From: Adeel Kazmi Date: Fri, 4 Sep 2015 13:03:04 +0000 (-0700) Subject: Merge "Notify the IMF when backspace/cut empties the TextField" into devel/master X-Git-Tag: dali_1.1.2~4 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=commitdiff_plain;h=dcf0eeebe1e683b311b675e93adcc21a0602e671;hp=daa53bafd34781116b8cb3a2a8c54475a932ba21 Merge "Notify the IMF when backspace/cut empties the TextField" into devel/master --- diff --git a/dali-toolkit/internal/text/text-controller.cpp b/dali-toolkit/internal/text/text-controller.cpp index a0302bc..f24e69a 100644 --- a/dali-toolkit/internal/text/text-controller.cpp +++ b/dali-toolkit/internal/text/text-controller.cpp @@ -1713,6 +1713,13 @@ void Controller::TextPopupButtonTouched( Dali::Toolkit::TextSelectionPopup::Butt { mImpl->SendSelectionToClipboard( true ); // Synchronous call to modify text mImpl->mOperationsPending = ALL_OPERATIONS; + + // This is to reset the virtual keyboard to Upper-case + if( 0u == mImpl->mLogicalModel->mText.Count() ) + { + NotifyImfManager(); + } + if( 0u != mImpl->mLogicalModel->mText.Count() || !mImpl->IsPlaceholderAvailable() ) { @@ -1876,6 +1883,12 @@ bool Controller::BackspaceKeyEvent() if( removed ) { + // This is to reset the virtual keyboard to Upper-case + if( 0u == mImpl->mLogicalModel->mText.Count() ) + { + NotifyImfManager(); + } + if( 0u != mImpl->mLogicalModel->mText.Count() || !mImpl->IsPlaceholderAvailable() ) { @@ -1891,6 +1904,22 @@ bool Controller::BackspaceKeyEvent() return removed; } +void Controller::NotifyImfManager() +{ + ImfManager imfManager = ImfManager::Get(); + + if( imfManager ) + { + // Notifying IMF of a cursor change triggers a surrounding text request so updating it now. + std::string text; + GetText( text ); + imfManager.SetSurroundingText( text ); + + imfManager.SetCursorPosition( GetLogicalCursorPosition() ); + imfManager.NotifyCursorPosition(); + } +} + void Controller::ShowPlaceholderText() { if( mImpl->IsPlaceholderAvailable() ) diff --git a/dali-toolkit/internal/text/text-controller.h b/dali-toolkit/internal/text/text-controller.h index e665ac2..3c6125d 100644 --- a/dali-toolkit/internal/text/text-controller.h +++ b/dali-toolkit/internal/text/text-controller.h @@ -643,6 +643,11 @@ private: bool BackspaceKeyEvent(); /** + * @brief Helper to notify IMF manager with surrounding text & cursor changes. + */ + void NotifyImfManager(); + + /** * @brief Helper to clear font-specific data. */ void ShowPlaceholderText();