Skip to content

fix(desktop): restore titlebar dragging for zoomed macOS windows - #2583

Merged
vastsa merged 4 commits into
vastsa:mainfrom
Linuxdazhao:codex/macos-zoomed-titlebar-drag
Nov 28, 2026
Merged

vastsa merged 4 commits into
vastsa:mainfrom
Linuxdazhao:codex/macos-zoomed-titlebar-drag

Conversation

@Linuxdazhao

@Linuxdazhao Linuxdazhao commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

概要

Closes #2582

macOS 主窗口执行 Zoom 后,原有样式会把整个窗口切成 no-drag。拖动聊天顶栏空白处时,系统收不到标题栏拖动手势,用户只能先还原,再移动窗口。

移除针对最大化状态的全局样式、专用的渲染层双击监听和它们使用的 CSS 标记。普通和缩放窗口共用现有的原生拖动区域,按钮继续保留自己的点击区域,标题栏双击遵循 macOS 系统设置。保留 #2561 对原生全屏切换后窗口状态广播的修复,并单独覆盖其事件、延时校正和清理。

验证

macOS 27.2.1 arm64,锁定 Electron 43.6.0。

Chromium 计算样式,非全屏 Zoom 修复前 修复后
主标题栏、聊天顶栏 no-drag drag
顶栏按钮 no-drag no-drag

回归测试在基线上失败,在候选代码上通过。使用编译后的样式重新检查了普通和 Zoom 两种状态。52 项相关测试通过;桌面构建、类型检查、样式检查和 PR 基线检查通过。

在候选提交 e7f6c0e6e 上运行了两项 macOS Electron E2E:

  • node scripts/e2e-window-native-behavior.mjs 通过。透明和不透明窗口在 Zoom 后都报告可移动,执行还原后,原位置和尺寸均恢复。
  • node scripts/e2e-window-controls.mjs 通过。真实桌面窗口退出原生全屏后,渲染层收到明确的 fullscreen === "false",主进程报告 maximized === true。在此状态下脚本从可见顶栏找到原生拖动区域,工作面板按钮为 no-drag,随后成功还原窗口。

样式单测也覆盖了非会话页主标题栏和工作面板按钮。E2E-167 记录了同屏拖动、跨屏释放、按钮点击和系统双击的手动验收步骤。物理双屏拖放和系统双击手势尚未实测。

Keep native caption hit regions active after Zoom so users can move the window within or across displays. Let AppKit apply the titlebar double-click preference and remove the renderer-only drag markers.
@vastsa
vastsa merged commit 083a15f into vastsa:main Nov 28, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] macOS 非全屏最大化后,无法从标题栏拖动窗口或移到另一台显示器

2 participants