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