mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-01 23:55:39 +00:00
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 <mail@eliasnaur.com>
This commit is contained in:
@@ -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{
|
||||
|
||||
Reference in New Issue
Block a user