chore(layer shell): add padding action
This commit is contained in:
parent
e0c7d353aa
commit
f6fa506f6c
3 changed files with 54 additions and 12 deletions
|
|
@ -6,8 +6,8 @@ use cctk::sctk::{
|
||||||
};
|
};
|
||||||
use iced_core::layout::Limits;
|
use iced_core::layout::Limits;
|
||||||
|
|
||||||
use iced_core::window::Id;
|
|
||||||
use iced_core::Rectangle;
|
use iced_core::Rectangle;
|
||||||
|
use iced_core::window::Id;
|
||||||
|
|
||||||
/// output for layer surface
|
/// output for layer surface
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
|
|
@ -150,6 +150,13 @@ pub enum Action {
|
||||||
/// layer of the layer surface
|
/// layer of the layer surface
|
||||||
layer: Layer,
|
layer: Layer,
|
||||||
},
|
},
|
||||||
|
/// padding of the surface geometry
|
||||||
|
Padding {
|
||||||
|
/// id of the layer surface
|
||||||
|
id: Id,
|
||||||
|
/// padding of the surface geometry
|
||||||
|
padding: IcedMargin,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
impl fmt::Debug for Action {
|
impl fmt::Debug for Action {
|
||||||
|
|
@ -162,35 +169,51 @@ impl fmt::Debug for Action {
|
||||||
),
|
),
|
||||||
Action::Size { id, width, height } => write!(
|
Action::Size { id, width, height } => write!(
|
||||||
f,
|
f,
|
||||||
"Action::LayerSurfaceAction::Size {{ id: {:#?}, width: {:?}, height: {:?} }}", id, width, height
|
"Action::LayerSurfaceAction::Size {{ id: {:#?}, width: {:?}, height: {:?} }}",
|
||||||
|
id, width, height
|
||||||
),
|
),
|
||||||
Action::Destroy(id) => write!(
|
Action::Destroy(id) => write!(
|
||||||
f,
|
f,
|
||||||
"Action::LayerSurfaceAction::Destroy {{ id: {:#?} }}", id
|
"Action::LayerSurfaceAction::Destroy {{ id: {:#?} }}",
|
||||||
|
id
|
||||||
),
|
),
|
||||||
Action::Anchor { id, anchor } => write!(
|
Action::Anchor { id, anchor } => write!(
|
||||||
f,
|
f,
|
||||||
"Action::LayerSurfaceAction::Anchor {{ id: {:#?}, anchor: {:?} }}", id, anchor
|
"Action::LayerSurfaceAction::Anchor {{ id: {:#?}, anchor: {:?} }}",
|
||||||
|
id, anchor
|
||||||
),
|
),
|
||||||
Action::ExclusiveZone { id, exclusive_zone } => write!(
|
Action::ExclusiveZone { id, exclusive_zone } => write!(
|
||||||
f,
|
f,
|
||||||
"Action::LayerSurfaceAction::ExclusiveZone {{ id: {:#?}, exclusive_zone: {exclusive_zone} }}", id
|
"Action::LayerSurfaceAction::ExclusiveZone {{ id: {:#?}, exclusive_zone: {exclusive_zone} }}",
|
||||||
|
id
|
||||||
),
|
),
|
||||||
Action::Margin { id, margin } => write!(
|
Action::Margin { id, margin } => write!(
|
||||||
f,
|
f,
|
||||||
"Action::LayerSurfaceAction::Margin {{ id: {:#?}, margin: {:?} }}", id, margin
|
"Action::LayerSurfaceAction::Margin {{ id: {:#?}, margin: {:?} }}",
|
||||||
|
id, margin
|
||||||
),
|
),
|
||||||
Action::KeyboardInteractivity { id, keyboard_interactivity } => write!(
|
Action::KeyboardInteractivity {
|
||||||
|
id,
|
||||||
|
keyboard_interactivity,
|
||||||
|
} => write!(
|
||||||
f,
|
f,
|
||||||
"Action::LayerSurfaceAction::KeyboardInteractivity {{ id: {:#?}, keyboard_interactivity: {:?} }}", id, keyboard_interactivity
|
"Action::LayerSurfaceAction::KeyboardInteractivity {{ id: {:#?}, keyboard_interactivity: {:?} }}",
|
||||||
|
id, keyboard_interactivity
|
||||||
),
|
),
|
||||||
Action::InputZone { id, zone } => write!(
|
Action::InputZone { id, zone } => write!(
|
||||||
f,
|
f,
|
||||||
"Action::LayerSurfaceAction::InputZone {{ id: {:#?}, zone: {:?} }}", id, zone
|
"Action::LayerSurfaceAction::InputZone {{ id: {:#?}, zone: {:?} }}",
|
||||||
|
id, zone
|
||||||
),
|
),
|
||||||
Action::Layer { id, layer } => write!(
|
Action::Layer { id, layer } => write!(
|
||||||
f,
|
f,
|
||||||
"Action::LayerSurfaceAction::Layer {{ id: {:#?}, layer: {:?} }}", id, layer
|
"Action::LayerSurfaceAction::Layer {{ id: {:#?}, layer: {:?} }}",
|
||||||
|
id, layer
|
||||||
|
),
|
||||||
|
Action::Padding { id, padding } => write!(
|
||||||
|
f,
|
||||||
|
"Action::LayerSurfaceAction::Padding {{ id: {:#?}, padding: {:?} }}",
|
||||||
|
id, padding
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
use crate::core::window::Id as SurfaceId;
|
use crate::core::window::Id as SurfaceId;
|
||||||
use iced_runtime::{
|
use iced_runtime::{
|
||||||
self,
|
self, Action, Task,
|
||||||
platform_specific::{
|
platform_specific::{
|
||||||
self,
|
self,
|
||||||
wayland::{
|
wayland::{
|
||||||
|
|
@ -10,7 +10,7 @@ use iced_runtime::{
|
||||||
layer_surface::{IcedMargin, SctkLayerSurfaceSettings},
|
layer_surface::{IcedMargin, SctkLayerSurfaceSettings},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
task, Action, Task,
|
task,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub use cctk::sctk::shell::wlr_layer::{Anchor, KeyboardInteractivity, Layer};
|
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 },
|
||||||
|
)),
|
||||||
|
))
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -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 {
|
Action::Popup(action) => match action {
|
||||||
platform_specific::wayland::popup::Action::Popup { popup: settings } => {
|
platform_specific::wayland::popup::Action::Popup { popup: settings } => {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue