From 9fd90c70c845ecf6e4515b71d0a5f85802f3dab5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Tue, 15 Nov 2022 14:33:36 +0400 Subject: [PATCH] qemu-display: avoid sending absolute position if unsupported MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Marc-André Lureau --- qemu-rdw/src/display.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/qemu-rdw/src/display.rs b/qemu-rdw/src/display.rs index b3c79dc..73e9387 100644 --- a/qemu-rdw/src/display.rs +++ b/qemu-rdw/src/display.rs @@ -78,7 +78,12 @@ mod imp { .connect_motion(clone!(@weak self as this => move |_, x, y| { log::debug!("motion: {:?}", (x, y)); MainContext::default().spawn_local(clone!(@weak this => async move { - let _ = this.obj().console().mouse.set_abs_position(x as _, y as _).await; + if !this.obj().console().mouse.is_absolute().await.unwrap_or(false) { + return; + } + if let Err(e) = this.obj().console().mouse.set_abs_position(x as _, y as _).await { + log::warn!("{e}"); + } })); }));