ecore-x: Remove XIM
authormike_m <mike_m@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Tue, 12 Jul 2011 02:26:19 +0000 (02:26 +0000)
committermike_m <mike_m@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Tue, 12 Jul 2011 02:26:19 +0000 (02:26 +0000)
Signed-off-by: Naruto TAKAHASHI <tnaruto@gmail.com>
git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/ecore@61257 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/lib/ecore_x/xlib/ecore_x.c
src/lib/ecore_x/xlib/ecore_x_events.c

index 066306c..48c1f25 100644 (file)
@@ -59,8 +59,6 @@ Window _ecore_x_event_last_win = 0;
 int _ecore_x_event_last_root_x = 0;
 int _ecore_x_event_last_root_y = 0;
 Eina_Bool _ecore_x_xcursor = EINA_FALSE;
-XIC _ecore_x_ic = NULL; /* Input context for composed characters */
-XIM _ecore_x_im = NULL;
 
 Ecore_X_Window _ecore_x_private_win = 0;
 
@@ -558,56 +556,6 @@ ecore_x_init(const char *name)
 
    _ecore_x_private_win = ecore_x_window_override_new(0, -77, -777, 123, 456);
 
-#ifdef ENABLE_XIM
-   /* Setup XIM */
-   if (!_ecore_x_ic && XSupportsLocale())
-     {
-        XIM im;
-        XIC ic;
-        XIMStyles *supported_styles;
-        XIMStyle chosen_style = 0;
-        Ecore_X_Window client_window = ecore_x_window_root_get(
-              _ecore_x_private_win);
-        char *ret;
-        int i;
-
-        XSetLocaleModifiers("@im=none");
-        if (!(im = XOpenIM(_ecore_x_disp, NULL, NULL, NULL)))
-           goto _im_create_end;
-
-        ret = XGetIMValues(im, XNQueryInputStyle, &supported_styles, NULL);
-        if (ret || !supported_styles)
-           goto _im_create_error;
-
-        for (i = 0; i < supported_styles->count_styles; i++)
-          {
-             if (supported_styles->supported_styles[i] ==
-                 (XIMPreeditNothing | XIMStatusNothing))
-                chosen_style = supported_styles->supported_styles[i];
-          }
-        XFree(supported_styles);
-        if (!chosen_style)
-           goto _im_create_error;
-
-        ic = XCreateIC(im,
-                       XNInputStyle,
-                       chosen_style,
-                       XNClientWindow,
-                       client_window,
-                       NULL);
-        if (ic)
-          {
-             _ecore_x_ic = ic;
-             _ecore_x_im = im;
-             goto _im_create_end;
-          }
-
-_im_create_error:
-        XCloseIM(im);
-     }
-
-_im_create_end:
-#endif /* ifdef ENABLE_XIM */
    return _ecore_x_init_count;
 
 free_event_handlers:
@@ -640,20 +588,6 @@ _ecore_x_shutdown(int close_display)
 
    LOGFN(__FILE__, __LINE__, __FUNCTION__);
 
-#ifdef ENABLE_XIM
-   if (_ecore_x_ic)
-     {
-        XDestroyIC(_ecore_x_ic);
-        _ecore_x_ic = NULL;
-     }
-
-   if (_ecore_x_im)
-     {
-        XCloseIM(_ecore_x_im);
-        _ecore_x_im = NULL;
-     }
-
-#endif /* ifdef ENABLE_XIM */
    ecore_main_fd_handler_del(_ecore_x_fd_handler_handle);
    if (close_display)
       XCloseDisplay(_ecore_x_disp);
index fe8d1b6..8165308 100644 (file)
@@ -231,88 +231,18 @@ _ecore_key_press(int event, XKeyEvent *xevent)
    sym = 0;
    key = NULL;
    compose = NULL;
