annotate src/glbl_ime.cpp @ 19506:8602a051c9bd

Added tag v8.2.0310 for changeset e7eec9cae0ea189c45b910ffa62ee6bac71fa29a
author Bram Moolenaar <Bram@vim.org>
date Sun, 23 Feb 2020 16:30:04 +0100
parents 973070a30381
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
10042
4aead6a9b7a9 commit https://github.com/vim/vim/commit/edf3f97ae2af024708ebb4ac614227327033ca47
Christian Brabandt <cb@256bit.org>
parents: 4352
diff changeset
1 /* vi:set ts=8 sts=4 sw=4 noet:
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2 *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3 * VIM - Vi IMproved by Bram Moolenaar
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4 *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5 * Do ":help uganda" in Vim to read copying and usage conditions.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6 * Do ":help credits" in Vim to see a list of people who contributed.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10 * DESCRIPTION:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
11 * This module produces Global IME for Vim, on Windows with Internet
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
12 * Explorer 5.01 or higher. You need three files "dimm.idl", "dimm.h", and
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
13 * "dimm_i.c" when compile this module at your self. "dimm.h", and
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
14 * "dimm_i.c" are generated from "dimm.idl" by using MIDL.EXE as like
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
15 * "if_ole.h". You can get "dimm.idl" in MSDN web site. I got it below
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
16 * URL.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
17 *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
18 * WHAT IS THE GLOBAL IME?:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
19 * Global IME makes capability input Chinese, Japanese, and Korean text into
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
20 * Vim buffer on any language version of Windows 98, Windows 95, and Windows
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
21 * NT 4.0. See below URL for detail of Global IME. You can also find
1186
2de44d8f2cf1 updated for version 7.1b
vimboss
parents: 376
diff changeset
22 * various language version of Global IME at same place.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
23 *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
24 * RUNTIME REQUIREMENTS:
1186
2de44d8f2cf1 updated for version 7.1b
vimboss
parents: 376
diff changeset
25 * - Internet Explorer 5.01 or higher.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
26 * - Global IME (with language pack?).
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
27 * - Of course Vim for Windows.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
28 *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
29 * URLS:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
30 * - Where you can probably get "dimm.idl".
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
31 * http://msdn.microsoft.com/downloads/samples/internet/libraries/ie5_lib/sample.asp
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
32 * - Global IME detailed information.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
33 * http://www.microsoft.com/windows/ie/features/ime.asp
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
34 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
35
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
36 #ifdef GLOBAL_IME
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
37
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
38 #define WIN32_LEAN_AND_MEAN
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
39 #include <windows.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
40 #include <objbase.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
41 extern "C" {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
42 #include "vim.h"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
43 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
44 #include "dimm.h"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
45 #include "glbl_ime.h"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
46
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
47 static IActiveIMMApp *pIApp = NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
48 static IActiveIMMMessagePumpOwner *pIMsg = NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
49 static HWND s_hWnd = NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
50 static BOOL s_bStatus = FALSE; /* for evacuate */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
51
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
52 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
53 * Initialize Global IME.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
54 * "atom" must be return value of RegisterClass(Ex).
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
55 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
56 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
57 global_ime_init(ATOM atom, HWND hWnd)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
58 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
59 IUnknown *pI;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
60 HRESULT hr;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
61
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
62 if (pIApp != NULL || pIMsg != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
63 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
64 OleInitialize(NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
65
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
66 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
67 * Get interface IUnknown
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
68 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
69 hr = CoCreateInstance(CLSID_CActiveIMM, NULL, CLSCTX_SERVER,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
70 IID_IUnknown, (void**)&pI);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
71 if (FAILED(hr) || !pI)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
72 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
73
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
74 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
75 * Get interface IActiveIMMApp
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
76 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
77 hr = pI->QueryInterface(IID_IActiveIMMApp, (void**)&pIApp);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
78 if (FAILED(hr))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
79 pIApp = NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
80
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
81 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
82 * Get interface IActiveIMMMessagePumpOwner
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
83 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
84 hr = pI->QueryInterface(IID_IActiveIMMMessagePumpOwner, (void**)&pIMsg);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
85 if (FAILED(hr))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
86 pIMsg = NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
87
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
88 if (pIApp != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
89 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
90 pIApp->Activate(TRUE);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
91 pIApp->FilterClientWindows(&atom, 1);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
92 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
93 if (pIMsg != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
94 pIMsg->Start();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
95
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
96 pI->Release();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
97 s_hWnd = hWnd;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
98 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
99
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
100 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
101 * Reset and clear Global IME.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
102 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
103 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
104 global_ime_end()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
105 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
106 if (pIApp != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
107 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
108 IActiveIMMApp *p = pIApp;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
109
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
110 pIApp = NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
111 p->FilterClientWindows(NULL, 0);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
112 p->Deactivate();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
113 p->Release();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
114 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
115 if (pIMsg != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
116 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
117 IActiveIMMMessagePumpOwner *p = pIMsg;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
118
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
119 pIMsg = NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
120 p->End();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
121 p->Release();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
122 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
123 OleUninitialize();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
124 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
125
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
126 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
127 * Replacement for DefWindowProc().
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
128 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
129 LRESULT WINAPI
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
130 global_ime_DefWindowProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
131 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
132 LRESULT lResult;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
133
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
134 if (pIApp == NULL || pIApp->OnDefWindowProc(hWnd, Msg,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
135 wParam, lParam, &lResult) != S_OK)
16196
973070a30381 patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents: 15868
diff changeset
136 lResult = DefWindowProcW(hWnd, Msg, wParam, lParam);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
137 return lResult;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
138 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
139
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
140 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
141 * Replace with TranslateMessage()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
142 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
143 BOOL WINAPI
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
144 global_ime_TranslateMessage(CONST MSG *lpMsg)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
145 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
146 if (pIMsg == NULL || pIMsg->OnTranslateMessage(lpMsg) == S_FALSE)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
147 return TranslateMessage(lpMsg);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
148 return TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
149 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
150
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
151 /*
4352
04736b4030ec updated for version 7.3.925
Bram Moolenaar <bram@vim.org>
parents: 1186
diff changeset
152 * Set position of IME composition window.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
153 *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
154 * You have to call this before starting composition. If once composition
1186
2de44d8f2cf1 updated for version 7.1b
vimboss
parents: 376
diff changeset
155 * started, this can take no effect until that composition have finished. So
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
156 * you should handle WM_IME_STARTCOMPOSITION and call this function.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
157 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
158 void WINAPI
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
159 global_ime_set_position(POINT *pPoint)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
160 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
161 HIMC hImc = NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
162
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
163 if (pIApp == NULL || pPoint == NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
164 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
165
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
166 if (SUCCEEDED(pIApp->GetContext(s_hWnd, &hImc)))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
167 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
168 COMPOSITIONFORM CompForm;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
169
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
170 CompForm.dwStyle = CFS_POINT;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
171 CompForm.ptCurrentPos = *pPoint;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
172 pIApp->SetCompositionWindow(hImc, &CompForm);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
173 pIApp->ReleaseContext(s_hWnd, hImc);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
174 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
175 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
176
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
177 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
178 * Set font to Global IME
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
179 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
180 /* GIME_TEST */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
181 void WINAPI
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
182 global_ime_set_font(LOGFONT *pFont)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
183 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
184 HIMC hImc = NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
185
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
186 if (pIApp == NULL || pFont == NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
187 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
188
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
189 if (SUCCEEDED(pIApp->GetContext(s_hWnd, &hImc)))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
190 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
191 pIApp->SetCompositionFontA(hImc, pFont);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
192 pIApp->ReleaseContext(s_hWnd, hImc);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
193 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
194 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
195
376
d2bc505a6d91 updated for version 7.0098
vimboss
parents: 285
diff changeset
196 #if 0
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
197 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
198 * for IME control. Save current status of IME, and set force new-status to
376
d2bc505a6d91 updated for version 7.0098
vimboss
parents: 285
diff changeset
199 * English (turn off).
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
200 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
201 void WINAPI
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
202 global_ime_status_evacuate()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
203 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
204 HIMC hImc;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
205
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
206 if (pIApp != NULL && SUCCEEDED(pIApp->GetContext(s_hWnd, &hImc)))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
207 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
208 s_bStatus = (pIApp->GetOpenStatus(hImc) == 0) ? TRUE : FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
209 pIApp->SetOpenStatus(hImc, FALSE);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
210 pIApp->ReleaseContext(s_hWnd, hImc);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
211 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
212 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
213
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
214 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
215 * for IME control. Change IME status to last saved one.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
216 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
217 void WINAPI
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
218 global_ime_status_restore()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
219 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
220 HIMC hImc;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
221
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
222 if (pIApp != NULL && SUCCEEDED(pIApp->GetContext(s_hWnd, &hImc)))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
223 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
224 pIApp->SetOpenStatus(hImc, s_bStatus);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
225 pIApp->ReleaseContext(s_hWnd, hImc);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
226 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
227 }
376
d2bc505a6d91 updated for version 7.0098
vimboss
parents: 285
diff changeset
228 #endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
229
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
230 void WINAPI
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
231 global_ime_set_status(int status)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
232 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
233 HIMC hImc;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
234
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
235 if (pIApp != NULL && SUCCEEDED(pIApp->GetContext(s_hWnd, &hImc)))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
236 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
237 pIApp->SetOpenStatus(hImc, status ? TRUE : FALSE);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
238 pIApp->ReleaseContext(s_hWnd, hImc);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
239 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
240 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
241
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
242 int WINAPI
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
243 global_ime_get_status()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
244 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
245 int status = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
246 HIMC hImc;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
247
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
248 if (pIApp != NULL && SUCCEEDED(pIApp->GetContext(s_hWnd, &hImc)))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
249 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
250 status = pIApp->GetOpenStatus(hImc) ? 1 : 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
251 pIApp->ReleaseContext(s_hWnd, hImc);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
252 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
253 return status;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
254 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
255
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
256 #endif /* GLOBAL_IME */