DeviceWorkstation.st
changeset 6168 1c9707cfaa48
parent 6164 1860d4131349
child 6171 cb82f8fa9cd0
--- a/DeviceWorkstation.st	Mon Dec 02 20:04:07 2013 +0100
+++ b/DeviceWorkstation.st	Wed Dec 04 10:55:10 2013 +0100
@@ -4479,11 +4479,11 @@
 
     "/ Timestamp now print. 'X: ' print. untranslatedKey printCR.
 
-    "/
-    "/ ctrl-Esc gives up focus
-    "/
+    "/ ctrl/meta-ESC give up focus
+    "/ ESC escapes an activePointerGrab
     untranslatedKey == #Escape ifTrue:[
-        (ctrlDown or:[metaDown]) ifTrue:[
+        (activePointerGrab notNil 
+        or:[ctrlDown or:[metaDown]]) ifTrue:[
             self ungrabPointer.
             self ungrabKeyboard.
             self setInputFocusTo:nil
@@ -6339,9 +6339,11 @@
      Show aCursor while waiting. Pressing shift or ctrl cancels the operation,
      and aborts"
 
-    |p prevGrab|
+    |p prevGrab prevKbdGrab|
 
     prevGrab := activePointerGrab.
+    prevKbdGrab := activeKeyboardGrab.
+
     self ungrabPointer.
     self grabPointerInView:(self rootView) withCursor:(aCursor onDevice:self).
 
@@ -6353,11 +6355,14 @@
     ].
 
     [
+        self grabKeyboardInView:(self rootView).
+
         "
          wait for leftButton...
+         ctrl, shift or escape terminate that operation
         "
         [self leftButtonPressed] whileFalse:[
-            (self ctrlDown or:[self shiftDown]) ifTrue:[
+            (self ctrlDown or:[self shiftDown or:[activePointerGrab == nil]]) ifTrue:[
                 AbortOperationRequest raise.
                 ^ nil
             ].
@@ -6369,6 +6374,10 @@
 
         p := self pointerPosition.
     ] ensure:[
+        self ungrabKeyboard.
+        prevKbdGrab notNil ifTrue:[
+            self grabKeyboardInView:prevKbdGrab
+        ].
         self ungrabPointer.
         prevGrab notNil ifTrue:[
             self grabPointerInView:prevGrab
@@ -6392,7 +6401,8 @@
 rectangleFromUser
     "{ Pragma: +optSpace }"
 
-    "let user specify a rectangle in the screen, return the rectangle"
+    "let user specify a rectangle in the screen, return the rectangle.
+     If the user presses ESC, an AbortSignal is raised."
 
     |origin|
 
@@ -8276,11 +8286,11 @@
 !DeviceWorkstation class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview/DeviceWorkstation.st,v 1.596 2013-11-25 16:45:15 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/DeviceWorkstation.st,v 1.597 2013-12-04 09:55:10 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libview/DeviceWorkstation.st,v 1.596 2013-11-25 16:45:15 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/DeviceWorkstation.st,v 1.597 2013-12-04 09:55:10 cg Exp $'
 ! !