gtk-css-engine r175 - in trunk: . conf src



Author: robsta
Date: Wed Oct 29 16:41:02 2008
New Revision: 175
URL: http://svn.gnome.org/viewvc/gtk-css-engine?rev=175&view=rev

Log:
* conf/user-agent.css: comment-out deprecated widgets for now.

* src/gce-node.c:
* src/gce-node.h:
* src/gce-style.c (rectangle), (gap), (line), (draw_hline),
(draw_vline), (draw_shadow), (draw_box), (draw_flat_box),
(draw_check), (draw_option), (draw_shadow_gap), (draw_box_gap),
(draw_extension), (draw_slider), (draw_handle), (draw_resize_grip),
(draw_focus), (draw_expander), (draw_diamond), (draw_arrow),
(draw_tab):
Do not use gce-specific libccss API any more, in preparation for the general smoothification.



Modified:
   trunk/ChangeLog
   trunk/conf/user-agent.css
   trunk/src/gce-node.c
   trunk/src/gce-node.h
   trunk/src/gce-style.c

Modified: trunk/conf/user-agent.css
==============================================================================
--- trunk/conf/user-agent.css	(original)
+++ trunk/conf/user-agent.css	Wed Oct 29 16:41:02 2008
@@ -115,9 +115,11 @@
 	border-radius: 0;
 }
 
+/* DEPRECATED, maybe consider later.
 GtkListItem > flat-box {
 	ccss:import("GtkTreeView > flat-box");
 }
+*/
 
 GtkMenuBar > box {
 	background: inherit;
@@ -194,6 +196,14 @@
 }
 
 /* FIXME: rtl variant? */
+GtkSpinButton > GtkEntry > shadow {
+	background: inherit;
+	border-left: inherit;
+	border-top: inherit;
+	border-bottom: inherit;
+	border-top-left-radius: inherit;
+	border-bottom-left-radius: inherit;
+}
 GtkSpinButton > box.spinbutton_up {
 	border-top: inherit;
 	border-right: inherit;
@@ -211,13 +221,14 @@
 	border-radius: inherit;
 }
 
+/* DEPRECATED, maybe consider later.
 GtkText > flat-box {
 	ccss:import("GtkEntry > flat-box");
 }
-
 GtkText > shadow {
 	ccss:import("GtkEntry > shadow");
 }
+*/
 
 GtkToolbar > box {
 	background: inherit;
@@ -231,9 +242,11 @@
 	border-radius: inherit;
 }
 
+/* DEPRECATED, maybe consider later.
 GtkTreeItem > flat-box {
 	ccss:import("GtkTreeView > flat-box");
 }
+*/
 
 GtkViewport > flat-box {
 	background: inherit;

Modified: trunk/src/gce-node.c
==============================================================================
--- trunk/src/gce-node.c	(original)
+++ trunk/src/gce-node.c	Wed Oct 29 16:41:02 2008
@@ -77,7 +77,7 @@
 	return node;
 }
 
-GceNode *
+static GceNode *
 gce_node_cache_fetch_node (GtkWidget	*widget, 
 			   char const	*class_name,
 			   char const	*pseudo_class,

Modified: trunk/src/gce-node.h
==============================================================================
--- trunk/src/gce-node.h	(original)
+++ trunk/src/gce-node.h	Wed Oct 29 16:41:02 2008
@@ -39,14 +39,7 @@
 					       char const *edge,
 					       char const *expander_style,
 					       char const *primitive);
-GceNode * gce_node_cache_fetch_node (GtkWidget *widget, 
-				     char const *class_name,
-				     char const *pseudo_class,
-				     char const *shadow,
-				     char const *orientation,
-				     char const *gap,
-				     char const *edge,
-				     char const *expander_style);
+
 GceNode * gce_node_cache_get_top_node (void);
 void gce_node_cache_release_node (GceNode *node);
 

Modified: trunk/src/gce-style.c
==============================================================================
--- trunk/src/gce-style.c	(original)
+++ trunk/src/gce-style.c	Wed Oct 29 16:41:02 2008
@@ -36,37 +36,8 @@
 static GType          gce_style_type = 0;
 static GtkStyleClass *gce_style_parent_class = NULL;
 
