<body><div id="__MailbirdStyleContent" style="font-size: 10pt;font-family: Arial;color: #000000">
> <span style="font-family: Arial, Helvetica, sans-serif;font-size: 13px">We can remove that hack if we adopt the VM at SHA 83e43ee7138f8a1b76ed774c3972f2691776778a as I suggested</span><div><span style="font-family: Arial, Helvetica, sans-serif;font-size: 13px"><br></span></div><div><span style="font-family: Arial, Helvetica, sans-serif;font-size: 13px">Okay, but please leave the key-swap part to swap all kinds of printable characters. Not just that ancient edit-key selection. :-)</span></div><div><span style="font-family: Arial, Helvetica, sans-serif;font-size: 13px"><br></span></div><div><span style="font-family: Arial, Helvetica, sans-serif;font-size: 13px">Best,</span></div><div><span style="font-family: Arial, Helvetica, sans-serif;font-size: 13px">Marcel</span></div><div class="mb_sig"></div><blockquote class="history_container" type="cite" style="border-left-style:solid;border-width:1px; margin-top:20px; margin-left:0px;padding-left:10px;">
<p style="color: #AAAAAA; margin-top: 10px;">Am 28.12.2019 16:52:44 schrieb Nicolas Cellier <nicolas.cellier.aka.nice@gmail.com>:</p><div style="font-family:Arial,Helvetica,sans-serif">
<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Le jeu. 19 déc. 2019 à 11:46, <<a href="mailto:commits@source.squeak.org">commits@source.squeak.org</a>> a écrit :<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Marcel Taeumel uploaded a new version of Kernel to project The Trunk:<br>
<a href="http://source.squeak.org/trunk/Kernel-mt.1289.mcz" rel="noreferrer" target="_blank">http://source.squeak.org/trunk/Kernel-mt.1289.mcz</a><br>
<br>
==================== Summary ====================<br>
<br>
Name: Kernel-mt.1289<br>
Author: mt<br>
Time: 19 December 2019, 11:45:58.637761 am<br>
UUID: e9f9d6a0-0ce8-114e-b3d2-26b481f590a1<br>
Ancestors: Kernel-mt.1288<br>
<br>
- fixes ctrl <-> alt key swapping bug in #processEvent:<br>
- fixes ctrl <-> alt key swapping by extending the range to the same range as for "duplicate *all*"<br>
- LINUX ONLY: fixes swapping and duplication of ctrl/alt keys<br>
- LINUX ONLY: maps controls keys that arrive as ASCII 64 to 127 down to ASCII 0 to 31<br>
- document that other (older) "duplicate keys" preference to be deprecated after the 5.3 release<br>
<br>
So, the current VM 201911282316 should be fine for all platforms for Squeak 5.3 at the moment.<br>
<br>
=============== Diff against Kernel-mt.1288 ===============<br>
<br>
Item was added:<br>
+ ----- Method: EventSensor class>>installControlKeyEntryFor: (in category 'key decode table') -----<br>
+ installControlKeyEntryFor: aPrintableCharacter<br>
+ <br>
+ | upper lower |<br>
+ self assert: (aPrintableCharacter asInteger between: 64 and: 95).<br>
+ <br>
+ upper := aPrintableCharacter asInteger.<br>
+ lower := aPrintableCharacter asInteger bitOr: 16r20.<br>
+ <br>
+ "For Unix/Linux VMs as of version 201911282316, no control characters will be sent from the VM. Avoid check for #platformName because the extra mapping will not affect others anyway."<br>
+ self flag: #unixOnly.<br>
+ KeyDecodeTable at: { lower . 2 "ctrl" } put: { lower bitAnd: 16r9F . 2 "ctrl" }.<br>
+ KeyDecodeTable at: { upper . 2 bitOr: 1 "ctrl+shift" } put: { upper bitAnd: 16r9F . 2 bitOr: 1 "ctrl+shift" }.!<br></blockquote><div>I have fixed this in <a href="https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/460">https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/460</a></div><div>We can remove that hack if we adopt the VM at SHA 83e43ee7138f8a1b76ed774c3972f2691776778a as I suggested (after mouse wheel fixes <a href="https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/461">https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/461</a> and <a href="https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/462">https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/462</a>)</div><div>IMO, we should adopt that VM, it restores compatibility with older ones.<br></div><div><br> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
Item was changed:<br>
----- Method: EventSensor class>>installDuplicateKeyEntryFor: (in category 'key decode table') -----<br>
installDuplicateKeyEntryFor: aPrintableCharacter<br>
"Updates the key-decode table, which maps between pairs of {character code . modifier code}. See the class comment for more information.<br>
Note that the bitmask 16r9F removes the high bits, which subtracts 64 from the key code for (upper) $A to $Z and 96 for (lower) $a to $z. The VM sends non-printable control characters for [ctrl]+[A-Za-Z] in ASCII < 32, but the given character is expected to be ASCII >= 32 and thus printable. So we have to convert printable characters to control characters in this mapping table."<br>
<br>
| upper lower |<br>
upper := aPrintableCharacter asUppercase asInteger.<br>
lower := aPrintableCharacter asLowercase asInteger.<br>
<br>
KeyDecodeTable at: { lower bitAnd: 16r9F . 2 "ctrl" } put: { lower . 8 "cmd/alt" }.<br>
KeyDecodeTable at: { upper bitAnd: 16r9F . 2 bitOr: 1 "ctrl+shift" } put: { upper . 8 bitOr: 1 "cmd/alt+shift" }.<br>
+ <br>
+ "For Unix/Linux VMs as of version 201911282316, no control characters will be sent from the VM. Avoid check for #platformName because the extra mapping will not affect others anyway."<br>
+ self flag: #unixOnly.<br>
+ KeyDecodeTable at: { lower . 2 "ctrl" } put: { lower . 8 "cmd/alt" }.<br>
+ KeyDecodeTable at: { upper . 2 bitOr: 1 "ctrl+shift" } put: { upper . 8 bitOr: 1 "cmd/alt+shift" }.!<br>
- !<br>
<br>
Item was changed:<br>
----- Method: EventSensor class>>installKeyDecodeTable (in category 'class initialization') -----<br>
installKeyDecodeTable<br>
+ "Create a decode table that swaps or duplicates some keys if the respective preference is set."<br>
+ <br>
- "Create a decode table that swaps some keys if <br>
- Preferences swapControlAndAltKeys is set"<br>
KeyDecodeTable := Dictionary new.<br>
+ <br>
+ "In any case, ensure that control keys are mapped correctly."<br>
+ self flag: #toRemove. "mt: If all VMs send the correct control keys on all platforms, we will remove this mapping."<br>
+ 64 "$@" to: 95 "$_"do: [:keyCode | self installControlKeyEntryFor: keyCode asCharacter].<br>
+ <br>
- Preferences duplicateControlAndAltKeys <br>
- ifTrue: [ self defaultCrossPlatformKeys do:<br>
- [ :c | self installDuplicateKeyEntryFor: c ] ].<br>
Preferences swapControlAndAltKeys <br>
+ ifTrue: [ (Character allByteCharacters select: [:ea | ea isAlphaNumeric]) do:<br>
- ifTrue: [ self defaultCrossPlatformKeys do:<br>
[ :c | self installSwappedKeyEntryFor: c ] ].<br>
Preferences duplicateAllControlAndAltKeys<br>
ifTrue: [ (Character allByteCharacters select: [:ea | ea isAlphaNumeric]) do:<br>
[ :c | self installDuplicateKeyEntryFor: c ] ].<br>
+ <br>
+ self flag: #toDeprecate. "mt: This mapping should be deprecated in the future."<br>
+ Preferences duplicateControlAndAltKeys <br>
+ ifTrue: [ self defaultCrossPlatformKeys do:<br>
+ [ :c | self installDuplicateKeyEntryFor: c ] ].<br>
!<br>
<br>
Item was changed:<br>
----- Method: EventSensor class>>installSwappedKeyEntryFor: (in category 'key decode table') -----<br>
installSwappedKeyEntryFor: aPrintableCharacter<br>
"Updates the key-decode table, which maps between pairs of {character code . modifier code}. See the class comment for more information.<br>
Note that the bitmask 16r9F removes the high bits, which subtracts 64 from the key code for (upper) $A to $Z and 96 for (lower) $a to $z. The VM sends non-printable control characters for [ctrl]+[A-Za-Z] in ASCII < 32, but the given character is expected to be ASCII >= 32 and thus printable. So we have to convert printable characters to control characters in this mapping table."<br>
<br>
| upper lower |<br>
upper := aPrintableCharacter asUppercase asInteger.<br>
lower := aPrintableCharacter asLowercase asInteger.<br>
<br>
KeyDecodeTable at: { lower bitAnd: 16r9F . 2 "ctrl" } put: { lower . 8 "cmd/alt" }.<br>
KeyDecodeTable at: { lower . 8 "cmd/alt" } put: { lower bitAnd: 16r9F . 2 "ctrl" }.<br>
KeyDecodeTable at: { upper bitAnd: 16r9F . 2 bitOr: 1 "ctrl+shift" } put: { upper . 8 bitOr: 1 "cmd/alt+shift" }.<br>
+ KeyDecodeTable at: { upper . 8 bitOr: 1 "cmd/alt+shift" } put: { upper bitAnd: 16r9F . 2 bitOr: 1 "ctrl+shift" }.<br>
+ <br>
+ "For Unix/Linux VMs as of version 201911282316, no control characters will be sent from the VM. Avoid check for #platformName because the extra mapping will not affect others anyway."<br>
+ self flag: #unixOnly.<br>
+ KeyDecodeTable at: { lower . 2 "ctrl" } put: { lower . 8 "cmd/alt" }.<br>
+ KeyDecodeTable at: { upper . 2 bitOr: 1 "ctrl+shift" } put: { upper . 8 bitOr: 1 "cmd/alt+shift" }.!<br>
- KeyDecodeTable at: { upper . 8 bitOr: 1 "cmd/alt+shift" } put: { upper bitAnd: 16r9F . 2 bitOr: 1 "ctrl+shift" }.!<br>
<br>
Item was changed:<br>
----- Method: EventSensor>>processEvent: (in category 'private-I/O') -----<br>
processEvent: evt <br>
"Process a single event. This method is run at high priority."<br>
| type buttons window |<br>
type := evt at: 1.<br>
<br>
"Only process main window events, forward others to host window proxies"<br>
window := evt at: 8.<br>
(window isNil or: [window isZero]) ifTrue: <br>
[window := 1. <br>
evt at: 8 put: window].<br>
window = 1 ifFalse: [<br>
^Smalltalk at: #HostWindowProxy ifPresent: [:w | w processEvent: evt]].<br>
<br>
"Tackle mouse events and mouse wheel events first"<br>
(type = EventTypeMouse or: [type = EventTypeMouseWheel])<br>
ifTrue: [buttons := (ButtonDecodeTable at: (evt at: 5) + 1). <br>
evt at: 5 put: (Smalltalk platformName = 'Mac OS'<br>
ifTrue: [ buttons ]<br>
ifFalse: [ self mapButtons: buttons modifiers: (evt at: 6) ]).<br>
self queueEvent: evt.<br>
type = EventTypeMouse ifTrue: [self processMouseEvent: evt].<br>
type = EventTypeMouseWheel ifTrue: [self processMouseWheelEvent: evt]. <br>
^self].<br>
<br>
"Store the event in the queue if there's any"<br>
type = EventTypeKeyboard<br>
ifTrue: [ "Check if the event is a user interrupt"<br>
((evt at: 4) = EventKeyChar<br>
and: [((evt at: 3)<br>
bitOr: (((evt at: 5)<br>
bitAnd: 8)<br>
bitShift: 8))<br>
= interruptKey])<br>
ifTrue: ["interrupt key is meta - not reported as event"<br>
^ interruptSemaphore signal].<br>
"Decode keys for characters (i.e., duplicate or swap, ctrl <-> alt/cmd)."<br>
(evt at: 4) = EventKeyChar<br>
+ ifTrue: [ | unicode ascii |<br>
+ "Copy lookup key first in case of key swap."<br>
+ unicode := {evt at: 6. evt at: 5}.<br>
+ ascii := {evt at: 3. evt at: 5}.<br>
- ifTrue: [ <br>
KeyDecodeTable "Unicode character first"<br>
+ at: unicode<br>
- at: {evt at: 6. evt at: 5}<br>
ifPresent: [:a | evt at: 6 put: a first;<br>
at: 5 put: a second]. <br>
KeyDecodeTable "ASCII character second"<br>
+ at: ascii<br>
- at: {evt at: 3. evt at: 5}<br>
ifPresent: [:a | evt at: 3 put: a first;<br>
at: 5 put: a second]]. <br>
self queueEvent: evt. <br>
self processKeyboardEvent: evt . <br>
^self ].<br>
<br>
"Handle all events other than Keyboard or Mouse."<br>
self queueEvent: evt.<br>
!<br>
<br>
<br>
</blockquote></div></div>
</div></blockquote>
</div></body>