Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions plugins/topbar/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down Expand Up @@ -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
Expand Down
Loading