I use this sample to set a hotkey in my program on the Linux X11 graphics system. The problem is that I don’t understand how to set hotkey combinations like Ctrl+ Altand Ctrl+ Shift, i.e. Without any keys, only modifiers. I try like this:
KeyCode key = XKeysymToKeycode(display, 0); //no key code
XGrabKey(display, key, ControlMask | ShiftMask, grabWin, true, GrabModeAsync, GrabModeAsync);
But it does not work. However, it works like this (view):
KeyCode key = XKeysymToKeycode(display, XK_Alt_L);
XGrabKey(display, key, ControlMask, grabWin, true, GrabModeAsync, GrabModeAsync);
I do not like this solution because:
- Logically wrong
- It only works when Ctrl+ is Altpressed, not Alt+ Ctrl, i.e. important to press order
- It blocks all other combinations in the windows with the Ctrland keys Alt.
What am I doing wrong?
user2440074