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

Windows: KeyPress event for modifiers are ignored if they were released while the app was inactive

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P4: Low
    • 5.6.0
    • 5.5.0, 5.5.1, 5.6.0 Alpha
    • QPA: Windows
    • None
    • Windows
    • ac5c2aaf35bba3048aeff5c26cf0aa704fe63df6 (qtbase/5.6, 18.12.2015, 5.6)

    Description

      I'm working on a remote desktop application which send key press and release events for individual keys and not just key combinations.

      There is an issue when modifier keys (alt, control, shift) are pressed, another app gets activated and the key is released.

      QWindowsKeyMapper keeps the state of all pressed keys. If a modifier key is released while the app is inactive there is no update of the state of the modifier key.

      When the app gets activated again and the modifier key is pressed it first checks the internal state if the key is already marked as pressed. This is the case since the key was released while the app was inactive. The keypress is therefore discarded.

      The following key release will clear the internal state and the second modifier keypress is actually registered.

      The is rather annoying when the user uses combinations like ctrl-c to copy text on the remote desktop. Since the control keypress is discarded only the "c" keypress is registered and the selected text is replaced.
      This behaviour is very prominent when using a focus-follows-mouse setting.

      A workaround is not possible since the app can not access the classes in the Windows platform plugin.

      A viable solution would be to rebuild the internal keystate when the application get activated again.

      The attached test will change the background color to green when the alt key is pressed. it's changed to gray when the key is released or the app get inactive.

      If the alt key is pressed while another application is activated qt gets into the wrong state. Activating the test app again and pressing alt for the first time will not change the backgrond to green.

      • Activate test app
      • Press Alt -> green background
      • Keep Alt pressed and activate a different application -> gray background
      • Release Alt
      • Activate the app
      • Press Alt -> no background change
      • Release Alt
      • Press Alt -> green background

      Attachments

        1. QAltKeyTest.zip
          1 kB
        2. qtbug49930_diag.diff
          4 kB
        3. qtbug49930_log.txt
          2 kB
        4. qtbug49930.zip
          1 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            kleint Friedemann Kleint
            ago Alexander Gottwald
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes