[Message Prev][Message Next][Thread Prev][Thread Next][Message Index][Thread Index]
Re: XGrabKey problems
patch19-8-5 XGrabKey problems
It looks like gnome just won't let you grab function keys like F1 or F2. The function below only grabs ALT and CTL keys. I tested this with KDE and Gnome, it works good. Just replace your ui_grab_keyboard function with whats below.
Does anyone know why XGrabKey works this way? It looks like you never get a BadAccess return code, the app just halts.
Well anyway, this is a testing fix. If you want to test it out and let me know the results, great. Check the ALT-TAB and CTL-ESC key combos, actually give the whole keyboard a test run.
I'm thinking XGrabKeyboard might be better(more reliable). It seems like most apps either grabkeyboard or don't grab at all.
Since we're using scancodes here, non-pc keyboards won't grab, allthough we can check for that.
Thanks
Jay
void
ui_grab_keyboard()
{
int i;
int grab_keys[4] = {0x25, 0x40, 0x6d, 0x71}; /* alt and ctl keys */
for (i = 0; i < 4; i++)
XGrabKey(display, grab_keys[i], AnyModifier, wnd, True, GrabModeAsync, GrabModeAsync);
}