The Inbox: Kernel-nice.1292.mcz

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

The Inbox: Kernel-nice.1292.mcz

commits-2
Nicolas Cellier uploaded a new version of Kernel to project The Inbox:
http://source.squeak.org/inbox/Kernel-nice.1292.mcz

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

Name: Kernel-nice.1292
Author: nice
Time: 28 December 2019, 10:15:37.810563 pm
UUID: 8cce1ea4-5e21-46f5-858f-0732cf2e33d5
Ancestors: Kernel-nice.1291

Assuming that patched VM will produce ASCII control characters (code 1 to 26) again when pressing ctrl+letter, revert some of the recent keyboard event mapping changes (See https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/460).

Those recent changes have unexpected consequences and implications that we might better postpone post release. We should never have to say that, but it's easier to fix the VM than the image in this case ;)

One example of consequences is that cmd+7 is captured by DockingBarMorph as menu #7 rather than passed to theTextEditor if Preferences duplicateAllControlAndAltKeys.

I guess that we have this preference enabled to make windows user experience not to werid wrt native feel (ctrl+key is the shortcut of choice)...

=============== Diff against Kernel-nice.1291 ===============

Item was removed:
- ----- Method: EventSensor class>>installControlKeyEntryFor: (in category 'key decode table') -----
- installControlKeyEntryFor: aPrintableCharacter
-
- | upper lower |
- self assert: (aPrintableCharacter asInteger between: 64 and: 95).
-
- upper := aPrintableCharacter asInteger.
- lower := aPrintableCharacter asInteger bitOr: 16r20.
-
- "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 bitAnd: 16r9F . 2 "ctrl" }.
- KeyDecodeTable at: { upper . 2 bitOr: 1 "ctrl+shift" } put: { upper bitAnd: 16r9F . 2 bitOr: 1 "ctrl+shift" }.!

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.
+ The purpose of this change is to let ctrl+key act like cmd+key (Mac) or alt+key (linux/windows).
+ It is especially usefull on windows VM where default feel is to use ctrl as shortcut (ctrl+C = copy, etc...).
+ 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 control characters to printable characters in this mapping table."
- "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 . 8 "cmd/alt" }.
+ KeyDecodeTable at: { upper bitAnd: 16r9F . 2 bitOr: 1 "ctrl + shift" } put: { upper . 8 bitOr: 1 "cmd/alt + shift" }.!
- 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" }.
-
- "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" }.!

Item was changed:
  ----- Method: EventSensor class>>installKeyDecodeTable (in category 'class initialization') -----
  installKeyDecodeTable
  "Create a decode table that swaps or duplicates some keys if the respective preference is set."
 
  KeyDecodeTable := Dictionary new.
 
- "In any case, ensure that control keys are mapped correctly."
- self flag: #toRemove. "mt: If all VMs send the correct control keys on all platforms, we will remove this mapping."
- 64 "$@" to: 95 "$_"do: [:keyCode | self installControlKeyEntryFor: keyCode asCharacter].
-
  Preferences swapControlAndAltKeys
  ifTrue: [ (Character allByteCharacters select: [:ea | ea isAlphaNumeric]) do:
  [ :c | self installSwappedKeyEntryFor: c ] ].
  Preferences duplicateAllControlAndAltKeys
  ifTrue: [ (Character allByteCharacters select: [:ea | ea isAlphaNumeric]) do:
  [ :c | self installDuplicateKeyEntryFor: c ] ].
 
  self flag: #toDeprecate. "mt: This mapping should be deprecated in the future."
  Preferences duplicateControlAndAltKeys
  ifTrue: [ self defaultCrossPlatformKeys do:
  [ :c | self installDuplicateKeyEntryFor: c ] ].
  !

Item was changed:
  ----- Method: EventSensor class>>installSwappedKeyEntryFor: (in category 'key decode table') -----
  installSwappedKeyEntryFor: 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 . 8 "cmd/alt" }.
  KeyDecodeTable at: { lower . 8 "cmd/alt" } put: { lower bitAnd: 16r9F . 2 "ctrl" }.
  KeyDecodeTable at: { upper bitAnd: 16r9F . 2 bitOr: 1 "ctrl+shift" } put: { upper . 8 bitOr: 1 "cmd/alt+shift" }.
+ KeyDecodeTable at: { upper . 8 bitOr: 1 "cmd/alt+shift" } put: { upper bitAnd: 16r9F . 2 bitOr: 1 "ctrl+shift" }.!
- KeyDecodeTable at: { upper . 8 bitOr: 1 "cmd/alt+shift" } put: { upper bitAnd: 16r9F . 2 bitOr: 1 "ctrl+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 . 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 Inbox: Kernel-nice.1292.mcz

marcel.taeumel
Ha! Damn. :-) Actual ctrl/cmd dupcliation causes too much trouble in the current Trunk? Hmpf...

But CTRL+[0-9] to trigger the world-main docking bar cannot work if duplication is enabled, can it?

Best,
Marcel

Am 28.12.2019 22:16:01 schrieb [hidden email] <[hidden email]>:

Nicolas Cellier uploaded a new version of Kernel to project The Inbox:
http://source.squeak.org/inbox/Kernel-nice.1292.mcz

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

Name: Kernel-nice.1292
Author: nice
Time: 28 December 2019, 10:15:37.810563 pm
UUID: 8cce1ea4-5e21-46f5-858f-0732cf2e33d5
Ancestors: Kernel-nice.1291

Assuming that patched VM will produce ASCII control characters (code 1 to 26) again when pressing ctrl+letter, revert some of the recent keyboard event mapping changes (See https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/460).

Those recent changes have unexpected consequences and implications that we might better postpone post release. We should never have to say that, but it's easier to fix the VM than the image in this case ;)

One example of consequences is that cmd+7 is captured by DockingBarMorph as menu #7 rather than passed to theTextEditor if Preferences duplicateAllControlAndAltKeys.

I guess that we have this preference enabled to make windows user experience not to werid wrt native feel (ctrl+key is the shortcut of choice)...

=============== Diff against Kernel-nice.1291 ===============

