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

Popups missing or placed incorrectly when using Wayland

    XMLWordPrintable

Details

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

    Description

      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.

      Example:

      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.

      Attachments

        Issue Links

          For Gerrit Dashboard: QTBUG-96983
          # Subject Branch Project Status CR V

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There is 1 open Gerrit change