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