[squeak-dev] The Trunk: Kernel-mt.1405.mcz

commits at source.squeak.org commits at source.squeak.org
Tue Jun 29 07:12:21 UTC 2021


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

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

Name: Kernel-mt.1405
Author: mt
Time: 29 June 2021, 9:12:17.425032 am
UUID: 0c90c979-78a0-8a4a-85b8-35b90f0cbc2d
Ancestors: Kernel-dtl.1404

Fixes regression in mapping modifier keys for keyDown/keyUp events on macOS.

The bug was in the VirtualKeyTable, which had an entry for 0 on macOS, but not on Windows and X11 platforms.

=============== Diff against Kernel-dtl.1404 ===============

Item was changed:
  ----- Method: EventSensor>>processEvent: (in category 'private-I/O') -----
  processEvent: evt 
  	"Process a single event. This method is run at high priority."
  	| type buttons window |
  	type := evt at: 1.
  	lastEventTime := evt at: 2.
  
  	"Only process main window events, forward others to host window proxies"
  	window := evt at: 8.
  	(window isNil or: [window isZero]) ifTrue: 
  		[window := 1. 
  		evt at: 8 put: window].
  	window = 1 ifFalse: [
  		^Smalltalk at: #HostWindowProxy ifPresent: [:w | w processEvent: evt]].
  
  	"Tackle mouse events and mouse wheel events first"
  	(type = EventTypeMouse or: [type = EventTypeMouseWheel])
  		ifTrue: [buttons := (ButtonDecodeTable at: (evt at: 5) + 1). 
  				evt at: 5 put: (Smalltalk platformName = 'Mac OS'
  							ifTrue: [ buttons ]
  							ifFalse: [ self mapButtons: buttons modifiers: (evt at: 6) ]).
  				self queueEvent: evt.
  				type = EventTypeMouseWheel
  					ifTrue: [^ self processMouseWheelEvent: evt].				
  				type = EventTypeMouse
  					ifTrue: [^ self processMouseEvent: evt]].
  	
  	"Store the event in the queue if there's any"
  	type = EventTypeKeyboard
  		ifTrue: [ "Check if the event is a user interrupt"
  			((evt at: 4) = EventKeyChar
  				and: [((evt at: 3)
  						bitOr: (((evt at: 5)
  							bitAnd: 8)
  							bitShift: 8))
  							= interruptKey])
  					ifTrue: ["interrupt key is meta - not reported as event"
  							^ interruptSemaphore signal].
  			"Decode keys for characters (e.g., map ctrl -> cmd)."
  			(evt at: 4) = EventKeyChar
  				ifTrue: [ | unicode ascii |
  					"Copy lookup key first in case of key swap."
  					unicode := {evt at: 6. evt at: 5}.
  					ascii := {evt at: 3. evt at: 5}.
  					KeyDecodeTable "Unicode character first"
  						at: unicode
  						ifPresent: [:a | evt at: 6 put: a first;
  								 at: 5 put: a second]. 
  					KeyDecodeTable "ASCII character second"
  						at: ascii
  						ifPresent: [:a | evt at: 3 put: a first;
  								 at: 5 put: a second]]
  				ifFalse: ["Replace modifiers for virtual keys. (keyUp/keyDown)"
+ 					(evt at: 5) > 0 "Any modifier pressed?" ifTrue: [
+ 						VirtualKeyTable
+ 							at: ((evt at: 5) bitShift: 8)
+ 							ifPresent: [:a | evt at: 5 put: a]]].
- 					VirtualKeyTable
- 						at: ((evt at: 5) bitShift: 8)
- 						ifPresent: [:a | evt at: 5 put: a]].
  			self queueEvent: evt. 
  			self processKeyboardEvent: evt . 
  			^self ].
  				
  	"Handle all events other than Keyboard or Mouse."
  	self queueEvent: evt.
  	!



More information about the Squeak-dev mailing list