开发者

Qt and X11 fullscreen application , which blocks Window Manager simultaneously

开发者 https://www.devze.com 2023-03-11 23:46 出处:网络
i think i need to use a XEvent with QMainWindow together to make my application unable to close even by Window Manager , could any one provide an example ?

i think i need to use a XEvent with QMainWindow together to make my application unable to close even by Window Manager , could any one provide an example ?

It's like a fullscreen video game , which blocks all keyboards , mouse buttons.

P.S: 开发者_如何学JAVAQWidget::grabKeyboard() && QWidget::grabMouse() doesn't work when i try to switch to other applications with key combinations like "ALT_TAB"

Thanks.


To completely block all inputs from other apps, you need to use XGrabServer and not XGrabKeyboard/XGrabPointer combination. Dunno whether Qt has an API for that but you can always call the Xlib function directly.

I however recommend against it. If the application is for some reason doesn't release the grab, you're stuck and need to escape to the console to kill it.


I think you can override closeEvent() of your main window and reject the event by using ignore() method as described here.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号