[PATCH 1/2] win32u: Handle sys color brushes in fill_rect.

Jacek Caban wine at gitlab.winehq.org
Mon May 16 07:28:58 CDT 2022


From: Jacek Caban <jacek at codeweavers.com>

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=53004
Signed-off-by: Jacek Caban <jacek at codeweavers.com>
---
 dlls/win32u/defwnd.c         | 2 ++
 dlls/win32u/sysparams.c      | 2 +-
 dlls/win32u/win32u_private.h | 1 +
 3 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/dlls/win32u/defwnd.c b/dlls/win32u/defwnd.c
index 67472246960..27120a96d98 100644
--- a/dlls/win32u/defwnd.c
+++ b/dlls/win32u/defwnd.c
@@ -35,6 +35,8 @@ void fill_rect( HDC dc, const RECT *rect, HBRUSH hbrush )
 {
     HBRUSH prev_brush;
 
+    if (hbrush <= (HBRUSH)(COLOR_MENUBAR + 1)) hbrush = get_sys_color_brush( HandleToULong(hbrush) - 1 );
+
     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 );
diff --git a/dlls/win32u/sysparams.c b/dlls/win32u/sysparams.c
index 114016954aa..5fec4ade0f8 100644
--- a/dlls/win32u/sysparams.c
+++ b/dlls/win32u/sysparams.c
@@ -4506,7 +4506,7 @@ static HBRUSH get_55aa_brush(void)
     return brush_55aa;
 }
 
-static HBRUSH get_sys_color_brush( unsigned int index )
+HBRUSH get_sys_color_brush( unsigned int index )
 {
     if (index == COLOR_55AA_BRUSH) return get_55aa_brush();
     if (index >= ARRAY_SIZE( system_colors )) return 0;
diff --git a/dlls/win32u/win32u_private.h b/dlls/win32u/win32u_private.h
index e459e6df6bd..d02871a6ad1 100644
--- a/dlls/win32u/win32u_private.h
+++ b/dlls/win32u/win32u_private.h
@@ -404,6 +404,7 @@ extern UINT get_monitor_dpi( HMONITOR monitor ) DECLSPEC_HIDDEN;
 extern BOOL get_monitor_info( HMONITOR handle, MONITORINFO *info ) DECLSPEC_HIDDEN;
 extern UINT get_win_monitor_dpi( HWND hwnd ) DECLSPEC_HIDDEN;
 extern RECT get_primary_monitor_rect( UINT dpi ) DECLSPEC_HIDDEN;
+extern HBRUSH get_sys_color_brush( unsigned int index ) DECLSPEC_HIDDEN;
 extern UINT get_system_dpi(void) DECLSPEC_HIDDEN;
 extern int get_system_metrics( int index ) DECLSPEC_HIDDEN;
 extern UINT get_thread_dpi(void) DECLSPEC_HIDDEN;
-- 
GitLab


https://gitlab.winehq.org/wine/wine/-/merge_requests/72



More information about the wine-devel mailing list