X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Finternal%2Ftext%2Ftext-controller.cpp;h=112d07db4b6316469351b8ca5adf822d6ef78ef8;hp=1bb0fed78b8bc397a58387d99e68f08526d3cfd6;hb=11ba5d111fecad79f948f180e7976a5a236a3da7;hpb=c57e053b5795783ad92b0fd7f8fbaba6b6d9322a diff --git a/dali-toolkit/internal/text/text-controller.cpp b/dali-toolkit/internal/text/text-controller.cpp index 1bb0fed..112d07d 100644 --- a/dali-toolkit/internal/text/text-controller.cpp +++ b/dali-toolkit/internal/text/text-controller.cpp @@ -1313,6 +1313,23 @@ const std::string& Controller::GetInputOutlineProperties() const return GetDefaultOutlineProperties(); } +void Controller::SetInputModePassword( bool passwordInput ) +{ + if( NULL != mImpl->mEventData ) + { + mImpl->mEventData->mPasswordInput = passwordInput; + } +} + +bool Controller::IsInputModePassword() +{ + if( NULL != mImpl->mEventData ) + { + return mImpl->mEventData->mPasswordInput; + } + return false; +} + // public : Queries & retrieves. Layout::Engine& Controller::GetLayoutEngine() @@ -1690,8 +1707,15 @@ bool Controller::KeyEvent( const Dali::KeyEvent& keyEvent ) int keyCode = keyEvent.keyCode; const std::string& keyString = keyEvent.keyPressed; + const bool isNullKey = ( 0 == keyCode ) && ( keyString.empty() ); + // Pre-process to separate modifying events from non-modifying input events. - if( Dali::DALI_KEY_ESCAPE == keyCode ) + if( isNullKey ) + { + // In some platforms arrive key events with no key code. + // Do nothing. + } + else if( Dali::DALI_KEY_ESCAPE == keyCode ) { // Escape key is a special case which causes focus loss KeyboardFocusLostEvent(); @@ -1701,8 +1725,29 @@ bool Controller::KeyEvent( const Dali::KeyEvent& keyEvent ) ( Dali::DALI_KEY_CURSOR_UP == keyCode ) || ( Dali::DALI_KEY_CURSOR_DOWN == keyCode ) ) { - mImpl->mEventData->mCheckScrollAmount = true; + // If don't have any text, do nothing. + if( !mImpl->mTextUpdateInfo.mPreviousNumberOfCharacters ) + { + return false; + } + + uint32_t cursorPosition = mImpl->mEventData->mPrimaryCursorPosition; + uint32_t numberOfCharacters = mImpl->mTextUpdateInfo.mPreviousNumberOfCharacters; + uint32_t cursorLine = mImpl->mModel->mVisualModel->GetLineOfCharacter( cursorPosition ); + uint32_t numberOfLines = mImpl->mModel->GetNumberOfLines(); + + // Logic to determine whether this text control will lose focus or not. + if( ( Dali::DALI_KEY_CURSOR_LEFT == keyCode && 0 == cursorPosition ) || + ( Dali::DALI_KEY_CURSOR_RIGHT == keyCode && numberOfCharacters == cursorPosition) || + ( Dali::DALI_KEY_CURSOR_DOWN == keyCode && cursorLine == numberOfLines -1 ) || + ( Dali::DALI_KEY_CURSOR_DOWN == keyCode && numberOfCharacters == cursorPosition && cursorLine -1 == numberOfLines -1 ) || + ( Dali::DALI_KEY_CURSOR_UP == keyCode && cursorLine == 0 ) || + ( Dali::DALI_KEY_CURSOR_UP == keyCode && numberOfCharacters == cursorPosition && cursorLine == 1 ) ) + { + return false; + } + mImpl->mEventData->mCheckScrollAmount = true; Event event( Event::CURSOR_KEY_EVENT ); event.p1.mInt = keyCode; mImpl->mEventData->mEventQueue.push_back( event ); @@ -1740,6 +1785,7 @@ bool Controller::KeyEvent( const Dali::KeyEvent& keyEvent ) if ( ( mImpl->mEventData->mState != EventData::INTERRUPTED ) && ( mImpl->mEventData->mState != EventData::INACTIVE ) && + ( !isNullKey ) && ( Dali::DALI_KEY_SHIFT_LEFT != keyCode ) ) { // Should not change the state if the key is the shift send by the imf manager. @@ -1880,7 +1926,7 @@ void Controller::LongPressEvent( Gesture::State state, float x, float y ) mImpl->RequestRelayout(); } - else if( !mImpl->IsClipboardVisible() ) + else { // Reset the imf manger to commit the pre-edit before selecting the text. mImpl->ResetImfManager();