first pass of merging in warp (doesn't build)
This commit is contained in:
@@ -7,12 +7,12 @@ mod mouse;
|
||||
mod screenshot;
|
||||
|
||||
use async_trait::async_trait;
|
||||
use galaxyui::r#async::Timer;
|
||||
use galaxyui_core::r#async::Timer;
|
||||
use windows::Win32::System::StationsAndDesktops::{
|
||||
CloseDesktop, DESKTOP_ACCESS_FLAGS, DESKTOP_CONTROL_FLAGS, HDESK, OpenInputDesktop,
|
||||
};
|
||||
|
||||
use crate::{Action, ActionResult, Options};
|
||||
use crate::{Action, ActionResult, Options, TargetedAction};
|
||||
|
||||
/// Returns whether computer_use can drive input on this machine right now.
|
||||
///
|
||||
@@ -24,6 +24,12 @@ pub fn is_supported_on_current_platform() -> bool {
|
||||
probe_input_desktop_available()
|
||||
}
|
||||
|
||||
/// Reports whether background, per-window control is available. The Windows input stack drives the
|
||||
/// screen / foreground window, so per-window background control is unsupported.
|
||||
pub fn background_supported() -> bool {
|
||||
false
|
||||
}
|
||||
|
||||
/// Shared probe used by both [`is_supported_on_current_platform`] and [`Actor::new`] so the
|
||||
/// "can we drive input right now?" logic lives in one place. This still runs the probe on each
|
||||
/// call (it's a cheap `OpenInputDesktop` / `CloseDesktop` round-trip) — we don't cache it because
|
||||
@@ -103,7 +109,7 @@ impl super::Actor for Actor {
|
||||
|
||||
async fn perform_actions(
|
||||
&mut self,
|
||||
actions: &[Action],
|
||||
actions: &[TargetedAction],
|
||||
options: Options,
|
||||
) -> Result<ActionResult, String> {
|
||||
// Probe at the top of every call so transient loss of the input desktop (workstation
|
||||
@@ -115,7 +121,10 @@ impl super::Actor for Actor {
|
||||
let keyboard = &mut self.keyboard;
|
||||
let mouse = &mut self.mouse;
|
||||
|
||||
for action in actions {
|
||||
for targeted in actions {
|
||||
// Per-window targeting is not supported on Windows; act on the screen / foreground
|
||||
// window regardless of the requested target.
|
||||
let action: &Action = &targeted.action;
|
||||
match action {
|
||||
Action::Wait(duration) => {
|
||||
Timer::after(*duration).await;
|
||||
@@ -152,9 +161,9 @@ impl super::Actor for Actor {
|
||||
None
|
||||
};
|
||||
|
||||
Ok(ActionResult {
|
||||
Ok(ActionResult::legacy(
|
||||
screenshot,
|
||||
cursor_position: Some(mouse.current_position()?),
|
||||
})
|
||||
Some(mouse.current_position()?),
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user