-static ccss_selector_group_t *
-setup (GceNode const *node, 
-       GceNode const *base)
-{
-	ccss_stylesheet_t const	*stylesheet;
-	ccss_selector_group_t	*group;
-	gboolean		 status;
-
-	stylesheet = gce_rc_style_get_stylesheet ();
-	group = ccss_selector_group_new ();
-	status = FALSE;
-
-	/* query for widget theming */
-	status |= ccss_stylesheet_query_collect (stylesheet, (ccss_node_t const *) node, FALSE, group);
-
-	/* query for primitive theming */
-	status |= ccss_stylesheet_query_collect (stylesheet, (ccss_node_t const *) base, TRUE, group);
-
-	if (!status) {
-		g_warning ("Un-themed widget `%s', primitive `%s'.", 
-			   G_OBJECT_TYPE_NAME (G_OBJECT (gce_node_get_widget (node))), gce_node_get_primitive (base));
-		ccss_selector_group_free (group);
-		group = NULL;
-	}
-
-	return group;
-}
-
 static void
 rectangle (GtkStyle		*self, 
-	   GceNode const	*node,
 	   GceNode const	*base,
 	   GdkWindow		*window, 
 	   GdkRectangle		*area, 
@@ -77,14 +48,16 @@
 	   gint			 height,
 	   gboolean		 fill)
 {
-	ccss_selector_group_t	*group;
+	ccss_stylesheet_t const	*stylesheet;
 	ccss_style_t		*style;
 	cairo_t			*cr;
+	gboolean		 ret;
 
-	group = setup (node, base);
-	if (group) {
+	stylesheet = gce_rc_style_get_stylesheet ();
+	style = ccss_style_new ();
+	ret = ccss_stylesheet_query_apply (stylesheet, (ccss_node_t const *) base, style);
+	if (ret) {
 		cr = gdk_cairo_create (window);
-		style = ccss_style_new ();
 
 		if (area) {
 			gdk_cairo_rectangle (cr, area);
@@ -99,8 +72,6 @@
 			height = height == -1 ? h : height;
 		}
 
-		ccss_selector_group_apply (group, style);
-
 		/* Hackishly support "background-attachment: fixed". */
 		ccss_style_set_viewport (style,
 			widget->allocation.x, widget->allocation.y,
@@ -112,15 +83,13 @@
 			ccss_style_draw_outline (style, cr, x, y, width, height);
 		}
 
-		cairo_destroy (cr);
-		ccss_style_free (style);
-		ccss_selector_group_free (group);
+		cairo_destroy (cr), cr = NULL;
 	}
+	ccss_style_free (style), style = NULL;
 }
 
 static void
-gap (GtkStyle		*self, 
-     GceNode const	*node,
+gap (GtkStyle		*self,
      GceNode const	*base,
      GdkWindow		*window, 
      GdkRectangle	*area, 
@@ -133,12 +102,15 @@
      gint		 gap_start,
      gint		 gap_width)
 {
-	ccss_selector_group_t	*group;
+	ccss_stylesheet_t const	*stylesheet;
 	ccss_style_t		*style;
 	cairo_t			*cr;
+	gboolean		 ret;
 
-	group = setup (node, base);
-	if (group) {
+	stylesheet = gce_rc_style_get_stylesheet ();
+	style = ccss_style_new ();
+	ret = ccss_stylesheet_query_apply (stylesheet, (ccss_node_t const *) base, style);
+	if (ret) {
 		cr = gdk_cairo_create (window);
 		style = ccss_style_new ();
 
@@ -155,8 +127,6 @@
 			height = height == -1 ? h : height;
 		}
 
-		ccss_selector_group_apply (group, style);
-
 		/* Hackishly support "background-attachment: fixed". */
 		ccss_style_set_viewport (style,
 			widget->allocation.x, widget->allocation.y,
@@ -164,15 +134,13 @@
 
 		ccss_style_draw_gap (style, cr, x, y, width, height, gap_side, gap_start, gap_width);
 
-		cairo_destroy (cr);
-		ccss_style_free (style);
-		ccss_selector_group_free (group);
+		cairo_destroy (cr), cr = NULL;
 	}
+	ccss_style_free (style), style = NULL;
 }
 
 static void
-line (GtkStyle		*self, 
-      GceNode		*node,
+line (GtkStyle		*self,
       GceNode		*base,
       GdkWindow		*window, 
       GdkRectangle	*area, 
@@ -182,12 +150,15 @@
       gint		 y1, 
       gint		 y2)
 {
-	ccss_selector_group_t	*group;
+	ccss_stylesheet_t const	*stylesheet;
 	ccss_style_t		*style;
 	cairo_t			*cr;
+	gboolean		 ret;
 
-	group = setup (node, base);
-	if (group) {
+	stylesheet = gce_rc_style_get_stylesheet ();
+	style = ccss_style_new ();
+	ret = ccss_stylesheet_query_apply (stylesheet, (ccss_node_t const *) base, style);
+	if (ret) {
 		cr = gdk_cairo_create (window);
 		style = ccss_style_new ();
 
@@ -196,8 +167,6 @@
 			cairo_clip (cr);
 		}
 
-		ccss_selector_group_apply (group, style);
-
 		/* Hackishly support "background-attachment: fixed". */
 		ccss_style_set_viewport (style,
 			widget->allocation.x, widget->allocation.y,
@@ -205,10 +174,9 @@
 
 		ccss_style_draw_line (style, cr, x1, x2, y1, y2);
 
-		cairo_destroy (cr);
-		ccss_style_free (style);
-		ccss_selector_group_free (group);
+		cairo_destroy (cr), cr = NULL;
 	}
+	ccss_style_free (style), style = NULL;
 }
 
 static void 
@@ -222,7 +190,6 @@
 	    gint		 x2, 
 	    gint		 y)
 {
-	GceNode *node;
 	GceNode *base;
 
 	base = gce_node_cache_fetch_primitive_node (widget, 
@@ -231,14 +198,8 @@
 			NULL, NULL, NULL, NULL, NULL,
 			"hline");
 
-	node = gce_node_cache_fetch_node (widget,
-			gce_maps_get_detail (detail),
-			gce_maps_get_state (state),
-			NULL, NULL, NULL, NULL, NULL);
-
-	line (self, node, base, window, area, widget, x1, x2, y, y);
+	line (self, base, window, area, widget, x1, x2, y, y);
 
-	gce_node_cache_release_node (node);
 	gce_node_cache_release_node (base);
 }
 
@@ -253,7 +214,6 @@
 	    gint		 y2, 
 	    gint		 x)
 {
-	GceNode *node;
 	GceNode *base;
 
 	base = gce_node_cache_fetch_primitive_node (widget, 
@@ -262,14 +222,8 @@
 			NULL, NULL, NULL, NULL, NULL,
 			"vline");
 
-	node = gce_node_cache_fetch_node (widget,
-			gce_maps_get_detail (detail),
-			gce_maps_get_state (state),
-			NULL, NULL, NULL, NULL, NULL);
-
-	line (self, node, base, window, area, widget, x, x, y1, y2);
+	line (self, base, window, area, widget, x, x, y1, y2);
 
-	gce_node_cache_release_node (node);
 	gce_node_cache_release_node (base);
 
 }
@@ -287,7 +241,6 @@
 	     gint		 width, 
 	     gint		 height)
 {
-	GceNode *node;
 	GceNode *base;
 
 	base = gce_node_cache_fetch_primitive_node (widget, 
@@ -297,16 +250,9 @@
 			NULL, NULL, NULL, NULL,
 			"shadow");
 
-	node = gce_node_cache_fetch_node (widget, 
-			gce_maps_get_detail (detail),
-			gce_maps_get_state (state),
-			gce_maps_get_shadow (shadow),
-			NULL, NULL, NULL, NULL);
-
-	rectangle (self, node, base, window, area, widget, 
+	rectangle (self, base, window, area, widget, 
 		   x, y, width, height, TRUE);
 
-	gce_node_cache_release_node (node);
 	gce_node_cache_release_node (base);
 }
 
@@ -323,7 +269,6 @@
 	  gint			 width,
 	  gint			 height)
 {
-	GceNode *node;
 	GceNode *base;
 
 	base = gce_node_cache_fetch_primitive_node (widget, 
@@ -333,16 +278,9 @@
 			NULL, NULL, NULL, NULL,
 			"box");
 
-	node = gce_node_cache_fetch_node (widget, 
-			gce_maps_get_detail (detail),
-			gce_maps_get_state (state),
-			gce_maps_get_shadow (shadow),
-			NULL, NULL, NULL, NULL);
-
-	rectangle (self, node, base, window, area, widget,
+	rectangle (self, base, window, area, widget,
 		   x, y, width, height, TRUE);
 
-	gce_node_cache_release_node (node);
 	gce_node_cache_release_node (base);
 }
 
@@ -359,7 +297,6 @@
 	       gint		 width,
 	       gint		 height)
 {
-	GceNode *node;
 	GceNode *base;
 
 	base = gce_node_cache_fetch_primitive_node (widget, 
@@ -369,16 +306,9 @@
 			NULL, NULL, NULL, NULL,
 			"flatbox");
 
-	node = gce_node_cache_fetch_node (widget, 
-			gce_maps_get_detail (detail),
-			gce_maps_get_state (state),
-			gce_maps_get_shadow (shadow),
-			NULL, NULL, NULL, NULL);
-
-	rectangle (self, node, base, window, area, widget, 
+	rectangle (self, base, window, area, widget, 
 		   x, y, width, height, TRUE);
 
-	gce_node_cache_release_node (node);
 	gce_node_cache_release_node (base);
 }
 
@@ -395,7 +325,6 @@
 	    gint		 width,
 	    gint		 height)
 {
-	GceNode *node;
 	GceNode *base;
 
 	base = gce_node_cache_fetch_primitive_node (widget, 
@@ -405,16 +334,9 @@
 			NULL, NULL, NULL, NULL,
 			"check");
 
-	node = gce_node_cache_fetch_node (widget, 
-			gce_maps_get_detail (detail),
-			gce_maps_get_state (state),
-			gce_maps_get_shadow (shadow),
-			NULL, NULL, NULL, NULL);
-
-	rectangle (self, node, base, window, area, widget, 
+	rectangle (self, base, window, area, widget, 
 		   x, y, width, height, TRUE);
 
-	gce_node_cache_release_node (node);
 	gce_node_cache_release_node (base);
 }
 
@@ -431,7 +353,6 @@
 	     gint		 width,
 	     gint		 height)
 {
-	GceNode *node;
 	GceNode *base;
 
 	base = gce_node_cache_fetch_primitive_node (widget, 
@@ -441,16 +362,9 @@
 			NULL, NULL, NULL, NULL,
 			"option");
 
-	node = gce_node_cache_fetch_node (widget, 
-			gce_maps_get_detail (detail),
-			gce_maps_get_state (state),
-			gce_maps_get_shadow (shadow),
-			NULL, NULL, NULL, NULL);
-
-	rectangle (self, node, base, window, area, widget, 
+	rectangle (self, base, window, area, widget, 
 		   x, y, width, height, TRUE);
 
-	gce_node_cache_release_node (node);
 	gce_node_cache_release_node (base);
 }
 
@@ -470,7 +384,6 @@
 		 gint			 gap_start,
 		 gint			 gap_width)
 {
-	GceNode *node;
 	GceNode *base;
 
 	base = gce_node_cache_fetch_primitive_node (widget, 
@@ -480,16 +393,9 @@
 			NULL, gce_maps_get_position (gap_side), NULL, NULL,
 			"shadow");
 
-	node = gce_node_cache_fetch_node (widget, 
-			gce_maps_get_detail (detail),
-			gce_maps_get_state (state),
-			gce_maps_get_shadow (shadow),
-			NULL, gce_maps_get_position (gap_side), NULL, NULL);
-
-	gap (self, node, base, window, area, widget, 
+	gap (self, base, window, area, widget, 
 	     x, y, width, height, gap_side, gap_start, gap_width);
 
-	gce_node_cache_release_node (node);
 	gce_node_cache_release_node (base);
 }
 
@@ -509,7 +415,6 @@
 	      gint			 gap_start,
 	      gint			 gap_width)
 {
-	GceNode *node;
 	GceNode *base;
 
 	base = gce_node_cache_fetch_primitive_node (widget, 
@@ -519,16 +424,9 @@
 			NULL, gce_maps_get_position (gap_side), NULL, NULL,
 			"box");
 
-	node = gce_node_cache_fetch_node (widget, 
-			gce_maps_get_detail (detail),
-			gce_maps_get_state (state),
-			gce_maps_get_shadow (shadow),
-			NULL, gce_maps_get_position (gap_side), NULL, NULL);
-
-	gap (self, node, base, window, area, widget, 
+	gap (self, base, window, area, widget, 
 	     x, y, width, height, gap_side, gap_start, gap_width);
 
-	gce_node_cache_release_node (node);
 	gce_node_cache_release_node (base);
 }
 
@@ -546,7 +444,6 @@
 		gint		 height,
 		GtkPositionType	 gap_side)
 {
-	GceNode *node;
 	GceNode *base;
 	gint	 gap_width;
 
@@ -557,12 +454,6 @@
 			NULL, gce_maps_get_position (gap_side), NULL, NULL,
 			"extension");
 
-	node = gce_node_cache_fetch_node (widget, 
-			gce_maps_get_detail (detail),
-			gce_maps_get_state (state),
-			gce_maps_get_shadow (shadow),
-			NULL, gce_maps_get_position (gap_side), NULL, NULL);
-
 	switch (gap_side) {
 	case GTK_POS_LEFT:
 	case GTK_POS_RIGHT:
@@ -574,10 +465,9 @@
 		break;
 	}
 
-	gap (self, node, base, window, area, widget, 
+	gap (self, base, window, area, widget, 
 	     x, y, width, height, gap_side, 0, gap_width);
 
-	gce_node_cache_release_node (node);
 	gce_node_cache_release_node (base);
 }
 
@@ -595,7 +485,6 @@
 	     gint		 height,
 	     GtkOrientation	 orientation)
 {
-	GceNode *node;
 	GceNode *base;
 
 	base = gce_node_cache_fetch_primitive_node (widget,
@@ -606,17 +495,9 @@
 			NULL, NULL, NULL,
 			"slider");
 
-	node = gce_node_cache_fetch_node (widget, 
-			gce_maps_get_detail (detail),
-			gce_maps_get_state (state),
-			gce_maps_get_shadow (shadow),
-			gce_maps_get_orientation (orientation),
-			NULL, NULL, NULL);
-
-	rectangle (self, node, base, window, area, widget, 
+	rectangle (self, base, window, area, widget, 
 		   x, y, width, height, TRUE);
 
-	gce_node_cache_release_node (node);
 	gce_node_cache_release_node (base);
 }
 
@@ -634,7 +515,6 @@
 	     gint		 height,
 	     GtkOrientation	 orientation)
 {
-	GceNode *node;
 	GceNode *base;
 
 	base = gce_node_cache_fetch_primitive_node (widget,
@@ -645,17 +525,9 @@
 			NULL, NULL, NULL,
 			"handle");
 
-	node = gce_node_cache_fetch_node (widget, 
-			gce_maps_get_detail (detail),
-			gce_maps_get_state (state),
-			gce_maps_get_shadow (shadow),
-			gce_maps_get_orientation (orientation),
-			NULL, NULL, NULL);
-
-	rectangle (self, node, base, window, area, widget, 
+	rectangle (self, base, window, area, widget, 
 		   x, y, width, height, TRUE);
 
-	gce_node_cache_release_node (node);
 	gce_node_cache_release_node (base);
 }
 
@@ -672,7 +544,6 @@
 		  gint			 width,
 		  gint			 height)
 {
-	GceNode *node;
 	GceNode *base;
 
 	base = gce_node_cache_fetch_primitive_node (widget,
@@ -681,15 +552,9 @@
 			NULL, NULL, NULL, gce_maps_get_window_edge (edge), NULL,
 			"resizegrip");
 
-	node = gce_node_cache_fetch_node (widget, 
-			gce_maps_get_detail (detail),
-			gce_maps_get_state (state),
-			NULL, NULL, NULL, gce_maps_get_window_edge (edge), NULL);
-
-	rectangle (self, node, base, window, area, widget, 
+	rectangle (self, base, window, area, widget, 
 		   x, y, width, height, TRUE);
 
-	gce_node_cache_release_node (node);
 	gce_node_cache_release_node (base);
 }
 
@@ -705,7 +570,6 @@
 	    gint		 width,
 	    gint		 height)
 {
-	GceNode *node;
 	GceNode *base;
 
 	base = gce_node_cache_fetch_primitive_node (widget,
@@ -714,15 +578,9 @@
 			NULL, NULL, NULL, NULL, NULL,
 			"focus");
 
-	node = gce_node_cache_fetch_node (widget, 
-			gce_maps_get_detail (detail),
-			gce_maps_get_state (state),
-			NULL, NULL, NULL, NULL, NULL);
-
-	rectangle (self, node, base, window, area, widget, 
+	rectangle (self, base, window, area, widget, 
 		   x, y, width, height, FALSE);
 
-	gce_node_cache_release_node (node);
 	gce_node_cache_release_node (base);
 }
 
@@ -738,7 +596,6 @@
 	       GtkExpanderStyle	 style)
 {
 #define DEFAULT_EXPANDER_SIZE 12
-	GceNode *node;
 	GceNode *base;
 	gint	 expander_size;
 
@@ -758,15 +615,9 @@
 			NULL, NULL, NULL, NULL, gce_maps_get_expander_style (style),
 			"expander");
 
-	node = gce_node_cache_fetch_node (widget, 
-			gce_maps_get_detail (detail),
-			gce_maps_get_state (state),
-			NULL, NULL, NULL, NULL, gce_maps_get_expander_style (style));
-
-	rectangle (self, node, base, window, area, widget, 
+	rectangle (self, base, window, area, widget, 
 		   x, y, expander_size, expander_size, TRUE);
 
-	gce_node_cache_release_node (node);
 	gce_node_cache_release_node (base);
 #undef DEFAULT_EXPANDER_SIZE
 }
@@ -784,7 +635,6 @@
 	      gint		 width,
 	      gint		 height)
 {
-	GceNode *node;
 	GceNode *base;
 
 	base = gce_node_cache_fetch_primitive_node (widget,
@@ -794,16 +644,9 @@
 			NULL, NULL, NULL, NULL,
 			"diamond");
 
-	node = gce_node_cache_fetch_node (widget, 
-			gce_maps_get_detail (detail),
-			gce_maps_get_state (state),
-			gce_maps_get_shadow (shadow),
-			NULL, NULL, NULL, NULL);
-
-	rectangle (self, node, base, window, area, widget, 
+	rectangle (self, base, window, area, widget, 
 		   x, y, width, height, TRUE);
 
-	gce_node_cache_release_node (node);
 	gce_node_cache_release_node (base);
 }
 
@@ -825,7 +668,6 @@
 	    gint		 width,
 	    gint		 height)
 {
-	GceNode *node;
 	GceNode *base;
 
 	base = gce_node_cache_fetch_primitive_node (widget,
@@ -836,17 +678,9 @@
 			NULL, NULL, NULL,
 			"arrow");
 
-	node = gce_node_cache_fetch_node (widget, 
-			gce_maps_get_detail (detail),
-			gce_maps_get_state (state),
-			gce_maps_get_shadow (shadow),
-			gce_maps_get_arrow (arrow),
-			NULL, NULL, NULL);
-
-	rectangle (self, node, base, window, area, widget, 
+	rectangle (self, base, window, area, widget, 
 		   x, y, width, height, TRUE);
 
-	gce_node_cache_release_node (node);
 	gce_node_cache_release_node (base);
 }
 
@@ -863,7 +697,6 @@
 	  gint			 width,
 	  gint			 height)
 {
-	GceNode *node;
 	GceNode *base;
 
 	base = gce_node_cache_fetch_primitive_node (widget,
@@ -873,16 +706,9 @@
 			NULL, NULL, NULL, NULL,
 			"tab");
 
-	node = gce_node_cache_fetch_node (widget, 
-			gce_maps_get_detail (detail),
-			gce_maps_get_state (state),
-			gce_maps_get_shadow (shadow),
-			NULL, NULL, NULL, NULL);
-
-	rectangle (self, node, base, window, area, widget, 
+	rectangle (self, base, window, area, widget, 
 		   x, y, width, height, TRUE);
 
-	gce_node_cache_release_node (node);
 	gce_node_cache_release_node (base);
 }
 



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