[Tizen]Add KeyEventGeneratedSignal for Get KeyEvent normally 09/208009/1
authorSunghyun kim <scholb.kim@samsung.com>
Thu, 13 Jun 2019 10:10:45 +0000 (19:10 +0900)
committerSunghyun kim <scholb.kim@samsung.com>
Mon, 17 Jun 2019 04:04:42 +0000 (13:04 +0900)
Window can get KeyEvent even if control already use it.

Change-Id: I41631b5b3aef393e3e0134419b38acea20aed84a

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 9d89f317acc097a92727c756a54c3815b2b8f63f..0b2624db44974c7391926655a39c3dee6784eed1 100644 (file)
@@ -144,6 +144,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 f1b3059a5c2206492160c272a36fbd5fa4a57a18..4e44caf9f10c1e05611282eb0f5369bbf28aabf4 100755 (executable)
@@ -54,6 +54,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
 
@@ -228,6 +229,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 30a4a0f982b5e1d575a04accc08b64e87cfaadbc..89e0f0ef794291775b6d6233907ce199ca4a6e77 100644 (file)
@@ -278,6 +278,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();
@@ -299,6 +305,11 @@ Integration::Scene::KeyEventSignalType& Scene::KeyEventSignal()
   return mKeyEventSignal;
 }
 
+Integration::Scene::KeyEventGeneratedSignalType& Scene::KeyEventGeneratedSignal()
+{
+  return mKeyEventGeneratedSignal;
+}
+
 Integration::Scene::EventProcessingFinishedSignalType& Scene::EventProcessingFinishedSignal()
 {
   return mEventProcessingFinishedSignal;
index 634bcbd70f3dbdbc52e68e584471eb7855ef5516..2c3f3d41425776fb76b0aee60dc0408f8af13792 100644 (file)
@@ -171,6 +171,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.
    *
@@ -196,6 +203,11 @@ public:
    */
   Integration::Scene::KeyEventSignalType& KeyEventSignal();
 
+    /**
+   * @copydoc Integration::Scene::KeyEventGeneratedSignal()
+   */
+  Integration::Scene::KeyEventGeneratedSignalType& KeyEventGeneratedSignal();
+
   /**
    * @copydoc Integration::Scene::SignalEventProcessingFinished()
    */
@@ -277,6 +289,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