Commit 64c772dc authored by Aric Stewart's avatar Aric Stewart Committed by Alexandre Julliard

imm32: Messages from ImmGenerateMessage are sent not posted.

parent faf59e5f
......@@ -439,6 +439,16 @@ static void ImmInternalPostIMEMessage(InputContextData *data, UINT msg, WPARAM w
PostMessageW(target, msg, wParam, lParam);
}
/* for sending messages as the IME */
static void ImmInternalSendIMEMessage(InputContextData *data, UINT msg, WPARAM wParam, LPARAM lParam)
{
HWND target = GetFocus();
if (!target)
SendMessageW(data->IMC.hWnd,msg,wParam,lParam);
else
SendMessageW(target, msg, wParam, lParam);
}
static LRESULT ImmInternalSendIMENotify(InputContextData *data, WPARAM notify, LPARAM lParam)
{
HWND target;
......@@ -2887,7 +2897,7 @@ BOOL WINAPI ImmGenerateMessage(HIMC hIMC)
lpTransMsg = ImmLockIMCC(data->IMC.hMsgBuf);
for (i = 0; i < data->IMC.dwNumMsgBuf; i++)
ImmInternalPostIMEMessage(data, lpTransMsg[i].message, lpTransMsg[i].wParam, lpTransMsg[i].lParam);
ImmInternalSendIMEMessage(data, lpTransMsg[i].message, lpTransMsg[i].wParam, lpTransMsg[i].lParam);
ImmUnlockIMCC(data->IMC.hMsgBuf);
......
......@@ -44,7 +44,7 @@ static struct _msg_spy {
HWND hwnd;
HHOOK get_msg_hook;
HHOOK call_wnd_proc_hook;
imm_msgs msgs[32];
imm_msgs msgs[64];
unsigned int i_msg;
} msg_spy;
......@@ -59,6 +59,12 @@ typedef struct
} u;
} TEST_INPUT;
typedef struct _tagTRANSMSG {
UINT message;
WPARAM wParam;
LPARAM lParam;
} TRANSMSG, *LPTRANSMSG;
static UINT (WINAPI *pSendInput) (UINT, INPUT*, size_t);
static LRESULT CALLBACK get_msg_filter(int nCode, WPARAM wParam, LPARAM lParam)
......@@ -1015,6 +1021,9 @@ static void test_ImmMessages(void)
HIMC imc;
UINT idx = 0;
LPINPUTCONTEXT lpIMC;
LPTRANSMSG lpTransMsg;
HWND hwnd = CreateWindowExA(WS_EX_CLIENTEDGE, "EDIT", "Wine imm32.dll test",
WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT,
240, 120, NULL, NULL, GetModuleHandleA(NULL), NULL);
......@@ -1032,6 +1041,64 @@ static void test_ImmMessages(void)
if (msg) ok(!msg->post, "Message should not be posted\n");
} while (msg);
msg_spy_flush_msgs();
lpIMC = ImmLockIMC(imc);
lpIMC->hMsgBuf = ImmReSizeIMCC(lpIMC->hMsgBuf, (lpIMC->dwNumMsgBuf + 1) * sizeof(TRANSMSG));
lpTransMsg = ImmLockIMCC(lpIMC->hMsgBuf);
lpTransMsg += lpIMC->dwNumMsgBuf;
lpTransMsg->message = WM_IME_STARTCOMPOSITION;
lpTransMsg->wParam = 0;
lpTransMsg->lParam = 0;
ImmUnlockIMCC(lpIMC->hMsgBuf);
lpIMC->dwNumMsgBuf++;
ImmUnlockIMC(imc);
ImmGenerateMessage(imc);
idx = 0;
do
{
msg = msg_spy_find_next_msg(WM_IME_STARTCOMPOSITION, &idx);
if (msg) ok(!msg->post, "Message should not be posted\n");
} while (msg);
msg_spy_flush_msgs();
lpIMC = ImmLockIMC(imc);
lpIMC->hMsgBuf = ImmReSizeIMCC(lpIMC->hMsgBuf, (lpIMC->dwNumMsgBuf + 1) * sizeof(TRANSMSG));
lpTransMsg = ImmLockIMCC(lpIMC->hMsgBuf);
lpTransMsg += lpIMC->dwNumMsgBuf;
lpTransMsg->message = WM_IME_COMPOSITION;
lpTransMsg->wParam = 0;
lpTransMsg->lParam = 0;
ImmUnlockIMCC(lpIMC->hMsgBuf);
lpIMC->dwNumMsgBuf++;
ImmUnlockIMC(imc);
ImmGenerateMessage(imc);
idx = 0;
do
{
msg = msg_spy_find_next_msg(WM_IME_COMPOSITION, &idx);
if (msg) ok(!msg->post, "Message should not be posted\n");
} while (msg);
msg_spy_flush_msgs();
lpIMC = ImmLockIMC(imc);
lpIMC->hMsgBuf = ImmReSizeIMCC(lpIMC->hMsgBuf, (lpIMC->dwNumMsgBuf + 1) * sizeof(TRANSMSG));
lpTransMsg = ImmLockIMCC(lpIMC->hMsgBuf);
lpTransMsg += lpIMC->dwNumMsgBuf;
lpTransMsg->message = WM_IME_ENDCOMPOSITION;
lpTransMsg->wParam = 0;
lpTransMsg->lParam = 0;
ImmUnlockIMCC(lpIMC->hMsgBuf);
lpIMC->dwNumMsgBuf++;
ImmUnlockIMC(imc);
ImmGenerateMessage(imc);
idx = 0;
do
{
msg = msg_spy_find_next_msg(WM_IME_ENDCOMPOSITION, &idx);
if (msg) ok(!msg->post, "Message should not be posted\n");
} while (msg);
msg_spy_flush_msgs();
ImmSetOpenStatus(imc, FALSE);
ImmReleaseContext(hwnd, imc);
DestroyWindow(hwnd);
......
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