[murrine/gtk+3] Fixed GtkScrollbar



commit b0ef5efcf6eda8797892014fcededa6991c67869
Author: Andrea Cimitan <andrea cimitan gmail com>
Date:   Wed Oct 13 17:20:06 2010 +0200

    Fixed GtkScrollbar

 src/murrine_draw.c  |   30 +++++++++++++++++-------------
 src/murrine_style.c |   21 +++++++--------------
 src/murrine_types.h |    1 +
 3 files changed, 25 insertions(+), 27 deletions(-)
---
diff --git a/src/murrine_draw.c b/src/murrine_draw.c
index 0f4c46a..eb32f0e 100644
--- a/src/murrine_draw.c
+++ b/src/murrine_draw.c
@@ -1928,20 +1928,24 @@ murrine_draw_scrollbar_trough (cairo_t *cr,
 		murrine_rounded_rectangle_closed (cr, 0.5, 0.5, width-1, height-1, widget->roundness, widget->corners);
 		cairo_clip (cr);
 
-		corners = MRN_CORNER_BOTTOMLEFT | MRN_CORNER_BOTTOMRIGHT;
-		murrine_rounded_rectangle_inverted (cr, 0.5, 0.5, width-1, scrollbar->steppersize, widget->roundness, corners);
-		murrine_set_color_rgb (cr, &fill_stepper);
-		cairo_fill_preserve (cr);
-		murrine_draw_trough_border_from_path (cr, &border,0.5, 0.5, width-1, scrollbar->steppersize, widget->mrn_gradient, 1.0, FALSE);
-
-		corners = MRN_CORNER_TOPLEFT | MRN_CORNER_TOPRIGHT;
-		murrine_rounded_rectangle_inverted (cr, 0.5, height-scrollbar->steppersize-0.5, width-1, scrollbar->steppersize, widget->roundness, corners);
-		murrine_set_color_rgb (cr, &fill_stepper);
-		cairo_fill_preserve (cr);
-		murrine_draw_trough_border_from_path (cr, &border, 0.5, height-scrollbar->steppersize-0.5, width-1, scrollbar->steppersize, widget->mrn_gradient, 1.0, FALSE);
-
-		cairo_restore (cr);
+		if (!scrollbar->trough_upper)
+		{
+			corners = MRN_CORNER_BOTTOMLEFT | MRN_CORNER_BOTTOMRIGHT;
+			murrine_rounded_rectangle_inverted (cr, 0.5, 0.5, width-1, scrollbar->steppersize, widget->roundness, corners);
+			murrine_set_color_rgb (cr, &fill_stepper);
+			cairo_fill_preserve (cr);
+			murrine_draw_trough_border_from_path (cr, &border,0.5, 0.5, width-1, scrollbar->steppersize, widget->mrn_gradient, 1.0, FALSE);
+		}
+		else
+		{
+			corners = MRN_CORNER_TOPLEFT | MRN_CORNER_TOPRIGHT;
+			murrine_rounded_rectangle_inverted (cr, 0.5, height-scrollbar->steppersize-0.5, width-1, scrollbar->steppersize, widget->roundness, corners);
+			murrine_set_color_rgb (cr, &fill_stepper);
+			cairo_fill_preserve (cr);
+			murrine_draw_trough_border_from_path (cr, &border, 0.5, height-scrollbar->steppersize-0.5, width-1, scrollbar->steppersize, widget->mrn_gradient, 1.0, FALSE);
 	}
+			cairo_restore (cr);
+		}
 
 	/* Draw border */
 	if (!scrollbar->within_bevel)
diff --git a/src/murrine_style.c b/src/murrine_style.c
index f6f7e3b..ae6649f 100644
--- a/src/murrine_style.c
+++ b/src/murrine_style.c
@@ -1021,7 +1021,7 @@ murrine_style_draw_box (DRAW_ARGS)
 
 		STYLE_FUNCTION(draw_progressbar_trough) (cr, colors, &params, &progressbar, x, y, width, height);
 	}
