bqt icon indicating copy to clipboard operation
bqt copied to clipboard

Attempting to fix alt-tab bug in bqt

Open friedererdmann opened this issue 5 years ago • 1 comments

Currently there is a bug in bqt, if you alt-tab out of Blender and back in, it will often perceive that the alt key is stuck. The same can happen with the shift or ctrl key (but alt-tab is the most common use-case where the bug becomes apparent).

I'm attempting a fix that catches at least some cases of this behavior by running a second operator along side the QOperator. The second operator is a regular Blender operator running modally and scanning inputs. I've also added a just_focused property on the BlenderApplication object, that we can check if - "Blender just got focused" (came back from Alt-Tab). In that case the modal operator will check if there's a keyboard event perceived and if that keyboard event contained any modifier key. We then simply send an emulated key release to the operating system.

Apparently Blender having trouble catching if any modifier keys have been released is not a new issue by bqt, but appears to be more common with bqt. E.g. see the following two older issues: https://developer.blender.org/T52905 https://developer.blender.org/T64105

friedererdmann avatar Feb 04 '21 22:02 friedererdmann

when testing this out

  • the ctypes part works for me
  • the keyboard alt tab fix prevents me from typing in blender. it is now worse than it was before since i cant type at all

can i suggest to split this PR in 2 parts? ctypes & keyboard alt tab

hannesdelbeke avatar Jul 01 '22 22:07 hannesdelbeke

Closing this in favor of Hannes cleaned up Pull request here #23

friedererdmann avatar Sep 08 '22 11:09 friedererdmann