The adapter ids used by the host and settings handlers are not guaranteed to be compatible, so ensure we are using the proper id with each handler.
Note that although the possibly incompatible id was already used in `settings_handler.get_modes()` before, the settings handler was ignoring it anyway for `get_modes()` in the case it was really incompatible (e.g., using host handler xrandr 1.4, settings handler xrandr 1.0), . The problem manifests now since we are additionally calling `settings_handler.get_current_mode()` which does check the id value (e.g., in xrandr 1.0 to differentiate primary vs non-primary).
Signed-off-by: Alexandros Frantzis alexandros.frantzis@collabora.com Fixes: 4232312dffe1cd115aa6bfd755f5b7c6a403e3fc Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=54781
-- v2: winex11.drv: Do not call desktop get_current_mode() from UpdateDisplayDevices.
From: Alexandros Frantzis alexandros.frantzis@collabora.com
The adapter ids used by the host and settings handlers are not guaranteed to be compatible, so ensure we are using the proper id with each handler.
Signed-off-by: Alexandros Frantzis alexandros.frantzis@collabora.com Fixes: 4232312dffe1cd115aa6bfd755f5b7c6a403e3fc Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=54781 --- dlls/winex11.drv/display.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/dlls/winex11.drv/display.c b/dlls/winex11.drv/display.c index cd36c3c559c..75b585ff201 100644 --- a/dlls/winex11.drv/display.c +++ b/dlls/winex11.drv/display.c @@ -564,6 +564,10 @@ BOOL X11DRV_UpdateDisplayDevices( const struct gdi_device_manager *device_manage for (adapter = 0; adapter < adapter_count; adapter++) { DEVMODEW current_mode = {.dmSize = sizeof(current_mode)}; + WCHAR devname[32]; + char buffer[32]; + ULONG_PTR settings_id; + BOOL is_primary = adapters[adapter].state_flags & DISPLAY_DEVICE_PRIMARY_DEVICE;
device_manager->add_adapter( &adapters[adapter], param );
@@ -576,8 +580,13 @@ BOOL X11DRV_UpdateDisplayDevices( const struct gdi_device_manager *device_manage
handler->free_monitors(monitors, monitor_count);
- settings_handler.get_current_mode( adapters[adapter].id, ¤t_mode ); - if (!settings_handler.get_modes( adapters[adapter].id, EDS_ROTATEDMODE, &modes, &mode_count )) + /* Get the settings handler id for the adapter */ + snprintf( buffer, sizeof(buffer), "\\.\DISPLAY%d", adapter + 1 ); + 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 ); + if (!settings_handler.get_modes( settings_id, EDS_ROTATEDMODE, &modes, &mode_count )) continue;
for (mode = modes; mode_count; mode_count--)
From: Alexandros Frantzis alexandros.frantzis@collabora.com
The virtual desktop handler implementation of get_current_mode() calls into win32u and causes a deadlock, but we also do no need to set the win32u registry/current modes for the virtual desktop.
Signed-off-by: Alexandros Frantzis alexandros.frantzis@collabora.com --- dlls/winex11.drv/display.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/dlls/winex11.drv/display.c b/dlls/winex11.drv/display.c index 75b585ff201..6891a6b35fc 100644 --- a/dlls/winex11.drv/display.c +++ b/dlls/winex11.drv/display.c @@ -585,7 +585,11 @@ BOOL X11DRV_UpdateDisplayDevices( const struct gdi_device_manager *device_manage 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 ); + /* Get the current mode, but only if we are not not using the desktop + * handler, since the desktop handler get_current_mode() recurses into + * win32u. */ + if (handler != &desktop_handler) + settings_handler.get_current_mode( settings_id, ¤t_mode ); if (!settings_handler.get_modes( settings_id, EDS_ROTATEDMODE, &modes, &mode_count )) continue;