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;