qemu-display: avoid sending absolute position if unsupported

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
This commit is contained in:
Marc-André Lureau 2022-11-15 14:33:36 +04:00
parent d78a324502
commit 9fd90c70c8

View File

@ -78,7 +78,12 @@ mod imp {
.connect_motion(clone!(@weak self as this => move |_, x, y| { .connect_motion(clone!(@weak self as this => move |_, x, y| {
log::debug!("motion: {:?}", (x, y)); log::debug!("motion: {:?}", (x, y));
MainContext::default().spawn_local(clone!(@weak this => async move { 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}");
}
})); }));
})); }));