[Xfce4-commits] [apps/xfce4-screenshooter] 01/01: Do not use root coordinates for region capture (Bug #15406)

noreply at xfce.org noreply at xfce.org
Sun May 19 19:48:37 CEST 2019


This is an automated email from the git hooks/post-receive script.

a   n   d   r   e       p   u   s   h   e   d       a       c   o   m   m   i   t       t   o       b   r   a   n   c   h       m   a   s   t   e   r   
   in repository apps/xfce4-screenshooter.

commit 1200add10730b07618dbf4ed0f43a99b51c60d60
Author: Andre Miranda <andreldm at xfce.org>
Date:   Sun May 19 14:47:18 2019 -0300

    Do not use root coordinates for region capture (Bug #15406)
---
 lib/screenshooter-capture.c | 39 ++++++++++-----------------------------
 1 file changed, 10 insertions(+), 29 deletions(-)

diff --git a/lib/screenshooter-capture.c b/lib/screenshooter-capture.c
index 8a3f7d8..c1e1ebe 100644
--- a/lib/screenshooter-capture.c
+++ b/lib/screenshooter-capture.c
@@ -42,7 +42,6 @@ typedef struct
   gint x_root;
   gint y_root;
   cairo_rectangle_int_t rectangle;
-  cairo_rectangle_int_t rectangle_root;
   GtkWidget *size_window;
   GtkWidget *size_label;
 } RubberBandData;
@@ -699,14 +698,13 @@ static gboolean cb_motion_notify (GtkWidget *widget,
 
   if (rbdata->left_pressed)
     {
-      cairo_rectangle_int_t *new_rect, *new_rect_root;
+      cairo_rectangle_int_t *new_rect;
       cairo_rectangle_int_t old_rect, intersect;
       cairo_region_t *region;
 
       TRACE ("Mouse is moving with left button pressed");
 
       new_rect = &rbdata->rectangle;
-      new_rect_root = &rbdata->rectangle_root;
 
       if (!rbdata->rubber_banding)
         {
@@ -734,12 +732,12 @@ static gboolean cb_motion_notify (GtkWidget *widget,
           coords = g_strdup_printf ("%d x %d", rect_width, rect_height);
 
           size_window_get_offset (rbdata->size_window, strlen (coords),
-                                  event->x_root, event->y_root,
+                                  event->x, event->y,
                                   &x_offset, &y_offset);
 
           gtk_window_move (GTK_WINDOW (rbdata->size_window),
-                           event->x_root + x_offset,
-                           event->y_root + y_offset);
+                           event->x + x_offset,
+                           event->y + y_offset);
 
           gtk_label_set_text (GTK_LABEL (rbdata->size_label), coords);
           g_free (coords);
@@ -757,26 +755,14 @@ static gboolean cb_motion_notify (GtkWidget *widget,
 
           /* Do not resize, instead move the rubber banding rectangle around */
           if (rbdata->anchor & ANCHOR_LEFT)
-            {
-              rbdata->x = (new_rect->x = event->x) + new_rect->width;
-              rbdata->x_root = (new_rect_root->x = event->x_root) + new_rect->width;
-            }
+            rbdata->x = (new_rect->x = event->x) + new_rect->width;
           else
-            {
-              rbdata->x = new_rect->x = event->x - new_rect->width;
-              rbdata->x_root = new_rect_root->x = event->x_root - new_rect->width;
-            }
+            rbdata->x = new_rect->x = event->x - new_rect->width;
 
           if (rbdata->anchor & ANCHOR_TOP)
-            {
-              rbdata->y = (new_rect->y = event->y) + new_rect->height;
-              rbdata->y_root = (new_rect_root->y = event->y_root) + new_rect->height;
-            }
+            rbdata->y = (new_rect->y = event->y) + new_rect->height;
           else
-            {
-              rbdata->y = new_rect->y = event->y - new_rect->height;
-              rbdata->x_root = new_rect_root->y = event->y_root - new_rect->height;
-            }
+            rbdata->y = new_rect->y = event->y - new_rect->height;
         }
       else
         {
@@ -785,11 +771,6 @@ static gboolean cb_motion_notify (GtkWidget *widget,
           new_rect->y = MIN (rbdata->y, event->y);
           new_rect->width = ABS (rbdata->x - event->x) + 1;
           new_rect->height = ABS (rbdata->y - event->y) + 1;
-
-          new_rect_root->x = MIN (rbdata->x_root, event->x_root);
-          new_rect_root->y = MIN (rbdata->y_root, event->y_root);
-          new_rect_root->width = ABS (rbdata->x_root - event->x_root) + 1;
-          new_rect_root->height = ABS (rbdata->y_root - event->y_root) + 1;
         }
 
       region = cairo_region_create_rectangle (&old_rect);
@@ -972,8 +953,8 @@ static GdkPixbuf
     goto cleanup;
 
   /* Grab the screenshot on the main window */
-  screenshot = capture_rectangle_screenshot (rbdata.rectangle_root.x,
-                                             rbdata.rectangle_root.y,
+  screenshot = capture_rectangle_screenshot (rbdata.rectangle.x,
+                                             rbdata.rectangle.y,
                                              rbdata.rectangle.width,
                                              rbdata.rectangle.height,
                                              delay);

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list