<div id="__MailbirdStyleContent" style="font-size: 10pt;font-family: Arial;color: #000000;text-align: left" dir="ltr"><div>Hi all!<br></div><div><span style="font-size: 13.3333px"><br></span></div><div><span style="font-size: 13.3333px">Please find attached a changeset that adds mapping tables for virtual keys (or scan codes) for macOS, X11, and Windows. You can find them in EventSensor class >> #virtualKeysOn*</span></div><div><span style="font-size: 13.3333px"><br></span></div><div><span style="font-size: 13.3333px">You can try out if they work through the KeyboardExerciser. Please take a look at the balloon text (i.e. tool tip) to better understand the data.</span></div><div><span style="font-size: 13.3333px"><br></span></div><div><span style="font-size: 13.3333px">There is also a new preference:</span></div><div><span style="font-size: 13.3333px">[x] Simplify Virtual-key codes</span></div><div><span style="font-size: 13.3333px"><br></span></div><div><span style="font-size: 13.3333px">... because of Windows who dares to couple codes to the input language (e.g. US vs. DE), which Squeak knows nothing about. macOS is better in this regard. :-)</span></div><div><span style="font-size: 13.3333px"><br></span></div><div><span style="font-size: 13.3333px">Biggest mess is on Linux/X11. For key-down/up events, the Linux VM delivers actual character codes instead of scan codes, which makes a basic mapping to physical keys almost impossible. See EventSensor class >> #virtualKeysOnX11. We MUST fix that! Please. Somebody. Can I haz scan codes? ^__^</span></div><div><span style="font-size: 13.3333px"><br></span></div><div><span style="font-size: 13.3333px">***</span></div><div><img id="af6cb333-4a04-4609-ac24-d8d07d02b787" src="cid:4d3dcc25-f68b-4238-a5a7-bf997a213c69" width="491" height="215"></img><span style="font-size: 13.3333px"><br></span></div><div><span style="font-size: 13.3333px"><br></span></div><div><span style="font-size: 13.3333px">***</span></div><div><span style="font-size: 13.3333px"><br></span></div><div><span style="font-size: 13.3333px">The good news: KeyboardEvent >> #key (and UserInputEvent >> #modifiers) now gives you cross-platform stable information about physical keys to be used in keyboard handlers. Yes, for both key-stroke and key-down/up events.</span></div><div><span style="font-size: 13.3333px"><br></span></div><div><span style="font-size: 13.3333px">Or at least, that is the plan. That's why it would be great if you could help testing! :-)</span></div><div><span style="font-size: 13.3333px"><br></span></div><div><span style="font-size: 13.3333px">Why key-stroke events too? Aren't they for typing text only?</span></div><div><span style="font-size: 13.3333px"><br></span></div><div><span style="font-size: 13.3333px">1. Almost all keyboard shortcuts in current Squeak are based on key-stroke events.</span></div><div><span style="font-size: 13.3333px">2. Using the #keyCharacter is tricky because SHIFT changes lower-case to upper-case, which makes "anEvent shiftPressed" hard to understand.</span></div><div><span style="font-size: 13.3333px">3. CTRL combinations might not do the expected thing. How would you handle CTRL+C? The #keyCharacter could arrive as $c or Character enter. See the preference "Map non-printable characters to printable characters. Now, #key will always answer $C in such a case. Regardless of that preference.</span></div><div><span style="font-size: 13.3333px"><br></span></div><div><span style="font-size: 13.3333px">Can't we just use #keyCharacter in key-down/up events?</span></div><div><span style="font-size: 13.3333px"><br></span></div><div><span style="font-size: 13.3333px">No. Those are undefined. Never do that. key-down/up events carry virtual-key codes in their #keyValue. We might want to change #keyCharacter to answer "nil" for those events.</span></div><div><span style="font-size: 13.3333px"><br></span></div><div><span style="font-size: 13.3333px">***</span></div><div><span style="font-size: 13.3333px"><br></span></div><div><span style="font-size: 13.3333px">Q: What is a "physical key" or "physical modifier"?</span></div><div><span style="font-size: 13.3333px">A: The label that can be presented to the user so that he or she feels at home when using Squeak. Thus, looks platform-<b>specific</b>.</span></div><div><span style="font-size: 13.3333px"><br></span></div><div><span style="font-size: 13.3333px">Q: What is a "virtual key" or "virtual modifier"?</span></div><div><span style="font-size: 13.3333px">A: The information to be processed in your application's key handlers. Thus, looks platform-<b>independent</b>. If you have still no clue how to talk to keyboard events, please read the commentary in KeyboardEvent >> #checkCommandKey.</span></div><div><span style="font-size: 13.3333px"><br></span></div><div><span style="font-size: 13.3333px">***</span></div><div><span style="font-size: 13.3333px"><br></span></div><div><span style="font-size: 13.3333px">Happy testing! :-) And thank you all in advance!</span></div><div><span style="font-size: 13.3333px"><br></span></div><div><span style="font-size: 13.3333px">Best,</span></div><div><span style="font-size: 13.3333px">Marcel</span></div><div><span style="font-size: 13.3333px"><br></span></div><div><span style="font-size: 13.3333px">P.S.: You might want to disable the preference "synthesize mouse-wheel events from keyboard-events" to get CTRL+ArrowUp and CTRL+ArrowDown ;-)</span></div><div class="mb_sig"></div></div>