[Libreoffice-commits] core.git: vcl/unx
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Mon Nov 9 14:37:18 UTC 2020
vcl/unx/gtk3/gtk3gtkinst.cxx | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
New commits:
commit e1e662065c911e55aeb85a67664dea9d5ed12313
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Mon Nov 9 10:19:21 2020 +0000
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Mon Nov 9 15:36:32 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>
diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index cede2908dbc4..6a82aa32eae5 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -8449,8 +8449,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
@@ -8464,8 +8465,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();
}
@@ -8474,8 +8473,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
@@ -8486,8 +8486,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