VM Maker: VMMakerUI-eem.27.mcz

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

VM Maker: VMMakerUI-eem.27.mcz

commits-2
 
Eliot Miranda uploaded a new version of VMMakerUI to project VM Maker:
http://source.squeak.org/VMMaker/VMMakerUI-eem.27.mcz

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

Name: VMMakerUI-eem.27
Author: eem
Time: 26 July 2020, 12:47:38.901108 pm
UUID: ac8c4a65-9aef-4923-a182-41cee05503b1
Ancestors: VMMakerUI-eem.26

Fix several bugs in SimulatorEventTransformer.  The UI is now "usable", i.e. I managed to bring up the About dialog.  Now I at least have a chance of debugging the corrupted fixed pitch font output bug observed in the System reporter.

=============== Diff against VMMakerUI-eem.26 ===============

Item was changed:
  ----- Method: CogVMSimulator>>handleListenEvent: (in category '*VMMakerUI-I/O primitive support') -----
  handleListenEvent: aMorphicEvent
  "openAsMorph[NoTranscript] registered me for listen events via HandMorph>>addEventListener.
  Transform the listen event and add it to my event queue.  ALso check if the displayForm should resize."
  (displayForm ~~ fakeForm and: [displayForm extent ~= displayView extent]) ifTrue:
  [| newForm |
  newForm := Form
  extent: displayView extent
  depth: displayForm depth.
  displayForm displayOn: newForm.
  displayForm := newForm.
  displayView image: displayForm].
  ((aMorphicEvent isMouse or: [aMorphicEvent isKeyboard])
  and: [displayView bounds containsPoint: aMorphicEvent position]) ifTrue:
+ [[eventTransformer degenerateEvent: aMorphicEvent for: self]
+ on: Error
+ do: [:ex|
+ displayView activeHand removeEventListener: self.
+ ex pass]]!
- [eventTransformer degenerateEvent: aMorphicEvent for: self]!

Item was changed:
  Object subclass: #SimulatorEventTransformer
+ instanceVariableNames: 'buttons modifiers lastMouseMoveEvent'
- instanceVariableNames: 'buttons modifiers'
  classVariableNames: 'Default'
  poolDictionaries: 'EventSensorConstants'
  category: 'VMMakerUI-InterpreterSimulation-Morphic'!
 
  !SimulatorEventTransformer commentStamp: 'eem 7/14/2015 17:05' prior: 0!
  A SimulatorEventTransformer takes events as wrapped by HandMorph and converts them to a form a StackInterpreterSimulator can deal with.
 
  See HandMorph >> handleEvent to see what the wrapping entails.
  See HandMorph >> ProcessEvents  or EventSensor >> fetchMoreEvents for examples of what an unwrapped event looks like when given to the system for pre-wrapping.
 
  Instance Variables
  !

Item was changed:
  ----- Method: SimulatorEventTransformer>>degenerateKeyboardEvent:for: (in category 'event transformation') -----
  degenerateKeyboardEvent: aMorphicEvent for: aClient
  "Convert the keyboard event into a low-level event for the VM simulator (aClient).
  See HandMorph>>generateKeyboardEvent and EventSensor class comment"
  aClient queueForwardedEvent:
+ { EventTypeKeyboard.
+ aClient ioUTCMicroseconds // 1000.
+ aMorphicEvent keyValue. "<--this is wrong. See nextCharFrom:firstEvt: for what needs to be undone. hooo boy"
- { 2.
- aMorphicEvent timeStamp.
- aMorphicEvent keyValue. "<--this is wrong. See Sensor FirstEvt: for what needs to happen. hooo boy"
  aMorphicEvent type caseOf: {
  [#keyDown] -> [EventKeyDown].
  [#keyUp] -> [EventKeyUp].
  [#keystroke] -> [EventKeyChar] }.
  modifiers.
  aMorphicEvent keyValue.
  0.
  self windowIndex }!

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 |
- translated := aMorphicEvent position - aClient displayView bounds origin.
  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
+  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:
+ [aClient queueForwardedEvent:
+ { EventTypeMouse.
+ lastMouseMoveEvent timeStamp.
+ lastMouseMoveEvent position x.
+ lastMouseMoveEvent position y.
+ lastMouseMoveEvent buttons bitAnd: 7.
+ lastMouseMoveEvent buttons >> 3.
+ 0.
+ self windowIndex }.
+ lastMouseMoveEvent := nil].
+ buttons := aMorphicEvent buttons.
+ translated := aMorphicEvent position - aClient displayView bounds origin.
- aMorphicEvent type == #mouseMove
- ifTrue: "filter-out mouse moves unless buttons are pressed, so simulation doesn't get window leave events when we leave its window"
- [buttons = 0 ifTrue: [^nil]]
- ifFalse:"If the buttons are going down, make sure to add a mouse move event to the current position before the buttons are pressed."
- [((buttons bitAnd: 7) = 0 and: [(aMorphicEvent buttons bitAnd: 7) ~= 0]) ifTrue:
- [aClient queueForwardedEvent:
- { 1.
- aMorphicEvent timeStamp.
- translated x.
- translated y.
- 0.
- buttons >> 3.     "Thanks dtl"
- 0.
- self windowIndex }].
- buttons := aMorphicEvent buttons].
  aClient queueForwardedEvent:
+ { EventTypeMouse.
+ aClient ioUTCMicroseconds // 1000.
- { 1.
- aMorphicEvent timeStamp.
  translated x.
  translated y.
+ buttons bitAnd: 7. "thanks Ron T."
+ buttons >> 3. "Thanks dtl"
- buttons bitAnd: 7.  "thanks Ron T."
- buttons >> 3.     "Thanks dtl"
  0.
  self windowIndex }!

Item was changed:
  ----- Method: StackInterpreterSimulator>>handleListenEvent: (in category '*VMMakerUI-I/O primitive support') -----
  handleListenEvent: aMorphicEvent
  "openAsMorph[NoTranscript] registered me for listen events via HandMorph>>addEventListener.
  Transform the listen event and add it to my event queue.  ALso check if the displayForm should resize."
  (displayForm ~~ fakeForm and: [displayForm extent ~= displayView extent]) ifTrue:
  [| newForm |
  newForm := Form
  extent: displayView extent
  depth: displayForm depth.
  displayForm displayOn: newForm.
  displayForm := newForm.
  displayView image: displayForm].
  ((aMorphicEvent isMouse or: [aMorphicEvent isKeyboard])
  and: [displayView bounds containsPoint: aMorphicEvent position]) ifTrue:
+ [[eventTransformer degenerateEvent: aMorphicEvent for: self]
+ on: Error
+ do: [:ex|
+ displayView activeHand removeEventListener: self.
+ ex pass]]!
- [eventTransformer degenerateEvent: aMorphicEvent for: self]!

Reply | Threaded
Open this post in threaded view
|

Re: VM Maker: VMMakerUI-eem.27.mcz

timrowledge
 


> On 2020-07-26, at 12:47 PM, [hidden email] wrote:
> Now I at least have a chance of debugging the corrupted fixed pitch font output bug observed in the System reporter.

The weird thing is that I *still* don't see it on any of my machines - Mac OS 64bit image (5.3 & latest 6alpha), Pi (32bit only), x86 linux (64 bit only). A colleague doesn't see it on Windows either.

tim
--
tim Rowledge; [hidden email]; http://www.rowledge.org/tim
Strange OpCodes: SEOB: Set Every Other Bit