Skip to content

Commit d2949f2

Browse files
FreddyFunkwash2
authored andcommitted
fix Wayland layer-shell protocol violation: "must ack the initial configure before attaching buffer"
1 parent b788625 commit d2949f2

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

winit/src/platform_specific/wayland/event_loop/state.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1057,7 +1057,6 @@ impl SctkState {
10571057
if let Ok((id, surface, common)) = self.get_layer_surface(builder) {
10581058
// TODO Ashley: all surfaces should probably have an optional title for a11y if nothing else
10591059
let wl_surface = surface.wl_surface().clone();
1060-
receive_frame(&mut self.frame_status, &wl_surface);
10611060
send_event(&self.events_sender, &self.proxy,
10621061
SctkEvent::LayerSurfaceEvent {
10631062
variant: LayerSurfaceEventVariant::Created(self.queue_handle.clone(), surface, id, common, self.connection.display(), title),

winit/src/platform_specific/wayland/handlers/shell/layer.rs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use crate::platform_specific::wayland::{
2-
event_loop::state::SctkState,
2+
event_loop::state::{receive_frame, SctkState},
33
sctk_event::{LayerSurfaceEventVariant, SctkEvent},
44
};
55
use cctk::sctk::{
@@ -42,14 +42,14 @@ impl LayerShellHandler for SctkState {
4242
mut configure: cctk::sctk::shell::wlr_layer::LayerSurfaceConfigure,
4343
_serial: u32,
4444
) {
45-
self.request_redraw(layer.wl_surface());
4645
let layer =
4746
match self.layer_surfaces.iter_mut().find(|s| {
4847
s.surface.wl_surface().id() == layer.wl_surface().id()
4948
}) {
5049
Some(l) => l,
5150
None => return,
5251
};
52+
let first = layer.last_configure.is_none();
5353
let common = layer.common.lock().unwrap();
5454
let requested_size = common.requested_size;
5555
drop(common);
@@ -65,18 +65,22 @@ impl LayerShellHandler for SctkState {
6565
};
6666

6767
layer.update_viewport(configure.new_size.0, configure.new_size.1);
68-
let first = layer.last_configure.is_none();
6968
_ = layer.last_configure.replace(configure.clone());
7069
let mut common = layer.common.lock().unwrap();
7170
common.size =
7271
LogicalSize::new(configure.new_size.0, configure.new_size.1);
72+
drop(common);
73+
let wl_surface = layer.surface.wl_surface().clone();
74+
receive_frame(&mut self.frame_status, &wl_surface);
75+
self.request_redraw(&wl_surface);
76+
7377
self.sctk_events.push(SctkEvent::LayerSurfaceEvent {
7478
variant: LayerSurfaceEventVariant::Configure(
7579
configure,
76-
layer.surface.wl_surface().clone(),
80+
wl_surface.clone(),
7781
first,
7882
),
79-
id: layer.surface.wl_surface().clone(),
83+
id: wl_surface,
8084
});
8185
}
8286
}

0 commit comments

Comments
 (0)