32
32
#include <string.h>
33
33
#include <stdlib.h>
34
34
#include <LCUI_Build.h>
35
-
36
35
#ifdef LCUI_BUILD_IN_WIN32
37
36
#include <LCUI/LCUI.h>
38
37
#include <LCUI/input.h>
39
38
#include <LCUI/ime.h>
40
39
#include <LCUI/platform.h>
41
40
#include LCUI_EVENTS_H
42
41
42
+ #pragma comment(lib, "Imm32.lib")
43
+
43
44
static LCUI_BOOL IME_ProcessKey (int key , int key_state )
44
45
{
45
46
return FALSE;
@@ -60,6 +61,20 @@ static void WinIME_OnChar(LCUI_Event e, void *arg)
60
61
LCUIIME_Commit (text , 2 );
61
62
}
62
63
64
+ static void IME_SetCaret (int x , int y )
65
+ {
66
+ HWND hwnd = GetActiveWindow ();
67
+ HIMC himc = ImmGetContext (hwnd );
68
+ if (himc ) {
69
+ COMPOSITIONFORM composition ;
70
+ composition .dwStyle = CFS_POINT ;
71
+ composition .ptCurrentPos .x = x ;
72
+ composition .ptCurrentPos .y = y ;
73
+ ImmSetCompositionWindow (himc , & composition );
74
+ ImmReleaseContext (hwnd , himc );
75
+ }
76
+ }
77
+
63
78
static LCUI_BOOL IME_Open (void )
64
79
{
65
80
LCUI_BindSysEvent (WM_CHAR , WinIME_OnChar , NULL , NULL );
@@ -79,6 +94,7 @@ int LCUI_RegisterWin32IME(void)
79
94
handler .totext = IME_ToText ;
80
95
handler .close = IME_Close ;
81
96
handler .open = IME_Open ;
97
+ handler .setcaret = IME_SetCaret ;
82
98
return LCUIIME_Register ("LCUI Input Method" , & handler );
83
99
}
84
100
0 commit comments