Jacek Caban : win32u: Move NtUserEndPaint implementation from user32.

Alexandre Julliard julliard at winehq.org
Mon Mar 14 17:47:37 CDT 2022


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Mon Mar 14 11:44:41 2022 +0100

win32u: Move NtUserEndPaint implementation from user32.

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

---

 dlls/user32/button.c         |  2 +-
 dlls/user32/combo.c          |  4 ++--
 dlls/user32/defwnd.c         |  2 +-
 dlls/user32/edit.c           |  2 +-
 dlls/user32/listbox.c        |  2 +-
 dlls/user32/menu.c           |  2 +-
 dlls/user32/painting.c       | 13 -------------
 dlls/user32/scroll.c         |  2 +-
 dlls/user32/static.c         |  2 +-
 dlls/user32/user32.spec      |  2 +-
 dlls/user32/user_main.c      |  1 +
 dlls/win32u/dce.c            | 12 ++++++++++++
 dlls/win32u/gdiobj.c         |  1 +
 dlls/win32u/ntuser_private.h |  1 +
 dlls/win32u/win32u.spec      |  2 +-
 dlls/win32u/win32u_private.h |  1 +
 dlls/win32u/wrappers.c       |  6 ++++++
 include/ntuser.h             |  1 +
 18 files changed, 34 insertions(+), 24 deletions(-)

diff --git a/dlls/user32/button.c b/dlls/user32/button.c
index 37b5fe317e1..f4b570126f7 100644
--- a/dlls/user32/button.c
+++ b/dlls/user32/button.c
@@ -253,7 +253,7 @@ LRESULT ButtonWndProc_common(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam,
             (btnPaintFunc[btn_type])( hWnd, hdc, ODA_DRAWENTIRE );
             SetBkMode(hdc, nOldMode); /*  reset painting mode */
         }
-        if ( !wParam ) EndPaint( hWnd, &ps );
+        if (!wParam) NtUserEndPaint( hWnd, &ps );
         break;
     }
 
diff --git a/dlls/user32/combo.c b/dlls/user32/combo.c
index 21de55ad479..7fc75e8038a 100644
--- a/dlls/user32/combo.c
+++ b/dlls/user32/combo.c
@@ -832,8 +832,8 @@ static LRESULT COMBO_Paint(LPHEADCOMBO lphc, HDC hParamDC)
 	SelectObject( hDC, hPrevBrush );
   }
 
-  if( !hParamDC )
-    EndPaint(lphc->self, &ps);
+  if (!hParamDC)
+    NtUserEndPaint( lphc->self, &ps );
 
   return 0;
 }
diff --git a/dlls/user32/defwnd.c b/dlls/user32/defwnd.c
index 9804c3b5418..c4de8928462 100644
--- a/dlls/user32/defwnd.c
+++ b/dlls/user32/defwnd.c
@@ -381,7 +381,7 @@ static LRESULT DEFWND_DefWinProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPa
                         wine_dbgstr_rect(&ps.rcPaint));
                   DrawIcon( hdc, x, y, hIcon );
               }
-              EndPaint( hwnd, &ps );
+              NtUserEndPaint( hwnd, &ps );
             }
             return 0;
         }
diff --git a/dlls/user32/edit.c b/dlls/user32/edit.c
index e56fd85926d..9bbfa2727b2 100644
--- a/dlls/user32/edit.c
+++ b/dlls/user32/edit.c
@@ -3776,7 +3776,7 @@ static void EDIT_WM_Paint(EDITSTATE *es, HDC hdc)
 		SelectObject(dc, old_font);
 
         if (!hdc)
-            EndPaint(es->hwndSelf, &ps);
+            NtUserEndPaint( es->hwndSelf, &ps );
 }
 
 
diff --git a/dlls/user32/listbox.c b/dlls/user32/listbox.c
index 29ed35be331..fedd32711fd 100644
--- a/dlls/user32/listbox.c
+++ b/dlls/user32/listbox.c
@@ -3092,7 +3092,7 @@ LRESULT ListBoxWndProc_common( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam
             PAINTSTRUCT ps;
             HDC hdc = ( wParam ) ? ((HDC)wParam) :  NtUserBeginPaint( descr->self, &ps );
             ret = LISTBOX_Paint( descr, hdc );
-            if( !wParam ) EndPaint( descr->self, &ps );
+            if (!wParam) NtUserEndPaint( descr->self, &ps );
         }
         return ret;
     case WM_SIZE:
diff --git a/dlls/user32/menu.c b/dlls/user32/menu.c
index 430d7ca8402..c0d03d30d0f 100644
--- a/dlls/user32/menu.c
+++ b/dlls/user32/menu.c
@@ -3584,7 +3584,7 @@ LRESULT WINAPI PopupMenuWndProc( HWND hwnd, UINT message, WPARAM wParam, LPARAM
 	    NtUserBeginPaint( hwnd, &ps );
 	    MENU_DrawPopupMenu( hwnd, ps.hdc,
                                 (HMENU)GetWindowLongPtrW( hwnd, 0 ) );
-	    EndPaint( hwnd, &ps );
+            NtUserEndPaint( hwnd, &ps );
             return 0;
 	}
 
