Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-96983

Popups missing or placed incorrectly when using Wayland



    • Bug
    • Resolution: Duplicate
    • P2: Important
    • None
    • 5.15.6, 6.1.2, 6.3.0
    • GUI: Menus, QPA: Wayland
    • None
    • Linux/Wayland


      Qt currently relies on absolute screen coordinates to place popups - but this cannot work in Wayland. As a result, Qt ends up misplacing menus and other popups.


      I have two screens with the following geometries:

      • 1920x1080+0+1296
      • 3840x2160+1920+0

      I open any Qt application and click e.g. a "File" menu. What happens next is:

      • Qt calculates the popup coordinates relative to the window - let's say, (10, 10).
      • It attempts to convert the point into screen coordinates - but since it has no information about the parent window coordinates, it still ends up with (10, 10).
      • It checks if (10, 10) is within any of the screens - and it's not.
      • The popup gets shifted to (1920, 10) to be "visible".
      • At best, the popup shows up to the right of where it should've been. At worst, it's not visible at all because the parent window is less than 1920px wide.

      Here's an example of code that is moving the popup: https://github.com/qt/qtbase/blob/dev/src/widgets/widgets/qmenu.cpp#L2416

      Disabling "if (adjustToDesktop)" fixes that particular bug - but there are many more such cases in the Qt codebase.

      From what I understand, using "xdg_positioner" is the solution on Wayland.


        1. qt wayland bug.webm
          5.60 MB
          Dima Ryazanov

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.



              liaqi Liang Qi
              dimaryaz Dima Ryazanov
              2 Vote for this issue
              4 Start watching this issue



                Gerrit Reviews

                  There is 1 open Gerrit change