options: win32: ignore and deprecate --fit-border

The accurate description of this option was:
- fit-border is enabled by default. When disabled, it adds a bug where
  if the window has borders and mpv shrinks it to fit the desktop, then
  the calculation ignores the borders and adds incorrect video crop.

The option was added at commits 70f64f3c and 949247d6, in order to
solve an issue (#2935) where if mpv wanted to display a video with
size WxH, then w32_common.c incorrectly set the window to WxH, while
down-scaling the video slightly to fit (even with small sizes).

It was addressed with a new option which is enabled by default, but
does the right thing (sets the client area to WxH) only when disabled,
so that everyone who prefers their video slightly downscaled could
keep their default behavior.

(#2935 also addressed an off-by-one issue, fixed before fit-border)

While disabling the option did avoid unnecessary downscaling, it also
added a bug when disabled: the borders are no longer taken into
account when the size is too big for the desktop. Most users don't
notice and are unaffected as it's enabled by default.

Shortly later (981048e0) the core issue is fixed, and now the client
area is correctly set to WxH instead of the window (and together with
the three following commits which center the video, adds a new bug
where the window title can be outside the display - addressed next).

However, fit-border remained, now without any effect, except that it
still has the same bug when disabled and the window is too big.

Later code changes and refactoring preserved this issue with great
attention to details, and it remained in identical form until now.

Simply rip out fit-border.
This commit is contained in:
Avi Halachmi (:avih) 2021-04-17 13:18:43 +03:00
parent f665149fc8
commit ef1d0b2cdb
3 changed files with 3 additions and 8 deletions

View File

@ -2995,12 +2995,6 @@ Window
Play video with window border and decorations. Since this is on by
default, use ``--no-border`` to disable the standard window decorations.
``--fit-border``, ``--no-fit-border``
(Windows only) Fit the whole window with border and decorations on the
screen. Since this is on by default, use ``--no-fit-border`` to make mpv
try to only fit client area with video on the screen. This behavior only
applied to window/video with size exceeding size of the screen.
``--on-all-workspaces``
(X11 and macOS only)
Show the video window on all virtual desktops.

View File

@ -113,7 +113,8 @@ static const m_option_t mp_vo_opt_list[] = {
{"ontop-level", OPT_CHOICE(ontop_level, {"window", -1}, {"system", -2},
{"desktop", -3}), M_RANGE(0, INT_MAX)},
{"border", OPT_FLAG(border)},
{"fit-border", OPT_FLAG(fit_border)},
{"fit-border", OPT_FLAG(fit_border),
.deprecation_message = "the option is ignored and no longer needed"},
{"on-all-workspaces", OPT_FLAG(all_workspaces)},
{"geometry", OPT_GEOMETRY(geometry)},
{"autofit", OPT_SIZE_BOX(autofit)},

View File

@ -828,7 +828,7 @@ static void fit_window_on_screen(struct vo_w32_state *w32)
return;
RECT screen = get_working_area(w32);
if (w32->opts->border && w32->opts->fit_border)
if (w32->opts->border)
subtract_window_borders(w32, w32->window, &screen);
if (fit_rect(&w32->windowrc, &screen)) {