diff --git a/iced_examples/counter_muti/src/main.rs b/iced_examples/counter_muti/src/main.rs index 5561be5..f8c61bb 100644 --- a/iced_examples/counter_muti/src/main.rs +++ b/iced_examples/counter_muti/src/main.rs @@ -10,7 +10,7 @@ use iced_layershell::actions::{ use iced_runtime::command::Action; use iced_runtime::window::Action as WindowAction; -use iced_layershell::reexport::{Anchor, Layer, NewLayerShellSettings}; +use iced_layershell::reexport::{Anchor, KeyboardInteractivity, Layer, NewLayerShellSettings}; use iced_layershell::settings::{LayerShellSettings, Settings}; use iced_layershell::MultiApplication; pub fn main() -> Result<(), iced_layershell::Error> { @@ -189,10 +189,11 @@ impl MultiApplication for Counter { LayershellCustomActionsWithInfo::NewLayerShell(( NewLayerShellSettings { size: Some((100, 100)), - exclude_zone: None, + exclusize_zone: None, anchor: Anchor::Left | Anchor::Bottom, layer: Layer::Top, - margin: None, + margins: None, + keyboard_interactivity: KeyboardInteractivity::None, }, WindowInfo::Left, )), @@ -205,10 +206,11 @@ impl MultiApplication for Counter { LayershellCustomActionsWithInfo::NewLayerShell(( NewLayerShellSettings { size: Some((100, 100)), - exclude_zone: None, + exclusize_zone: None, anchor: Anchor::Right | Anchor::Bottom, layer: Layer::Top, - margin: None, + margins: None, + keyboard_interactivity: KeyboardInteractivity::None, }, WindowInfo::Right, )), diff --git a/layershellev/src/events.rs b/layershellev/src/events.rs index 9e019a2..358c7d6 100644 --- a/layershellev/src/events.rs +++ b/layershellev/src/events.rs @@ -1,5 +1,6 @@ use wayland_protocols_wlr::layer_shell::v1::client::{ - zwlr_layer_shell_v1::Layer, zwlr_layer_surface_v1::Anchor, + zwlr_layer_shell_v1::Layer, + zwlr_layer_surface_v1::{Anchor, KeyboardInteractivity}, }; use wayland_client::{ @@ -55,10 +56,23 @@ pub struct NewLayerShellSettings { pub size: Option<(u32, u32)>, pub layer: Layer, pub anchor: Anchor, - pub exclude_zone: Option, - pub margin: Option<(i32, i32, i32, i32)>, + pub exclusize_zone: Option, + pub margins: Option<(i32, i32, i32, i32)>, + pub keyboard_interactivity: KeyboardInteractivity, } +impl Default for NewLayerShellSettings { + fn default() -> Self { + NewLayerShellSettings { + anchor: Anchor::Bottom | Anchor::Left | Anchor::Right, + layer: Layer::Top, + exclusize_zone: None, + size: None, + margins: Some((0, 0, 0, 0)), + keyboard_interactivity: KeyboardInteractivity::OnDemand, + } + } +} /// the return data /// Note: when event is RequestBuffer, you must return WlBuffer /// Note: when receive InitRequest, you can request to bind extra wayland-protocols. this time you diff --git a/layershellev/src/lib.rs b/layershellev/src/lib.rs index 8bdf6ef..9a8c79d 100644 --- a/layershellev/src/lib.rs +++ b/layershellev/src/lib.rs @@ -1767,8 +1767,9 @@ impl WindowState { size, layer, anchor, - exclude_zone: exclusive_zone, - margin, + exclusize_zone: exclusive_zone, + margins: margin, + keyboard_interactivity }, info, )) => { @@ -1791,7 +1792,7 @@ impl WindowState { (), ); layer.set_anchor(anchor); - layer.set_keyboard_interactivity(self.keyboard_interactivity); + layer.set_keyboard_interactivity(keyboard_interactivity); if let Some((init_w, init_h)) = size { layer.set_size(init_w, init_h); }