(Window) Move methods from Devel to Public API & add a new GetDpi method 18/238118/3
authorAdeel Kazmi <adeel.kazmi@samsung.com>
Wed, 8 Jul 2020 17:11:38 +0000 (18:11 +0100)
committerAdeel Kazmi <adeel.kazmi@samsung.com>
Mon, 13 Jul 2020 17:57:59 +0000 (18:57 +0100)
Change-Id: I83eabbc3334bdd717e818eabac9330bd4c0a2062

dali/devel-api/adaptor-framework/window-devel.cpp [changed mode: 0755->0644]
dali/devel-api/adaptor-framework/window-devel.h [changed mode: 0755->0644]
dali/integration-api/adaptor-framework/scene-holder-impl.cpp
dali/integration-api/adaptor-framework/scene-holder-impl.h
dali/public-api/adaptor-framework/window.cpp
dali/public-api/adaptor-framework/window.h [changed mode: 0755->0644]

old mode 100755 (executable)
new mode 100644 (file)
index 7d046ec..cd0819f
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
@@ -88,16 +88,6 @@ EventProcessingFinishedSignalType& EventProcessingFinishedSignal( Window window
   return GetImplementation( window ).EventProcessingFinishedSignal();
 }
 
-KeyEventSignalType& KeyEventSignal( Window window )
-{
-  return GetImplementation( window ).KeyEventSignal();
-}
-
-TouchSignalType& TouchSignal( Window window )
-{
-  return GetImplementation( window ).TouchSignal();
-}
-
 WheelEventSignalType& WheelEventSignal( Window window )
 {
   return GetImplementation( window ).WheelEventSignal();
old mode 100755 (executable)
new mode 100644 (file)
index 3c97559..b70876d
@@ -124,36 +124,6 @@ DALI_ADAPTOR_API Window Get( Actor actor );
 DALI_ADAPTOR_API EventProcessingFinishedSignalType& EventProcessingFinishedSignal( Window window );
 
 /**
- * @brief This signal is emitted when key event is received.
- *
- * A callback of the following type may be connected:
- * @code
- *   void YourCallbackName(const KeyEvent& event);
- * @endcode
- * @param[in] window The window instance
- * @return The signal to connect to
- */
-DALI_ADAPTOR_API KeyEventSignalType& KeyEventSignal( Window window );
-
-/**
- * @brief This signal is emitted when the screen is touched and when the touch ends
- * (i.e. the down & up touch events only).
- *
- * If there are multiple touch points, then this will be emitted when the first touch occurs and
- * then when the last finger is lifted.
- * An interrupted event will also be emitted (if it occurs).
- * A callback of the following type may be connected:
- * @code
- *   void YourCallbackName( TouchData event );
- * @endcode
- *
- * @param[in] window The window instance
- * @return The touch signal to connect to
- * @note Motion events are not emitted.
- */
-DALI_ADAPTOR_API TouchSignalType& TouchSignal( Window window );
-
-/**
  * @brief This signal is emitted when wheel event is received.
  *
  * A callback of the following type may be connected:
index e296ea1..e545376 100644 (file)
@@ -20,6 +20,7 @@
 
 // EXTERNAL INCLUDES
 #include <sys/time.h>
+#include <dali/public-api/common/dali-common.h>
 #include <dali/public-api/actors/actor.h>
 #include <dali/public-api/actors/layer.h>
 #include <dali/integration-api/debug.h>
@@ -121,6 +122,7 @@ SceneHolder::SceneHolder()
   mId( mSceneHolderCounter++ ),
   mSurface( nullptr ),
   mAdaptor( nullptr ),
+  mDpi(),
   mIsBeingDeleted( false ),
   mAdaptorStarted( false ),
   mVisible( true )
@@ -186,6 +188,11 @@ Dali::Integration::Scene SceneHolder::GetScene()
   return mScene;
 }
 
+Uint16Pair SceneHolder::GetDpi() const
+{
+  return mDpi;
+}
+
 void SceneHolder::SetSurface(Dali::RenderSurfaceInterface* surface)
 {
   mSurface.reset( surface );
@@ -194,11 +201,7 @@ void SceneHolder::SetSurface(Dali::RenderSurfaceInterface* surface)
 
   SurfaceResized();
 
-  unsigned int dpiHorizontal, dpiVertical;
-  dpiHorizontal = dpiVertical = 0;
-
-  mSurface->GetDpi( dpiHorizontal, dpiVertical );
-  mScene.SetDpi( Vector2( static_cast<float>( dpiHorizontal ), static_cast<float>( dpiVertical ) ) );
+  InitializeDpi();
 
   mSurface->SetAdaptor( *mAdaptor );
   mSurface->SetScene( mScene );
@@ -252,6 +255,8 @@ void SceneHolder::SetAdaptor(Dali::Adaptor& adaptor)
     return;
   }
 
+  DALI_ASSERT_DEBUG(mSurface && "Surface needs to be set before calling this method\n");
+
   mAdaptorStarted = true;
 
   // Create the scene
@@ -264,17 +269,10 @@ void SceneHolder::SetAdaptor(Dali::Adaptor& adaptor)
   // Create an observer for the adaptor lifecycle
   mAdaptor->AddObserver( *mLifeCycleObserver );
 
-  if ( mSurface )
-  {
-    unsigned int dpiHorizontal, dpiVertical;
-    dpiHorizontal = dpiVertical = 0;
-
-    mSurface->GetDpi( dpiHorizontal, dpiVertical );
-    mScene.SetDpi( Vector2( static_cast<float>( dpiHorizontal ), static_cast<float>( dpiVertical ) ) );
+  InitializeDpi();
 
-    mSurface->SetAdaptor( *mAdaptor );
-    mSurface->SetScene( mScene );
-  }
+  mSurface->SetAdaptor( *mAdaptor );
+  mSurface->SetScene( mScene );
 
   OnAdaptorSet( adaptor );
 }
@@ -403,6 +401,17 @@ void SceneHolder::Reset()
   mAdaptor->ProcessCoreEvents();
 }
 
+void SceneHolder::InitializeDpi()
+{
+  unsigned int dpiHorizontal, dpiVertical;
+  dpiHorizontal = dpiVertical = 0;
+
+  mSurface->GetDpi( dpiHorizontal, dpiVertical );
+  mScene.SetDpi( Vector2( static_cast<float>( dpiHorizontal ), static_cast<float>( dpiVertical ) ) );
+
+  mDpi.SetX( dpiHorizontal );
+  mDpi.SetY( dpiVertical );
+}
 
 }// Adaptor
 
index 38560cf..9b14bfc 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_INTEGRATION_INTERNAL_SCENEHOLDER_H
 
 /*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
@@ -24,6 +24,7 @@
 #include <atomic>
 #include <dali/public-api/object/base-object.h>
 #include <dali/public-api/common/intrusive-ptr.h>
+#include <dali/public-api/math/uint-16-pair.h>
 #include <dali/integration-api/scene.h>
 #include <dali/integration-api/events/key-event-integ.h>
 #include <dali/integration-api/events/point.h>
@@ -106,6 +107,12 @@ public:
   Dali::Integration::Scene GetScene();
 
   /**
+   * @brief Retrieves the DPI of this sceneholder.
+   * @return The DPI.
+   */
+  Uint16Pair GetDpi() const;
+
+  /**
    * @brief Set the render surface
    * @param[in] surface The render surface
    */
@@ -295,6 +302,11 @@ private:
    */
   void Reset();
 
+  /**
+   * Initializes the DPI for this object.
+   */
+  void InitializeDpi();
+
 private:
 
   static uint32_t                                 mSceneHolderCounter; ///< A counter to track the SceneHolder creation
@@ -313,6 +325,9 @@ protected:
 
   Dali::Integration::TouchEventCombiner           mCombiner;           ///< Combines multi-touch events.
 
+
+  Uint16Pair                                      mDpi;                ///< The DPI for this SceneHolder.
+
   std::atomic<bool>                               mIsBeingDeleted;     ///< This is set only from the event thread and read only from the render thread
 
   bool                                            mAdaptorStarted:1;   ///< Whether the adaptor has started or not
index 554ab88..c073254 100644 (file)
@@ -122,6 +122,11 @@ Layer Window::GetLayer( uint32_t depth ) const
   return GetImplementation( *this ).GetLayer( depth );
 }
 
