1 /* $XConsortium: SmProperty.c /main/7 1996/02/08 11:27:32 barstow $ */
3 * (c) Copyright 1993, 1994 Hewlett-Packard Company *
4 * (c) Copyright 1993, 1994 International Business Machines Corp. *
5 * (c) Copyright 1993, 1994 Sun Microsystems, Inc. *
6 * (c) Copyright 1993, 1994 Novell, Inc. *
8 /*************************************<+>*************************************
9 *****************************************************************************
13 ** Project: HP DT Session Manager (dtsession)
17 ** This file contains routines that deal with the properties used by the
18 ** session manager to save and restore client information.
22 *******************************************************************
23 ** (c) Copyright Hewlett-Packard Company, 1990. All rights are
24 ** reserved. Copying or other reproduction of this program
25 ** except for archival purposes is prohibited without prior
26 ** written consent of Hewlett-Packard Company.
27 ********************************************************************
31 *****************************************************************************
32 *************************************<+>*************************************/
35 #include <X11/Intrinsic.h>
36 #include <X11/Xutil.h>
37 #include <X11/Xatom.h>
39 #include "SmProtocol.h"
43 /*************************************<->*************************************
45 * GetStandardProperties -
48 * Description: returns information about the specified window
53 * window = window for which we are getting properties
57 * argv = data returned from WM_COMMAND property (to restart client)
58 * argc = number of arguments returned from WM_COMMAND property
59 * clientMachine = which machine is client running on
60 * xsmpClient = True if the client is XSMP and False otherwise
61 * screen = window's screen number
65 * All X (except GetWMHints) were not available until R4 and therefore have
66 * R4 or greater dependencies.
68 * BEWARE OF THESE ROUTINES: The XGetWindowProperty routine returns 0 if
69 * it succeeds. These routines (which were derived from XGetWindowProperty
70 * return 0 if they FAIL.
72 *************************************<->***********************************/
73 Status GetStandardProperties(
76 int *argc, /* RETURNED */
77 char ***argv, /* RETURNED */
78 char **clientMachine, /* RETURNED */
79 Boolean *xsmpClient) /* RETURNED */
83 XTextProperty sessProp;
86 unsigned long bytesAfter;
88 unsigned char *data = NULL;
91 * If this client is participating in the XSMP, then don't save
92 * it as a proxy (pre-XSMP) client. However, do cache its
93 * screen number before returning.
95 if (XGetWindowProperty(smGD.display, window, XaSmClientId, 0L,
96 (long) BUFSIZ, False, XA_STRING, &actType,
97 &actFormat, &nitems, &bytesAfter, &data) == Success)
99 if (data && actType == XA_STRING)
101 ClientRecPtr pClient;
103 for (pClient = connectedList; pClient != NULL;
104 pClient = pClient->next) {
105 if (!strcmp ((char *) data, pClient->clientId)) {
106 pClient->screenNum = screen;
111 SM_FREE ((char *) data);
114 SM_FREE ((char *) data);
119 * Get WM_COMMAND property
121 if ((cc=XGetCommand(smGD.display,window,argv,argc))==0)
125 * If there is no argc or argv - don't bother going on. We're not
126 * going to save anything anyway
133 * Get WM_CLIENT_MACHINE property
135 if ((cc=XGetWMClientMachine(smGD.display,window,&sessProp))==0)
137 *clientMachine = NULL;
141 *clientMachine = (char *) sessProp.value;