Item was removed:
- ----- Method: EventSensor class>>installControlKeyEntryFor: (in category 'key decode table') -----
- installControlKeyEntryFor: aPrintableCharacter
-
- | upper lower |
- self assert: (aPrintableCharacter asInteger between: 64 and: 95).
-
- upper := aPrintableCharacter asInteger.
- lower := aPrintableCharacter asInteger bitOr: 16r20.
-
- "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 bitAnd: 16r9F . 2 "ctrl" }.
- KeyDecodeTable at: { upper . 2 bitOr: 1 "ctrl+shift" } put: { upper bitAnd: 16r9F . 2 bitOr: 1 "ctrl+shift" }.!

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.
+ The purpose of this change is to let ctrl+key act like cmd+key (Mac) or alt+key (linux/windows).
+ It is especially usefull on windows VM where default feel is to use ctrl as shortcut (ctrl+C = copy, etc...).
+ 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 control characters to printable characters in this mapping table."
- "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 . 8 "cmd/alt" }.
+ KeyDecodeTable at: { upper bitAnd: 16r9F . 2 bitOr: 1 "ctrl + shift" } put: { upper . 8 bitOr: 1 "cmd/alt + shift" }.!
- 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" }.
-
- "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" }.!

Item was changed:
----- Method: EventSensor class>>installKeyDecodeTable (in category 'class initialization') -----
installKeyDecodeTable
"Create a decode table that swaps or duplicates some keys if the respective preference is set."

KeyDecodeTable := Dictionary new.

- "In any case, ensure that control keys are mapped correctly."
- self flag: #toRemove. "mt: If all VMs send the correct control keys on all platforms, we will remove this mapping."
- 64 "$@" to: 95 "$_"do: [:keyCode | self installControlKeyEntryFor: keyCode asCharacter].
-
Preferences swapControlAndAltKeys
ifTrue: [ (Character allByteCharacters select: [:ea | ea isAlphaNumeric]) do:
[ :c | self installSwappedKeyEntryFor: c ] ].
Preferences duplicateAllControlAndAltKeys
ifTrue: [ (Character allByteCharacters select: [:ea | ea isAlphaNumeric]) do:
[ :c | self installDuplicateKeyEntryFor: c ] ].

self flag: #toDeprecate. "mt: This mapping should be deprecated in the future."
Preferences duplicateControlAndAltKeys
ifTrue: [ self defaultCrossPlatformKeys do:
[ :c | self installDuplicateKeyEntryFor: c ] ].
!

Item was changed:
----- Method: EventSensor class>>installSwappedKeyEntryFor: (in category 'key decode table') -----
installSwappedKeyEntryFor: 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 . 8 "cmd/alt" }.
KeyDecodeTable at: { lower . 8 "cmd/alt" } put: { lower bitAnd: 16r9F . 2 "ctrl" }.
KeyDecodeTable at: { upper bitAnd: 16r9F . 2 bitOr: 1 "ctrl+shift" } put: { upper . 8 bitOr: 1 "cmd/alt+shift" }.
+ KeyDecodeTable at: { upper . 8 bitOr: 1 "cmd/alt+shift" } put: { upper bitAnd: 16r9F . 2 bitOr: 1 "ctrl+shift" }.!
- KeyDecodeTable at: { upper . 8 bitOr: 1 "cmd/alt+shift" } put: { upper bitAnd: 16r9F . 2 bitOr: 1 "ctrl+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 . 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 Inbox: Kernel-nice.1292.mcz

Nicolas Cellier

Le lun. 6 janv. 2020 à 11:50, Marcel Taeumel <[hidden email]> a écrit :
Ha! Damn. :-) Actual ctrl/cmd dupcliation causes too much trouble in the current Trunk? Hmpf...

But CTRL+[0-9] to trigger the world-main docking bar cannot work if duplication is enabled, can it?

It appears to work on Windows VM

Best,
Marcel

Am 28.12.2019 22:16:01 schrieb [hidden email] <[hidden email]>:

Nicolas Cellier uploaded a new version of Kernel to project The Inbox:
http://source.squeak.org/inbox/Kernel-nice.1292.mcz

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

Name: Kernel-nice.1292
Author: nice
Time: 28 December 2019, 10:15:37.810563 pm
UUID: 8cce1ea4-5e21-46f5-858f-0732cf2e33d5
Ancestors: Kernel-nice.1291

Assuming that patched VM will produce ASCII control characters (code 1 to 26) again when pressing ctrl+letter, revert some of the recent keyboard event mapping changes (See https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/460).

Those recent changes have unexpected consequences and implications that we might better postpone post release. We should never have to say that, but it's easier to fix the VM than the image in this case ;)

One example of consequences is that cmd+7 is captured by DockingBarMorph as menu #7 rather than passed to theTextEditor if Preferences duplicateAllControlAndAltKeys.

I guess that we have this preference enabled to make windows user experience not to werid wrt native feel (ctrl+key is the shortcut of choice)...

=============== Diff against Kernel-nice.1291 ===============

Item was removed:
- ----- Method: EventSensor class>>installControlKeyEntryFor: (in category 'key decode table') -----
- installControlKeyEntryFor: aPrintableCharacter
-
- | upper lower |
- self assert: (aPrintableCharacter asInteger between: 64 and: 95).
-
- upper := aPrintableCharacter asInteger.
- lower := aPrintableCharacter asInteger bitOr: 16r20.
-
- "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 bitAnd: 16r9F . 2 "ctrl" }.
- KeyDecodeTable at: { upper . 2 bitOr: 1 "ctrl+shift" } put: { upper bitAnd: 16r9F . 2 bitOr: 1 "ctrl+shift" }.!

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.
+ The purpose of this change is to let ctrl+key act like cmd+key (Mac) or alt+key (linux/windows).
+ It is especially usefull on windows VM where default feel is to use ctrl as shortcut (ctrl+C = copy, etc...).
+ 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 control characters to printable characters in this mapping table."
- "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 . 8 "cmd/alt" }.
+ KeyDecodeTable at: { upper bitAnd: 16r9F . 2 bitOr: 1 "ctrl + shift" } put: { upper . 8 bitOr: 1 "cmd/alt + shift" }.!
- 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" }.
-
- "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" }.!

