]> git.decadent.org.uk Git - ion3.git/blob - ioncore/mwmhints.c
[svn-upgrade] Integrating new upstream version, ion3 (20070506)
[ion3.git] / ioncore / mwmhints.c
1 /*
2  * ion/ioncore/mwmhints.c
3  *
4  * Copyright (c) Tuomo Valkonen 1999-2007. 
5  *
6  * See the included file LICENSE for details.
7  */
8
9 #include "common.h"
10 #include "property.h"
11 #include "mwmhints.h"
12 #include "global.h"
13
14
15 WMwmHints *xwindow_get_mwmhints(Window win)
16 {
17     WMwmHints *hints=NULL;
18     int n;
19     
20     n=xwindow_get_property(win, ioncore_g.atom_mwm_hints,
21                            ioncore_g.atom_mwm_hints, 
22                            MWM_N_HINTS, FALSE, (uchar**)&hints);
23     
24     if(n<MWM_N_HINTS && hints!=NULL){
25         XFree((void*)hints);
26         return NULL;
27     }
28     
29     return hints;
30 }
31
32
33 void xwindow_check_mwmhints_nodecor(Window win, bool *nodecor)
34 {
35     WMwmHints *hints;
36     int n;
37
38     *nodecor=FALSE;
39     
40     n=xwindow_get_property(win, ioncore_g.atom_mwm_hints, 
41                            ioncore_g.atom_mwm_hints, 
42                            MWM_N_HINTS, FALSE, (uchar**)&hints);
43     
44     if(n<MWM_DECOR_NDX)
45         return;
46     
47     if(hints->flags&MWM_HINTS_DECORATIONS &&
48        (hints->decorations&MWM_DECOR_ALL)==0){
49         *nodecor=TRUE;
50         
51         if(hints->decorations&MWM_DECOR_BORDER ||
52            hints->decorations&MWM_DECOR_TITLE)
53             *nodecor=FALSE;
54     }
55     
56     XFree((void*)hints);
57 }