svtools/source/uno/popupwindowcontroller.cxx |   10 ++++++++++
 1 file changed, 10 insertions(+)

New commits:
commit ceff75b533654154ac077a7313ebebd53aedaa5e
Author:     Caolán McNamara <caolan.mcnam...@collabora.com>
AuthorDate: Wed Sep 18 17:05:51 2024 +0100
Commit:     Caolán McNamara <caolan.mcnam...@collabora.com>
CommitDate: Thu Sep 19 09:21:09 2024 +0200

    Resolves: tdf#141577 explicitly set current frame as active frame
    
    of the current frame window. Creating the popup will grab focus
    into the dropdown, making the embedded frame lose focus, so it considers
    itself inactive (like right clicking in main frame area makes the
    embedded frame lose focus), so for this embedded object in another frame
    case make the original frame the active child of its parent after
    the popup has been created.
    
    Change-Id: Id6e12babcf4ebce05c297888b7b04756f2a12ccf
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173624
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>

diff --git a/svtools/source/uno/popupwindowcontroller.cxx 
b/svtools/source/uno/popupwindowcontroller.cxx
index 63326fcf570a..18aad5cef74b 100644
--- a/svtools/source/uno/popupwindowcontroller.cxx
+++ b/svtools/source/uno/popupwindowcontroller.cxx
@@ -212,6 +212,16 @@ Reference< awt::XWindow > SAL_CALL 
PopupWindowController::createPopupWindow()
     {
         mxPopoverContainer->unsetPopover();
         mxPopoverContainer->setPopover(weldPopupWindow());
+
+        // tdf#141577 setPopover might GrabFocus, which may cause the 
ActiveFrame to be
+        // unset. So explicitly set this frame as the active frame of its 
parent when
+        // this popup is created.
+        if (uno::Reference<frame::XFrame> xFrame = getFrameInterface())
+        {
+            if (uno::Reference<frame::XFramesSupplier> xParentFrame = 
xFrame->getCreator())
+                xParentFrame->setActiveFrame(xFrame);
+        }
+
         return Reference<awt::XWindow>();
     }
 

Reply via email to