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