From eef2ca9f2ea135b84564be428064cf303ce3e7a1 Mon Sep 17 00:00:00 2001 From: Kirill Chibisov Date: Wed, 30 Sep 2020 18:05:24 +0300 Subject: [PATCH] Update SCTK to 0.12 --- CHANGELOG.md | 2 ++ Cargo.toml | 6 +++--- examples/clipboard.rs | 2 +- src/worker/mod.rs | 13 +++++-------- 4 files changed, 11 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 00ef294..69d02e7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +- Updated smithay-client-toolkit to 0.12 + ## 0.5.2 -- 2020-08-30 - Fixed clipboard crashing, when seat has neither keyboard nor pointer focus diff --git a/Cargo.toml b/Cargo.toml index 5a06f7f..fdef777 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,8 +10,8 @@ license = "MIT" keywords = ["clipboard", "wayland"] [dependencies] -sctk = { package = "smithay-client-toolkit", version = "0.11", default-features = false } -wayland-client = { version = "0.27", features = ["dlopen"] } +sctk = { package = "smithay-client-toolkit", version = "0.12", default-features = false } +wayland-client = { version = "0.28", features = ["dlopen"] } [dev-dependencies] -sctk = { package = "smithay-client-toolkit", version = "0.11"} +sctk = { package = "smithay-client-toolkit", version = "0.12"} diff --git a/examples/clipboard.rs b/examples/clipboard.rs index a3abfca..211eade 100644 --- a/examples/clipboard.rs +++ b/examples/clipboard.rs @@ -31,7 +31,7 @@ impl DispatchData { fn main() { // Setup default desktop environment - let (env, display, queue) = sctk::init_default_environment!(ClipboardExample, desktop) + let (env, display, queue) = sctk::new_default_environment!(ClipboardExample, desktop) .expect("unable to connect to a Wayland compositor."); // Create event loop diff --git a/src/worker/mod.rs b/src/worker/mod.rs index 75304fb..ba5338d 100644 --- a/src/worker/mod.rs +++ b/src/worker/mod.rs @@ -66,14 +66,11 @@ fn worker_impl(display: Display, request_rx: Receiver, reply_tx: Sender let mut queue = display.create_event_queue(); let display_proxy = display.attach(queue.token()); - let env = Environment::init(&display_proxy, SmithayClipboard::new()); - let req = queue.sync_roundtrip(&mut (), |_, _, _| unreachable!()); - let req = req.and_then(|_| queue.sync_roundtrip(&mut (), |_, _, _| unreachable!())); - - // We shouldn't crash the application if we've failed to dispatch. - if req.is_err() { - return; - } + let env = match Environment::new(&display_proxy, &mut queue, SmithayClipboard::new()) { + Ok(env) => env, + // We shouldn't crash the application if we've failed to create environment. + Err(_) => return, + }; // Get data device manager. let data_device_manager = env.get_global::();