From fc56b9fcb872aa9d9f88e6df821914a384317130 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Tue, 18 Jan 2022 23:08:46 +0400 Subject: [PATCH] Bump gtk/glib/rdw deps MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Marc-André Lureau --- Cargo.toml | 2 -- qemu-display/Cargo.toml | 2 +- qemu-rdw/Cargo.toml | 10 +++++----- qemu-rdw/src/clipboard.rs | 41 ++++++++++++++++++--------------------- qemu-rdw/src/usbredir.rs | 13 ++++++------- qemu-vte/Cargo.toml | 4 ++-- qemu-vte/src/main.rs | 2 +- 7 files changed, 34 insertions(+), 40 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index dcc179c..b91f930 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,6 +12,4 @@ default-members = ["qemu-rdw"] [patch.crates-io] vnc = { git = "https://github.com/elmarco/rust-vnc", branch = "server" } -zbus = { git = "https://gitlab.freedesktop.org/dbus/zbus.git" } -zvariant = { git = "https://gitlab.freedesktop.org/dbus/zbus.git" } rdw4 = { git = "https://gitlab.gnome.org/malureau/rdw.git" } diff --git a/qemu-display/Cargo.toml b/qemu-display/Cargo.toml index 6846950..d098325 100644 --- a/qemu-display/Cargo.toml +++ b/qemu-display/Cargo.toml @@ -9,7 +9,7 @@ edition = "2018" [dependencies] log = "0.4" derivative = "2.2.0" -zbus = { version = "2.0.0-beta.7", features = ["xml"] } +zbus = { version = "2.0", features = ["xml"] } zvariant = { version = "3.0", features = ["serde_bytes"] } libc = "0.2.86" enumflags2 = { version = "0.7", features = ["serde"] } diff --git a/qemu-rdw/Cargo.toml b/qemu-rdw/Cargo.toml index 1e0231d..16606e4 100644 --- a/qemu-rdw/Cargo.toml +++ b/qemu-rdw/Cargo.toml @@ -10,10 +10,10 @@ edition = "2018" log = "0.4" pretty_env_logger = "0.4" once_cell = "1.5" -zbus = { version = "2.0.0-beta.7" } +zbus = { version = "2.0" } qemu-display = { path = "../qemu-display" } keycodemap = { path = "../keycodemap" } -rdw = { package = "rdw4", version = "0.1.0", features = ["bindings"] } -futures-util = "0.3.13" -futures = "0.3.13" -async-trait = "0.1.48" +rdw = { package = "rdw4", version = "0.1", features = ["bindings"] } +futures-util = "0.3" +futures = "0.3" +async-trait = "0.1" diff --git a/qemu-rdw/src/clipboard.rs b/qemu-rdw/src/clipboard.rs index 5936c19..4ebdcbc 100644 --- a/qemu-rdw/src/clipboard.rs +++ b/qemu-rdw/src/clipboard.rs @@ -67,7 +67,7 @@ impl ClipboardHandler for InnerHandler { match p.request(selection, &[&mime]).await { Ok((_, data)) => { let bytes = glib::Bytes::from(&data); - stream.write_bytes_async_future(&bytes, prio).await.map(|_| ()) + stream.write_bytes_future(&bytes, prio).await.map(|_| ()) } Err(e) => { let err = format!("failed to request clipboard data: {}", e); @@ -88,7 +88,7 @@ impl ClipboardHandler for InnerHandler { async fn release(&mut self, selection: ClipboardSelection) { if let Some((clipboard, _)) = clipboard_from_selection(selection) { // TODO: track if the outside/app changed the clipboard - if let Err(e) = clipboard.set_content(gdk::NONE_CONTENT_PROVIDER) { + if let Err(e) = clipboard.set_content(gdk::ContentProvider::NONE) { log::warn!("Failed to release clipboard: {}", e); } } @@ -104,15 +104,13 @@ impl ClipboardHandler for InnerHandler { glib::MainContext::default().spawn_local(async move { let res = if let Some((clipboard, _)) = clipboard_from_selection(selection) { let m: Vec<_> = mimes.iter().map(|s| s.as_str()).collect(); - let res = clipboard - .read_async_future(&m, glib::Priority::default()) - .await; + let res = clipboard.read_future(&m, glib::Priority::default()).await; log::debug!("clipboard-read: {}", res.is_ok()); match res { Ok((stream, mime)) => { let out = gio::MemoryOutputStream::new_resizable(); let res = out - .splice_async_future( + .splice_future( &stream, gio::OutputStreamSpliceFlags::CLOSE_SOURCE | gio::OutputStreamSpliceFlags::CLOSE_TARGET, @@ -201,22 +199,21 @@ fn watch_clipboard( return; } - if let Some(formats) = clipboard.formats() { - let types = formats.mime_types(); - log::debug!(">clipboard-changed({:?}): {:?}", selection, types); - let proxy = proxy.clone(); - let serials = serials.clone(); - glib::MainContext::default().spawn_local(async move { - if types.is_empty() { - let _ = proxy.release(selection).await; - } else { - let mimes: Vec<_> = types.iter().map(|s| s.as_str()).collect(); - let ser = serials[idx].load(Ordering::SeqCst); - let _ = proxy.grab(selection, ser, &mimes).await; - serials[idx].store(ser + 1, Ordering::SeqCst); - } - }); - } + let formats = clipboard.formats(); + let types = formats.mime_types(); + log::debug!(">clipboard-changed({:?}): {:?}", selection, types); + let proxy = proxy.clone(); + let serials = serials.clone(); + glib::MainContext::default().spawn_local(async move { + if types.is_empty() { + let _ = proxy.release(selection).await; + } else { + let mimes: Vec<_> = types.iter().map(|s| s.as_str()).collect(); + let ser = serials[idx].load(Ordering::SeqCst); + let _ = proxy.grab(selection, ser, &mimes).await; + serials[idx].store(ser + 1, Ordering::SeqCst); + } + }); }); Some(id) } diff --git a/qemu-rdw/src/usbredir.rs b/qemu-rdw/src/usbredir.rs index b7cc1da..ae4cb46 100644 --- a/qemu-rdw/src/usbredir.rs +++ b/qemu-rdw/src/usbredir.rs @@ -25,7 +25,7 @@ impl Handler { for pos in pos..pos + add { let item = model.item(pos).unwrap(); if let Some(dev) = item.downcast_ref::().unwrap().device() { - item.set_property("active", usbredir.is_device_connected(&dev).await).unwrap(); + item.set_property("active", usbredir.is_device_connected(&dev).await); } } })); @@ -41,12 +41,12 @@ impl Handler { let usbredir = usbredir.clone(); MainContext::default().spawn_local(clone!(@weak item, @weak widget => async move { match usbredir.set_device_state(&device, state).await { - Ok(active) => item.set_property("active", active).unwrap(), + Ok(active) => item.set_property("active", active), Err(e) => { if state { - item.set_property("active", false).unwrap(); + item.set_property("active", false); } - widget.emit_by_name("show-error", &[&e.to_string()]).unwrap(); + widget.emit_by_name::<()>("show-error", &[&e.to_string()]); }, } })); @@ -56,11 +56,10 @@ impl Handler { MainContext::default().spawn_local(clone!(@weak widget => async move { use futures::stream::StreamExt; // for `next` widget - .set_property("free-channels", usbredir.n_free_channels().await) - .unwrap(); + .set_property("free-channels", usbredir.n_free_channels().await); let mut n = usbredir.receive_n_free_channels().await; while let Some(n) = n.next().await { - widget.set_property("free-channels", n).unwrap(); + widget.set_property("free-channels", n); } })); diff --git a/qemu-vte/Cargo.toml b/qemu-vte/Cargo.toml index d15d9a9..2449202 100644 --- a/qemu-vte/Cargo.toml +++ b/qemu-vte/Cargo.toml @@ -7,10 +7,10 @@ edition = "2018" log = "0.4" pretty_env_logger = "0.4" once_cell = "1.5" -zbus = { version = "2.0.0-beta.7" } +zbus = { version = "2.0" } qemu-display = { path = "../qemu-display" } futures = "0.3.13" [dependencies.vte] package = "vte4" -version = "0.0.1" +version = "0.1" diff --git a/qemu-vte/src/main.rs b/qemu-vte/src/main.rs index b2f2593..6b323d9 100644 --- a/qemu-vte/src/main.rs +++ b/qemu-vte/src/main.rs @@ -45,7 +45,7 @@ fn main() { let mut read = istream.into_async_read().unwrap(); term.connect_commit(move |_, text, _| { - let _res = ostream.write(text.as_bytes(), gio::NONE_CANCELLABLE); // TODO cancellable and error + let _res = ostream.write(text.as_bytes(), gio::Cancellable::NONE); // TODO cancellable and error }); loop {