[gtk/global-coords: 2/5] main: Use gdk_surface_translate_coordinates



commit 8b037802df85d6b704411fa7ec258dd540e9ecbe
Author: Matthias Clasen <mclasen redhat com>
Date:   Tue May 28 23:43:05 2019 -0400

    main: Use gdk_surface_translate_coordinates
    
    This gets rid of another use of global coordinates.

 gtk/gtkmain.c | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)
---
diff --git a/gtk/gtkmain.c b/gtk/gtkmain.c
index 71b1dce79b..c57c09e70e 100644
--- a/gtk/gtkmain.c
+++ b/gtk/gtkmain.c
@@ -1216,14 +1216,11 @@ rewrite_events_translate (GdkSurface *old_surface,
                           gdouble   *x,
                           gdouble   *y)
 {
-  gint old_origin_x, old_origin_y;
-  gint new_origin_x, new_origin_y;
-
-  gdk_surface_get_origin (old_surface, &old_origin_x, &old_origin_y);
-  gdk_surface_get_origin (new_surface, &new_origin_x, &new_origin_y);
-
-  *x += old_origin_x - new_origin_x;
-  *y += old_origin_y - new_origin_y;
+  if (!gdk_surface_translate_coordinates (old_surface, new_surface, x, y))
+    {
+      *x = 0;
+      *y = 0;
+    }
 }
 
 static GdkEvent *


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]