Skip to content

Commit

Permalink
options: win32: ignore and deprecate --fit-border
Browse files Browse the repository at this point in the history
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 70f64f3 and 949247d, in order to
solve an issue (mpv-player#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.

(mpv-player#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 (981048e) 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.
  • Loading branch information
avih committed Apr 17, 2021
1 parent cd7a7a1 commit 17a6762
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 8 deletions.
6 changes: 0 additions & 6 deletions DOCS/man/options.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
3 changes: 2 additions & 1 deletion options/options.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)},
Expand Down
2 changes: 1 addition & 1 deletion video/out/w32_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down

0 comments on commit 17a6762

Please sign in to comment.