90fab137f56139ee5a4fd05aa7b90872c0ddaf91
[oweals/cde.git] / SmProtocol.c
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
49 #include <stdio.h>
50 #include <X11/Intrinsic.h>
51 #include <X11/Xatom.h>
52 #include <Dt/Wsm.h>
53 #include <Dt/WsmP.h>
54 #include <Dt/Connect.h>
55 #include <Dt/SessionM.h>
56 #include <Dt/SessionP.h>
57 #include "Sm.h"
58 #include "SmProtocol.h"
59
60
61 /*
62  * Global variable definitions
63  */
64 Atom     XaWmProtocols;
65 Atom     XaWmSaveYourself;
66 Atom     XaWmState;
67 Atom     XaWmDtHints;
68 Atom     XaSmSaveMode;
69 Atom     XaSmRestoreMode;
70 Atom     XaSmRestoreDir;
71 Atom     XaSmStartAckWindow;
72 Atom     XaSmStopAckWindow;
73 Atom     XaWmWindowAck;
74 Atom     XaWmExitSession;
75 Atom     XaWmLockDisplay;
76 Atom     XaWmReady;
77 Atom     XaSmWmProtocol;
78 Atom     XaVsmInfo;
79 Atom     XaDtSmStmProtocol;
80 Atom     XaDtSmSaveToHome;
81 Atom     XaDtSmStateChange;
82 Atom     XaDtSmRestoreDefault;
83 Atom     XaDtSmLockChange;
84 Atom     XaDtSmStateInfo;
85 Atom     XaDtSmSaverInfo;
86 Atom     XaDtSmScreenInfo;
87 Atom     XaDtSmAudioInfo;
88 Atom     XaDtSmKeyboardInfo;
89 Atom     XaDtSmFontInfo;
90 Atom     XaDtSmPointerInfo;
91 Atom     XaSmScreenSaveRet;
92 Atom     XaDtSmPreeditInfo;
93
94 \f
95 /*************************************<->*************************************
96  *
97  *  InitProtocol ()
98  *
99  *
100  *  Description:
101  *  -----------
102  *  Handles interning of atoms used by the session manager.  All should
103  *  already exist because the session manager is a toolkit application.
104  *  Also handles setting of selection mechanism used by session manager to
105  *  distribute unique file names.
106  *
107  *
108  *  Inputs:
109  *  ------
110  *
111  * 
112  *  Outputs:
113  *  -------
114  *
115  *
116  *  Comments:
117  *  --------
118  * 
119  *************************************<->***********************************/
120 void 
121 InitProtocol( void )
122 {
123     enum { XA_WM_PROTOCOLS, XA_WM_SAVE_YOURSELF,
124            XA_DT_SAVE_MODE, XA_WM_STATE,
125            XA_DT_SM_STM_PROTOCOL, XA_DT_SM_SAVE_TO_HOME,
126            XA_DT_SM_STATE_CHANGE, XA_DT_SM_RESTORE_DEFAULT,
127            XA_DT_SM_LOCK_CHANGE, XA_DT_SM_SCREEN_INFO,
128            XA_DT_SM_STATE_INFO, XA_DT_SM_SAVER_INFO,
129            XA_DT_SM_AUDIO_INFO, XA_DT_SM_KEYBOARD_INFO,
130            XA_DT_SM_FONT_INFO, XA_DT_SM_POINTER_INFO,
131            XA_DT_SM_PREEDIT_INFO, NUM_ATOMS };
132     static char *atom_names[] = { _XA_WM_PROTOCOLS, _XA_WM_SAVE_YOURSELF,
133            _XA_DT_SAVE_MODE, _XA_WM_STATE,
134            _XA_DT_SM_STM_PROTOCOL, _XA_DT_SM_SAVE_TO_HOME,
135            _XA_DT_SM_STATE_CHANGE, _XA_DT_SM_RESTORE_DEFAULT,
136            _XA_DT_SM_LOCK_CHANGE, _XA_DT_SM_SCREEN_INFO,
137            _XA_DT_SM_STATE_INFO, _XA_DT_SM_SAVER_INFO,
138            _XA_DT_SM_AUDIO_INFO, _XA_DT_SM_KEYBOARD_INFO,
139            _XA_DT_SM_FONT_INFO, _XA_DT_SM_POINTER_INFO,
140            _XA_DT_SM_PREEDIT_INFO };
141
142     Atom atoms[XtNumber(atom_names)];
143
144     XInternAtoms(smGD.display, atom_names, XtNumber(atom_names), False, atoms);
145
146     XaWmProtocols = atoms[XA_WM_PROTOCOLS];
147     XaWmSaveYourself = atoms[XA_WM_SAVE_YOURSELF];
148     XaSmSaveMode = atoms[XA_DT_SAVE_MODE];
149     XaWmState = atoms[XA_WM_STATE];
150     XaDtSmStmProtocol = atoms[XA_DT_SM_STM_PROTOCOL];
151     XaDtSmSaveToHome = atoms[XA_DT_SM_SAVE_TO_HOME];
152     XaDtSmStateChange = atoms[XA_DT_SM_STATE_CHANGE];
153     XaDtSmRestoreDefault = atoms[XA_DT_SM_RESTORE_DEFAULT];
154     XaDtSmLockChange = atoms[XA_DT_SM_LOCK_CHANGE];
155     XaDtSmScreenInfo = atoms[XA_DT_SM_SCREEN_INFO];
156     XaDtSmStateInfo = atoms[XA_DT_SM_STATE_INFO];
157     XaDtSmSaverInfo = atoms[XA_DT_SM_SAVER_INFO];
158     XaDtSmAudioInfo = atoms[XA_DT_SM_AUDIO_INFO];
159     XaDtSmKeyboardInfo = atoms[XA_DT_SM_KEYBOARD_INFO];
160     XaDtSmFontInfo = atoms[XA_DT_SM_FONT_INFO];
161     XaDtSmPointerInfo = atoms[XA_DT_SM_POINTER_INFO];
162     XaDtSmPreeditInfo = atoms[XA_DT_SM_PREEDIT_INFO];
163 }
164