Dispatch source hit testing for native pointer clicks
Verify Tessera GUI / verify (push) Failing after 7m31s
Verify Tessera GUI / verify (push) Failing after 7m31s
This commit is contained in:
+23
-1
@@ -1,4 +1,4 @@
|
||||
//! Native input transport. Only opaque frame/mount identities cross to the VM worker.
|
||||
//! Native input transport. Frame/mount identities and optional logical pointer positions cross to the VM worker.
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::{
|
||||
io::{Read, Write},
|
||||
@@ -16,6 +16,28 @@ pub struct Input {
|
||||
pub layout_version: u64,
|
||||
pub mount: u64,
|
||||
pub kind: String,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub point: Option<[f32; 2]>,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub press_point: Option<[f32; 2]>,
|
||||
}
|
||||
|
||||
impl Input {
|
||||
pub fn validate(&self) -> Result<(), &'static str> {
|
||||
match (self.point, self.press_point) {
|
||||
(None, None) => Ok(()),
|
||||
(Some(point), Some(press))
|
||||
if self.kind == "click"
|
||||
&& point
|
||||
.into_iter()
|
||||
.chain(press)
|
||||
.all(|value| value.is_finite() && (0.0..=1_000_000.0).contains(&value)) =>
|
||||
{
|
||||
Ok(())
|
||||
}
|
||||
_ => Err("pointer click requires finite press/release coordinates"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub struct Client(SyncSender<Input>);
|
||||
|
||||
Reference in New Issue
Block a user