fix(window): 启动时把窗口夹进当前屏幕,修「画面被顶起来」
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 1m21s

用户两次反馈:底部工具栏跑到屏幕中间、左右栏底部被拉长。之前按「文档滚动」修过(html/body overflow:hidden),
仍复现 —— 说明不是滚动,而是**窗口本身比当前屏幕还高**:
src-tauri 的 restore_geom 会恢复上次窗口尺寸,只校验中心点是否落在某块显示器内,不夹尺寸。
换显示器 / 远程会话分辨率变小后,恢复出超大窗口 ⇒ 底部工具栏与侧栏底部落到屏幕外,看起来就是「被顶起来」。

改动:
- src-tauri/src/lib.rs:新增 clamp_geom(win, min_w, min_h) —— 取窗口中心所在显示器,
  把宽高夹到 屏幕尺寸-40px(不小于窗口下限),并把位置夹回屏幕内;
  restore_geom 末尾调用一次,无历史几何时在 setup 里也调用一次
- src/runtime-boot-load.js:启动时往 _boot.log 记一行 viewport/screen/dpr,
  下次再出现可直接判断是不是窗口比屏幕大
This commit is contained in:
qiqi committed 2026-11-28 00:31:33 +08:00
1 parent ab3833ade7
commit 0b46512667
3 files changed
+51 -1

No files matched your search

+2
View File
@@ -25,6 +25,8 @@
}
} catch (e) { /* ignore */ }
if (window.IWBBootProgress) window.IWBBootProgress.report('finalize', 1, 1)
// v3.26.109 诊断:记一次视口/屏幕尺寸,用来确认「画面被顶起来」是不是窗口比屏幕还高
try { const stg = (typeof window !== 'undefined') ? window.IWBStorageFile : null; if (stg && stg.logLine) stg.logLine('viewport ' + window.innerWidth + 'x' + window.innerHeight + ' screen ' + (screen && screen.width) + 'x' + (screen && screen.height) + ' dpr ' + window.devicePixelRatio) } catch (e) { /* ignore */ }
api('config').then((r) => { if (r && Array.isArray(r.providers)) setConfig(r) }).catch(() => setServer({ ok: false }))
api('prompts').then((r) => {
if (r && Array.isArray(r.prompts)) setPrompts(r.prompts)