From ac83360abb1945b9a45de62867a8af3560dc7070 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Tue, 9 Nov 2004 14:49:01 +0000 Subject: [PATCH] Only clear the triangle below the grip to the background, not the full 2004-11-09 Matthias Clasen * gtk/gtkstyle.c (gtk_default_draw_resize_grip): Only clear the triangle below the grip to the background, not the full area. --- ChangeLog | 4 ++++ ChangeLog.pre-2-10 | 4 ++++ ChangeLog.pre-2-6 | 4 ++++ ChangeLog.pre-2-8 | 4 ++++ gtk/gtkstyle.c | 50 ++++++++++++++++++++++++++-------------------- 5 files changed, 44 insertions(+), 22 deletions(-) diff --git a/ChangeLog b/ChangeLog index 59907ad3a2..05552b823b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2004-11-09 Matthias Clasen + * gtk/gtkstyle.c (gtk_default_draw_resize_grip): Only + clear the triangle below the grip to the background, + not the full area. + * gtk/gtklabel.c (draw_insertion_cursor, gtk_label_expose): Clip when drawing the cursor. This prevents bits of a selectable label leaking out from underneath the resize diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 59907ad3a2..05552b823b 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,5 +1,9 @@ 2004-11-09 Matthias Clasen + * gtk/gtkstyle.c (gtk_default_draw_resize_grip): Only + clear the triangle below the grip to the background, + not the full area. + * gtk/gtklabel.c (draw_insertion_cursor, gtk_label_expose): Clip when drawing the cursor. This prevents bits of a selectable label leaking out from underneath the resize diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 59907ad3a2..05552b823b 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,5 +1,9 @@ 2004-11-09 Matthias Clasen + * gtk/gtkstyle.c (gtk_default_draw_resize_grip): Only + clear the triangle below the grip to the background, + not the full area. + * gtk/gtklabel.c (draw_insertion_cursor, gtk_label_expose): Clip when drawing the cursor. This prevents bits of a selectable label leaking out from underneath the resize diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 59907ad3a2..05552b823b 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,5 +1,9 @@ 2004-11-09 Matthias Clasen + * gtk/gtkstyle.c (gtk_default_draw_resize_grip): Only + clear the triangle below the grip to the background, + not the full area. + * gtk/gtklabel.c (draw_insertion_cursor, gtk_label_expose): Clip when drawing the cursor. This prevents bits of a selectable label leaking out from underneath the resize diff --git a/gtk/gtkstyle.c b/gtk/gtkstyle.c index 4a6964090c..225174c057 100644 --- a/gtk/gtkstyle.c +++ b/gtk/gtkstyle.c @@ -5312,6 +5312,9 @@ gtk_default_draw_resize_grip (GtkStyle *style, gint width, gint height) { + GdkPoint points[4]; + gint i, j, skip; + g_return_if_fail (GTK_IS_STYLE (style)); g_return_if_fail (window != NULL); @@ -5322,42 +5325,35 @@ gtk_default_draw_resize_grip (GtkStyle *style, gdk_gc_set_clip_rectangle (style->bg_gc[state_type], area); } + skip = -1; switch (edge) { case GDK_WINDOW_EDGE_NORTH_WEST: /* make it square */ if (width < height) - { - height = width; - } + height = width; else if (height < width) - { - width = height; - } + width = height; + skip = 2; break; case GDK_WINDOW_EDGE_NORTH: if (width < height) - { - height = width; - } + height = width; break; case GDK_WINDOW_EDGE_NORTH_EAST: /* make it square, aligning to top right */ if (width < height) - { - height = width; - } + height = width; else if (height < width) { x += (width - height); width = height; } + skip = 3; break; case GDK_WINDOW_EDGE_WEST: if (height < width) - { - width = height; - } + width = height; break; case GDK_WINDOW_EDGE_EAST: /* aligning to right */ @@ -5375,9 +5371,8 @@ gtk_default_draw_resize_grip (GtkStyle *style, height = width; } else if (height < width) - { - width = height; - } + width = height; + skip = 1; break; case GDK_WINDOW_EDGE_SOUTH: /* align to bottom */ @@ -5399,15 +5394,26 @@ gtk_default_draw_resize_grip (GtkStyle *style, x += (width - height); width = height; } + skip = 0; break; default: g_assert_not_reached (); } /* Clear background */ - gtk_style_apply_default_background (style, window, FALSE, - state_type, area, - x, y, width, height); - + j = 0; + for (i = 0; i < 4; i++) + { + if (skip != i) + { + points[j].x = (i == 0 || i == 3) ? x : x + width; + points[j].y = (i < 2) ? y : y + height; + j++; + } + } + + gdk_draw_polygon (window, style->bg_gc[state_type], TRUE, + points, skip < 0 ? 4 : 3); + switch (edge) { case GDK_WINDOW_EDGE_WEST: