Add cursor_image_status/set_cursor_image_status to SeatExt

The `cursor_image_status()` function saves some duplication in various
places. The `set_cursor_image_status()` saves a bit less, but is also
handy.
This commit is contained in:
Ian Douglas Scott 2025-06-06 15:33:58 -07:00 committed by Victoria Brekenfeld
parent ddc23fcaa5
commit fa4bffdbe6
8 changed files with 52 additions and 105 deletions

View file

@ -1427,12 +1427,7 @@ impl Common {
}
let is_cursor_image = shell.seats.iter().any(|seat| {
seat.user_data()
.get::<Mutex<CursorImageStatus>>()
.map(|guard| {
matches!(*guard.lock().unwrap(), CursorImageStatus::Surface(ref cursor_surface) if cursor_surface == surface)
})
.unwrap_or(false)
matches!(seat.cursor_image_status(), CursorImageStatus::Surface(ref cursor_surface) if cursor_surface == surface)
});
if is_cursor_image {