Item was changed:
----- Method: EventSensor class>>installKeyDecodeTable (in category 'class initialization') -----
installKeyDecodeTable
"Create a decode table that swaps or duplicates some keys if the respective preference is set."

KeyDecodeTable := Dictionary new.

- "In any case, ensure that control keys are mapped correctly."
- self flag: #toRemove. "mt: If all VMs send the correct control keys on all platforms, we will remove this mapping."
- 64 "$@" to: 95 "$_"do: [:keyCode | self installControlKeyEntryFor: keyCode asCharacter].
-
Preferences swapControlAndAltKeys
ifTrue: [ (Character allByteCharacters select: [:ea | ea isAlphaNumeric]) do:
[ :c | self installSwappedKeyEntryFor: c ] ].
Preferences duplicateAllControlAndAltKeys
ifTrue: [ (Character allByteCharacters select: [:ea | ea isAlphaNumeric]) do:
[ :c | self installDuplicateKeyEntryFor: c ] ].

self flag: #toDeprecate. "mt: This mapping should be deprecated in the future."
Preferences duplicateControlAndAltKeys
ifTrue: [ self defaultCrossPlatformKeys do:
[ :c | self installDuplicateKeyEntryFor: c ] ].
!

Item was changed:
----- Method: EventSensor class>>installSwappedKeyEntryFor: (in category 'key decode table') -----
installSwappedKeyEntryFor: 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 . 8 "cmd/alt" }.
KeyDecodeTable at: { lower . 8 "cmd/alt" } put: { lower bitAnd: 16r9F . 2 "ctrl" }.
KeyDecodeTable at: { upper bitAnd: 16r9F . 2 bitOr: 1 "ctrl+shift" } put: { upper . 8 bitOr: 1 "cmd/alt+shift" }.
+ KeyDecodeTable at: { upper . 8 bitOr: 1 "cmd/alt+shift" } put: { upper bitAnd: 16r9F . 2 bitOr: 1 "ctrl+shift" }.!
- KeyDecodeTable at: { upper . 8 bitOr: 1 "cmd/alt+shift" } put: { upper bitAnd: 16r9F . 2 bitOr: 1 "ctrl+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 . 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 Inbox: Kernel-nice.1292.mcz

marcel.taeumel
Just because of key-down vs. key-stroke, right? And I removed that key-down check recently because of another bug. See DockingBarMorph>>#filterEvent:For:.

Best,
Marcel

Am 06.01.2020 11:56:53 schrieb Nicolas Cellier <[hidden email]>:


Le lun. 6 janv. 2020 à 11:50, Marcel Taeumel <[hidden email]> a écrit :
Ha! Damn. :-) Actual ctrl/cmd dupcliation causes too much trouble in the current Trunk? Hmpf...

But CTRL+[0-9] to trigger the world-main docking bar cannot work if duplication is enabled, can it?

It appears to work on Windows VM

Best,
Marcel

Am 28.12.2019 22:16:01 schrieb [hidden email] <[hidden email]>:

Nicolas Cellier uploaded a new version of Kernel to project The Inbox:
http://source.squeak.org/inbox/Kernel-nice.1292.mcz

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

Name: Kernel-nice.1292
Author: nice
Time: 28 December 2019, 10:15:37.810563 pm
UUID: 8cce1ea4-5e21-46f5-858f-0732cf2e33d5
Ancestors: Kernel-nice.1291

Assuming that patched VM will produce ASCII control characters (code 1 to 26) again when pressing ctrl+letter, revert some of the recent keyboard event mapping changes (See https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/460).

Those recent changes have unexpected consequences and implications that we might better postpone post release. We should never have to say that, but it's easier to fix the VM than the image in this case ;)

One example of consequences is that cmd+7 is captured by DockingBarMorph as menu #7 rather than passed to theTextEditor if Preferences duplicateAllControlAndAltKeys.

I guess that we have this preference enabled to make windows user experience not to werid wrt native feel (ctrl+key is the shortcut of choice)...

=============== Diff against Kernel-nice.1291 ===============

Item was removed:
- ----- Method: EventSensor class>>installControlKeyEntryFor: (in category 'key decode table') -----
- installControlKeyEntryFor: aPrintableCharacter
-
- | upper lower |
- self assert: (aPrintableCharacter asInteger between: 64 and: 95).
-
- upper := aPrintableCharacter asInteger.
- lower := aPrintableCharacter asInteger bitOr: 16r20.
-
- "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 bitAnd: 16r9F . 2 "ctrl" }.
- KeyDecodeTable at: { upper . 2 bitOr: 1 "ctrl+shift" } put: { upper bitAnd: 16r9F . 2 bitOr: 1 "ctrl+shift" }.!

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.
+ The purpose of this change is to let ctrl+key act like cmd+key (Mac) or alt+key (linux/windows).
+ It is especially usefull on windows VM where default feel is to use ctrl as shortcut (ctrl+C = copy, etc...).
+ 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 control characters to printable characters in this mapping table."
- "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 . 8 "cmd/alt" }.
+ KeyDecodeTable at: { upper bitAnd: 16r9F . 2 bitOr: 1 "ctrl + shift" } put: { upper . 8 bitOr: 1 "cmd/alt + shift" }.!
- 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" }.
-
- "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" }.!

Item was changed:
----- Method: EventSensor class>>installKeyDecodeTable (in category 'class initialization') -----
installKeyDecodeTable
"Create a decode table that swaps or duplicates some keys if the respective preference is set."

KeyDecodeTable := Dictionary new.

- "In any case, ensure that control keys are mapped correctly."
- self flag: #toRemove. "mt: If all VMs send the correct control keys on all platforms, we will remove this mapping."
- 64 "$@" to: 95 "$_"do: [:keyCode | self installControlKeyEntryFor: keyCode asCharacter].
-
Preferences swapControlAndAltKeys
ifTrue: [ (Character allByteCharacters select: [:ea | ea isAlphaNumeric]) do:
[ :c | self installSwappedKeyEntryFor: c ] ].
Preferences duplicateAllControlAndAltKeys
ifTrue: [ (Character allByteCharacters select: [:ea | ea isAlphaNumeric]) do:
[ :c | self installDuplicateKeyEntryFor: c ] ].

