summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornanahi <130121847+na-na-hi@users.noreply.github.com>2024-02-13 00:38:36 -0500
committerDudemanguy <random342@airmail.cc>2024-02-17 16:09:41 +0000
commitb6dcf9eceec148c2fd79c8799bd1ffd5c38a7d6c (patch)
treed505c71352e0db3484e1478beba469bc9dba6034
parentb86768b3568a0f700d73c606f2d010af1655f217 (diff)
downloadmpv-b6dcf9eceec148c2fd79c8799bd1ffd5c38a7d6c.tar.bz2
mpv-b6dcf9eceec148c2fd79c8799bd1ffd5c38a7d6c.tar.xz
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.
-rw-r--r--video/out/wayland_common.c25
1 files changed, 22 insertions, 3 deletions
diff --git a/video/out/wayland_common.c b/video/out/wayland_common.c
index a175c10775..48a2eec246 100644
--- a/video/out/wayland_common.c
+++ b/video/out/wayland_common.c
@@ -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: