Use SynchronousWindoeSensor if no windowGroup
authorStefan Vogel <sv@exept.de>
Tue, 15 Apr 2003 13:57:52 +0200
changeset 2730 61a2f1981ac6
parent 2729 9e78bde459f2
child 2731 0f3c02f592d0
Use SynchronousWindoeSensor if no windowGroup
CodeView.st
EditTextView.st
ObjectView.st
ScrollableView.st
Scroller.st
SelectionInListView.st
TextView.st
--- a/CodeView.st	Fri Apr 11 18:48:49 2003 +0200
+++ b/CodeView.st	Tue Apr 15 13:57:52 2003 +0200
@@ -183,10 +183,10 @@
                           #Accept #Explain #Format)>
     <resource: #programMenu>
 
-    |m sub sensor|
+    |m sub|
 
     m := super editMenu.
-    ((sensor := self sensor) notNil and:[sensor ctrlDown]) ifTrue:[
+    self sensor ctrlDown ifTrue:[
         sub := m.
         m := nil.
     ] ifFalse:[
@@ -269,5 +269,5 @@
 !CodeView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg/CodeView.st,v 1.48 2002-02-26 13:06:16 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/CodeView.st,v 1.49 2003-04-15 11:57:49 stefan Exp $'
 ! !
--- a/EditTextView.st	Fri Apr 11 18:48:49 2003 +0200
+++ b/EditTextView.st	Tue Apr 15 13:57:52 2003 +0200
@@ -3407,9 +3407,8 @@
 
 cursorKeyPress:key shifted:shifted
 
-    |sensor n|
-
-    sensor := self sensor.
+    |n|
+
     self changeTypeOfSelectionTo:nil.
 
     (key == #CursorRight) ifTrue:[
@@ -3477,16 +3476,12 @@
             ].
         ].
 
-        sensor isNil ifTrue:[
-            n := 1
-        ] ifFalse:[
-            n := 1 + (sensor compressKeyPressEventsWithKey:#CursorDown).
-        ].
+        n := 1 + (self sensor compressKeyPressEventsWithKey:#CursorDown).
         self cursorDown:n. 
         "/
         "/ flush keyboard to avoid runaway cursor
         "/
-        sensor notNil ifTrue:[self sensor flushKeyboardFor:self].
+        self sensor flushKeyboardFor:self.
         ^ self
     ].
     (key == #CursorLeft or:[key == #CursorUp]) ifTrue:[
@@ -3541,16 +3536,12 @@
             self cursorLeft. ^self
         ].
         (key == #CursorUp)        ifTrue:[
-            sensor isNil ifTrue:[
-                n := 1
-            ] ifFalse:[
-                n := 1 + (sensor compressKeyPressEventsWithKey:#CursorUp).
-            ].
+            n := 1 + (self sensor compressKeyPressEventsWithKey:#CursorUp).
             self cursorUp:n. 
             "/
             "/ flush keyboard to avoid runaway cursor
             "/
-            sensor notNil ifTrue:[sensor flushKeyboardFor:self].
+            self sensor flushKeyboardFor:self.
             ^ self
         ].
     ].
@@ -3575,7 +3566,7 @@
 !
 
 handleNonCommandKey:key
-    |selStartLine selStartCol selEndLine selEndCol sel word|
+    |selStartLine selStartCol selEndLine selEndCol sel|
 
     self isReadOnly ifTrue:[
         self flash.
@@ -3642,7 +3633,7 @@
 
                              sensor := self sensor.
                              5 timesRepeat:[
-                                 (sensor notNil and:[sensor hasKeyPressEventFor:self]) ifFalse:[
+                                 (sensor hasKeyPressEventFor:self) ifFalse:[
                                      Processor activeProcess millisecondDelay:40.
                                  ]
                              ].
@@ -4318,7 +4309,7 @@
     <resource: #keyboard (#Again #Copy #Cut #Paste #Accept #Find #GotoLine #SaveAs #Print)>
     <resource: #programMenu>
 
-    |items m sub sensor translateItems subSub|
+    |items m sub translateItems subSub|
 
     items := #(
                     ('Again (for All)'  multipleAgain           )  
@@ -4368,7 +4359,7 @@
     subSub receiver:self.
     sub subMenuAt:#babelFishTranslate put:subSub.
 
-    ((sensor := self sensor) notNil and:[sensor ctrlDown]) ifTrue:[
+    self sensor ctrlDown ifTrue:[
         m := sub
     ] ifFalse:[
         items := #(
@@ -4423,20 +4414,21 @@
                 okText:'Paste'
                 abortText:'Cancel'
                 list:list 
-                action:[:idx | idx notNil ifTrue:[ sel := history at:idx]].
+                action:[:idx | idx notNil ifTrue:[sel := history at:idx]].
     box useIndex:true.
     box show.
-    ^ sel.
+    ^ sel.                                 
 !
 
 getTextSelectionOrTextSelectionFromHistory
-    device shiftDown ifTrue:[
+
+    self sensor shiftDown ifTrue:[
         ^ self getTextSelectionFromHistory
     ].
 
     "/ return either the (xterm-) selection or the clipBoard
     ^ self 
-        getTextSelection:(device ctrlDown 
+        getTextSelection:(self sensor ctrlDown 
                             ifTrue:#selection
                             ifFalse:#clipboard)
 !
@@ -5433,15 +5425,13 @@
             ] 
        ifAbsent:
             [
-                |sensor|
-
-                (sensor := self sensor) notNil ifTrue:[
-                    sensor compressKeyPressEventsWithKey:#Again.
-                ].
+                self sensor compressKeyPressEventsWithKey:#Again.
                 self showNotFound.
                 selectStyle := savedSelectStyle.
                 ^ false
-            ]
+            ].
+
+    ^ true.
 
     "Modified: 9.10.1996 / 16:14:11 / cg"
 !
@@ -5464,5 +5454,5 @@
 !EditTextView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg/EditTextView.st,v 1.300 2003-04-04 08:57:27 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/EditTextView.st,v 1.301 2003-04-15 11:57:08 stefan Exp $'
 ! !
--- a/ObjectView.st	Fri Apr 11 18:48:49 2003 +0200
+++ b/ObjectView.st	Tue Apr 15 13:57:52 2003 +0200
@@ -621,8 +621,8 @@
     |sel|
 
     sel := self getSelection.
-    ((Display platformName ~= 'X11')
-     or:[(device getSelectionOwnerOf:#PRIMARY) == drawableId])
+    ((Screen current platformName ~= 'X11')
+     or:[(device getSelectionOwnerOf:#CLIPBOARD) == drawableId])
     ifTrue:[
         "
          a local selection - paste with some offset
@@ -1320,11 +1320,6 @@
 
     "is it the select or 1-button ?"
     self sensor leftButtonPressed ifFalse:[^ self].
-"/    (device buttonMotionMask:buttonMask includesButton:#select) ifFalse:[
-"/        (device buttonMotionMask:buttonMask includesButton:1) ifFalse:[
-"/            ^ self
-"/        ].
-"/    ].
 
     lastButt notNil ifTrue:[
         xpos := buttX.
@@ -3278,5 +3273,5 @@
 !ObjectView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg/ObjectView.st,v 1.94 2003-01-21 15:55:51 mb Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/ObjectView.st,v 1.95 2003-04-15 11:57:52 stefan Exp $'
 ! !
--- a/ScrollableView.st	Fri Apr 11 18:48:49 2003 +0200
+++ b/ScrollableView.st	Tue Apr 15 13:57:52 2003 +0200
@@ -1638,9 +1638,9 @@
             lockUpdates := false
         ].
         vScrollBar 
-            scrollUpAction:[|sensor|
-                            ((sensor := self sensor) notNil
-                            and:[sensor shiftDown or:[sensor ctrlDown]]) ifTrue:[
+            scrollUpAction:[ |sensor|
+                            sensor := self sensor.
+                            (sensor shiftDown or:[sensor ctrlDown]) ifTrue:[
                                 scrolledView scrollToTop
                             ] ifFalse:[
                                 scrolledView scrollUp
@@ -1648,8 +1648,8 @@
                            ].
         vScrollBar 
             scrollDownAction:[|sensor|
-                            ((sensor := self sensor) notNil
-                            and:[sensor shiftDown or:[sensor ctrlDown]]) ifTrue:[
+                            sensor := self sensor.
+                            (sensor shiftDown or:[sensor ctrlDown]) ifTrue:[
                                 scrolledView scrollToBottom
                             ] ifFalse:[
                                 scrolledView scrollDown
@@ -1664,8 +1664,8 @@
         ].
         hScrollBar 
             scrollUpAction:[|sensor|
-                            ((sensor := self sensor) notNil
-                            and:[sensor shiftDown or:[sensor ctrlDown]]) ifTrue:[
+                            sensor := self sensor.
+                            (sensor shiftDown or:[sensor ctrlDown]) ifTrue:[
                                 scrolledView scrollToLeft
                             ] ifFalse:[
                                 scrolledView scrollLeft
@@ -1673,8 +1673,8 @@
                            ].
         hScrollBar 
             scrollDownAction:[|sensor|
-                            ((sensor := self sensor) notNil
-                            and:[sensor shiftDown or:[sensor ctrlDown]]) ifTrue:[
+                            sensor := self sensor.
+                            (sensor shiftDown or:[sensor ctrlDown]) ifTrue:[
                                 scrolledView scrollToRight
                             ] ifFalse:[
                                 scrolledView scrollRight
@@ -2283,5 +2283,5 @@
 !ScrollableView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg/ScrollableView.st,v 1.123 2002-10-25 10:06:56 ca Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/ScrollableView.st,v 1.124 2003-04-15 11:56:06 stefan Exp $'
 ! !
--- a/Scroller.st	Fri Apr 11 18:48:49 2003 +0200
+++ b/Scroller.st	Tue Apr 15 13:57:52 2003 +0200
@@ -1329,14 +1329,12 @@
     <resource: #style (#name 
                        #'scroller.snapBack')>
 
-    |pos curr limit prevOrigin newOrigin snap sensor|
+    |pos curr limit prevOrigin newOrigin snap|
 
     lastMousePosition := x@y.
 
-    (sensor := self sensor) notNil ifTrue:[
-        (sensor hasButtonMotionEventFor:self) ifTrue:[
-            ^ self.
-        ]
+    (self sensor hasButtonMotionEventFor:self) ifTrue:[
+        ^ self.
     ].
 
     enabled ifFalse:[^ self].
@@ -1408,11 +1406,11 @@
     scrolling ifTrue:[^ self].
 
     sensor := self sensor.
-    (((sensor notNil and:[sensor shiftDown]))
-    or:[DefaultMiddleButtonJump and:[button ~~ #select and:[button ~~ 1]]]) ifTrue:[
+    (sensor shiftDown
+     or:[DefaultMiddleButtonJump and:[button ~~ #select and:[button ~~ 1]]]) ifTrue:[
         ^ self buttonShiftPress:button x:x y:y
     ].
-    (sensor notNil and:[sensor ctrlDown]) ifTrue:[
+    sensor ctrlDown ifTrue:[
         ^ self buttonControlPress:button x:x y:y
     ].
     (button ~~ #select and:[button ~~ 1]) ifTrue:[
@@ -1444,11 +1442,7 @@
             repeatBlock notNil ifTrue:[
                 Processor removeTimedBlock:repeatBlock.
             ].
-            repeatBlock := [|sensor|
-                            (sensor := self sensor) notNil ifTrue:[
-                                sensor pushUserEvent:#repeatPageUp for:self
-                            ]
-                           ].
+            repeatBlock := [self sensor pushUserEvent:#repeatPageUp for:self].
             sensor pushUserEvent:#installRepeat: for:self withArgument:initialRepeatDelay.
             "/ Processor addTimedBlock:repeatBlock afterSeconds:initialRepeatDelay
         ]
@@ -1460,11 +1454,7 @@
                 repeatBlock notNil ifTrue:[
                     Processor removeTimedBlock:repeatBlock.
                 ].
-                repeatBlock := [|sensor|
-                                (sensor := self sensor) notNil ifTrue:[
-                                    sensor pushUserEvent:#repeatPageDown for:self
-                                ]
-                               ].
+                repeatBlock := [self sensor pushUserEvent:#repeatPageDown for:self].
                 sensor pushUserEvent:#installRepeat: for:self withArgument:initialRepeatDelay.
                 "/ Processor addTimedBlock:repeatBlock afterSeconds:initialRepeatDelay
             ]
@@ -1611,8 +1601,8 @@
     ] ifFalse:[
         sensor := self sensor.
 
-        (((frm containsPoint:p) and:[sensor notNil and:[sensor leftButtonPressed]])
-         "or:[sensor notNil and:[sensor shiftDown]]") ifTrue:[ 
+        (((frm containsPoint:p) and:[sensor leftButtonPressed])
+         "or:[sensor shiftDown]") ifTrue:[ 
             orientation == #horizontal ifTrue:[
                 which := #xMarker
             ] ifFalse:[
@@ -2609,5 +2599,5 @@
 !Scroller class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg/Scroller.st,v 1.163 2002-09-06 21:24:55 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/Scroller.st,v 1.164 2003-04-15 11:56:42 stefan Exp $'
 ! !
--- a/SelectionInListView.st	Fri Apr 11 18:48:49 2003 +0200
+++ b/SelectionInListView.st	Tue Apr 15 13:57:52 2003 +0200
@@ -2242,13 +2242,11 @@
     clickPosition := nil.
 
     sensor := self sensor.
-    sensor notNil ifTrue:[
-        sensor ctrlDown ifTrue:[
-            ^ self buttonControlPress:button x:x y:y
-        ].
-        sensor shiftDown ifTrue:[
-            ^ self expandSelectionToX:x y:y
-        ]
+    sensor ctrlDown ifTrue:[
+        ^ self buttonControlPress:button x:x y:y
+    ].
+    sensor shiftDown ifTrue:[
+        ^ self expandSelectionToX:x y:y
     ].
 
     self canDrag ifTrue:[
@@ -3967,5 +3965,5 @@
 !SelectionInListView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg/SelectionInListView.st,v 1.208 2003-03-02 20:47:37 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/SelectionInListView.st,v 1.209 2003-04-15 11:56:54 stefan Exp $'
 ! !
--- a/TextView.st	Fri Apr 11 18:48:49 2003 +0200
+++ b/TextView.st	Tue Apr 15 13:57:52 2003 +0200
@@ -1129,7 +1129,7 @@
     dragIsActive := false.
     sensor       := self sensor.
 
-    (sensor notNil and:[sensor shiftDown]) ifTrue:[
+    sensor shiftDown ifTrue:[
         "mouse-click with shift - adding to selection"
 
         "very simple - just simulate a move"
@@ -2579,11 +2579,7 @@
     self searchBwd:pattern 
          ignoreCase:ign 
          ifAbsent:[
-                    |sensor|
-
-                    (sensor := self sensor) notNil ifTrue:[
-                        sensor compressKeyPressEventsWithKey:#FindPrev.
-                    ].
+                    self sensor compressKeyPressEventsWithKey:#FindPrev.
                     self showNotFound
                   ].
     lastSearchIgnoredCase := ign.
@@ -3058,11 +3054,7 @@
         searchFwd:pattern 
         ignoreCase:ign 
         ifAbsent:[
-                    |sensor|
-
-                    (sensor := self sensor) notNil ifTrue:[
-                        sensor compressKeyPressEventsWithKey:#FindNext.
-                    ].
+                    self sensor compressKeyPressEventsWithKey:#FindNext.
                     self showNotFound
                  ].
     lastSearchIgnoredCase := ign.
@@ -3623,7 +3615,7 @@
 !TextView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg/TextView.st,v 1.198 2003-04-11 16:48:49 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/TextView.st,v 1.199 2003-04-15 11:56:50 stefan Exp $'
 ! !
 
 TextView initialize!