From ee24dd04194aadfda882fd73553cba8d1e734567 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kacper=20Michaj=C5=82ow?= Date: Sun, 19 Mar 2023 06:38:32 +0100 Subject: [PATCH] win32: add an option to control window title bar state Fixes: #11432 --- DOCS/interface-changes.rst | 1 + DOCS/man/options.rst | 6 ++++++ options/options.c | 2 ++ options/options.h | 1 + video/out/w32_common.c | 6 +++++- 5 files changed, 15 insertions(+), 1 deletion(-) diff --git a/DOCS/interface-changes.rst b/DOCS/interface-changes.rst index f5a5711b9d..ad0e059ef1 100644 --- a/DOCS/interface-changes.rst +++ b/DOCS/interface-changes.rst @@ -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. diff --git a/DOCS/man/options.rst b/DOCS/man/options.rst index 2cae12e5f2..8e59ac1dbc 100644 --- a/DOCS/man/options.rst +++ b/DOCS/man/options.rst @@ -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. diff --git a/options/options.c b/options/options.c index c53183a6ec..357f043404 100644 --- a/options/options.c +++ b/options/options.c @@ -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, diff --git a/options/options.h b/options/options.h index a272f46916..ce676840ed 100644 --- a/options/options.h +++ b/options/options.h @@ -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; diff --git a/video/out/w32_common.c b/video/out/w32_common.c index 4861d97cc0..a8794b89c9 100644 --- a/video/out/w32_common.c +++ b/video/out/w32_common.c @@ -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) {