--- cleanice-draw.orig.c 2008-02-15 10:16:46.000000000 +0100 +++ cleanice-draw.c 2008-02-15 10:17:57.000000000 +0100 @@ -569,7 +569,6 @@ GdkRectangle *area, GtkStateType state_type, GtkArrowType arrow_type, - GtkShadowType shadow_type, gboolean fill, gint x, gint y, @@ -591,29 +590,6 @@ gdk_draw_line (window, gc, x + (width - 1) / 2, y + height - 1, x + width - 1, y); } - switch (shadow_type) { - case GTK_SHADOW_IN: - case GTK_SHADOW_ETCHED_IN: - gdk_draw_line (window, widget->style->dark_gc[state_type], - x, y, x + width - 1, y); - gdk_draw_line (window, widget->style->mid_gc[state_type], - x, y, x + (width - 1) / 2, y + height - 1); - gdk_draw_line (window, widget->style->light_gc[state_type], - x + (width - 1) / 2, y + height - 1, x + width - 1, y); - break; - case GTK_SHADOW_OUT: - case GTK_SHADOW_ETCHED_OUT: - gdk_draw_line (window, widget->style->light_gc[state_type], - x, y, x + width - 1, y); - gdk_draw_line (window, widget->style->mid_gc[state_type], - x, y, x + (width - 1) / 2, y + height - 1); - gdk_draw_line (window, widget->style->dark_gc[state_type], - x + (width - 1) / 2, y + height - 1, x + width - 1, y); - break; - - case GTK_SHADOW_NONE: - break; - } break; case GTK_ARROW_UP: if (fill) { @@ -627,29 +603,6 @@ gdk_draw_line (window, gc, x + (width - 1) / 2, y, x + width - 1, y + height - 1); } - switch (shadow_type) { - case GTK_SHADOW_IN: - case GTK_SHADOW_ETCHED_IN: - gdk_draw_line (window, widget->style->light_gc[state_type], - x, y + height - 1, x + width - 1, y + height - 1); - gdk_draw_line (window, widget->style->dark_gc[state_type], - x + (width - 1) / 2, y, x, y + height - 1); - gdk_draw_line (window, widget->style->mid_gc[state_type], - x + (width - 1) / 2, y, x + width - 1, y + height - 1); - break; - case GTK_SHADOW_OUT: - case GTK_SHADOW_ETCHED_OUT: - gdk_draw_line (window, widget->style->dark_gc[state_type], - x, y + height - 1, x + width - 1, y + height - 1); - gdk_draw_line (window, widget->style->light_gc[state_type], - x + (width - 1) / 2, y, x, y + height - 1); - gdk_draw_line (window, widget->style->mid_gc[state_type], - x + (width - 1) / 2, y, x + width - 1, y + height - 1); - break; - - case GTK_SHADOW_NONE: - break; - } break; case GTK_ARROW_LEFT: if (fill) { @@ -664,30 +617,6 @@ x + width - 1, y + height - 1); } break; - switch (shadow_type) { - case GTK_SHADOW_IN: - case GTK_SHADOW_ETCHED_IN: - gdk_draw_line (window, widget->style->light_gc[state_type], - x + width - 1, y, x + width - 1, y + height - 1); - gdk_draw_line (window, widget->style->dark_gc[state_type], - x, y + (height - 1) / 2, x + width - 1, y); - gdk_draw_line (window, widget->style->mid_gc[state_type], - x, y + (height - 1) / 2, x + width - 1, y + height - 1); - break; - case GTK_SHADOW_OUT: - case GTK_SHADOW_ETCHED_OUT: - gdk_draw_line (window, widget->style->dark_gc[state_type], - x + width - 1, y, x + width - 1, y + height - 1); - gdk_draw_line (window, widget->style->light_gc[state_type], - x, y + (height - 1) / 2, x + width - 1, y); - gdk_draw_line (window, widget->style->mid_gc[state_type], - x, y + (height - 1) / 2, x + width - 1, y + height - 1); - break; - - case GTK_SHADOW_NONE: - break; - } - break; case GTK_ARROW_RIGHT: if (fill) { for (i = 0, j = 0; i < width; i++, j++) @@ -698,29 +627,6 @@ gdk_draw_line (window, gc, x, y + height - 1, x + width - 1, y + (height - 1) / 2); } - switch (shadow_type) { - case GTK_SHADOW_IN: - case GTK_SHADOW_ETCHED_IN: - gdk_draw_line (window, widget->style->dark_gc[state_type], - x, y, x, y + height - 1); - gdk_draw_line (window, widget->style->mid_gc[state_type], - x, y, x + width - 1, y + (height - 1) / 2); - gdk_draw_line (window, widget->style->light_gc[state_type], - x, y + height - 1, x + width - 1, y + (height - 1) / 2); - break; - case GTK_SHADOW_OUT: - case GTK_SHADOW_ETCHED_OUT: - gdk_draw_line (window, widget->style->light_gc[state_type], - x, y, x, y + height - 1); - gdk_draw_line (window, widget->style->mid_gc[state_type], - x, y, x + width - 1, y + (height - 1) / 2); - gdk_draw_line (window, widget->style->dark_gc[state_type], - x, y + height - 1, x + width - 1, y + (height - 1) / 2); - break; - - case GTK_SHADOW_NONE: - break; - } break; } @@ -751,19 +657,6 @@ calculate_arrow_geometry (arrow_type, &ax, &ay, &aw, &ah); - /* - GTK+ sucks at drawing arrows, or telling itself what to draw in - some cases, and so we must do this stupid lame hack, so that the - arrows in CleanIce draw correctly - */ - if (DETAIL ("vscrollbar") || DETAIL ("hscrollbar") || - DETAIL ("spinbutton") || DETAIL ("notebook") || - DETAIL ("calendar") || DETAIL ("menuitem") || - DETAIL ("tearoffmenuitem") || DETAIL ("header") || - DETAIL ("menu_scroll_arrow_up") || DETAIL ("menu_scroll_arrow_down") || - widget->parent->parent && GTK_IS_COMBO (widget->parent->parent)) - shadow_type = GTK_SHADOW_NONE; - if (DETAIL ("vscrollbar")) { ax -= (width % 2); aw += 2; @@ -792,24 +685,24 @@ switch (arrow_type) { case GTK_ARROW_UP: case GTK_ARROW_DOWN: - if (aw < 5) aw = 5; - if (ah < 3) ah = 3; + if (aw < 7) aw = 7; + if (ah < 4) ah = 4; break; case GTK_ARROW_RIGHT: case GTK_ARROW_LEFT: - if (aw < 3) aw = 3; - if (ah < 5) ah = 5; + if (aw < 4) aw = 4; + if (ah < 7) ah = 7; break; } if (DETAIL ("expander") && state_type == GTK_STATE_PRELIGHT) { draw_black_arrow (window, widget, style->bg_gc[state_type], area, - state_type, arrow_type, shadow_type, + state_type, arrow_type, fill, ax, ay, aw, ah); } else if (DETAIL ("treeview") && state_type == GTK_STATE_SELECTED && !GTK_WIDGET_HAS_FOCUS (widget)) { draw_black_arrow (window, widget, style->text_gc[GTK_STATE_ACTIVE], area, - state_type, arrow_type, shadow_type, + state_type, arrow_type, fill, ax, ay, aw, ah); } else { if ((widget->parent->parent && @@ -819,14 +712,14 @@ GTK_IS_COMBO_BOX (widget->parent->parent->parent) && !GTK_IS_COMBO_BOX_ENTRY (widget->parent->parent->parent))) { draw_black_arrow (window, widget->parent, style->fg_gc[state_type], area, - state_type, GTK_ARROW_UP, shadow_type, + state_type, GTK_ARROW_UP, fill, ax, ay - ah / 2 - 1, aw, ah); draw_black_arrow (window, widget->parent, style->fg_gc[state_type], area, - state_type, GTK_ARROW_DOWN, shadow_type, + state_type, GTK_ARROW_DOWN, fill, ax, ay + ah / 2 + 1, aw, ah); } else { draw_black_arrow (window, widget, style->fg_gc[state_type], area, - state_type, arrow_type, shadow_type, + state_type, arrow_type, fill, ax, ay, aw, ah); } } @@ -1355,20 +1248,122 @@ GtkWidget * widget, const gchar * detail, GdkWindowEdge edge, gint x, gint y, gint width, gint height) { - GdkPoint points2[3]; /* light */ - - if (GTK_IS_STATUSBAR (widget)) - gtk_statusbar_set_has_resize_grip (GTK_STATUSBAR (widget), FALSE); - return; - - points2[0].x = x + width; points2[0].y = y - 1; - points2[1].x = x + width; points2[1].y = y + height; - points2[2].x = x + (width - height) - 1; points2[2].y = y + height; - - gtk_paint_box(style, window, state_type, GTK_SHADOW_OUT, area, widget, - detail, x + (width - height) - 2, y - 2, - height + 6, height + 6); - gdk_draw_polygon(window, style->dark_gc[state_type], TRUE, points2, 3); + int xi, yi; + int max_x, max_y; + int threshold; + + g_return_if_fail(style != NULL); + g_return_if_fail(window != NULL); + + sanitize_size (GDK_DRAWABLE (window), &width, &height); + + switch (edge) { + case GDK_WINDOW_EDGE_NORTH_WEST: + /* make it square */ + if (width < height) { + height = width; + } + else if (height < width) { + width = height; + } + break; + case GDK_WINDOW_EDGE_NORTH: + if (width < height) { + height = width; + } + break; + case GDK_WINDOW_EDGE_NORTH_EAST: + /* make it square, aligning to top right */ + if (width < height) { + height = width; + } else if (height < width) { + x += (width - height); + width = height; + } + break; + case GDK_WINDOW_EDGE_WEST: + if (height < width) { + width = height; + } + break; + case GDK_WINDOW_EDGE_EAST: + /* aligning to right */ + if (height < width) { + x += (width - height); + width = height; + } + break; + case GDK_WINDOW_EDGE_SOUTH_WEST: + /* make it square, aligning to bottom left */ + if (width < height) { + y += (height - width); + height = width; + } else if (height < width) { + width = height; + } + break; + case GDK_WINDOW_EDGE_SOUTH: + /* align to bottom */ + if (width < height) { + y += (height - width); + height = width; + } + break; + case GDK_WINDOW_EDGE_SOUTH_EAST: + /* make it square, aligning to bottom right */ + if (width < height) { + y += (height - width); + height = width; + } else if (height < width) { + x += (width - height); + width = height; + } + break; + default: + g_assert_not_reached (); + } + + max_x = (width - 2) / 4; + max_y = (height - 2) / 4; + + threshold = max_x; + + for (xi = 0; xi <= max_x; xi++) { + for (yi = 0; yi <= max_y; yi++) { + gboolean draw_dot; + + switch (edge) { + case GDK_WINDOW_EDGE_NORTH: + case GDK_WINDOW_EDGE_WEST: + case GDK_WINDOW_EDGE_EAST: + case GDK_WINDOW_EDGE_SOUTH: + draw_dot = TRUE; + break; + case GDK_WINDOW_EDGE_NORTH_WEST: + draw_dot = (xi + yi <= threshold); + break; + case GDK_WINDOW_EDGE_NORTH_EAST: + draw_dot = (xi >= yi); + break; + case GDK_WINDOW_EDGE_SOUTH_WEST: + draw_dot = (xi <= yi); + break; + case GDK_WINDOW_EDGE_SOUTH_EAST: + draw_dot = (xi + yi >= threshold); + break; + default: + g_assert_not_reached (); + } + + if (draw_dot) { + cleanice_dot(window, + style->dark_gc[state_type], + style->light_gc[state_type], + x + (xi * 4) + 1, + y + (yi * 4) + 1); + } + } + } } static void draw_layout (GtkStyle * style, GdkWindow * window,