fix: popup corner improvements

This commit is contained in:
Ashley Wulber 2026-06-15 14:04:52 -04:00
parent e00725a450
commit 8fc5182486
3 changed files with 37 additions and 6 deletions

View file

@ -4496,9 +4496,10 @@ impl Application for App {
use cctk::wayland_protocols::xdg::shell::client::xdg_positioner::{ use cctk::wayland_protocols::xdg::shell::client::xdg_positioner::{
Anchor, Gravity, Anchor, Gravity,
}; };
use cosmic::iced::runtime::platform_specific::wayland::popup::{ use cosmic::{iced::runtime::platform_specific::wayland::popup::{
SctkPopupSettings, SctkPositioner, SctkPopupSettings, SctkPositioner,
}; }, widget::menu::StyleSheet as _};
let window_id = WindowId::unique(); let window_id = WindowId::unique();
self.windows.insert( self.windows.insert(
window_id, window_id,
@ -4508,10 +4509,24 @@ impl Application for App {
)), )),
); );
commands.push(self.update(Message::CheckClipboard)); commands.push(self.update(Message::CheckClipboard));
let t = self.core.system_theme();
let styling = t.appearance(
&cosmic::theme::menu_bar::MenuBarStyle::Default,
false,
);
let rad = styling.menu_border_radius;
commands.push(self.update(Message::Surface( commands.push(self.update(Message::Surface(
cosmic::surface::action::app_popup( cosmic::surface::action::app_popup(
|_| Default::default(), move |_| cosmic::surface::action::LiveSettings {
move |app: &mut Self| -> SctkPopupSettings { corners: Some(iced::runtime::platform_specific::wayland::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()
}, move |app: &mut Self| -> SctkPopupSettings {
let anchor_rect = Rectangle { let anchor_rect = Rectangle {
x: point.x as i32, x: point.x as i32,
y: point.y as i32, y: point.y as i32,

View file

@ -1790,12 +1790,28 @@ impl Application for App {
SctkPopupSettings, SctkPositioner, SctkPopupSettings, SctkPositioner,
}; };
use cosmic::iced::Rectangle; use cosmic::iced::Rectangle;
use cosmic::widget::menu::StyleSheet as _;
let window_id = window::Id::unique(); let window_id = window::Id::unique();
self.context_menu_window = Some(window_id); self.context_menu_window = Some(window_id);
let autosize_id = widget::Id::unique(); let autosize_id = widget::Id::unique();
let t = self.core.system_theme();
let styling = t.appearance(
&cosmic::theme::menu_bar::MenuBarStyle::Default,
false,
);
let rad = styling.menu_border_radius;
commands.push(self.update(Message::Surface( commands.push(self.update(Message::Surface(
cosmic::surface::action::app_popup( cosmic::surface::action::app_popup(
|_| Default::default(), move |_| cosmic::surface::action::LiveSettings {
corners: Some(iced::runtime::platform_specific::wayland::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()
},
move |app: &mut Self| -> SctkPopupSettings { move |app: &mut Self| -> SctkPopupSettings {
let anchor_rect = Rectangle { let anchor_rect = Rectangle {
x: point.x as i32, x: point.x as i32,

View file

@ -441,7 +441,7 @@ pub fn context_menu<'a>(
//TODO: move style to libcosmic //TODO: move style to libcosmic
.style(|theme| { .style(|theme| {
let cosmic = theme.cosmic(); let cosmic = theme.cosmic();
let component = &cosmic.background(theme.transparent).component; let component = &cosmic.background(theme.transparent);
container::Style { container::Style {
icon_color: Some(component.on.into()), icon_color: Some(component.on.into()),
text_color: Some(component.on.into()), text_color: Some(component.on.into()),