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

imm32: Use INPUTCONTEXT directly in ImmRequestMessage(W|A).

parent c4187bc4
......@@ -2380,31 +2380,67 @@ BOOL WINAPI ImmReleaseContext(HWND hWnd, HIMC hIMC)
/***********************************************************************
* ImmRequestMessageA(IMM32.@)
*/
LRESULT WINAPI ImmRequestMessageA(HIMC hIMC, WPARAM wParam, LPARAM lParam)
LRESULT WINAPI ImmRequestMessageA( HIMC himc, WPARAM wparam, LPARAM lparam )
{
struct imc *data = get_imc_data( hIMC );
INPUTCONTEXT *ctx;
LRESULT res;
TRACE("%p %Id %Id\n", hIMC, wParam, wParam);
TRACE( "himc %p, wparam %#Ix, lparam %#Ix\n", himc, wparam, lparam );
if (data) return SendMessageA(data->IMC.hWnd, WM_IME_REQUEST, wParam, lParam);
if (NtUserQueryInputContext( himc, NtUserInputContextThreadId ) != GetCurrentThreadId()) return FALSE;
SetLastError(ERROR_INVALID_HANDLE);
return 0;
switch (wparam)
{
case IMR_CANDIDATEWINDOW:
case IMR_COMPOSITIONFONT:
case IMR_COMPOSITIONWINDOW:
case IMR_CONFIRMRECONVERTSTRING:
case IMR_DOCUMENTFEED:
case IMR_QUERYCHARPOSITION:
case IMR_RECONVERTSTRING:
break;
default:
return FALSE;
}
if (!(ctx = ImmLockIMC( himc ))) return FALSE;
res = SendMessageA( ctx->hWnd, WM_IME_REQUEST, wparam, lparam );
ImmUnlockIMC( himc );
return res;
}
/***********************************************************************
* ImmRequestMessageW(IMM32.@)
*/
LRESULT WINAPI ImmRequestMessageW(HIMC hIMC, WPARAM wParam, LPARAM lParam)
LRESULT WINAPI ImmRequestMessageW( HIMC himc, WPARAM wparam, LPARAM lparam )
{
struct imc *data = get_imc_data( hIMC );
INPUTCONTEXT *ctx;
LRESULT res;
TRACE("%p %Id %Id\n", hIMC, wParam, wParam);
TRACE( "himc %p, wparam %#Ix, lparam %#Ix\n", himc, wparam, lparam );
if (data) return SendMessageW(data->IMC.hWnd, WM_IME_REQUEST, wParam, lParam);
if (NtUserQueryInputContext( himc, NtUserInputContextThreadId ) != GetCurrentThreadId()) return FALSE;
SetLastError(ERROR_INVALID_HANDLE);
return 0;
switch (wparam)
{
case IMR_CANDIDATEWINDOW:
case IMR_COMPOSITIONFONT:
case IMR_COMPOSITIONWINDOW:
case IMR_CONFIRMRECONVERTSTRING:
case IMR_DOCUMENTFEED:
case IMR_QUERYCHARPOSITION:
case IMR_RECONVERTSTRING:
break;
default:
return FALSE;
}
if (!(ctx = ImmLockIMC( himc ))) return FALSE;
res = SendMessageW( ctx->hWnd, WM_IME_REQUEST, wparam, lparam );
ImmUnlockIMC( himc );
return res;
}
/***********************************************************************
......
......@@ -1582,7 +1582,7 @@ static void test_cross_thread_himc(void)
ok_ret( 0, ImmRequestMessageW( params.himc[1], IMR_COMPOSITIONFONT, (LPARAM)&fontW ) );
ok_ret( 0, ImmRequestMessageA( params.himc[1], IMR_COMPOSITIONFONT, (LPARAM)&fontA ) );
todo_wine ok_seq( empty_sequence );
ok_seq( empty_sequence );
/* ImmSetCompositionString(W|A) should fail with cross thread HIMC */
......@@ -1638,7 +1638,7 @@ static void test_cross_thread_himc(void)
ok_ret( 0, ImmRequestMessageW( params.himc[1], IMR_CONFIRMRECONVERTSTRING, (LPARAM)&reconv ) );
ok_ret( 0, ImmRequestMessageA( params.himc[1], IMR_CONFIRMRECONVERTSTRING, (LPARAM)&reconv ) );
todo_wine ok_seq( empty_sequence );
ok_seq( empty_sequence );
/* ImmSetCompositionWindow should fail with cross thread HIMC */
......@@ -1660,7 +1660,7 @@ static void test_cross_thread_himc(void)
ok_ret( 0, ImmRequestMessageW( params.himc[1], IMR_COMPOSITIONWINDOW, (LPARAM)&composition ) );
ok_ret( 0, ImmRequestMessageA( params.himc[1], IMR_COMPOSITIONWINDOW, (LPARAM)&composition ) );
todo_wine ok_seq( empty_sequence );
ok_seq( empty_sequence );
/* ImmSetCandidateWindow should fail with cross thread HIMC */
......@@ -1687,7 +1687,7 @@ static void test_cross_thread_himc(void)
ok_ret( 0, ImmRequestMessageW( params.himc[1], IMR_CANDIDATEWINDOW, (LPARAM)&candidate ) );
ok_ret( 0, ImmRequestMessageA( params.himc[1], IMR_CANDIDATEWINDOW, (LPARAM)&candidate ) );
todo_wine ok_seq( empty_sequence );
ok_seq( empty_sequence );
/* ImmSetStatusWindowPos should fail with cross thread HIMC */
......@@ -1709,7 +1709,7 @@ static void test_cross_thread_himc(void)
ok_ret( 0, ImmRequestMessageW( params.himc[1], IMR_QUERYCHARPOSITION, (LPARAM)&char_pos ) );
ok_ret( 0, ImmRequestMessageA( params.himc[1], IMR_QUERYCHARPOSITION, (LPARAM)&char_pos ) );
todo_wine ok_seq( empty_sequence );
ok_seq( empty_sequence );
/* ImmGenerateMessage should fail with cross thread HIMC */
......
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