gdksurface-win32.c: Acquire root coordinates on drag/move

As in commit d45996c, the x and y coordinates passed into begin_drag and
begin_move are no longer root coordinates but are now surface
coordinates.

Use the x and y surface coordinates to acquire the root x and y
coordinates so that resizing and moving can work as expected.
This commit is contained in:
Chun-wei Fan 2019-04-01 14:18:30 +08:00
parent 19f4fce931
commit 896104939b

View File

@ -3865,8 +3865,8 @@ setup_drag_move_resize_context (GdkSurface *window,
GdkSurfaceEdge edge, GdkSurfaceEdge edge,
GdkDevice *device, GdkDevice *device,
gint button, gint button,
gint root_x, gint x,
gint root_y, gint y,
guint32 timestamp) guint32 timestamp)
{ {
RECT rect; RECT rect;
@ -3874,6 +3874,9 @@ setup_drag_move_resize_context (GdkSurface *window,
GdkSurface *pointer_window; GdkSurface *pointer_window;
GdkSurfaceImplWin32 *impl = GDK_SURFACE_IMPL_WIN32 (window->impl); GdkSurfaceImplWin32 *impl = GDK_SURFACE_IMPL_WIN32 (window->impl);
gboolean maximized = gdk_surface_get_state (window) & GDK_SURFACE_STATE_MAXIMIZED; gboolean maximized = gdk_surface_get_state (window) & GDK_SURFACE_STATE_MAXIMIZED;
gint root_x, root_y;
gdk_win32_surface_get_root_coords (window, x, y, &root_x, &root_y);
/* Before we drag, we need to undo any maximization or snapping. /* Before we drag, we need to undo any maximization or snapping.
* AeroSnap behaviour: * AeroSnap behaviour:
@ -4507,8 +4510,8 @@ gdk_win32_surface_begin_resize_drag (GdkSurface *window,
GdkSurfaceEdge edge, GdkSurfaceEdge edge,
GdkDevice *device, GdkDevice *device,
gint button, gint button,
gint root_x, gint x,
gint root_y, gint y,
guint32 timestamp) guint32 timestamp)
{ {
GdkSurfaceImplWin32 *impl; GdkSurfaceImplWin32 *impl;
@ -4536,15 +4539,15 @@ gdk_win32_surface_begin_resize_drag (GdkSurface *window,
setup_drag_move_resize_context (window, &impl->drag_move_resize_context, setup_drag_move_resize_context (window, &impl->drag_move_resize_context,
GDK_WIN32_DRAGOP_RESIZE, edge, device, GDK_WIN32_DRAGOP_RESIZE, edge, device,
button, root_x, root_y, timestamp); button, x, y, timestamp);
} }
static void static void
gdk_win32_surface_begin_move_drag (GdkSurface *window, gdk_win32_surface_begin_move_drag (GdkSurface *window,
GdkDevice *device, GdkDevice *device,
gint button, gint button,
gint root_x, gint x,
gint root_y, gint y,
guint32 timestamp) guint32 timestamp)
{ {
GdkSurfaceImplWin32 *impl; GdkSurfaceImplWin32 *impl;
@ -4571,7 +4574,7 @@ gdk_win32_surface_begin_move_drag (GdkSurface *window,
setup_drag_move_resize_context (window, &impl->drag_move_resize_context, setup_drag_move_resize_context (window, &impl->drag_move_resize_context,
GDK_WIN32_DRAGOP_MOVE, GDK_SURFACE_EDGE_NORTH_WEST, GDK_WIN32_DRAGOP_MOVE, GDK_SURFACE_EDGE_NORTH_WEST,
device, button, root_x, root_y, timestamp); device, button, x, y, timestamp);
} }