On Fri Sep 23 04:08:54 2022 +0000, Zhiyi Zhang wrote:
I noticed that the timeout here is 1000ms while previous timeouts are 10000ms. Is it possible that the timeout is not enough? Also, when setting identical modes, you might need CDS_RESET. Same for the preceding ChangeDisplaySettingsExW() calls.
I can add the `CDS_RESET` flag but as far as I could see it doesn't force it to re-send the `WM_DISPLAYCHANGE` message, including with a very high timeout. It's a bit inconsistent but see here for instance: https://testbot.winehq.org/JobDetails.pl?Key=124072
As I understand it, the first `ChangeDisplaySettingsExW` sends the message because the current enumerated mode doesn't exactly match some internal state. But a second `ChangeDisplaySettingsExW` with the exact same full mode doesn't, because there's truly no changes this time.
Then, non 32bit modes are indeed emulated, and although they cause a `WM_DISPLAYCHANGE` message, they don't actually change that internal state, or the actual current mode. So when asking back for the 32bit mode, no change is needed either, and no message is sent.
So I used a 1000ms timeout here to avoid causing unnecessary waits when we actually expect it to timeout.