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
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--)
Keeping as 'Draft' for now, until we get some more feedback from the bug reporter.