From 4b459f111ce4c4ef0f1fc5e45e41331d1eef9505 Mon Sep 17 00:00:00 2001 From: qhy040404 Date: Wed, 26 Jun 2024 10:58:24 +0800 Subject: [PATCH] libobs: Also determine WinUI 3 Window --- libobs/util/windows/window-helpers.c | 6 ++++-- plugins/win-capture/data/compatibility.json | 14 ++++++++++++++ plugins/win-capture/window-capture.c | 1 + 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/libobs/util/windows/window-helpers.c b/libobs/util/windows/window-helpers.c index 1828c98b131c91..919d6e275c8499 100644 --- a/libobs/util/windows/window-helpers.c +++ b/libobs/util/windows/window-helpers.c @@ -326,7 +326,8 @@ bool ms_is_uwp_window(HWND hwnd) if (!GetClassNameW(hwnd, name, sizeof(name) / sizeof(wchar_t))) return false; - return wcscmp(name, L"ApplicationFrameWindow") == 0; + return wcscmp(name, L"ApplicationFrameWindow") == 0 || + wcscmp(name, L"WinUIDesktopWin32WindowClass") == 0; } HWND ms_get_uwp_actual_window(HWND parent) @@ -499,7 +500,8 @@ static bool is_generic_class(const char *current_class) static bool is_uwp_class(const char *window_class) { - return strcmp(window_class, "Windows.UI.Core.CoreWindow") == 0; + return strcmp(window_class, "Windows.UI.Core.CoreWindow") == 0 || + strcmp(window_class, "WinUIDesktopWin32WindowClass") == 0; } HWND ms_find_window(enum window_search_mode mode, enum window_priority priority, diff --git a/plugins/win-capture/data/compatibility.json b/plugins/win-capture/data/compatibility.json index aa839d7fd0a403..a0e228415d68a4 100644 --- a/plugins/win-capture/data/compatibility.json +++ b/plugins/win-capture/data/compatibility.json @@ -114,6 +114,20 @@ "message": "UWP applications may not be capturable using the selected Capture Method (BitBlt).", "url": "" }, + { + "name": "WinUI 3", + "translation_key": "Compatibility.WindowCapture.BitBlt.Applications", + "severity": 0, + "executable": "", + "window_class": "WinUIDesktopWin32WindowClass", + "window_title": "", + "match_flags": 4, + "game_capture": false, + "window_capture": true, + "window_capture_wgc": false, + "message": "WinUI 3 applications may not be capturable using the selected Capture Method (BitBlt).", + "url": "" + }, { "name": "Gaming Services", "translation_key": "Compatibility.WindowCapture.BitBlt.Applications", diff --git a/plugins/win-capture/window-capture.c b/plugins/win-capture/window-capture.c index 7166e0b59b14ef..eb540016a4191d 100644 --- a/plugins/win-capture/window-capture.c +++ b/plugins/win-capture/window-capture.c @@ -126,6 +126,7 @@ static const char *wgc_partial_match_classes[] = { static const char *wgc_whole_match_classes[] = { "ApplicationFrameWindow", "Windows.UI.Core.CoreWindow", + "WinUIDesktopWin32WindowClass", "GAMINGSERVICESUI_HOSTING_WINDOW_CLASS", "XLMAIN", /* Microsoft Excel */ "PPTFrameClass", /* Microsoft PowerPoint */