fix(wayland popup): apply input region

This commit is contained in:
Ashley Wulber 2025-07-31 11:54:09 -04:00
parent 9e45bd2378
commit 4eb7f9b2fe
No known key found for this signature in database
GPG key ID: 5216D4F46A90A820

View file

@ -679,7 +679,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 {
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,
);
wl_surface.set_input_region(Some(&region));
}
let (toplevel, popup) = match &parent { let (toplevel, popup) = match &parent {
PopupParent::LayerSurface(parent) => { PopupParent::LayerSurface(parent) => {
let Some(parent_layer_surface) = self let Some(parent_layer_surface) = self
@ -741,6 +753,14 @@ impl SctkState {
) )
} }
}; };
popup.xdg_surface().set_window_geometry(
0,
0,
size.0 as i32,
size.1 as i32,
);
if grab { if grab {
if let Some(s) = self.seats.first() { if let Some(s) = self.seats.first() {
let ptr_data = s let ptr_data = s
@ -764,24 +784,7 @@ impl SctkState {
} }
} }
if let Some(z) = 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,
);
}
popup.xdg_surface().set_window_geometry(
0,
0,
size.0 as i32,
size.1 as i32,
);
_ = wl_surface.frame(&self.queue_handle, wl_surface.clone()); _ = wl_surface.frame(&self.queue_handle, wl_surface.clone());
wl_surface.commit(); wl_surface.commit();