From 22b07e0233a29d9633ffa825a79503befaf2e16e Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Mon, 5 Oct 2015 16:17:49 +0200 Subject: NOOP, remove trailing tabs/whitespace. --- libs/clearlooks-older/clearlooks_draw.c | 304 ++++++++-------- libs/clearlooks-older/clearlooks_draw.h | 28 +- libs/clearlooks-older/clearlooks_rc_style.c | 20 +- libs/clearlooks-older/clearlooks_style.c | 540 ++++++++++++++-------------- libs/clearlooks-older/clearlooks_style.h | 20 +- libs/clearlooks-older/support.c | 156 ++++---- libs/clearlooks-older/support.h | 6 +- 7 files changed, 537 insertions(+), 537 deletions(-) (limited to 'libs/clearlooks-older') diff --git a/libs/clearlooks-older/clearlooks_draw.c b/libs/clearlooks-older/clearlooks_draw.c index 68bd0e6ee9..cf133eba2f 100644 --- a/libs/clearlooks-older/clearlooks_draw.c +++ b/libs/clearlooks-older/clearlooks_draw.c @@ -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); @@ -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 || 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,9 +648,9 @@ void cl_progressbar_fill (GdkDrawable *drawable, GtkWidget *widget, break; } } - + gdk_gc_set_clip_rectangle (gc, NULL); - + g_object_unref (tile); } @@ -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]; @@ -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) { 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_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,31 +1059,31 @@ 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); @@ -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); @@ -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); @@ -1165,22 +1165,22 @@ void cl_draw_menuitem_flat (GdkDrawable *window, GtkWidget *widget, GtkStyle *st 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); } @@ -1192,29 +1192,29 @@ void cl_draw_menuitem_gradient (GdkDrawable *window, GtkWidget *widget, GtkStyle 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,20 +1245,20 @@ 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]); @@ -1268,26 +1268,26 @@ void cl_draw_treeview_header (GtkStyle *style, GdkWindow *window, 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); - } + } } diff --git a/libs/clearlooks-older/clearlooks_draw.h b/libs/clearlooks-older/clearlooks_draw.h index 0605cba1f9..eb707db6c0 100644 --- a/libs/clearlooks-older/clearlooks_draw.h +++ b/libs/clearlooks-older/clearlooks_draw.h @@ -21,17 +21,17 @@ typedef struct { CLGradient fill_gradient; CLGradient border_gradient; - + CLGradientType gradient_type; - + GdkGC *bordergc; GdkGC *fillgc; guint8 corners[4]; - + GdkGC *topleft; /* top + left shadow */ GdkGC *bottomright; /* bottom + right shadow */ - + GdkColor tmp_color; /* used for gradient */ } CLRectangle; @@ -79,7 +79,7 @@ void cl_rectangle_set_entry (CLRectangle *r, GtkStyle *style, CLBorderType tl, CLBorderType tr, CLBorderType bl, CLBorderType br, gboolean has_focus); - + void cl_draw_shadow(GdkWindow *window, GtkWidget *widget, GtkStyle *style, int x, int y, int width, int height, CLRectangle *r); @@ -99,12 +99,12 @@ void cl_rectangle_reset (CLRectangle *r, GtkStyle *style); GdkPixmap* cl_progressbar_tile_new (GdkDrawable *drawable, GtkWidget *widget, GtkStyle *style, gint height, gint offset); - + void cl_progressbar_fill (GdkDrawable *drawable, GtkWidget *widget, GtkStyle *style, GdkGC *gc, gint x, gint y, gint width, gint height, guint8 offset, GdkRectangle *area); - + GdkColor cl_gc_set_fg_color_shade (GdkGC *gc, GdkColormap *colormap, GdkColor *from, gfloat s); @@ -113,31 +113,31 @@ void cl_draw_spinbutton(GtkStyle *style, GdkWindow *window, GdkRectangle *area, GtkWidget *widget, const gchar *detail, gint x, gint y, gint width, gint height); - + void cl_draw_button(GtkStyle *style, GdkWindow *window, GtkStateType state_type, GtkShadowType shadow_type, GdkRectangle *area, GtkWidget *widget, const gchar *detail, gint x, gint y, gint width, gint height); - + void cl_draw_entry (GtkStyle *style, GdkWindow *window, GtkStateType state_type, GtkShadowType shadow_type, GdkRectangle *area, GtkWidget *widget, const gchar *detail, gint x, gint y, gint width, gint height); - + void cl_draw_combobox_entry (GtkStyle *style, GdkWindow *window, GtkStateType state_type, GtkShadowType shadow_type, GdkRectangle *area, GtkWidget *widget, const gchar *detail, gint x, gint y, gint width, gint height); - + void cl_draw_combobox_button (GtkStyle *style, GdkWindow *window, GtkStateType state_type, GtkShadowType shadow_type, GdkRectangle *area, GtkWidget *widget, const gchar *detail, gint x, gint y, gint width, gint height); - + void cl_draw_menuitem_button (GdkDrawable *window, GtkWidget *widget, GtkStyle *style, GdkRectangle *area, GtkStateType state_type, int x, int y, int wiidth, int height, CLRectangle *r); @@ -149,11 +149,11 @@ void cl_draw_menuitem_flat (GdkDrawable *window, GtkWidget *widget, GtkStyle *st void cl_draw_menuitem_gradient (GdkDrawable *window, GtkWidget *widget, GtkStyle *style, GdkRectangle *area, GtkStateType state_type, int x, int y, int wiidth, int height, CLRectangle *r); - + void cl_draw_treeview_header (GtkStyle *style, GdkWindow *window, GtkStateType state_type, GtkShadowType shadow_type, GdkRectangle *area, GtkWidget *widget, const gchar *detail, gint x, gint y, gint width, gint height); - + #endif /* CLEARLOOKS_DRAW_H */ diff --git a/libs/clearlooks-older/clearlooks_rc_style.c b/libs/clearlooks-older/clearlooks_rc_style.c index f3af2044fe..639edbabb7 100644 --- a/libs/clearlooks-older/clearlooks_rc_style.c +++ b/libs/clearlooks-older/clearlooks_rc_style.c @@ -251,20 +251,20 @@ theme_parse_listviewitemstyle(GtkSettings *settings, guint8 *listviewitemstyle) { guint token; - + token = g_scanner_get_next_token(scanner); - + token = g_scanner_get_next_token(scanner); if (token != G_TOKEN_EQUAL_SIGN) return G_TOKEN_EQUAL_SIGN; - + token = g_scanner_get_next_token(scanner); if (token != G_TOKEN_INT) return G_TOKEN_INT; - + *listviewitemstyle = scanner->value.v_int; - + return G_TOKEN_NONE; } @@ -272,7 +272,7 @@ static guint clearlooks_rc_style_parse (GtkRcStyle *rc_style, GtkSettings *settings, GScanner *scanner) - + { static GQuark scope_id = 0; ClearlooksRcStyle *clearlooks_style = CLEARLOOKS_RC_STYLE (rc_style); @@ -359,15 +359,15 @@ clearlooks_rc_style_merge (GtkRcStyle *dest, GtkRcStyle *src) { ClearlooksRcStyle *dest_w, *src_w; - + parent_class->merge (dest, src); - + if (!CLEARLOOKS_IS_RC_STYLE (src)) return; - + src_w = CLEARLOOKS_RC_STYLE (src); dest_w = CLEARLOOKS_RC_STYLE (dest); - + dest_w->contrast = src_w->contrast; dest_w->sunkenmenubar = src_w->sunkenmenubar; dest_w->progressbarstyle = src_w->progressbarstyle; diff --git a/libs/clearlooks-older/clearlooks_style.c b/libs/clearlooks-older/clearlooks_style.c index 29cc30dd9b..da4720ed56 100644 --- a/libs/clearlooks-older/clearlooks_style.c +++ b/libs/clearlooks-older/clearlooks_style.c @@ -43,7 +43,7 @@ static void cl_progressbar_remove (gpointer data) progressbars = g_list_remove (progressbars, data); g_object_unref (data); - + if (g_list_first(progressbars) == NULL) { g_source_remove(timer_id); timer_id = 0; @@ -58,11 +58,11 @@ static void update_progressbar (gpointer data, gpointer user_data) return; fraction = gtk_progress_bar_get_fraction (GTK_PROGRESS_BAR (data)); - + /* update only if not filled */ if (fraction < 1.0) gtk_widget_queue_resize ((GtkWidget*)data); - + if (fraction >= 1.0 || GTK_PROGRESS (data)->activity_mode) cl_progressbar_remove (data); } @@ -89,7 +89,7 @@ static void cl_progressbar_add (gpointer data) g_object_ref (data); g_signal_connect ((GObject*)data, "unrealize", G_CALLBACK (cl_progressbar_remove), data); - + if (timer_id == 0) timer_id = g_timeout_add (100, timer_func, NULL); } @@ -98,7 +98,7 @@ static GdkColor * clearlooks_get_spot_color (ClearlooksRcStyle *clearlooks_rc) { GtkRcStyle *rc = GTK_RC_STYLE (clearlooks_rc); - + if (clearlooks_rc->has_spot_color) return &clearlooks_rc->spot_color; else @@ -128,12 +128,12 @@ draw_tab (GtkStyle *style, GtkRequisition indicator_size; GtkBorder indicator_spacing; gint arrow_height; - + option_menu_get_props (widget, &indicator_size, &indicator_spacing); - + indicator_size.width += (indicator_size.width % 2) - 1; arrow_height = indicator_size.width / 2 + 2; - + x += (width - indicator_size.width) / 2; y += height/2; @@ -147,11 +147,11 @@ draw_tab (GtkStyle *style, GTK_ARROW_DOWN, 1+x, 1+y+1, indicator_size.width, arrow_height); } - + draw_arrow (window, style->fg_gc[state_type], area, GTK_ARROW_UP, x, y-arrow_height, indicator_size.width, arrow_height); - + draw_arrow (window, style->fg_gc[state_type], area, GTK_ARROW_DOWN, x, y+1, indicator_size.width, arrow_height); @@ -175,9 +175,9 @@ clearlooks_draw_arrow (GtkStyle *style, ClearlooksStyle *clearlooks_style = CLEARLOOKS_STYLE (style); gint original_width, original_x; GdkGC *gc; - + sanitize_size (window, &width, &height); - + if (is_combo_box (widget)) { width = 7; @@ -194,57 +194,57 @@ clearlooks_draw_arrow (GtkStyle *style, GTK_ARROW_DOWN, 1+x, 1+y+1, width, height); } - + draw_arrow (window, style->fg_gc[state], area, GTK_ARROW_UP, x, y-height, width, height); - + draw_arrow (window, style->fg_gc[state], area, GTK_ARROW_DOWN, x, y+1, width, height); - + return; } - + original_width = width; original_x = x; - + /* Make spinbutton arrows and arrows in menus * slightly larger to get the right pixels drawn */ if (DETAIL ("spinbutton")) height += 1; - + if (DETAIL("menuitem")) { width = 6; height = 7; } - + /* Compensate arrow position for "sunken" look */ if (DETAIL ("spinbutton") && arrow_type == GTK_ARROW_DOWN && style->xthickness > 2 && style->ythickness > 2) y -= 1; - + if (widget && widget->parent && GTK_IS_COMBO (widget->parent->parent)) { width -= 2; height -=2; x++; } - + calculate_arrow_geometry (arrow_type, &x, &y, &width, &height); - + if (DETAIL ("menuitem")) x = original_x + original_width - width; - + if (DETAIL ("spinbutton") && (arrow_type == GTK_ARROW_DOWN)) y += 1; - + if (state == GTK_STATE_INSENSITIVE) draw_arrow (window, style->light_gc[state], area, arrow_type, x + 1, y + 1, width, height); gc = style->fg_gc[state]; - + draw_arrow (window, gc, area, arrow_type, x, y, width, height); } @@ -259,7 +259,7 @@ draw_flat_box (DRAW_ARGS) sanitize_size (window, &width, &height); - if (detail && + if (detail && clearlooks_style->listviewitemstyle == 1 && state_type == GTK_STATE_SELECTED && ( !strncmp ("cell_even", detail, strlen ("cell_even")) || @@ -279,7 +279,7 @@ draw_flat_box (DRAW_ARGS) gc = style->base_gc[GTK_STATE_ACTIVE]; upper_color = &style->base[GTK_STATE_ACTIVE]; } - + if (GTK_IS_TREE_VIEW (widget) && 0) { GtkTreeSelection *sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (widget)); @@ -292,12 +292,12 @@ draw_flat_box (DRAW_ARGS) return; } } - + shade (upper_color, &lower_color, 0.8); if (area) gdk_gc_set_clip_rectangle (gc, area); - + draw_hgradient (window, gc, style, x, y, width, height, upper_color, &lower_color); @@ -319,7 +319,7 @@ draw_shadow (DRAW_ARGS) { ClearlooksStyle *clearlooks_style = CLEARLOOKS_STYLE (style); CLRectangle r; - + GdkGC *outer_gc = clearlooks_style->shade_gc[4]; GdkGC *gc1 = NULL; GdkGC *gc2 = NULL; @@ -358,12 +358,12 @@ draw_shadow (DRAW_ARGS) gdk_gc_set_clip_rectangle (clearlooks_style->shade_gc[3], area); gdk_gc_set_clip_rectangle (clearlooks_style->shade_gc[0], area); } - + gdk_draw_line (window, clearlooks_style->shade_gc[3], x, y, x + width, y); gdk_draw_line (window, clearlooks_style->shade_gc[0], x, y + 1, x + width, y + 1); - + if (area) { gdk_gc_set_clip_rectangle (clearlooks_style->shade_gc[3], NULL); @@ -411,7 +411,7 @@ draw_shadow (DRAW_ARGS) { GdkGC *a = clearlooks_style->shade_gc[(shadow_type == GTK_SHADOW_ETCHED_IN) ? 0 : 3]; GdkGC *b = clearlooks_style->shade_gc[(shadow_type == GTK_SHADOW_ETCHED_IN) ? 3 : 0]; - + cl_rectangle_set_corners (&r, CL_CORNER_NONE, CL_CORNER_NONE, CL_CORNER_NONE, CL_CORNER_NONE); @@ -419,17 +419,17 @@ draw_shadow (DRAW_ARGS) cl_rectangle_set_clip_rectangle (&r, area); cl_draw_rectangle (window, widget, style, x+1, y+1, width-1, height-1, &r); cl_rectangle_reset_clip_rectangle (&r); - + r.bordergc = b; cl_rectangle_set_clip_rectangle (&r, area); - cl_draw_rectangle (window, widget, style, x, y, width-1, height-1, &r); + cl_draw_rectangle (window, widget, style, x, y, width-1, height-1, &r); cl_rectangle_reset_clip_rectangle (&r); } else if (shadow_type == GTK_SHADOW_ETCHED_IN) { GdkGC *a = clearlooks_style->shade_gc[(shadow_type == GTK_SHADOW_ETCHED_IN) ? 3 : 0]; GdkGC *b = clearlooks_style->shade_gc[(shadow_type == GTK_SHADOW_ETCHED_IN) ? 0 : 3]; - + cl_rectangle_set_corners (&r, CL_CORNER_NONE, CL_CORNER_NONE, CL_CORNER_NONE, CL_CORNER_NONE); @@ -437,12 +437,12 @@ draw_shadow (DRAW_ARGS) cl_rectangle_set_clip_rectangle (&r, area); cl_draw_rectangle (window, widget, style, x+1, y+1, width-1, height-1, &r); cl_rectangle_reset_clip_rectangle (&r); - + r.bordergc = b; cl_rectangle_set_clip_rectangle (&r, area); - cl_draw_rectangle (window, widget, style, x, y, width-1, height-1, &r); + cl_draw_rectangle (window, widget, style, x, y, width-1, height-1, &r); cl_rectangle_reset_clip_rectangle (&r); - } + } else parent_class->draw_shadow (style, window, state_type, shadow_type, area, widget, detail, @@ -464,7 +464,7 @@ draw_box_gap (DRAW_ARGS, { ClearlooksStyle *clearlooks_style = CLEARLOOKS_STYLE (style); CLRectangle r; - + GdkRegion *area_region = NULL, *gap_region = NULL; GdkRectangle light_rect; @@ -473,10 +473,10 @@ draw_box_gap (DRAW_ARGS, #if DEBUG printf("draw_box_gap: %s %d %d %d %d\n", detail, x, y, width, height); #endif - + g_return_if_fail (GTK_IS_STYLE (style)); g_return_if_fail (window != NULL); - + sanitize_size (window, &width, &height); cl_rectangle_reset (&r, style); @@ -493,7 +493,7 @@ draw_box_gap (DRAW_ARGS, GdkRectangle tmp = { x, y, width, height }; area_region = gdk_region_rectangle (&tmp); } - + switch (gap_side) { case GTK_POS_TOP: @@ -503,7 +503,7 @@ draw_box_gap (DRAW_ARGS, GDK_RECTANGLE_SET (light_rect, x+gap_x+1, y, x+gap_x+1, y+1); GDK_RECTANGLE_SET (dark_rect, x+gap_x+gap_width-2, y, x+gap_x+gap_width-2, y); - + cl_rectangle_set_corners (&r, CL_CORNER_NONE, CL_CORNER_NONE, CL_CORNER_ROUND, CL_CORNER_ROUND); @@ -513,7 +513,7 @@ draw_box_gap (DRAW_ARGS, { GdkRectangle rect = { x+gap_x+1, y+height-2, gap_width-2, 2 }; gap_region = gdk_region_rectangle (&rect); - + GDK_RECTANGLE_SET (light_rect, x+gap_x+1, y+height-2, x+gap_x+1, y+height-1); GDK_RECTANGLE_SET (dark_rect, x+gap_x+gap_width-2, y+height-2, x+gap_x+gap_width-2, y+height-1); @@ -526,37 +526,37 @@ draw_box_gap (DRAW_ARGS, { GdkRectangle rect = { x, y+gap_x+1, 2, gap_width-2 }; gap_region = gdk_region_rectangle (&rect); - + GDK_RECTANGLE_SET (light_rect, x, y+gap_x+1, x+1, y+gap_x+1); GDK_RECTANGLE_SET (dark_rect, x, y+gap_x+gap_width-2, x, y+gap_x+gap_width-2); cl_rectangle_set_corners (&r, CL_CORNER_NONE, CL_CORNER_ROUND, CL_CORNER_NONE, CL_CORNER_ROUND); break; - } + } case GTK_POS_RIGHT: { GdkRectangle rect = { x+width-2, y+gap_x+1, 2, gap_width-2 }; gap_region = gdk_region_rectangle (&rect); - + GDK_RECTANGLE_SET (light_rect, x+width-2, y+gap_x+1, x+width-1, y+gap_x+1); GDK_RECTANGLE_SET (dark_rect, x+width-2, y+gap_x+gap_width-2, x+width-1, y+gap_x+gap_width-2); cl_rectangle_set_corners (&r, CL_CORNER_ROUND, CL_CORNER_NONE, CL_CORNER_ROUND, CL_CORNER_NONE); break; - } + } } - + gdk_region_subtract (area_region, gap_region); - + gdk_gc_set_clip_region (r.bordergc, area_region); gdk_gc_set_clip_region (r.topleft, area_region); gdk_gc_set_clip_region (r.bottomright, area_region); - + gdk_region_destroy (area_region); gdk_region_destroy (gap_region); - + gdk_draw_rectangle (window, style->bg_gc[state_type], TRUE, x, y, width, height); cl_draw_rectangle (window, widget, style, x, y, width, height, &r); @@ -566,12 +566,12 @@ draw_box_gap (DRAW_ARGS, gdk_gc_set_clip_region (r.bordergc, NULL); gdk_gc_set_clip_region (r.topleft, NULL); gdk_gc_set_clip_region (r.bottomright, NULL); - + /* it's a semi hack */ gdk_draw_line (window, style->light_gc[state_type], light_rect.x, light_rect.y, light_rect.width, light_rect.height); - + gdk_draw_line (window, clearlooks_style->shade_gc[1], dark_rect.x, dark_rect.y, dark_rect.width, dark_rect.height); @@ -592,9 +592,9 @@ draw_extension (DRAW_ARGS, GtkPositionType gap_side) g_return_if_fail (GTK_IS_STYLE (style)); g_return_if_fail (window != NULL); - + sanitize_size (window, &width, &height); - + if (DETAIL ("tab")) { GdkRectangle new_area; @@ -603,12 +603,12 @@ draw_extension (DRAW_ARGS, GtkPositionType gap_side) cl_rectangle_set_button (&r, style, state_type, FALSE, FALSE, CL_CORNER_ROUND, CL_CORNER_ROUND, CL_CORNER_ROUND, CL_CORNER_ROUND); - + if (state_type == GTK_STATE_ACTIVE) shade (&style->bg[state_type], &tmp_color, 1.08); else shade (&style->bg[state_type], &tmp_color, 1.05); - + if (area) { new_area = *area; @@ -620,7 +620,7 @@ draw_extension (DRAW_ARGS, GtkPositionType gap_side) new_area.width = width; new_area.height = height; } - + switch (gap_side) { case GTK_POS_BOTTOM: @@ -666,20 +666,20 @@ draw_extension (DRAW_ARGS, GtkPositionType gap_side) &clearlooks_style->border[CL_BORDER_LOWER+my_state_type]); break; } - - r.topleft = style->light_gc[state_type]; + + r.topleft = style->light_gc[state_type]; r.bottomright = (state_type == GTK_STATE_NORMAL) ? clearlooks_style->shade_gc[1] : NULL; cl_rectangle_set_clip_rectangle (&r, &new_area); cl_draw_rectangle (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); - + /* draw the selection stripe */ if (state_type != GTK_STATE_ACTIVE) { cl_rectangle_set_gradient (&r.fill_gradient, NULL, NULL); r.fillgc = clearlooks_style->spot2_gc; - + switch (gap_side) { case GTK_POS_BOTTOM: @@ -717,14 +717,14 @@ draw_extension (DRAW_ARGS, GtkPositionType gap_side) CL_CORNER_ROUND, CL_CORNER_NONE); cl_rectangle_set_gradient (&r.border_gradient, &clearlooks_style->spot3, &clearlooks_style->spot2); r.gradient_type = CL_GRADIENT_HORIZONTAL; - + cl_rectangle_set_clip_rectangle (&r, &new_area); cl_draw_rectangle (window, widget, style, x, y, 3, height, &r); cl_rectangle_reset_clip_rectangle (&r); break; } } - + } else @@ -752,16 +752,16 @@ draw_handle (DRAW_ARGS, GtkOrientation orientation) int i; int n_lines; int offset; - + #if DEBUG printf("draw_handle: %s %d %d %d %d\n", detail, x, y, width, height); #endif g_return_if_fail (GTK_IS_STYLE (style)); g_return_if_fail (window != NULL); - + sanitize_size (window, &width, &height); - + if (state_type == GTK_STATE_PRELIGHT) gtk_style_apply_default_background (style, window, widget && !GTK_WIDGET_NO_WINDOW (widget), @@ -786,10 +786,10 @@ draw_handle (DRAW_ARGS, GtkOrientation orientation) orientation == GTK_ORIENTATION_VERTICAL ) { /* The line in the toolbar */ - + light_gc = style->light_gc[state_type]; dark_gc = clearlooks_style->shade_gc[3]; - + if (area) { gdk_gc_set_clip_rectangle (light_gc, area); @@ -810,14 +810,14 @@ draw_handle (DRAW_ARGS, GtkOrientation orientation) gdk_draw_line (window, clearlooks_style->shade_gc[0], x, y, x + width, y); gdk_draw_line (window, clearlooks_style->shade_gc[3], x, y + height - 1, x + width, 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[3], NULL); } } - + light_gc = clearlooks_style->shade_gc[0]; dark_gc = clearlooks_style->shade_gc[4]; @@ -825,7 +825,7 @@ draw_handle (DRAW_ARGS, GtkOrientation orientation) rect.y = y + ythick; rect.width = width - (xthick * 2); rect.height = height - (ythick * 2); - + if (area) intersect = gdk_rectangle_intersect (area, &rect, &dest); else @@ -839,19 +839,19 @@ draw_handle (DRAW_ARGS, GtkOrientation orientation) gdk_gc_set_clip_rectangle (light_gc, &dest); gdk_gc_set_clip_rectangle (dark_gc, &dest); - + n_lines = (!strcmp (detail, "paned")) ? 21 : 11; if (orientation == GTK_ORIENTATION_VERTICAL) - { + { h = width - 2 * xthick; h = MAX (3, h - 6); - + xx = x + (width - h) / 2; offset = (height - 2*ythick - 2*n_lines)/2 + 1; if (offset < 0) offset = 0; - + for (i = 0, yy = y + ythick + offset; yy <= (y + height - ythick - 1) && i < n_lines; yy += 2, i++) { gdk_draw_line (window, dark_gc, xx, yy, xx + h, yy); @@ -862,12 +862,12 @@ draw_handle (DRAW_ARGS, GtkOrientation orientation) { h = height - 2 * ythick; h = MAX (3, h - 6); - + yy = y + (height - h) / 2; offset = (width - 2*xthick - 2*n_lines)/2 + 1; if (offset < 0) offset = 0; - + for (i = 0, xx = x + xthick + offset; i < n_lines; xx += 2, i++) { gdk_draw_line (window, dark_gc, xx, yy, xx, yy + h); @@ -891,13 +891,13 @@ draw_box (DRAW_ARGS) #ifdef DEBUG printf("draw_box: %s %d %d %d %d\n", detail, x, y, width, height); #endif - + g_return_if_fail (style != NULL); g_return_if_fail (window != NULL); if (width == -1 || height == -1) false_size = TRUE; - + if ((width == -1) && (height == -1)) gdk_window_get_size (window, &width, &height); else if (width == -1) @@ -909,7 +909,7 @@ draw_box (DRAW_ARGS) if (widget == NULL) return; - + /* listview headers */ if (widget && DETAIL ("button") && widget->parent && (GTK_IS_TREE_VIEW(widget->parent) || @@ -938,7 +938,7 @@ draw_box (DRAW_ARGS) !strcmp (detail, "spinbutton_up") || !strcmp (detail, "spinbutton_down") || !strcmp (detail, "spinbutton"))) - { + { cl_draw_spinbutton (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height); } @@ -955,7 +955,7 @@ draw_box (DRAW_ARGS) r.fill_gradient.to = &clearlooks_style->shade[2]; r.bottomright = clearlooks_style->shade_gc[2]; } - + cl_set_corner_sharpness (detail, widget, &r); if (!strcmp (detail, "spinbutton_up")) @@ -971,24 +971,24 @@ draw_box (DRAW_ARGS) gtk_style_apply_default_background (style, window, FALSE, state_type, area, x, y, width, height); } - - cl_rectangle_set_clip_rectangle (&r, area); + + cl_rectangle_set_clip_rectangle (&r, area); cl_draw_rectangle (window, widget, style, x+1, y+1, width-2, height-2, &r); cl_draw_shadow (window, widget, style, x+1, y+1, width-2, height-2, &r); - cl_rectangle_reset_clip_rectangle (&r); + cl_rectangle_reset_clip_rectangle (&r); } else if (DETAIL ("trough") && GTK_IS_PROGRESS_BAR (widget)) { GdkPoint points[4] = { {x,y}, {x+width-1,y}, {x,y+height-1}, {x+width-1,y+height-1} }; - + gdk_draw_points (window, style->bg_gc[state_type], points, 4); - + r.bordergc = clearlooks_style->shade_gc[5]; r.fillgc = clearlooks_style->shade_gc[2]; - + cl_rectangle_set_corners (&r, CL_CORNER_NARROW, CL_CORNER_NARROW, CL_CORNER_NARROW, CL_CORNER_NARROW); - + cl_rectangle_set_clip_rectangle (&r, area); cl_draw_rectangle (window, widget, style, x, y, width, height, &r); cl_rectangle_reset_clip_rectangle (&r); @@ -1001,11 +1001,11 @@ draw_box (DRAW_ARGS) *shadow = clearlooks_style->shade_gc[4]; GdkColor upper_color = *clearlooks_get_spot_color (CLEARLOOKS_RC_STYLE (style->rc_style)), lower_color; - + GtkAdjustment *adjustment = gtk_range_get_adjustment (GTK_RANGE (widget)); - + GtkOrientation orientation = GTK_RANGE (widget)->orientation; - + gint fill_size = (orientation ? height : width) * (1 / ((adjustment->upper - adjustment->lower) / (adjustment->value - adjustment->lower))); @@ -1020,60 +1020,60 @@ draw_box (DRAW_ARGS) x += (width - SCALE_SIZE) / 2; width = SCALE_SIZE; } - + if (state_type == GTK_STATE_INSENSITIVE) { outer = clearlooks_style->shade_gc[4]; inner = clearlooks_style->shade_gc[2]; shadow = clearlooks_style->shade_gc[3]; } - + cl_rectangle_init (&r, inner, outer, CL_CORNER_NONE, CL_CORNER_NONE, CL_CORNER_NONE, CL_CORNER_NONE ); - + r.topleft = shadow; - - cl_rectangle_set_clip_rectangle (&r, area); + + 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_rectangle_reset_clip_rectangle (&r); + cl_rectangle_reset_clip_rectangle (&r); /* DRAW FILL */ shade (&upper_color, &lower_color, 1.3); - + r.bordergc = clearlooks_style->spot3_gc; r.fillgc = style->bg_gc[state_type]; - + r.gradient_type = (orientation == GTK_ORIENTATION_HORIZONTAL ) ? CL_GRADIENT_VERTICAL : CL_GRADIENT_HORIZONTAL; - + cl_rectangle_set_gradient (&r.fill_gradient, &upper_color, &lower_color); - - cl_rectangle_set_clip_rectangle (&r, area); + + cl_rectangle_set_clip_rectangle (&r, area); if (orientation == GTK_ORIENTATION_HORIZONTAL && fill_size > 1) { if (gtk_range_get_inverted(GTK_RANGE(widget)) != (get_direction(widget) == GTK_TEXT_DIR_RTL)) cl_draw_rectangle (window, widget, style, x+width-fill_size, y, fill_size, height, &r); else - cl_draw_rectangle (window, widget, style, x, y, fill_size, height, &r); + cl_draw_rectangle (window, widget, style, x, y, fill_size, height, &r); } else if (fill_size > 1) { if (gtk_range_get_inverted (GTK_RANGE (widget))) cl_draw_rectangle (window, widget, style, x, y+height-fill_size, width, fill_size, &r); else - cl_draw_rectangle (window, widget, style, x, y, width, fill_size, &r); + cl_draw_rectangle (window, widget, style, x, y, width, fill_size, &r); } - cl_rectangle_reset_clip_rectangle (&r); + cl_rectangle_reset_clip_rectangle (&r); } else if (DETAIL ("trough")) { GdkGC *inner = clearlooks_style->shade_gc[3], - *outer = clearlooks_style->shade_gc[5]; - + *outer = clearlooks_style->shade_gc[5]; + cl_rectangle_init (&r, inner, outer, CL_CORNER_NONE, CL_CORNER_NONE, CL_CORNER_NONE, CL_CORNER_NONE ); - + if (GTK_RANGE (widget)->orientation == GTK_ORIENTATION_VERTICAL) { y+=1; @@ -1084,7 +1084,7 @@ draw_box (DRAW_ARGS) x+=1; width-=2; } - + cl_rectangle_set_clip_rectangle (&r, area); cl_draw_rectangle (window, widget, style, x, y, width, height, &r); cl_rectangle_reset_clip_rectangle (&r); @@ -1114,18 +1114,18 @@ draw_box (DRAW_ARGS) } cl_rectangle_set_button (&r, style, state_type, FALSE, FALSE, 0,0,0,0); - + cl_rectangle_set_gradient (&r.fill_gradient, NULL, NULL); cl_rectangle_set_gradient (&r.fill_gradient, &clearlooks_style->inset_light[state_type], &clearlooks_style->inset_dark[state_type]); - - + + r.gradient_type = horizontal ? CL_GRADIENT_VERTICAL : CL_GRADIENT_HORIZONTAL; - + r.bottomright = clearlooks_style->shade_gc[1]; r.border_gradient.to = r.border_gradient.from; - + if (button_type == CL_SCROLLBUTTON_OTHER) { cl_rectangle_set_corners (&r, CL_CORNER_NONE, CL_CORNER_NONE, @@ -1149,11 +1149,11 @@ draw_box (DRAW_ARGS) cl_rectangle_set_corners (&r, CL_CORNER_NONE, CL_CORNER_NONE, CL_CORNER_ROUND, CL_CORNER_ROUND); } - - cl_rectangle_set_clip_rectangle (&r, area); + + 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_rectangle_reset_clip_rectangle (&r); + cl_rectangle_reset_clip_rectangle (&r); } else if (DETAIL ("slider")) @@ -1161,7 +1161,7 @@ draw_box (DRAW_ARGS) if (DETAIL("slider") && widget && GTK_IS_RANGE (widget)) { GtkAdjustment *adj = GTK_RANGE (widget)->adjustment; - + if (adj->value <= adj->lower && (GTK_RANGE (widget)->has_stepper_a || GTK_RANGE (widget)->has_stepper_b)) { @@ -1185,11 +1185,11 @@ draw_box (DRAW_ARGS) width+=1; } } - + cl_rectangle_set_button (&r, style, state_type, FALSE, GTK_WIDGET_HAS_FOCUS (widget), CL_CORNER_NONE, CL_CORNER_NONE, CL_CORNER_NONE, CL_CORNER_NONE); - + r.gradient_type = GTK_IS_HSCROLLBAR (widget) ? CL_GRADIENT_VERTICAL : CL_GRADIENT_HORIZONTAL; @@ -1198,11 +1198,11 @@ draw_box (DRAW_ARGS) r.bottomright = clearlooks_style->shade_gc[1]; r.border_gradient.to = r.border_gradient.from; - - cl_rectangle_set_clip_rectangle (&r, area); + + 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_rectangle_reset_clip_rectangle (&r); + cl_rectangle_reset_clip_rectangle (&r); } else if (detail && !strcmp (detail, "optionmenu")) /* supporting deprecated */ { @@ -1213,7 +1213,7 @@ draw_box (DRAW_ARGS) if (clearlooks_style->menuitemstyle == 0) { cl_draw_menuitem_flat (window, widget, style, area, state_type, - x, y, width, height, &r); + x, y, width, height, &r); } else if (clearlooks_style->menuitemstyle == 1) { @@ -1230,52 +1230,52 @@ draw_box (DRAW_ARGS) { GdkGC *dark = clearlooks_style->shade_gc[2]; GdkColor upper_color, lower_color; - + /* don't draw sunken menubar on gnome panel IT'S A HACK! HORRIBLE HACK! HIDEOUS HACK! BUT IT WORKS FOR ME(tm)! */ if (widget->parent && strcmp(G_OBJECT_TYPE_NAME (widget->parent), "PanelWidget") == 0) return; - + shade(&style->bg[state_type], &upper_color, 1.0); shade(&style->bg[state_type], &lower_color, 0.95); - + cl_rectangle_set_corners (&r, CL_CORNER_NONE, CL_CORNER_NONE, CL_CORNER_NONE, CL_CORNER_NONE); - + r.fillgc = style->bg_gc[state_type]; r.bordergc = clearlooks_style->shade_gc[2]; r.gradient_type = CL_GRADIENT_VERTICAL; - + cl_rectangle_set_gradient (&r.border_gradient, &clearlooks_style->shade[2], &clearlooks_style->shade[3]); cl_rectangle_set_gradient (&r.fill_gradient, &upper_color, &lower_color); - + /* make vertical and top borders invisible for style 2 */ if (clearlooks_style->menubarstyle == 2) { x--; width+=2; y--; height+=1; } - + cl_rectangle_set_clip_rectangle (&r, area); cl_draw_rectangle (window, widget, style, x, y, width, height, &r); cl_rectangle_reset_clip_rectangle (&r); } else if (DETAIL ("menu") && widget->parent && GDK_IS_WINDOW (widget->parent->window)) - { + { cl_rectangle_set_corners (&r, CL_CORNER_NONE, CL_CORNER_NONE, CL_CORNER_NONE, CL_CORNER_NONE); - + r.bordergc = clearlooks_style->border_gc[CL_BORDER_UPPER]; r.topleft = style->light_gc[state_type]; r.bottomright = clearlooks_style->shade_gc[1]; - + 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_rectangle_reset_clip_rectangle (&r); + cl_rectangle_reset_clip_rectangle (&r); return; } @@ -1285,29 +1285,29 @@ draw_box (DRAW_ARGS) lower_color, prev_foreground; gboolean activity_mode = GTK_PROGRESS (widget)->activity_mode; - + #ifdef HAVE_ANIMATION if (!activity_mode && gtk_progress_bar_get_fraction (widget) != 1.0 && !cl_progressbar_known((gconstpointer)widget)) { cl_progressbar_add ((gpointer)widget); } -#endif +#endif cl_progressbar_fill (window, widget, style, style->black_gc, x, y, width, height, #ifdef HAVE_ANIMATION activity_mode ? 0 : pboffset, #else - 0, + 0, #endif area); - + cl_rectangle_set_corners (&r, CL_CORNER_NONE, CL_CORNER_NONE, CL_CORNER_NONE, CL_CORNER_NONE); - + r.bordergc = clearlooks_style->spot3_gc; r.topleft = clearlooks_style->spot2_gc; - + prev_foreground = cl_gc_set_fg_color_shade (clearlooks_style->spot2_gc, style->colormap, &clearlooks_style->spot2, @@ -1317,7 +1317,7 @@ draw_box (DRAW_ARGS) cl_draw_rectangle (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); - + gdk_gc_set_foreground (clearlooks_style->spot2_gc, &prev_foreground); } @@ -1328,21 +1328,21 @@ draw_box (DRAW_ARGS) gdk_gc_set_clip_rectangle (clearlooks_style->shade_gc[0], area); gdk_gc_set_clip_rectangle (clearlooks_style->shade_gc[3], area); } - + gtk_style_apply_default_background (style, window, widget && !GTK_WIDGET_NO_WINDOW (widget), state_type, area, x, y, width, height); - + /* we only want the borders on horizontal toolbars */ if ( DETAIL ("menubar") || height < 2*width ) { if (!DETAIL ("menubar")) gdk_draw_line (window, clearlooks_style->shade_gc[0], x, y, x + width, y); /* top */ - + gdk_draw_line (window, clearlooks_style->shade_gc[3], x, y + height - 1, x + width, y + height - 1); /* bottom */ } - + if (area) { gdk_gc_set_clip_rectangle (clearlooks_style->shade_gc[0], NULL); @@ -1368,10 +1368,10 @@ ensure_check_pixmaps (GtkStyle *style, ClearlooksRcStyle *clearlooks_rc = CLEARLOOKS_RC_STYLE (style->rc_style); GdkPixbuf *check, *base, *inconsistent, *composite; GdkColor *spot_color = clearlooks_get_spot_color (clearlooks_rc); - + if (clearlooks_style->check_pixmap_nonactive[state] != NULL) return; - + if (state == GTK_STATE_ACTIVE || state == GTK_STATE_SELECTED) { check = generate_bit (check_alpha, &style->text[GTK_STATE_NORMAL], 1.0); inconsistent = generate_bit (check_inconsistent_alpha, &style->text[GTK_STATE_NORMAL], 1.0); @@ -1379,24 +1379,24 @@ ensure_check_pixmaps (GtkStyle *style, check = generate_bit (check_alpha, &style->text[state], 1.0); inconsistent = generate_bit (check_inconsistent_alpha, &style->text[state], 1.0); } - + if (state == GTK_STATE_ACTIVE && !treeview) base = generate_bit (check_base_alpha, &style->bg[state], 1.0); else base = generate_bit (check_base_alpha, &style->base[GTK_STATE_NORMAL], 1.0); - + if (treeview) composite = generate_bit (NULL, &clearlooks_style->shade[6], 1.0); else composite = generate_bit (NULL, &clearlooks_style->shade[5], 1.0); - + gdk_pixbuf_composite (base, composite, 0, 0, RADIO_SIZE, RADIO_SIZE, 0, 0, 1.0, 1.0, GDK_INTERP_NEAREST, 255); clearlooks_style->check_pixmap_nonactive[state] = pixbuf_to_pixmap (style, composite, screen); - + gdk_pixbuf_composite (check, composite, 0, 0, RADIO_SIZE, RADIO_SIZE, 0, 0, 1.0, 1.0, GDK_INTERP_NEAREST, 255); @@ -1457,7 +1457,7 @@ draw_check (DRAW_ARGS) y += (height - CHECK_SIZE)/2; gdk_draw_drawable (window, gc, pixmap, 0, 0, x, y, CHECK_SIZE, CHECK_SIZE); - + if (area) gdk_gc_set_clip_rectangle (gc, NULL); } @@ -1486,7 +1486,7 @@ draw_slider (DRAW_ARGS, GtkOrientation orientation) if ((orientation == GTK_ORIENTATION_VERTICAL && height < 20) || (orientation == GTK_ORIENTATION_HORIZONTAL && width < 20)) return; - + if (detail && strcmp ("slider", detail) == 0) { if (area) @@ -1571,10 +1571,10 @@ ensure_radio_pixmaps (GtkStyle *style, GdkPixbuf *dot, *circle, *outline, *inconsistent, *composite; GdkColor *spot_color = clearlooks_get_spot_color (clearlooks_rc); GdkColor *composite_color; - + if (clearlooks_style->radio_pixmap_nonactive[state] != NULL) return; - + if (state == GTK_STATE_ACTIVE || state == GTK_STATE_SELECTED) { dot = colorize_bit (dot_intensity, dot_alpha, &style->text[GTK_STATE_NORMAL]); inconsistent = generate_bit (inconsistent_alpha, &style->text[GTK_STATE_NORMAL], 1.0); @@ -1582,9 +1582,9 @@ ensure_radio_pixmaps (GtkStyle *style, dot = colorize_bit (dot_intensity, dot_alpha, &style->text[state]); inconsistent = generate_bit (inconsistent_alpha, &style->text[state], 1.0); } - + outline = generate_bit (outline_alpha, &clearlooks_style->shade[5], 1.0); - + if (clearlooks_style->radio_pixmap_mask == NULL) { gdk_pixbuf_render_pixmap_and_mask (outline, @@ -1592,7 +1592,7 @@ ensure_radio_pixmaps (GtkStyle *style, &clearlooks_style->radio_pixmap_mask, 1); } - + if (state == GTK_STATE_ACTIVE) { composite_color = &style->bg[GTK_STATE_PRELIGHT]; @@ -1603,31 +1603,31 @@ ensure_radio_pixmaps (GtkStyle *style, composite_color = &style->bg[state]; circle = generate_bit (circle_alpha, &style->base[GTK_STATE_NORMAL], 1.0); } - + composite = generate_bit (NULL, composite_color, 1.0); - + gdk_pixbuf_composite (outline, composite, 0, 0, RADIO_SIZE, RADIO_SIZE, 0, 0, 1.0, 1.0, GDK_INTERP_NEAREST, 255); - + gdk_pixbuf_composite (circle, composite, 0, 0, RADIO_SIZE, RADIO_SIZE, 0, 0, 1.0, 1.0, GDK_INTERP_NEAREST, 255); - + clearlooks_style->radio_pixmap_nonactive[state] = pixbuf_to_pixmap (style, composite, screen); - + gdk_pixbuf_composite (dot, composite, 0, 0, RADIO_SIZE, RADIO_SIZE, 0, 0, 1.0, 1.0, GDK_INTERP_NEAREST, 255); - + clearlooks_style->radio_pixmap_active[state] = pixbuf_to_pixmap (style, composite, screen); - + g_object_unref (composite); - + composite = generate_bit (NULL, composite_color,1.0); - + gdk_pixbuf_composite (outline, composite, 0, 0, RADIO_SIZE, RADIO_SIZE, 0, 0, 1.0, 1.0, GDK_INTERP_NEAREST, 255); @@ -1637,10 +1637,10 @@ ensure_radio_pixmaps (GtkStyle *style, gdk_pixbuf_composite (inconsistent, composite, 0, 0, RADIO_SIZE, RADIO_SIZE, 0, 0, 1.0, 1.0, GDK_INTERP_NEAREST, 255); - + clearlooks_style->radio_pixmap_inconsistent[state] = pixbuf_to_pixmap (style, composite, screen); - + g_object_unref (composite); g_object_unref (circle); g_object_unref (dot); @@ -1654,42 +1654,42 @@ draw_option (DRAW_ARGS) ClearlooksStyle *clearlooks_style = CLEARLOOKS_STYLE (style); GdkGC *gc = style->base_gc[state_type]; GdkPixmap *pixmap; - + if (DETAIL ("option")) /* Menu item */ { parent_class->draw_option (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height); return; } - + ensure_radio_pixmaps (style, state_type, gtk_widget_get_screen (widget)); - + if (area) gdk_gc_set_clip_rectangle (gc, area); - + if (shadow_type == GTK_SHADOW_IN) pixmap = clearlooks_style->radio_pixmap_active[state_type]; else if (shadow_type == GTK_SHADOW_ETCHED_IN) /* inconsistent */ pixmap = clearlooks_style->radio_pixmap_inconsistent[state_type]; else pixmap = clearlooks_style->radio_pixmap_nonactive[state_type]; - + x += (width - RADIO_SIZE)/2; y += (height - RADIO_SIZE)/2; - + #ifndef GTKOSX gdk_gc_set_clip_mask (gc, clearlooks_style->radio_pixmap_mask); gdk_gc_set_clip_origin (gc, x, y); #endif - + gdk_draw_drawable (window, gc, pixmap, 0, 0, x, y, RADIO_SIZE, RADIO_SIZE); - + #ifndef GTKOSX gdk_gc_set_clip_origin (gc, 0, 0); gdk_gc_set_clip_mask (gc, NULL); #endif - + if (area) gdk_gc_set_clip_rectangle (gc, NULL); } @@ -1714,17 +1714,17 @@ draw_shadow_gap (DRAW_ARGS, g_return_if_fail (GTK_IS_STYLE (style)); g_return_if_fail (window != NULL); - + sanitize_size (window, &width, &height); cl_rectangle_reset (&r, style); cl_rectangle_set_corners (&r, CL_CORNER_NONE, CL_CORNER_NONE, CL_CORNER_NONE, CL_CORNER_NONE); - + if (area) { area_region = gdk_region_rectangle (area); - + switch (gap_side) { case GTK_POS_TOP: @@ -1744,18 +1744,18 @@ draw_shadow_gap (DRAW_ARGS, GdkRectangle rect = { x, y+gap_x, 2, gap_width }; gap_region = gdk_region_rectangle (&rect); break; - } + } case GTK_POS_RIGHT: { GdkRectangle rect = { x+width-2, y+gap_x, 2, gap_width }; gap_region = gdk_region_rectangle (&rect); break; - } + } } - + gdk_region_subtract (area_region, gap_region); } - + if (shadow_type == GTK_SHADOW_ETCHED_IN || shadow_type == GTK_SHADOW_ETCHED_OUT) { @@ -1772,9 +1772,9 @@ draw_shadow_gap (DRAW_ARGS, a = clearlooks_style->shade_gc[3]; b = style->light_gc[state_type]; } - - gdk_gc_set_clip_region (a, area_region); - gdk_gc_set_clip_region (b, area_region); + + gdk_gc_set_clip_region (a, area_region); + gdk_gc_set_clip_region (b, area_region); r.bordergc = a; cl_draw_rectangle (window, widget, style, x+1, y+1, width-1, height-1, &r); @@ -1782,21 +1782,21 @@ draw_shadow_gap (DRAW_ARGS, r.bordergc = b; cl_draw_rectangle (window, widget, style, x, y, width-1, height-1, &r); - gdk_gc_set_clip_region (a, NULL); - gdk_gc_set_clip_region (b, NULL); + gdk_gc_set_clip_region (a, NULL); + gdk_gc_set_clip_region (b, NULL); } else if (shadow_type == GTK_SHADOW_IN || shadow_type == GTK_SHADOW_OUT) { r.topleft = (shadow_type == GTK_SHADOW_OUT) ? style->light_gc[state_type] : clearlooks_style->shade_gc[1]; r.bottomright = (shadow_type == GTK_SHADOW_OUT) ? clearlooks_style->shade_gc[1] : style->light_gc[state_type]; r.bordergc = clearlooks_style->shade_gc[5]; - - gdk_gc_set_clip_region (r.bordergc, area_region); - gdk_gc_set_clip_region (r.topleft, area_region); - gdk_gc_set_clip_region (r.bottomright, area_region); - + + gdk_gc_set_clip_region (r.bordergc, area_region); + gdk_gc_set_clip_region (r.topleft, area_region); + gdk_gc_set_clip_region (r.bottomright, area_region); + cl_draw_rectangle (window, widget, style, x, y, width, height, &r); - + cl_draw_shadow (window, widget, style, x, y, width, height, &r); gdk_gc_set_clip_region (r.bordergc, NULL); @@ -1828,25 +1828,25 @@ draw_hline (GtkStyle *style, g_return_if_fail (GTK_IS_STYLE (style)); g_return_if_fail (window != NULL); - + if (area) gdk_gc_set_clip_rectangle (clearlooks_style->shade_gc[2], area); - + if (detail && !strcmp (detail, "label")) { if (state_type == GTK_STATE_INSENSITIVE) gdk_draw_line (window, style->light_gc[state_type], x1 + 1, y + 1, x2 + 1, y + 1); - + gdk_draw_line (window, style->fg_gc[state_type], x1, y, x2, y); } else { gdk_draw_line (window, clearlooks_style->shade_gc[2], x1, y, x2, y); - + /* if (DETAIL ("menuitem")) */ gdk_draw_line (window, clearlooks_style->shade_gc[0], x1, y+1, x2, y+1); } - + if (area) gdk_gc_set_clip_rectangle (clearlooks_style->shade_gc[2], NULL); } @@ -1873,16 +1873,16 @@ draw_vline (GtkStyle *style, g_return_if_fail (GTK_IS_STYLE (style)); g_return_if_fail (window != NULL); - + thickness_light = style->xthickness / 2; thickness_dark = style->xthickness - thickness_light; - + if (area) gdk_gc_set_clip_rectangle (clearlooks_style->shade_gc[2], area); - + gdk_draw_line (window, clearlooks_style->shade_gc[2], x, y1, x, y2 - 1); gdk_draw_line (window, clearlooks_style->shade_gc[0], x+1, y1, x+1, y2 - 1); - + if (area) gdk_gc_set_clip_rectangle (clearlooks_style->shade_gc[2], NULL); } @@ -1911,38 +1911,38 @@ draw_focus (GtkStyle *style, #if DEBUG printf("draw_focus: %s %d %d %d %d\n", detail, x, y, width, height); #endif - + gc = clearlooks_style->shade_gc[6]; - + if (widget) { gtk_widget_style_get (widget, "focus-line-width", &line_width, "focus-line-pattern", (gchar *)&dash_list, NULL); - + free_dash_list = TRUE; } - + sanitize_size (window, &width, &height); - + if (area) gdk_gc_set_clip_rectangle (gc, area); - + gdk_gc_set_line_attributes (gc, line_width, dash_list[0] ? GDK_LINE_ON_OFF_DASH : GDK_LINE_SOLID, GDK_CAP_BUTT, GDK_JOIN_MITER); - - + + if (detail && !strcmp (detail, "add-mode")) { if (free_dash_list) g_free (dash_list); - + dash_list = "\4\4"; free_dash_list = FALSE; } - + points[0].x = x + line_width / 2; points[0].y = y + line_width / 2; points[1].x = x + width - line_width + line_width / 2; @@ -1952,7 +1952,7 @@ draw_focus (GtkStyle *style, points[3].x = x + line_width / 2; points[3].y = y + height - line_width + line_width / 2; points[4] = points[0]; - + if (!dash_list[0]) { gdk_draw_lines (window, gc, points, 5); @@ -1960,41 +1960,41 @@ draw_focus (GtkStyle *style, else { dash_len = strlen (dash_list); - + if (dash_list[0]) gdk_gc_set_dashes (gc, 0, dash_list, dash_len); - + gdk_draw_lines (window, gc, points, 3); - + points[2].x += 1; - + if (dash_list[0]) { gint dash_pixels = 0; gint i; - + /* Adjust the dash offset for the bottom and left so we * match up at the upper left. */ for (i = 0; i < dash_len; i++) dash_pixels += dash_list[i]; - + if (dash_len % 2 == 1) dash_pixels *= 2; - + gdk_gc_set_dashes (gc, dash_pixels - (width + height - 2 * line_width) % dash_pixels, dash_list, dash_len); } - + gdk_draw_lines (window, gc, points + 2, 3); } - + gdk_gc_set_line_attributes (gc, 0, GDK_LINE_SOLID, GDK_CAP_BUTT, GDK_JOIN_MITER); - + if (area) gdk_gc_set_clip_rectangle (gc, NULL); - + if (free_dash_list) g_free (dash_list); } @@ -2009,14 +2009,14 @@ draw_layout(GtkStyle * style, const gchar * detail, gint x, gint y, PangoLayout * layout) { ClearlooksStyle *clearlooks_style = CLEARLOOKS_STYLE (style); - + g_return_if_fail(GTK_IS_STYLE (style)); g_return_if_fail(window != NULL); parent_class->draw_layout(style, window, state_type, use_text, area, widget, detail, x, y, layout); - + } /**************************************************************************/ @@ -2205,7 +2205,7 @@ draw_resize_grip (GtkStyle *style, xi -= 3; yi -= 3; - + } } break; @@ -2260,7 +2260,7 @@ draw_resize_grip (GtkStyle *style, xi -= 3; yi += 3; - + } } break; @@ -2316,26 +2316,26 @@ clearlooks_style_init_from_rc (GtkStyle * style, double shades[] = {1.065, 0.93, 0.896, 0.85, 0.768, 0.665, 0.4, 0.205}; int i; double contrast; - + parent_class->init_from_rc (style, rc_style); - + contrast = CLEARLOOKS_RC_STYLE (rc_style)->contrast; - + clearlooks_style->sunkenmenubar = CLEARLOOKS_RC_STYLE (rc_style)->sunkenmenubar; clearlooks_style->progressbarstyle = CLEARLOOKS_RC_STYLE (rc_style)->progressbarstyle; clearlooks_style->menubarstyle = CLEARLOOKS_RC_STYLE (rc_style)->menubarstyle; clearlooks_style->menuitemstyle = CLEARLOOKS_RC_STYLE (rc_style)->menuitemstyle; clearlooks_style->listviewitemstyle = CLEARLOOKS_RC_STYLE (rc_style)->listviewitemstyle; - + /* Lighter to darker */ for (i = 0; i < 8; i++) { shade (&style->bg[GTK_STATE_NORMAL], &clearlooks_style->shade[i], (shades[i]-0.7) * contrast + 0.7); } - + spot_color = clearlooks_get_spot_color (CLEARLOOKS_RC_STYLE (rc_style)); - + clearlooks_style->spot_color = *spot_color; shade (&clearlooks_style->spot_color, &clearlooks_style->spot1, 1.42); shade (&clearlooks_style->spot_color, &clearlooks_style->spot2, 1.05); @@ -2352,11 +2352,11 @@ realize_color (GtkStyle * style, GdkColor * color) { GdkGCValues gc_values; - + gdk_colormap_alloc_color (style->colormap, color, FALSE, TRUE); - + gc_values.foreground = *color; - + return gtk_gc_get (style->depth, style->colormap, &gc_values, GDK_GC_FOREGROUND); } @@ -2365,15 +2365,15 @@ clearlooks_style_realize (GtkStyle * style) { ClearlooksStyle *clearlooks_style = CLEARLOOKS_STYLE (style); int i; - + parent_class->realize (style); - + for (i = 0; i < 8; i++) clearlooks_style->shade_gc[i] = realize_color (style, &clearlooks_style->shade[i]); for (i=0; i < CL_BORDER_COUNT; i++) clearlooks_style->border_gc[i] = realize_color (style, &clearlooks_style->border[i]); - + clearlooks_style->spot1_gc = realize_color (style, &clearlooks_style->spot1); clearlooks_style->spot2_gc = realize_color (style, &clearlooks_style->spot2); clearlooks_style->spot3_gc = realize_color (style, &clearlooks_style->spot3); @@ -2390,10 +2390,10 @@ clearlooks_style_realize (GtkStyle * style) shade (&style->bg[i], &clearlooks_style->listview_bg[i], 1.015); gdk_rgb_find_color (style->colormap, &clearlooks_style->listview_bg[i]); - /* CREATE GRADIENT FOR BUTTONS */ + /* CREATE GRADIENT FOR BUTTONS */ shade (&style->bg[i], &clearlooks_style->button_g1[i], 1.055); gdk_rgb_find_color (style->colormap, &clearlooks_style->button_g1[i]); - + shade (&style->bg[i], &clearlooks_style->button_g2[i], 1.005); gdk_rgb_find_color (style->colormap, &clearlooks_style->button_g2[i]); @@ -2411,7 +2411,7 @@ clearlooks_style_unrealize (GtkStyle * style) { ClearlooksStyle *clearlooks_style = CLEARLOOKS_STYLE (style); int i; - + /* We don't free the colors, because we don't know if * gtk_gc_release() actually freed the GC. FIXME - need * a way of ref'ing colors explicitely so GtkGC can @@ -2419,11 +2419,11 @@ clearlooks_style_unrealize (GtkStyle * style) */ for (i=0; i < 8; i++) gtk_gc_release (clearlooks_style->shade_gc[i]); - + gtk_gc_release (clearlooks_style->spot1_gc); gtk_gc_release (clearlooks_style->spot2_gc); gtk_gc_release (clearlooks_style->spot3_gc); - + for (i = 0; i < 5; i++) { if (clearlooks_style->radio_pixmap_nonactive[i] != NULL) @@ -2435,7 +2435,7 @@ clearlooks_style_unrealize (GtkStyle * style) g_object_unref (clearlooks_style->radio_pixmap_inconsistent[i]); clearlooks_style->radio_pixmap_inconsistent[i] = NULL; } - + if (clearlooks_style->check_pixmap_nonactive[i] != NULL) { g_object_unref (clearlooks_style->check_pixmap_nonactive[i]); @@ -2446,21 +2446,21 @@ clearlooks_style_unrealize (GtkStyle * style) clearlooks_style->check_pixmap_inconsistent[i] = NULL; } } - + if (clearlooks_style->radio_pixmap_mask != NULL) g_object_unref (clearlooks_style->radio_pixmap_mask); - + clearlooks_style->radio_pixmap_mask = NULL; while (progressbars = g_list_first (progressbars)) cl_progressbar_remove (progressbars->data); - + if (timer_id != 0) { g_source_remove(timer_id); - timer_id = 0; + timer_id = 0; } - + parent_class->unrealize (style); } @@ -2529,16 +2529,16 @@ render_icon (GtkStyle *style, GdkPixbuf *base_pixbuf; GdkScreen *screen; GtkSettings *settings; - + /* Oddly, style can be NULL in this function, because * GtkIconSet can be used without a style and if so * it uses this function. */ - + base_pixbuf = gtk_icon_source_get_pixbuf (source); - + g_return_val_if_fail (base_pixbuf != NULL, NULL); - + if (widget && gtk_widget_has_screen (widget)) { screen = gtk_widget_get_screen (widget); settings = gtk_settings_get_for_screen (screen); @@ -2550,7 +2550,7 @@ render_icon (GtkStyle *style, GTK_NOTE (MULTIHEAD, g_warning ("Using the default screen for gtk_default_render_icon()")); } - + if (size != (GtkIconSize) -1 && !gtk_icon_size_lookup_for_settings (settings, size, &width, &height)) { g_warning (G_STRLOC ": invalid icon size '%d'", size); @@ -2564,7 +2564,7 @@ render_icon (GtkStyle *style, scaled = scale_or_ref (base_pixbuf, width, height); else scaled = g_object_ref (base_pixbuf); - + /* If the state was wildcarded, then generate a state. */ if (gtk_icon_source_get_state_wildcarded (source)) { if (state == GTK_STATE_INSENSITIVE) { @@ -2581,14 +2581,14 @@ render_icon (GtkStyle *style, #endif gdk_pixbuf_saturate_and_pixelate (stated, stated, 0.1, FALSE); - + g_object_unref (scaled); } else if (state == GTK_STATE_PRELIGHT) { stated = gdk_pixbuf_copy (scaled); - + gdk_pixbuf_saturate_and_pixelate (scaled, stated, 1.2, FALSE); - + g_object_unref (scaled); } else { stated = scaled; @@ -2609,7 +2609,7 @@ static void clearlooks_style_class_init (ClearlooksStyleClass * klass) { GtkStyleClass *style_class = GTK_STYLE_CLASS (klass); - + parent_class = g_type_class_peek_parent (klass); style_class->realize = clearlooks_style_realize; @@ -2630,7 +2630,7 @@ clearlooks_style_class_init (ClearlooksStyleClass * klass) style_class->draw_box_gap = draw_box_gap; style_class->draw_extension = draw_extension; style_class->draw_option = draw_option; - style_class->draw_layout = draw_layout; + style_class->draw_layout = draw_layout; style_class->render_icon = render_icon; style_class->draw_flat_box = draw_flat_box; } diff --git a/libs/clearlooks-older/clearlooks_style.h b/libs/clearlooks-older/clearlooks_style.h index 1e07877bf7..d56876d533 100644 --- a/libs/clearlooks-older/clearlooks_style.h +++ b/libs/clearlooks-older/clearlooks_style.h @@ -55,43 +55,43 @@ typedef enum struct _ClearlooksStyle { GtkStyle parent_instance; - + GdkColor shade[9]; - + GdkColor spot_color; GdkColor spot1; GdkColor spot2; GdkColor spot3; - + GdkColor border[CL_BORDER_COUNT]; - + /* from light to dark */ GdkGC *shade_gc[9]; GdkGC *border_gc[CL_BORDER_COUNT]; - + GdkGC *spot1_gc; GdkGC *spot2_gc; GdkGC *spot3_gc; - + GdkColor inset_light[5]; GdkColor inset_dark[5]; - + GdkColor button_g1[5]; GdkColor button_g2[5]; GdkColor button_g3[5]; GdkColor button_g4[5]; - + GdkColor listview_bg[5]; GdkPixmap *radio_pixmap_nonactive[5]; GdkPixmap *radio_pixmap_active[5]; GdkPixmap *radio_pixmap_inconsistent[5]; GdkBitmap *radio_pixmap_mask; /* All masks are the same */ - + GdkPixmap *check_pixmap_nonactive[5]; GdkPixmap *check_pixmap_active[5]; GdkPixmap *check_pixmap_inconsistent[5]; - + gboolean sunkenmenubar:1; guint8 progressbarstyle; diff --git a/libs/clearlooks-older/support.c b/libs/clearlooks-older/support.c index 0d288123f2..d34a41b637 100644 --- a/libs/clearlooks-older/support.c +++ b/libs/clearlooks-older/support.c @@ -6,12 +6,12 @@ GtkTextDirection get_direction (GtkWidget *widget) { GtkTextDirection dir; - + if (widget) dir = gtk_widget_get_direction (widget); else dir = GTK_TEXT_DIR_LTR; - + return dir; } @@ -23,22 +23,22 @@ generate_bit (unsigned char alpha[], GdkColor *color, double mult) unsigned char *pixels; int w, h, rs; int x, y; - + r = (color->red >> 8) * mult; r = MIN(r, 255); g = (color->green >> 8) * mult; g = MIN(g, 255); b = (color->blue >> 8) * mult; b = MIN(b, 255); - + pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, 8, RADIO_SIZE, RADIO_SIZE); - + w = gdk_pixbuf_get_width (pixbuf); h = gdk_pixbuf_get_height (pixbuf); rs = gdk_pixbuf_get_rowstride (pixbuf); pixels = gdk_pixbuf_get_pixels (pixbuf); - - + + for (y=0; y < h; y++) { for (x=0; x < w; x++) @@ -52,7 +52,7 @@ generate_bit (unsigned char alpha[], GdkColor *color, double mult) pixels[y*rs + x*4 + 3] = 255; } } - + return pixbuf; } @@ -71,29 +71,29 @@ colorize_bit (unsigned char *bit, int dest_rowstride; int width, height; guchar *dest_pixels; - + pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, 8, RADIO_SIZE, RADIO_SIZE); - + if (pixbuf == NULL) return NULL; - + dest_rowstride = gdk_pixbuf_get_rowstride (pixbuf); width = gdk_pixbuf_get_width (pixbuf); height = gdk_pixbuf_get_height (pixbuf); dest_pixels = gdk_pixbuf_get_pixels (pixbuf); - + for (y = 0; y < RADIO_SIZE; y++) { src = bit + y * RADIO_SIZE; asrc = alpha + y * RADIO_SIZE; dest = dest_pixels + y * dest_rowstride; - + for (x = 0; x < RADIO_SIZE; x++) { double dr, dg, db; - + intensity = (src[x] + 0 )/ 255.0; - + if (intensity <= 0.5) { /* Go from black at intensity = 0.0 to new_color at intensity = 0.5 */ @@ -108,16 +108,16 @@ colorize_bit (unsigned char *bit, dg = (new_color->green + (65535 - new_color->green) * (intensity - 0.5) * 2.0) / 65535.0; db = (new_color->blue + (65535 - new_color->blue) * (intensity - 0.5) * 2.0) / 65535.0; } - + dest[0] = CLAMP_UCHAR (255 * dr); dest[1] = CLAMP_UCHAR (255 * dg); dest[2] = CLAMP_UCHAR (255 * db); - + dest[3] = asrc[x]; dest += 4; } } - + return pixbuf; } @@ -128,23 +128,23 @@ pixbuf_to_pixmap (GtkStyle *style, { GdkGC *tmp_gc; GdkPixmap *pixmap; - + pixmap = gdk_pixmap_new (gdk_screen_get_root_window (screen), gdk_pixbuf_get_width (pixbuf), gdk_pixbuf_get_height (pixbuf), style->depth); - + gdk_drawable_set_colormap (pixmap, style->colormap); - + tmp_gc = gdk_gc_new (pixmap); - + gdk_pixbuf_render_to_drawable (pixbuf, pixmap, tmp_gc, 0, 0, 0, 0, gdk_pixbuf_get_width (pixbuf), gdk_pixbuf_get_height (pixbuf), GDK_RGB_DITHER_NORMAL, 0, 0); - + gdk_gc_unref (tmp_gc); - + return pixmap; } @@ -161,7 +161,7 @@ rgb_to_hls (gdouble *r, gdouble blue; gdouble h, l, s; gdouble delta; - + red = *r; green = *g; blue = *b; @@ -172,7 +172,7 @@ rgb_to_hls (gdouble *r, max = red; else max = blue; - + if (green < blue) min = green; else @@ -184,7 +184,7 @@ rgb_to_hls (gdouble *r, max = green; else max = blue; - + if (red < blue) min = red; else @@ -201,7 +201,7 @@ rgb_to_hls (gdouble *r, s = (max - min) / (max + min); else s = (max - min) / (2 - max - min); - + delta = max -min; if (red == max) h = (green - blue) / delta; @@ -209,7 +209,7 @@ rgb_to_hls (gdouble *r, h = 2 + (blue - red) / delta; else if (blue == max) h = 4 + (red - green) / delta; - + h *= 60; if (h < 0.0) h += 360; @@ -230,7 +230,7 @@ hls_to_rgb (gdouble *h, gdouble saturation; gdouble m1, m2; gdouble r, g, b; - + lightness = *l; saturation = *s; @@ -238,7 +238,7 @@ hls_to_rgb (gdouble *h, m2 = lightness * (1 + saturation); else m2 = lightness + saturation - lightness * saturation; - + m1 = 2 * lightness - m2; if (saturation == 0) @@ -254,7 +254,7 @@ hls_to_rgb (gdouble *h, hue -= 360; while (hue < 0) hue += 360; - + if (hue < 60) r = m1 + (m2 - m1) * hue / 60; else if (hue < 180) @@ -263,13 +263,13 @@ hls_to_rgb (gdouble *h, r = m1 + (m2 - m1) * (240 - hue) / 60; else r = m1; - + hue = *h; while (hue > 360) hue -= 360; while (hue < 0) hue += 360; - + if (hue < 60) g = m1 + (m2 - m1) * hue / 60; else if (hue < 180) @@ -278,13 +278,13 @@ hls_to_rgb (gdouble *h, g = m1 + (m2 - m1) * (240 - hue) / 60; else g = m1; - + hue = *h - 120; while (hue > 360) hue -= 360; while (hue < 0) hue += 360; - + if (hue < 60) b = m1 + (m2 - m1) * hue / 60; else if (hue < 180) @@ -293,7 +293,7 @@ hls_to_rgb (gdouble *h, b = m1 + (m2 - m1) * (240 - hue) / 60; else b = m1; - + *h = r; *l = g; *s = b; @@ -306,27 +306,27 @@ shade (GdkColor * a, GdkColor * b, float k) gdouble red; gdouble green; gdouble blue; - + red = (gdouble) a->red / 65535.0; green = (gdouble) a->green / 65535.0; blue = (gdouble) a->blue / 65535.0; - + rgb_to_hls (&red, &green, &blue); - + green *= k; if (green > 1.0) green = 1.0; else if (green < 0.0) green = 0.0; - + blue *= k; if (blue > 1.0) blue = 1.0; else if (blue < 0.0) blue = 0.0; - + hls_to_rgb (&red, &green, &blue); - + b->red = red * 65535.0; b->green = green * 65535.0; b->blue = blue * 65535.0; @@ -452,13 +452,13 @@ calculate_arrow_geometry (GtkArrowType arrow_type, case GTK_ARROW_DOWN: w += (w % 2) - 1; h = (w / 2 + 1) + 1; - + if (h > *height) { h = *height; w = 2 * (h - 1) - 1; } - + if (arrow_type == GTK_ARROW_DOWN) { if (*height % 2 == 1 || h % 2 == 0) @@ -470,18 +470,18 @@ calculate_arrow_geometry (GtkArrowType arrow_type, *height -= 1; } break; - + case GTK_ARROW_RIGHT: case GTK_ARROW_LEFT: h += (h % 2) - 1; w = (h / 2 + 1) + 1; - + if (w > *width) { w = *width; h = 2 * (w - 1) - 1; } - + if (arrow_type == GTK_ARROW_RIGHT) { if (*width % 2 == 1 || w % 2 == 0) @@ -493,7 +493,7 @@ calculate_arrow_geometry (GtkArrowType arrow_type, *width -= 1; } break; - + default: /* should not be reached */ break; @@ -532,7 +532,7 @@ void gtk_clist_get_header_index (GtkCList *clist, GtkWidget *button, { *columns = clist->columns; int i; - + for (i=0; i<*columns; i++) { if (clist->column[i].button == button) @@ -549,7 +549,7 @@ sanitize_size (GdkWindow *window, gint *height) { gboolean set_bg = FALSE; - + if ((*width == -1) && (*height == -1)) { set_bg = GDK_IS_WINDOW (window); @@ -559,7 +559,7 @@ sanitize_size (GdkWindow *window, gdk_window_get_size (window, width, NULL); else if (*height == -1) gdk_window_get_size (window, NULL, height); - + return set_bg; } @@ -573,11 +573,11 @@ option_menu_get_props (GtkWidget *widget, { GtkRequisition *tmp_size = NULL; GtkBorder *tmp_spacing = NULL; - + if (widget) gtk_widget_style_get (widget, "indicator_size", &tmp_size, "indicator_spacing", &tmp_spacing, NULL); - + if (tmp_size) { *indicator_size = *tmp_size; @@ -585,7 +585,7 @@ option_menu_get_props (GtkWidget *widget, } else *indicator_size = default_option_indicator_size; - + if (tmp_spacing) { *indicator_spacing = *tmp_spacing; @@ -651,7 +651,7 @@ internal_color_get_as_uchars(GdkColor *color, *red = (guchar) (color->red / 256.0); *green = (guchar) (color->green / 256.0); *blue = (guchar) (color->blue / 256.0); -} +} static GdkPixbuf* internal_create_horizontal_gradient_image_buffer (gint width, gint height, @@ -716,7 +716,7 @@ internal_create_vertical_gradient_image_buffer (gint width, gint height, gint i, j, max_block, last_block; long r, g, b, dr, dg, db; GdkPixbuf *buffer; - + guchar *ptr; guchar point[4]; @@ -754,7 +754,7 @@ internal_create_vertical_gradient_image_buffer (gint width, gint height, ptr[0] = r>>16; ptr[1] = g>>16; ptr[2] = b>>16; - + if (width > 1) { last_block = 0; @@ -779,7 +779,7 @@ internal_create_vertical_gradient_image_buffer (gint width, gint height, g += dg; b += db; } - + return buffer; } @@ -806,15 +806,15 @@ draw_vgradient (GdkDrawable *drawable, GdkGC *gc, GtkStyle *style, #endif { GdkPixbuf *image_buffer = NULL; - + image_buffer = internal_create_horizontal_gradient_image_buffer (width, height, left_color, right_color); - + if (image_buffer) { gdk_draw_pixbuf(drawable, gc, image_buffer, 0, 0, x, y, width, height, GDK_RGB_DITHER_MAX, 0, 0); g_object_unref(image_buffer); - } + } } #ifndef ALWAYS_DITHER_GRADIENTS else @@ -825,7 +825,7 @@ draw_vgradient (GdkDrawable *drawable, GdkGC *gc, GtkStyle *style, GdkGCValues old_values; gdk_gc_get_values (gc, &old_values); - + if (left_color == right_color ) { col = *left_color; @@ -835,7 +835,7 @@ draw_vgradient (GdkDrawable *drawable, GdkGC *gc, GtkStyle *style, gdk_gc_set_foreground (gc, &old_values.foreground); return; } - + col = *left_color; dr = (right_color->red - left_color->red) / width; dg = (right_color->green - left_color->green) / width; @@ -844,10 +844,10 @@ draw_vgradient (GdkDrawable *drawable, GdkGC *gc, GtkStyle *style, for (i = 0; i < width; i++) { gdk_rgb_find_color (style->colormap, &col); - + gdk_gc_set_foreground (gc, &col); gdk_draw_line (drawable, gc, x + i, y, x + i, y + height - 1); - + col.red += dr; col.green += dg; col.blue += db; @@ -862,11 +862,11 @@ void draw_hgradient (GdkDrawable *drawable, GdkGC *gc, GtkStyle *style, int x, int y, int width, int height, GdkColor *top_color, GdkColor *bottom_color) -{ +{ #ifndef ALWAYS_DITHER_GRADIENTS gboolean dither = ((style->depth > 0) && (style->depth <= 16)); #endif - + if ((width <= 0) || (height <= 0)) return; @@ -875,15 +875,15 @@ draw_hgradient (GdkDrawable *drawable, GdkGC *gc, GtkStyle *style, #endif { GdkPixbuf *image_buffer = NULL; - + image_buffer = internal_create_vertical_gradient_image_buffer (width, height, top_color, bottom_color); - + if (image_buffer) { gdk_draw_pixbuf(drawable, gc, image_buffer, 0, 0, x, y, width, height, GDK_RGB_DITHER_MAX, 0, 0); g_object_unref(image_buffer); - } + } } #ifndef ALWAYS_DITHER_GRADIENTS else @@ -892,7 +892,7 @@ draw_hgradient (GdkDrawable *drawable, GdkGC *gc, GtkStyle *style, GdkColor col; int dr, dg, db; GdkGCValues old_values; - + gdk_gc_get_values (gc, &old_values); if (top_color == bottom_color ) @@ -909,14 +909,14 @@ draw_hgradient (GdkDrawable *drawable, GdkGC *gc, GtkStyle *style, dr = (bottom_color->red - top_color->red) / height; dg = (bottom_color->green - top_color->green) / height; db = (bottom_color->blue - top_color->blue) / height; - + for (i = 0; i < height; i++) { gdk_rgb_find_color (style->colormap, &col); - + gdk_gc_set_foreground (gc, &col); gdk_draw_line (drawable, gc, x, y + i, x + width - 1, y + i); - + col.red += dr; col.green += dg; col.blue += db; @@ -934,7 +934,7 @@ void blend (GdkColormap *colormap, c->red = (a->red * alpha + b->red * inAlpha) / 100; c->green = (a->green * alpha + b->green * inAlpha) / 100; c->blue = (a->blue * alpha + b->blue * inAlpha) / 100; - + gdk_rgb_find_color (colormap, c); } @@ -962,7 +962,7 @@ GtkWidget * find_combo_box_widget (GtkWidget * widget) { GtkWidget *result = NULL; - + if (widget && !GTK_IS_COMBO_BOX_ENTRY (widget)) { if (GTK_IS_COMBO_BOX (widget)) @@ -970,7 +970,7 @@ find_combo_box_widget (GtkWidget * widget) else result = find_combo_box_widget(widget->parent); } - + return result; } diff --git a/libs/clearlooks-older/support.h b/libs/clearlooks-older/support.h index ea2417f3cb..646115ede9 100644 --- a/libs/clearlooks-older/support.h +++ b/libs/clearlooks-older/support.h @@ -91,13 +91,13 @@ calculate_arrow_geometry (GtkArrowType arrow_type, gint *y, gint *width, gint *height); - + GtkWidget *special_get_ancestor(GtkWidget * widget, GType widget_type); - + void blend (GdkColormap *colormap, GdkColor *a, GdkColor *b, GdkColor *c, int alpha); - + GtkWidget *get_parent_window (GtkWidget *widget); GdkColor *get_parent_bgcolor (GtkWidget *widget); -- cgit v1.2.3