Fix behaviour switching from DefaultTool to text tool and make text tool select all text by default
This fixes the behaviour of double-clicking or pressing Enter on a text shape to edit it, and make it easier for users to edit text on newly-created text shapes.
The tool switching fix for DefaultTool is more of a workaround to avoid triggering the recursion guard, instead of fixing the underlying issue that can cause KisInputManager
to unintentionally resend an event:
The original event is handled by
KisShortcutMatcher
fromKisInputManager
, which then goes throughKisToolInvocationAction
andKisToolProxy
to eventually reachDefaultTool
. When the tool callsKoToolManager::switchToolRequested
directly, it eventually callsKisShortcutMatcher::lostFocusEvent
andKisShortcutMatcher::toolHasBeenActivated
, both of which triggers the recursion guard.KisInputManager
then thinks the event hasn't been handled and callsprocessUnhandledEvent
, which sends the event toKisToolProxy
for a second time. Observable effects include: double- clicking a text shape causes all text to be selected (bymouseTripleClickEvent
), or pressing Enter on a text shape causes an unwanted newline to be inserted immediately.
Test Plan
- In DefaultTool, double-click on a text shape.
- In DefaultTool, press Enter on a text shape.
- In the text tool, create a new text shape.
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.
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.