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.
18 // Ecore is littered with C style cast
19 #pragma GCC diagnostic push
20 #pragma GCC diagnostic ignored "-Wold-style-cast"
23 #include <dali/internal/window-system/tizen-wayland/ecore-wl2/window-base-ecore-wl2.h>
26 #include <dali/internal/input/common/key-impl.h>
27 #include <dali/internal/system/common/time-service.h>
28 #include <dali/internal/window-system/common/window-impl.h>
29 #include <dali/internal/window-system/common/window-render-surface.h>
30 #include <dali/internal/window-system/common/window-system.h>
33 #include <Ecore_Input.h>
34 #include <dali/integration-api/debug.h>
35 #include <dali/integration-api/trace.h>
36 #include <dali/public-api/adaptor-framework/window-enumerations.h>
37 #include <dali/public-api/events/mouse-button.h>
38 #include <dali/public-api/object/any.h>
40 #if defined(VCONF_ENABLED)
41 #include <vconf-keys.h>
45 #define START_DURATION_CHECK() \
46 uint32_t durationMilliSeconds = static_cast<uint32_t>(-1); \
47 uint32_t startTime, endTime; \
48 startTime = TimeService::GetMilliSeconds();
50 #define FINISH_DURATION_CHECK(functionName) \
51 endTime = TimeService::GetMilliSeconds(); \
52 durationMilliSeconds = endTime - startTime; \
53 if(durationMilliSeconds > 0) \
55 DALI_LOG_DEBUG_INFO("%s : duration [%u ms]\n", functionName, durationMilliSeconds); \
58 #include <wayland-egl-tizen.h>
68 #if defined(DEBUG_ENABLED)
69 Debug::Filter* gWindowBaseLogFilter = Debug::Filter::New(Debug::NoLogging, false, "LOG_WINDOW_BASE");
72 DALI_INIT_TRACE_FILTER(gTraceFilter, DALI_TRACE_PERFORMANCE_MARKER, false);
75 * @brief Enumeration of location for window resized by display server.
77 enum class ResizeLocation
79 INVALID = 0, ///< Invalid value
80 TOP_LEFT = 5, ///< Start resizing window to the top-left edge.
81 LEFT = 4, ///< Start resizing window to the left side.
82 BOTTOM_LEFT = 6, ///< Start resizing window to the bottom-left edge.
83 BOTTOM = 2, ///< Start resizing window to the bottom side.
84 BOTTOM_RIGHT = 10, ///< Start resizing window to the bottom-right edge.
85 RIGHT = 8, ///< Start resizing window to the right side.
86 TOP_RIGHT = 9, ///< Start resizing window to the top-right edge.
87 TOP = 1 ///< Start resizing window to the top side.
90 const uint32_t MAX_TIZEN_CLIENT_VERSION = 7;
91 const unsigned int PRIMARY_TOUCH_BUTTON_ID = 1;
92 const ResizeLocation RESIZE_LOCATIONS[] = {ResizeLocation::TOP_LEFT, ResizeLocation::LEFT, ResizeLocation::BOTTOM_LEFT, ResizeLocation::BOTTOM, ResizeLocation::BOTTOM_RIGHT, ResizeLocation::RIGHT, ResizeLocation::TOP_RIGHT, ResizeLocation::TOP, ResizeLocation::INVALID};
94 #if defined(VCONF_ENABLED)
95 const char* DALI_VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_NAME = "db/setting/accessibility/font_name"; // It will be update at vconf-key.h and replaced.
101 xkb_keycode_t keyCode;
106 * Get the device name from the provided ecore key event
108 void GetDeviceName(Ecore_Event_Key* keyEvent, std::string& result)
110 const char* ecoreDeviceName = ecore_device_name_get(keyEvent->dev);
114 result = ecoreDeviceName;
119 * Get the device class from the provided ecore event
121 void GetDeviceClass(Ecore_Device_Class ecoreDeviceClass, Device::Class::Type& deviceClass)
123 switch(ecoreDeviceClass)
125 case ECORE_DEVICE_CLASS_SEAT:
127 deviceClass = Device::Class::USER;
130 case ECORE_DEVICE_CLASS_KEYBOARD:
132 deviceClass = Device::Class::KEYBOARD;
135 case ECORE_DEVICE_CLASS_MOUSE:
137 deviceClass = Device::Class::MOUSE;
140 case ECORE_DEVICE_CLASS_TOUCH:
142 deviceClass = Device::Class::TOUCH;
145 case ECORE_DEVICE_CLASS_PEN:
147 deviceClass = Device::Class::PEN;
150 case ECORE_DEVICE_CLASS_POINTER:
152 deviceClass = Device::Class::POINTER;
155 case ECORE_DEVICE_CLASS_GAMEPAD:
157 deviceClass = Device::Class::GAMEPAD;
162 deviceClass = Device::Class::NONE;
168 void GetDeviceSubclass(Ecore_Device_Subclass ecoreDeviceSubclass, Device::Subclass::Type& deviceSubclass)
170 switch(ecoreDeviceSubclass)
172 case ECORE_DEVICE_SUBCLASS_FINGER:
174 deviceSubclass = Device::Subclass::FINGER;
177 case ECORE_DEVICE_SUBCLASS_FINGERNAIL:
179 deviceSubclass = Device::Subclass::FINGERNAIL;
182 case ECORE_DEVICE_SUBCLASS_KNUCKLE:
184 deviceSubclass = Device::Subclass::KNUCKLE;
187 case ECORE_DEVICE_SUBCLASS_PALM:
189 deviceSubclass = Device::Subclass::PALM;
192 case ECORE_DEVICE_SUBCLASS_HAND_SIZE:
194 deviceSubclass = Device::Subclass::HAND_SIDE;
197 case ECORE_DEVICE_SUBCLASS_HAND_FLAT:
199 deviceSubclass = Device::Subclass::HAND_FLAT;
202 case ECORE_DEVICE_SUBCLASS_PEN_TIP:
204 deviceSubclass = Device::Subclass::PEN_TIP;
207 case ECORE_DEVICE_SUBCLASS_TRACKPAD:
209 deviceSubclass = Device::Subclass::TRACKPAD;
212 case ECORE_DEVICE_SUBCLASS_TRACKPOINT:
214 deviceSubclass = Device::Subclass::TRACKPOINT;
217 case ECORE_DEVICE_SUBCLASS_TRACKBALL:
219 deviceSubclass = Device::Subclass::TRACKBALL;
222 case ECORE_DEVICE_SUBCLASS_REMOCON:
224 deviceSubclass = Device::Subclass::REMOCON;
227 case ECORE_DEVICE_SUBCLASS_VIRTUAL_KEYBOARD:
229 deviceSubclass = Device::Subclass::VIRTUAL_KEYBOARD;
234 deviceSubclass = Device::Subclass::NONE;
240 void FindKeyCode(struct xkb_keymap* keyMap, xkb_keycode_t key, void* data)
242 KeyCodeMap* foundKeyCode = static_cast<KeyCodeMap*>(data);
243 if(foundKeyCode->isKeyCode)
248 xkb_keysym_t keySym = foundKeyCode->keySym;
250 const xkb_keysym_t* symsOut = NULL;
252 nsyms = xkb_keymap_key_get_syms_by_level(keyMap, key, 0, 0, &symsOut);
256 if(*symsOut == keySym)
258 foundKeyCode->keyCode = key;
259 foundKeyCode->isKeyCode = true;
265 * Return the recalculated window resizing location according to the current orientation.
267 ResizeLocation RecalculateLocationToCurrentOrientation(WindowResizeDirection direction, int windowRotationAngle)
272 case WindowResizeDirection::TOP_LEFT:
277 case WindowResizeDirection::LEFT:
282 case WindowResizeDirection::BOTTOM_LEFT:
287 case WindowResizeDirection::BOTTOM:
292 case WindowResizeDirection::BOTTOM_RIGHT:
297 case WindowResizeDirection::RIGHT:
302 case WindowResizeDirection::TOP_RIGHT:
307 case WindowResizeDirection::TOP:
319 if(index != 8 && windowRotationAngle != 0)
321 index = (index + (windowRotationAngle / 90) * 2) % 8;
324 return RESIZE_LOCATIONS[index];
327 /////////////////////////////////////////////////////////////////////////////////////////////////
329 /////////////////////////////////////////////////////////////////////////////////////////////////
331 /// Called when the window iconify state is changed.
332 static Eina_Bool EcoreEventWindowIconifyStateChanged(void* data, int type, void* event)
334 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
337 return windowBase->OnIconifyStateChanged(data, type, event);
340 return ECORE_CALLBACK_PASS_ON;
343 /// Called when the window gains focus
344 static Eina_Bool EcoreEventWindowFocusIn(void* data, int type, void* event)
346 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
349 return windowBase->OnFocusIn(data, type, event);
352 return ECORE_CALLBACK_PASS_ON;
355 /// Called when the window loses focus
356 static Eina_Bool EcoreEventWindowFocusOut(void* data, int type, void* event)
358 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
361 return windowBase->OnFocusOut(data, type, event);
364 return ECORE_CALLBACK_PASS_ON;
367 /// Called when the output is transformed
368 static Eina_Bool EcoreEventOutputTransform(void* data, int type, void* event)
370 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
373 return windowBase->OnOutputTransform(data, type, event);
376 return ECORE_CALLBACK_PASS_ON;
379 /// Called when the output transform should be ignored
380 static Eina_Bool EcoreEventIgnoreOutputTransform(void* data, int type, void* event)
382 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
385 return windowBase->OnIgnoreOutputTransform(data, type, event);
388 return ECORE_CALLBACK_PASS_ON;
392 * Called when rotate event is recevied.
394 static Eina_Bool EcoreEventRotate(void* data, int type, void* event)
396 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
399 DALI_LOG_RELEASE_INFO("WindowBaseEcoreWl2::EcoreEventRotate\n");
400 windowBase->OnRotation(data, type, event);
402 return ECORE_CALLBACK_PASS_ON;
406 * Called when configure event is recevied.
408 static Eina_Bool EcoreEventConfigure(void* data, int type, void* event)
410 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
413 windowBase->OnConfiguration(data, type, event);
415 return ECORE_CALLBACK_PASS_ON;
418 /////////////////////////////////////////////////////////////////////////////////////////////////
420 /////////////////////////////////////////////////////////////////////////////////////////////////
423 * Called when a touch down is received.
425 static Eina_Bool EcoreEventMouseButtonDown(void* data, int type, void* event)
427 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
430 windowBase->OnMouseButtonDown(data, type, event);
432 return ECORE_CALLBACK_PASS_ON;
436 * Called when a touch up is received.
438 static Eina_Bool EcoreEventMouseButtonUp(void* data, int type, void* event)
440 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
443 windowBase->OnMouseButtonUp(data, type, event);
445 return ECORE_CALLBACK_PASS_ON;
449 * Called when a touch motion is received.
451 static Eina_Bool EcoreEventMouseButtonMove(void* data, int type, void* event)
453 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
456 windowBase->OnMouseButtonMove(data, type, event);
458 return ECORE_CALLBACK_PASS_ON;
462 * Called when a touch is canceled.
464 static Eina_Bool EcoreEventMouseButtonCancel(void* data, int type, void* event)
466 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
469 windowBase->OnMouseButtonCancel(data, type, event);
471 return ECORE_CALLBACK_PASS_ON;
475 * Called when a mouse wheel is received.
477 static Eina_Bool EcoreEventMouseWheel(void* data, int type, void* event)
479 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
482 windowBase->OnMouseWheel(data, type, event);
484 return ECORE_CALLBACK_PASS_ON;
488 * Called when a mouse in is received.
490 static Eina_Bool EcoreEventMouseIn(void* data, int type, void* event)
492 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
495 windowBase->OnMouseInOut(data, type, event, Dali::DevelWindow::MouseInOutEvent::Type::IN);
497 return ECORE_CALLBACK_PASS_ON;
501 * Called when a mouse out is received.
503 static Eina_Bool EcoreEventMouseOut(void* data, int type, void* event)
505 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
508 // When the mouse is out, the previous mouse must be canceled.
509 windowBase->OnMouseButtonCancel(data, type, event);
510 windowBase->OnMouseInOut(data, type, event, Dali::DevelWindow::MouseInOutEvent::Type::OUT);
512 return ECORE_CALLBACK_PASS_ON;
516 * Called when a detent rotation event is recevied.
518 static Eina_Bool EcoreEventDetentRotation(void* data, int type, void* event)
520 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
523 windowBase->OnDetentRotation(data, type, event);
525 return ECORE_CALLBACK_PASS_ON;
528 /////////////////////////////////////////////////////////////////////////////////////////////////
530 /////////////////////////////////////////////////////////////////////////////////////////////////
533 * Called when a key down is received.
535 static Eina_Bool EcoreEventKeyDown(void* data, int type, void* event)
537 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
540 windowBase->OnKeyDown(data, type, event);
542 return ECORE_CALLBACK_PASS_ON;
546 * Called when a key up is received.
548 static Eina_Bool EcoreEventKeyUp(void* data, int type, void* event)
550 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
553 windowBase->OnKeyUp(data, type, event);
555 return ECORE_CALLBACK_PASS_ON;
558 /////////////////////////////////////////////////////////////////////////////////////////////////
559 // Selection Callbacks
560 /////////////////////////////////////////////////////////////////////////////////////////////////
563 * Called when the source window notifies us the content in clipboard is selected.
565 static Eina_Bool EcoreEventDataSend(void* data, int type, void* event)
567 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
570 windowBase->OnDataSend(data, type, event);
572 return ECORE_CALLBACK_PASS_ON;
576 * Called when the source window sends us about the selected content.
577 * For example, when item is selected in the clipboard.
579 static Eina_Bool EcoreEventDataReceive(void* data, int type, void* event)
581 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
584 windowBase->OnDataReceive(data, type, event);
586 return ECORE_CALLBACK_PASS_ON;
589 /////////////////////////////////////////////////////////////////////////////////////////////////
590 // Effect Start/End Callbacks
591 /////////////////////////////////////////////////////////////////////////////////////////////////
594 * Called when transition animation of the window's shown/hidden is started by window manager.
596 static Eina_Bool EcoreEventEffectStart(void* data, int type, void* event)
598 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
599 Ecore_Wl2_Event_Effect_Start* effectStart = static_cast<Ecore_Wl2_Event_Effect_Start*>(event);
600 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::EcoreEventEffectStart, effect type[ %d ]\n", effectStart->type);
603 if(effectStart->type < 3) // only under restack
605 windowBase->OnTransitionEffectEvent(WindowEffectState::START, static_cast<WindowEffectType>(effectStart->type));
608 return ECORE_CALLBACK_PASS_ON;
612 * Called when transition animation of the window's shown/hidden is ended by window manager.
614 static Eina_Bool EcoreEventEffectEnd(void* data, int type, void* event)
616 Ecore_Wl2_Event_Effect_Start* effectEnd = static_cast<Ecore_Wl2_Event_Effect_Start*>(event);
617 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
618 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::EcoreEventEffectEnd, effect type[ %d ]\n", effectEnd->type);
621 if(effectEnd->type < 3) // only under restack
623 windowBase->OnTransitionEffectEvent(WindowEffectState::END, static_cast<WindowEffectType>(effectEnd->type));
626 return ECORE_CALLBACK_PASS_ON;
629 /////////////////////////////////////////////////////////////////////////////////////////////////
630 // Keyboard Repeat Settings Changed Callbacks
631 /////////////////////////////////////////////////////////////////////////////////////////////////
633 static Eina_Bool EcoreEventSeatKeyboardRepeatChanged(void* data, int type, void* event)
635 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
636 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::EcoreEventSeatKeyboardRepeatChanged, id[ %d ]\n", static_cast<Ecore_Wl2_Event_Seat_Keyboard_Repeat_Changed*>(event)->id);
639 windowBase->OnKeyboardRepeatSettingsChanged();
642 return ECORE_CALLBACK_RENEW;
645 /////////////////////////////////////////////////////////////////////////////////////////////////
646 // Keymap Changed Callbacks
647 /////////////////////////////////////////////////////////////////////////////////////////////////
649 static Eina_Bool EcoreEventSeatKeymapChanged(void* data, int type, void* event)
651 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
654 windowBase->KeymapChanged(data, type, event);
657 return ECORE_CALLBACK_RENEW;
660 /////////////////////////////////////////////////////////////////////////////////////////////////
662 /////////////////////////////////////////////////////////////////////////////////////////////////
664 #if defined(VCONF_ENABLED)
666 * Called when a font name is changed.
668 static void VconfNotifyFontNameChanged(keynode_t* node, void* data)
670 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
673 windowBase->OnFontNameChanged();
678 * Called when a font size is changed.
680 static void VconfNotifyFontSizeChanged(keynode_t* node, void* data)
682 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
685 windowBase->OnFontSizeChanged();
690 /////////////////////////////////////////////////////////////////////////////////////////////////
691 // Window Redraw Request Event Callbacks
692 /////////////////////////////////////////////////////////////////////////////////////////////////
694 static Eina_Bool EcoreEventWindowRedrawRequest(void* data, int type, void* event)
696 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
697 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::EcoreEventWindowRedrawRequest, window[ %d ]\n", static_cast<Ecore_Wl2_Event_Window_Redraw_Request*>(event)->win);
700 windowBase->OnEcoreEventWindowRedrawRequest();
703 return ECORE_CALLBACK_RENEW;
706 /////////////////////////////////////////////////////////////////////////////////////////////////
707 // Window Auxiliary Message Callbacks
708 /////////////////////////////////////////////////////////////////////////////////////////////////
709 static Eina_Bool EcoreEventWindowAuxiliaryMessage(void* data, int type, void* event)
711 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
714 windowBase->OnEcoreEventWindowAuxiliaryMessage(event);
716 return ECORE_CALLBACK_RENEW;
719 /////////////////////////////////////////////////////////////////////////////////////////////////
720 // Window is Moved/Resized By Server Callbacks
721 /////////////////////////////////////////////////////////////////////////////////////////////////
722 static Eina_Bool EcoreEventWindowMoveCompleted(void* data, int type, void* event)
724 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
727 windowBase->OnMoveCompleted(event);
729 return ECORE_CALLBACK_RENEW;
732 static Eina_Bool EcoreEventWindowResizeCompleted(void* data, int type, void* event)
734 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
737 windowBase->OnResizeCompleted(event);
739 return ECORE_CALLBACK_RENEW;
742 /////////////////////////////////////////////////////////////////////////////////////////////////
743 // Conformant Change Callback
744 /////////////////////////////////////////////////////////////////////////////////////////////////
745 static Eina_Bool EcoreEventConformantChange(void* data, int type, void* event)
747 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
750 windowBase->OnEcoreEventConformantChange(event);
752 return ECORE_CALLBACK_RENEW;
755 static void RegistryGlobalCallback(void* data, struct wl_registry* registry, uint32_t name, const char* interface, uint32_t version)
757 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
760 windowBase->RegistryGlobalCallback(data, registry, name, interface, version);
764 static void RegistryGlobalCallbackRemove(void* data, struct wl_registry* registry, uint32_t id)
766 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
769 windowBase->RegistryGlobalCallbackRemove(data, registry, id);
773 static void TizenPolicyConformant(void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, uint32_t isConformant)
777 static void TizenPolicyConformantArea(void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, uint32_t conformantPart, uint32_t state, int32_t x, int32_t y, int32_t w, int32_t h)
779 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
782 windowBase->TizenPolicyConformantArea(data, tizenPolicy, surface, conformantPart, state, x, y, w, h);
786 static void TizenPolicyNotificationChangeDone(void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, int32_t level, uint32_t state)
788 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
791 windowBase->TizenPolicyNotificationChangeDone(data, tizenPolicy, surface, level, state);
795 static void TizenPolicyTransientForDone(void* data, struct tizen_policy* tizenPolicy, uint32_t childId)
799 static void TizenPolicyScreenModeChangeDone(void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, uint32_t mode, uint32_t state)
801 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
804 windowBase->TizenPolicyScreenModeChangeDone(data, tizenPolicy, surface, mode, state);
808 static void TizenPolicyIconifyStateChanged(void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, uint32_t iconified, uint32_t force)
812 static void TizenPolicySupportedAuxiliaryHints(void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, struct wl_array* hints, uint32_t numNints)
816 static void TizenPolicyAllowedAuxiliaryHint(void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, int id)
820 static void TizenPolicyAuxiliaryMessage(void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, const char* key, const char* val, struct wl_array* options)
824 static void TizenPolicyConformantRegion(void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, uint32_t conformantPart, uint32_t state, int32_t x, int32_t y, int32_t w, int32_t h, uint32_t serial)
828 static void DisplayPolicyBrightnessChangeDone(void* data, struct tizen_display_policy* displayPolicy, struct wl_surface* surface, int32_t brightness, uint32_t state)
830 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
833 windowBase->DisplayPolicyBrightnessChangeDone(data, displayPolicy, surface, brightness, state);
837 const struct wl_registry_listener registryListener =
839 RegistryGlobalCallback,
840 RegistryGlobalCallbackRemove};
842 const struct tizen_policy_listener tizenPolicyListener =
844 TizenPolicyConformant,
845 TizenPolicyConformantArea,
846 TizenPolicyNotificationChangeDone,
847 TizenPolicyTransientForDone,
848 TizenPolicyScreenModeChangeDone,
849 TizenPolicyIconifyStateChanged,
850 TizenPolicySupportedAuxiliaryHints,
851 TizenPolicyAllowedAuxiliaryHint,
852 TizenPolicyAuxiliaryMessage,
853 TizenPolicyConformantRegion};
855 const struct tizen_display_policy_listener tizenDisplayPolicyListener =
857 DisplayPolicyBrightnessChangeDone};
859 } // unnamed namespace
861 WindowBaseEcoreWl2::WindowBaseEcoreWl2(Dali::PositionSize positionSize, Any surface, bool isTransparent)
862 : mEcoreEventHandler(),
863 mEcoreWindow(nullptr),
865 mWlInputPanel(nullptr),
867 mWlInputPanelSurface(nullptr),
870 mEventQueue(nullptr),
871 mTizenPolicy(nullptr),
872 mTizenDisplayPolicy(nullptr),
874 mSupportedAuxiliaryHints(),
875 mWindowPositionSize(positionSize),
877 mType(WindowType::NORMAL),
878 mNotificationLevel(-1),
881 mWindowRotationAngle(0),
882 mScreenRotationAngle(0),
883 mSupportedPreProtation(0),
884 mNotificationChangeState(0),
885 mScreenOffModeChangeState(0),
886 mBrightnessChangeState(0),
887 mLastSubmittedMoveResizeSerial(0),
888 mMoveResizeSerial(0),
889 mNotificationLevelChangeDone(true),
890 mScreenOffModeChangeDone(true),
893 mBrightnessChangeDone(true)
895 Initialize(positionSize, surface, isTransparent);
898 WindowBaseEcoreWl2::~WindowBaseEcoreWl2()
900 #if defined(VCONF_ENABLED)
901 vconf_ignore_key_changed(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, VconfNotifyFontSizeChanged);
902 vconf_ignore_key_changed(DALI_VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_NAME, VconfNotifyFontNameChanged);
905 for(Dali::Vector<Ecore_Event_Handler*>::Iterator iter = mEcoreEventHandler.Begin(), endIter = mEcoreEventHandler.End(); iter != endIter; ++iter)
907 ecore_event_handler_del(*iter);
909 mEcoreEventHandler.Clear();
913 wl_event_queue_destroy(mEventQueue);
916 mSupportedAuxiliaryHints.clear();
917 mAuxiliaryHints.clear();
919 if(mEglWindow != NULL)
921 wl_egl_window_destroy(mEglWindow);
927 ecore_wl2_window_free(mEcoreWindow);
929 WindowSystem::Shutdown();
933 void WindowBaseEcoreWl2::Initialize(PositionSize positionSize, Any surface, bool isTransparent)
935 if(surface.Empty() == false)
937 // check we have a valid type
938 DALI_ASSERT_ALWAYS((surface.GetType() == typeid(Ecore_Wl2_Window*)) && "Surface type is invalid");
940 mEcoreWindow = AnyCast<Ecore_Wl2_Window*>(surface);
944 // we own the surface about to created
945 WindowSystem::Initialize();
948 CreateWindow(positionSize);
951 mWlSurface = ecore_wl2_window_surface_get(mEcoreWindow);
953 SetTransparency(isTransparent);
955 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_WINDOW_ICONIFY_STATE_CHANGE, EcoreEventWindowIconifyStateChanged, this));
956 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_FOCUS_IN, EcoreEventWindowFocusIn, this));
957 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_FOCUS_OUT, EcoreEventWindowFocusOut, this));
958 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_OUTPUT_TRANSFORM, EcoreEventOutputTransform, this));
959 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_IGNORE_OUTPUT_TRANSFORM, EcoreEventIgnoreOutputTransform, this));
961 // Register Rotate event
962 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_WINDOW_ROTATE, EcoreEventRotate, this));
964 // Register Configure event
965 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_WINDOW_CONFIGURE, EcoreEventConfigure, this));
967 // Register Touch events
968 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_DOWN, EcoreEventMouseButtonDown, this));
969 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_UP, EcoreEventMouseButtonUp, this));
970 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_EVENT_MOUSE_MOVE, EcoreEventMouseButtonMove, this));
971 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_CANCEL, EcoreEventMouseButtonCancel, this));
973 // Register Mouse wheel events
974 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_EVENT_MOUSE_WHEEL, EcoreEventMouseWheel, this));
976 // Register Mouse IO events
977 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_EVENT_MOUSE_IN, EcoreEventMouseIn, this));
978 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_EVENT_MOUSE_OUT, EcoreEventMouseOut, this));
980 // Register Detent event
981 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_EVENT_DETENT_ROTATE, EcoreEventDetentRotation, this));
983 // Register Key events
984 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_EVENT_KEY_DOWN, EcoreEventKeyDown, this));
985 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_EVENT_KEY_UP, EcoreEventKeyUp, this));
987 // Register Selection event - clipboard selection
988 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_DATA_SOURCE_SEND, EcoreEventDataSend, this));
989 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_SELECTION_DATA_READY, EcoreEventDataReceive, this));
991 // Register Effect Start/End event
992 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_EFFECT_START, EcoreEventEffectStart, this));
993 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_EFFECT_END, EcoreEventEffectEnd, this));
995 // Register Keyboard repeat event
996 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_SEAT_KEYBOARD_REPEAT_CHANGED, EcoreEventSeatKeyboardRepeatChanged, this));
998 // Register Window redraw request event
999 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_WINDOW_REDRAW_REQUEST, EcoreEventWindowRedrawRequest, this));
1001 // Register Window auxiliary event
1002 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_AUX_MESSAGE, EcoreEventWindowAuxiliaryMessage, this));
1004 // Register Conformant change event
1005 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_CONFORMANT_CHANGE, EcoreEventConformantChange, this));
1007 #if defined(VCONF_ENABLED)
1008 // Register Vconf notify - font name and size
1009 vconf_notify_key_changed_for_ui_thread(DALI_VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_NAME, VconfNotifyFontNameChanged, this);
1010 vconf_notify_key_changed_for_ui_thread(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, VconfNotifyFontSizeChanged, this);
1013 // Register Window is moved and resized done event.
1014 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_WINDOW_INTERACTIVE_MOVE_DONE, EcoreEventWindowMoveCompleted, this));
1015 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_WINDOW_INTERACTIVE_RESIZE_DONE, EcoreEventWindowResizeCompleted, this));
1017 Ecore_Wl2_Display* display = ecore_wl2_connected_display_get(NULL);
1018 mDisplay = ecore_wl2_display_get(display);
1022 wl_display* displayWrapper = static_cast<wl_display*>(wl_proxy_create_wrapper(mDisplay));
1025 mEventQueue = wl_display_create_queue(mDisplay);
1028 wl_proxy_set_queue(reinterpret_cast<wl_proxy*>(displayWrapper), mEventQueue);
1030 wl_registry* registry = wl_display_get_registry(displayWrapper);
1031 wl_registry_add_listener(registry, ®istryListener, this);
1033 // To support ECORE_WL2_EVENT_CONFORMANT_CHANGE event handler
1034 ecore_wl2_window_conformant_set(mEcoreWindow, true);
1037 wl_proxy_wrapper_destroy(displayWrapper);
1041 Ecore_Wl2_Input* ecoreWlInput = ecore_wl2_input_default_input_get(display);
1045 mKeyMap = ecore_wl2_input_keymap_get(ecoreWlInput);
1047 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_SEAT_KEYMAP_CHANGED, EcoreEventSeatKeymapChanged, this));
1050 // get auxiliary hint
1051 Eina_List* hints = ecore_wl2_window_aux_hints_supported_get(mEcoreWindow);
1054 Eina_List* l = NULL;
1057 for(l = hints, (hint = static_cast<char*>(eina_list_data_get(l))); l; l = eina_list_next(l), (hint = static_cast<char*>(eina_list_data_get(l))))
1059 mSupportedAuxiliaryHints.push_back(hint);
1061 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::Initialize: %s\n", hint);
1066 Eina_Bool WindowBaseEcoreWl2::OnIconifyStateChanged(void* data, int type, void* event)
1068 Ecore_Wl2_Event_Window_Iconify_State_Change* iconifyChangedEvent(static_cast<Ecore_Wl2_Event_Window_Iconify_State_Change*>(event));
1069 Eina_Bool handled(ECORE_CALLBACK_PASS_ON);
1071 if(iconifyChangedEvent->win == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
1073 if(iconifyChangedEvent->iconified == EINA_TRUE)
1075 mIconifyChangedSignal.Emit(true);
1079 mIconifyChangedSignal.Emit(false);
1081 handled = ECORE_CALLBACK_DONE;
1087 Eina_Bool WindowBaseEcoreWl2::OnFocusIn(void* data, int type, void* event)
1089 Ecore_Wl2_Event_Focus_In* focusInEvent(static_cast<Ecore_Wl2_Event_Focus_In*>(event));
1091 if(focusInEvent->window == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
1093 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "Window EcoreEventWindowFocusIn\n");
1095 mFocusChangedSignal.Emit(true);
1098 return ECORE_CALLBACK_PASS_ON;
1101 Eina_Bool WindowBaseEcoreWl2::OnFocusOut(void* data, int type, void* event)
1103 Ecore_Wl2_Event_Focus_Out* focusOutEvent(static_cast<Ecore_Wl2_Event_Focus_Out*>(event));
1105 if(focusOutEvent->window == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
1107 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "Window EcoreEventWindowFocusOut\n");
1109 mFocusChangedSignal.Emit(false);
1112 return ECORE_CALLBACK_PASS_ON;
1115 Eina_Bool WindowBaseEcoreWl2::OnOutputTransform(void* data, int type, void* event)
1117 Ecore_Wl2_Event_Output_Transform* transformEvent(static_cast<Ecore_Wl2_Event_Output_Transform*>(event));
1119 if(transformEvent->output == ecore_wl2_window_output_find(mEcoreWindow))
1121 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "Window (%p) EcoreEventOutputTransform\n", mEcoreWindow);
1123 mScreenRotationAngle = GetScreenRotationAngle();
1125 mOutputTransformedSignal.Emit();
1128 return ECORE_CALLBACK_PASS_ON;
1131 Eina_Bool WindowBaseEcoreWl2::OnIgnoreOutputTransform(void* data, int type, void* event)
1133 Ecore_Wl2_Event_Ignore_Output_Transform* ignoreTransformEvent(static_cast<Ecore_Wl2_Event_Ignore_Output_Transform*>(event));
1135 if(ignoreTransformEvent->win == mEcoreWindow)
1137 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "Window (%p) EcoreEventIgnoreOutputTransform\n", mEcoreWindow);
1139 mScreenRotationAngle = GetScreenRotationAngle();
1141 mOutputTransformedSignal.Emit();
1144 return ECORE_CALLBACK_PASS_ON;
1147 void WindowBaseEcoreWl2::OnRotation(void* data, int type, void* event)
1149 Ecore_Wl2_Event_Window_Rotation* ev(static_cast<Ecore_Wl2_Event_Window_Rotation*>(event));
1151 if(ev->win == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
1153 DALI_LOG_RELEASE_INFO("WindowBaseEcoreWl2::OnRotation, angle: %d, width: %d, height: %d\n", ev->angle, ev->w, ev->h);
1155 RotationEvent rotationEvent;
1156 rotationEvent.angle = ev->angle;
1157 rotationEvent.winResize = 0;
1159 if(ev->w == 0 || ev->h == 0)
1161 // When rotation event does not have the window width or height,
1162 // previous DALi side window's size are used.
1163 ev->w = mWindowPositionSize.width;
1164 ev->h = mWindowPositionSize.height;
1167 mWindowRotationAngle = ev->angle;
1169 mWindowPositionSize.width = ev->w;
1170 mWindowPositionSize.height = ev->h;
1172 PositionSize newPositionSize = RecalculatePositionSizeToCurrentOrientation(mWindowPositionSize);
1174 rotationEvent.x = newPositionSize.x;
1175 rotationEvent.y = newPositionSize.y;
1176 rotationEvent.width = newPositionSize.width;
1177 rotationEvent.height = newPositionSize.height;
1179 mRotationSignal.Emit(rotationEvent);
1183 void WindowBaseEcoreWl2::OnConfiguration(void* data, int type, void* event)
1185 Ecore_Wl2_Event_Window_Configure* ev(static_cast<Ecore_Wl2_Event_Window_Configure*>(event));
1187 if(ev && ev->win == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
1189 // Note: To comply with the wayland protocol, Dali should make an ack_configure
1190 // by calling ecore_wl2_window_commit
1192 int tempWidth = static_cast<int>(ev->w);
1193 int tempHeight = static_cast<int>(ev->h);
1195 // Initialize with previous size for skip resize when new size is 0.
1196 // When window is just moved or window is resized by client application,
1197 // The configure notification event's size will be 0.
1198 // If new size is 0, the resized work should be skip.
1199 int newWidth = mWindowPositionSize.width;
1200 int newHeight = mWindowPositionSize.height;
1201 bool windowMoved = false, windowResized = false;
1203 if(ev->x != mWindowPositionSize.x || ev->y != mWindowPositionSize.y)
1208 if(tempWidth != 0 && tempHeight != 0 && (tempWidth != mWindowPositionSize.width || tempHeight != mWindowPositionSize.height))
1210 windowResized = true;
1211 newWidth = tempWidth;
1212 newHeight = tempHeight;
1215 if(windowMoved || windowResized)
1217 mWindowPositionSize.x = ev->x;
1218 mWindowPositionSize.y = ev->y;
1219 mWindowPositionSize.width = newWidth;
1220 mWindowPositionSize.height = newHeight;
1221 DALI_LOG_RELEASE_INFO("Update position & resize signal by server, current angle [%d] x[%d] y[%d] w[%d] h[%d]\n", mWindowRotationAngle, mWindowPositionSize.x, mWindowPositionSize.y, mWindowPositionSize.width, mWindowPositionSize.height);
1223 ecore_wl2_window_geometry_set(mEcoreWindow, mWindowPositionSize.x, mWindowPositionSize.y, mWindowPositionSize.width, mWindowPositionSize.height);
1225 Dali::PositionSize newPositionSize = RecalculatePositionSizeToCurrentOrientation(mWindowPositionSize);
1226 mUpdatePositionSizeSignal.Emit(newPositionSize);
1229 ecore_wl2_window_commit(mEcoreWindow, EINA_FALSE);
1233 void WindowBaseEcoreWl2::OnMouseButtonDown(void* data, int type, void* event)
1235 Ecore_Event_Mouse_Button* touchEvent = static_cast<Ecore_Event_Mouse_Button*>(event);
1237 if(touchEvent->window == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
1239 DALI_TRACE_SCOPE(gTraceFilter, "DALI_ON_MOUSE_DOWN");
1241 Device::Class::Type deviceClass;
1242 Device::Subclass::Type deviceSubclass;
1244 GetDeviceClass(ecore_device_class_get(touchEvent->dev), deviceClass);
1245 GetDeviceSubclass(ecore_device_subclass_get(touchEvent->dev), deviceSubclass);
1247 PointState::Type state(PointState::DOWN);
1249 if(deviceClass != Device::Class::Type::MOUSE)
1251 // Check if the buttons field is set and ensure it's the primary touch button.
1252 // If this event was triggered by buttons other than the primary button (used for touch), then
1253 // just send an interrupted event to Core.
1254 if(touchEvent->buttons && (touchEvent->buttons != PRIMARY_TOUCH_BUTTON_ID))
1256 state = PointState::INTERRUPTED;
1260 Integration::Point point;
1261 point.SetDeviceId(touchEvent->multi.device);
1262 point.SetState(state);
1263 point.SetScreenPosition(Vector2(touchEvent->x, touchEvent->y));
1264 point.SetRadius(touchEvent->multi.radius, Vector2(touchEvent->multi.radius_x, touchEvent->multi.radius_y));
1265 point.SetPressure(touchEvent->multi.pressure);
1266 point.SetAngle(Degree(touchEvent->multi.angle));
1267 point.SetDeviceClass(deviceClass);
1268 point.SetDeviceSubclass(deviceSubclass);
1269 point.SetMouseButton(static_cast<MouseButton::Type>(touchEvent->buttons));
1271 mTouchEventSignal.Emit(point, touchEvent->timestamp);
1275 void WindowBaseEcoreWl2::OnMouseButtonUp(void* data, int type, void* event)
1277 Ecore_Event_Mouse_Button* touchEvent = static_cast<Ecore_Event_Mouse_Button*>(event);
1279 if(touchEvent->window == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
1281 DALI_TRACE_SCOPE(gTraceFilter, "DALI_ON_MOUSE_UP");
1283 Device::Class::Type deviceClass;
1284 Device::Subclass::Type deviceSubclass;
1286 GetDeviceClass(ecore_device_class_get(touchEvent->dev), deviceClass);
1287 GetDeviceSubclass(ecore_device_subclass_get(touchEvent->dev), deviceSubclass);
1289 Integration::Point point;
1290 point.SetDeviceId(touchEvent->multi.device);
1291 point.SetState(PointState::UP);
1292 point.SetScreenPosition(Vector2(touchEvent->x, touchEvent->y));
1293 point.SetRadius(touchEvent->multi.radius, Vector2(touchEvent->multi.radius_x, touchEvent->multi.radius_y));
1294 point.SetPressure(touchEvent->multi.pressure);
1295 point.SetAngle(Degree(touchEvent->multi.angle));
1296 point.SetDeviceClass(deviceClass);
1297 point.SetDeviceSubclass(deviceSubclass);
1298 point.SetMouseButton(static_cast<MouseButton::Type>(touchEvent->buttons));
1300 mTouchEventSignal.Emit(point, touchEvent->timestamp);
1304 void WindowBaseEcoreWl2::OnMouseButtonMove(void* data, int type, void* event)
1306 Ecore_Event_Mouse_Move* touchEvent = static_cast<Ecore_Event_Mouse_Move*>(event);
1308 if(touchEvent->window == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
1310 DALI_TRACE_SCOPE(gTraceFilter, "DALI_ON_MOUSE_MOVE");
1312 Device::Class::Type deviceClass;
1313 Device::Subclass::Type deviceSubclass;
1315 GetDeviceClass(ecore_device_class_get(touchEvent->dev), deviceClass);
1316 GetDeviceSubclass(ecore_device_subclass_get(touchEvent->dev), deviceSubclass);
1318 Integration::Point point;
1319 point.SetDeviceId(touchEvent->multi.device);
1320 point.SetState(PointState::MOTION);
1321 point.SetScreenPosition(Vector2(touchEvent->x, touchEvent->y));
1322 point.SetRadius(touchEvent->multi.radius, Vector2(touchEvent->multi.radius_x, touchEvent->multi.radius_y));
1323 point.SetPressure(touchEvent->multi.pressure);
1324 point.SetAngle(Degree(touchEvent->multi.angle));
1325 point.SetDeviceClass(deviceClass);
1326 point.SetDeviceSubclass(deviceSubclass);
1328 mTouchEventSignal.Emit(point, touchEvent->timestamp);
1332 void WindowBaseEcoreWl2::OnMouseButtonCancel(void* data, int type, void* event)
1334 Ecore_Event_Mouse_Button* touchEvent = static_cast<Ecore_Event_Mouse_Button*>(event);
1336 if(touchEvent->window == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
1338 DALI_TRACE_SCOPE(gTraceFilter, "DALI_ON_MOUSE_CANCEL");
1340 Integration::Point point;
1341 point.SetDeviceId(touchEvent->multi.device);
1342 point.SetState(PointState::INTERRUPTED);
1343 point.SetScreenPosition(Vector2(0.0f, 0.0f));
1345 mTouchEventSignal.Emit(point, touchEvent->timestamp);
1347 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::OnMouseButtonCancel\n");
1351 void WindowBaseEcoreWl2::OnMouseWheel(void* data, int type, void* event)
1353 Ecore_Event_Mouse_Wheel* mouseWheelEvent = static_cast<Ecore_Event_Mouse_Wheel*>(event);
1355 if(mouseWheelEvent->window == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
1357 DALI_TRACE_SCOPE(gTraceFilter, "DALI_ON_MOUSE_WHEEL");
1359 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::OnMouseWheel: direction: %d, modifiers: %d, x: %d, y: %d, z: %d\n", mouseWheelEvent->direction, mouseWheelEvent->modifiers, mouseWheelEvent->x, mouseWheelEvent->y, mouseWheelEvent->z);
1361 Integration::WheelEvent wheelEvent(Integration::WheelEvent::MOUSE_WHEEL, mouseWheelEvent->direction, mouseWheelEvent->modifiers, Vector2(mouseWheelEvent->x, mouseWheelEvent->y), mouseWheelEvent->z, mouseWheelEvent->timestamp);
1363 mWheelEventSignal.Emit(wheelEvent);
1367 void WindowBaseEcoreWl2::OnMouseInOut(void* data, int type, void* event, Dali::DevelWindow::MouseInOutEvent::Type action)
1369 Ecore_Event_Mouse_IO* mouseInOutEvent = static_cast<Ecore_Event_Mouse_IO*>(event);
1371 if(mouseInOutEvent->window == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
1373 DALI_TRACE_SCOPE(gTraceFilter, "DALI_ON_MOUSE_IN_OUT");
1375 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::OnMouseInOut: timestamp: %d, modifiers: %d, x: %d, y: %d\n", mouseInOutEvent->timestamp, mouseInOutEvent->modifiers, mouseInOutEvent->x, mouseInOutEvent->y);
1377 Device::Class::Type deviceClass;
1378 Device::Subclass::Type deviceSubclass;
1380 GetDeviceClass(ecore_device_class_get(mouseInOutEvent->dev), deviceClass);
1381 GetDeviceSubclass(ecore_device_subclass_get(mouseInOutEvent->dev), deviceSubclass);
1383 Dali::DevelWindow::MouseInOutEvent inOutEvent(action, mouseInOutEvent->modifiers, Vector2(mouseInOutEvent->x, mouseInOutEvent->y), mouseInOutEvent->timestamp, deviceClass, deviceSubclass);
1385 mMouseInOutEventSignal.Emit(inOutEvent);
1389 void WindowBaseEcoreWl2::OnDetentRotation(void* data, int type, void* event)
1391 Ecore_Event_Detent_Rotate* detentEvent = static_cast<Ecore_Event_Detent_Rotate*>(event);
1393 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Concise, "WindowBaseEcoreWl2::OnDetentRotation\n");
1395 int32_t clockwise = (detentEvent->direction == ECORE_DETENT_DIRECTION_CLOCKWISE) ? 1 : -1;
1397 Integration::WheelEvent wheelEvent(Integration::WheelEvent::CUSTOM_WHEEL, detentEvent->direction, 0, Vector2(0.0f, 0.0f), clockwise, detentEvent->timestamp);
1399 mWheelEventSignal.Emit(wheelEvent);
1402 void WindowBaseEcoreWl2::OnKeyDown(void* data, int type, void* event)
1404 Ecore_Event_Key* keyEvent = static_cast<Ecore_Event_Key*>(event);
1406 if(keyEvent->window == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
1408 std::string keyName(keyEvent->keyname);
1409 std::string logicalKey("");
1410 std::string keyString("");
1411 std::string compose("");
1413 DALI_TRACE_BEGIN(gTraceFilter, "DALI_ON_KEY_DOWN");
1415 // Ensure key compose string is not NULL as keys like SHIFT or arrow have a null string.
1416 if(keyEvent->compose)
1418 compose = keyEvent->compose;
1421 // Ensure key symbol is not NULL as keys like SHIFT have a null string.
1424 logicalKey = keyEvent->key;
1428 GetKeyCode(keyName, keyCode); // Get key code dynamically.
1432 // Get a specific key code from dali key look up table.
1433 keyCode = KeyLookup::GetDaliKeyCode(keyEvent->keyname);
1436 keyCode = (keyCode == -1) ? 0 : keyCode;
1437 int modifier(keyEvent->modifiers);
1438 unsigned long time = keyEvent->timestamp;
1439 if(!strncmp(keyEvent->keyname, "Keycode-", 8))
1441 keyCode = atoi(keyEvent->keyname + 8);
1444 // Ensure key event string is not NULL as keys like SHIFT have a null string.
1445 if(keyEvent->string)
1447 keyString = keyEvent->string;
1450 std::string deviceName;
1451 Device::Class::Type deviceClass;
1452 Device::Subclass::Type deviceSubclass;
1454 GetDeviceName(keyEvent, deviceName);
1455 GetDeviceClass(ecore_device_class_get(keyEvent->dev), deviceClass);
1456 GetDeviceSubclass(ecore_device_subclass_get(keyEvent->dev), deviceSubclass);
1458 Integration::KeyEvent keyEvent(keyName, logicalKey, keyString, keyCode, modifier, time, Integration::KeyEvent::DOWN, compose, deviceName, deviceClass, deviceSubclass);
1460 mKeyEventSignal.Emit(keyEvent);
1462 DALI_TRACE_END(gTraceFilter, "DALI_ON_KEY_DOWN");
1466 void WindowBaseEcoreWl2::OnKeyUp(void* data, int type, void* event)
1468 Ecore_Event_Key* keyEvent = static_cast<Ecore_Event_Key*>(event);
1470 if(keyEvent->window == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
1472 #if defined(ECORE_VERSION_MAJOR) && (ECORE_VERSION_MAJOR >= 1) && defined(ECORE_VERSION_MINOR) && (ECORE_VERSION_MINOR >= 23)
1473 // Cancel processing flag is sent because this key event will combine with the previous key. So, the event should not actually perform anything.
1474 if(keyEvent->event_flags & ECORE_EVENT_FLAG_CANCEL)
1476 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::OnKeyUp: This event flag indicates the event is canceled. \n");
1479 #endif // Since ecore 1.23 version
1481 std::string keyName(keyEvent->keyname);
1482 std::string logicalKey("");
1483 std::string keyString("");
1484 std::string compose("");
1486 DALI_TRACE_BEGIN(gTraceFilter, "DALI_ON_KEY_UP");
1488 // Ensure key compose string is not NULL as keys like SHIFT or arrow have a null string.
1489 if(keyEvent->compose)
1491 compose = keyEvent->compose;
1494 // Ensure key symbol is not NULL as keys like SHIFT have a null string.
1497 logicalKey = keyEvent->key;
1501 GetKeyCode(keyName, keyCode); // Get key code dynamically.
1505 // Get a specific key code from dali key look up table.
1506 keyCode = KeyLookup::GetDaliKeyCode(keyEvent->keyname);
1509 keyCode = (keyCode == -1) ? 0 : keyCode;
1510 int modifier(keyEvent->modifiers);
1511 unsigned long time = keyEvent->timestamp;
1512 if(!strncmp(keyEvent->keyname, "Keycode-", 8))
1514 keyCode = atoi(keyEvent->keyname + 8);
1517 // Ensure key event string is not NULL as keys like SHIFT have a null string.
1518 if(keyEvent->string)
1520 keyString = keyEvent->string;
1523 std::string deviceName;
1524 Device::Class::Type deviceClass;
1525 Device::Subclass::Type deviceSubclass;
1527 GetDeviceName(keyEvent, deviceName);
1528 GetDeviceClass(ecore_device_class_get(keyEvent->dev), deviceClass);
1529 GetDeviceSubclass(ecore_device_subclass_get(keyEvent->dev), deviceSubclass);
1531 Integration::KeyEvent keyEvent(keyName, logicalKey, keyString, keyCode, modifier, time, Integration::KeyEvent::UP, compose, deviceName, deviceClass, deviceSubclass);
1533 mKeyEventSignal.Emit(keyEvent);
1535 DALI_TRACE_END(gTraceFilter, "DALI_ON_KEY_UP");
1539 void WindowBaseEcoreWl2::OnDataSend(void* data, int type, void* event)
1541 mSelectionDataSendSignal.Emit(event);
1544 void WindowBaseEcoreWl2::OnDataReceive(void* data, int type, void* event)
1546 mSelectionDataReceivedSignal.Emit(event);
1549 void WindowBaseEcoreWl2::OnFontNameChanged()
1551 mStyleChangedSignal.Emit(StyleChange::DEFAULT_FONT_CHANGE);
1554 void WindowBaseEcoreWl2::OnFontSizeChanged()
1556 mStyleChangedSignal.Emit(StyleChange::DEFAULT_FONT_SIZE_CHANGE);
1559 void WindowBaseEcoreWl2::OnTransitionEffectEvent(WindowEffectState state, WindowEffectType type)
1561 mTransitionEffectEventSignal.Emit(state, type);
1564 void WindowBaseEcoreWl2::OnKeyboardRepeatSettingsChanged()
1566 mKeyboardRepeatSettingsChangedSignal.Emit();
1569 void WindowBaseEcoreWl2::OnEcoreEventWindowRedrawRequest()
1571 mWindowRedrawRequestSignal.Emit();
1574 void WindowBaseEcoreWl2::OnEcoreEventWindowAuxiliaryMessage(void* event)
1576 Ecore_Wl2_Event_Aux_Message* message = static_cast<Ecore_Wl2_Event_Aux_Message*>(event);
1579 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::OnEcoreEventWindowAuxiliaryMessage, key:%s, value:%s \n", message->key, message->val);
1580 std::string key(message->key);
1581 std::string value(message->val);
1582 Dali::Property::Array options;
1584 if(message->options)
1588 EINA_LIST_FOREACH(message->options, l, data)
1590 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::OnEcoreEventWindowAuxiliaryMessage, option: %s\n", (char*)data);
1591 std::string option(static_cast<char*>(data));
1592 options.Add(option);
1596 mAuxiliaryMessageSignal.Emit(key, value, options);
1600 void WindowBaseEcoreWl2::OnEcoreEventConformantChange(void* event)
1602 Ecore_Wl2_Event_Conformant_Change* ev = static_cast<Ecore_Wl2_Event_Conformant_Change*>(event);
1603 if(ev && ev->win == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
1605 WindowInsetsPartType partType = WindowInsetsPartType::STATUS_BAR;
1612 switch (ev->part_type)
1614 case ECORE_WL2_INDICATOR_PART:
1616 partType = WindowInsetsPartType::STATUS_BAR;
1617 ecore_wl2_window_indicator_geometry_get(mEcoreWindow, &x, &y, &w, &h);
1620 case ECORE_WL2_KEYBOARD_PART:
1622 partType = WindowInsetsPartType::KEYBOARD;
1623 ecore_wl2_window_keyboard_geometry_get(mEcoreWindow, &x, &y, &w, &h);
1626 case ECORE_WL2_CLIPBOARD_PART:
1628 partType = WindowInsetsPartType::CLIPBOARD;
1629 ecore_wl2_window_clipboard_geometry_get(mEcoreWindow, &x, &y, &w, &h);
1638 WindowInsetsPartState partState = WindowInsetsPartState::INVISIBLE;
1645 // Insets are applied only if system UI(e.g. virtual keyboard) satisfies the following 2 conditions.
1646 // 1. System UI fits to the window width or height.
1647 // 2. System UI begins or ends from the edge of window.
1648 // Otherwise, we should not resize window content because there would be empty space around system UI.
1649 bool applyInsets = false;
1651 // Zero insets are applied if state is invisible
1658 partState = WindowInsetsPartState::VISIBLE;
1660 int winX = mWindowPositionSize.x;
1661 int winY = mWindowPositionSize.y;
1662 int winW = mWindowPositionSize.width;
1663 int winH = mWindowPositionSize.height;
1665 if((x <= winX) && (x + w >= winX + winW))
1667 if((y <= winY) && (y + h >= winY) && (y + h <= winY + winH))
1672 else if((y + h >= winY + winH) && (y >= winY) && (y <= winY + winH))
1674 bottom = winY + winH - y;
1678 else if((y <= winY) && (y + h >= winY + winH))
1680 if((x <= winX) && (x + w >= winX) && (x + w <= winX + winW))
1682 left = x + w - winX;
1685 else if((x + w >= winX + winW) && (x >= winX) && (x <= winX + winW))
1687 right = winX + winW - x;
1695 mInsetsChangedSignal.Emit(partType, partState, Extents(left, right, top, bottom));
1700 void WindowBaseEcoreWl2::KeymapChanged(void* data, int type, void* event)
1702 Ecore_Wl2_Event_Seat_Keymap_Changed* changed = static_cast<Ecore_Wl2_Event_Seat_Keymap_Changed*>(event);
1703 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::KeymapChanged, keymap id[ %d ]\n", changed->id);
1704 Ecore_Wl2_Input* ecoreWlInput = ecore_wl2_input_default_input_get(changed->display);
1707 mKeyMap = ecore_wl2_input_keymap_get(ecoreWlInput);
1711 void WindowBaseEcoreWl2::OnMoveCompleted(void* event)
1713 Ecore_Wl2_Event_Window_Interactive_Move_Done* movedDoneEvent = static_cast<Ecore_Wl2_Event_Window_Interactive_Move_Done*>(event);
1714 if(movedDoneEvent && movedDoneEvent->win == static_cast<uint32_t>(ecore_wl2_window_id_get(mEcoreWindow)))
1716 Dali::PositionSize orgPositionSize(movedDoneEvent->x, movedDoneEvent->y, movedDoneEvent->w, movedDoneEvent->h);
1717 Dali::PositionSize newPositionSize = RecalculatePositionSizeToCurrentOrientation(orgPositionSize);
1718 Dali::Int32Pair newPosition(newPositionSize.x, newPositionSize.y);
1719 DALI_LOG_RELEASE_INFO("window(%p) has been moved by server[%d, %d]\n", mEcoreWindow, newPositionSize.x, newPositionSize.y);
1720 mMoveCompletedSignal.Emit(newPosition);
1724 void WindowBaseEcoreWl2::OnResizeCompleted(void* event)
1726 Ecore_Wl2_Event_Window_Interactive_Resize_Done* resizedDoneEvent = static_cast<Ecore_Wl2_Event_Window_Interactive_Resize_Done*>(event);
1727 if(resizedDoneEvent && resizedDoneEvent->win == static_cast<uint32_t>(ecore_wl2_window_id_get(mEcoreWindow)))
1729 Dali::PositionSize orgPositionSize(resizedDoneEvent->x, resizedDoneEvent->y, resizedDoneEvent->w, resizedDoneEvent->h);
1730 Dali::PositionSize newPositionSize = RecalculatePositionSizeToCurrentOrientation(orgPositionSize);
1731 Dali::Uint16Pair newSize(newPositionSize.width, newPositionSize.height);
1732 DALI_LOG_RELEASE_INFO("window(%p) has been resized by server[%d, %d]\n", mEcoreWindow, newPositionSize.width, newPositionSize.height);
1733 mResizeCompletedSignal.Emit(newSize);
1737 void WindowBaseEcoreWl2::RegistryGlobalCallback(void* data, struct wl_registry* registry, uint32_t name, const char* interface, uint32_t version)
1739 if(strcmp(interface, tizen_policy_interface.name) == 0)
1741 uint32_t clientVersion = std::min(version, MAX_TIZEN_CLIENT_VERSION);
1743 mTizenPolicy = static_cast<tizen_policy*>(wl_registry_bind(registry, name, &tizen_policy_interface, clientVersion));
1746 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::RegistryGlobalCallback: wl_registry_bind(tizen_policy_interface) is failed.\n");
1750 tizen_policy_add_listener(mTizenPolicy, &tizenPolicyListener, data);
1752 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::RegistryGlobalCallback: tizen_policy_add_listener is called.\n");
1754 else if(strcmp(interface, tizen_display_policy_interface.name) == 0)
1756 mTizenDisplayPolicy = static_cast<tizen_display_policy*>(wl_registry_bind(registry, name, &tizen_display_policy_interface, version));
1757 if(!mTizenDisplayPolicy)
1759 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::RegistryGlobalCallback: wl_registry_bind(tizen_display_policy_interface) is failed.\n");
1763 tizen_display_policy_add_listener(mTizenDisplayPolicy, &tizenDisplayPolicyListener, data);
1765 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::RegistryGlobalCallback: tizen_display_policy_add_listener is called.\n");
1769 void WindowBaseEcoreWl2::RegistryGlobalCallbackRemove(void* data, struct wl_registry* registry, uint32_t id)
1771 mTizenPolicy = NULL;
1772 mTizenDisplayPolicy = NULL;
1775 void WindowBaseEcoreWl2::TizenPolicyConformantArea(void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, uint32_t conformantPart, uint32_t state, int32_t x, int32_t y, int32_t w, int32_t h)
1777 int originalX, originalY, originalWidth, originalHeight;
1778 bool changed = false;
1782 DALI_LOG_ERROR("Failed to get wayland surface in WindowBaseEcoreWl2::TizenPolicyConformantArea()\n");
1786 if(conformantPart == TIZEN_POLICY_CONFORMANT_PART_INDICATOR)
1788 ecore_wl2_window_indicator_geometry_get(mEcoreWindow, &originalX, &originalY, &originalWidth, &originalHeight);
1789 if((originalX != x) || (originalY != y) || (originalWidth != w) || (originalHeight != h))
1791 ecore_wl2_window_indicator_geometry_set(mEcoreWindow, x, y, w, h);
1796 * The given state is based on the visibility value of indicator.
1797 * Thus we need to add 1 to it before comparing with indicator state.
1799 Ecore_Wl2_Indicator_State indState = ecore_wl2_window_indicator_state_get(mEcoreWindow);
1800 if((state + 1) != indState)
1802 ecore_wl2_window_indicator_state_set(mEcoreWindow, static_cast<Ecore_Wl2_Indicator_State>(state + 1));
1806 else if(conformantPart == TIZEN_POLICY_CONFORMANT_PART_KEYBOARD)
1808 ecore_wl2_window_keyboard_geometry_get(mEcoreWindow, &originalX, &originalY, &originalWidth, &originalHeight);
1809 if((originalX != x) || (originalY != y) || (originalWidth != w) || (originalHeight != h))
1811 ecore_wl2_window_keyboard_geometry_set(mEcoreWindow, x, y, w, h);
1816 * The given state is based on the visibility value of virtual keyboard window.
1817 * Thus we need to add 1 to it before comparing with keyboard state.
1819 Ecore_Wl2_Virtual_Keyboard_State kbdState = ecore_wl2_window_keyboard_state_get(mEcoreWindow);
1820 if((state + 1) != (kbdState))
1822 ecore_wl2_window_keyboard_state_set(mEcoreWindow, static_cast<Ecore_Wl2_Virtual_Keyboard_State>(state + 1));
1826 else if(conformantPart == TIZEN_POLICY_CONFORMANT_PART_CLIPBOARD)
1828 ecore_wl2_window_clipboard_geometry_get(mEcoreWindow, &originalX, &originalY, &originalWidth, &originalHeight);
1829 if((originalX != x) || (originalY != y) || (originalWidth != w) || (originalHeight != h))
1831 ecore_wl2_window_clipboard_geometry_set(mEcoreWindow, x, y, w, h);
1836 * The given state is based on the visibility value of clipboard window.
1837 * Thus we need to add 1 to it before comparing with clipboard state.
1839 Ecore_Wl2_Clipboard_State clipState = ecore_wl2_window_clipboard_state_get(mEcoreWindow);
1840 if((state + 1) != clipState)
1842 ecore_wl2_window_clipboard_state_set(mEcoreWindow, static_cast<Ecore_Wl2_Clipboard_State>(state + 1));
1849 Ecore_Wl2_Event_Conformant_Change *ev = static_cast<Ecore_Wl2_Event_Conformant_Change*>(calloc(1, sizeof(Ecore_Wl2_Event_Conformant_Change)));
1855 ev->win = GetNativeWindowId();
1856 ev->part_type = static_cast<Ecore_Wl2_Conformant_Part_Type>(conformantPart);
1858 ecore_event_add(ECORE_WL2_EVENT_CONFORMANT_CHANGE, ev, NULL, NULL);
1861 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::TizenPolicyConformantArea: conformantPart = %u, state = %u, position = (%d, %d), size = (%d, %d)\n", conformantPart, state, x, y, w, h);
1864 void WindowBaseEcoreWl2::TizenPolicyNotificationChangeDone(void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, int32_t level, uint32_t state)
1866 mNotificationLevel = level;
1867 mNotificationChangeState = state;
1868 mNotificationLevelChangeDone = true;
1870 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::TizenPolicyNotificationChangeDone: level = %d, state = %d\n", level, state);
1873 void WindowBaseEcoreWl2::TizenPolicyScreenModeChangeDone(void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, uint32_t mode, uint32_t state)
1875 mScreenOffMode = mode;
1876 mScreenOffModeChangeState = state;
1877 mScreenOffModeChangeDone = true;
1879 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::TizenPolicyScreenModeChangeDone: mode = %d, state = %d\n", mode, state);
1882 void WindowBaseEcoreWl2::DisplayPolicyBrightnessChangeDone(void* data, struct tizen_display_policy* displayPolicy, struct wl_surface* surface, int32_t brightness, uint32_t state)
1884 mBrightness = brightness;
1885 mBrightnessChangeState = state;
1886 mBrightnessChangeDone = true;
1888 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::DisplayPolicyBrightnessChangeDone: brightness = %d, state = %d\n", brightness, state);
1891 void WindowBaseEcoreWl2::GetKeyCode(std::string keyName, int32_t& keyCode)
1893 xkb_keysym_t sym = XKB_KEY_NoSymbol;
1894 KeyCodeMap foundKeyCode;
1896 sym = xkb_keysym_from_name(keyName.c_str(), XKB_KEYSYM_NO_FLAGS);
1897 if(sym == XKB_KEY_NoSymbol)
1899 DALI_LOG_ERROR("Failed to get keysym in WindowBaseEcoreWl2\n");
1903 foundKeyCode.keySym = sym;
1904 foundKeyCode.isKeyCode = false;
1905 xkb_keymap_key_for_each(mKeyMap, FindKeyCode, &foundKeyCode);
1906 keyCode = static_cast<int32_t>(foundKeyCode.keyCode);
1909 Any WindowBaseEcoreWl2::GetNativeWindow()
1911 return mEcoreWindow;
1914 int WindowBaseEcoreWl2::GetNativeWindowId()
1916 return ecore_wl2_window_id_get(mEcoreWindow);
1919 std::string WindowBaseEcoreWl2::GetNativeWindowResourceId()
1921 #ifdef OVER_TIZEN_VERSION_7
1922 return std::to_string(ecore_wl2_window_resource_id_get(mEcoreWindow));
1924 return std::string();
1928 EGLNativeWindowType WindowBaseEcoreWl2::CreateEglWindow(int width, int height)
1930 int totalAngle = (mWindowRotationAngle + mScreenRotationAngle) % 360;
1932 START_DURATION_CHECK();
1933 if(totalAngle == 90 || totalAngle == 270)
1935 mEglWindow = wl_egl_window_create(mWlSurface, height, width);
1939 mEglWindow = wl_egl_window_create(mWlSurface, width, height);
1941 FINISH_DURATION_CHECK("wl_egl_window_create");
1943 return static_cast<EGLNativeWindowType>(mEglWindow);
1946 void WindowBaseEcoreWl2::DestroyEglWindow()
1948 if(mEglWindow != NULL)
1950 START_DURATION_CHECK();
1951 wl_egl_window_destroy(mEglWindow);
1952 FINISH_DURATION_CHECK("wl_egl_window_destroy");
1958 void WindowBaseEcoreWl2::SetEglWindowRotation(int angle)
1960 wl_egl_window_tizen_rotation rotation;
1966 rotation = WL_EGL_WINDOW_TIZEN_ROTATION_0;
1971 rotation = WL_EGL_WINDOW_TIZEN_ROTATION_270;
1976 rotation = WL_EGL_WINDOW_TIZEN_ROTATION_180;
1981 rotation = WL_EGL_WINDOW_TIZEN_ROTATION_90;
1986 rotation = WL_EGL_WINDOW_TIZEN_ROTATION_0;
1991 START_DURATION_CHECK();
1992 wl_egl_window_tizen_set_rotation(mEglWindow, rotation);
1993 FINISH_DURATION_CHECK("wl_egl_window_tizen_set_rotation");
1996 void WindowBaseEcoreWl2::SetEglWindowBufferTransform(int angle)
1998 wl_output_transform bufferTransform;
2004 bufferTransform = WL_OUTPUT_TRANSFORM_NORMAL;
2009 bufferTransform = WL_OUTPUT_TRANSFORM_90;
2014 bufferTransform = WL_OUTPUT_TRANSFORM_180;
2019 bufferTransform = WL_OUTPUT_TRANSFORM_270;
2024 bufferTransform = WL_OUTPUT_TRANSFORM_NORMAL;
2029 DALI_LOG_RELEASE_INFO("wl_egl_window_tizen_set_buffer_transform() with buffer Transform [%d]\n", bufferTransform);
2030 START_DURATION_CHECK();
2031 wl_egl_window_tizen_set_buffer_transform(mEglWindow, bufferTransform);
2032 FINISH_DURATION_CHECK("wl_egl_window_tizen_set_buffer_transform");
2035 void WindowBaseEcoreWl2::SetEglWindowTransform(int angle)
2037 wl_output_transform windowTransform;
2043 windowTransform = WL_OUTPUT_TRANSFORM_NORMAL;
2048 windowTransform = WL_OUTPUT_TRANSFORM_90;
2053 windowTransform = WL_OUTPUT_TRANSFORM_180;
2058 windowTransform = WL_OUTPUT_TRANSFORM_270;
2063 windowTransform = WL_OUTPUT_TRANSFORM_NORMAL;
2068 DALI_LOG_RELEASE_INFO("wl_egl_window_tizen_set_window_transform() with window Transform [%d]\n", windowTransform);
2069 START_DURATION_CHECK();
2070 wl_egl_window_tizen_set_window_transform(mEglWindow, windowTransform);
2071 FINISH_DURATION_CHECK("wl_egl_window_tizen_set_window_transform");
2074 void WindowBaseEcoreWl2::ResizeEglWindow(PositionSize positionSize)
2076 DALI_LOG_RELEASE_INFO("wl_egl_window_resize(), (%d, %d) [%d x %d]\n", positionSize.x, positionSize.y, positionSize.width, positionSize.height);
2077 START_DURATION_CHECK();
2078 wl_egl_window_resize(mEglWindow, positionSize.width, positionSize.height, positionSize.x, positionSize.y);
2080 // Note: Both "Resize" and "MoveResize" cases can reach here, but only "MoveResize" needs to submit serial number
2081 if(mMoveResizeSerial != mLastSubmittedMoveResizeSerial)
2083 wl_egl_window_tizen_set_window_serial(mEglWindow, mMoveResizeSerial);
2084 mLastSubmittedMoveResizeSerial = mMoveResizeSerial;
2086 FINISH_DURATION_CHECK("wl_egl_window functions");
2089 bool WindowBaseEcoreWl2::IsEglWindowRotationSupported()
2091 START_DURATION_CHECK();
2093 wl_egl_window_tizen_capability capability = static_cast<wl_egl_window_tizen_capability>(wl_egl_window_tizen_get_capabilities(mEglWindow));
2094 FINISH_DURATION_CHECK("wl_egl_window_tizen_get_capabilities");
2096 if(capability == WL_EGL_WINDOW_TIZEN_CAPABILITY_ROTATION_SUPPORTED)
2098 mSupportedPreProtation = true;
2101 mSupportedPreProtation = false;
2105 PositionSize WindowBaseEcoreWl2::RecalculatePositionSizeToSystem(PositionSize positionSize)
2107 PositionSize newPositionSize;
2108 int32_t screenWidth, screenHeight;
2109 WindowSystem::GetScreenSize(screenWidth, screenHeight);
2111 if(mWindowRotationAngle == 90)
2113 newPositionSize.x = positionSize.y;
2114 newPositionSize.y = screenHeight - (positionSize.x + positionSize.width);
2115 newPositionSize.width = positionSize.height;
2116 newPositionSize.height = positionSize.width;
2118 else if(mWindowRotationAngle == 180)
2120 newPositionSize.x = screenWidth - (positionSize.x + positionSize.width);
2121 newPositionSize.y = screenHeight - (positionSize.y + positionSize.height);
2122 newPositionSize.width = positionSize.width;
2123 newPositionSize.height = positionSize.height;
2125 else if(mWindowRotationAngle == 270)
2127 newPositionSize.x = screenWidth - (positionSize.y + positionSize.height);
2128 newPositionSize.y = positionSize.x;
2129 newPositionSize.width = positionSize.height;
2130 newPositionSize.height = positionSize.width;
2134 newPositionSize.x = positionSize.x;
2135 newPositionSize.y = positionSize.y;
2136 newPositionSize.width = positionSize.width;
2137 newPositionSize.height = positionSize.height;
2140 return newPositionSize;
2143 PositionSize WindowBaseEcoreWl2::RecalculatePositionSizeToCurrentOrientation(PositionSize positionSize)
2145 PositionSize newPositionSize;
2146 int32_t screenWidth, screenHeight;
2147 WindowSystem::GetScreenSize(screenWidth, screenHeight);
2149 if(mWindowRotationAngle == 90)
2151 newPositionSize.x = screenHeight - (positionSize.y + positionSize.height);
2152 newPositionSize.y = positionSize.x;
2153 newPositionSize.width = positionSize.height;
2154 newPositionSize.height = positionSize.width;
2156 else if(mWindowRotationAngle == 180)
2158 newPositionSize.x = screenWidth - (positionSize.x + positionSize.width);
2159 newPositionSize.y = screenHeight - (positionSize.y + positionSize.height);
2160 newPositionSize.width = positionSize.width;
2161 newPositionSize.height = positionSize.height;
2163 else if(mWindowRotationAngle == 270)
2165 newPositionSize.x = positionSize.y;
2166 newPositionSize.y = screenWidth - (positionSize.x + positionSize.width);
2167 newPositionSize.width = positionSize.height;
2168 newPositionSize.height = positionSize.width;
2172 newPositionSize.x = positionSize.x;
2173 newPositionSize.y = positionSize.y;
2174 newPositionSize.width = positionSize.width;
2175 newPositionSize.height = positionSize.height;
2178 return newPositionSize;
2181 void WindowBaseEcoreWl2::Move(PositionSize positionSize)
2183 PositionSize newPositionSize = RecalculatePositionSizeToSystem(positionSize);
2185 mWindowPositionSize = newPositionSize;
2186 DALI_LOG_RELEASE_INFO("ecore_wl2_window_position_set x[%d], y[%d]\n", newPositionSize.x, newPositionSize.y);
2187 START_DURATION_CHECK();
2188 ecore_wl2_window_position_set(mEcoreWindow, newPositionSize.x, newPositionSize.y);
2189 FINISH_DURATION_CHECK("ecore_wl2_window_position_set");
2192 void WindowBaseEcoreWl2::Resize(PositionSize positionSize)
2194 PositionSize newPositionSize = RecalculatePositionSizeToSystem(positionSize);
2196 mWindowPositionSize = newPositionSize;
2197 DALI_LOG_RELEASE_INFO("ecore_wl2_window_sync_geometry_set, x[%d], y[%d], w{%d], h[%d]\n", newPositionSize.x, newPositionSize.y, newPositionSize.width, newPositionSize.height);
2198 START_DURATION_CHECK();
2199 ecore_wl2_window_sync_geometry_set(mEcoreWindow, ++mMoveResizeSerial, newPositionSize.x, newPositionSize.y, newPositionSize.width, newPositionSize.height);
2200 FINISH_DURATION_CHECK("ecore_wl2_window_sync_geometry_set");
2203 void WindowBaseEcoreWl2::MoveResize(PositionSize positionSize)
2205 PositionSize newPositionSize = RecalculatePositionSizeToSystem(positionSize);
2207 mWindowPositionSize = newPositionSize;
2208 DALI_LOG_RELEASE_INFO("ecore_wl2_window_sync_geometry_set, x[%d], y[%d], w{%d], h[%d]\n", newPositionSize.x, newPositionSize.y, newPositionSize.width, newPositionSize.height);
2209 START_DURATION_CHECK();
2210 ecore_wl2_window_sync_geometry_set(mEcoreWindow, ++mMoveResizeSerial, newPositionSize.x, newPositionSize.y, newPositionSize.width, newPositionSize.height);
2211 FINISH_DURATION_CHECK("ecore_wl2_window_sync_geometry_set");
2214 void WindowBaseEcoreWl2::SetLayout(unsigned int numCols, unsigned int numRows, unsigned int column, unsigned int row, unsigned int colSpan, unsigned int rowSpan)
2216 DALI_LOG_RELEASE_INFO("ecore_wl2_window_layout_set, numCols[%d], numRows[%d], column[%d], row[%d], colSpan[%d], rowSpan[%d]\n", numCols, numRows, column, row, colSpan, rowSpan);
2217 START_DURATION_CHECK();
2218 ecore_wl2_window_layout_set(mEcoreWindow, numCols, numRows, column, row, colSpan, rowSpan);
2219 FINISH_DURATION_CHECK("ecore_wl2_window_layout_set");
2222 void WindowBaseEcoreWl2::SetClass(const std::string& name, const std::string& className)
2224 ecore_wl2_window_title_set(mEcoreWindow, name.c_str());
2225 ecore_wl2_window_class_set(mEcoreWindow, className.c_str());
2228 void WindowBaseEcoreWl2::Raise()
2230 START_DURATION_CHECK();
2231 // Use ecore_wl2_window_activate to prevent the window shown without rendering
2232 ecore_wl2_window_activate(mEcoreWindow);
2233 FINISH_DURATION_CHECK("ecore_wl2_window_activate");
2236 void WindowBaseEcoreWl2::Lower()
2238 START_DURATION_CHECK();
2239 ecore_wl2_window_lower(mEcoreWindow);
2240 FINISH_DURATION_CHECK("ecore_wl2_window_lower");
2243 void WindowBaseEcoreWl2::Activate()
2245 START_DURATION_CHECK();
2246 ecore_wl2_window_activate(mEcoreWindow);
2247 FINISH_DURATION_CHECK("ecore_wl2_window_activate");
2250 void WindowBaseEcoreWl2::Maximize(bool maximize)
2252 START_DURATION_CHECK();
2253 ecore_wl2_window_maximized_set(mEcoreWindow, maximize);
2254 FINISH_DURATION_CHECK("ecore_wl2_window_maximized_set");
2257 bool WindowBaseEcoreWl2::IsMaximized() const
2259 return ecore_wl2_window_maximized_get(mEcoreWindow);
2262 void WindowBaseEcoreWl2::SetMaximumSize(Dali::Window::WindowSize size)
2264 DALI_LOG_RELEASE_INFO("ecore_wl2_window_maximum_size_set, width: %d, height: %d\n", size.GetWidth(), size.GetHeight());
2265 START_DURATION_CHECK();
2266 ecore_wl2_window_maximum_size_set(mEcoreWindow, size.GetWidth(), size.GetHeight());
2267 FINISH_DURATION_CHECK("ecore_wl2_window_maximum_size_set");
2268 ecore_wl2_window_commit(mEcoreWindow, EINA_TRUE);
2271 void WindowBaseEcoreWl2::Minimize(bool minimize)
2273 START_DURATION_CHECK();
2274 ecore_wl2_window_iconified_set(mEcoreWindow, minimize);
2275 FINISH_DURATION_CHECK("ecore_wl2_window_iconified_set");
2278 bool WindowBaseEcoreWl2::IsMinimized() const
2280 return ecore_wl2_window_iconified_get(mEcoreWindow);
2283 void WindowBaseEcoreWl2::SetMimimumSize(Dali::Window::WindowSize size)
2285 DALI_LOG_RELEASE_INFO("ecore_wl2_window_minimum_size_set, width: %d, height: %d\n", size.GetWidth(), size.GetHeight());
2286 START_DURATION_CHECK();
2287 ecore_wl2_window_minimum_size_set(mEcoreWindow, size.GetWidth(), size.GetHeight());
2288 FINISH_DURATION_CHECK("ecore_wl2_window_minimum_size_set");
2289 ecore_wl2_window_commit(mEcoreWindow, EINA_TRUE);
2292 void WindowBaseEcoreWl2::SetAvailableAnlges(const std::vector<int>& angles)
2294 int rotations[4] = {0};
2295 DALI_LOG_RELEASE_INFO("WindowBaseEcoreWl2::SetAvailableAnlges, angle's count: %d, angles\n", angles.size());
2296 for(std::size_t i = 0; i < angles.size(); ++i)
2298 rotations[i] = static_cast<int>(angles[i]);
2299 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "%d ", rotations[i]);
2302 START_DURATION_CHECK();
2303 ecore_wl2_window_available_rotations_set(mEcoreWindow, rotations, angles.size());
2304 FINISH_DURATION_CHECK("ecore_wl2_window_available_rotations_set");
2307 void WindowBaseEcoreWl2::SetPreferredAngle(int angle)
2309 DALI_LOG_RELEASE_INFO("WindowBaseEcoreWl2::SetPreferredAngle, angle: %d\n", angle);
2310 START_DURATION_CHECK();
2311 ecore_wl2_window_preferred_rotation_set(mEcoreWindow, angle);
2312 FINISH_DURATION_CHECK("ecore_wl2_window_preferred_rotation_set");
2315 void WindowBaseEcoreWl2::SetAcceptFocus(bool accept)
2317 START_DURATION_CHECK();
2318 ecore_wl2_window_focus_skip_set(mEcoreWindow, !accept);
2319 FINISH_DURATION_CHECK("ecore_wl2_window_focus_skip_set");
2322 void WindowBaseEcoreWl2::Show()
2326 START_DURATION_CHECK();
2327 ecore_wl2_window_geometry_set(mEcoreWindow, mWindowPositionSize.x, mWindowPositionSize.y, mWindowPositionSize.width, mWindowPositionSize.height);
2328 FINISH_DURATION_CHECK("ecore_wl2_window_geometry_set");
2332 ecore_wl2_window_show(mEcoreWindow);
2335 void WindowBaseEcoreWl2::Hide()
2338 ecore_wl2_window_hide(mEcoreWindow);
2341 unsigned int WindowBaseEcoreWl2::GetSupportedAuxiliaryHintCount() const
2343 return mSupportedAuxiliaryHints.size();
2346 std::string WindowBaseEcoreWl2::GetSupportedAuxiliaryHint(unsigned int index) const
2348 if(index >= GetSupportedAuxiliaryHintCount())
2350 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetSupportedAuxiliaryHint: Invalid index! [%d]\n", index);
2353 return mSupportedAuxiliaryHints[index];
2356 unsigned int WindowBaseEcoreWl2::AddAuxiliaryHint(const std::string& hint, const std::string& value)
2358 bool supported = false;
2360 // Check if the hint is suppported
2361 for(std::vector<std::string>::iterator iter = mSupportedAuxiliaryHints.begin(); iter != mSupportedAuxiliaryHints.end(); ++iter)
2372 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Concise, "WindowBaseEcoreWl2::AddAuxiliaryHint: Not supported auxiliary hint [%s]\n", hint.c_str());
2376 // Check if the hint is already added
2377 for(unsigned int i = 0; i < mAuxiliaryHints.size(); i++)
2379 if(mAuxiliaryHints[i].first == hint)
2381 // Just change the value
2382 mAuxiliaryHints[i].second = value;
2384 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::AddAuxiliaryHint: Change! hint = %s, value = %s, id = %d\n", hint.c_str(), value.c_str(), i + 1);
2386 return i + 1; // id is index + 1
2391 mAuxiliaryHints.push_back(std::pair<std::string, std::string>(hint, value));
2393 unsigned int id = mAuxiliaryHints.size();
2395 START_DURATION_CHECK();
2396 ecore_wl2_window_aux_hint_add(mEcoreWindow, static_cast<int>(id), hint.c_str(), value.c_str());
2397 FINISH_DURATION_CHECK("ecore_wl2_window_aux_hint_add");
2399 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::AddAuxiliaryHint: hint = %s, value = %s, id = %d\n", hint.c_str(), value.c_str(), id);
2404 bool WindowBaseEcoreWl2::RemoveAuxiliaryHint(unsigned int id)
2406 if(id == 0 || id > mAuxiliaryHints.size())
2408 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Concise, "WindowBaseEcoreWl2::RemoveAuxiliaryHint: Invalid id [%d]\n", id);
2412 mAuxiliaryHints[id - 1].second = std::string();
2414 START_DURATION_CHECK();
2415 ecore_wl2_window_aux_hint_del(mEcoreWindow, static_cast<int>(id));
2416 FINISH_DURATION_CHECK("ecore_wl2_window_aux_hint_del");
2418 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::RemoveAuxiliaryHint: id = %d, hint = %s\n", id, mAuxiliaryHints[id - 1].first.c_str());
2423 bool WindowBaseEcoreWl2::SetAuxiliaryHintValue(unsigned int id, const std::string& value)
2425 if(id == 0 || id > mAuxiliaryHints.size())
2427 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Concise, "WindowBaseEcoreWl2::SetAuxiliaryHintValue: Invalid id [%d]\n", id);
2431 mAuxiliaryHints[id - 1].second = value;
2433 START_DURATION_CHECK();
2434 ecore_wl2_window_aux_hint_change(mEcoreWindow, static_cast<int>(id), value.c_str());
2435 FINISH_DURATION_CHECK("ecore_wl2_window_aux_hint_change");
2437 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetAuxiliaryHintValue: id = %d, hint = %s, value = %s\n", id, mAuxiliaryHints[id - 1].first.c_str(), mAuxiliaryHints[id - 1].second.c_str());
2442 std::string WindowBaseEcoreWl2::GetAuxiliaryHintValue(unsigned int id) const
2444 if(id == 0 || id > mAuxiliaryHints.size())
2446 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Concise, "WindowBaseEcoreWl2::GetAuxiliaryHintValue: Invalid id [%d]\n", id);
2447 return std::string();
2450 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetAuxiliaryHintValue: id = %d, hint = %s, value = %s\n", id, mAuxiliaryHints[id - 1].first.c_str(), mAuxiliaryHints[id - 1].second.c_str());
2452 return mAuxiliaryHints[id - 1].second;
2455 unsigned int WindowBaseEcoreWl2::GetAuxiliaryHintId(const std::string& hint) const
2457 for(unsigned int i = 0; i < mAuxiliaryHints.size(); i++)
2459 if(mAuxiliaryHints[i].first == hint)
2461 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetAuxiliaryHintId: hint = %s, id = %d\n", hint.c_str(), i + 1);
2466 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetAuxiliaryHintId: Invalid hint! [%s]\n", hint.c_str());
2471 Rect<int> WindowBaseEcoreWl2::RecalculateInputRect(const Rect<int>& rect)
2475 if(mWindowRotationAngle == 90)
2478 newRect.y = mWindowPositionSize.height - (rect.x + rect.width);
2479 newRect.width = rect.height;
2480 newRect.height = rect.width;
2482 else if(mWindowRotationAngle == 180)
2484 newRect.x = mWindowPositionSize.width - (rect.x + rect.width);
2485 newRect.y = mWindowPositionSize.height - (rect.y + rect.height);
2486 newRect.width = rect.width;
2487 newRect.height = rect.height;
2489 else if(mWindowRotationAngle == 270)
2491 newRect.x = mWindowPositionSize.width - (rect.y + rect.height);
2493 newRect.width = rect.height;
2494 newRect.height = rect.width;
2500 newRect.width = rect.width;
2501 newRect.height = rect.height;
2506 void WindowBaseEcoreWl2::SetInputRegion(const Rect<int>& inputRegion)
2508 Rect<int> convertRegion = RecalculateInputRect(inputRegion);
2510 Eina_Rectangle rect;
2511 rect.x = convertRegion.x;
2512 rect.y = convertRegion.y;
2513 rect.w = convertRegion.width;
2514 rect.h = convertRegion.height;
2516 DALI_LOG_RELEASE_INFO("%p, Set input rect (%d, %d, %d x %d)\n", mEcoreWindow, rect.x, rect.y, rect.w, rect.h);
2517 START_DURATION_CHECK();
2518 ecore_wl2_window_input_rect_set(mEcoreWindow, &rect);
2519 FINISH_DURATION_CHECK("ecore_wl2_window_input_rect_set");
2520 ecore_wl2_window_commit(mEcoreWindow, EINA_TRUE);
2523 void WindowBaseEcoreWl2::SetType(Dali::WindowType type)
2528 Ecore_Wl2_Window_Type windowType;
2532 case Dali::WindowType::NORMAL:
2534 windowType = ECORE_WL2_WINDOW_TYPE_TOPLEVEL;
2537 case Dali::WindowType::NOTIFICATION:
2539 windowType = ECORE_WL2_WINDOW_TYPE_NOTIFICATION;
2542 case Dali::WindowType::UTILITY:
2544 windowType = ECORE_WL2_WINDOW_TYPE_UTILITY;
2547 case Dali::WindowType::DIALOG:
2549 windowType = ECORE_WL2_WINDOW_TYPE_DIALOG;
2552 case Dali::WindowType::IME:
2554 windowType = ECORE_WL2_WINDOW_TYPE_NONE;
2557 case Dali::WindowType::DESKTOP:
2559 windowType = ECORE_WL2_WINDOW_TYPE_DESKTOP;
2564 windowType = ECORE_WL2_WINDOW_TYPE_TOPLEVEL;
2569 START_DURATION_CHECK();
2570 ecore_wl2_window_type_set(mEcoreWindow, windowType);
2571 FINISH_DURATION_CHECK("ecore_wl2_window_type_set");
2575 Dali::WindowType WindowBaseEcoreWl2::GetType() const
2580 Dali::WindowOperationResult WindowBaseEcoreWl2::SetNotificationLevel(Dali::WindowNotificationLevel level)
2582 START_DURATION_CHECK();
2583 while(!mTizenPolicy)
2585 wl_display_dispatch_queue(mDisplay, mEventQueue);
2588 int notificationLevel;
2592 case Dali::WindowNotificationLevel::NONE:
2594 notificationLevel = TIZEN_POLICY_LEVEL_NONE;
2597 case Dali::WindowNotificationLevel::BASE:
2599 notificationLevel = TIZEN_POLICY_LEVEL_DEFAULT;
2602 case Dali::WindowNotificationLevel::MEDIUM:
2604 notificationLevel = TIZEN_POLICY_LEVEL_MEDIUM;
2607 case Dali::WindowNotificationLevel::HIGH:
2609 notificationLevel = TIZEN_POLICY_LEVEL_HIGH;
2612 case Dali::WindowNotificationLevel::TOP:
2614 notificationLevel = TIZEN_POLICY_LEVEL_TOP;
2619 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetNotificationLevel: invalid level [%d]\n", level);
2620 notificationLevel = TIZEN_POLICY_LEVEL_DEFAULT;
2625 mNotificationLevelChangeDone = false;
2626 mNotificationChangeState = TIZEN_POLICY_ERROR_STATE_NONE;
2628 tizen_policy_set_notification_level(mTizenPolicy, ecore_wl2_window_surface_get(mEcoreWindow), notificationLevel);
2632 while(!mNotificationLevelChangeDone && count < 3)
2634 ecore_wl2_display_flush(ecore_wl2_connected_display_get(NULL));
2635 wl_display_dispatch_queue(mDisplay, mEventQueue);
2638 FINISH_DURATION_CHECK("ecore_wl2 & wl_display");
2640 if(!mNotificationLevelChangeDone)
2642 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetNotificationLevel: Level change is failed [%d, %d]\n", level, mNotificationChangeState);
2643 return Dali::WindowOperationResult::UNKNOWN_ERROR;
2645 else if(mNotificationChangeState == TIZEN_POLICY_ERROR_STATE_PERMISSION_DENIED)
2647 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetNotificationLevel: Permission denied! [%d]\n", level);
2648 return Dali::WindowOperationResult::PERMISSION_DENIED;
2651 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetNotificationLevel: Level is changed [%d]\n", mNotificationLevel);
2653 return Dali::WindowOperationResult::SUCCEED;
2656 Dali::WindowNotificationLevel WindowBaseEcoreWl2::GetNotificationLevel() const
2658 while(!mTizenPolicy)
2660 wl_display_dispatch_queue(mDisplay, mEventQueue);
2665 while(!mNotificationLevelChangeDone && count < 3)
2667 ecore_wl2_display_flush(ecore_wl2_connected_display_get(NULL));
2668 wl_display_dispatch_queue(mDisplay, mEventQueue);
2672 if(!mNotificationLevelChangeDone)
2674 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetNotificationLevel: Error! [%d]\n", mNotificationChangeState);
2675 return Dali::WindowNotificationLevel::NONE;
2678 Dali::WindowNotificationLevel level;
2680 switch(mNotificationLevel)
2682 case TIZEN_POLICY_LEVEL_NONE:
2684 level = Dali::WindowNotificationLevel::NONE;
2687 case TIZEN_POLICY_LEVEL_DEFAULT:
2689 level = Dali::WindowNotificationLevel::BASE;
2692 case TIZEN_POLICY_LEVEL_MEDIUM:
2694 level = Dali::WindowNotificationLevel::MEDIUM;
2697 case TIZEN_POLICY_LEVEL_HIGH:
2699 level = Dali::WindowNotificationLevel::HIGH;
2702 case TIZEN_POLICY_LEVEL_TOP:
2704 level = Dali::WindowNotificationLevel::TOP;
2709 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetNotificationLevel: invalid level [%d]\n", mNotificationLevel);
2710 level = Dali::WindowNotificationLevel::NONE;
2715 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetNotificationLevel: level [%d]\n", mNotificationLevel);
2720 void WindowBaseEcoreWl2::SetOpaqueState(bool opaque)
2722 while(!mTizenPolicy)
2724 wl_display_dispatch_queue(mDisplay, mEventQueue);
2727 tizen_policy_set_opaque_state(mTizenPolicy, ecore_wl2_window_surface_get(mEcoreWindow), (opaque ? 1 : 0));
2730 Dali::WindowOperationResult WindowBaseEcoreWl2::SetScreenOffMode(WindowScreenOffMode screenOffMode)
2732 while(!mTizenPolicy)
2734 wl_display_dispatch_queue(mDisplay, mEventQueue);
2737 mScreenOffModeChangeDone = false;
2738 mScreenOffModeChangeState = TIZEN_POLICY_ERROR_STATE_NONE;
2740 unsigned int mode = 0;
2742 switch(screenOffMode)
2744 case WindowScreenOffMode::TIMEOUT:
2749 case WindowScreenOffMode::NEVER:
2756 tizen_policy_set_window_screen_mode(mTizenPolicy, ecore_wl2_window_surface_get(mEcoreWindow), mode);
2760 while(!mScreenOffModeChangeDone && count < 3)
2762 ecore_wl2_display_flush(ecore_wl2_connected_display_get(NULL));
2763 wl_display_dispatch_queue(mDisplay, mEventQueue);
2767 if(!mScreenOffModeChangeDone)
2769 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetScreenOffMode: Screen mode change is failed [%d, %d]\n", screenOffMode, mScreenOffModeChangeState);
2770 return Dali::WindowOperationResult::UNKNOWN_ERROR;
2772 else if(mScreenOffModeChangeState == TIZEN_POLICY_ERROR_STATE_PERMISSION_DENIED)
2774 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetScreenOffMode: Permission denied! [%d]\n", screenOffMode);
2775 return Dali::WindowOperationResult::PERMISSION_DENIED;
2778 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetScreenOffMode: Screen mode is changed [%d]\n", mScreenOffMode);
2780 return Dali::WindowOperationResult::SUCCEED;
2783 WindowScreenOffMode WindowBaseEcoreWl2::GetScreenOffMode() const
2785 while(!mTizenPolicy)
2787 wl_display_dispatch_queue(mDisplay, mEventQueue);
2792 while(!mScreenOffModeChangeDone && count < 3)
2794 ecore_wl2_display_flush(ecore_wl2_connected_display_get(NULL));
2795 wl_display_dispatch_queue(mDisplay, mEventQueue);
2799 if(!mScreenOffModeChangeDone)
2801 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetScreenOffMode: Error! [%d]\n", mScreenOffModeChangeState);
2802 return WindowScreenOffMode::TIMEOUT;
2805 WindowScreenOffMode screenMode = WindowScreenOffMode::TIMEOUT;
2807 switch(mScreenOffMode)
2811 screenMode = WindowScreenOffMode::TIMEOUT;
2816 screenMode = WindowScreenOffMode::NEVER;
2821 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetScreenOffMode: screen mode [%d]\n", mScreenOffMode);
2826 Dali::WindowOperationResult WindowBaseEcoreWl2::SetBrightness(int brightness)
2828 START_DURATION_CHECK();
2829 while(!mTizenDisplayPolicy)
2831 wl_display_dispatch_queue(mDisplay, mEventQueue);
2834 mBrightnessChangeDone = false;
2835 mBrightnessChangeState = TIZEN_POLICY_ERROR_STATE_NONE;
2837 tizen_display_policy_set_window_brightness(mTizenDisplayPolicy, ecore_wl2_window_surface_get(mEcoreWindow), brightness);
2841 while(!mBrightnessChangeDone && count < 3)
2843 ecore_wl2_display_flush(ecore_wl2_connected_display_get(NULL));
2844 wl_display_dispatch_queue(mDisplay, mEventQueue);
2847 FINISH_DURATION_CHECK("ecore_wl2_display_flush");
2849 if(!mBrightnessChangeDone)
2851 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetBrightness: Brightness change is failed [%d, %d]\n", brightness, mBrightnessChangeState);
2852 return Dali::WindowOperationResult::UNKNOWN_ERROR;
2854 else if(mBrightnessChangeState == TIZEN_POLICY_ERROR_STATE_PERMISSION_DENIED)
2856 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetBrightness: Permission denied! [%d]\n", brightness);
2857 return Dali::WindowOperationResult::PERMISSION_DENIED;
2860 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetBrightness: Brightness is changed [%d]\n", mBrightness);
2862 return Dali::WindowOperationResult::SUCCEED;
2865 int WindowBaseEcoreWl2::GetBrightness() const
2867 START_DURATION_CHECK();
2868 while(!mTizenDisplayPolicy)
2870 wl_display_dispatch_queue(mDisplay, mEventQueue);
2875 while(!mBrightnessChangeDone && count < 3)
2877 ecore_wl2_display_flush(ecore_wl2_connected_display_get(NULL));
2878 wl_display_dispatch_queue(mDisplay, mEventQueue);
2881 FINISH_DURATION_CHECK("ecore_wl2_display_flush");
2883 if(!mBrightnessChangeDone)
2885 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetBrightness: Error! [%d]\n", mBrightnessChangeState);
2889 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetBrightness: Brightness [%d]\n", mBrightness);
2894 bool WindowBaseEcoreWl2::GrabKey(Dali::KEY key, KeyGrab::KeyGrabMode grabMode)
2896 Ecore_Wl2_Window_Keygrab_Mode mode;
2900 case KeyGrab::TOPMOST:
2902 mode = ECORE_WL2_WINDOW_KEYGRAB_TOPMOST;
2905 case KeyGrab::SHARED:
2907 mode = ECORE_WL2_WINDOW_KEYGRAB_SHARED;
2910 case KeyGrab::OVERRIDE_EXCLUSIVE:
2912 mode = ECORE_WL2_WINDOW_KEYGRAB_OVERRIDE_EXCLUSIVE;
2915 case KeyGrab::EXCLUSIVE:
2917 mode = ECORE_WL2_WINDOW_KEYGRAB_EXCLUSIVE;
2926 return ecore_wl2_window_keygrab_set(mEcoreWindow, KeyLookup::GetKeyName(key), 0, 0, 0, mode);
2929 bool WindowBaseEcoreWl2::UngrabKey(Dali::KEY key)
2931 return ecore_wl2_window_keygrab_unset(mEcoreWindow, KeyLookup::GetKeyName(key), 0, 0);
2934 bool WindowBaseEcoreWl2::GrabKeyList(const Dali::Vector<Dali::KEY>& key, const Dali::Vector<KeyGrab::KeyGrabMode>& grabMode, Dali::Vector<bool>& result)
2936 int keyCount = key.Count();
2937 int keyGrabModeCount = grabMode.Count();
2939 if(keyCount != keyGrabModeCount || keyCount == 0)
2946 Eina_List* keyList = NULL;
2947 Ecore_Wl2_Window_Keygrab_Info* info = new Ecore_Wl2_Window_Keygrab_Info[keyCount];
2949 for(int index = 0; index < keyCount; ++index)
2951 info[index].key = const_cast<char*>(KeyLookup::GetKeyName(key[index]));
2953 switch(grabMode[index])
2955 case KeyGrab::TOPMOST:
2957 info[index].mode = ECORE_WL2_WINDOW_KEYGRAB_TOPMOST;
2960 case KeyGrab::SHARED:
2962 info[index].mode = ECORE_WL2_WINDOW_KEYGRAB_SHARED;
2965 case KeyGrab::OVERRIDE_EXCLUSIVE:
2967 info[index].mode = ECORE_WL2_WINDOW_KEYGRAB_OVERRIDE_EXCLUSIVE;
2970 case KeyGrab::EXCLUSIVE:
2972 info[index].mode = ECORE_WL2_WINDOW_KEYGRAB_EXCLUSIVE;
2977 info[index].mode = ECORE_WL2_WINDOW_KEYGRAB_UNKNOWN;
2982 keyList = eina_list_append(keyList, &info);
2985 START_DURATION_CHECK();
2986 Eina_List* grabList = ecore_wl2_window_keygrab_list_set(mEcoreWindow, keyList);
2987 FINISH_DURATION_CHECK("ecore_wl2_window_keygrab_list_set");
2989 result.Resize(keyCount, true);
2991 Eina_List* l = NULL;
2992 Eina_List* m = NULL;
2993 void* listData = NULL;
2995 if(grabList != NULL)
2997 EINA_LIST_FOREACH(grabList, m, data)
3000 EINA_LIST_FOREACH(keyList, l, listData)
3002 if(static_cast<Ecore_Wl2_Window_Keygrab_Info*>(listData)->key == NULL)
3004 DALI_LOG_ERROR("input key list has null data!");
3008 if(strcmp(static_cast<char*>(data), static_cast<Ecore_Wl2_Window_Keygrab_Info*>(listData)->key) == 0)
3010 result[index] = false;
3019 eina_list_free(keyList);
3020 eina_list_free(grabList);
3026 bool WindowBaseEcoreWl2::UngrabKeyList(const Dali::Vector<Dali::KEY>& key, Dali::Vector<bool>& result)
3028 int keyCount = key.Count();
3036 Eina_List* keyList = NULL;
3037 Ecore_Wl2_Window_Keygrab_Info* info = new Ecore_Wl2_Window_Keygrab_Info[keyCount];
3039 for(int index = 0; index < keyCount; ++index)
3041 info[index].key = const_cast<char*>(KeyLookup::GetKeyName(key[index]));
3042 keyList = eina_list_append(keyList, &info);
3045 START_DURATION_CHECK();
3046 Eina_List* ungrabList = ecore_wl2_window_keygrab_list_unset(mEcoreWindow, keyList);
3047 FINISH_DURATION_CHECK("ecore_wl2_window_keygrab_list_unset");
3049 result.Resize(keyCount, true);
3051 Eina_List* l = NULL;
3052 Eina_List* m = NULL;
3053 void* listData = NULL;
3056 if(ungrabList != NULL)
3058 EINA_LIST_FOREACH(ungrabList, m, data)
3061 EINA_LIST_FOREACH(keyList, l, listData)
3063 if(strcmp(static_cast<char*>(data), static_cast<Ecore_Wl2_Window_Keygrab_Info*>(listData)->key) == 0)
3065 result[index] = false;
3074 eina_list_free(keyList);
3075 eina_list_free(ungrabList);
3081 void WindowBaseEcoreWl2::GetDpi(unsigned int& dpiHorizontal, unsigned int& dpiVertical)
3086 Ecore_Wl2_Output* output = ecore_wl2_window_output_find(mEcoreWindow);
3088 // 1 inch = 25.4 millimeters
3089 xres = ecore_wl2_output_dpi_get(output);
3090 yres = ecore_wl2_output_dpi_get(output);
3092 dpiHorizontal = int(xres + 0.5f); // rounding
3093 dpiVertical = int(yres + 0.5f);
3096 int WindowBaseEcoreWl2::GetWindowRotationAngle() const
3098 int orientation = mWindowRotationAngle;
3099 if(mSupportedPreProtation)
3106 int WindowBaseEcoreWl2::GetScreenRotationAngle()
3108 if(mSupportedPreProtation)
3110 DALI_LOG_RELEASE_INFO("Support PreRotation and return 0\n");
3114 if(ecore_wl2_window_ignore_output_transform_get(mEcoreWindow))
3120 transform = ecore_wl2_output_transform_get(ecore_wl2_window_output_find(mEcoreWindow));
3122 mScreenRotationAngle = transform * 90;
3123 return mScreenRotationAngle;
3126 void WindowBaseEcoreWl2::SetWindowRotationAngle(int degree)
3128 mWindowRotationAngle = degree;
3129 ecore_wl2_window_rotation_set(mEcoreWindow, degree);
3132 void WindowBaseEcoreWl2::WindowRotationCompleted(int degree, int width, int height)
3134 START_DURATION_CHECK();
3135 ecore_wl2_window_rotation_change_done_send(mEcoreWindow, degree, width, height);
3136 FINISH_DURATION_CHECK("ecore_wl2_window_rotation_change_done_send");
3139 void WindowBaseEcoreWl2::SetTransparency(bool transparent)
3141 START_DURATION_CHECK();
3142 ecore_wl2_window_alpha_set(mEcoreWindow, transparent);
3143 FINISH_DURATION_CHECK("ecore_wl2_window_alpha_set");
3146 void WindowBaseEcoreWl2::CreateWindow(PositionSize positionSize)
3148 Ecore_Wl2_Display* display = ecore_wl2_display_connect(NULL);
3151 DALI_ASSERT_ALWAYS(0 && "Failed to get display");
3154 START_DURATION_CHECK();
3155 ecore_wl2_display_sync(display);
3157 mEcoreWindow = ecore_wl2_window_new(display, NULL, positionSize.x, positionSize.y, positionSize.width, positionSize.height);
3159 if(mEcoreWindow == 0)
3161 DALI_ASSERT_ALWAYS(0 && "Failed to create Wayland window");
3165 ecore_wl2_window_type_set(mEcoreWindow, ECORE_WL2_WINDOW_TYPE_TOPLEVEL);
3166 FINISH_DURATION_CHECK("ecore_wl2 functions");
3169 void WindowBaseEcoreWl2::SetParent(WindowBase* parentWinBase, bool belowParent)
3171 Ecore_Wl2_Window* ecoreParent = NULL;
3174 WindowBaseEcoreWl2* winBaseEcore2 = static_cast<WindowBaseEcoreWl2*>(parentWinBase);
3175 ecoreParent = winBaseEcore2->mEcoreWindow;
3178 START_DURATION_CHECK();
3179 ecore_wl2_window_transient_parent_set(mEcoreWindow, ecoreParent, belowParent);
3180 FINISH_DURATION_CHECK("ecore_wl2_window_transient_parent_set");
3183 int WindowBaseEcoreWl2::CreateFrameRenderedSyncFence()
3185 return wl_egl_window_tizen_create_commit_sync_fd(mEglWindow);
3188 int WindowBaseEcoreWl2::CreateFramePresentedSyncFence()
3190 return wl_egl_window_tizen_create_presentation_sync_fd(mEglWindow);
3193 void WindowBaseEcoreWl2::SetPositionSizeWithAngle(PositionSize positionSize, int angle)
3195 DALI_LOG_RELEASE_INFO("WindowBaseEcoreWl2::SetPositionSizeWithAngle, angle: %d, x: %d, y: %d, w: %d, h: %d\n", angle, positionSize.x, positionSize.y, positionSize.width, positionSize.height);
3196 START_DURATION_CHECK();
3197 ecore_wl2_window_rotation_geometry_set(mEcoreWindow, angle, positionSize.x, positionSize.y, positionSize.width, positionSize.height);
3198 FINISH_DURATION_CHECK("ecore_wl2_window_rotation_geometry_set");
3201 void WindowBaseEcoreWl2::InitializeIme()
3203 Eina_Iterator* globals;
3204 struct wl_registry* registry;
3205 Ecore_Wl2_Global* global;
3206 Ecore_Wl2_Display* ecoreWl2Display;
3208 if(!(ecoreWl2Display = ecore_wl2_connected_display_get(NULL)))
3210 DALI_LOG_ERROR("WindowBaseEcoreWl2::InitializeIme(), fail to get ecore_wl2 connected display\n");
3214 DALI_LOG_RELEASE_INFO("InitializeIme: Ecore_Wl2_Display: %p, ecore wl window: %p\n", ecoreWl2Display, mEcoreWindow);
3216 if(!(registry = ecore_wl2_display_registry_get(ecoreWl2Display)))
3218 DALI_LOG_ERROR("WindowBaseEcoreWl2::InitializeIme(), fail to get ecore_wl2 display registry\n");
3222 if(!(globals = ecore_wl2_display_globals_get(ecoreWl2Display)))
3224 DALI_LOG_ERROR("WindowBaseEcoreWl2::InitializeIme(), fail to get ecore_wl2 globals\n");
3228 START_DURATION_CHECK();
3229 EINA_ITERATOR_FOREACH(globals, global)
3231 #ifdef OVER_TIZEN_VERSION_7
3232 if(strcmp(global->interface, "zwp_input_panel_v1") == 0)
3234 mWlInputPanel = (zwp_input_panel_v1*)wl_registry_bind(registry, global->id, &zwp_input_panel_v1_interface, 1);
3237 if(strcmp(global->interface, "wl_input_panel") == 0)
3239 mWlInputPanel = (wl_input_panel*)wl_registry_bind(registry, global->id, &wl_input_panel_interface, 1);
3242 else if(strcmp(global->interface, "wl_output") == 0)
3244 mWlOutput = (wl_output*)wl_registry_bind(registry, global->id, &wl_output_interface, 1);
3250 DALI_LOG_ERROR("WindowBaseEcoreWl2::InitializeIme(), fail to get wayland input panel interface\n");
3256 DALI_LOG_ERROR("WindowBaseEcoreWl2::InitializeIme(), fail to get wayland output panel interface\n");
3259 #ifdef OVER_TIZEN_VERSION_7
3260 mWlInputPanelSurface = zwp_input_panel_v1_get_input_panel_surface(mWlInputPanel, mWlSurface);
3262 mWlInputPanelSurface = wl_input_panel_get_input_panel_surface(mWlInputPanel, mWlSurface);
3264 if(!mWlInputPanelSurface)
3266 DALI_LOG_ERROR("WindowBaseEcoreWl2::InitializeIme(), fail to get wayland input panel surface\n");
3269 #ifdef OVER_TIZEN_VERSION_7
3270 zwp_input_panel_surface_v1_set_toplevel(mWlInputPanelSurface, mWlOutput, ZWP_INPUT_PANEL_SURFACE_V1_POSITION_CENTER_BOTTOM);
3272 wl_input_panel_surface_set_toplevel(mWlInputPanelSurface, mWlOutput, WL_INPUT_PANEL_SURFACE_POSITION_CENTER_BOTTOM);
3274 FINISH_DURATION_CHECK("zwp_input_panel_surface_v1_set_toplevel");
3277 void WindowBaseEcoreWl2::ImeWindowReadyToRender()
3279 if(!mWlInputPanelSurface)
3281 DALI_LOG_ERROR("WindowBaseEcoreWl2::ImeWindowReadyToRender(), wayland input panel surface is null\n");
3285 START_DURATION_CHECK();
3286 #ifdef OVER_TIZEN_VERSION_7
3287 zwp_input_panel_surface_v1_set_ready(mWlInputPanelSurface, 1);
3289 wl_input_panel_surface_set_ready(mWlInputPanelSurface, 1);
3291 FINISH_DURATION_CHECK("zwp_input_panel_surface_v1_set_ready");
3294 void WindowBaseEcoreWl2::RequestMoveToServer()
3296 Ecore_Wl2_Display* display = ecore_wl2_connected_display_get(NULL);
3299 DALI_LOG_ERROR("WindowBaseEcoreWl2::RequestMoveToServer, Fail to get ecore_wl2_display\n");
3303 Ecore_Wl2_Input* input = ecore_wl2_input_default_input_get(display);
3306 DALI_LOG_ERROR("WindowBaseEcoreWl2::RequestMoveToServer, Fail to get default Ecore_Wl2_Input\n");
3310 START_DURATION_CHECK();
3311 ecore_wl2_window_move(mEcoreWindow, input);
3312 FINISH_DURATION_CHECK("ecore_wl2_window_move");
3313 DALI_LOG_RELEASE_INFO("WindowBaseEcoreWl2::RequestMoveToServer, starts the window[%p] is moved by server\n", mEcoreWindow);
3316 void WindowBaseEcoreWl2::RequestResizeToServer(WindowResizeDirection direction)
3318 Ecore_Wl2_Display* display = ecore_wl2_connected_display_get(NULL);
3321 DALI_LOG_ERROR("WindowBaseEcoreWl2::RequestResizeToServer, Fail to get ecore_wl2_display\n");
3325 Ecore_Wl2_Input* input = ecore_wl2_input_default_input_get(display);
3328 DALI_LOG_ERROR("WindowBaseEcoreWl2::RequestResizeToServer, Fail to get default Ecore_Wl2_Input\n");
3332 ResizeLocation location = RecalculateLocationToCurrentOrientation(direction, mWindowRotationAngle);
3334 START_DURATION_CHECK();
3335 ecore_wl2_window_resize(mEcoreWindow, input, static_cast<int>(location));
3336 FINISH_DURATION_CHECK("ecore_wl2_window_resize");
3337 DALI_LOG_RELEASE_INFO("WindowBaseEcoreWl2::RequestResizeToServer, starts the window[%p] is resized by server, direction:%d oriention:%d mode:%d\n", mEcoreWindow, direction, mWindowRotationAngle, location);
3340 void WindowBaseEcoreWl2::EnableFloatingMode(bool enable)
3342 DALI_LOG_RELEASE_INFO("WindowBaseEcoreWl2::EnableFloatingMode, floating mode flag: [%p], enable [%d]\n", mEcoreWindow, enable);
3343 START_DURATION_CHECK();
3346 ecore_wl2_window_floating_mode_set(mEcoreWindow, EINA_TRUE);
3350 ecore_wl2_window_floating_mode_set(mEcoreWindow, EINA_FALSE);
3352 FINISH_DURATION_CHECK("ecore_wl2_window_floating_mode_set");
3355 bool WindowBaseEcoreWl2::IsFloatingModeEnabled() const
3357 return ecore_wl2_window_floating_mode_get(mEcoreWindow);
3360 void WindowBaseEcoreWl2::IncludeInputRegion(const Rect<int>& inputRegion)
3362 Rect<int> convertRegion = RecalculateInputRect(inputRegion);
3363 Eina_Rectangle rect;
3365 rect.x = convertRegion.x;
3366 rect.y = convertRegion.y;
3367 rect.w = convertRegion.width;
3368 rect.h = convertRegion.height;
3370 DALI_LOG_RELEASE_INFO("%p, Add input_rect(%d, %d, %d x %d)\n", mEcoreWindow, rect.x, rect.y, rect.w, rect.h);
3371 START_DURATION_CHECK();
3372 ecore_wl2_window_input_rect_add(mEcoreWindow, &rect);
3373 FINISH_DURATION_CHECK("ecore_wl2_window_input_rect_add");
3374 ecore_wl2_window_commit(mEcoreWindow, EINA_TRUE);
3377 void WindowBaseEcoreWl2::ExcludeInputRegion(const Rect<int>& inputRegion)
3379 Rect<int> convertRegion = RecalculateInputRect(inputRegion);
3380 Eina_Rectangle rect;
3382 rect.x = convertRegion.x;
3383 rect.y = convertRegion.y;
3384 rect.w = convertRegion.width;
3385 rect.h = convertRegion.height;
3387 DALI_LOG_RELEASE_INFO("%p, Subtract input_rect(%d, %d, %d x %d)\n", mEcoreWindow, rect.x, rect.y, rect.w, rect.h);
3388 START_DURATION_CHECK();
3389 ecore_wl2_window_input_rect_subtract(mEcoreWindow, &rect);
3390 FINISH_DURATION_CHECK("ecore_wl2_window_input_rect_subtract");
3391 ecore_wl2_window_commit(mEcoreWindow, EINA_TRUE);
3394 } // namespace Adaptor
3396 } // namespace Internal
3400 #pragma GCC diagnostic pop