diff --git a/src/ui/virtualkeyboard/virtualkeyboard.cpp b/src/ui/virtualkeyboard/virtualkeyboard.cpp index 01f72b2f1..6f3c05830 100644 --- a/src/ui/virtualkeyboard/virtualkeyboard.cpp +++ b/src/ui/virtualkeyboard/virtualkeyboard.cpp @@ -34,7 +34,7 @@ class VirtualKeyboardService void showVirtualKeyboard() { parent_->showVirtualKeyboardForcibly(); } - void hideVirtualKeyboard() { parent_->hideVirtualKeyboard(); } + void hideVirtualKeyboard() { parent_->hideVirtualKeyboardForcibly(); } void toggleVirtualKeyboard() { parent_->toggleVirtualKeyboard(); } @@ -325,13 +325,25 @@ void VirtualKeyboard::showVirtualKeyboardForcibly() { showVirtualKeyboard(); } +void VirtualKeyboard::hideVirtualKeyboardForcibly() { + if (!available_) { + return; + } + + hideVirtualKeyboard(); + + if (!instance_->virtualKeyboardAutoShow()) { + instance_->setInputMethodMode(InputMethodMode::PhysicalKeyboard); + } +} + void VirtualKeyboard::toggleVirtualKeyboard() { if (!available_) { return; } if (visible_) { - hideVirtualKeyboard(); + hideVirtualKeyboardForcibly(); } else { showVirtualKeyboardForcibly(); } diff --git a/src/ui/virtualkeyboard/virtualkeyboard.h b/src/ui/virtualkeyboard/virtualkeyboard.h index 92bff2f07..a94e096ac 100644 --- a/src/ui/virtualkeyboard/virtualkeyboard.h +++ b/src/ui/virtualkeyboard/virtualkeyboard.h @@ -40,6 +40,7 @@ class VirtualKeyboard : public VirtualKeyboardUserInterface { void hideVirtualKeyboard() override; void showVirtualKeyboardForcibly(); + void hideVirtualKeyboardForcibly(); void toggleVirtualKeyboard(); void updateInputPanel(InputContext *inputContext);