xsm.h 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240
  1. /* $Xorg: xsm.h,v 1.4 2001/02/09 02:06:01 xorgcvs Exp $ */
  2. /* $XdotOrg: $ */
  3. /******************************************************************************
  4. Copyright 1993, 1998 The Open Group
  5. Permission to use, copy, modify, distribute, and sell this software and its
  6. documentation for any purpose is hereby granted without fee, provided that
  7. the above copyright notice appear in all copies and that both that
  8. copyright notice and this permission notice appear in supporting
  9. documentation.
  10. The above copyright notice and this permission notice shall be included in
  11. all copies or substantial portions of the Software.
  12. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  13. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  14. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  15. OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
  16. AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  17. CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  18. Except as contained in this notice, the name of The Open Group shall not be
  19. used in advertising or otherwise to promote the sale, use or other dealings
  20. in this Software without prior written authorization from The Open Group.
  21. ******************************************************************************/
  22. /* $XFree86: xc/programs/xsm/xsm.h,v 1.7 2001/12/08 18:33:45 herrb Exp $ */
  23. #ifndef _XSM_H_
  24. #define _XSM_H_
  25. #ifdef HAVE_CONFIG_H
  26. # include "config.h"
  27. #endif
  28. #include <X11/Xos.h>
  29. #include <X11/Xfuncs.h>
  30. #ifndef X_NOT_POSIX
  31. #ifdef _POSIX_SOURCE
  32. #include <limits.h>
  33. #else
  34. #define _POSIX_SOURCE
  35. #include <limits.h>
  36. #undef _POSIX_SOURCE
  37. #endif
  38. #endif /* X_NOT_POSIX */
  39. #ifndef PATH_MAX
  40. #include <sys/param.h>
  41. #ifndef PATH_MAX
  42. #ifdef MAXPATHLEN
  43. #define PATH_MAX MAXPATHLEN
  44. #else
  45. #define PATH_MAX 1024
  46. #endif
  47. #endif
  48. #endif /* PATH_MAX */
  49. #ifndef _POSIX_SOURCE
  50. #define _POSIX_SOURCE
  51. #include <stdio.h>
  52. #undef _POSIX_SOURCE
  53. #else
  54. #include <stdio.h>
  55. #endif
  56. #include <ctype.h>
  57. #include <stdlib.h>
  58. #include <X11/StringDefs.h>
  59. #include <X11/Intrinsic.h>
  60. #include <X11/ICE/ICEutil.h>
  61. #include <X11/SM/SMlib.h>
  62. #include "list.h"
  63. /*
  64. * Each time the format of the sm's save file changes, bump up
  65. * the version.
  66. */
  67. #define SAVEFILE_VERSION 3
  68. #define DEFAULT_SESSION_NAME "Default"
  69. #define FAILSAFE_SESSION_NAME "Fail Safe"
  70. #define RESTART_MANAGERS 1
  71. #define RESTART_REST_OF_CLIENTS 2
  72. typedef struct _ClientRec {
  73. SmsConn smsConn;
  74. IceConn ice_conn;
  75. char *clientId;
  76. char *clientHostname;
  77. List *props;
  78. char *discardCommand;
  79. char *saveDiscardCommand;
  80. unsigned int restarted : 1;
  81. unsigned int userIssuedCheckpoint : 1;
  82. unsigned int restartHint : 2;
  83. unsigned int receivedDiscardCommand : 1;
  84. unsigned int freeAfterBadSavePopup : 1;
  85. } ClientRec;
  86. typedef struct _PendingClient {
  87. char *clientId;
  88. char *clientHostname;
  89. List *props;
  90. } PendingClient;
  91. typedef struct _Prop {
  92. char *name;
  93. char *type;
  94. List *values;
  95. } Prop;
  96. typedef struct _PropValue {
  97. XtPointer value;
  98. int length;
  99. } PropValue;
  100. extern char **environ;
  101. extern int Argc;
  102. extern char **Argv;
  103. extern char *display_env, *non_local_display_env;
  104. extern char *session_env, *non_local_session_env;
  105. extern char *audio_env;
  106. extern Bool need_to_name_session;
  107. extern Bool remote_allowed;
  108. extern Bool verbose;
  109. extern char *sm_id;
  110. extern char *networkIds;
  111. extern char *session_name;
  112. extern IceAuthDataEntry *authDataEntries;
  113. extern int numTransports;
  114. extern List *RunningList;
  115. extern List *PendingList;
  116. extern List *RestartAnywayList;
  117. extern List *RestartImmedList;
  118. extern List *WaitForSaveDoneList;
  119. extern List *FailedSaveList;
  120. extern List *WaitForInteractList;
  121. extern List *WaitForPhase2List;
  122. extern Bool client_info_visible;
  123. extern Bool client_prop_visible;
  124. extern Bool client_log_visible;
  125. extern String *clientListNames;
  126. extern ClientRec **clientListRecs;
  127. extern int numClientListNames;
  128. extern int current_client_selected;
  129. extern Bool shutdownInProgress;
  130. extern Bool phase2InProgress;
  131. extern Bool saveInProgress;
  132. extern Bool shutdownCancelled;
  133. extern Bool wantShutdown;
  134. extern int sessionNameCount;
  135. extern String *sessionNamesShort;
  136. extern String *sessionNamesLong;
  137. extern Bool *sessionsLocked;
  138. extern int num_clients_in_last_session;
  139. extern char **non_session_aware_clients;
  140. extern int non_session_aware_count;
  141. extern XtAppContext appContext;
  142. extern Widget topLevel;
  143. extern Widget mainWindow;
  144. extern Widget clientInfoButton;
  145. extern Widget logButton;
  146. extern Widget checkPointButton;
  147. extern Widget shutdownButton;
  148. extern Widget shutdownDontSave;
  149. extern XtSignalId sig_term_id, sig_usr1_id;
  150. extern void fprintfhex(FILE *fp, unsigned int len, char *cp);
  151. extern Status StartSession(char *name, Bool use_default);
  152. extern void EndSession(int status);
  153. extern void SetWM_DELETE_WINDOW(Widget widget, const _XtString delAction);
  154. extern void SetAllSensitive(Bool on);
  155. extern void FreeClient(ClientRec *client, Bool freeProps);
  156. extern void CloseDownClient(ClientRec *client);
  157. /* misc.c */
  158. extern int strbw(const char *a, const char *b);
  159. extern void nomem(void);
  160. #define Strstr strstr
  161. #if defined(sun) && defined(SVR4)
  162. extern int System(char *s);
  163. #define system(s) System(s)
  164. #endif
  165. /* remote.c */
  166. extern void remote_start(const char *restart_protocol,
  167. const char *restart_machine,
  168. const char *program, char **args,
  169. const char *cwd, char **env,
  170. const char *non_local_display_env,
  171. const char *non_local_session_env );
  172. /* signals.c */
  173. extern void sig_child_handler(int sig);
  174. extern void sig_term_handler(int sig);
  175. extern void sig_usr1_handler(int sig);
  176. extern void xt_sig_term_handler(XtPointer closure, XtSignalId *id);
  177. extern void xt_sig_usr1_handler(XtPointer closure, XtSignalId *id);
  178. extern void register_signals(XtAppContext);
  179. extern int execute_system_command(char *s);
  180. extern int checkpoint_from_signal;
  181. #ifdef XKB
  182. #include <X11/extensions/XKBbells.h>
  183. #endif
  184. #endif /* _XSM_H_ */