cleanup app-list
This commit is contained in:
parent
1391388ec0
commit
8b46cc209f
1 changed files with 23 additions and 35 deletions
|
|
@ -24,6 +24,7 @@ use cosmic::iced::wayland::popup::get_popup;
|
||||||
use cosmic::iced::widget::{column, dnd_source, mouse_listener, row, text, Column, Row};
|
use cosmic::iced::widget::{column, dnd_source, mouse_listener, row, text, Column, Row};
|
||||||
use cosmic::iced::Settings;
|
use cosmic::iced::Settings;
|
||||||
use cosmic::iced::{window, Application, Command, Subscription};
|
use cosmic::iced::{window, Application, Command, Subscription};
|
||||||
|
use cosmic::iced_native as native;
|
||||||
use cosmic::iced_native::alignment::Horizontal;
|
use cosmic::iced_native::alignment::Horizontal;
|
||||||
use cosmic::iced_native::subscription::events_with;
|
use cosmic::iced_native::subscription::events_with;
|
||||||
use cosmic::iced_native::widget::vertical_space;
|
use cosmic::iced_native::widget::vertical_space;
|
||||||
|
|
@ -51,6 +52,7 @@ use iced::Alignment;
|
||||||
use iced::Background;
|
use iced::Background;
|
||||||
use iced::Length;
|
use iced::Length;
|
||||||
use itertools::Itertools;
|
use itertools::Itertools;
|
||||||
|
use native::event;
|
||||||
use url::Url;
|
use url::Url;
|
||||||
|
|
||||||
static MIME_TYPE: &str = "text/uri-list";
|
static MIME_TYPE: &str = "text/uri-list";
|
||||||
|
|
@ -981,52 +983,38 @@ impl Application for CosmicAppList {
|
||||||
Subscription::batch(vec![
|
Subscription::batch(vec![
|
||||||
toplevel_subscription(self.subscription_ctr).map(|(_, event)| Message::Toplevel(event)),
|
toplevel_subscription(self.subscription_ctr).map(|(_, event)| Message::Toplevel(event)),
|
||||||
events_with(|e, _| match e {
|
events_with(|e, _| match e {
|
||||||
cosmic::iced_native::Event::PlatformSpecific(
|
native::Event::PlatformSpecific(event::PlatformSpecific::Wayland(
|
||||||
cosmic::iced_native::event::PlatformSpecific::Wayland(
|
event::wayland::Event::Seat(e, seat),
|
||||||
cosmic::iced_native::event::wayland::Event::Seat(e, seat),
|
)) => match e {
|
||||||
),
|
event::wayland::SeatEvent::Enter => Some(Message::NewSeat(seat)),
|
||||||
) => match e {
|
event::wayland::SeatEvent::Leave => Some(Message::RemovedSeat(seat)),
|
||||||
cosmic::iced_native::event::wayland::SeatEvent::Enter => {
|
|
||||||
Some(Message::NewSeat(seat))
|
|
||||||
}
|
|
||||||
cosmic::iced_native::event::wayland::SeatEvent::Leave => {
|
|
||||||
Some(Message::RemovedSeat(seat))
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
// XXX Must be done to catch a finished drag after the source is removed
|
// XXX Must be done to catch a finished drag after the source is removed
|
||||||
// (for now, the source is removed when the drag starts)
|
// (for now, the source is removed when the drag starts)
|
||||||
cosmic::iced_native::Event::PlatformSpecific(
|
native::Event::PlatformSpecific(event::PlatformSpecific::Wayland(
|
||||||
cosmic::iced_native::event::PlatformSpecific::Wayland(
|
event::wayland::Event::DataSource(
|
||||||
cosmic::iced_sctk::event::wayland::Event::DataSource(
|
event::wayland::DataSourceEvent::DndFinished
|
||||||
cosmic::iced_sctk::event::wayland::DataSourceEvent::DndFinished
|
| event::wayland::DataSourceEvent::Cancelled,
|
||||||
| cosmic::iced_sctk::event::wayland::DataSourceEvent::Cancelled,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
) => Some(Message::DragFinished),
|
)) => Some(Message::DragFinished),
|
||||||
cosmic::iced_native::Event::PlatformSpecific(
|
native::Event::PlatformSpecific(event::PlatformSpecific::Wayland(
|
||||||
cosmic::iced_native::event::PlatformSpecific::Wayland(
|
event::wayland::Event::DndOffer(event::wayland::DndOfferEvent::Enter {
|
||||||
cosmic::iced_native::event::wayland::Event::DndOffer(
|
mime_types,
|
||||||
cosmic::iced_native::event::wayland::DndOfferEvent::Enter {
|
..
|
||||||
mime_types,
|
}),
|
||||||
..
|
)) => {
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
|
||||||
) => {
|
|
||||||
if mime_types.iter().any(|m| m == MIME_TYPE) {
|
if mime_types.iter().any(|m| m == MIME_TYPE) {
|
||||||
Some(Message::StartListeningForDnd)
|
Some(Message::StartListeningForDnd)
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cosmic::iced_native::Event::PlatformSpecific(
|
native::Event::PlatformSpecific(event::PlatformSpecific::Wayland(
|
||||||
cosmic::iced_native::event::PlatformSpecific::Wayland(
|
event::wayland::Event::DndOffer(
|
||||||
cosmic::iced_native::event::wayland::Event::DndOffer(
|
event::wayland::DndOfferEvent::Leave
|
||||||
cosmic::iced_native::event::wayland::DndOfferEvent::Leave
|
| event::wayland::DndOfferEvent::DropPerformed,
|
||||||
| cosmic::iced_native::event::wayland::DndOfferEvent::DropPerformed,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
) => Some(Message::StopListeningForDnd),
|
)) => Some(Message::StopListeningForDnd),
|
||||||
_ => None,
|
_ => None,
|
||||||
}),
|
}),
|
||||||
rectangle_tracker_subscription(0).map(|(_, update)| Message::Rectangle(update)),
|
rectangle_tracker_subscription(0).map(|(_, update)| Message::Rectangle(update)),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue