wine/dlls/user button.c
Dmitry Timoshkov
dmitry at baikal.ru
Mon Oct 25 23:57:36 CDT 2004
"Dimitrie O. Paun" <dpaun at rogers.com> wrote:
> > The following hunk of the patch below breaks the IE install. You should
> > be able to press Alt-A to accept the license in the first dialog, but
> > with this hunk applied it no longer works.
>
> Thank you, I'll submit a patch later on tonight. It seems the MSDN is
> wrong (oh, the horror!), so I'd guess a test would be nice as well.
The thing is that the old code wasn't entirely correct too.
Here is a test case + fix.
Changelog:
Dmitry Timoshkov <dmitry at codeweavers.com>
Make button return exactly the same dialog codes as Windows does.
Add a test case.
--
Dmitry.
-------------- next part --------------
diff -u cvs/hq/wine/dlls/user/button.c wine/dlls/user/button.c
--- cvs/hq/wine/dlls/user/button.c 2004-10-05 14:26:08.000000000 +0900
+++ wine/dlls/user/button.c 2004-10-26 13:48:03.000000000 +0900
@@ -224,13 +224,12 @@ static LRESULT WINAPI ButtonWndProc_comm
case WM_GETDLGCODE:
switch(btn_type)
{
- case BS_AUTOCHECKBOX: return DLGC_BUTTON | DLGC_WANTCHARS;
- case BS_AUTORADIOBUTTON: return DLGC_RADIOBUTTON;
- case BS_CHECKBOX: return DLGC_BUTTON | DLGC_WANTCHARS;
- case BS_DEFPUSHBUTTON: return DLGC_DEFPUSHBUTTON;
+ case BS_USERBUTTON:
+ case BS_PUSHBUTTON: return DLGC_BUTTON | DLGC_UNDEFPUSHBUTTON;
+ case BS_DEFPUSHBUTTON: return DLGC_BUTTON | DLGC_DEFPUSHBUTTON;
+ case BS_RADIOBUTTON:
+ case BS_AUTORADIOBUTTON: return DLGC_BUTTON | DLGC_RADIOBUTTON;
case BS_GROUPBOX: return DLGC_STATIC;
- case BS_PUSHBUTTON: return DLGC_UNDEFPUSHBUTTON;
- case BS_RADIOBUTTON: return DLGC_RADIOBUTTON;
default: return DLGC_BUTTON;
}
diff -u cvs/hq/wine/dlls/user/tests/msg.c wine/dlls/user/tests/msg.c
--- cvs/hq/wine/dlls/user/tests/msg.c 2004-10-26 10:30:31.000000000 +0900
+++ wine/dlls/user/tests/msg.c 2004-10-26 13:16:16.000000000 +0900
@@ -2643,23 +2643,36 @@ static void test_button_messages(void)
static const struct
{
DWORD style;
+ DWORD dlg_code;
const struct message *setfocus;
const struct message *killfocus;
} button[] = {
- { BS_PUSHBUTTON, WmSetFocusButtonSeq, WmKillFocusButtonSeq },
- { BS_DEFPUSHBUTTON, WmSetFocusButtonSeq, WmKillFocusButtonSeq },
- { BS_CHECKBOX, WmSetFocusStaticSeq, WmKillFocusStaticSeq },
- { BS_AUTOCHECKBOX, WmSetFocusStaticSeq, WmKillFocusStaticSeq },
- { BS_RADIOBUTTON, WmSetFocusStaticSeq, WmKillFocusStaticSeq },
- { BS_3STATE, WmSetFocusStaticSeq, WmKillFocusStaticSeq },
- { BS_AUTO3STATE, WmSetFocusStaticSeq, WmKillFocusStaticSeq },
- { BS_GROUPBOX, WmSetFocusStaticSeq, WmKillFocusStaticSeq },
- { BS_USERBUTTON, WmSetFocusButtonSeq, WmKillFocusButtonSeq },
- { BS_AUTORADIOBUTTON, WmSetFocusStaticSeq, WmKillFocusStaticSeq },
- { BS_OWNERDRAW, WmSetFocusButtonSeq, WmKillFocusButtonSeq }
+ { BS_PUSHBUTTON, DLGC_BUTTON | DLGC_UNDEFPUSHBUTTON,
+ WmSetFocusButtonSeq, WmKillFocusButtonSeq },
+ { BS_DEFPUSHBUTTON, DLGC_BUTTON | DLGC_DEFPUSHBUTTON,
+ WmSetFocusButtonSeq, WmKillFocusButtonSeq },
+ { BS_CHECKBOX, DLGC_BUTTON,
+ WmSetFocusStaticSeq, WmKillFocusStaticSeq },
+ { BS_AUTOCHECKBOX, DLGC_BUTTON,
+ WmSetFocusStaticSeq, WmKillFocusStaticSeq },
+ { BS_RADIOBUTTON, DLGC_BUTTON | DLGC_RADIOBUTTON,
+ WmSetFocusStaticSeq, WmKillFocusStaticSeq },
+ { BS_3STATE, DLGC_BUTTON,
+ WmSetFocusStaticSeq, WmKillFocusStaticSeq },
+ { BS_AUTO3STATE, DLGC_BUTTON,
+ WmSetFocusStaticSeq, WmKillFocusStaticSeq },
+ { BS_GROUPBOX, DLGC_STATIC,
+ WmSetFocusStaticSeq, WmKillFocusStaticSeq },
+ { BS_USERBUTTON, DLGC_BUTTON | DLGC_UNDEFPUSHBUTTON,
+ WmSetFocusButtonSeq, WmKillFocusButtonSeq },
+ { BS_AUTORADIOBUTTON, DLGC_BUTTON | DLGC_RADIOBUTTON,
+ WmSetFocusStaticSeq, WmKillFocusStaticSeq },
+ { BS_OWNERDRAW, DLGC_BUTTON,
+ WmSetFocusButtonSeq, WmKillFocusButtonSeq }
};
unsigned int i;
HWND hwnd;
+ DWORD dlg_code;
subclass_button();
@@ -2669,6 +2682,9 @@ static void test_button_messages(void)
0, 0, 50, 14, 0, 0, 0, NULL);
ok(hwnd != 0, "Failed to create button window\n");
+ dlg_code = SendMessageA(hwnd, WM_GETDLGCODE, 0, 0);
+ ok(dlg_code == button[i].dlg_code, "%d: wrong dlg_code %08lx\n", i, dlg_code);
+
ShowWindow(hwnd, SW_SHOW);
UpdateWindow(hwnd);
SetFocus(0);
@@ -2684,7 +2700,7 @@ static void test_button_messages(void)
DestroyWindow(hwnd);
}
- hwnd = CreateWindowExA(0, "my_button_class", "test", button[i].style | WS_POPUP | WS_VISIBLE,
+ hwnd = CreateWindowExA(0, "my_button_class", "test", BS_PUSHBUTTON | WS_POPUP | WS_VISIBLE,
0, 0, 50, 14, 0, 0, 0, NULL);
ok(hwnd != 0, "Failed to create button window\n");
More information about the wine-patches
mailing list