Bump smithay-client-toolkit to v0.16.0

This commit is contained in:
Kirill Chibisov 2022-06-20 10:19:49 +03:00 committed by GitHub
parent 2b414cd825
commit c93ef47b9b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 23 deletions

View file

@ -102,8 +102,8 @@ features = [
[target.'cfg(any(target_os = "linux", target_os = "dragonfly", target_os = "freebsd", target_os = "openbsd", target_os = "netbsd"))'.dependencies] [target.'cfg(any(target_os = "linux", target_os = "dragonfly", target_os = "freebsd", target_os = "openbsd", target_os = "netbsd"))'.dependencies]
wayland-client = { version = "0.29.4", default_features = false, features = ["use_system_lib"], optional = true } wayland-client = { version = "0.29.4", default_features = false, features = ["use_system_lib"], optional = true }
wayland-protocols = { version = "0.29.4", features = [ "staging_protocols"], optional = true } wayland-protocols = { version = "0.29.4", features = [ "staging_protocols"], optional = true }
sctk = { package = "smithay-client-toolkit", version = "0.15.4", default_features = false, features = ["calloop"], optional = true } sctk = { package = "smithay-client-toolkit", version = "0.16.0", default_features = false, features = ["calloop"], optional = true }
sctk-adwaita = { version = "0.3.5", optional = true } sctk-adwaita = { version = "0.4.0", optional = true }
mio = { version = "0.8", features = ["os-ext"], optional = true } mio = { version = "0.8", features = ["os-ext"], optional = true }
x11-dl = { version = "2.18.5", optional = true } x11-dl = { version = "2.18.5", optional = true }
percent-encoding = { version = "2.0", optional = true } percent-encoding = { version = "2.0", optional = true }

View file

@ -538,6 +538,8 @@ impl<T: 'static> EventLoop<T> {
_ => unreachable!(), _ => unreachable!(),
}; };
self.event_loop.dispatch(timeout, state) self.event_loop
.dispatch(timeout, state)
.map_err(|error| error.into())
} }
} }

View file

@ -7,7 +7,7 @@ use sctk::reexports::client::protocol::wl_keyboard::WlKeyboard;
use sctk::reexports::client::protocol::wl_seat::WlSeat; use sctk::reexports::client::protocol::wl_seat::WlSeat;
use sctk::reexports::client::Attached; use sctk::reexports::client::Attached;
use sctk::reexports::calloop::{LoopHandle, RegistrationToken}; use sctk::reexports::calloop::LoopHandle;
use sctk::seat::keyboard; use sctk::seat::keyboard;
@ -20,12 +20,6 @@ mod keymap;
pub(crate) struct Keyboard { pub(crate) struct Keyboard {
pub keyboard: WlKeyboard, pub keyboard: WlKeyboard,
/// The source for repeat keys.
pub repeat_token: Option<RegistrationToken>,
/// LoopHandle to drop `RepeatSource`, when dropping the keyboard.
pub loop_handle: LoopHandle<'static, WinitState>,
} }
impl Keyboard { impl Keyboard {
@ -35,7 +29,7 @@ impl Keyboard {
modifiers_state: Rc<RefCell<ModifiersState>>, modifiers_state: Rc<RefCell<ModifiersState>>,
) -> Option<Self> { ) -> Option<Self> {
let mut inner = KeyboardInner::new(modifiers_state); let mut inner = KeyboardInner::new(modifiers_state);
let keyboard_data = keyboard::map_keyboard_repeat( let keyboard = keyboard::map_keyboard_repeat(
loop_handle.clone(), loop_handle.clone(),
seat, seat,
None, None,
@ -44,15 +38,10 @@ impl Keyboard {
let winit_state = dispatch_data.get::<WinitState>().unwrap(); let winit_state = dispatch_data.get::<WinitState>().unwrap();
handlers::handle_keyboard(event, &mut inner, winit_state); handlers::handle_keyboard(event, &mut inner, winit_state);
}, },
); )
.ok()?;
let (keyboard, repeat_token) = keyboard_data.ok()?; Some(Self { keyboard })
Some(Self {
keyboard,
loop_handle,
repeat_token: Some(repeat_token),
})
} }
} }
@ -61,10 +50,6 @@ impl Drop for Keyboard {
if self.keyboard.as_ref().version() >= 3 { if self.keyboard.as_ref().version() >= 3 {
self.keyboard.release(); self.keyboard.release();
} }
if let Some(repeat_token) = self.repeat_token.take() {
self.loop_handle.remove(repeat_token);
}
} }
} }