Re: Capturing global key press events
- From: Vikram Noel Ambrose <noel ambrose gmail com>
- Cc: gtk-list gnome org
- Subject: Re: Capturing global key press events
- Date: Wed, 03 Mar 2010 03:07:10 -0500
Vikram Noel Ambrose wrote:
Lex Trotman wrote:
On 2 March 2010 15:29, Vikram Noel Ambrose <noel ambrose gmail com
<mailto:noel ambrose gmail com>> wrote:
I'd like to capture global key press events to enable a "Global
Shortcuts" feature in my application.
I've looked at a few other projects that have such capabilities
and they all seem to hook straight into xlib. Is there a more GTK
way of doing it?
At the moment I'm using,
XKeysymToKeycode($DISPLAY,XStringToKeysym("some key in here"));
And then passing the resulting key code to XGrabKey,
XGrabKey($DISPLAY,key,Mod4Mask|ShiftMask,$WINDOW,True,GrabModeAsync,GrabModeAsync);
Then I call XSync($DISPLAY,0); I dont know why, but if I dont, gtk
segfaults.
I then wait for events with XNextEvent($DISPLAY,&event); inside a
pthread and when an event comes by, i call a signal callback
surrounded with gdk_threads_enter and _leave.
Now all this worked nicely for a while, but somehow I've managed
to break it :(
Figured it out!
I don't know what caused it, but for some reason the Super key on my
keyboard suddenly no longer responds to the Mod4Mask modifier. After
dumping the key states with AnyModifier I found it to actually be 0x50
which is apparently Mod4Mask|Mod2Mask.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]