Scale computer-use 2.0 with open-source drivers, cross-OS sandboxes, and benchmarks for training, evaluation, and data generation.
Rust agentai-agentapplecomputer-usecomputer-use-agentcontainerizationcuadesktop-automationhacktoberfestlumemacosmanusoperatorswiftvirtualizationvirtualization-frameworkwindowswindows-sandbox
fix(cua-driver): preserve semantic Hyprland AX scrolling (#3820)
Francesco Bonacci72b8707cfbdf
diff --git a/libs/cua-driver/rust/crates/cua-driver/tests/harness_gtk3_test.rs b/libs/cua-driver/rust/crates/cua-driver/tests/harness_gtk3_test.rsindex e1955852c1..03cf5d6d9a 100644--- a/libs/cua-driver/rust/crates/cua-driver/tests/harness_gtk3_test.rs+++ b/libs/cua-driver/rust/crates/cua-driver/tests/harness_gtk3_test.rs@@ -813,6 +813,18 @@ fn invoke_operation("GTK3 scroll failed: {}",response.text());+ if !pixel+ && mode == "foreground"+ && platform_linux::wayland::wayland_input_enabled()+ && platform_linux::wayland::hyprland::is_session()+ {+ assert_eq!(+ response.action_route(),+ Some("accessibility"),+ "GTK3 AX scroll must use its semantic action: {}",+ response.raw+ );+ }wait_for_positive_state(driver, pid, window_id, state_key);return false;}diff --git a/libs/cua-driver/rust/crates/platform-linux/src/tools/impl_.rs b/libs/cua-driver/rust/crates/platform-linux/src/tools/impl_.rsindex bfb65c55c2..ce3813c61e 100644--- a/libs/cua-driver/rust/crates/platform-linux/src/tools/impl_.rs+++ b/libs/cua-driver/rust/crates/platform-linux/src/tools/impl_.rs@@ -5763,6 +5763,39 @@ impl Tool for ScrollTool {return refusal;}}+ if let cua_driver_core::element_token::ResolvedElement::Element { element_index, .. } =+ &resolved+ {+ let idx = *element_index;+ // WebKitGTK acknowledges the AT-SPI scroll action without moving+ // the DOM scroller. On native Wayland, use a real compositor wheel+ // event at the resolved element instead of reporting a silent+ // success. Other AX targets keep their semantic route before any+ // coordinate-based compositor fallback.+ if !(crate::wayland::wayland_input_enabled() && is_webkitgtk_embedder(pid)) {+ let direction_for_ax = direction.clone();+ let ax_result = tokio::task::spawn_blocking(move || {+ crate::atspi::scroll_element(pid, idx, &direction_for_ax, amount, by)+ })+ .await;+ match ax_result {+ Ok(Ok(progress)) => {+ return atspi_scroll_result(progress, delivery.is_foreground())+ }+ Err(error) => {+ return atspi_scroll_result(+ crate::atspi::ScrollProgress {+ acknowledged: 0,+ complete: false,+ detail: Some(error.to_string()),+ },+ delivery.is_foreground(),+ )+ }+ Ok(Err(_)) => {}+ }+ }+ }if hyprland_foreground(delivery) {if xid_opt.is_none() {return foreground_hyprland_refusal(@@ -5797,39 +5830,6 @@ impl Tool for ScrollTool {).await;}- if let cua_driver_core::element_token::ResolvedElement::Element { element_index, .. } =- &resolved- {- let idx = *element_index;- // WebKitGTK acknowledges the AT-SPI scroll action without moving- // the DOM scroller. On native Wayland, use a real compositor wheel- // event at the resolved element instead of reporting a silent- // success. Chromium's AT-SPI scroll path remains effective.- if !(crate::wayland::wayland_input_enabled() && is_webkitgtk_embedder(pid)) {- let direction_for_ax = direction.clone();- let ax_result = tokio::task::spawn_blocking(move || {- crate::atspi::scroll_element(pid, idx, &direction_for_ax, amount, by)- })- .await;- match ax_result {- Ok(Ok(progress)) => {- return atspi_scroll_result(progress, delivery.is_foreground())- }- Err(error) => {- return atspi_scroll_result(- crate::atspi::ScrollProgress {- acknowledged: 0,- complete: false,- detail: Some(error.to_string()),- },- delivery.is_foreground(),- )- }- Ok(Err(_)) => {}- }- }- }-if isolated_background {if xid_opt.is_none() {return isolated_hyprland_refusal(