I'm confused with XSetWMNormalHints and XSetWMSizeHints. I want to set my window non-resizable, and a call to XSetWMNormalHints does it properly. But if I call XSetWMSizeHints instead, nothing really happens; the window is still resizable. How are the 2 functions used for my purpose, and what exactly does XSetWMSizeHints do? I've read the documentation multiple times, but I'm still confused, so asking a question here.
sh = XAllocSizeHints();
sh->flags = PMinSize | PMaxSize;
sh->min_width = sh->max_width = 100;
sh->min_height = sh->max_height = 100;
XSetWMNormalHints(d, w, sh);
//XSetWMSizeHints(d, w, sh, PMinSize | PMaxSize);
XFree(sh);
According to the manual page:
while
and at the beginning, it shows
In your commented-out fragment, it does not use a property (does not appear to work). X11 Atoms (see Xlib Programming Manual: Properties and Atoms) are identifiers like a C pointer (but not actually an address), while
PMinSize | PMaxSizeis something entirely different: a value with specific bits set. The compiler accepted it because both are unsigned values, but at runtime that value probably does not match any Atom identifier.XSetWMNormalHintsis the more useful of the functions because it updates the property which you normally would use:WM_NORMAL_HINTS. TheXSetWMSizeHintsis more general — allowing you to use any property — but you probably do not need the generality.