gdkdrag-win32.c: Fix drag surface positioning

Determine the root_x and root_y coordinates of the drag surface by
relying on the coordinates of the surface where the drag is being
carried out, plus the coordinates that we receive from the drag event,
which is in-line with what the X11 backend does.

This will prevent the drag surface from being initially drawn at the
correct position, but jumping towards the top-left corner of the screen
shortly afterwards.

The DnD support will still need some more updates to function correctly
on Windows, but at least this is a small improvement.

Fixes issue #3798.
This commit is contained in:
Chun-wei Fan 2021-06-18 17:58:14 +08:00
parent 352898ae9e
commit e35490ba5b
2 changed files with 2 additions and 3 deletions

View File

@ -2345,8 +2345,8 @@ gdk_dnd_handle_motion_event (GdkDrag *drag,
state = gdk_event_get_modifier_state (event);
gdk_event_get_position (event, &x, &y);
x_root = x + _gdk_offset_x;
y_root = y + _gdk_offset_y;
x_root = event->surface->x + x;
y_root = event->surface->y + y;
if (drag_win32->drag_surface)
move_drag_surface (drag, x_root, y_root);

View File

@ -2343,7 +2343,6 @@ gdk_event_translate (MSG *msg,
current_root_x = (msg->pt.x + _gdk_offset_x) / impl->surface_scale;
current_root_y = (msg->pt.y + _gdk_offset_y) / impl->surface_scale;
if (impl->drag_move_resize_context.op != GDK_WIN32_DRAGOP_NONE)
gdk_win32_surface_do_move_resize_drag (window, current_root_x, current_root_y);
else if (_gdk_input_ignore_core == 0)