Commit 8387d2fe authored by Rémi Bernon's avatar Rémi Bernon Committed by Alexandre Julliard

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
parent 591f585a
...@@ -1104,12 +1104,8 @@ BOOL WINAPI SetWindowSubclass (HWND hWnd, SUBCLASSPROC pfnSubclass, ...@@ -1104,12 +1104,8 @@ BOOL WINAPI SetWindowSubclass (HWND hWnd, SUBCLASSPROC pfnSubclass,
/* set window procedure to our own and save the current one */ /* set window procedure to our own and save the current one */
stack->is_unicode = IsWindowUnicode (hWnd); stack->is_unicode = IsWindowUnicode (hWnd);
if (stack->is_unicode) stack->origproc = (WNDPROC)SetWindowLongPtrW (hWnd, GWLP_WNDPROC,
stack->origproc = (WNDPROC)SetWindowLongPtrW (hWnd, GWLP_WNDPROC, (DWORD_PTR)COMCTL32_SubclassProc);
(DWORD_PTR)COMCTL32_SubclassProc);
else
stack->origproc = (WNDPROC)SetWindowLongPtrA (hWnd, GWLP_WNDPROC,
(DWORD_PTR)COMCTL32_SubclassProc);
} }
else { else {
/* Check to see if we have called this function with the same uIDSubClass /* 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 ...@@ -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 /* If we are at the end of stack then we have to call the original
* window procedure */ * window procedure */
if (!stack->stackpos) { if (!stack->stackpos) {
if (stack->is_unicode) ret = CallWindowProcW (stack->origproc, hWnd, uMsg, wParam, lParam);
ret = CallWindowProcW (stack->origproc, hWnd, uMsg, wParam, lParam);
else
ret = CallWindowProcA (stack->origproc, hWnd, uMsg, wParam, lParam);
} else { } else {
const SUBCLASSPROCS *proc = stack->stackpos; const SUBCLASSPROCS *proc = stack->stackpos;
stack->stackpos = stack->stackpos->next; stack->stackpos = stack->stackpos->next;
......
...@@ -202,7 +202,7 @@ static LRESULT WINAPI wnd_proc_1(HWND hwnd, UINT message, WPARAM wParam, LPARAM ...@@ -202,7 +202,7 @@ static LRESULT WINAPI wnd_proc_1(HWND hwnd, UINT message, WPARAM wParam, LPARAM
DWORD flags = GetWindowLongA(hwnd, GWLP_USERDATA); DWORD flags = GetWindowLongA(hwnd, GWLP_USERDATA);
struct message msg; struct message msg;
todo_wine_if(flags & EXPECT_UNICODE) check_unicode(hwnd, flags); check_unicode(hwnd, flags);
if(message == WM_USER) { if(message == WM_USER) {
msg.wParam = wParam; msg.wParam = wParam;
...@@ -234,7 +234,7 @@ static LRESULT WINAPI wnd_proc_sub(HWND hwnd, UINT message, WPARAM wParam, LPARA ...@@ -234,7 +234,7 @@ static LRESULT WINAPI wnd_proc_sub(HWND hwnd, UINT message, WPARAM wParam, LPARA
DWORD flags = GetWindowLongA(hwnd, GWLP_USERDATA); DWORD flags = GetWindowLongA(hwnd, GWLP_USERDATA);
struct message msg; struct message msg;
todo_wine_if(flags & EXPECT_UNICODE) check_unicode(hwnd, flags); check_unicode(hwnd, flags);
if(message == WM_USER) { if(message == WM_USER) {
msg.wParam = wParam; msg.wParam = wParam;
...@@ -245,22 +245,21 @@ static LRESULT WINAPI wnd_proc_sub(HWND hwnd, UINT message, WPARAM wParam, LPARA ...@@ -245,22 +245,21 @@ static LRESULT WINAPI wnd_proc_sub(HWND hwnd, UINT message, WPARAM wParam, LPARA
if(dwRefData & DELETE_SELF) { if(dwRefData & DELETE_SELF) {
pRemoveWindowSubclass(hwnd, wnd_proc_sub, uldSubclass); pRemoveWindowSubclass(hwnd, wnd_proc_sub, uldSubclass);
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) if(dwRefData & DELETE_PREV)
{ {
pRemoveWindowSubclass(hwnd, wnd_proc_sub, uldSubclass-1); 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) if(dwRefData & SEND_NEST)
{ {
SendMessageA(hwnd, WM_USER, wParam+1, 0); 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) { if (message == WM_CHAR) {
todo_wine
ok(wParam == 0x30c2, "got wParam %#Ix\n", wParam); ok(wParam == 0x30c2, "got wParam %#Ix\n", wParam);
} }
return pDefSubclassProc(hwnd, message, wParam, lParam); return pDefSubclassProc(hwnd, message, wParam, lParam);
...@@ -277,7 +276,7 @@ static void test_subclass(void) ...@@ -277,7 +276,7 @@ static void test_subclass(void)
ret = pSetWindowSubclass(hwnd, wnd_proc_sub, 2, 0); ret = pSetWindowSubclass(hwnd, wnd_proc_sub, 2, 0);
ok(ret == TRUE, "Expected TRUE\n"); ok(ret == TRUE, "Expected TRUE\n");
todo_wine check_unicode(hwnd, EXPECT_UNICODE); check_unicode(hwnd, EXPECT_UNICODE);
SetWindowLongA(hwnd, GWLP_USERDATA, EXPECT_UNICODE); SetWindowLongA(hwnd, GWLP_USERDATA, EXPECT_UNICODE);
SendMessageA(hwnd, WM_USER, 1, 0); SendMessageA(hwnd, WM_USER, 1, 0);
...@@ -287,7 +286,7 @@ static void test_subclass(void) ...@@ -287,7 +286,7 @@ static void test_subclass(void)
ret = pSetWindowSubclass(hwnd, wnd_proc_sub, 2, DELETE_SELF); ret = pSetWindowSubclass(hwnd, wnd_proc_sub, 2, DELETE_SELF);
ok(ret == TRUE, "Expected TRUE\n"); ok(ret == TRUE, "Expected TRUE\n");
todo_wine check_unicode(hwnd, EXPECT_UNICODE); check_unicode(hwnd, EXPECT_UNICODE);
SendMessageA(hwnd, WM_USER, 1, 1); SendMessageA(hwnd, WM_USER, 1, 1);
ok_sequence(Sub_DeletedTest, "Deleted"); ok_sequence(Sub_DeletedTest, "Deleted");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment