Add Window::SetLayout method
[platform/core/uifw/dali-adaptor.git] / dali / internal / window-system / x11 / window-base-x.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/x11/window-base-x.h>
20
21 // INTERNAL HEADERS
22 #include <dali/internal/window-system/common/window-impl.h>
23 #include <dali/internal/window-system/common/window-render-surface.h>
24 #include <dali/internal/window-system/common/window-system.h>
25 #include <dali/internal/window-system/x11/window-system-x.h>
26
27 // EXTERNAL_HEADERS
28 #include <dali/integration-api/debug.h>
29 #include <dali/public-api/events/mouse-button.h>
30 #include <dali/public-api/object/any.h>
31
32 using Dali::Internal::Adaptor::WindowSystem::WindowSystemX;
33
34 namespace Dali
35 {
36 namespace Internal
37 {
38 namespace Adaptor
39 {
40 namespace
41 {
42 const char*                  DEFAULT_DEVICE_NAME     = "";
43 const Device::Class::Type    DEFAULT_DEVICE_CLASS    = Device::Class::NONE;
44 const Device::Subclass::Type DEFAULT_DEVICE_SUBCLASS = Device::Subclass::NONE;
45
46 const unsigned int PRIMARY_TOUCH_BUTTON_ID(1);
47
48 #if defined(DEBUG_ENABLED)
49 Debug::Filter* gWindowBaseLogFilter = Debug::Filter::New(Debug::NoLogging, false, "LOG_WINDOW_BASE");
50 #endif
51
52 /////////////////////////////////////////////////////////////////////////////////////////////////
53 // Window Callbacks
54 /////////////////////////////////////////////////////////////////////////////////////////////////
55
56 static bool EventWindowConfigureNotify(void* data, WindowSystemBase::Event type, WindowSystemBase::EventBase* event)
57 {
58   WindowBaseX* windowBase = static_cast<WindowBaseX*>(data);
59   if(windowBase)
60   {
61     windowBase->OnConfigure(event);
62   }
63
64   return false;
65 }
66
67 static bool EventWindowPropertyChanged(void* data, WindowSystemBase::Event type, WindowSystemBase::EventBase* event)
68 {
69   WindowBaseX* windowBase = static_cast<WindowBaseX*>(data);
70   if(windowBase)
71   {
72     return windowBase->OnWindowPropertyChanged(data, type, event);
73   }
74
75   return false;
76 }
77
78 /**
79  * Called when the window receives a delete request
80  */
81 static bool EventWindowDeleteRequest(void* data, WindowSystemBase::Event type, WindowSystemBase::EventBase* event)
82 {
83   WindowBaseX* windowBase = static_cast<WindowBaseX*>(data);
84   if(windowBase)
85   {
86     windowBase->OnDeleteRequest();
87   }
88   return true;
89 }
90
91 /**
92  * Called when the window gains focus.
93  */
94 static bool EventWindowFocusIn(void* data, WindowSystemBase::Event type, WindowSystemBase::EventBase* event)
95 {
96   WindowBaseX* windowBase = static_cast<WindowBaseX*>(data);
97   if(windowBase)
98   {
99     windowBase->OnFocusIn(data, type, event);
100   }
101   return false;
102 }
103
104 /**
105  * Called when the window loses focus.
106  */
107 static bool EventWindowFocusOut(void* data, WindowSystemBase::Event type, WindowSystemBase::EventBase* event)
108 {
109   WindowBaseX* windowBase = static_cast<WindowBaseX*>(data);
110   if(windowBase)
111   {
112     windowBase->OnFocusOut(data, type, event);
113   }
114   return false;
115 }
116
117 /**
118  * Called when the window is damaged.
119  */
120 static bool EventWindowDamaged(void* data, WindowSystemBase::Event type, WindowSystemBase::EventBase* event)
121 {
122   WindowBaseX* windowBase = static_cast<WindowBaseX*>(data);
123   if(windowBase)
124   {
125     windowBase->OnWindowDamaged(data, type, event);
126   }
127
128   return false;
129 }
130
131 /////////////////////////////////////////////////////////////////////////////////////////////////
132 // Selection Callbacks
133 /////////////////////////////////////////////////////////////////////////////////////////////////
134
135 /**
136  * Called when the source window notifies us the content in clipboard is selected.
137  */
138 static bool EventSelectionClear(void* data, WindowSystemBase::Event type, WindowSystemBase::EventBase* event)
139 {
140   WindowBaseX* windowBase = static_cast<WindowBaseX*>(data);
141   if(windowBase)
142   {
143     windowBase->OnSelectionClear(data, type, event);
144   }
145   return false;
146 }
147
148 /**
149  * Called when the source window sends us about the selected content.
150  * For example, when dragged items are dragged INTO our window or when items are selected in the clipboard.
151  */
152 static bool EventSelectionNotify(void* data, WindowSystemBase::Event type, WindowSystemBase::EventBase* event)
153 {
154   WindowBaseX* windowBase = static_cast<WindowBaseX*>(data);
155   if(windowBase)
156   {
157     windowBase->OnSelectionNotify(data, type, event);
158   }
159   return false;
160 }
161
162 /////////////////////////////////////////////////////////////////////////////////////////////////
163 // Touch Callbacks
164 /////////////////////////////////////////////////////////////////////////////////////////////////
165
166 /**
167  * Called when a touch down is received.
168  */
169 static bool EventMouseButtonDown(void* data, WindowSystemBase::Event type, WindowSystemBase::EventBase* event)
170 {
171   WindowBaseX* windowBase = static_cast<WindowBaseX*>(data);
172   if(windowBase)
173   {
174     windowBase->OnMouseButtonDown(data, type, event);
175   }
176   return false;
177 }
178
179 /**
180  * Called when a touch up is received.
181  */
182 static bool EventMouseButtonUp(void* data, WindowSystemBase::Event type, WindowSystemBase::EventBase* event)
183 {
184   WindowBaseX* windowBase = static_cast<WindowBaseX*>(data);
185   if(windowBase)
186   {
187     windowBase->OnMouseButtonUp(data, type, event);
188   }
189   return false;
190 }
191
192 /**
193  * Called when a touch motion is received.
194  */
195 static bool EventMouseButtonMove(void* data, WindowSystemBase::Event type, WindowSystemBase::EventBase* event)
196 {
197   WindowBaseX* windowBase = static_cast<WindowBaseX*>(data);
198   if(windowBase)
199   {
200     windowBase->OnMouseButtonMove(data, type, event);
201   }
202   return false;
203 }
204
205 /////////////////////////////////////////////////////////////////////////////////////////////////
206 // Wheel Callbacks
207 /////////////////////////////////////////////////////////////////////////////////////////////////
208
209 /**
210  * Called when a mouse wheel is received.
211  */
212 static bool EventMouseWheel(void* data, WindowSystemBase::Event type, WindowSystemBase::EventBase* event)
213 {
214   WindowBaseX* windowBase = static_cast<WindowBaseX*>(data);
215   if(windowBase)
216   {
217     windowBase->OnMouseWheel(data, type, event);
218   }
219   return false;
220 }
221
222 /////////////////////////////////////////////////////////////////////////////////////////////////
223 // Key Callbacks
224 /////////////////////////////////////////////////////////////////////////////////////////////////
225
226 /**
227  * Called when a key down is received.
228  */
229 static bool EventKeyDown(void* data, WindowSystemBase::Event type, WindowSystemBase::EventBase* event)
230 {
231   WindowBaseX* windowBase = static_cast<WindowBaseX*>(data);
232   if(windowBase)
233   {
234     windowBase->OnKeyDown(data, type, event);
235   }
236   return false;
237 }
238
239 /**
240  * Called when a key up is received.
241  */
242 static bool EventKeyUp(void* data, WindowSystemBase::Event type, WindowSystemBase::EventBase* event)
243 {
244   WindowBaseX* windowBase = static_cast<WindowBaseX*>(data);
245   if(windowBase)
246   {
247     windowBase->OnKeyUp(data, type, event);
248   }
249   return false;
250 }
251
252 } // unnamed namespace
253
254 WindowBaseX::WindowBaseX(Dali::PositionSize positionSize, Any surface, bool isTransparent)
255 : mEventHandlers(),
256   mWindow(0),
257   mOwnSurface(false),
258   mIsTransparent(false), // Should only be set to true once we actually create a transparent window regardless of what isTransparent is.
259   mRotationAppSet(false),
260   mWindowRotationAngle(0)
261 {
262   Initialize(positionSize, surface, isTransparent);
263 }
264
265 WindowBaseX::~WindowBaseX()
266 {
267   DeleteEvents();
268   mEventHandlers.Clear();
269
270   if(mOwnSurface)
271   {
272     XDestroyWindow(WindowSystem::GetImplementation().GetXDisplay(), mWindow);
273   }
274 }
275
276 void WindowBaseX::Initialize(PositionSize positionSize, Any surface, bool isTransparent)
277 {
278   // see if there is a surface in Any surface
279   unsigned int surfaceId = GetSurfaceId(surface);
280
281   // if the surface is empty, create a new one.
282   if(surfaceId == 0)
283   {
284     // we own the surface about to created
285     mOwnSurface = true;
286     CreateWindow(positionSize, isTransparent);
287   }
288   else
289   {
290     // XLib should already be initialized so no point in calling XInitThreads
291     mWindow = static_cast<::Window>(surfaceId);
292   }
293
294   auto& windowSystem = WindowSystem::GetImplementation();
295
296   char* id = NULL;
297   if((id = getenv("DESKTOP_STARTUP_ID")))
298   {
299     windowSystem.SetStringProperty(mWindow, WindowSystemX::ATOM_NET_STARTUP_ID, std::string(id));
300   }
301
302   windowSystem.SetWindowHints(mWindow, true);
303   windowSystem.Sync();
304
305   EnableMultipleSelection();
306   EnableWindowClose();
307   EnableDragAndDrop();
308
309   SetupEvents();
310 }
311
312 void WindowBaseX::SetWindowHints()
313 {
314 }
315
316 void WindowBaseX::EnableMultipleSelection()
317 {
318   WindowSystem::GetImplementation().InputMultiSelect(mWindow);
319 }
320
321 void WindowBaseX::EnableWindowClose()
322 {
323   WindowSystem::GetImplementation().SetProtocol(mWindow, WindowSystemX::ATOM_WM_DELETE_WINDOW, true);
324 }
325
326 void WindowBaseX::EnableDragAndDrop()
327 {
328   WindowSystem::GetImplementation().EnableDragAndDrop(mWindow, true);
329 }
330
331 void WindowBaseX::SetupEvents()
332 {
333   auto& windowSystem = WindowSystem::GetImplementation();
334   windowSystem.AddEventHandler(WindowSystemBase::Event::CONFIGURE_NOTIFY, EventWindowConfigureNotify, this);
335   windowSystem.AddEventHandler(WindowSystemBase::Event::PROPERTY_NOTIFY, EventWindowPropertyChanged, this);
336   windowSystem.AddEventHandler(WindowSystemBase::Event::DELETE_REQUEST, EventWindowDeleteRequest, this);
337   windowSystem.AddEventHandler(WindowSystemBase::Event::FOCUS_IN, EventWindowFocusIn, this);
338   windowSystem.AddEventHandler(WindowSystemBase::Event::FOCUS_OUT, EventWindowFocusOut, this);
339   windowSystem.AddEventHandler(WindowSystemBase::Event::DAMAGE, EventWindowDamaged, this);
340   windowSystem.AddEventHandler(WindowSystemBase::Event::MOUSE_BUTTON_DOWN, EventMouseButtonDown, this);
341   windowSystem.AddEventHandler(WindowSystemBase::Event::MOUSE_BUTTON_UP, EventMouseButtonUp, this);
342   windowSystem.AddEventHandler(WindowSystemBase::Event::MOUSE_OUT, EventMouseButtonUp, this);
343   windowSystem.AddEventHandler(WindowSystemBase::Event::MOUSE_MOVE, EventMouseButtonMove, this);
344   windowSystem.AddEventHandler(WindowSystemBase::Event::MOUSE_WHEEL, EventMouseWheel, this);
345   windowSystem.AddEventHandler(WindowSystemBase::Event::KEY_DOWN, EventKeyDown, this);
346   windowSystem.AddEventHandler(WindowSystemBase::Event::KEY_UP, EventKeyUp, this);
347   windowSystem.AddEventHandler(WindowSystemBase::Event::SELECTION_CLEAR, EventSelectionClear, this);
348   windowSystem.AddEventHandler(WindowSystemBase::Event::SELECTION_NOTIFY, EventSelectionNotify, this);
349 }
350
351 void WindowBaseX::DeleteEvents()
352 {
353 }
354
355 bool WindowBaseX::OnWindowPropertyChanged(void* data, WindowSystemBase::Event type, WindowSystemBase::EventBase* event)
356 {
357   bool handled(false);
358
359   auto propertyNotifyEvent = static_cast<WindowSystem::WindowSystemX::X11PropertyNotifyEvent*>(event);
360   if(propertyNotifyEvent->window == mWindow)
361   {
362     WindowSystemX::WindowState state = WindowSystem::GetImplementation().GetWindowState(mWindow);
363
364     switch(state)
365     {
366       case WindowSystemX::WindowState::WITHDRAWN:
367       {
368         // Window was hidden.
369         mIconifyChangedSignal.Emit(true);
370         handled = true;
371         break;
372       }
373       case WindowSystemX::WindowState::ICONIC:
374       {
375         // Window was iconified (minimised).
376         mIconifyChangedSignal.Emit(true);
377         handled = true;
378         break;
379       }
380       case WindowSystemX::WindowState::NORMAL:
381       {
382         // Window was shown.
383         mIconifyChangedSignal.Emit(false);
384         handled = true;
385         break;
386       }
387       default:
388       {
389         // Ignore
390         break;
391       }
392     }
393   }
394
395   return handled;
396 }
397
398 void WindowBaseX::OnConfigure(WindowSystemBase::EventBase* event)
399 {
400   auto configureEvent = static_cast<WindowSystemX::X11ConfigureNotifyEvent*>(event);
401   if(configureEvent->window == mWindow)
402   {
403     DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "Window::OnConfigureNotify\n");
404     Dali::PositionSize positionSize;
405     positionSize.x      = configureEvent->x;
406     positionSize.y      = configureEvent->y;
407     positionSize.width  = configureEvent->width;
408     positionSize.height = configureEvent->height;
409     /// @note Can also get the window below this one if raise/lower was called.
410     mUpdatePositionSizeSignal.Emit(positionSize);
411   }
412 }
413
414 void WindowBaseX::OnDeleteRequest()
415 {
416   mDeleteRequestSignal.Emit();
417 }
418
419 void WindowBaseX::OnFocusIn(void* data, WindowSystemBase::Event, WindowSystemBase::EventBase* event)
420 {
421   auto x11Event = static_cast<WindowSystemX::X11Event*>(event);
422
423   if(x11Event->window == mWindow)
424   {
425     DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "Window::OnFocusIn\n");
426
427     mFocusChangedSignal.Emit(true);
428   }
429 }
430
431 void WindowBaseX::OnFocusOut(void* data, WindowSystemBase::Event, WindowSystemBase::EventBase* event)
432 {
433   auto x11Event = static_cast<WindowSystemX::X11Event*>(event);
434   // If the window loses focus then hide the keyboard.
435   if(x11Event->window == mWindow)
436   {
437     DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "Window::FocusOut\n");
438
439     mFocusChangedSignal.Emit(false);
440   }
441 }
442
443 void WindowBaseX::OnWindowDamaged(void* data, WindowSystemBase::Event, WindowSystemBase::EventBase* event)
444 {
445   auto windowExposeEvent = static_cast<WindowSystemX::X11ExposeEvent*>(event);
446   if(windowExposeEvent->window == mWindow)
447   {
448     DamageArea area;
449     area.x      = windowExposeEvent->x;
450     area.y      = windowExposeEvent->y;
451     area.width  = windowExposeEvent->width;
452     area.height = windowExposeEvent->height;
453
454     mWindowDamagedSignal.Emit(area);
455   }
456 }
457
458 void WindowBaseX::OnMouseButtonDown(void* data, WindowSystemBase::Event type, WindowSystemBase::EventBase* event)
459 {
460   auto touchEvent = static_cast<WindowSystemX::X11MouseEvent*>(event);
461
462   if(touchEvent->window == mWindow)
463   {
464     DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "Window::ButtonDown\n");
465     PointState::Type state(PointState::DOWN);
466
467     Integration::Point point;
468     point.SetDeviceId(touchEvent->device);
469     point.SetState(state);
470     point.SetScreenPosition(Vector2(touchEvent->x, touchEvent->y));
471     point.SetRadius(touchEvent->multi.radius, Vector2(touchEvent->multi.radiusX, touchEvent->multi.radiusY));
472     point.SetPressure(touchEvent->multi.pressure);
473     point.SetAngle(Degree(touchEvent->multi.angle));
474     if(touchEvent->buttons)
475     {
476       point.SetMouseButton(static_cast<MouseButton::Type>(touchEvent->buttons));
477     }
478
479     mTouchEventSignal.Emit(point, touchEvent->timestamp);
480   }
481 }
482
483 void WindowBaseX::OnMouseButtonUp(void* data, WindowSystemBase::Event type, WindowSystemBase::EventBase* event)
484 {
485   auto touchEvent = static_cast<WindowSystemX::X11MouseEvent*>(event);
486
487   if(touchEvent->window == mWindow)
488   {
489     DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "Window::ButtonUp\n");
490     Integration::Point point;
491     point.SetDeviceId(touchEvent->device);
492     point.SetState(PointState::UP);
493     point.SetScreenPosition(Vector2(touchEvent->x, touchEvent->y));
494     point.SetRadius(touchEvent->multi.radius, Vector2(touchEvent->multi.radiusX, touchEvent->multi.radiusY));
495     point.SetPressure(touchEvent->multi.pressure);
496     point.SetAngle(Degree(static_cast<float>(touchEvent->multi.angle)));
497     if(touchEvent->buttons)
498     {
499       point.SetMouseButton(static_cast<MouseButton::Type>(touchEvent->buttons));
500     }
501
502     mTouchEventSignal.Emit(point, touchEvent->timestamp);
503   }
504 }
505
506 void WindowBaseX::OnMouseButtonMove(void* data, WindowSystemBase::Event type, WindowSystemBase::EventBase* event)
507 {
508   auto touchEvent = static_cast<WindowSystemX::X11MouseEvent*>(event);
509
510   if(touchEvent->window == mWindow)
511   {
512     Integration::Point point;
513     point.SetDeviceId(touchEvent->device);
514     point.SetState(PointState::MOTION);
515     point.SetScreenPosition(Vector2(static_cast<float>(touchEvent->x), static_cast<float>(touchEvent->y)));
516     point.SetRadius(static_cast<float>(touchEvent->multi.radius), Vector2(static_cast<float>(touchEvent->multi.radiusX), static_cast<float>(touchEvent->multi.radiusY)));
517     point.SetPressure(static_cast<float>(touchEvent->multi.pressure));
518     point.SetAngle(Degree(static_cast<float>(touchEvent->multi.angle)));
519
520     mTouchEventSignal.Emit(point, touchEvent->timestamp);
521   }
522 }
523
524 void WindowBaseX::OnMouseWheel(void* data, WindowSystemBase::Event type, WindowSystemBase::EventBase* event)
525 {
526   auto mouseWheelEvent = static_cast<WindowSystemX::X11MouseWheelEvent*>(event);
527
528   if(mouseWheelEvent->window == mWindow)
529   {
530     DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseX::OnMouseWheel: direction: %d, modifiers: %d, x: %d, y: %d, z: %d\n", mouseWheelEvent->direction, mouseWheelEvent->modifiers, mouseWheelEvent->x, mouseWheelEvent->y, mouseWheelEvent->z);
531
532     Integration::WheelEvent wheelEvent(Integration::WheelEvent::MOUSE_WHEEL, mouseWheelEvent->direction, mouseWheelEvent->modifiers, Vector2(static_cast<float>(mouseWheelEvent->x), static_cast<float>(mouseWheelEvent->y)), mouseWheelEvent->z, mouseWheelEvent->timestamp);
533
534     mWheelEventSignal.Emit(wheelEvent);
535   }
536 }
537
538 Integration::KeyEvent WindowBaseX::CreateKeyEvent(WindowSystemX::X11KeyEvent* keyEvent, Integration::KeyEvent::State state)
539 {
540   std::string keyName(keyEvent->keyname);
541   std::string logicalKey("");
542   std::string keyString("");
543   std::string compose("");
544
545   // Ensure key compose string is not NULL as keys like SHIFT or arrow have a null string.
546   if(!keyEvent->compose.empty())
547   {
548     compose   = keyEvent->compose;
549     keyString = keyEvent->compose;
550   }
551   // Ensure key symbol is not NULL as keys like SHIFT have a null string.
552   if(!keyEvent->key.empty())
553   {
554     logicalKey = keyEvent->key;
555   }
556
557   int           keyCode = keyEvent->keyCode;
558   int           modifier(keyEvent->modifiers);
559   unsigned long time(keyEvent->timestamp);
560
561   Integration::KeyEvent daliKeyEvent{keyName, logicalKey, keyString, keyCode, modifier, time, state, compose, DEFAULT_DEVICE_NAME, DEFAULT_DEVICE_CLASS, DEFAULT_DEVICE_SUBCLASS};
562   return daliKeyEvent;
563 }
564
565 void WindowBaseX::OnKeyDown(void* data, WindowSystemBase::Event type, WindowSystemBase::EventBase* event)
566 {
567   auto keyEvent = static_cast<WindowSystemX::X11KeyEvent*>(event);
568
569   if(keyEvent->window == mWindow)
570   {
571     DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseX::OnKeyDown\n");
572
573     auto daliKeyEvent = CreateKeyEvent(keyEvent, Integration::KeyEvent::DOWN);
574
575     mKeyEventSignal.Emit(daliKeyEvent);
576   }
577 }
578
579 void WindowBaseX::OnKeyUp(void* data, WindowSystemBase::Event type, WindowSystemBase::EventBase* event)
580 {
581   auto keyEvent = static_cast<WindowSystemX::X11KeyEvent*>(event);
582
583   if(keyEvent->window == mWindow)
584   {
585     DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, " WindowBaseX::OnKeyUp\n");
586
587     auto daliKeyEvent = CreateKeyEvent(keyEvent, Integration::KeyEvent::UP);
588
589     mKeyEventSignal.Emit(daliKeyEvent);
590   }
591 }
592
593 void WindowBaseX::OnSelectionClear(void* data, WindowSystemBase::Event type, WindowSystemBase::EventBase* event)
594 {
595 }
596
597 void WindowBaseX::OnSelectionNotify(void* data, WindowSystemBase::Event type, WindowSystemBase::EventBase* event)
598 {
599 }
600
601 Any WindowBaseX::GetNativeWindow()
602 {
603   return mWindow;
604 }
605
606 int WindowBaseX::GetNativeWindowId()
607 {
608   return mWindow;
609 }
610
611 std::string WindowBaseX::GetNativeWindowResourceId()
612 {
613   return std::string();
614 }
615
616 EGLNativeWindowType WindowBaseX::CreateEglWindow(int width, int height)
617 {
618   return reinterpret_cast<EGLNativeWindowType>(mWindow);
619 }
620
621 void WindowBaseX::DestroyEglWindow()
622 {
623 }
624
625 void WindowBaseX::SetEglWindowRotation(int angle)
626 {
627 }
628
629 void WindowBaseX::SetEglWindowBufferTransform(int angle)
630 {
631 }
632
633 void WindowBaseX::SetEglWindowTransform(int angle)
634 {
635 }
636
637 void WindowBaseX::ResizeEglWindow(PositionSize positionSize)
638 {
639 }
640
641 bool WindowBaseX::IsEglWindowRotationSupported()
642 {
643   return false;
644 }
645
646 void WindowBaseX::Move(PositionSize positionSize)
647 {
648   WindowSystem::GetImplementation().Move(mWindow, positionSize.x, positionSize.y);
649 }
650
651 void WindowBaseX::Resize(PositionSize positionSize)
652 {
653   WindowSystem::GetImplementation().Resize(mWindow, positionSize.width, positionSize.height);
654 }
655
656 void WindowBaseX::MoveResize(PositionSize positionSize)
657 {
658   WindowSystem::GetImplementation().MoveResize(mWindow, positionSize.x, positionSize.y, positionSize.width, positionSize.height);
659 }
660
661 void WindowBaseX::SetLayout(unsigned int numCols, unsigned int numRows, unsigned int column, unsigned int row, unsigned int colSpan, unsigned int rowSpan)
662 {
663 }
664
665 void WindowBaseX::SetClass(const std::string& name, const std::string& className)
666 {
667   WindowSystem::GetImplementation().SetClass(mWindow, name, className);
668 }
669
670 void WindowBaseX::Raise()
671 {
672   WindowSystem::GetImplementation().Raise(mWindow);
673 }
674
675 void WindowBaseX::Lower()
676 {
677   WindowSystem::GetImplementation().Lower(mWindow);
678 }
679
680 void WindowBaseX::Activate()
681 {
682   WindowSystem::GetImplementation().Activate(mWindow);
683 }
684
685 void WindowBaseX::Maximize(bool maximize)
686 {
687 }
688
689 bool WindowBaseX::IsMaximized() const
690 {
691   return false;
692 }
693
694 void WindowBaseX::Minimize(bool minimize)
695 {
696 }
697
698 bool WindowBaseX::IsMinimized() const
699 {
700   return false;
701 }
702
703 void WindowBaseX::SetMimimumSize(Dali::Window::WindowSize size)
704 {
705 }
706
707 void WindowBaseX::SetMaximumSize(Dali::Window::WindowSize size)
708 {
709 }
710
711 void WindowBaseX::SetAvailableAnlges(const std::vector<int>& angles)
712 {
713 }
714
715 void WindowBaseX::SetPreferredAngle(int angle)
716 {
717 }
718
719 void WindowBaseX::SetAcceptFocus(bool accept)
720 {
721 }
722
723 void WindowBaseX::Show()
724 {
725   WindowSystem::GetImplementation().Show(mWindow);
726 }
727
728 void WindowBaseX::Hide()
729 {
730   WindowSystem::GetImplementation().Hide(mWindow);
731 }
732
733 unsigned int WindowBaseX::GetSupportedAuxiliaryHintCount() const
734 {
735   return 0;
736 }
737
738 std::string WindowBaseX::GetSupportedAuxiliaryHint(unsigned int index) const
739 {
740   return std::string();
741 }
742
743 unsigned int WindowBaseX::AddAuxiliaryHint(const std::string& hint, const std::string& value)
744 {
745   return 0;
746 }
747
748 bool WindowBaseX::RemoveAuxiliaryHint(unsigned int id)
749 {
750   return false;
751 }
752
753 bool WindowBaseX::SetAuxiliaryHintValue(unsigned int id, const std::string& value)
754 {
755   return false;
756 }
757
758 std::string WindowBaseX::GetAuxiliaryHintValue(unsigned int id) const
759 {
760   return std::string();
761 }
762
763 unsigned int WindowBaseX::GetAuxiliaryHintId(const std::string& hint) const
764 {
765   return 0;
766 }
767
768 void WindowBaseX::SetInputRegion(const Rect<int>& inputRegion)
769 {
770 }
771
772 void WindowBaseX::SetType(Dali::WindowType type)
773 {
774 }
775
776 Dali::WindowType WindowBaseX::GetType() const
777 {
778   return Dali::WindowType::NORMAL;
779 }
780
781 Dali::WindowOperationResult WindowBaseX::SetNotificationLevel(Dali::WindowNotificationLevel level)
782 {
783   return Dali::WindowOperationResult::NOT_SUPPORTED;
784 }
785
786 Dali::WindowNotificationLevel WindowBaseX::GetNotificationLevel() const
787 {
788   return Dali::WindowNotificationLevel::NONE;
789 }
790
791 void WindowBaseX::SetOpaqueState(bool opaque)
792 {
793 }
794
795 Dali::WindowOperationResult WindowBaseX::SetScreenOffMode(WindowScreenOffMode screenOffMode)
796 {
797   return Dali::WindowOperationResult::NOT_SUPPORTED;
798 }
799
800 WindowScreenOffMode WindowBaseX::GetScreenOffMode() const
801 {
802   return WindowScreenOffMode::TIMEOUT;
803 }
804
805 Dali::WindowOperationResult WindowBaseX::SetBrightness(int brightness)
806 {
807   return Dali::WindowOperationResult::NOT_SUPPORTED;
808 }
809
810 int WindowBaseX::GetBrightness() const
811 {
812   return 0;
813 }
814
815 bool WindowBaseX::GrabKey(Dali::KEY key, KeyGrab::KeyGrabMode grabMode)
816 {
817   return false;
818 }
819
820 bool WindowBaseX::UngrabKey(Dali::KEY key)
821 {
822   return false;
823 }
824
825 bool WindowBaseX::GrabKeyList(const Dali::Vector<Dali::KEY>& key, const Dali::Vector<KeyGrab::KeyGrabMode>& grabMode, Dali::Vector<bool>& result)
826 {
827   return false;
828 }
829
830 bool WindowBaseX::UngrabKeyList(const Dali::Vector<Dali::KEY>& key, Dali::Vector<bool>& result)
831 {
832   return false;
833 }
834
835 void WindowBaseX::GetDpi(unsigned int& dpiHorizontal, unsigned int& dpiVertical)
836 {
837   // 1 inch = 25.4 millimeters
838   WindowSystem::GetImplementation().GetDPI(dpiHorizontal, dpiVertical);
839 }
840
841 int WindowBaseX::GetWindowRotationAngle() const
842 {
843   return 0;
844 }
845
846 int WindowBaseX::GetScreenRotationAngle()
847 {
848   return 0;
849 }
850
851 void WindowBaseX::SetWindowRotationAngle(int degree)
852 {
853   mWindowRotationAngle = degree;
854 }
855
856 void WindowBaseX::WindowRotationCompleted(int degree, int width, int height)
857 {
858 }
859
860 void WindowBaseX::SetTransparency(bool transparent)
861 {
862 }
863
864 unsigned int WindowBaseX::GetSurfaceId(Any surface) const
865 {
866   unsigned int surfaceId = 0;
867
868   if(surface.Empty() == false)
869   {
870     // check we have a valid type
871     DALI_ASSERT_ALWAYS(((surface.GetType() == typeid(::Window))) && "Surface type is invalid");
872
873     surfaceId = static_cast<unsigned int>(AnyCast<::Window>(surface));
874   }
875   return surfaceId;
876 }
877
878 void WindowBaseX::CreateWindow(PositionSize positionSize, bool isTransparent)
879 {
880   int depth = 3;
881
882   if(isTransparent)
883   {
884     // create 32 bit window
885     depth = 4;
886
887     mIsTransparent = true;
888   }
889   mWindow = WindowSystem::GetImplementation().CreateWindow(depth, positionSize.x, positionSize.y, positionSize.width, positionSize.height);
890
891   if(mWindow == 0)
892   {
893     DALI_ASSERT_ALWAYS(0 && "Failed to create X window");
894   }
895 }
896
897 void WindowBaseX::SetParent(WindowBase* parentWinBase, bool belowParent)
898 {
899   if(parentWinBase)
900   {
901     WindowBaseX* windowBaseX  = static_cast<WindowBaseX*>(parentWinBase);
902     ::Window     parentWindow = windowBaseX->mWindow;
903     WindowSystem::GetImplementation().SetTransientForHint(mWindow, parentWindow);
904   }
905   else
906   {
907     WindowSystem::GetImplementation().UnsetTransientFor(mWindow);
908   }
909 }
910
911 int WindowBaseX::CreateFrameRenderedSyncFence()
912 {
913   return -1;
914 }
915
916 int WindowBaseX::CreateFramePresentedSyncFence()
917 {
918   return -1;
919 }
920
921 void WindowBaseX::SetPositionSizeWithAngle(PositionSize positionSize, int angle)
922 {
923 }
924
925 void WindowBaseX::InitializeIme()
926 {
927 }
928
929 void WindowBaseX::ImeWindowReadyToRender()
930 {
931 }
932
933 void WindowBaseX::RequestMoveToServer()
934 {
935 }
936
937 void WindowBaseX::RequestResizeToServer(WindowResizeDirection direction)
938 {
939 }
940
941 void WindowBaseX::EnableFloatingMode(bool enable)
942 {
943 }
944
945 bool WindowBaseX::IsFloatingModeEnabled() const
946 {
947   return false;
948 }
949
950 void WindowBaseX::IncludeInputRegion(const Rect<int>& inputRegion)
951 {
952 }
953
954 void WindowBaseX::ExcludeInputRegion(const Rect<int>& inputRegion)
955 {
956 }
957
958 } // namespace Adaptor
959
960 } // namespace Internal
961
962 } // namespace Dali