ensure that the grab is released when unwinding from
authorClaus Gittinger <cg@exept.de>
Sat, 05 Sep 2009 00:41:56 +0200
changeset 5336 f2f56441b54c
parent 5335 344723f3f065
child 5337 dae799444a35
ensure that the grab is released when unwinding from a pointFromUser.
DeviceWorkstation.st
--- a/DeviceWorkstation.st	Fri Aug 28 13:45:41 2009 +0200
+++ b/DeviceWorkstation.st	Sat Sep 05 00:41:56 2009 +0200
@@ -6070,25 +6070,27 @@
     prevGrab := activePointerGrab.
     self ungrabPointer.
     self grabPointerInView:(self rootView) withCursor:(aCursor onDevice:self).
-    "
-     wait for leftButton ...
-    "
-    [self leftButtonPressed] whileFalse:[
-	feedbackBlockOrNil notNil ifTrue:[
-	    feedbackBlockOrNil value:(self pointerPosition)
-	].
-	Delay waitForSeconds:0.05.
-    ].
-
-    p := self pointerPosition.
-
-    self ungrabPointer.
-    prevGrab notNil ifTrue:[
-	self grabPointerInView:prevGrab
-    ].
-
-    "flush all events pending on myself"
-    self disposeButtonEventsFor:nil.
+    [
+        "
+         wait for leftButton ...
+        "
+        [self leftButtonPressed] whileFalse:[
+            feedbackBlockOrNil notNil ifTrue:[
+                feedbackBlockOrNil value:(self pointerPosition)
+            ].
+            Delay waitForSeconds:0.05.
+        ].
+
+        p := self pointerPosition.
+    ] ensure:[
+        self ungrabPointer.
+        prevGrab notNil ifTrue:[
+            self grabPointerInView:prevGrab
+        ].
+        "flush all events pending on myself"
+        self disposeButtonEventsFor:nil.
+    ].
+
     ^ p
 
     "
@@ -7943,7 +7945,7 @@
 !DeviceWorkstation class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview/DeviceWorkstation.st,v 1.537 2009-05-14 13:02:47 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/DeviceWorkstation.st,v 1.538 2009-09-04 22:41:56 cg Exp $'
 ! !
 
 DeviceWorkstation initialize!