summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-05-08 21:47:39 +0200
committerwm4 <wm4@nowhere>2015-05-08 21:47:39 +0200
commitf9e2d5026e4e9b0685137033dc08e2dc9034e5fc (patch)
tree7af4c8ba4f5f593df2a6a336785e145ac0ea3a67
parent00130651dac758f90bf98306a9d1e569ed4155ca (diff)
downloadmpv-f9e2d5026e4e9b0685137033dc08e2dc9034e5fc.tar.bz2
mpv-f9e2d5026e4e9b0685137033dc08e2dc9034e5fc.tar.xz
player: add --force-window=immediate mode
This creates the window before the first file is loaded. This was requested a bunch of times, but on the other hand a change to make this behavior the default was reverted some time ago, because other users hated it.
-rw-r--r--DOCS/man/options.rst6
-rw-r--r--options/options.c3
-rw-r--r--player/main.c2
3 files changed, 8 insertions, 3 deletions
diff --git a/DOCS/man/options.rst b/DOCS/man/options.rst
index e5da5fe536..0912c113f5 100644
--- a/DOCS/man/options.rst
+++ b/DOCS/man/options.rst
@@ -1586,7 +1586,7 @@ Window
file.mkv normally, then fail to open ``/dev/null``, then exit). (In
mpv 0.8.0, ``always`` was introduced, which restores the old behavior.)
-``--force-window``
+``--force-window=<yes|no|immediate>``
Create a video output window even if there is no video. This can be useful
when pretending that mpv is a GUI application. Currently, the window
always has the size 640x480, and is subject to ``--geometry``,
@@ -1598,7 +1598,9 @@ Window
window placement still works if the video size is different from the
``--force-window`` default window size). This can be a problem if
initialization doesn't work perfectly, such as when opening URLs with
- bad network connection, or opening broken video files.
+ bad network connection, or opening broken video files. The ``immediate``
+ mode can be used to create the window always on program start, but this
+ may cause other issues.
``--ontop``
Makes the player window stay on top of other windows.
diff --git a/options/options.c b/options/options.c
index a902360e56..c51a948db4 100644
--- a/options/options.c
+++ b/options/options.c
@@ -367,7 +367,8 @@ const m_option_t mp_opts[] = {
OPT_SETTINGSLIST("ao-defaults", ao_defs, 0, &ao_obj_list),
OPT_STRING("audio-device", audio_device, 0),
OPT_STRING("audio-client-name", audio_client_name, 0),
- OPT_FLAG("force-window", force_vo, 0),
+ OPT_CHOICE("force-window", force_vo, 0,
+ ({"no", 0}, {"yes", 1}, {"immediate", 2})),
OPT_FLAG("ontop", vo.ontop, M_OPT_FIXED),
OPT_FLAG("border", vo.border, M_OPT_FIXED),
OPT_FLAG("on-all-workspaces", vo.all_workspaces, M_OPT_FIXED),
diff --git a/player/main.c b/player/main.c
index cb7fda3e49..b80bc994bb 100644
--- a/player/main.c
+++ b/player/main.c
@@ -472,6 +472,8 @@ int mp_initialize(struct MPContext *mpctx, char **options)
"the selected video_out (-vo) device.\n");
return -1;
}
+ if (opts->force_vo == 2)
+ handle_force_window(mpctx, false);
mpctx->mouse_cursor_visible = true;
}