comctl32/rebar: Do not remove WS_BORDER when theming is on.

Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zhiyi Zhang 2021-10-06 15:48:07 +08:00 committed by Alexandre Julliard
parent a9165162dd
commit 106a5f43ec
2 changed files with 42 additions and 25 deletions

View File

@ -2930,14 +2930,9 @@ REBAR_Create (REBAR_INFO *infoPtr, LPCREATESTRUCTW cs)
cs->x, cs->y, cs->cx, cs->cy);
}
OpenThemeData(infoPtr->hwndSelf, themeClass);
TRACE("created!\n");
if (OpenThemeData (infoPtr->hwndSelf, themeClass))
{
/* native seems to clear WS_BORDER when themed */
infoPtr->dwStyle &= ~WS_BORDER;
}
return 0;
}
@ -3508,8 +3503,6 @@ REBAR_StyleChanged (REBAR_INFO *infoPtr, INT nType, const STYLESTRUCT *lpStyle)
if (nType == GWL_STYLE)
{
infoPtr->orgStyle = infoPtr->dwStyle = lpStyle->styleNew;
if (GetWindowTheme (infoPtr->hwndSelf))
infoPtr->dwStyle &= ~WS_BORDER;
/* maybe it should be COMMON_STYLES like in toolbar */
if ((lpStyle->styleNew ^ lpStyle->styleOld) & CCS_VERT)
REBAR_Layout(infoPtr);
@ -3522,11 +3515,7 @@ static LRESULT theme_changed (REBAR_INFO* infoPtr)
{
HTHEME theme = GetWindowTheme (infoPtr->hwndSelf);
CloseThemeData (theme);
theme = OpenThemeData (infoPtr->hwndSelf, themeClass);
/* WS_BORDER disappears when theming is enabled and reappears when
* disabled... */
infoPtr->dwStyle &= ~WS_BORDER;
infoPtr->dwStyle |= theme ? 0 : (infoPtr->orgStyle & WS_BORDER);
OpenThemeData(infoPtr->hwndSelf, themeClass);
return 0;
}

View File

@ -77,11 +77,11 @@ static void init_system_font_height(void) {
system_font_height = tm.tmHeight;
}
static HWND create_rebar_control(void)
static HWND create_rebar_control(DWORD style)
{
HWND hwnd;
hwnd = CreateWindowA(REBARCLASSNAMEA, NULL, WS_CHILD | WS_VISIBLE, 0, 0, 0, 0,
hwnd = CreateWindowA(REBARCLASSNAMEA, NULL, style | WS_CHILD | WS_VISIBLE, 0, 0, 0, 0,
hMainWnd, (HMENU)17, GetModuleHandleA(NULL), NULL);
ok(hwnd != NULL, "Failed to create Rebar\n");
@ -499,7 +499,7 @@ static void test_layout(void)
rbsize_results_init();
hRebar = create_rebar_control();
hRebar = create_rebar_control(0);
check_sizes();
rbi.cbSize = REBARBANDINFOA_V6_SIZE;
rbi.fMask = RBBIM_SIZE | RBBIM_CHILDSIZE | RBBIM_CHILD;
@ -559,7 +559,7 @@ static void test_layout(void)
DestroyWindow(hRebar);
hRebar = create_rebar_control();
hRebar = create_rebar_control(0);
add_band_w(hRebar, "ABC", 70, 40, 100);
add_band_w(hRebar, NULL, 40, 70, 100);
add_band_w(hRebar, NULL, 170, 240, 100);
@ -602,7 +602,7 @@ static void test_layout(void)
DestroyWindow(hRebar);
/* VARHEIGHT resizing test on a horizontal rebar */
hRebar = create_rebar_control();
hRebar = create_rebar_control(0);
SetWindowLongA(hRebar, GWL_STYLE, GetWindowLongA(hRebar, GWL_STYLE) | RBS_AUTOSIZE);
check_sizes();
rbi.fMask = RBBIM_CHILD | RBBIM_CHILDSIZE | RBBIM_SIZE | RBBIM_STYLE;
@ -630,7 +630,7 @@ static void test_layout(void)
DestroyWindow(hRebar);
/* VARHEIGHT resizing on a vertical rebar */
hRebar = create_rebar_control();
hRebar = create_rebar_control(0);
SetWindowLongA(hRebar, GWL_STYLE, GetWindowLongA(hRebar, GWL_STYLE) | CCS_VERT | RBS_AUTOSIZE);
check_sizes();
rbi.fMask = RBBIM_CHILD | RBBIM_CHILDSIZE | RBBIM_SIZE | RBBIM_STYLE;
@ -661,7 +661,7 @@ static void test_layout(void)
pImageList_Destroy(himl);
/* One hidden band. */
hRebar = create_rebar_control();
hRebar = create_rebar_control(0);
rbi.cbSize = REBARBANDINFOA_V6_SIZE;
rbi.fMask = RBBIM_STYLE | RBBIM_SIZE | RBBIM_CHILDSIZE | RBBIM_CHILD;
@ -966,7 +966,7 @@ static void test_bandinfo(void)
CHAR szABCD[] = "ABCD";
HWND hRebar;
hRebar = create_rebar_control();
hRebar = create_rebar_control(0);
rb.cbSize = REBARBANDINFOA_V6_SIZE;
rb.fMask = 0;
if (!SendMessageA(hRebar, RB_INSERTBANDA, 0, (LPARAM)&rb))
@ -1027,7 +1027,7 @@ static void test_colors(void)
HWND hRebar;
REBARBANDINFOA bi;
hRebar = create_rebar_control();
hRebar = create_rebar_control(0);
/* test default colors */
clr = SendMessageA(hRebar, RB_GETTEXTCOLOR, 0, 0);
@ -1106,7 +1106,7 @@ static void test_showband(void)
REBARBANDINFOA rbi;
BOOL ret;
hRebar = create_rebar_control();
hRebar = create_rebar_control(0);
/* no bands */
ret = SendMessageA(hRebar, RB_SHOWBAND, 0, TRUE);
@ -1135,7 +1135,7 @@ static void test_notification(void)
MEASUREITEMSTRUCT mis;
HWND rebar;
rebar = create_rebar_control();
rebar = create_rebar_control(0);
g_parent_measureitem = 0;
SendMessageA(rebar, WM_MEASUREITEM, 0, (LPARAM)&mis);
@ -1144,6 +1144,33 @@ static void test_notification(void)
DestroyWindow(rebar);
}
static void test_style(void)
{
STYLESTRUCT style_struct;
LONG style;
HWND hwnd;
RECT rect;
/* WS_BORDER */
hwnd = create_rebar_control(WS_BORDER);
ok(GetWindowLongW(hwnd, GWL_STYLE) & WS_BORDER, "Expected WS_BORDER.\n");
GetClientRect(hwnd, &rect);
SendMessageW(hwnd, WM_NCCALCSIZE, 0, (LPARAM)&rect);
ok(GetWindowLongW(hwnd, GWL_STYLE) & WS_BORDER, "Expected WS_BORDER.\n");
SendMessageW(hwnd, WM_THEMECHANGED, 0, 0);
style = GetWindowLongW(hwnd, GWL_STYLE);
ok(style & WS_BORDER, "Expected WS_BORDER.\n");
style_struct.styleOld = style;
style_struct.styleNew = style | WS_DLGFRAME;
SendMessageW(hwnd, WM_STYLECHANGED, (WPARAM)GWL_STYLE, (LPARAM)&style_struct);
ok(GetWindowLongW(hwnd, GWL_STYLE) & WS_BORDER, "Expected WS_BORDER.\n");
DestroyWindow(hwnd);
}
static void init_functions(void)
{
HMODULE hComCtl32 = LoadLibraryA("comctl32.dll");
@ -1176,6 +1203,7 @@ START_TEST(rebar)
test_layout();
test_resize();
test_style();
out:
PostQuitMessage(0);