Added X11 window manager resize handling
[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 std::string            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     /**** @todo Should not be destroyed here! ****/
275     WindowSystem::Shutdown();
276   }
277 }
278
279 void WindowBaseX::Initialize(PositionSize positionSize, Any surface, bool isTransparent)
280 {
281   // see if there is a surface in Any surface
282   unsigned int surfaceId = GetSurfaceId(surface);
283
284   // if the surface is empty, create a new one.
285   if(surfaceId == 0)
286   {
287     /**** @todo Should be created from somewhere else! ****/
288     WindowSystem::Initialize();
289
290     // we own the surface about to created
291     mOwnSurface = true;
292     CreateWindow(positionSize, isTransparent);
293   }
294   else
295   {
296     // XLib should already be initialized so no point in calling XInitThreads
297     mWindow = static_cast<::Window>(surfaceId);
298   }
299
300   auto& windowSystem = WindowSystem::GetImplementation();
301
302   char* id = NULL;
303   if((id = getenv("DESKTOP_STARTUP_ID")))
304   {
305     windowSystem.SetStringProperty(mWindow, WindowSystemX::ATOM_NET_STARTUP_ID, std::string(id));
306   }
307
308   windowSystem.SetWindowHints(mWindow, true);
309   windowSystem.Sync();
310
311   EnableMultipleSelection();
312   EnableWindowClose();
313   EnableDragAndDrop();
314
315   SetupEvents();
316 }
317
318 void WindowBaseX::SetWindowHints()
319 {
320 }
321
322 void WindowBaseX::EnableMultipleSelection()
323 {
324   WindowSystem::GetImplementation().InputMultiSelect(mWindow);
325 }
326
327 void WindowBaseX::EnableWindowClose()
328 {
329   WindowSystem::GetImplementation().SetProtocol(mWindow, WindowSystemX::ATOM_WM_DELETE_WINDOW, true);
330 }
331
332 void WindowBaseX::EnableDragAndDrop()
333 {
334   WindowSystem::GetImplementation().EnableDragAndDrop(mWindow, true);
335 }
336
337 void WindowBaseX::SetupEvents()
338 {
339   auto& windowSystem = WindowSystem::GetImplementation();
340   windowSystem.AddEventHandler(WindowSystemBase::Event::CONFIGURE_NOTIFY, EventWindowConfigureNotify, this);
341   windowSystem.AddEventHandler(WindowSystemBase::Event::PROPERTY_NOTIFY, EventWindowPropertyChanged, this);
342   windowSystem.AddEventHandler(WindowSystemBase::Event::DELETE_REQUEST, EventWindowDeleteRequest, this);
343   windowSystem.AddEventHandler(WindowSystemBase::Event::FOCUS_IN, EventWindowFocusIn, this);
344   windowSystem.AddEventHandler(WindowSystemBase::Event::FOCUS_OUT, EventWindowFocusOut, this);
345   windowSystem.AddEventHandler(WindowSystemBase::Event::DAMAGE, EventWindowDamaged, this);
346   windowSystem.AddEventHandler(WindowSystemBase::Event::MOUSE_BUTTON_DOWN, EventMouseButtonDown, this);
347   windowSystem.AddEventHandler(WindowSystemBase::Event::MOUSE_BUTTON_UP, EventMouseButtonUp, this);
348   windowSystem.AddEventHandler(WindowSystemBase::Event::MOUSE_OUT, EventMouseButtonUp, this);
349   windowSystem.AddEventHandler(WindowSystemBase::Event::MOUSE_MOVE, EventMouseButtonMove, this);
350   windowSystem.AddEventHandler(WindowSystemBase::Event::MOUSE_WHEEL, EventMouseWheel, this);
351   windowSystem.AddEventHandler(WindowSystemBase::Event::KEY_DOWN, EventKeyDown, this);
352   windowSystem.AddEventHandler(WindowSystemBase::Event::KEY_UP, EventKeyUp, this);
353   windowSystem.AddEventHandler(WindowSystemBase::Event::SELECTION_CLEAR, EventSelectionClear, this);
354   windowSystem.AddEventHandler(WindowSystemBase::Event::SELECTION_NOTIFY, EventSelectionNotify, this);
355 }
356
357 void WindowBaseX::DeleteEvents()
358 {
359 }
360
361 bool WindowBaseX::OnWindowPropertyChanged(void* data, WindowSystemBase::Event type, WindowSystemBase::EventBase* event)
362 {
363   bool handled(false);
364
365   auto propertyNotifyEvent = static_cast<WindowSystem::WindowSystemX::X11PropertyNotifyEvent*>(event);
366   if(propertyNotifyEvent->window == mWindow)
367   {
368     WindowSystemX::WindowState state = WindowSystem::GetImplementation().GetWindowState(mWindow);
369
370     switch(state)
371     {
372       case WindowSystemX::WindowState::WITHDRAWN:
373       {
374         // Window was hidden.
375         mIconifyChangedSignal.Emit(true);
376         handled = true;
377         break;
378       }
379       case WindowSystemX::WindowState::ICONIC:
380       {
381         // Window was iconified (minimised).
382         mIconifyChangedSignal.Emit(true);
383         handled = true;
384         break;
385       }
386       case WindowSystemX::WindowState::NORMAL:
387       {
388         // Window was shown.
389         mIconifyChangedSignal.Emit(false);
390         handled = true;
391         break;
392       }
393       default:
394       {
395         // Ignore
396         break;
397       }
398     }
399   }
400
401   return handled;
402 }
403
404 void WindowBaseX::OnConfigure(WindowSystemBase::EventBase* event)
405 {
406   auto configureEvent = static_cast<WindowSystemX::X11ConfigureNotifyEvent*>(event);
407   if(configureEvent->window == mWindow)
408   {
409     DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "Window::OnConfigureNotify\n");
410     Dali::PositionSize positionSize;
411     positionSize.x      = configureEvent->x;
412     positionSize.y      = configureEvent->y;
413     positionSize.width  = configureEvent->width;
414     positionSize.height = configureEvent->height;
415     /// @note Can also get the window below this one if raise/lower was called.
416     mUpdatePositionSizeSignal.Emit(positionSize);
417   }
418 }
419
420 void WindowBaseX::OnDeleteRequest()
421 {
422   mDeleteRequestSignal.Emit();
423 }
424
425 void WindowBaseX::OnFocusIn(void* data, WindowSystemBase::Event, WindowSystemBase::EventBase* event)
426 {
427   auto x11Event = static_cast<WindowSystemX::X11Event*>(event);
428
429   if(x11Event->window == mWindow)
430   {
431     DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "Window::OnFocusIn\n");
432
433     mFocusChangedSignal.Emit(true);
434   }
435 }
436
437 void WindowBaseX::OnFocusOut(void* data, WindowSystemBase::Event, WindowSystemBase::EventBase* event)
438 {
439   auto x11Event = static_cast<WindowSystemX::X11Event*>(event);
440   // If the window loses focus then hide the keyboard.
441   if(x11Event->window == mWindow)
442   {
443     DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "Window::FocusOut\n");
444
445     mFocusChangedSignal.Emit(false);
446   }
447 }
448
449 void WindowBaseX::OnWindowDamaged(void* data, WindowSystemBase::Event, WindowSystemBase::EventBase* event)
450 {
451   auto windowExposeEvent = static_cast<WindowSystemX::X11ExposeEvent*>(event);
452   if(windowExposeEvent->window == mWindow)
453   {
454     DamageArea area;
455     area.x      = windowExposeEvent->x;
456     area.y      = windowExposeEvent->y;
457     area.width  = windowExposeEvent->width;
458     area.height = windowExposeEvent->height;
459
460     mWindowDamagedSignal.Emit(area);
461   }
462 }
463
464 void WindowBaseX::OnMouseButtonDown(void* data, WindowSystemBase::Event type, WindowSystemBase::EventBase* event)
465 {
466   auto touchEvent = static_cast<WindowSystemX::X11MouseEvent*>(event);
467
468   if(touchEvent->window == mWindow)
469   {
470     DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "Window::ButtonDown\n");
471     PointState::Type state(PointState::DOWN);
472
473     Integration::Point point;
474     point.SetDeviceId(touchEvent->device);
475     point.SetState(state);
476     point.SetScreenPosition(Vector2(touchEvent->x, touchEvent->y));
477     point.SetRadius(touchEvent->multi.radius, Vector2(touchEvent->multi.radiusX, touchEvent->multi.radiusY));
478     point.SetPressure(touchEvent->multi.pressure);
479     point.SetAngle(Degree(touchEvent->multi.angle));
480     if(touchEvent->buttons)
481     {
482       point.SetMouseButton(static_cast<MouseButton::Type>(touchEvent->buttons));
483     }
484
485     mTouchEventSignal.Emit(point, touchEvent->timestamp);
486   }
487 }
488
489 void WindowBaseX::OnMouseButtonUp(void* data, WindowSystemBase::Event type, WindowSystemBase::EventBase* event)
490 {
491   auto touchEvent = static_cast<WindowSystemX::X11MouseEvent*>(event);
492
493   if(touchEvent->window == mWindow)
494   {
495     DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "Window::ButtonUp\n");
496     Integration::Point point;
497     point.SetDeviceId(touchEvent->device);
498     point.SetState(PointState::UP);
499     point.SetScreenPosition(Vector2(touchEvent->x, touchEvent->y));
500     point.SetRadius(touchEvent->multi.radius, Vector2(touchEvent->multi.radiusX, touchEvent->multi.radiusY));
501     point.SetPressure(touchEvent->multi.pressure);
502     point.SetAngle(Degree(static_cast<float>(touchEvent->multi.angle)));
503     if(touchEvent->buttons)
504     {
505       point.SetMouseButton(static_cast<MouseButton::Type>(touchEvent->buttons));
506     }
507
508     mTouchEventSignal.Emit(point, touchEvent->timestamp);
509   }
510 }
511
512 void WindowBaseX::OnMouseButtonMove(void* data, WindowSystemBase::Event type, WindowSystemBase::EventBase* event)
513 {
514   auto touchEvent = static_cast<WindowSystemX::X11MouseEvent*>(event);
515
516   if(touchEvent->window == mWindow)
517   {
518     Integration::Point point;
519     point.SetDeviceId(touchEvent->device);
520     point.SetState(PointState::MOTION);
521     point.SetScreenPosition(Vector2(static_cast<float>(touchEvent->x), static_cast<float>(touchEvent->y)));
522     point.SetRadius(static_cast<float>(touchEvent->multi.radius), Vector2(static_cast<float>(touchEvent->multi.radiusX), static_cast<float>(touchEvent->multi.radiusY)));
523     point.SetPressure(static_cast<float>(touchEvent->multi.pressure));
524     point.SetAngle(Degree(static_cast<float>(touchEvent->multi.angle)));
525
526     mTouchEventSignal.Emit(point, touchEvent->timestamp);
527   }
528 }
529
530 void WindowBaseX::OnMouseWheel(void* data, WindowSystemBase::Event type, WindowSystemBase::EventBase* event)
531 {
532   auto mouseWheelEvent = static_cast<WindowSystemX::X11MouseWheelEvent*>(event);
533
534   if(mouseWheelEvent->window == mWindow)
535   {
536     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);
537
538     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);
539
540     mWheelEventSignal.Emit(wheelEvent);
541   }
542 }
543
544 Integration::KeyEvent WindowBaseX::CreateKeyEvent(WindowSystemX::X11KeyEvent* keyEvent, Integration::KeyEvent::State state)
545 {
546   std::string keyName(keyEvent->keyname);
547   std::string logicalKey("");
548   std::string keyString("");
549   std::string compose("");
550
551   // Ensure key compose string is not NULL as keys like SHIFT or arrow have a null string.
552   if(!keyEvent->compose.empty())
553   {
554     compose   = keyEvent->compose;
555     keyString = keyEvent->compose;
556   }
557   // Ensure key symbol is not NULL as keys like SHIFT have a null string.
558   if(!keyEvent->key.empty())
559   {
560     logicalKey = keyEvent->key;
561   }
562
563   int           keyCode = keyEvent->keyCode;
564   int           modifier(keyEvent->modifiers);
565   unsigned long time(keyEvent->timestamp);
566
567   Integration::KeyEvent daliKeyEvent{keyName, logicalKey, keyString, keyCode, modifier, time, state, compose, DEFAULT_DEVICE_NAME, DEFAULT_DEVICE_CLASS, DEFAULT_DEVICE_SUBCLASS};
568   return daliKeyEvent;
569 }
570
571 void WindowBaseX::OnKeyDown(void* data, WindowSystemBase::Event type, WindowSystemBase::EventBase* event)
572 {
573   auto keyEvent = static_cast<WindowSystemX::X11KeyEvent*>(event);
574
575   if(keyEvent->window == mWindow)
576   {
577     DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseX::OnKeyDown\n");
578
579     auto daliKeyEvent = CreateKeyEvent(keyEvent, Integration::KeyEvent::DOWN);
580
581     mKeyEventSignal.Emit(daliKeyEvent);
582   }
583 }
584
585 void WindowBaseX::OnKeyUp(void* data, WindowSystemBase::Event type, WindowSystemBase::EventBase* event)
586 {
587   auto keyEvent = static_cast<WindowSystemX::X11KeyEvent*>(event);
588
589   if(keyEvent->window == mWindow)
590   {
591     DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, " WindowBaseX::OnKeyUp\n");
592
593     auto daliKeyEvent = CreateKeyEvent(keyEvent, Integration::KeyEvent::UP);
594
595     mKeyEventSignal.Emit(daliKeyEvent);
596   }
597 }
598
599 void WindowBaseX::OnSelectionClear(void* data, WindowSystemBase::Event type, WindowSystemBase::EventBase* event)
600 {
601 }
602
603 void WindowBaseX::OnSelectionNotify(void* data, WindowSystemBase::Event type, WindowSystemBase::EventBase* event)
604 {
605 }
606
607 Any WindowBaseX::GetNativeWindow()
608 {
609   return mWindow;
610 }
611
612 int WindowBaseX::GetNativeWindowId()
613 {
614   return mWindow;
615 }
616
617 std::string WindowBaseX::GetNativeWindowResourceId()
618 {
619   return std::string();
620 }
621
622 EGLNativeWindowType WindowBaseX::CreateEglWindow(int width, int height)
623 {
624   return reinterpret_cast<EGLNativeWindowType>(mWindow);
625 }
626
627 void WindowBaseX::DestroyEglWindow()
628 {
629 }
630
631 void WindowBaseX::SetEglWindowRotation(int angle)
632 {
633 }
634
635 void WindowBaseX::SetEglWindowBufferTransform(int angle)
636 {
637 }
638
639 void WindowBaseX::SetEglWindowTransform(int angle)
640 {
641 }
642
643 void WindowBaseX::ResizeEglWindow(PositionSize positionSize)
644 {
645 }
646
647 bool WindowBaseX::IsEglWindowRotationSupported()
648 {
649   return false;
650 }
651
652 void WindowBaseX::Move(PositionSize positionSize)
653 {
654   WindowSystem::GetImplementation().Move(mWindow, positionSize.x, positionSize.y);
655 }
656
657 void WindowBaseX::Resize(PositionSize positionSize)
658 {
659   WindowSystem::GetImplementation().Resize(mWindow, positionSize.width, positionSize.height);
660 }
661
662 void WindowBaseX::MoveResize(PositionSize positionSize)
663 {
664   WindowSystem::GetImplementation().MoveResize(mWindow, positionSize.x, positionSize.y, positionSize.width, positionSize.height);
665 }
666
667 void WindowBaseX::SetClass(const std::string& name, const std::string& className)
668 {
669   WindowSystem::GetImplementation().SetClass(mWindow, name, className);
670 }
671
672 void WindowBaseX::Raise()
673 {
674   WindowSystem::GetImplementation().Raise(mWindow);
675 }
676
677 void WindowBaseX::Lower()
678 {
679   WindowSystem::GetImplementation().Lower(mWindow);
680 }
681
682 void WindowBaseX::Activate()
683 {
684   WindowSystem::GetImplementation().Activate(mWindow);
685 }
686
687 void WindowBaseX::Maximize(bool maximize)
688 {
689 }
690
691 bool WindowBaseX::IsMaximized() const
692 {
693   return false;
694 }
695
696 void WindowBaseX::Minimize(bool minimize)
697 {
698 }
699
700 bool WindowBaseX::IsMinimized() const
701 {
702   return false;
703 }
704
705 void WindowBaseX::SetMimimumSize(Dali::Window::WindowSize size)
706 {
707 }
708
709 void WindowBaseX::SetMaximumSize(Dali::Window::WindowSize size)
710 {
711 }
712
713 void WindowBaseX::SetAvailableAnlges(const std::vector<int>& angles)
714 {
715 }
716
717 void WindowBaseX::SetPreferredAngle(int angle)
718 {
719 }
720
721 void WindowBaseX::SetAcceptFocus(bool accept)
722 {
723 }
724
725 void WindowBaseX::Show()
726 {
727   WindowSystem::GetImplementation().Show(mWindow);
728 }
729
730 void WindowBaseX::Hide()
731 {
732   WindowSystem::GetImplementation().Hide(mWindow);
733 }
734
735 unsigned int WindowBaseX::GetSupportedAuxiliaryHintCount() const
736 {
737   return 0;
738 }
739
740 std::string WindowBaseX::GetSupportedAuxiliaryHint(unsigned int index) const
741 {
742   return std::string();
743 }
744
745 unsigned int WindowBaseX::AddAuxiliaryHint(const std::string& hint, const std::string& value)
746 {
747   return 0;
748 }
749
750 bool WindowBaseX::RemoveAuxiliaryHint(unsigned int id)
751 {
752   return false;
753 }
754
755 bool WindowBaseX::SetAuxiliaryHintValue(unsigned int id, const std::string& value)
756 {
757   return false;
758 }
759
760 std::string WindowBaseX::GetAuxiliaryHintValue(unsigned int id) const
761 {
762   return std::string();
763 }
764
765 unsigned int WindowBaseX::GetAuxiliaryHintId(const std::string& hint) const
766 {
767   return 0;
768 }
769
770 void WindowBaseX::SetInputRegion(const Rect<int>& inputRegion)
771 {
772 }
773
774 void WindowBaseX::SetType(Dali::WindowType type)
775 {
776 }
777
778 Dali::WindowType WindowBaseX::GetType() const
779 {
780   return Dali::WindowType::NORMAL;
781 }
782
783 Dali::WindowOperationResult WindowBaseX::SetNotificationLevel(Dali::WindowNotificationLevel level)
784 {
785   return Dali::WindowOperationResult::NOT_SUPPORTED;
786 }
787
788 Dali::WindowNotificationLevel WindowBaseX::GetNotificationLevel() const
789 {
790   return Dali::WindowNotificationLevel::NONE;
791 }
792
793 void WindowBaseX::SetOpaqueState(bool opaque)
794 {
795 }
796
797 Dali::WindowOperationResult WindowBaseX::SetScreenOffMode(WindowScreenOffMode screenOffMode)
798 {
799   return Dali::WindowOperationResult::NOT_SUPPORTED;
800 }
801
802 WindowScreenOffMode WindowBaseX::GetScreenOffMode() const
803 {
804   return WindowScreenOffMode::TIMEOUT;
805 }
806
807 Dali::WindowOperationResult WindowBaseX::SetBrightness(int brightness)
808 {
809   return Dali::WindowOperationResult::NOT_SUPPORTED;
810 }
811
812 int WindowBaseX::GetBrightness() const
813 {
814   return 0;
815 }
816
817 bool WindowBaseX::GrabKey(Dali::KEY key, KeyGrab::KeyGrabMode grabMode)
818 {
819   return false;
820 }
821
822 bool WindowBaseX::UngrabKey(Dali::KEY key)
823 {
824   return false;
825 }
826
827 bool WindowBaseX::GrabKeyList(const Dali::Vector<Dali::KEY>& key, const Dali::Vector<KeyGrab::KeyGrabMode>& grabMode, Dali::Vector<bool>& result)
828 {
829   return false;
830 }
831
832 bool WindowBaseX::UngrabKeyList(const Dali::Vector<Dali::KEY>& key, Dali::Vector<bool>& result)
833 {
834   return false;
835 }
836
837 void WindowBaseX::GetDpi(unsigned int& dpiHorizontal, unsigned int& dpiVertical)
838 {
839   // 1 inch = 25.4 millimeters
840   WindowSystem::GetImplementation().GetDPI(dpiHorizontal, dpiVertical);
841 }
842
843 int WindowBaseX::GetWindowRotationAngle() const
844 {
845   return 0;
846 }
847
848 int WindowBaseX::GetScreenRotationAngle()
849 {
850   return 0;
851 }
852
853 void WindowBaseX::SetWindowRotationAngle(int degree)
854 {
855   mWindowRotationAngle = degree;
856 }
857
858 void WindowBaseX::WindowRotationCompleted(int degree, int width, int height)
859 {
860 }
861
862 void WindowBaseX::SetTransparency(bool transparent)
863 {
864 }
865
866 unsigned int WindowBaseX::GetSurfaceId(Any surface) const
867 {
868   unsigned int surfaceId = 0;
869
870   if(surface.Empty() == false)
871   {
872     // check we have a valid type
873     DALI_ASSERT_ALWAYS(((surface.GetType() == typeid(::Window))) && "Surface type is invalid");
874
875     surfaceId = static_cast<unsigned int>(AnyCast<::Window>(surface));
876   }
877   return surfaceId;
878 }
879
880 void WindowBaseX::CreateWindow(PositionSize positionSize, bool isTransparent)
881 {
882   int depth = 3;
883
884   if(isTransparent)
885   {
886     // create 32 bit window
887     depth = 4;
888
889     mIsTransparent = true;
890   }
891   mWindow = WindowSystem::GetImplementation().CreateWindow(depth, positionSize.x, positionSize.y, positionSize.width, positionSize.height);
892
893   if(mWindow == 0)
894   {
895     DALI_ASSERT_ALWAYS(0 && "Failed to create X window");
896   }
897 }
898
899 void WindowBaseX::SetParent(WindowBase* parentWinBase, bool belowParent)
900 {
901   if(parentWinBase)
902   {
903     WindowBaseX* windowBaseX  = static_cast<WindowBaseX*>(parentWinBase);
904     ::Window     parentWindow = windowBaseX->mWindow;
905     WindowSystem::GetImplementation().SetTransientForHint(mWindow, parentWindow);
906   }
907   else
908   {
909     WindowSystem::GetImplementation().UnsetTransientFor(mWindow);
910   }
911 }
912
913 int WindowBaseX::CreateFrameRenderedSyncFence()
914 {
915   return -1;
916 }
917
918 int WindowBaseX::CreateFramePresentedSyncFence()
919 {
920   return -1;
921 }
922
923 void WindowBaseX::SetPositionSizeWithAngle(PositionSize positionSize, int angle)
924 {
925 }
926
927 void WindowBaseX::InitializeIme()
928 {
929 }
930
931 void WindowBaseX::ImeWindowReadyToRender()
932 {
933 }
934
935 void WindowBaseX::RequestMoveToServer()
936 {
937 }
938
939 void WindowBaseX::RequestResizeToServer(WindowResizeDirection direction)
940 {
941 }
942
943 void WindowBaseX::EnableFloatingMode(bool enable)
944 {
945 }
946
947 bool WindowBaseX::IsFloatingModeEnabled() const
948 {
949   return false;
950 }
951
952 void WindowBaseX::IncludeInputRegion(const Rect<int>& inputRegion)
953 {
954 }
955
956 void WindowBaseX::ExcludeInputRegion(const Rect<int>& inputRegion)
957 {
958 }
959
960 } // namespace Adaptor
961
962 } // namespace Internal
963
964 } // namespace Dali