On Fri Jul 29 02:14:06 2022 +0000, Zhiyi Zhang wrote:
You can simply pass \.\DISPLAY1 to NtUserChangeDisplaySettings(). I don't think nulldrv is going to support multiple monitors, is it? If you do, this loop to reset adapter settings is wrong. ChangeDisplaySettingsEx(NULL, NULL, ...) to reset all adapters to their registry settings should read all registry settings at once, then resolve any position conflicts, then finally apply adjusted modes to each adapter. Doing it in a loop calling NtUserChangeDisplaySettings separately for each monitor might end up with the wrong position because you're adjusting one monitor at a time. For details, see how place_all_displays() is used in X11DRV_ChangeDisplaySettingsEx().
The idea is that the generic code should do the right thing generally, not just what's needed for nulldrv, so I guess I'll have to move the monitor placing logic there.