i’m writing some low level window code for a window in x (in c++), and I want to prevent the user from either maximising or minimising the window. i don’t mind whether this is done by rejecting the request to resize, or by removing the buttons themselves. however, i am tied to x and can’t use qt or other higher-level libraries which i know provide this functionality.
at the moment all i have managed to do is intercept the ResizeRequest event and then set the window size back using XResizeWindow… but this causes the window to momentarily maximise and then return to its original state. is there a way to directly reject a ResizeRequest, that would seem to be the proper way to handle this but a fair bit of googling and document trawling has not come up with a solution.
thanks,
james
you can’t.
essentially you would fight like hell against the window manager (and against the user in the end).
eg, you could watch PropertyNotify events to check if your window (or rather the window your window is attached to (provided by the window manager)) gets minimized. and then you unminimize it. and then the user minimizes it, or the window manager. technically, you can fight against it, but i would strongly advise against it.
that said: you can try to give the window manager some hints about what you think is appropriate for the window. see http://standards.freedesktop.org/wm-spec/1.3/ar01s05.html#id2523223:
is a property the window manager manages per window (to tell other tools what is possible with that window). one of such actions is
so, if your users are using a window manager which interpretes
WM_NORMAL_HINTScorrectly and drops any resizing, maximizing, minimizing: then you can feel lucky.what do you really want to achieve? some kind of kiosk-mode? some kind of fair-trade mode where people walking by can not “shutdown”, close, resize, fiddle around with the app you are presenting?
if so: consider running a xsession without any window manager involved at all. just start your app as big as you need it and done.