162 currentX11InputMethodInstance's pData) */
163 static XIM X11im = NULL;
164 Display * dpy = NULL;
165
166 #define GetJNIEnv() (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2)
167
168 static void DestroyXIMCallback(XIM, XPointer, XPointer);
169 static void OpenXIMCallback(Display *, XPointer, XPointer);
170 /* Solaris XIM Extention */
171 #define XNCommitStringCallback "commitStringCallback"
172 static void CommitStringCallback(XIC, XPointer, XPointer);
173
174 static X11InputMethodData * getX11InputMethodData(JNIEnv *, jobject);
175 static void setX11InputMethodData(JNIEnv *, jobject, X11InputMethodData *);
176 static void destroyX11InputMethodData(JNIEnv *, X11InputMethodData *);
177 static void freeX11InputMethodData(JNIEnv *, X11InputMethodData *);
178 #if defined(__linux__)
179 static Window getParentWindow(Window);
180 #endif
181
182 #ifdef __solaris__
183 /* Prototype for this function is missing in Solaris X11R6 Xlib.h */
184 extern char *XSetIMValues(
185 #if NeedVarargsPrototypes
186 XIM /* im */, ...
187 #endif
188 );
189 #endif
190
191 /*
192 * This function is stolen from /src/solaris/hpi/src/system_md.c
193 * It is used in setting the time in Java-level InputEvents
194 */
195 jlong
196 awt_util_nowMillisUTC()
197 {
198 struct timeval t;
199 gettimeofday(&t, NULL);
200 return ((jlong)t.tv_sec) * 1000 + (jlong)(t.tv_usec/1000);
201 }
202
203 /*
204 * Converts the wchar_t string to a multi-byte string calling wcstombs(). A
205 * buffer is allocated by malloc() to store the multi-byte string. NULL is
206 * returned if the given wchar_t string pointer is NULL or buffer allocation is
207 * failed.
208 */
209 static char *
210 wcstombsdmp(wchar_t *wcs, int len)
|
162 currentX11InputMethodInstance's pData) */
163 static XIM X11im = NULL;
164 Display * dpy = NULL;
165
166 #define GetJNIEnv() (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2)
167
168 static void DestroyXIMCallback(XIM, XPointer, XPointer);
169 static void OpenXIMCallback(Display *, XPointer, XPointer);
170 /* Solaris XIM Extention */
171 #define XNCommitStringCallback "commitStringCallback"
172 static void CommitStringCallback(XIC, XPointer, XPointer);
173
174 static X11InputMethodData * getX11InputMethodData(JNIEnv *, jobject);
175 static void setX11InputMethodData(JNIEnv *, jobject, X11InputMethodData *);
176 static void destroyX11InputMethodData(JNIEnv *, X11InputMethodData *);
177 static void freeX11InputMethodData(JNIEnv *, X11InputMethodData *);
178 #if defined(__linux__)
179 static Window getParentWindow(Window);
180 #endif
181
182 /*
183 * This function is stolen from /src/solaris/hpi/src/system_md.c
184 * It is used in setting the time in Java-level InputEvents
185 */
186 jlong
187 awt_util_nowMillisUTC()
188 {
189 struct timeval t;
190 gettimeofday(&t, NULL);
191 return ((jlong)t.tv_sec) * 1000 + (jlong)(t.tv_usec/1000);
192 }
193
194 /*
195 * Converts the wchar_t string to a multi-byte string calling wcstombs(). A
196 * buffer is allocated by malloc() to store the multi-byte string. NULL is
197 * returned if the given wchar_t string pointer is NULL or buffer allocation is
198 * failed.
199 */
200 static char *
201 wcstombsdmp(wchar_t *wcs, int len)
|