winit/wayland: Allow Vec for input_zone
This commit is contained in:
parent
621713fe15
commit
20e60ffde6
3 changed files with 20 additions and 16 deletions
|
|
@ -27,7 +27,7 @@ pub struct SctkPopupSettings {
|
|||
pub close_with_children: bool,
|
||||
/// input zone
|
||||
/// None results in accepting all input
|
||||
pub input_zone: Option<Rectangle>,
|
||||
pub input_zone: Option<Vec<Rectangle>>,
|
||||
}
|
||||
|
||||
impl Hash for SctkPopupSettings {
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ pub struct SctkSubsurfaceSettings {
|
|||
|
||||
/// input zone
|
||||
/// None results in accepting all input
|
||||
pub input_zone: Option<Rectangle>,
|
||||
pub input_zone: Option<Vec<Rectangle>>,
|
||||
}
|
||||
|
||||
impl Hash for SctkSubsurfaceSettings {
|
||||
|
|
|
|||
|
|
@ -729,17 +729,19 @@ impl SctkState {
|
|||
let wl_surface =
|
||||
self.compositor_state.create_surface(&self.queue_handle);
|
||||
_ = self.id_map.insert(wl_surface.id(), settings.id.clone());
|
||||
if let Some(z) = settings.input_zone {
|
||||
if let Some(zone) = &settings.input_zone {
|
||||
let region = self
|
||||
.compositor_state
|
||||
.wl_compositor()
|
||||
.create_region(&self.queue_handle, ());
|
||||
region.add(
|
||||
z.x.round() as i32,
|
||||
z.y.round() as i32,
|
||||
z.width.round() as i32,
|
||||
z.height.round() as i32,
|
||||
);
|
||||
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,
|
||||
);
|
||||
}
|
||||
wl_surface.set_input_region(Some(®ion));
|
||||
}
|
||||
let (toplevel, popup) = match &parent {
|
||||
|
|
@ -1684,17 +1686,19 @@ impl SctkState {
|
|||
);
|
||||
wl_subsurface.set_position(bounds.x as i32, bounds.y as i32);
|
||||
_ = wl_surface.frame(&self.queue_handle, wl_surface.clone());
|
||||
if let Some(zone) = settings.input_zone {
|
||||
if let Some(zone) = &settings.input_zone {
|
||||
let region = self
|
||||
.compositor_state
|
||||
.wl_compositor()
|
||||
.create_region(&self.queue_handle, ());
|
||||
region.add(
|
||||
zone.x.round() as i32,
|
||||
zone.y.round() as i32,
|
||||
zone.width.round() as i32,
|
||||
zone.height.round() as i32,
|
||||
);
|
||||
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,
|
||||
);
|
||||
}
|
||||
wl_surface.set_input_region(Some(®ion));
|
||||
region.destroy();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue