< prev index next >

src/java.desktop/unix/native/libawt_xawt/awt/awt_InputMethod.c

Print this page




1312 
1313     X11im = XOpenIM(display, NULL, NULL, NULL);
1314     if (X11im == NULL) {
1315         return;
1316     }
1317 
1318     ximCallback.callback = (XIMProc)DestroyXIMCallback;
1319     ximCallback.client_data = NULL;
1320     XSetIMValues(X11im, XNDestroyCallback, &ximCallback, NULL);
1321 }
1322 
1323 static void DestroyXIMCallback(XIM im, XPointer client_data, XPointer call_data) {
1324     /* mark that XIM server was destroyed */
1325     X11im = NULL;
1326     JNIEnv* env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
1327 
1328     AWT_LOCK();
1329     /* free the old pX11IMData and set it to null. this also avoids crashing
1330      * the jvm if the XIM server reappears */
1331     while (x11InputMethodGRefListHead != NULL) {
1332         if (getX11InputMethodData(env,
1333                 x11InputMethodGRefListHead->inputMethodGRef) == NULL) {
1334             /* Clear possible exceptions
1335              */
1336             if ((*env)->ExceptionOccurred(env)) {
1337                 (*env)->ExceptionDescribe(env);
1338                 (*env)->ExceptionClear(env);
1339             }
1340         }
1341     }
1342     AWT_UNLOCK();
1343 }
1344 
1345 JNIEXPORT jboolean JNICALL
1346 Java_sun_awt_X11_XInputMethod_openXIMNative(JNIEnv *env,
1347                                             jobject this,
1348                                             jlong display)
1349 {
1350     Bool registered;
1351 
1352     AWT_LOCK();
1353 
1354     dpy = (Display *)jlong_to_ptr(display);
1355 
1356 /* Use IMInstantiate call back only on Linux, as there is a bug in Solaris
1357    (4768335)
1358 */
1359 #if defined(__linux__) || defined(MACOSX)
1360     registered = XRegisterIMInstantiateCallback(dpy, NULL, NULL,




1312 
1313     X11im = XOpenIM(display, NULL, NULL, NULL);
1314     if (X11im == NULL) {
1315         return;
1316     }
1317 
1318     ximCallback.callback = (XIMProc)DestroyXIMCallback;
1319     ximCallback.client_data = NULL;
1320     XSetIMValues(X11im, XNDestroyCallback, &ximCallback, NULL);
1321 }
1322 
1323 static void DestroyXIMCallback(XIM im, XPointer client_data, XPointer call_data) {
1324     /* mark that XIM server was destroyed */
1325     X11im = NULL;
1326     JNIEnv* env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
1327 
1328     AWT_LOCK();
1329     /* free the old pX11IMData and set it to null. this also avoids crashing
1330      * the jvm if the XIM server reappears */
1331     while (x11InputMethodGRefListHead != NULL) {
1332         getX11InputMethodData(env, x11InputMethodGRefListHead->inputMethodGRef);








1333     }
1334     AWT_UNLOCK();
1335 }
1336 
1337 JNIEXPORT jboolean JNICALL
1338 Java_sun_awt_X11_XInputMethod_openXIMNative(JNIEnv *env,
1339                                             jobject this,
1340                                             jlong display)
1341 {
1342     Bool registered;
1343 
1344     AWT_LOCK();
1345 
1346     dpy = (Display *)jlong_to_ptr(display);
1347 
1348 /* Use IMInstantiate call back only on Linux, as there is a bug in Solaris
1349    (4768335)
1350 */
1351 #if defined(__linux__) || defined(MACOSX)
1352     registered = XRegisterIMInstantiateCallback(dpy, NULL, NULL,


< prev index next >