From 8311cfe2171fd5b9d231bfe03656bb99e33711d6 Mon Sep 17 00:00:00 2001 From: Rafal Harabien Date: Sun, 1 May 2011 12:49:38 +0000 Subject: [PATCH] [COMCTL32] * Sync Rebar to Wine 1.3.19 * Properly support WM_SYSCOLORCHANGE in Rebars * Update comctl32_ros.diff svn path=/trunk/; revision=51522 --- reactos/dll/win32/comctl32/comctl32_ros.diff | 74 +++++++++++++++++++- reactos/dll/win32/comctl32/listview.c | 2 +- reactos/dll/win32/comctl32/rebar.c | 39 +++-------- 3 files changed, 84 insertions(+), 31 deletions(-) diff --git a/reactos/dll/win32/comctl32/comctl32_ros.diff b/reactos/dll/win32/comctl32/comctl32_ros.diff index 079c5972367..d15da082250 100644 --- a/reactos/dll/win32/comctl32/comctl32_ros.diff +++ b/reactos/dll/win32/comctl32/comctl32_ros.diff @@ -143,7 +143,15 @@ Index: listview.c =================================================================== --- listview.c (revision 51320) +++ listview.c (working copy) -@@ -1634,8 +1635,19 @@ +@@ -315,6 +315,7 @@ + COLORREF clrBk; + COLORREF clrText; + COLORREF clrTextBk; ++ BOOL bDefaultBkColor; + + /* font */ + HFONT hDefaultFont; +@@ -1635,8 +1636,19 @@ /* used to handle collapse main item column case */ static inline BOOL LISTVIEW_DrawFocusRect(const LISTVIEW_INFO *infoPtr, HDC hdc) { @@ -165,7 +173,7 @@ Index: listview.c } /* Listview invalidation functions: use _only_ these functions to invalidate */ -@@ -5041,7 +5053,11 @@ +@@ -5042,7 +5054,11 @@ /* Draw marquee rectangle if appropriate */ if (infoPtr->bMarqueeSelect) @@ -177,3 +185,65 @@ Index: listview.c if (cdmode & CDRF_NOTIFYPOSTPAINT) notify_postpaint(infoPtr, &nmlvcd); +@@ -7856,6 +7872,7 @@ + { + TRACE("(clrBk=%x)\n", clrBk); + ++ infoPtr->bDefaultBkColor = FALSE; + if(infoPtr->clrBk != clrBk) { + if (infoPtr->clrBk != CLR_NONE) DeleteObject(infoPtr->hBkBrush); + infoPtr->clrBk = clrBk; +@@ -9248,6 +9265,7 @@ + infoPtr->clrText = CLR_DEFAULT; + infoPtr->clrTextBk = CLR_DEFAULT; + LISTVIEW_SetBkColor(infoPtr, comctl32_color.clrWindow); ++ infoPtr->bDefaultBkColor = TRUE; + + /* set default values */ + infoPtr->nFocusedItem = -1; +@@ -11510,6 +11528,11 @@ + + case WM_SYSCOLORCHANGE: + COMCTL32_RefreshSysColors(); ++ if (infoPtr->bDefaultBkColor) ++ { ++ LISTVIEW_SetBkColor(infoPtr, comctl32_color.clrWindow); ++ infoPtr->bDefaultBkColor = TRUE; ++ } + return 0; + + /* case WM_TIMER: */ +Index: rebar.c +=================================================================== +--- rebar.c (revision 51320) ++++ rebar.c (working copy) +@@ -51,7 +51,6 @@ + * - WM_QUERYNEWPALETTE + * - WM_RBUTTONDOWN + * - WM_RBUTTONUP +- * - WM_SYSCOLORCHANGE + * - WM_VKEYTOITEM + * - WM_WININICHANGE + * Notifications: +@@ -2540,10 +2539,8 @@ + + /* initialize band */ + memset(lpBand, 0, sizeof(*lpBand)); +- lpBand->clrFore = infoPtr->clrText == CLR_NONE ? infoPtr->clrBtnText : +- infoPtr->clrText; +- lpBand->clrBack = infoPtr->clrBk == CLR_NONE ? infoPtr->clrBtnFace : +- infoPtr->clrBk; ++ lpBand->clrFore = infoPtr->clrText; ++ lpBand->clrBack = infoPtr->clrBk; + lpBand->iImage = -1; + + REBAR_CommonSetupBand(infoPtr->hwndSelf, lprbbi, lpBand); +@@ -3793,6 +3790,8 @@ + + case WM_SYSCOLORCHANGE: + COMCTL32_RefreshSysColors(); ++ infoPtr->clrBtnText = comctl32_color.clrBtnText; ++ infoPtr->clrBtnFace = comctl32_color.clrBtnFace; + return 0; + + /* case WM_VKEYTOITEM: supported according to ControlSpy */ diff --git a/reactos/dll/win32/comctl32/listview.c b/reactos/dll/win32/comctl32/listview.c index 1a1d837ca3b..d6da12d5a0a 100644 --- a/reactos/dll/win32/comctl32/listview.c +++ b/reactos/dll/win32/comctl32/listview.c @@ -7871,7 +7871,7 @@ static BOOL LISTVIEW_Scroll(LISTVIEW_INFO *infoPtr, INT dx, INT dy) static BOOL LISTVIEW_SetBkColor(LISTVIEW_INFO *infoPtr, COLORREF clrBk) { TRACE("(clrBk=%x)\n", clrBk); - + infoPtr->bDefaultBkColor = FALSE; if(infoPtr->clrBk != clrBk) { if (infoPtr->clrBk != CLR_NONE) DeleteObject(infoPtr->hBkBrush); diff --git a/reactos/dll/win32/comctl32/rebar.c b/reactos/dll/win32/comctl32/rebar.c index 8e9c38b7a79..d5771064883 100644 --- a/reactos/dll/win32/comctl32/rebar.c +++ b/reactos/dll/win32/comctl32/rebar.c @@ -51,7 +51,6 @@ * - WM_QUERYNEWPALETTE * - WM_RBUTTONDOWN * - WM_RBUTTONUP - * - WM_SYSCOLORCHANGE * - WM_VKEYTOITEM * - WM_WININICHANGE * Notifications: @@ -1524,9 +1523,10 @@ REBAR_SizeToHeight(REBAR_INFO *infoPtr, int height) for (i = prev_visible(infoPtr, infoPtr->uNumBands); i > 0; i = prev_visible(infoPtr, i)) { REBAR_BAND *lpBand = REBAR_GetBand(infoPtr, i); - int height = lpBand->rcBand.bottom - lpBand->rcBand.top; int cyBreakExtra; /* additional cy for the rebar after a RBBS_BREAK on this band */ + height = lpBand->rcBand.bottom - lpBand->rcBand.top; + if (infoPtr->dwStyle & RBS_VARHEIGHT) cyBreakExtra = lpBand->cyRowSoFar; /* 'height' => 'lpBand->cyRowSoFar' + 'height'*/ else @@ -1846,8 +1846,7 @@ REBAR_CommonSetupBand(HWND hwnd, const REBARBANDINFOW *lprbbi, REBAR_BAND *lpBan return uChanged; } -static LRESULT -REBAR_InternalEraseBkGnd (const REBAR_INFO *infoPtr, HDC hdc, const RECT *clip) +static LRESULT REBAR_EraseBkGnd (const REBAR_INFO *infoPtr, HDC hdc) /* Function: This erases the background rectangle by drawing */ /* each band with its background color (or the default) and */ /* draws each bands right separator if necessary. The row */ @@ -1950,14 +1949,10 @@ REBAR_InternalEraseBkGnd (const REBAR_INFO *infoPtr, HDC hdc, const RECT *clip) else { old = SetBkColor (hdc, new); - TRACE("%s background color=0x%06x, band (%d,%d)-(%d,%d), clip (%d,%d)-(%d,%d)\n", + TRACE("%s background color=0x%06x, band %s\n", (lpBand->clrBack == CLR_NONE) ? "none" : ((lpBand->clrBack == CLR_DEFAULT) ? "dft" : ""), - GetBkColor(hdc), - rcBand.left,rcBand.top, - rcBand.right,rcBand.bottom, - clip->left, clip->top, - clip->right, clip->bottom); + GetBkColor(hdc), wine_dbgstr_rect(&rcBand)); ExtTextOutW (hdc, 0, 0, ETO_OPAQUE, &rcBand, NULL, 0, 0); if (lpBand->clrBack != CLR_NONE) SetBkColor (hdc, old); @@ -2120,7 +2115,7 @@ REBAR_HandleUDDrag (REBAR_INFO *infoPtr, const POINT *ptsmove) REBAR_BAND *hitBand, *rowBeginBand; if(infoPtr->uNumBands <= 0) - ERR("There are no bands in this rebar"); + ERR("There are no bands in this rebar\n"); /* Up/down dragging can only occur when there is more than one * band in the rebar */ @@ -2544,10 +2539,8 @@ REBAR_InsertBandT(REBAR_INFO *infoPtr, INT iIndex, const REBARBANDINFOW *lprbbi, /* initialize band */ memset(lpBand, 0, sizeof(*lpBand)); - lpBand->clrFore = infoPtr->clrText == CLR_NONE ? infoPtr->clrBtnText : - infoPtr->clrText; - lpBand->clrBack = infoPtr->clrBk == CLR_NONE ? infoPtr->clrBtnFace : - infoPtr->clrBk; + lpBand->clrFore = infoPtr->clrText; + lpBand->clrBack = infoPtr->clrBk; lpBand->iImage = -1; REBAR_CommonSetupBand(infoPtr->hwndSelf, lprbbi, lpBand); @@ -3000,18 +2993,6 @@ REBAR_Destroy (REBAR_INFO *infoPtr) return 0; } - -static LRESULT -REBAR_EraseBkGnd (const REBAR_INFO *infoPtr, HDC hdc) -{ - RECT cliprect; - - if (GetClipBox ( hdc, &cliprect)) - return REBAR_InternalEraseBkGnd (infoPtr, hdc, &cliprect); - return 0; -} - - static LRESULT REBAR_GetFont (const REBAR_INFO *infoPtr) { @@ -3454,7 +3435,7 @@ REBAR_Paint (const REBAR_INFO *infoPtr, HDC hdc) TRACE("painting (%s)\n", wine_dbgstr_rect(&ps.rcPaint)); if (ps.fErase) { /* Erase area of paint if requested */ - REBAR_InternalEraseBkGnd (infoPtr, hdc, &ps.rcPaint); + REBAR_EraseBkGnd (infoPtr, hdc); } REBAR_Refresh (infoPtr, hdc); EndPaint (infoPtr->hwndSelf, &ps); @@ -3809,6 +3790,8 @@ REBAR_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) case WM_SYSCOLORCHANGE: COMCTL32_RefreshSysColors(); + infoPtr->clrBtnText = comctl32_color.clrBtnText; + infoPtr->clrBtnFace = comctl32_color.clrBtnFace; return 0; /* case WM_VKEYTOITEM: supported according to ControlSpy */