]> git.cworth.org Git - acre/commitdiff
acre-x: Don't redraw for unrecognized keypresses.
authorCarl Worth <cworth@cworth.org>
Thu, 7 Nov 2013 21:13:22 +0000 (13:13 -0800)
committerCarl Worth <cworth@cworth.org>
Thu, 7 Nov 2013 21:13:22 +0000 (13:13 -0800)
Until we add double-buffering, any unnecessary redrawing causes
annoying blinking. Eliminating redraws from unknown keypresses fixes
at least some, (but likely not that many).

acre-x.c

index f0fac370a5d9bb45e414c7834a6e5e9087805624..194926a0ae7e8502d1a75f2903698950c74e486e 100644 (file)
--- a/acre-x.c
+++ b/acre-x.c
@@ -126,6 +126,7 @@ handle_events(Display *dpy, Window window, Visual *visual,
                XNextEvent (dpy, &xev);
                 switch (xev.type) {
                 case KeyPress:
+                       need_redraw = true;
                        keycode = xev.xkey.keycode;
                        if (keycode == quit_code ||
                            keycode == escape_code)
@@ -161,7 +162,10 @@ handle_events(Display *dpy, Window window, Visual *visual,
                        {
                                acre_get_x_axis_data_range (acre, &x_min, &x_max);
                        }
-                       need_redraw = 1;
+                       else
+                       {
+                               need_redraw = false;
+                       }
                        break;
                 case ConfigureNotify:
                         width = xev.xconfigure.width;