From: Kevin Worth <kworth@kworth-laptop.(none)>
Date: Sat, 6 Jun 2009 15:15:40 +0000 (-0400)
Subject: Selection box now draws correctly in all four directions
X-Git-Url: https://git.cworth.org/git?a=commitdiff_plain;h=ad15874eb551213fc4da921cd43a009020c8c2cf;p=kub

Selection box now draws correctly in all four directions
---

diff --git a/kub.c b/kub.c
index 2fdcd36..489effb 100644
--- a/kub.c
+++ b/kub.c
@@ -113,7 +113,7 @@ static void selection_box_init(selection_box_t *box)
 
 static void selection_box_draw(selection_box_t *box, cairo_t *cr)
 {
-    cairo_rectangle (cr, box->x1, box->y1, box->x2 -box->x1, box->y2 - box->y1);
+    cairo_rectangle (cr, box->x1, box->y1, box->x2 - box->x1, box->y2 - box->y1);
     cairo_set_source_rgba(cr, 0.0, 0.1, 0.2, 0.5);
     cairo_fill (cr);
 }
@@ -554,7 +554,7 @@ static gboolean on_button_release_event (GtkWidget *widget, GdkEventButton *even
 	int height = abs(box->y2 - box->y1);
 
 	box->visible = 0;	
-	gtk_widget_queue_draw_area (widget, x - 1, y - 1, width - 2, height + 2);
+	gtk_widget_queue_draw_area (widget, x, y, width, height);
 
 	tile_group_t group;
 	group.num_tiles = 0;
@@ -596,7 +596,7 @@ static gboolean on_button_motion_event (GtkWidget *widget, GdkEventMotion *event
 	gtk_widget_queue_draw_area ( widget,  MIN(box->x1, box->x2), MIN(box->y1, box->y2), abs(box->x2 - box->x1), abs(box->y2 - box->y1) );
 
 	box->x2 = event->x;
-	box->x2 = event->y;
+	box->y2 = event->y;
 
 	gtk_widget_queue_draw_area ( widget, MIN(box->x1, box->x2), MIN(box->y1, box->y2), abs(box->x2 - box->x1), abs(box->y2 - box->y1) );
     }