[gtk+] css parser: Add :link and :visited



commit 9b1c94319001e55cf56b38b380b9bd05bd8130cc
Author: Timm Bäder <mail baedert org>
Date:   Tue Oct 8 11:27:53 2013 +0200

    css parser: Add :link and :visited
    
    ... which are both to be used for links instead of the current
    -GtkWidget-link-color and -GtkWidget-visited-link-color
    
    https://bugzilla.gnome.org/show_bug.cgi?id=709629

 gtk/gtkcssmatcher.c  |    6 ++++--
 gtk/gtkcssselector.c |    4 +++-
 gtk/gtkenums.h       |    6 +++++-
 gtk/gtkwidget.c      |    2 +-
 4 files changed, 13 insertions(+), 5 deletions(-)
---
diff --git a/gtk/gtkcssmatcher.c b/gtk/gtkcssmatcher.c
index ccdf547..b0bdfd1 100644
--- a/gtk/gtkcssmatcher.c
+++ b/gtk/gtkcssmatcher.c
@@ -230,7 +230,8 @@ gtk_css_matcher_any_get_state (const GtkCssMatcher *matcher)
 
   return GTK_STATE_FLAG_ACTIVE | GTK_STATE_FLAG_PRELIGHT | GTK_STATE_FLAG_SELECTED
     | GTK_STATE_FLAG_INSENSITIVE | GTK_STATE_FLAG_INCONSISTENT
-    | GTK_STATE_FLAG_FOCUSED | GTK_STATE_FLAG_BACKDROP;
+    | GTK_STATE_FLAG_FOCUSED | GTK_STATE_FLAG_BACKDROP | GTK_STATE_FLAG_LINK
+    | GTK_STATE_FLAG_VISITED;
 }
 
 static gboolean
@@ -326,7 +327,8 @@ gtk_css_matcher_superset_get_state (const GtkCssMatcher *matcher)
   else
     return GTK_STATE_FLAG_ACTIVE | GTK_STATE_FLAG_PRELIGHT | GTK_STATE_FLAG_SELECTED
       | GTK_STATE_FLAG_INSENSITIVE | GTK_STATE_FLAG_INCONSISTENT
-      | GTK_STATE_FLAG_FOCUSED | GTK_STATE_FLAG_BACKDROP;
+      | GTK_STATE_FLAG_FOCUSED | GTK_STATE_FLAG_BACKDROP | GTK_STATE_FLAG_LINK
+      | GTK_STATE_FLAG_VISITED;
 }
 
 static gboolean
diff --git a/gtk/gtkcssselector.c b/gtk/gtkcssselector.c
index 216090f..25b174c 100644
--- a/gtk/gtkcssselector.c
+++ b/gtk/gtkcssselector.c
@@ -1827,7 +1827,9 @@ parse_selector_pseudo_class (GtkCssParser   *parser,
     { "focus",        GTK_STATE_FLAG_FOCUSED, },
     { "backdrop",     GTK_STATE_FLAG_BACKDROP, },
     { "dir(ltr)",     GTK_STATE_FLAG_DIR_LTR, },
-    { "dir(rtl)",     GTK_STATE_FLAG_DIR_RTL, }
+    { "dir(rtl)",     GTK_STATE_FLAG_DIR_RTL, },
+    { "link",         GTK_STATE_FLAG_LINK, },
+    { "visited",      GTK_STATE_FLAG_VISITED, }
   };
   guint i;
 
diff --git a/gtk/gtkenums.h b/gtk/gtkenums.h
index 82f5a0a..c1e0311 100644
--- a/gtk/gtkenums.h
+++ b/gtk/gtkenums.h
@@ -889,6 +889,8 @@ typedef enum
  * @GTK_STATE_FLAG_BACKDROP: Widget is in a background toplevel window.
  * @GTK_STATE_FLAG_DIR_LTR: Widget is in left-to-right text direction. Since 3.8
  * @GTK_STATE_FLAG_DIR_RTL: Widget is in right-to-left text direction. Since 3.8
+ * @GTK_STATE_FLAG_LINK: Widget is a link. Since 3.12
+ * @GTK_STATE_FLAG_VISITED: The location the widget points to has already been visited. Since 3.12
  *
  * Describes a widget state. Widget states are used to match the widget
  * against CSS pseudo-classes. Note that GTK extends the regular CSS
@@ -905,7 +907,9 @@ typedef enum
   GTK_STATE_FLAG_FOCUSED      = 1 << 5,
   GTK_STATE_FLAG_BACKDROP     = 1 << 6,
   GTK_STATE_FLAG_DIR_LTR      = 1 << 7,
-  GTK_STATE_FLAG_DIR_RTL      = 1 << 8
+  GTK_STATE_FLAG_DIR_RTL      = 1 << 8,
+  GTK_STATE_FLAG_LINK         = 1 << 9,
+  GTK_STATE_FLAG_VISITED      = 1 << 10
 } GtkStateFlags;
 
 /**
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 21d02f3..be1ce05 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -389,7 +389,7 @@
 
 #define WIDGET_CLASS(w)         GTK_WIDGET_GET_CLASS (w)
 
-#define GTK_STATE_FLAGS_BITS 9
+#define GTK_STATE_FLAGS_BITS 11
 
 typedef struct {
   gchar               *name;           /* Name of the template automatic child */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]