+Uint16Pair Window::GetDpi() const
+{
+  return GetImplementation(*this).GetDpi();
+}
+
 void Window::SetClass( std::string name, std::string klass )
 {
   GetImplementation(*this).SetClass( name, klass );
@@ -323,6 +328,21 @@ void Window::SetTransparency( bool transparent )
   GetImplementation(*this).SetTransparency( transparent );
 }
 
+Dali::RenderTaskList Window::GetRenderTaskList()
+{
+  return GetImplementation(*this).GetRenderTaskList();
+}
+
+Window::KeyEventSignalType& Window::KeyEventSignal()
+{
+  return GetImplementation(*this).KeyEventSignal();
+}
+
+Window::TouchSignalType& Window::TouchSignal()
+{
+  return GetImplementation(*this).TouchSignal();
+}
+
 Window::Window( Internal::Adaptor::Window* window )
 : BaseHandle( window )
 {
old mode 100755 (executable)
new mode 100644 (file)
index 421b65d..05a86de
@@ -55,6 +55,9 @@ class DragAndDropDetector;
 class Orientation;
 class Actor;
 class Layer;
+class RenderTaskList;
+class TouchData;
+struct KeyEvent;
 
 /**
  * @brief The window class is used internally for drawing.
@@ -67,12 +70,15 @@ class DALI_ADAPTOR_API Window : public BaseHandle
 {
 public:
 
-  typedef Uint16Pair WindowSize;          ///< Window size type @SINCE_1_2.60
-  typedef Uint16Pair WindowPosition;      ///< Window position type @SINCE_1_2.60
+  using WindowSize = Uint16Pair ;     ///< Window size type @SINCE_1_2.60
+  using WindowPosition = Uint16Pair;  ///< Window position type @SINCE_1_2.60
+
+  using ResizedSignalType = Signal< void (WindowSize) >;       ///< @DEPRECATED_1_4.35 @brief Window resized signal type @SINCE_1_2.60
+  using FocusChangeSignalType = Signal< void (Window,bool) >;  ///< Window focus signal type @SINCE_1_4.35
+  using ResizeSignalType = Signal< void (Window,WindowSize) >; ///< Window resized signal type @SINCE_1_4.35
+  using KeyEventSignalType = Signal< void (const KeyEvent&) >; ///< Key event signal type
+  using TouchSignalType = Signal< void (const TouchData&) >;   ///< Touch signal type
 
-  typedef Signal< void (WindowSize) > ResizedSignalType; ///< @DEPRECATED_1_4.35 @brief Window resized signal type @SINCE_1_2.60
-  typedef Signal< void (Window,bool) > FocusChangeSignalType;         ///< Window focus signal type @SINCE_1_4.35
-  typedef Signal< void (Window,WindowSize) > ResizeSignalType; ///< Window resized signal type @SINCE_1_4.35
 public:
 
   // Enumerations
@@ -271,6 +277,14 @@ public:
   Layer GetLayer( uint32_t depth ) const;
 
   /**
+   * @brief Retrieves the DPI of the window.
+   *
+   * @SINCE_1_9.21
+   * @return The DPI of the window
+   */
+  Uint16Pair GetDpi() const;
+
+  /**
    * @brief Sets the window name and class string.
    * @SINCE_1_0.0
    * @param[in] name The name of the window
@@ -576,6 +590,14 @@ public:
    */
   void SetTransparency( bool transparent );
 
+  /**
+   * @brief Retrieves the list of render-tasks in the window.
+   *
+   * @SINCE_1_9.21
+   * @return A valid handle to a RenderTaskList
+   */
+  RenderTaskList GetRenderTaskList();
+
 public: // Signals
 
   /**
@@ -622,6 +644,38 @@ public: // Signals
    */
   ResizeSignalType& ResizeSignal();
 
+  /**
+   * @brief This signal is emitted when key event is received.
+   *
+   * A callback of the following type may be connected:
+   * @code
+   *   void YourCallbackName(const KeyEvent& event);
+   * @endcode
+   *
+   * @SINCE_1_9.21
+   * @return The signal to connect to
+   */
+  KeyEventSignalType& KeyEventSignal();
+
+  /**
+   * @brief This signal is emitted when the screen is touched and when the touch ends
+   * (i.e. the down & up touch events only).
+   *
+   * If there are multiple touch points, then this will be emitted when the first touch occurs and
+   * then when the last finger is lifted.
+   * An interrupted event will also be emitted (if it occurs).
+   * A callback of the following type may be connected:
+   * @code
+   *   void YourCallbackName(const TouchData& event);
+   * @endcode
+   *
+   * @SINCE_1_9.21
+   * @return The touch signal to connect to
+   *
+   * @note Motion events are not emitted.
+   */
+  TouchSignalType& TouchSignal();
+
 public: // Not intended for application developers
   /// @cond internal
   /**