Ugly. But apparently Solaris does not have the Xutf8* functions
authorsachiel <sachiel@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Sat, 3 Jan 2009 21:53:42 +0000 (21:53 +0000)
committersachiel <sachiel@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Sat, 3 Jan 2009 21:53:42 +0000 (21:53 +0000)
git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/ecore@38443 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/lib/ecore_x/xlib/ecore_x_events.c

index f73651e..87b7208 100644 (file)
@@ -217,17 +217,29 @@ _ecore_x_event_handle_key_press(XEvent *xevent)
    if (_ecore_x_ic)
      {
        Status mbstatus;
+#ifdef X_HAVE_UTF8_STRING
        val = Xutf8LookupString(_ecore_x_ic, (XKeyEvent *)xevent, buf, buflen - 1, &sym, &mbstatus);
+#else
+       val = XmbLookupString(_ecore_x_ic, (XKeyEvent *)xevent, buf, buflen - 1, &sym, &mbstatus);
+#endif
        if (mbstatus == XBufferOverflow)
          {
             buflen = val + 1;
             buf = realloc(buf, buflen);
+#ifdef X_HAVE_UTF8_STRING
             val = Xutf8LookupString(_ecore_x_ic, (XKeyEvent *)xevent, buf, buflen - 1, &sym, &mbstatus);
+#else
+            val = XmbLookupString(_ecore_x_ic, (XKeyEvent *)xevent, buf, buflen - 1, &sym, &mbstatus);
+#endif
          }
        if (val > 0)
          {
             buf[val] = 0;
+#ifdef X_HAVE_UTF8_STRING
             e->key_compose = strdup(buf);
+#else
+            e->key_compose = ecore_txt_convert(nl_langinfo(CODESET), "UTF-8", buf);
+#endif
          }
      }
    else
@@ -739,7 +751,7 @@ _ecore_x_event_handle_focus_in(XEvent *xevent)
      {
        char *str;
        XSetICValues(_ecore_x_ic, XNFocusWindow, xevent->xfocus.window, NULL);
-       if ((str = Xutf8ResetIC(_ecore_x_ic)))
+       if ((str = Xmb8ResetIC(_ecore_x_ic)))
          XFree(str);
        XSetICFocus(_ecore_x_ic);
      }