Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup keyboard code #352

Merged
merged 3 commits into from
Aug 23, 2021
Merged

Cleanup keyboard code #352

merged 3 commits into from
Aug 23, 2021

Conversation

drmfinlay
Copy link
Member

@drmfinlay drmfinlay commented Jul 21, 2021

This PR cleans up the keyboard code a little and fixes some bugs.

Summary:

  • Change the Key and Text action classes to calculate keyboard
    events at execution time instead of initialization time.
  • Fix a regression with keyboard input actions on Windows.
    This restores the list of extended keys removed from sendinput.py in PR 343. If the specified virtual-key is in this list, e.g. the insert key, then the KEYEVENTF_EXTENDEDKEY flag is used.
  • Fix a bug with Text action default pause values.
    This change fixes a bug where the PAUSE_DEFAULT setting in the Windows-only settings.cfg file is not used properly by Text actions.
  • Fix numerous code style issues.
  • Remove doc build conditionals from keyboard/init.py.
    These should be removed from other files too. I plan to do that as part of a more general clean up of the platform code.

@drmfinlay drmfinlay added Bug Unexpected replicated behavior Windows Issues regarding Microsoft Windows OS labels Jul 21, 2021
@drmfinlay drmfinlay self-assigned this Jul 21, 2021
@LexiconCode
Copy link
Member

Let me know when this is ready to test!

@drmfinlay
Copy link
Member Author

drmfinlay commented Jul 31, 2021

Should be ready to test now. I can already see a problem with Key("") that I'll fix shortly.

I'd like to merge 326 before this; I anticipate a fair few conflicts.

@drmfinlay drmfinlay marked this pull request as ready for review July 31, 2021 08:22
@LexiconCode
Copy link
Member

In my limited testing this does fix #350

Is this PR meant to address the difference in speed between DNS text output versus dragonfly?

@drmfinlay
Copy link
Member Author

Yes. It looks like that problem is caused by incorrect pauses in the Typeable event methods. I think it is still not quite right. It would not have been helped by the bug I fixed with aaff1ba.

@LexiconCode
Copy link
Member

LexiconCode commented Aug 21, 2021

Yes. It looks like that problem is caused by incorrect pauses in the Typeable event methods. I think it is still not quite right. It would not have been helped by the bug I fixed with aaff1ba.

We are all human! At least I hope :) Let me know if you can hear a high-pitched squeal from one of my fans going bad as you read this text.

@drmfinlay
Copy link
Member Author

Haha :)

Well, I can confirm that the behaviour doesn't occur for me using the hardware or Unicode events. It is the same speed as DNS if I set pause_default to 0.

Incidentally, I plan to remove the settings.cfg file in the future; the settings are either defunct or better handled by setting class/instance members instead.

Summary:
- Change the Key and Text action classes to calculate keyboard
  events at execution time instead of initialization time.
- Fix numerous code style issues.
- Remove doc build conditionals from keyboard/__init__.py.
Fixes #350.

This restores the list of extended keys removed from sendinput.py in
PR #343.  If the specified virtual-key is in this list, e.g. the
insert key, then the KEYEVENTF_EXTENDEDKEY flag is used.
This change fixes a bug where the PAUSE_DEFAULT setting in the
Windows-only settings.cfg file is not used properly by Text actions.
@drmfinlay drmfinlay merged commit 0a0eae5 into master Aug 23, 2021
@drmfinlay drmfinlay deleted the cleanup-kb-code branch August 23, 2021 12:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Unexpected replicated behavior Windows Issues regarding Microsoft Windows OS
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants