author | itakiguchi |
Tue, 30 Apr 2019 14:30:17 -0700 | |
changeset 54867 | 65297f60ba19 |
parent 52263 | 680ab6b53f6f |
permissions | -rw-r--r-- |
2 | 1 |
/* |
50350
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
2 |
* Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved. |
2 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
5506 | 7 |
* published by the Free Software Foundation. Oracle designates this |
2 | 8 |
* particular file as subject to the "Classpath" exception as provided |
5506 | 9 |
* by Oracle in the LICENSE file that accompanied this code. |
2 | 10 |
* |
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
15 |
* accompanied this code). |
|
16 |
* |
|
17 |
* You should have received a copy of the GNU General Public License version |
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
20 |
* |
|
5506 | 21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
22 |
* or visit www.oracle.com if you need additional information or have any |
|
23 |
* questions. |
|
2 | 24 |
*/ |
25 |
||
26 |
#ifdef HEADLESS |
|
27 |
#error This file should not be included in headless library |
|
28 |
#endif |
|
29 |
||
30 |
#include "awt.h" |
|
31 |
#include "awt_p.h" |
|
32 |
||
50350
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
33 |
#include <sun_awt_X11InputMethodBase.h> |
2 | 34 |
#include <sun_awt_X11InputMethod.h> |
35 |
#include <sun_awt_X11_XInputMethod.h> |
|
36 |
||
50350
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
37 |
#include <langinfo.h> |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
38 |
#include <stdio.h> |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
39 |
#include <stdlib.h> |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
40 |
#include <sys/time.h> |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
41 |
#include <wchar.h> |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
42 |
#include <wctype.h> |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
43 |
#include <X11/Intrinsic.h> |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
44 |
#include <X11/keysym.h> |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
45 |
#include <X11/Xlib.h> |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
46 |
|
2 | 47 |
#define THROW_OUT_OF_MEMORY_ERROR() \ |
48 |
JNU_ThrowOutOfMemoryError((JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2), NULL) |
|
49 |
||
50 |
struct X11InputMethodIDs { |
|
51 |
jfieldID pData; |
|
52 |
} x11InputMethodIDs; |
|
53 |
||
50350
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
54 |
static int PreeditStartCallback(XIC, XPointer, XPointer); |
2 | 55 |
static void PreeditDoneCallback(XIC, XPointer, XPointer); |
56 |
static void PreeditDrawCallback(XIC, XPointer, |
|
57 |
XIMPreeditDrawCallbackStruct *); |
|
58 |
static void PreeditCaretCallback(XIC, XPointer, |
|
59 |
XIMPreeditCaretCallbackStruct *); |
|
60 |
static void StatusStartCallback(XIC, XPointer, XPointer); |
|
61 |
static void StatusDoneCallback(XIC, XPointer, XPointer); |
|
62 |
static void StatusDrawCallback(XIC, XPointer, |
|
63 |
XIMStatusDrawCallbackStruct *); |
|
64 |
||
65 |
#define ROOT_WINDOW_STYLES (XIMPreeditNothing | XIMStatusNothing) |
|
66 |
#define NO_STYLES (XIMPreeditNone | XIMStatusNone) |
|
50350
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
67 |
/* added style to allow for in-place composition, such as "dead" keys for accents */ |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
68 |
#define IN_PLACE_STYLES (XIMPreeditNothing | XIMStatusNone) |
2 | 69 |
|
70 |
#define PreeditStartIndex 0 |
|
71 |
#define PreeditDoneIndex 1 |
|
72 |
#define PreeditDrawIndex 2 |
|
73 |
#define PreeditCaretIndex 3 |
|
74 |
#define StatusStartIndex 4 |
|
75 |
#define StatusDoneIndex 5 |
|
76 |
#define StatusDrawIndex 6 |
|
77 |
#define NCALLBACKS 7 |
|
50350
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
78 |
|
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
79 |
#define STATUS_BORDER 2 /* Status Border width */ |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
80 |
#define CARET_OFFSET 1 /* Offset of caret position (pixel) */ |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
81 |
#define BORDER_MARGIN 3 /* BORDER MARGIN width */ |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
82 |
#define STATUS_MARGIN 7 /* Margin between the status window and its parent window */ |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
83 |
#define PREEDIT_ATTR_MASK (XIMReverse|XIMUnderline) |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
84 |
/* Preedit attribute which host adapter can handle */ |
2 | 85 |
|
86 |
/* |
|
87 |
* Callback function pointers: the order has to match the *Index |
|
88 |
* values above. |
|
89 |
*/ |
|
90 |
static XIMProc callback_funcs[NCALLBACKS] = { |
|
54867
65297f60ba19
8213232: Unix/X11 setCompositionEnableNative issue
itakiguchi
parents:
52263
diff
changeset
|
91 |
(XIMProc)(void *)&PreeditStartCallback, |
2 | 92 |
(XIMProc)PreeditDoneCallback, |
93 |
(XIMProc)PreeditDrawCallback, |
|
94 |
(XIMProc)PreeditCaretCallback, |
|
95 |
(XIMProc)StatusStartCallback, |
|
96 |
(XIMProc)StatusDoneCallback, |
|
97 |
(XIMProc)StatusDrawCallback, |
|
98 |
}; |
|
99 |
||
100 |
#define MAX_STATUS_LEN 100 |
|
101 |
typedef struct { |
|
102 |
Window w; /*status window id */ |
|
103 |
Window root; /*the root window id */ |
|
104 |
Window parent; /*parent shell window */ |
|
50350
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
105 |
Window grandParent; /*window has WM frame */ |
2 | 106 |
int x, y; /*parent's upperleft position */ |
107 |
int width, height; /*parent's width, height */ |
|
108 |
GC lightGC; /*gc for light border */ |
|
109 |
GC dimGC; /*gc for dim border */ |
|
110 |
GC bgGC; /*normal painting */ |
|
111 |
GC fgGC; /*normal painting */ |
|
112 |
int statusW, statusH; /*status window's w, h */ |
|
113 |
int rootW, rootH; /*root window's w, h */ |
|
114 |
int bWidth; /*border width */ |
|
50350
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
115 |
wchar_t status[MAX_STATUS_LEN + 1]; /*status text */ |
2 | 116 |
XFontSet fontset; /*fontset for drawing */ |
117 |
int off_x, off_y; |
|
118 |
Bool on; /*if the status window on*/ |
|
50350
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
119 |
int fOff; /* font base line(in pixel) from top */ |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
120 |
int fBot; /* font bottom line(in pixel) from top */ |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
121 |
int peTextW; /* Composition text width in pixel */ |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
122 |
wchar_t* peText; /* Composed string (wide char.) */ |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
123 |
XIMFeedback* peAttr; /* Composed text attribute */ |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
124 |
int peCaret; /* Caret position in number of character */ |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
125 |
Bool status_ready; /* Not draw Status at XCreateIC */ |
2 | 126 |
} StatusWindow; |
127 |
||
128 |
/* |
|
129 |
* X11InputMethodData keeps per X11InputMethod instance information. A pointer |
|
130 |
* to this data structure is kept in an X11InputMethod object (pData). |
|
131 |
*/ |
|
132 |
typedef struct _X11InputMethodData { |
|
133 |
XIC current_ic; /* current X Input Context */ |
|
134 |
XIC ic_active; /* X Input Context for active clients */ |
|
135 |
XIC ic_passive; /* X Input Context for passive clients */ |
|
136 |
XIMCallback *callbacks; /* callback parameters */ |
|
137 |
jobject x11inputmethod; /* global ref to X11InputMethod instance */ |
|
138 |
/* associated with the XIC */ |
|
139 |
StatusWindow *statusWindow; /* our own status window */ |
|
50350
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
140 |
Bool passiveStatusWindow;/* Passive Client uses StatusWindow */ |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
141 |
Bool isActiveClient; /* True:clinet is active */ |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
142 |
Bool forceReset; /* True: call resetXIC before UnsetICFocus */ |
2 | 143 |
} X11InputMethodData; |
144 |
||
145 |
/* reference to the current X11InputMethod instance, it is always |
|
146 |
point to the global reference to the X11InputMethodObject since |
|
147 |
it could be referenced by different threads. */ |
|
148 |
jobject currentX11InputMethodInstance = NULL; |
|
149 |
||
150 |
Window currentFocusWindow = 0; /* current window that has focus for input |
|
151 |
method. (the best place to put this |
|
152 |
information should be |
|
153 |
currentX11InputMethodInstance's pData) */ |
|
154 |
static XIM X11im = NULL; |
|
155 |
Display * dpy = NULL; |
|
156 |
||
157 |
#define GetJNIEnv() (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2) |
|
158 |
||
159 |
static X11InputMethodData * getX11InputMethodData(JNIEnv *, jobject); |
|
160 |
static void setX11InputMethodData(JNIEnv *, jobject, X11InputMethodData *); |
|
161 |
static void destroyX11InputMethodData(JNIEnv *, X11InputMethodData *); |
|
162 |
static void freeX11InputMethodData(JNIEnv *, X11InputMethodData *); |
|
163 |
||
50350
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
164 |
/* Prototype for this function is missing in AIX Xlib.h */ |
2 | 165 |
extern char *XSetIMValues( |
166 |
#if NeedVarargsPrototypes |
|
167 |
XIM /* im */, ... |
|
168 |
#endif |
|
169 |
); |
|
50350
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
170 |
|
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
171 |
static int st_wcslen(wchar_t *string); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
172 |
static Bool isPreeditStateActive(XIC ic); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
173 |
static void * buf_insert(void * src, void * insert, int size, |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
174 |
int src_len, int ins_len, int offset); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
175 |
static void * handle_buffer(void * source, void * insert, |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
176 |
int size, int src_len, int ins_len, |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
177 |
int del_len, int offset); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
178 |
static void preedit_draw_passive(X11InputMethodData *pX11IMData, |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
179 |
XIMPreeditDrawCallbackStruct *pre_draw); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
180 |
static void resetPassivePreeditText(StatusWindow *statusWindow); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
181 |
static void draw_caret(StatusWindow *statusWindow, GC gc, int pos); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
182 |
static int get_next_attr(int len, unsigned long *attr); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
183 |
static void draw_preedit(StatusWindow *statusWindow); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
184 |
static void align_status(StatusWindow *statusWindow); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
185 |
static void shrink_status(StatusWindow *statusWindow); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
186 |
static GC create_gc(Window win, Bool isReverse); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
187 |
static XFontSet create_fontset(void); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
188 |
static Bool is_text_available(XIMText * text); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
189 |
static Bool isNativeIm(); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
190 |
static Window getGrandParent(Window parent); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
191 |
static void moveStatusWindow(StatusWindow *statusWindow); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
192 |
static void arrange_window_stack(StatusWindow* statusWindow); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
193 |
static Window get_current_focus(XIC ic); |
2 | 194 |
|
195 |
/* |
|
196 |
* This function is stolen from /src/solaris/hpi/src/system_md.c |
|
197 |
* It is used in setting the time in Java-level InputEvents |
|
198 |
*/ |
|
199 |
jlong |
|
200 |
awt_util_nowMillisUTC() |
|
201 |
{ |
|
202 |
struct timeval t; |
|
203 |
gettimeofday(&t, NULL); |
|
204 |
return ((jlong)t.tv_sec) * 1000 + (jlong)(t.tv_usec/1000); |
|
205 |
} |
|
206 |
||
207 |
/* |
|
208 |
* Converts the wchar_t string to a multi-byte string calling wcstombs(). A |
|
209 |
* buffer is allocated by malloc() to store the multi-byte string. NULL is |
|
210 |
* returned if the given wchar_t string pointer is NULL or buffer allocation is |
|
211 |
* failed. |
|
212 |
*/ |
|
213 |
static char * |
|
214 |
wcstombsdmp(wchar_t *wcs, int len) |
|
215 |
{ |
|
216 |
size_t n; |
|
217 |
char *mbs; |
|
218 |
||
219 |
if (wcs == NULL) |
|
220 |
return NULL; |
|
221 |
||
222 |
n = len*MB_CUR_MAX + 1; |
|
223 |
||
224 |
mbs = (char *) malloc(n * sizeof(char)); |
|
225 |
if (mbs == NULL) { |
|
226 |
THROW_OUT_OF_MEMORY_ERROR(); |
|
227 |
return NULL; |
|
228 |
} |
|
229 |
||
230 |
/* TODO: check return values... Handle invalid characters properly... */ |
|
35677 | 231 |
if (wcstombs(mbs, wcs, n) == (size_t)-1) { |
232 |
free(mbs); |
|
2 | 233 |
return NULL; |
35677 | 234 |
} |
2 | 235 |
|
236 |
return mbs; |
|
237 |
} |
|
238 |
||
239 |
static X11InputMethodData * getX11InputMethodData(JNIEnv * env, jobject imInstance) { |
|
240 |
X11InputMethodData *pX11IMData = |
|
241 |
(X11InputMethodData *)JNU_GetLongFieldAsPtr(env, imInstance, x11InputMethodIDs.pData); |
|
242 |
||
243 |
/* |
|
244 |
* In case the XIM server was killed somehow, reset X11InputMethodData. |
|
245 |
*/ |
|
246 |
if (X11im == NULL && pX11IMData != NULL) { |
|
247 |
JNU_CallMethodByName(env, NULL, pX11IMData->x11inputmethod, |
|
248 |
"flushText", |
|
249 |
"()V"); |
|
24130
db72fc72f87b
8031001: [Parfait] warnings from b121 for jdk/src/solaris/native/sun/awt: JNI-related warnings
pchelko
parents:
18135
diff
changeset
|
250 |
JNU_CHECK_EXCEPTION_RETURN(env, NULL); |
2 | 251 |
/* IMPORTANT: |
252 |
The order of the following calls is critical since "imInstance" may |
|
253 |
point to the global reference itself, if "freeX11InputMethodData" is called |
|
254 |
first, the global reference will be destroyed and "setX11InputMethodData" |
|
255 |
will in fact fail silently. So pX11IMData will not be set to NULL. |
|
256 |
This could make the original java object refers to a deleted pX11IMData |
|
257 |
object. |
|
258 |
*/ |
|
259 |
setX11InputMethodData(env, imInstance, NULL); |
|
260 |
freeX11InputMethodData(env, pX11IMData); |
|
261 |
pX11IMData = NULL; |
|
262 |
} |
|
263 |
||
264 |
return pX11IMData; |
|
265 |
} |
|
266 |
||
267 |
static void setX11InputMethodData(JNIEnv * env, jobject imInstance, X11InputMethodData *pX11IMData) { |
|
268 |
JNU_SetLongFieldFromPtr(env, imInstance, x11InputMethodIDs.pData, pX11IMData); |
|
269 |
} |
|
270 |
||
271 |
/* this function should be called within AWT_LOCK() */ |
|
272 |
static void |
|
273 |
destroyX11InputMethodData(JNIEnv *env, X11InputMethodData *pX11IMData) |
|
274 |
{ |
|
275 |
/* |
|
276 |
* Destroy XICs |
|
277 |
*/ |
|
278 |
if (pX11IMData == NULL) { |
|
279 |
return; |
|
280 |
} |
|
281 |
||
282 |
if (pX11IMData->ic_active != (XIC)0) { |
|
283 |
XUnsetICFocus(pX11IMData->ic_active); |
|
284 |
XDestroyIC(pX11IMData->ic_active); |
|
285 |
if (pX11IMData->ic_active != pX11IMData->ic_passive) { |
|
286 |
if (pX11IMData->ic_passive != (XIC)0) { |
|
287 |
XUnsetICFocus(pX11IMData->ic_passive); |
|
288 |
XDestroyIC(pX11IMData->ic_passive); |
|
289 |
} |
|
290 |
pX11IMData->ic_passive = (XIC)0; |
|
291 |
pX11IMData->current_ic = (XIC)0; |
|
292 |
} |
|
293 |
} |
|
294 |
||
295 |
freeX11InputMethodData(env, pX11IMData); |
|
296 |
} |
|
297 |
||
298 |
static void |
|
299 |
freeX11InputMethodData(JNIEnv *env, X11InputMethodData *pX11IMData) |
|
300 |
{ |
|
301 |
if (pX11IMData->statusWindow != NULL){ |
|
302 |
StatusWindow *sw = pX11IMData->statusWindow; |
|
303 |
XFreeGC(awt_display, sw->lightGC); |
|
304 |
XFreeGC(awt_display, sw->dimGC); |
|
305 |
XFreeGC(awt_display, sw->bgGC); |
|
306 |
XFreeGC(awt_display, sw->fgGC); |
|
307 |
if (sw->fontset != NULL) { |
|
308 |
XFreeFontSet(awt_display, sw->fontset); |
|
309 |
} |
|
310 |
XDestroyWindow(awt_display, sw->w); |
|
50350
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
311 |
if (pX11IMData->statusWindow->peText){ |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
312 |
free((void *)pX11IMData->statusWindow->peText); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
313 |
pX11IMData->statusWindow->peText = NULL; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
314 |
} |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
315 |
if (pX11IMData->statusWindow->peAttr){ |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
316 |
free((void *)pX11IMData->statusWindow->peAttr); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
317 |
pX11IMData->statusWindow->peAttr = NULL; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
318 |
} |
2 | 319 |
free((void*)sw); |
320 |
} |
|
321 |
||
322 |
if (pX11IMData->callbacks) |
|
323 |
free((void *)pX11IMData->callbacks); |
|
324 |
||
325 |
if (env) { |
|
326 |
(*env)->DeleteGlobalRef(env, pX11IMData->x11inputmethod); |
|
327 |
} |
|
328 |
||
329 |
free((void *)pX11IMData); |
|
330 |
} |
|
331 |
||
332 |
/* |
|
333 |
* Sets or unsets the focus to the given XIC. |
|
334 |
*/ |
|
335 |
static void |
|
336 |
setXICFocus(XIC ic, unsigned short req) |
|
337 |
{ |
|
338 |
if (ic == NULL) { |
|
339 |
(void)fprintf(stderr, "Couldn't find X Input Context\n"); |
|
340 |
return; |
|
341 |
} |
|
342 |
if (req == 1) |
|
343 |
XSetICFocus(ic); |
|
344 |
else |
|
345 |
XUnsetICFocus(ic); |
|
346 |
} |
|
347 |
||
348 |
/* |
|
349 |
* Sets the focus window to the given XIC. |
|
350 |
*/ |
|
351 |
static void |
|
352 |
setXICWindowFocus(XIC ic, Window w) |
|
353 |
{ |
|
354 |
if (ic == NULL) { |
|
355 |
(void)fprintf(stderr, "Couldn't find X Input Context\n"); |
|
356 |
return; |
|
357 |
} |
|
358 |
(void) XSetICValues(ic, XNFocusWindow, w, NULL); |
|
359 |
} |
|
360 |
||
361 |
/* |
|
362 |
* Invokes XmbLookupString() to get something from the XIM. It invokes |
|
363 |
* X11InputMethod.dispatchCommittedText() if XmbLookupString() returns |
|
364 |
* committed text. This function is called from handleKeyEvent in canvas.c and |
|
365 |
* it's under the Motif event loop thread context. |
|
366 |
* |
|
367 |
* Buffer usage: There is a bug in XFree86-4.3.0 XmbLookupString implementation, |
|
368 |
* where it never returns XBufferOverflow. We need to allocate the initial lookup buffer |
|
369 |
* big enough, so that the possibility that user encounters this problem is relatively |
|
370 |
* small. When this bug gets fixed, we can make the initial buffer size smaller. |
|
371 |
* Note that XmbLookupString() sometimes produces a non-null-terminated string. |
|
372 |
* |
|
373 |
* Returns True when there is a keysym value to be handled. |
|
374 |
*/ |
|
375 |
#define INITIAL_LOOKUP_BUF_SIZE 512 |
|
376 |
||
18135
d9be76f1a19c
8005661: [parfait] Possible buffer overrun in jdk/src/solaris/native/sun/awt/awt_GraphicsEnv.c
pchelko
parents:
17923
diff
changeset
|
377 |
Boolean |
2 | 378 |
awt_x11inputmethod_lookupString(XKeyPressedEvent *event, KeySym *keysymp) |
379 |
{ |
|
380 |
JNIEnv *env = GetJNIEnv(); |
|
381 |
X11InputMethodData *pX11IMData = NULL; |
|
50350
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
382 |
int buf_len = INITIAL_LOOKUP_BUF_SIZE; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
383 |
char mbbuf[INITIAL_LOOKUP_BUF_SIZE]; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
384 |
char *buf; |
2 | 385 |
KeySym keysym = NoSymbol; |
386 |
Status status; |
|
387 |
int mblen; |
|
388 |
jstring javastr; |
|
389 |
XIC ic; |
|
18135
d9be76f1a19c
8005661: [parfait] Possible buffer overrun in jdk/src/solaris/native/sun/awt/awt_GraphicsEnv.c
pchelko
parents:
17923
diff
changeset
|
390 |
Boolean result = True; |
d9be76f1a19c
8005661: [parfait] Possible buffer overrun in jdk/src/solaris/native/sun/awt/awt_GraphicsEnv.c
pchelko
parents:
17923
diff
changeset
|
391 |
static Boolean composing = False; |
2 | 392 |
|
393 |
/* |
|
394 |
printf("lookupString: entering...\n"); |
|
395 |
*/ |
|
396 |
||
397 |
pX11IMData = getX11InputMethodData(env, currentX11InputMethodInstance); |
|
398 |
||
399 |
if (pX11IMData == NULL) { |
|
400 |
return False; |
|
401 |
} |
|
402 |
||
403 |
if ((ic = pX11IMData->current_ic) == (XIC)0){ |
|
404 |
return False; |
|
405 |
} |
|
406 |
||
50350
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
407 |
buf = mbbuf; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
408 |
mblen = XmbLookupString(ic, event, buf, |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
409 |
buf_len - 1, &keysym, &status); |
2 | 410 |
|
411 |
/* |
|
412 |
* In case of overflow, a buffer is allocated and it retries |
|
413 |
* XmbLookupString(). |
|
414 |
*/ |
|
415 |
if (status == XBufferOverflow) { |
|
50350
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
416 |
buf_len = mblen + 1; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
417 |
buf = (char *)malloc(buf_len); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
418 |
if (buf == NULL) { |
2 | 419 |
THROW_OUT_OF_MEMORY_ERROR(); |
420 |
return result; |
|
421 |
} |
|
50350
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
422 |
mblen = XmbLookupString(ic, event, buf, buf_len, &keysym, &status); |
2 | 423 |
} |
50350
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
424 |
buf[mblen] = 0; |
2 | 425 |
|
426 |
/* Get keysym without taking modifiers into account first to map |
|
427 |
* to AWT keyCode table. |
|
428 |
*/ |
|
429 |
switch (status) { |
|
430 |
case XLookupBoth: |
|
431 |
if (!composing) { |
|
432 |
if (event->keycode != 0) { |
|
433 |
*keysymp = keysym; |
|
434 |
result = False; |
|
435 |
break; |
|
436 |
} |
|
437 |
} |
|
438 |
composing = False; |
|
439 |
/*FALLTHRU*/ |
|
440 |
case XLookupChars: |
|
50350
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
441 |
/* |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
442 |
printf("lookupString: status=XLookupChars, type=%d, state=%x, keycode=%x, keysym=%x\n", |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
443 |
event->type, event->state, event->keycode, keysym); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
444 |
*/ |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
445 |
javastr = JNU_NewStringPlatform(env, (const char *)buf); |
2 | 446 |
if (javastr != NULL) { |
447 |
JNU_CallMethodByName(env, NULL, |
|
448 |
currentX11InputMethodInstance, |
|
449 |
"dispatchCommittedText", |
|
450 |
"(Ljava/lang/String;J)V", |
|
451 |
javastr, |
|
452 |
event->time); |
|
50350
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
453 |
if ((*env)->ExceptionOccurred(env)) { |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
454 |
(*env)->ExceptionDescribe(env); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
455 |
(*env)->ExceptionClear(env); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
456 |
} |
2 | 457 |
} |
458 |
break; |
|
459 |
||
460 |
case XLookupKeySym: |
|
50350
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
461 |
/* |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
462 |
printf("lookupString: status=XLookupKeySym, type=%d, state=%x, keycode=%x, keysym=%x\n", |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
463 |
event->type, event->state, event->keycode, keysym); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
464 |
*/ |
2 | 465 |
if (keysym == XK_Multi_key) |
466 |
composing = True; |
|
467 |
if (! composing) { |
|
468 |
*keysymp = keysym; |
|
469 |
result = False; |
|
470 |
} |
|
471 |
break; |
|
472 |
||
473 |
case XLookupNone: |
|
50350
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
474 |
/* |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
475 |
printf("lookupString: status=XLookupNone, type=%d, state=%x, keycode=%x, keysym=%x\n", |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
476 |
event->type, event->state, event->keycode, keysym); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
477 |
*/ |
2 | 478 |
break; |
479 |
} |
|
480 |
||
50350
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
481 |
if (buf != mbbuf) { |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
482 |
free(buf); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
483 |
} |
2 | 484 |
return result; |
485 |
} |
|
486 |
||
50350
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
487 |
static StatusWindow *createStatusWindow(Window parent) { |
2 | 488 |
StatusWindow *statusWindow; |
489 |
XSetWindowAttributes attrib; |
|
490 |
unsigned long attribmask; |
|
491 |
Window containerWindow; |
|
492 |
Window status; |
|
493 |
Window child; |
|
494 |
XWindowAttributes xwa; |
|
495 |
XWindowAttributes xxwa; |
|
496 |
/* Variable for XCreateFontSet()*/ |
|
497 |
char **mclr; |
|
498 |
int mccr = 0; |
|
499 |
char *dsr; |
|
37699
c3d9835483f9
8154269: Remove unused or unnecessary Xm/Xt files and header includes
prr
parents:
35677
diff
changeset
|
500 |
unsigned long bg, fg, light, dim; |
6825 | 501 |
int x, y, off_x, off_y, xx, yy; |
502 |
unsigned int w, h, bw, depth; |
|
2 | 503 |
XGCValues values; |
504 |
unsigned long valuemask = 0; /*ignore XGCvalue and use defaults*/ |
|
505 |
int screen = 0; |
|
506 |
int i; |
|
507 |
AwtGraphicsConfigDataPtr adata; |
|
508 |
extern int awt_numScreens; |
|
509 |
/*hardcode the size right now, should get the size base on font*/ |
|
50350
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
510 |
int width=80, height=22; |
2 | 511 |
Window rootWindow; |
512 |
Window *ignoreWindowPtr; |
|
513 |
unsigned int ignoreUnit; |
|
50350
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
514 |
Window grandParent; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
515 |
Window target; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
516 |
XFontSet fontset; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
517 |
|
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
518 |
fontset = create_fontset(); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
519 |
if (NULL == fontset) { |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
520 |
return NULL; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
521 |
} |
2 | 522 |
|
523 |
XGetGeometry(dpy, parent, &rootWindow, &x, &y, &w, &h, &bw, &depth); |
|
524 |
||
525 |
attrib.override_redirect = True; |
|
526 |
attribmask = CWOverrideRedirect; |
|
527 |
for (i = 0; i < awt_numScreens; i++) { |
|
528 |
if (RootWindow(dpy, i) == rootWindow) { |
|
529 |
screen = i; |
|
530 |
break; |
|
531 |
} |
|
532 |
} |
|
533 |
adata = getDefaultConfig(screen); |
|
534 |
bg = adata->AwtColorMatch(255, 255, 255, adata); |
|
535 |
fg = adata->AwtColorMatch(0, 0, 0, adata); |
|
536 |
light = adata->AwtColorMatch(195, 195, 195, adata); |
|
537 |
dim = adata->AwtColorMatch(128, 128, 128, adata); |
|
538 |
||
50350
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
539 |
grandParent = getGrandParent(parent); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
540 |
target = (grandParent == 0) ? parent : grandParent; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
541 |
XGetWindowAttributes(dpy, target, &xwa); |
2 | 542 |
bw = 2; /*xwa.border_width does not have the correct value*/ |
543 |
||
544 |
/*compare the size difference between parent container |
|
545 |
and shell widget, the diff should be the border frame |
|
546 |
and title bar height (?)*/ |
|
547 |
||
548 |
XQueryTree( dpy, |
|
50350
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
549 |
target, |
2 | 550 |
&rootWindow, |
551 |
&containerWindow, |
|
552 |
&ignoreWindowPtr, |
|
553 |
&ignoreUnit); |
|
554 |
XGetWindowAttributes(dpy, containerWindow, &xxwa); |
|
555 |
||
50350
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
556 |
XTranslateCoordinates(dpy, |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
557 |
target, xwa.root, |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
558 |
0, 0, |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
559 |
&x, &y, &child); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
560 |
|
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
561 |
if (containerWindow == rootWindow) { |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
562 |
off_x = 0; off_y = STATUS_MARGIN; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
563 |
} else { |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
564 |
XGetWindowAttributes(dpy, containerWindow, &xxwa); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
565 |
off_x = (xxwa.width - xwa.width) / 2; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
566 |
/* off_y = xxwa.height - xwa.height - off_x;*/ /*it's magic:-) */ |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
567 |
{ |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
568 |
int cx, cy; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
569 |
XTranslateCoordinates(dpy, |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
570 |
containerWindow, xxwa.root, |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
571 |
0, 0, |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
572 |
&cx, &cy, |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
573 |
&child); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
574 |
off_y = (xxwa.height + cy) - (xwa.height + y); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
575 |
} |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
576 |
} |
2 | 577 |
|
578 |
/*get the size of root window*/ |
|
579 |
XGetWindowAttributes(dpy, rootWindow, &xxwa); |
|
580 |
||
581 |
XTranslateCoordinates(dpy, |
|
50350
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
582 |
target, xwa.root, |
2 | 583 |
xwa.x, xwa.y, |
584 |
&x, &y, |
|
585 |
&child); |
|
586 |
xx = x - off_x; |
|
587 |
yy = y + xwa.height - off_y; |
|
588 |
if (xx < 0 ){ |
|
589 |
xx = 0; |
|
590 |
} |
|
50350
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
591 |
if (xx + width > xxwa.width) { |
2 | 592 |
xx = xxwa.width - width; |
593 |
} |
|
50350
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
594 |
if (yy + height > xxwa.height) { |
2 | 595 |
yy = xxwa.height - height; |
596 |
} |
|
597 |
||
50350
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
598 |
if ((DefaultVisual(dpy,screen))->class != adata->awt_visInfo.visual->class && |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
599 |
adata->awt_visInfo.visual->class == TrueColor) { |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
600 |
attrib.colormap = XCreateColormap(dpy, xwa.root, |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
601 |
adata->awt_visInfo.visual, AllocNone ); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
602 |
attrib.border_pixel = BlackPixel(dpy, screen) ; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
603 |
attribmask |= CWColormap | CWBorderPixel; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
604 |
} |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
605 |
|
2 | 606 |
status = XCreateWindow(dpy, |
607 |
xwa.root, |
|
608 |
xx, yy, |
|
609 |
width, height, |
|
610 |
0, |
|
611 |
xwa.depth, |
|
612 |
InputOutput, |
|
613 |
adata->awt_visInfo.visual, |
|
614 |
attribmask, &attrib); |
|
615 |
XSelectInput(dpy, status, |
|
616 |
ExposureMask | StructureNotifyMask | EnterWindowMask | |
|
617 |
LeaveWindowMask | VisibilityChangeMask); |
|
50350
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
618 |
if (grandParent != 0){ |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
619 |
long mask; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
620 |
XGetWindowAttributes(dpy, grandParent, &xwa); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
621 |
mask = xwa.your_event_mask | StructureNotifyMask | |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
622 |
VisibilityChangeMask | PropertyChangeMask; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
623 |
XSelectInput(dpy, grandParent,mask); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
624 |
} |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
625 |
|
2 | 626 |
statusWindow = (StatusWindow*) calloc(1, sizeof(StatusWindow)); |
627 |
if (statusWindow == NULL){ |
|
628 |
THROW_OUT_OF_MEMORY_ERROR(); |
|
629 |
return NULL; |
|
630 |
} |
|
631 |
statusWindow->w = status; |
|
50350
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
632 |
statusWindow->fontset = fontset; |
2 | 633 |
statusWindow->parent = parent; |
50350
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
634 |
statusWindow->grandParent = grandParent; |
2 | 635 |
statusWindow->on = False; |
636 |
statusWindow->x = x; |
|
637 |
statusWindow->y = y; |
|
638 |
statusWindow->width = xwa.width; |
|
639 |
statusWindow->height = xwa.height; |
|
640 |
statusWindow->off_x = off_x; |
|
641 |
statusWindow->off_y = off_y; |
|
642 |
statusWindow->bWidth = bw; |
|
643 |
statusWindow->statusH = height; |
|
644 |
statusWindow->statusW = width; |
|
50350
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
645 |
statusWindow->peTextW = 0; |
2 | 646 |
statusWindow->rootH = xxwa.height; |
647 |
statusWindow->rootW = xxwa.width; |
|
648 |
statusWindow->lightGC = XCreateGC(dpy, status, valuemask, &values); |
|
649 |
XSetForeground(dpy, statusWindow->lightGC, light); |
|
650 |
statusWindow->dimGC = XCreateGC(dpy, status, valuemask, &values); |
|
651 |
XSetForeground(dpy, statusWindow->dimGC, dim); |
|
50350
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
652 |
statusWindow->fgGC = create_gc(status, FALSE); |
2 | 653 |
XSetForeground(dpy, statusWindow->fgGC, fg); |
50350
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
654 |
statusWindow->bgGC = create_gc(status, TRUE); |
2 | 655 |
XSetForeground(dpy, statusWindow->bgGC, bg); |
50350
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
656 |
statusWindow->status_ready = False; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
657 |
wcscpy(statusWindow->status, L""); |
2 | 658 |
return statusWindow; |
659 |
} |
|
660 |
||
661 |
/* This method is to turn off or turn on the status window. */ |
|
662 |
static void onoffStatusWindow(X11InputMethodData* pX11IMData, |
|
663 |
Window parent, |
|
664 |
Bool ON){ |
|
665 |
XWindowAttributes xwa; |
|
666 |
Window child; |
|
667 |
int x, y; |
|
668 |
StatusWindow *statusWindow = NULL; |
|
669 |
||
50350
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
670 |
if (NULL == pX11IMData || |
2 | 671 |
NULL == (statusWindow = pX11IMData->statusWindow)){ |
672 |
return; |
|
673 |
} |
|
674 |
||
50350
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
675 |
if (ON == False) { |
2 | 676 |
XUnmapWindow(dpy, statusWindow->w); |
50350
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
677 |
return; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
678 |
} |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
679 |
if (NULL == currentX11InputMethodInstance){ |
2 | 680 |
return; |
681 |
} |
|
50350
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
682 |
{ |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
683 |
JNIEnv *env = GetJNIEnv(); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
684 |
parent = JNU_CallMethodByName(env, NULL, pX11IMData->x11inputmethod, |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
685 |
"getCurrentParentWindow", |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
686 |
"()J").j; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
687 |
if ((*env)->ExceptionOccurred(env)) { |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
688 |
(*env)->ExceptionDescribe(env); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
689 |
(*env)->ExceptionClear(env); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
690 |
} |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
691 |
} |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
692 |
if (statusWindow->parent != parent) { |
2 | 693 |
statusWindow->parent = parent; |
694 |
} |
|
50350
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
695 |
if (st_wcslen(statusWindow->status) > 0 || |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
696 |
(statusWindow->peText != NULL && st_wcslen(statusWindow->peText) > 0 )) { |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
697 |
moveStatusWindow(statusWindow); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
698 |
XMapRaised(dpy, statusWindow->w); |
2 | 699 |
} |
700 |
} |
|
701 |
||
702 |
void paintStatusWindow(StatusWindow *statusWindow){ |
|
703 |
Window win = statusWindow->w; |
|
704 |
GC lightgc = statusWindow->lightGC; |
|
705 |
GC dimgc = statusWindow->dimGC; |
|
706 |
GC bggc = statusWindow->bgGC; |
|
707 |
GC fggc = statusWindow->fgGC; |
|
708 |
||
709 |
int width = statusWindow->statusW; |
|
710 |
int height = statusWindow->statusH; |
|
711 |
int bwidth = statusWindow->bWidth; |
|
50350
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
712 |
int len; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
713 |
XRectangle logical, ink; |
2 | 714 |
|
50350
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
715 |
if (NULL == statusWindow) return; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
716 |
if ((len = st_wcslen(statusWindow->status)) == 0) { |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
717 |
return; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
718 |
} |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
719 |
XwcTextExtents(statusWindow->fontset, statusWindow->status, |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
720 |
len, &ink, &logical); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
721 |
width = logical.width; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
722 |
height = logical.height; |
2 | 723 |
|
50350
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
724 |
XFillRectangle(dpy, win, bggc, 0, 0, width+2, height+2); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
725 |
|
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
726 |
XDrawLine(dpy, win, fggc, 0, 0, width+2, 0); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
727 |
XDrawLine(dpy, win, fggc, 0, height+2, width+2, height+2); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
728 |
XDrawLine(dpy, win, fggc, 0, 0, 0, height+2); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
729 |
XDrawLine(dpy, win, fggc, width+2, 0, width+2, height+2); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
730 |
|
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
731 |
if (statusWindow->fontset) { |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
732 |
XwcDrawString(dpy, win, statusWindow->fontset, fggc, |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
733 |
-logical.x + 1, -logical.y + 1, |
2 | 734 |
statusWindow->status, |
50350
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
735 |
st_wcslen(statusWindow->status)); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
736 |
} else { |
2 | 737 |
/*too bad we failed to create a fontset for this locale*/ |
738 |
XDrawString(dpy, win, fggc, bwidth + 2, height - bwidth - 4, |
|
739 |
"[InputMethod ON]", strlen("[InputMethod ON]")); |
|
740 |
} |
|
741 |
} |
|
742 |
||
50350
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
743 |
Bool statusWindowEventHandler(XEvent event) { |
2 | 744 |
JNIEnv *env = GetJNIEnv(); |
745 |
X11InputMethodData *pX11IMData = NULL; |
|
746 |
StatusWindow *statusWindow; |
|
747 |
||
50350
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
748 |
if (NULL == currentX11InputMethodInstance || |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
749 |
NULL == (pX11IMData = getX11InputMethodData(env, currentX11InputMethodInstance)) || |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
750 |
NULL == (statusWindow = pX11IMData->statusWindow)) |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
751 |
{ |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
752 |
return False; |
2 | 753 |
} |
754 |
||
50350
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
755 |
if (statusWindow->w == event.xany.window) { |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
756 |
switch (event.type) { |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
757 |
case Expose: |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
758 |
paintStatusWindow(statusWindow); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
759 |
if (statusWindow->peText) |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
760 |
draw_preedit(statusWindow); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
761 |
arrange_window_stack(statusWindow); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
762 |
break; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
763 |
case ConfigureNotify: |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
764 |
case VisibilityNotify: |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
765 |
arrange_window_stack(statusWindow); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
766 |
break; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
767 |
/* |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
768 |
case UnmapNotify: |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
769 |
case VisibilityNotify: |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
770 |
break; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
771 |
*/ |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
772 |
default: |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
773 |
break; |
2 | 774 |
} |
50350
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
775 |
return True; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
776 |
} else if ((statusWindow->parent == event.xany.window) || |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
777 |
(statusWindow->grandParent && statusWindow->grandParent == event.xany.window)) { |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
778 |
switch (event.type) { |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
779 |
case MapNotify: |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
780 |
if (statusWindow->on) { |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
781 |
onoffStatusWindow(pX11IMData, statusWindow->parent, True); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
782 |
} |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
783 |
break; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
784 |
case UnmapNotify: |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
785 |
onoffStatusWindow(pX11IMData, 0, False); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
786 |
break; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
787 |
case VisibilityNotify: |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
788 |
if (statusWindow->on) { |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
789 |
arrange_window_stack(statusWindow); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
790 |
} |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
791 |
break; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
792 |
case ConfigureNotify: |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
793 |
if (statusWindow->grandParent && statusWindow->on) { |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
794 |
moveStatusWindow(statusWindow); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
795 |
} |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
796 |
case PropertyNotify: |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
797 |
if (statusWindow->on) { |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
798 |
arrange_window_stack(statusWindow); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
799 |
} |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
800 |
break; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
801 |
default: |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
802 |
break; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
803 |
} |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
804 |
} |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
805 |
return False; |
2 | 806 |
} |
807 |
||
50350
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
808 |
static void adjustStatusWindow(Window shell) { |
2 | 809 |
JNIEnv *env = GetJNIEnv(); |
810 |
X11InputMethodData *pX11IMData = NULL; |
|
811 |
StatusWindow *statusWindow; |
|
812 |
||
813 |
if (NULL == currentX11InputMethodInstance |
|
814 |
|| NULL == (pX11IMData = getX11InputMethodData(env,currentX11InputMethodInstance)) |
|
815 |
|| NULL == (statusWindow = pX11IMData->statusWindow) |
|
50350
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
816 |
|| !statusWindow->on) |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
817 |
{ |
2 | 818 |
return; |
819 |
} |
|
820 |
||
50350
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
821 |
moveStatusWindow(statusWindow); |
2 | 822 |
} |
50350
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
823 |
|
2 | 824 |
/* |
825 |
* Creates two XICs, one for active clients and the other for passive |
|
826 |
* clients. All information on those XICs are stored in the |
|
827 |
* X11InputMethodData given by the pX11IMData parameter. |
|
828 |
* |
|
829 |
* For active clients: Try to use preedit callback to support |
|
830 |
* on-the-spot. If tc is not null, the XIC to be created will |
|
831 |
* share the Status Area with Motif widgets (TextComponents). If the |
|
832 |
* preferable styles can't be used, fallback to root-window styles. If |
|
833 |
* root-window styles failed, fallback to None styles. |
|
834 |
* |
|
835 |
* For passive clients: Try to use root-window styles. If failed, |
|
836 |
* fallback to None styles. |
|
837 |
*/ |
|
838 |
static Bool |
|
839 |
createXIC(JNIEnv * env, X11InputMethodData *pX11IMData, Window w) |
|
840 |
{ |
|
841 |
XVaNestedList preedit = NULL; |
|
842 |
XVaNestedList status = NULL; |
|
843 |
XIMStyle on_the_spot_styles = XIMPreeditCallbacks, |
|
50350
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
844 |
in_place_styles = 0, |
2 | 845 |
active_styles = 0, |
846 |
passive_styles = 0, |
|
847 |
no_styles = 0; |
|
848 |
XIMCallback *callbacks; |
|
849 |
unsigned short i; |
|
850 |
XIMStyles *im_styles; |
|
851 |
char *ret = NULL; |
|
50350
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
852 |
Bool passiveStatusWindow = False; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
853 |
pX11IMData->statusWindow = NULL; |
2 | 854 |
|
855 |
if (X11im == NULL) { |
|
856 |
return False; |
|
857 |
} |
|
6825 | 858 |
if (!w) { |
2 | 859 |
return False; |
860 |
} |
|
861 |
||
50350
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
862 |
if (getenv("IBMJAVA_PASSIVE") == NULL) { |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
863 |
passiveStatusWindow = False; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
864 |
} else { |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
865 |
passiveStatusWindow = True; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
866 |
} |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
867 |
|
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
868 |
if (isNativeIm()) { passiveStatusWindow = True; } |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
869 |
|
2 | 870 |
ret = XGetIMValues(X11im, XNQueryInputStyle, &im_styles, NULL); |
871 |
||
872 |
if (ret != NULL) { |
|
873 |
jio_fprintf(stderr,"XGetIMValues: %s\n",ret); |
|
874 |
return FALSE ; |
|
875 |
} |
|
876 |
||
877 |
on_the_spot_styles |= XIMStatusNothing; |
|
878 |
||
879 |
/*kinput does not support XIMPreeditCallbacks and XIMStatusArea |
|
880 |
at the same time, so use StatusCallback to draw the status |
|
881 |
ourself |
|
882 |
*/ |
|
883 |
for (i = 0; i < im_styles->count_styles; i++) { |
|
884 |
if (im_styles->supported_styles[i] == (XIMPreeditCallbacks | XIMStatusCallbacks)) { |
|
885 |
on_the_spot_styles = (XIMPreeditCallbacks | XIMStatusCallbacks); |
|
886 |
break; |
|
887 |
} |
|
888 |
} |
|
889 |
||
890 |
for (i = 0; i < im_styles->count_styles; i++) { |
|
50350
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
891 |
if (im_styles->supported_styles[i] == on_the_spot_styles) |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
892 |
active_styles = im_styles->supported_styles[i]; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
893 |
if (im_styles->supported_styles[i] == ROOT_WINDOW_STYLES) |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
894 |
passive_styles = im_styles->supported_styles[i]; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
895 |
if (im_styles->supported_styles[i] == IN_PLACE_STYLES) { |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
896 |
in_place_styles = im_styles->supported_styles[i]; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
897 |
} |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
898 |
if (im_styles->supported_styles[i] == NO_STYLES) { |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
899 |
no_styles = im_styles->supported_styles[i]; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
900 |
} |
2 | 901 |
} |
902 |
||
903 |
XFree(im_styles); |
|
904 |
||
905 |
if (active_styles != on_the_spot_styles) { |
|
906 |
if (passive_styles == ROOT_WINDOW_STYLES) |
|
907 |
active_styles = passive_styles; |
|
908 |
else { |
|
50350
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
909 |
if (in_place_styles == IN_PLACE_STYLES){ |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
910 |
active_styles = passive_styles = IN_PLACE_STYLES; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
911 |
} else { |
2 | 912 |
if (no_styles == NO_STYLES) |
913 |
active_styles = passive_styles = NO_STYLES; |
|
914 |
else |
|
915 |
active_styles = passive_styles = 0; |
|
50350
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
916 |
} |
2 | 917 |
} |
918 |
} else { |
|
50350
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
919 |
if (!passiveStatusWindow) { |
2 | 920 |
if (passive_styles != ROOT_WINDOW_STYLES) { |
921 |
if (no_styles == NO_STYLES) |
|
922 |
active_styles = passive_styles = NO_STYLES; |
|
923 |
else |
|
924 |
active_styles = passive_styles = 0; |
|
925 |
} |
|
50350
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
926 |
} else |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
927 |
passive_styles = active_styles; |
2 | 928 |
} |
929 |
||
930 |
if (active_styles == on_the_spot_styles) { |
|
931 |
callbacks = (XIMCallback *)malloc(sizeof(XIMCallback) * NCALLBACKS); |
|
932 |
if (callbacks == (XIMCallback *)NULL) |
|
933 |
return False; |
|
934 |
pX11IMData->callbacks = callbacks; |
|
935 |
||
936 |
for (i = 0; i < NCALLBACKS; i++, callbacks++) { |
|
937 |
callbacks->client_data = (XPointer) pX11IMData->x11inputmethod; |
|
938 |
callbacks->callback = callback_funcs[i]; |
|
939 |
} |
|
940 |
||
941 |
callbacks = pX11IMData->callbacks; |
|
942 |
preedit = (XVaNestedList)XVaCreateNestedList(0, |
|
943 |
XNPreeditStartCallback, &callbacks[PreeditStartIndex], |
|
944 |
XNPreeditDoneCallback, &callbacks[PreeditDoneIndex], |
|
945 |
XNPreeditDrawCallback, &callbacks[PreeditDrawIndex], |
|
946 |
XNPreeditCaretCallback, &callbacks[PreeditCaretIndex], |
|
947 |
NULL); |
|
948 |
if (preedit == (XVaNestedList)NULL) |
|
949 |
goto err; |
|
950 |
/*always try XIMStatusCallbacks for active client...*/ |
|
951 |
{ |
|
50350
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
952 |
if (on_the_spot_styles & XIMStatusCallbacks) { |
2 | 953 |
status = (XVaNestedList)XVaCreateNestedList(0, |
954 |
XNStatusStartCallback, &callbacks[StatusStartIndex], |
|
955 |
XNStatusDoneCallback, &callbacks[StatusDoneIndex], |
|
956 |
XNStatusDrawCallback, &callbacks[StatusDrawIndex], |
|
957 |
NULL); |
|
958 |
||
959 |
if (status == NULL) |
|
960 |
goto err; |
|
50350
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
961 |
} |
2 | 962 |
pX11IMData->statusWindow = createStatusWindow(w); |
963 |
pX11IMData->ic_active = XCreateIC(X11im, |
|
6825 | 964 |
XNClientWindow, w, |
965 |
XNFocusWindow, w, |
|
2 | 966 |
XNInputStyle, active_styles, |
967 |
XNPreeditAttributes, preedit, |
|
968 |
XNStatusAttributes, status, |
|
969 |
NULL); |
|
50350
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
970 |
if (NULL != pX11IMData->statusWindow) { |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
971 |
pX11IMData->statusWindow->status_ready = True; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
972 |
} |
2 | 973 |
XFree((void *)status); |
974 |
XFree((void *)preedit); |
|
975 |
} |
|
50350
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
976 |
if (passiveStatusWindow) { |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
977 |
pX11IMData->ic_passive = pX11IMData->ic_active; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
978 |
} else { |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
979 |
pX11IMData->ic_passive = XCreateIC(X11im, |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
980 |
XNClientWindow, w, |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
981 |
XNFocusWindow, w, |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
982 |
XNInputStyle, passive_styles, |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
983 |
NULL); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
984 |
} |
2 | 985 |
} else { |
986 |
pX11IMData->ic_active = XCreateIC(X11im, |
|
6825 | 987 |
XNClientWindow, w, |
988 |
XNFocusWindow, w, |
|
2 | 989 |
XNInputStyle, active_styles, |
990 |
NULL); |
|
991 |
pX11IMData->ic_passive = pX11IMData->ic_active; |
|
992 |
} |
|
993 |
||
50350
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
994 |
// The code set the IC mode that the preedit state is not initialied |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
995 |
// at XmbResetIC. This attribute can be set at XCreateIC. I separately |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
996 |
// set the attribute to avoid the failure of XCreateIC at some platform |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
997 |
// which does not support the attribute. |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
998 |
if (pX11IMData->ic_active != 0) |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
999 |
XSetICValues(pX11IMData->ic_active, |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1000 |
XNResetState, XIMPreserveState, NULL); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1001 |
if (pX11IMData->ic_passive != 0 && |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1002 |
pX11IMData->ic_active != pX11IMData->ic_passive) |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1003 |
XSetICValues(pX11IMData->ic_passive, |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1004 |
XNResetState, XIMInitialState, NULL); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1005 |
|
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1006 |
pX11IMData->passiveStatusWindow = passiveStatusWindow; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1007 |
|
2 | 1008 |
if (pX11IMData->ic_active == (XIC)0 |
1009 |
|| pX11IMData->ic_passive == (XIC)0) { |
|
1010 |
return False; |
|
1011 |
} |
|
1012 |
||
50350
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1013 |
/* Unset focus to avoid unexpected IM on */ |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1014 |
setXICFocus(pX11IMData->ic_active, False); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1015 |
if (pX11IMData->ic_active != pX11IMData->ic_passive) |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1016 |
setXICFocus(pX11IMData->ic_passive, False); |
2 | 1017 |
|
1018 |
return True; |
|
1019 |
||
1020 |
err: |
|
1021 |
if (preedit) |
|
1022 |
XFree((void *)preedit); |
|
1023 |
THROW_OUT_OF_MEMORY_ERROR(); |
|
1024 |
return False; |
|
1025 |
} |
|
1026 |
||
50350
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1027 |
static int |
2 | 1028 |
PreeditStartCallback(XIC ic, XPointer client_data, XPointer call_data) |
1029 |
{ |
|
50350
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1030 |
JNIEnv *env = GetJNIEnv(); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1031 |
X11InputMethodData *pX11IMData; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1032 |
|
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1033 |
pX11IMData = getX11InputMethodData(env, (jobject)client_data); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1034 |
if (pX11IMData == NULL || pX11IMData->statusWindow == NULL) { |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1035 |
return 0; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1036 |
} |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1037 |
resetPassivePreeditText(pX11IMData->statusWindow); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1038 |
|
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1039 |
return -1; /* unlimited length for preedit text */ |
2 | 1040 |
} |
1041 |
||
1042 |
static void |
|
1043 |
PreeditDoneCallback(XIC ic, XPointer client_data, XPointer call_data) |
|
1044 |
{ |
|
50350
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1045 |
JNIEnv *env = GetJNIEnv(); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1046 |
X11InputMethodData *pX11IMData; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1047 |
|
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1048 |
pX11IMData = getX11InputMethodData(env, (jobject)client_data); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1049 |
if (pX11IMData == NULL) { |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1050 |
return; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1051 |
} |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1052 |
|
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1053 |
if (!pX11IMData->isActiveClient) { |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1054 |
resetPassivePreeditText(pX11IMData->statusWindow); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1055 |
shrink_status(pX11IMData->statusWindow); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1056 |
} |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1057 |
else{ |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1058 |
JNU_CallMethodByName(env, NULL, pX11IMData->x11inputmethod, |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1059 |
"clearComposedText", |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1060 |
"(J)V", |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1061 |
awt_util_nowMillisUTC()); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1062 |
if ((*env)->ExceptionOccurred(env)) { |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1063 |
(*env)->ExceptionDescribe(env); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1064 |
(*env)->ExceptionClear(env); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1065 |
} |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1066 |
} |
2 | 1067 |
} |
1068 |
||
1069 |
/* |
|
1070 |
* Translate the preedit draw callback items to Java values and invoke |
|
1071 |
* X11InputMethod.dispatchComposedText(). |
|
1072 |
* |
|
1073 |
* client_data: X11InputMethod object |
|
1074 |
*/ |
|
1075 |
static void |
|
1076 |
PreeditDrawCallback(XIC ic, XPointer client_data, |
|
1077 |
XIMPreeditDrawCallbackStruct *pre_draw) |
|
1078 |
{ |
|
1079 |
JNIEnv *env = GetJNIEnv(); |
|
1080 |
X11InputMethodData *pX11IMData = NULL; |
|
1081 |
jmethodID x11imMethodID; |
|
1082 |
||
1083 |
XIMText *text; |
|
1084 |
jstring javastr = NULL; |
|
1085 |
jintArray style = NULL; |
|
1086 |
||
1087 |
/* printf("Native: PreeditDrawCallback() \n"); */ |
|
1088 |
if (pre_draw == NULL) { |
|
1089 |
return; |
|
1090 |
} |
|
1091 |
AWT_LOCK(); |
|
50350
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1092 |
if ((pX11IMData = getX11InputMethodData(env, (jobject)client_data)) == NULL) { |
2 | 1093 |
goto finally; |
1094 |
} |
|
50350
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1095 |
|
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1096 |
if (!pX11IMData->isActiveClient){ |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1097 |
if (ic == pX11IMData->ic_passive) { |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1098 |
preedit_draw_passive(pX11IMData, pre_draw); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1099 |
} |
2 | 1100 |
goto finally; |
1101 |
} |
|
1102 |
||
1103 |
if ((text = pre_draw->text) != NULL) { |
|
50350
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1104 |
if (is_text_available(text)) { |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1105 |
if (text->string.multi_byte != NULL) { |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1106 |
if (pre_draw->text->encoding_is_wchar == False) { |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1107 |
javastr = JNU_NewStringPlatform(env, (const char *)text->string.multi_byte); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1108 |
if (javastr == NULL) { |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1109 |
goto finally; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1110 |
} |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1111 |
} else { |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1112 |
char *mbstr = wcstombsdmp(text->string.wide_char, text->length); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1113 |
if (mbstr == NULL) { |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1114 |
goto finally; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1115 |
} |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1116 |
javastr = JNU_NewStringPlatform(env, (const char *)mbstr); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1117 |
free(mbstr); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1118 |
if (javastr == NULL) { |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1119 |
goto finally; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1120 |
} |
24130
db72fc72f87b
8031001: [Parfait] warnings from b121 for jdk/src/solaris/native/sun/awt: JNI-related warnings
pchelko
parents:
18135
diff
changeset
|
1121 |
} |
2 | 1122 |
} |
1123 |
} |
|
1124 |
if (text->feedback != NULL) { |
|
1125 |
int cnt; |
|
1126 |
jint *tmpstyle; |
|
1127 |
||
1128 |
style = (*env)->NewIntArray(env, text->length); |
|
1129 |
if (JNU_IsNull(env, style)) { |
|
24130
db72fc72f87b
8031001: [Parfait] warnings from b121 for jdk/src/solaris/native/sun/awt: JNI-related warnings
pchelko
parents:
18135
diff
changeset
|
1130 |
(*env)->ExceptionClear(env); |
2 | 1131 |
THROW_OUT_OF_MEMORY_ERROR(); |
1132 |
goto finally; |
|
1133 |
} |
|
1134 |
||
1135 |
if (sizeof(XIMFeedback) == sizeof(jint)) { |
|
1136 |
/* |
|
1137 |
* Optimization to avoid copying the array |
|
1138 |
*/ |
|
1139 |
(*env)->SetIntArrayRegion(env, style, 0, |
|
1140 |
text->length, (jint *)text->feedback); |
|
1141 |
} else { |
|
1142 |
tmpstyle = (jint *)malloc(sizeof(jint)*(text->length)); |
|
1143 |
if (tmpstyle == (jint *) NULL) { |
|
1144 |
THROW_OUT_OF_MEMORY_ERROR(); |
|
1145 |
goto finally; |
|
1146 |
} |
|
1147 |
for (cnt = 0; cnt < (int)text->length; cnt++) |
|
1148 |
tmpstyle[cnt] = text->feedback[cnt]; |
|
1149 |
(*env)->SetIntArrayRegion(env, style, 0, |
|
1150 |
text->length, (jint *)tmpstyle); |
|
52263
680ab6b53f6f
8211393: Memory leak issue on awt_InputMethod.c
itakiguchi
parents:
50350
diff
changeset
|
1151 |
free(tmpstyle); |
2 | 1152 |
} |
1153 |
} |
|
1154 |
} |
|
1155 |
JNU_CallMethodByName(env, NULL, pX11IMData->x11inputmethod, |
|
1156 |
"dispatchComposedText", |
|
1157 |
"(Ljava/lang/String;[IIIIJ)V", |
|
1158 |
javastr, |
|
1159 |
style, |
|
1160 |
(jint)pre_draw->chg_first, |
|
1161 |
(jint)pre_draw->chg_length, |
|
1162 |
(jint)pre_draw->caret, |
|
1163 |
awt_util_nowMillisUTC()); |
|
50350
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1164 |
|
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1165 |
if ((*env)->ExceptionOccurred(env)) { |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1166 |
(*env)->ExceptionDescribe(env); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1167 |
(*env)->ExceptionClear(env); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1168 |
} |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1169 |
|
2 | 1170 |
finally: |
1171 |
AWT_UNLOCK(); |
|
1172 |
return; |
|
1173 |
} |
|
1174 |
||
1175 |
static void |
|
1176 |
PreeditCaretCallback(XIC ic, XPointer client_data, |
|
1177 |
XIMPreeditCaretCallbackStruct *pre_caret) |
|
1178 |
{ |
|
50350
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1179 |
XIMPreeditDrawCallbackStruct pre_draw; |
2 | 1180 |
|
50350
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1181 |
if (pre_caret != NULL && pre_caret->direction == XIMAbsolutePosition) { |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1182 |
pre_draw.caret = pre_caret->position; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1183 |
pre_draw.chg_first = 0; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1184 |
pre_draw.chg_length = 0; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1185 |
pre_draw.text = NULL; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1186 |
PreeditDrawCallback(ic, client_data, &pre_draw); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1187 |
} |
2 | 1188 |
} |
1189 |
||
1190 |
static void |
|
1191 |
StatusStartCallback(XIC ic, XPointer client_data, XPointer call_data) |
|
1192 |
{ |
|
1193 |
/*ARGSUSED*/ |
|
1194 |
/*printf("StatusStartCallback:\n"); */ |
|
1195 |
} |
|
1196 |
||
1197 |
static void |
|
1198 |
StatusDoneCallback(XIC ic, XPointer client_data, XPointer call_data) |
|
1199 |
{ |
|
1200 |
/*ARGSUSED*/ |
|
1201 |
/*printf("StatusDoneCallback:\n"); */ |
|
1202 |
} |
|
1203 |
||
50350
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1204 |
static void StatusDrawCallback |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1205 |
(XIC ic, XPointer client_data, XIMStatusDrawCallbackStruct *status_draw) |
2 | 1206 |
{ |
1207 |
/*ARGSUSED*/ |
|
1208 |
/*printf("StatusDrawCallback:\n"); */ |
|
1209 |
JNIEnv *env = GetJNIEnv(); |
|
1210 |
X11InputMethodData *pX11IMData = NULL; |
|
1211 |
StatusWindow *statusWindow; |
|
50350
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1212 |
int value_make = CWX|CWWidth|CWHeight; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1213 |
XRectangle logical, ink; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1214 |
XWindowChanges xwc; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1215 |
int len; |
2 | 1216 |
|
1217 |
AWT_LOCK(); |
|
1218 |
||
1219 |
if (NULL == (pX11IMData = getX11InputMethodData(env, (jobject)client_data)) |
|
1220 |
|| NULL == (statusWindow = pX11IMData->statusWindow)){ |
|
1221 |
goto finally; |
|
1222 |
} |
|
1223 |
||
50350
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1224 |
if (status_draw->type == XIMTextType) { |
2 | 1225 |
XIMText *text = (status_draw->data).text; |
50350
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1226 |
if (text != NULL) { |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1227 |
if (text->string.multi_byte != NULL) { |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1228 |
if(!strcmp(text->string.multi_byte," ")){ |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1229 |
wcscpy(statusWindow->status, L""); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1230 |
onoffStatusWindow(pX11IMData, 0, False); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1231 |
goto finally; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1232 |
} |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1233 |
mbstowcs(statusWindow->status, |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1234 |
(const char *)text->string.multi_byte, |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1235 |
(size_t)MAX_STATUS_LEN); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1236 |
} else { |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1237 |
if (0 == st_wcslen(text->string.wide_char)){ |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1238 |
wcscpy(statusWindow->status, L""); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1239 |
onoffStatusWindow(pX11IMData, 0, False); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1240 |
goto finally; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1241 |
} |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1242 |
wcsncpy(statusWindow->status, |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1243 |
text->string.wide_char, |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1244 |
MAX_STATUS_LEN); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1245 |
} |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1246 |
XwcTextExtents(statusWindow->fontset, statusWindow->status, |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1247 |
st_wcslen(statusWindow->status), &ink, &logical); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1248 |
statusWindow->statusW = logical.width + BORDER_MARGIN; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1249 |
statusWindow->statusH = logical.height + BORDER_MARGIN; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1250 |
xwc.x = statusWindow->x - statusWindow->off_x; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1251 |
if (xwc.x < 0 ) xwc.x = 0; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1252 |
xwc.width = statusWindow->statusW; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1253 |
xwc.height = statusWindow->statusH; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1254 |
if (xwc.x + xwc.width > statusWindow->rootW){ |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1255 |
xwc.x = statusWindow->rootW - xwc.width; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1256 |
} |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1257 |
XConfigureWindow(dpy, statusWindow->w, value_make, &xwc); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1258 |
if (statusWindow->status_ready && statusWindow->on == True){ |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1259 |
onoffStatusWindow(pX11IMData, statusWindow->parent, True); |
2 | 1260 |
} |
50350
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1261 |
paintStatusWindow(statusWindow); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1262 |
if (statusWindow->peText) |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1263 |
draw_preedit(statusWindow); |
2 | 1264 |
} |
1265 |
else { |
|
50350
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1266 |
wcscpy(statusWindow->status, L""); |
2 | 1267 |
/*just turnoff the status window |
1268 |
paintStatusWindow(statusWindow); |
|
1269 |
*/ |
|
1270 |
onoffStatusWindow(pX11IMData, 0, False); |
|
1271 |
} |
|
1272 |
} |
|
1273 |
||
1274 |
finally: |
|
1275 |
AWT_UNLOCK(); |
|
1276 |
} |
|
1277 |
||
50350
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1278 |
/* return the string length without trailing spaces */ |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1279 |
/* work around code for Japanese AIXIM is implemented. */ |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1280 |
static int st_wcslen(wchar_t *string) |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1281 |
{ |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1282 |
int len = (int32_t)wcslen(string); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1283 |
if (len == 0) |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1284 |
return 0; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1285 |
for (len--;len >= 0; len--) { |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1286 |
if (!iswspace((wint_t) string[len])) break; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1287 |
} |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1288 |
return len+1; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1289 |
} |
2 | 1290 |
|
50350
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1291 |
/* |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1292 |
* Checks whether given XIMText contains a string data. |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1293 |
*/ |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1294 |
static Bool is_text_available(XIMText * text) |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1295 |
{ |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1296 |
if (text == NULL || text->length==0) |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1297 |
return False; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1298 |
if (text->encoding_is_wchar) { |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1299 |
if(text->string.wide_char[0] == L'\0') |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1300 |
return False; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1301 |
} else { |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1302 |
if (text->string.multi_byte[0] == '\0') |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1303 |
return False; |
2 | 1304 |
} |
50350
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1305 |
return True; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1306 |
} |
2 | 1307 |
|
50350
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1308 |
/* |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1309 |
* check if preedit status is active |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1310 |
*/ |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1311 |
static Bool isPreeditStateActive(XIC ic) |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1312 |
{ |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1313 |
XIMPreeditState state = XIMPreeditUnKnown; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1314 |
XVaNestedList pr_atrb; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1315 |
char* nosupportAttr; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1316 |
|
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1317 |
if (ic == NULL) return False; |
2 | 1318 |
|
50350
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1319 |
pr_atrb = XVaCreateNestedList(0,XNPreeditState,&state,NULL); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1320 |
nosupportAttr=XGetICValues(ic,XNPreeditAttributes,pr_atrb,NULL); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1321 |
XFree(pr_atrb); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1322 |
if (nosupportAttr==NULL && state & XIMPreeditDisable) |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1323 |
return False; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1324 |
else |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1325 |
return True; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1326 |
} |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1327 |
|
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1328 |
static void * buf_insert(void * src, void * insert, int size, |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1329 |
int src_len, int ins_len, int offset) |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1330 |
{ |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1331 |
char *temp; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1332 |
|
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1333 |
temp = realloc(src, size*(src_len+ins_len+1)); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1334 |
if (temp == NULL) { |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1335 |
THROW_OUT_OF_MEMORY_ERROR(); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1336 |
return src; |
2 | 1337 |
} |
50350
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1338 |
if (offset != src_len) { |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1339 |
memmove(&temp[size*(offset+ins_len)], |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1340 |
&((char *)temp)[size*offset], |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1341 |
size*(src_len-offset)); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1342 |
} |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1343 |
memcpy(&temp[size*offset], insert, size*ins_len); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1344 |
|
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1345 |
return (void *)temp; |
2 | 1346 |
} |
1347 |
||
50350
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1348 |
static void * handle_buffer(void * source, void * insert, |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1349 |
int size,int src_len, int ins_len, |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1350 |
int del_len, int offset) |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1351 |
{ |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1352 |
void * temp = source; |
2 | 1353 |
|
50350
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1354 |
if (del_len > 0) { |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1355 |
if (del_len == ins_len) { |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1356 |
memcpy(&((char *)source)[size*offset], insert, size*ins_len); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1357 |
return source; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1358 |
} |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1359 |
else if (src_len > offset+del_len) { |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1360 |
memmove(&((char *)source)[size*offset], |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1361 |
&((char *)source)[size*(offset+del_len)], |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1362 |
size*(src_len-offset-del_len)); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1363 |
} |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1364 |
} |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1365 |
if (ins_len > 0) { |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1366 |
temp = buf_insert(source, insert, size, src_len, |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1367 |
ins_len, offset); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1368 |
} |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1369 |
return temp; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1370 |
} |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1371 |
/* |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1372 |
* Display the given preedit text to the root window which is ownd by |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1373 |
* myself. All of the character is converted to wide char. |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1374 |
* this function is used for the passive client. |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1375 |
*/ |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1376 |
static void preedit_draw_passive(X11InputMethodData *pX11IMData, |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1377 |
XIMPreeditDrawCallbackStruct *pre_draw) |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1378 |
{ |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1379 |
XIMText *text; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1380 |
wchar_t *tempbuf = NULL; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1381 |
StatusWindow *statusWindow; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1382 |
wchar_t *cur_text; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1383 |
unsigned long *cur_attr; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1384 |
int cur_len = 0; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1385 |
int chg_len = pre_draw->chg_length; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1386 |
int chg_1st = pre_draw->chg_first; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1387 |
|
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1388 |
if (NULL == (statusWindow = pX11IMData->statusWindow)) |
2 | 1389 |
return; |
50350
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1390 |
cur_text = statusWindow->peText; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1391 |
cur_attr = statusWindow->peAttr; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1392 |
if (cur_text == NULL && pre_draw->text == NULL) |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1393 |
return; |
2 | 1394 |
|
50350
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1395 |
if (cur_text != NULL) |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1396 |
cur_len = (int32_t)wcslen(cur_text); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1397 |
text = pre_draw->text; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1398 |
if (text == NULL) { |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1399 |
/* delete only */ |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1400 |
if (cur_len > chg_1st+chg_len) { |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1401 |
memmove(&cur_text[chg_1st], |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1402 |
&cur_text[chg_1st+chg_len], |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1403 |
sizeof(wchar_t)*(cur_len-chg_1st-chg_len)); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1404 |
memmove(&cur_attr[chg_1st], |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1405 |
&cur_attr[chg_1st+chg_len], |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1406 |
sizeof(long)*(cur_len-chg_1st-chg_len)); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1407 |
} |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1408 |
if ((pre_draw->chg_length <= cur_len ) && (pre_draw->chg_length >0)) |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1409 |
cur_text[cur_len-pre_draw->chg_length] =L'\0'; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1410 |
} else { |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1411 |
/* insert or replace */ |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1412 |
int ins_len = 0; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1413 |
void * ins_text = NULL; |
2 | 1414 |
|
50350
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1415 |
/* if invalid offset is specified, do nothing. */ |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1416 |
/* this fix is for aixim for eucTW */ |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1417 |
if (cur_len < chg_1st) |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1418 |
return; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1419 |
if(is_text_available(text)) { |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1420 |
/* insert or replace the text */ |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1421 |
if (text->encoding_is_wchar == False) { |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1422 |
/* convert the text to wide chars. |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1423 |
allocate enough size buffer |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1424 |
*/ |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1425 |
tempbuf = (wchar_t *)malloc(sizeof(wchar_t)*(text->length+1)); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1426 |
if (tempbuf == NULL) { |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1427 |
THROW_OUT_OF_MEMORY_ERROR(); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1428 |
return; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1429 |
} |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1430 |
ins_len = (int32_t)mbstowcs(tempbuf, text->string.multi_byte, |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1431 |
text->length); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1432 |
if (ins_len == -1) { |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1433 |
free(tempbuf); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1434 |
return; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1435 |
} |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1436 |
ins_text = (void *)tempbuf; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1437 |
} |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1438 |
else { |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1439 |
ins_len = text->length; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1440 |
ins_text = text->string.wide_char; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1441 |
} |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1442 |
/* finish prepare the data to be inserted */ |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1443 |
|
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1444 |
statusWindow->peText = |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1445 |
handle_buffer(cur_text, ins_text, sizeof(wchar_t), |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1446 |
cur_len, ins_len, chg_len, chg_1st); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1447 |
statusWindow->peAttr = |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1448 |
handle_buffer(cur_attr, text->feedback, sizeof(long), |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1449 |
cur_len, ins_len, chg_len, chg_1st); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1450 |
statusWindow->peText[cur_len-chg_len+ins_len] =L'\0'; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1451 |
|
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1452 |
if (tempbuf != NULL) |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1453 |
free(tempbuf); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1454 |
} /* endof insert or replace text */ |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1455 |
else { |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1456 |
/* change attribute only */ |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1457 |
memcpy(&cur_attr[chg_1st], text->feedback, |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1458 |
sizeof(long)*text->length); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1459 |
} |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1460 |
} |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1461 |
statusWindow->peCaret= pre_draw->caret; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1462 |
draw_preedit(statusWindow); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1463 |
if (statusWindow->on && wcslen(statusWindow->peText) > 0) |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1464 |
onoffStatusWindow(pX11IMData, statusWindow->parent, True); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1465 |
else if (wcslen(statusWindow->status) == 0) |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1466 |
onoffStatusWindow(pX11IMData, 0, False); |
2 | 1467 |
} |
1468 |
||
1469 |
/* |
|
50350
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1470 |
* reset predit test of passive mode |
2 | 1471 |
*/ |
50350
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1472 |
static void |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1473 |
resetPassivePreeditText(StatusWindow *statusWindow) |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1474 |
{ |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1475 |
if (NULL == statusWindow) return; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1476 |
if(statusWindow->peText != NULL) { |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1477 |
free(statusWindow->peText); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1478 |
statusWindow->peText = NULL; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1479 |
} |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1480 |
if(statusWindow->peAttr != NULL) { |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1481 |
free(statusWindow->peAttr); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1482 |
statusWindow->peAttr = NULL; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1483 |
} |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1484 |
statusWindow->peCaret= 0; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1485 |
} |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1486 |
|
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1487 |
static void draw_caret(StatusWindow *statusWindow, GC gc, int pos) |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1488 |
{ |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1489 |
if (NULL == statusWindow) return; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1490 |
XSetFunction(dpy, gc, GXinvert); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1491 |
XDrawLine(dpy, statusWindow->w, |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1492 |
gc, pos, STATUS_BORDER/2, |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1493 |
pos, STATUS_BORDER/2+statusWindow->fOff); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1494 |
XSetFunction(dpy, gc, GXcopy); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1495 |
} |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1496 |
|
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1497 |
static int get_next_attr(int len, unsigned long *attr) |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1498 |
{ |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1499 |
int count; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1500 |
|
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1501 |
for (count = 1; count < len; count++) { |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1502 |
if ((attr[count-1] & PREEDIT_ATTR_MASK) |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1503 |
!= (attr[count] & PREEDIT_ATTR_MASK)) |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1504 |
break; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1505 |
} |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1506 |
return count; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1507 |
} |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1508 |
|
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1509 |
static void draw_preedit(StatusWindow *statusWindow) |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1510 |
{ |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1511 |
unsigned long *attr; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1512 |
int x_pos,x_caret; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1513 |
unsigned int len; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1514 |
int len_disp, pos; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1515 |
wchar_t *str; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1516 |
GC gc; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1517 |
XRectangle ink, rect, rect_c; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1518 |
Bool caret_done = False; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1519 |
|
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1520 |
if (NULL == statusWindow) return; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1521 |
align_status(statusWindow); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1522 |
XFillRectangle(dpy, statusWindow->w, |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1523 |
statusWindow->bgGC, |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1524 |
statusWindow->statusW,0, |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1525 |
statusWindow->statusW + statusWindow->peTextW + BORDER_MARGIN, |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1526 |
statusWindow->fBot+2); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1527 |
|
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1528 |
|
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1529 |
XDrawLine(dpy, statusWindow->w, statusWindow->fgGC, |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1530 |
statusWindow->statusW, 0, |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1531 |
statusWindow->statusW + statusWindow->peTextW + BORDER_MARGIN, 0); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1532 |
XDrawLine(dpy, statusWindow->w, statusWindow->fgGC, |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1533 |
statusWindow->statusW, statusWindow->fBot+2, |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1534 |
statusWindow->statusW + statusWindow->peTextW + BORDER_MARGIN, |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1535 |
statusWindow->fBot+2); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1536 |
XDrawLine(dpy, statusWindow->w, statusWindow->fgGC, |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1537 |
statusWindow->statusW + statusWindow->peTextW + BORDER_MARGIN, 0, |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1538 |
statusWindow->statusW + statusWindow->peTextW + BORDER_MARGIN, |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1539 |
statusWindow->fBot+2); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1540 |
if (0 == statusWindow->statusW) |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1541 |
XDrawLine(dpy, statusWindow->w, statusWindow->fgGC, |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1542 |
0, 0, 0, statusWindow->fBot+2); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1543 |
|
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1544 |
str = statusWindow->peText; |
2 | 1545 |
|
50350
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1546 |
if (str != NULL && (len = (int32_t)wcslen(str)) != 0) { |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1547 |
pos = 0; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1548 |
attr = statusWindow->peAttr; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1549 |
x_pos = x_caret = statusWindow->statusW + STATUS_BORDER; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1550 |
while((int)len-1 >= pos) { |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1551 |
len_disp = get_next_attr(len - pos, &attr[pos]); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1552 |
if (attr[pos] & XIMReverse) { |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1553 |
gc = statusWindow->bgGC; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1554 |
} |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1555 |
else { |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1556 |
gc = statusWindow->fgGC; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1557 |
} |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1558 |
XwcTextExtents(statusWindow->fontset, |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1559 |
&str[pos], |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1560 |
len_disp, &ink, &rect); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1561 |
XwcDrawImageString(dpy, statusWindow->w, |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1562 |
statusWindow->fontset, gc, |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1563 |
x_pos, statusWindow->fOff+1, &str[pos], len_disp); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1564 |
if (attr[pos] & XIMUnderline) { |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1565 |
XDrawLine(dpy, statusWindow->w, |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1566 |
gc, x_pos, statusWindow->fBot, |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1567 |
x_pos+rect.width, statusWindow->fBot); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1568 |
} |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1569 |
if (!caret_done) { |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1570 |
if( statusWindow->peCaret >= pos && |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1571 |
statusWindow->peCaret <= pos+len_disp) { |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1572 |
if (statusWindow->peCaret == 0) |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1573 |
x_caret = x_pos; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1574 |
else if (statusWindow->peCaret == pos+len_disp) |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1575 |
x_caret = x_pos+rect.width; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1576 |
else { |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1577 |
XwcTextExtents(statusWindow->fontset, |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1578 |
&str[pos], |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1579 |
statusWindow->peCaret-pos, |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1580 |
&ink, &rect_c); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1581 |
x_caret = x_pos+ rect_c.width; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1582 |
} |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1583 |
x_caret-=CARET_OFFSET; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1584 |
caret_done = True; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1585 |
} |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1586 |
} |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1587 |
pos += len_disp; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1588 |
x_pos += rect.width; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1589 |
} |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1590 |
if (caret_done) |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1591 |
draw_caret(statusWindow, statusWindow->fgGC, x_caret); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1592 |
} |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1593 |
} |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1594 |
|
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1595 |
/* calc required status window size and resize the window */ |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1596 |
static void align_status(StatusWindow *statusWindow) |
2 | 1597 |
{ |
50350
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1598 |
int len_st, len_pe = 0; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1599 |
XRectangle rect_st, rect_pe, ink; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1600 |
Dimension cur_w; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1601 |
int value_make = CWX|CWWidth|CWHeight; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1602 |
XWindowChanges xwc; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1603 |
|
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1604 |
if (NULL == statusWindow) return; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1605 |
if ((len_st = st_wcslen(statusWindow->status)) == 0 |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1606 |
&& (statusWindow->peText == NULL || st_wcslen(statusWindow->peText) == 0 )) |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1607 |
return; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1608 |
|
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1609 |
rect_pe.x = rect_pe.y = rect_pe.width = rect_pe.height = 0; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1610 |
|
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1611 |
XwcTextExtents(statusWindow->fontset, |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1612 |
statusWindow->status, |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1613 |
len_st, &ink, &rect_st); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1614 |
if (statusWindow->peText != NULL |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1615 |
&& (len_pe = (int32_t)wcslen(statusWindow->peText)) > 0) { |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1616 |
XwcTextExtents(statusWindow->fontset, |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1617 |
statusWindow->peText, |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1618 |
len_pe, &ink, &rect_pe); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1619 |
} |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1620 |
statusWindow->fOff = max(-rect_st.y, -rect_pe.y); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1621 |
statusWindow->fBot = max(rect_st.height, rect_pe.height); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1622 |
statusWindow->statusW =rect_st.width; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1623 |
if (rect_st.width > 0) statusWindow->statusW += BORDER_MARGIN; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1624 |
statusWindow->peTextW = rect_pe.width; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1625 |
|
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1626 |
xwc.x = statusWindow->x - statusWindow->off_x; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1627 |
if (xwc.x < 0 ) xwc.x = 0; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1628 |
|
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1629 |
if (len_pe > 0) { |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1630 |
xwc.width = statusWindow->statusW |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1631 |
+ statusWindow->peTextW + BORDER_MARGIN + 1; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1632 |
xwc.height = statusWindow->fBot + BORDER_MARGIN; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1633 |
} else { |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1634 |
xwc.width = statusWindow->statusW; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1635 |
xwc.height = statusWindow->fBot + BORDER_MARGIN; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1636 |
} |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1637 |
if (xwc.x + xwc.width > statusWindow->rootW){ |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1638 |
xwc.x = statusWindow->rootW - xwc.width; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1639 |
} |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1640 |
XConfigureWindow(dpy, statusWindow->w, value_make, &xwc); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1641 |
} |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1642 |
|
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1643 |
static void shrink_status(StatusWindow *statusWindow) |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1644 |
{ |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1645 |
int value_make = CWX|CWWidth|CWHeight; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1646 |
XWindowChanges xwc; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1647 |
|
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1648 |
if (NULL == statusWindow) return; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1649 |
xwc.width = statusWindow->statusW; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1650 |
xwc.height = statusWindow->statusH; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1651 |
statusWindow->peTextW = 0; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1652 |
xwc.x = statusWindow->x - statusWindow->off_x; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1653 |
if (xwc.x < 0 ) xwc.x = 0; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1654 |
if (xwc.x + xwc.width > statusWindow->rootW){ |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1655 |
xwc.x = statusWindow->rootW - xwc.width; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1656 |
} |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1657 |
XConfigureWindow(dpy, statusWindow->w, value_make, &xwc); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1658 |
} |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1659 |
|
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1660 |
static GC create_gc(Window win, Bool isReverse) |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1661 |
{ |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1662 |
XGCValues xgcv; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1663 |
unsigned long mask; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1664 |
AwtScreenDataPtr defaultScreen; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1665 |
|
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1666 |
defaultScreen = getScreenData(DefaultScreen(dpy)); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1667 |
|
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1668 |
mask = (GCForeground | GCBackground ); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1669 |
if (isReverse) { |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1670 |
xgcv.foreground = defaultScreen->whitepixel; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1671 |
xgcv.background = defaultScreen->blackpixel; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1672 |
} else { |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1673 |
xgcv.foreground = defaultScreen->blackpixel; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1674 |
xgcv.background = defaultScreen->whitepixel; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1675 |
} |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1676 |
return XCreateGC(dpy, win, mask, &xgcv); |
2 | 1677 |
} |
1678 |
||
50350
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1679 |
static Bool isNativeIm() |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1680 |
{ |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1681 |
#define XIMMODIFIER "@im=" |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1682 |
#define XIM_SERVER_CATEGORY "@server=" |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1683 |
char *immodifiers; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1684 |
char *imserver, *imserverPtr; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1685 |
Atom imserverAtom; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1686 |
|
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1687 |
if (!(immodifiers = getenv("XMODIFIERS"))) return True; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1688 |
if (!(imserver = calloc(1,strlen(immodifiers)+strlen(XIM_SERVER_CATEGORY)+1))) return True; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1689 |
if (!(immodifiers = strstr(immodifiers,XIMMODIFIER))) return True; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1690 |
immodifiers += strlen(XIMMODIFIER); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1691 |
strcpy(imserver,XIM_SERVER_CATEGORY); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1692 |
imserverPtr = imserver + strlen(imserver); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1693 |
while(*immodifiers != '@' && *immodifiers != '\0') { |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1694 |
*imserverPtr = *immodifiers; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1695 |
imserverPtr++; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1696 |
immodifiers++; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1697 |
} |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1698 |
imserverAtom = XInternAtom(awt_display, imserver, True); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1699 |
free(imserver); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1700 |
if (imserverAtom > 0) |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1701 |
return False; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1702 |
else |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1703 |
return True; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1704 |
} |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1705 |
|
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1706 |
static Window getGrandParent(Window parent) |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1707 |
{ |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1708 |
Window containerWindow,rootWindow,tmp; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1709 |
Window *ignoreWindowPtr; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1710 |
unsigned int ignoreUnit; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1711 |
Window grandParent=0; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1712 |
XWindowAttributes xwa; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1713 |
Atom WM_STATE; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1714 |
Atom type = None; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1715 |
int32_t format; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1716 |
unsigned long nitems, after; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1717 |
unsigned char * data; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1718 |
|
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1719 |
if (parent == 0) return grandParent; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1720 |
WM_STATE = XInternAtom(dpy, "WM_STATE", True); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1721 |
if (WM_STATE == None) return grandParent; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1722 |
|
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1723 |
tmp=parent; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1724 |
while(XQueryTree(dpy, tmp, |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1725 |
&rootWindow, &containerWindow, |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1726 |
&ignoreWindowPtr, &ignoreUnit)){ |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1727 |
XFree(ignoreWindowPtr); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1728 |
if (containerWindow == rootWindow) break; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1729 |
if (XGetWindowProperty(dpy, containerWindow, WM_STATE, |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1730 |
0, 0, False, AnyPropertyType, |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1731 |
&type, &format, &nitems, &after, &data) == Success) { |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1732 |
XFree(data); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1733 |
if (type) { |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1734 |
XGetWindowAttributes(dpy, containerWindow, &xwa); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1735 |
if (FALSE == xwa.override_redirect){ |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1736 |
grandParent=containerWindow; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1737 |
} |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1738 |
} |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1739 |
} |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1740 |
tmp=containerWindow; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1741 |
} |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1742 |
return grandParent; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1743 |
} |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1744 |
|
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1745 |
static void moveStatusWindow(StatusWindow *statusWindow) |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1746 |
{ |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1747 |
XWindowAttributes xwa; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1748 |
Window child; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1749 |
int x, y, width; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1750 |
Window target; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1751 |
|
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1752 |
if (NULL == statusWindow) return; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1753 |
if (statusWindow->grandParent) { |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1754 |
target = statusWindow->grandParent; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1755 |
} else { |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1756 |
target = statusWindow->parent; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1757 |
} |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1758 |
XGetWindowAttributes(dpy, target, &xwa); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1759 |
XTranslateCoordinates(dpy, |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1760 |
target, xwa.root, |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1761 |
0, 0, |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1762 |
&x, &y, |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1763 |
&child); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1764 |
if (statusWindow->x != x |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1765 |
|| statusWindow->y != y |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1766 |
|| statusWindow->width != xwa.width |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1767 |
|| statusWindow->height != xwa.height){ |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1768 |
statusWindow->x = x; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1769 |
statusWindow->y = y; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1770 |
statusWindow->height = xwa.height; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1771 |
statusWindow->width = xwa.width; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1772 |
x = statusWindow->x - statusWindow->off_x; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1773 |
y = statusWindow->y + statusWindow->height + statusWindow->off_y; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1774 |
if (x < 0 ){ |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1775 |
x = 0; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1776 |
} |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1777 |
if (statusWindow->peTextW > 0) { |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1778 |
width = statusWindow->statusW + statusWindow->peTextW + BORDER_MARGIN + 1; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1779 |
if (x + width > statusWindow->rootW){ |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1780 |
x = statusWindow->rootW - width; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1781 |
} |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1782 |
} else { |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1783 |
if (x + statusWindow->statusW > statusWindow->rootW){ |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1784 |
x = statusWindow->rootW - statusWindow->statusW; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1785 |
} |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1786 |
} |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1787 |
if (y + statusWindow->statusH > statusWindow->rootH){ |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1788 |
y = statusWindow->rootH - statusWindow->statusH; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1789 |
} |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1790 |
XMoveWindow(dpy, statusWindow->w, x, y); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1791 |
} |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1792 |
} |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1793 |
|
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1794 |
static void arrange_window_stack(StatusWindow* statusWindow) |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1795 |
{ |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1796 |
XWindowChanges xwc; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1797 |
int value_make = CWSibling|CWStackMode; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1798 |
Window root, parent, *children; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1799 |
unsigned int nchildren; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1800 |
|
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1801 |
if (NULL == statusWindow) return; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1802 |
if (XQueryTree(dpy, statusWindow->parent, |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1803 |
&root, &parent, &children, &nchildren)){ |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1804 |
XFree(children); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1805 |
xwc.sibling = parent; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1806 |
while(XQueryTree(dpy, xwc.sibling, &root, &parent, &children, &nchildren)) { |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1807 |
XFree(children); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1808 |
if (root != parent) { |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1809 |
xwc.sibling = parent; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1810 |
} else { |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1811 |
break; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1812 |
} |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1813 |
} |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1814 |
xwc.stack_mode = Above; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1815 |
XConfigureWindow(dpy, statusWindow->w, value_make, &xwc); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1816 |
} |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1817 |
} |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1818 |
|
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1819 |
static int count_missing_fonts(char **charset_list, int charset_count) |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1820 |
{ |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1821 |
int i,j; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1822 |
if (charset_count > 0) { |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1823 |
j=charset_count; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1824 |
for(i=0; i < charset_count; i++) { |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1825 |
if ((strstr(charset_list[i], "IBM-udc")) || |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1826 |
(strstr(charset_list[i], "IBM-sbd")) || |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1827 |
(strstr(charset_list[i], "IBM-ucdTW"))) |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1828 |
j--; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1829 |
} |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1830 |
return j; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1831 |
} |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1832 |
else |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1833 |
return 0; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1834 |
} |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1835 |
|
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1836 |
static XFontSet create_fontset_name(char * font_name, Bool force) |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1837 |
{ |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1838 |
XFontSet fontset = NULL; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1839 |
char **charset_list; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1840 |
int charset_count; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1841 |
char *def_string; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1842 |
int missing_fonts; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1843 |
|
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1844 |
fontset = XCreateFontSet(dpy, font_name, |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1845 |
&charset_list, &charset_count, &def_string); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1846 |
if (charset_count > 0) { |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1847 |
missing_fonts = count_missing_fonts(charset_list, |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1848 |
charset_count); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1849 |
XFreeStringList(charset_list); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1850 |
if (fontset && (missing_fonts > 0)) { |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1851 |
if (!force) { |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1852 |
XFreeFontSet(dpy, fontset); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1853 |
fontset = NULL; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1854 |
} |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1855 |
} |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1856 |
} |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1857 |
return fontset; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1858 |
} |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1859 |
|
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1860 |
static XFontSet create_fontset() |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1861 |
{ |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1862 |
XFontSet fontset = NULL; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1863 |
int i; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1864 |
static char * fontlist[] = { |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1865 |
"-dt-interface user-medium-r-normal-S*-*-*-*-*-*-*-*-*", |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1866 |
"-*-*-medium-r-normal-*-14-*-*-*-c-*-*-*", |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1867 |
"-*-*-medium-r-normal-*-14-*-*-*-m-*-*-*", |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1868 |
"-*-*-medium-r-normal--14-0-0-0-m-*-*-*", |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1869 |
"-monotype-sansmonowt-medium-r-normal--14-*-*-*-m-*-*-*", |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1870 |
"-*--14-*", |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1871 |
"-dt-interface user-medium-r-normal-s*-*-*-*-*-*-*-*-*", |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1872 |
"-*--16-*", |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1873 |
"-*--17-*", |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1874 |
"-*--18-*", |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1875 |
"-*--19-*", |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1876 |
"-*--20-*", |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1877 |
"-*--24-*", |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1878 |
NULL}; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1879 |
|
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1880 |
for (i=0; fontlist[i] != NULL && fontset==NULL; i++) |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1881 |
fontset = create_fontset_name(fontlist[i], False); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1882 |
|
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1883 |
if (!fontset) |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1884 |
fprintf(stdout, "Cannot load fonts for IMF.\n"); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1885 |
return fontset; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1886 |
} |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1887 |
|
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1888 |
static Window get_current_focus(XIC ic) { |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1889 |
Window w = 0; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1890 |
if (ic != NULL) |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1891 |
XGetICValues(ic, XNFocusWindow, &w, NULL); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1892 |
return w; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1893 |
} |
2 | 1894 |
|
1895 |
JNIEXPORT jboolean JNICALL |
|
1896 |
Java_sun_awt_X11_XInputMethod_openXIMNative(JNIEnv *env, |
|
50350
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1897 |
jobject this, |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1898 |
jlong display) |
2 | 1899 |
{ |
1900 |
Bool registered; |
|
1901 |
||
1902 |
AWT_LOCK(); |
|
1903 |
||
6825 | 1904 |
dpy = (Display *)jlong_to_ptr(display); |
2 | 1905 |
|
50350
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1906 |
if (X11im == NULL) { |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1907 |
X11im = XOpenIM(dpy, NULL, NULL, NULL); |
2 | 1908 |
} |
1909 |
||
1910 |
AWT_UNLOCK(); |
|
1911 |
||
1912 |
return JNI_TRUE; |
|
1913 |
} |
|
1914 |
||
1915 |
JNIEXPORT jboolean JNICALL |
|
1916 |
Java_sun_awt_X11_XInputMethod_createXICNative(JNIEnv *env, |
|
50350
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1917 |
jobject this, |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1918 |
jlong window) |
2 | 1919 |
{ |
1920 |
X11InputMethodData *pX11IMData; |
|
1921 |
jobject globalRef; |
|
1922 |
XIC ic; |
|
1923 |
||
1924 |
AWT_LOCK(); |
|
1925 |
||
6825 | 1926 |
if (!window) { |
2 | 1927 |
JNU_ThrowNullPointerException(env, "NullPointerException"); |
1928 |
AWT_UNLOCK(); |
|
1929 |
return JNI_FALSE; |
|
1930 |
} |
|
1931 |
||
1932 |
pX11IMData = (X11InputMethodData *) calloc(1, sizeof(X11InputMethodData)); |
|
1933 |
if (pX11IMData == NULL) { |
|
1934 |
THROW_OUT_OF_MEMORY_ERROR(); |
|
1935 |
AWT_UNLOCK(); |
|
1936 |
return JNI_FALSE; |
|
1937 |
} |
|
1938 |
||
1939 |
globalRef = (*env)->NewGlobalRef(env, this); |
|
1940 |
pX11IMData->x11inputmethod = globalRef; |
|
1941 |
pX11IMData->statusWindow = NULL; |
|
1942 |
||
50350
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1943 |
setX11InputMethodData(env, this, pX11IMData); |
2 | 1944 |
|
24130
db72fc72f87b
8031001: [Parfait] warnings from b121 for jdk/src/solaris/native/sun/awt: JNI-related warnings
pchelko
parents:
18135
diff
changeset
|
1945 |
if (createXIC(env, pX11IMData, (Window)window) == False) { |
2 | 1946 |
destroyX11InputMethodData((JNIEnv *) NULL, pX11IMData); |
1947 |
pX11IMData = (X11InputMethodData *) NULL; |
|
50350
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1948 |
setX11InputMethodData(env, this, pX11IMData); |
24130
db72fc72f87b
8031001: [Parfait] warnings from b121 for jdk/src/solaris/native/sun/awt: JNI-related warnings
pchelko
parents:
18135
diff
changeset
|
1949 |
if ((*env)->ExceptionCheck(env)) { |
db72fc72f87b
8031001: [Parfait] warnings from b121 for jdk/src/solaris/native/sun/awt: JNI-related warnings
pchelko
parents:
18135
diff
changeset
|
1950 |
goto finally; |
db72fc72f87b
8031001: [Parfait] warnings from b121 for jdk/src/solaris/native/sun/awt: JNI-related warnings
pchelko
parents:
18135
diff
changeset
|
1951 |
} |
2 | 1952 |
} |
1953 |
||
24130
db72fc72f87b
8031001: [Parfait] warnings from b121 for jdk/src/solaris/native/sun/awt: JNI-related warnings
pchelko
parents:
18135
diff
changeset
|
1954 |
finally: |
2 | 1955 |
AWT_UNLOCK(); |
1956 |
return (pX11IMData != NULL); |
|
1957 |
} |
|
1958 |
||
1959 |
JNIEXPORT void JNICALL |
|
1960 |
Java_sun_awt_X11_XInputMethod_setXICFocusNative(JNIEnv *env, |
|
50350
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1961 |
jobject this, |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1962 |
jlong w, |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1963 |
jboolean req, |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1964 |
jboolean active) |
2 | 1965 |
{ |
1966 |
X11InputMethodData *pX11IMData; |
|
1967 |
AWT_LOCK(); |
|
1968 |
pX11IMData = getX11InputMethodData(env, this); |
|
1969 |
if (pX11IMData == NULL) { |
|
1970 |
AWT_UNLOCK(); |
|
1971 |
return; |
|
1972 |
} |
|
1973 |
||
1974 |
if (req) { |
|
6825 | 1975 |
if (!w) { |
2 | 1976 |
AWT_UNLOCK(); |
1977 |
return; |
|
1978 |
} |
|
50350
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1979 |
pX11IMData->isActiveClient = active; |
2 | 1980 |
pX11IMData->current_ic = active ? |
1981 |
pX11IMData->ic_active : pX11IMData->ic_passive; |
|
1982 |
/* |
|
1983 |
* On Solaris2.6, setXICWindowFocus() has to be invoked |
|
1984 |
* before setting focus. |
|
1985 |
*/ |
|
50350
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1986 |
get_current_focus(pX11IMData->current_ic); /* workaround for kinput2 and SCIM */ |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1987 |
if (currentFocusWindow != w) { |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1988 |
setXICWindowFocus(pX11IMData->current_ic, w); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1989 |
setXICFocus(pX11IMData->current_ic, req); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1990 |
currentX11InputMethodInstance = pX11IMData->x11inputmethod; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1991 |
currentFocusWindow = w; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1992 |
} else { |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1993 |
setXICFocus(pX11IMData->current_ic, req); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1994 |
} |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1995 |
if ((active || pX11IMData->passiveStatusWindow) |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
1996 |
&& (pX11IMData->statusWindow && pX11IMData->statusWindow->on)) |
2 | 1997 |
onoffStatusWindow(pX11IMData, w, True); |
1998 |
} else { |
|
1999 |
currentX11InputMethodInstance = NULL; |
|
2000 |
currentFocusWindow = 0; |
|
2001 |
onoffStatusWindow(pX11IMData, 0, False); |
|
2002 |
if (pX11IMData->current_ic != NULL) |
|
2003 |
setXICFocus(pX11IMData->current_ic, req); |
|
2004 |
||
2005 |
pX11IMData->current_ic = (XIC)0; |
|
2006 |
} |
|
2007 |
||
2008 |
XFlush(dpy); |
|
2009 |
AWT_UNLOCK(); |
|
2010 |
} |
|
2011 |
||
50350
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
2012 |
/* |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
2013 |
* Class: sun_awt_X11InputMethodBase |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
2014 |
* Method: initIDs |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
2015 |
* Signature: ()V |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
2016 |
* This function gets called from the static initializer for |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
2017 |
* X11InputMethod.java to initialize the fieldIDs for fields |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
2018 |
* that may be accessed from C |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
2019 |
*/ |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
2020 |
JNIEXPORT void JNICALL Java_sun_awt_X11InputMethodBase_initIDs |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
2021 |
(JNIEnv *env, jclass cls) |
2 | 2022 |
{ |
50350
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
2023 |
x11InputMethodIDs.pData = (*env)->GetFieldID(env, cls, "pData", "J"); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
2024 |
} |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
2025 |
|
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
2026 |
/* |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
2027 |
* Class: sun_awt_X11InputMethodBase |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
2028 |
* Method: turnoffStatusWindow |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
2029 |
* Signature: ()V |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
2030 |
*/ |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
2031 |
JNIEXPORT void JNICALL Java_sun_awt_X11InputMethodBase_turnoffStatusWindow |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
2032 |
(JNIEnv *env, jobject this) |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
2033 |
{ |
2 | 2034 |
X11InputMethodData *pX11IMData; |
2035 |
StatusWindow *statusWindow; |
|
2036 |
||
2037 |
AWT_LOCK(); |
|
2038 |
||
2039 |
if (NULL == currentX11InputMethodInstance |
|
2040 |
|| NULL == (pX11IMData = getX11InputMethodData(env,currentX11InputMethodInstance)) |
|
2041 |
|| NULL == (statusWindow = pX11IMData->statusWindow) |
|
2042 |
|| !statusWindow->on ){ |
|
2043 |
AWT_UNLOCK(); |
|
2044 |
return; |
|
2045 |
} |
|
2046 |
onoffStatusWindow(pX11IMData, 0, False); |
|
50350
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
2047 |
statusWindow->on = False; |
2 | 2048 |
|
2049 |
AWT_UNLOCK(); |
|
2050 |
} |
|
2051 |
||
50350
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
2052 |
/* |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
2053 |
* Class: sun_awt_X11InputMethodBase |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
2054 |
* Method: disposeXIC |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
2055 |
* Signature: ()V |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
2056 |
*/ |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
2057 |
JNIEXPORT void JNICALL Java_sun_awt_X11InputMethodBase_disposeXIC |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
2058 |
(JNIEnv *env, jobject this) |
2 | 2059 |
{ |
2060 |
X11InputMethodData *pX11IMData = NULL; |
|
2061 |
||
2062 |
AWT_LOCK(); |
|
2063 |
pX11IMData = getX11InputMethodData(env, this); |
|
2064 |
if (pX11IMData == NULL) { |
|
2065 |
AWT_UNLOCK(); |
|
2066 |
return; |
|
2067 |
} |
|
2068 |
||
2069 |
setX11InputMethodData(env, this, NULL); |
|
2070 |
||
2071 |
if (pX11IMData->x11inputmethod == currentX11InputMethodInstance) { |
|
2072 |
currentX11InputMethodInstance = NULL; |
|
2073 |
currentFocusWindow = 0; |
|
2074 |
} |
|
2075 |
destroyX11InputMethodData(env, pX11IMData); |
|
2076 |
AWT_UNLOCK(); |
|
2077 |
} |
|
2078 |
||
50350
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
2079 |
/* |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
2080 |
* Class: sun_awt_X11InputMethodBase |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
2081 |
* Method: resetXIC |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
2082 |
* Signature: ()Ljava/lang/String; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
2083 |
*/ |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
2084 |
JNIEXPORT jstring JNICALL Java_sun_awt_X11InputMethodBase_resetXIC |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
2085 |
(JNIEnv *env, jobject this) |
2 | 2086 |
{ |
2087 |
X11InputMethodData *pX11IMData; |
|
2088 |
char *xText = NULL; |
|
2089 |
jstring jText = (jstring)0; |
|
2090 |
||
2091 |
AWT_LOCK(); |
|
2092 |
pX11IMData = getX11InputMethodData(env, this); |
|
2093 |
if (pX11IMData == NULL) { |
|
2094 |
AWT_UNLOCK(); |
|
2095 |
return jText; |
|
2096 |
} |
|
2097 |
||
50350
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
2098 |
if (pX11IMData->current_ic) { |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
2099 |
if (!isPreeditStateActive(pX11IMData->current_ic)) { |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
2100 |
xText = NULL; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
2101 |
} else { |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
2102 |
if (!(pX11IMData->forceReset)) |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
2103 |
setXICFocus(pX11IMData->current_ic, FALSE); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
2104 |
xText = XmbResetIC(pX11IMData->current_ic); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
2105 |
if (!(pX11IMData->forceReset)) |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
2106 |
setXICFocus(pX11IMData->current_ic, TRUE); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
2107 |
} |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
2108 |
} else { |
2 | 2109 |
/* |
2110 |
* If there is no reference to the current XIC, try to reset both XICs. |
|
2111 |
*/ |
|
50350
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
2112 |
if (!isPreeditStateActive(pX11IMData->ic_active)) |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
2113 |
xText = NULL; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
2114 |
else |
2 | 2115 |
xText = XmbResetIC(pX11IMData->ic_active); |
2116 |
/*it may also means that the real client component does |
|
2117 |
not have focus -- has been deactivated... its xic should |
|
2118 |
not have the focus, bug#4284651 showes reset XIC for htt |
|
2119 |
may bring the focus back, so de-focus it again. |
|
2120 |
*/ |
|
2121 |
setXICFocus(pX11IMData->ic_active, FALSE); |
|
2122 |
if (pX11IMData->ic_active != pX11IMData->ic_passive) { |
|
50350
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
2123 |
char *tmpText; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
2124 |
if (!isPreeditStateActive(pX11IMData->ic_passive)) |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
2125 |
tmpText = NULL; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
2126 |
else |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
2127 |
tmpText = XmbResetIC(pX11IMData->ic_passive); |
2 | 2128 |
setXICFocus(pX11IMData->ic_passive, FALSE); |
2129 |
if (xText == (char *)NULL && tmpText) |
|
2130 |
xText = tmpText; |
|
2131 |
} |
|
2132 |
} |
|
2133 |
if (xText != NULL) { |
|
2134 |
jText = JNU_NewStringPlatform(env, (const char *)xText); |
|
2135 |
XFree((void *)xText); |
|
2136 |
} |
|
2137 |
||
50350
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
2138 |
/* workaround |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
2139 |
* Some IME do not call PreeditDoneCallback routine even |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
2140 |
* when XmbResetIC is called. I force to reset the preedit string. |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
2141 |
*/ |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
2142 |
if (!pX11IMData->isActiveClient) { |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
2143 |
resetPassivePreeditText(pX11IMData->statusWindow); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
2144 |
shrink_status(pX11IMData->statusWindow); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
2145 |
} else { |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
2146 |
JNU_CallMethodByName(env, NULL, pX11IMData->x11inputmethod, |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
2147 |
"clearComposedText", |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
2148 |
"()V"); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
2149 |
if ((*env)->ExceptionOccurred(env)) { |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
2150 |
(*env)->ExceptionDescribe(env); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
2151 |
(*env)->ExceptionClear(env); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
2152 |
} |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
2153 |
} |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
2154 |
|
2 | 2155 |
AWT_UNLOCK(); |
2156 |
return jText; |
|
2157 |
} |
|
2158 |
||
2159 |
/* |
|
50350
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
2160 |
* Class: sun_awt_X11InputMethodBase |
2 | 2161 |
* Method: setCompositionEnabledNative |
50350
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
2162 |
* Signature: (Z)Z |
2 | 2163 |
* |
2164 |
* This method tries to set the XNPreeditState attribute associated with the current |
|
2165 |
* XIC to the passed in 'enable' state. |
|
2166 |
* |
|
2167 |
* Return JNI_TRUE if XNPreeditState attribute is successfully changed to the |
|
2168 |
* 'enable' state; Otherwise, if XSetICValues fails to set this attribute, |
|
2169 |
* java.lang.UnsupportedOperationException will be thrown. JNI_FALSE is returned if this |
|
2170 |
* method fails due to other reasons. |
|
2171 |
*/ |
|
50350
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
2172 |
JNIEXPORT jboolean JNICALL Java_sun_awt_X11InputMethodBase_setCompositionEnabledNative |
2 | 2173 |
(JNIEnv *env, jobject this, jboolean enable) |
2174 |
{ |
|
2175 |
X11InputMethodData *pX11IMData; |
|
2176 |
char * ret = NULL; |
|
50350
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
2177 |
XVaNestedList pr_atrb; |
2 | 2178 |
|
2179 |
AWT_LOCK(); |
|
2180 |
pX11IMData = getX11InputMethodData(env, this); |
|
2181 |
||
2182 |
if ((pX11IMData == NULL) || (pX11IMData->current_ic == NULL)) { |
|
2183 |
AWT_UNLOCK(); |
|
2184 |
return JNI_FALSE; |
|
2185 |
} |
|
2186 |
||
50350
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
2187 |
pr_atrb = XVaCreateNestedList(0, XNPreeditState, |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
2188 |
(enable ? XIMPreeditEnable : XIMPreeditDisable), NULL); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
2189 |
ret = XSetICValues(pX11IMData->current_ic, XNPreeditAttributes, pr_atrb, NULL); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
2190 |
XFree((void *)pr_atrb); |
2 | 2191 |
AWT_UNLOCK(); |
2192 |
||
50350
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
2193 |
if ((ret != 0) && |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
2194 |
((strcmp(ret, XNPreeditAttributes) == 0) |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
2195 |
|| (strcmp(ret, XNPreeditState) == 0))) { |
2 | 2196 |
JNU_ThrowByName(env, "java/lang/UnsupportedOperationException", ""); |
2197 |
} |
|
2198 |
||
2199 |
return (jboolean)(ret == 0); |
|
2200 |
} |
|
2201 |
||
2202 |
/* |
|
50350
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
2203 |
* Class: sun_awt_X11InputMethodBase |
2 | 2204 |
* Method: isCompositionEnabledNative |
50350
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
2205 |
* Signature: ()Z |
2 | 2206 |
* |
2207 |
* This method tries to get the XNPreeditState attribute associated with the current XIC. |
|
2208 |
* |
|
2209 |
* Return JNI_TRUE if the XNPreeditState is successfully retrieved. Otherwise, if |
|
2210 |
* XGetICValues fails to get this attribute, java.lang.UnsupportedOperationException |
|
2211 |
* will be thrown. JNI_FALSE is returned if this method fails due to other reasons. |
|
2212 |
*/ |
|
50350
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
2213 |
JNIEXPORT jboolean JNICALL Java_sun_awt_X11InputMethodBase_isCompositionEnabledNative |
2 | 2214 |
(JNIEnv *env, jobject this) |
2215 |
{ |
|
2216 |
X11InputMethodData *pX11IMData = NULL; |
|
2217 |
char * ret = NULL; |
|
50350
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
2218 |
XIMPreeditState state = XIMPreeditUnKnown; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
2219 |
XVaNestedList pr_atrb; |
2 | 2220 |
|
2221 |
AWT_LOCK(); |
|
2222 |
pX11IMData = getX11InputMethodData(env, this); |
|
2223 |
||
2224 |
if ((pX11IMData == NULL) || (pX11IMData->current_ic == NULL)) { |
|
2225 |
AWT_UNLOCK(); |
|
2226 |
return JNI_FALSE; |
|
2227 |
} |
|
2228 |
||
50350
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
2229 |
pr_atrb = XVaCreateNestedList(0, XNPreeditState, &state, NULL); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
2230 |
ret = XGetICValues(pX11IMData->current_ic, XNPreeditAttributes, pr_atrb, NULL); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
2231 |
XFree((void *)pr_atrb); |
2 | 2232 |
AWT_UNLOCK(); |
2233 |
||
50350
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
2234 |
if ((ret != 0) && |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
2235 |
((strcmp(ret, XNPreeditAttributes) == 0) |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
2236 |
|| (strcmp(ret, XNPreeditState) == 0))) { |
2 | 2237 |
JNU_ThrowByName(env, "java/lang/UnsupportedOperationException", ""); |
2238 |
return JNI_FALSE; |
|
2239 |
} |
|
2240 |
||
2241 |
return (jboolean)(state == XIMPreeditEnable); |
|
2242 |
} |
|
2243 |
||
2244 |
JNIEXPORT void JNICALL Java_sun_awt_X11_XInputMethod_adjustStatusWindow |
|
2245 |
(JNIEnv *env, jobject this, jlong window) |
|
2246 |
{ |
|
50350
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
2247 |
|
2 | 2248 |
} |
50350
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
2249 |
|
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
2250 |
/* |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
2251 |
* Class: sun_awt_X11InputMethod |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
2252 |
* Method: setStatusAreaVisible |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
2253 |
* Signature: (ZJ)V |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
2254 |
*/ |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
2255 |
JNIEXPORT void JNICALL Java_sun_awt_X11InputMethod_setStatusAreaVisible |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
2256 |
(JNIEnv *env, jobject this, jboolean value, jlong data) |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
2257 |
{ |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
2258 |
X11InputMethodData *pX11IMData; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
2259 |
|
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
2260 |
pX11IMData = getX11InputMethodData(env, this); |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
2261 |
if (NULL == pX11IMData) return; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
2262 |
if (NULL == pX11IMData->statusWindow) return; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
2263 |
|
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
2264 |
if ((int)value){ |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
2265 |
pX11IMData->statusWindow->on = True; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
2266 |
}else{ |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
2267 |
pX11IMData->statusWindow->on = False; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
2268 |
} |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
2269 |
return; |
668463f93ec0
8201429: Support AIX Input Method Editor (IME) for AWT Input Method Framework (IMF)
clanger
parents:
47216
diff
changeset
|
2270 |
} |