mirror of
git://source.winehq.org/git/wine.git
synced 2024-11-05 18:01:34 +00:00
comctl32/button: Improve button data layout compatibility.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
52df130d29
commit
733a3ec1b9
2 changed files with 59 additions and 0 deletions
|
@ -90,6 +90,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(button);
|
||||||
typedef struct _BUTTON_INFO
|
typedef struct _BUTTON_INFO
|
||||||
{
|
{
|
||||||
HWND hwnd;
|
HWND hwnd;
|
||||||
|
HWND parent;
|
||||||
LONG state;
|
LONG state;
|
||||||
HFONT font;
|
HFONT font;
|
||||||
WCHAR *note;
|
WCHAR *note;
|
||||||
|
@ -342,6 +343,7 @@ static LRESULT CALLBACK BUTTON_WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, L
|
||||||
infoPtr = heap_alloc_zero( sizeof(*infoPtr) );
|
infoPtr = heap_alloc_zero( sizeof(*infoPtr) );
|
||||||
SetWindowLongPtrW( hWnd, 0, (LONG_PTR)infoPtr );
|
SetWindowLongPtrW( hWnd, 0, (LONG_PTR)infoPtr );
|
||||||
infoPtr->hwnd = hWnd;
|
infoPtr->hwnd = hWnd;
|
||||||
|
infoPtr->parent = GetParent(hWnd);
|
||||||
return DefWindowProcW(hWnd, uMsg, wParam, lParam);
|
return DefWindowProcW(hWnd, uMsg, wParam, lParam);
|
||||||
|
|
||||||
case WM_NCDESTROY:
|
case WM_NCDESTROY:
|
||||||
|
|
|
@ -979,6 +979,62 @@ static void register_parent_class(void)
|
||||||
RegisterClassA(&cls);
|
RegisterClassA(&cls);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void test_button_data(void)
|
||||||
|
{
|
||||||
|
static const DWORD styles[] =
|
||||||
|
{
|
||||||
|
BS_PUSHBUTTON,
|
||||||
|
BS_DEFPUSHBUTTON,
|
||||||
|
BS_CHECKBOX,
|
||||||
|
BS_AUTOCHECKBOX,
|
||||||
|
BS_RADIOBUTTON,
|
||||||
|
BS_3STATE,
|
||||||
|
BS_AUTO3STATE,
|
||||||
|
BS_GROUPBOX,
|
||||||
|
BS_USERBUTTON,
|
||||||
|
BS_AUTORADIOBUTTON,
|
||||||
|
BS_OWNERDRAW,
|
||||||
|
BS_SPLITBUTTON,
|
||||||
|
BS_DEFSPLITBUTTON,
|
||||||
|
BS_COMMANDLINK,
|
||||||
|
BS_DEFCOMMANDLINK,
|
||||||
|
};
|
||||||
|
|
||||||
|
struct button_desc
|
||||||
|
{
|
||||||
|
HWND self;
|
||||||
|
HWND parent;
|
||||||
|
};
|
||||||
|
unsigned int i;
|
||||||
|
HWND parent;
|
||||||
|
|
||||||
|
parent = CreateWindowExA(0, "TestParentClass", "Test parent", WS_OVERLAPPEDWINDOW | WS_VISIBLE,
|
||||||
|
100, 100, 200, 200, 0, 0, 0, NULL);
|
||||||
|
ok(parent != 0, "Failed to create parent window\n");
|
||||||
|
|
||||||
|
for (i = 0; i < ARRAY_SIZE(styles); i++)
|
||||||
|
{
|
||||||
|
struct button_desc *desc;
|
||||||
|
HWND hwnd;
|
||||||
|
|
||||||
|
hwnd = create_button(styles[i], parent);
|
||||||
|
ok(hwnd != NULL, "Failed to create a button.\n");
|
||||||
|
|
||||||
|
desc = (void *)GetWindowLongPtrA(hwnd, 0);
|
||||||
|
ok(desc != NULL, "Expected window data.\n");
|
||||||
|
|
||||||
|
if (desc)
|
||||||
|
{
|
||||||
|
ok(desc->self == hwnd, "Unexpected 'self' field.\n");
|
||||||
|
ok(desc->parent == parent, "Unexpected 'parent' field.\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
DestroyWindow(hwnd);
|
||||||
|
}
|
||||||
|
|
||||||
|
DestroyWindow(parent);
|
||||||
|
}
|
||||||
|
|
||||||
START_TEST(button)
|
START_TEST(button)
|
||||||
{
|
{
|
||||||
ULONG_PTR ctx_cookie;
|
ULONG_PTR ctx_cookie;
|
||||||
|
@ -995,6 +1051,7 @@ START_TEST(button)
|
||||||
test_button_class();
|
test_button_class();
|
||||||
test_button_messages();
|
test_button_messages();
|
||||||
test_note();
|
test_note();
|
||||||
|
test_button_data();
|
||||||
|
|
||||||
unload_v6_module(ctx_cookie, hCtx);
|
unload_v6_module(ctx_cookie, hCtx);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue