jdk/src/solaris/native/sun/awt/awt_InputMethod.c
changeset 12047 320a714614e9
parent 11093 e753252dc8a9
child 16734 da1901d79073
--- a/jdk/src/solaris/native/sun/awt/awt_InputMethod.c	Tue Mar 06 10:25:45 2012 +0800
+++ b/jdk/src/solaris/native/sun/awt/awt_InputMethod.c	Tue Mar 06 20:34:38 2012 +0000
@@ -53,7 +53,7 @@
                                 XIMPreeditDrawCallbackStruct *);
 static void PreeditCaretCallback(XIC, XPointer,
                                  XIMPreeditCaretCallbackStruct *);
-#ifdef __linux__
+#if defined(__linux__) || defined(MACOSX)
 static void StatusStartCallback(XIC, XPointer, XPointer);
 static void StatusDoneCallback(XIC, XPointer, XPointer);
 static void StatusDrawCallback(XIC, XPointer,
@@ -67,7 +67,7 @@
 #define PreeditDoneIndex        1
 #define PreeditDrawIndex        2
 #define PreeditCaretIndex       3
-#ifdef __linux__
+#if defined(__linux__) || defined(MACOSX)
 #define StatusStartIndex        4
 #define StatusDoneIndex         5
 #define StatusDrawIndex         6
@@ -85,14 +85,14 @@
     (XIMProc)PreeditDoneCallback,
     (XIMProc)PreeditDrawCallback,
     (XIMProc)PreeditCaretCallback,
-#ifdef __linux__
+#if defined(__linux__) || defined(MACOSX)
     (XIMProc)StatusStartCallback,
     (XIMProc)StatusDoneCallback,
     (XIMProc)StatusDrawCallback,
 #endif
 };
 
