Re: Checking modifier keys at any moment



Hi,

Paul Davis <pbd op net> writes:

> >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.

the GdkEventKey struct has a state value that has the state of the
modifier keys as a bit mask using the GdkModifierType.

> 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.

I'd also suggest this solution.


Salut, Sven



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