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

Can't dismiss a popup by clicking another window of the same application

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 5.14.2
    • QPA: Wayland
    • Linux/Wayland

    Description

      Currently, there is a bug in plasmashell where panel popups don't get dismissed when the user clicks some blank area on the desktop. The reason for that is that the QMenu fails to grab both the keyboard(keyboard grabbing isn't implemented in QtWaylandClient) and the mouse at the same time. Without a mouse grab, the QMenu won't receive button press events when the mouse hovers some other window of the same application.

      This bug can't be reproduced in Qt Widgets based applications because QWidgetWindow contains fallback code that forwards keyboard and mouse events to the active popup window. But if it's an application that uses both Qt Quick and Qt Widgets (e.g. plasmashell), then there is a good chance that the fallback code in QWidgetWindow will be bypassed when the mouse hovers a Qt Quick component.

      I had tried to fix the bug by faking keyboard grabbing in QtWaylandClient as 1a40ec4f8dd333386250fa1ba01826ce83c8e1a0 did a similar thing for mouse grabs, but it only exposed another bug w.r.t. sending Qt::Enter and Qt::Leave events that confuse QMenuSloppyState and make it dismiss any hovered nested popup menu.

      In order to showcase the problem, I've created a test application that demonstrates the bug. If you run it on X11 and click the blank area in the window several times, you're going to see at most one popup at a time. If you run the test application on Wayland and repeat what you did on X11, you're going to see multiple popup windows, see the attached screenshot.

      Attachments

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

        Activity

          People

            qt.team.graphics.and.multimedia Qt Graphics Team
            zzag Vlad Zahorodnii
            Votes:
            7 Vote for this issue
            Watchers:
            11 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes