ignore motions if more are pending;
authorClaus Gittinger <cg@exept.de>
Tue, 25 Feb 1997 23:08:46 +0100
changeset 1058 bf4c27091f6b
parent 1057 220f818b0577
child 1059 05411f9b1bdb
ignore motions if more are pending; kludged around realize/unrealize race condition (already realized in showSubMenu)
MenuView.st
--- a/MenuView.st	Tue Feb 25 23:07:32 1997 +0100
+++ b/MenuView.st	Tue Feb 25 23:08:46 1997 +0100
@@ -1570,12 +1570,18 @@
 
 buttonMotion:state x:x y:y
     state ~~ 0 ifTrue:[
-	self setSelectionForX:x y:y
+        (self sensor hasButtonMotionEventFor:self) ifFalse:[
+            self setSelectionForX:x y:y
+        ]
     ]
+
+    "Modified: 25.2.1997 / 22:33:18 / cg"
 !
 
 buttonPress:button x:x y:y
-    self setSelectionForX:x y:y
+    self setSelectionForX:x y:y.
+
+    "Modified: 25.2.1997 / 22:32:22 / cg"
 !
 
 buttonRelease:button x:x y:y
@@ -1913,13 +1919,23 @@
 !MenuView methodsFor:'private'!
 
 hideSubmenu
-    subMenuShown notNil ifTrue:[
-        subMenuShown hide.
+    "hide the currently shown subMenu (if any)"
+
+    |m|
+
+    (m := subMenuShown) notNil ifTrue:[
+        "/ race condition kludge ...
+        m realized ifFalse:[
+            device unmapWindow:m id.
+        ] ifTrue:[
+            m hide.
+        ].
+
         subMenuShown := nil.
         self setSelection:nil.
     ].
 
-    "Modified: 25.5.1996 / 13:02:56 / cg"
+    "Modified: 25.2.1997 / 22:58:30 / cg"
 !
 
 isCheckItem:line
@@ -2200,10 +2216,10 @@
     "
      before showing, process all of my expose events
     "
-    "/ mhmh - is this still needed ?
-    windowGroup notNil ifTrue:[
-        windowGroup processExposeEvents
-    ].
+"/    "/ mhmh - is this still needed ?
+"/    windowGroup notNil ifTrue:[
+"/        windowGroup processExposeEvents
+"/    ].
 
     m topView device:device.   "/ req'd for multiDisplay operation
     m superMenu:self.
@@ -2228,12 +2244,17 @@
     m origin:org.
     m makeFullyVisible.
     m noShadow.
-    m realize. 
-    device flush.
-
+
+    "/ race condition kludge ...
+    m realized ifFalse:[
+        m realize. 
+    ] ifTrue:[
+        device mapWindow:m id.
+    ].
+"/    device flush.
     subMenuShown := m
 
-    "Modified: 14.1.1997 / 01:41:20 / cg"
+    "Modified: 25.2.1997 / 22:59:42 / cg"
 ! !
 
 !MenuView methodsFor:'queries'!
@@ -2574,6 +2595,14 @@
     self realize
 
     "Modified: 21.3.1996 / 17:21:46 / cg"
+!
+
+unmap
+    self hideSubmenu.
+    super unmap.
+
+    "Created: 25.2.1997 / 23:01:56 / cg"
+    "Modified: 25.2.1997 / 23:02:09 / cg"
 ! !
 
 !MenuView methodsFor:'submenu notifications'!
@@ -2620,5 +2649,5 @@
 !MenuView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg/MenuView.st,v 1.101 1997-02-25 13:32:45 ca Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/MenuView.st,v 1.102 1997-02-25 22:08:46 cg Exp $'
 ! !