diff --git a/gdk/win32/gdksurface-win32.c b/gdk/win32/gdksurface-win32.c index 7853d1a83f..c690fed206 100644 --- a/gdk/win32/gdksurface-win32.c +++ b/gdk/win32/gdksurface-win32.c @@ -1633,42 +1633,48 @@ gdk_win32_surface_get_geometry (GdkSurface *window, RECT rect; GdkWin32Surface *impl = GDK_WIN32_SURFACE (window); - API_CALL (GetClientRect, (GDK_SURFACE_HWND (window), &rect)); - - POINT pt; + if (GDK_IS_TOPLEVEL (window) && impl->drag_move_resize_context.native_move_resize_pending) + rect = impl->next_layout.configured_rect; + else + { + POINT pt; GdkSurface *parent; - + if (GDK_IS_TOPLEVEL (window)) parent = NULL; else if (GDK_IS_POPUP (window)) parent = gdk_popup_get_parent (GDK_POPUP (window)); else parent = NULL; - - pt.x = rect.left; - pt.y = rect.top; - ClientToScreen (GDK_SURFACE_HWND (window), &pt); + API_CALL (GetClientRect, (GDK_SURFACE_HWND (window), &rect)); + + pt.x = rect.left; + pt.y = rect.top; + ClientToScreen (GDK_SURFACE_HWND (window), &pt); if (parent) - ScreenToClient (GDK_SURFACE_HWND (parent), &pt); - rect.left = pt.x; - rect.top = pt.y; + ScreenToClient (GDK_SURFACE_HWND (parent), &pt); - pt.x = rect.right; - pt.y = rect.bottom; - ClientToScreen (GDK_SURFACE_HWND (window), &pt); + rect.left = pt.x; + rect.top = pt.y; + + pt.x = rect.right; + pt.y = rect.bottom; + ClientToScreen (GDK_SURFACE_HWND (window), &pt); if (parent) - ScreenToClient (GDK_SURFACE_HWND (parent), &pt); - rect.right = pt.x; - rect.bottom = pt.y; + ScreenToClient (GDK_SURFACE_HWND (parent), &pt); - if (parent == NULL) - { - rect.left += _gdk_offset_x * impl->surface_scale; - rect.top += _gdk_offset_y * impl->surface_scale; - rect.right += _gdk_offset_x * impl->surface_scale; - rect.bottom += _gdk_offset_y * impl->surface_scale; - } + rect.right = pt.x; + rect.bottom = pt.y; + + if (parent == NULL) + { + rect.left += _gdk_offset_x * impl->surface_scale; + rect.top += _gdk_offset_y * impl->surface_scale; + rect.right += _gdk_offset_x * impl->surface_scale; + rect.bottom += _gdk_offset_y * impl->surface_scale; + } + } if (x) *x = rect.left / impl->surface_scale; @@ -2273,7 +2279,6 @@ snap_up (GdkSurface *window) impl = GDK_WIN32_SURFACE (window); impl->snap_state = GDK_WIN32_AEROSNAP_STATE_FULLUP; - impl->resized = FALSE; stash_window (window, impl); @@ -2311,7 +2316,6 @@ snap_left (GdkSurface *window, impl = GDK_WIN32_SURFACE (window); impl->snap_state = GDK_WIN32_AEROSNAP_STATE_HALFLEFT; - impl->resized = FALSE; gdk_win32_monitor_get_workarea (snap_monitor, &rect); @@ -2340,7 +2344,6 @@ snap_right (GdkSurface *window, impl = GDK_WIN32_SURFACE (window); impl->snap_state = GDK_WIN32_AEROSNAP_STATE_HALFRIGHT; - impl->resized = FALSE; gdk_win32_monitor_get_workarea (snap_monitor, &rect); @@ -3950,9 +3953,10 @@ gdk_win32_surface_do_move_resize_drag (GdkSurface *window, impl->unscaled_width = new_rect.right - new_rect.left; impl->unscaled_height = new_rect.bottom - new_rect.top; + + impl->next_layout.configured_rect = new_rect; impl->next_layout.configured_width = (impl->unscaled_width + scale - 1) / scale; impl->next_layout.configured_height = (impl->unscaled_height + scale - 1) / scale; - impl->resized = TRUE; } context->native_move_resize_pending = TRUE; @@ -4105,7 +4109,6 @@ gdk_win32_surface_maximize (GdkSurface *window) _gdk_win32_surface_state_to_string (window->state))); impl = GDK_WIN32_SURFACE (window); - impl->resized = FALSE; if (GDK_SURFACE_IS_MAPPED (window)) GtkShowWindow (window, SW_MAXIMIZE); @@ -4550,7 +4553,7 @@ _gdk_win32_surface_request_layout (GdkSurface *surface) int scale = impl->surface_scale; RECT rect; - if (GDK_IS_TOPLEVEL (surface) && impl->resized) + if (GDK_IS_TOPLEVEL (surface) && impl->drag_move_resize_context.native_move_resize_pending) { surface->width = impl->next_layout.configured_width; surface->height = impl->next_layout.configured_height; @@ -4578,7 +4581,7 @@ _gdk_win32_surface_compute_size (GdkSurface *surface) if (GDK_IS_TOPLEVEL (surface)) compute_toplevel_size (surface, TRUE, &width, &height); - if (!impl->resized) + if (!impl->drag_move_resize_context.native_move_resize_pending) { surface->width = impl->next_layout.configured_width; surface->height = impl->next_layout.configured_height; diff --git a/gdk/win32/gdksurface-win32.h b/gdk/win32/gdksurface-win32.h index 1d0c9c6c7e..6be358338b 100644 --- a/gdk/win32/gdksurface-win32.h +++ b/gdk/win32/gdksurface-win32.h @@ -342,8 +342,8 @@ struct _GdkWin32Surface struct { int configured_width; int configured_height; + RECT configured_rect; } next_layout; - gboolean resized; #ifdef GDK_WIN32_ENABLE_EGL EGLSurface egl_surface;