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