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 issues with the Windows keyboard input code #340

Closed drmfinlay closed 3 years ago

drmfinlay commented 3 years ago

This PR fixes a few bugs with the Windows keyboard input code and cleans it up a bit. The changes are as follows:

These changes fix bugs that occur with different keyboard layouts and should make this implementation more reliable.

drmfinlay commented 3 years ago

@daanzu This might have fixed that weird bug (#182). If it didn't, then I can't see what else could be causing it. The input code is significantly more reliable now in any case.

I can say that this does fix a similar bug that occurs for me if I use my Dvorak keyboard layout and Dragonfly in 64-bit Python, which is what Kaldi requires.

drmfinlay commented 3 years ago

@Versatilus Just FYI, this removes the soft keys code you added into sendinput.py a little while ago. I have tested the SOFT_KEYS set with the MapVirtualKey() function and it returns 0 (meaning no scan code translation) for most of those keys. I assume the exceptions are due to layout/locale differences between us.

I'm happy to add it back in if this breaks something for you, but I'm pretty sure it will work fine.