Re: State modifers



>This is probably a dumb question:
>
>For a GdkEventKey is event->state set in the case where only the Shift
>key is pressed? When I press the Shift key, I get a key press event
>emitted, but event->state isn't set to anything. If the shift key and
>another key is pressed, then event->state & GDK_SHIFT_MASK is true. 

the event->state field describes the state *at the time* the event
happened. when the shift key was pressed, the shift key was not
already pressed, so the bit is not set. when the shift key is
released, the shift key is pressed, so the bit is set. when another
key is pressed after the shift key, the shift key is pressed, so the
bist is set.

>Is this correct behaviour? If so, how do you detect when only the Shift
>key is pressed?

when a shift key press event is received. 

--p



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