From 0ace1393f025d47173d7ee8d7a94afbe52f1c3a0 Mon Sep 17 00:00:00 2001 From: barkly1te <219408398+barkly1te@users.noreply.github.com> Date: Mon, 23 Nov 2026 18:56:49 +0800 Subject: [PATCH] [bugfix] desktop: keep the welcome language selector below window controls --- apps/desktop/scripts/smoke-window.mjs | 22 ++++++++++++++++++++++ src/canvas/welcome-screen.css | 10 +++++++--- 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/apps/desktop/scripts/smoke-window.mjs b/apps/desktop/scripts/smoke-window.mjs index 46de96d55..1cb6e35b0 100644 --- a/apps/desktop/scripts/smoke-window.mjs +++ b/apps/desktop/scripts/smoke-window.mjs @@ -14,6 +14,9 @@ export async function smokeWindow({ window, host, getLocale }) { })()`); if (result.health.status !== 'ok' || result.projects !== 200 || !result.isolated || !result.bridge) throw new Error('Desktop smoke failed'); await waitFor(() => window.webContents.executeJavaScript('document.querySelectorAll("button").length > 2'), 'Workbench did not become interactive'); + if (process.platform === 'win32' && await window.webContents.executeJavaScript('!localStorage.getItem("opendirector.modelSetup.v1")')) { + await checkWindowsWelcomeCaption(window); + } await window.webContents.executeJavaScript('document.querySelector(".cw-welcome-secondary")?.click()'); await waitFor(() => window.webContents.executeJavaScript('!!document.querySelector(".react-flow") && !!document.querySelector(".cw-save-status i.saved")'), 'Canvas did not open'); result.projectIds = await waitFor(() => window.webContents.executeJavaScript(`fetch('/api/creation/projects', {headers: {'X-OpenDirector-Request': '1'}}) @@ -320,6 +323,25 @@ async function droppedMediaState(window, projectId, fingerprints) { })()`); } +async function checkWindowsWelcomeCaption(window) { + const originalBounds = window.getBounds(); + const [minWidth] = window.getMinimumSize(); + try { + window.setSize(minWidth, originalBounds.height); + const bounds = await waitFor(() => window.webContents.executeJavaScript(`(() => { + const overlay = navigator.windowControlsOverlay; + const language = document.querySelector('dialog.cw-welcome[open] .cw-welcome-language'); + if (innerWidth > ${minWidth} || !overlay?.visible || !language) return null; + return { captionBottom: overlay.getTitlebarAreaRect().bottom, languageTop: language.getBoundingClientRect().top }; + })()`), 'Windows welcome or caption did not appear at minimum width'); + if (bounds.languageTop < bounds.captionBottom) { + throw new Error(`Window controls overlap the welcome language selector: ${JSON.stringify(bounds)}`); + } + } finally { + window.setBounds(originalBounds); + } +} + async function checkWindowsCaption(window) { if (window.isMenuBarVisible()) throw new Error('Windows application menu is visible'); let bounds; diff --git a/src/canvas/welcome-screen.css b/src/canvas/welcome-screen.css index 3c1dce4e6..652d54229 100644 --- a/src/canvas/welcome-screen.css +++ b/src/canvas/welcome-screen.css @@ -1,9 +1,10 @@ .cw-welcome { + --cw-welcome-titlebar-inset: 0px; position: fixed; - inset: 0; + inset: var(--cw-welcome-titlebar-inset) 0 0; box-sizing: border-box; width: 100vw; - height: 100dvh; + height: calc(100dvh - var(--cw-welcome-titlebar-inset)); max-width: none; max-height: none; margin: 0; @@ -14,6 +15,9 @@ color: var(--settings-text); font: 14px Inter, -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif; } +html[data-desktop-platform="win32"]:not([data-desktop-fullscreen]) .cw-welcome { + --cw-welcome-titlebar-inset: max(var(--desktop-toolbar-height), calc(env(titlebar-area-y, 0px) + env(titlebar-area-height, 0px))); +} .cw-welcome::backdrop { background: var(--settings-background); } .cw-welcome-shell { width: min(100% - 48px, 860px); margin: 0 auto; } .cw-welcome-brand { @@ -59,7 +63,7 @@ align-items: center; gap: clamp(24px, 5vw, 72px); box-sizing: border-box; - min-height: calc(100dvh - 85px); + min-height: calc(100dvh - var(--cw-welcome-titlebar-inset) - 85px); padding: 48px 0 78px; } .cw-welcome-intro-copy h1 { font-size: clamp(32px, 4.2vw, 52px); text-wrap: balance; }