[gtk/cherry-pick-e35490ba] gdkdrag-win32.c: Fix drag surface positioning




commit 4ad550f341c6cdaea9b2559db966bf740a64ccd9
Author: Chun-wei Fan <fanchunwei src gnome org>
Date:   Fri Jun 18 17:58:14 2021 +0800

    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.
    
    
    (cherry picked from commit e35490ba5b6079a15d3be84cbe42d100e46ec120)

 gdk/win32/gdkdrag-win32.c   | 4 ++--
 gdk/win32/gdkevents-win32.c | 1 -
 2 files changed, 2 insertions(+), 3 deletions(-)
---
diff --git a/gdk/win32/gdkdrag-win32.c b/gdk/win32/gdkdrag-win32.c
index df81a73cec..419889ebe1 100644
--- a/gdk/win32/gdkdrag-win32.c
+++ b/gdk/win32/gdkdrag-win32.c
@@ -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);
diff --git a/gdk/win32/gdkevents-win32.c b/gdk/win32/gdkevents-win32.c
index 5a17522ae1..808354c4ae 100644
--- a/gdk/win32/gdkevents-win32.c
+++ b/gdk/win32/gdkevents-win32.c
@@ -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)


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