From 4e68cd84cc53d0cb572d7b42b726f3a5b8dc08fa Mon Sep 17 00:00:00 2001 From: Freedom <48708512+xddcode@users.noreply.github.com> Date: Wed, 22 Jul 2026 13:28:41 +0800 Subject: [PATCH] fix(desktop): align Windows window borders --- apps/desktop/src/App.vue | 4 ++-- .../src/composables/__tests__/useWindowControls.spec.ts | 9 +++++---- apps/desktop/src/composables/useWindowControls.ts | 6 ++++-- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/apps/desktop/src/App.vue b/apps/desktop/src/App.vue index 9a6641f2a..5a4bbd670 100644 --- a/apps/desktop/src/App.vue +++ b/apps/desktop/src/App.vue @@ -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 | undefined; const needsAuth = ref(!isDesktop); diff --git a/apps/desktop/src/composables/__tests__/useWindowControls.spec.ts b/apps/desktop/src/composables/__tests__/useWindowControls.spec.ts index e1c0068d5..b0bc7c411 100644 --- a/apps/desktop/src/composables/__tests__/useWindowControls.spec.ts +++ b/apps/desktop/src/composables/__tests__/useWindowControls.spec.ts @@ -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", () => { diff --git a/apps/desktop/src/composables/useWindowControls.ts b/apps/desktop/src/composables/useWindowControls.ts index 4a8be83dd..c1aeb2a86 100644 --- a/apps/desktop/src/composables/useWindowControls.ts +++ b/apps/desktop/src/composables/useWindowControls.ts @@ -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() {