SmProtocol.c 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. /*
  2. * CDE - Common Desktop Environment
  3. *
  4. * Copyright (c) 1993-2012, The Open Group. All rights reserved.
  5. *
  6. * These libraries and programs are free software; you can
  7. * redistribute them and/or modify them under the terms of the GNU
  8. * Lesser General Public License as published by the Free Software
  9. * Foundation; either version 2 of the License, or (at your option)
  10. * any later version.
  11. *
  12. * These libraries and programs are distributed in the hope that
  13. * they will be useful, but WITHOUT ANY WARRANTY; without even the
  14. * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  15. * PURPOSE. See the GNU Lesser General Public License for more
  16. * details.
  17. *
  18. * You should have received a copy of the GNU Lesser General Public
  19. * License along with these libraries and programs; if not, write
  20. * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
  21. * Floor, Boston, MA 02110-1301 USA
  22. */
  23. /* $TOG: SmProtocol.c /main/8 1998/08/05 13:38:17 samborn $ */
  24. /*************************************<+>*************************************
  25. *****************************************************************************
  26. **
  27. ** File: SmProtocol.c
  28. **
  29. ** Project: HP DT Session Manager (dtsession)
  30. **
  31. ** Description:
  32. ** -----------
  33. ** This file contains all modules that handle the initialization and
  34. ** interning of all atoms used by the session manager.
  35. **
  36. **
  37. *****************************************************************************
  38. *************************************<+>*************************************/
  39. /*
  40. * (c) Copyright 1996 Digital Equipment Corporation.
  41. * (c) Copyright 1990, 1993, 1994, 1996 Hewlett-Packard Company
  42. * (c) Copyright 1993, 1994, 1996 International Business Machines Corp.
  43. * (c) Copyright 1993, 1994, 1996 Sun Microsystems, Inc.
  44. * (c) Copyright 1993, 1994, 1996 Novell, Inc.
  45. * (c) Copyright 1996 FUJITSU LIMITED.
  46. * (c) Copyright 1996 Hitachi.
  47. */
  48. #include <stdio.h>
  49. #include <X11/Intrinsic.h>
  50. #include <X11/Xatom.h>
  51. #include <Dt/Wsm.h>
  52. #include <Dt/WsmP.h>
  53. #include <Dt/Connect.h>
  54. #include <Dt/SessionM.h>
  55. #include <Dt/SessionP.h>
  56. #include "Sm.h"
  57. #include "SmProtocol.h"
  58. /*
  59. * Global variable definitions
  60. */
  61. Atom XaWmProtocols;
  62. Atom XaWmSaveYourself;
  63. Atom XaWmState;
  64. Atom XaWmDtHints;
  65. Atom XaSmSaveMode;
  66. Atom XaSmRestoreMode;
  67. Atom XaSmRestoreDir;
  68. Atom XaSmStartAckWindow;
  69. Atom XaSmStopAckWindow;
  70. Atom XaWmWindowAck;
  71. Atom XaWmExitSession;
  72. Atom XaWmLockDisplay;
  73. Atom XaWmReady;
  74. Atom XaSmWmProtocol;
  75. Atom XaVsmInfo;
  76. Atom XaDtSmStmProtocol;
  77. Atom XaDtSmSaveToHome;
  78. Atom XaDtSmStateChange;
  79. Atom XaDtSmRestoreDefault;
  80. Atom XaDtSmLockChange;
  81. Atom XaDtSmStateInfo;
  82. Atom XaDtSmSaverInfo;
  83. Atom XaDtSmScreenInfo;
  84. Atom XaDtSmAudioInfo;
  85. Atom XaDtSmKeyboardInfo;
  86. Atom XaDtSmFontInfo;
  87. Atom XaDtSmPointerInfo;
  88. Atom XaSmScreenSaveRet;
  89. Atom XaDtSmPreeditInfo;
  90. /*************************************<->*************************************
  91. *
  92. * InitProtocol ()
  93. *
  94. *
  95. * Description:
  96. * -----------
  97. * Handles interning of atoms used by the session manager. All should
  98. * already exist because the session manager is a toolkit application.
  99. * Also handles setting of selection mechanism used by session manager to
  100. * distribute unique file names.
  101. *
  102. *
  103. * Inputs:
  104. * ------
  105. *
  106. *
  107. * Outputs:
  108. * -------
  109. *
  110. *
  111. * Comments:
  112. * --------
  113. *
  114. *************************************<->***********************************/
  115. void
  116. InitProtocol( void )
  117. {
  118. enum { XA_WM_PROTOCOLS, XA_WM_SAVE_YOURSELF,
  119. XA_DT_SAVE_MODE, XA_WM_STATE,
  120. XA_DT_SM_STM_PROTOCOL, XA_DT_SM_SAVE_TO_HOME,
  121. XA_DT_SM_STATE_CHANGE, XA_DT_SM_RESTORE_DEFAULT,
  122. XA_DT_SM_LOCK_CHANGE, XA_DT_SM_SCREEN_INFO,
  123. XA_DT_SM_STATE_INFO, XA_DT_SM_SAVER_INFO,
  124. XA_DT_SM_AUDIO_INFO, XA_DT_SM_KEYBOARD_INFO,
  125. XA_DT_SM_FONT_INFO, XA_DT_SM_POINTER_INFO,
  126. XA_DT_SM_PREEDIT_INFO, NUM_ATOMS };
  127. static char *atom_names[] = { _XA_WM_PROTOCOLS, _XA_WM_SAVE_YOURSELF,
  128. _XA_DT_SAVE_MODE, _XA_WM_STATE,
  129. _XA_DT_SM_STM_PROTOCOL, _XA_DT_SM_SAVE_TO_HOME,
  130. _XA_DT_SM_STATE_CHANGE, _XA_DT_SM_RESTORE_DEFAULT,
  131. _XA_DT_SM_LOCK_CHANGE, _XA_DT_SM_SCREEN_INFO,
  132. _XA_DT_SM_STATE_INFO, _XA_DT_SM_SAVER_INFO,
  133. _XA_DT_SM_AUDIO_INFO, _XA_DT_SM_KEYBOARD_INFO,
  134. _XA_DT_SM_FONT_INFO, _XA_DT_SM_POINTER_INFO,
  135. _XA_DT_SM_PREEDIT_INFO };
  136. Atom atoms[XtNumber(atom_names)];
  137. XInternAtoms(smGD.display, atom_names, XtNumber(atom_names), False, atoms);
  138. XaWmProtocols = atoms[XA_WM_PROTOCOLS];
  139. XaWmSaveYourself = atoms[XA_WM_SAVE_YOURSELF];
  140. XaSmSaveMode = atoms[XA_DT_SAVE_MODE];
  141. XaWmState = atoms[XA_WM_STATE];
  142. XaDtSmStmProtocol = atoms[XA_DT_SM_STM_PROTOCOL];
  143. XaDtSmSaveToHome = atoms[XA_DT_SM_SAVE_TO_HOME];
  144. XaDtSmStateChange = atoms[XA_DT_SM_STATE_CHANGE];
  145. XaDtSmRestoreDefault = atoms[XA_DT_SM_RESTORE_DEFAULT];
  146. XaDtSmLockChange = atoms[XA_DT_SM_LOCK_CHANGE];
  147. XaDtSmScreenInfo = atoms[XA_DT_SM_SCREEN_INFO];
  148. XaDtSmStateInfo = atoms[XA_DT_SM_STATE_INFO];
  149. XaDtSmSaverInfo = atoms[XA_DT_SM_SAVER_INFO];
  150. XaDtSmAudioInfo = atoms[XA_DT_SM_AUDIO_INFO];
  151. XaDtSmKeyboardInfo = atoms[XA_DT_SM_KEYBOARD_INFO];
  152. XaDtSmFontInfo = atoms[XA_DT_SM_FONT_INFO];
  153. XaDtSmPointerInfo = atoms[XA_DT_SM_POINTER_INFO];
  154. XaDtSmPreeditInfo = atoms[XA_DT_SM_PREEDIT_INFO];
  155. }