feat(applets): add destroy tooltip popup action
This commit adds a new surface action to explicitly destroy the tooltip popup on `TOOLTIP_WINDOW_ID`, allowing proper cleanup when minimizing applets.
This commit is contained in:
parent
24464908f6
commit
8dccedbe14
3 changed files with 15 additions and 1 deletions
|
|
@ -230,6 +230,17 @@ where
|
||||||
iced_winit::commands::popup::destroy_popup(id)
|
iced_winit::commands::popup::destroy_popup(id)
|
||||||
}
|
}
|
||||||
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
||||||
|
crate::surface::Action::DestroyTooltipPopup => {
|
||||||
|
#[cfg(feature = "applet")]
|
||||||
|
{
|
||||||
|
iced_winit::commands::popup::destroy_popup(*crate::applet::TOOLTIP_WINDOW_ID)
|
||||||
|
}
|
||||||
|
#[cfg(not(feature = "applet"))]
|
||||||
|
{
|
||||||
|
Task::none()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#[cfg(all(feature = "wayland", target_os = "linux"))]
|
||||||
crate::surface::Action::DestroySubsurface(id) => {
|
crate::surface::Action::DestroySubsurface(id) => {
|
||||||
iced_winit::commands::subsurface::destroy_subsurface(id)
|
iced_winit::commands::subsurface::destroy_subsurface(id)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@ static AUTOSIZE_ID: LazyLock<iced::id::Id> =
|
||||||
static AUTOSIZE_MAIN_ID: LazyLock<iced::id::Id> =
|
static AUTOSIZE_MAIN_ID: LazyLock<iced::id::Id> =
|
||||||
LazyLock::new(|| iced::id::Id::new("cosmic-applet-autosize-main"));
|
LazyLock::new(|| iced::id::Id::new("cosmic-applet-autosize-main"));
|
||||||
static TOOLTIP_ID: LazyLock<crate::widget::Id> = LazyLock::new(|| iced::id::Id::new("subsurface"));
|
static TOOLTIP_ID: LazyLock<crate::widget::Id> = LazyLock::new(|| iced::id::Id::new("subsurface"));
|
||||||
static TOOLTIP_WINDOW_ID: LazyLock<window::Id> = LazyLock::new(window::Id::unique);
|
pub(crate) static TOOLTIP_WINDOW_ID: LazyLock<window::Id> = LazyLock::new(window::Id::unique);
|
||||||
|
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct Context {
|
pub struct Context {
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,8 @@ pub enum Action {
|
||||||
),
|
),
|
||||||
/// Destroy a subsurface with a view function
|
/// Destroy a subsurface with a view function
|
||||||
DestroyPopup(iced::window::Id),
|
DestroyPopup(iced::window::Id),
|
||||||
|
/// Destroys the global tooltip popup subsurface
|
||||||
|
DestroyTooltipPopup,
|
||||||
|
|
||||||
/// Create a window with a view function accepting the App as a parameter
|
/// Create a window with a view function accepting the App as a parameter
|
||||||
AppWindow(
|
AppWindow(
|
||||||
|
|
@ -85,6 +87,7 @@ impl std::fmt::Debug for Action {
|
||||||
}
|
}
|
||||||
Self::Popup(arg0, arg1) => f.debug_tuple("Popup").field(arg0).field(arg1).finish(),
|
Self::Popup(arg0, arg1) => f.debug_tuple("Popup").field(arg0).field(arg1).finish(),
|
||||||
Self::DestroyPopup(arg0) => f.debug_tuple("DestroyPopup").field(arg0).finish(),
|
Self::DestroyPopup(arg0) => f.debug_tuple("DestroyPopup").field(arg0).finish(),
|
||||||
|
Self::DestroyTooltipPopup => f.debug_tuple("DestroyTooltipPopup").finish(),
|
||||||
Self::ResponsiveMenuBar {
|
Self::ResponsiveMenuBar {
|
||||||
menu_bar,
|
menu_bar,
|
||||||
limits,
|
limits,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue