304.1.2
by Matthew Fuller
Run 'make indent' to reindent the world. |
1 |
/*
|
252.1.1
by Olaf 'Rhialto' Seibert
Look at some _MOTIF_WM_HINTS; proof of concept version. |
2 |
* [ ctwm ]
|
3 |
*
|
|
4 |
* Copyright 2014 Olaf Seibert
|
|
5 |
*
|
|
6 |
* Permission to use, copy, modify and distribute this software [ctwm]
|
|
7 |
* and its documentation for any purpose is hereby granted without fee,
|
|
8 |
* provided that the above copyright notice appear in all copies and
|
|
9 |
* that both that copyright notice and this permission notice appear in
|
|
10 |
* supporting documentation, and that the name of Olaf Seibert not be
|
|
11 |
* used in advertising or publicity pertaining to distribution of the
|
|
12 |
* software without specific, written prior permission. Olaf Seibert
|
|
13 |
* makes no representations about the suitability of this software for
|
|
14 |
* any purpose. It is provided "as is" without express or implied
|
|
15 |
* warranty.
|
|
16 |
*
|
|
17 |
* Olaf Seibert DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
|
18 |
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN
|
|
19 |
* NO EVENT SHALL Olaf Seibert BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
|
20 |
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
|
21 |
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
|
22 |
* OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE
|
|
23 |
* USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
24 |
*
|
|
25 |
* Author: Olaf Seibert [ rhialto@falu.nl ][ May 2014 ]
|
|
26 |
*/
|
|
27 |
||
28 |
/*
|
|
29 |
* Code to look at a few Motif Window Manager hints.
|
|
30 |
*
|
|
31 |
* Only the bits marked [v] are actually looked at.
|
|
32 |
* For the rest, ctwm has no concept, really.
|
|
33 |
*
|
|
276
by Olaf 'Rhialto' Seibert
Make provenance of MWM definitions clear. |
34 |
* For some information about the meaning of the flags, see
|
35 |
* the manual page VendorShell(3) from the Motif library.
|
|
252.1.1
by Olaf 'Rhialto' Seibert
Look at some _MOTIF_WM_HINTS; proof of concept version. |
36 |
*/
|
37 |
||
395.1.1
by Matthew Fuller
Move ctwm.h to always be included first. |
38 |
#include "ctwm.h" |
39 |
||
252.1.1
by Olaf 'Rhialto' Seibert
Look at some _MOTIF_WM_HINTS; proof of concept version. |
40 |
#include <stdio.h> |
41 |
||
335.1.2
by Olaf 'Rhialto' Seibert
Add _MOTIF_WM_HINTS to the Automated Atoms. |
42 |
#include "ctwm_atoms.h" |
252.1.1
by Olaf 'Rhialto' Seibert
Look at some _MOTIF_WM_HINTS; proof of concept version. |
43 |
#include "mwmhints.h" |
44 |
||
252.1.2
by Olaf 'Rhialto' Seibert
Integrate MWM hints for titlebar and border better in the existing |
45 |
int GetMWMHints(Window w, MotifWmHints *mwmHints) |
46 |
{
|
|
304.1.2
by Matthew Fuller
Run 'make indent' to reindent the world. |
47 |
int success; |
48 |
Atom actual_type; |
|
49 |
int actual_format; |
|
50 |
unsigned long nitems; |
|
51 |
unsigned long bytes_after; |
|
52 |
unsigned long *prop = NULL; |
|
53 |
||
54 |
/* Defaults for when not found */
|
|
55 |
mwmHints->flags = 0; |
|
56 |
mwmHints->functions = 0; |
|
57 |
mwmHints->decorations = 0; |
|
58 |
#ifdef FULL_MWM_DATA
|
|
59 |
mwmHints->input_mode = 0; |
|
60 |
mwmHints->status = 0; |
|
61 |
#endif
|
|
62 |
||
63 |
success = XGetWindowProperty( |
|
335.1.2
by Olaf 'Rhialto' Seibert
Add _MOTIF_WM_HINTS to the Automated Atoms. |
64 |
dpy, w, XA__MOTIF_WM_HINTS, |
304.1.2
by Matthew Fuller
Run 'make indent' to reindent the world. |
65 |
0, 5, /* long_offset, long long_length, */ |
66 |
False, /* Bool delete, */ |
|
67 |
AnyPropertyType,/* Atom req_type */ |
|
68 |
&actual_type, /* Atom *actual_type_return, */ |
|
69 |
&actual_format, /* int *actual_format_return, */ |
|
70 |
&nitems, /* unsigned long *nitems_return, */ |
|
71 |
&bytes_after, /* unsigned long * */ |
|
72 |
(unsigned char **)&prop); /* unsigned char ** */ |
|
73 |
||
74 |
if(success == Success && |
|
335.1.2
by Olaf 'Rhialto' Seibert
Add _MOTIF_WM_HINTS to the Automated Atoms. |
75 |
actual_type == XA__MOTIF_WM_HINTS && |
304.1.2
by Matthew Fuller
Run 'make indent' to reindent the world. |
76 |
actual_format == 32 && |
77 |
nitems >= 3) { |
|
78 |
mwmHints->flags = (int)prop[0]; |
|
79 |
mwmHints->functions = (int)prop[1]; |
|
80 |
mwmHints->decorations = (int)prop[2]; |
|
81 |
#ifdef FULL_MWM_DATA
|
|
82 |
mwmHints->input_mode = (int)prop[3]; |
|
83 |
mwmHints->status = (int)prop[4]; |
|
84 |
#endif
|
|
85 |
||
86 |
if(mwmHints->flags & MWM_HINTS_FUNCTIONS) { |
|
87 |
if(mwmHints->functions & MWM_FUNC_ALL) { |
|
88 |
mwmHints->functions ^= ~0; |
|
89 |
}
|
|
90 |
}
|
|
91 |
if(mwmHints->flags & MWM_HINTS_DECORATIONS) { |
|
92 |
if(mwmHints->decorations & MWM_DECOR_ALL) { |
|
93 |
mwmHints->decorations ^= ~0; |
|
94 |
}
|
|
95 |
}
|
|
96 |
||
97 |
success = True; |
|
98 |
}
|
|
99 |
else { |
|
100 |
success = False; |
|
101 |
}
|
|
102 |
||
103 |
if(prop != NULL) { |
|
104 |
XFree(prop); |
|
105 |
}
|
|
106 |
||
107 |
return success; |
|
252.1.1
by Olaf 'Rhialto' Seibert
Look at some _MOTIF_WM_HINTS; proof of concept version. |
108 |
}
|
109 |