[Cuis-dev] Mac Option Key Support in the VM

Gerald Klix cuis.01 at klix.ch
Wed Dec 1 11:55:39 PST 2021


On 12/1/21 8:33 PM, Juan Vuletich via Cuis-dev wrote:
> On 12/1/2021 2:23 PM, Gerald Klix via Cuis-dev wrote:
>> Hi all,
>>
>> It's fairly easy to add a reaction to the VM for the Windows-key
>> on X11, but I don't know which key code the Option-key on Mac
>> reports. I have no (working) Mac at hand and the Quartz-driver
>> passes the key-code unmodified; so nothing can
>> be gleaned from the source.
>>
>> Can someone with a Mac at hand do `Sensor test`
>> and tell me, which key code the VM reports for
>> the option key (Exit this trap by pressing the x-key).
>>
>>
>> Thanks and Best Regards,
>>
>> Gerald
> 
> Hi Gerald,
> 
> These are the results on my Mac. Tried each ctrl / option / command by 
> itself, and as a modifier of [a]. (Note, my mac keyboard doesn't have a 
> control key on the right side of the spacebar.)
> 
> Hope this helps.
> 
> ---------
> Transcript
> 
> ==== option down - option up ==== (58 for left option. 61 for right option)
> keyDown macRomanCode:58-:- unicodeCodePoint:0-- modifiers:4 
> [macOption]#(2 28297 58 1 4 0 0 1)
> keyUp macRomanCode:58-:- unicodeCodePoint:0-- modifiers:4 [macOption]#(2 
> 28372 58 2 4 0 0 1)
> 
> ==== option down - a down - a up - option up ==== (58 for left option. 
> 61 for right option)
> keyDown macRomanCode:58-:- unicodeCodePoint:0-- modifiers:4 
> [macOption]#(2 39836 58 1 4 0 0 1)
> keyDown macRomanCode:0-- unicodeCodePoint:0-- modifiers:4 [macOption]#(2 
> 40732 0 1 4 0 0 1)
> keystroke macRomanCode:229-Â- unicodeCodePoint:229-å- modifiers:4 
> [macOption]#(2 40732 229 0 4 229 0 1)
> keyUp macRomanCode:0-- unicodeCodePoint:0-- modifiers:4 [macOption]#(2 
> 40882 0 2 4 0 0 1)
> keyUp macRomanCode:58-:- unicodeCodePoint:0-- modifiers:4 [macOption]#(2 
> 41633 58 2 4 0 0 1)
> 
> 
> 
> ==== control down - control up ====
> keyDown macRomanCode:59-;- unicodeCodePoint:0-- modifiers:2 [control]#(2 
> 604158 59 1 2 0 0 1)
> keyUp macRomanCode:59-;- unicodeCodePoint:0-- modifiers:2 [control]#(2 
> 604847 59 2 2 0 0 1)
> 
> ==== control down - a down - a up - control up ====
> keyDown macRomanCode:59-;- unicodeCodePoint:0-- modifiers:2 [control]#(2 
> 608941 59 1 2 0 0 1)
> keyDown macRomanCode:0-- unicodeCodePoint:0-- modifiers:2 [control]#(2 
> 608957 0 1 2 0 0 1)
> keystroke macRomanCode:1-- unicodeCodePoint:1-- modifiers:2 [control]#(2 
> 608957 1 0 2 1 0 1)
> keyUp macRomanCode:0-- unicodeCodePoint:0-- modifiers:2 [control]#(2 
> 609226 0 2 2 0 0 1)
> keyUp macRomanCode:59-;- unicodeCodePoint:0-- modifiers:2 [control]#(2 
> 609826 59 2 2 0 0 1)
> 
> 
> 
> ==== command down - command up ==== (55 for left command, 54 for right 
> command)
> keyDown macRomanCode:55-7- unicodeCodePoint:0-- modifiers:8 
> [commandWinAlt]#(2 722491 55 1 8 0 0 1)
> keyUp macRomanCode:55-7- unicodeCodePoint:0-- modifiers:8 
> [commandWinAlt]#(2 722731 55 2 8 0 0 1)
> 
> ==== command down - a down - a up - command up ==== (55 for left 
> command, 54 for right command)
> keyDown macRomanCode:55-7- unicodeCodePoint:0-- modifiers:8 
> [commandWinAlt]#(2 724546 55 1 8 0 0 1)
> keyDown macRomanCode:0-- unicodeCodePoint:0-- modifiers:8 
> [commandWinAlt]#(2 724875 0 1 8 0 0 1)
> keystroke macRomanCode:97-a- unicodeCodePoint:97-a- modifiers:8 
> [commandWinAlt]#(2 724875 97 0 8 97 0 1)
> keyUp macRomanCode:0-- unicodeCodePoint:0-- modifiers:8 
> [commandWinAlt]#(2 725026 0 2 8 0 0 1)
> keyUp macRomanCode:55-7- unicodeCodePoint:0-- modifiers:8 
> [commandWinAlt]#(2 725624 55 2 8 0 0 1)
> 

Thanks a lot!
All codes on X11 are different from the ones the Mac version reports.
Besides: Some 10 minutes ago, I discovered that the X11-driver
already maps the meta-keys (to key-code 249 and 248),
so I used that mapping.

Obviously nobody reacts on pure modifier key-presses.

For some reason EventSensor>>#test did work on the very first trial,
but EventSensor>>#primMouseButtons' answer does not have
the options-bit set. I suppose this gets deleted somewhere
in the mouse button mapping stuff.


Thanks again,

Gerald


More information about the Cuis-dev mailing list