diff --git a/examples/sctk_todos/src/main.rs b/examples/sctk_todos/src/main.rs index e2a38fda..cf27529a 100644 --- a/examples/sctk_todos/src/main.rs +++ b/examples/sctk_todos/src/main.rs @@ -98,7 +98,7 @@ impl Todos { get_layer_surface(iced::platform_specific::runtime::wayland::layer_surface::SctkLayerSurfaceSettings { id: id.clone(), size: Some((None, Some(500))), - pointer_interactivity: true, + input_zone: None, keyboard_interactivity: cctk::sctk::shell::wlr_layer::KeyboardInteractivity::OnDemand, anchor: Anchor::LEFT.union(Anchor::RIGHT).union(Anchor::TOP), ..Default::default() diff --git a/runtime/src/platform_specific/wayland/layer_surface.rs b/runtime/src/platform_specific/wayland/layer_surface.rs index 187d3174..0a7122bc 100644 --- a/runtime/src/platform_specific/wayland/layer_surface.rs +++ b/runtime/src/platform_specific/wayland/layer_surface.rs @@ -7,6 +7,7 @@ use cctk::sctk::{ use iced_core::layout::Limits; use iced_core::window::Id; +use iced_core::Rectangle; /// output for layer surface #[derive(Debug, Clone)] @@ -47,8 +48,9 @@ pub struct SctkLayerSurfaceSettings { pub layer: Layer, /// keyboard interactivity pub keyboard_interactivity: KeyboardInteractivity, - /// pointer interactivity - pub pointer_interactivity: bool, + /// input zone + /// None results in accepting all input + pub input_zone: Option>, /// anchor, if a surface is anchored to two opposite edges, it will be stretched to fit between those edges, regardless of the specified size in that dimension. pub anchor: Anchor, /// output @@ -72,7 +74,7 @@ impl Default for SctkLayerSurfaceSettings { id: Id::unique(), layer: Layer::Top, keyboard_interactivity: Default::default(), - pointer_interactivity: true, + input_zone: None, anchor: Anchor::empty(), output: Default::default(), namespace: Default::default(), diff --git a/winit/src/platform_specific/wayland/event_loop/state.rs b/winit/src/platform_specific/wayland/event_loop/state.rs index 90da2603..b4d9382c 100644 --- a/winit/src/platform_specific/wayland/event_loop/state.rs +++ b/winit/src/platform_specific/wayland/event_loop/state.rs @@ -886,7 +886,7 @@ impl SctkState { id, layer, keyboard_interactivity, - pointer_interactivity, + input_zone, anchor, output, namespace, @@ -941,11 +941,19 @@ impl SctkState { layer_surface .set_size(size.0.unwrap_or_default(), size.1.unwrap_or_default()); layer_surface.set_exclusive_zone(exclusive_zone); - if !pointer_interactivity { + if let Some(zone) = &input_zone { let region = self .compositor_state .wl_compositor() .create_region(&self.queue_handle, ()); + for rect in zone { + region.add( + rect.x.round() as i32, + rect.y.round() as i32, + rect.width.round() as i32, + rect.height.round() as i32, + ); + } layer_surface.set_input_region(Some(®ion)); region.destroy(); }