From: Jacek Caban jacek@codeweavers.com
Signed-off-by: Jacek Caban jacek@codeweavers.com --- dlls/user32/defwnd.c | 12 ------------ dlls/win32u/defwnd.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+), 12 deletions(-)
diff --git a/dlls/user32/defwnd.c b/dlls/user32/defwnd.c index c40d2ebedab..be41f6c47a0 100644 --- a/dlls/user32/defwnd.c +++ b/dlls/user32/defwnd.c @@ -161,18 +161,6 @@ static LRESULT DEFWND_DefWinProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPa DEFWND_Print(hwnd, (HDC)wParam, lParam); return 0;
- case WM_CTLCOLORMSGBOX: - case WM_CTLCOLOREDIT: - case WM_CTLCOLORLISTBOX: - case WM_CTLCOLORBTN: - case WM_CTLCOLORDLG: - case WM_CTLCOLORSTATIC: - case WM_CTLCOLORSCROLLBAR: - return (LRESULT)DEFWND_ControlColor( (HDC)wParam, msg - WM_CTLCOLORMSGBOX ); - - case WM_CTLCOLOR: - return (LRESULT)DEFWND_ControlColor( (HDC)wParam, HIWORD(lParam) ); - case WM_SYSCOMMAND: return NC_HandleSysCommand( hwnd, wParam, lParam );
diff --git a/dlls/win32u/defwnd.c b/dlls/win32u/defwnd.c index e367a769401..506ff0f9fd9 100644 --- a/dlls/win32u/defwnd.c +++ b/dlls/win32u/defwnd.c @@ -2261,6 +2261,38 @@ static LRESULT handle_nc_button_dbl_click( HWND hwnd, WPARAM wparam, LPARAM lpar return 0; }
+static HBRUSH handle_control_color( HDC hdc, UINT type ) +{ + if (type == CTLCOLOR_SCROLLBAR) + { + HBRUSH hb = get_sys_color_brush( COLOR_SCROLLBAR ); + COLORREF bk = get_sys_color( COLOR_3DHILIGHT ); + NtGdiGetAndSetDCDword( hdc, NtGdiSetTextColor, get_sys_color( COLOR_3DFACE ), NULL ); + NtGdiGetAndSetDCDword( hdc, NtGdiSetBkColor, bk, NULL ); + + /* if COLOR_WINDOW happens to be the same as COLOR_3DHILIGHT + * we better use 0x55aa bitmap brush to make scrollbar's background + * look different from the window background. + */ + if (bk == get_sys_color( COLOR_WINDOW )) return get_55aa_brush(); + + NtGdiUnrealizeObject( hb ); + return hb; + } + + NtGdiGetAndSetDCDword( hdc, NtGdiSetTextColor, get_sys_color( COLOR_WINDOWTEXT ), NULL ); + + if (type == CTLCOLOR_EDIT || type == CTLCOLOR_LISTBOX) + NtGdiGetAndSetDCDword( hdc, NtGdiSetBkColor, get_sys_color( COLOR_WINDOW ), NULL ); + else + { + NtGdiGetAndSetDCDword( hdc, NtGdiSetBkColor, get_sys_color( COLOR_3DFACE ), NULL); + return get_sys_color_brush( COLOR_3DFACE ); + } + + return get_sys_color_brush( COLOR_WINDOW ); +} + LRESULT default_window_proc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam, BOOL ansi ) { LRESULT result = 0; @@ -2474,6 +2506,18 @@ LRESULT default_window_proc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam, handle_set_cursor( hwnd, wparam, lparam ); break;
+ case WM_CTLCOLORMSGBOX: + case WM_CTLCOLOREDIT: + case WM_CTLCOLORLISTBOX: + case WM_CTLCOLORBTN: + case WM_CTLCOLORDLG: + case WM_CTLCOLORSTATIC: + case WM_CTLCOLORSCROLLBAR: + return (LRESULT)handle_control_color( (HDC)wparam, msg - WM_CTLCOLORMSGBOX ); + + case WM_CTLCOLOR: + return (LRESULT)handle_control_color( (HDC)wparam, HIWORD( lparam )); + case WM_SYSCOMMAND: result = handle_sys_command( hwnd, wparam, lparam ); break;