Note: This is a public test instance of Red Hat Bugzilla. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback at bugzilla.redhat.com.
Bug 1759259 - Qt5 popup menus misplaced or missing
Summary: Qt5 popup menus misplaced or missing
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: qt5-qtwayland
Version: 36
Hardware: x86_64
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Jan Grulich
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
: 1900838 (view as bug list)
Depends On:
Blocks: qt-wayland-issues-tracker
TreeView+ depends on / blocked
 
Reported: 2019-10-07 17:46 UTC by Dima Ryazanov
Modified: 2022-08-07 04:32 UTC (History)
10 users (show)

Fixed In Version: qt5-qtwayland-5.15.5-3.fc36
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2022-07-27 02:22:58 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
Screenshot (deleted)
2019-10-07 17:46 UTC, Dima Ryazanov
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Qt Bug Tracker QTBUG-68636 0 None None None 2021-05-28 19:24:00 UTC
Red Hat Issue Tracker FC-306 0 None None None 2021-10-18 07:03:08 UTC

Description Dima Ryazanov 2019-10-07 17:46:11 UTC
Created attachment 1623290 [details]
Screenshot

Description of problem:
When using Wayland and a multi-monitor setup, Qt5 does not place popup menus correctly - they're displayed at an offset, or missing completely if the offset would make it appear outside of the parent window.
Gtk+ used to have the exact same problem: it would try to calculate the popup position based on the parent window coordinates and screen dimensions - but Wayland does not expose window coordinates. I'm guessing Qt5 is doing the same thing.
The bug has probably always been there - but Qt5 didn't use Wayland by default until Fedora 31.

Version-Release number of selected component (if applicable):
qt5-qtwayland-5.12.5-1.fc31.x86_64

How reproducible:
Depends on the window location, but for a given location, happens consistently

Steps to Reproduce:
1. Make sure you have multiple monitors side by side
2. Open /usr/lib64/qt5/examples/widgets/richtext/textedit/textedit on the monitor to the right
3. Right-click the text or open File/Edit/etc. menus

Actual results:
Popup menu is shifted to the right

Expected results:
Popup menu should work as usual

Additional info:

Comment 1 Jan Grulich 2019-10-08 05:03:22 UTC
This is unfortunately a known regression in qtwayland, see [1] and fixing this properly requires significant amount of work. This can be workarounded on per-app basis, but it's not probably what we want to do for every application.

[1] - https://bugreports.qt.io/browse/QTBUG-68636

Comment 2 Ben Cotton 2020-11-03 17:04:18 UTC
This message is a reminder that Fedora 31 is nearing its end of life.
Fedora will stop maintaining and issuing updates for Fedora 31 on 2020-11-24.
It is Fedora's policy to close all bug reports from releases that are no longer
maintained. At that time this bug will be closed as EOL if it remains open with a
Fedora 'version' of '31'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 31 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 3 Ben Cotton 2020-11-24 17:38:23 UTC
Fedora 31 changed to end-of-life (EOL) status on 2020-11-24. Fedora 31 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.

Comment 4 Jan Grulich 2021-07-15 10:58:45 UTC
*** Bug 1900838 has been marked as a duplicate of this bug. ***

Comment 5 Dima Ryazanov 2021-09-22 04:08:53 UTC
I decided to look into this myself.

Both Qt5 and Qt6 have the same bug that Gtk used to have: they rely on absolute coordinates to place popups in visible areas of the screen. But, obviously, this cannot work in Wayland since there are no more absolute coordinates.

What Qt ends up doing is:
- Calculate the popup's absolute coordinates - but get window-relative coordinates instead
- Compare the (wrong) coordinates to the screen geometry
- Determine (incorrectly) that the popup would be displayed outside of any of the screens
- Shift the popup to the right by first screen's width, or down by first screen's height

Best case: popup appears at the wrong location. Worst case: popup's location is outside of the parent window, so it does not appear at all.

There is an example of the code doing these calculations: https://github.com/qt/qtbase/blob/dev/src/widgets/widgets/qmenu.cpp#L2416
 
Unfortunately, there are many, many references to absolute coordinates and screen geometry throughout Qt codebase. I have not noticed much progress on the upstream bug - and it's unrealistic for me to fix it all myself.