self flag: #toDeprecate. "mt: This mapping should be deprecated in the future."
Preferences duplicateControlAndAltKeys
ifTrue: [ self defaultCrossPlatformKeys do:
[ :c | self installDuplicateKeyEntryFor: c ] ].
!

Item was changed:
----- Method: EventSensor class>>installSwappedKeyEntryFor: (in category 'key decode table') -----
installSwappedKeyEntryFor: 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 . 8 "cmd/alt" }.
KeyDecodeTable at: { lower . 8 "cmd/alt" } put: { lower bitAnd: 16r9F . 2 "ctrl" }.
KeyDecodeTable at: { upper bitAnd: 16r9F . 2 bitOr: 1 "ctrl+shift" } put: { upper . 8 bitOr: 1 "cmd/alt+shift" }.
+ KeyDecodeTable at: { upper . 8 bitOr: 1 "cmd/alt+shift" } put: { upper bitAnd: 16r9F . 2 bitOr: 1 "ctrl+shift" }.!
- KeyDecodeTable at: { upper . 8 bitOr: 1 "cmd/alt+shift" } put: { upper bitAnd: 16r9F . 2 bitOr: 1 "ctrl+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 . 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 Inbox: Kernel-nice.1292.mcz

Nicolas Cellier
I do not see any handler for keyDown events, so I think that image is just handling regular keyStroke events...
I hav a franch keyboard, so maybe there is some device specific behavior?

Le lun. 6 janv. 2020 à 12:01, Marcel Taeumel <[hidden email]> a écrit :
Just because of key-down vs. key-stroke, right? And I removed that key-down check recently because of another bug. See DockingBarMorph>>#filterEvent:For:.

Best,
Marcel

Am 06.01.2020 11:56:53 schrieb Nicolas Cellier <[hidden email]>:


Le lun. 6 janv. 2020 à 11:50, Marcel Taeumel <[hidden email]> a écrit :
Ha! Damn. :-) Actual ctrl/cmd dupcliation causes too much trouble in the current Trunk? Hmpf...

But CTRL+[0-9] to trigger the world-main docking bar cannot work if duplication is enabled, can it?

It appears to work on Windows VM

Best,
Marcel

Am 28.12.2019 22:16:01 schrieb [hidden email] <[hidden email]>:

Nicolas Cellier uploaded a new version of Kernel to project The Inbox:
http://source.squeak.org/inbox/Kernel-nice.1292.mcz

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

Name: Kernel-nice.1292
Author: nice
Time: 28 December 2019, 10:15:37.810563 pm
UUID: 8cce1ea4-5e21-46f5-858f-0732cf2e33d5
Ancestors: Kernel-nice.1291

Assuming that patched VM will produce ASCII control characters (code 1 to 26) again when pressing ctrl+letter, revert some of the recent keyboard event mapping changes (See https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/460).

Those recent changes have unexpected consequences and implications that we might better postpone post release. We should never have to say that, but it's easier to fix the VM than the image in this case ;)

One example of consequences is that cmd+7 is captured by DockingBarMorph as menu #7 rather than passed to theTextEditor if Preferences duplicateAllControlAndAltKeys.

I guess that we have this preference enabled to make windows user experience not to werid wrt native feel (ctrl+key is the shortcut of choice)...

=============== Diff against Kernel-nice.1291 ===============

Item was removed:
- ----- Method: EventSensor class>>installControlKeyEntryFor: (in category 'key decode table') -----
- installControlKeyEntryFor: aPrintableCharacter
-
- | upper lower |
- self assert: (aPrintableCharacter asInteger between: 64 and: 95).
-
- upper := aPrintableCharacter asInteger.
- lower := aPrintableCharacter asInteger bitOr: 16r20.
-
- "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 bitAnd: 16r9F . 2 "ctrl" }.
- KeyDecodeTable at: { upper . 2 bitOr: 1 "ctrl+shift" } put: { upper bitAnd: 16r9F . 2 bitOr: 1 "ctrl+shift" }.!

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.
+ The purpose of this change is to let ctrl+key act like cmd+key (Mac) or alt+key (linux/windows).
+ It is especially usefull on windows VM where default feel is to use ctrl as shortcut (ctrl+C = copy, etc...).
+ 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 control characters to printable characters in this mapping table."
- "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 . 8 "cmd/alt" }.
+ KeyDecodeTable at: { upper bitAnd: 16r9F . 2 bitOr: 1 "ctrl + shift" } put: { upper . 8 bitOr: 1 "cmd/alt + shift" }.!
- 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" }.
-
- "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" }.!

Item was changed:
----- Method: EventSensor class>>installKeyDecodeTable (in category 'class initialization') -----
installKeyDecodeTable
"Create a decode table that swaps or duplicates some keys if the respective preference is set."

KeyDecodeTable := Dictionary new.

- "In any case, ensure that control keys are mapped correctly."
- self flag: #toRemove. "mt: If all VMs send the correct control keys on all platforms, we will remove this mapping."
- 64 "$@" to: 95 "$_"do: [:keyCode | self installControlKeyEntryFor: keyCode asCharacter].
-
Preferences swapControlAndAltKeys
ifTrue: [ (Character allByteCharacters select: [:ea | ea isAlphaNumeric]) do:
[ :c | self installSwappedKeyEntryFor: c ] ].
Preferences duplicateAllControlAndAltKeys
ifTrue: [ (Character allByteCharacters select: [:ea | ea isAlphaNumeric]) do:
[ :c | self installDuplicateKeyEntryFor: c ] ].

self flag: #toDeprecate. "mt: This mapping should be deprecated in the future."
Preferences duplicateControlAndAltKeys
ifTrue: [ self defaultCrossPlatformKeys do:
[ :c | self installDuplicateKeyEntryFor: c ] ].
!

