JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
Applying the changes to the docs; by Peter Hartman.
[st.git] / st.c
diff --git a/st.c b/st.c
index cc8a22a..7010195 100644 (file)
--- a/st.c
+++ b/st.c
@@ -436,7 +436,7 @@ typedef struct {
  * the current length of used elements.
  */
 
-static Fontcache frc[256];
+static Fontcache frc[2];
 static int frccur = -1, frclen = 0;
 
 ssize_t
@@ -2406,7 +2406,7 @@ xunloadfonts(void)
         * from the frccur.
         */
        for (i = 0, ip = frccur; i < frclen; i++, ip--) {
-               if (ip <= 0)
+               if (ip < 0)
                        ip = LEN(frc) - 1;
                XftFontClose(xw.dpy, frc[ip].font);
        }
@@ -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);
@@ -2542,7 +2550,6 @@ xdraws(char *s, Glyph base, int x, int y, int charlen, int bytelen) {
        FcPattern *fcpattern, *fontpattern;
        FcFontSet *fcsets[] = { NULL };
        FcCharSet *fccharset;
-       XGlyphInfo extents;
        Colour *fg = &dc.col[base.fg], *bg = &dc.col[base.bg],
                 *temp, revfg, revbg;
        XRenderColor colfg, colbg;