Details
-
Bug
-
Resolution: Unresolved
-
P3: Somewhat important
-
None
-
5.3.2
-
Qt5 for Windows running under wine on any Linux distribution
Description
Due to a bug in wine's implementation of GetMonitorInfo (which returns the same hardcoded string for every monitor), Qt doesn't correctly detect the available monitors (it keeps only the last enumerated one).
This results in broken QDesktopWidget::screenNumber, which in turn breaks the positioning of (at least) menus and combo boxes dropdowns, which are snapped to the last enumerated screen (see attached images).
This is a confirmed bug in wine (https://bugs.winehq.org/show_bug.cgi?id=37709), but doesn't seem so immediate to fix (the changes are not very localized); since we need to run a custom Win32 application on wine while migrating it to Qt, I wrote a patch that adds a workaround in the Qt platform plugin for Windows.
The patch adds an "id" member to QWindowsScreenData, which is used as the search key in QWindowsScreenManager::m_screens. If everything is normal, id is just a copy of name (which is left untouched); but if multiple screens with the same name are detected after enumeration, ids are rewritten to make them unique.
This should fix most problems (the multiple monitors are correctly detected), without touching the data stored in the external interface (in particular, the name is left untouched) and without any change in behavior in the "regular" case (=running under "real" Windows with non-duplicated device names).