Item was changed:
----- Method: EventSensor class>>installSwappedKeyEntryFor: (in category 'key decode table') -----
installSwappedKeyEntryFor: 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 . 8 "cmd/alt" }.
KeyDecodeTable at: { lower . 8 "cmd/alt" } put: { lower bitAnd: 16r9F . 2 "ctrl" }.
KeyDecodeTable at: { upper bitAnd: 16r9F . 2 bitOr: 1 "ctrl+shift" } put: { upper . 8 bitOr: 1 "cmd/alt+shift" }.
+ KeyDecodeTable at: { upper . 8 bitOr: 1 "cmd/alt+shift" } put: { upper bitAnd: 16r9F . 2 bitOr: 1 "ctrl+shift" }.!
- KeyDecodeTable at: { upper . 8 bitOr: 1 "cmd/alt+shift" } put: { upper bitAnd: 16r9F . 2 bitOr: 1 "ctrl+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 . 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 Inbox: Kernel-nice.1292.mcz

Nicolas Cellier


Le lun. 6 janv. 2020 à 14:12, Nicolas Cellier <[hidden email]> a écrit :
I do not see any handler for keyDown events, so I think that image is just handling regular keyStroke events...
I hav a franch keyboard, so maybe there is some device specific behavior?
and big fingers...


Le lun. 6 janv. 2020 à 12:01, Marcel Taeumel <[hidden email]> a écrit :
Just because of key-down vs. key-stroke, right? And I removed that key-down check recently because of another bug. See DockingBarMorph>>#filterEvent:For:.

Best,
Marcel

Am 06.01.2020 11:56:53 schrieb Nicolas Cellier <[hidden email]>:


Le lun. 6 janv. 2020 à 11:50, Marcel Taeumel <[hidden email]> a écrit :
Ha! Damn. :-) Actual ctrl/cmd dupcliation causes too much trouble in the current Trunk? Hmpf...

But CTRL+[0-9] to trigger the world-main docking bar cannot work if duplication is enabled, can it?

It appears to work on Windows VM

Best,
Marcel

Am 28.12.2019 22:16:01 schrieb [hidden email] <[hidden email]>:

Nicolas Cellier uploaded a new version of Kernel to project The Inbox:
http://source.squeak.org/inbox/Kernel-nice.1292.mcz

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

Name: Kernel-nice.1292
Author: nice
Time: 28 December 2019, 10:15:37.810563 pm
UUID: 8cce1ea4-5e21-46f5-858f-0732cf2e33d5
Ancestors: Kernel-nice.1291

Assuming that patched VM will produce ASCII control characters (code 1 to 26) again when pressing ctrl+letter, revert some of the recent keyboard event mapping changes (See https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/460).

Those recent changes have unexpected consequences and implications that we might better postpone post release. We should never have to say that, but it's easier to fix the VM than the image in this case ;)

One example of consequences is that cmd+7 is captured by DockingBarMorph as menu #7 rather than passed to theTextEditor if Preferences duplicateAllControlAndAltKeys.

I guess that we have this preference enabled to make windows user experience not to werid wrt native feel (ctrl+key is the shortcut of choice)...

=============== Diff against Kernel-nice.1291 ===============

Item was removed:
- ----- Method: EventSensor class>>installControlKeyEntryFor: (in category 'key decode table') -----
- installControlKeyEntryFor: aPrintableCharacter
-
- | upper lower |
- self assert: (aPrintableCharacter asInteger between: 64 and: 95).
-
- upper := aPrintableCharacter asInteger.
- lower := aPrintableCharacter asInteger bitOr: 16r20.
-
- "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 bitAnd: 16r9F . 2 "ctrl" }.
- KeyDecodeTable at: { upper . 2 bitOr: 1 "ctrl+shift" } put: { upper bitAnd: 16r9F . 2 bitOr: 1 "ctrl+shift" }.!

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.
+ The purpose of this change is to let ctrl+key act like cmd+key (Mac) or alt+key (linux/windows).
+ It is especially usefull on windows VM where default feel is to use ctrl as shortcut (ctrl+C = copy, etc...).
+ 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 control characters to printable characters in this mapping table."
- "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 . 8 "cmd/alt" }.
+ KeyDecodeTable at: { upper bitAnd: 16r9F . 2 bitOr: 1 "ctrl + shift" } put: { upper . 8 bitOr: 1 "cmd/alt + shift" }.!
- 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" }.
-
- "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" }.!

Item was changed:
----- Method: EventSensor class>>installKeyDecodeTable (in category 'class initialization') -----
installKeyDecodeTable
"Create a decode table that swaps or duplicates some keys if the respective preference is set."

KeyDecodeTable := Dictionary new.

- "In any case, ensure that control keys are mapped correctly."
- self flag: #toRemove. "mt: If all VMs send the correct control keys on all platforms, we will remove this mapping."
- 64 "$@" to: 95 "$_"do: [:keyCode | self installControlKeyEntryFor: keyCode asCharacter].
-
Preferences swapControlAndAltKeys
ifTrue: [ (Character allByteCharacters select: [:ea | ea isAlphaNumeric]) do:
[ :c | self installSwappedKeyEntryFor: c ] ].
Preferences duplicateAllControlAndAltKeys
ifTrue: [ (Character allByteCharacters select: [:ea | ea isAlphaNumeric]) do:
[ :c | self installDuplicateKeyEntryFor: c ] ].

self flag: #toDeprecate. "mt: This mapping should be deprecated in the future."
Preferences duplicateControlAndAltKeys
ifTrue: [ self defaultCrossPlatformKeys do:
[ :c | self installDuplicateKeyEntryFor: c ] ].
!

Item was changed:
----- Method: EventSensor class>>installSwappedKeyEntryFor: (in category 'key decode table') -----
installSwappedKeyEntryFor: 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 . 8 "cmd/alt" }.
KeyDecodeTable at: { lower . 8 "cmd/alt" } put: { lower bitAnd: 16r9F . 2 "ctrl" }.
KeyDecodeTable at: { upper bitAnd: 16r9F . 2 bitOr: 1 "ctrl+shift" } put: { upper . 8 bitOr: 1 "cmd/alt+shift" }.
+ KeyDecodeTable at: { upper . 8 bitOr: 1 "cmd/alt+shift" } put: { upper bitAnd: 16r9F . 2 bitOr: 1 "ctrl+shift" }.!
- KeyDecodeTable at: { upper . 8 bitOr: 1 "cmd/alt+shift" } put: { upper bitAnd: 16r9F . 2 bitOr: 1 "ctrl+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 . 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 Inbox: Kernel-nice.1292.mcz

marcel.taeumel
Hi Nicolas,

you can revert those key-duplication/swapping things if you think it is better for 5.3. :-) 

