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