Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(detect): update sctk dependency to fix crash #1769

Merged
merged 2 commits into from Dec 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
47 changes: 23 additions & 24 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion espanso-detect/Cargo.toml
Expand Up @@ -24,7 +24,7 @@ widestring = "0.4.3"
[target.'cfg(target_os="linux")'.dependencies]
libc = "0.2.85"
scopeguard = "1.1.0"
sctk = { package = "smithay-client-toolkit", version = "0.15.4", optional = true }
sctk = { package = "smithay-client-toolkit", version = "0.16.1", optional = true }

[build-dependencies]
cc = "1.0.73"
Expand Down
16 changes: 6 additions & 10 deletions espanso-detect/src/evdev/sync/wayland.rs
Expand Up @@ -67,10 +67,7 @@ pub fn get_modifiers_state() -> Result<Option<super::ModifiersState>> {
* Keyboard initialization
*/

let mut seats = Vec::<(
String,
Option<(wl_keyboard::WlKeyboard, calloop::RegistrationToken)>,
)>::new();
let mut seats = Vec::<(String, Option<wl_keyboard::WlKeyboard>)>::new();

// first process already existing seats
for seat in env.get_all_seats() {
Expand All @@ -89,8 +86,8 @@ pub fn get_modifiers_state() -> Result<Option<super::ModifiersState>> {
RepeatKind::System,
move |event, _, _| keyboard_event_handler(event, &result_clone),
) {
Ok((kbd, repeat_source)) => {
seats.push((name, Some((kbd, repeat_source))));
Ok(kbd) => {
seats.push((name, Some(kbd)));
}
Err(e) => {
error!("Failed to map keyboard on seat {} : {:?}.", name, e);
Expand Down Expand Up @@ -127,8 +124,8 @@ pub fn get_modifiers_state() -> Result<Option<super::ModifiersState>> {
RepeatKind::System,
move |event, _, _| keyboard_event_handler(event, &result_clone),
) {
Ok((kbd, repeat_source)) => {
*opt_kbd = Some((kbd, repeat_source));
Ok(kbd) => {
*opt_kbd = Some(kbd);
}
Err(e) => {
eprintln!(
Expand All @@ -138,10 +135,9 @@ pub fn get_modifiers_state() -> Result<Option<super::ModifiersState>> {
}
}
}
} else if let Some((kbd, source)) = opt_kbd.take() {
} else if let Some(kbd) = opt_kbd.take() {
// the keyboard has been removed, cleanup
kbd.release();
loop_handle.remove(source);
}
});

Expand Down