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/ubuntu-x11/ecore-x-types.h>
27 #include <dali/integration-api/debug.h>
28 #include <dali/internal/input/ubuntu-x11/dali-ecore-input.h>
29 #include <dali/public-api/events/mouse-button.h>
30 #include <dali/public-api/object/any.h>
40 const char* DEFAULT_DEVICE_NAME = "";
41 const Device::Class::Type DEFAULT_DEVICE_CLASS = Device::Class::NONE;
42 const Device::Subclass::Type DEFAULT_DEVICE_SUBCLASS = Device::Subclass::NONE;
44 const unsigned int PRIMARY_TOUCH_BUTTON_ID(1);
46 #if defined(DEBUG_ENABLED)
47 Debug::Filter* gWindowBaseLogFilter = Debug::Filter::New(Debug::NoLogging, false, "LOG_WINDOW_BASE");
50 /////////////////////////////////////////////////////////////////////////////////////////////////
52 /////////////////////////////////////////////////////////////////////////////////////////////////
54 static Eina_Bool EcoreEventWindowConfigure(void* data, int type, void* event)
56 WindowBaseEcoreX* windowBase = static_cast<WindowBaseEcoreX*>(data);
59 windowBase->OnWindowConfigure(event);
62 return ECORE_CALLBACK_PASS_ON;
65 static Eina_Bool EcoreEventWindowPropertyChanged(void* data, int type, void* event)
67 WindowBaseEcoreX* windowBase = static_cast<WindowBaseEcoreX*>(data);
70 return windowBase->OnWindowPropertyChanged(data, type, event);
73 return ECORE_CALLBACK_PASS_ON;
77 * Called when the window receives a delete request
79 static Eina_Bool EcoreEventWindowDeleteRequest(void* data, int type, void* event)
81 WindowBaseEcoreX* windowBase = static_cast<WindowBaseEcoreX*>(data);
84 windowBase->OnDeleteRequest();
86 return ECORE_CALLBACK_DONE;
90 * Called when the window gains focus.
92 static Eina_Bool EcoreEventWindowFocusIn(void* data, int type, void* event)
94 WindowBaseEcoreX* windowBase = static_cast<WindowBaseEcoreX*>(data);
97 windowBase->OnFocusIn(data, type, event);
99 return ECORE_CALLBACK_PASS_ON;
103 * Called when the window loses focus.
105 static Eina_Bool EcoreEventWindowFocusOut(void* data, int type, void* event)
107 WindowBaseEcoreX* windowBase = static_cast<WindowBaseEcoreX*>(data);
110 windowBase->OnFocusOut(data, type, event);
112 return ECORE_CALLBACK_PASS_ON;
116 * Called when the window is damaged.
118 static Eina_Bool EcoreEventWindowDamaged(void* data, int type, void* event)
120 WindowBaseEcoreX* windowBase = static_cast<WindowBaseEcoreX*>(data);
123 windowBase->OnWindowDamaged(data, type, event);
126 return ECORE_CALLBACK_PASS_ON;
129 /////////////////////////////////////////////////////////////////////////////////////////////////
130 // Selection Callbacks
131 /////////////////////////////////////////////////////////////////////////////////////////////////
134 * Called when the source window notifies us the content in clipboard is selected.
136 static Eina_Bool EcoreEventSelectionClear(void* data, int type, void* event)
138 WindowBaseEcoreX* windowBase = static_cast<WindowBaseEcoreX*>(data);
141 windowBase->OnSelectionClear(data, type, event);
143 return ECORE_CALLBACK_PASS_ON;
147 * Called when the source window sends us about the selected content.
148 * For example, when dragged items are dragged INTO our window or when items are selected in the clipboard.
150 static Eina_Bool EcoreEventSelectionNotify(void* data, int type, void* event)
152 WindowBaseEcoreX* windowBase = static_cast<WindowBaseEcoreX*>(data);
155 windowBase->OnSelectionNotify(data, type, event);
157 return ECORE_CALLBACK_PASS_ON;
160 /////////////////////////////////////////////////////////////////////////////////////////////////
162 /////////////////////////////////////////////////////////////////////////////////////////////////
165 * Called when a touch down is received.
167 static Eina_Bool EcoreEventMouseButtonDown(void* data, int type, void* event)
169 WindowBaseEcoreX* windowBase = static_cast<WindowBaseEcoreX*>(data);
172 windowBase->OnMouseButtonDown(data, type, event);
174 return ECORE_CALLBACK_PASS_ON;
178 * Called when a touch up is received.
180 static Eina_Bool EcoreEventMouseButtonUp(void* data, int type, void* event)
182 WindowBaseEcoreX* windowBase = static_cast<WindowBaseEcoreX*>(data);
185 windowBase->OnMouseButtonUp(data, type, event);
187 return ECORE_CALLBACK_PASS_ON;
191 * Called when a touch motion is received.
193 static Eina_Bool EcoreEventMouseButtonMove(void* data, int type, void* event)
195 WindowBaseEcoreX* windowBase = static_cast<WindowBaseEcoreX*>(data);
198 windowBase->OnMouseButtonMove(data, type, event);
200 return ECORE_CALLBACK_PASS_ON;
203 /////////////////////////////////////////////////////////////////////////////////////////////////
205 /////////////////////////////////////////////////////////////////////////////////////////////////
208 * Called when a mouse wheel is received.
210 static Eina_Bool EcoreEventMouseWheel(void* data, int type, void* event)
212 WindowBaseEcoreX* windowBase = static_cast<WindowBaseEcoreX*>(data);
215 windowBase->OnMouseWheel(data, type, event);
217 return ECORE_CALLBACK_PASS_ON;
220 /////////////////////////////////////////////////////////////////////////////////////////////////
222 /////////////////////////////////////////////////////////////////////////////////////////////////
225 * Called when a key down is received.
227 static Eina_Bool EcoreEventKeyDown(void* data, int type, void* event)
229 WindowBaseEcoreX* windowBase = static_cast<WindowBaseEcoreX*>(data);
232 windowBase->OnKeyDown(data, type, event);
234 return ECORE_CALLBACK_PASS_ON;
238 * Called when a key up is received.
240 static Eina_Bool EcoreEventKeyUp(void* data, int type, void* event)
242 WindowBaseEcoreX* windowBase = static_cast<WindowBaseEcoreX*>(data);
245 windowBase->OnKeyUp(data, type, event);
247 return ECORE_CALLBACK_PASS_ON;
250 } // unnamed namespace
252 WindowBaseEcoreX::WindowBaseEcoreX(Dali::PositionSize positionSize, Any surface, bool isTransparent)
253 : mEcoreEventHandler(),
256 mIsTransparent(false), // Should only be set to true once we actually create a transparent window regardless of what isTransparent is.
257 mRotationAppSet(false),
258 mWindowRotationAngle(0)
260 Initialize(positionSize, surface, isTransparent);
263 WindowBaseEcoreX::~WindowBaseEcoreX()
265 for(Dali::Vector<Ecore_Event_Handler*>::Iterator iter = mEcoreEventHandler.Begin(), endIter = mEcoreEventHandler.End(); iter != endIter; ++iter)
267 ecore_event_handler_del(*iter);
269 mEcoreEventHandler.Clear();
273 ecore_x_window_free(mEcoreWindow);
277 void WindowBaseEcoreX::Initialize(PositionSize positionSize, Any surface, bool isTransparent)
279 // see if there is a surface in Any surface
280 unsigned int surfaceId = GetSurfaceId(surface);
282 // if the surface is empty, create a new one.
285 // we own the surface about to created
287 CreateWindow(positionSize, isTransparent);
291 // XLib should already be initialized so no point in calling XInitThreads
292 mEcoreWindow = static_cast<Ecore_X_Window>(surfaceId);
295 // set up etc properties to match with ecore-evas
297 if((id = getenv("DESKTOP_STARTUP_ID")))
299 ecore_x_netwm_startup_id_set(mEcoreWindow, id);
302 ecore_x_icccm_hints_set(mEcoreWindow,
304 ECORE_X_WINDOW_STATE_HINT_NORMAL, // initial_state
311 // we SHOULD guarantee the x11 window was created in x server.
314 ecore_x_input_multi_select(mEcoreWindow);
316 // This ensures that we catch the window close (or delete) request
317 ecore_x_icccm_protocol_set(mEcoreWindow, ECORE_X_WM_PROTOCOL_DELETE_REQUEST, EINA_TRUE);
319 // Enable Drag & Drop
320 ecore_x_dnd_aware_set(mEcoreWindow, EINA_TRUE);
322 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_X_EVENT_WINDOW_CONFIGURE, EcoreEventWindowConfigure, this));
323 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_X_EVENT_WINDOW_PROPERTY, EcoreEventWindowPropertyChanged, this));
324 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_X_EVENT_WINDOW_DELETE_REQUEST, EcoreEventWindowDeleteRequest, this));
326 // Register window focus events
327 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_X_EVENT_WINDOW_FOCUS_IN, EcoreEventWindowFocusIn, this));
328 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_X_EVENT_WINDOW_FOCUS_OUT, EcoreEventWindowFocusOut, this));
330 // Register Window damage events
331 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_X_EVENT_WINDOW_DAMAGE, EcoreEventWindowDamaged, this));
333 // Register Touch events
334 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_DOWN, EcoreEventMouseButtonDown, this));
335 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_UP, EcoreEventMouseButtonUp, this));
336 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_EVENT_MOUSE_MOVE, EcoreEventMouseButtonMove, this));
337 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_EVENT_MOUSE_OUT, EcoreEventMouseButtonUp, this)); // process mouse out event like up event
339 // Register Mouse wheel events
340 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_EVENT_MOUSE_WHEEL, EcoreEventMouseWheel, this));
342 // Register Key events
343 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_EVENT_KEY_DOWN, EcoreEventKeyDown, this));
344 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_EVENT_KEY_UP, EcoreEventKeyUp, this));
346 // Register Selection event
347 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_X_EVENT_SELECTION_CLEAR, EcoreEventSelectionClear, this));
348 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_X_EVENT_SELECTION_NOTIFY, EcoreEventSelectionNotify, this));
351 void WindowBaseEcoreX::OnWindowConfigure(void* event)
353 auto configure = static_cast<Ecore_X_Event_Window_Configure*>(event);
354 if(configure->win == mEcoreWindow)
356 Dali::PositionSize positionSize;
357 positionSize.x = configure->x;
358 positionSize.y = configure->y;
359 positionSize.width = configure->w;
360 positionSize.height = configure->h;
361 mUpdatePositionSizeSignal.Emit(positionSize);
365 Eina_Bool WindowBaseEcoreX::OnWindowPropertyChanged(void* data, int type, void* event)
367 Ecore_X_Event_Window_Property* propertyChangedEvent = static_cast<Ecore_X_Event_Window_Property*>(event);
368 Eina_Bool handled(ECORE_CALLBACK_PASS_ON);
370 if(propertyChangedEvent->win == mEcoreWindow)
372 Ecore_X_Window_State_Hint state(ecore_x_icccm_state_get(propertyChangedEvent->win));
376 case ECORE_X_WINDOW_STATE_HINT_WITHDRAWN:
378 // Window was hidden.
379 mIconifyChangedSignal.Emit(true);
380 handled = ECORE_CALLBACK_DONE;
383 case ECORE_X_WINDOW_STATE_HINT_ICONIC:
385 // Window was iconified (minimised).
386 mIconifyChangedSignal.Emit(true);
387 handled = ECORE_CALLBACK_DONE;
390 case ECORE_X_WINDOW_STATE_HINT_NORMAL:
393 mIconifyChangedSignal.Emit(false);
394 handled = ECORE_CALLBACK_DONE;
408 void WindowBaseEcoreX::OnDeleteRequest()
410 mDeleteRequestSignal.Emit();
413 void WindowBaseEcoreX::OnFocusIn(void* data, int type, void* event)
415 Ecore_X_Event_Window_Focus_In* focusInEvent = static_cast<Ecore_X_Event_Window_Focus_In*>(event);
417 if(focusInEvent->win == mEcoreWindow)
419 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "Window EcoreEventWindowFocusIn\n");
421 mFocusChangedSignal.Emit(true);
425 void WindowBaseEcoreX::OnFocusOut(void* data, int type, void* event)
427 Ecore_X_Event_Window_Focus_Out* focusOutEvent = static_cast<Ecore_X_Event_Window_Focus_Out*>(event);
429 // If the window loses focus then hide the keyboard.
430 if(focusOutEvent->win == mEcoreWindow)
432 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "Window EcoreEventWindowFocusOut\n");
434 mFocusChangedSignal.Emit(false);
438 void WindowBaseEcoreX::OnWindowDamaged(void* data, int type, void* event)
440 Ecore_X_Event_Window_Damage* windowDamagedEvent = static_cast<Ecore_X_Event_Window_Damage*>(event);
442 if(windowDamagedEvent->win == mEcoreWindow)
445 area.x = windowDamagedEvent->x;
446 area.y = windowDamagedEvent->y;
447 area.width = windowDamagedEvent->w;
448 area.height = windowDamagedEvent->h;
450 mWindowDamagedSignal.Emit(area);
454 void WindowBaseEcoreX::OnMouseButtonDown(void* data, int type, void* event)
456 Ecore_Event_Mouse_Button* touchEvent = static_cast<Ecore_Event_Mouse_Button*>(event);
458 if(touchEvent->window == mEcoreWindow)
460 PointState::Type state(PointState::DOWN);
462 Integration::Point point;
463 point.SetDeviceId(touchEvent->multi.device);
464 point.SetState(state);
465 point.SetScreenPosition(Vector2(touchEvent->x, touchEvent->y));
466 point.SetRadius(touchEvent->multi.radius, Vector2(touchEvent->multi.radius_x, touchEvent->multi.radius_y));
467 point.SetPressure(touchEvent->multi.pressure);
468 point.SetAngle(Degree(touchEvent->multi.angle));
469 if(touchEvent->buttons)
471 point.SetMouseButton(static_cast<MouseButton::Type>(touchEvent->buttons));
474 mTouchEventSignal.Emit(point, touchEvent->timestamp);
478 void WindowBaseEcoreX::OnMouseButtonUp(void* data, int type, void* event)
480 Ecore_Event_Mouse_Button* touchEvent = static_cast<Ecore_Event_Mouse_Button*>(event);
482 if(touchEvent->window == mEcoreWindow)
484 Integration::Point point;
485 point.SetDeviceId(touchEvent->multi.device);
486 point.SetState(PointState::UP);
487 point.SetScreenPosition(Vector2(touchEvent->x, touchEvent->y));
488 point.SetRadius(touchEvent->multi.radius, Vector2(touchEvent->multi.radius_x, touchEvent->multi.radius_y));
489 point.SetPressure(touchEvent->multi.pressure);
490 point.SetAngle(Degree(static_cast<float>(touchEvent->multi.angle)));
491 if(touchEvent->buttons)
493 point.SetMouseButton(static_cast<MouseButton::Type>(touchEvent->buttons));
496 mTouchEventSignal.Emit(point, touchEvent->timestamp);
500 void WindowBaseEcoreX::OnMouseButtonMove(void* data, int type, void* event)
502 Ecore_Event_Mouse_Move* touchEvent = static_cast<Ecore_Event_Mouse_Move*>(event);
504 if(touchEvent->window == mEcoreWindow)
506 Integration::Point point;
507 point.SetDeviceId(touchEvent->multi.device);
508 point.SetState(PointState::MOTION);
509 point.SetScreenPosition(Vector2(static_cast<float>(touchEvent->x), static_cast<float>(touchEvent->y)));
510 point.SetRadius(static_cast<float>(touchEvent->multi.radius), Vector2(static_cast<float>(touchEvent->multi.radius_x), static_cast<float>(touchEvent->multi.radius_y)));
511 point.SetPressure(static_cast<float>(touchEvent->multi.pressure));
512 point.SetAngle(Degree(static_cast<float>(touchEvent->multi.angle)));
514 mTouchEventSignal.Emit(point, touchEvent->timestamp);
518 void WindowBaseEcoreX::OnMouseWheel(void* data, int type, void* event)
520 Ecore_Event_Mouse_Wheel* mouseWheelEvent = static_cast<Ecore_Event_Mouse_Wheel*>(event);
522 if(mouseWheelEvent->window == mEcoreWindow)
524 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);
526 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);
528 mWheelEventSignal.Emit(wheelEvent);
532 void WindowBaseEcoreX::OnKeyDown(void* data, int type, void* event)
534 Ecore_Event_Key* keyEvent = static_cast<Ecore_Event_Key*>(event);
536 if(keyEvent->window == mEcoreWindow)
538 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreX::OnKeyDown\n");
540 std::string keyName(keyEvent->keyname);
541 std::string logicalKey("");
542 std::string keyString("");
543 std::string compose("");
545 // Ensure key compose string is not NULL as keys like SHIFT or arrow have a null string.
546 if(keyEvent->compose)
548 compose = keyEvent->compose;
551 // Ensure key symbol is not NULL as keys like SHIFT have a null string.
554 logicalKey = keyEvent->key;
557 int keyCode = ecore_x_keysym_keycode_get(keyEvent->keyname);
558 int modifier(keyEvent->modifiers);
559 unsigned long time = keyEvent->timestamp;
561 // Ensure key event string is not NULL as keys like SHIFT have a null string.
564 keyString = keyEvent->string;
567 Integration::KeyEvent keyEvent(keyName, logicalKey, keyString, keyCode, modifier, time, Integration::KeyEvent::DOWN, compose, DEFAULT_DEVICE_NAME, DEFAULT_DEVICE_CLASS, DEFAULT_DEVICE_SUBCLASS);
569 mKeyEventSignal.Emit(keyEvent);
573 void WindowBaseEcoreX::OnKeyUp(void* data, int type, void* event)
575 Ecore_Event_Key* keyEvent = static_cast<Ecore_Event_Key*>(event);
577 if(keyEvent->window == mEcoreWindow)
579 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, " WindowBaseEcoreX::OnKeyUp\n");
581 std::string keyName(keyEvent->keyname);
582 std::string logicalKey("");
583 std::string keyString("");
584 std::string compose("");
586 // Ensure key compose string is not NULL as keys like SHIFT or arrow have a null string.
587 if(keyEvent->compose)
589 compose = keyEvent->compose;
591 // Ensure key symbol is not NULL as keys like SHIFT have a null string.
594 logicalKey = keyEvent->key;
597 int keyCode = ecore_x_keysym_keycode_get(keyEvent->keyname);
598 int modifier(keyEvent->modifiers);
599 unsigned long time(keyEvent->timestamp);
601 // Ensure key event string is not NULL as keys like SHIFT have a null string.
604 keyString = keyEvent->string;
607 Integration::KeyEvent keyEvent(keyName, logicalKey, keyString, keyCode, modifier, time, Integration::KeyEvent::UP, compose, DEFAULT_DEVICE_NAME, DEFAULT_DEVICE_CLASS, DEFAULT_DEVICE_SUBCLASS);
609 mKeyEventSignal.Emit(keyEvent);
613 void WindowBaseEcoreX::OnSelectionClear(void* data, int type, void* event)
615 Ecore_X_Event_Selection_Clear* selectionClearEvent = static_cast<Ecore_X_Event_Selection_Clear*>(event);
617 if(selectionClearEvent->win == mEcoreWindow)
619 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Concise, " WindowBaseEcoreX::OnSelectionClear\n");
621 if(selectionClearEvent->selection == ECORE_X_SELECTION_SECONDARY)
623 // Request to get the content from Ecore.
624 ecore_x_selection_secondary_request(selectionClearEvent->win, ECORE_X_SELECTION_TARGET_TEXT);
629 void WindowBaseEcoreX::OnSelectionNotify(void* data, int type, void* event)
631 Ecore_X_Event_Selection_Notify* selectionNotifyEvent = static_cast<Ecore_X_Event_Selection_Notify*>(event);
633 if(selectionNotifyEvent->win == mEcoreWindow)
635 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Concise, " WindowBaseEcoreX::OnSelectionNotify\n");
637 Ecore_X_Selection_Data* selectionData = static_cast<Ecore_X_Selection_Data*>(selectionNotifyEvent->data);
638 if(selectionData->data)
640 if(selectionNotifyEvent->selection == ECORE_X_SELECTION_SECONDARY)
642 mSelectionDataReceivedSignal.Emit(event);
648 Any WindowBaseEcoreX::GetNativeWindow()
653 int WindowBaseEcoreX::GetNativeWindowId()
658 std::string WindowBaseEcoreX::GetNativeWindowResourceId()
660 return std::string();
663 EGLNativeWindowType WindowBaseEcoreX::CreateEglWindow(int width, int height)
665 // need to create X handle as in 64bit system ECore handle is 32 bit whereas EGLnative and XWindow are 64 bit
666 XWindow window(mEcoreWindow);
667 return reinterpret_cast<EGLNativeWindowType>(window);
670 void WindowBaseEcoreX::DestroyEglWindow()
674 void WindowBaseEcoreX::SetEglWindowRotation(int angle)
678 void WindowBaseEcoreX::SetEglWindowBufferTransform(int angle)
682 void WindowBaseEcoreX::SetEglWindowTransform(int angle)
686 void WindowBaseEcoreX::ResizeEglWindow(PositionSize positionSize)
690 bool WindowBaseEcoreX::IsEglWindowRotationSupported()
695 void WindowBaseEcoreX::Move(PositionSize positionSize)
697 ecore_x_window_move(mEcoreWindow, positionSize.x, positionSize.y);
700 void WindowBaseEcoreX::Resize(PositionSize positionSize)
702 ecore_x_window_resize(mEcoreWindow, positionSize.width, positionSize.height);
705 void WindowBaseEcoreX::MoveResize(PositionSize positionSize)
707 ecore_x_window_move_resize(mEcoreWindow, positionSize.x, positionSize.y, positionSize.width, positionSize.height);
710 void WindowBaseEcoreX::SetLayout(unsigned int numCols, unsigned int numRows, unsigned int column, unsigned int row, unsigned int colSpan, unsigned int rowSpan)
714 void WindowBaseEcoreX::SetClass(const std::string& name, const std::string& className)
716 ecore_x_icccm_title_set(mEcoreWindow, name.c_str());
717 ecore_x_netwm_name_set(mEcoreWindow, name.c_str());
718 ecore_x_icccm_name_class_set(mEcoreWindow, name.c_str(), className.c_str());
721 void WindowBaseEcoreX::Raise()
723 ecore_x_window_raise(mEcoreWindow);
726 void WindowBaseEcoreX::Lower()
728 ecore_x_window_lower(mEcoreWindow);
731 void WindowBaseEcoreX::Activate()
733 ecore_x_netwm_client_active_request(ecore_x_window_root_get(mEcoreWindow), mEcoreWindow, 1 /* request type, 1:application, 2:pager */, 0);
736 void WindowBaseEcoreX::Maximize(bool maximize)
740 bool WindowBaseEcoreX::IsMaximized() const
745 void WindowBaseEcoreX::SetMaximumSize(Dali::Window::WindowSize size)
749 void WindowBaseEcoreX::Minimize(bool minimize)
753 bool WindowBaseEcoreX::IsMinimized() const
758 void WindowBaseEcoreX::SetMimimumSize(Dali::Window::WindowSize size)
762 void WindowBaseEcoreX::SetAvailableAnlges(const std::vector<int>& angles)
766 void WindowBaseEcoreX::SetPreferredAngle(int angle)
770 void WindowBaseEcoreX::SetAcceptFocus(bool accept)
774 void WindowBaseEcoreX::Show()
776 ecore_x_window_show(mEcoreWindow);
779 void WindowBaseEcoreX::Hide()
781 ecore_x_window_hide(mEcoreWindow);
784 unsigned int WindowBaseEcoreX::GetSupportedAuxiliaryHintCount() const
789 std::string WindowBaseEcoreX::GetSupportedAuxiliaryHint(unsigned int index) const
791 return std::string();
794 unsigned int WindowBaseEcoreX::AddAuxiliaryHint(const std::string& hint, const std::string& value)
799 bool WindowBaseEcoreX::RemoveAuxiliaryHint(unsigned int id)
804 bool WindowBaseEcoreX::SetAuxiliaryHintValue(unsigned int id, const std::string& value)
809 std::string WindowBaseEcoreX::GetAuxiliaryHintValue(unsigned int id) const
811 return std::string();
814 unsigned int WindowBaseEcoreX::GetAuxiliaryHintId(const std::string& hint) const
819 void WindowBaseEcoreX::SetInputRegion(const Rect<int>& inputRegion)
823 void WindowBaseEcoreX::SetType(Dali::WindowType type)
827 Dali::WindowType WindowBaseEcoreX::GetType() const
829 return Dali::WindowType::NORMAL;
832 Dali::WindowOperationResult WindowBaseEcoreX::SetNotificationLevel(Dali::WindowNotificationLevel level)
834 return Dali::WindowOperationResult::NOT_SUPPORTED;
837 Dali::WindowNotificationLevel WindowBaseEcoreX::GetNotificationLevel() const
839 return Dali::WindowNotificationLevel::NONE;
842 void WindowBaseEcoreX::SetOpaqueState(bool opaque)
846 Dali::WindowOperationResult WindowBaseEcoreX::SetScreenOffMode(WindowScreenOffMode screenOffMode)
848 return Dali::WindowOperationResult::NOT_SUPPORTED;
851 WindowScreenOffMode WindowBaseEcoreX::GetScreenOffMode() const
853 return WindowScreenOffMode::TIMEOUT;
856 Dali::WindowOperationResult WindowBaseEcoreX::SetBrightness(int brightness)
858 return Dali::WindowOperationResult::NOT_SUPPORTED;
861 int WindowBaseEcoreX::GetBrightness() const
866 bool WindowBaseEcoreX::GrabKey(Dali::KEY key, KeyGrab::KeyGrabMode grabMode)
871 bool WindowBaseEcoreX::UngrabKey(Dali::KEY key)
876 bool WindowBaseEcoreX::GrabKeyList(const Dali::Vector<Dali::KEY>& key, const Dali::Vector<KeyGrab::KeyGrabMode>& grabMode, Dali::Vector<bool>& result)
881 bool WindowBaseEcoreX::UngrabKeyList(const Dali::Vector<Dali::KEY>& key, Dali::Vector<bool>& result)
886 void WindowBaseEcoreX::GetDpi(unsigned int& dpiHorizontal, unsigned int& dpiVertical)
888 // 1 inch = 25.4 millimeters
889 // ecore does not account for differing DPI in the x and y axes, so only get for x is available
891 dpiHorizontal = ecore_x_dpi_get();
892 dpiVertical = ecore_x_dpi_get();
895 int WindowBaseEcoreX::GetWindowRotationAngle() const
900 int WindowBaseEcoreX::GetScreenRotationAngle()
905 void WindowBaseEcoreX::SetWindowRotationAngle(int degree)
907 mWindowRotationAngle = degree;
910 void WindowBaseEcoreX::WindowRotationCompleted(int degree, int width, int height)
914 void WindowBaseEcoreX::SetTransparency(bool transparent)
918 unsigned int WindowBaseEcoreX::GetSurfaceId(Any surface) const
920 unsigned int surfaceId = 0;
922 if(surface.Empty() == false)
924 // check we have a valid type
925 DALI_ASSERT_ALWAYS(((surface.GetType() == typeid(XWindow)) || (surface.GetType() == typeid(Ecore_X_Window))) && "Surface type is invalid");
927 if(surface.GetType() == typeid(Ecore_X_Window))
929 surfaceId = AnyCast<Ecore_X_Window>(surface);
933 surfaceId = static_cast<unsigned int>(AnyCast<XWindow>(surface));
939 void WindowBaseEcoreX::CreateWindow(PositionSize positionSize, bool isTransparent)
943 // create 32 bit window
944 mEcoreWindow = ecore_x_window_argb_new(0, positionSize.x, positionSize.y, positionSize.width, positionSize.height);
945 mIsTransparent = true;
949 // create 24 bit window
950 mEcoreWindow = ecore_x_window_new(0, positionSize.x, positionSize.y, positionSize.width, positionSize.height);
953 if(mEcoreWindow == 0)
955 DALI_ASSERT_ALWAYS(0 && "Failed to create X window");
959 void WindowBaseEcoreX::SetParent(WindowBase* parentWinBase, bool belowParent)
961 Ecore_X_Window ecoreParent = 0;
964 WindowBaseEcoreX* winBaseEcoreX = static_cast<WindowBaseEcoreX*>(parentWinBase);
965 ecoreParent = winBaseEcoreX->mEcoreWindow;
966 ecore_x_icccm_transient_for_set(mEcoreWindow, ecoreParent);
971 ecore_x_icccm_transient_for_unset(mEcoreWindow);
975 int WindowBaseEcoreX::CreateFrameRenderedSyncFence()
980 int WindowBaseEcoreX::CreateFramePresentedSyncFence()
985 void WindowBaseEcoreX::SetPositionSizeWithAngle(PositionSize positionSize, int angle)
989 void WindowBaseEcoreX::InitializeIme()
993 void WindowBaseEcoreX::ImeWindowReadyToRender()
997 void WindowBaseEcoreX::RequestMoveToServer()
1001 void WindowBaseEcoreX::RequestResizeToServer(WindowResizeDirection direction)
1005 void WindowBaseEcoreX::EnableFloatingMode(bool enable)
1009 bool WindowBaseEcoreX::IsFloatingModeEnabled() const
1014 void WindowBaseEcoreX::IncludeInputRegion(const Rect<int>& inputRegion)
1018 void WindowBaseEcoreX::ExcludeInputRegion(const Rect<int>& inputRegion)
1022 bool WindowBaseEcoreX::PointerConstraintsLock()
1027 bool WindowBaseEcoreX::PointerConstraintsUnlock()
1032 void WindowBaseEcoreX::LockedPointerRegionSet(int32_t x, int32_t y, int32_t width, int32_t height)
1036 void WindowBaseEcoreX::LockedPointerCursorPositionHintSet(int32_t x, int32_t y)
1040 bool WindowBaseEcoreX::PointerWarp(int32_t x, int32_t y)
1045 void WindowBaseEcoreX::CursorVisibleSet(bool visible)
1049 bool WindowBaseEcoreX::KeyboardGrab(Device::Subclass::Type deviceSubclass)
1054 bool WindowBaseEcoreX::KeyboardUnGrab()
1059 void WindowBaseEcoreX::SetFullScreen(bool fullscreen)
1064 bool WindowBaseEcoreX::GetFullScreen()
1069 void WindowBaseEcoreX::SetFrontBufferRendering(bool enable)
1073 bool WindowBaseEcoreX::GetFrontBufferRendering()
1078 void WindowBaseEcoreX::SetEglWindowFrontBufferMode(bool enable)
1082 } // namespace Adaptor
1084 } // namespace Internal