Zhiyi Zhang : comctl32/listbox: Actually draw themed frame.

Alexandre Julliard julliard at winehq.org
Mon Mar 1 15:54:04 CST 2021


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

Author: Zhiyi Zhang <zzhang at codeweavers.com>
Date:   Mon Mar  1 11:09:40 2021 +0800

comctl32/listbox: Actually draw themed frame.

Previously, LISTBOX_NCPaint() is called and themed frame is drawn. And then DefWindowProcW() is
called with original clip region, overwriting the drawn themed frame.

Signed-off-by: Zhiyi Zhang <zzhang at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/comctl32/listbox.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/dlls/comctl32/listbox.c b/dlls/comctl32/listbox.c
index b905beee325..137b08ce678 100644
--- a/dlls/comctl32/listbox.c
+++ b/dlls/comctl32/listbox.c
@@ -1186,7 +1186,7 @@ static LRESULT LISTBOX_Paint( LB_DESCR *descr, HDC hdc )
     return 0;
 }
 
-static void LISTBOX_NCPaint( LB_DESCR *descr, HRGN region )
+static LRESULT LISTBOX_NCPaint( LB_DESCR *descr, HRGN region )
 {
     DWORD exstyle = GetWindowLongW( descr->self, GWL_EXSTYLE);
     HTHEME theme = GetWindowTheme( descr->self );
@@ -1196,7 +1196,7 @@ static void LISTBOX_NCPaint( LB_DESCR *descr, HRGN region )
     RECT r;
 
     if (!theme || !(exstyle & WS_EX_CLIENTEDGE))
-        return;
+        return DefWindowProcW(descr->self, WM_NCPAINT, (WPARAM)region, 0);
 
     cxEdge = GetSystemMetrics(SM_CXEDGE);
     cyEdge = GetSystemMetrics(SM_CYEDGE);
@@ -1217,6 +1217,11 @@ static void LISTBOX_NCPaint( LB_DESCR *descr, HRGN region )
         DrawThemeParentBackground(descr->self, hdc, &r);
     DrawThemeBackground (theme, hdc, 0, 0, &r, 0);
     ReleaseDC(descr->self, hdc);
+
+    /* Call default proc to get the scrollbars etc. also painted */
+    DefWindowProcW(descr->self, WM_NCPAINT, (WPARAM)cliprgn, 0);
+    DeleteObject(cliprgn);
+    return 0;
 }
 
 /***********************************************************************
@@ -2976,8 +2981,7 @@ static LRESULT CALLBACK LISTBOX_WindowProc( HWND hwnd, UINT msg, WPARAM wParam,
         return ret;
 
     case WM_NCPAINT:
-        LISTBOX_NCPaint( descr, (HRGN)wParam );
-        break;
+        return LISTBOX_NCPaint( descr, (HRGN)wParam );
 
     case WM_SIZE:
         LISTBOX_UpdateSize( descr );




More information about the wine-cvs mailing list