forge
Explore
Log in

Don't you dare go Hollow

layer-shell: properly handle re-map

Browse files at this commit

2415346caaa4121ed202b8e376fb40b2a44eb61falex-huffParent: 3f2b7e6
According to the zwlr_layer_surface_v1 documentation: Unmapping a
layer_surface means that the surface cannot be shown by the compositor
until it is explicitly mapped again. The layer_surface returns to the
state it had right after layer_shell.get_layer_surface. The client can
re-map the surface by performing a commit without any buffer attached,
waiting for a configure event and handling it as usual.

Before this commit, no configure event was sent when a client performed
a commit without any buffer attached.
src/handlers/layer_shell.rsmodified+14 -0
@@ -176,6 +176,20 @@ impl State {
176 } else {176 } else {
177 self.niri.mapped_layer_surfaces.remove(layer);177 self.niri.mapped_layer_surfaces.remove(layer);
178 self.niri.unmapped_layer_surfaces.insert(surface.clone());178 self.niri.unmapped_layer_surfaces.insert(surface.clone());
179+
180+ // After layer surface unmaps it has to perform the initial commit-configure
181+ // sequence again. This is a workaround until Smithay properly resets
182+ // initial_configure_sent upon the surface unmapping itself as it does for
183+ // toplevels.
184+ with_states(surface, |states| {
185+ let mut data = states
186+ .data_map
187+ .get::<LayerSurfaceData>()
188+ .unwrap()
189+ .lock()
190+ .unwrap();
191+ data.initial_configure_sent = false;
192+ });
179 }193 }
180 } else {194 } else {
181 let scale = output.current_scale();195 let scale = output.current_scale();