]> git.cworth.org Git - kub/commitdiff
Selection box now draws correctly in all four directions
authorKevin Worth <kworth@kworth-laptop.(none)>
Sat, 6 Jun 2009 15:15:40 +0000 (11:15 -0400)
committerKevin Worth <kworth@kworth-laptop.(none)>
Sat, 6 Jun 2009 15:15:40 +0000 (11:15 -0400)
kub.c

diff --git a/kub.c b/kub.c
index 2fdcd36d8d78a45fde92057edcad9e54a595fa52..489effb4cd77945d570c5b58bf81c2307f4a5896 100644 (file)
--- 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) );
     }