Re: Checking modifier keys at any moment



>I have a handler for GtkTreeView's row_activated and I'd like to check
>there if at the moment of signal emision any modifier key (I'm mostly
>interested in shift and mod1 keys) is pressed. Is there any gtk function
>that returns current state of these keys at any moment?
>I use Gtk+ 2.0.5.

i doubt if there is one directly. last time i looked, GDK didn't have
any notion of keyboard state per se. if you know that GDK is running
atop X, you could theoretically use some X functions to do this, but
its very complex.

much simpler is just to connect to the "event" event of the top-level
window, and note key press and release events yourself, tracking the
state as needed. just return FALSE from your handler, and the usual
thing will happen in addition to your tracking. you could use
"key_press_event" and "key_release_event" instead, if you wish.

--p



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