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

New commits:
commit 8028799b51d0a645db93b8c8400b62558b2c6278
Author:     Patrick Luby <plub...@neooffice.org>
AuthorDate: Thu Oct 19 16:32:33 2023 -0400
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Fri Oct 27 10:45:44 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/+/158162
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>
    Tested-by: Xisco Fauli <xiscofa...@libreoffice.org>
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>

diff --git a/vcl/osx/salframe.cxx b/vcl/osx/salframe.cxx
index 82283d25d892..d3d35de8577f 100644
--- a/vcl/osx/salframe.cxx
+++ b/vcl/osx/salframe.cxx
@@ -465,8 +465,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