vcl/osx/salframe.cxx |   25 +++++++++++++++++++++++--
 1 file changed, 23 insertions(+), 2 deletions(-)

New commits:
commit fb68f0761c3cfadf73f261d2d44de7b4e277e0af
Author:     Patrick Luby <plub...@neooffice.org>
AuthorDate: Thu Oct 19 16:32:33 2023 -0400
Commit:     Patrick Luby <plub...@neooffice.org>
CommitDate: Fri Oct 20 02:20:42 2023 +0200

    tdf#157565 show tooltip if any parent window is the key window
    
    Commit b69db38a38b09e158e8d46d8b717db85860ca874 caused tooltips
    to fail to appear if their immediate parent window was not the
    key window. So, look through the parent window's parent windows
    and, if any of those windows are the kwy window, show the tooltip.
    
    Change-Id: Icf1aed1144fdeac03b4b208de8ed8ee2db8ad4a0
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158212
    Tested-by: Jenkins
    Reviewed-by: Patrick Luby <plub...@neooffice.org>

diff --git a/vcl/osx/salframe.cxx b/vcl/osx/salframe.cxx
index 98c165d9659f..d20e6e3d8422 100644
--- a/vcl/osx/salframe.cxx
+++ b/vcl/osx/salframe.cxx
@@ -468,8 +468,29 @@ void AquaSalFrame::Show(bool bVisible, bool bNoActivate)
     // Also, don't display tooltips when mousing over non-key windows even if
     // the application is active as the tooltip window will pull the non-key
     // window in front of the key window.
-    if (bVisible && (mnStyle & SalFrameStyleFlags::TOOLTIP) && (![NSApp 
isActive] || (mpParent && ![ mpParent->mpNSWindow isKeyWindow])))
-        return;
+    if (bVisible && (mnStyle & SalFrameStyleFlags::TOOLTIP))
+    {
+        if (![NSApp isActive])
+            return;
+
+        if (mpParent)
+        {
+            // tdf#157565 show tooltip if any parent window is the key window
+            bool bKeyWindowFound = false;
+            NSWindow *pParent = mpParent->mpNSWindow;
+            while (pParent)
+            {
+                if ([pParent isKeyWindow])
+                {
+                    bKeyWindowFound = true;
+                    break;
+                }
+                pParent = [pParent parentWindow];
+            }
+            if (!bKeyWindowFound)
+                return;
+        }
+    }
 
     mbShown = bVisible;
     if(bVisible)

Reply via email to