Bump smithay-client-toolkit to latest version

This commit is contained in:
Benjamin Bouvier 2021-06-25 15:23:58 +02:00 • committed by Victor Berger
parent 02f60b9884
commit fe44fead1c
3 changed files with 10 additions and 12 deletions

View file

@ -10,8 +10,8 @@ license = "MIT"
keywords = ["clipboard", "wayland"] keywords = ["clipboard", "wayland"]
[dependencies] [dependencies]
sctk = { package = "smithay-client-toolkit", version = "0.12", default-features = false } sctk = { package = "smithay-client-toolkit", version = "0.14", default-features = false }
wayland-client = { version = "0.28", features = ["dlopen"] } wayland-client = { version = "0.28", features = ["dlopen"] }
[dev-dependencies] [dev-dependencies]
sctk = { package = "smithay-client-toolkit", version = "0.12"} sctk = { package = "smithay-client-toolkit", version = "0.14"}

View file

@ -3,11 +3,8 @@ use std::io::{BufWriter, Seek, SeekFrom, Write};
use sctk::seat; use sctk::seat;
use sctk::seat::keyboard::{self, Event as KeyboardEvent, KeyState, RepeatKind}; use sctk::seat::keyboard::{self, Event as KeyboardEvent, KeyState, RepeatKind};
use sctk::shm::MemPool; use sctk::shm::MemPool;
use sctk::window::{ConceptFrame, Event as WindowEvent}; use sctk::window::{Event as WindowEvent, FallbackFrame};
use sctk::reexports::calloop::Source as EventLoopSource;
use sctk::reexports::client::protocol::wl_keyboard::WlKeyboard;
use sctk::reexports::client::protocol::wl_seat::WlSeat;
use sctk::reexports::client::protocol::wl_shm; use sctk::reexports::client::protocol::wl_shm;
use sctk::reexports::client::protocol::wl_surface::WlSurface; use sctk::reexports::client::protocol::wl_surface::WlSurface;
@ -35,7 +32,7 @@ fn main() {
.expect("unable to connect to a Wayland compositor."); .expect("unable to connect to a Wayland compositor.");
// Create event loop // Create event loop
let mut event_loop = sctk::reexports::calloop::EventLoop::<DispatchData>::new().unwrap(); let mut event_loop = sctk::reexports::calloop::EventLoop::<DispatchData>::try_new().unwrap();
// Initial window dimentions // Initial window dimentions
let mut dimentions = (320u32, 240u32); let mut dimentions = (320u32, 240u32);
@ -45,7 +42,7 @@ fn main() {
// Create window // Create window
let mut window = env let mut window = env
.create_window::<ConceptFrame, _>( .create_window::<FallbackFrame, _>(
surface, surface,
None, None,
dimentions, dimentions,
@ -77,7 +74,7 @@ fn main() {
let mut pools = env.create_double_pool(|_| {}).expect("failed to create a memory pool."); let mut pools = env.create_double_pool(|_| {}).expect("failed to create a memory pool.");
// Structure to track seats // Structure to track seats
let mut seats = Vec::<(WlSeat, Option<(WlKeyboard, EventLoopSource<_>)>)>::new(); let mut seats = Vec::new();
// Process existing seats // Process existing seats
for seat in env.get_all_seats() { for seat in env.get_all_seats() {

View file

@ -1,3 +1,4 @@
use sctk::MissingGlobal;
use sctk::data_device::{DataDevice, DataDeviceHandler, DataDeviceHandling, DndEvent}; use sctk::data_device::{DataDevice, DataDeviceHandler, DataDeviceHandling, DndEvent};
use sctk::primary_selection::{ use sctk::primary_selection::{
PrimarySelectionDevice, PrimarySelectionDeviceManager, PrimarySelectionHandler, PrimarySelectionDevice, PrimarySelectionDeviceManager, PrimarySelectionHandler,
@ -39,7 +40,7 @@ impl PrimarySelectionHandling for SmithayClipboard {
&self, &self,
seat: &WlSeat, seat: &WlSeat,
f: F, f: F,
) -> Result<(), ()> { ) -> Result<(), MissingGlobal> {
self.primary_selection_manager.with_primary_selection(seat, f) self.primary_selection_manager.with_primary_selection(seat, f)
} }
@ -49,14 +50,14 @@ impl PrimarySelectionHandling for SmithayClipboard {
} }
impl DataDeviceHandling for SmithayClipboard { impl DataDeviceHandling for SmithayClipboard {
fn set_callback<F>(&mut self, callback: F) -> Result<(), ()> fn set_callback<F>(&mut self, callback: F) -> Result<(), MissingGlobal>
where where
F: FnMut(WlSeat, DndEvent, DispatchData) + 'static, F: FnMut(WlSeat, DndEvent, DispatchData) + 'static,
{ {
self.data_device_manager.set_callback(callback) self.data_device_manager.set_callback(callback)
} }
fn with_device<F: FnOnce(&DataDevice)>(&self, seat: &WlSeat, f: F) -> Result<(), ()> { fn with_device<F: FnOnce(&DataDevice)>(&self, seat: &WlSeat, f: F) -> Result<(), MissingGlobal> {
self.data_device_manager.with_device(seat, f) self.data_device_manager.with_device(seat, f)
} }
} }