chore(layer shell): add padding action

This commit is contained in:
Ashley Wulber 2026-04-20 15:33:26 -04:00 committed by Ashley Wulber
parent e0c7d353aa
commit f6fa506f6c
3 changed files with 54 additions and 12 deletions

View file

@ -2,7 +2,7 @@
use crate::core::window::Id as SurfaceId;
use iced_runtime::{
self,
self, Action, Task,
platform_specific::{
self,
wayland::{
@ -10,7 +10,7 @@ use iced_runtime::{
layer_surface::{IcedMargin, SctkLayerSurfaceSettings},
},
},
task, Action, Task,
task,
};
pub use cctk::sctk::shell::wlr_layer::{Anchor, KeyboardInteractivity, Layer};
@ -114,3 +114,14 @@ pub fn set_layer<Message>(id: SurfaceId, layer: Layer) -> Task<Message> {
)),
))
}
pub fn set_padding<Message>(
id: SurfaceId,
padding: IcedMargin,
) -> Task<Message> {
task::effect(Action::PlatformSpecific(
platform_specific::Action::Wayland(wayland::Action::LayerSurface(
wayland::layer_surface::Action::Padding { id, padding },
)),
))
}

View file

@ -1229,6 +1229,14 @@ impl SctkState {
}
},
platform_specific::wayland::layer_surface::Action::Padding { id, padding } => {
// corner radius padding
if let Some((protocol_object, _)) = self.corner_radii.get_mut(&id) {
if let CornerRadiusWrapper::Wlr(protocol_object) = protocol_object.0.as_ref() {
protocol_object.set_padding(padding.top, padding.right, padding.bottom, padding.left);
}
}
},
},
Action::Popup(action) => match action {
platform_specific::wayland::popup::Action::Popup { popup: settings } => {