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