Re: GUI-less app to capture key_press_events only



On Wed, Oct 06, 2004 at 00:07:47 -0400, muppet wrote:

On Oct 5, 2004, at 11:22 AM, Eric Lenio wrote:

Actually the issue is related to the Curses.pm module: the problem is 
that
Curses does NOT trigger an event by pressing the control (or shift or 
mod) key
by itself.  I fumbled my way through building a very simple Gtk2 app 
which did
recognize the event.  But that little test app had a Gtk window, and I 
want to
get away from having any window.

X applications cannot receive events unless they have an X window, 
because it is the X window that receives the event.  the gtk+ 
equivalent is a GdkWindow (the GdkWindow is an abstraction for a 
windowing system's lowlevel window object, and is an X window in the 
X11 target).  getting keyboard events also requires keyboard focus, so 
using a hidden window will be tricky magic at best.

It is not true, actualy. Any application may capture events on any
window. That is particularly true for the root window. And since all
other windows are BELOW the root window, each keypress can be captured
on the root window. After all, that's exactly how the window manager
keybindings work.

so, if you're wanting to capture the Ctrl key in a terminal app, Gtk2 
will not help you at all.

Gtk2 won't. I am not sure how much Gdk would, though. Anyway, the Gnome
Panel installs global keybindings. You can have a look at how it does
that (As far as I recall, it used a key grab, but I am not sure whether
it was a gdk call or a direct X call).

-------------------------------------------------------------------------------
                                                 Jan 'Bulb' Hudec <bulb ucw cz>

Attachment: signature.asc
Description: Digital signature



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