[squeak-dev] The Trunk: Kernel-nice.1292.mcz

commits at source.squeak.org commits at source.squeak.org
Mon Jan 6 14:34:53 UTC 2020


Nicolas Cellier uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/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" }.!



More information about the Squeak-dev mailing list