From: Bowon Ryu Date: Thu, 15 Sep 2022 10:02:37 +0000 (+0900) Subject: Fix cursor position update issue X-Git-Tag: dali_2.1.41~8^2 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=commitdiff_plain;h=06610a90baadc44e9b7c6257ef3fd3e8606b7af3 Fix cursor position update issue When a text controller has focus and loses keyboard focus, the controller is in the INACTIVE state. But in this case, when the cursor position is updated from a key event, there is an issue that the position is not updated due to the wrong state. This patch changes the state of controller to EDITING in the issue case. Change-Id: Idea21a5486a7c076a59ad5dcd74c5b3343c1e2fe Signed-off-by: Bowon Ryu --- diff --git a/automated-tests/src/dali-toolkit-internal/utc-Dali-Text-Controller.cpp b/automated-tests/src/dali-toolkit-internal/utc-Dali-Text-Controller.cpp index 53b45f2..cbff44c 100755 --- a/automated-tests/src/dali-toolkit-internal/utc-Dali-Text-Controller.cpp +++ b/automated-tests/src/dali-toolkit-internal/utc-Dali-Text-Controller.cpp @@ -1146,6 +1146,9 @@ int UtcDaliTextControllerCheckInputFontPointSizeChanged(void) const Size size( application.GetScene().GetSize() ); controller->Relayout(size); + // For coverage + controller->KeyEvent( GenerateKey( "", "", DALI_KEY_CURSOR_LEFT, 0, 0, Dali::KeyEvent::DOWN ) ); + tet_result(TET_PASS); END_TEST; diff --git a/dali-toolkit/internal/text/controller/text-controller-event-handler.cpp b/dali-toolkit/internal/text/controller/text-controller-event-handler.cpp index e351342..ca6d7f5 100644 --- a/dali-toolkit/internal/text/controller/text-controller-event-handler.cpp +++ b/dali-toolkit/internal/text/controller/text-controller-event-handler.cpp @@ -191,6 +191,12 @@ bool Controller::EventHandler::KeyEvent(Controller& controller, const Dali::KeyE return false; } + if(controller.mImpl->mEventData->mState == EventData::INACTIVE) + { + // Cursor position will be updated + controller.mImpl->ChangeState(EventData::EDITING); + } + controller.mImpl->mEventData->mCheckScrollAmount = true; Event event(Event::CURSOR_KEY_EVENT); event.p1.mInt = keyCode;