summaryrefslogtreecommitdiffstats
path: root/video
diff options
context:
space:
mode:
authornanahi <130121847+na-na-hi@users.noreply.github.com>2023-12-25 09:02:54 -0500
committerDudemanguy <random342@airmail.cc>2023-12-28 15:45:24 +0000
commit26df531b149e49f5897a36f87ba54a0d21fb5e34 (patch)
treeb8398a4d1b7efff8b7db6d9218486a6015f9a98c /video
parent579349b21cefba50cdd7993efcdcf958378f7007 (diff)
downloadmpv-26df531b149e49f5897a36f87ba54a0d21fb5e34.tar.bz2
mpv-26df531b149e49f5897a36f87ba54a0d21fb5e34.tar.xz
win32: add support for --input-cursor-passthrough option
This completes the support for all supported desktop platforms.
Diffstat (limited to 'video')
-rw-r--r--video/out/w32_common.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/video/out/w32_common.c b/video/out/w32_common.c
index e15ead8f68..d04119664f 100644
--- a/video/out/w32_common.c
+++ b/video/out/w32_common.c
@@ -1204,6 +1204,23 @@ static void update_backdrop(const struct vo_w32_state *w32)
&backdropType, sizeof(backdropType));
}
+static void update_cursor_passthrough(const struct vo_w32_state *w32)
+{
+ if (w32->parent)
+ return;
+
+ LONG_PTR exstyle = GetWindowLongPtrW(w32->window, GWL_EXSTYLE);
+ if (exstyle) {
+ if (w32->opts->cursor_passthrough) {
+ SetWindowLongPtrW(w32->window, GWL_EXSTYLE, exstyle | WS_EX_LAYERED | WS_EX_TRANSPARENT);
+ // This is required, otherwise the titlebar disappears.
+ SetLayeredWindowAttributes(w32->window, 0, 255, LWA_ALPHA);
+ } else {
+ SetWindowLongPtrW(w32->window, GWL_EXSTYLE, exstyle & ~(WS_EX_LAYERED | WS_EX_TRANSPARENT));
+ }
+ }
+}
+
static LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam,
LPARAM lParam)
{
@@ -1802,6 +1819,8 @@ static MP_THREAD_VOID gui_thread(void *ptr)
update_affinity(w32);
if (w32->opts->backdrop_type)
update_backdrop(w32);
+ if (w32->opts->cursor_passthrough)
+ update_cursor_passthrough(w32);
if (SUCCEEDED(OleInitialize(NULL))) {
ole_ok = true;
@@ -1982,6 +2001,8 @@ static int gui_thread_control(struct vo_w32_state *w32, int request, void *arg)
update_window_state(w32);
} else if (changed_option == &vo_opts->backdrop_type) {
update_backdrop(w32);
+ } 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)
{