2 * Copyright (c) 2023 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 EcoreEventWindowConfigure(void* data, int type, void* event)
57 WindowBaseEcoreX* windowBase = static_cast<WindowBaseEcoreX*>(data);
60 windowBase->OnWindowConfigure(event);
63 return ECORE_CALLBACK_PASS_ON;
66 static Eina_Bool EcoreEventWindowPropertyChanged(void* data, int type, void* event)
68 WindowBaseEcoreX* windowBase = static_cast<WindowBaseEcoreX*>(data);
71 return windowBase->OnWindowPropertyChanged(data, type, event);
74 return ECORE_CALLBACK_PASS_ON;
78 * Called when the window receives a delete request
80 static Eina_Bool EcoreEventWindowDeleteRequest(void* data, int type, void* event)
82 WindowBaseEcoreX* windowBase = static_cast<WindowBaseEcoreX*>(data);
85 windowBase->OnDeleteRequest();
87 return ECORE_CALLBACK_DONE;
91 * Called when the window gains focus.
93 static Eina_Bool EcoreEventWindowFocusIn(void* data, int type, void* event)
95 WindowBaseEcoreX* windowBase = static_cast<WindowBaseEcoreX*>(data);
98 windowBase->OnFocusIn(data, type, event);
100 return ECORE_CALLBACK_PASS_ON;
104 * Called when the window loses focus.
106 static Eina_Bool EcoreEventWindowFocusOut(void* data, int type, void* event)
108 WindowBaseEcoreX* windowBase = static_cast<WindowBaseEcoreX*>(data);
111 windowBase->OnFocusOut(data, type, event);
113 return ECORE_CALLBACK_PASS_ON;
117 * Called when the window is damaged.
119 static Eina_Bool EcoreEventWindowDamaged(void* data, int type, void* event)
121 WindowBaseEcoreX* windowBase = static_cast<WindowBaseEcoreX*>(data);
124 windowBase->OnWindowDamaged(data, type, event);
127 return ECORE_CALLBACK_PASS_ON;
130 /////////////////////////////////////////////////////////////////////////////////////////////////
131 // Selection Callbacks
132 /////////////////////////////////////////////////////////////////////////////////////////////////
135 * Called when the source window notifies us the content in clipboard is selected.
137 static Eina_Bool EcoreEventSelectionClear(void* data, int type, void* event)
139 WindowBaseEcoreX* windowBase = static_cast<WindowBaseEcoreX*>(data);
142 windowBase->OnSelectionClear(data, type, event);
144 return ECORE_CALLBACK_PASS_ON;
148 * Called when the source window sends us about the selected content.
149 * For example, when dragged items are dragged INTO our window or when items are selected in the clipboard.
151 static Eina_Bool EcoreEventSelectionNotify(void* data, int type, void* event)
153 WindowBaseEcoreX* windowBase = static_cast<WindowBaseEcoreX*>(data);
156 windowBase->OnSelectionNotify(data, type, event);
158 return ECORE_CALLBACK_PASS_ON;
161 /////////////////////////////////////////////////////////////////////////////////////////////////
163 /////////////////////////////////////////////////////////////////////////////////////////////////
166 * Called when a touch down is received.
168 static Eina_Bool EcoreEventMouseButtonDown(void* data, int type, void* event)
170 WindowBaseEcoreX* windowBase = static_cast<WindowBaseEcoreX*>(data);
173 windowBase->OnMouseButtonDown(data, type, event);
175 return ECORE_CALLBACK_PASS_ON;
179 * Called when a touch up is received.
181 static Eina_Bool EcoreEventMouseButtonUp(void* data, int type, void* event)
183 WindowBaseEcoreX* windowBase = static_cast<WindowBaseEcoreX*>(data);
186 windowBase->OnMouseButtonUp(data, type, event);
188 return ECORE_CALLBACK_PASS_ON;
192 * Called when a touch motion is received.
194 static Eina_Bool EcoreEventMouseButtonMove(void* data, int type, void* event)
196 WindowBaseEcoreX* windowBase = static_cast<WindowBaseEcoreX*>(data);
199 windowBase->OnMouseButtonMove(data, type, event);
201 return ECORE_CALLBACK_PASS_ON;
204 /////////////////////////////////////////////////////////////////////////////////////////////////
206 /////////////////////////////////////////////////////////////////////////////////////////////////
209 * Called when a mouse wheel is received.
211 static Eina_Bool EcoreEventMouseWheel(void* data, int type, void* event)
213 WindowBaseEcoreX* windowBase = static_cast<WindowBaseEcoreX*>(data);
216 windowBase->OnMouseWheel(data, type, event);
218 return ECORE_CALLBACK_PASS_ON;
221 /////////////////////////////////////////////////////////////////////////////////////////////////
223 /////////////////////////////////////////////////////////////////////////////////////////////////
226 * Called when a key down is received.
228 static Eina_Bool EcoreEventKeyDown(void* data, int type, void* event)
230 WindowBaseEcoreX* windowBase = static_cast<WindowBaseEcoreX*>(data);
233 windowBase->OnKeyDown(data, type, event);
235 return ECORE_CALLBACK_PASS_ON;
239 * Called when a key up is received.
241 static Eina_Bool EcoreEventKeyUp(void* data, int type, void* event)
243 WindowBaseEcoreX* windowBase = static_cast<WindowBaseEcoreX*>(data);
246 windowBase->OnKeyUp(data, type, event);
248 return ECORE_CALLBACK_PASS_ON;
251 } // unnamed namespace
253 WindowBaseEcoreX::WindowBaseEcoreX(Dali::PositionSize positionSize, Any surface, bool isTransparent)
254 : mEcoreEventHandler(),
257 mIsTransparent(false), // Should only be set to true once we actually create a transparent window regardless of what isTransparent is.
258 mRotationAppSet(false),
259 mWindowRotationAngle(0)
261 Initialize(positionSize, surface, isTransparent);
264 WindowBaseEcoreX::~WindowBaseEcoreX()
266 for(Dali::Vector<Ecore_Event_Handler*>::Iterator iter = mEcoreEventHandler.Begin(), endIter = mEcoreEventHandler.End(); iter != endIter; ++iter)
268 ecore_event_handler_del(*iter);
270 mEcoreEventHandler.Clear();
274 ecore_x_window_free(mEcoreWindow);
276 WindowSystem::Shutdown();
280 void WindowBaseEcoreX::Initialize(PositionSize positionSize, Any surface, bool isTransparent)
282 // see if there is a surface in Any surface
283 unsigned int surfaceId = GetSurfaceId(surface);
285 // if the surface is empty, create a new one.
288 WindowSystem::Initialize();
290 // we own the surface about to created
292 CreateWindow(positionSize, isTransparent);
296 // XLib should already be initialized so no point in calling XInitThreads
297 mEcoreWindow = static_cast<Ecore_X_Window>(surfaceId);
300 // set up etc properties to match with ecore-evas
302 if((id = getenv("DESKTOP_STARTUP_ID")))
304 ecore_x_netwm_startup_id_set(mEcoreWindow, id);
307 ecore_x_icccm_hints_set(mEcoreWindow,
309 ECORE_X_WINDOW_STATE_HINT_NORMAL, // initial_state
316 // we SHOULD guarantee the x11 window was created in x server.
319 ecore_x_input_multi_select(mEcoreWindow);
321 // This ensures that we catch the window close (or delete) request
322 ecore_x_icccm_protocol_set(mEcoreWindow, ECORE_X_WM_PROTOCOL_DELETE_REQUEST, EINA_TRUE);
324 // Enable Drag & Drop
325 ecore_x_dnd_aware_set(mEcoreWindow, EINA_TRUE);
327 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_X_EVENT_WINDOW_CONFIGURE, EcoreEventWindowConfigure, this));
328 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_X_EVENT_WINDOW_PROPERTY, EcoreEventWindowPropertyChanged, this));
329 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_X_EVENT_WINDOW_DELETE_REQUEST, EcoreEventWindowDeleteRequest, this));
331 // Register window focus events
332 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_X_EVENT_WINDOW_FOCUS_IN, EcoreEventWindowFocusIn, this));
333 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_X_EVENT_WINDOW_FOCUS_OUT, EcoreEventWindowFocusOut, this));
335 // Register Window damage events
336 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_X_EVENT_WINDOW_DAMAGE, EcoreEventWindowDamaged, this));
338 // Register Touch events
339 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_DOWN, EcoreEventMouseButtonDown, this));
340 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_UP, EcoreEventMouseButtonUp, this));
341 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_EVENT_MOUSE_MOVE, EcoreEventMouseButtonMove, this));
342 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_EVENT_MOUSE_OUT, EcoreEventMouseButtonUp, this)); // process mouse out event like up event
344 // Register Mouse wheel events
345 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_EVENT_MOUSE_WHEEL, EcoreEventMouseWheel, this));
347 // Register Key events
348 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_EVENT_KEY_DOWN, EcoreEventKeyDown, this));
349 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_EVENT_KEY_UP, EcoreEventKeyUp, this));
351 // Register Selection event
352 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_X_EVENT_SELECTION_CLEAR, EcoreEventSelectionClear, this));
353 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_X_EVENT_SELECTION_NOTIFY, EcoreEventSelectionNotify, this));
356 void WindowBaseEcoreX::OnWindowConfigure(void* event)
358 auto configure = static_cast<Ecore_X_Event_Window_Configure*>(event);
359 if(configure->win == mEcoreWindow)
361 Dali::PositionSize positionSize;
362 positionSize.x = configure->x;
363 positionSize.y = configure->y;
364 positionSize.width = configure->w;
365 positionSize.height = configure->h;
366 mUpdatePositionSizeSignal.Emit(positionSize);
370 Eina_Bool WindowBaseEcoreX::OnWindowPropertyChanged(void* data, int type, void* event)
372 Ecore_X_Event_Window_Property* propertyChangedEvent = static_cast<Ecore_X_Event_Window_Property*>(event);
373 Eina_Bool handled(ECORE_CALLBACK_PASS_ON);
375 if(propertyChangedEvent->win == mEcoreWindow)
377 Ecore_X_Window_State_Hint state(ecore_x_icccm_state_get(propertyChangedEvent->win));
381 case ECORE_X_WINDOW_STATE_HINT_WITHDRAWN:
383 // Window was hidden.
384 mIconifyChangedSignal.Emit(true);
385 handled = ECORE_CALLBACK_DONE;
388 case ECORE_X_WINDOW_STATE_HINT_ICONIC:
390 // Window was iconified (minimised).
391 mIconifyChangedSignal.Emit(true);
392 handled = ECORE_CALLBACK_DONE;
395 case ECORE_X_WINDOW_STATE_HINT_NORMAL:
398 mIconifyChangedSignal.Emit(false);
399 handled = ECORE_CALLBACK_DONE;
413 void WindowBaseEcoreX::OnDeleteRequest()
415 mDeleteRequestSignal.Emit();
418 void WindowBaseEcoreX::OnFocusIn(void* data, int type, void* event)
420 Ecore_X_Event_Window_Focus_In* focusInEvent = static_cast<Ecore_X_Event_Window_Focus_In*>(event);
422 if(focusInEvent->win == mEcoreWindow)
424 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "Window EcoreEventWindowFocusIn\n");
426 mFocusChangedSignal.Emit(true);
430 void WindowBaseEcoreX::OnFocusOut(void* data, int type, void* event)
432 Ecore_X_Event_Window_Focus_Out* focusOutEvent = static_cast<Ecore_X_Event_Window_Focus_Out*>(event);
434 // If the window loses focus then hide the keyboard.
435 if(focusOutEvent->win == mEcoreWindow)
437 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "Window EcoreEventWindowFocusOut\n");
439 mFocusChangedSignal.Emit(false);
443 void WindowBaseEcoreX::OnWindowDamaged(void* data, int type, void* event)
445 Ecore_X_Event_Window_Damage* windowDamagedEvent = static_cast<Ecore_X_Event_Window_Damage*>(event);
447 if(windowDamagedEvent->win == mEcoreWindow)
450 area.x = windowDamagedEvent->x;
451 area.y = windowDamagedEvent->y;
452 area.width = windowDamagedEvent->w;
453 area.height = windowDamagedEvent->h;
455 mWindowDamagedSignal.Emit(area);
459 void WindowBaseEcoreX::OnMouseButtonDown(void* data, int type, void* event)
461 Ecore_Event_Mouse_Button* touchEvent = static_cast<Ecore_Event_Mouse_Button*>(event);
463 if(touchEvent->window == mEcoreWindow)
465 PointState::Type state(PointState::DOWN);
467 Integration::Point point;
468 point.SetDeviceId(touchEvent->multi.device);
469 point.SetState(state);
470 point.SetScreenPosition(Vector2(touchEvent->x, touchEvent->y));
471 point.SetRadius(touchEvent->multi.radius, Vector2(touchEvent->multi.radius_x, touchEvent->multi.radius_y));
472 point.SetPressure(touchEvent->multi.pressure);
473 point.SetAngle(Degree(touchEvent->multi.angle));
474 if(touchEvent->buttons)
476 point.SetMouseButton(static_cast<MouseButton::Type>(touchEvent->buttons));
479 mTouchEventSignal.Emit(point, touchEvent->timestamp);
483 void WindowBaseEcoreX::OnMouseButtonUp(void* data, int type, void* event)
485 Ecore_Event_Mouse_Button* touchEvent = static_cast<Ecore_Event_Mouse_Button*>(event);
487 if(touchEvent->window == mEcoreWindow)
489 Integration::Point point;
490 point.SetDeviceId(touchEvent->multi.device);
491 point.SetState(PointState::UP);
492 point.SetScreenPosition(Vector2(touchEvent->x, touchEvent->y));
493 point.SetRadius(touchEvent->multi.radius, Vector2(touchEvent->multi.radius_x, touchEvent->multi.radius_y));
494 point.SetPressure(touchEvent->multi.pressure);
495 point.SetAngle(Degree(static_cast<float>(touchEvent->multi.angle)));
496 if(touchEvent->buttons)
498 point.SetMouseButton(static_cast<MouseButton::Type>(touchEvent->buttons));
501 mTouchEventSignal.Emit(point, touchEvent->timestamp);
505 void WindowBaseEcoreX::OnMouseButtonMove(void* data, int type, void* event)
507 Ecore_Event_Mouse_Move* touchEvent = static_cast<Ecore_Event_Mouse_Move*>(event);
509 if(touchEvent->window == mEcoreWindow)
511 Integration::Point point;
512 point.SetDeviceId(touchEvent->multi.device);
513 point.SetState(PointState::MOTION);
514 point.SetScreenPosition(Vector2(static_cast<float>(touchEvent->x), static_cast<float>(touchEvent->y)));
515 point.SetRadius(static_cast<float>(touchEvent->multi.radius), Vector2(static_cast<float>(touchEvent->multi.radius_x), static_cast<float>(touchEvent->multi.radius_y)));
516 point.SetPressure(static_cast<float>(touchEvent->multi.pressure));
517 point.SetAngle(Degree(static_cast<float>(touchEvent->multi.angle)));
519 mTouchEventSignal.Emit(point, touchEvent->timestamp);
523 void WindowBaseEcoreX::OnMouseWheel(void* data, int type, void* event)
525 Ecore_Event_Mouse_Wheel* mouseWheelEvent = static_cast<Ecore_Event_Mouse_Wheel*>(event);
527 if(mouseWheelEvent->window == mEcoreWindow)
529 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);
531 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 mWheelEventSignal.Emit(wheelEvent);
537 void WindowBaseEcoreX::OnKeyDown(void* data, int type, void* event)
539 Ecore_Event_Key* keyEvent = static_cast<Ecore_Event_Key*>(event);
541 if(keyEvent->window == mEcoreWindow)
543 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreX::OnKeyDown\n");
545 std::string keyName(keyEvent->keyname);
546 std::string logicalKey("");
547 std::string keyString("");
548 std::string compose("");
550 // Ensure key compose string is not NULL as keys like SHIFT or arrow have a null string.
551 if(keyEvent->compose)
553 compose = keyEvent->compose;
556 // Ensure key symbol is not NULL as keys like SHIFT have a null string.
559 logicalKey = keyEvent->key;
562 int keyCode = ecore_x_keysym_keycode_get(keyEvent->keyname);
563 int modifier(keyEvent->modifiers);
564 unsigned long time = keyEvent->timestamp;
566 // Ensure key event string is not NULL as keys like SHIFT have a null string.
569 keyString = keyEvent->string;
572 Integration::KeyEvent keyEvent(keyName, logicalKey, keyString, keyCode, modifier, time, Integration::KeyEvent::DOWN, compose, DEFAULT_DEVICE_NAME, DEFAULT_DEVICE_CLASS, DEFAULT_DEVICE_SUBCLASS);
574 mKeyEventSignal.Emit(keyEvent);
578 void WindowBaseEcoreX::OnKeyUp(void* data, int type, void* event)
580 Ecore_Event_Key* keyEvent = static_cast<Ecore_Event_Key*>(event);
582 if(keyEvent->window == mEcoreWindow)
584 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, " WindowBaseEcoreX::OnKeyUp\n");
586 std::string keyName(keyEvent->keyname);
587 std::string logicalKey("");
588 std::string keyString("");
589 std::string compose("");
591 // Ensure key compose string is not NULL as keys like SHIFT or arrow have a null string.
592 if(keyEvent->compose)
594 compose = keyEvent->compose;
596 // Ensure key symbol is not NULL as keys like SHIFT have a null string.
599 logicalKey = keyEvent->key;
602 int keyCode = ecore_x_keysym_keycode_get(keyEvent->keyname);
603 int modifier(keyEvent->modifiers);
604 unsigned long time(keyEvent->timestamp);
606 // Ensure key event string is not NULL as keys like SHIFT have a null string.
609 keyString = keyEvent->string;
612 Integration::KeyEvent keyEvent(keyName, logicalKey, keyString, keyCode, modifier, time, Integration::KeyEvent::UP, compose, DEFAULT_DEVICE_NAME, DEFAULT_DEVICE_CLASS, DEFAULT_DEVICE_SUBCLASS);
614 mKeyEventSignal.Emit(keyEvent);
618 void WindowBaseEcoreX::OnSelectionClear(void* data, int type, void* event)
620 Ecore_X_Event_Selection_Clear* selectionClearEvent = static_cast<Ecore_X_Event_Selection_Clear*>(event);
622 if(selectionClearEvent->win == mEcoreWindow)
624 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Concise, " WindowBaseEcoreX::OnSelectionClear\n");
626 if(selectionClearEvent->selection == ECORE_X_SELECTION_SECONDARY)
628 // Request to get the content from Ecore.
629 ecore_x_selection_secondary_request(selectionClearEvent->win, ECORE_X_SELECTION_TARGET_TEXT);
634 void WindowBaseEcoreX::OnSelectionNotify(void* data, int type, void* event)
636 Ecore_X_Event_Selection_Notify* selectionNotifyEvent = static_cast<Ecore_X_Event_Selection_Notify*>(event);
638 if(selectionNotifyEvent->win == mEcoreWindow)
640 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Concise, " WindowBaseEcoreX::OnSelectionNotify\n");
642 Ecore_X_Selection_Data* selectionData = static_cast<Ecore_X_Selection_Data*>(selectionNotifyEvent->data);
643 if(selectionData->data)
645 if(selectionNotifyEvent->selection == ECORE_X_SELECTION_SECONDARY)
647 mSelectionDataReceivedSignal.Emit(event);
653 Any WindowBaseEcoreX::GetNativeWindow()
658 int WindowBaseEcoreX::GetNativeWindowId()
663 std::string WindowBaseEcoreX::GetNativeWindowResourceId()
665 return std::string();
668 EGLNativeWindowType WindowBaseEcoreX::CreateEglWindow(int width, int height)
670 // need to create X handle as in 64bit system ECore handle is 32 bit whereas EGLnative and XWindow are 64 bit
671 XWindow window(mEcoreWindow);
672 return reinterpret_cast<EGLNativeWindowType>(window);
675 void WindowBaseEcoreX::DestroyEglWindow()
679 void WindowBaseEcoreX::SetEglWindowRotation(int angle)
683 void WindowBaseEcoreX::SetEglWindowBufferTransform(int angle)
687 void WindowBaseEcoreX::SetEglWindowTransform(int angle)
691 void WindowBaseEcoreX::ResizeEglWindow(PositionSize positionSize)
695 bool WindowBaseEcoreX::IsEglWindowRotationSupported()
700 void WindowBaseEcoreX::Move(PositionSize positionSize)
702 ecore_x_window_move(mEcoreWindow, positionSize.x, positionSize.y);
705 void WindowBaseEcoreX::Resize(PositionSize positionSize)
707 ecore_x_window_resize(mEcoreWindow, positionSize.width, positionSize.height);
710 void WindowBaseEcoreX::MoveResize(PositionSize positionSize)
712 ecore_x_window_move_resize(mEcoreWindow, positionSize.x, positionSize.y, positionSize.width, positionSize.height);
715 void WindowBaseEcoreX::SetClass(const std::string& name, const std::string& className)
717 ecore_x_icccm_title_set(mEcoreWindow, name.c_str());
718 ecore_x_netwm_name_set(mEcoreWindow, name.c_str());
719 ecore_x_icccm_name_class_set(mEcoreWindow, name.c_str(), className.c_str());
722 void WindowBaseEcoreX::Raise()
724 ecore_x_window_raise(mEcoreWindow);
727 void WindowBaseEcoreX::Lower()
729 ecore_x_window_lower(mEcoreWindow);
732 void WindowBaseEcoreX::Activate()
734 ecore_x_netwm_client_active_request(ecore_x_window_root_get(mEcoreWindow), mEcoreWindow, 1 /* request type, 1:application, 2:pager */, 0);
737 void WindowBaseEcoreX::Maximize(bool maximize)
741 bool WindowBaseEcoreX::IsMaximized() const
746 void WindowBaseEcoreX::SetMaximumSize(Dali::Window::WindowSize size)
750 void WindowBaseEcoreX::Minimize(bool minimize)
754 bool WindowBaseEcoreX::IsMinimized() const
759 void WindowBaseEcoreX::SetMimimumSize(Dali::Window::WindowSize size)
763 void WindowBaseEcoreX::SetAvailableAnlges(const std::vector<int>& angles)
767 void WindowBaseEcoreX::SetPreferredAngle(int angle)
771 void WindowBaseEcoreX::SetAcceptFocus(bool accept)
775 void WindowBaseEcoreX::Show()
777 ecore_x_window_show(mEcoreWindow);
780 void WindowBaseEcoreX::Hide()
782 ecore_x_window_hide(mEcoreWindow);
785 unsigned int WindowBaseEcoreX::GetSupportedAuxiliaryHintCount() const
790 std::string WindowBaseEcoreX::GetSupportedAuxiliaryHint(unsigned int index) const
792 return std::string();
795 unsigned int WindowBaseEcoreX::AddAuxiliaryHint(const std::string& hint, const std::string& value)
800 bool WindowBaseEcoreX::RemoveAuxiliaryHint(unsigned int id)
805 bool WindowBaseEcoreX::SetAuxiliaryHintValue(unsigned int id, const std::string& value)
810 std::string WindowBaseEcoreX::GetAuxiliaryHintValue(unsigned int id) const
812 return std::string();
815 unsigned int WindowBaseEcoreX::GetAuxiliaryHintId(const std::string& hint) const
820 void WindowBaseEcoreX::SetInputRegion(const Rect<int>& inputRegion)
824 void WindowBaseEcoreX::SetType(Dali::WindowType type)
828 Dali::WindowType WindowBaseEcoreX::GetType() const
830 return Dali::WindowType::NORMAL;
833 Dali::WindowOperationResult WindowBaseEcoreX::SetNotificationLevel(Dali::WindowNotificationLevel level)
835 return Dali::WindowOperationResult::NOT_SUPPORTED;
838 Dali::WindowNotificationLevel WindowBaseEcoreX::GetNotificationLevel() const
840 return Dali::WindowNotificationLevel::NONE;
843 void WindowBaseEcoreX::SetOpaqueState(bool opaque)
847 Dali::WindowOperationResult WindowBaseEcoreX::SetScreenOffMode(WindowScreenOffMode screenOffMode)
849 return Dali::WindowOperationResult::NOT_SUPPORTED;
852 WindowScreenOffMode WindowBaseEcoreX::GetScreenOffMode() const
854 return WindowScreenOffMode::TIMEOUT;
857 Dali::WindowOperationResult WindowBaseEcoreX::SetBrightness(int brightness)
859 return Dali::WindowOperationResult::NOT_SUPPORTED;
862 int WindowBaseEcoreX::GetBrightness() const
867 bool WindowBaseEcoreX::GrabKey(Dali::KEY key, KeyGrab::KeyGrabMode grabMode)
872 bool WindowBaseEcoreX::UngrabKey(Dali::KEY key)
877 bool WindowBaseEcoreX::GrabKeyList(const Dali::Vector<Dali::KEY>& key, const Dali::Vector<KeyGrab::KeyGrabMode>& grabMode, Dali::Vector<bool>& result)
882 bool WindowBaseEcoreX::UngrabKeyList(const Dali::Vector<Dali::KEY>& key, Dali::Vector<bool>& result)
887 void WindowBaseEcoreX::GetDpi(unsigned int& dpiHorizontal, unsigned int& dpiVertical)
889 // 1 inch = 25.4 millimeters
890 // ecore does not account for differing DPI in the x and y axes, so only get for x is available
892 dpiHorizontal = ecore_x_dpi_get();
893 dpiVertical = ecore_x_dpi_get();
896 int WindowBaseEcoreX::GetWindowRotationAngle() const
901 int WindowBaseEcoreX::GetScreenRotationAngle()
906 void WindowBaseEcoreX::SetWindowRotationAngle(int degree)
908 mWindowRotationAngle = degree;
911 void WindowBaseEcoreX::WindowRotationCompleted(int degree, int width, int height)
915 void WindowBaseEcoreX::SetTransparency(bool transparent)
919 unsigned int WindowBaseEcoreX::GetSurfaceId(Any surface) const
921 unsigned int surfaceId = 0;
923 if(surface.Empty() == false)
925 // check we have a valid type
926 DALI_ASSERT_ALWAYS(((surface.GetType() == typeid(XWindow)) || (surface.GetType() == typeid(Ecore_X_Window))) && "Surface type is invalid");
928 if(surface.GetType() == typeid(Ecore_X_Window))
930 surfaceId = AnyCast<Ecore_X_Window>(surface);
934 surfaceId = static_cast<unsigned int>(AnyCast<XWindow>(surface));
940 void WindowBaseEcoreX::CreateWindow(PositionSize positionSize, bool isTransparent)
944 // create 32 bit window
945 mEcoreWindow = ecore_x_window_argb_new(0, positionSize.x, positionSize.y, positionSize.width, positionSize.height);
946 mIsTransparent = true;
950 // create 24 bit window
951 mEcoreWindow = ecore_x_window_new(0, positionSize.x, positionSize.y, positionSize.width, positionSize.height);
954 if(mEcoreWindow == 0)
956 DALI_ASSERT_ALWAYS(0 && "Failed to create X window");
960 void WindowBaseEcoreX::SetParent(WindowBase* parentWinBase, bool belowParent)
962 Ecore_X_Window ecoreParent = 0;
965 WindowBaseEcoreX* winBaseEcoreX = static_cast<WindowBaseEcoreX*>(parentWinBase);
966 ecoreParent = winBaseEcoreX->mEcoreWindow;
967 ecore_x_icccm_transient_for_set(mEcoreWindow, ecoreParent);
972 ecore_x_icccm_transient_for_unset(mEcoreWindow);
976 int WindowBaseEcoreX::CreateFrameRenderedSyncFence()
981 int WindowBaseEcoreX::CreateFramePresentedSyncFence()
986 void WindowBaseEcoreX::SetPositionSizeWithAngle(PositionSize positionSize, int angle)
990 void WindowBaseEcoreX::InitializeIme()
994 void WindowBaseEcoreX::ImeWindowReadyToRender()
998 void WindowBaseEcoreX::RequestMoveToServer()
1002 void WindowBaseEcoreX::RequestResizeToServer(WindowResizeDirection direction)
1006 void WindowBaseEcoreX::EnableFloatingMode(bool enable)
1010 bool WindowBaseEcoreX::IsFloatingModeEnabled() const
1015 void WindowBaseEcoreX::IncludeInputRegion(const Rect<int>& inputRegion)
1019 void WindowBaseEcoreX::ExcludeInputRegion(const Rect<int>& inputRegion)
1023 } // namespace Adaptor
1025 } // namespace Internal