aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2014-05-01 22:05:57 -0400
committerJesse Luehrs <doy@tozt.net>2014-05-01 22:05:57 -0400
commit5a07dfe1df384d55596e614c04b31e7ea2090636 (patch)
tree6feb3ea76ea927b7496e3ae57c53735de3216c98
parent330c3d53a21e2b8877fd7dd8d19821c71367de20 (diff)
downloadrunes-5a07dfe1df384d55596e614c04b31e7ea2090636.tar.gz
runes-5a07dfe1df384d55596e614c04b31e7ea2090636.zip
avoid redundant flushes
-rw-r--r--src/window-xlib.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/window-xlib.c b/src/window-xlib.c
index 7325595..7324690 100644
--- a/src/window-xlib.c
+++ b/src/window-xlib.c
@@ -78,6 +78,8 @@ static struct function_key application_cursor_keys[] = {
static void runes_window_backend_get_next_event(uv_work_t *req);
static void runes_window_backend_process_event(uv_work_t *req, int status);
+static Bool runes_window_backend_find_flush_events(
+ Display *dpy, XEvent *e, XPointer arg);
static void runes_window_backend_resize_window(
RunesTerm *t, int width, int height);
static void runes_window_backend_flush(RunesTerm *t);
@@ -379,6 +381,13 @@ static void runes_window_backend_process_event(uv_work_t *req, int status)
);
}
else if (a == w->atoms[RUNES_ATOM_RUNES_FLUSH]) {
+ Bool res = True;
+
+ while (res) {
+ res = XCheckIfEvent(
+ w->dpy, e, runes_window_backend_find_flush_events,
+ (XPointer)w);
+ }
runes_window_backend_flush(t);
}
break;
@@ -399,6 +408,22 @@ static void runes_window_backend_process_event(uv_work_t *req, int status)
}
}
+static Bool runes_window_backend_find_flush_events(
+ Display *dpy, XEvent *e, XPointer arg)
+{
+ RunesWindowBackend *w = (RunesWindowBackend *)arg;
+
+ UNUSED(dpy);
+
+ if (e->type == ClientMessage) {
+ Atom a = e->xclient.data.l[0];
+ return a == w->atoms[RUNES_ATOM_RUNES_FLUSH] ? True : False;
+ }
+ else {
+ return False;
+ }
+}
+
static void runes_window_backend_resize_window(
RunesTerm *t, int width, int height)
{