Merge "DALi Version 1.2.52" into devel/master
[platform/core/uifw/dali-adaptor.git] / adaptors / wayland / compositor-output-region / compositor-output.h
1 #ifndef __DALI_INTERNAL_ADAPTOR_COMPOSITOR_OUTPUT_H__
2 #define __DALI_INTERNAL_ADAPTOR_COMPOSITOR_OUTPUT_H__
3
4 /*
5  * Copyright (c) 2016 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 // INTERNAL INCLUDES
22 #include <wl-types.h>
23
24
25 namespace Dali
26 {
27
28 namespace Internal
29 {
30
31 namespace Adaptor
32 {
33
34 /**
35  *
36  * An output is typically a monitor with Wayland.
37  * The output is required to view a region of the compositor space.
38  * E.g. a monitor may be display the entire compositor space, or just a
39  * region of that space.
40  * The output interface is published as global during start up, or when a monitor is
41  * hotplugged.
42  *
43  * Information available from the output includes
44  * - refresh rate
45  * - monitor dimensions in millimetres
46  * - monitor resolution
47  *
48  * We can use this information to calculate DPI for displaying text
49  */
50
51 class CompositorOutput
52 {
53
54 public:
55
56
57   /**
58    * @brief constructor
59    * @param[in] inputInterface input interface
60    * @param[in] seatInterface Wayland seat interface
61    */
62   CompositorOutput();
63
64   /**
65    * @brief non virtual destructor, not intended as base class
66    */
67   ~CompositorOutput();
68
69   /**
70    * @brief listen to output callbacks
71    * @param outputInterface[in] output interface
72    */
73   void AddListener( WlOutput* outputInterface );
74
75   /**
76    * @brief Get DPI
77    * @param[out] dpiHorizontal set to the horizontal DPI
78    * @param[out] dpiVertical set to the vertical DPI
79    */
80   static void GetDpi( unsigned int& dpiHorizontal, unsigned int& dpiVertical );
81
82
83   /**
84    * @brief return true if all information about the compositor output has been received
85    * and is ready to be read
86    * @return true if ready
87    */
88   bool DataReady() const;
89
90
91   /**
92    * @brief Set monitor size in millimetres
93    * @param[in] width width
94    * @param[in] height height
95    */
96   void SetMonitorDimensions( unsigned int width, unsigned int height );
97
98   /**
99    * @brief Set monitor resolution in pixels
100    * @param[in] width width
101    * @param[in] height height
102    */
103   void SetMonitorResolution( unsigned int width, unsigned int height );
104
105
106   /**
107    * @brief Called when all callbacks have finished
108    * at this point we calculate DPI
109    */
110   void CallbacksDone();
111
112 private:
113
114   // @brief Undefined copy constructor.
115   CompositorOutput( const CompositorOutput& );
116
117   // @brief Undefined assignment operator.
118   CompositorOutput& operator=( const CompositorOutput& );
119
120   WlOutput* mOutput;              ///< Compositor output ( info for attached monitor)
121   unsigned int mXresolution;      ///< Monitor resolution in pixel
122   unsigned int mYresolution;      ///< Monitor resolution in pixel
123   float mMonitorWidth;            ///< width in inches
124   float mMonitorHeight;           ///< height in inches
125   bool mDataReady:1;
126
127 };
128
129 } // Internal
130 } // Adaptor
131 } // Dali
132
133 #endif  //__DALI_INTERNAL_ADAPTOR_COMPOSITOR_OUTPUT_H__