Revert "Remove unnecessary XFilterEvent call."
[st.git] / st.c
diff --git a/st.c b/st.c
index 3dd5caf..b89d094 100644 (file)
--- a/st.c
+++ b/st.c
@@ -3061,7 +3061,6 @@ xloadfont(Font *f, FcPattern *pattern) {
 void
 xloadfonts(char *fontstr, double fontsize) {
        FcPattern *pattern;
-       FcResult r_sz, r_psz;
        double fontval;
        float ceilf(float);
 
@@ -3080,11 +3079,11 @@ xloadfonts(char *fontstr, double fontsize) {
                FcPatternAddDouble(pattern, FC_PIXEL_SIZE, (double)fontsize);
                usedfontsize = fontsize;
        } else {
-               r_psz = FcPatternGetDouble(pattern, FC_PIXEL_SIZE, 0, &fontval);
-               r_sz = FcPatternGetDouble(pattern, FC_SIZE, 0, &fontval);
-               if(r_psz == FcResultMatch) {
+               if(FcPatternGetDouble(pattern, FC_PIXEL_SIZE, 0, &fontval) ==
+                               FcResultMatch) {
                        usedfontsize = fontval;
-               } else if(r_sz == FcResultMatch) {
+               } else if(FcPatternGetDouble(pattern, FC_SIZE, 0, &fontval) ==
+                               FcResultMatch) {
                        usedfontsize = -1;
                } else {
                        /*
@@ -3157,14 +3156,14 @@ void
 xzoom(const Arg *arg) {
        Arg larg;
 
-       larg.i = usedfontsize + arg->i;
+       larg.f = usedfontsize + arg->f;
        xzoomabs(&larg);
 }
 
 void
 xzoomabs(const Arg *arg) {
        xunloadfonts();
-       xloadfonts(usedfont, arg->i);
+       xloadfonts(usedfont, arg->f);
        cresize(0, 0);
        redraw();
        xhints();
@@ -3175,7 +3174,7 @@ xzoomreset(const Arg *arg) {
        Arg larg;
 
        if(defaultfontsize > 0) {
-               larg.i = defaultfontsize;
+               larg.f = defaultfontsize;
                xzoomabs(&larg);
        }
 }
@@ -3913,6 +3912,13 @@ run(void) {
        /* Waiting for window mapping */
        do {
                XNextEvent(xw.dpy, &ev);
+               /*
+                * XFilterEvent is required to be called after you using XOpenIM,
+                * this is not unnecessary.It does not only filter the key event,
+                * but some clientmessage for input method as well.
+                */
+               if(XFilterEvent(&ev, None))
+                       continue;
                if(ev.type == ConfigureNotify) {
                        w = ev.xconfigure.width;
                        h = ev.xconfigure.height;