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:
@@ -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)?;
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user