Sm.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422
  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. /* $XConsortium: Sm.h /main/15 1996/09/14 14:48:18 drk $ */
  24. /*************************************<+>*************************************
  25. *****************************************************************************
  26. **
  27. ** File: Sm.h
  28. **
  29. ** Project: HP DT Session Manager (dtsession)
  30. **
  31. ** Description:
  32. ** -----------
  33. ** Contains all general, global variables used by the session manager
  34. **
  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. #ifndef _sm_h
  49. #define _sm_h
  50. /*
  51. * #include statements
  52. */
  53. #include <signal.h>
  54. #include <sys/param.h>
  55. #include <X11/Xlib.h>
  56. #include <Dt/DtP.h>
  57. #include <Dt/UserMsg.h>
  58. #include <Tt/tt_c.h>
  59. #include "SmError.h"
  60. #ifdef USE_XINERAMA
  61. # include <DtXinerama.h>
  62. #endif
  63. /*
  64. * #define statements
  65. */
  66. #define HELPVIEW_COMMAND_LINE CDE_INSTALLATION_TOP "/bin/dthelpview -helpVolume Dtintro"
  67. /*
  68. * Wrappers for system calls
  69. */
  70. #define SM_MALLOC(SIZE) XtMalloc(SIZE)
  71. #define SM_REALLOC(PTR, SIZE) XtRealloc(PTR, SIZE)
  72. #define SM_FREE(PTR) XtFree(PTR)
  73. #define SM_EXIT(STATUS) SmExit(STATUS)
  74. #ifdef __hpux
  75. #define SM_SETEUID(EUID) setresuid(-1, EUID, -1)
  76. #define SM_SETESUID(UID) setresuid(-1, UID, UID)
  77. #else
  78. #ifndef SVR4
  79. #define SM_SETEUID(EUID) seteuid(EUID)
  80. #define SM_SETESUID(UID) setreuid(UID, UID)
  81. #else
  82. #define SM_SETEUID(EUID) seteuid(EUID)
  83. #define SM_SETESUID(UID) (setuid(UID), seteuid(UID))
  84. #endif
  85. #endif
  86. /*
  87. * Types of states the session manager can be in
  88. */
  89. #define READY 0
  90. #define IN_PROCESS 1
  91. /*
  92. * session types .. home or current or default
  93. */
  94. #define DEFAULT_SESSION 0
  95. #define HOME_SESSION 1
  96. #define CURRENT_SESSION 2
  97. /*
  98. * The lower bounds for each resolution of display - caculated
  99. * as Y Resolution - which is pixels/meter
  100. */
  101. #define HIGH_RES_Y_RES 3583
  102. #define MED_RES_Y_RES 3150
  103. #define LOW_RES_Y_RES 1
  104. /*
  105. * Maximum number of screens saved during a session
  106. */
  107. #define MAX_SCREENS_SAVED 10
  108. /* contention management definitions */
  109. #define SM_CM_SYSTEM (1L << 0)
  110. #define SM_CM_HANDSHAKE (1L << 1)
  111. #define SM_CM_ALL (SM_CM_SYSTEM | SM_CM_HANDSHAKE)
  112. #define SM_CM_NONE 0
  113. #define SM_CM_DEFAULT SM_CM_NONE
  114. #ifndef NO_MESSAGE_CATALOG
  115. # define _CLIENT_CAT_NAME "dtsession"
  116. extern char *_DtGetMessage(char *filename, int set, int n, char *s);
  117. # define GETMESSAGE(set, number, string)\
  118. (_DtGetMessage(_CLIENT_CAT_NAME, set, number, string))
  119. #else
  120. # define GETMESSAGE(set, number, string)\
  121. string
  122. #endif
  123. typedef int (*IOErrorHandlerProc)(
  124. Display *
  125. );
  126. /*
  127. * typedef statements
  128. */
  129. /*
  130. * Pointer to hold information returned by session settings
  131. */
  132. typedef struct
  133. {
  134. int accelNum; /* Pointer Control Information */
  135. int accelDenom;
  136. int threshold;
  137. int timeout; /*Screen Saver Information */
  138. int interval;
  139. int preferBlank;
  140. int allowExp;
  141. char *fontDirs; /*Font path Information */
  142. XKeyboardState kbdState; /* Keyboard Control Information */
  143. char *autoRepeats;
  144. char *buttonMap; /*Button Mapping Information */
  145. int numKeyCode; /*Key Mapping information */
  146. int keySymPerCode;
  147. char *keySyms;
  148. int maxKeyPerMod; /*Modifier Mapping Information */
  149. char *modSyms;
  150. Boolean didQuery; /*Was this information queried for*/
  151. int confirmMode;
  152. int startState;
  153. } SessionSettings, *SessionSettingsPtr;
  154. /*
  155. * Structure to save all of the session manager resources
  156. */
  157. typedef struct
  158. {
  159. char *wmStartup;
  160. Boolean querySettings;
  161. char *keyholders;
  162. int alarmTime;
  163. int memThreshold;
  164. char *sessionVersion;
  165. int displayResolution;
  166. char *sessionLang;
  167. long contManagement;
  168. int waitClientTimeout;
  169. int waitWmTimeout;
  170. Boolean useBMS;
  171. Boolean saveFontPath;
  172. int saveYourselfTimeout;
  173. Boolean mergeXdefaults;
  174. int numSessionsBackedup;
  175. char *ignoreEnvironment;
  176. #if defined(USE_XINERAMA)
  177. int xineramaPreferredScreen; /* prefered xinerama screen */
  178. #endif
  179. } SessionResources, *SessionResourcesPtr;
  180. /*
  181. * Screen saver resources.
  182. */
  183. typedef struct
  184. {
  185. int cycleTimeout;
  186. int saverTimeout;
  187. int lockTimeout;
  188. Boolean random;
  189. char *saverList;
  190. } SaverResources, *SaverResourcesPtr;
  191. /*
  192. * Structure to hold global state settings
  193. */
  194. typedef struct
  195. {
  196. Boolean audioChange;
  197. Boolean pointerChange;
  198. Boolean pointerMapChange;
  199. char pointerMap[5];
  200. int numButton;
  201. Boolean keyboardChange;
  202. Boolean screenSavChange;
  203. char dClickBuf[50];
  204. } SettingsSet;
  205. typedef struct
  206. {
  207. Boolean audioChange;
  208. Boolean pointerChange;
  209. Boolean keyboardChange;
  210. Boolean screenSavChange;
  211. Boolean dClickChange;
  212. Boolean fontChange;
  213. Boolean preeditChange;
  214. } SettingsCust;
  215. /*
  216. * Structure to hold general information needed to be shared by
  217. * different modules in the session manager
  218. */
  219. typedef struct
  220. {
  221. Display *display;
  222. Widget topLevelWid;
  223. Window topLevelWindow;
  224. XtAppContext appCon;
  225. char *programName; /* main()'s argv[0] */
  226. int numSavedScreens;
  227. int screen;
  228. int lockedState;
  229. int smState;
  230. short sessionType;
  231. unsigned long blackPixel;
  232. unsigned long whitePixel;
  233. unsigned long foregroundPix;
  234. unsigned long backgroundPix;
  235. Cursor lockCursor, padlockCursor, blankCursor;
  236. Cursor waitCursor;
  237. char resourcePath[MAXPATHLEN + 1];
  238. char settingPath[MAXPATHLEN + 1];
  239. char clientPath[MAXPATHLEN + 1];
  240. char fontPath[MAXPATHLEN + 1];
  241. char exitPath[MAXPATHLEN + 1];
  242. char etcPath[MAXPATHLEN + 1]; /*
  243. * Used for sessionEtc on
  244. * the way up and for
  245. * moving current to
  246. * current.old on the way
  247. * down
  248. */
  249. char *savePath;
  250. char *restoreSession;
  251. Boolean dtwmRunning;
  252. Boolean bmsDead;
  253. Tt_pattern requests2Handle;
  254. Tt_pattern events2Watch;
  255. Boolean compatMode;
  256. Boolean lockOnTimeoutStatus;
  257. gid_t runningGID, conMgmtGID;
  258. uid_t runningUID, unLockUID;
  259. Boolean secureSystem;
  260. Boolean screenSaver; /* obsolete */
  261. Boolean screenSaverRunning; /* obsolete */
  262. Boolean userSetWaitWmTimeout;
  263. int savedWaitWmTimeout;
  264. /*
  265. * These strings are for our copy once we
  266. * fetch resources with XtGetApplicationResources.
  267. * These string returned can be overwritten anytime
  268. * another Xrm call is made as in MergeCoeResources (libXv3.0)
  269. * or in our own calls to XrmGetFileDatabase.
  270. */
  271. /*
  272. * This set is the for smRes
  273. */
  274. char *wmStartup;
  275. char *keyholders;
  276. char *sessionVersion;
  277. char *sessionLang;
  278. /*
  279. * This set is the for smSettings
  280. */
  281. char *fontDirs; /*Font path Information */
  282. char *autoRepeats;
  283. char *buttonMap; /*Button Mapping Information */
  284. char *keySyms;
  285. char *modSyms;
  286. char *saverList; /* Current screen saver list */
  287. void *saverListParse; /* Current parsed screen saver list */
  288. Boolean coverScreen; /* full screen cover */
  289. char *SmNextension; /* screen saver extension name */
  290. char *SmCextension; /* screen saver extension class */
  291. char *extensionSpec; /* sprintf specification */
  292. #if defined (USE_X11SSEXT)
  293. int ssEventType; /* screen saver event type */
  294. #endif /* USE_X11SSEXT */
  295. struct sigaction childvec;
  296. struct sigaction defvec;
  297. Boolean homeSave; /* True if the save is via the Style
  298. Manager's Save Home Session button. */
  299. Boolean displaySpecific; /* Is Ture if the session is for a
  300. specific display, otherwise False */
  301. Boolean loggingOut; /* Is True if the current save is for
  302. a logout; False otherwise. */
  303. #ifdef USE_XINERAMA /* JET - Xinerama. Schwiing! */
  304. DtXineramaInfoPtr_t DtXineramaInfo;
  305. #endif
  306. Boolean ExitComplete; /* JET - don't exit before we are ready... */
  307. } GeneralData;
  308. /*
  309. * External variables
  310. */
  311. extern char *_dtsessionMG();
  312. /*
  313. * Files that the session manager saves sessions to and restores sessions
  314. * from. allocated in SmStrDef.c
  315. */
  316. extern char SM_CLIENT_FILE[];
  317. extern char SM_CLIENT_FILE2[];
  318. extern char SM_RESOURCE_FILE[];
  319. extern char SM_FONT_FILE[];
  320. extern char SM_LOW_RES_EXT[];
  321. extern char SM_MED_RES_EXT[];
  322. extern char SM_HIGH_RES_EXT[];
  323. extern char SM_SETTING_FILE[];
  324. extern char SM_CONVERSION_FILE[];
  325. extern char SM_SYSTEM_CLIENT_FILE[];
  326. extern char SM_SYSTEM_RESOURCE_FILE[];
  327. extern char SM_SYSTEM_FONT_FILE[];
  328. extern char SM_SYSTEM_PATH[];
  329. extern char SM_SECURE_PATH[];
  330. extern char SM_CURRENT_DIRECTORY[];
  331. extern char SM_CURRENT_FONT_DIRECTORY[];
  332. extern char SM_HOME_DIRECTORY[];
  333. extern char SM_HOME_FONT_DIRECTORY[];
  334. extern char SM_OLD_EXTENSION[];
  335. extern char SM_SYSTEM_DIRECTORY[];
  336. extern char smEtcFile[];
  337. extern char smExitFile[];
  338. /*
  339. * Session manager name and class used to get resources allocated in SmStrDef.c
  340. */
  341. extern char SM_RESOURCE_CLASS[];
  342. extern char SM_RESOURCE_NAME[];
  343. extern char SM_HELP_VOLUME[];
  344. /*
  345. * Name of the lock the session manager has to make sure it's the only
  346. * session manager running
  347. */
  348. extern char SM_RUNNING_LOCK[];
  349. /*
  350. * Location and name of the screen saver program
  351. */
  352. extern char SM_SCREEN_SAVER_LOC[];
  353. extern char SM_SCREEN_SAVER_NAME[];
  354. /*
  355. * Global resource settings. These settings determine program behavior
  356. * wrt settings restoration, lock behavior, window manager startup etc
  357. */
  358. extern SessionResources smRes;
  359. extern SaverResources smSaverRes;
  360. extern SettingsSet smToSet;
  361. extern SettingsCust smCust;
  362. extern SessionSettings smSettings;
  363. extern GeneralData smGD;
  364. /*
  365. * External Interface
  366. */
  367. #endif /* __sm_h*/