Jacek Caban : win32u: Move default WM_PAINT implementation from user32.

Alexandre Julliard julliard at winehq.org
Thu May 12 15:55:50 CDT 2022


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Wed May 11 20:39:30 2022 +0200

win32u: Move default WM_PAINT implementation from user32.

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

---

 dlls/user32/defwnd.c | 25 -------------------------
 dlls/win32u/defwnd.c | 26 +++++++++++++++++++++++++-
 2 files changed, 25 insertions(+), 26 deletions(-)

diff --git a/dlls/user32/defwnd.c b/dlls/user32/defwnd.c
index 67cb77a3121..fdb100c9556 100644
--- a/dlls/user32/defwnd.c
+++ b/dlls/user32/defwnd.c
@@ -266,31 +266,6 @@ static LRESULT DEFWND_DefWinProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPa
         DEFWND_Print(hwnd, (HDC)wParam, lParam);
         return 0;
 
-    case WM_PAINTICON:
-    case WM_PAINT:
-        {
-            PAINTSTRUCT ps;
-            HDC hdc = NtUserBeginPaint( hwnd, &ps );
-            if( hdc )
-            {
-              HICON hIcon;
-              if (IsIconic(hwnd) && ((hIcon = (HICON)GetClassLongPtrW( hwnd, GCLP_HICON))) )
-              {
-                  RECT rc;
-                  int x, y;
-
-                  GetClientRect( hwnd, &rc );
-                  x = (rc.right - rc.left - GetSystemMetrics(SM_CXICON))/2;
-                  y = (rc.bottom - rc.top - GetSystemMetrics(SM_CYICON))/2;
-                  TRACE("Painting class icon: vis rect=(%s)\n",
-                        wine_dbgstr_rect(&ps.rcPaint));
-                  DrawIcon( hdc, x, y, hIcon );
-              }
-              NtUserEndPaint( hwnd, &ps );
-            }
-            return 0;
-        }
-
     case WM_SYNCPAINT:
         NtUserRedrawWindow ( hwnd, NULL, 0, RDW_ERASENOW | RDW_ERASE | RDW_ALLCHILDREN );
         return 0;
diff --git a/dlls/win32u/defwnd.c b/dlls/win32u/defwnd.c
index 3aa5a8286b3..c345a6ab188 100644
--- a/dlls/win32u/defwnd.c
+++ b/dlls/win32u/defwnd.c
@@ -243,7 +243,31 @@ LRESULT default_window_proc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam,
             if (user_callbacks) user_callbacks->free_win_ptr( win );
             win->pScroll = NULL;
             release_win_ptr( win );
-            return 0;
+            break;
+        }
+
+    case WM_PAINTICON:
+    case WM_PAINT:
+        {
+            PAINTSTRUCT ps;
+            HDC hdc = NtUserBeginPaint( hwnd, &ps );
+            if (hdc)
+            {
+                HICON icon;
+                if (is_iconic(hwnd) && ((icon = UlongToHandle( get_class_long( hwnd, GCLP_HICON, FALSE )))))
+                {
+                    RECT rc;
+                    int x, y;
+
+                    get_client_rect( hwnd, &rc );
+                    x = (rc.right - rc.left - get_system_metrics( SM_CXICON )) / 2;
+                    y = (rc.bottom - rc.top - get_system_metrics( SM_CYICON )) / 2;
+                    TRACE( "Painting class icon: vis rect=(%s)\n", wine_dbgstr_rect(&ps.rcPaint) );
+                    NtUserDrawIconEx( hdc, x, y, icon, 0, 0, 0, 0, DI_NORMAL | DI_COMPAT | DI_DEFAULTSIZE );
+                }
+                NtUserEndPaint( hwnd, &ps );
+            }
+            break;
         }
 
     case WM_SETTEXT:




More information about the wine-cvs mailing list