Still, I am not sure we can solve the issue of keyboard shortcuts on all platforms for 5.3 in a satisfying way right now.

Best,
Marcel

Am 06.01.2020 14:17:03 schrieb Nicolas Cellier <[hidden email]>:



Le lun. 6 janv. 2020 à 14:12, Nicolas Cellier <[hidden email]> a écrit :
I do not see any handler for keyDown events, so I think that image is just handling regular keyStroke events...
I hav a franch keyboard, so maybe there is some device specific behavior?
and big fingers...


Le lun. 6 janv. 2020 à 12:01, Marcel Taeumel <[hidden email]> a écrit :
Just because of key-down vs. key-stroke, right? And I removed that key-down check recently because of another bug. See DockingBarMorph>>#filterEvent:For:.

Best,
Marcel

Am 06.01.2020 11:56:53 schrieb Nicolas Cellier <[hidden email]>:


Le lun. 6 janv. 2020 à 11:50, Marcel Taeumel <[hidden email]> a écrit :
Ha! Damn. :-) Actual ctrl/cmd dupcliation causes too much trouble in the current Trunk? Hmpf...

But CTRL+[0-9] to trigger the world-main docking bar cannot work if duplication is enabled, can it?

It appears to work on Windows VM

Best,
Marcel

Am 28.12.2019 22:16:01 schrieb [hidden email] <[hidden email]>:

Nicolas Cellier uploaded a new version of Kernel to project The Inbox:
http://source.squeak.org/inbox/Kernel-nice.1292.mcz

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

Name: Kernel-nice.1292
Author: nice
Time: 28 December 2019, 10:15:37.810563 pm
UUID: 8cce1ea4-5e21-46f5-858f-0732cf2e33d5
Ancestors: Kernel-nice.1291

Assuming that patched VM will produce ASCII control characters (code 1 to 26) again when pressing ctrl+letter, revert some of the recent keyboard event mapping changes (See https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/460).

Those recent changes have unexpected consequences and implications that we might better postpone post release. We should never have to say that, but it's easier to fix the VM than the image in this case ;)

One example of consequences is that cmd+7 is captured by DockingBarMorph as menu #7 rather than passed to theTextEditor if Preferences duplicateAllControlAndAltKeys.

I guess that we have this preference enabled to make windows user experience not to werid wrt native feel (ctrl+key is the shortcut of choice)...

=============== Diff against Kernel-nice.1291 ===============

Item was removed:
- ----- Method: EventSensor class>>installControlKeyEntryFor: (in category 'key decode table') -----
- installControlKeyEntryFor: aPrintableCharacter
-
- | upper lower |
- self assert: (aPrintableCharacter asInteger between: 64 and: 95).
-
- upper := aPrintableCharacter asInteger.
- lower := aPrintableCharacter asInteger bitOr: 16r20.
-
- "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 bitAnd: 16r9F . 2 "ctrl" }.
- KeyDecodeTable at: { upper . 2 bitOr: 1 "ctrl+shift" } put: { upper bitAnd: 16r9F . 2 bitOr: 1 "ctrl+shift" }.!

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.
+ The purpose of this change is to let ctrl+key act like cmd+key (Mac) or alt+key (linux/windows).
+ It is especially usefull on windows VM where default feel is to use ctrl as shortcut (ctrl+C = copy, etc...).
+ 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 control characters to printable characters in this mapping table."
- "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 . 8 "cmd/alt" }.
+ KeyDecodeTable at: { upper bitAnd: 16r9F . 2 bitOr: 1 "ctrl + shift" } put: { upper . 8 bitOr: 1 "cmd/alt + shift" }.!
- 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" }.
-
- "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" }.!

Item was changed:
----- Method: EventSensor class>>installKeyDecodeTable (in category 'class initialization') -----
installKeyDecodeTable
"Create a decode table that swaps or duplicates some keys if the respective preference is set."

KeyDecodeTable := Dictionary new.

- "In any case, ensure that control keys are mapped correctly."
- self flag: #toRemove. "mt: If all VMs send the correct control keys on all platforms, we will remove this mapping."
- 64 "$@" to: 95 "$_"do: [:keyCode | self installControlKeyEntryFor: keyCode asCharacter].
-
Preferences swapControlAndAltKeys
ifTrue: [ (Character allByteCharacters select: [:ea | ea isAlphaNumeric]) do:
[ :c | self installSwappedKeyEntryFor: c ] ].
Preferences duplicateAllControlAndAltKeys
ifTrue: [ (Character allByteCharacters select: [:ea | ea isAlphaNumeric]) do:
[ :c | self installDuplicateKeyEntryFor: c ] ].

self flag: #toDeprecate. "mt: This mapping should be deprecated in the future."
Preferences duplicateControlAndAltKeys
ifTrue: [ self defaultCrossPlatformKeys do:
[ :c | self installDuplicateKeyEntryFor: c ] ].
!

Item was changed:
----- Method: EventSensor class>>installSwappedKeyEntryFor: (in category 'key decode table') -----
installSwappedKeyEntryFor: 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 . 8 "cmd/alt" }.
KeyDecodeTable at: { lower . 8 "cmd/alt" } put: { lower bitAnd: 16r9F . 2 "ctrl" }.
KeyDecodeTable at: { upper bitAnd: 16r9F . 2 bitOr: 1 "ctrl+shift" } put: { upper . 8 bitOr: 1 "cmd/alt+shift" }.
+ KeyDecodeTable at: { upper . 8 bitOr: 1 "cmd/alt+shift" } put: { upper bitAnd: 16r9F . 2 bitOr: 1 "ctrl+shift" }.!
- KeyDecodeTable at: { upper . 8 bitOr: 1 "cmd/alt+shift" } put: { upper bitAnd: 16r9F . 2 bitOr: 1 "ctrl+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 . 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 Inbox: Kernel-nice.1292.mcz

Nicolas Cellier
Well, I don't know at what level the cursor is satisfying...
I'd say not too many regressions would already be something, we should not be too far.


Le lun. 6 janv. 2020 à 14:46, Marcel Taeumel <[hidden email]> a écrit :
Hi Nicolas,

you can revert those key-duplication/swapping things if you think it is better for 5.3. :-) 

