[AT-SPI] Add resource id to window attribute
[platform/core/uifw/dali-adaptor.git] / dali / internal / window-system / common / window-base.h
1 #ifndef DALI_INTERNAL_WINDOWSYSTEM_COMMON_WINDOW_BASE_H
2 #define DALI_INTERNAL_WINDOWSYSTEM_COMMON_WINDOW_BASE_H
3
4 /*
5  * Copyright (c) 2022 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/integration-api/events/key-event-integ.h>
23 #include <dali/integration-api/events/point.h>
24 #include <dali/integration-api/events/wheel-event-integ.h>
25 #include <cstdint>
26 #include <string>
27 #include <vector>
28
29 // INTERNAL INCLUDES
30 #include <dali/devel-api/adaptor-framework/window-devel.h>
31 #include <dali/internal/graphics/gles/egl-implementation.h>
32 #include <dali/internal/window-system/common/damage-observer.h>
33 #include <dali/internal/window-system/common/rotation-event.h>
34 #include <dali/public-api/adaptor-framework/key-grab.h>
35 #include <dali/public-api/adaptor-framework/style-change.h>
36 #include <dali/public-api/adaptor-framework/window-enumerations.h>
37 #include <dali/public-api/adaptor-framework/window.h>
38
39 namespace Dali
40 {
41 namespace Internal
42 {
43 namespace Adaptor
44 {
45 /**
46  * WindowBase interface
47  */
48 class WindowBase
49 {
50 public:
51   /**
52    * @brief Struct used to retrieve accessibility information
53    */
54   struct AccessibilityInfo
55   {
56     int gestureValue;
57     int startX;
58     int startY;
59     int endX;
60     int endY;
61     int state;
62     int eventTime;
63   };
64
65   // Window
66   typedef Signal<void(bool)>                                IconifySignalType;
67   typedef Signal<void(bool)>                                FocusSignalType;
68   typedef Signal<void()>                                    OutputSignalType;
69   typedef Signal<void()>                                    DeleteSignalType;
70   typedef Signal<void(const DamageArea&)>                   DamageSignalType;
71   typedef Signal<void(const RotationEvent&)>                RotationSignalType;
72   typedef Signal<void(WindowEffectState, WindowEffectType)> TransitionEffectEventSignalType;
73   typedef Signal<void()>                                    KeyboardRepeatSettingsChangedSignalType;
74   typedef Signal<void()>                                    WindowRedrawRequestSignalType;
75   typedef Signal<void(Dali::PositionSize&)>                 UpdatePositionSizeType;
76   typedef Signal<void(const std::string&, const std::string&, const Property::Array&)>             AuxiliaryMessageSignalType;
77
78   // Input events
79   typedef Signal<void(Integration::Point&, uint32_t)> TouchEventSignalType;
80   typedef Signal<void(Integration::WheelEvent&)>      WheelEventSignalType;
81   typedef Signal<void(Integration::KeyEvent&)>        KeyEventSignalType;
82
83   // Clipboard
84   typedef Signal<void(void*)> SelectionSignalType;
85
86   // Accessibility
87   typedef Signal<void(StyleChange::Type)>        StyleSignalType;
88   typedef Signal<void(const AccessibilityInfo&)> AccessibilitySignalType;
89
90   /**
91    * @brief Default constructor
92    */
93   WindowBase();
94
95   /**
96    * @brief Destructor
97    */
98   virtual ~WindowBase();
99
100 public:
101   /**
102    * @brief Get the native window handle
103    * @return The native window handle
104    */
105   virtual Any GetNativeWindow() = 0;
106
107   /**
108    * @brief Get the native window id
109    * @return The native window id
110    */
111   virtual int GetNativeWindowId() = 0;
112
113   /**
114    * @brief Get the native window resource id assinged by window manager
115    * @return The native window resource id
116    */
117   virtual std::string GetNativeWindowResourceId() = 0;
118
119   /**
120    * @brief Create the egl window
121    */
122   virtual EGLNativeWindowType CreateEglWindow(int width, int height) = 0;
123
124   /**
125    * @brief Destroy the egl window
126    */
127   virtual void DestroyEglWindow() = 0;
128
129   /**
130    * @brief Set the egl window rotation
131    */
132   virtual void SetEglWindowRotation(int angle) = 0;
133
134   /**
135    * @brief Set the egl window buffer transform
136    */
137   virtual void SetEglWindowBufferTransform(int angle) = 0;
138
139   /**
140    * @brief Set the egl window transform
141    */
142   virtual void SetEglWindowTransform(int angle) = 0;
143
144   /**
145    * @brief Resize the egl window
146    */
147   virtual void ResizeEglWindow(Dali::PositionSize positionSize) = 0;
148
149   /**
150    * @brief Returns whether the egl window support rotation or not
151    */
152   virtual bool IsEglWindowRotationSupported() = 0;
153
154   /**
155    * @brief Move the window
156    */
157   virtual void Move(Dali::PositionSize positionSize) = 0;
158
159   /**
160    * @brief Resize the window
161    */
162   virtual void Resize(Dali::PositionSize positionSize) = 0;
163
164   /**
165    * @brief Move and resize the window
166    */
167   virtual void MoveResize(Dali::PositionSize positionSize) = 0;
168
169   /**
170    * @copydoc Dali::Window::SetClass()
171    */
172   virtual void SetClass(const std::string& name, const std::string& className) = 0;
173
174   /**
175    * @copydoc Dali::Window::Raise()
176    */
177   virtual void Raise() = 0;
178
179   /**
180    * @copydoc Dali::Window::Lower()
181    */
182   virtual void Lower() = 0;
183
184   /**
185    * @copydoc Dali::Window::Activate()
186    */
187   virtual void Activate() = 0;
188
189   /**
190    * @copydoc Dali::DevelWindow::Maximize()
191    */
192   virtual void Maximize(bool maximize) = 0;
193
194   /**
195    * @copydoc Dali::DevelWindow::IsMaximized()
196    */
197   virtual bool IsMaximized() const = 0;
198
199   /**
200    * @copydoc Dali::DevelWindow::Minimize()
201    */
202   virtual void Minimize(bool minimize) = 0;
203
204   /**
205    * @copydoc Dali::DevelWindow::IsMinimized()
206    */
207   virtual bool IsMinimized() const = 0;
208
209   /**
210    * @copydoc Dali::Window::SetAvailableOrientations()
211    */
212   virtual void SetAvailableAnlges(const std::vector<int>& angles) = 0;
213
214   /**
215    * @copydoc Dali::Window::SetPreferredOrientation()
216    */
217   virtual void SetPreferredAngle(int angle) = 0;
218
219   /**
220    * @copydoc Dali::Window::SetAcceptFocus()
221    */
222   virtual void SetAcceptFocus(bool accept) = 0;
223
224   /**
225    * @copydoc Dali::Window::Show()
226    */
227   virtual void Show() = 0;
228
229   /**
230    * @copydoc Dali::Window::Hide()
231    */
232   virtual void Hide() = 0;
233
234   /**
235    * @copydoc Dali::Window::GetSupportedAuxiliaryHintCount()
236    */
237   virtual unsigned int GetSupportedAuxiliaryHintCount() const = 0;
238
239   /**
240    * @copydoc Dali::Window::GetSupportedAuxiliaryHint()
241    */
242   virtual std::string GetSupportedAuxiliaryHint(unsigned int index) const = 0;
243
244   /**
245    * @copydoc Dali::Window::AddAuxiliaryHint()
246    */
247   virtual unsigned int AddAuxiliaryHint(const std::string& hint, const std::string& value) = 0;
248
249   /**
250    * @copydoc Dali::Window::RemoveAuxiliaryHint()
251    */
252   virtual bool RemoveAuxiliaryHint(unsigned int id) = 0;
253
254   /**
255    * @copydoc Dali::Window::SetAuxiliaryHintValue()
256    */
257   virtual bool SetAuxiliaryHintValue(unsigned int id, const std::string& value) = 0;
258
259   /**
260    * @copydoc Dali::Window::GetAuxiliaryHintValue()
261    */
262   virtual std::string GetAuxiliaryHintValue(unsigned int id) const = 0;
263
264   /**
265    * @copydoc Dali::Window::GetAuxiliaryHintId()
266    */
267   virtual unsigned int GetAuxiliaryHintId(const std::string& hint) const = 0;
268
269   /**
270    * @copydoc Dali::Window::SetInputRegion()
271    */
272   virtual void SetInputRegion(const Rect<int>& inputRegion) = 0;
273
274   /**
275    * @copydoc Dali::Window::SetType()
276    */
277   virtual void SetType(Dali::WindowType type) = 0;
278
279   /**
280    * @copydoc Dali::Window::GetType()
281    */
282   virtual Dali::WindowType GetType() const = 0;
283
284   /**
285    * @copydoc Dali::Window::SetNotificationLevel()
286    */
287   virtual Dali::WindowOperationResult SetNotificationLevel(Dali::WindowNotificationLevel level) = 0;
288
289   /**
290    * @copydoc Dali::Window::GetNotificationLevel()
291    */
292   virtual Dali::WindowNotificationLevel GetNotificationLevel() const = 0;
293
294   /**
295    * @copydoc Dali::Window::SetOpaqueState()
296    */
297   virtual void SetOpaqueState(bool opaque) = 0;
298
299   /**
300    * @copydoc Dali::Window::SetScreenOffMode()
301    */
302   virtual Dali::WindowOperationResult SetScreenOffMode(WindowScreenOffMode screenOffMode) = 0;
303
304   /**
305    * @copydoc Dali::Window::GetScreenOffMode()
306    */
307   virtual WindowScreenOffMode GetScreenOffMode() const = 0;
308
309   /**
310    * @copydoc Dali::Window::SetBrightness()
311    */
312   virtual Dali::WindowOperationResult SetBrightness(int brightness) = 0;
313
314   /**
315    * @copydoc Dali::Window::GetBrightness()
316    */
317   virtual int GetBrightness() const = 0;
318
319   /**
320    * @copydoc Dali::KeyGrab::GrabKey()
321    */
322   virtual bool GrabKey(Dali::KEY key, KeyGrab::KeyGrabMode grabMode) = 0;
323
324   /**
325    * @copydoc Dali::KeyGrab::UngrabKey()
326    */
327   virtual bool UngrabKey(Dali::KEY key) = 0;
328
329   /**
330    * @copydoc Dali::KeyGrab::GrabKeyList()
331    */
332   virtual bool GrabKeyList(const Dali::Vector<Dali::KEY>& key, const Dali::Vector<KeyGrab::KeyGrabMode>& grabMode, Dali::Vector<bool>& result) = 0;
333
334   /**
335    * @copydoc Dali::KeyGrab::UngrabKeyList()
336    */
337   virtual bool UngrabKeyList(const Dali::Vector<Dali::KEY>& key, Dali::Vector<bool>& result) = 0;
338
339   /**
340    * @brief Get DPI
341    * @param[out] dpiHorizontal set to the horizontal dpi
342    * @param[out] dpiVertical set to the vertical dpi
343    */
344   virtual void GetDpi(unsigned int& dpiHorizontal, unsigned int& dpiVertical) = 0;
345
346   /**
347    * @brief Return the orientation of the surface.
348    * @return The orientation
349    */
350   virtual int GetOrientation() const = 0;
351
352   /**
353    * @brief Get the screen rotation angle of the window
354    */
355   virtual int GetScreenRotationAngle() = 0;
356
357   /**
358    * @brief Set the rotation angle of the window
359    */
360   virtual void SetWindowRotationAngle(int degree) = 0;
361
362   /**
363    * @brief Inform the window rotation is completed
364    */
365   virtual void WindowRotationCompleted(int degree, int width, int height) = 0;
366
367   /**
368    * @brief starts the window is moved by display server
369    */
370   virtual void RequestMoveToServer() = 0;
371
372   /**
373    * @brief starts the window is resized by display server
374    *
375    * @param[in] direction It is direction of the started edge/side.
376    */
377   virtual void RequestResizeToServer(WindowResizeDirection direction) = 0;
378
379   /**
380    * @brief Enables the floating mode of window.
381    *
382    * The floating mode is to support making partial size window easliy.
383    * It is useful to make popup style window
384    * and this window is always upper than the other normal window.
385    *
386    * A special display server(as a Tizen display server) supports this mode.
387    *
388    * @param[in] enable Enable floating mode or not.
389    */
390   virtual void EnableFloatingMode(bool enable) = 0;
391
392   /**
393    * @brief Gets whether floating mode is enabled or not.
394    */
395   virtual bool IsFloatingModeEnabled() const = 0;
396
397   /**
398    * @copydoc Dali::Window::SetTransparency()
399    */
400   virtual void SetTransparency(bool transparent) = 0;
401
402   /**
403    * @copydoc Dali::Window::SetParent()
404    */
405   virtual void SetParent(WindowBase* parentWinBase, bool belowParent) = 0;
406
407   /**
408    * @brief Create a sync fence that can tell the frame is rendered by the graphics driver.
409    * @return The file descriptor that tells when it is rendered.
410    */
411   virtual int CreateFrameRenderedSyncFence() = 0;
412
413   /**
414    * @brief Create a sync fence that can tell the frame is presented by the display server.
415    * @return The file descriptor that tells when it is presented.
416    */
417   virtual int CreateFramePresentedSyncFence() = 0;
418
419   /**
420    * @copydoc Dali::Window::SetPositionSizeWithAngle()
421    */
422   virtual void SetPositionSizeWithAngle(PositionSize positionSize, int angle) = 0;
423
424   /**
425    * @brief Initialize for Ime window.
426    * It should be called when the window is only used for Ime keyboard window.
427    */
428   virtual void InitializeIme() = 0;
429
430   /**
431    * @brief Send the signal to display server for Ime Window is ready to render.
432    * It is used for compositing by display server.
433    */
434   virtual void ImeWindowReadyToRender() = 0;
435
436   /**
437    * @brief Includes input region.
438    * @param[in] inputRegion The added region to accept input events.
439    */
440   virtual void IncludeInputRegion(const Rect<int>& inputRegion) = 0;
441
442   /**
443    * @brief Excludes input region.
444    * @param[in] inputRegion The subtracted region to except input events.
445    */
446   virtual void ExcludeInputRegion(const Rect<int>& inputRegion) = 0;
447
448   // Signals
449
450   /**
451    * @brief This signal is emitted when the window becomes iconified or deiconified.
452    */
453   IconifySignalType& IconifyChangedSignal();
454
455   /**
456    * @brief This signal is emitted when the window focus is changed.
457    */
458   FocusSignalType& FocusChangedSignal();
459
460   /**
461    * @brief This signal is emitted when the output is transformed.
462    */
463   OutputSignalType& OutputTransformedSignal();
464
465   /**
466    * @brief This signal is emitted when the window receives a delete request.
467    */
468   DeleteSignalType& DeleteRequestSignal();
469
470   /**
471    * @brief This signal is emitted when the window is damaged.
472    */
473   DamageSignalType& WindowDamagedSignal();
474
475   /**
476    * @brief This signal is emitted when a rotation event is recevied.
477    */
478   RotationSignalType& RotationSignal();
479
480   /**
481    * @brief This signal is emitted when a touch event is received.
482    */
483   TouchEventSignalType& TouchEventSignal();
484
485   /**
486    * @brief This signal is emitted when a mouse wheel is received.
487    */
488   WheelEventSignalType& WheelEventSignal();
489
490   /**
491    * @brief This signal is emitted when a key event is received.
492    */
493   KeyEventSignalType& KeyEventSignal();
494
495   /**
496    * @brief This signal is emitted when the source window notifies us the content in clipboard is selected.
497    */
498   SelectionSignalType& SelectionDataSendSignal();
499
500   /**
501    * @brief This signal is emitted when the source window sends us about the selected content.
502    */
503   SelectionSignalType& SelectionDataReceivedSignal();
504
505   /**
506    * @brief This signal is emitted when the style is changed.
507    */
508   StyleSignalType& StyleChangedSignal();
509
510   /**
511    * @brief This signal is emitted when an accessibility event is received.
512    */
513   AccessibilitySignalType& AccessibilitySignal();
514
515   /**
516    * @brief This signal is emitted when window's transition animation is started or ended.
517    */
518   TransitionEffectEventSignalType& TransitionEffectEventSignal();
519
520   /**
521    * @brief This signal is emitted when the keyboard repeat is changed.
522    */
523   KeyboardRepeatSettingsChangedSignalType& KeyboardRepeatSettingsChangedSignal();
524
525   /**
526    * @brief This signal is emitted when the window redraw is requested.
527    */
528   WindowRedrawRequestSignalType& WindowRedrawRequestSignal();
529
530   /**
531    * @brief This signal is emitted when the window is resized or moved by display server.
532    */
533   UpdatePositionSizeType& UpdatePositionSizeSignal();
534
535   /**
536    * @brief This signal is emitted when the window is received the auxiliary message from display server.
537    */
538   AuxiliaryMessageSignalType& AuxiliaryMessageSignal();
539
540 protected:
541   // Undefined
542   WindowBase(const WindowBase&) = delete;
543
544   // Undefined
545   WindowBase& operator=(const WindowBase& rhs) = delete;
546
547 protected:
548   IconifySignalType                       mIconifyChangedSignal;
549   FocusSignalType                         mFocusChangedSignal;
550   OutputSignalType                        mOutputTransformedSignal;
551   DeleteSignalType                        mDeleteRequestSignal;
552   DamageSignalType                        mWindowDamagedSignal;
553   RotationSignalType                      mRotationSignal;
554   TouchEventSignalType                    mTouchEventSignal;
555   WheelEventSignalType                    mWheelEventSignal;
556   KeyEventSignalType                      mKeyEventSignal;
557   SelectionSignalType                     mSelectionDataSendSignal;
558   SelectionSignalType                     mSelectionDataReceivedSignal;
559   StyleSignalType                         mStyleChangedSignal;
560   AccessibilitySignalType                 mAccessibilitySignal;
561   TransitionEffectEventSignalType         mTransitionEffectEventSignal;
562   KeyboardRepeatSettingsChangedSignalType mKeyboardRepeatSettingsChangedSignal;
563   WindowRedrawRequestSignalType           mWindowRedrawRequestSignal;
564   UpdatePositionSizeType                  mUpdatePositionSizeSignal;
565   AuxiliaryMessageSignalType              mAuxiliaryMessageSignal;
566 };
567
568 } // namespace Adaptor
569
570 } // namespace Internal
571
572 } // namespace Dali
573
574 #endif // DALI_INTERNAL_WINDOWSYSTEM_COMMON_WINDOW_BASE_H