-#ifdef __linux__
+#if defined(__linux__) || defined(MACOSX)
 #define MAX_STATUS_LEN  100
 typedef struct {
     Window   w;                /*status window id        */
@@ -125,7 +125,7 @@
     XIMCallback *callbacks;     /* callback parameters */
     jobject     x11inputmethod; /* global ref to X11InputMethod instance */
                                 /* associated with the XIC */
-#ifdef __linux__
+#if defined(__linux__) || defined(MACOSX)
     StatusWindow *statusWindow; /* our own status window  */
 #endif
     char        *lookup_buf;    /* buffer used for XmbLookupString */
@@ -372,7 +372,7 @@
 static void
 freeX11InputMethodData(JNIEnv *env, X11InputMethodData *pX11IMData)
 {
-#ifdef __linux__
+#if defined(__linux__) || defined(MACOSX)
     if (pX11IMData->statusWindow != NULL){
         StatusWindow *sw = pX11IMData->statusWindow;
         XFreeGC(awt_display, sw->lightGC);
@@ -475,7 +475,7 @@
     pX11IMData = getX11InputMethodData(env, currentX11InputMethodInstance);
 
     if (pX11IMData == NULL) {
-#ifdef __linux__
+#if defined(__linux__) || defined(MACOSX)
         return False;
 #else
         return result;
@@ -483,7 +483,7 @@
     }
 
     if ((ic = pX11IMData->current_ic) == (XIC)0){
-#ifdef __linux__
+#if defined(__linux__) || defined(MACOSX)
         return False;
 #else
         return result;
@@ -579,7 +579,7 @@
     return result;
 }
 
-#ifdef __linux__
+#if defined(__linux__) || defined(MACOSX)
 static StatusWindow *createStatusWindow(
                                 Window parent) {
     StatusWindow *statusWindow;
@@ -892,7 +892,7 @@
         }
     }
 }
-#endif  /*__linux__*/
+#endif  /* __linux__ || MACOSX */
 /*
  * Creates two XICs, one for active clients and the other for passive
  * clients. All information on those XICs are stored in the
@@ -936,7 +936,7 @@
         return FALSE ;
     }
 
-#ifdef __linux__
+#if defined(__linux__) || defined(MACOSX)
     on_the_spot_styles |= XIMStatusNothing;
 
     /*kinput does not support XIMPreeditCallbacks and XIMStatusArea
@@ -949,9 +949,9 @@
             break;
         }
     }
-#else /*! __linux__ */
+#else /*! __linux__ && !MACOSX */
     on_the_spot_styles |= XIMStatusNothing;
-#endif /* __linux__ */
+#endif /* __linux__ || MACOSX */
 
     for (i = 0; i < im_styles->count_styles; i++) {
         active_styles |= im_styles->supported_styles[i] & on_the_spot_styles;
@@ -999,7 +999,7 @@
                         NULL);
         if (preedit == (XVaNestedList)NULL)
             goto err;
-#ifdef __linux__
+#if defined(__linux__) || defined(MACOSX)
         /*always try XIMStatusCallbacks for active client...*/
         {
             status = (XVaNestedList)XVaCreateNestedList(0,
@@ -1021,7 +1021,7 @@
             XFree((void *)status);
             XFree((void *)preedit);
         }
-#else /* !__linux__ */
+#else /* !__linux__ && !MACOSX */
             pX11IMData->ic_active = XCreateIC(X11im,
                                               XNClientWindow, w,
                                               XNFocusWindow, w,
@@ -1029,7 +1029,7 @@
                                               XNPreeditAttributes, preedit,
                                               NULL);
         XFree((void *)preedit);
-#endif /* __linux__ */
+#endif /* __linux__ || MACOSX */
         pX11IMData->ic_passive = XCreateIC(X11im,
                                            XNClientWindow, w,
                                            XNFocusWindow, w,
@@ -1188,7 +1188,7 @@
 
 }
 
-#ifdef __linux__
+#if defined(__linux__) || defined(MACOSX)
 static void
 StatusStartCallback(XIC ic, XPointer client_data, XPointer call_data)
 {
@@ -1256,7 +1256,7 @@
  finally:
     AWT_UNLOCK();
 }
-#endif /*__linux__*/
+#endif /* __linux__ || MACOSX */
 
 static void CommitStringCallback(XIC ic, XPointer client_data, XPointer call_data) {
     JNIEnv *env = GetJNIEnv();
@@ -1353,14 +1353,14 @@
 /* Use IMInstantiate call back only on Linux, as there is a bug in Solaris
    (4768335)
 */
-#ifdef __linux__
+#if defined(__linux__) || defined(MACOSX)
     registered = XRegisterIMInstantiateCallback(dpy, NULL, NULL,
                      NULL, (XIDProc)OpenXIMCallback, NULL);
     if (!registered) {
         /* directly call openXIM callback */
 #endif
         OpenXIMCallback(dpy, NULL, NULL);
-#ifdef __linux__
+#if defined(__linux__) || defined(MACOSX)
     }
 #endif
 
@@ -1395,9 +1395,9 @@
 
     globalRef = (*env)->NewGlobalRef(env, this);
     pX11IMData->x11inputmethod = globalRef;
-#ifdef __linux__
+#if defined(__linux__) || defined(MACOSX)
     pX11IMData->statusWindow = NULL;
-#endif /* __linux__ */
+#endif /* __linux__ || MACOSX */
 
     pX11IMData->lookup_buf = 0;
     pX11IMData->lookup_buf_len = 0;
@@ -1444,14 +1444,14 @@
         setXICFocus(pX11IMData->current_ic, req);
         currentX11InputMethodInstance = pX11IMData->x11inputmethod;
         currentFocusWindow =  w;
-#ifdef __linux__
+#if defined(__linux__) || defined(MACOSX)
         if (active && pX11IMData->statusWindow && pX11IMData->statusWindow->on)
             onoffStatusWindow(pX11IMData, w, True);
 #endif
     } else {
         currentX11InputMethodInstance = NULL;
         currentFocusWindow = 0;
-#ifdef __linux__
+#if defined(__linux__) || defined(MACOSX)
         onoffStatusWindow(pX11IMData, 0, False);
         if (pX11IMData->current_ic != NULL)
 #endif
@@ -1468,7 +1468,7 @@
 Java_sun_awt_X11InputMethod_turnoffStatusWindow(JNIEnv *env,
                                                 jobject this)
 {
-#ifdef __linux__
+#if defined(__linux__) || defined(MACOSX)
     X11InputMethodData *pX11IMData;
     StatusWindow *statusWindow;
 
@@ -1636,7 +1636,7 @@
 JNIEXPORT void JNICALL Java_sun_awt_X11_XInputMethod_adjustStatusWindow
   (JNIEnv *env, jobject this, jlong window)
 {
-#ifdef __linux__
+#if defined(__linux__) || defined(MACOSX)
     AWT_LOCK();
     adjustStatusWindow(window);
     AWT_UNLOCK();