Still, I am not sure we can solve the issue of keyboard shortcuts on all platforms for 5.3 in a satisfying way right now.

Best,
Marcel

Am 06.01.2020 14:17:03 schrieb Nicolas Cellier <[hidden email]>:



Le lun. 6 janv. 2020 à 14:12, Nicolas Cellier <[hidden email]> a écrit :
I do not see any handler for keyDown events, so I think that image is just handling regular keyStroke events...
I hav a franch keyboard, so maybe there is some device specific behavior?
and big fingers...


Le lun. 6 janv. 2020 à 12:01, Marcel Taeumel <[hidden email]> a écrit :
Just because of key-down vs. key-stroke, right? And I removed that key-down check recently because of another bug. See DockingBarMorph>>#filterEvent:For:.

Best,
Marcel

Am 06.01.2020 11:56:53 schrieb Nicolas Cellier <[hidden email]>:


Le lun. 6 janv. 2020 à 11:50, Marcel Taeumel <[hidden email]> a écrit :
Ha! Damn. :-) Actual ctrl/cmd dupcliation causes too much trouble in the current Trunk? Hmpf...

But CTRL+[0-9] to trigger the world-main docking bar cannot work if duplication is enabled, can it?

It appears to work on Windows VM

Best,
Marcel

Am 28.12.2019 22:16:01 schrieb [hidden email] <[hidden email]>:

Nicolas Cellier uploaded a new version of Kernel to project The Inbox:
http://source.squeak.org/inbox/Kernel-nice.1292.mcz

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

Name: Kernel-nice.1292
Author: nice
Time: 28 December 2019, 10:15:37.810563 pm
UUID: 8cce1ea4-5e21-46f5-858f-0732cf2e33d5
Ancestors: Kernel-nice.1291

Assuming that patched VM will produce ASCII control characters (code 1 to 26) again when pressing ctrl+letter, revert some of the recent keyboard event mapping changes (See https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/460).

Those recent changes have unexpected consequences and implications that we might better postpone post release. We should never have to say that, but it's easier to fix the VM than the image in this case ;)

One example of consequences is that cmd+7 is captured by DockingBarMorph as menu #7 rather than passed to theTextEditor if Preferences duplicateAllControlAndAltKeys.

I guess that we have this preference enabled to make windows user experience not to werid wrt native feel (ctrl+key is the shortcut of choice)...

=============== Diff against Kernel-nice.1291 ===============

Item was removed:
- ----- Method: EventSensor class>>installControlKeyEntryFor: (in category 'key decode table') -----
- installControlKeyEntryFor: aPrintableCharacter
-
- | upper lower |
- self assert: (aPrintableCharacter asInteger between: 64 and: 95).
-
- upper := aPrintableCharacter asInteger.
- lower := aPrintableCharacter asInteger bitOr: 16r20.
-
- "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 bitAnd: 16r9F . 2 "ctrl" }.
- KeyDecodeTable at: { upper . 2 bitOr: 1 "ctrl+shift" } put: { upper bitAnd: 16r9F . 2 bitOr: 1 "ctrl+shift" }.!

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.
+ The purpose of this change is to let ctrl+key act like cmd+key (Mac) or alt+key (linux/windows).
+ It is especially usefull on windows VM where default feel is to use ctrl as shortcut (ctrl+C = copy, etc...).
+ 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 control characters to printable characters in this mapping table."
- "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 . 8 "cmd/alt" }.
+ KeyDecodeTable at: { upper bitAnd: 16r9F . 2 bitOr: 1 "ctrl + shift" } put: { upper . 8 bitOr: 1 "cmd/alt + shift" }.!
- 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" }.
-
- "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" }.!

Item was changed:
----- Method: EventSensor class>>installKeyDecodeTable (in category 'class initialization') -----
installKeyDecodeTable
"Create a decode table that swaps or duplicates some keys if the respective preference is set."

KeyDecodeTable := Dictionary new.

- "In any case, ensure that control keys are mapped correctly."
- self flag: #toRemove. "mt: If all VMs send the correct control keys on all platforms, we will remove this mapping."
- 64 "$@" to: 95 "$_"do: [:keyCode | self installControlKeyEntryFor: keyCode asCharacter].
-
Preferences swapControlAndAltKeys
ifTrue: [ (Character allByteCharacters select: [:ea | ea isAlphaNumeric]) do:
[ :c | self installSwappedKeyEntryFor: c ] ].
Preferences duplicateAllControlAndAltKeys
ifTrue: [ (Character allByteCharacters select: [:ea | ea isAlphaNumeric]) do:
[ :c | self installDuplicateKeyEntryFor: c ] ].

self flag: #toDeprecate. "mt: This mapping should be deprecated in the future."
Preferences duplicateControlAndAltKeys
ifTrue: [ self defaultCrossPlatformKeys do:
[ :c | self installDuplicateKeyEntryFor: c ] ].
!

Item was changed:
----- Method: EventSensor class>>installSwappedKeyEntryFor: (in category 'key decode table') -----
installSwappedKeyEntryFor: 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 . 8 "cmd/alt" }.
KeyDecodeTable at: { lower . 8 "cmd/alt" } put: { lower bitAnd: 16r9F . 2 "ctrl" }.
KeyDecodeTable at: { upper bitAnd: 16r9F . 2 bitOr: 1 "ctrl+shift" } put: { upper . 8 bitOr: 1 "cmd/alt+shift" }.
+ KeyDecodeTable at: { upper . 8 bitOr: 1 "cmd/alt+shift" } put: { upper bitAnd: 16r9F . 2 bitOr: 1 "ctrl+shift" }.!
- KeyDecodeTable at: { upper . 8 bitOr: 1 "cmd/alt+shift" } put: { upper bitAnd: 16r9F . 2 bitOr: 1 "ctrl+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 . 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 Inbox: Kernel-nice.1292.mcz

marcel.taeumel
Sounds about right. :-)

Am 06.01.2020 15:02:28 schrieb Nicolas Cellier <[hidden email]>:

Well, I don't know at what level the cursor is satisfying...
I'd say not too many regressions would already be something, we should not be too far.


