summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Larsson <alexl@redhat.com>2020-05-14 11:46:33 +0200
committerAlexander Larsson <alexl@redhat.com>2020-05-14 11:46:33 +0200
commitbca4af360db820a37f9543aef1a61bffface01fe (patch)
treea7a5c4f0313de58066025cc4eb12ce7195581dc6
parent32f58e6c0b72c0749721ba6ceb17ecfe214f915e (diff)
downloadgtk+-bca4af360db820a37f9543aef1a61bffface01fe.tar.gz
X11 dnd: Calculate relative coords right in events
GdkSurface.x/y is mostly 0, we need to look atht GdkX11Surface->abs_x/y.
-rw-r--r--gdk/x11/gdkdrop-x11.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/gdk/x11/gdkdrop-x11.c b/gdk/x11/gdkdrop-x11.c
index 6043f52b26..68535043c2 100644
--- a/gdk/x11/gdkdrop-x11.c
+++ b/gdk/x11/gdkdrop-x11.c
@@ -625,11 +625,11 @@ xdnd_position_filter (GdkSurface *surface,
if (drop_x11->enter_emitted)
{
- gdk_drop_emit_motion_event (drop, FALSE, drop_x11->last_x - surface->x, drop_x11->last_y - surface->y, time);
+ gdk_drop_emit_motion_event (drop, FALSE, drop_x11->last_x - impl->abs_x, drop_x11->last_y - impl->abs_y, time);
}
else
{
- gdk_drop_emit_enter_event (drop, FALSE, drop_x11->last_x - surface->x, drop_x11->last_y - surface->y, time);
+ gdk_drop_emit_enter_event (drop, FALSE, drop_x11->last_x - impl->abs_x, drop_x11->last_y - impl->abs_y, time);
drop_x11->enter_emitted = TRUE;
}
}
@@ -662,9 +662,10 @@ xdnd_drop_filter (GdkSurface *surface,
(drop_x11->source_window == source_window))
{
GdkSurface *s = gdk_drop_get_surface (drop);
+ GdkX11Surface *si = GDK_X11_SURFACE (s);
gdk_x11_surface_set_user_time (s, time);
- gdk_drop_emit_drop_event (drop, FALSE, drop_x11->last_x - s->x, drop_x11->last_y - s->y, time);
+ gdk_drop_emit_drop_event (drop, FALSE, drop_x11->last_x - si->abs_x, drop_x11->last_y - si->abs_y, time);
}
return TRUE;