Skip no-change re-ordering of tracks/busses
[ardour.git] / libs / clearlooks-older / clearlooks_draw.c
index 144be35152fd689277f1e1ff58b43b5ccb169649..cf133eba2fc45ea15eb6c602ed5f70be4994a5fa 100644 (file)
@@ -12,11 +12,11 @@ static void cl_draw_borders (GdkWindow *window, GtkWidget *widget, GtkStyle *sty
 static void cl_draw_line (GdkWindow *window, GtkWidget *widget, GtkStyle *style,
                    int x1, int y1, int x2, int y2, CLBorderType border,
                    CLRectangle *r);
-                                  
+
 static void cl_draw_corner (GdkWindow *window, GtkWidget *widget, GtkStyle *style,
                      int x, int y, int width, int height,
                      CLRectangle *r, CLCornerSide corner);
-                                        
+
 static void cl_draw_fill (GdkWindow *window, GtkWidget *widget, GtkStyle *style,
                    int x, int y, int width, int height, CLRectangle *r);
 
@@ -27,11 +27,11 @@ void cl_draw_rectangle (GdkWindow *window, GtkWidget *widget, GtkStyle *style,
        {
                cl_draw_fill(window, widget, style, x, y, width, height, r);
        }
-       
+
        if (r->bordergc)
        {
                cl_draw_borders(window, widget, style, x, y, width, height, r);
-       }       
+       }
 }
 
 
@@ -117,10 +117,10 @@ static void cl_draw_line (GdkWindow *window, GtkWidget *widget, GtkStyle *style,
                        r->gradient_type == CL_GRADIENT_VERTICAL && border == CL_BORDER_TOP)
                        gdk_gc_set_foreground (r->bordergc, r->border_gradient.from);
                else
-                       gdk_gc_set_foreground (r->bordergc, r->border_gradient.to);                             
+                       gdk_gc_set_foreground (r->bordergc, r->border_gradient.to);
 
                gdk_draw_line (window, r->bordergc, x1, y1, x2, y2);
-               
+
                gdk_gc_set_foreground (r->bordergc, &tmp_color);
        }
 }
@@ -142,7 +142,7 @@ static GdkColor *cl_get_gradient_corner_color (CLRectangle *r, CLCornerSide corn
        {
                color = r->border_gradient.to;
        }
-       
+
        return color;
 }
 
