Eliot Miranda uploaded a new version of VMMakerUI to project VM Maker: http://source.squeak.org/VMMaker/VMMakerUI-eem.28.mcz ==================== Summary ==================== Name: VMMakerUI-eem.28 Author: eem Time: 13 October 2020, 9:41:02.540423 am UUID: 25c587b1-1972-41a3-ab3e-94e2b2d9cdb3 Ancestors: VMMakerUI-eem.27 Add click count to mouse e4vents and do a better job at collapsing mouse moves. But the collapse code is still wrong; a much better way would be to peek in teh event queue and update the last event in teh queue to the curreent position if it is also a mouse move. Also a UI indication that the event queue was not empty could help in not generating too many evennts. =============== Diff against VMMakerUI-eem.27 =============== Item was changed: ----- Method: SimulatorEventTransformer>>degenerateMouseEvent: (in category 'event transformation') ----- degenerateMouseEvent: aMorphicEvent "see HandMorph>>generateMouseEvent" modifiers := aMorphicEvent buttons >> 3. "Sad, but modifiers come in on mouse move events..." aMorphicEvent type == #mouseMove ifTrue: [buttons = 0 ifTrue: [^nil]] "filter-out mouse moves unless buttons are pressed, so simulation doersn't get window leave events when we leave its window" ifFalse: [buttons := aMorphicEvent buttons]. ^{ 1. aMorphicEvent timeStamp. aMorphicEvent position x. aMorphicEvent position y. buttons bitAnd: 7. "thanks Ron T." buttons >> 3. "Thanks dtl" + aMorphicEvent class == MouseButtonEvent ifTrue: [aMorphicEvent nClicks] ifFalse: [0]. + 0 "this is windowIndex" }! - 0. - 0 }! Item was changed: ----- Method: SimulatorEventTransformer>>degenerateMouseEvent:for: (in category 'event transformation') ----- degenerateMouseEvent: aMorphicEvent for: aClient "Convert the mouse event into low-level events for the VM simulator (aClient). Filter-out mouse moves, and generate a fake mouse move before each button press. See HandMorph>>generateMouseEvent" | translated | modifiers := aMorphicEvent buttons >> 3. "Sad, but modifiers come in on mouse move events..." "filter-out mouse moves unless buttons are pressed, so simulation doesn't get window leave events when we leave its window" aMorphicEvent type == #mouseMove ifTrue: [(aClient displayView bounds containsPoint: aMorphicEvent position) ifFalse: [^self]. "If buttons (which includes modifiers) change, or are pressed, communicate the event, otherwise (at least potentially) filter it out." + aMorphicEvent buttons = 0 ifTrue: + [lastMouseMoveEvent := aMorphicEvent copy. + lastMouseMoveEvent timeStamp: (aClient ioUTCMicroseconds // 1000). + lastMouseMoveEvent position: lastMouseMoveEvent position - aClient displayView bounds origin. + ^self]]. + "Now output the last move event, and synthesize an event near to the current position" - (aMorphicEvent buttons = 0 - and: [lastMouseMoveEvent notNil - and: [lastMouseMoveEvent buttons = 0]]) ifTrue: - [lastMouseMoveEvent := aMorphicEvent copy. - lastMouseMoveEvent timeStamp: (aClient ioUTCMicroseconds // 1000). - lastMouseMoveEvent position: lastMouseMoveEvent position - aClient displayView bounds origin. - ^self]]. lastMouseMoveEvent ifNotNil: + [:lastMouseMove| + aClient + queueForwardedEvent: - [aClient queueForwardedEvent: { EventTypeMouse. + lastMouseMove timeStamp. + lastMouseMove position x. + lastMouseMove position y. + lastMouseMove buttons bitAnd: 7. + lastMouseMove buttons >> 3. - lastMouseMoveEvent timeStamp. - lastMouseMoveEvent position x. - lastMouseMoveEvent position y. - lastMouseMoveEvent buttons bitAnd: 7. - lastMouseMoveEvent buttons >> 3. 0. + self windowIndex }; + queueForwardedEvent: + { EventTypeMouse. + aClient ioUTCMicroseconds // 1000 + lastMouseMove timeStamp // 2. + aMorphicEvent position x * 9 + lastMouseMove position x // 10. + aMorphicEvent position y * 9 + lastMouseMove position y // 10. + lastMouseMove buttons bitAnd: 7. + lastMouseMove buttons >> 3. + 0. self windowIndex }. lastMouseMoveEvent := nil]. buttons := aMorphicEvent buttons. translated := aMorphicEvent position - aClient displayView bounds origin. aClient queueForwardedEvent: { EventTypeMouse. aClient ioUTCMicroseconds // 1000. translated x. translated y. buttons bitAnd: 7. "thanks Ron T." buttons >> 3. "Thanks dtl" + aMorphicEvent class == MouseButtonEvent ifTrue: [aMorphicEvent nClicks] ifFalse: [0]. - 0. self windowIndex }! |
Free forum by Nabble | Edit this page |