Ensure InputGesture dialog is accessible even if new gesture was not added (#21058)
Fixes #20980
Summary of the issue:
If the InputGesturesDialog is entered and Add is clicked but no new input gesture added, this leaves the InputGesturesDialog inaccessible.
Description of user facing changes:
User can now see the InputGesturesDialog, even if the previous invocation of the dialog didn't add a new gesture properly
Description of developer facing changes:
Check for whether the InputGesturesDialog still has a CaptureFunc installed during teardown, and clear if so.
A new variable is created to store the last installed CaptureFunc in InputGesturesDialog, in order to compare against inputCore.manager._captureFunc when the dialog is destroyed
A new function _setCaptureFunc is created to encapsulate storing a new capture func both in InputGesturesDialog and also in inputCore.manager
Description of development approach:
Alternatives were considered to the approach in the PR
Don't store the last captureFunc within InputGesturesDialog. Instead try to determine if inputCore.manager._captureFunc matches a lambda generated from a function within InputGesturesDialog. Rejected because the logic to do this check is very heuristic and hard to follow
Replace lambda functions with wrapper functions, for use a captureFunc. This means the check on the function is easier. Rejected because because it is a larger change
Avoid the check altogether - The dialog isn't modal, and it looks like other dialogs e.g. the help dialog can be invoked while the InputGesturesDialog is active. Rejected because it could potentially introduce subtle bugs.