chore: fixes after libcosmic update
This commit is contained in:
parent
cdec335ac7
commit
355423a027
4 changed files with 23 additions and 11 deletions
12
src/app.rs
12
src/app.rs
|
|
@ -7,6 +7,7 @@ use cosmic::iced::clipboard::dnd::DndAction;
|
||||||
use cosmic::iced::core::SmolStr;
|
use cosmic::iced::core::SmolStr;
|
||||||
use cosmic::iced::core::widget::operation::focusable::unfocus;
|
use cosmic::iced::core::widget::operation::focusable::unfocus;
|
||||||
use cosmic::iced::futures::{self, SinkExt};
|
use cosmic::iced::futures::{self, SinkExt};
|
||||||
|
use cosmic::iced::keyboard::key::Physical;
|
||||||
use cosmic::iced::keyboard::{Event as KeyEvent, Key, Modifiers};
|
use cosmic::iced::keyboard::{Event as KeyEvent, Key, Modifiers};
|
||||||
#[cfg(all(feature = "wayland", feature = "desktop-applet"))]
|
#[cfg(all(feature = "wayland", feature = "desktop-applet"))]
|
||||||
use cosmic::iced::platform_specific::shell::wayland::commands::overlap_notify::overlap_notify;
|
use cosmic::iced::platform_specific::shell::wayland::commands::overlap_notify::overlap_notify;
|
||||||
|
|
@ -355,7 +356,7 @@ pub enum Message {
|
||||||
ExtractToResult(DialogResult),
|
ExtractToResult(DialogResult),
|
||||||
#[cfg(all(feature = "wayland", feature = "desktop-applet"))]
|
#[cfg(all(feature = "wayland", feature = "desktop-applet"))]
|
||||||
Focused(window::Id),
|
Focused(window::Id),
|
||||||
Key(window::Id, Modifiers, Key, Option<SmolStr>),
|
Key(window::Id, Modifiers, Key, Physical, Option<SmolStr>),
|
||||||
LaunchUrl(String),
|
LaunchUrl(String),
|
||||||
MaybeExit,
|
MaybeExit,
|
||||||
ModifiersChanged(window::Id, Modifiers),
|
ModifiersChanged(window::Id, Modifiers),
|
||||||
|
|
@ -3351,7 +3352,7 @@ impl Application for App {
|
||||||
return dialog.update(dialog_message);
|
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"))]
|
#[cfg(all(feature = "wayland", feature = "desktop-applet"))]
|
||||||
let in_surface_ids = self.surface_ids.values().any(|id| *id == window_id);
|
let in_surface_ids = self.surface_ids.values().any(|id| *id == window_id);
|
||||||
#[cfg(not(all(feature = "wayland", feature = "desktop-applet")))]
|
#[cfg(not(all(feature = "wayland", feature = "desktop-applet")))]
|
||||||
|
|
@ -3359,7 +3360,7 @@ impl Application for App {
|
||||||
if self.core.main_window_id() == Some(window_id) || in_surface_ids {
|
if self.core.main_window_id() == Some(window_id) || in_surface_ids {
|
||||||
let entity = self.tab_model.active();
|
let entity = self.tab_model.active();
|
||||||
for (key_bind, action) in &self.key_binds {
|
for (key_bind, action) in &self.key_binds {
|
||||||
if key_bind.matches(modifiers, &key) {
|
if key_bind.matches(modifiers, &key, Some(&physical_key)) {
|
||||||
return self.update(action.message(Some(entity)));
|
return self.update(action.message(Some(entity)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -6633,11 +6634,14 @@ impl Application for App {
|
||||||
},
|
},
|
||||||
Event::Keyboard(KeyEvent::KeyPressed {
|
Event::Keyboard(KeyEvent::KeyPressed {
|
||||||
key,
|
key,
|
||||||
|
physical_key,
|
||||||
modifiers,
|
modifiers,
|
||||||
text,
|
text,
|
||||||
..
|
..
|
||||||
}) => match status {
|
}) => 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::Status::Captured => None,
|
||||||
},
|
},
|
||||||
Event::Keyboard(KeyEvent::ModifiersChanged(modifiers)) => {
|
Event::Keyboard(KeyEvent::ModifiersChanged(modifiers)) => {
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ use cosmic::app::{Core, Task, context_drawer};
|
||||||
use cosmic::iced::core::SmolStr;
|
use cosmic::iced::core::SmolStr;
|
||||||
use cosmic::iced::core::widget::operation;
|
use cosmic::iced::core::widget::operation;
|
||||||
use cosmic::iced::futures::{self, SinkExt};
|
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::keyboard::{Event as KeyEvent, Key, Modifiers};
|
||||||
use cosmic::iced::platform_specific::shell::{self as iced_winit, SurfaceIdWrapper};
|
use cosmic::iced::platform_specific::shell::{self as iced_winit, SurfaceIdWrapper};
|
||||||
use cosmic::iced::widget::scrollable;
|
use cosmic::iced::widget::scrollable;
|
||||||
|
|
@ -456,7 +456,7 @@ enum Message {
|
||||||
Escape,
|
Escape,
|
||||||
Filename(String),
|
Filename(String),
|
||||||
Filter(usize),
|
Filter(usize),
|
||||||
Key(Modifiers, Key, Option<SmolStr>),
|
Key(Modifiers, Key, Physical, Option<SmolStr>),
|
||||||
ModifiersChanged(Modifiers),
|
ModifiersChanged(Modifiers),
|
||||||
MounterItems(MounterKey, MounterItems),
|
MounterItems(MounterKey, MounterItems),
|
||||||
Mouse(window::Id, mouse::Button),
|
Mouse(window::Id, mouse::Button),
|
||||||
|
|
@ -1450,16 +1450,16 @@ impl Application for App {
|
||||||
}
|
}
|
||||||
return self.rescan_tab(None);
|
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 {
|
for (key_bind, action) in &self.key_binds {
|
||||||
if key_bind.matches(modifiers, &key) {
|
if key_bind.matches(modifiers, &key, Some(&physical_key)) {
|
||||||
return self.update(Message::from(action.message()));
|
return self.update(Message::from(action.message()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check key binds from accept label
|
// Check key binds from accept label
|
||||||
if let Some(key_bind) = &self.accept_label.key_bind_opt
|
if let Some(key_bind) = &self.accept_label.key_bind_opt
|
||||||
&& key_bind.matches(modifiers, &key)
|
&& key_bind.matches(modifiers, &key, Some(&physical_key))
|
||||||
{
|
{
|
||||||
return self.update(if self.flags.kind.save() {
|
return self.update(if self.flags.kind.save() {
|
||||||
Message::Save(false)
|
Message::Save(false)
|
||||||
|
|
@ -2050,11 +2050,14 @@ impl Application for App {
|
||||||
},
|
},
|
||||||
Event::Keyboard(KeyEvent::KeyPressed {
|
Event::Keyboard(KeyEvent::KeyPressed {
|
||||||
key,
|
key,
|
||||||
|
physical_key,
|
||||||
modifiers,
|
modifiers,
|
||||||
text,
|
text,
|
||||||
..
|
..
|
||||||
}) => match status {
|
}) => 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 => {
|
event::Status::Captured => {
|
||||||
if key == Key::Named(Named::Escape) {
|
if key == Key::Named(Named::Escape) {
|
||||||
Some(Message::Escape)
|
Some(Message::Escape)
|
||||||
|
|
|
||||||
|
|
@ -71,6 +71,7 @@ pub fn context_menu<'a>(
|
||||||
color.alpha *= 0.75;
|
color.alpha *= 0.75;
|
||||||
TextStyle {
|
TextStyle {
|
||||||
color: Some(color.into()),
|
color: Some(color.into()),
|
||||||
|
..Default::default()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn disabled_style(theme: &cosmic::Theme) -> TextStyle {
|
fn disabled_style(theme: &cosmic::Theme) -> TextStyle {
|
||||||
|
|
@ -78,6 +79,7 @@ pub fn context_menu<'a>(
|
||||||
color.alpha *= 0.5;
|
color.alpha *= 0.5;
|
||||||
TextStyle {
|
TextStyle {
|
||||||
color: Some(color.into()),
|
color: Some(color.into()),
|
||||||
|
..Default::default()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7580,7 +7580,10 @@ mod tests {
|
||||||
// Text editor content may add a trailing newline
|
// Text editor content may add a trailing newline
|
||||||
assert_eq!(content.text().trim_end(), "ab");
|
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(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue