[AT-SPI] Rework intercepting key events
[platform/core/uifw/dali-adaptor.git] / dali / internal / window-system / common / window-impl.h
1 #ifndef DALI_INTERNAL_WINDOWSYSTEM_COMMON_WINDOW_IMPL_H
2 #define DALI_INTERNAL_WINDOWSYSTEM_COMMON_WINDOW_IMPL_H
3
4 /*
5  * Copyright (c) 2023 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/actors/layer.h>
23 #include <dali/public-api/adaptor-framework/window-enumerations.h>
24 #include <dali/public-api/events/touch-event.h>
25 #include <dali/public-api/object/base-object.h>
26 #include <dali/public-api/object/property-array.h>
27 #include <dali/public-api/object/ref-object.h>
28
29 // INTERNAL INCLUDES
30 #include <dali/devel-api/adaptor-framework/window-devel.h>
31 #include <dali/integration-api/adaptor-framework/scene-holder-impl.h>
32 #include <dali/internal/adaptor/common/adaptor-impl.h>
33 #include <dali/internal/window-system/common/event-handler.h>
34 #include <dali/public-api/adaptor-framework/key-grab.h>
35 #include <dali/public-api/adaptor-framework/window.h>
36
37 namespace Dali
38 {
39 class Adaptor;
40 class Actor;
41 class RenderSurfaceInterface;
42
43 namespace Internal
44 {
45 namespace Adaptor
46 {
47 class Orientation;
48 class WindowRenderSurface;
49 class WindowBase;
50
51 class Window;
52 using WindowPtr             = IntrusivePtr<Window>;
53 using OrientationPtr        = IntrusivePtr<Orientation>;
54 using MouseInOutEventPtr    = IntrusivePtr<Dali::DevelWindow::MouseInOutEvent>;
55 using MouseRelativeEventPtr = IntrusivePtr<Dali::DevelWindow::MouseRelativeEvent>;
56 using EventHandlerPtr       = IntrusivePtr<EventHandler>;
57
58 /**
59  * Window provides a surface to render onto with orientation & indicator properties.
60  */
61 class Window : public Dali::Internal::Adaptor::SceneHolder, public EventHandler::Observer, public ConnectionTracker
62 {
63 public:
64   typedef Dali::Window::FocusChangeSignalType                        FocusChangeSignalType;
65   typedef Dali::Window::ResizeSignalType                             ResizeSignalType;
66   typedef Dali::DevelWindow::VisibilityChangedSignalType             VisibilityChangedSignalType;
67   typedef Dali::DevelWindow::TransitionEffectEventSignalType         TransitionEffectEventSignalType;
68   typedef Dali::DevelWindow::KeyboardRepeatSettingsChangedSignalType KeyboardRepeatSettingsChangedSignalType;
69   typedef Dali::DevelWindow::AuxiliaryMessageSignalType              AuxiliaryMessageSignalType;
70   typedef Dali::DevelWindow::AccessibilityHighlightSignalType        AccessibilityHighlightSignalType;
71   typedef Dali::DevelWindow::MovedSignalType                         MovedSignalType;
72   typedef Dali::DevelWindow::OrientationChangedSignalType            OrientationChangedSignalType;
73   typedef Dali::DevelWindow::MouseInOutEventSignalType               MouseInOutEventSignalType;
74   typedef Dali::DevelWindow::MouseRelativeEventSignalType            MouseRelativeEventSignalType;
75   typedef Dali::DevelWindow::MoveCompletedSignalType                 MoveCompletedSignalType;
76   typedef Dali::DevelWindow::ResizeCompletedSignalType               ResizeCompletedSignalType;
77   typedef Dali::DevelWindow::InsetsChangedSignalType                 InsetsChangedSignalType;
78   typedef Dali::DevelWindow::PointerConstraintsSignalType            PointerConstraintsSignalType;
79   typedef Signal<void()>                                             SignalType;
80
81   /**
82    * @brief Create a new Window. This should only be called once by the Application class
83    *
84    * @param[in] name The window title
85    * @param[in] className The window class name
86    * @param[in] windowData The window data
87    * @return A newly allocated Window
88    */
89   static Window* New(const std::string& name, const std::string& className, const WindowData& windowData);
90
91   /**
92    * @brief Create a new Window. This should only be called once by the Application class
93    *
94    * @param[in] surface The surface used to render on.
95    * @param[in] name The window title
96    * @param[in] className The window class name
97    * @param[in] windowData The window data
98    * @return A newly allocated Window
99    */
100   static Window* New(Any surface, const std::string& name, const std::string& className, const WindowData& windowData);
101
102   /**
103    * @copydoc Dali::Window::SetClass()
104    */
105   void SetClass(std::string name, std::string className);
106
107   /**
108    * @brief Gets the window class name.
109    *
110    * @return The class of the window
111    */
112   std::string GetClassName() const;
113
114   /**
115    * @copydoc Dali::Window::Raise()
116    */
117   void Raise();
118
119   /**
120    * @copydoc Dali::Window::Lower()
121    */
122   void Lower();
123
124   /**
125    * @copydoc Dali::Window::Activate()
126    */
127   void Activate();
128
129   /**
130    * @copydoc Dali::DevelWindow::Maximize()
131    */
132   void Maximize(bool maximize);
133
134   /**
135    * @copydoc Dali::DevelWindow::IsMaximized()
136    */
137   bool IsMaximized() const;
138
139   /**
140    * @copydoc Dali::DevelWindow::SetMaximumSize()
141    */
142   void SetMaximumSize(Dali::Window::WindowSize size);
143
144   /**
145    * @copydoc Dali::DevelWindow::Minimize()
146    */
147   void Minimize(bool minimize);
148
149   /**
150    * @copydoc Dali::DevelWindow::IsMinimized()
151    */
152   bool IsMinimized() const;
153
154   /**
155    * @copydoc Dali::DevelWindow::SetMimimumSize()
156    */
157   void SetMimimumSize(Dali::Window::WindowSize size);
158
159   /**
160    * @copydoc Dali::Window::GetLayerCount()
161    */
162   uint32_t GetLayerCount() const;
163
164   /**
165    * @copydoc Dali::Window::GetLayer()
166    */
167   Dali::Layer GetLayer(uint32_t depth) const;
168
169   /**
170    * @copydoc Dali::Window::KeepRendering()
171    */
172   void KeepRendering(float durationSeconds);
173
174   /**
175    * @copydoc Dali::Window::SetPartialUpdateEnabled()
176    */
177   void SetPartialUpdateEnabled(bool enabled);
178
179   /**
180    * @copydoc Dali::Window::IsPartialUpdateEnabled()
181    */
182   bool IsPartialUpdateEnabled() const;
183
184   /**
185    * @brief Get window resource ID assigned by window manager
186    *
187    * @return The resource ID of the window
188    */
189   std::string GetNativeResourceId() const;
190
191   /**
192    * @copydoc Dali::Window::AddAvailableOrientation()
193    */
194   void AddAvailableOrientation(WindowOrientation orientation);
195
196   /**
197    * @copydoc Dali::Window::RemoveAvailableOrientation()
198    */
199   void RemoveAvailableOrientation(WindowOrientation orientation);
200
201   /**
202    * @copydoc Dali::Window::SetPreferredOrientation()
203    */
204   void SetPreferredOrientation(WindowOrientation orientation);
205
206   /**
207    * @copydoc Dali::Window::GetPreferredOrientation()
208    */
209   WindowOrientation GetPreferredOrientation();
210
211   /**
212    * @copydoc Dali::Window::SetAcceptFocus()
213    */
214   void SetAcceptFocus(bool accept);
215
216   /**
217    * @copydoc Dali::Window::IsFocusAcceptable()
218    */
219   bool IsFocusAcceptable() const;
220
221   /**
222    * @copydoc Dali::Window::Show()
223    */
224   void Show();
225
226   /**
227    * @copydoc Dali::Window::Hide()
228    */
229   void Hide();
230
231   /**
232    * @copydoc Dali::Window::GetSupportedAuxiliaryHintCount()
233    */
234   unsigned int GetSupportedAuxiliaryHintCount() const;
235
236   /**
237    * @copydoc Dali::Window::GetSupportedAuxiliaryHint()
238    */
239   std::string GetSupportedAuxiliaryHint(unsigned int index) const;
240
241   /**
242    * @copydoc Dali::Window::AddAuxiliaryHint()
243    */
244   unsigned int AddAuxiliaryHint(const std::string& hint, const std::string& value);
245
246   /**
247    * @copydoc Dali::Window::RemoveAuxiliaryHint()
248    */
249   bool RemoveAuxiliaryHint(unsigned int id);
250
251   /**
252    * @copydoc Dali::Window::SetAuxiliaryHintValue()
253    */
254   bool SetAuxiliaryHintValue(unsigned int id, const std::string& value);
255
256   /**
257    * @copydoc Dali::Window::GetAuxiliaryHintValue()
258    */
259   std::string GetAuxiliaryHintValue(unsigned int id) const;
260
261   /**
262    * @copydoc Dali::Window::GetAuxiliaryHintId()
263    */
264   unsigned int GetAuxiliaryHintId(const std::string& hint) const;
265
266   /**
267    * @copydoc Dali::Window::SetInputRegion()
268    */
269   void SetInputRegion(const Rect<int>& inputRegion);
270
271   /**
272    * @copydoc Dali::Window::SetType()
273    */
274   void SetType(WindowType type);
275
276   /**
277    * @copydoc Dali::Window::GetType() const
278    */
279   WindowType GetType() const;
280
281   /**
282    * @copydoc Dali::Window::SetNotificationLevel()
283    */
284   WindowOperationResult SetNotificationLevel(WindowNotificationLevel level);
285
286   /**
287    * @copydoc Dali::Window::GetNotificationLevel()
288    */
289   WindowNotificationLevel GetNotificationLevel() const;
290
291   /**
292    * @copydoc Dali::Window::SetOpaqueState()
293    */
294   void SetOpaqueState(bool opaque);
295
296   /**
297    * @copydoc Dali::Window::IsOpaqueState()
298    */
299   bool IsOpaqueState() const;
300
301   /**
302    * @copydoc Dali::Window::SetScreenOffMode()
303    */
304   WindowOperationResult SetScreenOffMode(WindowScreenOffMode screenOffMode);
305
306   /**
307    * @copydoc Dali::Window::GetScreenOffMode()
308    */
309   WindowScreenOffMode GetScreenOffMode() const;
310
311   /**
312    * @copydoc Dali::Window::SetBrightness()
313    */
314   WindowOperationResult SetBrightness(int brightness);
315
316   /**
317    * @copydoc Dali::Window::GetBrightness()
318    */
319   int GetBrightness() const;
320
321   /**
322    * @copydoc Dali::Window::SetSize()
323    */
324   void SetSize(Dali::Window::WindowSize size);
325
326   /**
327    * @copydoc Dali::Window::GetSize()
328    */
329   Dali::Window::WindowSize GetSize() const;
330
331   /**
332    * @copydoc Dali::Window::SetPosition()
333    */
334   void SetPosition(Dali::Window::WindowPosition position);
335
336   /**
337    * @copydoc Dali::Window::GetPosition()
338    */
339   Dali::Window::WindowPosition GetPosition() const;
340
341   /**
342    * @copydoc Dali::DevelWindow::SetPositionSize()
343    */
344   void SetPositionSize(PositionSize positionSize);
345
346   /**
347    * @copydoc Dali::DevelWindow::GetPositionSize()
348    */
349   PositionSize GetPositionSize() const;
350
351   /**
352    * @copydoc Dali::Window::SetLayout()
353    */
354   void SetLayout(unsigned int numCols, unsigned int numRows, unsigned int column, unsigned int row, unsigned int colSpan, unsigned int rowSpan);
355
356   /**
357    * @copydoc Dali::Window::GetRootLayer()
358    */
359   Dali::Layer GetRootLayer() const;
360
361   /**
362    * @copydoc Dali::Window::SetTransparency()
363    */
364   void SetTransparency(bool transparent);
365
366   /**
367    * @copydoc Dali::KeyGrab::GrabKey()
368    */
369   bool GrabKey(Dali::KEY key, KeyGrab::KeyGrabMode grabMode);
370
371   /**
372    * @copydoc Dali::KeyGrab::UngrabKey()
373    */
374   bool UngrabKey(Dali::KEY key);
375
376   /**
377    * @copydoc Dali::KeyGrab::GrabKeyList()
378    */
379   bool GrabKeyList(const Dali::Vector<Dali::KEY>& key, const Dali::Vector<KeyGrab::KeyGrabMode>& grabMode, Dali::Vector<bool>& result);
380
381   /**
382    * @copydoc Dali::KeyGrab::UngrabKeyList()
383    */
384   bool UngrabKeyList(const Dali::Vector<Dali::KEY>& key, Dali::Vector<bool>& result);
385
386   /**
387    * @copydoc Dali::DevelWindow::Get()
388    */
389   static Dali::Window Get(Dali::Actor actor);
390
391   /**
392    * @copydoc Dali::DevelWindow::SetParent(Window window, Window parent)
393    */
394   void SetParent(Dali::Window& parent);
395
396   /**
397    * @copydoc Dali::DevelWindow::SetParent(Window window, Window parent, bool belowParent)
398    */
399   void SetParent(Dali::Window& parent, bool belowParent);
400
401   /**
402    * @copydoc Dali::DevelWindow::Unparent()
403    */
404   void Unparent();
405
406   /**
407    * @copydoc Dali::DevelWindow::GetParent()
408    */
409   Dali::Window GetParent();
410
411   /**
412    * @copydoc Dali::DevelWindow::GetCurrentOrientation()
413    */
414   WindowOrientation GetCurrentOrientation() const;
415
416   /**
417    * @copydoc Dali::DevelWindow::GetPhysicalOrientation()
418    */
419   int GetPhysicalOrientation() const;
420
421   /**
422    * @copydoc Dali::DevelWindow::SetAvailableOrientations()
423    */
424   void SetAvailableOrientations(const Dali::Vector<WindowOrientation>& orientations);
425
426   /**
427    * @copydoc Dali::DevelWindow::SetPositionSizeWithOrientation()
428    */
429   void SetPositionSizeWithOrientation(PositionSize positionSize, WindowOrientation orientation);
430
431   /**
432    * @brief Emit the accessibility highlight signal.
433    *
434    * The highlight indicates that it is an object to interact with the user regardless of focus.
435    * After setting the highlight on the object, you can do things that the object can do, such as
436    * giving or losing focus.
437    *
438    * @param[in] highlight If window needs to grab or clear highlight.
439    */
440   void EmitAccessibilityHighlightSignal(bool highlight);
441
442   /**
443    * @brief Sets the render notification trigger to call when render thread is completed a frame
444    *
445    * @param[in] renderNotification to use
446    */
447   void SetRenderNotification(TriggerEventInterface* renderNotification);
448
449 public: // Dali::Internal::Adaptor::SceneHolder
450   /**
451    * @copydoc Dali::Internal::Adaptor::SceneHolder::GetNativeHandle
452    */
453   Dali::Any GetNativeHandle() const override;
454
455   /**
456    * @copydoc Dali::Internal::Adaptor::SceneHolder::IsVisible
457    */
458   bool IsVisible() const override;
459
460   /**
461    * @copydoc Dali::DevelWindow::GetNativeId()
462    */
463   int32_t GetNativeId() const;
464
465   /**
466    * @copydoc Dali::DevelWindow::RequestMoveToServer()
467    */
468   void RequestMoveToServer();
469
470   /**
471    * @copydoc Dali::DevelWindow::RequestResizeToServer()
472    */
473   void RequestResizeToServer(WindowResizeDirection direction);
474
475   /**
476    * @copydoc Dali::DevelWindow::EnableFloatingMode()
477    */
478   void EnableFloatingMode(bool enable);
479
480   /**
481    * @copydoc Dali::DevelWindow::IsFloatingModeEnabled()
482    */
483   bool IsFloatingModeEnabled();
484
485   /**
486    * @copydoc Dali::DevelWindow::IncludeInputRegion()
487    */
488   void IncludeInputRegion(const Rect<int>& inputRegion);
489
490   /**
491    * @copydoc Dali::DevelWindow::ExcludeInputRegion()
492    */
493   void ExcludeInputRegion(const Rect<int>& inputRegion);
494
495   /**
496    * @copydoc Dali::DevelWindow::SetNeedsRotationCompletedAcknowledgement()
497    */
498   void SetNeedsRotationCompletedAcknowledgement(bool needAcknowledgement);
499
500   /**
501    * @copydoc Dali::DevelWindow::SendRotationCompletedAcknowledgement()
502    */
503   void SendRotationCompletedAcknowledgement();
504
505   /**
506    * @copydoc Dali::DevelWindow::IsWindowRotating()
507    */
508   bool IsWindowRotating() const;
509
510   /**
511    * @copydoc Dali::DevelWindow::GetLastKeyEvent()
512    */
513   const Dali::KeyEvent& GetLastKeyEvent() const;
514
515   /**
516    * @copydoc Dali::DevelWindow::PointerConstraintsLock()
517    */
518   bool PointerConstraintsLock();
519
520   /**
521    * @copydoc Dali::DevelWindow::PointerConstraintsUnlock()
522    */
523   bool PointerConstraintsUnlock();
524
525   /**
526    * @copydoc Dali::DevelWindow::LockedPointerRegionSet()
527    */
528   void LockedPointerRegionSet(int32_t x, int32_t y, int32_t width, int32_t height);
529
530   /**
531    * @copydoc Dali::DevelWindow::LockedPointerCursorPositionHintSet()
532    */
533   void LockedPointerCursorPositionHintSet(int32_t x, int32_t y);
534
535   /**
536    * @copydoc Dali::DevelWindow::PointerWarp()
537    */
538   bool PointerWarp(int32_t x, int32_t y);
539
540   /**
541    * @copydoc Dali::DevelWindow::CursorVisibleSet()
542    */
543   void CursorVisibleSet(bool visible);
544
545   /**
546    * @copydoc Dali::DevelWindow::KeyboardGrab()
547    */
548   bool KeyboardGrab(Device::Subclass::Type deviceSubclass);
549
550   /**
551    * @copydoc Dali::DevelWindow::KeyboardUnGrab()
552    */
553   bool KeyboardUnGrab();
554
555   /**
556    * @copydoc Dali::DevelWindow::SetFullScreen()
557    */
558   void SetFullScreen(bool fullscreen);
559
560   /**
561    * @copydoc Dali::DevelWindow::GetFullScreen()
562    */
563   bool GetFullScreen();
564
565   /**
566    * @copydoc Dali::DevelWindow::SetFrontBufferRendering()
567    */
568   void SetFrontBufferRendering(bool enable);
569
570   /**
571    * @copydoc Dali::DevelWindow::GetFrontBufferRendering()
572    */
573   bool GetFrontBufferRendering();
574
575 private:
576   /**
577    * @brief Enumeration for orietation mode.
578    *
579    * The Orientation Mode is related to screen size.
580    * If screen width is longer than height, the Orientation Mode will have LANDSCAPE.
581    * Otherwise screen width is shorter than height or same, the Orientation Mode will have PORTRAIT.
582    */
583   enum class OrientationMode
584   {
585     PORTRAIT = 0,
586     LANDSCAPE
587   };
588
589   /**
590    * Private constructor.
591    * @sa Window::New()
592    */
593   Window();
594
595   /**
596    * Destructor
597    */
598   ~Window() override;
599
600   /**
601    * @brief Second stage initialization
602    *
603    * @param[in] surface The surface used to render on.
604    * @param[in] positionSize The window's position and size in initailized time.
605    * @param[in] name The window title
606    * @param[in] className The window class name
607    * @param[in] type window's type. Refer the WindowType in window-enumerations.h.
608    */
609   void Initialize(Any surface, const PositionSize& positionSize, const std::string& name, const std::string& className, WindowType type);
610
611   /**
612    * @brief Called when the window becomes iconified or deiconified.
613    *
614    * @param[in] iconified true If the window is iconified, othewise false.
615    */
616   void OnIconifyChanged(bool iconified);
617
618   /**
619    * @brief Called when the window becomes maximized or unmaximized.
620    *
621    * @param[in] maximized true If the window is maximized, othewise false.
622    */
623   void OnMaximizeChanged(bool maximized);
624
625   /**
626    * @brief Called when the window focus is changed.
627    *
628    * @param[in] focusIn true If the window is focused, othewise false.
629    */
630   void OnFocusChanged(bool focusIn);
631
632   /**
633    * @brief Called when the output is transformed.
634    */
635   void OnOutputTransformed();
636
637   /**
638    * @brief Called when the window receives a delete request.
639    */
640   void OnDeleteRequest();
641
642   /**
643    * @brief Called when the window receives a Transition effect-start/end event.
644    *
645    * This event is emitted by display server.
646    *
647    * @param[in] state current window transition effect state, refer the WindowEffectState in window-enumerations.h.
648    * @param[in] type current window transition effect type, refer the WindowEffectType in window-enumerations.h.
649    */
650   void OnTransitionEffectEvent(WindowEffectState state, WindowEffectType type);
651
652   /**
653    * @brief Called when window receives a keyboard repeat event.
654    */
655   void OnKeyboardRepeatSettingsChanged();
656
657   /**
658    * @brief Called when the window redraw is requested.
659    */
660   void OnWindowRedrawRequest();
661
662   /**
663    * @brief Called when the window's geometry data is changed by display server or client.
664    * It is based on configure noification event.
665    *
666    * @param[in] positionSize the updated window's position and size.
667    */
668   void OnUpdatePositionSize(Dali::PositionSize& positionSize);
669
670   /**
671    * @brief Called when display server sent the auxiliary message.
672    *
673    * @param[in] key the auxiliary message's key.
674    * @param[in] value the auxiliary message's value.
675    * @param[in] options the auxiliary message's options. This is the list of string.
676    */
677   void OnAuxiliaryMessage(const std::string& key, const std::string& value, const Property::Array& options);
678
679   /**
680    * @brief Called when Accessibility is enabled.
681    *
682    * This method is to register the window to accessibility bridge.
683    */
684   void OnAccessibilityEnabled();
685
686   /**
687    * @brief Called when Accessibility is disabled.
688    *
689    * This method is to remove the window from accessibility bridge.
690    */
691   void OnAccessibilityDisabled();
692
693   /**
694    * @brief Called in Accessibility mode on every KeyEvent
695    *
696    * @param[in] keyEvent The key event
697    * @return Always true, meaning that the event is consumed
698    */
699   bool OnAccessibilityInterceptKeyEvent(const Dali::KeyEvent& keyEvent);
700
701   /**
702    * @brief Called when the window rotation is finished.
703    *
704    * This signal is emmit when window rotation is finisehd and WindowRotationCompleted() is called.
705    */
706   void OnRotationFinished();
707
708   /**
709    * @brief Called when the mouse in or out event is received.
710    *
711    * @param[in] mouseInOutEvent the mouse event
712    */
713   void OnMouseInOutEvent(const Dali::DevelWindow::MouseInOutEvent& mouseInOutEvent);
714
715   /**
716    * @brief Called when the mouse relative event is received.
717    *
718    * @param[in] mouseRelativeEvent the mouse event
719    */
720   void OnMouseRelativeEvent(const Dali::DevelWindow::MouseRelativeEvent& mouseRelativeEvent);
721
722   /**
723    * @brief Called when the pointer is locked/unlocked
724    *
725    * @param[in] position The x, y coordinate relative to window where event happened
726    * @param[in] locked The status whether pointer is locked/unlocked
727    * @param[in] confined The status whether pointer is confined/unconfined
728    */
729   void OnPointerConstraints(const Dali::Int32Pair& position, bool locked, bool confined);
730
731   /**
732    * @brief Called when the window is moved by display server.
733    *
734    * @param[in] position the moved window's position.
735    */
736   void OnMoveCompleted(Dali::Window::WindowPosition& position);
737
738   /**
739    * @brief Called when the window is resized by display server.
740    *
741    * @param[in] positionSize the resized window's size.
742    */
743   void OnResizeCompleted(Dali::Window::WindowSize& size);
744
745   /**
746    * @brief Set available orientation to window base.
747    */
748   void SetAvailableAnlges(const std::vector<int>& angles);
749
750   /**
751    * @brief Convert from window orientation to angle using OrientationMode.
752    */
753   int ConvertToAngle(WindowOrientation orientation);
754
755   /**
756    * @brief Convert from angle to window orientation using OrientationMode.
757    */
758   WindowOrientation ConvertToOrientation(int angle) const;
759
760   /**
761    * @brief Check available window orientation for Available orientation.
762    */
763   bool IsOrientationAvailable(WindowOrientation orientation) const;
764
765   /**
766    * @brief Sets user geometry flag when window's geometry is changed.
767    *
768    * Window is created with screen size or not.
769    * If window is created with screen size or the geometry is changed by user,
770    * client should inform to server setting user.geometry flag
771    */
772   void SetUserGeometryPolicy();
773
774   /**
775    * @brief Called when window insets are changed by appearing or disappearing indicator, virtual keyboard, or clipboard.
776    *
777    * @param[in] partType the type of the part that occurs the window insets change.
778    * @param[in] partState the state of the part that occurs the window insets change.
779    * @param[in] insets the extents value of window insets.
780    */
781   void OnInsetsChanged(WindowInsetsPartType partType, WindowInsetsPartState partState, const Extents& insets);
782
783 private: // Dali::Internal::Adaptor::SceneHolder
784   /**
785    * @copydoc Dali::Internal::Adaptor::SceneHolder::OnAdaptorSet
786    */
787   void OnAdaptorSet(Dali::Adaptor& adaptor) override;
788
789   /**
790    * @copydoc Dali::Internal::Adaptor::SceneHolder::OnSurfaceSet
791    */
792   void OnSurfaceSet(Dali::RenderSurfaceInterface* surface) override;
793
794   /**
795    * @copydoc Dali::Internal::Adaptor::SceneHolder::OnPause
796    */
797   void OnPause() override;
798
799   /**
800    * @copydoc Dali::Internal::Adaptor::SceneHolder::OnResume
801    */
802   void OnResume() override;
803
804   /**
805    * @copydoc Dali::Internal::Adaptor::SceneHolder::RecalculatePosition
806    */
807   Vector2 RecalculatePosition(const Vector2& position) override;
808
809 private: // Dali::Internal::Adaptor::EventHandler::Observer
810   /**
811    * @copydoc Dali::Internal::Adaptor::EventHandler::Observer::OnTouchPoint
812    */
813   void OnTouchPoint(Dali::Integration::Point& point, int timeStamp) override;
814
815   /**
816    * @copydoc Dali::Internal::Adaptor::EventHandler::Observer::OnWheelEvent
817    */
818   void OnWheelEvent(Dali::Integration::WheelEvent& wheelEvent) override;
819
820   /**
821    * @copydoc Dali::Internal::Adaptor::EventHandler::Observer::OnKeyEvent
822    */
823   void OnKeyEvent(Dali::Integration::KeyEvent& keyEvent) override;
824
825   /**
826    * @copydoc Dali::Internal::Adaptor::EventHandler::Observer::OnRotation
827    */
828   void OnRotation(const RotationEvent& rotation) override;
829
830 public: // Signals
831   /**
832    * @copydoc Dali::Window::FocusChangeSignal()
833    */
834   FocusChangeSignalType& FocusChangeSignal()
835   {
836     return mFocusChangeSignal;
837   }
838
839   /**
840    * @copydoc Dali::Window::ResizedSignal()
841    */
842   ResizeSignalType& ResizeSignal()
843   {
844     return mResizeSignal;
845   }
846
847   /**
848    * @brief This signal is emitted when the window is requesting to be deleted
849    *
850    * It is internal signal in Dali-adaptor.
851    */
852   SignalType& DeleteRequestSignal()
853   {
854     return mDeleteRequestSignal;
855   }
856
857   /**
858    * @copydoc Dali::DevelWindow::VisibilityChangedSignal()
859    */
860   VisibilityChangedSignalType& VisibilityChangedSignal()
861   {
862     return mVisibilityChangedSignal;
863   }
864
865   /**
866    * @copydoc Dali::Window::SignalEventProcessingFinished()
867    */
868   Dali::DevelWindow::EventProcessingFinishedSignalType& EventProcessingFinishedSignal()
869   {
870     return mScene.EventProcessingFinishedSignal();
871   }
872
873   /**
874    * @copydoc Dali::DevelWindow::TransitionEffectEventSignal()
875    */
876   TransitionEffectEventSignalType& TransitionEffectEventSignal()
877   {
878     return mTransitionEffectEventSignal;
879   }
880
881   /**
882    * @copydoc Dali::DevelWindow::KeyboardRepeatSettingsChangedSignal()
883    */
884   KeyboardRepeatSettingsChangedSignalType& KeyboardRepeatSettingsChangedSignal()
885   {
886     return mKeyboardRepeatSettingsChangedSignal;
887   }
888
889   /**
890    * @copydoc Dali::DevelWindow::AuxiliaryMessageSignal()
891    */
892   AuxiliaryMessageSignalType& AuxiliaryMessageSignal()
893   {
894     return mAuxiliaryMessageSignal;
895   }
896
897   /**
898    * @copydoc Dali::DevelWindow::AccessibilityHighlightSignal()
899    */
900   AccessibilityHighlightSignalType& AccessibilityHighlightSignal()
901   {
902     return mAccessibilityHighlightSignal;
903   }
904
905   /**
906    * @copydoc Dali::DevelWindow::MovedSignal()
907    */
908   MovedSignalType& MovedSignal()
909   {
910     return mMovedSignal;
911   }
912
913   /**
914    * @copydoc Dali::DevelWindow::OrientationChangedSignal()
915    */
916   OrientationChangedSignalType& OrientationChangedSignal()
917   {
918     return mOrientationChangedSignal;
919   }
920
921   /**
922    * @copydoc Dali::DevelWindow::MouseInOutEventSignal()
923    */
924   MouseInOutEventSignalType& MouseInOutEventSignal()
925   {
926     return mMouseInOutEventSignal;
927   }
928
929   /**
930    * @copydoc Dali::DevelWindow::MouseRelativeEventSignal()
931    */
932   MouseRelativeEventSignalType& MouseRelativeEventSignal()
933   {
934     return mMouseRelativeEventSignal;
935   }
936
937   /**
938    * @copydoc Dali::DevelWindow::PointerConstraintsSignal()
939    */
940   PointerConstraintsSignalType& PointerConstraintsSignal()
941   {
942     return mPointerConstraintsSignal;
943   }
944
945   /**
946    * @copydoc Dali::DevelWindow::MoveCompletedSignal()
947    */
948   MoveCompletedSignalType& MoveCompletedSignal()
949   {
950     return mMoveCompletedSignal;
951   }
952
953   /**
954    * @copydoc Dali::DevelWindow::ResizeCompletedSignal()
955    */
956   ResizeCompletedSignalType& ResizeCompletedSignal()
957   {
958     return mResizeCompletedSignal;
959   }
960
961   /**
962    * @copydoc Dali::DevelWindow::InsetsChangedSignal()
963    */
964   InsetsChangedSignalType& InsetsChangedSignal()
965   {
966     return mInsetsChangedSignal;
967   }
968
969 private:
970   WindowRenderSurface* mWindowSurface; ///< The window rendering surface
971   WindowBase*          mWindowBase;
972   std::string          mName;
973   std::string          mClassName;
974   Dali::Window         mParentWindow;
975
976   OrientationPtr   mOrientation;
977   std::vector<int> mAvailableAngles;
978   int              mPreferredAngle;
979
980   int mRotationAngle;  ///< The angle of the rotation
981   int mWindowWidth;    ///< The width of the window
982   int mWindowHeight;   ///< The height of the window
983   int mNativeWindowId; ///< The Native Window Id
984
985   EventHandlerPtr mEventHandler;    ///< The window events handler
986   OrientationMode mOrientationMode; ///< The physical screen mode is portrait or landscape
987
988   // Signals
989   SignalType                              mDeleteRequestSignal;
990   FocusChangeSignalType                   mFocusChangeSignal;
991   ResizeSignalType                        mResizeSignal;
992   VisibilityChangedSignalType             mVisibilityChangedSignal;
993   TransitionEffectEventSignalType         mTransitionEffectEventSignal;
994   KeyboardRepeatSettingsChangedSignalType mKeyboardRepeatSettingsChangedSignal;
995   AuxiliaryMessageSignalType              mAuxiliaryMessageSignal;
996   AccessibilityHighlightSignalType        mAccessibilityHighlightSignal;
997   MovedSignalType                         mMovedSignal;
998   OrientationChangedSignalType            mOrientationChangedSignal;
999   MouseInOutEventSignalType               mMouseInOutEventSignal;
1000   MouseRelativeEventSignalType            mMouseRelativeEventSignal;
1001   MoveCompletedSignalType                 mMoveCompletedSignal;
1002   ResizeCompletedSignalType               mResizeCompletedSignal;
1003   InsetsChangedSignalType                 mInsetsChangedSignal;
1004   PointerConstraintsSignalType            mPointerConstraintsSignal;
1005
1006   Dali::KeyEvent mLastKeyEvent;
1007
1008   bool mIsTransparent : 1;
1009   bool mIsFocusAcceptable : 1;
1010   bool mIconified : 1;
1011   bool mMaximized : 1;
1012   bool mOpaqueState : 1;
1013   bool mWindowRotationAcknowledgement : 1;
1014   bool mFocused : 1;
1015   bool mIsWindowRotating : 1;      ///< The window rotating flag.
1016   bool mIsEnabledUserGeometry : 1; ///< The user geometry enable flag.
1017   bool mIsEmittedWindowCreatedEvent : 1; ///< The Window Created Event emit flag for accessibility.
1018   bool mIsFrontBufferRendering : 1;      ///< The Front Buffer Rendering state.
1019 };
1020
1021 } // namespace Adaptor
1022 } // namespace Internal
1023
1024 // Helpers for public-api forwarding methods
1025
1026 inline Internal::Adaptor::Window& GetImplementation(Dali::Window& window)
1027 {
1028   DALI_ASSERT_ALWAYS(window && "Window handle is empty");
1029   BaseObject& object = window.GetBaseObject();
1030   return static_cast<Internal::Adaptor::Window&>(object);
1031 }
1032
1033 inline const Internal::Adaptor::Window& GetImplementation(const Dali::Window& window)
1034 {
1035   DALI_ASSERT_ALWAYS(window && "Window handle is empty");
1036   const BaseObject& object = window.GetBaseObject();
1037   return static_cast<const Internal::Adaptor::Window&>(object);
1038 }
1039
1040 } // namespace Dali
1041
1042 #endif // DALI_INTERNAL_WINDOWSYSTEM_COMMON_WINDOW_IMPL_H