Skip to content

Commit f06bb26

Browse files
committed
wayland/session_lock: Reset attributes on destroy
In theory, allows reusing the wl_surface, consistent with other shells.
1 parent 3eac833 commit f06bb26

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

src/wayland/session_lock/surface.rs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,25 @@ where
6060
_ => unreachable!(),
6161
}
6262
}
63+
64+
fn destroyed(
65+
_state: &mut D,
66+
_client: wayland_server::backend::ClientId,
67+
_resource: &ExtSessionLockSurfaceV1,
68+
data: &ExtLockSurfaceUserData,
69+
) {
70+
if let Ok(surface) = data.surface.upgrade() {
71+
compositor::with_states(&surface, |states| {
72+
let mut attributes = states
73+
.data_map
74+
.get::<Mutex<LockSurfaceAttributes>>()
75+
.unwrap()
76+
.lock()
77+
.unwrap();
78+
attributes.reset();
79+
});
80+
}
81+
}
6382
}
6483

6584
/// Attributes for ext-session-lock surfaces.
@@ -113,6 +132,14 @@ impl LockSurfaceAttributes {
113132

114133
Some(configure)
115134
}
135+
136+
fn reset(&mut self) {
137+
self.configure_serial = None;
138+
self.server_pending = None;
139+
self.pending_configures = Vec::new();
140+
self.last_acked = None;
141+
self.current = Default::default();
142+
}
116143
}
117144

118145
/// Handle for a ext-session-lock surface.

0 commit comments

Comments
 (0)