Right now, practically all Qt apps are unusable - and it's been like this for two years now. The only solutions I see are:
- Switch Qt back to X11
- Patch Qt to disable broken code

Would Fedora accept Qt patches that have no chance of getting upsteamed, but would keep Qt apps mostly working?

(I know I can switch Qt to X11 myself - but I still find it incredible that things are this broken out of the box.)

Comment 6 Jan Grulich 2021-09-22 06:38:52 UTC
You are correct with your observations, but I'm not sure it's safe to disable part of the code which is misbehaving on Wayland, because it might have an impact on someone else. I would like to look into this myself, but I didn't have time yet.

Comment 7 Peter Tselios 2021-11-26 06:59:52 UTC
The issue is more extreme when you have at least 2 screens and with different resolution. 
In my case, I have a laptop with a 14'' UHD screen and an external 22'' FHD monitor. 
When I use Wayland, on the external monitor, the first 2-3 popup menus are misplaced but only horizontally.
If I move the same application to the laptop's screen, the popup menu is completely misplaced, both horizontally (but not that much) and vertically, it's moved almost at the bottom of the screen.

Comment 8 Peter Tselios 2021-11-26 07:00:22 UTC
(In reply to Peter Tselios from comment #7)
> The issue is more extreme when you have at least 2 screens and with
> different resolution. 
> In my case, I have a laptop with a 14'' UHD screen and an external 22'' FHD
> monitor. 
> When I use Wayland, on the external monitor, the first 2-3 popup menus are
> misplaced but only horizontally.
> If I move the same application to the laptop's screen, the popup menu is
> completely misplaced, both horizontally (but not that much) and vertically,
> it's moved almost at the bottom of the screen.

I forgot to mention: F34.

Comment 9 Ben Cotton 2022-05-12 16:52:29 UTC
This message is a reminder that Fedora Linux 34 is nearing its end of life.
Fedora will stop maintaining and issuing updates for Fedora Linux 34 on 2022-06-07.
It is Fedora's policy to close all bug reports from releases that are no longer
maintained. At that time this bug will be closed as EOL if it remains open with a
'version' of '34'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, change the 'version' 
to a later Fedora Linux version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora Linux 34 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora Linux, you are encouraged to change the 'version' to a later version
prior to this bug being closed.

Comment 10 Adam Williamson 2022-05-14 00:47:57 UTC
So, there seem to be at least two relevant upstream issues here:

https://bugreports.qt.io/browse/QTBUG-68636 (marked fixed in 6 but not 5?)
https://bugreports.qt.io/browse/QTBUG-85297 (still open)

so it sort of looks like this is still an issue, but can anyone confirm for sure?

Comment 11 Dima Ryazanov 2022-05-14 02:27:08 UTC
Yes, still an issue for me.

Comment 12 Adam Williamson 2022-05-14 06:26:29 UTC
OK, let's bump it to 36 then.

Comment 13 Fedora Update System 2022-07-26 12:31:15 UTC
FEDORA-2022-d1ac004bb1 has been submitted as an update to Fedora 36. https://bodhi.fedoraproject.org/updates/FEDORA-2022-d1ac004bb1

Comment 14 Fedora Update System 2022-07-27 02:22:58 UTC
FEDORA-2022-d1ac004bb1 has been pushed to the Fedora 36 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 15 Fedora Update System 2022-07-27 06:12:55 UTC
FEDORA-2022-fd5a821d68 has been submitted as an update to Fedora 36. https://bodhi.fedoraproject.org/updates/FEDORA-2022-fd5a821d68

Comment 16 Fedora Update System 2022-07-28 02:32:49 UTC
FEDORA-2022-fd5a821d68 has been pushed to the Fedora 36 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2022-fd5a821d68`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2022-fd5a821d68

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 17 Fedora Update System 2022-07-30 01:39:19 UTC
FEDORA-2022-fd5a821d68 has been pushed to the Fedora 36 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2022-fd5a821d68`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2022-fd5a821d68

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 18 Fedora Update System 2022-08-07 04:32:01 UTC
FEDORA-2022-fd5a821d68 has been pushed to the Fedora 36 stable repository.
If problem still persists, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.