Piotr Caban : user32: Support undocumented SC_SIZE flag that can be used to move window.

Alexandre Julliard julliard at winehq.org
Thu Jul 30 15:31:25 CDT 2020


Module: wine
Branch: master
Commit: 5bb4e4b36ce4073854944d98ddd3e5ef2484b28f
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=5bb4e4b36ce4073854944d98ddd3e5ef2484b28f

Author: Piotr Caban <piotr at codeweavers.com>
Date:   Wed Jul 29 19:07:40 2020 +0200

user32: Support undocumented SC_SIZE flag that can be used to move window.

Fixes main window moving in Quicken 2020.

Signed-off-by: Piotr Caban <piotr at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/user32/tests/win.c   | 40 ++++++++++++++++++++++++++++++++++++++++
 dlls/user32/winpos.c      |  4 ++--
 dlls/winex11.drv/window.c |  1 +
 3 files changed, 43 insertions(+), 2 deletions(-)

diff --git a/dlls/user32/tests/win.c b/dlls/user32/tests/win.c
index 700e60db17..843da8900f 100644
--- a/dlls/user32/tests/win.c
+++ b/dlls/user32/tests/win.c
@@ -11800,6 +11800,45 @@ static void other_process_proc(HWND hwnd)
     CloseHandle(test_done_event);
 }
 
+static void test_SC_SIZE(void)
+{
+    HWND hwnd;
+    RECT rect;
+    MSG msg;
+
+    hwnd = CreateWindowExA(0, "static", NULL, WS_POPUP | WS_VISIBLE,
+                100, 100, 100, 100, 0, 0, NULL, NULL);
+    ok(!!hwnd, "CreateWindowEx failed.\n");
+
+    GetWindowRect(hwnd, &rect);
+    ok(rect.left == 100, "rect.left = %d\n", rect.left);
+    ok(rect.top == 100, "rect.top = %d\n", rect.top);
+    ok(rect.right == 200, "rect.right = %d\n", rect.right);
+    ok(rect.bottom == 200, "rect.bottom = %d\n", rect.bottom);
+
+    SetCursorPos(100, 100);
+    PostMessageA(hwnd, WM_SYSCOMMAND, SC_SIZE | 9, MAKELONG(100, 100));
+    SetCursorPos(110, 100);
+    PostMessageA(hwnd, WM_MOUSEMOVE, 0, MAKELONG(110, 100));
+    PostMessageA(hwnd, WM_KEYDOWN, VK_RETURN, 0);
+
+    while (GetMessageA(&msg, 0, 0, 0))
+    {
+        TranslateMessage(&msg);
+        DispatchMessageA(&msg);
+
+        if (msg.message == WM_SYSCOMMAND) break;
+    }
+
+    GetWindowRect(hwnd, &rect);
+    ok(rect.left == 110, "rect.left = %d\n", rect.left);
+    ok(rect.top == 100, "rect.top = %d\n", rect.top);
+    ok(rect.right == 210, "rect.right = %d\n", rect.right);
+    ok(rect.bottom == 200, "rect.bottom = %d\n", rect.bottom);
+
+    DestroyWindow(hwnd);
+}
+
 static void test_other_process_window(const char *argv0)
 {
     HANDLE window_ready_event, test_done_event;
@@ -12022,6 +12061,7 @@ START_TEST(win)
     test_window_placement();
     test_arrange_iconic_windows();
     test_other_process_window(argv[0]);
+    test_SC_SIZE();
 
     /* add the tests above this line */
     if (hhook) UnhookWindowsHookEx(hhook);
diff --git a/dlls/user32/winpos.c b/dlls/user32/winpos.c
index b92a20df18..b45b74ce82 100644
--- a/dlls/user32/winpos.c
+++ b/dlls/user32/winpos.c
@@ -2894,7 +2894,7 @@ void WINPOS_SysCommandSizeMove( HWND hwnd, WPARAM wParam )
             else
             {
                 if (!DragFullWindows) draw_moving_frame( parent, hdc, &sizingRect, thickframe );
-                if (hittest == HTCAPTION) OffsetRect( &sizingRect, dx, dy );
+                if (hittest == HTCAPTION || hittest == HTBORDER) OffsetRect( &sizingRect, dx, dy );
                 if (ON_LEFT_BORDER(hittest)) sizingRect.left += dx;
                 else if (ON_RIGHT_BORDER(hittest)) sizingRect.right += dx;
                 if (ON_TOP_BORDER(hittest)) sizingRect.top += dy;
@@ -2902,7 +2902,7 @@ void WINPOS_SysCommandSizeMove( HWND hwnd, WPARAM wParam )
                 capturePoint = pt;
 
                 /* determine the hit location */
-                if (syscommand == SC_SIZE)
+                if (syscommand == SC_SIZE && hittest != HTBORDER)
                 {
                     WPARAM wpSizingHit = 0;
 
diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c
index a16b835424..f4920b802e 100644
--- a/dlls/winex11.drv/window.c
+++ b/dlls/winex11.drv/window.c
@@ -2851,6 +2851,7 @@ LRESULT CDECL X11DRV_SysCommand( HWND hwnd, WPARAM wparam, LPARAM lparam )
         case WMSZ_BOTTOM:      dir = _NET_WM_MOVERESIZE_SIZE_BOTTOM; break;
         case WMSZ_BOTTOMLEFT:  dir = _NET_WM_MOVERESIZE_SIZE_BOTTOMLEFT; break;
         case WMSZ_BOTTOMRIGHT: dir = _NET_WM_MOVERESIZE_SIZE_BOTTOMRIGHT; break;
+        case 9:                dir = _NET_WM_MOVERESIZE_MOVE; break;
         default:               dir = _NET_WM_MOVERESIZE_SIZE_KEYBOARD; break;
         }
         break;




More information about the wine-cvs mailing list