comctl32: Always use unicode messages for subclass procedures.

Final Fantasy XIV Online depends on this for its text input.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=43073
This commit is contained in:
Rémi Bernon 2023-01-10 17:39:17 +01:00 committed by Alexandre Julliard
parent 591f585a55
commit 8387d2feff
2 changed files with 10 additions and 18 deletions

View file

@ -1104,12 +1104,8 @@ BOOL WINAPI SetWindowSubclass (HWND hWnd, SUBCLASSPROC pfnSubclass,
/* set window procedure to our own and save the current one */
stack->is_unicode = IsWindowUnicode (hWnd);
if (stack->is_unicode)
stack->origproc = (WNDPROC)SetWindowLongPtrW (hWnd, GWLP_WNDPROC,
(DWORD_PTR)COMCTL32_SubclassProc);
else
stack->origproc = (WNDPROC)SetWindowLongPtrA (hWnd, GWLP_WNDPROC,
(DWORD_PTR)COMCTL32_SubclassProc);
stack->origproc = (WNDPROC)SetWindowLongPtrW (hWnd, GWLP_WNDPROC,
(DWORD_PTR)COMCTL32_SubclassProc);
}
else {
/* Check to see if we have called this function with the same uIDSubClass
@ -1332,10 +1328,7 @@ LRESULT WINAPI DefSubclassProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPar
/* If we are at the end of stack then we have to call the original
* window procedure */
if (!stack->stackpos) {
if (stack->is_unicode)
ret = CallWindowProcW (stack->origproc, hWnd, uMsg, wParam, lParam);
else
ret = CallWindowProcA (stack->origproc, hWnd, uMsg, wParam, lParam);
ret = CallWindowProcW (stack->origproc, hWnd, uMsg, wParam, lParam);
} else {
const SUBCLASSPROCS *proc = stack->stackpos;
stack->stackpos = stack->stackpos->next;

View file

@ -202,7 +202,7 @@ static LRESULT WINAPI wnd_proc_1(HWND hwnd, UINT message, WPARAM wParam, LPARAM
DWORD flags = GetWindowLongA(hwnd, GWLP_USERDATA);
struct message msg;
todo_wine_if(flags & EXPECT_UNICODE) check_unicode(hwnd, flags);
check_unicode(hwnd, flags);
if(message == WM_USER) {
msg.wParam = wParam;
@ -234,7 +234,7 @@ static LRESULT WINAPI wnd_proc_sub(HWND hwnd, UINT message, WPARAM wParam, LPARA
DWORD flags = GetWindowLongA(hwnd, GWLP_USERDATA);
struct message msg;
todo_wine_if(flags & EXPECT_UNICODE) check_unicode(hwnd, flags);
check_unicode(hwnd, flags);
if(message == WM_USER) {
msg.wParam = wParam;
@ -245,22 +245,21 @@ static LRESULT WINAPI wnd_proc_sub(HWND hwnd, UINT message, WPARAM wParam, LPARA
if(dwRefData & DELETE_SELF) {
pRemoveWindowSubclass(hwnd, wnd_proc_sub, uldSubclass);
pRemoveWindowSubclass(hwnd, wnd_proc_sub, uldSubclass);
todo_wine_if(flags & EXPECT_UNICODE) check_unicode(hwnd, flags);
check_unicode(hwnd, flags);
}
if(dwRefData & DELETE_PREV)
{
pRemoveWindowSubclass(hwnd, wnd_proc_sub, uldSubclass-1);
todo_wine_if(flags & EXPECT_UNICODE) check_unicode(hwnd, flags);
check_unicode(hwnd, flags);
}
if(dwRefData & SEND_NEST)
{
SendMessageA(hwnd, WM_USER, wParam+1, 0);
todo_wine_if(flags & EXPECT_UNICODE) check_unicode(hwnd, flags);
check_unicode(hwnd, flags);
}
}
}
if (message == WM_CHAR) {
todo_wine
ok(wParam == 0x30c2, "got wParam %#Ix\n", wParam);
}
return pDefSubclassProc(hwnd, message, wParam, lParam);
@ -277,7 +276,7 @@ static void test_subclass(void)
ret = pSetWindowSubclass(hwnd, wnd_proc_sub, 2, 0);
ok(ret == TRUE, "Expected TRUE\n");
todo_wine check_unicode(hwnd, EXPECT_UNICODE);
check_unicode(hwnd, EXPECT_UNICODE);
SetWindowLongA(hwnd, GWLP_USERDATA, EXPECT_UNICODE);
SendMessageA(hwnd, WM_USER, 1, 0);
@ -287,7 +286,7 @@ static void test_subclass(void)
ret = pSetWindowSubclass(hwnd, wnd_proc_sub, 2, DELETE_SELF);
ok(ret == TRUE, "Expected TRUE\n");
todo_wine check_unicode(hwnd, EXPECT_UNICODE);
check_unicode(hwnd, EXPECT_UNICODE);
SendMessageA(hwnd, WM_USER, 1, 1);
ok_sequence(Sub_DeletedTest, "Deleted");