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

Wayland context menus can go off the screen because Qt does not do set_constraint_adjustment

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P2: Important
    • 6.2.5, 6.2, 6.3.0 Beta3, 6.3, 6.4
    • 5.15.0
    • QPA: Wayland
    • None
    • FreeBSD -CURRENT, Wayfire/wlroots master
    • Linux/Wayland
    • 59a5fe99e1569421b920d99c5b20cdafcdcf43a9(dev) 48bdfa057910f5f7f7e9938bb69584c8638e286b(6.3) ede922ba096687844f46d9135e2a40660eb7a304(6.2) ede922ba09 (qt/qtwayland/6.2) 48bdfa0579 (qt/qtwayland/6.3) 59a5fe99e1 (qt/qtwayland/dev), d7a5dab01 (dev)

    Description

      When right-clicking to get to a context menu in the bottom of the screen, the menu can go beyond the end of the screen. xdg_positioner's set_constraint_adjustment should be called to let the compositor reposition the popup so that it's actually on the screen. Qt does not do this at all (how is this tolerated by KDE? do they default the constraint_adjustment to non-zero in their compositor?).

      Adding

      positioner->set_constraint_adjustment(
          QtWayland::xdg_positioner::constraint_adjustment_slide_x | QtWayland::xdg_positioner::constraint_adjustment_slide_y
          | QtWayland::xdg_positioner::constraint_adjustment_flip_x | QtWayland::xdg_positioner::constraint_adjustment_flip_y);
      

      in src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp QWaylandXdgSurface::setPopup solves the problem for most applications, but

      • should only be done for context menus specifically??
      • does not help in Cura because m_window->geometry().height() == 1 ends up in the set_size.. (their fault somehow? or.. should Qt change the positioner when the popup's size changes? does a normal menu's size change? do they show it too early? hmm)

      Attachments

        Issue Links

          Activity

            People

              liaqi Liang Qi
              unrelentingtech greg greg
              Votes:
              6 Vote for this issue
              Watchers:
              13 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: