Re: Hooking into the input queue(?)



On 12/02/04 15:16, Jan wrote:
Tristan Van Berkom wrote:
On Thu, 02 Dec 2004 14:15:06 +0000, Jan <jandersen informatica com> wrote:
[...]
I know that in the earlier versions of Windows an application could hook
in to different places in the system, among others the keyboard message
queue, and I assume this is what the producers of this game did. How
would one do the same in Gnome?

I think you are looking for something like this:
http://developer.gnome.org/doc/API/2.0/gtk/gtk-General.html#gtk-key-snooper-install

The prerequisite is that the application in question has to have keyboard 
forcus
somewhere (i.e. the keyboard snooper approach lets you get key input events
that are delivered to your application before they get delivered to
particular widgets
such as text entries etc.)

I think that to get "global" key input then you have to fool around with
the terminal that X is running in and kind of tee the output, there might 
be
some kind of inittab entry for that or something.

Yes, it is this global approach I am after - it has to be possible 
somehow. I assume the X server is the one that captures the physical 
keystrokes and sends them to - the window manager? Or directly to the 
application?

there's a draft spec for an X extension out, called the X Event Interception
Extension.  it's listed on freedesktop:
http://freedesktop.org/Standards
unfortunately, the link appears to be broken.  i don't know if there's a
working implementation of this.

i know the WM is capable of getting all keyboard events, as some WMs 
implement global keybindings that way.  last time i tried calling
XSelectInput() on the root window to get KeyPress events, my app quit with
a BadMatch error.  hmmph.  so, hacking your favorite WM might do the trick,
though this may not be the kind of effort you were looking for.

        -brian



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