X-Git-Url: https://git.danieliu.xyz/?a=blobdiff_plain;f=st.c;h=6f5ca8036ee39bfdeaae466bc3e9d7c84f219df9;hb=b233007e0fddbb5ad8da3e436533254d099c8861;hp=cc8a22a139041fd49f2839c749f321e0775589e1;hpb=addc84834506e24387c1fb70b5d33b3f2ba55b66;p=st.git diff --git a/st.c b/st.c index cc8a22a..6f5ca80 100644 --- 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[1024]; 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;