[x11] Add movement threshold when detecting double clicks in X11 #165
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.
Fixes #112
This makes double clicking in aseprite much less flakey on linux, for example when using the marque tool in tile mode, or navigating directories and opening files using the aseprite file dialogs. Without this I have to be very careful to keep the mouse still when double clicking and even then I usually have to try several times to get a double click to register.
Prevents the x11 implementation from resetting the click state on mouse movement until either x or y position has changed more than a certain radius from the last clicked position. Also checks the position again before triggering a double click action just in case the position has somehow changed in a way that wasn't captured and handled.
I set it up with a fixed radius of 8, since I'm not really sure how best to go about making it build configurable or actually dynamic. But this should be a huge improvement over the existing behavior with no threshold. For comparison with windows the default radius seems to be 2, but probably works differently for touch/tablet inputs, SDL defaults to 32 which seems a bit excessive so I picked something a bit more conservative but still hopefully useful if you happen to be using touch or tablet input.
I agree that my contributions are licensed under the MIT License.
You can find a copy of this license at https://opensource.org/licenses/MIT