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

New commits:
commit ae19777b039a0111fc2e9d51b57f23ae321c9d2c
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 14:40:06 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>
    (cherry picked from commit f2b3e97b4068c3c9799a5c2efd9118200ec7dd15)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158160

diff --git a/vcl/osx/salframe.cxx b/vcl/osx/salframe.cxx
index a82cf9d2ebb0..209f0b94ac59 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