Re: Capturing global key press events

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Vikram Noel Ambrose wrote:
Lex Trotman wrote:


On 2 March 2010 15:29, Vikram Noel Ambrose <noel.ambrose@xxxxxxxxx <mailto:noel.ambrose@xxxxxxxxx>> 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.

_______________________________________________
gtk-list mailing list
gtk-list@xxxxxxxxx
http://mail.gnome.org/mailman/listinfo/gtk-list

[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux