From 26186c74c6fc0701bbf7dc2ddda830d9bff738cd Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Tue, 18 Dec 2012 16:42:04 +0100 Subject: [PATCH] API: Add state flags for RTL and LTR See http://www.whatwg.org/specs/web-apps/current-work/#pseudo-classes for the rationale. --- gtk/gtkenums.h | 10 ++++++++-- gtk/gtkwidget.c | 4 ++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/gtk/gtkenums.h b/gtk/gtkenums.h index 6a339637d0..daff2f0ddf 100644 --- a/gtk/gtkenums.h +++ b/gtk/gtkenums.h @@ -860,8 +860,12 @@ typedef enum * @GTK_STATE_FLAG_INCONSISTENT: Widget is inconsistent. * @GTK_STATE_FLAG_FOCUSED: Widget has the keyboard focus. * @GTK_STATE_FLAG_BACKDROP: Widget is in a background toplevel window. + * @GTK_STATE_FLAG_LTR: Widget is in left-to-right text direction + * @GTK_STATE_FLAG_RTL: Widget is in right-to-left text direction * - * Describes a widget state. + * Describes a widget state. Widget states are used to match the widget + * against CSS pseudo-classes. Note that GTK extends the regular CSS + * classes and sometimes uses different names. */ typedef enum { @@ -872,7 +876,9 @@ typedef enum GTK_STATE_FLAG_INSENSITIVE = 1 << 3, GTK_STATE_FLAG_INCONSISTENT = 1 << 4, GTK_STATE_FLAG_FOCUSED = 1 << 5, - GTK_STATE_FLAG_BACKDROP = 1 << 6 + GTK_STATE_FLAG_BACKDROP = 1 << 6, + GTK_STATE_FLAG_DIR_LTR = 1 << 7, + GTK_STATE_FLAG_DIR_RTL = 1 << 8 } GtkStateFlags; /** diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c index a82e62be0b..13f7b7953d 100644 --- a/gtk/gtkwidget.c +++ b/gtk/gtkwidget.c @@ -300,12 +300,12 @@ * all flags will be set on children (think prelight or active), but we * might want to not do this for some. */ -#define GTK_STATE_FLAGS_DONT_PROPAGATE (GTK_STATE_FLAG_FOCUSED) +#define GTK_STATE_FLAGS_DONT_PROPAGATE (GTK_STATE_FLAG_FOCUSED | GTK_STATE_FLAG_DIR_LTR | GTK_STATE_FLAG_DIR_RTL) #define GTK_STATE_FLAGS_DO_PROPAGATE (~GTK_STATE_FLAGS_DONT_PROPAGATE) #define WIDGET_CLASS(w) GTK_WIDGET_GET_CLASS (w) -#define GTK_STATE_FLAGS_BITS 7 +#define GTK_STATE_FLAGS_BITS 9 struct _GtkWidgetPrivate {