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

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Fri Nov 13 09:09:06 UTC 2020


 vcl/unx/gtk3/gtk3gtkinst.cxx |   60 +++++++++++++++++++++++++++++++------------
 1 file changed, 44 insertions(+), 16 deletions(-)

New commits:
commit 85622e6cf676e507dea8845b5637f3a1df327490
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Thu Nov 12 12:35:07 2020 +0000
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Fri Nov 13 10:08:14 2020 +0100

    tdf#138047 wait until map to disable the parent SalFrame tab-cycling
    
    because the original parent is changed before the popup appears
    and the wrong SalFrame is affected
    
    Change-Id: I4dbf50c6bac063b7730f5b6c0f388b4983e0866c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105735
    Tested-by: Caolán McNamara <caolanm at redhat.com>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 23bd3f34d205..3105a4e3056b 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -16497,6 +16497,47 @@ private:
         GtkInstanceBuilder* pThis = static_cast<GtkInstanceBuilder*>(user_data);
         pThis->postprocess_widget(GTK_WIDGET(pObject));
     }
+
+    void DisallowCycleFocusOut()
+    {
+        assert(!m_bAllowCycleFocusOut); // we only expect this to be called when this holds
+
+        GtkWidget* pTopLevel = gtk_widget_get_toplevel(m_pParentWidget);
+        assert(pTopLevel);
+        GtkSalFrame* pFrame = GtkSalFrame::getFromWindow(pTopLevel);
+        assert(pFrame);
+        // unhook handler and let gtk cycle its own way through this widget's
+        // children because it has no non-gtk siblings
+        pFrame->DisallowCycleFocusOut();
+    }
+
+    static void signalMap(GtkWidget*, gpointer user_data)
+    {
+        GtkInstanceBuilder* pThis = static_cast<GtkInstanceBuilder*>(user_data);
+        // tdf#138047 wait until map to do this because the final SalFrame may
+        // not be the same as at ctor time
+        pThis->DisallowCycleFocusOut();
+    }
+
+    void AllowCycleFocusOut()
+    {
+        assert(!m_bAllowCycleFocusOut); // we only expect this to be called when this holds
+
+        GtkWidget* pTopLevel = gtk_widget_get_toplevel(m_pParentWidget);
+        assert(pTopLevel);
+        GtkSalFrame* pFrame = GtkSalFrame::getFromWindow(pTopLevel);
+        assert(pFrame);
+        // rehook handler and let vcl cycle its own way through this widget's
+        // children
+        pFrame->AllowCycleFocusOut();
+    }
+
+    static void signalUnmap(GtkWidget*, gpointer user_data)
+    {
+        GtkInstanceBuilder* pThis = static_cast<GtkInstanceBuilder*>(user_data);
+        pThis->AllowCycleFocusOut();
+    }
+
 public:
     GtkInstanceBuilder(GtkWidget* pParent, const OUString& rUIRoot, const OUString& rUIFile,
                        SystemChildWindow* pInterimGlue, bool bAllowCycleFocusOut)
@@ -16540,13 +16581,8 @@ public:
 
             if (!m_bAllowCycleFocusOut)
             {
-                GtkWidget* pTopLevel = gtk_widget_get_toplevel(m_pParentWidget);
-                assert(pTopLevel);
-                GtkSalFrame* pFrame = GtkSalFrame::getFromWindow(pTopLevel);
-                assert(pFrame);
-                // unhook handler and let gtk cycle its own way through this widget's
-                // children because it has no non-gtk siblings
-                pFrame->DisallowCycleFocusOut();
+                g_signal_connect(G_OBJECT(m_pParentWidget), "map", G_CALLBACK(signalMap), this);
+                g_signal_connect(G_OBJECT(m_pParentWidget), "unmap", G_CALLBACK(signalUnmap), this);
             }
         }
     }
@@ -16610,15 +16646,7 @@ public:
         g_object_unref(m_pBuilder);
 
         if (m_xInterimGlue && !m_bAllowCycleFocusOut)
-        {
-            GtkWidget* pTopLevel = gtk_widget_get_toplevel(m_pParentWidget);
-            assert(pTopLevel);
-            GtkSalFrame* pFrame = GtkSalFrame::getFromWindow(pTopLevel);
-            assert(pFrame);
-            // rehook handler and let vcl cycle its own way through this widget's
-            // children
-            pFrame->AllowCycleFocusOut();
-        }
+            AllowCycleFocusOut();
 
         m_xInterimGlue.disposeAndClear();
     }


More information about the Libreoffice-commits mailing list