From 86ed2d4e31dc9af82116af0faac64fac2921939c Mon Sep 17 00:00:00 2001 From: Ashley Wulber Date: Tue, 13 Dec 2022 19:58:00 -0500 Subject: [PATCH] feat: activation of apps --- applets/cosmic-app-list/Cargo.lock | 62 +++------ applets/cosmic-app-list/Cargo.toml | 17 +-- applets/cosmic-app-list/src/app.rs | 122 +++++++++++++++--- .../cosmic-app-list/src/toplevel_handler.rs | 62 ++++++++- .../src/toplevel_subscription.rs | 6 +- 5 files changed, 185 insertions(+), 84 deletions(-) diff --git a/applets/cosmic-app-list/Cargo.lock b/applets/cosmic-app-list/Cargo.lock index 0c2c40b7..1c5ad52a 100644 --- a/applets/cosmic-app-list/Cargo.lock +++ b/applets/cosmic-app-list/Cargo.lock @@ -390,7 +390,6 @@ dependencies = [ "futures-util", "i18n-embed", "i18n-embed-fl", - "iced", "itertools", "libcosmic", "log", @@ -407,19 +406,18 @@ dependencies = [ [[package]] name = "cosmic-client-toolkit" version = "0.1.0" -source = "git+https://github.com/pop-os/cosmic-protocols#85afc5b7e3358b15a35b794c7d482b776c1a3ce4" dependencies = [ "cosmic-protocols", "gl_generator", "smithay", - "smithay-client-toolkit 0.16.0 (git+https://github.com/Smithay/client-toolkit?rev=45a2ea5)", + "smithay-client-toolkit", "wayland-client", ] [[package]] name = "cosmic-panel-config" version = "0.1.0" -source = "git+https://github.com/pop-os/cosmic-panel#35d61a3a617b2ef552931645ec35c545a3a688f6" +source = "git+https://github.com/pop-os/cosmic-panel#c20dd262e25adfbc5dd5a8c2e85dc61b1f498387" dependencies = [ "anyhow", "ron", @@ -433,7 +431,6 @@ dependencies = [ [[package]] name = "cosmic-protocols" version = "0.1.0" -source = "git+https://github.com/pop-os/cosmic-protocols#85afc5b7e3358b15a35b794c7d482b776c1a3ce4" dependencies = [ "bitflags", "wayland-backend", @@ -1411,7 +1408,7 @@ dependencies = [ [[package]] name = "iced" version = "0.5.2" -source = "git+https://github.com/pop-os/iced.git?branch=sctk-cosmic#91f51e94ed906deada8462a1cb8a6dfdf43e558c" +source = "git+https://github.com/pop-os/libcosmic/?branch=master#db8b53b83699bf4e10c205873ba281de8d6a5bc3" dependencies = [ "iced_core", "iced_futures", @@ -1427,7 +1424,7 @@ dependencies = [ [[package]] name = "iced_core" version = "0.6.1" -source = "git+https://github.com/pop-os/iced.git?branch=sctk-cosmic#91f51e94ed906deada8462a1cb8a6dfdf43e558c" +source = "git+https://github.com/pop-os/libcosmic/?branch=master#db8b53b83699bf4e10c205873ba281de8d6a5bc3" dependencies = [ "bitflags", "palette", @@ -1437,7 +1434,7 @@ dependencies = [ [[package]] name = "iced_futures" version = "0.5.1" -source = "git+https://github.com/pop-os/iced.git?branch=sctk-cosmic#91f51e94ed906deada8462a1cb8a6dfdf43e558c" +source = "git+https://github.com/pop-os/libcosmic/?branch=master#db8b53b83699bf4e10c205873ba281de8d6a5bc3" dependencies = [ "futures", "log", @@ -1449,7 +1446,7 @@ dependencies = [ [[package]] name = "iced_glow" version = "0.4.1" -source = "git+https://github.com/pop-os/iced.git?branch=sctk-cosmic#91f51e94ed906deada8462a1cb8a6dfdf43e558c" +source = "git+https://github.com/pop-os/libcosmic/?branch=master#db8b53b83699bf4e10c205873ba281de8d6a5bc3" dependencies = [ "bytemuck", "euclid", @@ -1464,7 +1461,7 @@ dependencies = [ [[package]] name = "iced_graphics" version = "0.4.0" -source = "git+https://github.com/pop-os/iced.git?branch=sctk-cosmic#91f51e94ed906deada8462a1cb8a6dfdf43e558c" +source = "git+https://github.com/pop-os/libcosmic/?branch=master#db8b53b83699bf4e10c205873ba281de8d6a5bc3" dependencies = [ "bitflags", "bytemuck", @@ -1484,7 +1481,7 @@ dependencies = [ [[package]] name = "iced_lazy" version = "0.2.0" -source = "git+https://github.com/pop-os/iced.git?branch=sctk-cosmic#91f51e94ed906deada8462a1cb8a6dfdf43e558c" +source = "git+https://github.com/pop-os/libcosmic/?branch=master#db8b53b83699bf4e10c205873ba281de8d6a5bc3" dependencies = [ "iced_native", "ouroboros", @@ -1493,13 +1490,13 @@ dependencies = [ [[package]] name = "iced_native" version = "0.6.1" -source = "git+https://github.com/pop-os/iced.git?branch=sctk-cosmic#91f51e94ed906deada8462a1cb8a6dfdf43e558c" +source = "git+https://github.com/pop-os/libcosmic/?branch=master#db8b53b83699bf4e10c205873ba281de8d6a5bc3" dependencies = [ "iced_core", "iced_futures", "iced_style", "num-traits", - "smithay-client-toolkit 0.16.0 (git+https://github.com/Smithay/client-toolkit)", + "smithay-client-toolkit", "twox-hash", "unicode-segmentation", ] @@ -1507,7 +1504,7 @@ dependencies = [ [[package]] name = "iced_sctk" version = "0.1.0" -source = "git+https://github.com/pop-os/iced-sctk#d126b62ef1001b22dc946db91928395890ff8d9f" +source = "git+https://github.com/pop-os/libcosmic/?branch=master#db8b53b83699bf4e10c205873ba281de8d6a5bc3" dependencies = [ "enum-repr", "futures", @@ -1518,7 +1515,7 @@ dependencies = [ "iced_native", "log", "raw-window-handle", - "smithay-client-toolkit 0.16.0 (git+https://github.com/Smithay/client-toolkit)", + "smithay-client-toolkit", "thiserror", "wayland-backend", ] @@ -1526,7 +1523,7 @@ dependencies = [ [[package]] name = "iced_style" version = "0.5.0" -source = "git+https://github.com/pop-os/iced.git?branch=sctk-cosmic#91f51e94ed906deada8462a1cb8a6dfdf43e558c" +source = "git+https://github.com/pop-os/libcosmic/?branch=master#db8b53b83699bf4e10c205873ba281de8d6a5bc3" dependencies = [ "iced_core", "once_cell", @@ -1536,7 +1533,7 @@ dependencies = [ [[package]] name = "iced_wgpu" version = "0.6.1" -source = "git+https://github.com/pop-os/iced.git?branch=sctk-cosmic#91f51e94ed906deada8462a1cb8a6dfdf43e558c" +source = "git+https://github.com/pop-os/libcosmic/?branch=master#db8b53b83699bf4e10c205873ba281de8d6a5bc3" dependencies = [ "bitflags", "bytemuck", @@ -1715,7 +1712,7 @@ checksum = "db6d7e329c562c5dfab7a46a2afabc8b987ab9a4834c9d1ca04dc54c1546cef8" [[package]] name = "libcosmic" version = "0.1.0" -source = "git+https://github.com/pop-os/libcosmic/?branch=master#91e826d8eacd03d8e7ef5b1a767b2164f8719ed0" +source = "git+https://github.com/pop-os/libcosmic/?branch=master#db8b53b83699bf4e10c205873ba281de8d6a5bc3" dependencies = [ "apply", "cosmic-panel-config", @@ -1724,13 +1721,13 @@ dependencies = [ "freedesktop-icons", "iced", "iced_core", + "iced_glow", "iced_lazy", "iced_native", "iced_style", - "iced_wgpu", "lazy_static", "palette", - "smithay-client-toolkit 0.16.0 (git+https://github.com/Smithay/client-toolkit)", + "smithay-client-toolkit", ] [[package]] @@ -2745,30 +2742,7 @@ dependencies = [ [[package]] name = "smithay-client-toolkit" version = "0.16.0" -source = "git+https://github.com/Smithay/client-toolkit?rev=45a2ea5#45a2ea56ed17883fa6f99df4d87fbc3fc8d8170a" -dependencies = [ - "bitflags", - "calloop", - "dlib", - "lazy_static", - "log", - "memmap2 0.5.8", - "nix 0.24.3", - "pkg-config", - "thiserror", - "wayland-backend", - "wayland-client", - "wayland-cursor", - "wayland-protocols", - "wayland-protocols-wlr", - "wayland-scanner", - "xkbcommon", -] - -[[package]] -name = "smithay-client-toolkit" -version = "0.16.0" -source = "git+https://github.com/Smithay/client-toolkit#f1d9c3ef9cfbd508d986f7f98b2fc267fcc39b84" +source = "git+https://github.com/Smithay/client-toolkit?rev=f1d9c3e#f1d9c3ef9cfbd508d986f7f98b2fc267fcc39b84" dependencies = [ "bitflags", "calloop", diff --git a/applets/cosmic-app-list/Cargo.toml b/applets/cosmic-app-list/Cargo.toml index 0464bafe..312f9e88 100644 --- a/applets/cosmic-app-list/Cargo.toml +++ b/applets/cosmic-app-list/Cargo.toml @@ -5,9 +5,12 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -cctk = {git = "https://github.com/pop-os/cosmic-protocols", package = "cosmic-client-toolkit"} -cosmic-protocols = { git = "https://github.com/pop-os/cosmic-protocols", default-features = false, features = ["client"] } -libcosmic = { git = "https://github.com/pop-os/libcosmic/", branch = "master", default-features = false, features = ["wayland", "applet"] } +cctk = {path = "../../../cosmic-protocols/client-toolkit", package = "cosmic-client-toolkit"} +# cosmic-protocols = { git = "https://github.com/pop-os/cosmic-protocols", default-features = false, features = ["client"] } +cosmic-protocols = { path = "../../../cosmic-protocols", default-features = false, features = ["client"] } + +libcosmic = { git = "https://github.com/pop-os/libcosmic/", branch = "master", default-features = false, features = ["wayland", "applet", "tokio"] } +# libcosmic = { path = "../../../libcosmic", default-features = false, features = ["wayland", "applet"] } ron = "0.8" futures = "0.3" futures-util = "0.3" @@ -27,11 +30,3 @@ freedesktop-icons = {git = "https://github.com/wash2/freedestkop-icons"} i18n-embed = { version = "0.13", features = ["fluent-system", "desktop-requester"] } i18n-embed-fl = "0.6" rust-embed = "6.3" - - -[dependencies.iced] -git = "https://github.com/pop-os/iced.git" -branch = "sctk-cosmic" -# path = "../iced" -default-features = false -features = ["image", "svg", "tokio", "wayland"] \ No newline at end of file diff --git a/applets/cosmic-app-list/src/app.rs b/applets/cosmic-app-list/src/app.rs index 848ac5cd..2a071b2e 100644 --- a/applets/cosmic-app-list/src/app.rs +++ b/applets/cosmic-app-list/src/app.rs @@ -8,12 +8,15 @@ use crate::toplevel_subscription::ToplevelRequest; use crate::toplevel_subscription::ToplevelUpdate; use calloop::channel::Sender; use cctk::toplevel_info::ToplevelInfo; +use cctk::wayland_client::protocol::wl_seat::WlSeat; use cosmic::applet::CosmicAppletHelper; +use cosmic::iced; use cosmic::iced::wayland::popup::destroy_popup; use cosmic::iced::wayland::popup::get_popup; use cosmic::iced::wayland::SurfaceIdWrapper; use cosmic::iced::widget::{column, row}; use cosmic::iced::{executor, window, Application, Command, Subscription}; +use cosmic::iced_native::subscription::events_with; use cosmic::iced_style::application::{self, Appearance}; use cosmic::iced_style::Color; use cosmic::theme::Button; @@ -22,13 +25,13 @@ use cosmic::{Element, Theme}; use cosmic_panel_config::PanelAnchor; use cosmic_protocols::toplevel_info::v1::client::zcosmic_toplevel_handle_v1::ZcosmicToplevelHandleV1; use freedesktop_desktop_entry::DesktopEntry; -use iced::Alignment; -use iced::Background; use iced::wayland::window::resize_window; use iced::widget::container; use iced::widget::horizontal_space; use iced::widget::svg; use iced::widget::Image; +use iced::Alignment; +use iced::Background; use iced::Length; use itertools::Itertools; @@ -54,6 +57,7 @@ struct CosmicAppList { config: AppListConfig, toplevel_sender: Option>, applet_helper: CosmicAppletHelper, + seat: Option, } // TODO DnD after sctk merges DnD @@ -67,6 +71,8 @@ enum Message { Quit(ZcosmicToplevelHandleV1), Errored(String), Ignore, + NewSeat(WlSeat), + RemovedSeat(WlSeat), } fn icon_for_app_ids(mut app_ids: Vec) -> Vec<(String, PathBuf)> { let mut ret = freedesktop_desktop_entry::Iter::new(freedesktop_desktop_entry::default_paths()) @@ -155,8 +161,8 @@ impl Application for CosmicAppList { let _ = self.config.remove_favorite(id); } Message::Activate(handle) => { - if let (Some(tx), Some(handle)) = (self.toplevel_sender.as_ref(), handle) { - let _ = tx.send(ToplevelRequest::Activate(handle)); + if let (Some(tx), Some(seat), Some(handle)) = (self.toplevel_sender.as_ref(), self.seat.as_ref(), handle) { + let _ = tx.send(ToplevelRequest::Activate(handle, seat.clone())); } } Message::Quit(handle) => { @@ -188,7 +194,16 @@ impl Application for CosmicAppList { let padding = 8; let dot_size = 4; let spacing = 4; - let length = self.toplevel_list.iter().map(|t| (pixel_size + 2 * padding).max((dot_size + spacing) * t.toplevels.len() as u16) as u32 + spacing as u32).sum(); + let length = self + .toplevel_list + .iter() + .map(|t| { + (pixel_size + 2 * padding) + .max((dot_size + spacing) * t.toplevels.len() as u16) + as u32 + + spacing as u32 + }) + .sum(); let thickness = (pixel_size + 2 * padding + dot_size + spacing) as u32; let (w, h) = match self.applet_helper.anchor { PanelAnchor::Left | PanelAnchor::Right => (thickness, length), @@ -202,6 +217,9 @@ impl Application for CosmicAppList { } ToplevelUpdate::Finished => { self.subscription_ctr += 1; + for t in &mut self.toplevel_list { + t.toplevels.clear(); + } } ToplevelUpdate::RemoveToplevel(handle) => { if let Some(i) = self.toplevel_list.iter_mut().position( @@ -223,7 +241,16 @@ impl Application for CosmicAppList { let padding = 8; let dot_size = 4; let spacing = 4; - let length = self.toplevel_list.iter().map(|t| (pixel_size + 2 * padding).max((dot_size + spacing) * t.toplevels.len() as u16) as u32 + spacing as u32).sum(); + let length = self + .toplevel_list + .iter() + .map(|t| { + (pixel_size + 2 * padding) + .max((dot_size + spacing) * t.toplevels.len() as u16) + as u32 + + spacing as u32 + }) + .sum(); let thickness = (pixel_size + 2 * padding + dot_size + spacing) as u32; let (w, h) = match self.applet_helper.anchor { PanelAnchor::Left | PanelAnchor::Right => (thickness, length), @@ -245,7 +272,16 @@ impl Application for CosmicAppList { let padding = 8; let dot_size = 4; let spacing = 4; - let length = self.toplevel_list.iter().map(|t| (pixel_size + 2 * padding).max((dot_size + spacing) * t.toplevels.len() as u16) as u32 + spacing as u32).sum(); + let length = self + .toplevel_list + .iter() + .map(|t| { + (pixel_size + 2 * padding) + .max((dot_size + spacing) * t.toplevels.len() as u16) + as u32 + + spacing as u32 + }) + .sum(); let thickness = (pixel_size + 2 * padding + dot_size + spacing) as u32; let (w, h) = match self.applet_helper.anchor { PanelAnchor::Left | PanelAnchor::Right => (thickness, length), @@ -256,6 +292,12 @@ impl Application for CosmicAppList { } } Message::Ignore => {} + Message::NewSeat(s) => { + self.seat.replace(s); + }, + Message::RemovedSeat(_) => { + self.seat.take(); + }, } Command::none() } @@ -287,16 +329,18 @@ impl Application for CosmicAppList { .height(Length::Units(self.applet_helper.suggested_icon_size())) .into() }; - let dot_size = (self.applet_helper.suggested_icon_size() / 8).max(2); + let dot_radius = (self.applet_helper.suggested_icon_size() / 8).max(2); let dots = (0..toplevels.len()) .into_iter() .map(|_| { container(horizontal_space(Length::Units(0))) - .padding(dot_size) + .padding(dot_radius) .style(::Style::Custom( |theme| container::Appearance { text_color: Some(Color::TRANSPARENT), - background: Some(Background::Color(theme.cosmic().on_bg_color().into())), + background: Some(Background::Color( + theme.cosmic().on_bg_color().into(), + )), border_radius: 4.0, border_width: 0.0, border_color: Color::TRANSPARENT, @@ -307,16 +351,29 @@ impl Application for CosmicAppList { .collect_vec(); let icon_wrapper = match &self.applet_helper.anchor { - PanelAnchor::Left => row(vec![column(dots).spacing(2).into(), icon]).align_items(iced::Alignment::Center).spacing(2).into(), - PanelAnchor::Right => row(vec![icon, column(dots).spacing(2).into()]).align_items(iced::Alignment::Center).spacing(2).into(), - PanelAnchor::Top => column(vec![row(dots).spacing(2).into(), icon]).align_items(iced::Alignment::Center).spacing(2).into(), - PanelAnchor::Bottom => column(vec![icon, row(dots).spacing(2).into()]).align_items(iced::Alignment::Center).spacing(2).into(), + PanelAnchor::Left => row(vec![column(dots).spacing(4).into(), icon]) + .align_items(iced::Alignment::Center) + .spacing(4) + .into(), + PanelAnchor::Right => row(vec![icon, column(dots).spacing(4).into()]) + .align_items(iced::Alignment::Center) + .spacing(4) + .into(), + PanelAnchor::Top => column(vec![row(dots).spacing(4).into(), icon]) + .align_items(iced::Alignment::Center) + .spacing(4) + .into(), + PanelAnchor::Bottom => column(vec![icon, row(dots).spacing(4).into()]) + .align_items(iced::Alignment::Center) + .spacing(4) + .into(), }; // TODO tooltip on hover let icon_button = cosmic::widget::button(Button::Text) - .custom(vec![icon_wrapper]) - .on_press(Message::Activate(toplevels.first().map(|t| t.0.clone()))) - .padding(8).into(); + .custom(vec![icon_wrapper]) + .on_press(Message::Activate(toplevels.first().map(|t| t.0.clone()))) + .padding(8) + .into(); if self.config.favorites.contains(&app_id) { favorites.push(icon_button) } else { @@ -327,10 +384,20 @@ impl Application for CosmicAppList { ); match &self.applet_helper.anchor { PanelAnchor::Left | PanelAnchor::Right => { - column![column(favorites), horizontal_rule(1), column(running)].spacing(4).align_items(Alignment::Center).height(Length::Fill).width(Length::Fill).into() + column![column(favorites), horizontal_rule(1), column(running)] + .spacing(4) + .align_items(Alignment::Center) + .height(Length::Fill) + .width(Length::Fill) + .into() } PanelAnchor::Top | PanelAnchor::Bottom => { - row![row(favorites), vertical_rule(1), row(running)].spacing(4).align_items(Alignment::Center).height(Length::Fill).width(Length::Fill).into() + row![row(favorites), vertical_rule(1), row(running)] + .spacing(4) + .align_items(Alignment::Center) + .height(Length::Fill) + .width(Length::Fill) + .into() } } } @@ -342,7 +409,22 @@ impl Application for CosmicAppList { fn subscription(&self) -> Subscription { 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, status| match e { + cosmic::iced_native::Event::PlatformSpecific( + cosmic::iced_native::event::PlatformSpecific::Wayland( + cosmic::iced_native::event::wayland::Event::Seat(e, seat), + ), + ) => match e { + cosmic::iced_native::event::wayland::SeatEvent::Enter => { + Some(Message::NewSeat(seat)) + }, + cosmic::iced_native::event::wayland::SeatEvent::Leave => { + Some(Message::RemovedSeat(seat)) + }, + }, + _ => None + }), ]) } diff --git a/applets/cosmic-app-list/src/toplevel_handler.rs b/applets/cosmic-app-list/src/toplevel_handler.rs index 373f295d..a6137785 100644 --- a/applets/cosmic-app-list/src/toplevel_handler.rs +++ b/applets/cosmic-app-list/src/toplevel_handler.rs @@ -1,13 +1,17 @@ use cctk::{ - sctk::{self, event_loop::WaylandSource}, + sctk::{self, event_loop::WaylandSource, seat::{SeatHandler, SeatState}, reexports::client::protocol::wl_seat::WlSeat}, toplevel_info::{ToplevelInfoHandler, ToplevelInfoState}, - wayland_client, + toplevel_management::{ToplevelManagerHandler, ToplevelManagerState}, + wayland_client::{self, Proxy, backend::ObjectId}, +}; +use cosmic_protocols::{ + toplevel_info::v1::client::zcosmic_toplevel_handle_v1, + toplevel_management::v1::client::zcosmic_toplevel_manager_v1, }; -use cosmic_protocols::toplevel_info::v1::client::zcosmic_toplevel_handle_v1; use futures::channel::mpsc::UnboundedSender; use sctk::registry::{ProvidesRegistryState, RegistryState}; use wayland_client::{globals::registry_queue_init, Connection, QueueHandle}; - +use itertools::Itertools; use crate::toplevel_subscription::{ToplevelRequest, ToplevelUpdate}; struct AppData { @@ -15,6 +19,8 @@ struct AppData { tx: UnboundedSender, registry_state: RegistryState, toplevel_info_state: ToplevelInfoState, + toplevel_manager_state: ToplevelManagerState, + seat_state: SeatState, } impl ProvidesRegistryState for AppData { @@ -25,6 +31,42 @@ impl ProvidesRegistryState for AppData { sctk::registry_handlers!(); } +impl SeatHandler for AppData { + fn seat_state(&mut self) -> &mut sctk::seat::SeatState { + &mut self.seat_state + } + + fn new_seat(&mut self, conn: &Connection, qh: &QueueHandle, seat: WlSeat) {} + + fn new_capability( + &mut self, + conn: &Connection, + qh: &QueueHandle, + seat: WlSeat, + capability: sctk::seat::Capability, + ) {} + + fn remove_capability( + &mut self, + conn: &Connection, + qh: &QueueHandle, + seat: WlSeat, + capability: sctk::seat::Capability, + ) {} + + fn remove_seat(&mut self, conn: &Connection, qh: &QueueHandle, seat: WlSeat) {} +} + +impl ToplevelManagerHandler for AppData { + fn toplevel_manager_state(&mut self) -> &mut cctk::toplevel_management::ToplevelManagerState { + &mut self.toplevel_manager_state + } + + fn capabilities(&mut self, conn: &Connection, qh: &QueueHandle, capabilities: Vec) { + // TODO capabilities could affect the options in the applet + } +} + impl ToplevelInfoHandler for AppData { fn toplevel_info_state(&mut self) -> &mut ToplevelInfoState { &mut self.toplevel_info_state @@ -90,8 +132,12 @@ pub(crate) fn toplevel_handler( if handle .insert_source(rx, |event, _, state| match event { calloop::channel::Event::Msg(req) => match req { - ToplevelRequest::Activate(_) => {} // TODO - ToplevelRequest::Quit(_) => {} // TODO + ToplevelRequest::Activate(handle, seat) => { + + let manager = &state.toplevel_manager_state.manager; + manager.activate(&handle, &seat); + } // TODO + ToplevelRequest::Quit(_) => {} // TODO ToplevelRequest::Exit => { state.exit = true; } @@ -108,7 +154,9 @@ pub(crate) fn toplevel_handler( let mut app_data = AppData { exit: false, tx, + seat_state: SeatState::new(&globals, &qh), toplevel_info_state: ToplevelInfoState::new(®istry_state, &qh), + toplevel_manager_state: ToplevelManagerState::new(®istry_state, &qh), registry_state, }; @@ -120,5 +168,7 @@ pub(crate) fn toplevel_handler( } } +sctk::delegate_seat!(AppData); sctk::delegate_registry!(AppData); cctk::delegate_toplevel_info!(AppData); +cctk::delegate_toplevel_manager!(AppData); diff --git a/applets/cosmic-app-list/src/toplevel_subscription.rs b/applets/cosmic-app-list/src/toplevel_subscription.rs index 4d37ef43..14317b2b 100644 --- a/applets/cosmic-app-list/src/toplevel_subscription.rs +++ b/applets/cosmic-app-list/src/toplevel_subscription.rs @@ -2,15 +2,15 @@ //! //! This code was generated by `zbus-xmlgen` `2.0.1` from DBus introspection data. //! Source: `Interface '/org/freedesktop/UPower/KbdBacklight' from service 'org.freedesktop.UPower' on system bus`. - +use cctk::sctk::reexports::client::protocol::wl_seat::WlSeat; use cctk::toplevel_info::ToplevelInfo; use cosmic::iced; +use cosmic::iced::subscription; use cosmic_protocols::toplevel_info::v1::client::zcosmic_toplevel_handle_v1::ZcosmicToplevelHandleV1; use futures::{ channel::mpsc::{unbounded, UnboundedReceiver}, StreamExt, }; -use iced::subscription; use std::{fmt::Debug, hash::Hash}; use crate::toplevel_handler::toplevel_handler; @@ -65,7 +65,7 @@ pub enum ToplevelUpdate { #[derive(Debug, Clone)] pub enum ToplevelRequest { - Activate(ZcosmicToplevelHandleV1), + Activate(ZcosmicToplevelHandleV1, WlSeat), Quit(ZcosmicToplevelHandleV1), Exit, }