From 87f5bd6e9fbfd836d4663b134592fe5a0138196e Mon Sep 17 00:00:00 2001 From: jp9000 Date: Sat, 7 Mar 2020 07:31:29 -0800 Subject: [PATCH] win-capture/graphics-hook: Fix wrong HWND Game capture assumes the top-level ancestor HWND, not a child HWND. This fixes bugs such as the VLC window not capturing anymore due to the fact that the capture HWND of VLC is a child window of the main VLC window and not the main VLC window itself. --- plugins/win-capture/graphics-hook/graphics-hook.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plugins/win-capture/graphics-hook/graphics-hook.c b/plugins/win-capture/graphics-hook/graphics-hook.c index d85495cde..6855951d3 100644 --- a/plugins/win-capture/graphics-hook/graphics-hook.c +++ b/plugins/win-capture/graphics-hook/graphics-hook.c @@ -506,8 +506,10 @@ static inline void unlock_shmem_tex(int id) static inline bool init_shared_info(size_t size, HWND window) { wchar_t name[64]; + HWND top = GetAncestor(window, GA_ROOT); + swprintf(name, 64, SHMEM_TEXTURE "_%" PRIu64 "_%u", - (uint64_t)(uintptr_t)window, ++shmem_id_counter); + (uint64_t)(uintptr_t)top, ++shmem_id_counter); shmem_file_handle = CreateFileMappingW(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, (DWORD)size,