[3/3] user32: Implement EM_GETIMESTATUS and EM_SETIMESTATUS.
Kusanagi Kouichi
slash at ac.auone-net.jp
Fri Jan 15 07:22:52 CST 2010
Signed-off-by: Kusanagi Kouichi <slash at ac.auone-net.jp>
---
dlls/user32/edit.c | 53 ++++++++++++++++++++++++++++++++++++++++++---
dlls/user32/tests/edit.c | 3 --
2 files changed, 49 insertions(+), 7 deletions(-)
diff --git a/dlls/user32/edit.c b/dlls/user32/edit.c
index 5bdef8a..61638f6 100644
--- a/dlls/user32/edit.c
+++ b/dlls/user32/edit.c
@@ -35,7 +35,6 @@
* - EM_HIDEBALLOONTIP/Edit_HideBalloonTip
* - EM_SETCUEBANNER/Edit_SetCueBannerText
* - EM_SHOWBALLOONTIP/Edit_ShowBalloonTip
- * - EM_GETIMESTATUS, EM_SETIMESTATUS
* - EN_ALIGN_LTR_EC
* - EN_ALIGN_RTL_EC
* - ES_OEMCONVERT
@@ -138,6 +137,7 @@ typedef struct
Even if parent will change, EN_* messages
should be sent to the first parent. */
HWND hwndListBox; /* handle of ComboBox's listbox or NULL */
+ UINT imestatus;
/*
* only for multi line controls
*/
@@ -3345,6 +3345,19 @@ static LRESULT EDIT_WM_KillFocus(EDITSTATE *es)
if(!(es->style & ES_NOHIDESEL))
EDIT_InvalidateText(es, es->selection_start, es->selection_end);
EDIT_NOTIFY_PARENT(es, EN_KILLFOCUS);
+
+ if (es->imestatus & EIMES_COMPLETECOMPSTRKILLFOCUS)
+ {
+ HIMC imc;
+
+ imc = ImmGetContext(es->hwndSelf);
+ if (imc)
+ {
+ ImmNotifyIME(imc, NI_COMPOSITIONSTR, CPS_COMPLETE, 0);
+ ImmReleaseContext(es->hwndSelf, imc);
+ }
+ }
+
return 0;
}
@@ -3581,6 +3594,18 @@ static void EDIT_WM_SetFocus(EDITSTATE *es)
es->flags & EF_AFTER_WRAP);
ShowCaret(es->hwndSelf);
EDIT_NOTIFY_PARENT(es, EN_SETFOCUS);
+
+ if (es->imestatus & EIMES_CANCELCOMPSTRINFOCUS)
+ {
+ HIMC imc;
+
+ imc = ImmGetContext(es->hwndSelf);
+ if (imc)
+ {
+ ImmNotifyIME(imc, NI_COMPOSITIONSTR, CPS_CANCEL, 0);
+ ImmReleaseContext(es->hwndSelf, imc);
+ }
+ }
}
@@ -4182,7 +4207,7 @@ static void EDIT_GetResultStr(HIMC hIMC, EDITSTATE *es)
HeapFree(GetProcessHeap(),0,lpResultStr);
}
-static void EDIT_ImeComposition(HWND hwnd, LPARAM CompFlag, EDITSTATE *es)
+static void EDIT_ImeComposition(HWND hwnd, WPARAM wParam, LPARAM CompFlag, EDITSTATE *es)
{
HIMC hIMC;
int cursor;
@@ -4199,7 +4224,12 @@ static void EDIT_ImeComposition(HWND hwnd, LPARAM CompFlag, EDITSTATE *es)
return;
if (CompFlag & GCS_RESULTSTR)
- EDIT_GetResultStr(hIMC, es);
+ {
+ if (es->imestatus & EIMES_GETCOMPSTRATONCE)
+ EDIT_GetResultStr(hIMC, es);
+ else
+ DefWindowProcW(hwnd, WM_IME_COMPOSITION, wParam, CompFlag);
+ }
if (CompFlag & GCS_COMPSTR)
EDIT_GetCompositionStr(hIMC, CompFlag, es);
cursor = ImmGetCompositionStringW(hIMC, GCS_CURSORPOS, 0, 0);
@@ -4654,6 +4684,21 @@ LRESULT EditWndProc_common( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam, B
result = EDIT_EM_CharFromPos(es, (short)LOWORD(lParam), (short)HIWORD(lParam));
break;
+ case EM_SETIMESTATUS:
+ if (wParam == EMSIS_COMPOSITIONSTRING)
+ {
+ result = es->imestatus;
+ es->imestatus = lParam;
+ }
+ break;
+
+ case EM_GETIMESTATUS:
+ if (wParam == EMSIS_COMPOSITIONSTRING)
+ {
+ result = es->imestatus;
+ }
+ break;
+
/* End of the EM_ messages which were in numerical order; what order
* are these in? vaguely alphabetical?
*/
@@ -4923,7 +4968,7 @@ LRESULT EditWndProc_common( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam, B
break;
case WM_IME_COMPOSITION:
- EDIT_ImeComposition(hwnd, lParam, es);
+ EDIT_ImeComposition(hwnd, wParam, lParam, es);
break;
case WM_IME_ENDCOMPOSITION:
diff --git a/dlls/user32/tests/edit.c b/dlls/user32/tests/edit.c
index c8a9bbd..7fb53b7 100644
--- a/dlls/user32/tests/edit.c
+++ b/dlls/user32/tests/edit.c
@@ -2336,7 +2336,6 @@ static void test_imestatus(void)
SendMessage(hwEdit, EM_SETIMESTATUS, EMSIS_COMPOSITIONSTRING,
EIMES_CANCELCOMPSTRINFOCUS | EIMES_COMPLETECOMPSTRKILLFOCUS);
status = SendMessage(hwEdit, EM_GETIMESTATUS, EMSIS_COMPOSITIONSTRING, 0);
- todo_wine
ok(status == (EIMES_CANCELCOMPSTRINFOCUS | EIMES_COMPLETECOMPSTRKILLFOCUS),
"expected %#x, got %#lx\n",
EIMES_CANCELCOMPSTRINFOCUS | EIMES_COMPLETECOMPSTRKILLFOCUS,
@@ -2344,13 +2343,11 @@ static void test_imestatus(void)
SetFocus(hwEdit);
len2 = ImmGetCompositionStringW(imc, GCS_COMPSTR, NULL, 0);
- todo_wine
ok(len2 == 0, "expected 0, got %d\n", len2);
ImmSetCompositionStringW(imc, SCS_SETSTR, compstr, sizeof compstr, NULL, 0);
SetFocus(NULL);
len2 = ImmGetCompositionStringW(imc, GCS_RESULTSTR, NULL, 0);
- todo_wine
ok(len1 == len2, "expected %d, got %d\n", len1, len2);
ImmReleaseContext(hwEdit, imc);
--
1.6.6
More information about the wine-patches
mailing list