diff --git a/dlls/user32/painting.c b/dlls/user32/painting.c
index 3cc1f802abd..218f57f1670 100644
--- a/dlls/user32/painting.c
+++ b/dlls/user32/painting.c
@@ -550,19 +550,6 @@ static HWND fix_caret(HWND hWnd, const RECT *scroll_rect, INT dx, INT dy,
 }
 
 
-/***********************************************************************
- *		EndPaint (USER32.@)
- */
-BOOL WINAPI EndPaint( HWND hwnd, const PAINTSTRUCT *lps )
-{
-    ShowCaret( hwnd );
-    flush_window_surfaces( FALSE );
-    if (!lps) return FALSE;
-    release_dc( hwnd, lps->hdc, TRUE );
-    return TRUE;
-}
-
-
 /***********************************************************************
  *		GetDC (USER32.@)
  *
diff --git a/dlls/user32/scroll.c b/dlls/user32/scroll.c
index 090d0bc1c7e..f1b5da5165f 100644
--- a/dlls/user32/scroll.c
+++ b/dlls/user32/scroll.c
@@ -1523,7 +1523,7 @@ LRESULT WINAPI USER_ScrollBarProc( HWND hwnd, UINT message, WPARAM wParam, LPARA
             PAINTSTRUCT ps;
             HDC hdc = wParam ? (HDC)wParam : NtUserBeginPaint( hwnd, &ps );
             SCROLL_DrawScrollBar( hwnd, hdc, SB_CTL, g_tracking_info.hit_test, &g_tracking_info, TRUE, TRUE );
-            if (!wParam) EndPaint(hwnd, &ps);
+            if (!wParam) NtUserEndPaint( hwnd, &ps );
         }
         break;
 
diff --git a/dlls/user32/static.c b/dlls/user32/static.c
index 88ccb83c687..013e5c20312 100644
--- a/dlls/user32/static.c
+++ b/dlls/user32/static.c
@@ -385,7 +385,7 @@ LRESULT StaticWndProc_common( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam
                 (staticPaintFunc[style])( hwnd, hdc, hbrush, full_style );
             SelectClipRgn( hdc, hrgn );
             if (hrgn) DeleteObject( hrgn );
-            if (!wParam) EndPaint(hwnd, &ps);
+            if (!wParam) NtUserEndPaint( hwnd, &ps );
         }
         break;
 
diff --git a/dlls/user32/user32.spec b/dlls/user32/user32.spec
index 00decbbfade..8b339f7bfac 100644
--- a/dlls/user32/user32.spec
+++ b/dlls/user32/user32.spec
@@ -211,7 +211,7 @@
 @ stdcall EndDeferWindowPos(long)
 @ stdcall EndDialog(long long)
 @ stdcall EndMenu()
-@ stdcall EndPaint(long ptr)
+@ stdcall EndPaint(long ptr) NtUserEndPaint
 @ stub EndTask
 # @ stub EnterReaderModeHelper
 @ stdcall EnumChildWindows(long ptr long)
diff --git a/dlls/user32/user_main.c b/dlls/user32/user_main.c
index d1d7a7ef1b2..1b4e8833a89 100644
--- a/dlls/user32/user_main.c
+++ b/dlls/user32/user_main.c
@@ -151,6 +151,7 @@ static const struct user_callbacks user_funcs =
     SendMessageW,
     SendNotifyMessageW,
     SetWindowPos,
+    ShowCaret,
     WaitForInputIdle,
     notify_ime,
     register_builtin_classes,
diff --git a/dlls/win32u/dce.c b/dlls/win32u/dce.c
index 5055e909351..218f502f848 100644
--- a/dlls/win32u/dce.c
+++ b/dlls/win32u/dce.c
@@ -926,3 +926,15 @@ HDC WINAPI NtUserBeginPaint( HWND hwnd, PAINTSTRUCT *ps )
     ps->hdc = hdc;
     return hdc;
 }
+
+/***********************************************************************
+ *           NtUserEndPaint (win32u.@)
+ */
+BOOL WINAPI NtUserEndPaint( HWND hwnd, const PAINTSTRUCT *ps )
+{
+    if (user_callbacks) user_callbacks->pShowCaret( hwnd );
+    flush_window_surfaces( FALSE );
+    if (!ps) return FALSE;
+    release_dc( hwnd, ps->hdc, TRUE );
+    return TRUE;
+}
diff --git a/dlls/win32u/gdiobj.c b/dlls/win32u/gdiobj.c
index a186c05a7cf..68cde8936a3 100644
--- a/dlls/win32u/gdiobj.c
+++ b/dlls/win32u/gdiobj.c
@@ -1162,6 +1162,7 @@ static struct unix_funcs unix_funcs =
     NtUserCountClipboardFormats,
     NtUserDestroyCursor,
     NtUserDrawIconEx,
