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

[Mac] No key release events for Command + Shift + 4 (screen capture)

    XMLWordPrintable

Details

    • Bug
    • Resolution: Invalid
    • P3: Somewhat important
    • None
    • 5.12.1
    • None
    • Mac OS High Sierra 10.13.6
    • macOS

    Description

      On MacOS High Sierra (10.13.6) and probably other versions, Command (⌘) + Shift + 4 will allow you to do a screen capture of an area.   Entering this key sequence puts the cursor in a mode to draw an area, and will capture it upon release.

      The problem is that if you release the keys BEFORE drawing the capture area, the Command + Shift key releases are not detected by Qt's KeyReleaseEvent() callback.   However, if you release the keys AFTER drawing the area, the key releases are received.

      Follow this scenario, while listening to QWidget's keyPressEvent and keyReleaseEvent:

      1) Press and hold the Command Key

      2) Press and hold the Shift Key

      3) Press and release the 4 Key.

      4) Release the Command and Shift keys

      Expected result:

      1) Key Press Event for Command

      2) Key Press Event for Shift

      3) Key Press Event for 4

      4) Key Release Event for 4

      5) Key Release Event for Shift

      6) Key Release Event for Command

      Actual result:

      1) Key Press Event for Command

      2) Key Press Event for Shift

      Interestingly, if you click on the mouse to finish the capture sequence, Qt sends a Key Release event for the "a" key.   Very strange.

      This is a problem for us as we have an application that sends all keyboard events to a remote system and injects them as if they were pressed on that system.   Since we don't get the key release events for the pressed keys, the remote system continues to think those keys are still pressed, and subsequent keypresses are incorrectly interpreted.

      We could work around this by detecting this case and forcing a key release for the keys, but I'd prefer to get this fixed in Qt if it is indeed a Qt related issue.

      As far as code to reproduce this, please refer to the code sample provided in QTBUG-36839 as this defect appears to be similar in nature.

      There are other special key sequences on the Mac to capture screens (e.g. Command + Shift + 3, Command+Shift+5).   These sequences don't generate the key press / release for the "3" or the "5", but they at least do release the Command + Shift keys.

       

      Attachments

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

        Activity

          People

            Unassigned Unassigned
            fish4life Jeremy Cook
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes