mirror of
https://github.com/mpv-player/mpv
synced 2025-05-11 20:57:59 +00:00
wayland_common: set cursor visibility for all seats for voctrl
For VOCTRL_SET_CURSOR_VISIBILITY, set cursors visibility for all seats. The return is VO_NOTAVAIL is none of the seats have cursor, and VO_FALSE if setting visibility failed for at least one seat.
This commit is contained in:
parent
b86768b356
commit
b6dcf9ecee
@ -1966,6 +1966,27 @@ static int set_cursor_visibility(struct vo_wayland_seat *s, bool on)
|
||||
return VO_TRUE;
|
||||
}
|
||||
|
||||
static int set_cursor_visibility_all_seats(struct vo_wayland_state *wl, bool on)
|
||||
{
|
||||
bool unavailable = true;
|
||||
bool failed = false;
|
||||
struct vo_wayland_seat *seat;
|
||||
wl_list_for_each(seat, &wl->seat_list, link) {
|
||||
if (seat->pointer) {
|
||||
unavailable = false;
|
||||
if (set_cursor_visibility(seat, on) == VO_FALSE)
|
||||
failed = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (unavailable)
|
||||
return VO_NOTAVAIL;
|
||||
if (failed)
|
||||
return VO_FALSE;
|
||||
|
||||
return VO_TRUE;
|
||||
}
|
||||
|
||||
static void set_geometry(struct vo_wayland_state *wl, bool resize)
|
||||
{
|
||||
struct vo *vo = wl->vo;
|
||||
@ -2339,9 +2360,7 @@ int vo_wayland_control(struct vo *vo, int *events, int request, void *arg)
|
||||
case VOCTRL_UPDATE_WINDOW_TITLE:
|
||||
return update_window_title(wl, (const char *)arg);
|
||||
case VOCTRL_SET_CURSOR_VISIBILITY:
|
||||
if (wl->cursor_seat && !wl->cursor_seat->pointer)
|
||||
return VO_NOTAVAIL;
|
||||
return set_cursor_visibility(wl->cursor_seat, *(bool *)arg);
|
||||
return set_cursor_visibility_all_seats(wl, *(bool *)arg);
|
||||
case VOCTRL_KILL_SCREENSAVER:
|
||||
return set_screensaver_inhibitor(wl, true);
|
||||
case VOCTRL_RESTORE_SCREENSAVER:
|
||||
|
Loading…
Reference in New Issue
Block a user