aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2014-04-17 00:38:46 -0400
committerJesse Luehrs <doy@tozt.net>2014-04-17 00:38:46 -0400
commit7ef5f47270688d8f35dbfff24ba3cf22e8f2d04a (patch)
tree4e8948e4378093fee4e2cb3c2f6e6f9cb927b3dd
parent68690fbfb66df3e5f22ff235e3b23f1f4cc6b257 (diff)
downloadrunes-7ef5f47270688d8f35dbfff24ba3cf22e8f2d04a.tar.gz
runes-7ef5f47270688d8f35dbfff24ba3cf22e8f2d04a.zip
make visual bell more reliable
-rw-r--r--window-xlib.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/window-xlib.c b/window-xlib.c
index 4c375ca..f3e943b 100644
--- a/window-xlib.c
+++ b/window-xlib.c
@@ -1,6 +1,7 @@
#include <cairo-xlib.h>
#include <stdio.h>
#include <stdlib.h>
+#include <time.h>
#include <unistd.h>
#include <X11/cursorfont.h>
#include <X11/Xlib.h>
@@ -405,10 +406,14 @@ static void runes_window_backend_process_event(uv_work_t *req, int status)
}
else if (a == w->atoms[RUNES_ATOM_RUNES_VISUAL_BELL]) {
cairo_pattern_t *white;
+ struct timespec tm = { 0, 20000000 };
white = cairo_pattern_create_rgb(1.0, 1.0, 1.0);
cairo_set_source(t->backend_cr, white);
cairo_paint(t->backend_cr);
+ cairo_surface_flush(cairo_get_target(t->backend_cr));
+ XFlush(w->dpy);
+ nanosleep(&tm, NULL);
runes_window_backend_flush(t);
}
break;