Browse Source

Android: Fix dismissing screen keyboard when interacting with TextEditor

pull/22/head
attila 3 years ago
parent
commit
627afffeb4
6 changed files with 26 additions and 7 deletions
  1. +1
    -1
      modules/juce_gui_basics/native/juce_android_Windowing.cpp
  2. +1
    -1
      modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm
  3. +6
    -1
      modules/juce_gui_basics/native/juce_win32_Windowing.cpp
  4. +2
    -2
      modules/juce_gui_basics/widgets/juce_TextEditor.cpp
  5. +6
    -1
      modules/juce_gui_basics/windows/juce_ComponentPeer.cpp
  6. +10
    -1
      modules/juce_gui_basics/windows/juce_ComponentPeer.h

+ 1
- 1
modules/juce_gui_basics/native/juce_android_Windowing.cpp View File

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


+ 1
- 1
modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm View File

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


+ 6
- 1
modules/juce_gui_basics/native/juce_win32_Windowing.cpp View File

@@ -1874,9 +1874,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();


+ 2
- 2
modules/juce_gui_basics/widgets/juce_TextEditor.cpp View File

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


+ 6
- 1
modules/juce_gui_basics/windows/juce_ComponentPeer.cpp View File

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


+ 10
- 1
modules/juce_gui_basics/windows/juce_ComponentPeer.h View File

@@ -356,7 +356,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. */


Loading…
Cancel
Save