[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - vcl/unx
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Mon Nov 16 08:48:50 UTC 2020
vcl/unx/gtk3/gtk3gtkinst.cxx | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
New commits:
commit fbee4f38664eada791789b36514932aa66e65571
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Mon Nov 9 10:19:21 2020 +0000
Commit: Miklos Vajna <vmiklos at collabora.com>
CommitDate: Mon Nov 16 09:48:15 2020 +0100
Resolves: tdf#137786 allow 'toggling' GtkToolButtons
even if they are not GtkToggleToolButtons
We already allow this for GtkMenuToolButton, we shouldn't need to allow
it for a GtkToolButton because a GtkToggleToolButton should be used. But
we have inconsistency where some of these 'align' features are
considered toggleable by some apps or modes within an app and not by
others.
So when this inconsistency arises reuse the pseudo-toggle support
for GtkMenuToolButton for GtkToolButton.
Change-Id: I78b625b206bf6187e36fc39f876d4828ada10a7d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105476
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
(cherry picked from commit e1e662065c911e55aeb85a67664dea9d5ed12313)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105463
Reviewed-by: Miklos Vajna <vmiklos at collabora.com>
diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 828549ebe7d5..643ec0cac7f3 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -8018,8 +8018,9 @@ public:
GtkToolItem* pToolButton = m_aMap.find(rIdent)->second;
- assert(GTK_IS_TOGGLE_TOOL_BUTTON(pToolButton) || GTK_IS_MENU_TOOL_BUTTON(pToolButton) || !bActive);
- if (GTK_IS_MENU_TOOL_BUTTON(pToolButton))
+ if (GTK_IS_TOGGLE_TOOL_BUTTON(pToolButton))
+ gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(pToolButton), bActive);
+ else
{
GtkButton* pButton = nullptr;
// there is no GtkMenuToggleToolButton so abuse the CHECKED state of the GtkMenuToolButton button
@@ -8033,8 +8034,6 @@ public:
gtk_widget_set_state_flags(GTK_WIDGET(pButton), static_cast<GtkStateFlags>(eState), true);
}
}
- else if (GTK_IS_TOGGLE_TOOL_BUTTON(pToolButton))
- gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(pToolButton), bActive);
enable_item_notify_events();
}
@@ -8043,8 +8042,9 @@ public:
{
GtkToolItem* pToolButton = m_aMap.find(rIdent)->second;
- assert(GTK_IS_TOGGLE_TOOL_BUTTON(pToolButton) || GTK_IS_MENU_TOOL_BUTTON(pToolButton));
- if (GTK_IS_MENU_TOOL_BUTTON(pToolButton))
+ if (GTK_IS_TOGGLE_TOOL_BUTTON(pToolButton))
+ return gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(pToolButton));
+ else
{
GtkButton* pButton = nullptr;
// there is no GtkMenuToggleToolButton so abuse the CHECKED state of the GtkMenuToolButton button
@@ -8055,8 +8055,6 @@ public:
return gtk_widget_get_state_flags(GTK_WIDGET(pButton)) & GTK_STATE_FLAG_CHECKED;
}
}
- else if (GTK_IS_TOGGLE_TOOL_BUTTON(pToolButton))
- return gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(pToolButton));
return false;
}
More information about the Libreoffice-commits
mailing list