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

Cocoa window loses its 'key' status on QWidget::releaseMouse() if the grabber happens to be a descendant of the 'main' window

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P3: Somewhat important
    • None
    • 5.2.1
    • GUI: Window management
    • None
    • OSX 10.8.5, XCode
    • ab3a8443faa36799ab8142e48d25d8ff10f9d0bf

    Description

      This pertains to the 'key' and 'main' window status for a Mac window.

      Currently, when 'grab' flag is false, the logic in QCocoaWindow::setMouseGrabEnabled() will resigns the window's 'key' status so long as it has it.

      As a result, if user programmatically grab the mouse using QWidget::grabMouse(), and the mouse grabber happens to be a descendant widget in the 'main' window's hierarchy, when the the widget releases the mouse (i.e. releaseMouse() ), the 'main' cocoa window will lose its 'key' status. Visually, it means the 3 little red/yellow/green buttons will lose their color which won't come back until user clicks away then click back - something very hard to miss.

      I would assume grab/release mouse shouldn't affect the window 'key' status if the grabbing widget happens to be part of the 'main' window that owns the 'key' to begin with.

      Attached please find a patch that seems to address the issue. Same fix also need to be applied on setKeyboardGrabEnabled().

      Although I ran into this on Mac with 5.2.1, the problem probably exists in earlier version of 5.x as well.

      Attachments

        Issue Links

          Activity

            People

              tpochep Timur Pocheptsov
              bienur Pinyen Chen
              Votes:
              3 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: