Add GNU LGPL headers to all .c .C and .h files
[oweals/cde.git] / cde / lib / DtSvc / DtUtil1 / SetVWmHint.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 librararies 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 /*
24  * (c) Copyright 1993, 1994 International Business Machines Corp.       *
25  * (c) Copyright 1993, 1994 Sun Microsystems, Inc.                      *
26  * (c) Copyright 1993, 1994 Novell, Inc.                                *
27  */
28 /************************************<+>*************************************
29  ****************************************************************************
30  **
31  **   File:     SetVWmHint.c
32  **
33  **   RCS:      $XConsortium: SetVWmHint.c /main/4 1995/10/26 15:11:34 rswiston $
34  **
35  **   Project:  DT Workspace Manager
36  **
37  **   Description: Set Dt Wm hints.
38  **
39  **   (c) Copyright 1991, 1993, 1994 by Hewlett-Packard Company
40  **
41  ****************************************************************************
42  ************************************<+>*************************************/
43 #include <stdio.h>
44 #include <X11/Xlib.h>
45 #include <X11/Xutil.h>
46 #include <Dt/Wsm.h> 
47 #include <Dt/WsmP.h> 
48 #include <Xm/Xm.h>
49 #include <Xm/AtomMgr.h>
50
51
52 /*************************************<->*************************************
53  *
54  *  _DtWsmSetDtWmHints (display, window, pHints)
55  *
56  *
57  *  Description:
58  *  -----------
59  *  Set the contents of the _DT_WM_HINTS property on a window
60  *
61  *
62  *  Inputs:
63  *  ------
64  *  display     - display 
65  *  window      - window to set hints on
66  *  pHints      - pointer the hints to set
67  *
68  *  Comments:
69  *  ---------
70  *  No error checking
71  * 
72  *************************************<->***********************************/
73 void 
74 _DtWsmSetDtWmHints(
75         Display *display,
76         Window window,
77         DtWmHints *pHints)
78 {
79     Atom property;
80     DtWmHints vh;
81
82     property = XmInternAtom (display, _XA_DT_WM_HINTS, False);
83
84     /*
85      * Copy hints to make sure we have one of the right size.
86      * This is for backward compatibility.
87      */
88     vh.flags = pHints->flags;
89
90     if (pHints->flags & DtWM_HINTS_FUNCTIONS) {
91         vh.functions = pHints->functions;
92     } else {
93         vh.functions = 0L;
94     }
95   
96     if (pHints->flags & DtWM_HINTS_BEHAVIORS) {
97         vh.behaviors = pHints->behaviors;
98     } else {
99         vh.behaviors = 0L;
100     }
101
102     if (pHints->flags & DtWM_HINTS_ATTACH_WINDOW) {
103         vh.attachWindow = pHints->attachWindow;
104     } else {
105         vh.attachWindow = None;
106     }
107
108     XChangeProperty (
109                 display, 
110                 window, 
111                 property,
112                 property, 
113                 32, 
114                 PropModeReplace, 
115                 (unsigned char *)&vh, 
116                 (sizeof (DtWmHints)/sizeof (long)));
117 }