diff --git a/runtime/src/platform_specific/wayland/layer_surface.rs b/runtime/src/platform_specific/wayland/layer_surface.rs index 0a7122bc..4745ef67 100644 --- a/runtime/src/platform_specific/wayland/layer_surface.rs +++ b/runtime/src/platform_specific/wayland/layer_surface.rs @@ -137,6 +137,12 @@ pub enum Action { /// keyboard interactivity of the layer surface keyboard_interactivity: KeyboardInteractivity, }, + InputZone { + /// id of the layer surface + id: Id, + /// input zone + zone: Option>, + }, /// layer of the layer surface Layer { /// id of the layer surface @@ -176,11 +182,15 @@ impl fmt::Debug for Action { ), Action::KeyboardInteractivity { id, keyboard_interactivity } => write!( f, - "Action::LayerSurfaceAction::Margin {{ id: {:#?}, keyboard_interactivity: {:?} }}", id, keyboard_interactivity + "Action::LayerSurfaceAction::KeyboardInteractivity {{ id: {:#?}, keyboard_interactivity: {:?} }}", id, keyboard_interactivity + ), + Action::InputZone { id, zone } => write!( + f, + "Action::LayerSurfaceAction::InputZone {{ id: {:#?}, zone: {:?} }}", id, zone ), Action::Layer { id, layer } => write!( f, - "Action::LayerSurfaceAction::Margin {{ id: {:#?}, layer: {:?} }}", id, layer + "Action::LayerSurfaceAction::Layer {{ id: {:#?}, layer: {:?} }}", id, layer ), } } diff --git a/winit/src/platform_specific/wayland/event_loop/state.rs b/winit/src/platform_specific/wayland/event_loop/state.rs index b4d9382c..f75512a7 100644 --- a/winit/src/platform_specific/wayland/event_loop/state.rs +++ b/winit/src/platform_specific/wayland/event_loop/state.rs @@ -1139,6 +1139,29 @@ impl SctkState { } }, + platform_specific::wayland::layer_surface::Action::InputZone { id, zone } => { + if let Some(layer_surface) = self.layer_surfaces.iter_mut().find(|l| l.id == id) { + if let Some(zone) = &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.surface.set_input_region(Some(®ion)); + region.destroy(); + } else{ + layer_surface.surface.set_input_region(None); + } + _ = self.to_commit.insert(id, layer_surface.surface.wl_surface().clone()); + } + } platform_specific::wayland::layer_surface::Action::Layer { id, layer } => { if let Some(layer_surface) = self.layer_surfaces.iter_mut().find(|l| l.id == id) { layer_surface.layer = layer;