#FEATURE by exept
authorClaus Gittinger <cg@exept.de>
Mon, 14 Oct 2019 20:54:52 +0200
changeset 8826 8d03d2e7d39f
parent 8825 130f9ea79e35
child 8827 7e69e4aaf078
#FEATURE by exept class: SimpleView added: #inspectorExtraMenuOperations #simulateButtonMotion:to:sendDisplayEvent: changed: #simulateUserEvent:at:sendDisplayEvent:
SimpleView.st
--- a/SimpleView.st	Sun Oct 13 23:31:22 2019 +0200
+++ b/SimpleView.st	Mon Oct 14 20:54:52 2019 +0200
@@ -7164,6 +7164,18 @@
     "Modified: / 10.6.1998 / 17:28:16 / cg"
 !
 
+simulateButtonMotion:buttonMask to:aPoint sendDisplayEvent:sendDisplayEvent
+    "simulate a button motion by determining which sub-view is affected and
+     synthetically generating a buttonPressEvent for whatever view is underneath.
+     Returns the view which precessed the event or nil."
+
+    |ev|
+
+    ev := WindowEvent buttonMotion:buttonMask x:0 y:0 view:self.
+    "/ x/y will be set in simulateUserEvent:at:sendDisplayEvent:
+    ^ self simulateUserEvent:ev at:aPoint sendDisplayEvent:sendDisplayEvent
+!
+
 simulateButtonPress:button at:aPoint
     "simulate a button press by determining which sub-view is affected and
      synthetically generating a buttonPressEvent for whatever view is underneath.
@@ -7343,19 +7355,18 @@
 !
 
 simulateUserEvent:ev at:aPoint sendDisplayEvent:sendDisplayEvent
-    "simulate a button press by determining which sub-view is affected and
-     synthetically generating a buttonPressEvent for whatever view is underneath.
-
-     If sendDisplayEvent is true, a real physical event is generated via sendEvent,
-     from the Display (xserver). Otherwise, the event is pushed into the widget's event
-     queue, without a roundtrip through the display.
+    "simulate a button event by determining which sub-view is affected and
+     synthetically generating an event for whatever view is underneath.
+
+     If sendDisplayEvent is true, a real physical event is generated via sendEvent, from the Display (xserver). 
+     Otherwise, the event is pushed into the widget's event queue, without a roundtrip through the display.
 
      Otherwise, care for any active grab - i.e. if some other view has grabbed the pointer or keyboard
      the event is sent to the grabView with pointer coordinate translated as required
      (typically these are popup views like menus)
 
-     Returns the view which processed the event or nil. For displayEvent sending,
-     always return the receiver, as we do not know how the grab processing came out at the end"
+     Returns the view which processed the event or nil. 
+     For displayEvent sending, always return the receiver, as we do not know how the grab processing came out at the end"
 
     |targetView pointXLated|
 
@@ -7386,7 +7397,9 @@
             self subViews do:[:each |
                 |whichView|
 
-                whichView := each simulateUserEvent:ev at:(device translatePoint:aPoint fromView:self toView:each).
+                whichView := each simulateUserEvent:ev 
+                                  at:(device translatePoint:aPoint fromView:self toView:each)
+                                  sendDisplayEvent:false.
                 whichView notNil ifTrue:[^ whichView].
             ].
             targetView := self.
@@ -8310,6 +8323,14 @@
     subViews := nil
 ! !
 
+!SimpleView methodsFor:'inspecting'!
+
+inspectorExtraMenuOperations
+    ^ super inspectorExtraMenuOperations
+    , {
+        { 'Open Widget Tree' . [Tools::ViewTreeInspectorApplication openOn:self] }
+    }
+! !
 
 !SimpleView methodsFor:'keyboard control'!