The Trunk: Kernel-mt.1290.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: Kernel-mt.1290.mcz

commits-2
Marcel Taeumel uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-mt.1290.mcz

==================== Summary ====================

Name: Kernel-mt.1290
Author: mt
Time: 23 December 2019, 11:24:23.728349 am
UUID: b2e649ef-ad9d-5040-b6b0-70b7e29e4085
Ancestors: Kernel-mt.1289

Do actually *duplicate* CTRL and CMD/ALT keys if that preference is enabled.

This means that such key-stroke events will always answer TRUE to both #controlKeyPressed and #commandKeyPressed. This solves various issues in client code. Now all paths that only check for #controlKeyPressed will match even if the duplication preference is enabled.

Note that for applications that do want to make use of CTRL and ALT/CMD in separate ways, the PREFERENCE "duplicate (all) ctrl and alt keys" has to be DISABLED. Those applications can easily check and inform the user.

Also note that key duplication means that there is no way to detect actual control keys. Disable that preference if you want to hit CTRL+C and, for example, access "Character enter" (ASCII 3) for that event's #keyCharacter.

Finally note that I will double-check effects in TextEditor asap.

=============== Diff against Kernel-mt.1289 ===============

Item was changed:
  ----- Method: EventSensor class>>installDuplicateKeyEntryFor: (in category 'key decode table') -----
  installDuplicateKeyEntryFor: aPrintableCharacter
  "Updates the key-decode table, which maps between pairs of {character code . modifier code}. See the class comment for more information.
  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."
 
  | upper lower |
  upper := aPrintableCharacter asUppercase asInteger.
  lower := aPrintableCharacter asLowercase asInteger.
 
+ KeyDecodeTable at: { lower bitAnd: 16r9F . 2 "ctrl" } put: { lower . 2 bitOr: 8 "ctrl + cmd/alt" }.
+ KeyDecodeTable at: { upper bitAnd: 16r9F . 2 bitOr: 1 "ctrl + shift" } put: { upper . (2 bitOr: 8) bitOr: 1 "ctrl + cmd/alt + shift" }.
+ KeyDecodeTable at: { lower . 8 "cmd/alt" } put: { lower . 8 bitOr: 2 "cmd/alt + ctrl" }.
+ KeyDecodeTable at: { upper . 8 bitOr: 1 "cmd/alt + shift" } put: { upper . (8 bitOr: 2) bitOr: 1 "cmd/alt + ctrl + shift" }.
- KeyDecodeTable at: { lower bitAnd: 16r9F . 2 "ctrl" } put: { lower . 8 "cmd/alt" }.
- KeyDecodeTable at: { upper bitAnd: 16r9F . 2 bitOr: 1 "ctrl+shift" } put: { upper . 8 bitOr: 1 "cmd/alt+shift" }.
 
  "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."
  self flag: #unixOnly.
+ KeyDecodeTable at: { lower . 2 "ctrl" } put: { lower . 2 bitOr: 8 "ctrl + cmd/alt" }.
+ KeyDecodeTable at: { upper . 2 bitOr: 1 "ctrl + shift" } put: { upper . (2 bitOr: 8) bitOr: 1 "ctrl + cmd/alt + shift" }.!
- KeyDecodeTable at: { lower . 2 "ctrl" } put: { lower . 8 "cmd/alt" }.
- KeyDecodeTable at: { upper . 2 bitOr: 1 "ctrl+shift" } put: { upper . 8 bitOr: 1 "cmd/alt+shift" }.!


Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Kernel-mt.1290.mcz

Nicolas Cellier
Hi Marcel,

Since Squeak is Mac oriented, it understands cmd+c = copy, cmd+v = paste, etc... (alt+c alt+v on windows).
IMO, the purpose of #duplicateAllControlAndAltKeys is mainly to let windows users type ctrl+key in accordance to platform feel.
ctrl+c = copy, ctrl+v = paste, etc...

Le lun. 23 déc. 2019 à 11:24, <[hidden email]> a écrit :
Marcel Taeumel uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-mt.1290.mcz

==================== Summary ====================

Name: Kernel-mt.1290
Author: mt
Time: 23 December 2019, 11:24:23.728349 am
UUID: b2e649ef-ad9d-5040-b6b0-70b7e29e4085
Ancestors: Kernel-mt.1289

Do actually *duplicate* CTRL and CMD/ALT keys if that preference is enabled.

This means that such key-stroke events will always answer TRUE to both #controlKeyPressed and #commandKeyPressed. This solves various issues in client code. Now all paths that only check for #controlKeyPressed will match even if the duplication preference is enabled.

Note that for applications that do want to make use of CTRL and ALT/CMD in separate ways, the PREFERENCE "duplicate (all) ctrl and alt keys" has to be DISABLED. Those applications can easily check and inform the user.

