123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272 |
- /*
- * CDE - Common Desktop Environment
- *
- * Copyright (c) 1993-2012, The Open Group. All rights reserved.
- *
- * These libraries and programs are free software; you can
- * redistribute them and/or modify them under the terms of the GNU
- * Lesser General Public License as published by the Free Software
- * Foundation; either version 2 of the License, or (at your option)
- * any later version.
- *
- * These libraries and programs are distributed in the hope that
- * they will be useful, but WITHOUT ANY WARRANTY; without even the
- * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU Lesser General Public License for more
- * details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with these libraries and programs; if not, write
- * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
- * Floor, Boston, MA 02110-1301 USA
- */
- /*
- * (c) Copyright 1993, 1994 International Business Machines Corp. *
- * (c) Copyright 1993, 1994 Sun Microsystems, Inc. *
- * (c) Copyright 1993, 1994 Novell, Inc. *
- */
- /************************************<+>*************************************
- ****************************************************************************
- **
- ** File: WmRmWsFcn.c
- **
- ** RCS: $XConsortium: WmRmWsFcn.c /main/5 1996/06/21 17:24:22 ageorge $
- ** Project: HP DT Workspace Manager
- **
- ** Description: Remove the Workspace functions on a client
- **
- ** (c) Copyright 1991, 1993, 1994 by Hewlett-Packard Company
- **
- ****************************************************************************
- ************************************<+>*************************************/
- #include <X11/Xlib.h>
- #include <X11/Xutil.h>
- #include <X11/Xatom.h>
- #include <Dt/Wsm.h>
- #include <Dt/WsmP.h>
- #include <Xm/AtomMgr.h>
- #include "DtSvcLock.h"
- /*************************************<->*************************************
- *
- * DtWsmRemoveWorkspaceFunctions (display, client)
- *
- *
- * Description:
- * -----------
- * Request the window manager to disallow workspace functions
- * for this client.
- *
- *
- * Inputs:
- * ------
- * display - display
- * root - root window of screen
- *
- * Returns:
- * --------
- * none
- *
- *
- * Comments:
- * ---------
- * Disables f.workspace_presence, f.remove, f.occupy_all for this
- * client.
- *
- *************************************<->***********************************/
- void
- DtWsmRemoveWorkspaceFunctions (Display *display, Window client)
- {
- DtWmHints vHints, *pHints;
- long functions;
- Boolean bSetHints = False;
- _DtSvcDisplayToAppContext(display);
- _DtSvcAppLock(app);
- if (_DtWsmGetDtWmHints (display, client, &pHints) != Success)
- {
- /*
- * There were no existing workspace hints, so we'll
- * just use our own variable
- */
- pHints = &vHints;
- pHints->flags = 0;
- }
- if (pHints->flags & DtWM_HINTS_FUNCTIONS)
- {
- functions = pHints->functions &
- (DtWM_FUNCTION_OCCUPY_WS | DtWM_FUNCTION_ALL);
-
- if (functions & DtWM_FUNCTION_ALL)
- {
- /*
- * The flags are a list of functions to remove. If
- * the workspace functions aren't on this list, make
- * sure that it's put there.
- */
- if (!(functions & DtWM_FUNCTION_OCCUPY_WS))
- {
- /* remove workspace functions */
- pHints->functions |= DtWM_FUNCTION_OCCUPY_WS;
- bSetHints = True;
- }
- }
- else
- {
- /*
- * The flags are a list of functions to add. If
- * the workspace functions are on the list, make
- * sure they get removed.
- */
- if (functions & DtWM_FUNCTION_OCCUPY_WS)
- {
- /* remove workspace functions */
- pHints->functions &= ~DtWM_FUNCTION_OCCUPY_WS;
- bSetHints = True;
- }
- }
- }
- else
- {
- /*
- * The hints didn't have workspace functions specified.
- * Set the flag and remove workspace functions.
- */
- pHints->flags |= DtWM_HINTS_FUNCTIONS;
- pHints->functions = DtWM_FUNCTION_OCCUPY_WS | DtWM_FUNCTION_ALL;
- bSetHints = True;
- }
- /*
- * If something needs to be changed, then change it.
- */
- if (bSetHints)
- _DtWsmSetDtWmHints (display, client, pHints);
- /*
- * If we read these hints off the window, then be sure to free
- * them.
- */
- if (pHints && (pHints != &vHints))
- {
- XFree ((char *)pHints);
- }
- _DtSvcAppUnlock(app);
- } /* END OF FUNCTION DtWsmRemoveWorkspaceFunctions */
- /*************************************<->*************************************
- *
- * DtWsmAddWorkspaceFunctions (display, client)
- *
- *
- * Description:
- * -----------
- * Request the window manager to allow workspace functions
- * for this client.
- *
- *
- * Inputs:
- * ------
- * display - display
- * root - root window of screen
- *
- * Returns:
- * --------
- * none
- *
- *
- * Comments:
- * ---------
- * Enables f.workspace_presence, f.remove, f.occupy_all for this
- * client.
- *
- *************************************<->***********************************/
- void
- DtWsmAddWorkspaceFunctions (Display *display, Window client)
- {
- DtWmHints vHints, *pHints;
- long functions;
- Boolean bSetHints = False;
- _DtSvcDisplayToAppContext(display);
- _DtSvcAppLock(app);
- if (_DtWsmGetDtWmHints (display, client, &pHints) != Success)
- {
- /*
- * There were no existing workspace hints, so we'll
- * just use our own variable
- */
- pHints = &vHints;
- pHints->flags = 0;
- }
- if (pHints->flags & DtWM_HINTS_FUNCTIONS)
- {
- functions = pHints->functions &
- (DtWM_FUNCTION_OCCUPY_WS | DtWM_FUNCTION_ALL);
-
- if (functions & DtWM_FUNCTION_ALL)
- {
- /*
- * The flags are a list of functions to remove. If
- * the workspace functions are on this list, make
- * sure that they're removed.
- */
- if (functions & DtWM_FUNCTION_OCCUPY_WS)
- {
- /* add workspace functions */
- pHints->functions &= ~DtWM_FUNCTION_OCCUPY_WS;
- bSetHints = True;
- }
- }
- else
- {
- /*
- * The flags are a list of functions to add. If
- * the workspace functions aren't on the list, make
- * sure they get added.
- */
- if (!(functions & DtWM_FUNCTION_OCCUPY_WS))
- {
- /* remove workspace functions */
- pHints->functions |= DtWM_FUNCTION_OCCUPY_WS;
- bSetHints = True;
- }
- }
- }
- else
- {
- /*
- * The hints didn't have workspace functions specified.
- * Set the flag and add workspace functions.
- */
- pHints->flags |= DtWM_HINTS_FUNCTIONS;
- pHints->functions = DtWM_FUNCTION_OCCUPY_WS;
- bSetHints = True;
- }
- /*
- * If something needs to be changed, then change it.
- */
- if (bSetHints)
- _DtWsmSetDtWmHints (display, client, pHints);
- /*
- * If we read these hints off the window, then be sure to free
- * them.
- */
- if (pHints && (pHints != &vHints))
- {
- XFree ((char *)pHints);
- }
- _DtSvcAppUnlock(app);
- } /* END OF FUNCTION DtWsmAddWorkspaceFunctions */
|