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