fix(desktop): align Windows window borders

This commit is contained in:
Freedom 2026-07-22 13:28:41 +08:00 committed by GitHub
parent 5528f4e223
commit 4e68cd84cc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 11 additions and 8 deletions

View File

@ -45,7 +45,7 @@ import { sqlObjectNavigationSourceKind, sqlObjectNavigationTableType, type SqlOb
import { buildExecutableObjectSourceStatements, executeObjectSourceSave } from "@/lib/table/objectSourceEditor";
import { resolveExecutableSql, resolveExecutableSqlWithBackend, type SqlExecutionSnapshot } from "@/lib/sql/sqlExecutionTarget";
import { uuid } from "@/lib/common/utils";
import { isMacOS } from "@/lib/backend/platform";
import { isMacOS, isWindows } from "@/lib/backend/platform";
import { isTauriRuntime } from "@/lib/backend/tauriRuntime";
import { openQueryResultArchiveFile } from "@/lib/query/queryResultArchiveFile";
import { sqlFileTitleFromPath } from "@/lib/sql/sqlFileOpen";
@ -152,7 +152,7 @@ const {
const { setupFileDrop } = useFileDrop();
const isDesktop = isTauriRuntime();
const drawDesktopWindowFrame = shouldDrawDesktopWindowFrame(isMacOS(), isDesktop);
const drawDesktopWindowFrame = shouldDrawDesktopWindowFrame(isMacOS(), isDesktop, isWindows());
const UPDATE_CHECK_INTERVAL_MS = 60 * 60 * 1000;
let updateCheckTimer: ReturnType<typeof setInterval> | undefined;
const needsAuth = ref(!isDesktop);

View File

@ -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", () => {

View File

@ -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() {