1
0
mirror of https://github.com/mpv-player/mpv synced 2024-12-21 22:30:22 +00:00

x11: leaving fullscreen -> reset WM hints only if needed

This works around an issue in OpenBox: OpenBox apparently sizes the
normal window incorrectly if aspect ratio hints are set, and the window
size is off by 1 pixel. Then, when going fullscreen and leaving
fullscreen again, mpv sets the hints based on OpenBox' broken window
size, and as result, OpenBox sizes the window incorrectly and is off by
1 pixel again - so it's 2 pixels off in total. The error gets more
visible, the more often you toggle fullscreen mode.

Work this around by not setting the window hints if we don't need to.
Actually we only need to do this when the video is resized during
fullscreen, which happens rarely. Under normal circumstances, leaving
fullscreen mode requires that the WM restores the old state.

As such, this commit is not only a workaround, but actually a cleanup.

Note that we do need to set the hints when leaving fullscreen if the
window has resized: even though we set the hints in
vo_x11_highlevel_resize (called by vo_x11_config_vo_window), this
doesn't seem to have an effect (at least on IceWM), so we have to do it
after that.

Side note: ot seems commit 625ad57a strangely triggered the OpenBox
issue according to user reports; I'm not sure why.
This commit is contained in:
wm4 2014-05-19 21:58:55 +02:00
parent ebe798cbc0
commit 5f6406f450

View File

@ -1438,10 +1438,12 @@ static void vo_x11_fullscreen(struct vo *vo)
vo_x11_ewmh_fullscreen(x11, _NET_WM_STATE_ADD);
} else {
vo_x11_ewmh_fullscreen(x11, _NET_WM_STATE_REMOVE);
vo_x11_move_resize(vo,
x11->pos_changed_during_fs,
x11->size_changed_during_fs,
x11->nofsrc);
if (x11->pos_changed_during_fs || x11->size_changed_during_fs) {
vo_x11_move_resize(vo,
x11->pos_changed_during_fs,
x11->size_changed_during_fs,
x11->nofsrc);
}
}
} else {
struct mp_rect rc = x11->nofsrc;