1
0
mirror of https://github.com/mpv-player/mpv synced 2024-12-26 17:12:36 +00:00

win32: add an option to control window title bar state

Fixes: #11432
This commit is contained in:
Kacper Michajłow 2023-03-19 06:38:32 +01:00 committed by Dudemanguy
parent 2c738ca54b
commit ee24dd0419
5 changed files with 15 additions and 1 deletions

View File

@ -87,6 +87,7 @@ Interface changes
- remove deprecated `--vf-defaults` and `--af-defaults` options
- `--drm-connector` no longer allows selecting the card number (use `--drm-device`
instead)
- add `--title-bar` option
--- mpv 0.36.0 ---
- add `--target-contrast`
- Target luminance value is now also applied when ICC profile is used.

View File

@ -3135,6 +3135,12 @@ Window
Play video with window border and decorations. Since this is on by
default, use ``--no-border`` to disable the standard window decorations.
``--title-bar``, ``--no-title-bar``
(Windows only)
Play video with the window title bar. Since this is on by default,
use --no-title-bar to hide the title bar. The --no-border option takes
precedence.
``--on-all-workspaces``
(X11 and macOS only)
Show the video window on all virtual desktops.

View File

@ -114,6 +114,7 @@ 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_BOOL(border)},
{"title-bar", OPT_BOOL(title_bar)},
{"on-all-workspaces", OPT_BOOL(all_workspaces)},
{"geometry", OPT_GEOMETRY(geometry)},
{"autofit", OPT_SIZE_BOX(autofit)},
@ -216,6 +217,7 @@ const struct m_sub_options vo_sub_opts = {
.native_fs = true,
.taskbar_progress = true,
.border = true,
.title_bar = true,
.appid = "mpv",
.content_type = -1,
.WinID = -1,

View File

@ -16,6 +16,7 @@ typedef struct mp_vo_opts {
int ontop_level;
bool fullscreen;
bool border;
bool title_bar;
bool all_workspaces;
bool window_minimized;
bool window_maximized;

View File

@ -805,6 +805,8 @@ static DWORD update_style(struct vo_w32_state *w32, DWORD style)
style |= FULLSCREEN;
} else {
style |= w32->opts->border ? FRAME : NO_FRAME;
if (!w32->opts->title_bar)
style &= ~WS_CAPTION;
}
return style;
}
@ -1802,7 +1804,9 @@ static int gui_thread_control(struct vo_w32_state *w32, int request, void *arg)
update_affinity(w32);
} else if (changed_option == &vo_opts->ontop) {
update_window_state(w32);
} else if (changed_option == &vo_opts->border) {
} else if (changed_option == &vo_opts->border ||
changed_option == &vo_opts->title_bar)
{
update_window_style(w32);
update_window_state(w32);
} else if (changed_option == &vo_opts->window_minimized) {