I am writing a C++ Qt5 application that runs on X. The window manager it will run under is Metacity. I have a few requirements I'm not sure how to address:
- Window must not be able to be closed
- Window must not be able to be minimized
- Window must always be on top
I have sort of implemented requirement 3 using:
setWindowFlags(windowFlags() | Qt::WindowStaysOnTopHint);
However, right clicking on the window title still shows a popup menu:
From this menu, the user can turn off the "Always on Top" setting, and the Minimize and Close options are still available. I have tried:
setWindowFlags(windowFlags() & ~(Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint));
but, this function doesn't appear to do what I want with this window manager, because no functions get disabled.
One fallback position is:
- Restart the application if it is ever closed (this is already in place for other reasons)
- Restore the window to its normal size if it is ever minimized
Another fallback position is:
- Use
Qt::X11BypassWindowManagerHint
which completely avoids the window manager, and implement window moving and sizing myself somehow.
Ideally, I would like to continue to use the window manager to offer window move and size functionality, yet turn off functions that I don't need.
(Please try to avoid comments like "well you shouldn't do that" or "that's a dumb idea" - yes, I know, but this application is not for general use, it's only used in a specialized environment, and it is subject to requirements not written by me.)