[Libreoffice-commits] core.git: cui/source vcl/unx

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Thu Jul 2 15:55:06 UTC 2020


 cui/source/options/treeopt.cxx |    9 +++++++++
 vcl/unx/gtk3/gtk3gtkinst.cxx   |    5 +++--
 2 files changed, 12 insertions(+), 2 deletions(-)

New commits:
commit 05f4de0c4898e31431f6a8deaee58f6205c87dd3
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Thu Jul 2 10:54:52 2020 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Thu Jul 2 17:54:16 2020 +0200

    focus grabbed to options extension page when browsing options
    
    Window::Show grabs focus to the window if its a system window by default
    
    and XWindow::set_visible calls Show with default args
    
    Change-Id: Ief3b44068b867fe22f829de5d9722832692a35fe
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97768
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/cui/source/options/treeopt.cxx b/cui/source/options/treeopt.cxx
index b885b4ba1a8e..4632a8d5c60d 100644
--- a/cui/source/options/treeopt.cxx
+++ b/cui/source/options/treeopt.cxx
@@ -2044,6 +2044,15 @@ void ExtensionsTabPage::Show()
 {
     if (!m_xPageParent.is())
         return;
+
+    VclPtr<vcl::Window> xPageParent = VCLUnoHelper::GetWindow(m_xPageParent);
+    if (xPageParent)
+    {
+        // NoActivate otherwise setVisible will call Window::Show which will grab
+        // focus to the page by default
+        xPageParent->Show(true, ShowFlags::NoActivate);
+    }
+
     m_xPageParent->setVisible(true);
 }
 
diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 59af89e9023f..1aa1af96882a 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -3670,7 +3670,8 @@ public:
         gtk_widget_set_can_focus(pWindow, true);
         g_object_unref(pWindow);
 
-        xEmbedWindow->Show();
+        // NoActivate otherwise Show grab focus to this widget
+        xEmbedWindow->Show(true, ShowFlags::NoActivate);
         css::uno::Reference<css::awt::XWindow> xWindow(xEmbedWindow->GetComponentInterface(), css::uno::UNO_QUERY);
         return xWindow;
     }
@@ -15908,7 +15909,7 @@ weld::Builder* GtkInstance::CreateInterimBuilder(vcl::Window* pParent, const OUS
     SystemWindowData winData = {};
     winData.bClipUsingNativeWidget = true;
     auto xEmbedWindow = VclPtr<SystemChildWindow>::Create(pParent, 0, &winData, false);
-    xEmbedWindow->Show();
+    xEmbedWindow->Show(true, ShowFlags::NoActivate);
     xEmbedWindow->set_expand(true);
 
     const SystemEnvData* pEnvData = xEmbedWindow->GetSystemData();


More information about the Libreoffice-commits mailing list