pub enum ScriptEvent {
PointerMove {
x: f32,
y: f32,
},
Mouse {
x: f32,
y: f32,
button: String,
pressed: bool,
modifiers: u8,
},
Wheel {
x: f32,
y: f32,
dx: f32,
dy: f32,
modifiers: u8,
},
Key {
key: String,
pressed: bool,
modifiers: u8,
},
Ime {
kind: String,
text: String,
cursor: Option<usize>,
},
Focus {
focused: bool,
},
CursorLeft,
Command {
source: String,
id: u64,
},
ScaleFactorChanged {
dpr: f32,
logical_width: f32,
logical_height: f32,
},
}Expand description
脚本事件枚举。字段名与真实 ShellEvent 对齐,便于 Agent 生成脚本。
Variants§
PointerMove
光标移动:{"type":"pointer_move","x":10,"y":20}
Mouse
鼠标按下/抬起:{"type":"mouse","x":10,"y":20,"button":"left","pressed":true}
Wheel
滚轮:{"type":"wheel","x":10,"y":20,"dx":0,"dy":16}
Key
键盘:{"type":"key","key":"Enter","pressed":true}
Ime
IME:{"type":"ime","kind":"commit","text":"你好"}
Focus
窗口焦点:{"type":"focus","focused":false}
CursorLeft
光标离开客户区:{"type":"cursor_left"}
Command
统一命令路由投递:{"type":"command","source":"menu","id":1}
不是 ShellEvent:真实来源(菜单/托盘/快捷键/第二实例)本来就不走窗口事件管线。
由 Agent 宿主直接投递到场景的 CommandRouter,并把统计写进语义摘要。
ScaleFactorChanged
DPR / 屏幕归属变化:{"type":"scale_factor","dpr":1.5,"logical_width":800,"logical_height":600}
不是 ShellEvent:桌面 shell 通过 ScaleFactorChanged 回调直接通知 app,
不经过输入事件队列。Agent 宿主更新 headless shell metrics 并调用 Scene 的
DPR 钩子,保证与真实窗口走同一语义而不是伪造一个输入事件。
Implementations§
Source§impl ScriptEvent
impl ScriptEvent
Trait Implementations§
Source§impl Clone for ScriptEvent
impl Clone for ScriptEvent
Source§impl Debug for ScriptEvent
impl Debug for ScriptEvent
Source§impl<'de> Deserialize<'de> for ScriptEvent
impl<'de> Deserialize<'de> for ScriptEvent
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for ScriptEvent
impl PartialEq for ScriptEvent
impl StructuralPartialEq for ScriptEvent
Auto Trait Implementations§
impl Forget for ScriptEvent
impl Freeze for ScriptEvent
impl Move for ScriptEvent
impl RefUnwindSafe for ScriptEvent
impl Send for ScriptEventwhere
RawVecInner: Send,
impl Sync for ScriptEventwhere
RawVecInner: Sync,
impl Unpin for ScriptEvent
impl UnsafeUnpin for ScriptEvent
impl UnwindSafe for ScriptEventwhere
RawVecInner: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more