From a70feab2bff23d9a6066fa6b4977a028cc5b4b02 Mon Sep 17 00:00:00 2001 From: Hojjat Date: Tue, 19 May 2026 19:36:54 -0600 Subject: [PATCH] feat: integrate text context menu popups into Cosmic framework view system --- src/app/cosmic.rs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/app/cosmic.rs b/src/app/cosmic.rs index d31b6088..cc689223 100644 --- a/src/app/cosmic.rs +++ b/src/app/cosmic.rs @@ -513,7 +513,7 @@ where &mut self, message: crate::Action, ) -> iced::Task> { - let message = match message { + let mut task = match message { crate::Action::App(message) => self.app.update(message), crate::Action::Cosmic(message) => self.cosmic_update(message), crate::Action::None => iced::Task::none(), @@ -533,7 +533,7 @@ where #[cfg(all(target_env = "gnu", not(target_os = "windows")))] crate::malloc::trim(0); - message + task } #[cfg(not(feature = "multi-window"))] @@ -712,9 +712,15 @@ where #[cfg(feature = "multi-window")] pub fn view(&self, id: window::Id) -> Element<'_, crate::Action> { + #[cfg(all(feature = "wayland", target_os = "linux"))] if let Some((_, _, _, Some(v))) = self.surface_views.get(&id) { return v(&self.app); } + #[cfg(feature = "wayland")] + if let Some(element) = crate::widget::text_context_menu::popup_view_for_id::(id) + { + return element; + } if self .app .core() @@ -724,6 +730,8 @@ where return self.app.view_window(id).map(crate::Action::App); } + crate::widget::text_context_menu::set_current_window_id(id); + let view = if self.app.core().window.use_template { self.app.view_main() } else { @@ -738,6 +746,9 @@ where #[cfg(not(feature = "multi-window"))] pub fn view(&self) -> Element> { + if let Some(id) = self.app.core().main_window_id() { + crate::widget::text_context_menu::set_current_window_id(id); + } let view = self.app.view_main(); #[cfg(all(target_env = "gnu", not(target_os = "windows")))]