summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Weißschuh <thomas@t-8ch.de>2019-02-04 11:27:49 +0100
committerwm4 <1387750+wm4@users.noreply.github.com>2019-09-21 15:24:06 +0200
commit9e304ab974559907790829421a11e26eb2b630e5 (patch)
treedfd3261e8c34bc5994993b80dedbec3d1a923d31
parent1c43920fb85387aaf7267b4b79dc829896bd610d (diff)
downloadmpv-9e304ab974559907790829421a11e26eb2b630e5.tar.bz2
mpv-9e304ab974559907790829421a11e26eb2b630e5.tar.xz
wayland: reconfigure cursor on pointer enter event
On wayland the cursor has to be configured each time the pointer enters. Currently if the window (re)gains the focus, the pointer is not hidden, even when configured. After the mouse has been moved the pointer hides correctly. https://wayland.freedesktop.org/docs/html/apa.html#protocol-spec-wl_pointer: wl_pointer::enter - enter event ... When a seat's focus enters a surface, the pointer image is undefined and a client should respond to this event by setting an appropriate pointer image with the set_cursor request. Fixes #6185. Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
-rw-r--r--video/out/wayland_common.c4
-rw-r--r--video/out/wayland_common.h1
2 files changed, 4 insertions, 1 deletions
diff --git a/video/out/wayland_common.c b/video/out/wayland_common.c
index df64578e5c..4a9895520b 100644
--- a/video/out/wayland_common.c
+++ b/video/out/wayland_common.c
@@ -72,6 +72,7 @@ static int set_cursor_visibility(struct vo_wayland_state *wl, bool on)
{
if (!wl->pointer)
return VO_NOTAVAIL;
+ wl->cursor_visible = on;
if (on) {
if (spawn_cursor(wl))
return VO_FALSE;
@@ -100,7 +101,7 @@ static void pointer_handle_enter(void *data, struct wl_pointer *pointer,
wl->pointer = pointer;
wl->pointer_id = serial;
- set_cursor_visibility(wl, true);
+ set_cursor_visibility(wl, wl->cursor_visible);
mp_input_put_key(wl->vo->input_ctx, MP_KEY_MOUSE_ENTER);
}
@@ -1017,6 +1018,7 @@ int vo_wayland_init(struct vo *vo)
.scaling = 1,
.wakeup_pipe = {-1, -1},
.dnd_fd = -1,
+ .cursor_visible = true,
};
wl_list_init(&wl->output_list);
diff --git a/video/out/wayland_common.h b/video/out/wayland_common.h
index 0648efa09a..735b312e97 100644
--- a/video/out/wayland_common.h
+++ b/video/out/wayland_common.h
@@ -101,6 +101,7 @@ struct vo_wayland_state {
struct wl_cursor *default_cursor;
struct wl_surface *cursor_surface;
int allocated_cursor_scale;
+ bool cursor_visible;
};
int vo_wayland_init(struct vo *vo);