1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

Android: Fix dismissing screen keyboard when interacting with TextEditor

This commit is contained in:
attila 2022-04-27 15:44:45 +02:00
parent 5938796f43
commit 31d4f9059d
6 changed files with 26 additions and 7 deletions

View file

@ -940,7 +940,7 @@ public:
if (! isTimerRunning())
startTimer (500);
}
}
//==============================================================================
void handlePaintCallback (jobject canvas, jobject paint)

View file

@ -1569,7 +1569,7 @@ public:
void textInputRequired (Point<int>, TextInputTarget&) override {}
void dismissPendingTextInput() override
void closeInputMethodContext() override
{
stringBeingComposed.clear();
const auto* inputContext = [NSTextInputContext currentInputContext];

View file

@ -1869,9 +1869,14 @@ public:
OnScreenKeyboard::getInstance()->activate();
}
void dismissPendingTextInput() override
void closeInputMethodContext() override
{
imeHandler.handleSetContext (hwnd, false);
}
void dismissPendingTextInput() override
{
closeInputMethodContext();
if (uwpViewSettings.isTabletModeActivatedForWindow (hwnd))
OnScreenKeyboard::getInstance()->deactivate();

View file

@ -1838,7 +1838,7 @@ void TextEditor::mouseDown (const MouseEvent& e)
e.mods.isShiftDown());
if (auto* peer = getPeer())
peer->dismissPendingTextInput();
peer->closeInputMethodContext();
}
else
{
@ -1961,7 +1961,7 @@ bool TextEditor::moveCaretWithTransaction (const int newPos, const bool selectin
moveCaretTo (newPos, selecting);
if (auto* peer = getPeer())
peer->dismissPendingTextInput();
peer->closeInputMethodContext();
return true;
}

View file

@ -274,7 +274,12 @@ TextInputTarget* ComponentPeer::findCurrentTextInputTarget()
return nullptr;
}
void ComponentPeer::dismissPendingTextInput() {}
void ComponentPeer::closeInputMethodContext() {}
void ComponentPeer::dismissPendingTextInput()
{
closeInputMethodContext();
}
//==============================================================================
void ComponentPeer::handleBroughtToFront()

View file

@ -359,7 +359,16 @@ public:
*/
virtual void textInputRequired (Point<int> position, TextInputTarget&) = 0;
/** If there's some kind of OS input-method in progress, this should dismiss it. */
/** If there's a currently active input-method context - i.e. characters are being
composed using multiple keystrokes - this should commit the current state of the
context to the text and clear the context.
*/
virtual void closeInputMethodContext();
/** If there's some kind of OS input-method in progress, this should dismiss it.
Overrides of this function should call closeInputMethodContext().
*/
virtual void dismissPendingTextInput();
/** Returns the currently focused TextInputTarget, or null if none is found. */