[gnome-panel/gtk3] panel: Draw the separator line where it should



commit be822666a99680e5cd34c02ad2e35bea81f4a7d8
Author: Vincent Untz <vuntz gnome org>
Date:   Mon Jan 31 16:35:47 2011 +0100

    panel: Draw the separator line where it should
    
    The calculation wasn't done right. At least, I think so :-)
    Also cleanup a bit some code in the file.

 gnome-panel/panel-separator.c |   26 ++++++++++++++++++++------
 1 files changed, 20 insertions(+), 6 deletions(-)
---
diff --git a/gnome-panel/panel-separator.c b/gnome-panel/panel-separator.c
index fd3f218..a604231 100644
--- a/gnome-panel/panel-separator.c
+++ b/gnome-panel/panel-separator.c
@@ -68,13 +68,23 @@ panel_separator_draw (GtkWidget *widget,
 
         cairo_save (cr);
 	if (separator->priv->orientation == GTK_ORIENTATION_HORIZONTAL) {
+                int x;
+
+                x= (width - padding.left - padding.right) / 2 + padding.left;
+                x = MIN (x, width - padding.right);
+
                 gtk_render_line (context, cr,
-                                 (width - padding.left) / 2, 0,
-                                 (width - padding.left) / 2, height - 1);
+                                 x, padding.top,
+                                 x, height - padding.bottom);
 	} else {
+                int y;
+
+                y = (height - padding.top - padding.bottom) / 2 + padding.top;
+                y = MIN (y, height - padding.bottom);
+
                 gtk_render_line (context, cr,
-                                 0, (height - padding.top) / 2,
-                                 width - 1, (height - padding.top) / 2);
+                                 padding.left, y,
+                                 width - padding.right, y);
 	}
         cairo_restore (cr);
 
@@ -84,7 +94,9 @@ panel_separator_draw (GtkWidget *widget,
 }
 
 static void
-panel_separator_get_preferred_width(GtkWidget *widget, gint *minimal_width, gint *natural_width)
+panel_separator_get_preferred_width (GtkWidget *widget,
+				     gint      *minimal_width,
+				     gint      *natural_width)
 {
 	PanelSeparator *separator;
 	int             size;
@@ -100,7 +112,9 @@ panel_separator_get_preferred_width(GtkWidget *widget, gint *minimal_width, gint
 }
 
 static void
-panel_separator_get_preferred_height(GtkWidget *widget, gint *minimal_height, gint *natural_height)
+panel_separator_get_preferred_height (GtkWidget *widget,
+				      gint      *minimal_height,
+				      gint      *natural_height)
 {
 	PanelSeparator *separator;
 	int             size;



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