summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordudemanguy <random342@airmail.cc>2020-01-11 18:32:36 -0600
committerDudemanguy <random342@airmail.cc>2020-01-12 01:54:41 +0000
commitb8a42cc41c2733c95feda35929a9099e68c32571 (patch)
tree21c031ab573f22a3fb3764c71212514c26e2ee20
parent6cb3d024c85860470818d3a2a24358d006151d23 (diff)
downloadmpv-b8a42cc41c2733c95feda35929a9099e68c32571.tar.bz2
mpv-b8a42cc41c2733c95feda35929a9099e68c32571.tar.xz
wayland: unscrew up cursors
Fixes #7345 There was a multitude of issues with cursor handling in wayland and behavior seemed to vary for strange reasons across compositors and also bad things were being done in wayland_common. The problem is complicated and involved fullscreen states being set incorrectly under certain instances and so on. The best solution is to just remove most of the extra cruft. In handle_toplevel_config, instead of automatically assuming is_fullscreen and is_maximized are false, we should use whatever value is currently set vo_opts which matters when we initially launch the window.
-rw-r--r--video/out/wayland_common.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/video/out/wayland_common.c b/video/out/wayland_common.c
index ce0b83c0e4..3be85012df 100644
--- a/video/out/wayland_common.c
+++ b/video/out/wayland_common.c
@@ -105,8 +105,6 @@ static int spawn_cursor(struct vo_wayland_state *wl)
static int set_cursor_visibility(struct vo_wayland_state *wl, bool on)
{
- if (!wl->pointer || !wl->pointer_id)
- return VO_NOTAVAIL;
wl->cursor_visible = on;
if (on) {
if (spawn_cursor(wl))
@@ -136,8 +134,6 @@ static void pointer_handle_enter(void *data, struct wl_pointer *pointer,
wl->pointer = pointer;
wl->pointer_id = serial;
- if (wl->vo_opts->fullscreen && wl->vo_opts->cursor_autohide_delay != -1)
- wl->cursor_visible = false;
set_cursor_visibility(wl, wl->cursor_visible);
mp_input_put_key(wl->vo->input_ctx, MP_KEY_MOUSE_ENTER);
}
@@ -947,8 +943,8 @@ static void handle_toplevel_config(void *data, struct xdg_toplevel *toplevel,
struct mp_vo_opts *vo_opts = wl->vo_opts;
struct mp_rect old_geometry = wl->geometry;
- bool is_maximized = false;
- bool is_fullscreen = false;
+ bool is_maximized = vo_opts->window_maximized;
+ bool is_fullscreen = vo_opts->fullscreen;
enum xdg_toplevel_state *state;
wl_array_for_each(state, states) {
switch (*state) {
@@ -1500,6 +1496,8 @@ int vo_wayland_control(struct vo *vo, int *events, int request, void *arg)
case VOCTRL_UPDATE_WINDOW_TITLE:
return update_window_title(wl, (char *)arg);
case VOCTRL_SET_CURSOR_VISIBILITY:
+ if (!wl->pointer)
+ return VO_NOTAVAIL;
return set_cursor_visibility(wl, *(bool *)arg);
case VOCTRL_KILL_SCREENSAVER:
return set_screensaver_inhibitor(wl, true);