diff options
author | Dudemanguy <random342@airmail.cc> | 2020-08-02 16:45:06 -0500 |
---|---|---|
committer | Dudemanguy <random342@airmail.cc> | 2020-08-02 17:06:51 -0500 |
commit | fb55ee99e34498528a3c7e0abe19710ea47d8448 (patch) | |
tree | 94af3bbd2740b951ddc574b3739b81969cc39806 /sub | |
parent | 359261c50c83f1046e3ccc143c44606123fc33c4 (diff) | |
download | mpv-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 'sub')
0 files changed, 0 insertions, 0 deletions