@@ -161,7 +161,7 @@ static void cl_draw_corner (GdkWindow *window, GtkWidget *widget, GtkStyle *styl
 
        if (r->corners[corner] == CL_CORNER_NONE)
                return;
-       
+
        color = cl_get_gradient_corner_color (r, corner);
        gdk_gc_get_values (r->bordergc, &values);
 
@@ -185,21 +185,21 @@ static void cl_draw_corner (GdkWindow *window, GtkWidget *widget, GtkStyle *styl
        {
                x1 = (corner == CL_CORNER_TOPLEFT ||
                      corner == CL_CORNER_BOTTOMLEFT) ? x+1 : x+width - 2;
-               
+
                y1 = (corner == CL_CORNER_TOPLEFT ||
                      corner == CL_CORNER_TOPRIGHT) ? y+1 : y+height - 2;
-               
+
                gdk_gc_set_foreground (r->bordergc, color);
                gdk_draw_point (window, r->bordergc, x1, y1);
-               
+
                gdk_gc_set_foreground (r->bordergc, &aacolor);
-               
+
                x1 = (corner == CL_CORNER_TOPLEFT ||
                      corner == CL_CORNER_BOTTOMLEFT) ? x+1 : x+width-2;
 
                y1 = (corner == CL_CORNER_TOPLEFT ||
-                     corner == CL_CORNER_TOPRIGHT) ? y : y+height-1;           
-               
+                     corner == CL_CORNER_TOPRIGHT) ? y : y+height-1;
+
                gdk_draw_point (window, r->bordergc, x1, y1);
 
                x1 = (corner == CL_CORNER_TOPLEFT ||
@@ -209,7 +209,7 @@ static void cl_draw_corner (GdkWindow *window, GtkWidget *widget, GtkStyle *styl
                      corner == CL_CORNER_TOPRIGHT) ? y+1 : y+height-2;
 
                gdk_draw_point (window, r->bordergc, x1, y1);
-                                                               
+
        }
        else if (r->corners[corner] == CL_CORNER_NARROW)
        {
@@ -218,7 +218,7 @@ static void cl_draw_corner (GdkWindow *window, GtkWidget *widget, GtkStyle *styl
 
                y1 = (corner == CL_CORNER_TOPLEFT ||
                      corner == CL_CORNER_TOPRIGHT) ? y : y+height-1;
-                               
+
                gdk_gc_set_foreground (r->bordergc, &aacolor);
                gdk_draw_point (window, r->bordergc, x1, y1);
        }
@@ -258,8 +258,8 @@ void cl_rectangle_set_button(CLRectangle *r, GtkStyle *style,
        ClearlooksStyle *clearlooks_style = CLEARLOOKS_STYLE (style);
        int              my_state_type = (state_type == GTK_STATE_ACTIVE) ? 2 : 0;
        GdkGC           *border_gc = clearlooks_style->border_gc[CL_BORDER_UPPER+my_state_type];
-       
-       
+
+
        cl_rectangle_init (r, style->bg_gc[state_type],
                           clearlooks_style->border_gc[CL_BORDER_UPPER+my_state_type],
                           tl, tr, bl, br);
@@ -279,9 +279,9 @@ void cl_rectangle_set_button(CLRectangle *r, GtkStyle *style,
 
        r->topleft     = (state_type != GTK_STATE_ACTIVE) ? style->light_gc[state_type] : clearlooks_style->shade_gc[4];
        r->bottomright = (state_type != GTK_STATE_ACTIVE) ? clearlooks_style->shade_gc[1] : NULL;
-       
+
        shade (&style->bg[state_type], &r->tmp_color, 0.93);
-       
+
 
        cl_rectangle_set_gradient (&r->fill_gradient,
                                   &style->bg[state_type],
@@ -296,21 +296,21 @@ void cl_rectangle_set_entry (CLRectangle *r, GtkStyle *style,
 {
        ClearlooksStyle *clearlooks_style = CLEARLOOKS_STYLE (style);
        GdkGC *bordergc;
-       
+
        if (has_focus)
                bordergc = clearlooks_style->spot3_gc;
        else if (state_type != GTK_STATE_INSENSITIVE)
                bordergc = clearlooks_style->border_gc[CL_BORDER_LOWER];
        else
-               bordergc = clearlooks_style->shade_gc[3];               
-       
+               bordergc = clearlooks_style->shade_gc[3];
+
        cl_rectangle_init (r, style->base_gc[state_type], bordergc,
                       tl, tr, bl, br);
 
        if (state_type != GTK_STATE_INSENSITIVE )
                r->topleft     = (has_focus) ? clearlooks_style->spot1_gc
                                         : style->bg_gc[GTK_STATE_NORMAL];
-       
+
        if (has_focus)
                r->bottomright = clearlooks_style->spot1_gc;
        else if (state_type == GTK_STATE_INSENSITIVE)
@@ -328,24 +328,24 @@ void cl_draw_shadow(GdkWindow *window, GtkWidget *widget, GtkStyle *style,
                x1 = x+1+(r->corners[CL_CORNER_BOTTOMLEFT]/2);
                y1 = y2 = y+height-2;
                x2 = x+width - 1 - (1+r->corners[CL_CORNER_BOTTOMRIGHT]/2);
-               
+
                gdk_draw_line (window, r->bottomright, x1, y1, x2, y2);
-               
+
                x1 = x2 = x+width-2;
                y1 = y+1+(r->corners[CL_CORNER_TOPRIGHT]/2);
                y2 = y+height - 1 - (1+r->corners[CL_CORNER_BOTTOMRIGHT]/2);
 
                gdk_draw_line (window, r->bottomright, x1, y1, x2, y2);
        }
-       
+
        if (r->topleft != NULL)
        {
                x1 = x+1+(r->corners[CL_CORNER_TOPLEFT]/2);
                y1 = y2 = y+1;
                x2 = x+width-1-(1+r->corners[CL_CORNER_TOPRIGHT]/2);
-               
+
                gdk_draw_line (window, r->topleft, x1, y1, x2, y2);
-               
+
                x1 = x2 = x+1;
                y1 = y+1+(r->corners[CL_CORNER_TOPLEFT]/2);
                y2 = y+height-1-(1+r->corners[CL_CORNER_BOTTOMLEFT]/2);
@@ -371,16 +371,16 @@ void cl_rectangle_init (CLRectangle *r,
                         int tl, int tr, int bl, int br)
 {
        r->gradient_type = CL_GRADIENT_NONE;
-       
+
        r->border_gradient.from = r->border_gradient.to = NULL;
        r->fill_gradient.from   = r->fill_gradient.to   = NULL;
-       
+
        r->fillgc      = fillgc;
        r->bordergc    = bordergc;
-       
+
        r->topleft     = NULL;
        r->bottomright = NULL;
-       
+
        r->corners[CL_CORNER_TOPLEFT] = tl;
        r->corners[CL_CORNER_TOPRIGHT] = tr;
        r->corners[CL_CORNER_BOTTOMLEFT] = bl;
@@ -392,7 +392,7 @@ void cl_rectangle_set_corners (CLRectangle *r, int tl, int tr, int bl, int br)
        r->corners[CL_CORNER_TOPLEFT] = tl;
        r->corners[CL_CORNER_TOPRIGHT] = tr;
        r->corners[CL_CORNER_BOTTOMLEFT] = bl;
-       r->corners[CL_CORNER_BOTTOMRIGHT] = br; 
+       r->corners[CL_CORNER_BOTTOMRIGHT] = br;
 }
 
 void cl_set_corner_sharpness (const gchar *detail, GtkWidget *widget, CLRectangle *r)
@@ -402,7 +402,7 @@ void cl_set_corner_sharpness (const gchar *detail, GtkWidget *widget, CLRectangl
                gboolean rtl = get_direction (widget->parent) == GTK_TEXT_DIR_RTL;
                int cl = rtl ? CL_CORNER_ROUND : CL_CORNER_NONE;
                int cr = rtl ? CL_CORNER_NONE  : CL_CORNER_ROUND;
-               
+
                cl_rectangle_set_corners (r, cl, cr, cl, cr);
        }
        else if (detail && !strcmp (detail, "spinbutton_up"))
@@ -434,25 +434,25 @@ void cl_rectangle_set_clip_rectangle (CLRectangle *r, GdkRectangle *area)
 {
        if (area == NULL)
                return;
-       
+
        if (r->fillgc)
                gdk_gc_set_clip_rectangle (r->fillgc, area);
-       
+
        if (r->bordergc)
-               gdk_gc_set_clip_rectangle (r->bordergc, area);          
+               gdk_gc_set_clip_rectangle (r->bordergc, area);
 
        if (r->topleft)
-               gdk_gc_set_clip_rectangle (r->topleft, area);           
+               gdk_gc_set_clip_rectangle (r->topleft, area);
 
        if (r->bottomright)
-               gdk_gc_set_clip_rectangle (r->bottomright, area);               
+               gdk_gc_set_clip_rectangle (r->bottomright, area);
 }
 
 void cl_rectangle_reset_clip_rectangle (CLRectangle *r)
 {
        if (r->fillgc)
                gdk_gc_set_clip_rectangle (r->fillgc, NULL);
-       
+
        if (r->bordergc)
                gdk_gc_set_clip_rectangle (r->bordergc, NULL);
 
@@ -471,7 +471,7 @@ void cl_rectangle_reset (CLRectangle *r, GtkStyle *style)
                           CL_CORNER_ROUND, CL_CORNER_ROUND);
 }
 
-static void cl_progressbar_points_transform (GdkPoint *points, int npoints, 
+static void cl_progressbar_points_transform (GdkPoint *points, int npoints,
                                              int offset, gboolean is_horizontal)
 {
        int i;
@@ -494,37 +494,37 @@ GdkPixmap* cl_progressbar_tile_new (GdkDrawable *drawable, GtkWidget *widget,
        int trans;
 
        int stripe_width   = height/2;
-       int topright       = height + stripe_width;     
+       int topright       = height + stripe_width;
        int topright_div_2 = topright/2;
 
-       double shift;   
+       double shift;
        GdkPoint points[4];
 
        GtkProgressBarOrientation orientation = gtk_progress_bar_get_orientation (GTK_PROGRESS_BAR (widget));
        gboolean is_horizontal = (orientation == GTK_PROGRESS_LEFT_TO_RIGHT || orientation == GTK_PROGRESS_RIGHT_TO_LEFT) ? 1 : 0;
-       
+
        GdkPixmap *tmp = gdk_pixmap_new (widget->window, width, height, -1);
 
        GdkColor tmp_color;
        shade (&clearlooks_style->spot2, &tmp_color, 0.90);
-       
+
        if (is_horizontal)
                draw_hgradient (tmp, style->black_gc, style, 0, 0, width, height,
                            &clearlooks_style->spot2, &tmp_color );
        else
                draw_vgradient (tmp, style->black_gc, style, 0, 0, width, height,
                            &tmp_color, &clearlooks_style->spot2); /* TODO: swap for RTL */
-                       
-       if (orientation == GTK_PROGRESS_RIGHT_TO_LEFT || 
+
+       if (orientation == GTK_PROGRESS_RIGHT_TO_LEFT ||
            orientation == GTK_PROGRESS_BOTTOM_TO_TOP)
        {
                offset = -offset;
                xdir = -1;
        }
-       
+
        if (get_direction (widget) == GTK_TEXT_DIR_RTL)
                offset = -offset;
-       
+
        if (is_horizontal)
        {
                points[0] = (GdkPoint){xdir*(topright - stripe_width - topright_div_2), 0};  /* topleft */
@@ -539,11 +539,11 @@ GdkPixmap* cl_progressbar_tile_new (GdkDrawable *drawable, GtkWidget *widget,
                points[2] = (GdkPoint){0, xdir*(stripe_width - topright_div_2)};        /* bottomright */
                points[3] = (GdkPoint){0, xdir*(-topright_div_2)};                      /* bottomleft */
        }
-                                                
-       
+
+
        shift = (stripe_width*2)/(double)10;
        cl_progressbar_points_transform (points, 4, (offset*shift), is_horizontal);
-               
+
        trans = (width/2)-1-(stripe_width*2);
        cl_progressbar_points_transform (points, 4, trans, is_horizontal);
        gdk_draw_polygon (tmp, clearlooks_style->spot2_gc, TRUE, points, 4);
@@ -557,7 +557,7 @@ GdkPixmap* cl_progressbar_tile_new (GdkDrawable *drawable, GtkWidget *widget,
        trans = (width/2)-1+(stripe_width*2);
        cl_progressbar_points_transform (points, 4, trans, is_horizontal);
        gdk_draw_polygon (tmp, clearlooks_style->spot2_gc, TRUE, points, 4);
-       
+
        return tmp;
 }
 
@@ -576,9 +576,9 @@ void cl_progressbar_fill (GdkDrawable *drawable, GtkWidget *widget,
             ny = y,
             nwidth = height,
             nheight = width;
-       
+
        gdk_gc_set_clip_rectangle (gc, area);
-       
+
        switch (orientation)
        {
                case GTK_PROGRESS_LEFT_TO_RIGHT:
@@ -648,13 +648,13 @@ void cl_progressbar_fill (GdkDrawable *drawable, GtkWidget *widget,
                        break;
                }
        }
-       
+
        gdk_gc_set_clip_rectangle (gc, NULL);
-       
+
        g_object_unref (tile);
 }
 
-GdkColor cl_gc_set_fg_color_shade (GdkGC *gc, GdkColormap *colormap, 
+GdkColor cl_gc_set_fg_color_shade (GdkGC *gc, GdkColormap *colormap,
                                    GdkColor *from, gfloat s)
 {
        GdkColor tmp_color;
@@ -664,7 +664,7 @@ GdkColor cl_gc_set_fg_color_shade (GdkGC *gc, GdkColormap *colormap,
        gdk_gc_get_values (gc, &values);
        gdk_rgb_find_color (colormap, &tmp_color);
        gdk_gc_set_foreground (gc, &tmp_color);
-       
+
        return values.foreground;
 }
 
@@ -675,10 +675,10 @@ static void cl_get_window_style_state (GtkWidget *widget, GtkStyle **style, GtkS
        GtkStyle *windowstyle = NULL;
        GtkWidget *tmpwidget = widget;
        GtkStateType windowstate;
-       
+
        if (widget && GTK_IS_ENTRY (widget))
                tmpwidget = tmpwidget->parent;
-       
+
        while (tmpwidget && GTK_WIDGET_NO_WINDOW (tmpwidget) && !GTK_IS_NOTEBOOK(tmpwidget))
        {
                tmpwidget = tmpwidget->parent;
@@ -692,9 +692,9 @@ static GdkGC *cl_get_window_bg_gc (GtkWidget *widget)
 {
        GtkStyle *style;
        GtkStateType state_type;
-       
+
        cl_get_window_style_state (widget, &style, &state_type);
-       
+
        return style->bg_gc[state_type];
 }
 
@@ -709,18 +709,18 @@ void cl_draw_inset (GtkStyle *style, GdkWindow *window, GtkWidget *widget,
 {
        ClearlooksStyle *clearlooks_style = CLEARLOOKS_STYLE(style);
        ClearlooksStyle *clwindowstyle; /* style of the window this widget is on */
-       GtkStateType     windowstate;   
+       GtkStateType     windowstate;
        CLRectangle      r;
 
        cl_rectangle_init (&r, NULL, style->black_gc,
                           tl, tr, bl, br);
-       
+
        r.gradient_type = CL_GRADIENT_VERTICAL;
-       
+
        cl_get_window_style_state(widget, (GtkStyle**)&clwindowstyle, &windowstate);
-       
+
        g_assert (clwindowstyle != NULL);
-       
+
        if (GTK_WIDGET_HAS_DEFAULT (widget))
        {
                r.bordergc = style->mid_gc[GTK_STATE_NORMAL];
@@ -732,11 +732,11 @@ void cl_draw_inset (GtkStyle *style, GdkWindow *window, GtkWidget *widget,
                                           &clwindowstyle->inset_light[windowstate]);
        }
        cl_rectangle_set_clip_rectangle (&r, area);
-       cl_draw_rectangle (window, widget, style, x, y, width, height, &r); 
+       cl_draw_rectangle (window, widget, style, x, y, width, height, &r);
        cl_rectangle_reset_clip_rectangle (&r);
 }
 
-/* Draw a normal (toggle)button. Not spinbuttons.*/ 
+/* Draw a normal (toggle)button. Not spinbuttons.*/
 void cl_draw_button(GtkStyle *style, GdkWindow *window,
                     GtkStateType state_type, GtkShadowType shadow_type,
                     GdkRectangle *area,
@@ -748,16 +748,16 @@ void cl_draw_button(GtkStyle *style, GdkWindow *window,
        GdkGC *bg_gc = NULL;
        gboolean is_active = FALSE;
        CLRectangle r;
-       
+
        /* Get the background color of the window we're on */
        bg_gc = cl_get_window_bg_gc(widget);
-       
+
        cl_rectangle_set_button (&r, style, state_type,
                                 GTK_WIDGET_HAS_DEFAULT (widget),
                                 GTK_WIDGET_HAS_FOCUS (widget),
                                 CL_CORNER_ROUND, CL_CORNER_ROUND,
                                 CL_CORNER_ROUND, CL_CORNER_ROUND);
-               
+
        if (state_type == GTK_STATE_ACTIVE)
                is_active = TRUE;
 
@@ -768,24 +768,24 @@ void cl_draw_button(GtkStyle *style, GdkWindow *window,
                cl_rectangle_set_gradient (&r.fill_gradient, &clearlooks_style->shade[1], &clearlooks_style->shade[1]);
                r.topleft     = clearlooks_style->shade_gc[3];
                r.bottomright = clearlooks_style->shade_gc[1];
-               
+
                is_active = TRUE;
-       }       
+       }
 
        if (!is_active)
                r.fillgc = NULL;
-               
+
        if (!GTK_IS_NOTEBOOK (widget->parent))
        {
                gdk_draw_rectangle (window, bg_gc, FALSE, x, y, width-1, height-1);
-       
+
                /* Draw "sunken" look when border thickness is more than 2 pixels. */
                if (style->xthickness > 2 && style->ythickness > 2)
                cl_draw_inset (style, window, widget, area, x, y, width, height,
                               CL_CORNER_ROUND, CL_CORNER_ROUND,
                               CL_CORNER_ROUND, CL_CORNER_ROUND);
        }
-       
+
        /* Draw "sunken" look when border thickness is more than 2 pixels.*/
        if (style->xthickness > 2 && style->ythickness > 2)
        {
@@ -794,37 +794,37 @@ void cl_draw_button(GtkStyle *style, GdkWindow *window,
                height-=2;
                width-=2;
        }
-       
+
        /* Don't draw the normal gradient for normal buttons. */
 
        cl_rectangle_set_clip_rectangle (&r, area);
        cl_draw_rectangle (window, widget, style, x, y, width, height, &r);
-       
-       
-       if (!is_active) 
+
+
+       if (!is_active)
        {
                int tmp_height = (float)height*0.25;
-       
+
                gdk_gc_set_clip_rectangle (style->bg_gc[state_type], area);
-               
+
                draw_hgradient (window, style->bg_gc[state_type], style,
                                x+2,y+2,width-4,tmp_height,
                                &clearlooks_style->button_g1[state_type],
                                    &clearlooks_style->button_g2[state_type]);
-               
+
                draw_hgradient (window, style->bg_gc[state_type], style,
                                x+2, y+2+tmp_height, width-4, height-3-tmp_height*2,
                                &clearlooks_style->button_g2[state_type],
                                    &clearlooks_style->button_g3[state_type]);
-               
+
                draw_hgradient (window, style->bg_gc[state_type], style,
                                x+2,y+height-tmp_height-1,width-4,tmp_height,
                                &clearlooks_style->button_g3[state_type],
                                    &clearlooks_style->button_g4[state_type]);
 
                gdk_gc_set_clip_rectangle (style->bg_gc[state_type], NULL);
-       }                               
-       
+       }
+
        cl_draw_shadow    (window, widget, style, x, y, width, height, &r);
        cl_rectangle_reset_clip_rectangle (&r);
 }
@@ -840,21 +840,21 @@ void cl_draw_spinbutton(GtkStyle *style, GdkWindow *window,
        GdkRectangle new_area;
 
        int tl = CL_CORNER_NONE, tr = CL_CORNER_NONE,
-           bl = CL_CORNER_NONE, br = CL_CORNER_NONE;   
-       
+           bl = CL_CORNER_NONE, br = CL_CORNER_NONE;
+
        if (area == NULL)
        {
                new_area.x = x;
                new_area.y = y;
                new_area.width = width;
                new_area.height = height;
-               area = &new_area;               
+               area = &new_area;
        }
 
        if (!strcmp (detail, "spinbutton")) /* draws the 'back' of the spinbutton */
        {
                GdkGC *bg_gc = cl_get_window_bg_gc(widget);
-               
+
                gdk_gc_set_clip_rectangle (bg_gc, area);
                gdk_draw_rectangle (window, bg_gc, FALSE, x, y, width-1, height-1);
                gdk_gc_set_clip_rectangle (bg_gc, NULL);
@@ -863,32 +863,32 @@ void cl_draw_spinbutton(GtkStyle *style, GdkWindow *window,
                        cl_draw_inset (style, window, widget, area, x, y, width, height,
                                       CL_CORNER_NONE, CL_CORNER_ROUND,
                                       CL_CORNER_NONE, CL_CORNER_ROUND);
-               
+
                return;
        }
 
        if (!strcmp (detail, "spinbutton_up"))
        {
                tr = CL_CORNER_ROUND;
-               
+
                (style->xthickness > 2 && style->ythickness > 2) ? y++ : height++;
        }
-       
+
        if (!strcmp (detail, "spinbutton_down"))
        {
                br = CL_CORNER_ROUND;
-               
+
                if (style->xthickness > 2 && style->ythickness > 2)
                        height--;
        }
-       
+
        cl_rectangle_set_button (&r, style, state_type,
                                 GTK_WIDGET_HAS_DEFAULT  (widget),
                                 GTK_WIDGET_HAS_FOCUS (widget),
                                 tl, tr,
                                 bl, br);
        width--;
-       
+
        cl_rectangle_set_clip_rectangle (&r, area);
        cl_draw_rectangle (window, widget, style, x, y, width, height, &r);
        cl_draw_shadow    (window, widget, style, x, y, width, height, &r);
@@ -902,15 +902,15 @@ void cl_draw_combobox_entry (GtkStyle *style, GdkWindow *window,
                              gint x, gint y, gint width, gint height)
 {
        CLRectangle r;
-       
+
        gboolean rtl = get_direction (widget->parent) == GTK_TEXT_DIR_RTL;
        gboolean has_focus = GTK_WIDGET_HAS_FOCUS (widget);
-       
+
        int cl = rtl ? CL_CORNER_NONE  : CL_CORNER_ROUND,
                cr = rtl ? CL_CORNER_ROUND : CL_CORNER_NONE;
-       
+
        GdkGC *bg_gc = cl_get_window_bg_gc(widget);
-       
+
        if (rtl)
        {
                if (!has_focus)
@@ -924,7 +924,7 @@ void cl_draw_combobox_entry (GtkStyle *style, GdkWindow *window,
                width += 2;
                if (has_focus) width--; /* this gives us a 2px focus line at the right side. */
        }
-       
+
        cl_rectangle_set_entry (&r, style, state_type,
                                                   cl, cr, cl, cr,
                                                   has_focus);
@@ -944,12 +944,12 @@ void cl_draw_combobox_entry (GtkStyle *style, GdkWindow *window,
                width-=2;
                height-=2;
        }
-       
+
        cl_rectangle_set_clip_rectangle (&r, area);
 
        cl_draw_rectangle (window, widget, style, x, y, width, height, &r);
-       cl_draw_shadow (window, widget, style, x, y, width, height, &r); 
-       
+       cl_draw_shadow (window, widget, style, x, y, width, height, &r);
+
        cl_rectangle_reset_clip_rectangle (&r);
 }
 
@@ -969,16 +969,16 @@ void cl_draw_combobox_button (GtkStyle *style, GdkWindow *window,
                                 GTK_WIDGET_HAS_FOCUS (widget),
                                 CL_CORNER_NONE, CL_CORNER_ROUND,
                                 CL_CORNER_NONE, CL_CORNER_ROUND);
-       
+
        if (state_type == GTK_STATE_ACTIVE)
                is_active = TRUE;
        else
                r.fillgc = NULL;
-       
+
        /* Seriously, why can't non-gtk-apps at least try to be decent citizens?
           Take this fscking OpenOffice.org 1.9 for example. The morons responsible
           for this utter piece of crap give the clip size wrong values! :'(  */
-       
+
        if (area)
        {
                area->x = x;
@@ -989,20 +989,20 @@ void cl_draw_combobox_button (GtkStyle *style, GdkWindow *window,
 
        x--;
        width++;
-       
+
        /* Draw "sunken" look when border thickness is more than 2 pixels. */
        if (GTK_IS_COMBO(widget->parent))
                draw_inset = (widget->parent->style->xthickness > 2 &&
                          widget->parent->style->ythickness > 2);
        else
                draw_inset = (style->xthickness > 2 && style->ythickness > 2);
-               
+
        if (draw_inset)
        {
                cl_draw_inset (style, window, widget, area, x, y, width, height,
                               CL_CORNER_NONE, CL_CORNER_ROUND,
                               CL_CORNER_NONE, CL_CORNER_ROUND);
-       
+
                x++;
                y++;
                height-=2;
@@ -1013,36 +1013,36 @@ void cl_draw_combobox_button (GtkStyle *style, GdkWindow *window,
                x++;
                width--;
        }
-       
+
        if (area)
                cl_rectangle_set_clip_rectangle (&r, area);
 
        cl_draw_rectangle (window, widget, style, x, y, width, height, &r);
-       
+
        if (!is_active)
        {
                int tmp_height = (float)height*0.25;
-       
+
                gdk_gc_set_clip_rectangle (style->bg_gc[state_type], area);
-               
+
                draw_hgradient (window, style->bg_gc[state_type], style,
                                x+2,y+2,width-4,tmp_height,
                                &clearlooks_style->button_g1[state_type],
                                    &clearlooks_style->button_g2[state_type]);
-               
+
                draw_hgradient (window, style->bg_gc[state_type], style,
                                x+2, y+2+tmp_height, width-4, height-3-tmp_height*2,
                                &clearlooks_style->button_g2[state_type],
                                    &clearlooks_style->button_g3[state_type]);
-               
+
                draw_hgradient (window, style->bg_gc[state_type], style,
                                x+2,y+height-tmp_height-1,width-4,tmp_height,
                                &clearlooks_style->button_g3[state_type],
                                    &clearlooks_style->button_g4[state_type]);
 
                gdk_gc_set_clip_rectangle (style->bg_gc[state_type], NULL);
-       }                                       
-       
+       }
+
        cl_draw_shadow    (window, widget, style, x, y, width, height, &r);
 
        if (area)
@@ -1059,34 +1059,34 @@ void cl_draw_entry (GtkStyle *style, GdkWindow *window,
        CLRectangle r;
        gboolean has_focus = GTK_WIDGET_HAS_FOCUS(widget);
        GdkGC *bg_gc = cl_get_window_bg_gc(widget);
-       
+
        gdk_draw_rectangle (window, bg_gc, FALSE, x, y, width-1, height-1);
 
        gtk_style_apply_default_background (style, window, TRUE, state_type,
                                                                                area, x+1, y+1, width-2, height-2);
 
-       
+
        cl_rectangle_set_entry (&r, style, state_type,
                                                        CL_CORNER_ROUND, CL_CORNER_ROUND,
                                                        CL_CORNER_ROUND, CL_CORNER_ROUND,
                                                        has_focus);
-       
+
        /* Draw "sunken" look when border thickness is more than 2 pixels. */
        if (style->xthickness > 2 && style->ythickness > 2)
        {
                cl_draw_inset (style, window, widget, area, x, y, width, height,
                               CL_CORNER_ROUND, CL_CORNER_ROUND,
                               CL_CORNER_ROUND, CL_CORNER_ROUND);
-       
+
                x++;
                y++;
                width-=2;
                height-=2;
        }
-       
+
        cl_rectangle_set_clip_rectangle (&r, area);
        cl_draw_rectangle (window, widget, style, x, y, width, height, &r);
-       cl_draw_shadow (window, widget, style, x, y, width, height, &r); 
+       cl_draw_shadow (window, widget, style, x, y, width, height, &r);
        cl_rectangle_reset_clip_rectangle (&r);
 }
 
@@ -1102,14 +1102,14 @@ void cl_draw_optionmenu(GtkStyle *style, GdkWindow *window,
        int line_pos;
 
        option_menu_get_props (widget, &indicator_size, &indicator_spacing);
-       
+
        if (get_direction (widget) == GTK_TEXT_DIR_RTL)
                line_pos = x + (indicator_size.width + indicator_spacing.left + indicator_spacing.right) + style->xthickness;
        else
                line_pos = x + width - (indicator_size.width + indicator_spacing.left + indicator_spacing.right) - style->xthickness;
 
        cl_draw_button (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height);
-       
+
        gdk_draw_line (window, clearlooks_style->shade_gc[3],
                                   line_pos, y + style->ythickness - 1, line_pos,
                                   y + height - style->ythickness);
@@ -1121,7 +1121,7 @@ void cl_draw_optionmenu(GtkStyle *style, GdkWindow *window,
 
 
 void cl_draw_menuitem_button (GdkDrawable *window, GtkWidget *widget, GtkStyle *style,
-                              GdkRectangle *area, GtkStateType state_type, 
+                              GdkRectangle *area, GtkStateType state_type,
                               int x, int y, int width, int height, CLRectangle *r)
 {
        ClearlooksStyle *clearlooks_style = (ClearlooksStyle*)style;
@@ -1130,7 +1130,7 @@ void cl_draw_menuitem_button (GdkDrawable *window, GtkWidget *widget, GtkStyle *
        GdkColor lower_color;
 
        shade (&style->base[GTK_STATE_SELECTED], &lower_color, 0.85);
-       
+
        if (menubar)
        {
                height++;
@@ -1141,17 +1141,17 @@ void cl_draw_menuitem_button (GdkDrawable *window, GtkWidget *widget, GtkStyle *
        {
                r->bordergc    = clearlooks_style->spot3_gc;
        }
-       
+
        cl_rectangle_set_corners (r, corner, corner, corner, corner);
-       
+
        cl_rectangle_set_gradient (&r->fill_gradient,
                                   &style->base[GTK_STATE_SELECTED], &lower_color);
 
        r->gradient_type = CL_GRADIENT_VERTICAL;
-       
+
        r->fillgc  = clearlooks_style->spot2_gc;
        r->topleft = clearlooks_style->spot1_gc;
-       
+
        cl_rectangle_set_clip_rectangle (r, area);
        cl_draw_rectangle (window, widget, style, x, y, width, height, r);
        cl_draw_shadow (window, widget, style, x, y, width, height, r);
@@ -1159,62 +1159,62 @@ void cl_draw_menuitem_button (GdkDrawable *window, GtkWidget *widget, GtkStyle *
 }
 
 void cl_draw_menuitem_flat (GdkDrawable *window, GtkWidget *widget, GtkStyle *style,
-                              GdkRectangle *area, GtkStateType state_type, 
+                              GdkRectangle *area, GtkStateType state_type,
                               int x, int y, int width, int height, CLRectangle *r)
 {
        ClearlooksStyle *clearlooks_style = (ClearlooksStyle*)style;
        gboolean menubar  = (widget->parent && GTK_IS_MENU_BAR(widget->parent)) ? TRUE : FALSE;
        GdkColor tmp;
-       
+
        cl_rectangle_set_corners (r, CL_CORNER_NARROW, CL_CORNER_NARROW,
                                     CL_CORNER_NARROW, CL_CORNER_NARROW);
-       
+
        tmp = cl_gc_set_fg_color_shade (style->black_gc, style->colormap,
                                        &style->base[GTK_STATE_PRELIGHT], 0.8);
 
        r->bordergc = style->black_gc;
        r->fillgc = style->base_gc[GTK_STATE_PRELIGHT];
-       
+
        if (menubar) height++;
 
        cl_rectangle_set_clip_rectangle (r, area);
        cl_draw_rectangle (window, widget, style, x, y, width, height, r);
-       cl_rectangle_reset_clip_rectangle (r);  
-       
+       cl_rectangle_reset_clip_rectangle (r);
+
        gdk_gc_set_foreground (style->black_gc, &tmp);
 }
 
 void cl_draw_menuitem_gradient (GdkDrawable *window, GtkWidget *widget, GtkStyle *style,
-                                GdkRectangle *area, GtkStateType state_type, 
+                                GdkRectangle *area, GtkStateType state_type,
                                 int x, int y, int width, int height, CLRectangle *r)
 {
        ClearlooksStyle *clearlooks_style = (ClearlooksStyle*)style;
        gboolean menubar  = (widget->parent && GTK_IS_MENU_BAR(widget->parent)) ? TRUE : FALSE;
        GdkColor tmp;
        GdkColor lower_color;
-       
+
        shade (&style->base[GTK_STATE_SELECTED], &lower_color, 0.8);
-       
+
        cl_rectangle_set_corners (r, CL_CORNER_NARROW, CL_CORNER_NARROW,
                                     CL_CORNER_NARROW, CL_CORNER_NARROW);
-                                    
+
        cl_rectangle_set_gradient (&r->fill_gradient,
                                   &style->base[GTK_STATE_SELECTED], &lower_color);
 
        r->gradient_type = CL_GRADIENT_VERTICAL;
-       
+
        tmp = cl_gc_set_fg_color_shade (style->black_gc, style->colormap,
                                        &style->base[GTK_STATE_PRELIGHT], 0.8);
 
        r->bordergc = style->black_gc;
        r->fillgc = style->base_gc[GTK_STATE_PRELIGHT];
-       
+
        if (menubar) height++;
 
        cl_rectangle_set_clip_rectangle (r, area);
        cl_draw_rectangle (window, widget, style, x, y, width, height, r);
        cl_rectangle_reset_clip_rectangle (r);
-       
+
        gdk_gc_set_foreground (style->black_gc, &tmp);
 }
 
@@ -1228,12 +1228,12 @@ void cl_draw_treeview_header (GtkStyle *style, GdkWindow *window,
        gint columns = 0, column_index = -1, fill_width = width;
        gboolean is_etree = strcmp("ETree", G_OBJECT_TYPE_NAME(widget->parent)) == 0;
        gboolean resizable = TRUE;
-       
+
        GdkGC *bottom = clearlooks_style->shade_gc[5];
-               
+
        if ( width < 2 || height < 2 )
                return;
-       
+
        if (GTK_IS_TREE_VIEW (widget->parent))
        {
                gtk_treeview_get_header_index (GTK_TREE_VIEW(widget->parent),
@@ -1245,49 +1245,49 @@ void cl_draw_treeview_header (GtkStyle *style, GdkWindow *window,
                gtk_clist_get_header_index (GTK_CLIST(widget->parent),
                                            widget, &column_index, &columns);
        }
-       
+
        if (area)
        {
                gdk_gc_set_clip_rectangle (clearlooks_style->shade_gc[0], area);
                gdk_gc_set_clip_rectangle (clearlooks_style->shade_gc[4], area);
-               gdk_gc_set_clip_rectangle (style->bg_gc[state_type], area);                     
+               gdk_gc_set_clip_rectangle (style->bg_gc[state_type], area);
                gdk_gc_set_clip_rectangle (clearlooks_style->shade_gc[5], area);
        }
-       
+
        if (state_type != GTK_STATE_NORMAL)
                fill_width-=2;
-       
+
        gdk_draw_rectangle (window, style->bg_gc[state_type], TRUE, x, y, fill_width, height-(height/3)+1);
-       
+
        draw_hgradient (window, style->bg_gc[state_type], style,
                        x, 1+y+height-(height/3), fill_width, height/3,
                        &style->bg[state_type], &clearlooks_style->inset_dark[state_type]);
 
        if (resizable || (column_index != columns-1))
        {
-               gdk_draw_line (window, clearlooks_style->shade_gc[4], x+width-2, y+4, x+width-2, y+height-5); 
-               gdk_draw_line (window, clearlooks_style->shade_gc[0], x+width-1, y+4, x+width-1, y+height-5); 
+               gdk_draw_line (window, clearlooks_style->shade_gc[4], x+width-2, y+4, x+width-2, y+height-5);
+               gdk_draw_line (window, clearlooks_style->shade_gc[0], x+width-1, y+4, x+width-1, y+height-5);
        }
-       
+
        /* left light line */
        if (column_index == 0)
                gdk_draw_line (window, clearlooks_style->shade_gc[0], x, y+1, x, y+height-2);
-               
+
        /* top light line */
        gdk_draw_line (window, clearlooks_style->shade_gc[0], x, y, x+width-1, y);
-       
+
        /* bottom dark line */
        if (state_type == GTK_STATE_INSENSITIVE)
                bottom = clearlooks_style->shade_gc[3];
-       
-       
+
+
        gdk_draw_line (window, bottom, x, y+height-1, x+width-1, y+height-1);
-       
+
        if (area)
        {
                gdk_gc_set_clip_rectangle (clearlooks_style->shade_gc[0], NULL);
                gdk_gc_set_clip_rectangle (clearlooks_style->shade_gc[4], NULL);
                gdk_gc_set_clip_rectangle (style->bg_gc[state_type], NULL);
                gdk_gc_set_clip_rectangle (clearlooks_style->shade_gc[5], NULL);
-       }               
+       }
 }