From d9b0da5b836b44fe5129e5afc4966137f8826524 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Mon, 22 Nov 2010 22:37:19 -0500 Subject: [PATCH] Fix resize grip drawing There was some confusion about junctions... --- gtk/gtkstyle.c | 8 ++++---- gtk/gtkthemingengine.c | 26 +++++++++++++------------- gtk/gtkwindow.c | 6 +++--- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/gtk/gtkstyle.c b/gtk/gtkstyle.c index 63769a5e19..1d07ddf520 100644 --- a/gtk/gtkstyle.c +++ b/gtk/gtkstyle.c @@ -3367,13 +3367,13 @@ gtk_default_draw_resize_grip (GtkStyle *style, switch (edge) { case GDK_WINDOW_EDGE_NORTH_WEST: - sides = GTK_JUNCTION_TOP | GTK_JUNCTION_LEFT; + sides = GTK_JUNCTION_CORNER_TOPLEFT; break; case GDK_WINDOW_EDGE_NORTH: sides = GTK_JUNCTION_TOP; break; case GDK_WINDOW_EDGE_NORTH_EAST: - sides = GTK_JUNCTION_TOP | GTK_JUNCTION_RIGHT; + sides = GTK_JUNCTION_CORNER_TOPRIGHT; break; case GDK_WINDOW_EDGE_WEST: sides = GTK_JUNCTION_LEFT; @@ -3382,13 +3382,13 @@ gtk_default_draw_resize_grip (GtkStyle *style, sides = GTK_JUNCTION_RIGHT; break; case GDK_WINDOW_EDGE_SOUTH_WEST: - sides = GTK_JUNCTION_BOTTOM | GTK_JUNCTION_LEFT; + sides = GTK_JUNCTION_CORNER_BOTTOMLEFT; break; case GDK_WINDOW_EDGE_SOUTH: sides = GTK_JUNCTION_BOTTOM; break; case GDK_WINDOW_EDGE_SOUTH_EAST: - sides = GTK_JUNCTION_BOTTOM | GTK_JUNCTION_RIGHT; + sides = GTK_JUNCTION_CORNER_BOTTOMRIGHT; break; } diff --git a/gtk/gtkthemingengine.c b/gtk/gtkthemingengine.c index f7961bc1a4..d1f955050a 100644 --- a/gtk/gtkthemingengine.c +++ b/gtk/gtkthemingengine.c @@ -2302,14 +2302,14 @@ gtk_theming_engine_render_handle (GtkThemingEngine *engine, sides = gtk_theming_engine_get_junction_sides (engine); /* reduce confusing values to a meaningful state */ - if ((sides & (GTK_JUNCTION_LEFT | GTK_JUNCTION_RIGHT)) == (GTK_JUNCTION_LEFT | GTK_JUNCTION_RIGHT)) - sides &= ~GTK_JUNCTION_LEFT; + if ((sides & (GTK_JUNCTION_CORNER_TOPLEFT | GTK_JUNCTION_CORNER_BOTTOMRIGHT)) == (GTK_JUNCTION_CORNER_TOPLEFT | GTK_JUNCTION_CORNER_BOTTOMRIGHT)) + sides &= ~GTK_JUNCTION_CORNER_TOPLEFT; - if ((sides & (GTK_JUNCTION_TOP | GTK_JUNCTION_BOTTOM)) == (GTK_JUNCTION_TOP | GTK_JUNCTION_BOTTOM)) - sides &= ~GTK_JUNCTION_TOP; + if ((sides & (GTK_JUNCTION_CORNER_TOPRIGHT | GTK_JUNCTION_CORNER_BOTTOMLEFT)) == (GTK_JUNCTION_CORNER_TOPRIGHT | GTK_JUNCTION_CORNER_BOTTOMLEFT)) + sides &= ~GTK_JUNCTION_CORNER_TOPRIGHT; if (sides == 0) - sides = (GTK_JUNCTION_BOTTOM | GTK_JUNCTION_RIGHT); + sides = GTK_JUNCTION_CORNER_BOTTOMRIGHT; /* align drawing area to the connected side */ if (sides == GTK_JUNCTION_LEFT) @@ -2317,7 +2317,7 @@ gtk_theming_engine_render_handle (GtkThemingEngine *engine, if (height < width) width = height; } - else if (sides == (GTK_JUNCTION_LEFT | GTK_JUNCTION_TOP)) + else if (sides == GTK_JUNCTION_CORNER_TOPLEFT) { if (width < height) height = width; @@ -2326,7 +2326,7 @@ gtk_theming_engine_render_handle (GtkThemingEngine *engine, skip = 2; } - else if (sides == (GTK_JUNCTION_LEFT | GTK_JUNCTION_BOTTOM)) + else if (sides == GTK_JUNCTION_CORNER_BOTTOMLEFT) { /* make it square, aligning to bottom left */ if (width < height) @@ -2348,7 +2348,7 @@ gtk_theming_engine_render_handle (GtkThemingEngine *engine, width = height; } } - else if (sides == (GTK_JUNCTION_RIGHT | GTK_JUNCTION_TOP)) + else if (sides == GTK_JUNCTION_CORNER_TOPRIGHT) { if (width < height) height = width; @@ -2360,7 +2360,7 @@ gtk_theming_engine_render_handle (GtkThemingEngine *engine, skip = 3; } - else if (sides == (GTK_JUNCTION_RIGHT | GTK_JUNCTION_BOTTOM)) + else if (sides == GTK_JUNCTION_CORNER_BOTTOMRIGHT) { /* make it square, aligning to bottom right */ if (width < height) @@ -2433,7 +2433,7 @@ gtk_theming_engine_render_handle (GtkThemingEngine *engine, yi+= 2; } } - else if (sides == (GTK_JUNCTION_TOP | GTK_JUNCTION_LEFT)) + else if (sides == GTK_JUNCTION_CORNER_TOPLEFT) { gint xi, yi; @@ -2463,7 +2463,7 @@ gtk_theming_engine_render_handle (GtkThemingEngine *engine, yi -= 3; } } - else if (sides == (GTK_JUNCTION_TOP | GTK_JUNCTION_RIGHT)) + else if (sides == GTK_JUNCTION_CORNER_TOPRIGHT) { gint xi, yi; @@ -2493,7 +2493,7 @@ gtk_theming_engine_render_handle (GtkThemingEngine *engine, yi -= 3; } } - else if (sides == (GTK_JUNCTION_BOTTOM | GTK_JUNCTION_LEFT)) + else if (sides == GTK_JUNCTION_CORNER_BOTTOMLEFT) { gint xi, yi; @@ -2523,7 +2523,7 @@ gtk_theming_engine_render_handle (GtkThemingEngine *engine, yi += 3; } } - else if (sides == (GTK_JUNCTION_BOTTOM | GTK_JUNCTION_RIGHT)) + else if (sides == GTK_JUNCTION_CORNER_BOTTOMRIGHT) { gint xi, yi; diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c index b2b789ad58..31f46a56cd 100644 --- a/gtk/gtkwindow.c +++ b/gtk/gtkwindow.c @@ -5117,9 +5117,9 @@ static GtkJunctionSides get_grip_junction (GtkWidget *widget) { if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_LTR) - return GTK_JUNCTION_BOTTOM | GTK_JUNCTION_RIGHT; + return GTK_JUNCTION_CORNER_BOTTOMRIGHT; else - return GTK_JUNCTION_BOTTOM | GTK_JUNCTION_LEFT; + return GTK_JUNCTION_CORNER_BOTTOMLEFT; } static gboolean @@ -5232,7 +5232,7 @@ set_grip_shape (GtkWindow *window) cairo_set_source_rgba (cr, 0.0, 0.0, 0.0, 0.0); cairo_paint (cr); cairo_set_source_rgba (cr, 0.0, 0.0, 0.0, 1.0); - if (get_grip_junction (GTK_WIDGET (window)) & GTK_JUNCTION_RIGHT) + if (get_grip_junction (GTK_WIDGET (window)) & GTK_JUNCTION_CORNER_BOTTOMRIGHT) { cairo_move_to (cr, width, 0.0); cairo_line_to (cr, width, height);