mirror of
https://github.com/reactos/reactos.git
synced 2026-06-05 03:02:59 +08:00
[NTUSER][COMCTL32] Fix ListBox background color setting (#8665)
CORE-20433 The brush returned from WM_CTLCOLORLISTBOX message is ignored when painting the background. This bug can be found at https://bugs.winehq.org/show_bug.cgi?id=2948 Fixed by handling backgound painting in LISTBOX_PaintItem and LISTBOX_Paint functions. Patch by @I_Kill_Bugs
This commit is contained in:
@@ -676,6 +676,13 @@ static void LISTBOX_PaintItem( LB_DESCR *descr, HDC hdc, const RECT *rect,
|
||||
oldBk = SetBkColor( hdc, GetSysColor( COLOR_HIGHLIGHT ) );
|
||||
oldText = SetTextColor( hdc, GetSysColor(COLOR_HIGHLIGHTTEXT));
|
||||
}
|
||||
#ifdef __REACTOS__
|
||||
else
|
||||
{
|
||||
HBRUSH br = GetCurrentObject(hdc, OBJ_BRUSH);
|
||||
FillRect(hdc, rect, br);
|
||||
}
|
||||
#endif
|
||||
|
||||
TRACE("[%p]: painting %d (%s) action=%02x rect=%s\n",
|
||||
descr->self, index, debugstr_w(item_str), action,
|
||||
@@ -684,9 +691,24 @@ static void LISTBOX_PaintItem( LB_DESCR *descr, HDC hdc, const RECT *rect,
|
||||
ExtTextOutW( hdc, rect->left + 1, rect->top,
|
||||
ETO_OPAQUE | ETO_CLIPPED, rect, NULL, 0, NULL );
|
||||
else if (!(descr->style & LBS_USETABSTOPS))
|
||||
#ifdef __REACTOS__
|
||||
{
|
||||
RECT rc = *rect;
|
||||
if (!selected)
|
||||
{
|
||||
SIZE sz;
|
||||
GetTextExtentPoint32(hdc, item_str, lstrlenW(item_str), &sz);
|
||||
rc.right = min(sz.cx, rc.right);
|
||||
}
|
||||
ExtTextOutW( hdc, rect->left + 1, rect->top,
|
||||
ETO_OPAQUE | ETO_CLIPPED, &rc, item_str,
|
||||
lstrlenW(item_str), NULL);
|
||||
}
|
||||
#else
|
||||
ExtTextOutW( hdc, rect->left + 1, rect->top,
|
||||
ETO_OPAQUE | ETO_CLIPPED, rect, item_str,
|
||||
lstrlenW(item_str), NULL );
|
||||
#endif
|
||||
else
|
||||
{
|
||||
/* Output empty string to paint background in the full width. */
|
||||
@@ -1173,8 +1195,13 @@ static LRESULT LISTBOX_Paint( LB_DESCR *descr, HDC hdc )
|
||||
if (rect.top < descr->height)
|
||||
{
|
||||
rect.bottom = descr->height;
|
||||
#ifdef __REACTOS__
|
||||
HBRUSH br = GetCurrentObject(hdc, OBJ_BRUSH);
|
||||
FillRect(hdc, &rect, br);
|
||||
#else
|
||||
ExtTextOutW( hdc, 0, 0, ETO_OPAQUE | ETO_CLIPPED,
|
||||
&rect, NULL, 0, NULL );
|
||||
#endif
|
||||
}
|
||||
if (rect.right < descr->width)
|
||||
{
|
||||
@@ -1182,8 +1209,13 @@ static LRESULT LISTBOX_Paint( LB_DESCR *descr, HDC hdc )
|
||||
rect.right = descr->width;
|
||||
rect.top = 0;
|
||||
rect.bottom = descr->height;
|
||||
#ifdef __REACTOS__
|
||||
HBRUSH br = GetCurrentObject(hdc, OBJ_BRUSH);
|
||||
FillRect(hdc, &rect, br);
|
||||
#else
|
||||
ExtTextOutW( hdc, 0, 0, ETO_OPAQUE | ETO_CLIPPED,
|
||||
&rect, NULL, 0, NULL );
|
||||
#endif
|
||||
}
|
||||
}
|
||||
if (oldFont) SelectObject( hdc, oldFont );
|
||||
|
||||
@@ -585,6 +585,13 @@ static void LISTBOX_PaintItem( LB_DESCR *descr, HDC hdc, const RECT *rect,
|
||||
oldBk = SetBkColor( hdc, GetSysColor( COLOR_HIGHLIGHT ) );
|
||||
oldText = SetTextColor( hdc, GetSysColor(COLOR_HIGHLIGHTTEXT));
|
||||
}
|
||||
#ifdef __REACTOS__
|
||||
else
|
||||
{
|
||||
HBRUSH br = GetCurrentObject(hdc, OBJ_BRUSH);
|
||||
FillRect(hdc, rect, br);
|
||||
}
|
||||
#endif
|
||||
|
||||
TRACE("[%p]: painting %d (%s) action=%02x rect=%s\n",
|
||||
descr->self, index, item ? debugstr_w(item->str) : "", action,
|
||||
@@ -593,9 +600,24 @@ static void LISTBOX_PaintItem( LB_DESCR *descr, HDC hdc, const RECT *rect,
|
||||
ExtTextOutW( hdc, rect->left + 1, rect->top,
|
||||
ETO_OPAQUE | ETO_CLIPPED, rect, NULL, 0, NULL );
|
||||
else if (!(descr->style & LBS_USETABSTOPS))
|
||||
#ifdef __REACTOS__
|
||||
{
|
||||
RECT rc = *rect;
|
||||
if (!item->selected)
|
||||
{
|
||||
SIZE sz;
|
||||
GetTextExtentPoint32(hdc, item->str, strlenW(item->str), &sz);
|
||||
rc.right = min(sz.cx, rc.right);
|
||||
}
|
||||
ExtTextOutW( hdc, rect->left + 1, rect->top,
|
||||
ETO_OPAQUE | ETO_CLIPPED, &rc, item->str,
|
||||
strlenW(item->str), NULL);
|
||||
}
|
||||
#else
|
||||
ExtTextOutW( hdc, rect->left + 1, rect->top,
|
||||
ETO_OPAQUE | ETO_CLIPPED, rect, item->str,
|
||||
strlenW(item->str), NULL );
|
||||
#endif
|
||||
else
|
||||
{
|
||||
/* Output empty string to paint background in the full width. */
|
||||
@@ -1119,8 +1141,13 @@ static LRESULT LISTBOX_Paint( LB_DESCR *descr, HDC hdc )
|
||||
if (rect.top < descr->height)
|
||||
{
|
||||
rect.bottom = descr->height;
|
||||
#ifdef __REACTOS__
|
||||
HBRUSH br = GetCurrentObject(hdc, OBJ_BRUSH);
|
||||
FillRect(hdc, &rect, br);
|
||||
#else
|
||||
ExtTextOutW( hdc, 0, 0, ETO_OPAQUE | ETO_CLIPPED,
|
||||
&rect, NULL, 0, NULL );
|
||||
#endif
|
||||
}
|
||||
if (rect.right < descr->width)
|
||||
{
|
||||
@@ -1128,8 +1155,13 @@ static LRESULT LISTBOX_Paint( LB_DESCR *descr, HDC hdc )
|
||||
rect.right = descr->width;
|
||||
rect.top = 0;
|
||||
rect.bottom = descr->height;
|
||||
#ifdef __REACTOS__
|
||||
HBRUSH br = GetCurrentObject(hdc, OBJ_BRUSH);
|
||||
FillRect(hdc, &rect, br);
|
||||
#else
|
||||
ExtTextOutW( hdc, 0, 0, ETO_OPAQUE | ETO_CLIPPED,
|
||||
&rect, NULL, 0, NULL );
|
||||
#endif
|
||||
}
|
||||
}
|
||||
if (oldFont) SelectObject( hdc, oldFont );
|
||||
|
||||
Reference in New Issue
Block a user