Rebase on new libcosmic

This commit is contained in:
Jeremy Soller 2024-02-09 09:15:29 -07:00
parent e43008822f
commit ccee108243
No known key found for this signature in database
GPG key ID: D02FD439211AF56F
5 changed files with 758 additions and 793 deletions

View file

@ -7,7 +7,7 @@ use cosmic::{
cosmic_theme, executor,
iced::{
event::{self, Event},
keyboard::{Event as KeyEvent, KeyCode, Modifiers},
keyboard::{Event as KeyEvent, Key, Modifiers},
subscription::{self, Subscription},
window, Alignment, Length,
},
@ -123,7 +123,7 @@ pub enum Message {
Todo,
AppTheme(AppTheme),
Config(Config),
Key(Modifiers, KeyCode),
Key(Modifiers, Key),
Player(PlayerMessage),
SystemThemeModeChange(cosmic_theme::ThemeMode),
Tick(Instant),
@ -282,9 +282,9 @@ impl Application for App {
return self.update_config();
}
}
Message::Key(modifiers, key_code) => {
Message::Key(modifiers, key) => {
for (key_bind, action) in self.key_binds.iter() {
if key_bind.matches(modifiers, key_code) {
if key_bind.matches(modifiers, &key) {
return self.update(action.message());
}
}
@ -410,10 +410,9 @@ impl Application for App {
Subscription::batch([
window::frames().map(|(_window_id, instant)| Message::Tick(instant)),
event::listen_with(|event, _status| match event {
Event::Keyboard(KeyEvent::KeyPressed {
key_code,
modifiers,
}) => Some(Message::Key(modifiers, key_code)),
Event::Keyboard(KeyEvent::KeyPressed { key, modifiers, .. }) => {
Some(Message::Key(modifiers, key))
}
_ => None,
}),
cosmic_config::config_subscription(