summaryrefslogtreecommitdiffstats
path: root/video/out/wayland_common.c
diff options
context:
space:
mode:
authordudemanguy <random342@airmail.cc>2019-12-02 09:28:52 -0600
committerDudemanguy <random342@airmail.cc>2019-12-04 00:47:05 +0000
commit7f300a00e929bd728c6cbff27b68bbbf28e85d0f (patch)
treea6d8d254e758b40d1f0367a401982139c74ccbad /video/out/wayland_common.c
parent65a317436df05000366af2738bdbb834e95e33db (diff)
downloadmpv-7f300a00e929bd728c6cbff27b68bbbf28e85d0f.tar.bz2
mpv-7f300a00e929bd728c6cbff27b68bbbf28e85d0f.tar.xz
wayland: fix cursor behavior on an edge case
This small regression was introduced by #7216. Previously, the wayland backend used a trick which kept track of the previous fullscreen state and used that logic for showing the cursor. Since vo_opts now keeps track of the current fullscreen state, most of this stopped being neccessary. However, there was one edge case where the cursor didn't behave the same: passing a fullscreen flag for the inital window. The cursor would initially be visible here which is not desirable. This can be remedied pretty easily by just setting the cursor visiblity to false if the pointer entry event occurs on fullscreen. The only thing we need to do is to make sure that the autohide delay isn't completely disabled (i.e. the cursor is always visible). Hence the need for the previous commit.
Diffstat (limited to 'video/out/wayland_common.c')
-rw-r--r--video/out/wayland_common.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/video/out/wayland_common.c b/video/out/wayland_common.c
index 828926e79b..cbc7d63d31 100644
--- a/video/out/wayland_common.c
+++ b/video/out/wayland_common.c
@@ -136,6 +136,8 @@ 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);
}
@@ -151,12 +153,7 @@ static void pointer_handle_motion(void *data, struct wl_pointer *pointer,
uint32_t time, wl_fixed_t sx, wl_fixed_t sy)
{
struct vo_wayland_state *wl = data;
- if (!wl->prev_fullscreen && wl->vo_opts->fullscreen) {
- wl->prev_fullscreen = wl->vo_opts->fullscreen;
- return;
- }
- wl->prev_fullscreen = wl->vo_opts->fullscreen;
wl->mouse_x = wl_fixed_to_int(sx) * wl->scaling;
wl->mouse_y = wl_fixed_to_int(sy) * wl->scaling;
wl->mouse_unscaled_x = sx;
@@ -1078,7 +1075,6 @@ int vo_wayland_init(struct vo *vo)
.wakeup_pipe = {-1, -1},
.dnd_fd = -1,
.cursor_visible = true,
- .prev_fullscreen = vo->opts->fullscreen,
.vo_opts_cache = m_config_cache_alloc(wl, vo->global, &vo_sub_opts),
};
wl->vo_opts = wl->vo_opts_cache->opts;