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

New commits:
commit 813217dee1d809a2c33785c9024dc42671696067
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Tue Feb 25 15:23:38 2020 +0000
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Wed Feb 26 09:52:50 2020 +0100

    only call enter/leave page when not changing programatically
    
    which is how the vcl version traditionally works, this results
    in the "General" tab in the basic dialog editor 'sticking' as the
    the default page
    
    Change-Id: I2bc88093df48724c32c99add5234968fa672e4a6
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89463
    Tested-by: Jenkins
    Tested-by: Caolán McNamara <caol...@redhat.com>
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index e6c80ab1a456..1e93792e7778 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -5694,6 +5694,7 @@ private:
     guint m_nLaunchSplitTimeoutId;
     bool m_bOverFlowBoxActive;
     bool m_bOverFlowBoxIsStart;
+    bool m_bInternalPageChange;
     int m_nStartTabCount;
     int m_nEndTabCount;
     mutable std::vector<std::unique_ptr<GtkInstanceContainer>> m_aPages;
@@ -5726,7 +5727,7 @@ private:
             nNewPage += nOverFlowLen;
         }
 
-        bool bAllow = !m_aLeavePageHdl.IsSet() || 
m_aLeavePageHdl.Call(get_current_page_ident());
+        bool bAllow = m_bInternalPageChange || !m_aLeavePageHdl.IsSet() || 
m_aLeavePageHdl.Call(get_current_page_ident());
         if (!bAllow)
         {
             g_signal_stop_emission_by_name(m_pNotebook, "switch-page");
@@ -5735,7 +5736,8 @@ private:
         if (m_bOverFlowBoxActive)
             gtk_notebook_set_current_page(m_pOverFlowNotebook, 
gtk_notebook_get_n_pages(m_pOverFlowNotebook) - 1);
         OString sNewIdent(get_page_ident(nNewPage));
-        m_aEnterPageHdl.Call(sNewIdent);
+        if (!m_bInternalPageChange)
+            m_aEnterPageHdl.Call(sNewIdent);
     }
 
     void unsplit_notebooks()
@@ -6133,6 +6135,7 @@ public:
         , m_nLaunchSplitTimeoutId(0)
         , m_bOverFlowBoxActive(false)
         , m_bOverFlowBoxIsStart(false)
+        , m_bInternalPageChange(false)
         , m_nStartTabCount(0)
         , m_nEndTabCount(0)
     {
@@ -6234,6 +6237,13 @@ public:
 
     virtual void set_current_page(int nPage) override
     {
+        // normally we'd call disable_notify_events/enable_notify_events here,
+        // but the notebook is complicated by the need to support the
+        // double-decker hackery so for simplicity just flag that the page
+        // change is not a directly user-triggered one
+        bool bInternalPageChange = m_bInternalPageChange;
+        m_bInternalPageChange = true;
+
         if (m_bOverFlowBoxIsStart)
         {
             auto nOverFlowLen = m_bOverFlowBoxActive ? 
gtk_notebook_get_n_pages(m_pOverFlowNotebook) - 1 : 0;
@@ -6256,6 +6266,8 @@ public:
                 gtk_notebook_set_current_page(m_pOverFlowNotebook, nPage);
             }
         }
+
+        m_bInternalPageChange = bInternalPageChange;
     }
 
     virtual void set_current_page(const OString& rIdent) override
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to