The Trunk: Morphic-eem.1737.mcz

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

The Trunk: Morphic-eem.1737.mcz

commits-2
Eliot Miranda uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-eem.1737.mcz

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

Name: Morphic-eem.1737
Author: eem
Time: 4 March 2021, 4:03:54.375892 pm
UUID: 789562ea-966c-8f4e-9941-5576a9653b4d
Ancestors: Morphic-eem.1736

Have HandMorph>>showEvent: avoid scribbling over the DockingBar.

=============== Diff against Morphic-eem.1736 ===============

Item was changed:
  ----- Method: HandMorph>>generateMouseEvent: (in category 'private events') -----
  generateMouseEvent: evtBuf
  "Generate the appropriate mouse event for the given raw event buffer"
 
  | position buttons modifiers type trail stamp oldButtons evtChanged |
+ evtBuf first = lastEventBuffer first ifTrue:
+ ["Workaround for Mac VM bug, *always* generating 3 events on clicks"
+ evtChanged := false.
+ 3 to: evtBuf size do:
+ [:i | (lastEventBuffer at: i) = (evtBuf at: i) ifFalse: [evtChanged := true]].
+ evtChanged ifFalse: [^nil]].
- evtBuf first = lastEventBuffer first
- ifTrue:
- ["Workaround for Mac VM bug, *always* generating 3 events on clicks"
-
- evtChanged := false.
- 3 to: evtBuf size
- do: [:i | (lastEventBuffer at: i) = (evtBuf at: i) ifFalse: [evtChanged := true]].
- evtChanged ifFalse: [^nil]].
  stamp := evtBuf second.
  stamp = 0 ifTrue: [stamp := Sensor eventTimeNow].
  position := evtBuf third @ evtBuf fourth.
  buttons := evtBuf fifth.
  modifiers := evtBuf sixth.
 
  type := buttons = 0
  ifTrue:
  [lastEventBuffer fifth = 0
  ifTrue: [#mouseMove] "this time no button and previously no button .. just mouse move"
  ifFalse: [#mouseUp]] "this time no button but previously some button ... therefore button was released"
  ifFalse:
  [buttons = lastEventBuffer fifth
  ifTrue: [#mouseMove] "button states are the same .. now and past .. therfore a mouse movement"
  ifFalse: "button states are different .. button was pressed or released"
  [buttons > lastEventBuffer fifth
  ifTrue: [#mouseDown]
  ifFalse:[#mouseUp]]].
  buttons := buttons bitOr: (modifiers bitShift: MouseEvent numButtons).
  oldButtons := lastEventBuffer fifth bitOr: (lastEventBuffer sixth bitShift: MouseEvent numButtons).
  lastEventBuffer := evtBuf.
  type == #mouseMove ifTrue:
  [trail := self mouseTrailFrom: evtBuf.
  ^MouseMoveEvent new
  setType: type
  startPoint: self position
  endPoint: trail last
  trail: trail
  buttons: buttons
  hand: self
  stamp: stamp].
  ^MouseButtonEvent new
  setType: type
  position: position
  which: (oldButtons bitXor: buttons)
  buttons: buttons
  nClicks: (evtBuf seventh ifNil: [0])
  hand: self
  stamp: stamp!

Item was changed:
  ----- Method: HandMorph>>showEvent: (in category 'events-debugging') -----
  showEvent: anEvent
  "Show details about the event on the display form. Useful for debugging."
  "ShowEvents := true"
  "ShowEvents := false"
+ | message borderWidth heightOffset |
- | message borderWidth |
  ShowEvents == true ifFalse: [^ self].
 
  borderWidth := 5.
  message := String streamContents: [:strm |
  strm
  nextPutAll: '[HandMorph >> #showEvent:]'; cr;
  nextPutAll: 'event'; tab; tab; tab; tab; nextPutAll: anEvent printString; cr;
  nextPutAll: 'keyboard focus'; tab; tab; nextPutAll: self keyboardFocus printString; cr;
  nextPutAll: 'mouse focus'; tab; tab; nextPutAll: self mouseFocus printString].
 
  message := message asDisplayText
  foregroundColor: Color black
  backgroundColor: Color white.
+ heightOffset := (owner submorphs detect: [:m| m isDockingBar] ifNone: [])
+ ifNil: [0]
+ ifNotNil: [:m| m height].
-
  "Offset to support multiple hands debugging."
+ Display fill: (0 @ heightOffset extent: message form extent + (borderWidth asPoint * 2)) rule: Form over fillColor: Color white.
+ message displayOn: Display at: (borderWidth @ heightOffset) + (0 @  ((owner hands indexOf: self) - 1 * message form height)).!
- Display fill: (0 @ 0 extent: message form extent + (borderWidth asPoint * 2)) rule: Form over fillColor: Color white.
- message displayOn: Display at: borderWidth asPoint + (0 @  ((owner hands indexOf: self) - 1 * message form height)).!

Item was added:
+ ----- Method: MouseButtonEvent>>moveRightButtonChanged (in category 'accessing') -----
+ moveRightButtonChanged
+ "Answer if the move right mouse button has changed. This is the move left button on gaming mice."
+
+ ^ whichButton anyMask: 16!