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