feat: padding setting on surface creation
This commit is contained in:
parent
991a8f2c78
commit
4a7ed015f6
2 changed files with 13 additions and 1 deletions
|
|
@ -1539,6 +1539,7 @@ impl<App: Application> Cosmic<App> {
|
|||
live_settings: &LiveSettings,
|
||||
) -> Task<crate::Action<App::Message>> {
|
||||
use iced_winit::commands::corner_radius;
|
||||
use iced_winit::commands::layer_surface::set_padding;
|
||||
|
||||
let id = id_wrapper.inner();
|
||||
|
||||
|
|
@ -1563,9 +1564,14 @@ impl<App: Application> Cosmic<App> {
|
|||
if let Some(cur_rad) =
|
||||
corners(id_wrapper, rounded, &*t, self.app.core().auto_corner_radius)
|
||||
{
|
||||
cmds.push(corner_radius::corner_radius(id, Some(cur_rad)).discard())
|
||||
cmds.push(corner_radius::corner_radius(id, Some(cur_rad)).discard());
|
||||
}
|
||||
}
|
||||
if let (SurfaceIdWrapper::LayerSurface(id), Some(padding)) =
|
||||
(id_wrapper, live_settings.padding)
|
||||
{
|
||||
cmds.push(set_padding(id, padding));
|
||||
}
|
||||
Task::batch(cmds)
|
||||
}
|
||||
|
||||
|
|
@ -1586,6 +1592,7 @@ impl<App: Application> Cosmic<App> {
|
|||
&LiveSettings {
|
||||
blur: Some(self.blur_enabled),
|
||||
corners: None,
|
||||
padding: None,
|
||||
},
|
||||
);
|
||||
self.surface_views.insert(
|
||||
|
|
|
|||
|
|
@ -8,6 +8,8 @@ use crate::Application;
|
|||
use iced::{Rectangle, window};
|
||||
#[cfg(all(feature = "wayland", target_os = "linux", feature = "winit"))]
|
||||
use iced_runtime::platform_specific::wayland::CornerRadius;
|
||||
#[cfg(all(feature = "wayland", target_os = "linux", feature = "winit"))]
|
||||
use iced_runtime::platform_specific::wayland::layer_surface::IcedMargin;
|
||||
use std::any::Any;
|
||||
use std::sync::Arc;
|
||||
|
||||
|
|
@ -38,6 +40,9 @@ pub fn destroy_layer_shell(id: iced_core::window::Id) -> Action {
|
|||
|
||||
#[derive(Debug, Default, Copy, Clone)]
|
||||
pub struct LiveSettings {
|
||||
#[cfg(all(feature = "wayland", target_os = "linux", feature = "winit"))]
|
||||
/// Override the surface padding value for the surface type.
|
||||
pub padding: Option<IcedMargin>,
|
||||
#[cfg(all(feature = "wayland", target_os = "linux", feature = "winit"))]
|
||||
/// Override the default corner radius value for the surface type.
|
||||
pub corners: Option<CornerRadius>,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue