From 214095a0249b8b981b19371df6d6cfa60dfba8b6 Mon Sep 17 00:00:00 2001 From: Victor Cebollada Date: Mon, 7 Sep 2015 10:40:08 +0100 Subject: [PATCH] Fix setting a void string to the TEXT property. * Reset and notify the imf manager. * Do not call the IMF manager if the text control is not editable. Change-Id: If635978cef8503c1f2a42ee49ab75821f4d34915 Signed-off-by: Victor Cebollada --- dali-toolkit/internal/text/text-controller-impl.h | 15 +++++++----- dali-toolkit/internal/text/text-controller.cpp | 28 ++++++++++++++--------- 2 files changed, 26 insertions(+), 17 deletions(-) diff --git a/dali-toolkit/internal/text/text-controller-impl.h b/dali-toolkit/internal/text/text-controller-impl.h index 0efe8c1..d5fb69e 100644 --- a/dali-toolkit/internal/text/text-controller-impl.h +++ b/dali-toolkit/internal/text/text-controller-impl.h @@ -319,14 +319,17 @@ struct Controller::Impl void ResetImfManager() { - // Reset incase we are in a pre-edit state. - ImfManager imfManager = ImfManager::Get(); - if ( imfManager ) + if( mEventData ) { - imfManager.Reset(); // Will trigger a commit message + // Reset incase we are in a pre-edit state. + ImfManager imfManager = ImfManager::Get(); + if ( imfManager ) + { + imfManager.Reset(); // Will trigger a commit message + } + + ClearPreEditFlag(); } - - ClearPreEditFlag(); } bool IsClipboardEmpty() diff --git a/dali-toolkit/internal/text/text-controller.cpp b/dali-toolkit/internal/text/text-controller.cpp index 6bcb90c..ef10a3f 100644 --- a/dali-toolkit/internal/text/text-controller.cpp +++ b/dali-toolkit/internal/text/text-controller.cpp @@ -77,6 +77,9 @@ void Controller::SetText( const std::string& text ) { DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Controller::SetText\n" ); + // Reset keyboard as text changed + mImpl->ResetImfManager(); + // Remove the previously set text ResetText(); @@ -142,8 +145,8 @@ void Controller::SetText( const std::string& text ) mImpl->mEventData->mEventQueue.clear(); } - // Reset keyboard as text changed - mImpl->ResetImfManager(); + // Notify IMF as text changed + NotifyImfManager(); // Do this last since it provides callbacks into application code mImpl->mControlInterface.TextChanged(); @@ -1923,17 +1926,20 @@ bool Controller::BackspaceKeyEvent() void Controller::NotifyImfManager() { - ImfManager imfManager = ImfManager::Get(); - - if( imfManager ) + if( mImpl->mEventData ) { - // Notifying IMF of a cursor change triggers a surrounding text request so updating it now. - std::string text; - GetText( text ); - imfManager.SetSurroundingText( text ); + 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(); + imfManager.SetCursorPosition( GetLogicalCursorPosition() ); + imfManager.NotifyCursorPosition(); + } } } -- 2.7.4