Change window User.Geometry policy.
[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/render-tasks/render-task-list.h>
32 #include <dali/public-api/render-tasks/render-task.h>
33 #include <dali/public-api/rendering/frame-buffer.h>
34 #include <thread>
35
36 // INTERNAL HEADERS
37 #include <dali/devel-api/adaptor-framework/accessibility-bridge.h>
38 #include <dali/devel-api/atspi-interfaces/accessible.h>
39 #include <dali/integration-api/adaptor-framework/render-surface-interface.h>
40 #include <dali/internal/graphics/gles/egl-graphics.h>
41 #include <dali/internal/window-system/common/event-handler.h>
42 #include <dali/internal/window-system/common/orientation-impl.h>
43 #include <dali/internal/window-system/common/render-surface-factory.h>
44 #include <dali/internal/window-system/common/window-base.h>
45 #include <dali/internal/window-system/common/window-factory.h>
46 #include <dali/internal/window-system/common/window-render-surface.h>
47 #include <dali/internal/window-system/common/window-system.h>
48 #include <dali/internal/window-system/common/window-visibility-observer.h>
49
50 namespace Dali
51 {
52 namespace Internal
53 {
54 namespace Adaptor
55 {
56 namespace
57 {
58 #if defined(DEBUG_ENABLED)
59 Debug::Filter* gWindowLogFilter = Debug::Filter::New(Debug::NoLogging, false, "LOG_WINDOW");
60 #endif
61 } // unnamed namespace
62
63 Window* Window::New(const PositionSize& positionSize, const std::string& name, const std::string& className, Dali::WindowType type, bool isTransparent)
64 {
65   Any surface;
66   return Window::New(surface, positionSize, name, className, type, isTransparent);
67 }
68
69 Window* Window::New(Any surface, const PositionSize& positionSize, const std::string& name, const std::string& className, Dali::WindowType type, bool isTransparent)
70 {
71   Window* window         = new Window();
72   window->mIsTransparent = isTransparent;
73   window->Initialize(surface, positionSize, name, className, type);
74   return window;
75 }
76
77 Window::Window()
78 : mWindowSurface(nullptr),
79   mWindowBase(),
80   mParentWindow(NULL),
81   mPreferredAngle(static_cast<int>(WindowOrientation::NO_ORIENTATION_PREFERENCE)),
82   mRotationAngle(0),
83   mWindowWidth(0),
84   mWindowHeight(0),
85   mNativeWindowId(-1),
86   mOrientationMode(Internal::Adaptor::Window::OrientationMode::PORTRAIT),
87   mDeleteRequestSignal(),
88   mFocusChangeSignal(),
89   mResizeSignal(),
90   mVisibilityChangedSignal(),
91   mTransitionEffectEventSignal(),
92   mKeyboardRepeatSettingsChangedSignal(),
93   mAuxiliaryMessageSignal(),
94   mMovedSignal(),
95   mOrientationChangedSignal(),
96   mMouseInOutEventSignal(),
97   mMoveCompletedSignal(),
98   mResizeCompletedSignal(),
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->MoveCompletedSignal().Connect(this, &Window::OnMoveCompleted);
168   mWindowBase->ResizeCompletedSignal().Connect(this, &Window::OnResizeCompleted);
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 Dali::RenderTaskList Window::GetRenderTaskList() const
335 {
336   return mScene.GetRenderTaskList();
337 }
338
339 void Window::KeepRendering(float durationSeconds)
340 {
341   mScene.KeepRendering(durationSeconds);
342 }
343
344 std::string Window::GetNativeResourceId() const
345 {
346   return mWindowBase->GetNativeWindowResourceId();
347 }
348
349 void Window::AddAvailableOrientation(WindowOrientation orientation)
350 {
351   if(IsOrientationAvailable(orientation) == false)
352   {
353     return;
354   }
355
356   bool found          = false;
357   int  convertedAngle = ConvertToAngle(orientation);
358   DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), AddAvailableOrientation: %d\n", this, mNativeWindowId, convertedAngle);
359   for(std::size_t i = 0; i < mAvailableAngles.size(); i++)
360   {
361     if(mAvailableAngles[i] == convertedAngle)
362     {
363       found = true;
364       break;
365     }
366   }
367
368   if(!found)
369   {
370     mAvailableAngles.push_back(convertedAngle);
371     SetAvailableAnlges(mAvailableAngles);
372   }
373 }
374
375 void Window::RemoveAvailableOrientation(WindowOrientation orientation)
376 {
377   if(IsOrientationAvailable(orientation) == false)
378   {
379     return;
380   }
381
382   int convertedAngle = ConvertToAngle(orientation);
383   DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), RemoveAvailableOrientation: %d\n", this, mNativeWindowId, convertedAngle);
384   for(std::vector<int>::iterator iter = mAvailableAngles.begin();
385       iter != mAvailableAngles.end();
386       ++iter)
387   {
388     if(*iter == convertedAngle)
389     {
390       mAvailableAngles.erase(iter);
391       break;
392     }
393   }
394
395   SetAvailableAnlges(mAvailableAngles);
396 }
397
398 void Window::SetPreferredOrientation(WindowOrientation orientation)
399 {
400   if(orientation < WindowOrientation::NO_ORIENTATION_PREFERENCE || orientation > WindowOrientation::LANDSCAPE_INVERSE)
401   {
402     DALI_LOG_INFO(gWindowLogFilter, Debug::Verbose, "Window::CheckOrientation: Invalid input orientation [%d]\n", orientation);
403     return;
404   }
405   mPreferredAngle = ConvertToAngle(orientation);
406   DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), SetPreferredOrientation: %d\n", this, mNativeWindowId, mPreferredAngle);
407   mWindowBase->SetPreferredAngle(mPreferredAngle);
408 }
409
410 WindowOrientation Window::GetPreferredOrientation()
411 {
412   WindowOrientation preferredOrientation = ConvertToOrientation(mPreferredAngle);
413   return preferredOrientation;
414 }
415
416 void Window::SetPositionSizeWithOrientation(PositionSize positionSize, WindowOrientation orientation)
417 {
418   int angle = ConvertToAngle(orientation);
419   mWindowBase->SetPositionSizeWithAngle(positionSize, angle);
420 }
421
422 void Window::EmitAccessibilityHighlightSignal(bool highlight)
423 {
424   Dali::Window handle(this);
425   mAccessibilityHighlightSignal.Emit(handle, highlight);
426 }
427
428 void Window::SetAvailableAnlges(const std::vector<int>& angles)
429 {
430   if(angles.size() > 4)
431   {
432     DALI_LOG_INFO(gWindowLogFilter, Debug::Verbose, "Window::SetAvailableAnlges: Invalid vector size! [%d]\n", angles.size());
433     return;
434   }
435
436   mWindowBase->SetAvailableAnlges(angles);
437 }
438
439 int Window::ConvertToAngle(WindowOrientation orientation)
440 {
441   int convertAngle = static_cast<int>(orientation);
442   if(mOrientationMode == Internal::Adaptor::Window::OrientationMode::LANDSCAPE)
443   {
444     switch(orientation)
445     {
446       case WindowOrientation::LANDSCAPE:
447       {
448         convertAngle = 0;
449         break;
450       }
451       case WindowOrientation::PORTRAIT:
452       {
453         convertAngle = 90;
454         break;
455       }
456       case WindowOrientation::LANDSCAPE_INVERSE:
457       {
458         convertAngle = 180;
459         break;
460       }
461       case WindowOrientation::PORTRAIT_INVERSE:
462       {
463         convertAngle = 270;
464         break;
465       }
466       case WindowOrientation::NO_ORIENTATION_PREFERENCE:
467       {
468         convertAngle = -1;
469         break;
470       }
471     }
472   }
473   return convertAngle;
474 }
475
476 WindowOrientation Window::ConvertToOrientation(int angle) const
477 {
478   WindowOrientation orientation = static_cast<WindowOrientation>(angle);
479   if(mOrientationMode == Internal::Adaptor::Window::OrientationMode::LANDSCAPE)
480   {
481     switch(angle)
482     {
483       case 0:
484       {
485         orientation = WindowOrientation::LANDSCAPE;
486         break;
487       }
488       case 90:
489       {
490         orientation = WindowOrientation::PORTRAIT;
491         break;
492       }
493       case 180:
494       {
495         orientation = WindowOrientation::LANDSCAPE_INVERSE;
496         break;
497       }
498       case 270:
499       {
500         orientation = WindowOrientation::PORTRAIT_INVERSE;
501         break;
502       }
503       case -1:
504       {
505         orientation = WindowOrientation::NO_ORIENTATION_PREFERENCE;
506         break;
507       }
508     }
509   }
510   return orientation;
511 }
512
513 bool Window::IsOrientationAvailable(WindowOrientation orientation) const
514 {
515   if(orientation <= WindowOrientation::NO_ORIENTATION_PREFERENCE || orientation > WindowOrientation::LANDSCAPE_INVERSE)
516   {
517     DALI_LOG_INFO(gWindowLogFilter, Debug::Verbose, "Window::IsOrientationAvailable: Invalid input orientation [%d]\n", orientation);
518     return false;
519   }
520   return true;
521 }
522
523 Dali::Any Window::GetNativeHandle() const
524 {
525   return mWindowSurface->GetNativeWindow();
526 }
527
528 void Window::SetAcceptFocus(bool accept)
529 {
530   mIsFocusAcceptable = accept;
531
532   mWindowBase->SetAcceptFocus(accept);
533 }
534
535 bool Window::IsFocusAcceptable() const
536 {
537   return mIsFocusAcceptable;
538 }
539
540 void Window::Show()
541 {
542   mVisible = true;
543
544   mWindowBase->Show();
545
546   if(!mIconified)
547   {
548     Dali::Window handle(this);
549     mVisibilityChangedSignal.Emit(handle, true);
550     Dali::Accessibility::Bridge::GetCurrentBridge()->WindowShown(handle);
551
552     WindowVisibilityObserver* observer(mAdaptor);
553     observer->OnWindowShown();
554   }
555
556   mSurface->SetFullSwapNextFrame();
557
558   DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), Show(): iconified = %d, visible = %d\n", this, mNativeWindowId, mIconified, mVisible);
559 }
560
561 void Window::Hide()
562 {
563   mVisible = false;
564
565   mWindowBase->Hide();
566
567   if(!mIconified)
568   {
569     Dali::Window handle(this);
570     mVisibilityChangedSignal.Emit(handle, false);
571     Dali::Accessibility::Bridge::GetCurrentBridge()->WindowHidden(handle);
572
573     WindowVisibilityObserver* observer(mAdaptor);
574     observer->OnWindowHidden();
575   }
576
577   DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), Hide(): iconified = %d, visible = %d\n", this, mNativeWindowId, mIconified, mVisible);
578 }
579
580 bool Window::IsVisible() const
581 {
582   DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), IsVisible(): iconified = %d, visible = %d\n", this, mNativeWindowId, mIconified, mVisible);
583   return mVisible && !mIconified;
584 }
585
586 unsigned int Window::GetSupportedAuxiliaryHintCount() const
587 {
588   return mWindowBase->GetSupportedAuxiliaryHintCount();
589 }
590
591 std::string Window::GetSupportedAuxiliaryHint(unsigned int index) const
592 {
593   return mWindowBase->GetSupportedAuxiliaryHint(index);
594 }
595
596 unsigned int Window::AddAuxiliaryHint(const std::string& hint, const std::string& value)
597 {
598   return mWindowBase->AddAuxiliaryHint(hint, value);
599 }
600
601 bool Window::RemoveAuxiliaryHint(unsigned int id)
602 {
603   return mWindowBase->RemoveAuxiliaryHint(id);
604 }
605
606 bool Window::SetAuxiliaryHintValue(unsigned int id, const std::string& value)
607 {
608   return mWindowBase->SetAuxiliaryHintValue(id, value);
609 }
610
611 std::string Window::GetAuxiliaryHintValue(unsigned int id) const
612 {
613   return mWindowBase->GetAuxiliaryHintValue(id);
614 }
615
616 unsigned int Window::GetAuxiliaryHintId(const std::string& hint) const
617 {
618   return mWindowBase->GetAuxiliaryHintId(hint);
619 }
620
621 void Window::SetInputRegion(const Rect<int>& inputRegion)
622 {
623   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);
624   mWindowBase->SetInputRegion(inputRegion);
625 }
626
627 void Window::SetType(WindowType type)
628 {
629   mWindowBase->SetType(type);
630 }
631
632 WindowType Window::GetType() const
633 {
634   return mWindowBase->GetType();
635 }
636
637 WindowOperationResult Window::SetNotificationLevel(WindowNotificationLevel level)
638 {
639   WindowType type = mWindowBase->GetType();
640   if(type != WindowType::NOTIFICATION)
641   {
642     DALI_LOG_INFO(gWindowLogFilter, Debug::Verbose, "Window::SetNotificationLevel: Not supported window type [%d]\n", type);
643     return WindowOperationResult::INVALID_OPERATION;
644   }
645
646   return mWindowBase->SetNotificationLevel(level);
647 }
648
649 WindowNotificationLevel Window::GetNotificationLevel() const
650 {
651   WindowType type = mWindowBase->GetType();
652   if(type != WindowType::NOTIFICATION)
653   {
654     DALI_LOG_INFO(gWindowLogFilter, Debug::Verbose, "Window::GetNotificationLevel: Not supported window type [%d]\n", type);
655     return WindowNotificationLevel::NONE;
656   }
657
658   return mWindowBase->GetNotificationLevel();
659 }
660
661 void Window::SetOpaqueState(bool opaque)
662 {
663   mOpaqueState = opaque;
664
665   mWindowBase->SetOpaqueState(opaque);
666
667   DALI_LOG_INFO(gWindowLogFilter, Debug::Verbose, "Window::SetOpaqueState: opaque = %d\n", opaque);
668 }
669
670 bool Window::IsOpaqueState() const
671 {
672   return mOpaqueState;
673 }
674
675 WindowOperationResult Window::SetScreenOffMode(WindowScreenOffMode screenOffMode)
676 {
677   return mWindowBase->SetScreenOffMode(screenOffMode);
678 }
679
680 WindowScreenOffMode Window::GetScreenOffMode() const
681 {
682   return mWindowBase->GetScreenOffMode();
683 }
684
685 WindowOperationResult Window::SetBrightness(int brightness)
686 {
687   if(brightness < 0 || brightness > 100)
688   {
689     DALI_LOG_INFO(gWindowLogFilter, Debug::Verbose, "Window::SetBrightness: Invalid brightness value [%d]\n", brightness);
690     return WindowOperationResult::INVALID_OPERATION;
691   }
692
693   return mWindowBase->SetBrightness(brightness);
694 }
695
696 int Window::GetBrightness() const
697 {
698   return mWindowBase->GetBrightness();
699 }
700
701 void Window::SetSize(Dali::Window::WindowSize size)
702 {
703   PositionSize oldRect = GetPositionSize();
704
705   PositionSize newRect;
706   newRect.width  = size.GetWidth();
707   newRect.height = size.GetHeight();
708
709   SetUserGeometryPolicy();
710
711   // When surface size is updated, inform adaptor of resizing and emit ResizeSignal
712   if((oldRect.width != newRect.width) || (oldRect.height != newRect.height))
713   {
714     mWindowSurface->MoveResize(PositionSize(oldRect.x, oldRect.y, newRect.width, newRect.height));
715
716     Uint16Pair newSize(newRect.width, newRect.height);
717
718     mWindowWidth  = newRect.width;
719     mWindowHeight = newRect.height;
720
721     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);
722
723     SurfaceResized(static_cast<float>(mWindowWidth), static_cast<float>(mWindowHeight));
724
725     mAdaptor->SurfaceResizePrepare(mSurface.get(), newSize);
726
727     Dali::Window handle(this);
728     mResizeSignal.Emit(handle, newSize);
729
730     mAdaptor->SurfaceResizeComplete(mSurface.get(), newSize);
731   }
732
733   mSurface->SetFullSwapNextFrame();
734
735   Dali::Accessibility::Accessible::Get(mScene.GetRootLayer())->EmitBoundsChanged(Dali::Rect<>(oldRect.x, oldRect.y, size.GetWidth(), size.GetHeight()));
736 }
737
738 Dali::Window::WindowSize Window::GetSize() const
739 {
740   return Dali::Window::WindowSize(mWindowWidth, mWindowHeight);
741 }
742
743 void Window::SetPosition(Dali::Window::WindowPosition position)
744 {
745   PositionSize oldRect = mSurface->GetPositionSize();
746   int32_t      newX    = position.GetX();
747   int32_t      newY    = position.GetY();
748
749   SetUserGeometryPolicy();
750
751   mWindowSurface->Move(PositionSize(newX, newY, oldRect.width, oldRect.height));
752
753   if((oldRect.x != newX) || (oldRect.y != newY))
754   {
755     Dali::Window                 handle(this);
756     Dali::Window::WindowPosition newPosition(newX, newY);
757
758     DALI_LOG_RELEASE_INFO("send moved signal with new position: %d, %d\n", newPosition.GetX(), newPosition.GetY());
759     mMovedSignal.Emit(handle, newPosition);
760   }
761
762   mSurface->SetFullSwapNextFrame();
763
764   Dali::Accessibility::Accessible::Get(mScene.GetRootLayer())->EmitBoundsChanged(Dali::Rect<>(position.GetX(), position.GetY(), oldRect.width, oldRect.height));
765 }
766
767 Dali::Window::WindowPosition Window::GetPosition() const
768 {
769   PositionSize positionSize = GetPositionSize();
770   return Dali::Window::WindowPosition(positionSize.x, positionSize.y);
771 }
772
773 PositionSize Window::GetPositionSize() const
774 {
775   PositionSize positionSize = mSurface->GetPositionSize();
776   positionSize.width        = mWindowWidth;
777   positionSize.height       = mWindowHeight;
778   return positionSize;
779 }
780
781 void Window::SetPositionSize(PositionSize positionSize)
782 {
783   bool moved  = false;
784   bool resize = false;
785
786   PositionSize oldRect = GetPositionSize();
787   Dali::Window handle(this);
788
789   SetUserGeometryPolicy();
790
791   if((oldRect.x != positionSize.x) || (oldRect.y != positionSize.y))
792   {
793     moved = true;
794   }
795
796   if((oldRect.width != positionSize.width) || (oldRect.height != positionSize.height))
797   {
798     resize = true;
799   }
800
801   if(moved || resize)
802   {
803     mWindowSurface->MoveResize(positionSize);
804   }
805
806   // When window is moved, emit Moved Signal
807   if(moved)
808   {
809     DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), Moved signal emit (%d, %d)\n", this, mNativeWindowId, positionSize.x, positionSize.y);
810     Dali::Window::WindowPosition position(positionSize.x, positionSize.y);
811     mMovedSignal.Emit(handle, position);
812   }
813
814   // When surface size is updated, inform adaptor of resizing and emit ResizeSignal
815   if(resize)
816   {
817     Uint16Pair newSize(positionSize.width, positionSize.height);
818
819     mWindowWidth  = positionSize.width;
820     mWindowHeight = positionSize.height;
821
822     SurfaceResized(static_cast<float>(mWindowWidth), static_cast<float>(mWindowHeight));
823
824     mAdaptor->SurfaceResizePrepare(mSurface.get(), newSize);
825
826     DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), Resize signal emit [%d x %d]\n", this, mNativeWindowId, positionSize.width, positionSize.height);
827
828     mResizeSignal.Emit(handle, newSize);
829     mAdaptor->SurfaceResizeComplete(mSurface.get(), newSize);
830   }
831
832   mSurface->SetFullSwapNextFrame();
833
834   Dali::Accessibility::Accessible::Get(mScene.GetRootLayer())->EmitBoundsChanged(Dali::Rect<>(positionSize.x, positionSize.y, positionSize.width, positionSize.height));
835 }
836
837 void Window::SetLayout(unsigned int numCols, unsigned int numRows, unsigned int column, unsigned int row, unsigned int colSpan, unsigned int rowSpan)
838 {
839   SetUserGeometryPolicy();
840   mWindowBase->SetLayout(numCols, numRows, column, row, colSpan, rowSpan);
841 }
842
843 Dali::Layer Window::GetRootLayer() const
844 {
845   return mScene.GetRootLayer();
846 }
847
848 void Window::SetTransparency(bool transparent)
849 {
850   mWindowSurface->SetTransparency(transparent);
851 }
852
853 bool Window::GrabKey(Dali::KEY key, KeyGrab::KeyGrabMode grabMode)
854 {
855   return mWindowBase->GrabKey(key, grabMode);
856 }
857
858 bool Window::UngrabKey(Dali::KEY key)
859 {
860   return mWindowBase->UngrabKey(key);
861 }
862
863 bool Window::GrabKeyList(const Dali::Vector<Dali::KEY>& key, const Dali::Vector<KeyGrab::KeyGrabMode>& grabMode, Dali::Vector<bool>& result)
864 {
865   return mWindowBase->GrabKeyList(key, grabMode, result);
866 }
867
868 bool Window::UngrabKeyList(const Dali::Vector<Dali::KEY>& key, Dali::Vector<bool>& result)
869 {
870   return mWindowBase->UngrabKeyList(key, result);
871 }
872
873 void Window::OnIconifyChanged(bool iconified)
874 {
875   const bool   isActuallyChanged = (iconified != mIconified);
876   auto         bridge            = Dali::Accessibility::Bridge::GetCurrentBridge();
877   Dali::Window handle(this);
878
879   if(iconified)
880   {
881     mIconified = true;
882
883     if(mVisible)
884     {
885       mVisibilityChangedSignal.Emit(handle, false);
886       bridge->WindowHidden(handle);
887
888       WindowVisibilityObserver* observer(mAdaptor);
889       observer->OnWindowHidden();
890     }
891
892     if(isActuallyChanged)
893     {
894       bridge->WindowMinimized(handle);
895     }
896
897     DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), Iconified: visible = %d\n", this, mNativeWindowId, mVisible);
898   }
899   else
900   {
901     mIconified = false;
902
903     if(mVisible)
904     {
905       mVisibilityChangedSignal.Emit(handle, true);
906       bridge->WindowShown(handle);
907
908       WindowVisibilityObserver* observer(mAdaptor);
909       observer->OnWindowShown();
910     }
911
912     if(isActuallyChanged)
913     {
914       bridge->WindowRestored(handle, Dali::Accessibility::WindowRestoreType::RESTORE_FROM_ICONIFY);
915     }
916
917     DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), Deiconified: visible = %d\n", this, mNativeWindowId, mVisible);
918   }
919
920   mSurface->SetFullSwapNextFrame();
921 }
922
923 void Window::OnMaximizeChanged(bool maximized)
924 {
925   const bool isActuallyChanged = (maximized != mMaximized);
926
927   if(isActuallyChanged)
928   {
929     auto         bridge = Dali::Accessibility::Bridge::GetCurrentBridge();
930     Dali::Window handle(this);
931
932     if(maximized)
933     {
934       mMaximized = true;
935       bridge->WindowMaximized(handle);
936     }
937     else
938     {
939       mMaximized = false;
940       bridge->WindowRestored(handle, Dali::Accessibility::WindowRestoreType::RESTORE_FROM_MAXIMIZE);
941     }
942   }
943 }
944
945 void Window::OnFocusChanged(bool focusIn)
946 {
947   Dali::Window handle(this);
948   mFocusChangeSignal.Emit(handle, focusIn);
949
950   mSurface->SetFullSwapNextFrame();
951   auto bridge = Dali::Accessibility::Bridge::GetCurrentBridge();
952
953   if(focusIn)
954   {
955     bridge->WindowFocused(handle);
956   }
957   else
958   {
959     bridge->WindowUnfocused(handle);
960   }
961
962   mFocused = focusIn;
963 }
964
965 void Window::OnOutputTransformed()
966 {
967   PositionSize positionSize = GetPositionSize();
968
969   SurfaceRotated(static_cast<float>(positionSize.width), static_cast<float>(positionSize.height), mRotationAngle, mWindowBase->GetScreenRotationAngle());
970
971   mAdaptor->SurfaceResizePrepare(mSurface.get(), Adaptor::SurfaceSize(positionSize.width, positionSize.height));
972   mAdaptor->SurfaceResizeComplete(mSurface.get(), Adaptor::SurfaceSize(positionSize.width, positionSize.height));
973 }
974
975 void Window::OnDeleteRequest()
976 {
977   mDeleteRequestSignal.Emit();
978 }
979
980 void Window::OnTransitionEffectEvent(WindowEffectState state, WindowEffectType type)
981 {
982   Dali::Window handle(this);
983   mTransitionEffectEventSignal.Emit(handle, state, type);
984 }
985
986 void Window::OnKeyboardRepeatSettingsChanged()
987 {
988   Dali::Window handle(this);
989   mKeyboardRepeatSettingsChangedSignal.Emit();
990 }
991
992 void Window::OnWindowRedrawRequest()
993 {
994   mAdaptor->RenderOnce();
995 }
996
997 void Window::OnUpdatePositionSize(Dali::PositionSize& positionSize)
998 {
999   bool moved  = false;
1000   bool resize = false;
1001
1002   Dali::Window handle(this);
1003
1004   PositionSize oldRect = GetPositionSize();
1005   PositionSize newRect = positionSize;
1006
1007   if((oldRect.x != newRect.x) || (oldRect.y != newRect.y))
1008   {
1009     moved = true;
1010   }
1011
1012   if((oldRect.width != newRect.width) || (oldRect.height != newRect.height))
1013   {
1014     resize = true;
1015   }
1016
1017   if(moved || resize)
1018   {
1019     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);
1020     mWindowSurface->UpdatePositionSize(positionSize);
1021   }
1022
1023   if((oldRect.x != newRect.x) || (oldRect.y != newRect.y))
1024   {
1025     DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), Moved signal emit (%d, %d)\n", this, mNativeWindowId, newRect.x, newRect.y);
1026     Dali::Window::WindowPosition position(newRect.x, newRect.y);
1027     mMovedSignal.Emit(handle, position);
1028   }
1029
1030   // When surface size is updated, inform adaptor of resizing and emit ResizeSignal
1031   if((oldRect.width != newRect.width) || (oldRect.height != newRect.height))
1032   {
1033     Uint16Pair newSize(newRect.width, newRect.height);
1034
1035     mWindowWidth  = newRect.width;
1036     mWindowHeight = newRect.height;
1037
1038     SurfaceResized(static_cast<float>(mWindowWidth), static_cast<float>(mWindowHeight));
1039
1040     mAdaptor->SurfaceResizePrepare(mSurface.get(), newSize);
1041
1042     DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), Resized signal emit [%d x %d]\n", this, mNativeWindowId, newRect.width, newRect.height);
1043     mResizeSignal.Emit(handle, newSize);
1044     mAdaptor->SurfaceResizeComplete(mSurface.get(), newSize);
1045   }
1046
1047   mSurface->SetFullSwapNextFrame();
1048
1049   Dali::Accessibility::Accessible::Get(mScene.GetRootLayer())->EmitBoundsChanged(Dali::Rect<>(positionSize.x, positionSize.y, positionSize.width, positionSize.height));
1050 }
1051
1052 void Window::OnTouchPoint(Dali::Integration::Point& point, int timeStamp)
1053 {
1054   mLastTouchEvent = Dali::Integration::NewTouchEvent(timeStamp, point);
1055   FeedTouchPoint(point, timeStamp);
1056 }
1057
1058 void Window::OnWheelEvent(Dali::Integration::WheelEvent& wheelEvent)
1059 {
1060   FeedWheelEvent(wheelEvent);
1061 }
1062
1063 void Window::OnKeyEvent(Dali::Integration::KeyEvent& keyEvent)
1064 {
1065   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);
1066   FeedKeyEvent(keyEvent);
1067 }
1068
1069 void Window::OnMouseInOutEvent(const Dali::DevelWindow::MouseInOutEvent& mouseInOutEvent)
1070 {
1071   Dali::Window handle(this);
1072
1073   mMouseInOutEventSignal.Emit(handle, mouseInOutEvent);
1074 }
1075
1076 void Window::OnRotation(const RotationEvent& rotation)
1077 {
1078   PositionSize newPositionSize(rotation.x, rotation.y, rotation.width, rotation.height);
1079
1080   mRotationAngle = rotation.angle;
1081   mWindowWidth   = rotation.width;
1082   mWindowHeight  = rotation.height;
1083
1084   mIsWindowRotating = true;
1085   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);
1086
1087   // Notify that the orientation is changed
1088   mOrientation->OnOrientationChange(rotation);
1089
1090   mWindowSurface->RequestRotation(mRotationAngle, newPositionSize);
1091
1092   SurfaceRotated(static_cast<float>(mWindowWidth), static_cast<float>(mWindowHeight), mRotationAngle, mWindowBase->GetScreenRotationAngle());
1093
1094   mAdaptor->SurfaceResizePrepare(mSurface.get(), Adaptor::SurfaceSize(mWindowWidth, mWindowHeight));
1095
1096   Dali::Window handle(this);
1097   mResizeSignal.Emit(handle, Dali::Window::WindowSize(mWindowWidth, mWindowHeight));
1098   mOrientationChangedSignal.Emit(handle, GetCurrentOrientation());
1099
1100   mAdaptor->SurfaceResizeComplete(mSurface.get(), Adaptor::SurfaceSize(mWindowWidth, mWindowHeight));
1101 }
1102
1103 void Window::OnRotationFinished()
1104 {
1105   mIsWindowRotating = false;
1106   DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), window rotation is finised\n", this, mNativeWindowId);
1107 }
1108
1109 void Window::OnPause()
1110 {
1111   if(mEventHandler)
1112   {
1113     mEventHandler->Pause();
1114   }
1115 }
1116
1117 void Window::OnResume()
1118 {
1119   if(mEventHandler)
1120   {
1121     mEventHandler->Resume();
1122   }
1123
1124   mSurface->SetFullSwapNextFrame();
1125 }
1126
1127 void Window::OnAuxiliaryMessage(const std::string& key, const std::string& value, const Property::Array& options)
1128 {
1129   mAuxiliaryMessageSignal.Emit(key, value, options);
1130 }
1131
1132 void Window::OnAccessibilityEnabled()
1133 {
1134   auto bridge     = Accessibility::Bridge::GetCurrentBridge();
1135   auto rootLayer  = mScene.GetRootLayer();
1136   auto accessible = Accessibility::Accessible::Get(rootLayer);
1137   bridge->AddTopLevelWindow(accessible);
1138
1139   if(!mVisible || mIconified)
1140   {
1141     return;
1142   }
1143
1144   Dali::Window handle(this);
1145   bridge->WindowShown(handle);
1146
1147   if(mFocused)
1148   {
1149     bridge->WindowFocused(handle);
1150   }
1151 }
1152
1153 void Window::OnAccessibilityDisabled()
1154 {
1155   auto bridge     = Accessibility::Bridge::GetCurrentBridge();
1156   auto rootLayer  = mScene.GetRootLayer();
1157   auto accessible = Accessibility::Accessible::Get(rootLayer);
1158   bridge->RemoveTopLevelWindow(accessible);
1159 }
1160
1161 void Window::OnMoveCompleted(Dali::Window::WindowPosition& position)
1162 {
1163   Dali::Window handle(this);
1164   mMoveCompletedSignal.Emit(handle, position);
1165 }
1166
1167 void Window::OnResizeCompleted(Dali::Window::WindowSize& size)
1168 {
1169   Dali::Window handle(this);
1170   mResizeCompletedSignal.Emit(handle, size);
1171 }
1172
1173 Vector2 Window::RecalculatePosition(const Vector2& position)
1174 {
1175   Vector2 convertedPosition;
1176
1177   switch(mRotationAngle)
1178   {
1179     case 90:
1180     {
1181       convertedPosition.x = static_cast<float>(mWindowWidth) - position.y;
1182       convertedPosition.y = position.x;
1183       break;
1184     }
1185     case 180:
1186     {
1187       convertedPosition.x = static_cast<float>(mWindowWidth) - position.x;
1188       convertedPosition.y = static_cast<float>(mWindowHeight) - position.y;
1189       break;
1190     }
1191     case 270:
1192     {
1193       convertedPosition.x = position.y;
1194       convertedPosition.y = static_cast<float>(mWindowHeight) - position.x;
1195       break;
1196     }
1197     default:
1198     {
1199       convertedPosition = position;
1200       break;
1201     }
1202   }
1203   return convertedPosition;
1204 }
1205
1206 Dali::Window Window::Get(Dali::Actor actor)
1207 {
1208   Internal::Adaptor::Window* windowImpl = nullptr;
1209
1210   if(Internal::Adaptor::Adaptor::IsAvailable())
1211   {
1212     Dali::Internal::Adaptor::Adaptor& adaptor = Internal::Adaptor::Adaptor::GetImplementation(Internal::Adaptor::Adaptor::Get());
1213     windowImpl                                = dynamic_cast<Internal::Adaptor::Window*>(adaptor.GetWindow(actor));
1214     if(windowImpl)
1215     {
1216       return Dali::Window(windowImpl);
1217     }
1218   }
1219
1220   return Dali::Window();
1221 }
1222
1223 void Window::SetParent(Dali::Window& parent)
1224 {
1225   if(DALI_UNLIKELY(parent))
1226   {
1227     mParentWindow     = parent;
1228     Dali::Window self = Dali::Window(this);
1229     // check circular parent window setting
1230     if(Dali::DevelWindow::GetParent(parent) == self)
1231     {
1232       Dali::DevelWindow::Unparent(parent);
1233     }
1234     mWindowBase->SetParent(GetImplementation(mParentWindow).mWindowBase, false);
1235   }
1236 }
1237
1238 void Window::SetParent(Dali::Window& parent, bool belowParent)
1239 {
1240   if(DALI_UNLIKELY(parent))
1241   {
1242     mParentWindow     = parent;
1243     Dali::Window self = Dali::Window(this);
1244     // check circular parent window setting
1245     if(Dali::DevelWindow::GetParent(parent) == self)
1246     {
1247       Dali::DevelWindow::Unparent(parent);
1248     }
1249     mWindowBase->SetParent(GetImplementation(mParentWindow).mWindowBase, belowParent);
1250   }
1251 }
1252
1253 void Window::Unparent()
1254 {
1255   mWindowBase->SetParent(nullptr, false);
1256   mParentWindow.Reset();
1257 }
1258
1259 Dali::Window Window::GetParent()
1260 {
1261   return mParentWindow;
1262 }
1263
1264 WindowOrientation Window::GetCurrentOrientation() const
1265 {
1266   return ConvertToOrientation(mRotationAngle);
1267 }
1268
1269 int Window::GetPhysicalOrientation() const
1270 {
1271   return (mRotationAngle + mWindowBase->GetScreenRotationAngle()) % 360;
1272 }
1273
1274 void Window::SetAvailableOrientations(const Dali::Vector<WindowOrientation>& orientations)
1275 {
1276   Dali::Vector<float>::SizeType count = orientations.Count();
1277   for(Dali::Vector<float>::SizeType index = 0; index < count; ++index)
1278   {
1279     if(IsOrientationAvailable(orientations[index]) == false)
1280     {
1281       DALI_LOG_ERROR("Window::SetAvailableOrientations, invalid orientation: %d\n", orientations[index]);
1282       continue;
1283     }
1284
1285     bool found          = false;
1286     int  convertedAngle = ConvertToAngle(orientations[index]);
1287
1288     for(std::size_t i = 0; i < mAvailableAngles.size(); i++)
1289     {
1290       if(mAvailableAngles[i] == convertedAngle)
1291       {
1292         found = true;
1293         break;
1294       }
1295     }
1296
1297     if(!found)
1298     {
1299       DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), SetAvailableOrientations: %d\n", this, mNativeWindowId, convertedAngle);
1300       mAvailableAngles.push_back(convertedAngle);
1301     }
1302   }
1303   SetAvailableAnlges(mAvailableAngles);
1304 }
1305
1306 int32_t Window::GetNativeId() const
1307 {
1308   return mWindowBase->GetNativeWindowId();
1309 }
1310
1311 void Window::RequestMoveToServer()
1312 {
1313   SetUserGeometryPolicy();
1314   mWindowBase->RequestMoveToServer();
1315 }
1316
1317 void Window::RequestResizeToServer(WindowResizeDirection direction)
1318 {
1319   SetUserGeometryPolicy();
1320   mWindowBase->RequestResizeToServer(direction);
1321 }
1322
1323 void Window::EnableFloatingMode(bool enable)
1324 {
1325   mWindowBase->EnableFloatingMode(enable);
1326 }
1327
1328 void Window::IncludeInputRegion(const Rect<int>& inputRegion)
1329 {
1330   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);
1331   mWindowBase->IncludeInputRegion(inputRegion);
1332 }
1333
1334 void Window::ExcludeInputRegion(const Rect<int>& inputRegion)
1335 {
1336   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);
1337   mWindowBase->ExcludeInputRegion(inputRegion);
1338 }
1339
1340 void Window::SetNeedsRotationCompletedAcknowledgement(bool needAcknowledgement)
1341 {
1342   DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), needAcknowledgement(%d) Set needs Rotation Completed Acknowledgement\n", this, mNativeWindowId, needAcknowledgement);
1343   mWindowSurface->SetNeedsRotationCompletedAcknowledgement(needAcknowledgement);
1344   mWindowRotationAcknowledgement = needAcknowledgement;
1345 }
1346
1347 void Window::SendRotationCompletedAcknowledgement()
1348 {
1349   DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), SendRotationCompletedAcknowledgement(): orientation: %d, mWindowRotationAcknowledgement: %d\n", this, mNativeWindowId, mRotationAngle, mWindowRotationAcknowledgement);
1350   if(mWindowRotationAcknowledgement)
1351   {
1352     SetRotationCompletedAcknowledgement();
1353   }
1354 }
1355
1356 bool Window::IsWindowRotating() const
1357 {
1358   return mIsWindowRotating;
1359 }
1360
1361 const Dali::KeyEvent& Window::GetLastKeyEvent() const
1362 {
1363   return mLastKeyEvent;
1364 }
1365
1366 const Dali::TouchEvent& Window::GetLastTouchEvent() const
1367 {
1368   return mLastTouchEvent;
1369 }
1370
1371 void Window::SetUserGeometryPolicy()
1372 {
1373   if(mIsEnabledUserGeometry == true)
1374   {
1375     return;
1376   }
1377
1378   mIsEnabledUserGeometry = true;
1379   AddAuxiliaryHint("wm.policy.win.user.geometry", "1");
1380   DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), window user.geometry is changed\n", this, mNativeWindowId);
1381 }
1382
1383 } // namespace Adaptor
1384
1385 } // namespace Internal
1386
1387 } // namespace Dali