<div id="__MailbirdStyleContent" style="font-size: 10pt;font-family: Arial;color: #000000;text-align: left" dir="ltr">
Note that, at some point, we might want to move both EventSensor and event classes (e.g. MouseEvent) into a common package. Because leaving it like this would make Kernel depending on Morphic. :-)<div><br></div><div>I am still looking for a name (and overall responsibilities) for such a package...<br><div><br></div><div>Best,</div><div>Marcel</div><div class="mb_sig"></div>
</div><blockquote class="history_container" type="cite" style="border-left-style: solid;border-width: 1px;margin-top: 20px;margin-left: 0px;padding-left: 10px;min-width: 500px">
<p style="color: #AAAAAA; margin-top: 10px;">Am 05.03.2021 00:03:41 schrieb commits@source.squeak.org <commits@source.squeak.org>:</p><div style="font-family:Arial,Helvetica,sans-serif">Eliot Miranda uploaded a new version of Kernel to project The Trunk:<br>http://source.squeak.org/trunk/Kernel-eem.1378.mcz<br><br>==================== Summary ====================<br><br>Name: Kernel-eem.1378<br>Author: eem<br>Time: 4 March 2021, 3:03:26.648613 pm<br>UUID: 670311c0-11d4-4449-8c70-61d25280506f<br>Ancestors: Kernel-nice.1377<br><br>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.<br><br>=============== Diff against Kernel-nice.1377 ===============<br><br>Item was changed:<br> ----- Method: EventSensor>>commandKeyPressed (in category 'modifier keys') -----<br> commandKeyPressed<br> "Answer whether the command key on the keyboard is being held down."<br> <br>+ ^ self peekButtons anyMask: MouseEvent numButtons + 3!<br>- ^ self peekButtons anyMask: 64!<br><br>Item was changed:<br> ----- Method: EventSensor>>controlKeyPressed (in category 'modifier keys') -----<br> controlKeyPressed<br> "Answer whether the control key on the keyboard is being held down."<br> <br>+ ^self peekButtons anyMask: (1 bitShift: MouseEvent numButtons + 1)!<br>- ^ self peekButtons anyMask: 16!<br><br>Item was changed:<br> ----- Method: EventSensor>>processKeyboardEvent: (in category 'private-I/O') -----<br> processKeyboardEvent: evt<br> "process a keyboard event, updating EventSensor state"<br>- | charCode pressCode |<br> "Never update keyboardBuffer if we have an eventQueue active"<br>+ mouseButtons := (mouseButtons bitAnd: MouseEvent anyButton) bitOr: ((evt at: 5) bitShift: MouseEvent numButtons).<br>- mouseButtons := (mouseButtons bitAnd: 7) bitOr: ((evt at: 5) bitShift: 3).<br> <br>+ (evt at: 3) ifNotNil: "extra characters not handled in MVC"<br>+ [:charCode| | pressCode |<br>+ (pressCode := evt at: 4) = EventKeyChar ifTrue: "key down/up not handled in MVC"<br>+ ["mix in modifiers"<br>+ keyboardBuffer nextPut: (charCode bitOr: ((evt at: 5) bitShift: 8))]]!<br>- charCode := evt at: 3.<br>- charCode = nil ifTrue:[^self]. "extra characters not handled in MVC"<br>- pressCode := evt at: 4.<br>- pressCode = EventKeyChar ifFalse:[^self]. "key down/up not handled in MVC"<br>- "mix in modifiers"<br>- charCode := charCode bitOr: ((evt at: 5) bitShift: 8).<br>- keyboardBuffer nextPut: charCode.!<br><br>Item was changed:<br> ----- Method: EventSensor>>processMouseEvent: (in category 'private-I/O') -----<br> processMouseEvent: evt<br> "process a mouse event, updating EventSensor state"<br> | modifiers buttons mapped |<br> mousePosition := (evt at: 3) @ (evt at: 4).<br> buttons := evt at: 5.<br> modifiers := evt at: 6.<br> mapped := self mapButtons: buttons modifiers: modifiers.<br>+ mouseButtons := mapped bitOr: (modifiers bitShift: MouseEvent numButtons)!<br>- mouseButtons := mapped bitOr: (modifiers bitShift: 3).!<br><br>Item was changed:<br> ----- Method: EventSensor>>processMouseWheelEvent: (in category 'private-I/O') -----<br> processMouseWheelEvent: evt<br> "process a mouse wheel event, updating EventSensor state"<br> <br> | modifiers buttons mapped |<br> mouseWheelDelta := mouseWheelDelta + ((evt at: 3) @ (evt at: 4)).<br> buttons := evt at: 5.<br> modifiers := evt at: 6.<br> mapped := self mapButtons: buttons modifiers: modifiers.<br>+ mouseButtons := mapped bitOr: (modifiers bitShift: MouseEvent numButtons)!<br>- mouseButtons := mapped bitOr: (modifiers bitShift: 3).!<br><br>Item was changed:<br> ----- Method: EventSensor>>shiftPressed (in category 'modifier keys') -----<br> shiftPressed<br> "Answer whether the shift key on the keyboard is being held down."<br> <br>+ ^ self peekButtons anyMask: (1 bitShift: MouseEvent numButtons)!<br>- ^ self peekButtons anyMask: 8<br>- !<br><br><br></div></blockquote></div>