Also note that key duplication means that there is no way to detect actual control keys. Disable that preference if you want to hit CTRL+C and, for example, access "Character enter" (ASCII 3) for that event's #keyCharacter.

Finally note that I will double-check effects in TextEditor asap.

=============== Diff against Kernel-mt.1289 ===============

Item was changed:
  ----- Method: EventSensor class>>installDuplicateKeyEntryFor: (in category 'key decode table') -----
  installDuplicateKeyEntryFor: aPrintableCharacter
        "Updates the key-decode table, which maps between pairs of {character code . modifier code}. See the class comment for more information.
        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."

        | upper lower |
        upper := aPrintableCharacter asUppercase asInteger.
        lower := aPrintableCharacter asLowercase asInteger.

+       KeyDecodeTable at: { lower bitAnd: 16r9F . 2 "ctrl" } put: { lower . 2 bitOr: 8 "ctrl + cmd/alt" }.
+       KeyDecodeTable at: { upper bitAnd: 16r9F . 2 bitOr: 1 "ctrl + shift" } put: { upper . (2 bitOr: 8) bitOr: 1 "ctrl + cmd/alt + shift" }.
+       KeyDecodeTable at: { lower . 8 "cmd/alt" } put: { lower . 8 bitOr: 2 "cmd/alt + ctrl" }.
Due to this, cmd+7 never makes it way to TextEditor...
Since it now has controlKeyPressed, it is captured by/interpreted as DockingBarMorph menu #7.

IMO, this is too late in the release cycle to introduce such changes, given current code base complexity, it's too difficult to predict consequences.

+       KeyDecodeTable at: { upper . 8 bitOr: 1 "cmd/alt + shift" } put: { upper . (8 bitOr: 2) bitOr: 1 "cmd/alt + ctrl + shift" }.
-       KeyDecodeTable at: { lower bitAnd: 16r9F . 2 "ctrl" } put: { lower . 8 "cmd/alt" }.
-       KeyDecodeTable at: { upper bitAnd: 16r9F . 2 bitOr: 1 "ctrl+shift" } put: { upper . 8 bitOr: 1 "cmd/alt+shift" }.

        "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."
        self flag: #unixOnly.
+       KeyDecodeTable at: { lower . 2 "ctrl" } put: { lower . 2 bitOr: 8 "ctrl + cmd/alt" }.
+       KeyDecodeTable at: { upper . 2 bitOr: 1 "ctrl + shift" } put: { upper . (2 bitOr: 8) bitOr: 1 "ctrl + cmd/alt + shift" }.!
-       KeyDecodeTable at: { lower . 2 "ctrl" } put: { lower . 8 "cmd/alt" }.
-       KeyDecodeTable at: { upper . 2 bitOr: 1 "ctrl+shift" } put: { upper . 8 bitOr: 1 "cmd/alt+shift" }.!




Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Kernel-mt.1290.mcz

Jakob Reschke
Am Sa., 28. Dez. 2019 um 21:54 Uhr schrieb Nicolas Cellier <[hidden email]>:
IMO, the purpose of #duplicateAllControlAndAltKeys is mainly to let windows users type ctrl+key in accordance to platform feel.
ctrl+c = copy, ctrl+v = paste, etc...

But then the wiser choice would rather have been "swap Ctrl and Alt", wouldn't it?


Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Kernel-mt.1290.mcz

Eliot Miranda-2


On Dec 29, 2019, at 7:03 AM, Jakob Reschke <[hidden email]> wrote:


Am Sa., 28. Dez. 2019 um 21:54 Uhr schrieb Nicolas Cellier <[hidden email]>:
IMO, the purpose of #duplicateAllControlAndAltKeys is mainly to let windows users type ctrl+key in accordance to platform feel.
ctrl+c = copy, ctrl+v = paste, etc...

But then the wiser choice would rather have been "swap Ctrl and Alt", wouldn't it?

+1 !! Doh!!



Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Kernel-mt.1290.mcz

marcel.taeumel
In reply to this post by Jakob Reschke
But then the wiser choice would rather have been "swap Ctrl and Alt", wouldn't it?

Hehe, right. But then please swap all kinds of combinations. Not just an arbitrary selection. EventSensor is a generic place. Text editing is just one specific use case.

Best,
Marcel

Am 29.12.2019 16:03:08 schrieb Jakob Reschke <[hidden email]>:

Am Sa., 28. Dez. 2019 um 21:54 Uhr schrieb Nicolas Cellier <[hidden email]>:
IMO, the purpose of #duplicateAllControlAndAltKeys is mainly to let windows users type ctrl+key in accordance to platform feel.
ctrl+c = copy, ctrl+v = paste, etc...

But then the wiser choice would rather have been "swap Ctrl and Alt", wouldn't it?