+    NtUserEndPaint,
     NtUserEnumDisplayDevices,
     NtUserEnumDisplayMonitors,
     NtUserEnumDisplaySettings,
diff --git a/dlls/win32u/ntuser_private.h b/dlls/win32u/ntuser_private.h
index b870d0d0bcd..0e73be6fcd0 100644
--- a/dlls/win32u/ntuser_private.h
+++ b/dlls/win32u/ntuser_private.h
@@ -38,6 +38,7 @@ struct user_callbacks
     LRESULT (WINAPI *pSendMessageW)( HWND, UINT, WPARAM, LPARAM );
     BOOL (WINAPI *pSendNotifyMessageW)( HWND, UINT, WPARAM, LPARAM );
     BOOL (WINAPI *pSetWindowPos)( HWND, HWND, INT, INT, INT, INT, UINT );
+    BOOL (WINAPI *pShowCaret)( HWND hwnd );
     DWORD (WINAPI *pWaitForInputIdle)( HANDLE, DWORD );
     void (CDECL *notify_ime)( HWND hwnd, UINT param );
     void (CDECL *register_builtin_classes)(void);
diff --git a/dlls/win32u/win32u.spec b/dlls/win32u/win32u.spec
index 1c1cb19ae94..ad24113adff 100644
--- a/dlls/win32u/win32u.spec
+++ b/dlls/win32u/win32u.spec
@@ -874,7 +874,7 @@
 @ stub NtUserEnableWindowResizeOptimization
 @ stub NtUserEndDeferWindowPosEx
 @ stub NtUserEndMenu
-@ stub NtUserEndPaint
+@ stdcall NtUserEndPaint(long ptr)
 @ stdcall NtUserEnumDisplayDevices(ptr long ptr long)
 @ stdcall NtUserEnumDisplayMonitors(long ptr ptr long)
 @ stdcall NtUserEnumDisplaySettings(ptr long ptr long)
diff --git a/dlls/win32u/win32u_private.h b/dlls/win32u/win32u_private.h
index 6350813037c..b67a90c26c7 100644
--- a/dlls/win32u/win32u_private.h
+++ b/dlls/win32u/win32u_private.h
@@ -198,6 +198,7 @@ struct unix_funcs
     BOOL     (WINAPI *pNtUserDestroyCursor)( HCURSOR cursor, ULONG arg );
     BOOL     (WINAPI *pNtUserDrawIconEx)( HDC hdc, INT x0, INT y0, HICON icon, INT width,
                                           INT height, UINT istep, HBRUSH hbr, UINT flags );
+    BOOL     (WINAPI *pNtUserEndPaint)( HWND hwnd, const PAINTSTRUCT *ps );
     NTSTATUS (WINAPI *pNtUserEnumDisplayDevices)( UNICODE_STRING *device, DWORD index,
                                                   DISPLAY_DEVICEW *info, DWORD flags );
     BOOL     (WINAPI *pNtUserEnumDisplayMonitors)( HDC hdc, RECT *rect, MONITORENUMPROC proc, LPARAM lp );
diff --git a/dlls/win32u/wrappers.c b/dlls/win32u/wrappers.c
index a69e81e8e10..40100c7cde2 100644
--- a/dlls/win32u/wrappers.c
+++ b/dlls/win32u/wrappers.c
@@ -149,6 +149,12 @@ INT WINAPI NtGdiEndPage( HDC hdc )
     return unix_funcs->pNtGdiEndPage( hdc );
 }
 
+BOOL WINAPI NtUserEndPaint( HWND hwnd, const PAINTSTRUCT *ps )
+{
+    if (!unix_funcs) return FALSE;
+    return unix_funcs->pNtUserEndPaint( hwnd, ps );
+}
+
 BOOL WINAPI NtGdiEnumFonts( HDC hdc, ULONG type, ULONG win32_compat, ULONG face_name_len,
                             const WCHAR *face_name, ULONG charset, ULONG *count, void *buf )
 {
diff --git a/include/ntuser.h b/include/ntuser.h
index 455d81a10fb..e27ef262403 100644
--- a/include/ntuser.h
+++ b/include/ntuser.h
@@ -297,6 +297,7 @@ BOOL    WINAPI NtUserDestroyAcceleratorTable( HACCEL handle );
 BOOL    WINAPI NtUserDestroyCursor( HCURSOR cursor, ULONG arg );
 BOOL    WINAPI NtUserDrawIconEx( HDC hdc, INT x0, INT y0, HICON icon, INT width,
                                  INT height, UINT istep, HBRUSH hbr, UINT flags );
+BOOL    WINAPI NtUserEndPaint( HWND hwnd, const PAINTSTRUCT *ps );
 NTSTATUS WINAPI NtUserEnumDisplayDevices( UNICODE_STRING *device, DWORD index,
                                           DISPLAY_DEVICEW *info, DWORD flags );
 BOOL    WINAPI NtUserEnumDisplayMonitors( HDC hdc, RECT *rect, MONITORENUMPROC proc, LPARAM lp );




More information about the wine-cvs mailing list