You interpret the data you get from XGetWindowProperty
the same way you interpret data sent to XChangeProperty
.
In the case of _MOTIF_WM_HINTS
it's an array of 5 long
s, or perhaps the struct MwmHints
(syn. MotifWmHints
). It's a struct of 5 long
fields, plus several #define
d bit flags. It is inherited from the Motif window manager, but we don't usually keep Motif includes and libraries around nowadays, so the struct gets copied to various places (bad practice but everyonee is doing it). You may find its definition in xprops.h
of Gnome and several other places. Look it up on the 'net and copy to your code, or find it in an include file you already depend on, or just look at the definition and keep using the array of 5 long
s, your choice.
You need to check the right flags in the right fields. For decorations, check if the window is override-redirect first. If it is, it is undecorated (obviously) and you cannot add any decorations. If the window manager is not running, it's undecorated as well, and you cannot add any decorations in this case too.
Otherwise, if the window does not have the property at all (XGetWindowProperty
sets type
to None
), you may assume it's decorated.
If it does have the property, and MWM_HINTS_DECORATIONS
bit is set in flags
, then it has exactly the decorations specified in the decorations
field by the MWM_DECOR_*
bit values. If the field is non-zero, there are some decorations present. AFAIK if MWM_HINTS_DECORATIONS
is unset, then the window is (surprisingly) decorated. But please test this yourself, I don't remember and don't have an X11 machine around at the moment so I can't check it.
Naturally, some window managers don't use _MOTIF_WM_HINTS
(e.g. ones that were around before Motif). If you have one of those, you cannot check or set decorations with this method.
Don't forget to XFree(hints)
.