summaryrefslogtreecommitdiffstats
path: root/video/out/w32_common.c
diff options
context:
space:
mode:
authorDeadSix <DeadSix27@users.noreply.github.com>2023-09-21 23:13:07 +0200
committerDudemanguy <random342@airmail.cc>2023-09-21 22:14:28 +0000
commit2c738ca54b16cdd1982473672bd39068fcf8d948 (patch)
tree67fc735491ccd41a74311c4cd21cb1d0b7bbbb13 /video/out/w32_common.c
parent4c39e79169f666c1ba6075c1dd66184190eee328 (diff)
downloadmpv-2c738ca54b16cdd1982473672bd39068fcf8d948.tar.bz2
mpv-2c738ca54b16cdd1982473672bd39068fcf8d948.tar.xz
win32: add an option to change window affinity
Diffstat (limited to 'video/out/w32_common.c')
-rw-r--r--video/out/w32_common.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/video/out/w32_common.c b/video/out/w32_common.c
index b3ad949794..4861d97cc0 100644
--- a/video/out/w32_common.c
+++ b/video/out/w32_common.c
@@ -963,6 +963,16 @@ static bool is_visible(HWND window)
return GetWindowLongPtrW(window, GWL_STYLE) & WS_VISIBLE;
}
+//Set the mpv window's affinity.
+//This will affect how it's displayed on the desktop and in system-level operations like taking screenshots.
+static void update_affinity(struct vo_w32_state *w32)
+{
+ if (!w32 || w32->parent) {
+ return;
+ }
+ SetWindowDisplayAffinity(w32->window, w32->opts->window_affinity);
+}
+
static void update_window_state(struct vo_w32_state *w32)
{
if (w32->parent)
@@ -1612,6 +1622,8 @@ static void *gui_thread(void *ptr)
}
update_dark_mode(w32);
+ if (w32->opts->window_affinity)
+ update_affinity(w32);
if (SUCCEEDED(OleInitialize(NULL))) {
ole_ok = true;
@@ -1786,6 +1798,8 @@ static int gui_thread_control(struct vo_w32_state *w32, int request, void *arg)
if (changed_option == &vo_opts->fullscreen) {
reinit_window_state(w32);
+ } else if (changed_option == &vo_opts->window_affinity) {
+ update_affinity(w32);
} else if (changed_option == &vo_opts->ontop) {
update_window_state(w32);
} else if (changed_option == &vo_opts->border) {