Scroll events

Ned Konz ned at bike-nomad.com
Fri Mar 18 20:55:02 UTC 2005


On Friday 18 March 2005 12:31 pm, John M McIntosh wrote:
> I'm sure this is a change from our original thoughts to generate  
> unicode values for the keydown/keyup. I'll note you could be using a  
> input palette and not a keyboard device so you won't get any key  
> up/down events, and you imply that you are supplying unicode values for  
> the keystroke, versus the historical MacRoman? So how does a  unicode  
> character flow up in Windows?

Why not just pass unicode characters up all the time?

There's no particular need for MacRoman keystroke events in the image (or 
doesn't need to be).

And I don't think that key down/up events map at all well to Unicode, which 
deals with characters. After all, a given character could take many key 
down/up events to produce, and a keydown/up may not even generate any 
keystroke events (like, for instance, the shift key).

The mapping between hardware events (key codes) and keyboard keys is 
available, at least in X (you can ask it for the name of the key).

XLookupString returns what for us would be equivalent to the "keystroke".

But note that there is also the possibility to have both:

keyDown/keyUp -- physical keys, maybe with a name

keystrokeDown/keystrokeUp -- logical (translated) keys

Maybe we should distinguish these.

Do other platforms allow this level of detail?

Here's some output from xev. Look at the keycode/keysym/XLookupString; you'll 
see that XLookupString returns the logical keystroke for both KeyPress and 
KeyRelease events.

<press and release the 'a' key>

KeyPress event, serial 28, synthetic NO, window 0x3800001,
    root 0xd4, subw 0x0, time 187062733, (-933,57), root:(1445,895),
    state 0x0, keycode 38 (keysym 0x61, a), same_screen YES,
    XLookupString gives 1 bytes:  "a"

KeyRelease event, serial 28, synthetic NO, window 0x3800001,
    root 0xd4, subw 0x0, time 187062861, (-933,57), root:(1445,895),
    state 0x0, keycode 38 (keysym 0x61, a), same_screen YES,
    XLookupString gives 1 bytes:  "a"

<do a ctrl-c>

KeyPress event, serial 28, synthetic NO, window 0x3800001,
    root 0xd4, subw 0x0, time 187073836, (-1847,-333), root:(531,505),
    state 0x0, keycode 37 (keysym 0xffe3, Control_L), same_screen YES,
    XLookupString gives 0 bytes:  ""

KeyPress event, serial 28, synthetic NO, window 0x3800001,
    root 0xd4, subw 0x0, time 187073964, (-1847,-333), root:(531,505),
    state 0x4, keycode 54 (keysym 0x63, c), same_screen YES,
    XLookupString gives 1 bytes:  ""

KeyRelease event, serial 28, synthetic NO, window 0x3800001,
    root 0xd4, subw 0x0, time 187074412, (-1847,-332), root:(531,506),
    state 0x4, keycode 54 (keysym 0x63, c), same_screen YES,
    XLookupString gives 1 bytes:  ""

KeyRelease event, serial 28, synthetic NO, window 0x3800001,
    root 0xd4, subw 0x0, time 187074460, (-1847,-332), root:(531,506),
    state 0x4, keycode 37 (keysym 0xffe3, Control_L), same_screen YES,
    XLookupString gives 0 bytes:  ""

-- 
Ned Konz
http://bike-nomad.com




More information about the Vm-dev mailing list