Prevent Slate from hanging waiting for unresponsive apps #414
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Make use of a private API to prevent Slate from hanging waiting for
unresponsive apps.
Tested by pausing Google Chrome with a command like
kill -STOP 11019,then interacting with Slate (using hot keys to reposition windows). I
observed that there is some lag before the
CGSEventIsAppUnresponsiveAPI actually registers the state of the world; it returns
falseatfirst, but after about 20 seconds it correctly returns
true. Duringthe initial interval, interacting with Slate is laggy; after that, it
becomes snappy.
Resumed Chrome with
kill -CONT 11019.Fixes: #140
Thanks to @sdegutis for the tip.
Note: there may be other places that need to check for unresponsiveness before proceeding, but in my initial testing, it seems like all the hangs were happening in the
+[AccessibilityWrapper windowsInApp]method.