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.
This commit is contained in:
wm4 2015-05-08 21:47:39 +02:00
parent 00130651da
commit f9e2d5026e
3 changed files with 8 additions and 3 deletions

View File

@ -1586,7 +1586,7 @@ Window
file.mkv normally, then fail to open ``/dev/null``, then exit). (In file.mkv normally, then fail to open ``/dev/null``, then exit). (In
mpv 0.8.0, ``always`` was introduced, which restores the old behavior.) 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 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 when pretending that mpv is a GUI application. Currently, the window
always has the size 640x480, and is subject to ``--geometry``, 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 window placement still works if the video size is different from the
``--force-window`` default window size). This can be a problem if ``--force-window`` default window size). This can be a problem if
initialization doesn't work perfectly, such as when opening URLs with 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`` ``--ontop``
Makes the player window stay on top of other windows. Makes the player window stay on top of other windows.

View File

@ -367,7 +367,8 @@ const m_option_t mp_opts[] = {
OPT_SETTINGSLIST("ao-defaults", ao_defs, 0, &ao_obj_list), OPT_SETTINGSLIST("ao-defaults", ao_defs, 0, &ao_obj_list),
OPT_STRING("audio-device", audio_device, 0), OPT_STRING("audio-device", audio_device, 0),
OPT_STRING("audio-client-name", audio_client_name, 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("ontop", vo.ontop, M_OPT_FIXED),
OPT_FLAG("border", vo.border, M_OPT_FIXED), OPT_FLAG("border", vo.border, M_OPT_FIXED),
OPT_FLAG("on-all-workspaces", vo.all_workspaces, M_OPT_FIXED), OPT_FLAG("on-all-workspaces", vo.all_workspaces, M_OPT_FIXED),

View File

@ -472,6 +472,8 @@ int mp_initialize(struct MPContext *mpctx, char **options)
"the selected video_out (-vo) device.\n"); "the selected video_out (-vo) device.\n");
return -1; return -1;
} }
if (opts->force_vo == 2)
handle_force_window(mpctx, false);
mpctx->mouse_cursor_visible = true; mpctx->mouse_cursor_visible = true;
} }