2 * CDE - Common Desktop Environment
4 * Copyright (c) 1993-2012, The Open Group. All rights reserved.
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)
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
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with these librararies and programs; if not, write
20 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21 * Floor, Boston, MA 02110-1301 USA
23 /* $XConsortium: Sm.h /main/15 1996/09/14 14:48:18 drk $ */
24 /*************************************<+>*************************************
25 *****************************************************************************
29 ** Project: HP DT Session Manager (dtsession)
33 ** Contains all general, global variables used by the session manager
37 *****************************************************************************
38 *************************************<+>*************************************/
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.
57 #include <sys/param.h>
60 #include <Dt/UserMsg.h>
68 #define HELPVIEW_COMMAND_LINE CDE_INSTALLATION_TOP "/bin/dthelpview -helpVolume Dtintro"
72 * Wrappers for system calls
74 #define SM_MALLOC(SIZE) XtMalloc(SIZE)
75 #define SM_REALLOC(PTR, SIZE) XtRealloc(PTR, SIZE)
76 #define SM_FREE(PTR) XtFree(PTR)
77 #define SM_EXIT(STATUS) SmExit(STATUS)
80 #define SM_SETEUID(EUID) setresuid(-1, EUID, -1)
81 #define SM_SETESUID(UID) setresuid(-1, UID, UID)
84 #define SM_SETEUID(EUID) seteuid(EUID)
85 #define SM_SETESUID(UID) setreuid(UID, UID)
87 #define SM_SETEUID(EUID) seteuid(EUID)
88 #define SM_SETESUID(UID) (setuid(UID), seteuid(UID))
93 * Types of states the session manager can be in
99 * session types .. home or current or default
101 #define DEFAULT_SESSION 0
102 #define HOME_SESSION 1
103 #define CURRENT_SESSION 2
106 * The lower bounds for each resolution of display - caculated
107 * as Y Resolution - which is pixels/meter
109 #define HIGH_RES_Y_RES 3583
110 #define MED_RES_Y_RES 3150
111 #define LOW_RES_Y_RES 1
114 * Maximum number of screens saved during a session
116 #define MAX_SCREENS_SAVED 10
118 /* contention management definitions */
119 #define SM_CM_SYSTEM (1L << 0)
120 #define SM_CM_HANDSHAKE (1L << 1)
122 #define SM_CM_ALL (SM_CM_SYSTEM | SM_CM_HANDSHAKE)
125 #define SM_CM_DEFAULT SM_CM_NONE
127 #ifndef NO_MESSAGE_CATALOG
129 # define _CLIENT_CAT_NAME "dtsession.cat"
130 # else /* __ultrix */
131 # define _CLIENT_CAT_NAME "dtsession"
132 # endif /* __ultrix */
133 extern char *_DtGetMessage(char *filename, int set, int n, char *s);
134 # define GETMESSAGE(set, number, string)\
135 (_DtGetMessage(_CLIENT_CAT_NAME, set, number, string))
137 # define GETMESSAGE(set, number, string)\
141 typedef int (*IOErrorHandlerProc)(
150 * Pointer to hold information returned by session settings
154 int accelNum; /* Pointer Control Information */
158 int timeout; /*Screen Saver Information */
163 char *fontDirs; /*Font path Information */
165 XKeyboardState kbdState; /* Keyboard Control Information */
168 char *buttonMap; /*Button Mapping Information */
170 int numKeyCode; /*Key Mapping information */
174 int maxKeyPerMod; /*Modifier Mapping Information */
177 Boolean didQuery; /*Was this information queried for*/
181 } SessionSettings, *SessionSettingsPtr;
184 * Structure to save all of the session manager resources
189 Boolean querySettings;
193 char *sessionVersion;
194 int displayResolution;
197 int waitClientTimeout;
200 Boolean saveFontPath;
201 int saveYourselfTimeout;
202 Boolean mergeXdefaults;
203 int numSessionsBackedup;
204 char *ignoreEnvironment;
205 } SessionResources, *SessionResourcesPtr;
208 * Screen saver resources.
217 } SaverResources, *SaverResourcesPtr;
220 * Structure to hold global state settings
225 Boolean pointerChange;
226 Boolean pointerMapChange;
229 Boolean keyboardChange;
230 Boolean screenSavChange;
237 Boolean pointerChange;
238 Boolean keyboardChange;
239 Boolean screenSavChange;
240 Boolean dClickChange;
242 Boolean preeditChange;
247 * Structure to hold general information needed to be shared by
248 * different modules in the session manager
254 Window topLevelWindow;
256 char *programName; /* main()'s argv[0] */
262 unsigned long blackPixel;
263 unsigned long whitePixel;
264 unsigned long foregroundPix;
265 unsigned long backgroundPix;
266 Cursor lockCursor, padlockCursor, blankCursor;
268 char resourcePath[MAXPATHLEN + 1];
269 char settingPath[MAXPATHLEN + 1];
270 char clientPath[MAXPATHLEN + 1];
271 char fontPath[MAXPATHLEN + 1];
272 char exitPath[MAXPATHLEN + 1];
273 char etcPath[MAXPATHLEN + 1]; /*
274 * Used for sessionEtc on
277 * current.old on the way
281 char *restoreSession;
284 Tt_pattern requests2Handle;
285 Tt_pattern events2Watch;
287 Boolean lockOnTimeoutStatus;
288 gid_t runningGID, conMgmtGID;
289 uid_t runningUID, unLockUID;
290 Boolean secureSystem;
291 Boolean screenSaver; /* obsolete */
292 Boolean screenSaverRunning; /* obsolete */
293 Boolean userSetWaitWmTimeout;
294 int savedWaitWmTimeout;
296 * These strings are for our copy once we
297 * fetch resources with XtGetApplicationResources.
298 * These string returned can be overwritten anytime
299 * another Xrm call is made as in MergeCoeResources (libXv3.0)
300 * or in our own calls to XrmGetFileDatabase.
304 * This set is the for smRes
308 char *sessionVersion;
312 * This set is the for smSettings
314 char *fontDirs; /*Font path Information */
316 char *buttonMap; /*Button Mapping Information */
320 char *saverList; /* Current screen saver list */
321 void *saverListParse; /* Current parsed screen saver list */
323 Boolean coverScreen; /* full screen cover */
324 char *SmNextension; /* screen saver extension name */
325 char *SmCextension; /* screen saver extension class */
326 char *extensionSpec; /* sprintf specification */
327 #if defined (USE_X11SSEXT)
328 int ssEventType; /* screen saver event type */
329 #endif /* USE_X11SSEXT */
330 struct sigaction childvec;
331 struct sigaction defvec;
333 Boolean homeSave; /* True if the save is via the Style
334 Manager's Save Home Session button. */
335 Boolean displaySpecific; /* Is Ture if the session is for a
336 specific display, otherwise False */
337 Boolean loggingOut; /* Is True if the current save is for
338 a logout; False otherwise. */
340 Boolean ExitComplete; /* JET - don't exit before we are ready... */
348 extern char *_dtsessionMG();
351 * Files that the session manager saves sessions to and restores sessions
352 * from. allocated in SmStrDef.c
354 extern char SM_CLIENT_FILE[];
355 extern char SM_CLIENT_FILE2[];
356 extern char SM_RESOURCE_FILE[];
357 extern char SM_FONT_FILE[];
358 extern char SM_LOW_RES_EXT[];
359 extern char SM_MED_RES_EXT[];
360 extern char SM_HIGH_RES_EXT[];
361 extern char SM_SETTING_FILE[];
362 extern char SM_CONVERSION_FILE[];
363 extern char SM_SYSTEM_CLIENT_FILE[];
364 extern char SM_SYSTEM_RESOURCE_FILE[];
365 extern char SM_SYSTEM_FONT_FILE[];
367 extern char SM_SYSTEM_PATH[];
368 extern char SM_SECURE_PATH[];
370 extern char SM_CURRENT_DIRECTORY[];
371 extern char SM_CURRENT_FONT_DIRECTORY[];
372 extern char SM_HOME_DIRECTORY[];
373 extern char SM_HOME_FONT_DIRECTORY[];
374 extern char SM_OLD_EXTENSION[];
375 extern char SM_SYSTEM_DIRECTORY[];
376 extern char smEtcFile[];
377 extern char smExitFile[];
380 * Session manager name and class used to get resources allocated in SmStrDef.c
382 extern char SM_RESOURCE_CLASS[];
383 extern char SM_RESOURCE_NAME[];
384 extern char SM_HELP_VOLUME[];
388 * Name of the lock the session manager has to make sure it's the only
389 * session manager running
391 extern char SM_RUNNING_LOCK[];
394 * Location and name of the screen saver program
396 extern char SM_SCREEN_SAVER_LOC[];
397 extern char SM_SCREEN_SAVER_NAME[];
400 * Global resource settings. These settings determine program behavior
401 * wrt settings restoration, lock behavior, window manager startup etc
403 extern SessionResources smRes;
404 extern SaverResources smSaverRes;
405 extern SettingsSet smToSet;
406 extern SettingsCust smCust;
407 extern SessionSettings smSettings;
408 extern GeneralData smGD;