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 <noreply@anthropic.com>
This commit is contained in:
Ludovic Marie
2026-10-14 18:53:38 +02:00
parent c4b0e8efe0
commit a08577e301
2 changed files with 23 additions and 3 deletions
+20 -2
View File
@@ -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)?;
}
+3 -1
View File
@@ -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();
}