summaryrefslogtreecommitdiffstats
path: root/video/out
diff options
context:
space:
mode:
authornanahi <130121847+na-na-hi@users.noreply.github.com>2024-03-28 08:55:21 -0400
committerDudemanguy <random342@airmail.cc>2024-04-01 01:17:22 +0000
commita140d2788c33e729c4a0867c69cfe596458653dc (patch)
tree21ee1743e45003c71075f0a30cfc2e9fd023d873 /video/out
parent0a083eadb5f9242b045d4a90566a394284284d91 (diff)
downloadmpv-a140d2788c33e729c4a0867c69cfe596458653dc.tar.bz2
mpv-a140d2788c33e729c4a0867c69cfe596458653dc.tar.xz
wayland_common: set mouse position on pointer enter
At least on some compositors, when the pointer enters a surface, only a wl_pointer_enter event is generated, but not wl_pointer_motion. This results in the initial mouse position being lost, which is especially problematic when input simulation is used. Fix this by setting the mouse position on pointer enter event.
Diffstat (limited to 'video/out')
-rw-r--r--video/out/wayland_common.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/video/out/wayland_common.c b/video/out/wayland_common.c
index 1185678d18..d48af35917 100644
--- a/video/out/wayland_common.c
+++ b/video/out/wayland_common.c
@@ -246,6 +246,13 @@ static void pointer_handle_enter(void *data, struct wl_pointer *pointer,
s->pointer_enter_serial = serial;
set_cursor_visibility(s, wl->cursor_visible);
mp_input_put_key(wl->vo->input_ctx, MP_KEY_MOUSE_ENTER);
+
+ wl->mouse_x = wl_fixed_to_int(sx) * wl->scaling;
+ wl->mouse_y = wl_fixed_to_int(sy) * wl->scaling;
+
+ if (!wl->toplevel_configured)
+ mp_input_set_mouse_pos(wl->vo->input_ctx, wl->mouse_x, wl->mouse_y);
+ wl->toplevel_configured = false;
}
static void pointer_handle_leave(void *data, struct wl_pointer *pointer,