annotate src/glbl_ime.cpp @ 8432:6af4329b5592 v7.4.1507

commit https://github.com/vim/vim/commit/4e329fcaf7122370a6d1815a30aaf29476d3f722 Author: Bram Moolenaar <Bram@vim.org> Date: Mon Mar 7 15:24:03 2016 +0100 patch 7.4.1507 Problem: Crash when starting a job fails. Solution: Check for the channel to be NULL. (idea by Yasuhiro Matsumoto)
author Christian Brabandt <cb@256bit.org>
date Mon, 07 Mar 2016 15:30:05 +0100
parents 04736b4030ec
children 4aead6a9b7a9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1 /* vi:set ts=8 sts=4 sw=4:
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)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
136 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
137 #if defined(WIN3264) && defined(FEAT_MBYTE)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
138 if (wide_WindowProc)
285
6c7fb97ce82e updated for version 7.0076
vimboss
parents: 7
diff changeset
139 lResult = DefWindowProcW(hWnd, Msg, wParam, lParam);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
140 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
141 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
142 lResult = DefWindowProc(hWnd, Msg, wParam, lParam);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
143 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
144 return lResult;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
145 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
146
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
147 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
148 * Replace with TranslateMessage()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
149 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
150 BOOL WINAPI
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
151 global_ime_TranslateMessage(CONST MSG *lpMsg)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
152 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
153 if (pIMsg == NULL || pIMsg->OnTranslateMessage(lpMsg) == S_FALSE)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
154 return TranslateMessage(lpMsg);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
155 return TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
156 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
157
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
158 /*
4352
04736b4030ec updated for version 7.3.925
Bram Moolenaar <bram@vim.org>
parents: 1186
diff changeset
159 * Set position of IME composition window.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
160 *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
161 * You have to call this before starting composition. If once composition
1186
2de44d8f2cf1 updated for version 7.1b
vimboss
parents: 376
diff changeset
162 * started, this can take no effect until that composition have finished. So
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
163 * you should handle WM_IME_STARTCOMPOSITION and call this function.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
164 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
165 void WINAPI
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
166 global_ime_set_position(POINT *pPoint)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
167 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
168 HIMC hImc = NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
169
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
170 if (pIApp == NULL || pPoint == NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
171 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
172
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
173 if (SUCCEEDED(pIApp->GetContext(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 COMPOSITIONFORM CompForm;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
176
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
177 CompForm.dwStyle = CFS_POINT;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
178 CompForm.ptCurrentPos = *pPoint;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
179 pIApp->SetCompositionWindow(hImc, &CompForm);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
180 pIApp->ReleaseContext(s_hWnd, hImc);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
181 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
182 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
183
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
184 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
185 * Set font to Global IME
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
186 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
187 /* GIME_TEST */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
188 void WINAPI
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
189 global_ime_set_font(LOGFONT *pFont)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
190 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
191 HIMC hImc = NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
192
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
193 if (pIApp == NULL || pFont == NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
194 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
195
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
196 if (SUCCEEDED(pIApp->GetContext(s_hWnd, &hImc)))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
197 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
198 pIApp->SetCompositionFontA(hImc, pFont);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
199 pIApp->ReleaseContext(s_hWnd, hImc);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
200 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
201 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
202
376
d2bc505a6d91 updated for version 7.0098
vimboss
parents: 285
diff changeset
203 #if 0
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
204 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
205 * 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
206 * English (turn off).
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
207 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
208 void WINAPI
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
209 global_ime_status_evacuate()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
210 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
211 HIMC hImc;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
212
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
213 if (pIApp != NULL && SUCCEEDED(pIApp->GetContext(s_hWnd, &hImc)))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
214 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
215 s_bStatus = (pIApp->GetOpenStatus(hImc) == 0) ? TRUE : FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
216 pIApp->SetOpenStatus(hImc, FALSE);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
217 pIApp->ReleaseContext(s_hWnd, hImc);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
218 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
219 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
220
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
221 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
222 * for IME control. Change IME status to last saved one.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
223 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
224 void WINAPI
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
225 global_ime_status_restore()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
226 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
227 HIMC hImc;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
228
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
229 if (pIApp != NULL && SUCCEEDED(pIApp->GetContext(s_hWnd, &hImc)))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
230 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
231 pIApp->SetOpenStatus(hImc, s_bStatus);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
232 pIApp->ReleaseContext(s_hWnd, hImc);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
233 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
234 }
376
d2bc505a6d91 updated for version 7.0098
vimboss
parents: 285
diff changeset
235 #endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
236
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
237 void WINAPI
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
238 global_ime_set_status(int status)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
239 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
240 HIMC hImc;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
241
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
242 if (pIApp != NULL && SUCCEEDED(pIApp->GetContext(s_hWnd, &hImc)))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
243 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
244 pIApp->SetOpenStatus(hImc, status ? TRUE : FALSE);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
245 pIApp->ReleaseContext(s_hWnd, hImc);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
246 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
247 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
248
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
249 int WINAPI
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
250 global_ime_get_status()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
251 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
252 int status = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
253 HIMC hImc;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
254
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
255 if (pIApp != NULL && SUCCEEDED(pIApp->GetContext(s_hWnd, &hImc)))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
256 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
257 status = pIApp->GetOpenStatus(hImc) ? 1 : 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
258 pIApp->ReleaseContext(s_hWnd, hImc);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
259 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
260 return status;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
261 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
262
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
263 #endif /* GLOBAL_IME */