[squeak-dev] The Trunk: Kernel-eem.1378.mcz

commits at source.squeak.org commits at source.squeak.org
Thu Mar 4 23:03:32 UTC 2021


Eliot Miranda uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-eem.1378.mcz

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

Name: Kernel-eem.1378
Author: eem
Time: 4 March 2021, 3:03:26.648613 pm
UUID: 670311c0-11d4-4449-8c70-61d25280506f
Ancestors: Kernel-nice.1377

Use the class side methods of MouseEvent to compute the (incredibly annoying) conflation of mouse buttons and modifier keys in events.  This is a necessary first step in increasing the number of mouse buttons to support modern gaming mice.

=============== Diff against Kernel-nice.1377 ===============

Item was changed:
  ----- Method: EventSensor>>commandKeyPressed (in category 'modifier keys') -----
  commandKeyPressed
  	"Answer whether the command key on the keyboard is being held down."
  
+ 	^ self peekButtons anyMask: MouseEvent numButtons + 3!
- 	^ self peekButtons anyMask: 64!

Item was changed:
  ----- Method: EventSensor>>controlKeyPressed (in category 'modifier keys') -----
  controlKeyPressed
  	"Answer whether the control key on the keyboard is being held down."
  
+ 	^self peekButtons anyMask: (1 bitShift: MouseEvent numButtons + 1)!
- 	^ self peekButtons anyMask: 16!

Item was changed:
  ----- Method: EventSensor>>processKeyboardEvent: (in category 'private-I/O') -----
  processKeyboardEvent: evt
  	"process a keyboard event, updating EventSensor state"
- 	| charCode pressCode |
  	"Never update keyboardBuffer if we have an eventQueue active"
+ 	mouseButtons := (mouseButtons bitAnd: MouseEvent anyButton) bitOr: ((evt at: 5) bitShift: MouseEvent numButtons).
- 	mouseButtons := (mouseButtons bitAnd: 7) bitOr: ((evt at: 5) bitShift: 3).
  	
+ 	(evt at: 3) ifNotNil: "extra characters not handled in MVC"
+ 		[:charCode| | pressCode |
+ 		 (pressCode := evt at: 4) = EventKeyChar ifTrue: "key down/up not handled in MVC"
+ 			["mix in modifiers"
+ 			keyboardBuffer nextPut: (charCode bitOr: ((evt at: 5) bitShift: 8))]]!
- 	charCode := evt at: 3.
- 	charCode = nil ifTrue:[^self]. "extra characters not handled in MVC"
- 	pressCode := evt at: 4.
- 	pressCode = EventKeyChar ifFalse:[^self]. "key down/up not handled in MVC"
- 	"mix in modifiers"
- 	charCode := charCode bitOr: ((evt at: 5) bitShift: 8).
- 	keyboardBuffer nextPut: charCode.!

Item was changed:
  ----- Method: EventSensor>>processMouseEvent: (in category 'private-I/O') -----
  processMouseEvent: evt
  	"process a mouse event, updating EventSensor state"
  	| modifiers buttons mapped |
  	mousePosition := (evt at: 3) @ (evt at: 4).
  	buttons := evt at: 5.
  	modifiers := evt at: 6.
  	mapped := self mapButtons: buttons modifiers: modifiers.
+ 	mouseButtons := mapped bitOr: (modifiers bitShift: MouseEvent numButtons)!
- 	mouseButtons := mapped bitOr: (modifiers bitShift: 3).!

Item was changed:
  ----- Method: EventSensor>>processMouseWheelEvent: (in category 'private-I/O') -----
  processMouseWheelEvent: evt
  	"process a mouse wheel event, updating EventSensor state"
  	
  	| modifiers buttons mapped |
  	mouseWheelDelta := mouseWheelDelta + ((evt at: 3) @ (evt at: 4)).
  	buttons := evt at: 5.
  	modifiers := evt at: 6.
  	mapped := self mapButtons: buttons modifiers: modifiers.
+ 	mouseButtons := mapped bitOr: (modifiers bitShift: MouseEvent numButtons)!
- 	mouseButtons := mapped bitOr: (modifiers bitShift: 3).!

Item was changed:
  ----- Method: EventSensor>>shiftPressed (in category 'modifier keys') -----
  shiftPressed
  	"Answer whether the shift key on the keyboard is being held down."
  
+ 	^ self peekButtons anyMask: (1 bitShift: MouseEvent numButtons)!
- 	^ self peekButtons anyMask: 8
- !



More information about the Squeak-dev mailing list