Jacek Caban : user32: Inline DEFWND_ControlColor implementation.

Alexandre Julliard julliard at winehq.org
Thu Jul 28 16:01:11 CDT 2022


Module: wine
Branch: master
Commit: cf9e6b3b2281eba68a76e8677d9a36f866178e63
URL:    https://gitlab.winehq.org/wine/wine/-/commit/cf9e6b3b2281eba68a76e8677d9a36f866178e63

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Thu Jul 28 13:18:16 2022 +0200

user32: Inline DEFWND_ControlColor implementation.

---

 dlls/user32/controls.h |  3 ---
 dlls/user32/defwnd.c   | 36 ------------------------------------
 dlls/user32/scroll.c   | 30 +++++++++++++++++++++---------
 3 files changed, 21 insertions(+), 48 deletions(-)

diff --git a/dlls/user32/controls.h b/dlls/user32/controls.h
index 955c9092a54..036d872c43c 100644
--- a/dlls/user32/controls.h
+++ b/dlls/user32/controls.h
@@ -106,9 +106,6 @@ struct tagWND;
 extern ATOM get_int_atom_value( UNICODE_STRING *name ) DECLSPEC_HIDDEN;
 extern void register_desktop_class(void) DECLSPEC_HIDDEN;
 
-/* defwnd proc */
-extern HBRUSH DEFWND_ControlColor( HDC hDC, UINT ctlType ) DECLSPEC_HIDDEN;
-
 /* desktop */
 extern BOOL update_wallpaper( const WCHAR *wallpaper, const WCHAR *pattern ) DECLSPEC_HIDDEN;
 
diff --git a/dlls/user32/defwnd.c b/dlls/user32/defwnd.c
index 9e258e5d3c0..34a4f294429 100644
--- a/dlls/user32/defwnd.c
+++ b/dlls/user32/defwnd.c
@@ -34,42 +34,6 @@
 
 WINE_DEFAULT_DEBUG_CHANNEL(win);
 
-/***********************************************************************
- *           DEFWND_ControlColor
- *
- * Default colors for control painting.
- */
-HBRUSH DEFWND_ControlColor( HDC hDC, UINT ctlType )
-{
-    if( ctlType == CTLCOLOR_SCROLLBAR)
-    {
-        HBRUSH hb = GetSysColorBrush(COLOR_SCROLLBAR);
-        COLORREF bk = GetSysColor(COLOR_3DHILIGHT);
-        SetTextColor( hDC, GetSysColor(COLOR_3DFACE));
-        SetBkColor( hDC, bk);
-
-        /* 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 == GetSysColor(COLOR_WINDOW))
-            return SYSCOLOR_Get55AABrush();
-
-        UnrealizeObject( hb );
-        return hb;
-    }
-
-    SetTextColor( hDC, GetSysColor(COLOR_WINDOWTEXT));
-
-    if ((ctlType == CTLCOLOR_EDIT) || (ctlType == CTLCOLOR_LISTBOX))
-        SetBkColor( hDC, GetSysColor(COLOR_WINDOW) );
-    else {
-        SetBkColor( hDC, GetSysColor(COLOR_3DFACE) );
-        return GetSysColorBrush(COLOR_3DFACE);
-    }
-    return GetSysColorBrush(COLOR_WINDOW);
-}
-
 
 /***********************************************************************
  *              DefWindowProcA (USER32.@)
diff --git a/dlls/user32/scroll.c b/dlls/user32/scroll.c
index 9453df9dedd..9e17424a8de 100644
--- a/dlls/user32/scroll.c
+++ b/dlls/user32/scroll.c
@@ -97,18 +97,30 @@ static void SCROLL_DrawInterior( HWND hwnd, HDC hdc, INT nBar,
     HPEN hSavePen;
     HBRUSH hSaveBrush,hBrush;
 
-      /* Select the correct brush and pen */
-
-    /* Only scrollbar controls send WM_CTLCOLORSCROLLBAR.
-     * The window-owned scrollbars need to call DEFWND_ControlColor
-     * to correctly setup default scrollbar colors
-     */
-    if (nBar == SB_CTL) {
+    if (nBar == SB_CTL)
+    {
         hBrush = (HBRUSH)SendMessageW( GetParent(hwnd), WM_CTLCOLORSCROLLBAR,
                                        (WPARAM)hdc,(LPARAM)hwnd);
-    } else {
-        hBrush = DEFWND_ControlColor( hdc, CTLCOLOR_SCROLLBAR );
     }
+    else
+    {
+        COLORREF bk = GetSysColor( COLOR_3DHILIGHT );
+        SetTextColor( hdc, GetSysColor( COLOR_3DFACE ));
+        SetBkColor( hdc, bk );
+
+        /* 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 == GetSysColor( COLOR_WINDOW ))
+            hBrush = SYSCOLOR_Get55AABrush();
+        else
+        {
+            hBrush = GetSysColorBrush( COLOR_SCROLLBAR );
+            UnrealizeObject( hBrush );
+        }
+    }
+
     hSavePen = SelectObject( hdc, SYSCOLOR_GetPen(COLOR_WINDOWFRAME) );
     hSaveBrush = SelectObject( hdc, hBrush );
 




More information about the wine-cvs mailing list