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