summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2014-02-07 14:45:54 +0100
committerBenjamin Otte <otte@redhat.com>2014-02-07 14:48:54 +0100
commit6d3347de633cc5bc9cd30ef595ce7d6cd8afaba5 (patch)
tree7e681d69c95a71e9ee0eed92037c364c6efbce41
parent4e14056b0c3f517e73fd51a1c3e083f555a36601 (diff)
downloadgtk+-6d3347de633cc5bc9cd30ef595ce7d6cd8afaba5.tar.gz
widget: Ignore text direction in gtk_widget_set_state_flags()
Previously we did a semi-successful job at ignoring it. Unfortunately this job was bad enough that we could lose the direction. We still allow passing in the enum values, because we want code like this to work: set_state_flags (get_state_flags() | SOME_FLAGS)
-rw-r--r--gtk/gtkwidget.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index a84ac3e241..3a1ad0b5e5 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -8187,6 +8187,10 @@ gtk_widget_update_state_flags (GtkWidget *widget,
* This function is for use in widget implementations. Turns on flag
* values in the current widget state (insensitive, prelighted, etc.).
*
+ * This function accepts the values %GTK_STATE_FLAG_DIR_LTR and
+ * %GTK_STATE_FLAG_DIR_RTL but ignores them. If you want to set the widget's
+ * direction, use gtk_widget_set_direction().
+ *
* It is worth mentioning that any other state than %GTK_STATE_FLAG_INSENSITIVE,
* will be propagated down to all non-internal children if @widget is a
* #GtkContainer, while %GTK_STATE_FLAG_INSENSITIVE itself will be propagated
@@ -8201,6 +8205,8 @@ gtk_widget_set_state_flags (GtkWidget *widget,
GtkStateFlags flags,
gboolean clear)
{
+#define ALLOWED_FLAGS (~(GTK_STATE_FLAG_DIR_LTR | GTK_STATE_FLAG_DIR_RTL))
+
g_return_if_fail (GTK_IS_WIDGET (widget));
if ((!clear && (widget->priv->state_flags & flags) == flags) ||
@@ -8208,9 +8214,11 @@ gtk_widget_set_state_flags (GtkWidget *widget,
return;
if (clear)
- gtk_widget_update_state_flags (widget, flags, ~(flags ^ (GTK_STATE_FLAG_DIR_LTR | GTK_STATE_FLAG_DIR_RTL)));
+ gtk_widget_update_state_flags (widget, flags & ALLOWED_FLAGS, ~flags & ALLOWED_FLAGS);
else
- gtk_widget_update_state_flags (widget, flags, 0);
+ gtk_widget_update_state_flags (widget, flags & ALLOWED_FLAGS, 0);
+
+#undef ALLOWED_FLAGS
}
/**