Behavior of Keyboard

Alexander Gottwald Alexander.Gottwald@informatik.tu-chemnitz.de
Sun Apr 1 00:47:00 GMT 2001


Hi,

In the next days I want to change the handling of keypresses when
the server gets focus or loses focus and wanted to ask what behavior
is expected from the server. 

Losing focus:
- All pressed keys generate a KeyRelease Message

Getting Focus
- All pressed keys generate a KeyPress Message

or keeping track of changes between lose focus and get focus and 
generate the KeyRelease/KeyPress only if something has changed.

eg. Pressing the 'a' and 'b' key and switching tasks, releasing 'a', 
switching back to XWin and release 'b' would generate the following event:
a) KeyPress 'a'
   KeyPress 'b'
    Lose Focus
   KeyRelease 'a'
   KeyRelease 'b'
   ...
    Get Focus
   KeyPress 'b'
   ...
   KeyRelease 'b'

b) KeyPress 'a'
   KeyPress 'b'
    Lose Focus
   ...
    GetFocus
   KeyRelease 'a'
   ...
   KeyRelease 'b' 
   
The most important is, that we a) has as much KeyReleases as KeyPresses and
b) don't have X thinking a key is still pressed but it's not. 

Is it necesary to keep track of the windows num-, caps- and scroll
lock or is it better to keep it's own state (as for instance VMWare
does) and setting the states temporary and restoring the windows state
on losing focus?

Bye
    ago
-- 
Alexander.Gottwald@informatik.tu-chemnitz.de
http://www.gotti.org
+49 3725 3498080



More information about the Cygwin-xfree mailing list