-	else if (DETAIL ("trough") && widget && (MRN_IS_VSCROLLBAR (widget) || MRN_IS_HSCROLLBAR (widget)))
+	else if ((DETAIL ("trough-upper") || DETAIL ("trough-lower")) && widget && (MRN_IS_VSCROLLBAR (widget) || MRN_IS_HSCROLLBAR (widget)))
 	{
 		WidgetParameters params;
 		ScrollBarParameters scrollbar;
@@ -1034,6 +1034,7 @@ murrine_style_draw_box (DRAW_ARGS)
 		scrollbar.junction     = murrine_scrollbar_get_junction (widget);
 		scrollbar.stepperstyle = murrine_style->stepperstyle;
 		scrollbar.within_bevel = within_bevel;
+		scrollbar.trough_upper = DETAIL ("trough-upper");
 		gtk_widget_style_get (widget, "stepper-size", &scrollbar.steppersize, NULL);
 
 		murrine_set_widget_parameters (widget, style, state_type, &params);
@@ -1041,8 +1042,7 @@ murrine_style_draw_box (DRAW_ARGS)
 		if (within_bevel)
 			params.corners = MRN_CORNER_NONE;
 
-		if (MRN_IS_RANGE (widget))
-			scrollbar.horizontal = gtk_orientable_get_orientation (GTK_ORIENTABLE (widget)) == GTK_ORIENTATION_HORIZONTAL;
+		scrollbar.horizontal = gtk_orientable_get_orientation ((GtkOrientable*)widget) == GTK_ORIENTATION_HORIZONTAL;
 
 		if (murrine_style->stepperstyle != 1 && murrine_style->stepperstyle != 3 && !params.mrn_gradient.use_rgba)
 		{
@@ -1058,8 +1058,6 @@ murrine_style_draw_box (DRAW_ARGS)
 			}
 		}
 
-		printf( "draw_scrollbar_trough: %s %s\n", detail, G_OBJECT_TYPE_NAME (widget));
-
 		STYLE_FUNCTION(draw_scrollbar_trough) (cr, colors, &params, &scrollbar, x, y, width, height);
 	}
 	else if (DETAIL ("bar"))
@@ -1342,8 +1340,7 @@ murrine_style_draw_box (DRAW_ARGS)
 		scrollbar.prelight_shade = murrine_style->prelight_shade;
 		gtk_widget_style_get (widget, "stepper-size", &scrollbar.steppersize, NULL);
 
-		if (MRN_IS_RANGE (widget))
-			scrollbar.horizontal = gtk_orientable_get_orientation ((GtkOrientable*)widget) == GTK_ORIENTATION_HORIZONTAL;
+		scrollbar.horizontal = g_str_has_prefix (detail, "hscrollbar");
 
 		if (murrine_style->colorize_scrollbar)
 		{
@@ -1372,20 +1369,20 @@ murrine_style_draw_box (DRAW_ARGS)
 			else
 				stepper.stepper = MRN_STEPPER_UNKNOWN;
 
-			/* XXX Check later for corners */
+			/* XXX Check later for corners - might be OK 20101013 */
 
 			if (scrollbar.horizontal)
 			{
 				if (stepper.stepper == MRN_STEPPER_START)
 					params.corners = MRN_CORNER_TOPLEFT | MRN_CORNER_BOTTOMLEFT;
-				else if (stepper.stepper == MRN_STEPPER_END_INNER)
+				else if (stepper.stepper == MRN_STEPPER_END)
 					params.corners = MRN_CORNER_TOPRIGHT | MRN_CORNER_BOTTOMRIGHT;
 			}
 			else
 			{
 				if (stepper.stepper == MRN_STEPPER_START)
 					params.corners = MRN_CORNER_BOTTOMLEFT | MRN_CORNER_TOPLEFT;
-				else if (stepper.stepper == MRN_STEPPER_END_INNER)
+				else if (stepper.stepper == MRN_STEPPER_END)
 					params.corners = MRN_CORNER_TOPRIGHT | MRN_CORNER_BOTTOMRIGHT;
 			}
 		}
@@ -1403,8 +1400,6 @@ murrine_style_draw_box (DRAW_ARGS)
 		if (scrollbar.stepperstyle == 2)
 			params.corners = MRN_CORNER_NONE;
 
-		printf( "draw_scrollbar_stepper: %s %s\n", detail, G_OBJECT_TYPE_NAME (widget));
-
 		if (scrollbar.stepperstyle != 1 && scrollbar.stepperstyle != 3)
 			STYLE_FUNCTION(draw_scrollbar_stepper) (cr, colors, &params, &scrollbar, x, y, width, height);
 	}
@@ -1546,8 +1541,6 @@ murrine_style_draw_slider (DRAW_ARGS, GtkOrientation orientation)
 		else
 			params.corners = MRN_CORNER_NONE;
 
-		printf( "draw_scrollbar_slider: %s %s\n", detail, G_OBJECT_TYPE_NAME (widget));
-
 		STYLE_FUNCTION(draw_scrollbar_slider) (cr, colors, &params, &scrollbar, x, y, width, height);
 	}
 	else
diff --git a/src/murrine_types.h b/src/murrine_types.h
index b1bbf38..4496239 100644
--- a/src/murrine_types.h
+++ b/src/murrine_types.h
@@ -306,6 +306,7 @@ typedef struct
 	boolean         horizontal;
 	boolean         has_color;
 	boolean         within_bevel;
+	boolean         trough_upper;
 	int             handlestyle;
 	int             style;
 	int             steppersize;



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