From 7e22ed2d484118a72cce8f52f7ddc053096ea5fc Mon Sep 17 00:00:00 2001 From: Kira-NT Date: Wed, 19 Aug 2026 22:15:08 +0100 Subject: [PATCH] win-capture: Improve fullscreen window detection It's not that uncommon for apps on Windows to use a hacky method of extending their windows 1-2px past the supported monitor resolution to preserve "true" windowed fullscreen and circumvent some exclusive fullscreen-related issues presented by their graphics library, Windows itself, or both. Therefore, the fullscreen detection technique has been relaxed to properly identify windows slightly larger than the monitor's viewport as fullscreen. Windows also does something similar, evident by the fact that the taskbar disappears, as it always does for fullscreen windows, even when a window stretches slightly beyond the defined viewport. --- plugins/win-capture/game-capture.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/plugins/win-capture/game-capture.c b/plugins/win-capture/game-capture.c index 3bf12ef3d..369e2ca92 100644 --- a/plugins/win-capture/game-capture.c +++ b/plugins/win-capture/game-capture.c @@ -1104,6 +1104,12 @@ static void setup_window(struct game_capture *gc, HWND window) } } +static int rects_nearly_equal(RECT first, RECT second, long delta) +{ + return abs(first.left - second.left) <= delta && abs(first.right - second.right) <= delta && + abs(first.top - second.top) <= delta && abs(first.bottom - second.bottom) <= delta; +} + static void get_fullscreen_window(struct game_capture *gc) { HWND window = GetForegroundWindow(); @@ -1137,8 +1143,11 @@ static void get_fullscreen_window(struct game_capture *gc) return; } - if (rect.left == mi.rcMonitor.left && rect.right == mi.rcMonitor.right && rect.bottom == mi.rcMonitor.bottom && - rect.top == mi.rcMonitor.top) { + /* Some apps extend their windows 1-2 pixels beyond the monitor's supported resolution to circumvent certain + * exclusive fullscreen-related issues caused either by their graphics library, Windows itself, or both. Thus, + * we compare the window's corner coordinates with those of the monitor using an acceptable relative margin of + * 2, allowing it to extend slightly past the edge of the monitor. */ + if (rects_nearly_equal(rect, mi.rcMonitor, 2)) { setup_window(gc, window); } else { gc->wait_for_target_startup = true;