#UI_ENHANCEMENT by cg
authorClaus Gittinger <cg@exept.de>
Tue, 19 Jun 2018 14:45:41 +0200
changeset 8394 44c396105bcc
parent 8393 43fd938de095
child 8395 d52686498a23
#UI_ENHANCEMENT by cg class: StandardSystemView changed: #focusIn remember the last focusWindowGroup in the device (for activeHelp of views which have no focusView)
StandardSystemView.st
--- a/StandardSystemView.st	Tue Jun 19 13:52:27 2018 +0200
+++ b/StandardSystemView.st	Tue Jun 19 14:45:41 2018 +0200
@@ -989,79 +989,84 @@
     |viewToGetFocus viewUnderMousePointer ms|
 
     windowGroup notNil ifTrue:[
-	"/ a hack for window managers, which do not honor the
-	"/ WMTransientFor attribute (i.e. XQuartz).
-	"/ This flag would prevent a popup (dialog or notification) from being
-	"/ covered by its underlying regular view. But on MAC, it does not.
-	"/ However, focus is coming in, when doing this, so we manually fix this
-	"/ here. Should not hurt on other systems, where the view is already on top.
-	"/ if it does, add some conditional check here (device WMTransientForBroken or similar)
-	"/ You can check for you WM to be correct, by disabling the line below,
-	"/ then click on a smallLint-note icon, to see the smallLint info,
-	"/ then click on the underlying codeView, to raise it.
-	"/ if the smallLint view can be covered, your WM is broken.
-	"/ cg: turns out to be a bad idea - it does help solve the above problem (on mac),
-	"/ but raises unwanted topViews (for example, if a modal dialog's popup menu closes)
-	"/ windowGroup topViews first raise.
+        "/ a hack for window managers, which do not honor the
+        "/ WMTransientFor attribute (i.e. XQuartz).
+        "/ This flag would prevent a popup (dialog or notification) from being
+        "/ covered by its underlying regular view. But on MAC, it does not.
+        "/ However, focus is coming in, when doing this, so we manually fix this
+        "/ here. Should not hurt on other systems, where the view is already on top.
+        "/ if it does, add some conditional check here (device WMTransientForBroken or similar)
+        "/ You can check for you WM to be correct, by disabling the line below,
+        "/ then click on a smallLint-note icon, to see the smallLint info,
+        "/ then click on the underlying codeView, to raise it.
+        "/ if the smallLint view can be covered, your WM is broken.
+        "/ cg: turns out to be a bad idea - it does help solve the above problem (on mac),
+        "/ but raises unwanted topViews (for example, if a modal dialog's popup menu closes)
+        "/ windowGroup topViews first raise.
 
-	"/ I got the focus - tell the current focus-windowgroup
-	"/ that its focus is gone elsewhere ...
-	"/ 'focusIn ' print. windowGroup process name printCR.
-	"/ 'focusView is ' print. windowGroup focusView printCR.
-
-	"/ although the foucs has usually already been taken (see focusOut),
-	"/ there are situations where this does not happen;
-	"/ I am not sure if that is a WM bug or an ST/X bug, but sometimes (with popups),
-	"/ I only get a focus in. Could be a race, when the loosing view is already destroyed,
-	"/ at the time the focus event arrives.
-	"/ Anyway: it should not matter to take it again...
-	WindowGroup takeFocusFromDevice:device.
+        "/ I got the focus - tell the current focus-windowgroup
+        "/ that its focus is gone elsewhere ...
+        "/ 'focusIn ' print. windowGroup process name printCR.
+        "/ 'focusView is ' print. windowGroup focusView printCR.
 
-	windowGroup isInModalLoop ifTrue:[
-	    windowGroup allTopViewsDo:[:t |
-		t ~~ self ifTrue:[
-		    t focusIn.
-		    t raise.
-		    ^ self.
-		].
-	    ]
-	].
+        "/ although the foucs has usually already been taken (see focusOut),
+        "/ there are situations where this does not happen;
+        "/ I am not sure if that is a WM bug or an ST/X bug, but sometimes (with popups),
+        "/ I only get a focus in. Could be a race, when the loosing view is already destroyed,
+        "/ at the time the focus event arrives.
+        "/ Anyway: it should not matter to take it again...
+        WindowGroup takeFocusFromDevice:device.
+        device focusWindowGroup:windowGroup.
+        
+        windowGroup isInModalLoop ifTrue:[
+            windowGroup allTopViewsDo:[:t |
+                t ~~ self ifTrue:[
+                    t focusIn.
+                    t raise.
+                    ^ self.
+                ].
+            ]
+        ].
 
-	"/ Transcript show:self; show:' focus in '; showCR:windowGroup isInModalLoop.
+        "/ Transcript show:self; show:' focus in '; showCR:windowGroup isInModalLoop.
 
-	viewToGetFocus := windowGroup focusView.
-	viewToGetFocus isNil ifTrue:[
-	    UserPreferences current focusFollowsMouse ~~ false ifTrue:[
-		viewUnderMousePointer := windowGroup pointerView.
-		"/ 'viewUnderMousePointer is ' print. viewUnderMousePointer printCR.
-		(viewUnderMousePointer notNil
-		and:[viewUnderMousePointer isKeyboardConsumer
-		and:[viewUnderMousePointer wantsFocusWithPointerEnter]]) ifTrue:[
-		    viewToGetFocus := viewUnderMousePointer.
-		]
-	    ].
-	].
-	viewToGetFocus isNil ifTrue:[
-	    windowGroup focusBackToPreviousFocusView.
-	    windowGroup focusView isNil ifTrue:[
-		self assignInitialKeyboardFocus.
-	    ].
-	] ifFalse:[
-	    "/ v requestFocus.  - will be denied; but we must force it here
-	    "/ to force a change...
-	    windowGroup setFocusView:nil.
-	    windowGroup focusView:viewToGetFocus byTab:nil.
-	].
+        viewToGetFocus := windowGroup focusView.
+        viewToGetFocus isNil ifTrue:[
+            UserPreferences current focusFollowsMouse ~~ false ifTrue:[
+                viewUnderMousePointer := windowGroup pointerView.
+                "/ 'viewUnderMousePointer is ' print. viewUnderMousePointer printCR.
+                (viewUnderMousePointer notNil
+                and:[viewUnderMousePointer isKeyboardConsumer
+                and:[viewUnderMousePointer wantsFocusWithPointerEnter]]) ifTrue:[
+                    viewToGetFocus := viewUnderMousePointer.
+                ]
+            ].
+        ].
+        viewToGetFocus isNil ifTrue:[
+            windowGroup focusBackToPreviousFocusView.
+            windowGroup focusView isNil ifTrue:[
+                self assignInitialKeyboardFocus.
+                "/ windowGroup focusView isNil ifTrue:[
+                "/     'No focusWindow' infoPrintCR.
+                "/ ].    
+            ].
+        ] ifFalse:[
+            "/ v requestFocus.  - will be denied; but we must force it here
+            "/ to force a change...
+            windowGroup setFocusView:nil.
+            windowGroup focusView:viewToGetFocus byTab:nil.
+        ].
 
-	"/ optionally bring the window to the front after some delay.
-	"/ but not, if my windowGroup is in a modal or popup action
-	(ms := UserPreferences current autoRaiseOnFocusInDelay) notNil ifTrue:[
-	    self scheduleAutoRaiseAfter:ms
-	].
+        "/ optionally bring the window to the front after some delay.
+        "/ but not, if my windowGroup is in a modal or popup action
+        (ms := UserPreferences current autoRaiseOnFocusInDelay) notNil ifTrue:[
+            self scheduleAutoRaiseAfter:ms
+        ].
     ].
     super focusIn
 
     "Modified: / 20-01-2011 / 20:51:20 / cg"
+    "Modified: / 19-06-2018 / 14:01:54 / Claus Gittinger"
 !
 
 focusOut