fix(desktop): align Windows window borders

This commit is contained in:
Freedom authored and GitHub committed 2026-07-22 13:28:41 +08:00
1 parent 5528f4e223
commit 4e68cd84cc
3 files changed
+11 -8

No files matched your search

@@ -14,10 +14,11 @@ describe("window controls", () => {
expect(shouldShowWindowControls(false, false)).toBe(false);
});
it("draws an app frame only for self-decorated desktop windows", () => {
expect(shouldDrawDesktopWindowFrame(false, true)).toBe(true);
expect(shouldDrawDesktopWindowFrame(true, true)).toBe(false);
expect(shouldDrawDesktopWindowFrame(false, false)).toBe(false);
it("draws an app frame only for self-decorated non-Windows desktop windows", () => {
expect(shouldDrawDesktopWindowFrame(false, true, false)).toBe(true);
expect(shouldDrawDesktopWindowFrame(false, true, true)).toBe(false);
expect(shouldDrawDesktopWindowFrame(true, true, false)).toBe(false);
expect(shouldDrawDesktopWindowFrame(false, false, false)).toBe(false);
});
it("reserves traffic light inset only for non-fullscreen macOS desktop windows", () => {
@@ -35,8 +35,10 @@ export function shouldShowWindowControls(isMac: boolean, isDesktop = true): bool
return isDesktop && !isMac;
}
export function shouldDrawDesktopWindowFrame(isMac: boolean, isDesktop = true): boolean {
return isDesktop && !isMac;
export function shouldDrawDesktopWindowFrame(isMac: boolean, isDesktop = true, isWindows = false): boolean {
// Windows frameless+shadow windows already get a DWM 1px border on all sides.
// An extra CSS top hairline stacks on that edge and no longer matches left/right/bottom.
return isDesktop && !isMac && !isWindows;
}
export function useWindowControls() {