-
Notifications
You must be signed in to change notification settings - Fork 851
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
Display modes for all monitors should be restored instead of only restoring specific one monitor #2064
Comments
What exactly is the issue here? |
When using ChangeDisplaySettingsExW to change the primary monitor resolution while a secondary monitor is present. It's possible that the monitor layout will change, e.g., from aligning horizontally to vertically. And then if we only restore the primary monitor resolution, the layout is not kept. Some games expect the monitor layout is kept and the tests prove it. For example, there is a chance that RiME will hang on KDE if you quickly get in and out of fullscreen mode multiple times. |
Why does the layout change and why does restoring all monitors solve that problem? Doing so should be a no-op for all monitors that the game isn't currently running on since we're not changing the mode in the first place? |
The layout change is caused by calling ChangeDisplaySettings for a specific monitor. It happens in cases when moving the secondary monitor in one direction is closer than moving it to the original direction. For example, a primary 3840x2160 monitor and secondary 800x600 monitor on the right with the top side aligned horizontally. Now call ChangeDisplaySettings to set the primary monitor to 800x600. If the secondary monitor moves to the left. Then the offset is 3840-800=3040. However, if it moves upwards, it's -600. abs(-600) < abs(3040) so the secondary monitor end up on the top side of the primary monitor. You can test it on Windows as well. Finally restoring the primary monitor will keep the secondary monitor on the top side. Thus a layout change. I don't remember the exact reason why the layout change will solve the hang. If DXVK's DXGI can pass wine's DXGI tests, then things should be fine. Also, CDS_FULLSCREEN may have something to do with this but it's not implemented in Wine. It might affect how monitors get restored. I'll have to look into it. |
Does 1743a27 fix the problem? I can't really test this properly since i don't have a multi-monitor setup on my desktop and can't really reproduce these issues on my notebook. |
Actually, yeah, when changing the order around I get failures without that commit but not with it, so it should work. |
Please see
https://source.winehq.org/git/wine.git/commitdiff/df90c0ef7ea053606e684901073b26368f34ac26
https://source.winehq.org/git/wine.git/commitdiff/ef81152c8cd17f1bfb2950753428a95a81728c97
https://source.winehq.org/git/wine.git/commitdiff/b911e560458ac7a05c04758efb8f5286a47cae7d
DXVK's RestoreMonitorDisplayMode() only restores the display mode for a specific monitor, which might cause monitor layout changes after mode changes. I would have implemented this myself if I find the time. Reporting it here if anyone wants to fix this.
The text was updated successfully, but these errors were encountered: