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

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Fri May 21 18:54:55 UTC 2021


 vcl/unx/gtk3/gtkinst.cxx |   39 ++++++++++++++++++++++++---------------
 1 file changed, 24 insertions(+), 15 deletions(-)

New commits:
commit 69ad56b8281bbf4bbf4935cc2ac10b9719869afa
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Fri May 21 15:20:45 2021 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Fri May 21 20:54:09 2021 +0200

    gtk4: renable LinkButton
    
    Change-Id: Ifdb49a52c08ac78a48aa37c00041b8714bcd0206
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115940
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx
index 56d05b1dc6aa..be00119aa97c 100644
--- a/vcl/unx/gtk3/gtkinst.cxx
+++ b/vcl/unx/gtk3/gtkinst.cxx
@@ -9789,6 +9789,12 @@ public:
     }
 };
 
+}
+
+#endif
+
+namespace {
+
 class GtkInstanceLinkButton : public GtkInstanceWidget, public virtual weld::LinkButton
 {
 private:
@@ -9851,8 +9857,6 @@ public:
 
 }
 
-#endif
-
 namespace {
 
 class GtkInstanceCheckButton : public GtkInstanceWidget, public virtual weld::CheckButton
@@ -18948,16 +18952,11 @@ public:
 
     virtual std::unique_ptr<weld::LinkButton> weld_link_button(const OString &id) override
     {
-#if !GTK_CHECK_VERSION(4, 0, 0)
         GtkLinkButton* pButton = GTK_LINK_BUTTON(gtk_builder_get_object(m_pBuilder, id.getStr()));
         if (!pButton)
             return nullptr;
         auto_add_parentless_widgets_to_container(GTK_WIDGET(pButton));
         return std::make_unique<GtkInstanceLinkButton>(pButton, this, false);
-#else
-        (void)id;
-        return nullptr;
-#endif
     }
 
     virtual std::unique_ptr<weld::ToggleButton> weld_toggle_button(const OString &id) override
commit 4cd4946b7c04e192d2f2fa164eae87224f4d0b5d
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Fri May 21 15:18:33 2021 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Fri May 21 20:53:48 2021 +0200

    gtk4: reenable ToggleButton
    
    Change-Id: If6458ef0a5ad21532c9aa96ed52779993353b572
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115939
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx
index 9171de7f2f50..56d05b1dc6aa 100644
--- a/vcl/unx/gtk3/gtkinst.cxx
+++ b/vcl/unx/gtk3/gtkinst.cxx
@@ -8086,8 +8086,6 @@ GtkInstanceButton* GtkInstanceDialog::has_click_handler(int nResponse)
     return pButton;
 }
 
-#if !GTK_CHECK_VERSION(4, 0, 0)
-
 namespace {
 
 class GtkInstanceToggleButton : public GtkInstanceButton, public virtual weld::ToggleButton
@@ -8114,7 +8112,7 @@ public:
     virtual void set_active(bool active) override
     {
         disable_notify_events();
-        gtk_toggle_button_set_inconsistent(m_pToggleButton, false);
+        set_inconsistent(false);
         gtk_toggle_button_set_active(m_pToggleButton, active);
         enable_notify_events();
     }
@@ -8126,12 +8124,23 @@ public:
 
     virtual void set_inconsistent(bool inconsistent) override
     {
+#if GTK_CHECK_VERSION(4, 0, 0)
+        if (inconsistent)
+            gtk_widget_set_state_flags(GTK_WIDGET(m_pToggleButton), GTK_STATE_FLAG_INCONSISTENT, false);
+        else
+            gtk_widget_unset_state_flags(GTK_WIDGET(m_pToggleButton), GTK_STATE_FLAG_INCONSISTENT);
+#else
         gtk_toggle_button_set_inconsistent(m_pToggleButton, inconsistent);
+#endif
     }
 
     virtual bool get_inconsistent() const override
     {
+#if GTK_CHECK_VERSION(4, 0, 0)
+        return gtk_widget_get_state_flags(GTK_WIDGET(m_pToggleButton)) & GTK_STATE_FLAG_INCONSISTENT;
+#else
         return gtk_toggle_button_get_inconsistent(m_pToggleButton);
+#endif
     }
 
     virtual void disable_notify_events() override
@@ -8152,6 +8161,12 @@ public:
     }
 };
 
+}
+
+#if !GTK_CHECK_VERSION(4, 0, 0)
+
+namespace {
+
 void do_grab(GtkWidget* pWidget)
 {
 #if !GTK_CHECK_VERSION(4, 0, 0)
@@ -18947,16 +18962,11 @@ public:
 
     virtual std::unique_ptr<weld::ToggleButton> weld_toggle_button(const OString &id) override
     {
-#if !GTK_CHECK_VERSION(4, 0, 0)
         GtkToggleButton* pToggleButton = GTK_TOGGLE_BUTTON(gtk_builder_get_object(m_pBuilder, id.getStr()));
         if (!pToggleButton)
             return nullptr;
         auto_add_parentless_widgets_to_container(GTK_WIDGET(pToggleButton));
         return std::make_unique<GtkInstanceToggleButton>(pToggleButton, this, false);
-#else
-        (void)id;
-        return nullptr;
-#endif
     }
 
     virtual std::unique_ptr<weld::RadioButton> weld_radio_button(const OString &id) override


More information about the Libreoffice-commits mailing list