Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix: Drawing using a keyboard key on X11
As spoken in aseprite/aseprite#4063 - currently, if we try to bind a key to mouse trigger button and we will try to draw with it - after a longer period of holding the key, drawing will stop and will try to draw continously with short breaks. This is caused because we never set repeat count inside the event that we generate from the event that comes from X Window System. Repeat count is being properly checked in doc_view.cpp:onProcessMessage method, although it always equals 0 - thus allowing for the key event to be converted to mouse event, and at the same time interpreting (and queueing) it as a mouse event. Solution for that is to simply check if the previous key event that came was KeyPress, and if it is currently pressed. If yes - it means that user never pushed the key down, thus set repeat count to 1. Otherwise, if the previous key event is KeyRelease for example - it means user has pushed the key down, thus repeat count on the current event can be set to 0.
- Loading branch information