I'm trying to grab all keyboard events for a remote desktop-type client. I don't want things like ALT-Tab to get caught by the Gnome3/KDE/Openbox/etc... desktop, I want my application to get all these events and other applications to not get the event.
I'm doing something like this currently:
grabKeyboard() // qt function
Display *display = XOpenDisplay(NULL);
XGrabKeyboard(display, winId(), True, GrabModeAsync, GrabModeAsync, CurrentTime);
which actually seems to work fine with ALT-Tab, but in Openbox there are a bunch of keyboard shortcuts defined to "Show desktop" (ALT-CTRL-END) and "Reset X" (CTRL-ALT-R) that are getting caught by Openbox. I noticed that FreeRDP does something like this:
int input_mask =
KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask |
VisibilityChangeMask | FocusChangeMask | StructureNotifyMask |
PointerMotionMask | ExposureMask | PropertyChangeMask;
XSelectInput(display, winId(), input_mask);
I've tried that in addition to my code above and it doesn't work.
I also noticed that Remmina uses gdk_device_grab but since my app isn't a GTK application I can't call that. Can anyone help?