Re: key press events & holding keys down



On Mon, 19 Mar 2012 20:35:33 +0100
David NeÄas <yeti physics muni cz> wrote:
On Mon, Mar 19, 2012 at 07:25:22PM +0000, Chris Vine wrote:
Are you saying that on your hardware, holding one key down blocks
press and release events for all other keys?  I am not saying you
are wrong, but I find that surprising.

IMO Christopher observes this:
1) press A
2) press B while still holding A
3) release B while still holding A
You get no auto-repeat key events for A after 3) even though you still
hold it.

The solution can be either using something more low level(?) or simply
*NOT* getting your key events from Gdk key events and ignoring
autorepeat altogether.  (This is probably what has been â unclearly â
already suggested.)

Ah yes, I think that is the actual issue for the OP.  However, the
question which he asked and to which I responded was "under Gtk+, how
does one check whether or not any particular keyboard key is currently
pressed?" and the answer to that is to monitor key press and key
release events and keep state.

However, I wouldn't advise abandoning GDK just because his real
question is something different: it may be better to code the game by
reference to edge events, that is changes of state, rather than by
auto-repeat, which was not intended for that purpose.

Chris




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