From c874f813c1a98563998696d64f5c08539bb55e62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Sat, 22 Jul 2023 12:51:33 +0400 Subject: [PATCH] Update to latest crates --- Cargo.toml | 6 ++++-- qemu-display/Cargo.toml | 4 ++-- qemu-display/src/clipboard.rs | 6 ++++-- qemu-display/src/display.rs | 2 +- qemu-display/src/error.rs | 4 ++-- qemu-display/src/keyboard.rs | 3 +-- qemu-display/src/mouse.rs | 3 +-- qemu-display/src/usbredir.rs | 2 +- qemu-rdw/Cargo.toml | 9 ++++++--- qemu-rdw/src/display.rs | 28 ++++++++++++++-------------- qemu-rdw/src/main.rs | 6 +++--- qemu-vte/Cargo.toml | 3 ++- 12 files changed, 41 insertions(+), 35 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index b91f930..6ccd281 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,9 +7,11 @@ members = [ "qemu-vte", "xtask", ] - default-members = ["qemu-rdw"] +resolver = "2" [patch.crates-io] +zbus = { git = "https://github.com/dbus2/zbus.git" } +zvariant = { git = "https://github.com/dbus2/zbus.git" } vnc = { git = "https://github.com/elmarco/rust-vnc", branch = "server" } -rdw4 = { git = "https://gitlab.gnome.org/malureau/rdw.git" } +rdw4 = { path = "../rdw/rdw4" } diff --git a/qemu-display/Cargo.toml b/qemu-display/Cargo.toml index 266605f..be06fd2 100644 --- a/qemu-display/Cargo.toml +++ b/qemu-display/Cargo.toml @@ -13,8 +13,8 @@ qmp = ["dep:qapi", "dep:base64"] cfg-if = "1.0" log = "0.4" derivative = "2.2.0" -zbus = { version = "3.11", features = ["xml"] } -zvariant = { version = "3.0", features = ["serde_bytes"] } +zbus = { version = "4", features = ["xml"] } +zvariant = { version = "4", features = ["serde_bytes"] } libc = "0.2.86" enumflags2 = { version = "0.7", features = ["serde"] } serde = { version = "1.0.27", features = ["derive"] } diff --git a/qemu-display/src/clipboard.rs b/qemu-display/src/clipboard.rs index 7ac3ad5..acffb4a 100644 --- a/qemu-display/src/clipboard.rs +++ b/qemu-display/src/clipboard.rs @@ -1,7 +1,9 @@ use serde_repr::{Deserialize_repr, Serialize_repr}; use std::convert::TryFrom; -use zbus::{dbus_interface, dbus_proxy, zvariant::ObjectPath}; -use zvariant::Type; +use zbus::{ + dbus_interface, dbus_proxy, + zvariant::{ObjectPath, Type}, +}; use crate::Result; diff --git a/qemu-display/src/display.rs b/qemu-display/src/display.rs index 3452b73..2cfef6b 100644 --- a/qemu-display/src/display.rs +++ b/qemu-display/src/display.rs @@ -8,9 +8,9 @@ use zbus::{ fdo, fdo::ManagedObjects, names::{BusName, OwnedUniqueName, UniqueName, WellKnownName}, + zvariant::OwnedObjectPath, Connection, OwnerChangedStream, }; -use zvariant::OwnedObjectPath; #[cfg(unix)] use crate::UsbRedir; diff --git a/qemu-display/src/error.rs b/qemu-display/src/error.rs index fd1374e..70f3bdb 100644 --- a/qemu-display/src/error.rs +++ b/qemu-display/src/error.rs @@ -62,8 +62,8 @@ impl From for Error { } } -impl From for Error { - fn from(e: zvariant::Error) -> Self { +impl From for Error { + fn from(e: zbus::zvariant::Error) -> Self { Error::Zbus(e.into()) } } diff --git a/qemu-display/src/keyboard.rs b/qemu-display/src/keyboard.rs index abfdbb6..86ddf64 100644 --- a/qemu-display/src/keyboard.rs +++ b/qemu-display/src/keyboard.rs @@ -1,7 +1,6 @@ use enumflags2::{bitflags, BitFlags}; use serde::{Deserialize, Serialize}; -use zbus::dbus_proxy; -use zvariant::Type; +use zbus::{dbus_proxy, zvariant::Type}; #[bitflags] #[repr(u32)] diff --git a/qemu-display/src/mouse.rs b/qemu-display/src/mouse.rs index 25d3bf4..9454831 100644 --- a/qemu-display/src/mouse.rs +++ b/qemu-display/src/mouse.rs @@ -1,6 +1,5 @@ use serde_repr::{Deserialize_repr, Serialize_repr}; -use zbus::dbus_proxy; -use zvariant::Type; +use zbus::{dbus_proxy, zvariant::Type}; #[repr(u32)] #[derive(Deserialize_repr, Serialize_repr, Type, Debug, Hash, PartialEq, Eq, Clone, Copy)] diff --git a/qemu-display/src/usbredir.rs b/qemu-display/src/usbredir.rs index 58ff2be..13d2200 100644 --- a/qemu-display/src/usbredir.rs +++ b/qemu-display/src/usbredir.rs @@ -28,7 +28,7 @@ use crate::{Chardev, Error, Result}; struct InnerHandler { #[allow(unused)] // keep the device opened, as rusb doesn't take it #[cfg(unix)] - device_fd: Option, + device_fd: Option, stream: UnixStream, ctxt: rusb::Context, ctxt_thread: Option>, diff --git a/qemu-rdw/Cargo.toml b/qemu-rdw/Cargo.toml index abaa06b..ed509f4 100644 --- a/qemu-rdw/Cargo.toml +++ b/qemu-rdw/Cargo.toml @@ -12,15 +12,18 @@ qmp = ["qemu-display/qmp"] log = "0.4" pretty_env_logger = "0.4" once_cell = "1.5" -zbus = { version = "3.11" } +zbus = { version = "4" } qemu-display = { path = "../qemu-display" } keycodemap = { path = "../keycodemap" } -rdw = { package = "rdw4", version = "0.1", features = ["bindings"] } futures-util = "0.3" futures = "0.3" async-trait = "0.1" tracing-subscriber = { version = "0.3.11", features = ["env-filter" , "fmt"], default-features = false } -[target.'cfg(target_os = "windows")'.dependencies] +[target.'cfg(unix)'.dependencies] +rdw = { package = "rdw4", version = "0.1", features = ["bindings"] } + +[target.'cfg(windows)'.dependencies] uds_windows = "1.0.2" windows = { version = "0.43.0", features = ["Win32_System_Memory", "Win32_Foundation"] } +rdw = { package = "rdw4", version = "0.1", features = ["bindings"], default-features = false } diff --git a/qemu-rdw/src/display.rs b/qemu-rdw/src/display.rs index b937a5f..bf7509f 100644 --- a/qemu-rdw/src/display.rs +++ b/qemu-rdw/src/display.rs @@ -212,14 +212,14 @@ mod imp { continue; } this.obj().set_display_size(Some((s.width as _, s.height as _))); - this.obj().update_area(0, 0, s.width as _, s.height as _, s.stride as _, &s.data); + this.obj().update_area(0, 0, s.width as _, s.height as _, s.stride as _, Some(&s.data)); } Update(u) => { if u.format != 0x20020888 { log::warn!("Format not yet supported: {:X}", u.format); continue; } - this.obj().update_area(u.x as _, u.y as _, u.w as _, u.h as _, u.stride as _, &u.data); + this.obj().update_area(u.x as _, u.y as _, u.w as _, u.h as _, u.stride as _, Some(&u.data)); } #[cfg(windows)] ScanoutMap(s) => { @@ -242,7 +242,7 @@ mod imp { let map = MemoryMap { ptr, handle, offset, size }; this.obj().set_display_size(Some((s.width as _, s.height as _))); - this.obj().update_area(0, 0, s.width as _, s.height as _, s.stride as _, map.as_bytes()); + this.obj().update_area(0, 0, s.width as _, s.height as _, s.stride as _, Some(map.as_bytes())); this.scanout_map.replace(Some((map, s.stride))); } #[cfg(windows)] @@ -255,7 +255,7 @@ mod imp { }; let stride = *stride; let bytes = map.as_bytes(); - this.obj().update_area(u.x as _, u.y as _, u.w as _, u.h as _, stride as _, &bytes[u.y as usize * stride as usize + u.x as usize * 4..]); + this.obj().update_area(u.x as _, u.y as _, u.w as _, u.h as _, stride as _, Some(&bytes[u.y as usize * stride as usize + u.x as usize * 4..])); } #[cfg(windows)] ScanoutD3dTexture2d(s) => { @@ -273,9 +273,9 @@ mod imp { })); } #[cfg(windows)] - UpdateD3dTexture2d { wait_tx, .. } => { + UpdateD3dTexture2d { wait_tx, update } => { this.obj().set_d3d11_texture2d_can_acquire(true); - this.obj().render(); + this.obj().update_area(update.x, update.y, update.w, update.h, 0, None); this.obj().set_d3d11_texture2d_can_acquire(false); let _ = wait_tx.send(()); } @@ -294,8 +294,8 @@ mod imp { }); } #[cfg(unix)] - UpdateDMABUF { wait_tx, .. } => { - this.obj().render(); + UpdateDMABUF { wait_tx, update } => { + this.obj().update_area(update.x, update.y, update.w, update.h, 0, None); let _ = wait_tx.send(()); } Disable => { @@ -372,14 +372,14 @@ enum ConsoleEvent { ScanoutD3dTexture2d(qemu_display::ScanoutD3dTexture2d), #[cfg(windows)] UpdateD3dTexture2d { - _update: qemu_display::UpdateD3dTexture2d, + update: qemu_display::UpdateD3dTexture2d, wait_tx: futures::channel::oneshot::Sender<()>, }, #[cfg(unix)] ScanoutDMABUF(qemu_display::ScanoutDMABUF), #[cfg(unix)] UpdateDMABUF { - _update: qemu_display::UpdateDMABUF, + update: qemu_display::UpdateDMABUF, wait_tx: futures::channel::oneshot::Sender<()>, }, Disable, @@ -424,9 +424,9 @@ impl ConsoleListenerD3d11Handler for ConsoleHandler { } #[cfg(windows)] - async fn update_texture2d(&mut self, _update: qemu_display::UpdateD3dTexture2d) { + async fn update_texture2d(&mut self, update: qemu_display::UpdateD3dTexture2d) { let (wait_tx, wait_rx) = futures::channel::oneshot::channel(); - self.send(ConsoleEvent::UpdateD3dTexture2d { _update, wait_tx }); + self.send(ConsoleEvent::UpdateD3dTexture2d { update, wait_tx }); if let Err(e) = wait_rx.await { log::warn!("wait update d3d texture2d failed: {}", e); } @@ -449,9 +449,9 @@ impl ConsoleListenerHandler for ConsoleHandler { } #[cfg(unix)] - async fn update_dmabuf(&mut self, _update: qemu_display::UpdateDMABUF) { + async fn update_dmabuf(&mut self, update: qemu_display::UpdateDMABUF) { let (wait_tx, wait_rx) = futures::channel::oneshot::channel(); - self.send(ConsoleEvent::UpdateDMABUF { _update, wait_tx }); + self.send(ConsoleEvent::UpdateDMABUF { update, wait_tx }); if let Err(e) = wait_rx.await { log::warn!("wait update dmabuf failed: {}", e); } diff --git a/qemu-rdw/src/main.rs b/qemu-rdw/src/main.rs index 010835e..a1c2665 100644 --- a/qemu-rdw/src/main.rs +++ b/qemu-rdw/src/main.rs @@ -270,7 +270,7 @@ impl App { } } - window.show(); + window.present(); }); }); @@ -281,10 +281,10 @@ impl App { action_usb.connect_activate(move |_, _| { let usbredir = app_clone.inner.usbredir.borrow(); if let Some(usbredir) = usbredir.as_ref() { - let dialog = gtk::Dialog::new(); + let dialog = gtk::Window::new(); dialog.set_transient_for(app_clone.inner.app.active_window().as_ref()); dialog.set_child(Some(&usbredir.widget())); - dialog.show(); + dialog.present(); } }); app.inner.app.add_action(&action_usb); diff --git a/qemu-vte/Cargo.toml b/qemu-vte/Cargo.toml index 7aba51e..a4f7738 100644 --- a/qemu-vte/Cargo.toml +++ b/qemu-vte/Cargo.toml @@ -13,4 +13,5 @@ futures = "0.3.13" [dependencies.vte] package = "vte4" -version = "0.6" +version = "0.8" +git = "https://gitlab.gnome.org/World/Rust/vte4-rs"