From f853283d7b9f173d429aa49e2e976f0d23ef5c40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A0=D1=83=D1=81=D0=BB=D0=B0=D0=BD=20=D0=98=D0=B6=D0=B1?= =?UTF-8?q?=D1=83=D0=BB=D0=B0=D1=82=D0=BE=D0=B2?= Date: Tue, 15 Mar 2016 10:15:14 +0000 Subject: [PATCH] GDK W32: Add/subtract shadow when drag-resizing Implements gdk_win32_window_set_shadow_width(). Uses shadow width/height to adjust max tracking size, allowing windows to be drag-resized to cover the whole desktop. Also uses SM_C*VIRTUALSCREEN instead of SM_C*MAXTRACK. https://bugzilla.gnome.org/show_bug.cgi?id=763013 --- gdk/win32/gdkevents-win32.c | 4 ++-- gdk/win32/gdkwindow-win32.c | 21 +++++++++++++++++++++ gdk/win32/gdkwindow-win32.h | 7 +++++++ 3 files changed, 30 insertions(+), 2 deletions(-) diff --git a/gdk/win32/gdkevents-win32.c b/gdk/win32/gdkevents-win32.c index 0ee314e52a..c6f6a243cd 100644 --- a/gdk/win32/gdkevents-win32.c +++ b/gdk/win32/gdkevents-win32.c @@ -2044,8 +2044,8 @@ _gdk_win32_window_fill_min_max_info (GdkWindow *window, mmi->ptMaxSize.y = nearest_info.rcWork.bottom - nearest_info.rcWork.top; } - mmi->ptMaxTrackSize.x = GetSystemMetrics (SM_CXMAXTRACK); - mmi->ptMaxTrackSize.y = GetSystemMetrics (SM_CYMAXTRACK); + mmi->ptMaxTrackSize.x = GetSystemMetrics (SM_CXVIRTUALSCREEN) + impl->margins_x; + mmi->ptMaxTrackSize.y = GetSystemMetrics (SM_CYVIRTUALSCREEN) + impl->margins_y; } return TRUE; diff --git a/gdk/win32/gdkwindow-win32.c b/gdk/win32/gdkwindow-win32.c index 1446da9aa8..061192410a 100644 --- a/gdk/win32/gdkwindow-win32.c +++ b/gdk/win32/gdkwindow-win32.c @@ -5764,6 +5764,26 @@ GtkShowWindow (HWND hwnd, return ShowWindow (hwnd, cmd_show); } +static void +gdk_win32_window_set_shadow_width (GdkWindow *window, + gint left, + gint right, + gint top, + gint bottom) +{ + GdkWindowImplWin32 *impl = GDK_WINDOW_IMPL_WIN32 (window->impl); + + if (GDK_WINDOW_DESTROYED (window)) + return; + + impl->margins.left = left; + impl->margins.right = right; + impl->margins.top = top; + impl->margins.bottom = bottom; + impl->margins_x = left + right; + impl->margins_y = top + bottom; +} + static void gdk_window_impl_win32_class_init (GdkWindowImplWin32Class *klass) { @@ -5840,6 +5860,7 @@ gdk_window_impl_win32_class_init (GdkWindowImplWin32Class *klass) impl_class->get_decorations = gdk_win32_window_get_decorations; impl_class->set_functions = gdk_win32_window_set_functions; + impl_class->set_shadow_width = gdk_win32_window_set_shadow_width; impl_class->begin_resize_drag = gdk_win32_window_begin_resize_drag; impl_class->begin_move_drag = gdk_win32_window_begin_move_drag; impl_class->set_opacity = gdk_win32_window_set_opacity; diff --git a/gdk/win32/gdkwindow-win32.h b/gdk/win32/gdkwindow-win32.h index 7eca54f698..a4ab10a0e8 100644 --- a/gdk/win32/gdkwindow-win32.h +++ b/gdk/win32/gdkwindow-win32.h @@ -244,6 +244,13 @@ struct _GdkWindowImplWin32 gint initial_x; gint initial_y; + /* left/right/top/bottom width of the shadow/resize-grip around the window */ + RECT margins; + + /* left+right and top+bottom from @margins */ + gint margins_x; + gint margins_y; + guint no_bg : 1; guint inhibit_configure : 1; guint override_redirect : 1;