Merge "Fix InputMethodContext to work well in multi-window env" into devel/master
authorJIYUN YANG <ji.yang@samsung.com>
Mon, 2 Sep 2019 01:12:32 +0000 (01:12 +0000)
committerGerrit Code Review <gerrit@review.ap-northeast-2.compute.internal>
Mon, 2 Sep 2019 01:12:32 +0000 (01:12 +0000)
automated-tests/src/dali-toolkit/CMakeLists.txt
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-input-method-context.cpp
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-input-method-context.h
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-scene-holder.cpp [new file with mode: 0644]
dali-toolkit/internal/controls/text-controls/text-editor-impl.cpp
dali-toolkit/internal/controls/text-controls/text-field-impl.cpp
dali-toolkit/internal/focus-manager/keyboard-focus-manager-impl.cpp

index 21eb07c..7177d8c 100755 (executable)
@@ -96,6 +96,7 @@ LIST(APPEND TC_SOURCES
   dali-toolkit-test-utils/toolkit-video-player.cpp
   dali-toolkit-test-utils/toolkit-web-engine.cpp
   dali-toolkit-test-utils/toolkit-window.cpp
+  dali-toolkit-test-utils/toolkit-scene-holder.cpp
   dali-toolkit-test-utils/dali-test-suite-utils.cpp
   dali-toolkit-test-utils/dali-toolkit-test-suite-utils.cpp
   dali-toolkit-test-utils/dummy-control.cpp
index 775c0c0..74a2bd5 100755 (executable)
@@ -231,6 +231,11 @@ InputMethodContext::~InputMethodContext()
 
 InputMethodContext InputMethodContext::New()
 {
+  return InputMethodContext::New( Actor() );
+}
+
+InputMethodContext InputMethodContext::New( Actor actor )
+{
   return Internal::Adaptor::InputMethodContext::New();
 }
 
index 409e2b8..cf174cf 100755 (executable)
@@ -20,6 +20,7 @@
 
 // EXTERNAL INCLUDES
 #define DALI_INPUT_METHOD_CONTEXT_H
+#include <dali/public-api/actors/actor.h>
 #include <dali/public-api/object/base-handle.h>
 #include <dali/public-api/signals/dali-signal.h>
 #include <dali/devel-api/adaptor-framework/input-method-options.h>
@@ -148,6 +149,14 @@ public:
   static InputMethodContext New();
 
   /**
+   * @brief Create a handle to the instance of InputMethodContext.
+   *
+   * @param[in] actor The actor that uses the new InputMethodContext instance.
+   * @return A handle to the InputMethodContext.
+   */
+  static InputMethodContext New( Actor actor );
+
+  /**
    * @brief Finalize the InputMethodContext.
    *
    * It means that the context will be deleted.
diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-scene-holder.cpp b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-scene-holder.cpp
new file mode 100644 (file)
index 0000000..04afdeb
--- /dev/null
@@ -0,0 +1,106 @@
+/*
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include <dali/integration-api/adaptors/scene-holder.h>
+
+#include <dali/public-api/actors/actor.h>
+#include <dali/public-api/actors/layer.h>
+#include <dali/public-api/common/stage.h>
+#include <dali/public-api/object/base-object.h>
+
+namespace Dali
+{
+
+namespace Internal
+{
+
+namespace Adaptor
+{
+
+class SceneHolder: public Dali::BaseObject
+{
+
+};
+
+} // Adaptor
+
+} // Internal
+
+namespace Integration
+{
+
+SceneHolder::SceneHolder()
+{
+}
+
+SceneHolder::~SceneHolder()
+{
+}
+
+SceneHolder::SceneHolder( const SceneHolder& handle )
+: BaseHandle(handle)
+{
+}
+
+SceneHolder::SceneHolder( Internal::Adaptor::SceneHolder* internal )
+: BaseHandle(internal)
+{
+}
+
+SceneHolder& SceneHolder::operator=( const SceneHolder& rhs )
+{
+  BaseHandle::operator=(rhs);
+  return *this;
+}
+
+void SceneHolder::Add( Actor actor )
+{
+}
+
+void SceneHolder::Remove( Actor actor )
+{
+}
+
+Layer SceneHolder::GetRootLayer() const
+{
+  return Dali::Stage::GetCurrent().GetRootLayer();
+}
+
+void SceneHolder::SetBackgroundColor( Vector4 color )
+{
+}
+
+Vector4 SceneHolder::GetBackgroundColor() const
+{
+  return Dali::Stage::GetCurrent().GetBackgroundColor();
+}
+
+void SceneHolder::FeedTouchPoint( Dali::TouchPoint& point, int timeStamp )
+{
+}
+
+void SceneHolder::FeedWheelEvent( Dali::WheelEvent& wheelEvent )
+{
+}
+
+void SceneHolder::FeedKeyEvent( Dali::KeyEvent& keyEvent )
+{
+}
+
+} // Integration
+
+} // Dali
index 7ca679c..e4f245d 100755 (executable)
@@ -1221,7 +1221,7 @@ void TextEditor::OnInitialize()
   mDecorator = Text::Decorator::New( *mController,
                                      *mController );
 
-  mInputMethodContext = InputMethodContext::New();
+  mInputMethodContext = InputMethodContext::New( self );
 
   mController->GetLayoutEngine().SetLayout( Layout::Engine::MULTI_LINE_BOX );
 
index bf953ec..2c83872 100755 (executable)
@@ -1267,7 +1267,7 @@ void TextField::OnInitialize()
   mDecorator = Text::Decorator::New( *mController,
                                      *mController );
 
-  mInputMethodContext = InputMethodContext::New();
+  mInputMethodContext = InputMethodContext::New( self );
 
   mController->GetLayoutEngine().SetLayout( Layout::Engine::SINGLE_LINE_BOX );
 
index 5e447c4..09f71b3 100644 (file)
@@ -34,6 +34,7 @@
 #include <dali/public-api/object/property-map.h>
 #include <dali/public-api/images/resource-image.h>
 #include <dali/integration-api/adaptors/adaptor.h>
+#include <dali/integration-api/adaptors/scene-holder.h>
 #include <dali/integration-api/debug.h>
 
 // INTERNAL INCLUDES
@@ -328,7 +329,7 @@ Toolkit::Control KeyboardFocusManager::GetParentLayoutControl(Actor actor) const
   Actor parent;
   if(actor)
   {
-    rootActor = DevelWindow::Get( actor ).GetRootLayer();
+    rootActor = Integration::SceneHolder::Get( actor ).GetRootLayer();
     parent = actor.GetParent();
   }
 
@@ -410,7 +411,7 @@ bool KeyboardFocusManager::MoveFocus(Toolkit::Control::KeyboardFocus::Direction
 
           if( !nextFocusableActor )
           {
-            nextFocusableActor = DevelWindow::Get( currentFocusActor ).GetRootLayer().FindChildById( actorId );
+            nextFocusableActor = Integration::SceneHolder::Get( currentFocusActor ).GetRootLayer().FindChildById( actorId );
           }
         }
       }