VirtualKeyboard: Revamp visibility handling (#10852)

Move as much of the state tracking as possible inside VirtualKeyboard itself.
InputDialog unfortunately needs an internal tracking of this state because it needs to know about it *before* the VK is shown, so we have to keep a bit of duplication in there, although we do try much harder to keep everything in sync (at least at function call edges), and to keep the damage contained to, essentially, the toggle button's handler.

(Followup to #10803 & #10850)
This commit is contained in:
NiLuJe
2023-09-01 22:51:41 +02:00
committed by GitHub
parent 4d620d9fd2
commit 4cc620b702
7 changed files with 211 additions and 83 deletions

View File

@@ -218,7 +218,9 @@ end
function MultiInputDialog:onSwitchFocus(inputbox)
-- unfocus current inputbox
self._input_widget:unfocus()
self._input_widget:onCloseKeyboard()
-- and close its existing keyboard (via InputDialog's thin wrapper around _input_widget's own method)
self:onCloseKeyboard()
UIManager:setDirty(nil, function()
return "ui", self.dialog_frame.dimen
end)
@@ -226,7 +228,9 @@ function MultiInputDialog:onSwitchFocus(inputbox)
-- focus new inputbox
self._input_widget = inputbox
self._input_widget:focus()
self._input_widget:onShowKeyboard()
-- Make sure we have a (new) visible keyboard
self:onShowKeyboard()
end
return MultiInputDialog