-   if ((_ecore_x_ic) && (event == ECORE_EVENT_KEY_DOWN))
-     {
-        Status mbstatus;
-#ifdef X_HAVE_UTF8_STRING
-        val = Xutf8LookupString(_ecore_x_ic,
-                                (XKeyEvent *)xevent,
-                                compose_buffer,
-                                sizeof(compose_buffer) - 1,
-                                &sym,
-                                &mbstatus);
-#else /* ifdef X_HAVE_UTF8_STRING */
-        val = XmbLookupString(_ecore_x_ic,
-                              (XKeyEvent *)xevent,
-                              compose_buffer,
-                              sizeof(compose_buffer) - 1,
-                              &sym,
-                              &mbstatus);
-#endif /* ifdef X_HAVE_UTF8_STRING */
-        if (mbstatus == XBufferOverflow)
-          {
-             tmp = malloc(sizeof (char) * (val + 1));
-             if (!tmp)
-                return;
-
-             compose = tmp;
-
-#ifdef X_HAVE_UTF8_STRING
-             val = Xutf8LookupString(_ecore_x_ic,
-                                     (XKeyEvent *)xevent,
-                                     tmp,
-                                     val,
-                                     &sym,
-                                     &mbstatus);
-#else /* ifdef X_HAVE_UTF8_STRING */
-             val = XmbLookupString(_ecore_x_ic,
-                                   (XKeyEvent *)xevent,
-                                   tmp,
-                                   val,
-                                   &sym,
-                                   &mbstatus);
-#endif /* ifdef X_HAVE_UTF8_STRING */
-             if (val > 0)
-               {
-                  tmp[val] = 0;
-
-#ifndef X_HAVE_UTF8_STRING
-                  compose = eina_str_convert(nl_langinfo(CODESET), "UTF-8", tmp);
-                  free(tmp);
-                  tmp = compose;
-#endif /* ifndef X_HAVE_UTF8_STRING */
-               }
-             else
-                compose = NULL;
-          }
-        else
-        if (val > 0)
-          {
-             compose_buffer[val] = 0;
-#ifdef X_HAVE_UTF8_STRING
-             compose = compose_buffer;
-#else /* ifdef X_HAVE_UTF8_STRING */
-             compose = eina_str_convert(nl_langinfo(
-                                           CODESET), "UTF-8", compose_buffer);
-             tmp = compose;
-#endif /* ifdef X_HAVE_UTF8_STRING */
-          }
-     }
-   else
-     {
-        val = XLookupString(xevent,
-                            compose_buffer,
-                            sizeof(compose_buffer),
-                            &sym,
-                            &status);
-        if (val > 0)
-          {
-             compose_buffer[val] = 0;
-             compose = eina_str_convert(nl_langinfo(
-                                           CODESET), "UTF-8", compose_buffer);
-             tmp = compose;
-          }
-     }
+   val = XLookupString(xevent,
+                       compose_buffer,
+                       sizeof(compose_buffer),
+                       &sym,
+                       &status);
+   if (val > 0)
+       {
+          compose_buffer[val] = 0;
+          compose = eina_str_convert(nl_langinfo(CODESET), "UTF-8",
+                                     compose_buffer);
+          tmp = compose;
+       }
 
    key = XKeysymToString(sym);
    if (!key)
@@ -881,16 +811,6 @@ _ecore_x_event_handle_focus_in(XEvent *xevent)
    Ecore_X_Event_Window_Focus_In *e;
 
    _ecore_x_last_event_mouse_move = 0;
-   if (_ecore_x_ic)
-     {
-        char *str;
-
-        XSetICValues(_ecore_x_ic, XNFocusWindow, xevent->xfocus.window, NULL);
-        if ((str = XmbResetIC(_ecore_x_ic)))
-           XFree(str);
-
-        XSetICFocus(_ecore_x_ic);
-     }
 
    e = calloc(1, sizeof(Ecore_X_Event_Window_Focus_In));
    if (!e)
@@ -935,8 +855,6 @@ _ecore_x_event_handle_focus_out(XEvent *xevent)
    Ecore_X_Event_Window_Focus_Out *e;
 
    _ecore_x_last_event_mouse_move = 0;
-   if (_ecore_x_ic)
-      XUnsetICFocus(_ecore_x_ic);
 
    e = calloc(1, sizeof(Ecore_X_Event_Window_Focus_Out));
    if (!e)