Jacek Caban : win32u: Move default WM_ERASEBKGND implementation from user32.
Alexandre Julliard
julliard at winehq.org
Thu May 12 15:55:51 CDT 2022
Module: wine
Branch: master
Commit: 63ce060e5b33ca4b58d508be11af4d3c214fae33
URL: https://source.winehq.org/git/wine.git/?a=commit;h=63ce060e5b33ca4b58d508be11af4d3c214fae33
Author: Jacek Caban <jacek at codeweavers.com>
Date: Wed May 11 21:00:01 2022 +0200
win32u: Move default WM_ERASEBKGND 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 | 19 -------------------
dlls/win32u/defwnd.c | 28 ++++++++++++++++++++++++++++
dlls/win32u/input.c | 9 ---------
dlls/win32u/win32u_private.h | 1 +
4 files changed, 29 insertions(+), 28 deletions(-)
diff --git a/dlls/user32/defwnd.c b/dlls/user32/defwnd.c
index af2b32614bc..74dfa609bbd 100644
--- a/dlls/user32/defwnd.c
+++ b/dlls/user32/defwnd.c
@@ -266,25 +266,6 @@ static LRESULT DEFWND_DefWinProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPa
DEFWND_Print(hwnd, (HDC)wParam, lParam);
return 0;
- case WM_ERASEBKGND:
- case WM_ICONERASEBKGND:
- {
- RECT rect;
- HDC hdc = (HDC)wParam;
- HBRUSH hbr = (HBRUSH)GetClassLongPtrW( hwnd, GCLP_HBRBACKGROUND );
- if (!hbr) return 0;
-
- if (GetClassLongW( hwnd, GCL_STYLE ) & CS_PARENTDC)
- {
- /* can't use GetClipBox with a parent DC or we fill the whole parent */
- GetClientRect( hwnd, &rect );
- DPtoLP( hdc, (LPPOINT)&rect, 2 );
- }
- else GetClipBox( hdc, &rect );
- FillRect( hdc, &rect, hbr );
- return 1;
- }
-
case WM_CTLCOLORMSGBOX:
case WM_CTLCOLOREDIT:
case WM_CTLCOLORLISTBOX:
diff --git a/dlls/win32u/defwnd.c b/dlls/win32u/defwnd.c
index 72d9aa40164..ec9a1685325 100644
--- a/dlls/win32u/defwnd.c
+++ b/dlls/win32u/defwnd.c
@@ -31,6 +31,15 @@
WINE_DEFAULT_DEBUG_CHANNEL(win);
+void fill_rect( HDC dc, const RECT *rect, HBRUSH hbrush )
+{
+ HBRUSH prev_brush;
+
+ prev_brush = NtGdiSelectBrush( dc, hbrush );
+ NtGdiPatBlt( dc, rect->left, rect->top, rect->right - rect->left, rect->bottom - rect->top, PATCOPY );
+ if (prev_brush) NtGdiSelectBrush( dc, prev_brush );
+}
+
/***********************************************************************
* AdjustWindowRectEx (win32u.so)
*/
@@ -310,6 +319,25 @@ LRESULT default_window_proc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam,
result = send_message( get_parent( hwnd ), WM_MOUSEWHEEL, wparam, lparam );
break;
+ case WM_ERASEBKGND:
+ case WM_ICONERASEBKGND:
+ {
+ RECT rect;
+ HDC hdc = (HDC)wparam;
+ HBRUSH hbr = UlongToHandle( get_class_long( hwnd, GCLP_HBRBACKGROUND, FALSE ));
+ if (!hbr) break;
+
+ if (get_class_long( hwnd, GCL_STYLE, FALSE ) & CS_PARENTDC)
+ {
+ /* can't use GetClipBox with a parent DC or we fill the whole parent */
+ get_client_rect( hwnd, &rect );
+ NtGdiTransformPoints( hdc, (POINT *)&rect, (POINT *)&rect, 1, NtGdiDPtoLP );
+ }
+ else NtGdiGetAppClipBox( hdc, &rect );
+ fill_rect( hdc, &rect, hbr );
+ return 1;
+ }
+
case WM_GETDLGCODE:
break;
diff --git a/dlls/win32u/input.c b/dlls/win32u/input.c
index 877e3f1a064..2b196fb5b1d 100644
--- a/dlls/win32u/input.c
+++ b/dlls/win32u/input.c
@@ -1799,15 +1799,6 @@ static void display_caret( HWND hwnd, const RECT *r )
NtUserReleaseDC( hwnd, dc );
}
-static void fill_rect( HDC dc, const RECT *rect, HBRUSH hbrush )
-{
- HBRUSH prev_brush;
-
- prev_brush = NtGdiSelectBrush( dc, hbrush );
- NtGdiPatBlt( dc, rect->left, rect->top, rect->right - rect->left, rect->bottom - rect->top, PATCOPY );
- if (prev_brush) NtGdiSelectBrush( dc, prev_brush );
-}
-
static unsigned int get_caret_registry_timeout(void)
{
char value_buffer[FIELD_OFFSET(KEY_VALUE_PARTIAL_INFORMATION, Data[11 * sizeof(WCHAR)])];
diff --git a/dlls/win32u/win32u_private.h b/dlls/win32u/win32u_private.h
index ea6d67750b4..63eca06ecd6 100644
--- a/dlls/win32u/win32u_private.h
+++ b/dlls/win32u/win32u_private.h
@@ -353,6 +353,7 @@ extern void register_window_surface( struct window_surface *old,
/* defwnd.c */
extern LRESULT default_window_proc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam,
BOOL ansi ) DECLSPEC_HIDDEN;
+extern void fill_rect( HDC dc, const RECT *rect, HBRUSH hbrush ) DECLSPEC_HIDDEN;
/* hook.c */
extern LRESULT call_current_hook( HHOOK hhook, INT code, WPARAM wparam, LPARAM lparam ) DECLSPEC_HIDDEN;
More information about the wine-cvs
mailing list