[Tizen] Add KeyEventGeneratedSignal for Get KeyEvent normally accepted/tizen/unified/20190709.071034 submit/tizen/20190708.073346
authorJoogab Yun <joogab.yun@samsung.com>
Mon, 8 Jul 2019 07:17:42 +0000 (16:17 +0900)
committerJoogab Yun <joogab.yun@samsung.com>
Mon, 8 Jul 2019 07:17:51 +0000 (16:17 +0900)
This reverts commit 2d361418a7b4c0f0fb8947b837b6273cf11b0dc2.

Change-Id: I2ea7ee617c4f9a8bfa3a0b75e468a410f5857927

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 b2a49223bd37dcab283dacf17ff70b85d1b66c9f..9331a991e755516f9f6dd724a9549dfa5c39c94a 100644 (file)
@@ -159,6 +159,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 2128b477dfd2af9ce04d54b7d6198469c9ab914c..1d82a441c7206af36c9802704480bfadc7b339a1 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
 
@@ -248,6 +249,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 a944d35e6e86ee5a72bc5156b05e0c4bdd770154..b30aa0c13c669b1c696d95d978a6bca1d912e571 100644 (file)
@@ -307,6 +307,12 @@ void Scene::EmitKeyEventSignal(const KeyEvent& event)
   mKeyEventSignal.Emit( event );
 }
 
+bool Scene::EmitKeyEventGeneratedSignal(const KeyEvent& event)
+{
+  // Emit the KeyEventGenerated signal when KeyEvent is generated
+  return mKeyEventGeneratedSignal.Emit( event );
+}
+
 void Scene::EmitEventProcessingFinishedSignal()
 {
   mEventProcessingFinishedSignal.Emit();
@@ -328,6 +334,11 @@ Integration::Scene::KeyEventSignalType& Scene::KeyEventSignal()
   return mKeyEventSignal;
 }
 
+Integration::Scene::KeyEventGeneratedSignalType& Scene::KeyEventGeneratedSignal()
+{
+  return mKeyEventGeneratedSignal;
+}
+
 Integration::Scene::EventProcessingFinishedSignalType& Scene::EventProcessingFinishedSignal()
 {
   return mEventProcessingFinishedSignal;
index fb09efd1ca48727630d24f34be8b833e567a0c69..166ef09c98ba8378d6f5a12274d9e99dd3189cb3 100644 (file)
@@ -181,6 +181,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.
    *
@@ -206,6 +213,11 @@ public:
    */
   Integration::Scene::KeyEventSignalType& KeyEventSignal();
 
+    /**
+   * @copydoc Integration::Scene::KeyEventGeneratedSignal()
+   */
+  Integration::Scene::KeyEventGeneratedSignalType& KeyEventGeneratedSignal();
+
   /**
    * @copydoc Integration::Scene::SignalEventProcessingFinished()
    */
@@ -289,6 +301,7 @@ private:
 
   // The key event signal
   Integration::Scene::KeyEventSignalType mKeyEventSignal;
+  Integration::Scene::KeyEventGeneratedSignalType   mKeyEventGeneratedSignal;
 
   // The event processing finished signal
   Integration::Scene::EventProcessingFinishedSignalType mEventProcessingFinishedSignal;
index 399c209b43f521d2922230be6f6c7ff447dcc7f0..3d9ef4747fa4304a54c3b40271a5f111bac806a0 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