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

Plugin foregrounding logic might not retain keystroke order for multiple individual keys sent #2

Closed
frazierjason opened this issue Jan 11, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@frazierjason
Copy link
Owner

The fix for issue #1 may inadvertently cause multiple sequential keys sent ("S", "S", "B", "Enter") to all pile up in the case that the plugin is waiting up to two seconds for N1MM+ to be foregrounded.

This could have three consequences, neither one of which has been reproduced yet:

  • Each keystroke is processed on its own Plugin.OnActionEvent() thread. They normally process fast enough that the execution order sent by the TP Press action will be honored. But if they stall waiting on the hWnd to foreground, it is possible that each thread's wait loop might be unblocked in an order different than that executed by TP Press action. We might end up with a jumble like "B" "Enter" "S" "S".
  • In the case that N1MM+ foregrounds just barely after the two second delay, only half the keys such as "B" "Enter" are executed, while the earlier keys were timed out.
  • When all of the keys time out, they might time out very closely to the same moment in time once Windows comes back to process the keypress event threads. In this, all of them will call the logger to write to disk rapidly in sequence. While the data written is quite small, and the Serilog implementation can surely handle it, it's something to consider if we see any resulting IO issues.
  • There might be other variations of these timing issues as well.

This original issue sending multiple single keys is likely to be marked as won't fix, in favor of instead adding a new action that sends a series of alphanumeric keys followed by Enter. This would enable OnActionEvent to process the keys together as a sequence, and send either all or none. It'd be a good idea to add a lock section, so that only one OnActionEvent thread can be sending keys at a time (not multiple of them overlapping).

@frazierjason frazierjason added the enhancement New feature or request label Jan 11, 2023
@frazierjason
Copy link
Owner Author

Implemented a new action to wipe the active radio's entry window, type a sequence of plain keys entered as a single string, and optionally followed by Enter. Users should no longer need to create a bunch of individual key press actions to type a string and hit enter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant