summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--DOCS/interface-changes.rst1
-rw-r--r--DOCS/man/input.rst9
-rw-r--r--etc/input.conf6
-rw-r--r--player/command.c9
4 files changed, 21 insertions, 4 deletions
diff --git a/DOCS/interface-changes.rst b/DOCS/interface-changes.rst
index b4927470fa..ee84bc8f1c 100644
--- a/DOCS/interface-changes.rst
+++ b/DOCS/interface-changes.rst
@@ -42,6 +42,7 @@ Interface changes
instead be used to specifically set the contrast to any value.
- add a `--watch-later-options` option to allow configuring which
options quit-watch-later saves
+ - make `current-window-scale` writeable and use it in the default input.conf
--- mpv 0.33.0 ---
- add `--d3d11-exclusive-fs` flag to enable D3D11 exclusive fullscreen mode
when the player enters fullscreen.
diff --git a/DOCS/man/input.rst b/DOCS/man/input.rst
index 75841dba99..3f59eb957b 100644
--- a/DOCS/man/input.rst
+++ b/DOCS/man/input.rst
@@ -2525,6 +2525,10 @@ Property list
(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.
+
See ``current-window-scale`` for the value derived from the actual window
size.
@@ -2533,12 +2537,15 @@ Property list
Before mpv 0.31.0, this returned what ``current-window-scale`` returns now,
after the window was created.
-``current-window-scale``
+``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
since setting the option, and the window size was not restricted in other
ways. The property is unavailable if no video is active.
+ Setting the value of this property will always resize the window
+ accordingly if possible, without affecting the value of ``window-scale``.
+
``focused``
Whether the window has focus. Might not be supported by all VOs.
diff --git a/etc/input.conf b/etc/input.conf
index 63da217f3c..f84c0b7fca 100644
--- a/etc/input.conf
+++ b/etc/input.conf
@@ -118,9 +118,9 @@
#6 add gamma 1
#7 add saturation -1
#8 add saturation 1
-#Alt+0 set window-scale 0.5
-#Alt+1 set window-scale 1.0
-#Alt+2 set window-scale 2.0
+#Alt+0 set current-window-scale 0.5
+#Alt+1 set current-window-scale 1.0
+#Alt+2 set current-window-scale 2.0
# toggle deinterlacer (automatically inserts or removes required filter)
#d cycle deinterlace
#r add sub-pos -1 # move subtitles up
diff --git a/player/command.c b/player/command.c
index 5119857986..02a008ef57 100644
--- a/player/command.c
+++ b/player/command.c
@@ -2330,6 +2330,15 @@ static int mp_property_current_window_scale(void *ctx, struct m_property *prop,
if (vid_w < 1 || vid_h < 1)
return M_PROPERTY_UNAVAILABLE;
+ if (action == M_PROPERTY_SET) {
+ double scale = *(double *)arg;
+ int s[2] = {vid_w * scale, vid_h * scale};
+ if (s[0] <= 0 || s[1] <= 0)
+ return M_PROPERTY_INVALID_FORMAT;
+ vo_control(vo, VOCTRL_SET_UNFS_WINDOW_SIZE, s);
+ return M_PROPERTY_OK;
+ }
+
int s[2];
if (vo_control(vo, VOCTRL_GET_UNFS_WINDOW_SIZE, s) <= 0 ||
s[0] < 1 || s[1] < 1)