Zhiyi Zhang (@zhiyi) commented about dlls/winex11.drv/display.c:
if (!(ids = calloc( count, sizeof(*ids) ))) return DISP_CHANGE_FAILED; for (count = 0, mode = displays; mode->dmSize; mode = NEXT_DEVMODEW(mode), count++) {
if (!settings_handler.get_id( mode->dmDeviceName, ids + count )) goto done;
if (!settings_handler.get_id( mode->dmDeviceName, is_primary_display( mode ), ids + count )) goto done;
Eh, I didn't think of this. But notice that 'mode' is the display mode the application wants to change to, not the original mode. So is_primary_display() actually returns the future primary display. Say if we need to detach the current primary display, is_primary_display() will return FALSE here and cause confusion. This is a behavior change compared to the old implementation. Please find another way to do this. Maybe find the primary display name in win32u and pass it to ChangeDisplaySettings()? or keep the old ways or something else.