From fc22021c7828649a89fa9f44bcd2789e6bf38f12 Mon Sep 17 00:00:00 2001 From: Joel Klinghed Date: Wed, 27 Sep 2017 18:57:01 +0200 Subject: Do not wait for animation when draw request comes from X server When resizing the window I get two xcb_configure_notify_t events, one with x = 0, y = 0 and the new size and just after that a new configure event with the right x and y values and still the new size. Unless I force draw it's possible to get the desktop background at 0,0 instead of the right location. --- src/main.cc | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/main.cc b/src/main.cc index 96a6500..50fe463 100644 --- a/src/main.cc +++ b/src/main.cc @@ -514,7 +514,7 @@ private: char tmp; if (io::read(pipe_, &tmp, 1)) { if (tmp == 'd') { - draw(); + force_draw(); return; } } @@ -568,7 +568,7 @@ private: void draw() { // Animator will draw soon anyway, so let it if (animator_ && animator_->active()) return; - tick(nullptr); + force_draw(); } static void rounded_path(cairo_t* cr, double x, double y, @@ -755,11 +755,15 @@ private: draw(); } - void tick(Animator*) override { + void force_draw() { internal_draw(); xcb_flush(wnd_.conn()); } + void tick(Animator*) override { + force_draw(); + } + void animate(Machine& machine) { if (!animator_) return; if (machine.animation) return; -- cgit v1.3