vcl/source/app/salvtables.cxx |    4 +++-
 vcl/source/window/builder.cxx |    5 +++--
 2 files changed, 6 insertions(+), 3 deletions(-)

New commits:
commit 401dedc11e8921505fbd3eac8c26bb065e0197b0
Author:     Caolán McNamara <caolan.mcnam...@collabora.com>
AuthorDate: Sun Dec 15 20:55:50 2024 +0000
Commit:     Caolán McNamara <caolan.mcnam...@collabora.com>
CommitDate: Mon Dec 16 10:58:26 2024 +0100

    Set that a non-modal Popover don't auto-grab focus on popup
    
    currently sc/uiconfig/scalc/ui/filtersubdropdown.ui is the only one of
    these, and this doesn't change its behaviour
    
    Change-Id: Ia975f40fd75c88ddbb28490e60c4274b9e6e056b
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/178524
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>

diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index 14746134dae0..2533f7def9d5 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -7125,7 +7125,9 @@ void SalInstancePopover::popup_at_rect(weld::Widget* 
pParent, const tools::Recta
     aRect.SetRight(aPt.X());
     aRect.SetBottom(aPt.Y());
 
-    FloatWinPopupFlags nFlags = FloatWinPopupFlags::GrabFocus | 
FloatWinPopupFlags::NoMouseUpClose;
+    FloatWinPopupFlags nFlags = FloatWinPopupFlags::NoMouseUpClose;
+    if (!(pWidget->GetStyle() & WB_NOPOINTERFOCUS))
+        nFlags = nFlags | FloatWinPopupFlags::GrabFocus;
     if (ePlace == weld::Placement::Under)
         nFlags = nFlags | FloatWinPopupFlags::Down;
     else
diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx
index cec44574e48c..fd604cbe1c94 100644
--- a/vcl/source/window/builder.cxx
+++ b/vcl/source/window/builder.cxx
@@ -894,12 +894,10 @@ namespace
         return extractStringEntry(rMap, u"type-hint"_ustr, u"normal"_ustr);
     }
 
-#if HAVE_FEATURE_DESKTOP
     bool extractModal(VclBuilder::stringmap &rMap)
     {
         return extractBoolEntry(rMap, u"modal"_ustr, false);
     }
-#endif
 
     bool extractDecorated(VclBuilder::stringmap &rMap)
     {
@@ -1987,6 +1985,9 @@ VclPtr<vcl::Window> VclBuilder::makeObject(vcl::Window 
*pParent, const OUString
     else if (name == "GtkPopover")
     {
         WinBits nBits = extractDeferredBits(rMap);
+        // If a Popover is not modal don't grab focus when it pops up
+        if (!extractModal(rMap))
+            nBits |= WB_NOPOINTERFOCUS;
         xWindow = VclPtr<DockingWindow>::Create(pParent, 
nBits|WB_DOCKABLE|WB_MOVEABLE);
     }
     else if (name == "GtkCalendar")

Reply via email to