Comment 8 for bug 390552

I think this may be what you're looking for:
and some more info here:

You have to be careful with XGrabKey as well. XGrabKey will steal focus and
you also lose the ability to *not* steal the key from the XEvent queue. In
fact, I think this is harder to do in X than it is in Windows. I ended up
having to code a GTK timeout to poll the state of the keyboard every 250msec
in order to implement this, and I think that's a horrible, horrible

The EVIE library may have a solution for it in X though. But I know in
Windows that this can be done, because I've seen apps that do this. They're
all just closed source.


On Mon, Sep 14, 2009 at 1:06 PM, Mikkel Kamstrup Erlandsen <
<email address hidden>> wrote:

> The Win32 docs for KEY{UP,DOWN} specifically say that they are added to
> the message queue of the window with the focus. We an equivalent of
> XGrabKey:
> --
> Add a key-release signal in addition to key-press
> You received this bug notification because you are a direct subscriber
> of the bug.
> Status in Gtk Hotkey Library: Confirmed
> Status in GtkHotkey 0.3 series: New
> Bug description:
> When the hotkey is pressed, an event is sent as expected, however, there is
> no way to track a release event. The keypress release seems to happen
> instantly.
> We're trying to implement a GPL version of voice chat software. The
> software uses a keypress to turn on the mic and send sound.
> Instead of an "activated" event, I would expect a "pressed" and "released"
> event just like a GTK button.