Improve long-press handling on Android
Follow-up to !2489 (merged), fixing several of the "known issues" mentioned there.
- Pressing and holding on a spinner slider on Android no longer shows those annoying text selection handles.
- The long-press distance is now calculated correctly (it was being multiplied by 2 instead of squared.)
- Long-presses now behave more cleanly, delaying the input and then issuing a right-click followed by a context menu event. This makes widgets update their state correctly and doesn't confuse them with a mouse press that never gets released.
- Kinetic scrolling no longer causes the long-press delay to increase.
Test Plan
- Enable long-press context menus in the settings. This is enabled by default on Android.
- On Android, press and hold a spinner slider. Observe it no longer shows text selection handles. Double-click the slider to enter edit mode, observe that the text selection handles do appear now that there is actually text to select.
- Make a long-press and move the finger slightly. Observe that it no longer immediately cancels the long-press, but instead adheres to the touch slop distance used in the rest of the program.
- Long-press on e.g. a layer list item. Observe that the context menu now opens after the expected amount of time, rather than waiting for the kinetic scroll timeout and then the long-press timeout on top.
Formalities Checklist
-
I confirmed this builds. -
I confirmed Krita ran and the relevant functions work. -
I tested the relevant unit tests and can confirm they are not broken. (If not possible, don't hesitate to ask for help!) -
I made sure my commits build individually and have good descriptions as per KDE guidelines. -
I made sure my code conforms to the standards set in the HACKING file. -
I can confirm the code is licensed and attributed appropriately, and that unattributed code is mine, as per KDE Licensing Policy. -
Does the patch add a user-visible feature? If yes, is there a documentation MR ready for it at Krita Documentation Repository?
Reminder: the reviewer is responsible for merging the patch, this is to ensure at the least two people can build the patch. In case a patch breaks the build, both the author and the reviewer should be contacted to fix the build. If this is not possible, the commits shall be reverted, and a notification with the reasoning and any relevant logs shall be sent to the mailing list, kimageshop@kde.org.