[Vm-dev] INFO REQUEST: key & mouse state machine / API

ken.dickey at whidbey.com ken.dickey at whidbey.com
Sat Dec 28 03:48:05 UTC 2019


Nicolas,

Thanks much for the reply.

I can deal with Work In Progress.  I appreciate the warning.

As usual, answers lead to more questions.

> Currently, we have to generate:
> - an EventKeyDown at each keydown, and at each repeat
> - an EventKeyStroke if ever the key is producing a character (or 
> several
> EventKeyStroke if we produce several characters)
> - an EventKeyUp when the key is released

At present, if I hold down a modifier key (e.g. ctrl or shift) and a 
key-char, I get a modifier key-down then a huge number of modifier key 
repeats mixed in with a key-down and key-up of the character key.

I can see wanting the key-down and key-up with the character key, plus 
the modifiers.  But as with many rackpad micro-moves, if the VM really 
wants the modifier-key repeats, perhaps repeat count would save the VM 
from having to drop unprocessed events.  I really don't see how modifier 
key-doen/repeat/key-ups being useful in the absence of a char-key 
down/repeat/up.  Really?  That is unexpected.  Easy to generate this.  I 
can certainly try it out.

> Those events should have a platform independent key code in charCode 
> field
> (event at: 3)
> And a 32 bits unicode character in utf32 field (event at: 6) - that is 
> also
> known as ucs4

The keyboard libevdev event will give, e.g. ('l' + ShiftBit) rather than 
'L' or ('2' + ShiftBit) rather than '@'.

Is the more 'raw' report desired, or should I use the upcased char-key? 
[I presume the latter]

> When Ctrl+letter is pressed, it delivers an ASCII control character 
> (code 1
> to 26) instead of the keycode of the letter

When I see Key: (38 = x26)  'l' + Ctrl + keyDown
-> recordKeyboardEvent( 0x0021, EventKeyStroke, CtrlKeyBit, 0x004c)

No problem.  I can map ctrl+l -> '^l' just as shift+l -> 'L'

> But PharoVM wants the uppercase character code in both charCode and 
> utf32
> fields...

NOt quite sure how to encode both ^l and L in same charCode ;^)

 From the description, it sounds like:
   left-ctrl down
   left-ctrl repeat*
   char-l down
   left-ctrl repeat*
   char-l up
   left-ctel repeat*
   left-ctrl up

Where I was thinking of just reporting
   left-l down +Ctrl
   left-l up +Ctrl

...

sqUnixX11.c is a large and daunting file.  I will have to grovel over 
the translateCode() to decode what is happening.  Not sure how 
char-key+Shift+Ctrl+Alt+Meta is properly reported.

In particular, why not just track modifier key state (seet attached).  
The code seems to "erase" the meta-key state when reporting event rather 
than when the key-up's are received.


> Having a single keystroke with precomposed unicode would be nice, but 
> it
> can eventually be 2 keystroke with decomposed unicode...

At some point one must decide where characters are composed.  One can 
give "cooked" chars to the VM, which allows for various input methods 
for non-latin scripts.

vm-display-fbdev is much simpler than vm-device-X11.

I will try some experiments as things progress and see where I get into 
trouble.

Thanks again for answering.  We all have busy lives..
-KenD
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: misc-code.txt
URL: <http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20191227/58a2297d/attachment.txt>


More information about the Vm-dev mailing list