Batch updating the keyboard state / regrabbing keys #4367
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.
This adds a test case that tests that i3 does something quickly. With current
next
, the test needs 13 seconds on my computer and fails. That's not quick. The following commits fix this b 8000 y batching "the keyboard changed"-stuff: Instead of executing this code once per event we receive, this is now only done once per main loop iteration.This might or might not fix #3924 (no idea - I only tested with my new test case), hence CC @sammko
Also, I have no clue how to write test cases. I do not really know perl and I did not figure out the numbering scheme (thus went with 600). Perhaps this even has to handle the case "
xmodmap
is not installed" somehow? Dunno.The test uses a time limit of two seconds because
time()
only provides second granularity. Limiting this to one second could cause failures where the current time isx.99999
when the test starts and(x+1).000001
when the test finishes. This would already look like a one second time difference. Allowing two seconds thus seemed the safest option to me.Finally: IMO I am using way too many static variables for this, but let's see what you guys say about this.