summaryrefslogtreecommitdiffstats
path: root/video/out/wayland_common.h
diff options
context:
space:
mode:
authorDudemanguy <random342@airmail.cc>2020-08-02 16:45:06 -0500
committerDudemanguy <random342@airmail.cc>2020-08-02 17:06:51 -0500
commitfb55ee99e34498528a3c7e0abe19710ea47d8448 (patch)
tree94af3bbd2740b951ddc574b3739b81969cc39806 /video/out/wayland_common.h
parent359261c50c83f1046e3ccc143c44606123fc33c4 (diff)
downloadmpv-fb55ee99e34498528a3c7e0abe19710ea47d8448.tar.bz2
mpv-fb55ee99e34498528a3c7e0abe19710ea47d8448.tar.xz
wayland: don't set mouse pos on state change
Sway 1.5 started sending more pointer motion events to mpv which broke the autohiding behavior. The cursor would appear again if you fullscreened. Sway had a good reason to do this because certain applications had inconsistencies between hardware cursor and software cursor without rebasing on state changes[1]. So mpv needs to take this special case into consideration. Initially, simply checking mouse coordinates for changes was considered, but this doesn't work. All coordinates are surface-local in wayland so something can appear to move in the local coordinate space but not globally. You're not allowed to know global mouse coordinates in wayland, and we don't care about local coordinate changes in mpv so this approach isn't viable. Instead, let's just keep track of a local state change. If the toplevel surface changes in some way (fullscreen, maximized, etc.), then just set a bool that lets us ignore the mp_input_set_mouse_pos function. This keeps the cursor from appearing simply because the state was changed (i.e. fullscreening). For compositors that don't send pointer motion events on a state change, this does technically mean that the initial mp_input_set_mouse_pos is never set. In practice, this isn't a noticeable difference though because moving a mouse generates a ton of motion events so you'll immediately see it on the second motion event. [1] https://github.com/swaywm/sway/issues/5594
Diffstat (limited to 'video/out/wayland_common.h')
-rw-r--r--video/out/wayland_common.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/video/out/wayland_common.h b/video/out/wayland_common.h
index 31e75c4331..895db3393d 100644
--- a/video/out/wayland_common.h
+++ b/video/out/wayland_common.h
@@ -75,6 +75,7 @@ struct vo_wayland_state {
int reduced_height;
bool configured;
bool frame_wait;
+ bool state_changed;
int wakeup_pipe[2];
int pending_vo_events;
int mouse_x;