do not show help for inactive (background) views.
authorClaus Gittinger <cg@exept.de>
Sat, 14 Jun 2014 14:27:57 +0200
changeset 3347 f314814a3105
parent 3346 c27be735c63a
child 3348 b6e8252970c2
do not show help for inactive (background) views.
ActiveHelp.st
--- a/ActiveHelp.st	Sat Jun 14 11:14:50 2014 +0200
+++ b/ActiveHelp.st	Sat Jun 14 14:27:57 2014 +0200
@@ -260,7 +260,17 @@
 isActive
     "return true, if activeHelp is turned on"
 
-    ^ TheOneAndOnlyHelpListener notNil
+    TheOneAndOnlyHelpListener notNil ifTrue:[
+        ((WindowSensor eventListeners ? #()) includesIdentical:TheOneAndOnlyHelpListener) ifTrue:[
+            ^ true
+        ].
+        TheOneAndOnlyHelpListener := nil.
+    ].
+    ^ false.
+
+    "
+     FlyByHelp isActive
+    "
 
     "Modified: 27.4.1996 / 15:07:57 / cg"
 !
@@ -561,7 +571,7 @@
         ^ self
     ].
     (self interestedIn:aView) ifFalse:[
-        Debugging ifTrue:['not interested' infoPrintCR].
+        Debugging ifTrue:['not interested 0' infoPrintCR].
         ^ self
     ].
 
@@ -606,14 +616,33 @@
     "return true, if I am interested in aView (either listeningForAll,
      or in my list of apps)"
 
-    |app aViewsTopView|
+    |app aViewsTopView device deviceFocusView|
+
+    aView isNil ifTrue:[
+        Debugging ifTrue:['nil view' infoPrintCR].
+        ^ false
+    ].
+
+"/    applicationsOrTopViewsWithHelp isEmptyOrNil ifTrue:[
+"/        Debugging ifTrue:['no apps' infoPrintCR].
+"/        ^ false
+"/    ].
 
-    aView isNil ifTrue:[^ false].
+    aViewsTopView := aView topView.
+
+    "/ if none of the view's components has focus...
+    (device := aViewsTopView graphicsDevice) notNil ifTrue:[
+        (deviceFocusView := device focusView) notNil ifTrue:[
+            deviceFocusView topView ~~ aViewsTopView ifTrue:[
+                "/ 'for inactive ' infoPrint. aView infoPrintCR.
+                Debugging ifTrue:['inactive topView' infoPrintCR].
+                ^ false
+            ].
+        ].
+    ].
 
     listeningForAll == true ifTrue:[^ true].
-    applicationsOrTopViewsWithHelp isEmptyOrNil ifTrue:[^ false].
 
-    aViewsTopView := aView topView.
     (applicationsOrTopViewsWithHelp includesIdentical:aViewsTopView) ifTrue:[^ true].
     app := aViewsTopView application.
     app notNil ifTrue:[
@@ -777,7 +806,7 @@
 !ActiveHelp class methodsFor:'documentation'!
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libview2/ActiveHelp.st,v 1.78 2014-05-16 07:49:59 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview2/ActiveHelp.st,v 1.79 2014-06-14 12:27:57 cg Exp $'
 ! !