Le lun. 6 janv. 2020 à 14:46, Marcel Taeumel <[hidden email]> a écrit :
Hi Nicolas,

you can revert those key-duplication/swapping things if you think it is better for 5.3. :-) 

Still, I am not sure we can solve the issue of keyboard shortcuts on all platforms for 5.3 in a satisfying way right now.

Best,
Marcel

Am 06.01.2020 14:17:03 schrieb Nicolas Cellier <[hidden email]>:



Le lun. 6 janv. 2020 à 14:12, Nicolas Cellier <[hidden email]> a écrit :
I do not see any handler for keyDown events, so I think that image is just handling regular keyStroke events...
I hav a franch keyboard, so maybe there is some device specific behavior?
and big fingers...


Le lun. 6 janv. 2020 à 12:01, Marcel Taeumel <[hidden email]> a écrit :
Just because of key-down vs. key-stroke, right? And I removed that key-down check recently because of another bug. See DockingBarMorph>>#filterEvent:For:.

Best,
Marcel

Am 06.01.2020 11:56:53 schrieb Nicolas Cellier <[hidden email]>:


Le lun. 6 janv. 2020 à 11:50, Marcel Taeumel <[hidden email]> a écrit :
Ha! Damn. :-) Actual ctrl/cmd dupcliation causes too much trouble in the current Trunk? Hmpf...

But CTRL+[0-9] to trigger the world-main docking bar cannot work if duplication is enabled, can it?

It appears to work on Windows VM

Best,
Marcel

Am 28.12.2019 22:16:01 schrieb [hidden email] <[hidden email]>:

Nicolas Cellier uploaded a new version of Kernel to project The Inbox:
http://source.squeak.org/inbox/Kernel-nice.1292.mcz

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

Name: Kernel-nice.1292
Author: nice
Time: 28 December 2019, 10:15:37.810563 pm
UUID: 8cce1ea4-5e21-46f5-858f-0732cf2e33d5
Ancestors: Kernel-nice.1291

Assuming that patched VM will produce ASCII control characters (code 1 to 26) again when pressing ctrl+letter, revert some of the recent keyboard event mapping changes (See https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/460).

Those recent changes have unexpected consequences and implications that we might better postpone post release. We should never have to say that, but it's easier to fix the VM than the image in this case ;)

One example of consequences is that cmd+7 is captured by DockingBarMorph as menu #7 rather than passed to theTextEditor if Preferences duplicateAllControlAndAltKeys.

I guess that we have this preference enabled to make windows user experience not to werid wrt native feel (ctrl+key is the shortcut of choice)...

=============== Diff against Kernel-nice.1291 ===============

Item was removed:
- ----- Method: EventSensor class>>installControlKeyEntryFor: (in category 'key decode table') -----
- installControlKeyEntryFor: aPrintableCharacter
-
- | upper lower |
- self assert: (aPrintableCharacter asInteger between: 64 and: 95).
-
- upper := aPrintableCharacter asInteger.
- lower := aPrintableCharacter asInteger bitOr: 16r20.
-
- "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 bitAnd: 16r9F . 2 "ctrl" }.
- KeyDecodeTable at: { upper . 2 bitOr: 1 "ctrl+shift" } put: { upper bitAnd: 16r9F . 2 bitOr: 1 "ctrl+shift" }.!

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.
+ The purpose of this change is to let ctrl+key act like cmd+key (Mac) or alt+key (linux/windows).
+ It is especially usefull on windows VM where default feel is to use ctrl as shortcut (ctrl+C = copy, etc...).
+ 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 control characters to printable characters in this mapping table."
- "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 . 8 "cmd/alt" }.
+ KeyDecodeTable at: { upper bitAnd: 16r9F . 2 bitOr: 1 "ctrl + shift" } put: { upper . 8 bitOr: 1 "cmd/alt + shift" }.!
- 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" }.
-
- "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" }.!

Item was changed:
----- Method: EventSensor class>>installKeyDecodeTable (in category 'class initialization') -----
installKeyDecodeTable
"Create a decode table that swaps or duplicates some keys if the respective preference is set."

KeyDecodeTable := Dictionary new.

- "In any case, ensure that control keys are mapped correctly."
- self flag: #toRemove. "mt: If all VMs send the correct control keys on all platforms, we will remove this mapping."
- 64 "$@" to: 95 "$_"do: [:keyCode | self installControlKeyEntryFor: keyCode asCharacter].
-
Preferences swapControlAndAltKeys
ifTrue: [ (Character allByteCharacters select: [:ea | ea isAlphaNumeric]) do:
[ :c | self installSwappedKeyEntryFor: c ] ].
Preferences duplicateAllControlAndAltKeys
ifTrue: [ (Character allByteCharacters select: [:ea | ea isAlphaNumeric]) do:
[ :c | self installDuplicateKeyEntryFor: c ] ].

self flag: #toDeprecate. "mt: This mapping should be deprecated in the future."
Preferences duplicateControlAndAltKeys
ifTrue: [ self defaultCrossPlatformKeys do:
[ :c | self installDuplicateKeyEntryFor: c ] ].
!

Item was changed:
----- Method: EventSensor class>>installSwappedKeyEntryFor: (in category 'key decode table') -----
installSwappedKeyEntryFor: 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 . 8 "cmd/alt" }.
KeyDecodeTable at: { lower . 8 "cmd/alt" } put: { lower bitAnd: 16r9F . 2 "ctrl" }.
KeyDecodeTable at: { upper bitAnd: 16r9F . 2 bitOr: 1 "ctrl+shift" } put: { upper . 8 bitOr: 1 "cmd/alt+shift" }.
+ KeyDecodeTable at: { upper . 8 bitOr: 1 "cmd/alt+shift" } put: { upper bitAnd: 16r9F . 2 bitOr: 1 "ctrl+shift" }.!
- KeyDecodeTable at: { upper . 8 bitOr: 1 "cmd/alt+shift" } put: { upper bitAnd: 16r9F . 2 bitOr: 1 "ctrl+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 . 8 "cmd/alt" }.
- KeyDecodeTable at: { upper . 2 bitOr: 1 "ctrl+shift" } put: { upper . 8 bitOr: 1 "cmd/alt+shift" }.!