Zhiyi Zhang (@zhiyi) commented about dlls/winex11.drv/display.c:
asciiz_to_unicode( devname, buffer ); if (!settings_handler.get_id( devname, is_primary, &settings_id )) break;
settings_handler.get_current_mode( settings_id, ¤t_mode );
/* We don't need to set the win32u current mode when we are in
* virtual desktop mode, and, additionally, skipping this avoids a
* deadlock, since the desktop get_current_mode() implementation
* recurses into win32u. */
if (handler != &desktop_handler)
You can save the return value of the previous is_virtual_desktop() call and use it throughout the function.