From bd1bcc1f31dcf614f4b53234a62dc6b6d0b25480 Mon Sep 17 00:00:00 2001 From: Dudemanguy Date: Sun, 25 Feb 2024 14:10:00 -0600 Subject: [PATCH] player: always notify when writing window-scale option As described in the previous commit, update_window_scale will always execute whenever window-scale is written even if the value doesn't change. --- DOCS/man/input.rst | 31 +++---------------------------- DOCS/man/options.rst | 5 ++++- etc/input.conf | 6 +++--- options/options.c | 2 +- 4 files changed, 11 insertions(+), 33 deletions(-) diff --git a/DOCS/man/input.rst b/DOCS/man/input.rst index ae70585305..f9fa59121d 100644 --- a/DOCS/man/input.rst +++ b/DOCS/man/input.rst @@ -2690,30 +2690,6 @@ Property list enabled, or after precise seeking). Files with imprecise timestamps (such as Matroska) might lead to unstable results. -``window-scale`` (RW) - Window size multiplier. Setting this will resize the video window to the - values contained in ``dwidth`` and ``dheight`` multiplied with the value - set with this property. Setting ``1`` will resize to original video size - (or to be exact, the size the video filters output). ``2`` will set the - double size, ``0.5`` halves the size. - - Note that setting a value identical to its previous value will not resize - the window. That's because this property mirrors the ``window-scale`` - option, and setting an option to its previous value is ignored. If this - value is set while the window is in a fullscreen, the multiplier is not - applied until the window is taken out of that state. Writing this property - to a maximized window can unmaximize the window depending on the OS and - window manager. If the window does not unmaximize, the multiplier will be - applied if the user unmaximizes the window later. - - See ``current-window-scale`` for the value derived from the actual window - size. - - Since mpv 0.31.0, this always returns the previously set value (or the - default value), instead of the value implied by the actual window size. - Before mpv 0.31.0, this returned what ``current-window-scale`` returns now, - after the window was created. - ``current-window-scale`` (RW) The ``window-scale`` value calculated from the current window size. This has the same value as ``window-scale`` if the window size was not changed @@ -2722,10 +2698,9 @@ Property list calculated from the last non-fullscreen size of the window. The property is unavailable if no video is active. - When setting this property in the fullscreen or maximized state, the behavior - is the same as window-scale. In all other cases, setting the value of this - property will always resize the window. This does not affect the value of - ``window-scale``. + It is also possible to write to this property. This has the same behavior as + writing ``window-scale``. Note that writing to ``current-window-scale`` will + not affect the value of ``window-scale``. ``focused`` Whether the window has focus. Might not be supported by all VOs. diff --git a/DOCS/man/options.rst b/DOCS/man/options.rst index e3c05d44e8..bf1d55a294 100644 --- a/DOCS/man/options.rst +++ b/DOCS/man/options.rst @@ -3397,7 +3397,10 @@ Window ``--window-scale=`` Resize the video window to a multiple (or fraction) of the video size. This option is applied before ``--autofit`` and other options are applied (so - they override this option). + they override this option). Changing this option while the window is + maximized can unmaximize the window depending on the OS and window manager. + If the window does not unmaximize, the multiplier will be applied if the user + unmaximizes the window later. For example, ``--window-scale=0.5`` would show the window at half the video size. diff --git a/etc/input.conf b/etc/input.conf index 000f7ae650..80f1ceb2f3 100644 --- a/etc/input.conf +++ b/etc/input.conf @@ -117,9 +117,9 @@ #6 add gamma 1 #7 add saturation -1 #8 add saturation 1 -#Alt+0 set current-window-scale 0.5 # halve the window size -#Alt+1 set current-window-scale 1.0 # reset the window size -#Alt+2 set current-window-scale 2.0 # double the window size +#Alt+0 set window-scale 0.5 # halve the window size +#Alt+1 set window-scale 1.0 # reset the window size +#Alt+2 set window-scale 2.0 # double the window size #b cycle deband # toggle the debanding filter #d cycle deinterlace # cycle the deinterlacing filter #r add sub-pos -1 # move subtitles up diff --git a/options/options.c b/options/options.c index c059f4157d..8757ceeeff 100644 --- a/options/options.c +++ b/options/options.c @@ -128,7 +128,7 @@ static const m_option_t mp_vo_opt_list[] = { {"autofit-larger", OPT_SIZE_BOX(autofit_larger)}, {"autofit-smaller", OPT_SIZE_BOX(autofit_smaller)}, {"auto-window-resize", OPT_BOOL(auto_window_resize)}, - {"window-scale", OPT_DOUBLE(window_scale), M_RANGE(0.001, 100)}, + {"window-scale", OPT_DOUBLE(window_scale), M_RANGE(0.001, 100), .force_update = true}, {"window-minimized", OPT_BOOL(window_minimized)}, {"window-maximized", OPT_BOOL(window_maximized)}, {"focus-on-open", OPT_REMOVED("Replaced by --focus-on")},