[gtk/readonly-events-1: 5/51] x11: Stop relying on root coordinates in events
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/readonly-events-1: 5/51] x11: Stop relying on root coordinates in events
- Date: Mon, 17 Feb 2020 05:47:11 +0000 (UTC)
commit db2fc1ce8f66de4863d3f51232b486b1e446a930
Author: Matthias Clasen <mclasen redhat com>
Date: Fri Feb 14 18:17:13 2020 -0500
x11: Stop relying on root coordinates in events
The X11 dnd code was still using x_root/y_root in
GdkEventMotion in a couple of places. Stop doing so,
these field are going away soon.
gdk/x11/gdkdrag-x11.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
---
diff --git a/gdk/x11/gdkdrag-x11.c b/gdk/x11/gdkdrag-x11.c
index fb341088c2..c369ca0316 100644
--- a/gdk/x11/gdkdrag-x11.c
+++ b/gdk/x11/gdkdrag-x11.c
@@ -2243,15 +2243,18 @@ gdk_drag_update (GdkDrag *drag,
}
static gboolean
-gdk_dnd_handle_motion_event (GdkDrag *drag,
- const GdkEventMotion *event)
+gdk_dnd_handle_motion_event (GdkDrag *drag,
+ const GdkEvent *event)
{
GdkModifierType state;
+ int x_root, y_root;
if (!gdk_event_get_state ((GdkEvent *) event, &state))
return FALSE;
- gdk_drag_update (drag, event->x_root, event->y_root, state,
+ x_root = event->any.surface->x + event->motion.x;
+ y_root = event->any.surface->y + event->motion.y;
+ gdk_drag_update (drag, x_root, y_root, state,
gdk_event_get_time ((GdkEvent *) event));
return TRUE;
}
@@ -2407,7 +2410,7 @@ gdk_x11_drag_handle_event (GdkDrag *drag,
switch ((guint) event->any.type)
{
case GDK_MOTION_NOTIFY:
- return gdk_dnd_handle_motion_event (drag, &event->motion);
+ return gdk_dnd_handle_motion_event (drag, event);
case GDK_BUTTON_RELEASE:
return gdk_dnd_handle_button_event (drag, &event->button);
case GDK_KEY_PRESS:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]