2 * (c) Copyright 1993, 1994 International Business Machines Corp. *
3 * (c) Copyright 1993, 1994 Sun Microsystems, Inc. *
4 * (c) Copyright 1993, 1994 Novell, Inc. *
6 /************************************<+>*************************************
7 ****************************************************************************
11 ** RCS: $XConsortium: WmRmWsFcn.c /main/5 1996/06/21 17:24:22 ageorge $
12 ** Project: HP DT Workspace Manager
14 ** Description: Remove the Workspace functions on a client
16 ** (c) Copyright 1991, 1993, 1994 by Hewlett-Packard Company
18 ****************************************************************************
19 ************************************<+>*************************************/
21 #include <X11/Xutil.h>
22 #include <X11/Xatom.h>
25 #include <Xm/AtomMgr.h>
26 #include "DtSvcLock.h"
29 /*************************************<->*************************************
31 * DtWsmRemoveWorkspaceFunctions (display, client)
36 * Request the window manager to disallow workspace functions
43 * root - root window of screen
52 * Disables f.workspace_presence, f.remove, f.occupy_all for this
55 *************************************<->***********************************/
57 DtWsmRemoveWorkspaceFunctions (Display *display, Window client)
59 DtWmHints vHints, *pHints;
61 Boolean bSetHints = False;
62 _DtSvcDisplayToAppContext(display);
66 if (_DtWsmGetDtWmHints (display, client, &pHints) != Success)
69 * There were no existing workspace hints, so we'll
70 * just use our own variable
76 if (pHints->flags & DtWM_HINTS_FUNCTIONS)
78 functions = pHints->functions &
79 (DtWM_FUNCTION_OCCUPY_WS | DtWM_FUNCTION_ALL);
81 if (functions & DtWM_FUNCTION_ALL)
84 * The flags are a list of functions to remove. If
85 * the workspace functions aren't on this list, make
86 * sure that it's put there.
88 if (!(functions & DtWM_FUNCTION_OCCUPY_WS))
90 /* remove workspace functions */
91 pHints->functions |= DtWM_FUNCTION_OCCUPY_WS;
98 * The flags are a list of functions to add. If
99 * the workspace functions are on the list, make
100 * sure they get removed.
102 if (functions & DtWM_FUNCTION_OCCUPY_WS)
104 /* remove workspace functions */
105 pHints->functions &= ~DtWM_FUNCTION_OCCUPY_WS;
113 * The hints didn't have workspace functions specified.
114 * Set the flag and remove workspace functions.
116 pHints->flags |= DtWM_HINTS_FUNCTIONS;
117 pHints->functions = DtWM_FUNCTION_OCCUPY_WS | DtWM_FUNCTION_ALL;
122 * If something needs to be changed, then change it.
125 _DtWsmSetDtWmHints (display, client, pHints);
128 * If we read these hints off the window, then be sure to free
131 if (pHints && (pHints != &vHints))
133 XFree ((char *)pHints);
136 _DtSvcAppUnlock(app);
137 } /* END OF FUNCTION DtWsmRemoveWorkspaceFunctions */
141 /*************************************<->*************************************
143 * DtWsmAddWorkspaceFunctions (display, client)
148 * Request the window manager to allow workspace functions
155 * root - root window of screen
164 * Enables f.workspace_presence, f.remove, f.occupy_all for this
167 *************************************<->***********************************/
169 DtWsmAddWorkspaceFunctions (Display *display, Window client)
171 DtWmHints vHints, *pHints;
173 Boolean bSetHints = False;
174 _DtSvcDisplayToAppContext(display);
178 if (_DtWsmGetDtWmHints (display, client, &pHints) != Success)
181 * There were no existing workspace hints, so we'll
182 * just use our own variable
188 if (pHints->flags & DtWM_HINTS_FUNCTIONS)
190 functions = pHints->functions &
191 (DtWM_FUNCTION_OCCUPY_WS | DtWM_FUNCTION_ALL);
193 if (functions & DtWM_FUNCTION_ALL)
196 * The flags are a list of functions to remove. If
197 * the workspace functions are on this list, make
198 * sure that they're removed.
200 if (functions & DtWM_FUNCTION_OCCUPY_WS)
202 /* add workspace functions */
203 pHints->functions &= ~DtWM_FUNCTION_OCCUPY_WS;
210 * The flags are a list of functions to add. If
211 * the workspace functions aren't on the list, make
212 * sure they get added.
214 if (!(functions & DtWM_FUNCTION_OCCUPY_WS))
216 /* remove workspace functions */
217 pHints->functions |= DtWM_FUNCTION_OCCUPY_WS;
225 * The hints didn't have workspace functions specified.
226 * Set the flag and add workspace functions.
228 pHints->flags |= DtWM_HINTS_FUNCTIONS;
229 pHints->functions = DtWM_FUNCTION_OCCUPY_WS;
234 * If something needs to be changed, then change it.
237 _DtWsmSetDtWmHints (display, client, pHints);
240 * If we read these hints off the window, then be sure to free
243 if (pHints && (pHints != &vHints))
245 XFree ((char *)pHints);
247 _DtSvcAppUnlock(app);
249 } /* END OF FUNCTION DtWsmAddWorkspaceFunctions */