From bd8757e51f0755f90166a75ef515e2e35379f293 Mon Sep 17 00:00:00 2001 From: Elias Naur Date: Sat, 16 May 2020 20:36:23 +0200 Subject: [PATCH] app/internal/window: [X11] make the notification pipe wakeup only Before, the wakeup pipe both woke the event loop and implied a redraw. We're going to use the notication for more, so deduce the need for redraw from window state instead. Signed-off-by: Elias Naur --- app/internal/window/os_x11.go | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/app/internal/window/os_x11.go b/app/internal/window/os_x11.go index d5674598..a70d99b4 100644 --- a/app/internal/window/os_x11.go +++ b/app/internal/window/os_x11.go @@ -113,17 +113,15 @@ func (w *x11Window) loop() { loop: for !w.dead { - var syn, redraw bool + var syn, anim bool // Check for pending draw events before checking animation or blocking. // This fixes an issue on Xephyr where on startup XPending() > 0 but // poll will still block. This also prevents no-op calls to poll. if syn = h.handleEvents(); !syn { w.mu.Lock() - animating := w.animating + anim = w.animating w.mu.Unlock() - if animating { - redraw = true - } else { + if !anim { // Clear poll events. *xEvents = 0 // Wait for X event or gio notification. @@ -150,10 +148,9 @@ loop: if err != nil { panic(fmt.Errorf("x11 loop: read from notify pipe failed: %w", err)) } - redraw = true } - if redraw || syn { + if anim || syn { w.cfg.now = time.Now() w.w.Event(FrameEvent{ FrameEvent: system.FrameEvent{