Skip to content

Commit 8b46cc2

Browse files
committed
cleanup app-list
1 parent 1391388 commit 8b46cc2

File tree

1 file changed

+23
-35
lines changed

1 file changed

+23
-35
lines changed

cosmic-app-list/src/app.rs

Lines changed: 23 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ use cosmic::iced::wayland::popup::get_popup;
2424
use cosmic::iced::widget::{column, dnd_source, mouse_listener, row, text, Column, Row};
2525
use cosmic::iced::Settings;
2626
use cosmic::iced::{window, Application, Command, Subscription};
27+
use cosmic::iced_native as native;
2728
use cosmic::iced_native::alignment::Horizontal;
2829
use cosmic::iced_native::subscription::events_with;
2930
use cosmic::iced_native::widget::vertical_space;
@@ -51,6 +52,7 @@ use iced::Alignment;
5152
use iced::Background;
5253
use iced::Length;
5354
use itertools::Itertools;
55+
use native::event;
5456
use url::Url;
5557

5658
static MIME_TYPE: &str = "text/uri-list";
@@ -981,52 +983,38 @@ impl Application for CosmicAppList {
981983
Subscription::batch(vec![
982984
toplevel_subscription(self.subscription_ctr).map(|(_, event)| Message::Toplevel(event)),
983985
events_with(|e, _| match e {
984-
cosmic::iced_native::Event::PlatformSpecific(
985-
cosmic::iced_native::event::PlatformSpecific::Wayland(
986-
cosmic::iced_native::event::wayland::Event::Seat(e, seat),
987-
),
988-
) => match e {
989-
cosmic::iced_native::event::wayland::SeatEvent::Enter => {
990-
Some(Message::NewSeat(seat))
991-
}
992-
cosmic::iced_native::event::wayland::SeatEvent::Leave => {
993-
Some(Message::RemovedSeat(seat))
994-
}
986+
native::Event::PlatformSpecific(event::PlatformSpecific::Wayland(
987+
event::wayland::Event::Seat(e, seat),
988+
)) => match e {
989+
event::wayland::SeatEvent::Enter => Some(Message::NewSeat(seat)),
990+
event::wayland::SeatEvent::Leave => Some(Message::RemovedSeat(seat)),
995991
},
996992
// XXX Must be done to catch a finished drag after the source is removed
997993
// (for now, the source is removed when the drag starts)
998-
cosmic::iced_native::Event::PlatformSpecific(
999-
cosmic::iced_native::event::PlatformSpecific::Wayland(
1000-
cosmic::iced_sctk::event::wayland::Event::DataSource(
1001-
cosmic::iced_sctk::event::wayland::DataSourceEvent::DndFinished
1002-
| cosmic::iced_sctk::event::wayland::DataSourceEvent::Cancelled,
1003-
),
1004-
),
1005-
) => Some(Message::DragFinished),
1006-
cosmic::iced_native::Event::PlatformSpecific(
1007-
cosmic::iced_native::event::PlatformSpecific::Wayland(
1008-
cosmic::iced_native::event::wayland::Event::DndOffer(
1009-
cosmic::iced_native::event::wayland::DndOfferEvent::Enter {
1010-
mime_types,
1011-
..
1012-
},
1013-
),
994+
native::Event::PlatformSpecific(event::PlatformSpecific::Wayland(
995+
event::wayland::Event::DataSource(
996+
event::wayland::DataSourceEvent::DndFinished
997+
| event::wayland::DataSourceEvent::Cancelled,
1014998
),
1015-
) => {
999+
)) => Some(Message::DragFinished),
1000+
native::Event::PlatformSpecific(event::PlatformSpecific::Wayland(
1001+
event::wayland::Event::DndOffer(event::wayland::DndOfferEvent::Enter {
1002+
mime_types,
1003+
..
1004+
}),
1005+
)) => {
10161006
if mime_types.iter().any(|m| m == MIME_TYPE) {
10171007
Some(Message::StartListeningForDnd)
10181008
} else {
10191009
None
10201010
}
10211011
}
1022-
cosmic::iced_native::Event::PlatformSpecific(
1023-
cosmic::iced_native::event::PlatformSpecific::Wayland(
1024-
cosmic::iced_native::event::wayland::Event::DndOffer(
1025-
cosmic::iced_native::event::wayland::DndOfferEvent::Leave
1026-
| cosmic::iced_native::event::wayland::DndOfferEvent::DropPerformed,
1027-
),
1012+
native::Event::PlatformSpecific(event::PlatformSpecific::Wayland(
1013+
event::wayland::Event::DndOffer(
1014+
event::wayland::DndOfferEvent::Leave
1015+
| event::wayland::DndOfferEvent::DropPerformed,
10281016
),
1029-
) => Some(Message::StopListeningForDnd),
1017+
)) => Some(Message::StopListeningForDnd),
10301018
_ => None,
10311019
}),
10321020
rectangle_tracker_subscription(0).map(|(_, update)| Message::Rectangle(update)),

0 commit comments

Comments
 (0)