xref: /reactos/win32ss/user/ntuser/ime.c (revision 990ba545)
1 /*
2  * COPYRIGHT:        See COPYING in the top level directory
3  * PROJECT:          ReactOS Win32k subsystem
4  * PURPOSE:          Input Method Editor and Input Method Manager support
5  * FILE:             win32ss/user/ntuser/ime.c
6  * PROGRAMERS:       Casper S. Hornstrup (chorns@users.sourceforge.net)
7  *                   Katayama Hirofumi MZ (katayama.hirofumi.mz@gmail.com)
8  */
9 
10 #include <win32k.h>
11 DBG_DEFAULT_CHANNEL(UserMisc);
12 
13 
14 UINT FASTCALL
15 IntImmProcessKey(PUSER_MESSAGE_QUEUE MessageQueue, PWND pWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
16 {
17     PKL pKbdLayout;
18 
19     ASSERT_REFS_CO(pWnd);
20 
21     if ( Msg == WM_KEYDOWN ||
22          Msg == WM_SYSKEYDOWN ||
23          Msg == WM_KEYUP ||
24          Msg == WM_SYSKEYUP )
25     {
26        //Vk = wParam & 0xff;
27        pKbdLayout = pWnd->head.pti->KeyboardLayout;
28        if (pKbdLayout == NULL) return 0;
29        //
30        if (!(gpsi->dwSRVIFlags & SRVINFO_IMM32)) return 0;
31        // need ime.h!
32     }
33     // Call User32:
34     // Anything but BOOL!
35     //ImmRet = co_IntImmProcessKey(UserHMGetHandle(pWnd), pKbdLayout->hkl, Vk, lParam, HotKey);
36     FIXME(" is UNIMPLEMENTED.\n");
37     return 0;
38 }
39 
40 BOOL WINAPI
41 NtUserGetImeHotKey(IN DWORD dwHotKey,
42                    OUT LPUINT lpuModifiers,
43                    OUT LPUINT lpuVKey,
44                    OUT LPHKL lphKL)
45 {
46    STUB
47 
48    return FALSE;
49 }
50 
51 DWORD
52 APIENTRY
53 NtUserNotifyIMEStatus(HWND hwnd, BOOL fOpen, DWORD dwConversion)
54 {
55     TRACE("NtUserNotifyIMEStatus(%p, %d, 0x%lX)\n", hwnd, fOpen, dwConversion);
56     return 0;
57 }
58 
59 DWORD
60 APIENTRY
61 NtUserSetImeHotKey(
62    DWORD Unknown0,
63    DWORD Unknown1,
64    DWORD Unknown2,
65    DWORD Unknown3,
66    DWORD Unknown4)
67 {
68    STUB
69 
70    return 0;
71 }
72 
73 DWORD
74 APIENTRY
75 NtUserCheckImeHotKey(
76     DWORD  VirtualKey,
77     LPARAM lParam)
78 {
79     STUB;
80     return 0;
81 }
82 
83 
84 DWORD
85 APIENTRY
86 NtUserDisableThreadIme(
87     DWORD dwUnknown1)
88 {
89     STUB;
90     return 0;
91 }
92 
93 DWORD
94 APIENTRY
95 NtUserGetAppImeLevel(HWND hWnd)
96 {
97     STUB;
98     return 0;
99 }
100 
101 BOOL
102 APIENTRY
103 NtUserGetImeInfoEx(
104     PIMEINFOEX pImeInfoEx,
105     IMEINFOEXCLASS SearchType)
106 {
107     STUB;
108     return FALSE;
109 }
110 
111 
112 DWORD
113 APIENTRY
114 NtUserSetAppImeLevel(
115     DWORD dwUnknown1,
116     DWORD dwUnknown2)
117 {
118     STUB;
119     return 0;
120 }
121 
122 DWORD
123 APIENTRY
124 NtUserSetImeInfoEx(
125     PIMEINFOEX pImeInfoEx)
126 {
127     STUB;
128     return 0;
129 }
130 
131 DWORD APIENTRY
132 NtUserSetImeOwnerWindow(PIMEINFOEX pImeInfoEx, BOOL fFlag)
133 {
134    STUB
135    return 0;
136 }
137 
138 PVOID
139 AllocInputContextObject(PDESKTOP pDesk,
140                         PTHREADINFO pti,
141                         SIZE_T Size,
142                         PVOID* HandleOwner)
143 {
144     PTHRDESKHEAD ObjHead;
145 
146     ASSERT(Size > sizeof(*ObjHead));
147     ASSERT(pti != NULL);
148 
149     ObjHead = UserHeapAlloc(Size);
150     if (!ObjHead)
151         return NULL;
152 
153     RtlZeroMemory(ObjHead, Size);
154 
155     ObjHead->pSelf = ObjHead;
156     ObjHead->rpdesk = pDesk;
157     ObjHead->pti = pti;
158     IntReferenceThreadInfo(pti);
159     *HandleOwner = pti;
160     pti->ppi->UserHandleCount++;
161 
162     return ObjHead;
163 }
164 
165 VOID UserFreeInputContext(PVOID Object)
166 {
167     PIMC pIMC = Object, pImc0;
168     PTHREADINFO pti = pIMC->head.pti;
169 
170     UserMarkObjectDestroy(Object);
171 
172     for (pImc0 = pti->spDefaultImc; pImc0; pImc0 = pImc0->pImcNext)
173     {
174         if (pImc0->pImcNext == pIMC)
175         {
176             pImc0->pImcNext = pIMC->pImcNext;
177             break;
178         }
179     }
180 
181     UserHeapFree(Object);
182 
183     pti->ppi->UserHandleCount--;
184     IntDereferenceThreadInfo(pti);
185 }
186 
187 BOOLEAN UserDestroyInputContext(PVOID Object)
188 {
189     PIMC pIMC = Object;
190     UserDeleteObject(pIMC->head.h, TYPE_INPUTCONTEXT);
191     return TRUE;
192 }
193 
194 BOOL APIENTRY NtUserDestroyInputContext(HIMC hIMC)
195 {
196     PIMC pIMC;
197     BOOL ret = FALSE;
198 
199     UserEnterExclusive();
200 
201     if (!(gpsi->dwSRVIFlags & SRVINFO_IMM32))
202     {
203         EngSetLastError(ERROR_CALL_NOT_IMPLEMENTED);
204         UserLeave();
205         return FALSE;
206     }
207 
208     pIMC = UserGetObject(gHandleTable, hIMC, TYPE_INPUTCONTEXT);
209     if (pIMC)
210         ret = UserDereferenceObject(pIMC);
211 
212     UserLeave();
213     return ret;
214 }
215 
216 /* EOF */
217