[gtk/wip/readonly-events] Remove root coords from the GdkDrop api



commit bfc51444b7d9d27ddd92ddcdd5243f1ad0295db8
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri Feb 14 18:15:38 2020 -0500

    Remove root coords from the GdkDrop api

 gdk/gdkdrop.c         | 26 ++++++++------------------
 gdk/gdkdropprivate.h  |  8 ++++----
 gdk/x11/gdkdrop-x11.c | 10 ++++++----
 3 files changed, 18 insertions(+), 26 deletions(-)
---
diff --git a/gdk/gdkdrop.c b/gdk/gdkdrop.c
index a0accf7464..f4a5b27916 100644
--- a/gdk/gdkdrop.c
+++ b/gdk/gdkdrop.c
@@ -935,24 +935,19 @@ gdk_drop_emit_enter_event (GdkDrop  *self,
 void
 gdk_drop_emit_motion_event (GdkDrop  *self,
                             gboolean  dont_queue,
-                            double    x_root,
-                            double    y_root,
+                            double    x,
+                            double    y,
                             guint32   time)
 {
   GdkDropPrivate *priv = gdk_drop_get_instance_private (self);
   GdkEvent *event;
-  int x, y;
-
-  gdk_surface_get_origin (priv->surface, &x, &y);
 
   event = gdk_event_new (GDK_DRAG_MOTION);
   event->any.surface = g_object_ref (priv->surface);
   event->dnd.drop = g_object_ref (self);
   event->dnd.time = time;
-  event->dnd.x_root = x_root;
-  event->dnd.y_root = y_root;
-  event->dnd.x = x_root - x;
-  event->dnd.y = y_root - y;
+  event->dnd.x = x;
+  event->dnd.y = y;
   gdk_event_set_device (event, priv->device);
 
   gdk_drop_do_emit_event (event, dont_queue);
@@ -978,24 +973,19 @@ gdk_drop_emit_leave_event (GdkDrop  *self,
 void
 gdk_drop_emit_drop_event (GdkDrop  *self,
                           gboolean  dont_queue,
-                          double    x_root,
-                          double    y_root,
+                          double    x,
+                          double    y,
                           guint32   time)
 {
   GdkDropPrivate *priv = gdk_drop_get_instance_private (self);
   GdkEvent *event;
-  int x, y;
-
-  gdk_surface_get_origin (priv->surface, &x, &y);
 
   event = gdk_event_new (GDK_DROP_START);
   event->any.surface = g_object_ref (priv->surface);
   event->dnd.drop = g_object_ref (self);
   event->dnd.time = time;
-  event->dnd.x_root = x_root;
-  event->dnd.y_root = y_root;
-  event->dnd.x = x_root - x;
-  event->dnd.y = y_root - y;
+  event->dnd.x = x;
+  event->dnd.y = y;
   gdk_event_set_device (event, priv->device);
 
   gdk_drop_do_emit_event (event, dont_queue);
diff --git a/gdk/gdkdropprivate.h b/gdk/gdkdropprivate.h
index b20eee2ae7..5836c89b78 100644
--- a/gdk/gdkdropprivate.h
+++ b/gdk/gdkdropprivate.h
@@ -64,16 +64,16 @@ void                    gdk_drop_emit_enter_event               (GdkDrop
                                                                  guint32                 time);
 void                    gdk_drop_emit_motion_event              (GdkDrop                *self,
                                                                  gboolean                dont_queue,
-                                                                 double                  x_root,
-                                                                 double                  y_root,
+                                                                 double                  x,
+                                                                 double                  y,
                                                                  guint32                 time);
 void                    gdk_drop_emit_leave_event               (GdkDrop                *self,
                                                                  gboolean                dont_queue,
                                                                  guint32                 time);
 void                    gdk_drop_emit_drop_event                (GdkDrop                *self,
                                                                  gboolean                dont_queue,
-                                                                 double                  x_root,
-                                                                 double                  y_root,
+                                                                 double                  x,
+                                                                 double                  y,
                                                                  guint32                 time);
 
 G_END_DECLS
diff --git a/gdk/x11/gdkdrop-x11.c b/gdk/x11/gdkdrop-x11.c
index 07e5a8fc89..4eb24d154f 100644
--- a/gdk/x11/gdkdrop-x11.c
+++ b/gdk/x11/gdkdrop-x11.c
@@ -647,7 +647,8 @@ xdnd_position_filter (GdkSurface   *surface,
   if ((drop != NULL) &&
       (drop_x11->source_window == source_window))
     {
-      impl = GDK_X11_SURFACE (gdk_drop_get_surface (drop));
+      surface = gdk_drop_get_surface (drop);
+      impl = GDK_X11_SURFACE (surface);
 
       drop_x11->suggested_action = xdnd_action_from_atom (display, action);
       gdk_x11_drop_update_actions (drop_x11);
@@ -655,7 +656,7 @@ xdnd_position_filter (GdkSurface   *surface,
       drop_x11->last_x = x_root / impl->surface_scale;
       drop_x11->last_y = y_root / impl->surface_scale;
 
-      gdk_drop_emit_motion_event (drop, FALSE, drop_x11->last_x, drop_x11->last_y, time);
+      gdk_drop_emit_motion_event (drop, FALSE, drop_x11->last_x - surface->x, drop_x11->last_y - surface->y, 
time);
     }
 
   return TRUE;
@@ -687,9 +688,10 @@ xdnd_drop_filter (GdkSurface   *surface,
   if ((drop != NULL) &&
       (drop_x11->source_window == source_window))
     {
-      gdk_x11_surface_set_user_time (gdk_drop_get_surface (drop), time);
+      GdkSurface *s = gdk_drop_get_surface (drop);
+      gdk_x11_surface_set_user_time (s, time);
 
-      gdk_drop_emit_drop_event (drop, FALSE, drop_x11->last_x, drop_x11->last_y, time);
+      gdk_drop_emit_drop_event (drop, FALSE, drop_x11->last_x - s->x, drop_x11->last_y - s->y, time);
     }
 
   return TRUE;


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