wayland: no mouse dragging in fullscreen/maximized

The wayland code takes mouse dragging into account in order to trigger a
client-side request for a window move or window resize. According to the
xdg-shell spec*, "[t]he server may ignore move[/resize] requests
depending on the state of the surface (e.g. fullscreen or maximized)".
Since it is not actually a hard requirement, that means the compositor
could actually respond to a clientside move/resize request even if the
mpv window was fullscreen. For example, it was pointed out that in sway,
if mpv is a floating window, you could drag it around off screen even
though the window is fullscreen.

This kind of behavior does not really have any practical use. A user can
should pan a video if he/she wishes to move its orientation while
fullscreen (or maximized for that manner). Naturally, a maximized or
fullscreened window should never be manually resized (every compositor
likely ignores this anyway). The fix is to simply just not trigger the
smecial mouse dragging case if the wayland surface is fullscreened or
maximized.

*:https://gitlab.freedesktop.org/wayland/wayland-protocols/-/blob/master/stable/xdg-shell/xdg-shell.xml
This commit is contained in:
Dudemanguy 2021-03-02 16:38:54 -06:00
parent 0888e53fc4
commit 99968e1ce5
1 changed files with 1 additions and 0 deletions

View File

@ -268,6 +268,7 @@ static void pointer_handle_button(void *data, struct wl_pointer *wl_pointer,
mp_input_put_key(wl->vo->input_ctx, button | state | mpmod);
if (!mp_input_test_dragging(wl->vo->input_ctx, wl->mouse_x, wl->mouse_y) &&
(!wl->vo_opts->fullscreen) && (!wl->vo_opts->window_maximized) &&
(button == MP_MBTN_LEFT) && (state == MP_KEY_STATE_DOWN)) {
uint32_t edges;
// Implement an edge resize zone if there are no decorations