dictation-toolbox / dragonfly

Speech recognition framework allowing powerful Python-based scripting and extension of Dragon NaturallySpeaking (DNS), Windows Speech Recognition (WSR), Kaldi and CMU Pocket Sphinx
GNU Lesser General Public License v3.0
388 stars 75 forks source link

Fix incorrect handling of extended scan codes on Windows #343

Closed drmfinlay closed 3 years ago

drmfinlay commented 3 years ago

This changes the KeyboardInput struct in sendinput.py to use the MAPVK_VK_TO_VSC_EX map type when translating virtual key codes on modern versions of Windows. The KEYEVENTF_EXTENDEDKEY flag is added only if the scan code has a high byte of 0xe0 or 0xe1, as per the documentation for MapVirtualKeyExW() (available here).

This removes the hardcoded list of extended keys.

This fixes (again) issue #287.