[Xfce4-commits] <xfce4-screenshooter:master> No need to save the current mouse position.
Jérôme Guelfucci
noreply at xfce.org
Sat Dec 26 22:30:05 CET 2009
Updating branch refs/heads/master
to e893b3268d73322dc383263e214df14675c0a6c0 (commit)
from 354644d4c949c75ac3aaecf437a87090693a12fc (commit)
commit e893b3268d73322dc383263e214df14675c0a6c0
Author: Jérôme Guelfucci <jeromeg at xfce.org>
Date: Sat Dec 26 12:07:07 2009 +0100
No need to save the current mouse position.
lib/screenshooter-capture.c | 19 ++++++++++---------
1 files changed, 10 insertions(+), 9 deletions(-)
diff --git a/lib/screenshooter-capture.c b/lib/screenshooter-capture.c
index da16fa7..0b31acd 100644
--- a/lib/screenshooter-capture.c
+++ b/lib/screenshooter-capture.c
@@ -40,7 +40,7 @@ typedef struct
gboolean pressed;
gboolean cancelled;
GdkRectangle *rectangle;
- gint x1, y1, x2, y2;
+ gint x1, y1; /* holds the position where the mouse was pressed */
GdkGC *gc;
GdkWindow *root_window;
} RbData;
@@ -671,6 +671,7 @@ static GdkFilterReturn
region_filter_func (GdkXEvent *xevent, GdkEvent *event, RbData *rbdata)
{
XEvent *x_event = (XEvent *) xevent;
+ gint x2 = 0, y2 = 0;
switch (x_event->type)
{
@@ -678,8 +679,8 @@ region_filter_func (GdkXEvent *xevent, GdkEvent *event, RbData *rbdata)
case ButtonPress:
TRACE ("Start dragging the rectangle");
- rbdata->rectangle->x = rbdata->x2 = rbdata->x1 = x_event->xkey.x_root;
- rbdata->rectangle->y = rbdata->y2 = rbdata->y1 = x_event->xkey.y_root;
+ rbdata->rectangle->x = rbdata->x1 = x_event->xkey.x_root;
+ rbdata->rectangle->y = rbdata->y1 = x_event->xkey.y_root;
rbdata->rectangle->width = 0;
rbdata->rectangle->height = 0;
rbdata->pressed = TRUE;
@@ -739,13 +740,13 @@ region_filter_func (GdkXEvent *xevent, GdkEvent *event, RbData *rbdata)
rbdata->rectangle->height);
}
- rbdata->x2 = x_event->xkey.x_root;
- rbdata->y2 = x_event->xkey.y_root;
+ x2 = x_event->xkey.x_root;
+ y2 = x_event->xkey.y_root;
- rbdata->rectangle->x = MIN (rbdata->x1, rbdata->x2);
- rbdata->rectangle->y = MIN (rbdata->y1, rbdata->y2);
- rbdata->rectangle->width = ABS (rbdata->x2 - rbdata->x1);
- rbdata->rectangle->height = ABS (rbdata->y2 - rbdata->y1);
+ rbdata->rectangle->x = MIN (rbdata->x1, x2);
+ rbdata->rectangle->y = MIN (rbdata->y1, y2);
+ rbdata->rectangle->width = ABS (x2 - rbdata->x1);
+ rbdata->rectangle->height = ABS (y2 - rbdata->y1);
/* Draw the rectangle as the user drags the mouse */
TRACE ("Draw the new rectangle");
More information about the Xfce4-commits
mailing list