2 * Copyright (c) 2021 Samsung Electronics Co., Ltd.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
19 #include <dali/internal/window-system/ubuntu-x11/window-base-ecore-x.h>
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/ubuntu-x11/ecore-x-types.h>
28 #include <dali/integration-api/debug.h>
29 #include <dali/internal/input/ubuntu-x11/dali-ecore-input.h>
30 #include <dali/public-api/events/mouse-button.h>
31 #include <dali/public-api/object/any.h>
41 const std::string DEFAULT_DEVICE_NAME = "";
42 const Device::Class::Type DEFAULT_DEVICE_CLASS = Device::Class::NONE;
43 const Device::Subclass::Type DEFAULT_DEVICE_SUBCLASS = Device::Subclass::NONE;
45 const unsigned int PRIMARY_TOUCH_BUTTON_ID(1);
47 #if defined(DEBUG_ENABLED)
48 Debug::Filter* gWindowBaseLogFilter = Debug::Filter::New(Debug::NoLogging, false, "LOG_WINDOW_BASE");
51 /////////////////////////////////////////////////////////////////////////////////////////////////
53 /////////////////////////////////////////////////////////////////////////////////////////////////
55 static Eina_Bool EcoreEventWindowPropertyChanged(void* data, int type, void* event)
57 WindowBaseEcoreX* windowBase = static_cast<WindowBaseEcoreX*>(data);
60 return windowBase->OnWindowPropertyChanged(data, type, event);
63 return ECORE_CALLBACK_PASS_ON;
67 * Called when the window receives a delete request
69 static Eina_Bool EcoreEventWindowDeleteRequest(void* data, int type, void* event)
71 WindowBaseEcoreX* windowBase = static_cast<WindowBaseEcoreX*>(data);
74 windowBase->OnDeleteRequest();
76 return ECORE_CALLBACK_DONE;
80 * Called when the window gains focus.
82 static Eina_Bool EcoreEventWindowFocusIn(void* data, int type, void* event)
84 WindowBaseEcoreX* windowBase = static_cast<WindowBaseEcoreX*>(data);
87 windowBase->OnFocusIn(data, type, event);
89 return ECORE_CALLBACK_PASS_ON;
93 * Called when the window loses focus.
95 static Eina_Bool EcoreEventWindowFocusOut(void* data, int type, void* event)
97 WindowBaseEcoreX* windowBase = static_cast<WindowBaseEcoreX*>(data);
100 windowBase->OnFocusOut(data, type, event);
102 return ECORE_CALLBACK_PASS_ON;
106 * Called when the window is damaged.
108 static Eina_Bool EcoreEventWindowDamaged(void* data, int type, void* event)
110 WindowBaseEcoreX* windowBase = static_cast<WindowBaseEcoreX*>(data);
113 windowBase->OnWindowDamaged(data, type, event);
116 return ECORE_CALLBACK_PASS_ON;
119 /////////////////////////////////////////////////////////////////////////////////////////////////
120 // Selection Callbacks
121 /////////////////////////////////////////////////////////////////////////////////////////////////
124 * Called when the source window notifies us the content in clipboard is selected.
126 static Eina_Bool EcoreEventSelectionClear(void* data, int type, void* event)
128 WindowBaseEcoreX* windowBase = static_cast<WindowBaseEcoreX*>(data);
131 windowBase->OnSelectionClear(data, type, event);
133 return ECORE_CALLBACK_PASS_ON;
137 * Called when the source window sends us about the selected content.
138 * For example, when dragged items are dragged INTO our window or when items are selected in the clipboard.
140 static Eina_Bool EcoreEventSelectionNotify(void* data, int type, void* event)
142 WindowBaseEcoreX* windowBase = static_cast<WindowBaseEcoreX*>(data);
145 windowBase->OnSelectionNotify(data, type, event);
147 return ECORE_CALLBACK_PASS_ON;
150 /////////////////////////////////////////////////////////////////////////////////////////////////
152 /////////////////////////////////////////////////////////////////////////////////////////////////
155 * Called when a touch down is received.
157 static Eina_Bool EcoreEventMouseButtonDown(void* data, int type, void* event)
159 WindowBaseEcoreX* windowBase = static_cast<WindowBaseEcoreX*>(data);
162 windowBase->OnMouseButtonDown(data, type, event);
164 return ECORE_CALLBACK_PASS_ON;
168 * Called when a touch up is received.
170 static Eina_Bool EcoreEventMouseButtonUp(void* data, int type, void* event)
172 WindowBaseEcoreX* windowBase = static_cast<WindowBaseEcoreX*>(data);
175 windowBase->OnMouseButtonUp(data, type, event);
177 return ECORE_CALLBACK_PASS_ON;
181 * Called when a touch motion is received.
183 static Eina_Bool EcoreEventMouseButtonMove(void* data, int type, void* event)
185 WindowBaseEcoreX* windowBase = static_cast<WindowBaseEcoreX*>(data);
188 windowBase->OnMouseButtonMove(data, type, event);
190 return ECORE_CALLBACK_PASS_ON;
193 /////////////////////////////////////////////////////////////////////////////////////////////////
195 /////////////////////////////////////////////////////////////////////////////////////////////////
198 * Called when a mouse wheel is received.
200 static Eina_Bool EcoreEventMouseWheel(void* data, int type, void* event)
202 WindowBaseEcoreX* windowBase = static_cast<WindowBaseEcoreX*>(data);
205 windowBase->OnMouseWheel(data, type, event);
207 return ECORE_CALLBACK_PASS_ON;
210 /////////////////////////////////////////////////////////////////////////////////////////////////
212 /////////////////////////////////////////////////////////////////////////////////////////////////
215 * Called when a key down is received.
217 static Eina_Bool EcoreEventKeyDown(void* data, int type, void* event)
219 WindowBaseEcoreX* windowBase = static_cast<WindowBaseEcoreX*>(data);
222 windowBase->OnKeyDown(data, type, event);
224 return ECORE_CALLBACK_PASS_ON;
228 * Called when a key up is received.
230 static Eina_Bool EcoreEventKeyUp(void* data, int type, void* event)
232 WindowBaseEcoreX* windowBase = static_cast<WindowBaseEcoreX*>(data);
235 windowBase->OnKeyUp(data, type, event);
237 return ECORE_CALLBACK_PASS_ON;
240 } // unnamed namespace
242 WindowBaseEcoreX::WindowBaseEcoreX(Dali::PositionSize positionSize, Any surface, bool isTransparent)
243 : mEcoreEventHandler(),
246 mIsTransparent(false), // Should only be set to true once we actually create a transparent window regardless of what isTransparent is.
247 mRotationAppSet(false),
248 mWindowRotationAngle(0)
250 Initialize(positionSize, surface, isTransparent);
253 WindowBaseEcoreX::~WindowBaseEcoreX()
255 for(Dali::Vector<Ecore_Event_Handler*>::Iterator iter = mEcoreEventHandler.Begin(), endIter = mEcoreEventHandler.End(); iter != endIter; ++iter)
257 ecore_event_handler_del(*iter);
259 mEcoreEventHandler.Clear();
263 ecore_x_window_free(mEcoreWindow);
265 WindowSystem::Shutdown();
269 void WindowBaseEcoreX::Initialize(PositionSize positionSize, Any surface, bool isTransparent)
271 // see if there is a surface in Any surface
272 unsigned int surfaceId = GetSurfaceId(surface);
274 // if the surface is empty, create a new one.
277 WindowSystem::Initialize();
279 // we own the surface about to created
281 CreateWindow(positionSize, isTransparent);
285 // XLib should already be initialized so no point in calling XInitThreads
286 mEcoreWindow = static_cast<Ecore_X_Window>(surfaceId);
289 // set up etc properties to match with ecore-evas
291 if((id = getenv("DESKTOP_STARTUP_ID")))
293 ecore_x_netwm_startup_id_set(mEcoreWindow, id);
296 ecore_x_icccm_hints_set(mEcoreWindow,
298 ECORE_X_WINDOW_STATE_HINT_NORMAL, // initial_state
305 // we SHOULD guarantee the x11 window was created in x server.
308 ecore_x_input_multi_select(mEcoreWindow);
310 // This ensures that we catch the window close (or delete) request
311 ecore_x_icccm_protocol_set(mEcoreWindow, ECORE_X_WM_PROTOCOL_DELETE_REQUEST, EINA_TRUE);
313 // Enable Drag & Drop
314 ecore_x_dnd_aware_set(mEcoreWindow, EINA_TRUE);
316 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_X_EVENT_WINDOW_PROPERTY, EcoreEventWindowPropertyChanged, this));
317 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_X_EVENT_WINDOW_DELETE_REQUEST, EcoreEventWindowDeleteRequest, this));
319 // Register window focus events
320 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_X_EVENT_WINDOW_FOCUS_IN, EcoreEventWindowFocusIn, this));
321 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_X_EVENT_WINDOW_FOCUS_OUT, EcoreEventWindowFocusOut, this));
323 // Register Window damage events
324 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_X_EVENT_WINDOW_DAMAGE, EcoreEventWindowDamaged, this));
326 // Register Touch events
327 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_DOWN, EcoreEventMouseButtonDown, this));
328 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_UP, EcoreEventMouseButtonUp, this));
329 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_EVENT_MOUSE_MOVE, EcoreEventMouseButtonMove, this));
330 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_EVENT_MOUSE_OUT, EcoreEventMouseButtonUp, this)); // process mouse out event like up event
332 // Register Mouse wheel events
333 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_EVENT_MOUSE_WHEEL, EcoreEventMouseWheel, this));
335 // Register Key events
336 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_EVENT_KEY_DOWN, EcoreEventKeyDown, this));
337 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_EVENT_KEY_UP, EcoreEventKeyUp, this));
339 // Register Selection event
340 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_X_EVENT_SELECTION_CLEAR, EcoreEventSelectionClear, this));
341 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_X_EVENT_SELECTION_NOTIFY, EcoreEventSelectionNotify, this));
344 Eina_Bool WindowBaseEcoreX::OnWindowPropertyChanged(void* data, int type, void* event)
346 Ecore_X_Event_Window_Property* propertyChangedEvent = static_cast<Ecore_X_Event_Window_Property*>(event);
347 Eina_Bool handled(ECORE_CALLBACK_PASS_ON);
349 if(propertyChangedEvent->win == mEcoreWindow)
351 Ecore_X_Window_State_Hint state(ecore_x_icccm_state_get(propertyChangedEvent->win));
355 case ECORE_X_WINDOW_STATE_HINT_WITHDRAWN:
357 // Window was hidden.
358 mIconifyChangedSignal.Emit(true);
359 handled = ECORE_CALLBACK_DONE;
362 case ECORE_X_WINDOW_STATE_HINT_ICONIC:
364 // Window was iconified (minimised).
365 mIconifyChangedSignal.Emit(true);
366 handled = ECORE_CALLBACK_DONE;
369 case ECORE_X_WINDOW_STATE_HINT_NORMAL:
372 mIconifyChangedSignal.Emit(false);
373 handled = ECORE_CALLBACK_DONE;
387 void WindowBaseEcoreX::OnDeleteRequest()
389 mDeleteRequestSignal.Emit();
392 void WindowBaseEcoreX::OnFocusIn(void* data, int type, void* event)
394 Ecore_X_Event_Window_Focus_In* focusInEvent = static_cast<Ecore_X_Event_Window_Focus_In*>(event);
396 if(focusInEvent->win == mEcoreWindow)
398 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "Window EcoreEventWindowFocusIn\n");
400 mFocusChangedSignal.Emit(true);
404 void WindowBaseEcoreX::OnFocusOut(void* data, int type, void* event)
406 Ecore_X_Event_Window_Focus_Out* focusOutEvent = static_cast<Ecore_X_Event_Window_Focus_Out*>(event);
408 // If the window loses focus then hide the keyboard.
409 if(focusOutEvent->win == mEcoreWindow)
411 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "Window EcoreEventWindowFocusOut\n");
413 mFocusChangedSignal.Emit(false);
417 void WindowBaseEcoreX::OnWindowDamaged(void* data, int type, void* event)
419 Ecore_X_Event_Window_Damage* windowDamagedEvent = static_cast<Ecore_X_Event_Window_Damage*>(event);
421 if(windowDamagedEvent->win == mEcoreWindow)
424 area.x = windowDamagedEvent->x;
425 area.y = windowDamagedEvent->y;
426 area.width = windowDamagedEvent->w;
427 area.height = windowDamagedEvent->h;
429 mWindowDamagedSignal.Emit(area);
433 void WindowBaseEcoreX::OnMouseButtonDown(void* data, int type, void* event)
435 Ecore_Event_Mouse_Button* touchEvent = static_cast<Ecore_Event_Mouse_Button*>(event);
437 if(touchEvent->window == mEcoreWindow)
439 PointState::Type state(PointState::DOWN);
441 Integration::Point point;
442 point.SetDeviceId(touchEvent->multi.device);
443 point.SetState(state);
444 point.SetScreenPosition(Vector2(touchEvent->x, touchEvent->y));
445 point.SetRadius(touchEvent->multi.radius, Vector2(touchEvent->multi.radius_x, touchEvent->multi.radius_y));
446 point.SetPressure(touchEvent->multi.pressure);
447 point.SetAngle(Degree(touchEvent->multi.angle));
448 if(touchEvent->buttons)
450 point.SetMouseButton(static_cast<MouseButton::Type>(touchEvent->buttons));
453 mTouchEventSignal.Emit(point, touchEvent->timestamp);
457 void WindowBaseEcoreX::OnMouseButtonUp(void* data, int type, void* event)
459 Ecore_Event_Mouse_Button* touchEvent = static_cast<Ecore_Event_Mouse_Button*>(event);
461 if(touchEvent->window == mEcoreWindow)
463 Integration::Point point;
464 point.SetDeviceId(touchEvent->multi.device);
465 point.SetState(PointState::UP);
466 point.SetScreenPosition(Vector2(touchEvent->x, touchEvent->y));
467 point.SetRadius(touchEvent->multi.radius, Vector2(touchEvent->multi.radius_x, touchEvent->multi.radius_y));
468 point.SetPressure(touchEvent->multi.pressure);
469 point.SetAngle(Degree(static_cast<float>(touchEvent->multi.angle)));
470 if(touchEvent->buttons)
472 point.SetMouseButton(static_cast<MouseButton::Type>(touchEvent->buttons));
475 mTouchEventSignal.Emit(point, touchEvent->timestamp);
479 void WindowBaseEcoreX::OnMouseButtonMove(void* data, int type, void* event)
481 Ecore_Event_Mouse_Move* touchEvent = static_cast<Ecore_Event_Mouse_Move*>(event);
483 if(touchEvent->window == mEcoreWindow)
485 Integration::Point point;
486 point.SetDeviceId(touchEvent->multi.device);
487 point.SetState(PointState::MOTION);
488 point.SetScreenPosition(Vector2(static_cast<float>(touchEvent->x), static_cast<float>(touchEvent->y)));
489 point.SetRadius(static_cast<float>(touchEvent->multi.radius), Vector2(static_cast<float>(touchEvent->multi.radius_x), static_cast<float>(touchEvent->multi.radius_y)));
490 point.SetPressure(static_cast<float>(touchEvent->multi.pressure));
491 point.SetAngle(Degree(static_cast<float>(touchEvent->multi.angle)));
493 mTouchEventSignal.Emit(point, touchEvent->timestamp);
497 void WindowBaseEcoreX::OnMouseWheel(void* data, int type, void* event)
499 Ecore_Event_Mouse_Wheel* mouseWheelEvent = static_cast<Ecore_Event_Mouse_Wheel*>(event);
501 if(mouseWheelEvent->window == mEcoreWindow)
503 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreX::OnMouseWheel: direction: %d, modifiers: %d, x: %d, y: %d, z: %d\n", mouseWheelEvent->direction, mouseWheelEvent->modifiers, mouseWheelEvent->x, mouseWheelEvent->y, mouseWheelEvent->z);
505 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);
507 mWheelEventSignal.Emit(wheelEvent);
511 void WindowBaseEcoreX::OnKeyDown(void* data, int type, void* event)
513 Ecore_Event_Key* keyEvent = static_cast<Ecore_Event_Key*>(event);
515 if(keyEvent->window == mEcoreWindow)
517 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreX::OnKeyDown\n");
519 std::string keyName(keyEvent->keyname);
520 std::string logicalKey("");
521 std::string keyString("");
522 std::string compose("");
524 // Ensure key compose string is not NULL as keys like SHIFT or arrow have a null string.
525 if(keyEvent->compose)
527 compose = keyEvent->compose;
530 // Ensure key symbol is not NULL as keys like SHIFT have a null string.
533 logicalKey = keyEvent->key;
536 int keyCode = ecore_x_keysym_keycode_get(keyEvent->keyname);
537 int modifier(keyEvent->modifiers);
538 unsigned long time = keyEvent->timestamp;
540 // Ensure key event string is not NULL as keys like SHIFT have a null string.
543 keyString = keyEvent->string;
546 Integration::KeyEvent keyEvent(keyName, logicalKey, keyString, keyCode, modifier, time, Integration::KeyEvent::DOWN, compose, DEFAULT_DEVICE_NAME, DEFAULT_DEVICE_CLASS, DEFAULT_DEVICE_SUBCLASS);
548 mKeyEventSignal.Emit(keyEvent);
552 void WindowBaseEcoreX::OnKeyUp(void* data, int type, void* event)
554 Ecore_Event_Key* keyEvent = static_cast<Ecore_Event_Key*>(event);
556 if(keyEvent->window == mEcoreWindow)
558 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, " WindowBaseEcoreX::OnKeyUp\n");
560 std::string keyName(keyEvent->keyname);
561 std::string logicalKey("");
562 std::string keyString("");
563 std::string compose("");
565 // Ensure key compose string is not NULL as keys like SHIFT or arrow have a null string.
566 if(keyEvent->compose)
568 compose = keyEvent->compose;
570 // Ensure key symbol is not NULL as keys like SHIFT have a null string.
573 logicalKey = keyEvent->key;
576 int keyCode = ecore_x_keysym_keycode_get(keyEvent->keyname);
577 int modifier(keyEvent->modifiers);
578 unsigned long time(keyEvent->timestamp);
580 // Ensure key event string is not NULL as keys like SHIFT have a null string.
583 keyString = keyEvent->string;
586 Integration::KeyEvent keyEvent(keyName, logicalKey, keyString, keyCode, modifier, time, Integration::KeyEvent::UP, compose, DEFAULT_DEVICE_NAME, DEFAULT_DEVICE_CLASS, DEFAULT_DEVICE_SUBCLASS);
588 mKeyEventSignal.Emit(keyEvent);
592 void WindowBaseEcoreX::OnSelectionClear(void* data, int type, void* event)
594 Ecore_X_Event_Selection_Clear* selectionClearEvent = static_cast<Ecore_X_Event_Selection_Clear*>(event);
596 if(selectionClearEvent->win == mEcoreWindow)
598 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Concise, " WindowBaseEcoreX::OnSelectionClear\n");
600 if(selectionClearEvent->selection == ECORE_X_SELECTION_SECONDARY)
602 // Request to get the content from Ecore.
603 ecore_x_selection_secondary_request(selectionClearEvent->win, ECORE_X_SELECTION_TARGET_TEXT);
608 void WindowBaseEcoreX::OnSelectionNotify(void* data, int type, void* event)
610 Ecore_X_Event_Selection_Notify* selectionNotifyEvent = static_cast<Ecore_X_Event_Selection_Notify*>(event);
612 if(selectionNotifyEvent->win == mEcoreWindow)
614 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Concise, " WindowBaseEcoreX::OnSelectionNotify\n");
616 Ecore_X_Selection_Data* selectionData = static_cast<Ecore_X_Selection_Data*>(selectionNotifyEvent->data);
617 if(selectionData->data)
619 if(selectionNotifyEvent->selection == ECORE_X_SELECTION_SECONDARY)
621 mSelectionDataReceivedSignal.Emit(event);
627 Any WindowBaseEcoreX::GetNativeWindow()
632 int WindowBaseEcoreX::GetNativeWindowId()
637 EGLNativeWindowType WindowBaseEcoreX::CreateEglWindow(int width, int height)
639 // need to create X handle as in 64bit system ECore handle is 32 bit whereas EGLnative and XWindow are 64 bit
640 XWindow window(mEcoreWindow);
641 return reinterpret_cast<EGLNativeWindowType>(window);
644 void WindowBaseEcoreX::DestroyEglWindow()
648 void WindowBaseEcoreX::SetEglWindowRotation(int angle)
652 void WindowBaseEcoreX::SetEglWindowBufferTransform(int angle)
656 void WindowBaseEcoreX::SetEglWindowTransform(int angle)
660 void WindowBaseEcoreX::ResizeEglWindow(PositionSize positionSize)
664 bool WindowBaseEcoreX::IsEglWindowRotationSupported()
669 void WindowBaseEcoreX::Move(PositionSize positionSize)
671 ecore_x_window_move(mEcoreWindow, positionSize.x, positionSize.y);
674 void WindowBaseEcoreX::Resize(PositionSize positionSize)
676 ecore_x_window_resize(mEcoreWindow, positionSize.width, positionSize.height);
679 void WindowBaseEcoreX::MoveResize(PositionSize positionSize)
681 ecore_x_window_move_resize(mEcoreWindow, positionSize.x, positionSize.y, positionSize.width, positionSize.height);
684 void WindowBaseEcoreX::SetClass(const std::string& name, const std::string& className)
686 ecore_x_icccm_title_set(mEcoreWindow, name.c_str());
687 ecore_x_netwm_name_set(mEcoreWindow, name.c_str());
688 ecore_x_icccm_name_class_set(mEcoreWindow, name.c_str(), className.c_str());
691 void WindowBaseEcoreX::Raise()
693 ecore_x_window_raise(mEcoreWindow);
696 void WindowBaseEcoreX::Lower()
698 ecore_x_window_lower(mEcoreWindow);
701 void WindowBaseEcoreX::Activate()
703 ecore_x_netwm_client_active_request(ecore_x_window_root_get(mEcoreWindow), mEcoreWindow, 1 /* request type, 1:application, 2:pager */, 0);
706 void WindowBaseEcoreX::SetAvailableAnlges(const std::vector<int>& angles)
710 void WindowBaseEcoreX::SetPreferredAngle(int angle)
714 void WindowBaseEcoreX::SetAcceptFocus(bool accept)
718 void WindowBaseEcoreX::Show()
720 ecore_x_window_show(mEcoreWindow);
723 void WindowBaseEcoreX::Hide()
725 ecore_x_window_hide(mEcoreWindow);
728 unsigned int WindowBaseEcoreX::GetSupportedAuxiliaryHintCount() const
733 std::string WindowBaseEcoreX::GetSupportedAuxiliaryHint(unsigned int index) const
735 return std::string();
738 unsigned int WindowBaseEcoreX::AddAuxiliaryHint(const std::string& hint, const std::string& value)
743 bool WindowBaseEcoreX::RemoveAuxiliaryHint(unsigned int id)
748 bool WindowBaseEcoreX::SetAuxiliaryHintValue(unsigned int id, const std::string& value)
753 std::string WindowBaseEcoreX::GetAuxiliaryHintValue(unsigned int id) const
755 return std::string();
758 unsigned int WindowBaseEcoreX::GetAuxiliaryHintId(const std::string& hint) const
763 void WindowBaseEcoreX::SetInputRegion(const Rect<int>& inputRegion)
767 void WindowBaseEcoreX::SetType(Dali::WindowType type)
771 bool WindowBaseEcoreX::SetNotificationLevel(Dali::WindowNotificationLevel level)
776 Dali::WindowNotificationLevel WindowBaseEcoreX::GetNotificationLevel() const
778 return Dali::WindowNotificationLevel::NONE;
781 void WindowBaseEcoreX::SetOpaqueState(bool opaque)
785 bool WindowBaseEcoreX::SetScreenOffMode(WindowScreenOffMode screenOffMode)
790 WindowScreenOffMode WindowBaseEcoreX::GetScreenOffMode() const
792 return WindowScreenOffMode::TIMEOUT;
795 bool WindowBaseEcoreX::SetBrightness(int brightness)
800 int WindowBaseEcoreX::GetBrightness() const
805 bool WindowBaseEcoreX::GrabKey(Dali::KEY key, KeyGrab::KeyGrabMode grabMode)
810 bool WindowBaseEcoreX::UngrabKey(Dali::KEY key)
815 bool WindowBaseEcoreX::GrabKeyList(const Dali::Vector<Dali::KEY>& key, const Dali::Vector<KeyGrab::KeyGrabMode>& grabMode, Dali::Vector<bool>& result)
820 bool WindowBaseEcoreX::UngrabKeyList(const Dali::Vector<Dali::KEY>& key, Dali::Vector<bool>& result)
825 void WindowBaseEcoreX::GetDpi(unsigned int& dpiHorizontal, unsigned int& dpiVertical)
827 // 1 inch = 25.4 millimeters
828 // ecore does not account for differing DPI in the x and y axes, so only get for x is available
830 dpiHorizontal = ecore_x_dpi_get();
831 dpiVertical = ecore_x_dpi_get();
834 int WindowBaseEcoreX::GetOrientation() const
839 int WindowBaseEcoreX::GetScreenRotationAngle()
844 void WindowBaseEcoreX::SetWindowRotationAngle(int degree)
846 mWindowRotationAngle = degree;
849 void WindowBaseEcoreX::WindowRotationCompleted(int degree, int width, int height)
853 void WindowBaseEcoreX::SetTransparency(bool transparent)
857 unsigned int WindowBaseEcoreX::GetSurfaceId(Any surface) const
859 unsigned int surfaceId = 0;
861 if(surface.Empty() == false)
863 // check we have a valid type
864 DALI_ASSERT_ALWAYS(((surface.GetType() == typeid(XWindow)) || (surface.GetType() == typeid(Ecore_X_Window))) && "Surface type is invalid");
866 if(surface.GetType() == typeid(Ecore_X_Window))
868 surfaceId = AnyCast<Ecore_X_Window>(surface);
872 surfaceId = static_cast<unsigned int>(AnyCast<XWindow>(surface));
878 void WindowBaseEcoreX::CreateWindow(PositionSize positionSize, bool isTransparent)
882 // create 32 bit window
883 mEcoreWindow = ecore_x_window_argb_new(0, positionSize.x, positionSize.y, positionSize.width, positionSize.height);
884 mIsTransparent = true;
888 // create 24 bit window
889 mEcoreWindow = ecore_x_window_new(0, positionSize.x, positionSize.y, positionSize.width, positionSize.height);
892 if(mEcoreWindow == 0)
894 DALI_ASSERT_ALWAYS(0 && "Failed to create X window");
898 void WindowBaseEcoreX::SetParent(WindowBase* parentWinBase)
900 Ecore_X_Window ecoreParent = 0;
903 WindowBaseEcoreX* winBaseEcoreX = static_cast<WindowBaseEcoreX*>(parentWinBase);
904 ecoreParent = winBaseEcoreX->mEcoreWindow;
905 ecore_x_icccm_transient_for_set(mEcoreWindow, ecoreParent);
910 ecore_x_icccm_transient_for_unset(mEcoreWindow);
914 int WindowBaseEcoreX::CreateFrameRenderedSyncFence()
919 int WindowBaseEcoreX::CreateFramePresentedSyncFence()
924 } // namespace Adaptor
926 } // namespace Internal