fix: Windows 下多显示器不同缩放比例时窗口恢复尺寸异常 - #185
Open
Holden-Cross wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
改动类型
是否包含破坏性变更
改动说明
Electron 43.2.0 在 Windows 混合 DPI 环境中恢复带保存坐标的窗口时,会先按主显示器 DPI 初始化窗口尺寸,再将窗口定位到目标副屏。当两块显示器的缩放比例不同时,首次 DIP 到物理像素的换算会采用错误的缩放比例,导致重新启动后窗口变小或变大,并可能在连续重启后累积偏差。
本 PR 在主窗口创建并定位到目标显示器后、恢复最大化状态前,再次调用
setBounds应用保存的窗口边界,使尺寸按照目标显示器的 DPI 重新换算。该兼容逻辑仅在 Windows 且存在完整保存坐标时执行,不修改设置结构,不影响首次启动、未开启“记忆窗口状态”的场景以及 macOS、Linux 的现有行为。
关联 Issue
测试情况
SPlayer-Next-1.0.0-x64-portable.exe。SPlayer-Next-1.0.0-x64-portable.exe。自查清单
pnpm format,并确认pnpm typecheck、pnpm lint通过pnpm build:native验证;未手写native/*/index.d.tsdev分支提交