chore: Update deps

This commit is contained in:
Victoria Brekenfeld 2023-09-29 21:33:16 +02:00
parent 4f3a682564
commit 4e12957169
39 changed files with 1146 additions and 1001 deletions

View file

@ -4,7 +4,7 @@ use crate::shell::{focus::FocusDirection, grabs::ResizeEdge, Direction, ResizeDi
use serde::Deserialize;
use smithay::{
backend::input::KeyState,
input::keyboard::{keysyms as KeySyms, xkb::keysym_get_name, ModifiersState},
input::keyboard::{xkb::keysym_get_name, ModifiersState},
};
use std::collections::HashMap;
@ -90,11 +90,11 @@ pub struct KeyPattern {
pub modifiers: KeyModifiers,
/// The actual key, that was pressed
#[serde(deserialize_with = "deserialize_Keysym", default)]
pub key: Option<u32>,
pub key: Option<Keysym>,
}
impl KeyPattern {
pub fn new(modifiers: impl Into<KeyModifiers>, key: Option<u32>) -> KeyPattern {
pub fn new(modifiers: impl Into<KeyModifiers>, key: Option<Keysym>) -> KeyPattern {
KeyPattern {
modifiers: modifiers.into(),
key,
@ -174,7 +174,7 @@ pub enum Action {
fn insert_binding(
key_bindings: &mut HashMap<KeyPattern, Action>,
modifiers: KeyModifiers,
keys: impl Iterator<Item = u32>,
keys: impl Iterator<Item = Keysym>,
action: Action,
) {
if !key_bindings.values().any(|a| a == &action) {
@ -197,16 +197,16 @@ pub fn add_default_bindings(
let (workspace_previous, workspace_next, output_previous, output_next) = match workspace_layout
{
WorkspaceLayout::Horizontal => (
[KeySyms::KEY_Left, KeySyms::KEY_h],
[KeySyms::KEY_Right, KeySyms::KEY_l],
[KeySyms::KEY_Up, KeySyms::KEY_k],
[KeySyms::KEY_Down, KeySyms::KEY_j],
[Keysym::Left, Keysym::h],
[Keysym::Right, Keysym::l],
[Keysym::Up, Keysym::k],
[Keysym::Down, Keysym::j],
),
WorkspaceLayout::Vertical => (
[KeySyms::KEY_Up, KeySyms::KEY_k],
[KeySyms::KEY_Down, KeySyms::KEY_j],
[KeySyms::KEY_Left, KeySyms::KEY_h],
[KeySyms::KEY_Right, KeySyms::KEY_l],
[Keysym::Up, Keysym::k],
[Keysym::Down, Keysym::j],
[Keysym::Left, Keysym::h],
[Keysym::Right, Keysym::l],
),
};

View file

@ -2,7 +2,7 @@
use crate::{
shell::{Shell, WorkspaceAmount},
state::{BackendData, Data, State},
state::{BackendData, State},
wayland::protocols::output_configuration::OutputConfigurationState,
};
use cosmic_config::ConfigGet;
@ -158,12 +158,12 @@ impl OutputConfig {
}
impl Config {
pub fn load(loop_handle: &LoopHandle<'_, Data>) -> Config {
pub fn load(loop_handle: &LoopHandle<'_, State>) -> Config {
let config = cosmic_config::Config::new("com.system76.CosmicComp", 1).unwrap();
let source = cosmic_config::calloop::ConfigWatchSource::new(&config).unwrap();
loop_handle
.insert_source(source, |(config, keys), (), shared_data| {
config_changed(config, keys, &mut shared_data.state);
.insert_source(source, |(config, keys), (), state| {
config_changed(config, keys, state);
})
.expect("Failed to add cosmic-config to the event loop");
let xdg = xdg::BaseDirectories::new().ok();
@ -260,7 +260,7 @@ impl Config {
backend: &mut BackendData,
shell: &mut Shell,
seats: impl Iterator<Item = Seat<State>>,
loop_handle: &LoopHandle<'_, Data>,
loop_handle: &LoopHandle<'_, State>,
) {
let seats = seats.collect::<Vec<_>>();
let outputs = output_state.outputs().collect::<Vec<_>>();

View file

@ -3,6 +3,7 @@
use super::{KeyModifier, KeyModifiers};
use serde::{Deserialize, Serialize};
use smithay::reexports::x11rb::NO_SYMBOL;
pub use smithay::{
backend::input::KeyState,
input::keyboard::{keysyms as KeySyms, Keysym, XkbConfig as WlXkbConfig},
@ -65,20 +66,22 @@ where
let name = String::deserialize(deserializer)?;
//let name = format!("KEY_{}", code);
match xkb::keysym_from_name(&name, xkb::KEYSYM_NO_FLAGS) {
KeySyms::KEY_NoSymbol => match xkb::keysym_from_name(&name, xkb::KEYSYM_CASE_INSENSITIVE) {
KeySyms::KEY_NoSymbol => Err(<D::Error as Error>::invalid_value(
Unexpected::Str(&name),
&"One of the keysym names of xkbcommon.h without the 'KEY_' prefix",
)),
x => {
warn!(
"Key-Binding '{}' only matched case insensitive for {:?}",
name,
xkb::keysym_get_name(x)
);
Ok(Some(x))
x if x.raw() == NO_SYMBOL => {
match xkb::keysym_from_name(&name, xkb::KEYSYM_CASE_INSENSITIVE) {
x if x.raw() == NO_SYMBOL => Err(<D::Error as Error>::invalid_value(
Unexpected::Str(&name),
&"One of the keysym names of xkbcommon.h without the 'KEY_' prefix",
)),
x => {
warn!(
"Key-Binding '{}' only matched case insensitive for {:?}",
name,
xkb::keysym_get_name(x)
);
Ok(Some(x))
}
}
},
}
x => Ok(Some(x)),
}
}