Update libcosmic and iced

This commit is contained in:
Jeremy Soller 2024-10-22 08:21:51 -06:00
parent f851dab984
commit f5a205159a
No known key found for this signature in database
GPG key ID: D02FD439211AF56F
3 changed files with 46 additions and 65 deletions

View file

@ -3925,36 +3925,25 @@ impl Application for App {
struct TrashWatcherSubscription;
let mut subscriptions = vec![
event::listen_with(|event, status, window_id| {
//TODO: why are we getting keyboard events for this window Id?
if window_id == window::Id::NONE {
return match event {
#[cfg(feature = "wayland")]
Event::PlatformSpecific(event::PlatformSpecific::Wayland(
wayland_event,
)) => {
println!("{:?}", wayland_event);
match wayland_event {
WaylandEvent::Output(output_event, output) => {
Some(Message::OutputEvent(output_event, output))
}
_ => None,
}
event::listen_with(|event, status, _window_id| match event {
Event::Keyboard(KeyEvent::KeyPressed { key, modifiers, .. }) => match status {
event::Status::Ignored => Some(Message::Key(modifiers, key)),
event::Status::Captured => None,
},
Event::Keyboard(KeyEvent::ModifiersChanged(modifiers)) => {
Some(Message::Modifiers(modifiers))
}
Event::Window(WindowEvent::CloseRequested) => Some(Message::WindowClose),
#[cfg(feature = "wayland")]
Event::PlatformSpecific(event::PlatformSpecific::Wayland(wayland_event)) => {
match wayland_event {
WaylandEvent::Output(output_event, output) => {
Some(Message::OutputEvent(output_event, output))
}
_ => None,
};
}
match event {
Event::Keyboard(KeyEvent::KeyPressed { key, modifiers, .. }) => match status {
event::Status::Ignored => Some(Message::Key(modifiers, key)),
event::Status::Captured => None,
},
Event::Keyboard(KeyEvent::ModifiersChanged(modifiers)) => {
Some(Message::Modifiers(modifiers))
}
Event::Window(WindowEvent::CloseRequested) => Some(Message::WindowClose),
_ => None,
}
_ => None,
}),
Config::subscription().map(|update| {
if !update.errors.is_empty() {

View file

@ -173,7 +173,7 @@ impl<M: Send + 'static> Dialog<M> {
let (window_id, window_command) = window::open(settings.clone());
let mut core = Core::default();
core.set_main_window_id(window_id);
core.set_main_window_id(Some(window_id));
let flags = Flags {
kind,
path_opt: path_opt
@ -190,9 +190,7 @@ impl<M: Send + 'static> Dialog<M> {
config,
};
// settings here is unused
let (mut cosmic, cosmic_command) = Cosmic::<App>::init((core, flags, settings));
let (cosmic, cosmic_command) = Cosmic::<App>::init((core, flags));
(
Self {
cosmic,
@ -1586,21 +1584,15 @@ impl Application for App {
fn subscription(&self) -> Subscription<Message> {
struct WatcherSubscription;
let mut subscriptions = vec![
event::listen_with(|event, status, window_id| {
//TODO: why are we getting events for this window Id?
if window_id == window::Id::NONE {
return None;
}
match event {
Event::Keyboard(KeyEvent::KeyPressed { key, modifiers, .. }) => match status {
event::Status::Ignored => Some(Message::Key(modifiers, key)),
event::Status::Captured => None,
},
Event::Keyboard(KeyEvent::ModifiersChanged(modifiers)) => {
Some(Message::Modifiers(modifiers))
}
_ => None,
event::listen_with(|event, status, _window_id| match event {
Event::Keyboard(KeyEvent::KeyPressed { key, modifiers, .. }) => match status {
event::Status::Ignored => Some(Message::Key(modifiers, key)),
event::Status::Captured => None,
},
Event::Keyboard(KeyEvent::ModifiersChanged(modifiers)) => {
Some(Message::Modifiers(modifiers))
}
_ => None,
}),
Config::subscription().map(|update| {
if !update.errors.is_empty() {