patch 8.2.1232: MS-Windows GUI: Snap cancelled by split command
Problem: MS-Windows GUI: Snap cancelled by split command.
Solution: Do not cancel Snap when splitting a window. (Ken Takata,
closes #6467)
diff --git a/src/gui_w32.c b/src/gui_w32.c
index 46358dc..19db1a3 100644
--- a/src/gui_w32.c
+++ b/src/gui_w32.c
@@ -3342,19 +3342,33 @@
/*
* Return TRUE if the GUI window is maximized, filling the whole screen.
+ * Also return TRUE if the window is snapped.
*/
int
gui_mch_maximized(void)
{
WINDOWPLACEMENT wp;
+ RECT rc;
wp.length = sizeof(WINDOWPLACEMENT);
if (GetWindowPlacement(s_hwnd, &wp))
- return wp.showCmd == SW_SHOWMAXIMIZED
+ {
+ if (wp.showCmd == SW_SHOWMAXIMIZED
|| (wp.showCmd == SW_SHOWMINIMIZED
- && wp.flags == WPF_RESTORETOMAXIMIZED);
+ && wp.flags == WPF_RESTORETOMAXIMIZED))
+ return TRUE;
+ if (wp.showCmd == SW_SHOWMINIMIZED)
+ return FALSE;
- return 0;
+ // Assume the window is snapped when the sizes from two APIs differ.
+ GetWindowRect(s_hwnd, &rc);
+ if ((rc.right - rc.left !=
+ wp.rcNormalPosition.right - wp.rcNormalPosition.left)
+ || (rc.bottom - rc.top !=
+ wp.rcNormalPosition.bottom - wp.rcNormalPosition.top))
+ return TRUE;
+ }
+ return FALSE;
}
/*