seat: Make render-related state thread-safe

This commit is contained in:
Victoria Brekenfeld 2024-06-07 19:26:23 +02:00 committed by Victoria Brekenfeld
parent bd58481d19
commit c7d50e7c5b
11 changed files with 137 additions and 112 deletions

View file

@ -50,10 +50,13 @@ impl PointerTarget<State> for ResizeForkTarget {
fn enter(&self, seat: &Seat<State>, _data: &mut State, _event: &MotionEvent) {
let user_data = seat.user_data();
let cursor_state = user_data.get::<CursorState>().unwrap();
cursor_state.set_shape(match self.orientation {
Orientation::Horizontal => CursorShape::RowResize,
Orientation::Vertical => CursorShape::ColResize,
});
cursor_state
.lock()
.unwrap()
.set_shape(match self.orientation {
Orientation::Horizontal => CursorShape::RowResize,
Orientation::Vertical => CursorShape::ColResize,
});
}
fn leave(
@ -65,7 +68,7 @@ impl PointerTarget<State> for ResizeForkTarget {
) {
let user_data = seat.user_data();
let cursor_state = user_data.get::<CursorState>().unwrap();
cursor_state.set_shape(CursorShape::Default)
cursor_state.lock().unwrap().set_shape(CursorShape::Default)
}
fn button(&self, seat: &Seat<State>, data: &mut State, event: &ButtonEvent) {