Merge "Supports the key event repeat and delay for each way." into devel/master
[platform/core/uifw/dali-adaptor.git] / dali / internal / window-system / common / window-impl.cpp
1 /*
2  * Copyright (c) 2023 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17
18 // CLASS HEADER
19 #include <dali/internal/window-system/common/window-impl.h>
20
21 // EXTERNAL HEADERS
22 #include <dali/devel-api/adaptor-framework/orientation.h>
23 #include <dali/devel-api/events/key-event-devel.h>
24 #include <dali/integration-api/core.h>
25 #include <dali/integration-api/events/touch-event-integ.h>
26 #include <dali/integration-api/events/touch-integ.h>
27 #include <dali/public-api/actors/actor.h>
28 #include <dali/public-api/actors/camera-actor.h>
29 #include <dali/public-api/actors/layer.h>
30 #include <dali/public-api/adaptor-framework/window-enumerations.h>
31 #include <dali/public-api/rendering/frame-buffer.h>
32 #include <thread>
33
34 // INTERNAL HEADERS
35 #include <dali/devel-api/adaptor-framework/accessibility-bridge.h>
36 #include <dali/devel-api/atspi-interfaces/accessible.h>
37 #include <dali/integration-api/adaptor-framework/render-surface-interface.h>
38 #include <dali/internal/graphics/gles/egl-graphics.h>
39 #include <dali/internal/window-system/common/event-handler.h>
40 #include <dali/internal/window-system/common/orientation-impl.h>
41 #include <dali/internal/window-system/common/render-surface-factory.h>
42 #include <dali/internal/window-system/common/window-base.h>
43 #include <dali/internal/window-system/common/window-factory.h>
44 #include <dali/internal/window-system/common/window-render-surface.h>
45 #include <dali/internal/window-system/common/window-system.h>
46 #include <dali/internal/window-system/common/window-visibility-observer.h>
47
48 namespace Dali
49 {
50 namespace Internal
51 {
52 namespace Adaptor
53 {
54 namespace
55 {
56 #if defined(DEBUG_ENABLED)
57 Debug::Filter* gWindowLogFilter = Debug::Filter::New(Debug::NoLogging, false, "LOG_WINDOW");
58 #endif
59 } // unnamed namespace
60
61 Window* Window::New(const std::string& name, const std::string& className, const WindowData& windowData)
62 {
63   Any surface;
64   return Window::New(surface, name, className, windowData);
65 }
66
67 Window* Window::New(Any surface, const std::string& name, const std::string& className, const WindowData& windowData)
68 {
69   Window* window         = new Window();
70   window->mIsTransparent = windowData.GetTransparency();
71   window->Initialize(surface, windowData.GetPositionSize(), name, className, windowData.GetWindowType());
72   return window;
73 }
74
75 Window::Window()
76 : mWindowSurface(nullptr),
77   mWindowBase(),
78   mParentWindow(NULL),
79   mPreferredAngle(static_cast<int>(WindowOrientation::NO_ORIENTATION_PREFERENCE)),
80   mRotationAngle(0),
81   mWindowWidth(0),
82   mWindowHeight(0),
83   mNativeWindowId(-1),
84   mOrientationMode(Internal::Adaptor::Window::OrientationMode::PORTRAIT),
85   mDeleteRequestSignal(),
86   mFocusChangeSignal(),
87   mResizeSignal(),
88   mVisibilityChangedSignal(),
89   mTransitionEffectEventSignal(),
90   mKeyboardRepeatSettingsChangedSignal(),
91   mAuxiliaryMessageSignal(),
92   mMovedSignal(),
93   mOrientationChangedSignal(),
94   mMouseInOutEventSignal(),
95   mMouseRelativeEventSignal(),
96   mMoveCompletedSignal(),
97   mResizeCompletedSignal(),
98   mInsetsChangedSignal(),
99   mLastKeyEvent(),
100   mLastTouchEvent(),
101   mIsTransparent(false),
102   mIsFocusAcceptable(true),
103   mIconified(false),
104   mMaximized(false),
105   mOpaqueState(false),
106   mWindowRotationAcknowledgement(false),
107   mFocused(false),
108   mIsWindowRotating(false),
109   mIsEnabledUserGeometry(false)
110 {
111 }
112
113 Window::~Window()
114 {
115   if(mScene)
116   {
117     auto bridge     = Accessibility::Bridge::GetCurrentBridge();
118     auto rootLayer  = mScene.GetRootLayer();
119     auto accessible = Accessibility::Accessible::Get(rootLayer);
120     bridge->RemoveTopLevelWindow(accessible);
121     // Related to multi-window case. This is called for default window and non-default window, but it is effective for non-default window.
122     bridge->Emit(accessible, Accessibility::WindowEvent::DESTROY);
123   }
124
125   if(mAdaptor)
126   {
127     mAdaptor->RemoveWindow(this);
128   }
129
130   if(mEventHandler)
131   {
132     mEventHandler->RemoveObserver(*this);
133   }
134 }
135
136 void Window::Initialize(Any surface, const PositionSize& positionSize, const std::string& name, const std::string& className, WindowType type)
137 {
138   // Create a window render surface
139   auto renderSurfaceFactory = Dali::Internal::Adaptor::GetRenderSurfaceFactory();
140   mSurface                  = renderSurfaceFactory->CreateWindowRenderSurface(positionSize, surface, mIsTransparent);
141   mWindowSurface            = static_cast<WindowRenderSurface*>(mSurface.get());
142
143   // Get a window base
144   mWindowBase = mWindowSurface->GetWindowBase();
145
146   // Set Window Type
147   mWindowBase->SetType(type);
148
149   // Initialize for Ime window type
150   if(type == WindowType::IME)
151   {
152     mWindowBase->InitializeIme();
153     mWindowSurface->InitializeImeSurface();
154   }
155
156   // Connect signals
157   mWindowBase->IconifyChangedSignal().Connect(this, &Window::OnIconifyChanged);
158   mWindowBase->MaximizeChangedSignal().Connect(this, &Window::OnMaximizeChanged);
159   mWindowBase->FocusChangedSignal().Connect(this, &Window::OnFocusChanged);
160   mWindowBase->DeleteRequestSignal().Connect(this, &Window::OnDeleteRequest);
161   mWindowBase->TransitionEffectEventSignal().Connect(this, &Window::OnTransitionEffectEvent);
162   mWindowBase->KeyboardRepeatSettingsChangedSignal().Connect(this, &Window::OnKeyboardRepeatSettingsChanged);
163   mWindowBase->WindowRedrawRequestSignal().Connect(this, &Window::OnWindowRedrawRequest);
164   mWindowBase->UpdatePositionSizeSignal().Connect(this, &Window::OnUpdatePositionSize);
165   mWindowBase->AuxiliaryMessageSignal().Connect(this, &Window::OnAuxiliaryMessage);
166   mWindowBase->MouseInOutEventSignal().Connect(this, &Window::OnMouseInOutEvent);
167   mWindowBase->MouseRelativeEventSignal().Connect(this, &Window::OnMouseRelativeEvent);
168   mWindowBase->MoveCompletedSignal().Connect(this, &Window::OnMoveCompleted);
169   mWindowBase->ResizeCompletedSignal().Connect(this, &Window::OnResizeCompleted);
170
171   mWindowSurface->OutputTransformedSignal().Connect(this, &Window::OnOutputTransformed);
172   mWindowSurface->RotationFinishedSignal().Connect(this, &Window::OnRotationFinished);
173
174   mWindowBase->InsetsChangedSignal().Connect(this, &Window::OnInsetsChanged);
175
176   SetClass(name, className);
177
178   mOrientation = Orientation::New(this);
179
180   // Get OrientationMode
181   int screenWidth, screenHeight;
182   WindowSystem::GetScreenSize(screenWidth, screenHeight);
183   if(screenWidth > screenHeight)
184   {
185     mOrientationMode = Internal::Adaptor::Window::OrientationMode::LANDSCAPE;
186   }
187   else
188   {
189     mOrientationMode = Internal::Adaptor::Window::OrientationMode::PORTRAIT;
190   }
191
192   mWindowWidth  = positionSize.width;
193   mWindowHeight = positionSize.height;
194
195   bool isSetWithScreenSize = false;
196   if(mWindowWidth <= 0 || mWindowHeight <= 0)
197   {
198     mWindowWidth        = screenWidth;
199     mWindowHeight       = screenHeight;
200     isSetWithScreenSize = true;
201     DALI_LOG_RELEASE_INFO("Window size is set with screen size(%d x %d)\n", mWindowWidth, mWindowHeight);
202   }
203
204   if(isSetWithScreenSize == false || positionSize.x != 0 || positionSize.y != 0)
205   {
206     SetUserGeometryPolicy();
207   }
208
209   // For Debugging
210   mNativeWindowId = mWindowBase->GetNativeWindowId();
211 }
212
213 void Window::SetRenderNotification(TriggerEventInterface* renderNotification)
214 {
215   if(!mWindowSurface)
216   {
217     return;
218   }
219
220   mWindowSurface->SetRenderNotification(renderNotification);
221 }
222
223 void Window::OnAdaptorSet(Dali::Adaptor& adaptor)
224 {
225   mEventHandler = EventHandlerPtr(new EventHandler(mWindowSurface->GetWindowBase(), *mAdaptor));
226   mEventHandler->AddObserver(*this);
227
228   // Add Window to bridge for ATSPI
229   auto bridge = Accessibility::Bridge::GetCurrentBridge();
230   if(bridge->IsUp())
231   {
232     auto rootLayer  = mScene.GetRootLayer();
233     auto accessible = Accessibility::Accessible::Get(rootLayer);
234     bridge->AddTopLevelWindow(accessible);
235
236     // Emit Window create event
237     // Create and Destory signal only emit in multi-window environment, so it does not emit on default layer.
238     bridge->Emit(accessible, Accessibility::WindowEvent::CREATE);
239   }
240
241   bridge->EnabledSignal().Connect(this, &Window::OnAccessibilityEnabled);
242   bridge->DisabledSignal().Connect(this, &Window::OnAccessibilityDisabled);
243
244   // If you call the 'Show' before creating the adaptor, the application cannot know the app resource id.
245   // The show must be called after the adaptor is initialized.
246   Show();
247 }
248
249 void Window::OnSurfaceSet(Dali::RenderSurfaceInterface* surface)
250 {
251   mWindowSurface = static_cast<WindowRenderSurface*>(surface);
252 }
253
254 void Window::SetClass(std::string name, std::string className)
255 {
256   mName      = name;
257   mClassName = className;
258   mWindowBase->SetClass(name, className);
259 }
260
261 std::string Window::GetClassName() const
262 {
263   return mClassName;
264 }
265
266 void Window::Raise()
267 {
268   mWindowBase->Raise();
269
270   mSurface->SetFullSwapNextFrame();
271
272   DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), Raise() \n", this, mNativeWindowId);
273 }
274
275 void Window::Lower()
276 {
277   mWindowBase->Lower();
278
279   mSurface->SetFullSwapNextFrame();
280
281   DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), Lower() \n", this, mNativeWindowId);
282 }
283
284 void Window::Activate()
285 {
286   mWindowBase->Activate();
287
288   mSurface->SetFullSwapNextFrame();
289
290   DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), Activate() \n", this, mNativeWindowId);
291 }
292
293 void Window::Maximize(bool maximize)
294 {
295   mWindowBase->Maximize(maximize);
296
297   DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), Maximize: %d\n", this, mNativeWindowId, maximize);
298 }
299
300 bool Window::IsMaximized() const
301 {
302   return mWindowBase->IsMaximized();
303 }
304
305 void Window::SetMaximumSize(Dali::Window::WindowSize size)
306 {
307   mWindowBase->SetMaximumSize(size);
308 }
309
310 void Window::Minimize(bool minimize)
311 {
312   mWindowBase->Minimize(minimize);
313
314   DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), Minimize: %d\n", this, mNativeWindowId, minimize);
315 }
316
317 bool Window::IsMinimized() const
318 {
319   return mWindowBase->IsMinimized();
320 }
321
322 void Window::SetMimimumSize(Dali::Window::WindowSize size)
323 {
324   mWindowBase->SetMimimumSize(size);
325 }
326
327 uint32_t Window::GetLayerCount() const
328 {
329   return mScene.GetLayerCount();
330 }
331
332 Dali::Layer Window::GetLayer(uint32_t depth) const
333 {
334   return mScene.GetLayer(depth);
335 }
336
337 void Window::KeepRendering(float durationSeconds)
338 {
339   mScene.KeepRendering(durationSeconds);
340 }
341
342 void Window::SetPartialUpdateEnabled(bool enabled)
343 {
344   mScene.SetPartialUpdateEnabled(enabled);
345 }
346
347 bool Window::IsPartialUpdateEnabled() const
348 {
349   return mScene.IsPartialUpdateEnabled();
350 }
351
352 std::string Window::GetNativeResourceId() const
353 {
354   return mWindowBase->GetNativeWindowResourceId();
355 }
356
357 void Window::AddAvailableOrientation(WindowOrientation orientation)
358 {
359   if(IsOrientationAvailable(orientation) == false)
360   {
361     return;
362   }
363
364   bool found          = false;
365   int  convertedAngle = ConvertToAngle(orientation);
366   DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), AddAvailableOrientation: %d\n", this, mNativeWindowId, convertedAngle);
367   for(std::size_t i = 0; i < mAvailableAngles.size(); i++)
368   {
369     if(mAvailableAngles[i] == convertedAngle)
370     {
371       found = true;
372       break;
373     }
374   }
375
376   if(!found)
377   {
378     mAvailableAngles.push_back(convertedAngle);
379     SetAvailableAnlges(mAvailableAngles);
380   }
381 }
382
383 void Window::RemoveAvailableOrientation(WindowOrientation orientation)
384 {
385   if(IsOrientationAvailable(orientation) == false)
386   {
387     return;
388   }
389
390   int convertedAngle = ConvertToAngle(orientation);
391   DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), RemoveAvailableOrientation: %d\n", this, mNativeWindowId, convertedAngle);
392   for(std::vector<int>::iterator iter = mAvailableAngles.begin();
393       iter != mAvailableAngles.end();
394       ++iter)
395   {
396     if(*iter == convertedAngle)
397     {
398       mAvailableAngles.erase(iter);
399       break;
400     }
401   }
402
403   SetAvailableAnlges(mAvailableAngles);
404 }
405
406 void Window::SetPreferredOrientation(WindowOrientation orientation)
407 {
408   if(orientation < WindowOrientation::NO_ORIENTATION_PREFERENCE || orientation > WindowOrientation::LANDSCAPE_INVERSE)
409   {
410     DALI_LOG_INFO(gWindowLogFilter, Debug::Verbose, "Window::CheckOrientation: Invalid input orientation [%d]\n", orientation);
411     return;
412   }
413   mPreferredAngle = ConvertToAngle(orientation);
414   DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), SetPreferredOrientation: %d\n", this, mNativeWindowId, mPreferredAngle);
415   mWindowBase->SetPreferredAngle(mPreferredAngle);
416 }
417
418 WindowOrientation Window::GetPreferredOrientation()
419 {
420   WindowOrientation preferredOrientation = ConvertToOrientation(mPreferredAngle);
421   return preferredOrientation;
422 }
423
424 void Window::SetPositionSizeWithOrientation(PositionSize positionSize, WindowOrientation orientation)
425 {
426   int angle = ConvertToAngle(orientation);
427   mWindowBase->SetPositionSizeWithAngle(positionSize, angle);
428 }
429
430 void Window::EmitAccessibilityHighlightSignal(bool highlight)
431 {
432   Dali::Window handle(this);
433   mAccessibilityHighlightSignal.Emit(handle, highlight);
434 }
435
436 void Window::SetAvailableAnlges(const std::vector<int>& angles)
437 {
438   if(angles.size() > 4)
439   {
440     DALI_LOG_INFO(gWindowLogFilter, Debug::Verbose, "Window::SetAvailableAnlges: Invalid vector size! [%d]\n", angles.size());
441     return;
442   }
443
444   mWindowBase->SetAvailableAnlges(angles);
445 }
446
447 int Window::ConvertToAngle(WindowOrientation orientation)
448 {
449   int convertAngle = static_cast<int>(orientation);
450   if(mOrientationMode == Internal::Adaptor::Window::OrientationMode::LANDSCAPE)
451   {
452     switch(orientation)
453     {
454       case WindowOrientation::LANDSCAPE:
455       {
456         convertAngle = 0;
457         break;
458       }
459       case WindowOrientation::PORTRAIT:
460       {
461         convertAngle = 90;
462         break;
463       }
464       case WindowOrientation::LANDSCAPE_INVERSE:
465       {
466         convertAngle = 180;
467         break;
468       }
469       case WindowOrientation::PORTRAIT_INVERSE:
470       {
471         convertAngle = 270;
472         break;
473       }
474       case WindowOrientation::NO_ORIENTATION_PREFERENCE:
475       {
476         convertAngle = -1;
477         break;
478       }
479     }
480   }
481   return convertAngle;
482 }
483
484 WindowOrientation Window::ConvertToOrientation(int angle) const
485 {
486   WindowOrientation orientation = static_cast<WindowOrientation>(angle);
487   if(mOrientationMode == Internal::Adaptor::Window::OrientationMode::LANDSCAPE)
488   {
489     switch(angle)
490     {
491       case 0:
492       {
493         orientation = WindowOrientation::LANDSCAPE;
494         break;
495       }
496       case 90:
497       {
498         orientation = WindowOrientation::PORTRAIT;
499         break;
500       }
501       case 180:
502       {
503         orientation = WindowOrientation::LANDSCAPE_INVERSE;
504         break;
505       }
506       case 270:
507       {
508         orientation = WindowOrientation::PORTRAIT_INVERSE;
509         break;
510       }
511       case -1:
512       {
513         orientation = WindowOrientation::NO_ORIENTATION_PREFERENCE;
514         break;
515       }
516     }
517   }
518   return orientation;
519 }
520
521 bool Window::IsOrientationAvailable(WindowOrientation orientation) const
522 {
523   if(orientation <= WindowOrientation::NO_ORIENTATION_PREFERENCE || orientation > WindowOrientation::LANDSCAPE_INVERSE)
524   {
525     DALI_LOG_INFO(gWindowLogFilter, Debug::Verbose, "Window::IsOrientationAvailable: Invalid input orientation [%d]\n", orientation);
526     return false;
527   }
528   return true;
529 }
530
531 Dali::Any Window::GetNativeHandle() const
532 {
533   return mWindowSurface->GetNativeWindow();
534 }
535
536 void Window::SetAcceptFocus(bool accept)
537 {
538   mIsFocusAcceptable = accept;
539
540   mWindowBase->SetAcceptFocus(accept);
541 }
542
543 bool Window::IsFocusAcceptable() const
544 {
545   return mIsFocusAcceptable;
546 }
547
548 void Window::Show()
549 {
550   mVisible = true;
551
552   mWindowBase->Show();
553
554   if(!mIconified)
555   {
556     Dali::Window handle(this);
557     mVisibilityChangedSignal.Emit(handle, true);
558     Dali::Accessibility::Bridge::GetCurrentBridge()->WindowShown(handle);
559
560     WindowVisibilityObserver* observer(mAdaptor);
561     observer->OnWindowShown();
562   }
563
564   mSurface->SetFullSwapNextFrame();
565
566   DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), Show(): iconified = %d, visible = %d\n", this, mNativeWindowId, mIconified, mVisible);
567 }
568
569 void Window::Hide()
570 {
571   mVisible = false;
572
573   mWindowBase->Hide();
574
575   if(!mIconified)
576   {
577     Dali::Window handle(this);
578     mVisibilityChangedSignal.Emit(handle, false);
579     Dali::Accessibility::Bridge::GetCurrentBridge()->WindowHidden(handle);
580
581     WindowVisibilityObserver* observer(mAdaptor);
582     observer->OnWindowHidden();
583   }
584
585   DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), Hide(): iconified = %d, visible = %d\n", this, mNativeWindowId, mIconified, mVisible);
586 }
587
588 bool Window::IsVisible() const
589 {
590   DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), IsVisible(): iconified = %d, visible = %d\n", this, mNativeWindowId, mIconified, mVisible);
591   return mVisible && !mIconified;
592 }
593
594 unsigned int Window::GetSupportedAuxiliaryHintCount() const
595 {
596   return mWindowBase->GetSupportedAuxiliaryHintCount();
597 }
598
599 std::string Window::GetSupportedAuxiliaryHint(unsigned int index) const
600 {
601   return mWindowBase->GetSupportedAuxiliaryHint(index);
602 }
603
604 unsigned int Window::AddAuxiliaryHint(const std::string& hint, const std::string& value)
605 {
606   return mWindowBase->AddAuxiliaryHint(hint, value);
607 }
608
609 bool Window::RemoveAuxiliaryHint(unsigned int id)
610 {
611   return mWindowBase->RemoveAuxiliaryHint(id);
612 }
613
614 bool Window::SetAuxiliaryHintValue(unsigned int id, const std::string& value)
615 {
616   return mWindowBase->SetAuxiliaryHintValue(id, value);
617 }
618
619 std::string Window::GetAuxiliaryHintValue(unsigned int id) const
620 {
621   return mWindowBase->GetAuxiliaryHintValue(id);
622 }
623
624 unsigned int Window::GetAuxiliaryHintId(const std::string& hint) const
625 {
626   return mWindowBase->GetAuxiliaryHintId(hint);
627 }
628
629 void Window::SetInputRegion(const Rect<int>& inputRegion)
630 {
631   DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), SetInputRegion, (%d,%d), (%d x %d)\n", this, mNativeWindowId, inputRegion.x, inputRegion.y, inputRegion.width, inputRegion.height);
632   mWindowBase->SetInputRegion(inputRegion);
633 }
634
635 void Window::SetType(WindowType type)
636 {
637   mWindowBase->SetType(type);
638 }
639
640 WindowType Window::GetType() const
641 {
642   return mWindowBase->GetType();
643 }
644
645 WindowOperationResult Window::SetNotificationLevel(WindowNotificationLevel level)
646 {
647   WindowType type = mWindowBase->GetType();
648   if(type != WindowType::NOTIFICATION)
649   {
650     DALI_LOG_INFO(gWindowLogFilter, Debug::Verbose, "Window::SetNotificationLevel: Not supported window type [%d]\n", type);
651     return WindowOperationResult::INVALID_OPERATION;
652   }
653
654   return mWindowBase->SetNotificationLevel(level);
655 }
656
657 WindowNotificationLevel Window::GetNotificationLevel() const
658 {
659   WindowType type = mWindowBase->GetType();
660   if(type != WindowType::NOTIFICATION)
661   {
662     DALI_LOG_INFO(gWindowLogFilter, Debug::Verbose, "Window::GetNotificationLevel: Not supported window type [%d]\n", type);
663     return WindowNotificationLevel::NONE;
664   }
665
666   return mWindowBase->GetNotificationLevel();
667 }
668
669 void Window::SetOpaqueState(bool opaque)
670 {
671   mOpaqueState = opaque;
672
673   mWindowBase->SetOpaqueState(opaque);
674
675   DALI_LOG_INFO(gWindowLogFilter, Debug::Verbose, "Window::SetOpaqueState: opaque = %d\n", opaque);
676 }
677
678 bool Window::IsOpaqueState() const
679 {
680   return mOpaqueState;
681 }
682
683 WindowOperationResult Window::SetScreenOffMode(WindowScreenOffMode screenOffMode)
684 {
685   return mWindowBase->SetScreenOffMode(screenOffMode);
686 }
687
688 WindowScreenOffMode Window::GetScreenOffMode() const
689 {
690   return mWindowBase->GetScreenOffMode();
691 }
692
693 WindowOperationResult Window::SetBrightness(int brightness)
694 {
695   if(brightness < 0 || brightness > 100)
696   {
697     DALI_LOG_INFO(gWindowLogFilter, Debug::Verbose, "Window::SetBrightness: Invalid brightness value [%d]\n", brightness);
698     return WindowOperationResult::INVALID_OPERATION;
699   }
700
701   return mWindowBase->SetBrightness(brightness);
702 }
703
704 int Window::GetBrightness() const
705 {
706   return mWindowBase->GetBrightness();
707 }
708
709 void Window::SetSize(Dali::Window::WindowSize size)
710 {
711   PositionSize oldRect = GetPositionSize();
712
713   PositionSize newRect;
714   newRect.width  = size.GetWidth();
715   newRect.height = size.GetHeight();
716
717   SetUserGeometryPolicy();
718
719   // When surface size is updated, inform adaptor of resizing and emit ResizeSignal
720   if((oldRect.width != newRect.width) || (oldRect.height != newRect.height))
721   {
722     mWindowSurface->MoveResize(PositionSize(oldRect.x, oldRect.y, newRect.width, newRect.height));
723
724     Uint16Pair newSize(newRect.width, newRect.height);
725
726     mWindowWidth  = newRect.width;
727     mWindowHeight = newRect.height;
728
729     DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), current angle (%d), SetSize(): (%d, %d), [%d x %d]\n", this, mNativeWindowId, mRotationAngle, oldRect.x, oldRect.y, newRect.width, newRect.height);
730
731     SurfaceResized(static_cast<float>(mWindowWidth), static_cast<float>(mWindowHeight));
732
733     mAdaptor->SurfaceResizePrepare(mSurface.get(), newSize);
734
735     Dali::Window handle(this);
736     mResizeSignal.Emit(handle, newSize);
737
738     mAdaptor->SurfaceResizeComplete(mSurface.get(), newSize);
739   }
740
741   mSurface->SetFullSwapNextFrame();
742
743   Dali::Accessibility::Accessible::Get(mScene.GetRootLayer())->EmitBoundsChanged(Dali::Rect<>(oldRect.x, oldRect.y, size.GetWidth(), size.GetHeight()));
744 }
745
746 Dali::Window::WindowSize Window::GetSize() const
747 {
748   return Dali::Window::WindowSize(mWindowWidth, mWindowHeight);
749 }
750
751 void Window::SetPosition(Dali::Window::WindowPosition position)
752 {
753   PositionSize oldRect = mSurface->GetPositionSize();
754   int32_t      newX    = position.GetX();
755   int32_t      newY    = position.GetY();
756
757   SetUserGeometryPolicy();
758
759   mWindowSurface->Move(PositionSize(newX, newY, oldRect.width, oldRect.height));
760
761   if((oldRect.x != newX) || (oldRect.y != newY))
762   {
763     Dali::Window                 handle(this);
764     Dali::Window::WindowPosition newPosition(newX, newY);
765
766     DALI_LOG_RELEASE_INFO("send moved signal with new position: %d, %d\n", newPosition.GetX(), newPosition.GetY());
767     mMovedSignal.Emit(handle, newPosition);
768   }
769
770   mSurface->SetFullSwapNextFrame();
771
772   Dali::Accessibility::Accessible::Get(mScene.GetRootLayer())->EmitBoundsChanged(Dali::Rect<>(position.GetX(), position.GetY(), oldRect.width, oldRect.height));
773 }
774
775 Dali::Window::WindowPosition Window::GetPosition() const
776 {
777   PositionSize positionSize = GetPositionSize();
778   return Dali::Window::WindowPosition(positionSize.x, positionSize.y);
779 }
780
781 PositionSize Window::GetPositionSize() const
782 {
783   PositionSize positionSize = mSurface->GetPositionSize();
784   positionSize.width        = mWindowWidth;
785   positionSize.height       = mWindowHeight;
786   return positionSize;
787 }
788
789 void Window::SetPositionSize(PositionSize positionSize)
790 {
791   bool moved  = false;
792   bool resize = false;
793
794   PositionSize oldRect = GetPositionSize();
795   Dali::Window handle(this);
796
797   SetUserGeometryPolicy();
798
799   if((oldRect.x != positionSize.x) || (oldRect.y != positionSize.y))
800   {
801     moved = true;
802   }
803
804   if((oldRect.width != positionSize.width) || (oldRect.height != positionSize.height))
805   {
806     resize = true;
807   }
808
809   if(moved || resize)
810   {
811     mWindowSurface->MoveResize(positionSize);
812   }
813
814   // When window is moved, emit Moved Signal
815   if(moved)
816   {
817     DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), Moved signal emit (%d, %d)\n", this, mNativeWindowId, positionSize.x, positionSize.y);
818     Dali::Window::WindowPosition position(positionSize.x, positionSize.y);
819     mMovedSignal.Emit(handle, position);
820   }
821
822   // When surface size is updated, inform adaptor of resizing and emit ResizeSignal
823   if(resize)
824   {
825     Uint16Pair newSize(positionSize.width, positionSize.height);
826
827     mWindowWidth  = positionSize.width;
828     mWindowHeight = positionSize.height;
829
830     SurfaceResized(static_cast<float>(mWindowWidth), static_cast<float>(mWindowHeight));
831
832     mAdaptor->SurfaceResizePrepare(mSurface.get(), newSize);
833
834     DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), Resize signal emit [%d x %d]\n", this, mNativeWindowId, positionSize.width, positionSize.height);
835
836     mResizeSignal.Emit(handle, newSize);
837     mAdaptor->SurfaceResizeComplete(mSurface.get(), newSize);
838   }
839
840   mSurface->SetFullSwapNextFrame();
841
842   Dali::Accessibility::Accessible::Get(mScene.GetRootLayer())->EmitBoundsChanged(Dali::Rect<>(positionSize.x, positionSize.y, positionSize.width, positionSize.height));
843 }
844
845 void Window::SetLayout(unsigned int numCols, unsigned int numRows, unsigned int column, unsigned int row, unsigned int colSpan, unsigned int rowSpan)
846 {
847   SetUserGeometryPolicy();
848   mWindowBase->SetLayout(numCols, numRows, column, row, colSpan, rowSpan);
849 }
850
851 Dali::Layer Window::GetRootLayer() const
852 {
853   return mScene.GetRootLayer();
854 }
855
856 void Window::SetTransparency(bool transparent)
857 {
858   mWindowSurface->SetTransparency(transparent);
859 }
860
861 bool Window::GrabKey(Dali::KEY key, KeyGrab::KeyGrabMode grabMode)
862 {
863   return mWindowBase->GrabKey(key, grabMode);
864 }
865
866 bool Window::UngrabKey(Dali::KEY key)
867 {
868   return mWindowBase->UngrabKey(key);
869 }
870
871 bool Window::GrabKeyList(const Dali::Vector<Dali::KEY>& key, const Dali::Vector<KeyGrab::KeyGrabMode>& grabMode, Dali::Vector<bool>& result)
872 {
873   return mWindowBase->GrabKeyList(key, grabMode, result);
874 }
875
876 bool Window::UngrabKeyList(const Dali::Vector<Dali::KEY>& key, Dali::Vector<bool>& result)
877 {
878   return mWindowBase->UngrabKeyList(key, result);
879 }
880
881 void Window::OnIconifyChanged(bool iconified)
882 {
883   const bool   isActuallyChanged = (iconified != mIconified);
884   auto         bridge            = Dali::Accessibility::Bridge::GetCurrentBridge();
885   Dali::Window handle(this);
886
887   if(iconified)
888   {
889     mIconified = true;
890
891     if(mVisible)
892     {
893       mVisibilityChangedSignal.Emit(handle, false);
894       bridge->WindowHidden(handle);
895
896       WindowVisibilityObserver* observer(mAdaptor);
897       observer->OnWindowHidden();
898     }
899
900     if(isActuallyChanged)
901     {
902       bridge->WindowMinimized(handle);
903     }
904
905     DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), Iconified: visible = %d\n", this, mNativeWindowId, mVisible);
906   }
907   else
908   {
909     mIconified = false;
910
911     if(mVisible)
912     {
913       mVisibilityChangedSignal.Emit(handle, true);
914       bridge->WindowShown(handle);
915
916       WindowVisibilityObserver* observer(mAdaptor);
917       observer->OnWindowShown();
918     }
919
920     if(isActuallyChanged)
921     {
922       bridge->WindowRestored(handle, Dali::Accessibility::WindowRestoreType::RESTORE_FROM_ICONIFY);
923     }
924
925     DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), Deiconified: visible = %d\n", this, mNativeWindowId, mVisible);
926   }
927
928   mSurface->SetFullSwapNextFrame();
929 }
930
931 void Window::OnMaximizeChanged(bool maximized)
932 {
933   const bool isActuallyChanged = (maximized != mMaximized);
934
935   if(isActuallyChanged)
936   {
937     auto         bridge = Dali::Accessibility::Bridge::GetCurrentBridge();
938     Dali::Window handle(this);
939
940     if(maximized)
941     {
942       mMaximized = true;
943       bridge->WindowMaximized(handle);
944     }
945     else
946     {
947       mMaximized = false;
948       bridge->WindowRestored(handle, Dali::Accessibility::WindowRestoreType::RESTORE_FROM_MAXIMIZE);
949     }
950   }
951 }
952
953 void Window::OnFocusChanged(bool focusIn)
954 {
955   Dali::Window handle(this);
956   mFocusChangeSignal.Emit(handle, focusIn);
957
958   mSurface->SetFullSwapNextFrame();
959   auto bridge = Dali::Accessibility::Bridge::GetCurrentBridge();
960
961   if(focusIn)
962   {
963     bridge->WindowFocused(handle);
964   }
965   else
966   {
967     bridge->WindowUnfocused(handle);
968   }
969
970   mFocused = focusIn;
971 }
972
973 void Window::OnOutputTransformed()
974 {
975   PositionSize positionSize = GetPositionSize();
976
977   SurfaceRotated(static_cast<float>(positionSize.width), static_cast<float>(positionSize.height), mRotationAngle, mWindowBase->GetScreenRotationAngle());
978
979   mAdaptor->SurfaceResizePrepare(mSurface.get(), Adaptor::SurfaceSize(positionSize.width, positionSize.height));
980   mAdaptor->SurfaceResizeComplete(mSurface.get(), Adaptor::SurfaceSize(positionSize.width, positionSize.height));
981 }
982
983 void Window::OnDeleteRequest()
984 {
985   mDeleteRequestSignal.Emit();
986 }
987
988 void Window::OnTransitionEffectEvent(WindowEffectState state, WindowEffectType type)
989 {
990   Dali::Window handle(this);
991   mTransitionEffectEventSignal.Emit(handle, state, type);
992 }
993
994 void Window::OnKeyboardRepeatSettingsChanged()
995 {
996   Dali::Window handle(this);
997   mKeyboardRepeatSettingsChangedSignal.Emit();
998 }
999
1000 void Window::OnWindowRedrawRequest()
1001 {
1002   mAdaptor->RenderOnce();
1003 }
1004
1005 void Window::OnUpdatePositionSize(Dali::PositionSize& positionSize)
1006 {
1007   bool moved  = false;
1008   bool resize = false;
1009
1010   Dali::Window handle(this);
1011
1012   PositionSize oldRect = GetPositionSize();
1013   PositionSize newRect = positionSize;
1014
1015   if((oldRect.x != newRect.x) || (oldRect.y != newRect.y))
1016   {
1017     moved = true;
1018   }
1019
1020   if((oldRect.width != newRect.width) || (oldRect.height != newRect.height))
1021   {
1022     resize = true;
1023   }
1024
1025   if(moved || resize)
1026   {
1027     DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), current angle (%d), position or size is updated by server , (%d, %d) [%d x %d]\n", this, mNativeWindowId, mRotationAngle, newRect.x, newRect.y, newRect.width, newRect.height);
1028     mWindowSurface->UpdatePositionSize(positionSize);
1029   }
1030
1031   if((oldRect.x != newRect.x) || (oldRect.y != newRect.y))
1032   {
1033     DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), Moved signal emit (%d, %d)\n", this, mNativeWindowId, newRect.x, newRect.y);
1034     Dali::Window::WindowPosition position(newRect.x, newRect.y);
1035     mMovedSignal.Emit(handle, position);
1036   }
1037
1038   // When surface size is updated, inform adaptor of resizing and emit ResizeSignal
1039   if((oldRect.width != newRect.width) || (oldRect.height != newRect.height))
1040   {
1041     Uint16Pair newSize(newRect.width, newRect.height);
1042
1043     mWindowWidth  = newRect.width;
1044     mWindowHeight = newRect.height;
1045
1046     SurfaceResized(static_cast<float>(mWindowWidth), static_cast<float>(mWindowHeight));
1047
1048     mAdaptor->SurfaceResizePrepare(mSurface.get(), newSize);
1049
1050     DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), Resized signal emit [%d x %d]\n", this, mNativeWindowId, newRect.width, newRect.height);
1051     mResizeSignal.Emit(handle, newSize);
1052     mAdaptor->SurfaceResizeComplete(mSurface.get(), newSize);
1053   }
1054
1055   mSurface->SetFullSwapNextFrame();
1056
1057   Dali::Accessibility::Accessible::Get(mScene.GetRootLayer())->EmitBoundsChanged(Dali::Rect<>(positionSize.x, positionSize.y, positionSize.width, positionSize.height));
1058 }
1059
1060 void Window::OnTouchPoint(Dali::Integration::Point& point, int timeStamp)
1061 {
1062   mLastTouchEvent = Dali::Integration::NewTouchEvent(timeStamp, point);
1063   FeedTouchPoint(point, timeStamp);
1064 }
1065
1066 void Window::OnWheelEvent(Dali::Integration::WheelEvent& wheelEvent)
1067 {
1068   FeedWheelEvent(wheelEvent);
1069 }
1070
1071 void Window::OnKeyEvent(Dali::Integration::KeyEvent& keyEvent)
1072 {
1073   mLastKeyEvent = Dali::DevelKeyEvent::New(keyEvent.keyName, keyEvent.logicalKey, keyEvent.keyString, keyEvent.keyCode, keyEvent.keyModifier, keyEvent.time, static_cast<Dali::KeyEvent::State>(keyEvent.state), keyEvent.compose, keyEvent.deviceName, keyEvent.deviceClass, keyEvent.deviceSubclass);
1074   FeedKeyEvent(keyEvent);
1075 }
1076
1077 void Window::OnMouseInOutEvent(const Dali::DevelWindow::MouseInOutEvent& mouseInOutEvent)
1078 {
1079   Dali::Window handle(this);
1080
1081   mMouseInOutEventSignal.Emit(handle, mouseInOutEvent);
1082 }
1083
1084 void Window::OnMouseRelativeEvent(const Dali::DevelWindow::MouseRelativeEvent& MouseRelativeEvent)
1085 {
1086   Dali::Window handle(this);
1087
1088   mMouseRelativeEventSignal.Emit(handle, MouseRelativeEvent);
1089 }
1090
1091 void Window::OnRotation(const RotationEvent& rotation)
1092 {
1093   PositionSize newPositionSize(rotation.x, rotation.y, rotation.width, rotation.height);
1094
1095   mRotationAngle = rotation.angle;
1096   mWindowWidth   = rotation.width;
1097   mWindowHeight  = rotation.height;
1098
1099   mIsWindowRotating = true;
1100   DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), angle(%d), Window Rotation (%d , %d) [%d x %d]\n", this, mNativeWindowId, mRotationAngle, newPositionSize.x, newPositionSize.y, mWindowWidth, mWindowHeight);
1101
1102   // Notify that the orientation is changed
1103   mOrientation->OnOrientationChange(rotation);
1104
1105   mWindowSurface->RequestRotation(mRotationAngle, newPositionSize);
1106
1107   SurfaceRotated(static_cast<float>(mWindowWidth), static_cast<float>(mWindowHeight), mRotationAngle, mWindowBase->GetScreenRotationAngle());
1108
1109   mAdaptor->SurfaceResizePrepare(mSurface.get(), Adaptor::SurfaceSize(mWindowWidth, mWindowHeight));
1110
1111   Dali::Window handle(this);
1112   mResizeSignal.Emit(handle, Dali::Window::WindowSize(mWindowWidth, mWindowHeight));
1113   mOrientationChangedSignal.Emit(handle, GetCurrentOrientation());
1114
1115   mAdaptor->SurfaceResizeComplete(mSurface.get(), Adaptor::SurfaceSize(mWindowWidth, mWindowHeight));
1116 }
1117
1118 void Window::OnRotationFinished()
1119 {
1120   mIsWindowRotating = false;
1121   DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), window rotation is finised\n", this, mNativeWindowId);
1122 }
1123
1124 void Window::OnPause()
1125 {
1126   if(mEventHandler)
1127   {
1128     mEventHandler->Pause();
1129   }
1130 }
1131
1132 void Window::OnResume()
1133 {
1134   if(mEventHandler)
1135   {
1136     mEventHandler->Resume();
1137   }
1138
1139   mSurface->SetFullSwapNextFrame();
1140 }
1141
1142 void Window::OnAuxiliaryMessage(const std::string& key, const std::string& value, const Property::Array& options)
1143 {
1144   mAuxiliaryMessageSignal.Emit(key, value, options);
1145 }
1146
1147 void Window::OnInsetsChanged(WindowInsetsPartType partType, WindowInsetsPartState partState, const Extents& insets)
1148 {
1149   mInsetsChangedSignal.Emit(partType, partState, insets);
1150 }
1151
1152 void Window::OnAccessibilityEnabled()
1153 {
1154   auto bridge     = Accessibility::Bridge::GetCurrentBridge();
1155   auto rootLayer  = mScene.GetRootLayer();
1156   auto accessible = Accessibility::Accessible::Get(rootLayer);
1157   bridge->AddTopLevelWindow(accessible);
1158
1159   if(!mVisible || mIconified)
1160   {
1161     return;
1162   }
1163
1164   Dali::Window handle(this);
1165   bridge->WindowShown(handle);
1166
1167   if(mFocused)
1168   {
1169     bridge->WindowFocused(handle);
1170   }
1171 }
1172
1173 void Window::OnAccessibilityDisabled()
1174 {
1175   auto bridge     = Accessibility::Bridge::GetCurrentBridge();
1176   auto rootLayer  = mScene.GetRootLayer();
1177   auto accessible = Accessibility::Accessible::Get(rootLayer);
1178   bridge->RemoveTopLevelWindow(accessible);
1179 }
1180
1181 void Window::OnMoveCompleted(Dali::Window::WindowPosition& position)
1182 {
1183   Dali::Window handle(this);
1184   mMoveCompletedSignal.Emit(handle, position);
1185 }
1186
1187 void Window::OnResizeCompleted(Dali::Window::WindowSize& size)
1188 {
1189   Dali::Window handle(this);
1190   mResizeCompletedSignal.Emit(handle, size);
1191 }
1192
1193 Vector2 Window::RecalculatePosition(const Vector2& position)
1194 {
1195   Vector2 convertedPosition;
1196
1197   switch(mRotationAngle)
1198   {
1199     case 90:
1200     {
1201       convertedPosition.x = static_cast<float>(mWindowWidth) - position.y;
1202       convertedPosition.y = position.x;
1203       break;
1204     }
1205     case 180:
1206     {
1207       convertedPosition.x = static_cast<float>(mWindowWidth) - position.x;
1208       convertedPosition.y = static_cast<float>(mWindowHeight) - position.y;
1209       break;
1210     }
1211     case 270:
1212     {
1213       convertedPosition.x = position.y;
1214       convertedPosition.y = static_cast<float>(mWindowHeight) - position.x;
1215       break;
1216     }
1217     default:
1218     {
1219       convertedPosition = position;
1220       break;
1221     }
1222   }
1223   return convertedPosition;
1224 }
1225
1226 Dali::Window Window::Get(Dali::Actor actor)
1227 {
1228   Internal::Adaptor::Window* windowImpl = nullptr;
1229
1230   if(Internal::Adaptor::Adaptor::IsAvailable())
1231   {
1232     Dali::Internal::Adaptor::Adaptor& adaptor = Internal::Adaptor::Adaptor::GetImplementation(Internal::Adaptor::Adaptor::Get());
1233     windowImpl                                = dynamic_cast<Internal::Adaptor::Window*>(adaptor.GetWindow(actor));
1234     if(windowImpl)
1235     {
1236       return Dali::Window(windowImpl);
1237     }
1238   }
1239
1240   return Dali::Window();
1241 }
1242
1243 void Window::SetParent(Dali::Window& parent)
1244 {
1245   if(DALI_UNLIKELY(parent))
1246   {
1247     mParentWindow     = parent;
1248     Dali::Window self = Dali::Window(this);
1249     // check circular parent window setting
1250     if(Dali::DevelWindow::GetParent(parent) == self)
1251     {
1252       Dali::DevelWindow::Unparent(parent);
1253     }
1254     mWindowBase->SetParent(GetImplementation(mParentWindow).mWindowBase, false);
1255   }
1256 }
1257
1258 void Window::SetParent(Dali::Window& parent, bool belowParent)
1259 {
1260   if(DALI_UNLIKELY(parent))
1261   {
1262     mParentWindow     = parent;
1263     Dali::Window self = Dali::Window(this);
1264     // check circular parent window setting
1265     if(Dali::DevelWindow::GetParent(parent) == self)
1266     {
1267       Dali::DevelWindow::Unparent(parent);
1268     }
1269     mWindowBase->SetParent(GetImplementation(mParentWindow).mWindowBase, belowParent);
1270   }
1271 }
1272
1273 void Window::Unparent()
1274 {
1275   mWindowBase->SetParent(nullptr, false);
1276   mParentWindow.Reset();
1277 }
1278
1279 Dali::Window Window::GetParent()
1280 {
1281   return mParentWindow;
1282 }
1283
1284 WindowOrientation Window::GetCurrentOrientation() const
1285 {
1286   return ConvertToOrientation(mRotationAngle);
1287 }
1288
1289 int Window::GetPhysicalOrientation() const
1290 {
1291   return (mRotationAngle + mWindowBase->GetScreenRotationAngle()) % 360;
1292 }
1293
1294 void Window::SetAvailableOrientations(const Dali::Vector<WindowOrientation>& orientations)
1295 {
1296   Dali::Vector<float>::SizeType count = orientations.Count();
1297   for(Dali::Vector<float>::SizeType index = 0; index < count; ++index)
1298   {
1299     if(IsOrientationAvailable(orientations[index]) == false)
1300     {
1301       DALI_LOG_ERROR("Window::SetAvailableOrientations, invalid orientation: %d\n", orientations[index]);
1302       continue;
1303     }
1304
1305     bool found          = false;
1306     int  convertedAngle = ConvertToAngle(orientations[index]);
1307
1308     for(std::size_t i = 0; i < mAvailableAngles.size(); i++)
1309     {
1310       if(mAvailableAngles[i] == convertedAngle)
1311       {
1312         found = true;
1313         break;
1314       }
1315     }
1316
1317     if(!found)
1318     {
1319       DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), SetAvailableOrientations: %d\n", this, mNativeWindowId, convertedAngle);
1320       mAvailableAngles.push_back(convertedAngle);
1321     }
1322   }
1323   SetAvailableAnlges(mAvailableAngles);
1324 }
1325
1326 int32_t Window::GetNativeId() const
1327 {
1328   return mWindowBase->GetNativeWindowId();
1329 }
1330
1331 void Window::RequestMoveToServer()
1332 {
1333   SetUserGeometryPolicy();
1334   mWindowBase->RequestMoveToServer();
1335 }
1336
1337 void Window::RequestResizeToServer(WindowResizeDirection direction)
1338 {
1339   SetUserGeometryPolicy();
1340   mWindowBase->RequestResizeToServer(direction);
1341 }
1342
1343 void Window::EnableFloatingMode(bool enable)
1344 {
1345   mWindowBase->EnableFloatingMode(enable);
1346 }
1347
1348 bool Window::IsFloatingModeEnabled()
1349 {
1350   return mWindowBase->IsFloatingModeEnabled();
1351 }
1352
1353 void Window::IncludeInputRegion(const Rect<int>& inputRegion)
1354 {
1355   DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), IncludeInputRegion, (%d,%d), (%d x %d)\n", this, mNativeWindowId, inputRegion.x, inputRegion.y, inputRegion.width, inputRegion.height);
1356   mWindowBase->IncludeInputRegion(inputRegion);
1357 }
1358
1359 void Window::ExcludeInputRegion(const Rect<int>& inputRegion)
1360 {
1361   DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), ExcludeInputRegion, (%d,%d), (%d x %d)\n", this, mNativeWindowId, inputRegion.x, inputRegion.y, inputRegion.width, inputRegion.height);
1362   mWindowBase->ExcludeInputRegion(inputRegion);
1363 }
1364
1365 void Window::SetNeedsRotationCompletedAcknowledgement(bool needAcknowledgement)
1366 {
1367   DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), needAcknowledgement(%d) Set needs Rotation Completed Acknowledgement\n", this, mNativeWindowId, needAcknowledgement);
1368   mWindowSurface->SetNeedsRotationCompletedAcknowledgement(needAcknowledgement);
1369   mWindowRotationAcknowledgement = needAcknowledgement;
1370 }
1371
1372 void Window::SendRotationCompletedAcknowledgement()
1373 {
1374   DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), SendRotationCompletedAcknowledgement(): orientation: %d, mWindowRotationAcknowledgement: %d\n", this, mNativeWindowId, mRotationAngle, mWindowRotationAcknowledgement);
1375   if(mWindowRotationAcknowledgement)
1376   {
1377     SetRotationCompletedAcknowledgement();
1378   }
1379 }
1380
1381 bool Window::IsWindowRotating() const
1382 {
1383   return mIsWindowRotating;
1384 }
1385
1386 const Dali::KeyEvent& Window::GetLastKeyEvent() const
1387 {
1388   return mLastKeyEvent;
1389 }
1390
1391 const Dali::TouchEvent& Window::GetLastTouchEvent() const
1392 {
1393   return mLastTouchEvent;
1394 }
1395
1396 void Window::SetUserGeometryPolicy()
1397 {
1398   if(mIsEnabledUserGeometry == true)
1399   {
1400     return;
1401   }
1402
1403   mIsEnabledUserGeometry = true;
1404   AddAuxiliaryHint("wm.policy.win.user.geometry", "1");
1405   DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), window user.geometry is changed\n", this, mNativeWindowId);
1406 }
1407
1408 bool Window::PointerConstraintsLock()
1409 {
1410   return mWindowBase->PointerConstraintsLock();
1411 }
1412
1413 bool Window::PointerConstraintsUnlock()
1414 {
1415   return mWindowBase->PointerConstraintsUnlock();
1416 }
1417
1418 void Window::LockedPointerRegionSet(int32_t x, int32_t y, int32_t width, int32_t height)
1419 {
1420   mWindowBase->LockedPointerRegionSet(x, y, width, height);
1421 }
1422
1423 void Window::LockedPointerCursorPositionHintSet(int32_t x, int32_t y)
1424 {
1425   mWindowBase->LockedPointerCursorPositionHintSet(x, y);
1426 }
1427
1428 bool Window::PointerWarp(int32_t x, int32_t y)
1429 {
1430   return mWindowBase->PointerWarp(x, y);
1431 }
1432
1433 } // namespace Adaptor
1434
1435 } // namespace Internal
1436
1437 } // namespace Dali