From 2480d5cb0d67684ba95d4e42192c6b8f6d44f90d Mon Sep 17 00:00:00 2001 From: Hojjat Date: Tue, 26 May 2026 10:51:59 -0600 Subject: [PATCH] chore: fixes after libcosmic update --- src/app.rs | 10 +++++++--- src/dialog.rs | 11 +++++++---- src/menu.rs | 2 ++ src/tab.rs | 5 ++++- 4 files changed, 20 insertions(+), 8 deletions(-) diff --git a/src/app.rs b/src/app.rs index 0fc82ae..2b9e6c0 100644 --- a/src/app.rs +++ b/src/app.rs @@ -7,6 +7,7 @@ use cosmic::iced::clipboard::dnd::DndAction; use cosmic::iced::core::SmolStr; use cosmic::iced::core::widget::operation::focusable::unfocus; use cosmic::iced::futures::{self, SinkExt}; +use cosmic::iced::keyboard::key::Physical; use cosmic::iced::keyboard::{Event as KeyEvent, Key, Modifiers}; #[cfg(all(feature = "wayland", feature = "desktop-applet"))] use cosmic::iced::platform_specific::shell::wayland::commands::overlap_notify::overlap_notify; @@ -460,7 +461,7 @@ pub enum Message { ExtractToResult(DialogResult), #[cfg(all(feature = "wayland", feature = "desktop-applet"))] Focused(window::Id), - Key(window::Id, Modifiers, Key, Option), + Key(window::Id, Modifiers, Key, Physical, Option), LaunchUrl(String), MaybeExit, ModifiersChanged(window::Id, Modifiers), @@ -3654,7 +3655,7 @@ impl Application for App { return dialog.update(dialog_message); } } - Message::Key(window_id, modifiers, key, text) => { + Message::Key(window_id, modifiers, key, physical_key, text) => { #[cfg(all(feature = "wayland", feature = "desktop-applet"))] let in_surface_ids = self.surface_ids.values().any(|id| *id == window_id); #[cfg(not(all(feature = "wayland", feature = "desktop-applet")))] @@ -7072,11 +7073,14 @@ impl Application for App { }, Event::Keyboard(KeyEvent::KeyPressed { key, + physical_key, modifiers, text, .. }) => match status { - event::Status::Ignored => Some(Message::Key(window_id, modifiers, key, text)), + event::Status::Ignored => { + Some(Message::Key(window_id, modifiers, key, physical_key, text)) + } event::Status::Captured => None, }, Event::Keyboard(KeyEvent::ModifiersChanged(modifiers)) => { diff --git a/src/dialog.rs b/src/dialog.rs index 69a1e7a..3201b54 100644 --- a/src/dialog.rs +++ b/src/dialog.rs @@ -6,7 +6,7 @@ use cosmic::app::{Core, Task, context_drawer}; use cosmic::iced::core::SmolStr; use cosmic::iced::core::widget::operation; use cosmic::iced::futures::{self, SinkExt}; -use cosmic::iced::keyboard::key::Named; +use cosmic::iced::keyboard::key::{Named, Physical}; use cosmic::iced::keyboard::{Event as KeyEvent, Key, Modifiers}; use cosmic::iced::platform_specific::shell::{self as iced_winit, SurfaceIdWrapper}; use cosmic::iced::widget::scrollable; @@ -456,7 +456,7 @@ enum Message { Escape, Filename(String), Filter(usize), - Key(Modifiers, Key, Option), + Key(Modifiers, Key, Physical, Option), ModifiersChanged(Modifiers), MounterItems(MounterKey, MounterItems), Mouse(window::Id, mouse::Button), @@ -1456,7 +1456,7 @@ impl Application for App { } return self.rescan_tab(None); } - Message::Key(modifiers, key, text) => { + Message::Key(modifiers, key, physical_key, text) => { for (key_bind, action) in &self.key_binds { if key_bind.matches(modifiers, &key, None) { return self.update(Message::from(action.message())); @@ -2056,11 +2056,14 @@ impl Application for App { }, Event::Keyboard(KeyEvent::KeyPressed { key, + physical_key, modifiers, text, .. }) => match status { - event::Status::Ignored => Some(Message::Key(modifiers, key, text)), + event::Status::Ignored => { + Some(Message::Key(modifiers, key, physical_key, text)) + } event::Status::Captured => { if key == Key::Named(Named::Escape) { Some(Message::Escape) diff --git a/src/menu.rs b/src/menu.rs index d167f41..f3a106f 100644 --- a/src/menu.rs +++ b/src/menu.rs @@ -72,6 +72,7 @@ pub fn context_menu<'a>( color.alpha *= 0.75; TextStyle { color: Some(color.into()), + ..Default::default() } } fn disabled_style(theme: &cosmic::Theme) -> TextStyle { @@ -79,6 +80,7 @@ pub fn context_menu<'a>( color.alpha *= 0.5; TextStyle { color: Some(color.into()), + ..Default::default() } } diff --git a/src/tab.rs b/src/tab.rs index d7339f8..378b413 100644 --- a/src/tab.rs +++ b/src/tab.rs @@ -7595,7 +7595,10 @@ mod tests { // Text editor content may add a trailing newline assert_eq!(content.text().trim_end(), "ab"); } - _ => panic!("expected Text thumbnail with valid prefix only, got {:?}", thumb), + _ => panic!( + "expected Text thumbnail with valid prefix only, got {:?}", + thumb + ), } Ok(()) }