[PR #7208] Fix idle spin when Wayland redraws stop #7414

Open
opened 2026-11-03 06:39:12 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/7208
Author: @TraiNguyenVan
Created: 11/2/2026
Status: 🔄 Open

Base: main ← Head: fix/7181-hidden-redraw-spin


📝 Commits (2)

  • ab11862 Stop polling when redraw callbacks cease
  • 29579dc Place event loop tests after production items

📊 Changes

2 files changed (+47 additions, -12 deletions)

View changed files

📝 crates/horizon-client/src/game.rs (+7 -12)
📝 crates/horizon-client/src/game/event_loop.rs (+40 -0)

📄 Description

🤖 Opened by TraiNguyenVan's AI agent (Codex, GPT-6), not by TraiNguyenVan personally.

What and why

Fixes #7181. A successful render result could remain set when the compositor stops sending redraw callbacks, leaving the event loop polling indefinitely. Consume that result after one idle iteration, so a missing next frame uses the existing 16 ms bounded wait. A new successful frame restores polling; offscreen mode continues to poll for its synthetic redraws. This follows up on #6730 and #6779 without applying a wait to every visible frame.

Kind

  • bug: a crash or a breakage

Vanilla reference

None: window event-loop scheduling is Horizon-specific.

Other projects' code

None.

Self-check

  • cargo test -p horizon-client --lib --no-default-features game::event_loop::tests: 2 passed.
  • cargo build --profile fast -p horizon-client -p horizon-client-lib: passed.
  • Hyprland/Wayland, Intel Iris Xe, title screen, same workspace and btop setup for both builds: baseline used 99.7% of one logical CPU over 10 seconds while hidden; fixed build used 0.4% over 10 seconds. Screenshots (inline):

Baseline: visible

Baseline visible

Baseline: hidden on workspace 10

Baseline hidden

Baseline: restored

Baseline restored

Fixed: visible

Fixed visible

Fixed: hidden on workspace 10

Fixed hidden

Fixed: restored

Fixed restored The control socket responded while hidden; after restoring the fixed build, the title advanced 180 frames over 3 seconds and quit succeeded.

  • Offscreen control smoke: opened a fresh creative world, queried state, and quit.
    pr_ready (tools/pr_ready.py on omarchy, against origin/main at 11440651b, 7 min 16 s)
Check Result
Scope ✅ 3 files, +48 −12
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 612 passed (1 min 18 s)
rustfmt ✅ (13 s)
Rust ⚠️ 1.98.0 is older than CI's stable (1.99): clippy may flag lints CI doesn't, update with rustup update
clippy ✅ (2 min 17 s)
tests: horizon-client ✅ 682 passed (2 min 56 s)
doc tests ✅ 0 passed (3 s)
content root tests ➖ content root untouched
mod API up to date ✅ (29 s)
tokens.css up to date ➖ theme untouched
launcher rustfmt ➖ launcher untouched
launcher clippy ➖ launcher untouched
launcher tests ➖ launcher untouched
Parity ➖ not run (no vanilla data here): CI's parity job picks the affected harnesses
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

The self-check scope included one unrelated local untracked file; the PR itself changes two files.

Visible gameplay frame-time distribution, other platforms, and loading-screen behavior have not been measured in this change.

🤖 Generated with Codex


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/horizon-rust/horizon/pull/7208 **Author:** [@TraiNguyenVan](https://github.com/TraiNguyenVan) **Created:** 11/2/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/7181-hidden-redraw-spin` --- ### 📝 Commits (2) - [`ab11862`](https://github.com/horizon-rust/horizon/commit/ab11862bfe65838fb275a724ad5398fabdd4f486) Stop polling when redraw callbacks cease - [`29579dc`](https://github.com/horizon-rust/horizon/commit/29579dcdaa65e7ba69b3be79c3e956a896549d40) Place event loop tests after production items ### 📊 Changes **2 files changed** (+47 additions, -12 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game.rs` (+7 -12) 📝 `crates/horizon-client/src/game/event_loop.rs` (+40 -0) </details> ### 📄 Description > 🤖 Opened by TraiNguyenVan's AI agent (Codex, GPT-6), not by TraiNguyenVan personally. ## What and why Fixes #7181. A successful render result could remain set when the compositor stops sending redraw callbacks, leaving the event loop polling indefinitely. Consume that result after one idle iteration, so a missing next frame uses the existing 16 ms bounded wait. A new successful frame restores polling; offscreen mode continues to poll for its synthetic redraws. This follows up on #6730 and #6779 without applying a wait to every visible frame. ## Kind - [x] bug: a crash or a breakage ## Vanilla reference None: window event-loop scheduling is Horizon-specific. ## Other projects' code None. ## Self-check - `cargo test -p horizon-client --lib --no-default-features game::event_loop::tests`: 2 passed. - `cargo build --profile fast -p horizon-client -p horizon-client-lib`: passed. - Hyprland/Wayland, Intel Iris Xe, title screen, same workspace and btop setup for both builds: baseline used 99.7% of one logical CPU over 10 seconds while hidden; fixed build used 0.4% over 10 seconds. Screenshots (inline): **Baseline: visible** ![Baseline visible](https://raw.githubusercontent.com/TraiNguyenVan/horizon/evidence/baseline-visible.png) **Baseline: hidden on workspace 10** ![Baseline hidden](https://raw.githubusercontent.com/TraiNguyenVan/horizon/evidence/baseline-hidden.png) **Baseline: restored** ![Baseline restored](https://raw.githubusercontent.com/TraiNguyenVan/horizon/evidence/baseline-restored.png) **Fixed: visible** ![Fixed visible](https://raw.githubusercontent.com/TraiNguyenVan/horizon/evidence/fixed-visible.png) **Fixed: hidden on workspace 10** ![Fixed hidden](https://raw.githubusercontent.com/TraiNguyenVan/horizon/evidence/fixed-hidden.png) **Fixed: restored** ![Fixed restored](https://raw.githubusercontent.com/TraiNguyenVan/horizon/evidence/fixed-restored.png) The control socket responded while hidden; after restoring the fixed build, the title advanced 180 frames over 3 seconds and quit succeeded. - Offscreen control smoke: opened a fresh creative world, queried state, and quit. **pr_ready** (`tools/pr_ready.py` on omarchy, against origin/main at 11440651b, 7 min 16 s) | Check | Result | | --- | --- | | Scope | ✅ 3 files, +48 −12 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 612 passed (1 min 18 s) | | rustfmt | ✅ (13 s) | | Rust | ⚠️ 1.98.0 is older than CI's stable (1.99): clippy may flag lints CI doesn't, update with `rustup update` | | clippy | ✅ (2 min 17 s) | | tests: horizon-client | ✅ 682 passed (2 min 56 s) | | doc tests | ✅ 0 passed (3 s) | | content root tests | ➖ content root untouched | | mod API up to date | ✅ (29 s) | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ➖ not run (no vanilla data here): CI's parity job picks the affected harnesses | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | The self-check scope included one unrelated local untracked file; the PR itself changes two files. Visible gameplay frame-time distribution, other platforms, and loading-screen behavior have not been measured in this change. 🤖 Generated with [Codex](https://openai.com/codex/) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
horizon-rust/horizon#7414
No description provided.