From a08577e301c8b83b414fed0c120f55dfabde64a6 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Wed, 14 Oct 2026 18:53:38 +0200 Subject: [PATCH] Extras: horizon-ctl key and mouse reach the zoom key and keystrokes Agents press keys and buttons through the control socket, which skipped the keyboard and mouse hooks; under control the window may also lack focus without pausing, so the zoom no longer lets go then. Co-Authored-By: Claude Opus 5.5 --- crates/horizon-client/src/game/control.rs | 22 ++++++++++++++++++++-- crates/horizon-client/src/game/extras.rs | 4 +++- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/crates/horizon-client/src/game/control.rs b/crates/horizon-client/src/game/control.rs index bc584990d..e7fe21260 100644 --- a/crates/horizon-client/src/game/control.rs +++ b/crates/horizon-client/src/game/control.rs @@ -163,6 +163,16 @@ impl Game<'_> { self.debug_key(key, KeyAction::Release); } } + // The zoom extra's key, as the keyboard hook sees it. + if self.screen == Screen::Playing { + let action = arg(2)?; + if self.extras_key(physical, action != "up", false) { + if action == "tap" { + self.extras_key(physical, false, false); + } + return ok(); + } + } // Text screens consume raw presses; releases follow key binds. let typing = matches!(self.screen, Screen::Chat | Screen::Options); let key = if typing && arg(2)? != "up" { @@ -228,9 +238,17 @@ impl Game<'_> { .into()); } match arg(2)? { - "down" => self.play_mouse(button, true)?, - "up" => self.play_mouse(button, false)?, + "down" => { + self.extras_mouse(button, true); + self.play_mouse(button, true)? + } + "up" => { + self.extras_mouse(button, false); + self.play_mouse(button, false)? + } "click" => { + self.extras_mouse(button, true); + self.extras_mouse(button, false); self.play_mouse(button, true)?; self.play_mouse(button, false)?; } diff --git a/crates/horizon-client/src/game/extras.rs b/crates/horizon-client/src/game/extras.rs index 7197725f7..284871fd6 100644 --- a/crates/horizon-client/src/game/extras.rs +++ b/crates/horizon-client/src/game/extras.rs @@ -59,7 +59,9 @@ impl Game<'_> { } /// Once per frame: the frame's time, and keys let go behind screens. pub(super) fn extras_frame(&mut self, elapsed: Duration) { - let playing = self.screen == Screen::Playing && self.title.is_none() && self.focused; + // Under agent control the window may lack focus without pausing. + let focused = self.focused || self.control.is_some(); + let playing = self.screen == Screen::Playing && self.title.is_none() && focused; if !playing || !self.settings.extras.zoom { self.extras.zoom.release(); }