fix: tooltip corner radius

This commit is contained in:
Ashley Wulber 2026-05-20 14:49:19 -04:00 committed by Ashley Wulber
parent 4a7ed015f6
commit 76954a6524
2 changed files with 33 additions and 16 deletions

View file

@ -293,7 +293,7 @@ where
return Task::none(); return Task::none();
}; };
let settings = settings(); let settings = settings();
let live_settings = Box::new(move |app: &T| live_settings()); let live_settings = Box::new(move |_: &T| live_settings());
if let Some(view) = view.and_then(|view| { if let Some(view) = view.and_then(|view| {
match std::sync::Arc::try_unwrap(view).ok()?.downcast::<Box< match std::sync::Arc::try_unwrap(view).ok()?.downcast::<Box<
@ -1540,7 +1540,7 @@ impl<App: Application> Cosmic<App> {
) -> Task<crate::Action<App::Message>> { ) -> Task<crate::Action<App::Message>> {
use iced_winit::commands::corner_radius; use iced_winit::commands::corner_radius;
use iced_winit::commands::layer_surface::set_padding; use iced_winit::commands::layer_surface::set_padding;
dbg!(id_wrapper, live_settings);
let id = id_wrapper.inner(); let id = id_wrapper.inner();
let mut cmds = Vec::with_capacity(2); let mut cmds = Vec::with_capacity(2);
@ -1553,12 +1553,14 @@ impl<App: Application> Cosmic<App> {
iced::window::disable_blur iced::window::disable_blur
}; };
cmds.push(blur_cmd(id)); cmds.push(blur_cmd(id));
} else if self.app.core().blur(&*t, Some(id_wrapper)) { } else if self.app.core().blur(&t, Some(id_wrapper)) {
cmds.push(iced::window::enable_blur(id)); cmds.push(iced::window::enable_blur(id));
} }
if let Some(corners) = live_settings.corners { if let Some(corners) = live_settings.corners {
dbg!(corners);
cmds.push(corner_radius::corner_radius(id, Some(corners)).discard()); cmds.push(corner_radius::corner_radius(id, Some(corners)).discard());
} else { } else {
dbg!("app corners");
let rounded = !self.app.core().window.sharp_corners let rounded = !self.app.core().window.sharp_corners
&& self.app.core().sync_window_border_radii_to_theme(); && self.app.core().sync_window_border_radii_to_theme();
if let Some(cur_rad) = if let Some(cur_rad) =

View file

@ -13,27 +13,20 @@ use std::time::Duration;
use iced::Task; use iced::Task;
use iced_runtime::core::widget::Id; use iced_runtime::core::widget::Id;
use iced_core::event::{self, Event}; use iced_core::event::Event;
use iced_core::widget::Operation; use iced_core::widget::Operation;
use iced_core::widget::tree::{self, Tree}; use iced_core::widget::tree::{self, Tree};
use iced_core::{ use iced_core::{
Background, Border, Clipboard, Color, Layout, Length, Padding, Point, Rectangle, Shadow, Shell, Background, Border, Clipboard, Color, Layout, Length, Padding, Point, Rectangle, Shadow, Shell,
Vector, Widget, layout, mouse, overlay, renderer, svg, touch, Vector, Widget, layout, mouse, overlay, renderer, touch,
}; };
use iced_runtime::platform_specific::wayland::CornerRadius;
use crate::surface::action::LiveSettings; use crate::surface::action::LiveSettings;
use crate::theme::THEME;
pub use super::{Catalog, Style}; pub use super::{Catalog, Style};
/// Internally defines different button widget variants.
enum Variant<Message> {
Normal,
Image {
close_icon: svg::Handle,
on_remove: Option<Message>,
},
}
/// A generic button which emits a message when pressed. /// A generic button which emits a message when pressed.
#[allow(missing_debug_implementations)] #[allow(missing_debug_implementations)]
#[must_use] #[must_use]
@ -524,9 +517,20 @@ pub fn update<'a, Message: Clone + 'static, TopLevelMessage: Clone + 'static>(
let boxed: Box<dyn Any + Send + Sync + 'static> = let boxed: Box<dyn Any + Send + Sync + 'static> =
Box::new(boxed); Box::new(boxed);
let theme = THEME.lock().unwrap();
let corners = theme.cosmic().corner_radii.radius_s;
let boxed_live: Box< let boxed_live: Box<
dyn Fn() -> LiveSettings + Send + Sync + 'static, dyn Fn() -> LiveSettings + Send + Sync + 'static,
> = Box::new(move || Default::default()); > = Box::new(move || LiveSettings {
corners: Some(CornerRadius {
top_left: corners[0] as u32,
top_right: corners[1] as u32,
bottom_left: corners[3] as u32,
bottom_right: corners[2] as u32,
}),
..Default::default()
});
let boxed_live: Box<dyn Any + Send + Sync + 'static> = let boxed_live: Box<dyn Any + Send + Sync + 'static> =
Box::new(boxed_live); Box::new(boxed_live);
crate::surface::Action::Popup( crate::surface::Action::Popup(
@ -562,8 +566,19 @@ pub fn update<'a, Message: Clone + 'static, TopLevelMessage: Clone + 'static>(
+ 'static, + 'static,
> = Box::new(move || s(bounds)); > = Box::new(move || s(bounds));
let boxed: Box<dyn Any + Send + Sync + 'static> = Box::new(boxed); let boxed: Box<dyn Any + Send + Sync + 'static> = Box::new(boxed);
let theme = THEME.lock().unwrap();
let corners = theme.cosmic().corner_radii.radius_s;
let boxed_live: Box<dyn Fn() -> LiveSettings + Send + Sync + 'static> = let boxed_live: Box<dyn Fn() -> LiveSettings + Send + Sync + 'static> =
Box::new(move || Default::default()); Box::new(move || LiveSettings {
corners: Some(CornerRadius {
top_left: corners[0] as u32,
top_right: corners[1] as u32,
bottom_left: corners[3] as u32,
bottom_right: corners[2] as u32,
}),
..Default::default()
});
let boxed_live: Box<dyn Any + Send + Sync + 'static> = let boxed_live: Box<dyn Any + Send + Sync + 'static> =
Box::new(boxed_live); Box::new(boxed_live);