UI: an agent's injected drag never warps the real cursor (#592 follow-up)

Control-channel pointer events (ui.drag) scrub numbers like a mouse but
turn off the edge wrap, so an agent never moves the user's cursor; the
TextBox case of the drag test goes (that plug-in isn't in-tree).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QiAJeFttZp83Fh7YuzAR5f
This commit is contained in:
Claude
2026-10-10 16:30:09 +00:00
parent 00364546eb
commit 2500719969
2 changed files with 27 additions and 30 deletions
+3 -2
View File
@@ -1627,7 +1627,8 @@ impl eframe::App for EffectcraftApp {
}
fn raw_input_hook(&mut self, ctx: &egui::Context, raw_input: &mut egui::RawInput) {
if !self.synthetic.is_empty() {
let injected = !self.synthetic.is_empty();
if injected {
// Pointer events go one per frame so egui sees press → moves → release as a real drag.
let pointer = |e: &egui::Event| matches!(e, egui::Event::PointerMoved(_) | egui::Event::PointerButton { .. } | egui::Event::MouseWheel { .. });
let n = if pointer(&self.synthetic[0]) {
@@ -1640,7 +1641,7 @@ impl eframe::App for EffectcraftApp {
};
raw_input.events.extend(self.synthetic.drain(..n));
}
if pointer_wrap::prepare_input(ctx, raw_input) {
if pointer_wrap::prepare_input(ctx, raw_input, injected) {
self.session.history.merge_key = None;
}
}