summaryrefslogtreecommitdiffstats
path: root/video/out
diff options
context:
space:
mode:
authornanahi <130121847+na-na-hi@users.noreply.github.com>2024-04-13 00:15:56 -0400
committerKacper Michajłow <kasper93@gmail.com>2024-04-18 00:09:09 +0200
commit8c614e0df52f87b9c0b559abb47e62cad4ace057 (patch)
treeb1518881c3f5d4febbfcf69f24142d8fed5d6d99 /video/out
parentdcd10345291a3ecd573decc5125de243bcb1351b (diff)
downloadmpv-8c614e0df52f87b9c0b559abb47e62cad4ace057.tar.bz2
mpv-8c614e0df52f87b9c0b559abb47e62cad4ace057.tar.xz
w32_common: implement --show-in-taskbar option
When the window style changes, use WS_EX_TOOLWINDOW style to exclude the window from the taskbar and Alt+Tab switching.
Diffstat (limited to 'video/out')
-rw-r--r--video/out/w32_common.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/video/out/w32_common.c b/video/out/w32_common.c
index 36f48b9be7..6d89355a70 100644
--- a/video/out/w32_common.c
+++ b/video/out/w32_common.c
@@ -954,6 +954,14 @@ static DWORD update_style(struct vo_w32_state *w32, DWORD style)
return style;
}
+static DWORD update_exstyle(struct vo_w32_state *w32, DWORD exstyle)
+{
+ exstyle &= ~(WS_EX_TOOLWINDOW);
+ if (!w32->opts->show_in_taskbar)
+ exstyle |= WS_EX_TOOLWINDOW;
+ return exstyle;
+}
+
static void update_window_style(struct vo_w32_state *w32)
{
if (w32->parent)
@@ -963,7 +971,9 @@ static void update_window_style(struct vo_w32_state *w32)
// has to be saved now and restored after setting the new style.
const RECT wr = w32->windowrc;
const DWORD style = GetWindowLongPtrW(w32->window, GWL_STYLE);
+ const DWORD exstyle = GetWindowLongPtrW(w32->window, GWL_EXSTYLE);
SetWindowLongPtrW(w32->window, GWL_STYLE, update_style(w32, style));
+ SetWindowLongPtrW(w32->window, GWL_EXSTYLE, update_exstyle(w32, exstyle));
w32->windowrc = wr;
}
@@ -2172,7 +2182,8 @@ static int gui_thread_control(struct vo_w32_state *w32, int request, void *arg)
} else if (changed_option == &vo_opts->cursor_passthrough) {
update_cursor_passthrough(w32);
} else if (changed_option == &vo_opts->border ||
- changed_option == &vo_opts->title_bar)
+ changed_option == &vo_opts->title_bar ||
+ changed_option == &vo_opts->show_in_taskbar)
{
update_window_style(w32);
update_window_state(w32);