Re: [gtkmm] Q: keystroke interception



>support for Unicode.  Basically, I want to read keystrokes in
>raw mode, determine whether or not the Control or Alt key
>was pressed along with the keystroke, and act accordingly.

All X Window applications work this way because its the way X Window
works. You get "events" telling you of individual key presses,
including those involving modifier keys. If modifier keys are held
down while pressing other keys, the "state" field of the event is set
to a bitmask that describes which modifier keys are held down.

So If the user presses Ctrl-A, you will get

    key press event (Control), state = 0
    Key press event (A), state = <non-zero>

when they release the keys, you will get either

    key release event (A), state = <non-zero>
    key release event (Control), state = 0

or

    key release event (Control), state = <non-zero>
    key release event (A), state = 0


depending on the order.

--p



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