Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[wsi] Check more display mode flags when comparing them. #4764

Conversation

zzhiyi
Copy link
Contributor

@zzhiyi zzhiyi commented Mar 14, 2025

EnumDisplaySettings(..., ENUM_CURRENT_SETTINGS, ...) is guaranteed to have DM_DISPLAYORIENTATION, DM_BITSPERPEL, DM_PELSWIDTH, DM_PELSHEIGHT, DM_DISPLAYFLAGS, DM_DISPLAYFREQUENCY, and DM_POSITION.

If we don't compare positions, then in Win32WsiDriver::restoreDisplayMode(), the original monitor layout might not be restored. For example, a secondary 1080p monitor at (3840, 0) can be moved to (1280, -1080) after the primary 4K monitor resolution changes to 720p and back to 4K. And due to the secondary monitor having the same resolution, its position won't be restored before this patch.

Fix Rime (493200) fails to switch monitors in borderless mode in some cases for Proton 10 alpha.

Related to #2064.

EnumDisplaySettings(..., ENUM_CURRENT_SETTINGS, ...) is guaranteed to have DM_DISPLAYORIENTATION,
DM_BITSPERPEL, DM_PELSWIDTH, DM_PELSHEIGHT, DM_DISPLAYFLAGS, DM_DISPLAYFREQUENCY, and DM_POSITION.

If we don't compare positions, then in Win32WsiDriver::restoreDisplayMode(), the original monitor
layout might not be restored. For example, a secondary 1080p monitor at (3840, 0) can be moved to
(1280, -1080) after the primary 4K monitor resolution changes to 720p and back to 4K. And due to the
secondary monitor having the same resolution, its position won't be restored before this patch.

Fix Rime (493200) fails to switch monitors in borderless mode in some cases for Proton 10 alpha.

Related to doitsujin#2064.
@zzhiyi zzhiyi force-pushed the bug-25010-rime-switching-monitors-in-borderless-mode branch from e62cf97 to 083eed1 Compare March 14, 2025 05:14
@zzhiyi zzhiyi changed the title Check more display mode flags when comparing them. [wsi] Check more display mode flags when comparing them. Mar 14, 2025
@doitsujin doitsujin merged commit 74eff25 into doitsujin:master Mar 14, 2025
4 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.

2 participants