Dmitry Timoshkov : user32: DefWindowProc(WM_NCCALCSIZE) should return 0.

Alexandre Julliard julliard at winehq.org
Thu Feb 10 16:10:31 CST 2022


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

Author: Dmitry Timoshkov <dmitry at baikal.ru>
Date:   Thu Feb 10 15:26:46 2022 +0300

user32: DefWindowProc(WM_NCCALCSIZE) should return 0.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=37609
Signed-off-by: Dmitry Timoshkov <dmitry at baikal.ru>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/user32/controls.h  |  2 +-
 dlls/user32/defwnd.c    |  3 ++-
 dlls/user32/nonclient.c | 10 ++--------
 dlls/user32/tests/win.c |  6 ------
 4 files changed, 5 insertions(+), 16 deletions(-)

diff --git a/dlls/user32/controls.h b/dlls/user32/controls.h
index ce14d13171f..52584748768 100644
--- a/dlls/user32/controls.h
+++ b/dlls/user32/controls.h
@@ -168,7 +168,7 @@ extern void MENU_EndMenu(HWND) DECLSPEC_HIDDEN;
 /* nonclient area */
 extern LRESULT NC_HandleNCPaint( HWND hwnd , HRGN clip) DECLSPEC_HIDDEN;
 extern LRESULT NC_HandleNCActivate( HWND hwnd, WPARAM wParam, LPARAM lParam ) DECLSPEC_HIDDEN;
-extern LRESULT NC_HandleNCCalcSize( HWND hwnd, WPARAM wParam, RECT *winRect ) DECLSPEC_HIDDEN;
+extern void NC_HandleNCCalcSize( HWND hwnd, WPARAM wParam, RECT *winRect ) DECLSPEC_HIDDEN;
 extern LRESULT NC_HandleNCHitTest( HWND hwnd, POINT pt ) DECLSPEC_HIDDEN;
 extern LRESULT NC_HandleNCLButtonDown( HWND hwnd, WPARAM wParam, LPARAM lParam ) DECLSPEC_HIDDEN;
 extern LRESULT NC_HandleNCMouseMove( HWND hwnd, WPARAM wParam, LPARAM lParam ) DECLSPEC_HIDDEN;
diff --git a/dlls/user32/defwnd.c b/dlls/user32/defwnd.c
index abb73e73ca8..a8978c2d847 100644
--- a/dlls/user32/defwnd.c
+++ b/dlls/user32/defwnd.c
@@ -260,7 +260,8 @@ static LRESULT DEFWND_DefWinProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPa
         }
 
     case WM_NCCALCSIZE:
-        return NC_HandleNCCalcSize( hwnd, wParam, (RECT *)lParam );
+        NC_HandleNCCalcSize( hwnd, wParam, (RECT *)lParam );
+        break;
 
     case WM_WINDOWPOSCHANGING:
         return WINPOS_HandleWindowPosChanging( hwnd, (WINDOWPOS *)lParam );
diff --git a/dlls/user32/nonclient.c b/dlls/user32/nonclient.c
index a9768defa3c..8bb1b9a81a1 100644
--- a/dlls/user32/nonclient.c
+++ b/dlls/user32/nonclient.c
@@ -346,19 +346,14 @@ BOOL WINAPI DECLSPEC_HOTPATCH AdjustWindowRectExForDpi( LPRECT rect, DWORD style
  *
  * Handle a WM_NCCALCSIZE message. Called from DefWindowProc().
  */
-LRESULT NC_HandleNCCalcSize( HWND hwnd, WPARAM wparam, RECT *winRect )
+void NC_HandleNCCalcSize( HWND hwnd, WPARAM wparam, RECT *winRect )
 {
     RECT tmpRect = { 0, 0, 0, 0 };
-    LRESULT result = 0;
-    LONG cls_style = GetClassLongW(hwnd, GCL_STYLE);
     LONG style = GetWindowLongW( hwnd, GWL_STYLE );
     LONG exStyle = GetWindowLongW( hwnd, GWL_EXSTYLE );
 
     if (winRect == NULL)
-        return 0;
-
-    if (cls_style & CS_VREDRAW) result |= WVR_VREDRAW;
-    if (cls_style & CS_HREDRAW) result |= WVR_HREDRAW;
+        return;
 
     if (!(style & WS_MINIMIZE))
     {
@@ -413,7 +408,6 @@ LRESULT NC_HandleNCCalcSize( HWND hwnd, WPARAM wparam, RECT *winRect )
         winRect->right = winRect->left;
         winRect->bottom = winRect->top;
     }
-    return result;
 }
 
 
diff --git a/dlls/user32/tests/win.c b/dlls/user32/tests/win.c
index e1d9c8cfcd4..d6087873f21 100644
--- a/dlls/user32/tests/win.c
+++ b/dlls/user32/tests/win.c
@@ -1475,7 +1475,6 @@ static void test_nonclient_area(HWND hwnd)
 
     rc = rc_window;
     ret = DefWindowProcA(hwnd, WM_NCCALCSIZE, 0, (LPARAM)&rc);
-todo_wine_if(ret != 0)
     ok(!ret, "got %08lx\n", ret);
     MapWindowPoints(0, hwnd, (LPPOINT)&rc, 2);
     ok(EqualRect(&rc, &rc_client),
@@ -1494,7 +1493,6 @@ todo_wine_if(ret != 0)
 
     rc = rc_window;
     ret = DefWindowProcA(hwnd, WM_NCCALCSIZE, 0, (LPARAM)&rc);
-todo_wine_if(ret != 0)
     ok(!ret, "got %08lx\n", ret);
     MapWindowPoints(0, hwnd, (LPPOINT)&rc, 2);
     ok(EqualRect(&rc, &rc_client),
@@ -12966,25 +12964,21 @@ static void test_WM_NCCALCSIZE(void)
     params.lppos = &winpos;
 
     ret = SendMessageW(hwnd, WM_NCCALCSIZE, TRUE, (LPARAM)&params);
-todo_wine
     ok(!ret, "got %08lx\n", ret);
     ok(EqualRect(&params.rgrc[0], &client_rect), "got %s\n", wine_dbgstr_rect(&params.rgrc[0]));
 
     params.rgrc[0] = window_rect;
     ret = DefWindowProcA(hwnd, WM_NCCALCSIZE, TRUE, (LPARAM)&params);
-todo_wine
     ok(!ret, "got %08lx\n", ret);
     ok(EqualRect(&params.rgrc[0], &client_rect), "got %s\n", wine_dbgstr_rect(&params.rgrc[0]));
 
     GetWindowRect(hwnd, &window_rect);
     ret = SendMessageW(hwnd, WM_NCCALCSIZE, FALSE, (LPARAM)&window_rect);
-todo_wine
     ok(!ret, "got %08lx\n", ret);
     ok(EqualRect(&window_rect, &client_rect), "got %s\n", wine_dbgstr_rect(&window_rect));
 
     GetWindowRect(hwnd, &window_rect);
     ret = DefWindowProcA(hwnd, WM_NCCALCSIZE, FALSE, (LPARAM)&window_rect);
-todo_wine
     ok(!ret, "got %08lx\n", ret);
     ok(EqualRect(&window_rect, &client_rect), "got %s\n", wine_dbgstr_rect(&window_rect));
 




More information about the wine-cvs mailing list