From 324ef6e9056b540346c0de141fd2c6ffcd2d80dc Mon Sep 17 00:00:00 2001 From: Ashley Wulber Date: Mon, 20 Jul 2026 14:46:35 -0400 Subject: [PATCH] chore: update selectable text menu corner radius --- src/app/cosmic.rs | 4 ++-- src/widget/text_context_menu.rs | 24 +++++++++++++++++++++++- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/src/app/cosmic.rs b/src/app/cosmic.rs index b559ab4a..d1fffa33 100644 --- a/src/app/cosmic.rs +++ b/src/app/cosmic.rs @@ -544,11 +544,11 @@ where // `app.update()` and create them through the normal popup pipeline. #[cfg(all(wayland_platform, target_os = "linux"))] for req in crate::widget::text_context_menu::take_popup_requests() { - let (settings, view) = + let (live_settings, settings, view) = crate::widget::text_context_menu::into_popup_view::(req); task = task.chain(self.get_popup( settings, - Box::new(|_| LiveSettings::default()), + Box::new(move |_| live_settings), Some(Box::new(move |_| view())), )); } diff --git a/src/widget/text_context_menu.rs b/src/widget/text_context_menu.rs index 6fdea222..11df26d7 100644 --- a/src/widget/text_context_menu.rs +++ b/src/widget/text_context_menu.rs @@ -15,8 +15,14 @@ //! the context menu as a native popup surface. pub use iced_core::widget::text::HasSelectableText; +#[cfg(wayland_platform)] +use iced_runtime::platform_specific::wayland::CornerRadius; +#[cfg(wayland_platform)] +use crate::surface::action::LiveSettings; use crate::widget::RcElementWrapper; +#[cfg(wayland_platform)] +use crate::widget::menu::StyleSheet; use crate::widget::menu::{ self, CloseCondition, ItemHeight, ItemWidth, Menu, MenuBarState, PathHighlight, menu_roots_diff, }; @@ -59,6 +65,7 @@ use iced_runtime::platform_specific::wayland::popup::SctkPopupSettings; /// through the normal `get_popup()` Task + `surface_views` pipeline. #[cfg(wayland_platform)] pub(crate) struct PopupRequest { + live_settings: LiveSettings, settings: SctkPopupSettings, menu: Menu<'static, TextCtxAction>, selected_text: Option, @@ -93,6 +100,7 @@ pub(crate) fn take_popup_requests() -> Vec { pub(crate) fn into_popup_view( req: PopupRequest, ) -> ( + LiveSettings, SctkPopupSettings, Box crate::Element<'static, crate::Action> + Send + Sync>, ) { @@ -101,6 +109,7 @@ pub(crate) fn into_popup_view( menu, selected_text, pending_action, + live_settings, } = req; let view = Box::new(move || { @@ -114,7 +123,7 @@ pub(crate) fn into_popup_view( .map(crate::action::app) }); - (settings, view) + (live_settings, settings, view) } #[cfg(wayland_platform)] @@ -589,12 +598,25 @@ pub(crate) fn create_text_context_popup( input_zone: None, }; + let t = crate::theme::THEME.lock().unwrap(); + let styling = t.appearance(&crate::theme::menu_bar::MenuBarStyle::Default, false); + drop(t); + let rad = styling.menu_border_radius; PENDING_POPUP_REQUESTS.with(|q| { q.borrow_mut().push(PopupRequest { settings, menu: popup_menu, selected_text, pending_action: pending_action.clone(), + live_settings: LiveSettings { + corners: Some(CornerRadius { + top_left: rad[0] as u32, + top_right: rad[1] as u32, + bottom_left: rad[2] as u32, + bottom_right: rad[3] as u32, + }), + ..Default::default() + }, }); }); wake_runtime();