]> git.decadent.org.uk Git - ion3.git/blob - ioncore/mwmhints.c
2c2269c24d565fa48266009f56a1c928bd1e16ac
[ion3.git] / ioncore / mwmhints.c
1 /*
2  * ion/ioncore/mwmhints.c
3  *
4  * Copyright (c) Tuomo Valkonen 1999-2007. 
5  *
6  * Ion is free software; you can redistribute it and/or modify it under
7  * the terms of the GNU Lesser General Public License as published by
8  * the Free Software Foundation; either version 2.1 of the License, or
9  * (at your option) any later version.
10  */
11
12 #include "common.h"
13 #include "property.h"
14 #include "mwmhints.h"
15 #include "global.h"
16
17
18 WMwmHints *xwindow_get_mwmhints(Window win)
19 {
20     WMwmHints *hints=NULL;
21     int n;
22     
23     n=xwindow_get_property(win, ioncore_g.atom_mwm_hints,
24                            ioncore_g.atom_mwm_hints, 
25                            MWM_N_HINTS, FALSE, (uchar**)&hints);
26     
27     if(n<MWM_N_HINTS && hints!=NULL){
28         XFree((void*)hints);
29         return NULL;
30     }
31     
32     return hints;
33 }
34
35
36 void xwindow_check_mwmhints_nodecor(Window win, bool *nodecor)
37 {
38     WMwmHints *hints;
39     int n;
40
41     *nodecor=FALSE;
42     
43     n=xwindow_get_property(win, ioncore_g.atom_mwm_hints, 
44                            ioncore_g.atom_mwm_hints, 
45                            MWM_N_HINTS, FALSE, (uchar**)&hints);
46     
47     if(n<MWM_DECOR_NDX)
48         return;
49     
50     if(hints->flags&MWM_HINTS_DECORATIONS &&
51        (hints->decorations&MWM_DECOR_ALL)==0){
52         *nodecor=TRUE;
53         
54         if(hints->decorations&MWM_DECOR_BORDER ||
55            hints->decorations&MWM_DECOR_TITLE)
56             *nodecor=FALSE;
57     }
58     
59     XFree((void*)hints);
60 }