[gtk-css-engine] [style] Fix matching of scrollbar steppers.



commit 84d7c50a53e9d35f9bafb11b263299a123f6f711
Author: Robert Staudinger <robsta gnome org>
Date:   Tue Jun 23 12:14:07 2009 +0200

    [style] Fix matching of scrollbar steppers.

 src/gce-maps.c                    |   23 +++++++++++------------
 src/gce-style.c                   |   11 -----------
 themes/moblesse/gtk-2.0/gtkrc.css |    2 --
 3 files changed, 11 insertions(+), 25 deletions(-)
---
diff --git a/src/gce-maps.c b/src/gce-maps.c
index 977b057..1f2a145 100644
--- a/src/gce-maps.c
+++ b/src/gce-maps.c
@@ -55,30 +55,30 @@ get_stepper (GtkWidget		*widget,
 
 	/* Haven't found a match */
 	if (orientation == GTK_ORIENTATION_HORIZONTAL)
-		check_rectangle.x = widget->allocation.x + stepper->width;
+		check_rectangle.x = widget->allocation.x + widget->allocation.width - stepper->width;
 	else
-		check_rectangle.y = widget->allocation.y + stepper->height;
+		check_rectangle.y = widget->allocation.y + widget->allocation.height - stepper->height;
 	
 	if (gdk_rectangle_intersect (stepper, &check_rectangle, &tmp))
-		return "gtk-secondary-stepper-down";
+		return "gtk-stepper-down";
 
 	/* Haven't found a match */
 	if (orientation == GTK_ORIENTATION_HORIZONTAL)
-		check_rectangle.x = widget->allocation.x + widget->allocation.width - (stepper->width * 2);
+		check_rectangle.x = widget->allocation.x + stepper->width;
 	else
-		check_rectangle.y = widget->allocation.y + widget->allocation.height - (stepper->height * 2);
+		check_rectangle.y = widget->allocation.y + stepper->height;
 	
 	if (gdk_rectangle_intersect (stepper, &check_rectangle, &tmp))
-		return "gtk-secondary-stepper-up";
+		return "gtk-secondary-stepper-down";
 
 	/* Haven't found a match */
 	if (orientation == GTK_ORIENTATION_HORIZONTAL)
-		check_rectangle.x = widget->allocation.x + widget->allocation.width - stepper->width;
+		check_rectangle.x = widget->allocation.x + widget->allocation.width - (stepper->width * 2);
 	else
-		check_rectangle.y = widget->allocation.y + widget->allocation.height - stepper->height;
+		check_rectangle.y = widget->allocation.y + widget->allocation.height - (stepper->height * 2);
 	
 	if (gdk_rectangle_intersect (stepper, &check_rectangle, &tmp))
-		return "gtk-stepper-down";
+		return "gtk-secondary-stepper-up";
 	
 	/* Haven't found a match */
 	return NULL;
@@ -93,6 +93,7 @@ static char const *_gtk_tree_view__focus__details[] = { "treeview-drop-indicator
 							"treeview-drop-indicator-right",
 							"tree-view-drop-indicator-middle", NULL };
 
+/* TODO: add a new column that matches against parent widgets and use it for combo's dropdown button, treeview's header button etc.  */
 static const struct {
 	char const		 *role;
 	char const		 *type_name;
@@ -101,7 +102,7 @@ static const struct {
 	char const		**details;
 	match_rectangle_f	  match_rectangle;
 } _widgets[] = {
-/* TODO: add a new column that matches against parent widgets and use it for combo's dropdown button, treeview's header button etc.  */
+ /* Role		Widget (keep sorted)		Primitive       Shadow		Details		Match function */
   { "gtk-header",	"GtkCalendar",			"shadow",	GTK_SHADOW_OUT, NULL,		NULL },
   { "gtk-check-mark",	"GtkCellRendererToggle",	"check",	-1,		NULL,		NULL },
   { "gtk-radio-knob",	"GtkCellRendererToggle",	"option",	-1,		NULL,		NULL },
@@ -160,14 +161,12 @@ gce_maps_match_role (GtkWidget		*widget,
 					/* Match by shadow. */
 					if (_widgets[i].shadow == shadow)
 						return _widgets[i].role;
-					return NULL;
 				} else if (_widgets[i].details) {
 					/* Match by detail string. */
 					for (unsigned int j = 0; _widgets[i].details[j] != NULL; j++) {
 						if (0 == g_strcmp0 (detail,  _widgets[i].details[j]))
 							return _widgets[i].role;
 					}
-					return NULL;
 				} else if (_widgets[i].match_rectangle) {
 					/* Match by function. */
 					GdkRectangle rect = { .x = x, .y = y, .width = width, .height = height };
diff --git a/src/gce-style.c b/src/gce-style.c
index 82f18ee..2336958 100644
--- a/src/gce-style.c
+++ b/src/gce-style.c
@@ -276,20 +276,9 @@ draw_box (GtkStyle		*self,
 	char const	*role;
 	GceNode		*node = NULL;
 
-if (GTK_IS_VSCROLLBAR (widget) &&
-    0 == g_strcmp0 ("trough", detail))
-	g_debug ("trough?");
-
 	role = gce_maps_match_role (widget, "box", shadow, detail, x, y, width, height);
 	detail = gce_maps_get_detail (detail);
 
-if (role)
-	g_debug ("%s() widget='%s' role='%s' detail='%s'",
-		 __FUNCTION__,
-		 G_OBJECT_TYPE_NAME (widget),
-		 role,
-		 detail);
-
 	if (widget)
 		node = gce_node_cache_fetch_node (widget, 
 			detail,
diff --git a/themes/moblesse/gtk-2.0/gtkrc.css b/themes/moblesse/gtk-2.0/gtkrc.css
index c15ed98..0904548 100644
--- a/themes/moblesse/gtk-2.0/gtkrc.css
+++ b/themes/moblesse/gtk-2.0/gtkrc.css
@@ -60,11 +60,9 @@ gtk-radio-knob[shadow=in] {
 	background: gtk-color(selected_bg_color);
 }
 
-/* FIXME
 gtk-stepper-up, gtk-stepper-down {
 	border: 1px solid;
 }
-*/
 
 gtk-tab {
   background: gtk-shade(1.05, bg_color);



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