Re: keyboard events?



Harry van Haaren said the following at 09/04/2011 06:23 PM :

> I'm not 100% here, but I think the "modifier" keys (Shift, control, alt,
> "apple" if you happen to have one of those...) aren't actually broadcast
> like that. If I remember correctly, they are sent "along" with another
> keypress, like the letter A. Then you'll get one GdkKeyEvent, and that will
> have the "key" and the "modifier" list.
> 
> Pretty sure that's how it works... tried finding the docs, as you mention
> there's not much on keys out there.

I sure hope that's not how it works, because if it is I'm going to have to
drop gtkmm and move to something else (presumably Qt). I need to be able to
do the following:

1. Detect when a shift key is pressed.
2. Determine which of the two shift keys has been pressed.
3. And then, every tenth of a second or so see if it's still depressed (or
whether the other one has been depressed in the meantime).

Using the shift keys in this way is a common way to tune the receiver in a
computer-accessed transceiver (left shift to move down in frequency, right
shift to move up).

X certainly sends the necessary events, so it's not obvious why gtkmm
wouldn't just pass them on to the application code. It would probably take
more work for the gtkmm code to filter them out rather than just to pass
them on. So I'm reasonably optimistic that you're incorrect and this is
possible in gtkmm ... I just need to figure out how.

Lecas' e-mail sounds hopeful; and I see that there are separate values in
gdkkeysyms.h for the left and right shift keys, so I just need to try a
quick and dirty test program to see if it works.

  Doc

-- 
Web:  http://www.sff.net/people/N7DR

Attachment: signature.asc
Description: OpenPGP digital signature



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