This is the mail archive of the cygwin-xfree@cygwin.com mailing list for the Cygwin XFree86 project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: New devel to-do item (release all pressed keyboard keys on focus loss)


> There's nothing too hard about it, but it doesn't work.  The
> winSendKeyEvent()
> calls seem to result in keydown events, judging by this output
> from my test.

Actually, I believe it indicates that X clients interpret alpha key releases
without a press as a key event.  I was afraid of that.

You'll need to declare a global array in winkeybc.c, call it g_fKeyStates,
of type Bool and length MAP_LENGTH, initialize the array to 0's in
InitInput.c/InitInput ().  Then, on each call to winSendKeyEvent (), look at
the value of fDown and set the
array entry corresponding to dwKey accordingly.  Finally, have
winKeybdReleaseModifierKeys () loop from 0 to MAP_LENGTH, calling
winSendKeyEvent (dwKey, FALSE) for each array entry that indicates that the
key is pressed.

You know, I've also thought of an alternative that warrents trying.  When we
loose keyboard focus (WM_KILLFOCUS), try making
InitInput.c/InitInput()/pKeyboard global, then call winKeybdProc
(g_pKeyboard, DEVICE_OFF).  When we regain focus, call winKeybdProc
(g_pKeyboard, DEVICE_ON).  I think this may have the effect of stopping key
repeats due to a missing key release message.

Give the latter case a shot before creating a key state array.

Harold


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]