[dali_2.3.24] Merge branch 'devel/master'
[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 && Dali::Adaptor::IsAvailable())
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 && Dali::Adaptor::IsAvailable())
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   if(Dali::Adaptor::IsAvailable())
417   {
418     mDeleteRequestSignal.Emit();
419   }
420 }
421
422 void WindowBaseX::OnFocusIn(void* data, WindowSystemBase::Event, WindowSystemBase::EventBase* event)
423 {
424   auto x11Event = static_cast<WindowSystemX::X11Event*>(event);
425
426   if(x11Event->window == mWindow && Dali::Adaptor::IsAvailable())
427   {
428     DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "Window::OnFocusIn\n");
429
430     mFocusChangedSignal.Emit(true);
431   }
432 }
433
434 void WindowBaseX::OnFocusOut(void* data, WindowSystemBase::Event, WindowSystemBase::EventBase* event)
435 {
436   auto x11Event = static_cast<WindowSystemX::X11Event*>(event);
437   // If the window loses focus then hide the keyboard.
438   if(x11Event->window == mWindow && Dali::Adaptor::IsAvailable())
439   {
440     DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "Window::FocusOut\n");
441
442     mFocusChangedSignal.Emit(false);
443   }
444 }
445
446 void WindowBaseX::OnWindowDamaged(void* data, WindowSystemBase::Event, WindowSystemBase::EventBase* event)
447 {
448   auto windowExposeEvent = static_cast<WindowSystemX::X11ExposeEvent*>(event);
449   if(windowExposeEvent->window == mWindow && Dali::Adaptor::IsAvailable())
450   {
451     DamageArea area;
452     area.x      = windowExposeEvent->x;
453     area.y      = windowExposeEvent->y;
454     area.width  = windowExposeEvent->width;
455     area.height = windowExposeEvent->height;
456
457     mWindowDamagedSignal.Emit(area);
458   }
459 }
460
461 void WindowBaseX::OnMouseButtonDown(void* data, WindowSystemBase::Event type, WindowSystemBase::EventBase* event)
462 {
463   auto touchEvent = static_cast<WindowSystemX::X11MouseEvent*>(event);
464
465   if(touchEvent->window == mWindow && Dali::Adaptor::IsAvailable())
466   {
467     DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "Window::ButtonDown\n");
468     PointState::Type state(PointState::DOWN);
469
470     Integration::Point point;
471     point.SetDeviceId(touchEvent->device);
472     point.SetState(state);
473     point.SetScreenPosition(Vector2(touchEvent->x, touchEvent->y));
474     point.SetRadius(touchEvent->multi.radius, Vector2(touchEvent->multi.radiusX, touchEvent->multi.radiusY));
475     point.SetPressure(touchEvent->multi.pressure);
476     point.SetAngle(Degree(touchEvent->multi.angle));
477     if(touchEvent->buttons)
478     {
479       point.SetMouseButton(static_cast<MouseButton::Type>(touchEvent->buttons));
480     }
481
482     mTouchEventSignal.Emit(point, touchEvent->timestamp);
483   }
484 }
485
486 void WindowBaseX::OnMouseButtonUp(void* data, WindowSystemBase::Event type, WindowSystemBase::EventBase* event)
487 {
488   auto touchEvent = static_cast<WindowSystemX::X11MouseEvent*>(event);
489
490   if(touchEvent->window == mWindow && Dali::Adaptor::IsAvailable())
491   {
492     DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "Window::ButtonUp\n");
493     Integration::Point point;
494     point.SetDeviceId(touchEvent->device);
495     point.SetState(PointState::UP);
496     point.SetScreenPosition(Vector2(touchEvent->x, touchEvent->y));
497     point.SetRadius(touchEvent->multi.radius, Vector2(touchEvent->multi.radiusX, touchEvent->multi.radiusY));
498     point.SetPressure(touchEvent->multi.pressure);
499     point.SetAngle(Degree(static_cast<float>(touchEvent->multi.angle)));
500     if(touchEvent->buttons)
501     {
502       point.SetMouseButton(static_cast<MouseButton::Type>(touchEvent->buttons));
503     }
504
505     mTouchEventSignal.Emit(point, touchEvent->timestamp);
506   }
507 }
508
509 void WindowBaseX::OnMouseButtonMove(void* data, WindowSystemBase::Event type, WindowSystemBase::EventBase* event)
510 {
511   auto touchEvent = static_cast<WindowSystemX::X11MouseEvent*>(event);
512
513   if(touchEvent->window == mWindow && Dali::Adaptor::IsAvailable())
514   {
515     Integration::Point point;
516     point.SetDeviceId(touchEvent->device);
517     point.SetState(PointState::MOTION);
518     point.SetScreenPosition(Vector2(static_cast<float>(touchEvent->x), static_cast<float>(touchEvent->y)));
519     point.SetRadius(static_cast<float>(touchEvent->multi.radius), Vector2(static_cast<float>(touchEvent->multi.radiusX), static_cast<float>(touchEvent->multi.radiusY)));
520     point.SetPressure(static_cast<float>(touchEvent->multi.pressure));
521     point.SetAngle(Degree(static_cast<float>(touchEvent->multi.angle)));
522
523     mTouchEventSignal.Emit(point, touchEvent->timestamp);
524   }
525 }
526
527 void WindowBaseX::OnMouseWheel(void* data, WindowSystemBase::Event type, WindowSystemBase::EventBase* event)
528 {
529   auto mouseWheelEvent = static_cast<WindowSystemX::X11MouseWheelEvent*>(event);
530
531   if(mouseWheelEvent->window == mWindow && Dali::Adaptor::IsAvailable())
532   {
533     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);
534
535     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);
536
537     mWheelEventSignal.Emit(wheelEvent);
538   }
539 }
540
541 Integration::KeyEvent WindowBaseX::CreateKeyEvent(WindowSystemX::X11KeyEvent* keyEvent, Integration::KeyEvent::State state)
542 {
543   std::string keyName(keyEvent->keyname);
544   std::string logicalKey("");
545   std::string keyString("");
546   std::string compose("");
547
548   // Ensure key compose string is not NULL as keys like SHIFT or arrow have a null string.
549   if(!keyEvent->compose.empty())
550   {
551     compose   = keyEvent->compose;
552     keyString = keyEvent->compose;
553   }
554   // Ensure key symbol is not NULL as keys like SHIFT have a null string.
555   if(!keyEvent->key.empty())
556   {
557     logicalKey = keyEvent->key;
558   }
559
560   int           keyCode = keyEvent->keyCode;
561   int           modifier(keyEvent->modifiers);
562   unsigned long time(keyEvent->timestamp);
563
564   Integration::KeyEvent daliKeyEvent{keyName, logicalKey, keyString, keyCode, modifier, time, state, compose, DEFAULT_DEVICE_NAME, DEFAULT_DEVICE_CLASS, DEFAULT_DEVICE_SUBCLASS};
565   daliKeyEvent.windowId = GetNativeWindowId();
566   return daliKeyEvent;
567 }
568
569 void WindowBaseX::OnKeyDown(void* data, WindowSystemBase::Event type, WindowSystemBase::EventBase* event)
570 {
571   auto keyEvent = static_cast<WindowSystemX::X11KeyEvent*>(event);
572
573   if(keyEvent->window == mWindow && Dali::Adaptor::IsAvailable())
574   {
575     DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseX::OnKeyDown\n");
576
577     auto daliKeyEvent = CreateKeyEvent(keyEvent, Integration::KeyEvent::DOWN);
578
579     mKeyEventSignal.Emit(daliKeyEvent);
580   }
581 }
582
583 void WindowBaseX::OnKeyUp(void* data, WindowSystemBase::Event type, WindowSystemBase::EventBase* event)
584 {
585   auto keyEvent = static_cast<WindowSystemX::X11KeyEvent*>(event);
586
587   if(keyEvent->window == mWindow && Dali::Adaptor::IsAvailable())
588   {
589     DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, " WindowBaseX::OnKeyUp\n");
590
591     auto daliKeyEvent = CreateKeyEvent(keyEvent, Integration::KeyEvent::UP);
592
593     mKeyEventSignal.Emit(daliKeyEvent);
594   }
595 }
596
597 void WindowBaseX::OnSelectionClear(void* data, WindowSystemBase::Event type, WindowSystemBase::EventBase* event)
598 {
599 }
600
601 void WindowBaseX::OnSelectionNotify(void* data, WindowSystemBase::Event type, WindowSystemBase::EventBase* event)
602 {
603 }
604
605 Any WindowBaseX::GetNativeWindow()
606 {
607   return mWindow;
608 }
609
610 int WindowBaseX::GetNativeWindowId()
611 {
612   return mWindow;
613 }
614
615 std::string WindowBaseX::GetNativeWindowResourceId()
616 {
617   return std::string();
618 }
619
620 EGLNativeWindowType WindowBaseX::CreateEglWindow(int width, int height)
621 {
622   return reinterpret_cast<EGLNativeWindowType>(mWindow);
623 }
624
625 void WindowBaseX::DestroyEglWindow()
626 {
627 }
628
629 void WindowBaseX::SetEglWindowRotation(int angle)
630 {
631 }
632
633 void WindowBaseX::SetEglWindowBufferTransform(int angle)
634 {
635 }
636
637 void WindowBaseX::SetEglWindowTransform(int angle)
638 {
639 }
640
641 void WindowBaseX::ResizeEglWindow(PositionSize positionSize)
642 {
643 }
644
645 bool WindowBaseX::IsEglWindowRotationSupported()
646 {
647   return false;
648 }
649
650 void WindowBaseX::Move(PositionSize positionSize)
651 {
652   WindowSystem::GetImplementation().Move(mWindow, positionSize.x, positionSize.y);
653 }
654
655 void WindowBaseX::Resize(PositionSize positionSize)
656 {
657   WindowSystem::GetImplementation().Resize(mWindow, positionSize.width, positionSize.height);
658 }
659
660 void WindowBaseX::MoveResize(PositionSize positionSize)
661 {
662   WindowSystem::GetImplementation().MoveResize(mWindow, positionSize.x, positionSize.y, positionSize.width, positionSize.height);
663 }
664
665 void WindowBaseX::SetLayout(unsigned int numCols, unsigned int numRows, unsigned int column, unsigned int row, unsigned int colSpan, unsigned int rowSpan)
666 {
667 }
668
669 void WindowBaseX::SetClass(const std::string& name, const std::string& className)
670 {
671   WindowSystem::GetImplementation().SetClass(mWindow, name, className);
672 }
673
674 void WindowBaseX::Raise()
675 {
676   WindowSystem::GetImplementation().Raise(mWindow);
677 }
678
679 void WindowBaseX::Lower()
680 {
681   WindowSystem::GetImplementation().Lower(mWindow);
682 }
683
684 void WindowBaseX::Activate()
685 {
686   WindowSystem::GetImplementation().Activate(mWindow);
687 }
688
689 void WindowBaseX::Maximize(bool maximize)
690 {
691 }
692
693 bool WindowBaseX::IsMaximized() const
694 {
695   return false;
696 }
697
698 void WindowBaseX::Minimize(bool minimize)
699 {
700 }
701
702 bool WindowBaseX::IsMinimized() const
703 {
704   return false;
705 }
706
707 void WindowBaseX::SetMimimumSize(Dali::Window::WindowSize size)
708 {
709 }
710
711 void WindowBaseX::SetMaximumSize(Dali::Window::WindowSize size)
712 {
713 }
714
715 void WindowBaseX::SetAvailableAnlges(const std::vector<int>& angles)
716 {
717 }
718
719 void WindowBaseX::SetPreferredAngle(int angle)
720 {
721 }
722
723 void WindowBaseX::SetAcceptFocus(bool accept)
724 {
725 }
726
727 void WindowBaseX::Show()
728 {
729   WindowSystem::GetImplementation().Show(mWindow);
730 }
731
732 void WindowBaseX::Hide()
733 {
734   WindowSystem::GetImplementation().Hide(mWindow);
735 }
736
737 unsigned int WindowBaseX::GetSupportedAuxiliaryHintCount() const
738 {
739   return 0;
740 }
741
742 std::string WindowBaseX::GetSupportedAuxiliaryHint(unsigned int index) const
743 {
744   return std::string();
745 }
746
747 unsigned int WindowBaseX::AddAuxiliaryHint(const std::string& hint, const std::string& value)
748 {
749   return 0;
750 }
751
752 bool WindowBaseX::RemoveAuxiliaryHint(unsigned int id)
753 {
754   return false;
755 }
756
757 bool WindowBaseX::SetAuxiliaryHintValue(unsigned int id, const std::string& value)
758 {
759   return false;
760 }
761
762 std::string WindowBaseX::GetAuxiliaryHintValue(unsigned int id) const
763 {
764   return std::string();
765 }
766
767 unsigned int WindowBaseX::GetAuxiliaryHintId(const std::string& hint) const
768 {
769   return 0;
770 }
771
772 void WindowBaseX::SetInputRegion(const Rect<int>& inputRegion)
773 {
774 }
775
776 void WindowBaseX::SetType(Dali::WindowType type)
777 {
778 }
779
780 Dali::WindowType WindowBaseX::GetType() const
781 {
782   return Dali::WindowType::NORMAL;
783 }
784
785 Dali::WindowOperationResult WindowBaseX::SetNotificationLevel(Dali::WindowNotificationLevel level)
786 {
787   return Dali::WindowOperationResult::NOT_SUPPORTED;
788 }
789
790 Dali::WindowNotificationLevel WindowBaseX::GetNotificationLevel() const
791 {
792   return Dali::WindowNotificationLevel::NONE;
793 }
794
795 void WindowBaseX::SetOpaqueState(bool opaque)
796 {
797 }
798
799 Dali::WindowOperationResult WindowBaseX::SetScreenOffMode(WindowScreenOffMode screenOffMode)
800 {
801   return Dali::WindowOperationResult::NOT_SUPPORTED;
802 }
803
804 WindowScreenOffMode WindowBaseX::GetScreenOffMode() const
805 {
806   return WindowScreenOffMode::TIMEOUT;
807 }
808
809 Dali::WindowOperationResult WindowBaseX::SetBrightness(int brightness)
810 {
811   return Dali::WindowOperationResult::NOT_SUPPORTED;
812 }
813
814 int WindowBaseX::GetBrightness() const
815 {
816   return 0;
817 }
818
819 bool WindowBaseX::GrabKey(Dali::KEY key, KeyGrab::KeyGrabMode grabMode)
820 {
821   return false;
822 }
823
824 bool WindowBaseX::UngrabKey(Dali::KEY key)
825 {
826   return false;
827 }
828
829 bool WindowBaseX::GrabKeyList(const Dali::Vector<Dali::KEY>& key, const Dali::Vector<KeyGrab::KeyGrabMode>& grabMode, Dali::Vector<bool>& result)
830 {
831   return false;
832 }
833
834 bool WindowBaseX::UngrabKeyList(const Dali::Vector<Dali::KEY>& key, Dali::Vector<bool>& result)
835 {
836   return false;
837 }
838
839 void WindowBaseX::GetDpi(unsigned int& dpiHorizontal, unsigned int& dpiVertical)
840 {
841   // 1 inch = 25.4 millimeters
842   WindowSystem::GetImplementation().GetDPI(dpiHorizontal, dpiVertical);
843 }
844
845 int WindowBaseX::GetWindowRotationAngle() const
846 {
847   return 0;
848 }
849
850 int WindowBaseX::GetScreenRotationAngle()
851 {
852   return 0;
853 }
854
855 void WindowBaseX::SetWindowRotationAngle(int degree)
856 {
857   mWindowRotationAngle = degree;
858 }
859
860 void WindowBaseX::WindowRotationCompleted(int degree, int width, int height)
861 {
862 }
863
864 void WindowBaseX::SetTransparency(bool transparent)
865 {
866 }
867
868 unsigned int WindowBaseX::GetSurfaceId(Any surface) const
869 {
870   unsigned int surfaceId = 0;
871
872   if(surface.Empty() == false)
873   {
874     // check we have a valid type
875     DALI_ASSERT_ALWAYS(((surface.GetType() == typeid(::Window))) && "Surface type is invalid");
876
877     surfaceId = static_cast<unsigned int>(AnyCast<::Window>(surface));
878   }
879   return surfaceId;
880 }
881
882 void WindowBaseX::CreateWindow(PositionSize positionSize, bool isTransparent)
883 {
884   int depth = 3;
885
886   if(isTransparent)
887   {
888     // create 32 bit window
889     depth = 4;
890
891     mIsTransparent = true;
892   }
893   mWindow = WindowSystem::GetImplementation().CreateWindow(depth, positionSize.x, positionSize.y, positionSize.width, positionSize.height);
894
895   if(mWindow == 0)
896   {
897     DALI_ASSERT_ALWAYS(0 && "Failed to create X window");
898   }
899 }
900
901 void WindowBaseX::SetParent(WindowBase* parentWinBase, bool belowParent)
902 {
903   if(parentWinBase)
904   {
905     WindowBaseX* windowBaseX  = static_cast<WindowBaseX*>(parentWinBase);
906     ::Window     parentWindow = windowBaseX->mWindow;
907     WindowSystem::GetImplementation().SetTransientForHint(mWindow, parentWindow);
908   }
909   else
910   {
911     WindowSystem::GetImplementation().UnsetTransientFor(mWindow);
912   }
913 }
914
915 int WindowBaseX::CreateFrameRenderedSyncFence()
916 {
917   return -1;
918 }
919
920 int WindowBaseX::CreateFramePresentedSyncFence()
921 {
922   return -1;
923 }
924
925 void WindowBaseX::SetPositionSizeWithAngle(PositionSize positionSize, int angle)
926 {
927 }
928
929 void WindowBaseX::InitializeIme()
930 {
931 }
932
933 void WindowBaseX::ImeWindowReadyToRender()
934 {
935 }
936
937 void WindowBaseX::RequestMoveToServer()
938 {
939 }
940
941 void WindowBaseX::RequestResizeToServer(WindowResizeDirection direction)
942 {
943 }
944
945 void WindowBaseX::EnableFloatingMode(bool enable)
946 {
947 }
948
949 bool WindowBaseX::IsFloatingModeEnabled() const
950 {
951   return false;
952 }
953
954 void WindowBaseX::IncludeInputRegion(const Rect<int>& inputRegion)
955 {
956 }
957
958 void WindowBaseX::ExcludeInputRegion(const Rect<int>& inputRegion)
959 {
960 }
961
962 bool WindowBaseX::PointerConstraintsLock()
963 {
964   return false;
965 }
966
967 bool WindowBaseX::PointerConstraintsUnlock()
968 {
969   return false;
970 }
971
972 void WindowBaseX::LockedPointerRegionSet(int32_t x, int32_t y, int32_t width, int32_t height)
973 {
974 }
975
976 void WindowBaseX::LockedPointerCursorPositionHintSet(int32_t x, int32_t y)
977 {
978 }
979
980 bool WindowBaseX::PointerWarp(int32_t x, int32_t y)
981 {
982   return false;
983 }
984
985 void WindowBaseX::CursorVisibleSet(bool visible)
986 {
987 }
988
989 bool WindowBaseX::KeyboardGrab(Device::Subclass::Type deviceSubclass)
990 {
991   return false;
992 }
993
994 bool WindowBaseX::KeyboardUnGrab()
995 {
996   return false;
997 }
998
999 void WindowBaseX::SetFullScreen(bool fullscreen)
1000 {
1001   return;
1002 }
1003
1004 bool WindowBaseX::GetFullScreen()
1005 {
1006   return false;
1007 }
1008
1009 void WindowBaseX::SetFrontBufferRendering(bool enable)
1010 {
1011 }
1012
1013 bool WindowBaseX::GetFrontBufferRendering()
1014 {
1015   return false;
1016 }
1017
1018 void WindowBaseX::SetEglWindowFrontBufferMode(bool enable)
1019 {
1020 }
1021
1022 } // namespace Adaptor
1023
1024 } // namespace Internal
1025
1026 } // namespace Dali