[Tizen] Add KeyEventGeneratedSignal for Get KeyEvent normally
authorSeoyeon Kim <seoyeon2.kim@samsung.com>
Mon, 5 Aug 2019 04:43:12 +0000 (13:43 +0900)
committerSeoyeon Kim <seoyeon2.kim@samsung.com>
Mon, 5 Aug 2019 04:43:15 +0000 (13:43 +0900)
This reverts commit 7cd83f52b8fd45e3c8089016b1b6b871d5b79d68.

Change-Id: I465a871c009cd6f9a823eb94a8d31e131e65954b

dali/integration-api/scene.cpp
dali/integration-api/scene.h
dali/internal/event/common/scene-impl.cpp
dali/internal/event/common/scene-impl.h
dali/internal/event/events/key-event-processor.cpp

index 38e2477..8fef6db 100644 (file)
@@ -164,6 +164,11 @@ Scene::KeyEventSignalType& Scene::KeyEventSignal()
   return GetImplementation(*this).KeyEventSignal();
 }
 
+Scene::KeyEventGeneratedSignalType& Scene::KeyEventGeneratedSignal()
+{
+  return GetImplementation(*this).KeyEventGeneratedSignal();
+}
+
 Scene::TouchSignalType& Scene::TouchSignal()
 {
   return GetImplementation(*this).TouchSignal();
index c53c413..8669d82 100755 (executable)
@@ -55,6 +55,7 @@ class DALI_CORE_API Scene : public BaseHandle
 public:
   typedef Signal< void () > EventProcessingFinishedSignalType; ///< Event Processing finished signal type
   typedef Signal< void (const Dali::KeyEvent&) > KeyEventSignalType; ///< Key event signal type
+  typedef Signal< bool (const Dali::KeyEvent&) > KeyEventGeneratedSignalType; ///< key event generated signal type
   typedef Signal< void (const Dali::TouchData&) > TouchSignalType; ///< Touch signal type
   typedef Signal< void (const Dali::WheelEvent&) > WheelEventSignalType; ///< Touched signal type
 
@@ -254,6 +255,13 @@ public:
   KeyEventSignalType& KeyEventSignal();
 
   /**
+   * @brief The user would connect to this signal to get a KeyEvent when KeyEvent is generated.
+   *
+   * @return The return is true if KeyEvent is consumed, otherwise false.
+   */
+  KeyEventGeneratedSignalType& KeyEventGeneratedSignal();
+
+  /**
    * @brief This signal is emitted when the screen is touched and when the touch ends
    * (i.e. the down & up touch events only).
    *
index a4c65c5..c14470d 100644 (file)
@@ -321,6 +321,12 @@ void Scene::EmitKeyEventSignal(const KeyEvent& event)
   }
 }
 
+bool Scene::EmitKeyEventGeneratedSignal(const KeyEvent& event)
+{
+  // Emit the KeyEventGenerated signal when KeyEvent is generated
+  return mKeyEventGeneratedSignal.Emit( event );
+}
+
 void Scene::EmitEventProcessingFinishedSignal()
 {
   if ( !mEventProcessingFinishedSignal.Empty() )
@@ -357,6 +363,11 @@ Integration::Scene::KeyEventSignalType& Scene::KeyEventSignal()
   return mKeyEventSignal;
 }
 
+Integration::Scene::KeyEventGeneratedSignalType& Scene::KeyEventGeneratedSignal()
+{
+  return mKeyEventGeneratedSignal;
+}
+
 Integration::Scene::EventProcessingFinishedSignalType& Scene::EventProcessingFinishedSignal()
 {
   return mEventProcessingFinishedSignal;
index 2c93c84..f9db963 100644 (file)
@@ -187,6 +187,13 @@ public:
   void EmitKeyEventSignal(const KeyEvent& event);
 
   /**
+   * Used by the KeyEventProcessor to emit KeyEventGenerated signals.
+   * @param[in] event The key event.
+   * @return The return is true if KeyEvent is consumed, otherwise false.
+   */
+  bool EmitKeyEventGeneratedSignal(const KeyEvent& event);
+
+  /**
    * Emits the event processing finished signal.
    *
    * @see Dali::Scene::SignalEventProcessingFinished()
@@ -211,6 +218,11 @@ public:
    */
   Integration::Scene::KeyEventSignalType& KeyEventSignal();
 
+    /**
+   * @copydoc Integration::Scene::KeyEventGeneratedSignal()
+   */
+  Integration::Scene::KeyEventGeneratedSignalType& KeyEventGeneratedSignal();
+
   /**
    * @copydoc Integration::Scene::SignalEventProcessingFinished()
    */
@@ -292,6 +304,7 @@ private:
 
   // The key event signal
   Integration::Scene::KeyEventSignalType mKeyEventSignal;
+  Integration::Scene::KeyEventGeneratedSignalType   mKeyEventGeneratedSignal;
 
   // The event processing finished signal
   Integration::Scene::EventProcessingFinishedSignalType mEventProcessingFinishedSignal;
index 399c209..3d9ef47 100755 (executable)
@@ -25,6 +25,7 @@
 #include <dali/internal/event/common/scene-impl.h>
 #include <dali/integration-api/events/key-event-integ.h>
 
+
 namespace Dali
 {
 
@@ -50,7 +51,12 @@ void KeyEventProcessor::ProcessKeyEvent( const Integration::KeyEvent& event )
   GetImplementation( &keyEvent )->SetDeviceSubclass( event.deviceSubclass );
 
   // Emit the key event signal from the scene.
-  mScene.EmitKeyEventSignal( keyEvent );
+  bool consumed = mScene.EmitKeyEventGeneratedSignal( keyEvent );
+  if( !consumed )
+  {
+    mScene.EmitKeyEventSignal(keyEvent);
+  }
+
 }
 
 } // namespace Internal