--- st-0.2/st.c Sat Jan 21 22:43:03 2012 +++ st-0.2_modified/st.c Tue Mar 6 05:23:12 2012 @@ -1695,6 +1695,7 @@ XSetWindowAttributes attrs; Cursor cursor; Window parent; + if(!(xw.dpy = XOpenDisplay(NULL))) die("Can't open display\n"); @@ -1738,9 +1739,23 @@ /* input methods */ xw.xim = XOpenIM(xw.dpy, NULL, NULL, NULL); - xw.xic = XCreateIC(xw.xim, XNInputStyle, XIMPreeditNothing + + + if (xw.xim == NULL) { + XSetLocaleModifiers("@im=local"); + /* Second try */ + xw.xim= XOpenIM(xw.dpy, NULL, NULL, NULL); + } + + if (xw.xim != NULL) + xw.xic = XCreateIC(xw.xim, XNInputStyle, XIMPreeditNothing | XIMStatusNothing, XNClientWindow, xw.win, XNFocusWindow, xw.win, NULL); + else { + die("Context could not be opened\n"); + } + + /* gc */ dc.gc = XCreateGC(xw.dpy, xw.win, 0, NULL); @@ -2101,8 +2116,9 @@ } run: - setlocale(LC_CTYPE, ""); - tnew(80, 24); + + setlocale(LC_CTYPE, NULL); + tnew(80, 24); ttynew(); xinit(); selinit();