From 514e56509c9fbfe837b948f36040e89d03df99b8 Mon Sep 17 00:00:00 2001 From: 2sulraw <2sulraw@gmail.com> Date: Thu, 26 Nov 2026 20:09:46 +0330 Subject: [PATCH] topbar: a caption-style game covering the monitor is fullscreen, not only an exact match --- plugins/topbar/src/main.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/plugins/topbar/src/main.rs b/plugins/topbar/src/main.rs index 96471a6..1c9e6fa 100644 --- a/plugins/topbar/src/main.rs +++ b/plugins/topbar/src/main.rs @@ -1586,10 +1586,11 @@ unsafe fn fullscreen_now(bar: HWND) -> bool { } /// A framed maximized window overhangs the monitor by its border and is not fullscreen (#88); but a game in "borderless -/// window" mode that keeps its caption style while sized exactly to the monitor (Dota 2 and others) is. +/// window" mode that keeps its caption style while sized to the monitor (SDL, GLFW, Dota 2 and others) is. Such a window +/// can sit a pixel past the monitor edge (Minecraft: 1921 wide on a 1920 monitor), so it has to "cover", not "equal". fn covers_monitor(r: RECT, m: RECT, caption: bool, zoomed: bool) -> bool { - if caption { - return !zoomed && (r.left, r.top, r.right, r.bottom) == (m.left, m.top, m.right, m.bottom); + if caption && zoomed { + return false; // a framed maximized window: not a game (#88) } r.left <= m.left && r.top <= m.top && r.right >= m.right && r.bottom >= m.bottom } @@ -3272,6 +3273,8 @@ mod tests { let m = RECT { left: 0, top: 0, right: 1920, bottom: 1080 }; assert!(covers_monitor(m, m, false, false)); // plain borderless / exclusive fullscreen assert!(covers_monitor(m, m, true, false)); // borderless window that kept its caption style + // Minecraft (SDL_app): caption style, not maximized, sized one pixel past the monitor — still fullscreen + assert!(covers_monitor(RECT { left: 0, top: 0, right: 1921, bottom: 1080 }, m, true, false)); assert!(!covers_monitor(RECT { left: -8, top: -8, right: 1928, bottom: 1088 }, m, true, true)); // framed maximized window (#88) assert!(!covers_monitor(m, m, true, true)); // a maximized window is never a game assert!(!covers_monitor(RECT { left: 0, top: 0, right: 1920, bottom: 1032 }, m, false, false)); // leaves the bar's strip