Revert "[Tizen] ecore-wl2: applying ecore-wl2"
[platform/core/uifw/dali-adaptor.git] / dali / internal / window-system / common / display-connection.h
1 #ifndef DALI_INTERNAL_WINDOWSYSTEM_COMMON_DISPLAY_CONNECTION_H
2 #define DALI_INTERNAL_WINDOWSYSTEM_COMMON_DISPLAY_CONNECTION_H
3
4 /*
5  * Copyright (c) 2015 Samsung Electronics Co., Ltd.
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  */
20
21 // EXTERNAL INCLUDES
22 #include <dali/public-api/object/any.h>
23
24 // INTERNAL INCLUDES
25 #include <dali/devel-api/adaptor-framework/render-surface.h>
26
27 #include <memory>
28
29 namespace Dali
30 {
31
32 class EglInterface;
33
34 namespace Internal
35 {
36 namespace Adaptor
37 {
38 class DisplayConnection;
39 }
40 }
41
42 class DisplayConnection
43 {
44 public:
45
46   /**
47    * @brief Create an initialized DisplayConnection.
48    *
49    * @return A handle to a newly allocated DisplayConnection resource.
50    */
51   static DisplayConnection* New();
52
53   /**
54    * @brief Create an initialized DisplayConnection.
55    * Native surface will need this instead of DisplayConnection::New()
56    *
57    * @param[in] type Render surface type
58    * @return A handle to a newly allocated DisplayConnection resource.
59    */
60   static DisplayConnection* New( RenderSurface::Type type );
61
62   /**
63    * @brief Create a DisplayConnection handle; this can be initialised with DisplayConnection::New().
64    *
65    * Calling member functions with an uninitialised handle is not allowed.
66    */
67   DisplayConnection();
68
69   /**
70    * @brief Destructor
71    *
72    * This is non-virtual since derived Handle types must not contain data or virtual methods.
73    */
74   ~DisplayConnection();
75
76   /**
77    * @brief Get display
78    *
79    * @return display
80    */
81   Any GetDisplay();
82
83   /**
84    * @brief Get DPI
85    * @param[out] dpiHorizontal set to the horizontal dpi
86    * @param[out] dpiVertical set to the vertical dpi
87    */
88   static void GetDpi(unsigned int& dpiHorizontal, unsigned int& dpiVertical);
89
90   /**
91    * @brief Consumes any possible events on the queue so that there is no leaking between frames
92    */
93   void ConsumeEvents();
94
95   /**
96    * @brief Initialize EGL display
97    *
98    * @param egl implementation to use for the creation
99    */
100   bool InitializeEgl(EglInterface& egl);
101
102 public:
103
104   /**
105    * @brief This constructor is used by DisplayConnection New() methods.
106    *
107    * @param [in] handle A pointer to a newly allocated DisplayConnection resource
108    */
109   explicit DALI_INTERNAL DisplayConnection(Internal::Adaptor::DisplayConnection* impl);
110
111 private:
112
113   std::unique_ptr<Internal::Adaptor::DisplayConnection> mImpl;
114 };
115
116 }
117
118 #endif // DALI_INTERNAL_WINDOWSYSTEM_COMMON_DISPLAY_CONNECTION_H