A fix for the XopenIM() errors.
authorChristoph Lohmann <20h@r-36.net>
Tue, 1 Jan 2013 12:15:43 +0000 (13:15 +0100)
committerChristoph Lohmann <20h@r-36.net>
Tue, 1 Jan 2013 12:15:43 +0000 (13:15 +0100)
st.c

diff --git a/st.c b/st.c
index 7ceed75..163f160 100644 (file)
--- a/st.c
+++ b/st.c
@@ -2503,9 +2503,17 @@ xinit(void) {
        xw.draw = XftDrawCreate(xw.dpy, xw.buf, xw.vis, xw.cmap);
 
        /* input methods */
-       xw.xim = XOpenIM(xw.dpy, NULL, NULL, NULL);
-       if(xw.xim == NULL)
-               die("XOpenIM failed. Could not open input device.\n");
+       if((xw.xim =  XOpenIM(xw.dpy, NULL, NULL, NULL)) == NULL) {
+               XSetLocaleModifiers("@im=local");
+               if((xw.xim =  XOpenIM(xw.dpy, NULL, NULL, NULL)) == NULL) {
+                       XSetLocaleModifiers("@im=");
+                       if((xw.xim = XOpenIM(xw.dpy,
+                                       NULL, NULL, NULL)) == NULL) {
+                               die("XOpenIM failed. Could not open input"
+                                       " device.\n");
+                       }
+               }
+       }
        xw.xic = XCreateIC(xw.xim, XNInputStyle, XIMPreeditNothing
                                           | XIMStatusNothing, XNClientWindow, xw.win,
                                           XNFocusWindow, xw.win, NULL);