summaryrefslogtreecommitdiff
path: root/vcl/unx/gtk3/gtk3gtkinst.cxx
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2020-11-09 10:19:21 +0000
committerCaolán McNamara <caolanm@redhat.com>2020-11-09 15:36:32 +0100
commite1e662065c911e55aeb85a67664dea9d5ed12313 (patch)
tree1a5bdc198ac02ce8ea177928004aa1d162d08e5a /vcl/unx/gtk3/gtk3gtkinst.cxx
parent8ba9ecaaad1090dafa2e3040e03e532923fd38a4 (diff)
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@redhat.com>
Diffstat (limited to 'vcl/unx/gtk3/gtk3gtkinst.cxx')
-rw-r--r--vcl/unx/gtk3/gtk3gtkinst.cxx14
1 files changed, 6 insertions, 8 deletions
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;
}