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;
461 #ifdef OVER_TIZEN_VERSION_8
463 * Called when a touch motion is received.
465 static Eina_Bool EcoreEventMouseButtonRelativeMove(void* data, int type, void* event)
467 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
470 windowBase->OnMouseButtonRelativeMove(data, type, event);
472 return ECORE_CALLBACK_PASS_ON;
477 * Called when a touch is canceled.
479 static Eina_Bool EcoreEventMouseButtonCancel(void* data, int type, void* event)
481 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
484 windowBase->OnMouseButtonCancel(data, type, event);
486 return ECORE_CALLBACK_PASS_ON;
489 #ifdef OVER_TIZEN_VERSION_8
491 * Called when pointer constraints event is recevied.
493 static Eina_Bool EcoreEventPointerConstraints(void* data, int type, void* event)
495 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
498 windowBase->OnPointerConstraints(data, type, event);
500 return ECORE_CALLBACK_PASS_ON;
505 * Called when a mouse wheel is received.
507 static Eina_Bool EcoreEventMouseWheel(void* data, int type, void* event)
509 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
512 windowBase->OnMouseWheel(data, type, event);
514 return ECORE_CALLBACK_PASS_ON;
518 * Called when a mouse in is received.
520 static Eina_Bool EcoreEventMouseIn(void* data, int type, void* event)
522 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
525 windowBase->OnMouseInOut(data, type, event, Dali::DevelWindow::MouseInOutEvent::Type::IN);
527 return ECORE_CALLBACK_PASS_ON;
531 * Called when a mouse out is received.
533 static Eina_Bool EcoreEventMouseOut(void* data, int type, void* event)
535 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
538 // When the mouse is out, the previous mouse must be canceled.
539 windowBase->OnMouseButtonCancel(data, type, event);
540 windowBase->OnMouseInOut(data, type, event, Dali::DevelWindow::MouseInOutEvent::Type::OUT);
542 return ECORE_CALLBACK_PASS_ON;
546 * Called when a detent rotation event is recevied.
548 static Eina_Bool EcoreEventDetentRotation(void* data, int type, void* event)
550 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
553 windowBase->OnDetentRotation(data, type, event);
555 return ECORE_CALLBACK_PASS_ON;
558 /////////////////////////////////////////////////////////////////////////////////////////////////
560 /////////////////////////////////////////////////////////////////////////////////////////////////
563 * Called when a key down is received.
565 static Eina_Bool EcoreEventKeyDown(void* data, int type, void* event)
567 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
570 windowBase->OnKeyDown(data, type, event);
572 return ECORE_CALLBACK_PASS_ON;
576 * Called when a key up is received.
578 static Eina_Bool EcoreEventKeyUp(void* data, int type, void* event)
580 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
583 windowBase->OnKeyUp(data, type, event);
585 return ECORE_CALLBACK_PASS_ON;
588 /////////////////////////////////////////////////////////////////////////////////////////////////
589 // Selection Callbacks
590 /////////////////////////////////////////////////////////////////////////////////////////////////
593 * Called when the source window notifies us the content in clipboard is selected.
595 static Eina_Bool EcoreEventDataSend(void* data, int type, void* event)
597 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
600 windowBase->OnDataSend(data, type, event);
602 return ECORE_CALLBACK_PASS_ON;
606 * Called when the source window sends us about the selected content.
607 * For example, when item is selected in the clipboard.
609 static Eina_Bool EcoreEventDataReceive(void* data, int type, void* event)
611 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
614 windowBase->OnDataReceive(data, type, event);
616 return ECORE_CALLBACK_PASS_ON;
619 /////////////////////////////////////////////////////////////////////////////////////////////////
620 // Effect Start/End Callbacks
621 /////////////////////////////////////////////////////////////////////////////////////////////////
624 * Called when transition animation of the window's shown/hidden is started by window manager.
626 static Eina_Bool EcoreEventEffectStart(void* data, int type, void* event)
628 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
629 Ecore_Wl2_Event_Effect_Start* effectStart = static_cast<Ecore_Wl2_Event_Effect_Start*>(event);
630 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::EcoreEventEffectStart, effect type[ %d ]\n", effectStart->type);
633 if(effectStart->type < 3) // only under restack
635 windowBase->OnTransitionEffectEvent(WindowEffectState::START, static_cast<WindowEffectType>(effectStart->type));
638 return ECORE_CALLBACK_PASS_ON;
642 * Called when transition animation of the window's shown/hidden is ended by window manager.
644 static Eina_Bool EcoreEventEffectEnd(void* data, int type, void* event)
646 Ecore_Wl2_Event_Effect_Start* effectEnd = static_cast<Ecore_Wl2_Event_Effect_Start*>(event);
647 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
648 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::EcoreEventEffectEnd, effect type[ %d ]\n", effectEnd->type);
651 if(effectEnd->type < 3) // only under restack
653 windowBase->OnTransitionEffectEvent(WindowEffectState::END, static_cast<WindowEffectType>(effectEnd->type));
656 return ECORE_CALLBACK_PASS_ON;
659 /////////////////////////////////////////////////////////////////////////////////////////////////
660 // Keyboard Repeat Settings Changed Callbacks
661 /////////////////////////////////////////////////////////////////////////////////////////////////
663 static Eina_Bool EcoreEventSeatKeyboardRepeatChanged(void* data, int type, void* event)
665 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
666 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::EcoreEventSeatKeyboardRepeatChanged, id[ %d ]\n", static_cast<Ecore_Wl2_Event_Seat_Keyboard_Repeat_Changed*>(event)->id);
669 windowBase->OnKeyboardRepeatSettingsChanged();
672 return ECORE_CALLBACK_RENEW;
675 /////////////////////////////////////////////////////////////////////////////////////////////////
676 // Keymap Changed Callbacks
677 /////////////////////////////////////////////////////////////////////////////////////////////////
679 static Eina_Bool EcoreEventSeatKeymapChanged(void* data, int type, void* event)
681 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
684 windowBase->KeymapChanged(data, type, event);
687 return ECORE_CALLBACK_RENEW;
690 /////////////////////////////////////////////////////////////////////////////////////////////////
692 /////////////////////////////////////////////////////////////////////////////////////////////////
694 #if defined(VCONF_ENABLED)
696 * Called when a font name is changed.
698 static void VconfNotifyFontNameChanged(keynode_t* node, void* data)
700 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
703 windowBase->OnFontNameChanged();
708 * Called when a font size is changed.
710 static void VconfNotifyFontSizeChanged(keynode_t* node, void* data)
712 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
715 windowBase->OnFontSizeChanged();
720 /////////////////////////////////////////////////////////////////////////////////////////////////
721 // Window Redraw Request Event Callbacks
722 /////////////////////////////////////////////////////////////////////////////////////////////////
724 static Eina_Bool EcoreEventWindowRedrawRequest(void* data, int type, void* event)
726 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
727 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::EcoreEventWindowRedrawRequest, window[ %d ]\n", static_cast<Ecore_Wl2_Event_Window_Redraw_Request*>(event)->win);
730 windowBase->OnEcoreEventWindowRedrawRequest();
733 return ECORE_CALLBACK_RENEW;
736 /////////////////////////////////////////////////////////////////////////////////////////////////
737 // Window Auxiliary Message Callbacks
738 /////////////////////////////////////////////////////////////////////////////////////////////////
739 static Eina_Bool EcoreEventWindowAuxiliaryMessage(void* data, int type, void* event)
741 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
744 windowBase->OnEcoreEventWindowAuxiliaryMessage(event);
746 return ECORE_CALLBACK_RENEW;
749 /////////////////////////////////////////////////////////////////////////////////////////////////
750 // Window is Moved/Resized By Server Callbacks
751 /////////////////////////////////////////////////////////////////////////////////////////////////
752 static Eina_Bool EcoreEventWindowMoveCompleted(void* data, int type, void* event)
754 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
757 windowBase->OnMoveCompleted(event);
759 return ECORE_CALLBACK_RENEW;
762 static Eina_Bool EcoreEventWindowResizeCompleted(void* data, int type, void* event)
764 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
767 windowBase->OnResizeCompleted(event);
769 return ECORE_CALLBACK_RENEW;
772 /////////////////////////////////////////////////////////////////////////////////////////////////
773 // Conformant Change Callback
774 /////////////////////////////////////////////////////////////////////////////////////////////////
775 static Eina_Bool EcoreEventConformantChange(void* data, int type, void* event)
777 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
780 windowBase->OnEcoreEventConformantChange(event);
782 return ECORE_CALLBACK_RENEW;
785 static void RegistryGlobalCallback(void* data, struct wl_registry* registry, uint32_t name, const char* interface, uint32_t version)
787 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
790 windowBase->RegistryGlobalCallback(data, registry, name, interface, version);
794 static void RegistryGlobalCallbackRemove(void* data, struct wl_registry* registry, uint32_t id)
796 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
799 windowBase->RegistryGlobalCallbackRemove(data, registry, id);
803 static void TizenPolicyConformant(void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, uint32_t isConformant)
807 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)
809 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
812 windowBase->TizenPolicyConformantArea(data, tizenPolicy, surface, conformantPart, state, x, y, w, h);
816 static void TizenPolicyNotificationChangeDone(void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, int32_t level, uint32_t state)
818 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
821 windowBase->TizenPolicyNotificationChangeDone(data, tizenPolicy, surface, level, state);
825 static void TizenPolicyTransientForDone(void* data, struct tizen_policy* tizenPolicy, uint32_t childId)
829 static void TizenPolicyScreenModeChangeDone(void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, uint32_t mode, uint32_t state)
831 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
834 windowBase->TizenPolicyScreenModeChangeDone(data, tizenPolicy, surface, mode, state);
838 static void TizenPolicyIconifyStateChanged(void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, uint32_t iconified, uint32_t force)
842 static void TizenPolicySupportedAuxiliaryHints(void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, struct wl_array* hints, uint32_t numNints)
846 static void TizenPolicyAllowedAuxiliaryHint(void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, int id)
850 static void TizenPolicyAuxiliaryMessage(void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, const char* key, const char* val, struct wl_array* options)
854 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)
858 static void DisplayPolicyBrightnessChangeDone(void* data, struct tizen_display_policy* displayPolicy, struct wl_surface* surface, int32_t brightness, uint32_t state)
860 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
863 windowBase->DisplayPolicyBrightnessChangeDone(data, displayPolicy, surface, brightness, state);
867 const struct wl_registry_listener registryListener =
869 RegistryGlobalCallback,
870 RegistryGlobalCallbackRemove};
872 const struct tizen_policy_listener tizenPolicyListener =
874 TizenPolicyConformant,
875 TizenPolicyConformantArea,
876 TizenPolicyNotificationChangeDone,
877 TizenPolicyTransientForDone,
878 TizenPolicyScreenModeChangeDone,
879 TizenPolicyIconifyStateChanged,
880 TizenPolicySupportedAuxiliaryHints,
881 TizenPolicyAllowedAuxiliaryHint,
882 TizenPolicyAuxiliaryMessage,
883 TizenPolicyConformantRegion};
885 const struct tizen_display_policy_listener tizenDisplayPolicyListener =
887 DisplayPolicyBrightnessChangeDone};
889 } // unnamed namespace
891 WindowBaseEcoreWl2::WindowBaseEcoreWl2(Dali::PositionSize positionSize, Any surface, bool isTransparent)
892 : mEcoreEventHandler(),
893 mEcoreWindow(nullptr),
895 mWlInputPanel(nullptr),
897 mWlInputPanelSurface(nullptr),
900 mEventQueue(nullptr),
901 mTizenPolicy(nullptr),
902 mTizenDisplayPolicy(nullptr),
904 mSupportedAuxiliaryHints(),
905 mWindowPositionSize(positionSize),
907 mType(WindowType::NORMAL),
908 mNotificationLevel(-1),
911 mWindowRotationAngle(0),
912 mScreenRotationAngle(0),
913 mSupportedPreProtation(0),
914 mNotificationChangeState(0),
915 mScreenOffModeChangeState(0),
916 mBrightnessChangeState(0),
917 mLastSubmittedMoveResizeSerial(0),
918 mMoveResizeSerial(0),
919 mNotificationLevelChangeDone(true),
920 mScreenOffModeChangeDone(true),
923 mBrightnessChangeDone(true)
925 Initialize(positionSize, surface, isTransparent);
928 WindowBaseEcoreWl2::~WindowBaseEcoreWl2()
930 #if defined(VCONF_ENABLED)
931 vconf_ignore_key_changed(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, VconfNotifyFontSizeChanged);
932 vconf_ignore_key_changed(DALI_VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_NAME, VconfNotifyFontNameChanged);
935 for(Dali::Vector<Ecore_Event_Handler*>::Iterator iter = mEcoreEventHandler.Begin(), endIter = mEcoreEventHandler.End(); iter != endIter; ++iter)
937 ecore_event_handler_del(*iter);
939 mEcoreEventHandler.Clear();
943 wl_event_queue_destroy(mEventQueue);
946 mSupportedAuxiliaryHints.clear();
947 mAuxiliaryHints.clear();
949 if(mEglWindow != NULL)
951 wl_egl_window_destroy(mEglWindow);
957 ecore_wl2_window_free(mEcoreWindow);
961 void WindowBaseEcoreWl2::Initialize(PositionSize positionSize, Any surface, bool isTransparent)
963 if(surface.Empty() == false)
965 // check we have a valid type
966 DALI_ASSERT_ALWAYS((surface.GetType() == typeid(Ecore_Wl2_Window*)) && "Surface type is invalid");
968 mEcoreWindow = AnyCast<Ecore_Wl2_Window*>(surface);
972 // we own the surface about to created
974 CreateWindow(positionSize);
977 mWlSurface = ecore_wl2_window_surface_get(mEcoreWindow);
979 SetTransparency(isTransparent);
981 Ecore_Wl2_Display* display = ecore_wl2_connected_display_get(NULL);
982 Ecore_Wl2_Input* ecoreWlInput = ecore_wl2_input_default_input_get(display);
986 mKeyMap = ecore_wl2_input_keymap_get(ecoreWlInput);
988 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_SEAT_KEYMAP_CHANGED, EcoreEventSeatKeymapChanged, this));
991 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_WINDOW_ICONIFY_STATE_CHANGE, EcoreEventWindowIconifyStateChanged, this));
992 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_FOCUS_IN, EcoreEventWindowFocusIn, this));
993 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_FOCUS_OUT, EcoreEventWindowFocusOut, this));
994 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_OUTPUT_TRANSFORM, EcoreEventOutputTransform, this));
995 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_IGNORE_OUTPUT_TRANSFORM, EcoreEventIgnoreOutputTransform, this));
997 // Register Rotate event
998 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_WINDOW_ROTATE, EcoreEventRotate, this));
1000 // Register Configure event
1001 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_WINDOW_CONFIGURE, EcoreEventConfigure, this));
1003 // Register Touch events
1004 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_DOWN, EcoreEventMouseButtonDown, this));
1005 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_UP, EcoreEventMouseButtonUp, this));
1006 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_EVENT_MOUSE_MOVE, EcoreEventMouseButtonMove, this));
1007 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_CANCEL, EcoreEventMouseButtonCancel, this));
1008 #ifdef OVER_TIZEN_VERSION_8
1009 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_EVENT_MOUSE_RELATIVE_MOVE, EcoreEventMouseButtonRelativeMove, this));
1011 // Register pointer lock/unlock event
1012 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_POINTER_CONSTRAINTS, EcoreEventPointerConstraints, this));
1015 // Register Mouse wheel events
1016 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_EVENT_MOUSE_WHEEL, EcoreEventMouseWheel, this));
1018 // Register Mouse IO events
1019 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_EVENT_MOUSE_IN, EcoreEventMouseIn, this));
1020 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_EVENT_MOUSE_OUT, EcoreEventMouseOut, this));
1022 // Register Detent event
1023 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_EVENT_DETENT_ROTATE, EcoreEventDetentRotation, this));
1025 // Register Key events
1026 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_EVENT_KEY_DOWN, EcoreEventKeyDown, this));
1027 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_EVENT_KEY_UP, EcoreEventKeyUp, this));
1029 // Register Selection event - clipboard selection
1030 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_DATA_SOURCE_SEND, EcoreEventDataSend, this));
1031 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_OFFER_DATA_READY, EcoreEventDataReceive, this));
1033 // Register Effect Start/End event
1034 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_EFFECT_START, EcoreEventEffectStart, this));
1035 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_EFFECT_END, EcoreEventEffectEnd, this));
1037 // Register Keyboard repeat event
1038 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_SEAT_KEYBOARD_REPEAT_CHANGED, EcoreEventSeatKeyboardRepeatChanged, this));
1040 // Register Window redraw request event
1041 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_WINDOW_REDRAW_REQUEST, EcoreEventWindowRedrawRequest, this));
1043 // Register Window auxiliary event
1044 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_AUX_MESSAGE, EcoreEventWindowAuxiliaryMessage, this));
1046 // Register Conformant change event
1047 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_CONFORMANT_CHANGE, EcoreEventConformantChange, this));
1049 #if defined(VCONF_ENABLED)
1050 // Register Vconf notify - font name and size
1051 vconf_notify_key_changed_for_ui_thread(DALI_VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_NAME, VconfNotifyFontNameChanged, this);
1052 vconf_notify_key_changed_for_ui_thread(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, VconfNotifyFontSizeChanged, this);
1055 // Register Window is moved and resized done event.
1056 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_WINDOW_INTERACTIVE_MOVE_DONE, EcoreEventWindowMoveCompleted, this));
1057 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_WINDOW_INTERACTIVE_RESIZE_DONE, EcoreEventWindowResizeCompleted, this));
1059 mDisplay = ecore_wl2_display_get(display);
1062 wl_display* displayWrapper = static_cast<wl_display*>(wl_proxy_create_wrapper(mDisplay));
1065 mEventQueue = wl_display_create_queue(mDisplay);
1068 wl_proxy_set_queue(reinterpret_cast<wl_proxy*>(displayWrapper), mEventQueue);
1070 wl_registry* registry = wl_display_get_registry(displayWrapper);
1071 wl_registry_add_listener(registry, ®istryListener, this);
1073 // To support ECORE_WL2_EVENT_CONFORMANT_CHANGE event handler
1074 ecore_wl2_window_conformant_set(mEcoreWindow, true);
1077 wl_proxy_wrapper_destroy(displayWrapper);
1081 // get auxiliary hint
1082 Eina_List* hints = ecore_wl2_window_aux_hints_supported_get(mEcoreWindow);
1085 Eina_List* l = NULL;
1088 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))))
1090 mSupportedAuxiliaryHints.push_back(hint);
1092 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::Initialize: %s\n", hint);
1097 Eina_Bool WindowBaseEcoreWl2::OnIconifyStateChanged(void* data, int type, void* event)
1099 Ecore_Wl2_Event_Window_Iconify_State_Change* iconifyChangedEvent(static_cast<Ecore_Wl2_Event_Window_Iconify_State_Change*>(event));
1100 Eina_Bool handled(ECORE_CALLBACK_PASS_ON);
1102 if(iconifyChangedEvent->win == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
1104 if(iconifyChangedEvent->iconified == EINA_TRUE)
1106 mIconifyChangedSignal.Emit(true);
1110 mIconifyChangedSignal.Emit(false);
1112 handled = ECORE_CALLBACK_DONE;
1118 Eina_Bool WindowBaseEcoreWl2::OnFocusIn(void* data, int type, void* event)
1120 Ecore_Wl2_Event_Focus_In* focusInEvent(static_cast<Ecore_Wl2_Event_Focus_In*>(event));
1122 if(focusInEvent->window == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
1124 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "Window EcoreEventWindowFocusIn\n");
1126 mFocusChangedSignal.Emit(true);
1129 return ECORE_CALLBACK_PASS_ON;
1132 Eina_Bool WindowBaseEcoreWl2::OnFocusOut(void* data, int type, void* event)
1134 Ecore_Wl2_Event_Focus_Out* focusOutEvent(static_cast<Ecore_Wl2_Event_Focus_Out*>(event));
1136 if(focusOutEvent->window == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
1138 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "Window EcoreEventWindowFocusOut\n");
1140 mFocusChangedSignal.Emit(false);
1143 return ECORE_CALLBACK_PASS_ON;
1146 Eina_Bool WindowBaseEcoreWl2::OnOutputTransform(void* data, int type, void* event)
1148 Ecore_Wl2_Event_Output_Transform* transformEvent(static_cast<Ecore_Wl2_Event_Output_Transform*>(event));
1150 if(transformEvent->output == ecore_wl2_window_output_find(mEcoreWindow))
1152 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "Window (%p) EcoreEventOutputTransform\n", mEcoreWindow);
1154 mScreenRotationAngle = GetScreenRotationAngle();
1156 mOutputTransformedSignal.Emit();
1159 return ECORE_CALLBACK_PASS_ON;
1162 Eina_Bool WindowBaseEcoreWl2::OnIgnoreOutputTransform(void* data, int type, void* event)
1164 Ecore_Wl2_Event_Ignore_Output_Transform* ignoreTransformEvent(static_cast<Ecore_Wl2_Event_Ignore_Output_Transform*>(event));
1166 if(ignoreTransformEvent->win == mEcoreWindow)
1168 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "Window (%p) EcoreEventIgnoreOutputTransform\n", mEcoreWindow);
1170 mScreenRotationAngle = GetScreenRotationAngle();
1172 mOutputTransformedSignal.Emit();
1175 return ECORE_CALLBACK_PASS_ON;
1178 void WindowBaseEcoreWl2::OnRotation(void* data, int type, void* event)
1180 Ecore_Wl2_Event_Window_Rotation* ev(static_cast<Ecore_Wl2_Event_Window_Rotation*>(event));
1182 if(ev->win == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
1184 DALI_LOG_RELEASE_INFO("WindowBaseEcoreWl2::OnRotation, angle: %d, width: %d, height: %d\n", ev->angle, ev->w, ev->h);
1186 RotationEvent rotationEvent;
1187 rotationEvent.angle = ev->angle;
1188 rotationEvent.winResize = 0;
1190 if(ev->w == 0 || ev->h == 0)
1192 // When rotation event does not have the window width or height,
1193 // previous DALi side window's size are used.
1194 ev->w = mWindowPositionSize.width;
1195 ev->h = mWindowPositionSize.height;
1198 mWindowRotationAngle = ev->angle;
1200 mWindowPositionSize.width = ev->w;
1201 mWindowPositionSize.height = ev->h;
1203 PositionSize newPositionSize = RecalculatePositionSizeToCurrentOrientation(mWindowPositionSize);
1205 rotationEvent.x = newPositionSize.x;
1206 rotationEvent.y = newPositionSize.y;
1207 rotationEvent.width = newPositionSize.width;
1208 rotationEvent.height = newPositionSize.height;
1210 mRotationSignal.Emit(rotationEvent);
1214 void WindowBaseEcoreWl2::OnConfiguration(void* data, int type, void* event)
1216 Ecore_Wl2_Event_Window_Configure* ev(static_cast<Ecore_Wl2_Event_Window_Configure*>(event));
1218 if(ev && ev->win == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
1220 // Note: To comply with the wayland protocol, Dali should make an ack_configure
1221 // by calling ecore_wl2_window_commit
1223 int tempWidth = ev->w;
1224 int tempHeight = ev->h;
1226 // Initialize with previous size for skip resize when new size is 0.
1227 // When window is just moved or window is resized by client application,
1228 // The configure notification event's size will be 0.
1229 // If new size is 0, the resized work should be skip.
1230 int newWidth = mWindowPositionSize.width;
1231 int newHeight = mWindowPositionSize.height;
1232 bool windowMoved = false, windowResized = false;
1234 if(ev->x != mWindowPositionSize.x || ev->y != mWindowPositionSize.y)
1239 if(tempWidth != 0 && tempHeight != 0 && (tempWidth != mWindowPositionSize.width || tempHeight != mWindowPositionSize.height))
1241 windowResized = true;
1242 newWidth = tempWidth;
1243 newHeight = tempHeight;
1246 if(windowMoved || windowResized)
1248 mWindowPositionSize.x = ev->x;
1249 mWindowPositionSize.y = ev->y;
1250 mWindowPositionSize.width = newWidth;
1251 mWindowPositionSize.height = newHeight;
1252 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);
1254 ecore_wl2_window_geometry_set(mEcoreWindow, mWindowPositionSize.x, mWindowPositionSize.y, mWindowPositionSize.width, mWindowPositionSize.height);
1256 Dali::PositionSize newPositionSize = RecalculatePositionSizeToCurrentOrientation(mWindowPositionSize);
1257 mUpdatePositionSizeSignal.Emit(newPositionSize);
1260 mMaximizeChangedSignal.Emit(static_cast<bool>(ev->states & ECORE_WL2_WINDOW_STATE_MAXIMIZED));
1262 ecore_wl2_window_commit(mEcoreWindow, EINA_FALSE);
1266 void WindowBaseEcoreWl2::OnMouseButtonDown(void* data, int type, void* event)
1268 Ecore_Event_Mouse_Button* touchEvent = static_cast<Ecore_Event_Mouse_Button*>(event);
1270 if(touchEvent->window == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
1272 DALI_TRACE_SCOPE(gTraceFilter, "DALI_ON_MOUSE_DOWN");
1274 Device::Class::Type deviceClass;
1275 Device::Subclass::Type deviceSubclass;
1277 GetDeviceClass(ecore_device_class_get(touchEvent->dev), deviceClass);
1278 GetDeviceSubclass(ecore_device_subclass_get(touchEvent->dev), deviceSubclass);
1280 PointState::Type state(PointState::DOWN);
1282 if(deviceClass != Device::Class::Type::MOUSE)
1284 // Check if the buttons field is set and ensure it's the primary touch button.
1285 // If this event was triggered by buttons other than the primary button (used for touch), then
1286 // just send an interrupted event to Core.
1287 if(touchEvent->buttons && (touchEvent->buttons != PRIMARY_TOUCH_BUTTON_ID))
1289 state = PointState::INTERRUPTED;
1293 Integration::Point point;
1294 point.SetDeviceId(touchEvent->multi.device);
1295 point.SetState(state);
1296 point.SetScreenPosition(Vector2(touchEvent->x, touchEvent->y));
1297 point.SetRadius(touchEvent->multi.radius, Vector2(touchEvent->multi.radius_x, touchEvent->multi.radius_y));
1298 point.SetPressure(touchEvent->multi.pressure);
1299 point.SetAngle(Degree(touchEvent->multi.angle));
1300 point.SetDeviceClass(deviceClass);
1301 point.SetDeviceSubclass(deviceSubclass);
1302 point.SetMouseButton(static_cast<MouseButton::Type>(touchEvent->buttons));
1304 mTouchEventSignal.Emit(point, touchEvent->timestamp);
1308 void WindowBaseEcoreWl2::OnMouseButtonUp(void* data, int type, void* event)
1310 Ecore_Event_Mouse_Button* touchEvent = static_cast<Ecore_Event_Mouse_Button*>(event);
1312 if(touchEvent->window == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
1314 DALI_TRACE_SCOPE(gTraceFilter, "DALI_ON_MOUSE_UP");
1316 Device::Class::Type deviceClass;
1317 Device::Subclass::Type deviceSubclass;
1319 GetDeviceClass(ecore_device_class_get(touchEvent->dev), deviceClass);
1320 GetDeviceSubclass(ecore_device_subclass_get(touchEvent->dev), deviceSubclass);
1322 Integration::Point point;
1323 point.SetDeviceId(touchEvent->multi.device);
1324 point.SetState(PointState::UP);
1325 point.SetScreenPosition(Vector2(touchEvent->x, touchEvent->y));
1326 point.SetRadius(touchEvent->multi.radius, Vector2(touchEvent->multi.radius_x, touchEvent->multi.radius_y));
1327 point.SetPressure(touchEvent->multi.pressure);
1328 point.SetAngle(Degree(touchEvent->multi.angle));
1329 point.SetDeviceClass(deviceClass);
1330 point.SetDeviceSubclass(deviceSubclass);
1331 point.SetMouseButton(static_cast<MouseButton::Type>(touchEvent->buttons));
1333 mTouchEventSignal.Emit(point, touchEvent->timestamp);
1337 void WindowBaseEcoreWl2::OnMouseButtonMove(void* data, int type, void* event)
1339 Ecore_Event_Mouse_Move* touchEvent = static_cast<Ecore_Event_Mouse_Move*>(event);
1341 if(touchEvent->window == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
1343 DALI_TRACE_SCOPE(gTraceFilter, "DALI_ON_MOUSE_MOVE");
1345 Device::Class::Type deviceClass;
1346 Device::Subclass::Type deviceSubclass;
1348 GetDeviceClass(ecore_device_class_get(touchEvent->dev), deviceClass);
1349 GetDeviceSubclass(ecore_device_subclass_get(touchEvent->dev), deviceSubclass);
1351 Integration::Point point;
1352 point.SetDeviceId(touchEvent->multi.device);
1353 point.SetState(PointState::MOTION);
1354 point.SetScreenPosition(Vector2(touchEvent->x, touchEvent->y));
1355 point.SetRadius(touchEvent->multi.radius, Vector2(touchEvent->multi.radius_x, touchEvent->multi.radius_y));
1356 point.SetPressure(touchEvent->multi.pressure);
1357 point.SetAngle(Degree(touchEvent->multi.angle));
1358 point.SetDeviceClass(deviceClass);
1359 point.SetDeviceSubclass(deviceSubclass);
1361 mTouchEventSignal.Emit(point, touchEvent->timestamp);
1365 #ifdef OVER_TIZEN_VERSION_8
1366 void WindowBaseEcoreWl2::OnMouseButtonRelativeMove(void* data, int type, void* event)
1368 Ecore_Event_Mouse_Relative_Move* relativeMoveEvent = static_cast<Ecore_Event_Mouse_Relative_Move*>(event);
1370 if(relativeMoveEvent->window == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
1372 DALI_TRACE_SCOPE(gTraceFilter, "DALI_ON_MOUSE_RELATIVE_MOVE");
1374 Device::Class::Type deviceClass;
1375 Device::Subclass::Type deviceSubclass;
1377 GetDeviceClass(ecore_device_class_get(relativeMoveEvent->dev), deviceClass);
1378 GetDeviceSubclass(ecore_device_subclass_get(relativeMoveEvent->dev), deviceSubclass);
1380 Dali::DevelWindow::MouseRelativeEvent mouseRelativeEvent(Dali::DevelWindow::MouseRelativeEvent::Type::RELATIVE_MOVE, relativeMoveEvent->modifiers, relativeMoveEvent->timestamp, Vector2(relativeMoveEvent->dx, relativeMoveEvent->dy), Vector2(relativeMoveEvent->dx_unaccel, relativeMoveEvent->dy_unaccel), deviceClass, deviceSubclass);
1382 mMouseRelativeEventSignal.Emit(mouseRelativeEvent);
1387 void WindowBaseEcoreWl2::OnMouseButtonCancel(void* data, int type, void* event)
1389 Ecore_Event_Mouse_Button* touchEvent = static_cast<Ecore_Event_Mouse_Button*>(event);
1391 if(touchEvent->window == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
1393 DALI_TRACE_SCOPE(gTraceFilter, "DALI_ON_MOUSE_CANCEL");
1395 Integration::Point point;
1396 point.SetDeviceId(touchEvent->multi.device);
1397 point.SetState(PointState::INTERRUPTED);
1398 point.SetScreenPosition(Vector2(0.0f, 0.0f));
1400 mTouchEventSignal.Emit(point, touchEvent->timestamp);
1402 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::OnMouseButtonCancel\n");
1406 #ifdef OVER_TIZEN_VERSION_8
1407 void WindowBaseEcoreWl2::OnPointerConstraints(void* data, int type, void* event)
1409 Ecore_Wl2_Event_Pointer_Constraints* constraintsEvent = static_cast<Ecore_Wl2_Event_Pointer_Constraints*>(event);
1411 if(constraintsEvent && constraintsEvent->win == static_cast<uint32_t>(ecore_wl2_window_id_get(mEcoreWindow)))
1413 DALI_TRACE_SCOPE(gTraceFilter, "DALI_ON_POINTER_CONSTRAINTS");
1414 Dali::Int32Pair position(constraintsEvent->x, constraintsEvent->y);
1415 DALI_LOG_RELEASE_INFO("WindowBaseEcoreWl2::OnPointerConstraints[%d, %d]\n", position.GetX(), position.GetY());
1417 mPointerConstraintsSignal.Emit(position, constraintsEvent->locked, constraintsEvent->confined);
1422 void WindowBaseEcoreWl2::OnMouseWheel(void* data, int type, void* event)
1424 Ecore_Event_Mouse_Wheel* mouseWheelEvent = static_cast<Ecore_Event_Mouse_Wheel*>(event);
1426 if(mouseWheelEvent->window == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
1428 DALI_TRACE_SCOPE(gTraceFilter, "DALI_ON_MOUSE_WHEEL");
1430 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);
1432 Integration::WheelEvent wheelEvent(Integration::WheelEvent::MOUSE_WHEEL, mouseWheelEvent->direction, mouseWheelEvent->modifiers, Vector2(mouseWheelEvent->x, mouseWheelEvent->y), mouseWheelEvent->z, mouseWheelEvent->timestamp);
1434 mWheelEventSignal.Emit(wheelEvent);
1438 void WindowBaseEcoreWl2::OnMouseInOut(void* data, int type, void* event, Dali::DevelWindow::MouseInOutEvent::Type action)
1440 Ecore_Event_Mouse_IO* mouseInOutEvent = static_cast<Ecore_Event_Mouse_IO*>(event);
1442 if(mouseInOutEvent->window == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
1444 DALI_TRACE_SCOPE(gTraceFilter, "DALI_ON_MOUSE_IN_OUT");
1446 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);
1448 Device::Class::Type deviceClass;
1449 Device::Subclass::Type deviceSubclass;
1451 GetDeviceClass(ecore_device_class_get(mouseInOutEvent->dev), deviceClass);
1452 GetDeviceSubclass(ecore_device_subclass_get(mouseInOutEvent->dev), deviceSubclass);
1454 Dali::DevelWindow::MouseInOutEvent inOutEvent(action, mouseInOutEvent->modifiers, Vector2(mouseInOutEvent->x, mouseInOutEvent->y), mouseInOutEvent->timestamp, deviceClass, deviceSubclass);
1456 mMouseInOutEventSignal.Emit(inOutEvent);
1460 void WindowBaseEcoreWl2::OnDetentRotation(void* data, int type, void* event)
1462 Ecore_Event_Detent_Rotate* detentEvent = static_cast<Ecore_Event_Detent_Rotate*>(event);
1464 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Concise, "WindowBaseEcoreWl2::OnDetentRotation\n");
1466 int32_t clockwise = (detentEvent->direction == ECORE_DETENT_DIRECTION_CLOCKWISE) ? 1 : -1;
1468 Integration::WheelEvent wheelEvent(Integration::WheelEvent::CUSTOM_WHEEL, detentEvent->direction, 0, Vector2(0.0f, 0.0f), clockwise, detentEvent->timestamp);
1470 mWheelEventSignal.Emit(wheelEvent);
1473 void WindowBaseEcoreWl2::OnKeyDown(void* data, int type, void* event)
1475 Ecore_Event_Key* keyEvent = static_cast<Ecore_Event_Key*>(event);
1477 if(keyEvent->window == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
1479 std::string keyName(keyEvent->keyname);
1480 std::string logicalKey("");
1481 std::string keyString("");
1482 std::string compose("");
1484 DALI_TRACE_SCOPE(gTraceFilter, "DALI_ON_KEY_DOWN");
1486 // Ensure key compose string is not NULL as keys like SHIFT or arrow have a null string.
1487 if(keyEvent->compose)
1489 compose = keyEvent->compose;
1492 // Ensure key symbol is not NULL as keys like SHIFT have a null string.
1495 logicalKey = keyEvent->key;
1499 GetKeyCode(keyName, keyCode); // Get key code dynamically.
1503 // Get a specific key code from dali key look up table.
1504 keyCode = KeyLookup::GetDaliKeyCode(keyEvent->keyname);
1507 keyCode = (keyCode == -1) ? 0 : keyCode;
1508 int modifier(keyEvent->modifiers);
1509 unsigned long time = keyEvent->timestamp;
1510 if(!strncmp(keyEvent->keyname, "Keycode-", 8))
1512 keyCode = atoi(keyEvent->keyname + 8);
1515 // Ensure key event string is not NULL as keys like SHIFT have a null string.
1516 if(keyEvent->string)
1518 keyString = keyEvent->string;
1521 std::string deviceName;
1522 Device::Class::Type deviceClass;
1523 Device::Subclass::Type deviceSubclass;
1525 GetDeviceName(keyEvent, deviceName);
1526 GetDeviceClass(ecore_device_class_get(keyEvent->dev), deviceClass);
1527 GetDeviceSubclass(ecore_device_subclass_get(keyEvent->dev), deviceSubclass);
1529 bool isRepeat = false;
1530 #ifdef OVER_TIZEN_VERSION_8
1531 if(keyEvent->event_flags & ECORE_EVENT_FLAG_REPEAT)
1537 Integration::KeyEvent keyEvent(keyName, logicalKey, keyString, keyCode, modifier, time, Integration::KeyEvent::DOWN, compose, deviceName, deviceClass, deviceSubclass);
1538 keyEvent.isRepeat = isRepeat;
1540 mKeyEventSignal.Emit(keyEvent);
1544 void WindowBaseEcoreWl2::OnKeyUp(void* data, int type, void* event)
1546 Ecore_Event_Key* keyEvent = static_cast<Ecore_Event_Key*>(event);
1548 if(keyEvent->window == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
1550 #if defined(ECORE_VERSION_MAJOR) && (ECORE_VERSION_MAJOR >= 1) && defined(ECORE_VERSION_MINOR) && (ECORE_VERSION_MINOR >= 23)
1551 // Cancel processing flag is sent because this key event will combine with the previous key. So, the event should not actually perform anything.
1552 if(keyEvent->event_flags & ECORE_EVENT_FLAG_CANCEL)
1554 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::OnKeyUp: This event flag indicates the event is canceled. \n");
1557 #endif // Since ecore 1.23 version
1559 std::string keyName(keyEvent->keyname);
1560 std::string logicalKey("");
1561 std::string keyString("");
1562 std::string compose("");
1564 DALI_TRACE_SCOPE(gTraceFilter, "DALI_ON_KEY_UP");
1566 // Ensure key compose string is not NULL as keys like SHIFT or arrow have a null string.
1567 if(keyEvent->compose)
1569 compose = keyEvent->compose;
1572 // Ensure key symbol is not NULL as keys like SHIFT have a null string.
1575 logicalKey = keyEvent->key;
1579 GetKeyCode(keyName, keyCode); // Get key code dynamically.
1583 // Get a specific key code from dali key look up table.
1584 keyCode = KeyLookup::GetDaliKeyCode(keyEvent->keyname);
1587 keyCode = (keyCode == -1) ? 0 : keyCode;
1588 int modifier(keyEvent->modifiers);
1589 unsigned long time = keyEvent->timestamp;
1590 if(!strncmp(keyEvent->keyname, "Keycode-", 8))
1592 keyCode = atoi(keyEvent->keyname + 8);
1595 // Ensure key event string is not NULL as keys like SHIFT have a null string.
1596 if(keyEvent->string)
1598 keyString = keyEvent->string;
1601 std::string deviceName;
1602 Device::Class::Type deviceClass;
1603 Device::Subclass::Type deviceSubclass;
1605 GetDeviceName(keyEvent, deviceName);
1606 GetDeviceClass(ecore_device_class_get(keyEvent->dev), deviceClass);
1607 GetDeviceSubclass(ecore_device_subclass_get(keyEvent->dev), deviceSubclass);
1609 Integration::KeyEvent keyEvent(keyName, logicalKey, keyString, keyCode, modifier, time, Integration::KeyEvent::UP, compose, deviceName, deviceClass, deviceSubclass);
1611 mKeyEventSignal.Emit(keyEvent);
1615 void WindowBaseEcoreWl2::OnDataSend(void* data, int type, void* event)
1617 mSelectionDataSendSignal.Emit(event);
1620 void WindowBaseEcoreWl2::OnDataReceive(void* data, int type, void* event)
1622 mSelectionDataReceivedSignal.Emit(event);
1625 void WindowBaseEcoreWl2::OnFontNameChanged()
1627 mStyleChangedSignal.Emit(StyleChange::DEFAULT_FONT_CHANGE);
1630 void WindowBaseEcoreWl2::OnFontSizeChanged()
1632 mStyleChangedSignal.Emit(StyleChange::DEFAULT_FONT_SIZE_CHANGE);
1635 void WindowBaseEcoreWl2::OnTransitionEffectEvent(WindowEffectState state, WindowEffectType type)
1637 mTransitionEffectEventSignal.Emit(state, type);
1640 void WindowBaseEcoreWl2::OnKeyboardRepeatSettingsChanged()
1642 mKeyboardRepeatSettingsChangedSignal.Emit();
1645 void WindowBaseEcoreWl2::OnEcoreEventWindowRedrawRequest()
1647 mWindowRedrawRequestSignal.Emit();
1650 void WindowBaseEcoreWl2::OnEcoreEventWindowAuxiliaryMessage(void* event)
1652 Ecore_Wl2_Event_Aux_Message* message = static_cast<Ecore_Wl2_Event_Aux_Message*>(event);
1655 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::OnEcoreEventWindowAuxiliaryMessage, key:%s, value:%s \n", message->key, message->val);
1656 std::string key(message->key);
1657 std::string value(message->val);
1658 Dali::Property::Array options;
1660 if(message->options)
1664 EINA_LIST_FOREACH(message->options, l, data)
1666 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::OnEcoreEventWindowAuxiliaryMessage, option: %s\n", (char*)data);
1667 std::string option(static_cast<char*>(data));
1668 options.Add(option);
1672 mAuxiliaryMessageSignal.Emit(key, value, options);
1676 void WindowBaseEcoreWl2::OnEcoreEventConformantChange(void* event)
1678 Ecore_Wl2_Event_Conformant_Change* ev = static_cast<Ecore_Wl2_Event_Conformant_Change*>(event);
1679 if(ev && ev->win == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
1681 WindowInsetsPartType partType = WindowInsetsPartType::STATUS_BAR;
1688 switch(ev->part_type)
1690 case ECORE_WL2_INDICATOR_PART:
1692 partType = WindowInsetsPartType::STATUS_BAR;
1693 ecore_wl2_window_indicator_geometry_get(mEcoreWindow, &x, &y, &w, &h);
1696 case ECORE_WL2_KEYBOARD_PART:
1698 partType = WindowInsetsPartType::KEYBOARD;
1699 ecore_wl2_window_keyboard_geometry_get(mEcoreWindow, &x, &y, &w, &h);
1702 case ECORE_WL2_CLIPBOARD_PART:
1704 partType = WindowInsetsPartType::CLIPBOARD;
1705 ecore_wl2_window_clipboard_geometry_get(mEcoreWindow, &x, &y, &w, &h);
1714 WindowInsetsPartState partState = WindowInsetsPartState::INVISIBLE;
1721 // Insets are applied only if system UI(e.g. virtual keyboard) satisfies the following 2 conditions.
1722 // 1. System UI fits to the window width or height.
1723 // 2. System UI begins or ends from the edge of window.
1724 // Otherwise, we should not resize window content because there would be empty space around system UI.
1725 bool applyInsets = false;
1727 // Zero insets are applied if state is invisible
1734 partState = WindowInsetsPartState::VISIBLE;
1736 int winX = mWindowPositionSize.x;
1737 int winY = mWindowPositionSize.y;
1738 int winW = mWindowPositionSize.width;
1739 int winH = mWindowPositionSize.height;
1741 if((x <= winX) && (x + w >= winX + winW))
1743 if((y <= winY) && (y + h >= winY) && (y + h <= winY + winH))
1748 else if((y + h >= winY + winH) && (y >= winY) && (y <= winY + winH))
1750 bottom = winY + winH - y;
1754 else if((y <= winY) && (y + h >= winY + winH))
1756 if((x <= winX) && (x + w >= winX) && (x + w <= winX + winW))
1758 left = x + w - winX;
1761 else if((x + w >= winX + winW) && (x >= winX) && (x <= winX + winW))
1763 right = winX + winW - x;
1771 mInsetsChangedSignal.Emit(partType, partState, Extents(left, right, top, bottom));
1776 void WindowBaseEcoreWl2::KeymapChanged(void* data, int type, void* event)
1778 Ecore_Wl2_Event_Seat_Keymap_Changed* changed = static_cast<Ecore_Wl2_Event_Seat_Keymap_Changed*>(event);
1779 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::KeymapChanged, keymap id[ %d ]\n", changed->id);
1780 Ecore_Wl2_Input* ecoreWlInput = ecore_wl2_input_default_input_get(changed->display);
1783 mKeyMap = ecore_wl2_input_keymap_get(ecoreWlInput);
1787 void WindowBaseEcoreWl2::OnMoveCompleted(void* event)
1789 Ecore_Wl2_Event_Window_Interactive_Move_Done* movedDoneEvent = static_cast<Ecore_Wl2_Event_Window_Interactive_Move_Done*>(event);
1790 if(movedDoneEvent && movedDoneEvent->win == static_cast<uint32_t>(ecore_wl2_window_id_get(mEcoreWindow)))
1792 Dali::PositionSize orgPositionSize(movedDoneEvent->x, movedDoneEvent->y, movedDoneEvent->w, movedDoneEvent->h);
1793 Dali::PositionSize newPositionSize = RecalculatePositionSizeToCurrentOrientation(orgPositionSize);
1794 Dali::Int32Pair newPosition(newPositionSize.x, newPositionSize.y);
1795 DALI_LOG_RELEASE_INFO("window(%p) has been moved by server[%d, %d]\n", mEcoreWindow, newPositionSize.x, newPositionSize.y);
1796 mMoveCompletedSignal.Emit(newPosition);
1800 void WindowBaseEcoreWl2::OnResizeCompleted(void* event)
1802 Ecore_Wl2_Event_Window_Interactive_Resize_Done* resizedDoneEvent = static_cast<Ecore_Wl2_Event_Window_Interactive_Resize_Done*>(event);
1803 if(resizedDoneEvent && resizedDoneEvent->win == static_cast<uint32_t>(ecore_wl2_window_id_get(mEcoreWindow)))
1805 Dali::PositionSize orgPositionSize(resizedDoneEvent->x, resizedDoneEvent->y, resizedDoneEvent->w, resizedDoneEvent->h);
1806 Dali::PositionSize newPositionSize = RecalculatePositionSizeToCurrentOrientation(orgPositionSize);
1807 Dali::Uint16Pair newSize(newPositionSize.width, newPositionSize.height);
1808 DALI_LOG_RELEASE_INFO("window(%p) has been resized by server[%d, %d]\n", mEcoreWindow, newPositionSize.width, newPositionSize.height);
1809 mResizeCompletedSignal.Emit(newSize);
1813 void WindowBaseEcoreWl2::RegistryGlobalCallback(void* data, struct wl_registry* registry, uint32_t name, const char* interface, uint32_t version)
1815 if(strcmp(interface, tizen_policy_interface.name) == 0)
1817 uint32_t clientVersion = std::min(version, MAX_TIZEN_CLIENT_VERSION);
1819 mTizenPolicy = static_cast<tizen_policy*>(wl_registry_bind(registry, name, &tizen_policy_interface, clientVersion));
1822 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::RegistryGlobalCallback: wl_registry_bind(tizen_policy_interface) is failed.\n");
1826 tizen_policy_add_listener(mTizenPolicy, &tizenPolicyListener, data);
1828 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::RegistryGlobalCallback: tizen_policy_add_listener is called.\n");
1830 else if(strcmp(interface, tizen_display_policy_interface.name) == 0)
1832 mTizenDisplayPolicy = static_cast<tizen_display_policy*>(wl_registry_bind(registry, name, &tizen_display_policy_interface, version));
1833 if(!mTizenDisplayPolicy)
1835 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::RegistryGlobalCallback: wl_registry_bind(tizen_display_policy_interface) is failed.\n");
1839 tizen_display_policy_add_listener(mTizenDisplayPolicy, &tizenDisplayPolicyListener, data);
1841 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::RegistryGlobalCallback: tizen_display_policy_add_listener is called.\n");
1845 void WindowBaseEcoreWl2::RegistryGlobalCallbackRemove(void* data, struct wl_registry* registry, uint32_t id)
1847 mTizenPolicy = NULL;
1848 mTizenDisplayPolicy = NULL;
1851 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)
1853 int originalX, originalY, originalWidth, originalHeight;
1854 bool changed = false;
1858 DALI_LOG_ERROR("Failed to get wayland surface in WindowBaseEcoreWl2::TizenPolicyConformantArea()\n");
1862 if(conformantPart == TIZEN_POLICY_CONFORMANT_PART_INDICATOR)
1864 ecore_wl2_window_indicator_geometry_get(mEcoreWindow, &originalX, &originalY, &originalWidth, &originalHeight);
1865 if((originalX != x) || (originalY != y) || (originalWidth != w) || (originalHeight != h))
1867 ecore_wl2_window_indicator_geometry_set(mEcoreWindow, x, y, w, h);
1872 * The given state is based on the visibility value of indicator.
1873 * Thus we need to add 1 to it before comparing with indicator state.
1875 Ecore_Wl2_Indicator_State indState = ecore_wl2_window_indicator_state_get(mEcoreWindow);
1876 if((state + 1) != indState)
1878 ecore_wl2_window_indicator_state_set(mEcoreWindow, static_cast<Ecore_Wl2_Indicator_State>(state + 1));
1882 else if(conformantPart == TIZEN_POLICY_CONFORMANT_PART_KEYBOARD)
1884 ecore_wl2_window_keyboard_geometry_get(mEcoreWindow, &originalX, &originalY, &originalWidth, &originalHeight);
1885 if((originalX != x) || (originalY != y) || (originalWidth != w) || (originalHeight != h))
1887 ecore_wl2_window_keyboard_geometry_set(mEcoreWindow, x, y, w, h);
1892 * The given state is based on the visibility value of virtual keyboard window.
1893 * Thus we need to add 1 to it before comparing with keyboard state.
1895 Ecore_Wl2_Virtual_Keyboard_State kbdState = ecore_wl2_window_keyboard_state_get(mEcoreWindow);
1896 if((state + 1) != (kbdState))
1898 ecore_wl2_window_keyboard_state_set(mEcoreWindow, static_cast<Ecore_Wl2_Virtual_Keyboard_State>(state + 1));
1902 else if(conformantPart == TIZEN_POLICY_CONFORMANT_PART_CLIPBOARD)
1904 ecore_wl2_window_clipboard_geometry_get(mEcoreWindow, &originalX, &originalY, &originalWidth, &originalHeight);
1905 if((originalX != x) || (originalY != y) || (originalWidth != w) || (originalHeight != h))
1907 ecore_wl2_window_clipboard_geometry_set(mEcoreWindow, x, y, w, h);
1912 * The given state is based on the visibility value of clipboard window.
1913 * Thus we need to add 1 to it before comparing with clipboard state.
1915 Ecore_Wl2_Clipboard_State clipState = ecore_wl2_window_clipboard_state_get(mEcoreWindow);
1916 if((state + 1) != clipState)
1918 ecore_wl2_window_clipboard_state_set(mEcoreWindow, static_cast<Ecore_Wl2_Clipboard_State>(state + 1));
1925 Ecore_Wl2_Event_Conformant_Change* ev = static_cast<Ecore_Wl2_Event_Conformant_Change*>(calloc(1, sizeof(Ecore_Wl2_Event_Conformant_Change)));
1931 ev->win = GetNativeWindowId();
1932 ev->part_type = static_cast<Ecore_Wl2_Conformant_Part_Type>(conformantPart);
1934 ecore_event_add(ECORE_WL2_EVENT_CONFORMANT_CHANGE, ev, NULL, NULL);
1937 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);
1940 void WindowBaseEcoreWl2::TizenPolicyNotificationChangeDone(void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, int32_t level, uint32_t state)
1942 mNotificationLevel = level;
1943 mNotificationChangeState = state;
1944 mNotificationLevelChangeDone = true;
1946 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::TizenPolicyNotificationChangeDone: level = %d, state = %d\n", level, state);
1949 void WindowBaseEcoreWl2::TizenPolicyScreenModeChangeDone(void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, uint32_t mode, uint32_t state)
1951 mScreenOffMode = mode;
1952 mScreenOffModeChangeState = state;
1953 mScreenOffModeChangeDone = true;
1955 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::TizenPolicyScreenModeChangeDone: mode = %d, state = %d\n", mode, state);
1958 void WindowBaseEcoreWl2::DisplayPolicyBrightnessChangeDone(void* data, struct tizen_display_policy* displayPolicy, struct wl_surface* surface, int32_t brightness, uint32_t state)
1960 mBrightness = brightness;
1961 mBrightnessChangeState = state;
1962 mBrightnessChangeDone = true;
1964 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::DisplayPolicyBrightnessChangeDone: brightness = %d, state = %d\n", brightness, state);
1967 void WindowBaseEcoreWl2::GetKeyCode(std::string keyName, int32_t& keyCode)
1969 xkb_keysym_t sym = XKB_KEY_NoSymbol;
1970 KeyCodeMap foundKeyCode;
1972 sym = xkb_keysym_from_name(keyName.c_str(), XKB_KEYSYM_NO_FLAGS);
1973 if(sym == XKB_KEY_NoSymbol || !mKeyMap)
1975 DALI_LOG_ERROR("Failed to get keysym or keymap in WindowBaseEcoreWl2\n");
1979 foundKeyCode.keySym = sym;
1980 foundKeyCode.isKeyCode = false;
1981 xkb_keymap_key_for_each(mKeyMap, FindKeyCode, &foundKeyCode);
1982 keyCode = static_cast<int32_t>(foundKeyCode.keyCode);
1985 Any WindowBaseEcoreWl2::GetNativeWindow()
1987 return mEcoreWindow;
1990 int WindowBaseEcoreWl2::GetNativeWindowId()
1992 return ecore_wl2_window_id_get(mEcoreWindow);
1995 std::string WindowBaseEcoreWl2::GetNativeWindowResourceId()
1997 #ifdef OVER_TIZEN_VERSION_7
1998 return std::to_string(ecore_wl2_window_resource_id_get(mEcoreWindow));
2000 return std::string();
2004 EGLNativeWindowType WindowBaseEcoreWl2::CreateEglWindow(int width, int height)
2006 int totalAngle = (mWindowRotationAngle + mScreenRotationAngle) % 360;
2008 START_DURATION_CHECK();
2009 if(totalAngle == 90 || totalAngle == 270)
2011 mEglWindow = wl_egl_window_create(mWlSurface, height, width);
2015 mEglWindow = wl_egl_window_create(mWlSurface, width, height);
2017 FINISH_DURATION_CHECK("wl_egl_window_create");
2019 return static_cast<EGLNativeWindowType>(mEglWindow);
2022 void WindowBaseEcoreWl2::DestroyEglWindow()
2024 if(mEglWindow != NULL)
2026 START_DURATION_CHECK();
2027 wl_egl_window_destroy(mEglWindow);
2028 FINISH_DURATION_CHECK("wl_egl_window_destroy");
2034 void WindowBaseEcoreWl2::SetEglWindowRotation(int angle)
2036 wl_egl_window_tizen_rotation rotation;
2042 rotation = WL_EGL_WINDOW_TIZEN_ROTATION_0;
2047 rotation = WL_EGL_WINDOW_TIZEN_ROTATION_270;
2052 rotation = WL_EGL_WINDOW_TIZEN_ROTATION_180;
2057 rotation = WL_EGL_WINDOW_TIZEN_ROTATION_90;
2062 rotation = WL_EGL_WINDOW_TIZEN_ROTATION_0;
2067 START_DURATION_CHECK();
2068 wl_egl_window_tizen_set_rotation(mEglWindow, rotation);
2069 FINISH_DURATION_CHECK("wl_egl_window_tizen_set_rotation");
2072 void WindowBaseEcoreWl2::SetEglWindowBufferTransform(int angle)
2074 wl_output_transform bufferTransform;
2080 bufferTransform = WL_OUTPUT_TRANSFORM_NORMAL;
2085 bufferTransform = WL_OUTPUT_TRANSFORM_90;
2090 bufferTransform = WL_OUTPUT_TRANSFORM_180;
2095 bufferTransform = WL_OUTPUT_TRANSFORM_270;
2100 bufferTransform = WL_OUTPUT_TRANSFORM_NORMAL;
2105 DALI_LOG_RELEASE_INFO("wl_egl_window_tizen_set_buffer_transform() with buffer Transform [%d]\n", bufferTransform);
2106 START_DURATION_CHECK();
2107 wl_egl_window_tizen_set_buffer_transform(mEglWindow, bufferTransform);
2108 FINISH_DURATION_CHECK("wl_egl_window_tizen_set_buffer_transform");
2111 void WindowBaseEcoreWl2::SetEglWindowTransform(int angle)
2113 wl_output_transform windowTransform;
2119 windowTransform = WL_OUTPUT_TRANSFORM_NORMAL;
2124 windowTransform = WL_OUTPUT_TRANSFORM_90;
2129 windowTransform = WL_OUTPUT_TRANSFORM_180;
2134 windowTransform = WL_OUTPUT_TRANSFORM_270;
2139 windowTransform = WL_OUTPUT_TRANSFORM_NORMAL;
2144 DALI_LOG_RELEASE_INFO("wl_egl_window_tizen_set_window_transform() with window Transform [%d]\n", windowTransform);
2145 START_DURATION_CHECK();
2146 wl_egl_window_tizen_set_window_transform(mEglWindow, windowTransform);
2147 FINISH_DURATION_CHECK("wl_egl_window_tizen_set_window_transform");
2150 void WindowBaseEcoreWl2::ResizeEglWindow(PositionSize positionSize)
2152 DALI_LOG_RELEASE_INFO("wl_egl_window_resize(), (%d, %d) [%d x %d]\n", positionSize.x, positionSize.y, positionSize.width, positionSize.height);
2153 START_DURATION_CHECK();
2154 wl_egl_window_resize(mEglWindow, positionSize.width, positionSize.height, positionSize.x, positionSize.y);
2156 // Note: Both "Resize" and "MoveResize" cases can reach here, but only "MoveResize" needs to submit serial number
2157 if(mMoveResizeSerial != mLastSubmittedMoveResizeSerial)
2159 wl_egl_window_tizen_set_window_serial(mEglWindow, mMoveResizeSerial);
2160 mLastSubmittedMoveResizeSerial = mMoveResizeSerial;
2162 FINISH_DURATION_CHECK("wl_egl_window functions");
2165 bool WindowBaseEcoreWl2::IsEglWindowRotationSupported()
2167 START_DURATION_CHECK();
2169 wl_egl_window_tizen_capability capability = static_cast<wl_egl_window_tizen_capability>(wl_egl_window_tizen_get_capabilities(mEglWindow));
2170 FINISH_DURATION_CHECK("wl_egl_window_tizen_get_capabilities");
2172 if(capability == WL_EGL_WINDOW_TIZEN_CAPABILITY_ROTATION_SUPPORTED)
2174 mSupportedPreProtation = true;
2177 mSupportedPreProtation = false;
2181 PositionSize WindowBaseEcoreWl2::RecalculatePositionSizeToSystem(PositionSize positionSize)
2183 PositionSize newPositionSize;
2184 int32_t screenWidth, screenHeight;
2185 WindowSystem::GetScreenSize(screenWidth, screenHeight);
2187 if(mWindowRotationAngle == 90)
2189 newPositionSize.x = positionSize.y;
2190 newPositionSize.y = screenHeight - (positionSize.x + positionSize.width);
2191 newPositionSize.width = positionSize.height;
2192 newPositionSize.height = positionSize.width;
2194 else if(mWindowRotationAngle == 180)
2196 newPositionSize.x = screenWidth - (positionSize.x + positionSize.width);
2197 newPositionSize.y = screenHeight - (positionSize.y + positionSize.height);
2198 newPositionSize.width = positionSize.width;
2199 newPositionSize.height = positionSize.height;
2201 else if(mWindowRotationAngle == 270)
2203 newPositionSize.x = screenWidth - (positionSize.y + positionSize.height);
2204 newPositionSize.y = positionSize.x;
2205 newPositionSize.width = positionSize.height;
2206 newPositionSize.height = positionSize.width;
2210 newPositionSize.x = positionSize.x;
2211 newPositionSize.y = positionSize.y;
2212 newPositionSize.width = positionSize.width;
2213 newPositionSize.height = positionSize.height;
2216 return newPositionSize;
2219 PositionSize WindowBaseEcoreWl2::RecalculatePositionSizeToCurrentOrientation(PositionSize positionSize)
2221 PositionSize newPositionSize;
2222 int32_t screenWidth, screenHeight;
2223 WindowSystem::GetScreenSize(screenWidth, screenHeight);
2225 if(mWindowRotationAngle == 90)
2227 newPositionSize.x = screenHeight - (positionSize.y + positionSize.height);
2228 newPositionSize.y = positionSize.x;
2229 newPositionSize.width = positionSize.height;
2230 newPositionSize.height = positionSize.width;
2232 else if(mWindowRotationAngle == 180)
2234 newPositionSize.x = screenWidth - (positionSize.x + positionSize.width);
2235 newPositionSize.y = screenHeight - (positionSize.y + positionSize.height);
2236 newPositionSize.width = positionSize.width;
2237 newPositionSize.height = positionSize.height;
2239 else if(mWindowRotationAngle == 270)
2241 newPositionSize.x = positionSize.y;
2242 newPositionSize.y = screenWidth - (positionSize.x + positionSize.width);
2243 newPositionSize.width = positionSize.height;
2244 newPositionSize.height = positionSize.width;
2248 newPositionSize.x = positionSize.x;
2249 newPositionSize.y = positionSize.y;
2250 newPositionSize.width = positionSize.width;
2251 newPositionSize.height = positionSize.height;
2254 return newPositionSize;
2257 void WindowBaseEcoreWl2::Move(PositionSize positionSize)
2259 PositionSize newPositionSize = RecalculatePositionSizeToSystem(positionSize);
2261 mWindowPositionSize = newPositionSize;
2262 DALI_LOG_RELEASE_INFO("ecore_wl2_window_position_set x[%d], y[%d]\n", newPositionSize.x, newPositionSize.y);
2263 START_DURATION_CHECK();
2264 ecore_wl2_window_position_set(mEcoreWindow, newPositionSize.x, newPositionSize.y);
2265 FINISH_DURATION_CHECK("ecore_wl2_window_position_set");
2268 void WindowBaseEcoreWl2::Resize(PositionSize positionSize)
2270 PositionSize newPositionSize = RecalculatePositionSizeToSystem(positionSize);
2272 mWindowPositionSize = newPositionSize;
2273 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);
2274 START_DURATION_CHECK();
2275 ecore_wl2_window_sync_geometry_set(mEcoreWindow, ++mMoveResizeSerial, newPositionSize.x, newPositionSize.y, newPositionSize.width, newPositionSize.height);
2276 FINISH_DURATION_CHECK("ecore_wl2_window_sync_geometry_set");
2279 void WindowBaseEcoreWl2::MoveResize(PositionSize positionSize)
2281 PositionSize newPositionSize = RecalculatePositionSizeToSystem(positionSize);
2283 mWindowPositionSize = newPositionSize;
2284 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);
2285 START_DURATION_CHECK();
2286 ecore_wl2_window_sync_geometry_set(mEcoreWindow, ++mMoveResizeSerial, newPositionSize.x, newPositionSize.y, newPositionSize.width, newPositionSize.height);
2287 FINISH_DURATION_CHECK("ecore_wl2_window_sync_geometry_set");
2290 void WindowBaseEcoreWl2::SetLayout(unsigned int numCols, unsigned int numRows, unsigned int column, unsigned int row, unsigned int colSpan, unsigned int rowSpan)
2292 #ifdef OVER_TIZEN_VERSION_8
2293 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);
2294 START_DURATION_CHECK();
2295 ecore_wl2_window_layout_set(mEcoreWindow, numCols, numRows, column, row, colSpan, rowSpan);
2296 FINISH_DURATION_CHECK("ecore_wl2_window_layout_set");
2300 void WindowBaseEcoreWl2::SetClass(const std::string& name, const std::string& className)
2302 ecore_wl2_window_title_set(mEcoreWindow, name.c_str());
2303 ecore_wl2_window_class_set(mEcoreWindow, className.c_str());
2306 void WindowBaseEcoreWl2::Raise()
2308 START_DURATION_CHECK();
2309 // Use ecore_wl2_window_activate to prevent the window shown without rendering
2310 ecore_wl2_window_activate(mEcoreWindow);
2311 FINISH_DURATION_CHECK("ecore_wl2_window_activate");
2314 void WindowBaseEcoreWl2::Lower()
2316 START_DURATION_CHECK();
2317 ecore_wl2_window_lower(mEcoreWindow);
2318 FINISH_DURATION_CHECK("ecore_wl2_window_lower");
2321 void WindowBaseEcoreWl2::Activate()
2323 START_DURATION_CHECK();
2324 ecore_wl2_window_activate(mEcoreWindow);
2325 FINISH_DURATION_CHECK("ecore_wl2_window_activate");
2328 void WindowBaseEcoreWl2::Maximize(bool maximize)
2330 START_DURATION_CHECK();
2331 ecore_wl2_window_maximized_set(mEcoreWindow, maximize);
2332 FINISH_DURATION_CHECK("ecore_wl2_window_maximized_set");
2335 bool WindowBaseEcoreWl2::IsMaximized() const
2337 return ecore_wl2_window_maximized_get(mEcoreWindow);
2340 void WindowBaseEcoreWl2::SetMaximumSize(Dali::Window::WindowSize size)
2342 DALI_LOG_RELEASE_INFO("ecore_wl2_window_maximum_size_set, width: %d, height: %d\n", size.GetWidth(), size.GetHeight());
2343 START_DURATION_CHECK();
2344 ecore_wl2_window_maximum_size_set(mEcoreWindow, size.GetWidth(), size.GetHeight());
2345 FINISH_DURATION_CHECK("ecore_wl2_window_maximum_size_set");
2346 ecore_wl2_window_commit(mEcoreWindow, EINA_TRUE);
2349 void WindowBaseEcoreWl2::Minimize(bool minimize)
2351 START_DURATION_CHECK();
2352 ecore_wl2_window_iconified_set(mEcoreWindow, minimize);
2353 FINISH_DURATION_CHECK("ecore_wl2_window_iconified_set");
2356 bool WindowBaseEcoreWl2::IsMinimized() const
2358 return ecore_wl2_window_iconified_get(mEcoreWindow);
2361 void WindowBaseEcoreWl2::SetMimimumSize(Dali::Window::WindowSize size)
2363 DALI_LOG_RELEASE_INFO("ecore_wl2_window_minimum_size_set, width: %d, height: %d\n", size.GetWidth(), size.GetHeight());
2364 START_DURATION_CHECK();
2365 ecore_wl2_window_minimum_size_set(mEcoreWindow, size.GetWidth(), size.GetHeight());
2366 FINISH_DURATION_CHECK("ecore_wl2_window_minimum_size_set");
2367 ecore_wl2_window_commit(mEcoreWindow, EINA_TRUE);
2370 void WindowBaseEcoreWl2::SetAvailableAnlges(const std::vector<int>& angles)
2372 int rotations[4] = {0};
2373 DALI_LOG_RELEASE_INFO("WindowBaseEcoreWl2::SetAvailableAnlges, angle's count: %d, angles\n", angles.size());
2374 for(std::size_t i = 0; i < angles.size(); ++i)
2376 rotations[i] = static_cast<int>(angles[i]);
2377 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "%d ", rotations[i]);
2380 START_DURATION_CHECK();
2381 ecore_wl2_window_available_rotations_set(mEcoreWindow, rotations, angles.size());
2382 FINISH_DURATION_CHECK("ecore_wl2_window_available_rotations_set");
2385 void WindowBaseEcoreWl2::SetPreferredAngle(int angle)
2387 DALI_LOG_RELEASE_INFO("WindowBaseEcoreWl2::SetPreferredAngle, angle: %d\n", angle);
2388 START_DURATION_CHECK();
2389 ecore_wl2_window_preferred_rotation_set(mEcoreWindow, angle);
2390 FINISH_DURATION_CHECK("ecore_wl2_window_preferred_rotation_set");
2393 void WindowBaseEcoreWl2::SetAcceptFocus(bool accept)
2395 START_DURATION_CHECK();
2396 ecore_wl2_window_focus_skip_set(mEcoreWindow, !accept);
2397 FINISH_DURATION_CHECK("ecore_wl2_window_focus_skip_set");
2400 void WindowBaseEcoreWl2::Show()
2404 START_DURATION_CHECK();
2405 ecore_wl2_window_geometry_set(mEcoreWindow, mWindowPositionSize.x, mWindowPositionSize.y, mWindowPositionSize.width, mWindowPositionSize.height);
2406 FINISH_DURATION_CHECK("ecore_wl2_window_geometry_set");
2410 ecore_wl2_window_show(mEcoreWindow);
2413 void WindowBaseEcoreWl2::Hide()
2416 ecore_wl2_window_hide(mEcoreWindow);
2419 unsigned int WindowBaseEcoreWl2::GetSupportedAuxiliaryHintCount() const
2421 return mSupportedAuxiliaryHints.size();
2424 std::string WindowBaseEcoreWl2::GetSupportedAuxiliaryHint(unsigned int index) const
2426 if(index >= GetSupportedAuxiliaryHintCount())
2428 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetSupportedAuxiliaryHint: Invalid index! [%d]\n", index);
2431 return mSupportedAuxiliaryHints[index];
2434 unsigned int WindowBaseEcoreWl2::AddAuxiliaryHint(const std::string& hint, const std::string& value)
2436 bool supported = false;
2438 // Check if the hint is suppported
2439 for(std::vector<std::string>::iterator iter = mSupportedAuxiliaryHints.begin(); iter != mSupportedAuxiliaryHints.end(); ++iter)
2450 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Concise, "WindowBaseEcoreWl2::AddAuxiliaryHint: Not supported auxiliary hint [%s]\n", hint.c_str());
2454 // Check if the hint is already added
2455 for(unsigned int i = 0; i < mAuxiliaryHints.size(); i++)
2457 if(mAuxiliaryHints[i].first == hint)
2459 // Just change the value
2460 mAuxiliaryHints[i].second = value;
2462 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::AddAuxiliaryHint: Change! hint = %s, value = %s, id = %d\n", hint.c_str(), value.c_str(), i + 1);
2464 return i + 1; // id is index + 1
2469 mAuxiliaryHints.push_back(std::pair<std::string, std::string>(hint, value));
2471 unsigned int id = mAuxiliaryHints.size();
2473 START_DURATION_CHECK();
2474 ecore_wl2_window_aux_hint_add(mEcoreWindow, static_cast<int>(id), hint.c_str(), value.c_str());
2475 FINISH_DURATION_CHECK("ecore_wl2_window_aux_hint_add");
2477 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::AddAuxiliaryHint: hint = %s, value = %s, id = %d\n", hint.c_str(), value.c_str(), id);
2482 bool WindowBaseEcoreWl2::RemoveAuxiliaryHint(unsigned int id)
2484 if(id == 0 || id > mAuxiliaryHints.size())
2486 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Concise, "WindowBaseEcoreWl2::RemoveAuxiliaryHint: Invalid id [%d]\n", id);
2490 mAuxiliaryHints[id - 1].second = std::string();
2492 START_DURATION_CHECK();
2493 ecore_wl2_window_aux_hint_del(mEcoreWindow, static_cast<int>(id));
2494 FINISH_DURATION_CHECK("ecore_wl2_window_aux_hint_del");
2496 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::RemoveAuxiliaryHint: id = %d, hint = %s\n", id, mAuxiliaryHints[id - 1].first.c_str());
2501 bool WindowBaseEcoreWl2::SetAuxiliaryHintValue(unsigned int id, const std::string& value)
2503 if(id == 0 || id > mAuxiliaryHints.size())
2505 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Concise, "WindowBaseEcoreWl2::SetAuxiliaryHintValue: Invalid id [%d]\n", id);
2509 mAuxiliaryHints[id - 1].second = value;
2511 START_DURATION_CHECK();
2512 ecore_wl2_window_aux_hint_change(mEcoreWindow, static_cast<int>(id), value.c_str());
2513 FINISH_DURATION_CHECK("ecore_wl2_window_aux_hint_change");
2515 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());
2520 std::string WindowBaseEcoreWl2::GetAuxiliaryHintValue(unsigned int id) const
2522 if(id == 0 || id > mAuxiliaryHints.size())
2524 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Concise, "WindowBaseEcoreWl2::GetAuxiliaryHintValue: Invalid id [%d]\n", id);
2525 return std::string();
2528 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());
2530 return mAuxiliaryHints[id - 1].second;
2533 unsigned int WindowBaseEcoreWl2::GetAuxiliaryHintId(const std::string& hint) const
2535 for(unsigned int i = 0; i < mAuxiliaryHints.size(); i++)
2537 if(mAuxiliaryHints[i].first == hint)
2539 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetAuxiliaryHintId: hint = %s, id = %d\n", hint.c_str(), i + 1);
2544 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetAuxiliaryHintId: Invalid hint! [%s]\n", hint.c_str());
2549 void WindowBaseEcoreWl2::SetInputRegion(const Rect<int>& inputRegion)
2551 Rect<int> convertRegion = RecalculatePositionSizeToSystem(inputRegion);
2553 Eina_Rectangle rect;
2554 rect.x = convertRegion.x;
2555 rect.y = convertRegion.y;
2556 rect.w = convertRegion.width;
2557 rect.h = convertRegion.height;
2559 DALI_LOG_RELEASE_INFO("%p, Set input rect (%d, %d, %d x %d)\n", mEcoreWindow, rect.x, rect.y, rect.w, rect.h);
2560 START_DURATION_CHECK();
2561 ecore_wl2_window_input_rect_set(mEcoreWindow, &rect);
2562 FINISH_DURATION_CHECK("ecore_wl2_window_input_rect_set");
2563 ecore_wl2_window_commit(mEcoreWindow, EINA_TRUE);
2566 void WindowBaseEcoreWl2::SetType(Dali::WindowType type)
2571 Ecore_Wl2_Window_Type windowType;
2575 case Dali::WindowType::NORMAL:
2577 windowType = ECORE_WL2_WINDOW_TYPE_TOPLEVEL;
2580 case Dali::WindowType::NOTIFICATION:
2582 windowType = ECORE_WL2_WINDOW_TYPE_NOTIFICATION;
2585 case Dali::WindowType::UTILITY:
2587 windowType = ECORE_WL2_WINDOW_TYPE_UTILITY;
2590 case Dali::WindowType::DIALOG:
2592 windowType = ECORE_WL2_WINDOW_TYPE_DIALOG;
2595 case Dali::WindowType::IME:
2597 windowType = ECORE_WL2_WINDOW_TYPE_NONE;
2600 case Dali::WindowType::DESKTOP:
2602 windowType = ECORE_WL2_WINDOW_TYPE_DESKTOP;
2607 windowType = ECORE_WL2_WINDOW_TYPE_TOPLEVEL;
2612 START_DURATION_CHECK();
2613 ecore_wl2_window_type_set(mEcoreWindow, windowType);
2614 FINISH_DURATION_CHECK("ecore_wl2_window_type_set");
2618 Dali::WindowType WindowBaseEcoreWl2::GetType() const
2623 Dali::WindowOperationResult WindowBaseEcoreWl2::SetNotificationLevel(Dali::WindowNotificationLevel level)
2625 START_DURATION_CHECK();
2626 while(!mTizenPolicy)
2628 wl_display_dispatch_queue(mDisplay, mEventQueue);
2631 int notificationLevel;
2635 case Dali::WindowNotificationLevel::NONE:
2637 notificationLevel = TIZEN_POLICY_LEVEL_NONE;
2640 case Dali::WindowNotificationLevel::BASE:
2642 notificationLevel = TIZEN_POLICY_LEVEL_DEFAULT;
2645 case Dali::WindowNotificationLevel::MEDIUM:
2647 notificationLevel = TIZEN_POLICY_LEVEL_MEDIUM;
2650 case Dali::WindowNotificationLevel::HIGH:
2652 notificationLevel = TIZEN_POLICY_LEVEL_HIGH;
2655 case Dali::WindowNotificationLevel::TOP:
2657 notificationLevel = TIZEN_POLICY_LEVEL_TOP;
2662 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetNotificationLevel: invalid level [%d]\n", level);
2663 notificationLevel = TIZEN_POLICY_LEVEL_DEFAULT;
2668 mNotificationLevelChangeDone = false;
2669 mNotificationChangeState = TIZEN_POLICY_ERROR_STATE_NONE;
2671 tizen_policy_set_notification_level(mTizenPolicy, ecore_wl2_window_surface_get(mEcoreWindow), notificationLevel);
2675 while(!mNotificationLevelChangeDone && count < 3)
2677 ecore_wl2_display_flush(ecore_wl2_connected_display_get(NULL));
2678 wl_display_dispatch_queue(mDisplay, mEventQueue);
2681 FINISH_DURATION_CHECK("ecore_wl2 & wl_display");
2683 if(!mNotificationLevelChangeDone)
2685 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetNotificationLevel: Level change is failed [%d, %d]\n", level, mNotificationChangeState);
2686 return Dali::WindowOperationResult::UNKNOWN_ERROR;
2688 else if(mNotificationChangeState == TIZEN_POLICY_ERROR_STATE_PERMISSION_DENIED)
2690 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetNotificationLevel: Permission denied! [%d]\n", level);
2691 return Dali::WindowOperationResult::PERMISSION_DENIED;
2694 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetNotificationLevel: Level is changed [%d]\n", mNotificationLevel);
2696 return Dali::WindowOperationResult::SUCCEED;
2699 Dali::WindowNotificationLevel WindowBaseEcoreWl2::GetNotificationLevel() const
2701 while(!mTizenPolicy)
2703 wl_display_dispatch_queue(mDisplay, mEventQueue);
2708 while(!mNotificationLevelChangeDone && count < 3)
2710 ecore_wl2_display_flush(ecore_wl2_connected_display_get(NULL));
2711 wl_display_dispatch_queue(mDisplay, mEventQueue);
2715 if(!mNotificationLevelChangeDone)
2717 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetNotificationLevel: Error! [%d]\n", mNotificationChangeState);
2718 return Dali::WindowNotificationLevel::NONE;
2721 Dali::WindowNotificationLevel level;
2723 switch(mNotificationLevel)
2725 case TIZEN_POLICY_LEVEL_NONE:
2727 level = Dali::WindowNotificationLevel::NONE;
2730 case TIZEN_POLICY_LEVEL_DEFAULT:
2732 level = Dali::WindowNotificationLevel::BASE;
2735 case TIZEN_POLICY_LEVEL_MEDIUM:
2737 level = Dali::WindowNotificationLevel::MEDIUM;
2740 case TIZEN_POLICY_LEVEL_HIGH:
2742 level = Dali::WindowNotificationLevel::HIGH;
2745 case TIZEN_POLICY_LEVEL_TOP:
2747 level = Dali::WindowNotificationLevel::TOP;
2752 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetNotificationLevel: invalid level [%d]\n", mNotificationLevel);
2753 level = Dali::WindowNotificationLevel::NONE;
2758 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetNotificationLevel: level [%d]\n", mNotificationLevel);
2763 void WindowBaseEcoreWl2::SetOpaqueState(bool opaque)
2765 while(!mTizenPolicy)
2767 wl_display_dispatch_queue(mDisplay, mEventQueue);
2770 tizen_policy_set_opaque_state(mTizenPolicy, ecore_wl2_window_surface_get(mEcoreWindow), (opaque ? 1 : 0));
2773 Dali::WindowOperationResult WindowBaseEcoreWl2::SetScreenOffMode(WindowScreenOffMode screenOffMode)
2775 while(!mTizenPolicy)
2777 wl_display_dispatch_queue(mDisplay, mEventQueue);
2780 mScreenOffModeChangeDone = false;
2781 mScreenOffModeChangeState = TIZEN_POLICY_ERROR_STATE_NONE;
2783 unsigned int mode = 0;
2785 switch(screenOffMode)
2787 case WindowScreenOffMode::TIMEOUT:
2792 case WindowScreenOffMode::NEVER:
2799 tizen_policy_set_window_screen_mode(mTizenPolicy, ecore_wl2_window_surface_get(mEcoreWindow), mode);
2803 while(!mScreenOffModeChangeDone && count < 3)
2805 ecore_wl2_display_flush(ecore_wl2_connected_display_get(NULL));
2806 wl_display_dispatch_queue(mDisplay, mEventQueue);
2810 if(!mScreenOffModeChangeDone)
2812 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetScreenOffMode: Screen mode change is failed [%d, %d]\n", screenOffMode, mScreenOffModeChangeState);
2813 return Dali::WindowOperationResult::UNKNOWN_ERROR;
2815 else if(mScreenOffModeChangeState == TIZEN_POLICY_ERROR_STATE_PERMISSION_DENIED)
2817 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetScreenOffMode: Permission denied! [%d]\n", screenOffMode);
2818 return Dali::WindowOperationResult::PERMISSION_DENIED;
2821 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetScreenOffMode: Screen mode is changed [%d]\n", mScreenOffMode);
2823 return Dali::WindowOperationResult::SUCCEED;
2826 WindowScreenOffMode WindowBaseEcoreWl2::GetScreenOffMode() const
2828 while(!mTizenPolicy)
2830 wl_display_dispatch_queue(mDisplay, mEventQueue);
2835 while(!mScreenOffModeChangeDone && count < 3)
2837 ecore_wl2_display_flush(ecore_wl2_connected_display_get(NULL));
2838 wl_display_dispatch_queue(mDisplay, mEventQueue);
2842 if(!mScreenOffModeChangeDone)
2844 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetScreenOffMode: Error! [%d]\n", mScreenOffModeChangeState);
2845 return WindowScreenOffMode::TIMEOUT;
2848 WindowScreenOffMode screenMode = WindowScreenOffMode::TIMEOUT;
2850 switch(mScreenOffMode)
2854 screenMode = WindowScreenOffMode::TIMEOUT;
2859 screenMode = WindowScreenOffMode::NEVER;
2864 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetScreenOffMode: screen mode [%d]\n", mScreenOffMode);
2869 Dali::WindowOperationResult WindowBaseEcoreWl2::SetBrightness(int brightness)
2871 START_DURATION_CHECK();
2872 while(!mTizenDisplayPolicy)
2874 wl_display_dispatch_queue(mDisplay, mEventQueue);
2877 mBrightnessChangeDone = false;
2878 mBrightnessChangeState = TIZEN_POLICY_ERROR_STATE_NONE;
2880 tizen_display_policy_set_window_brightness(mTizenDisplayPolicy, ecore_wl2_window_surface_get(mEcoreWindow), brightness);
2884 while(!mBrightnessChangeDone && count < 3)
2886 ecore_wl2_display_flush(ecore_wl2_connected_display_get(NULL));
2887 wl_display_dispatch_queue(mDisplay, mEventQueue);
2890 FINISH_DURATION_CHECK("ecore_wl2_display_flush");
2892 if(!mBrightnessChangeDone)
2894 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetBrightness: Brightness change is failed [%d, %d]\n", brightness, mBrightnessChangeState);
2895 return Dali::WindowOperationResult::UNKNOWN_ERROR;
2897 else if(mBrightnessChangeState == TIZEN_POLICY_ERROR_STATE_PERMISSION_DENIED)
2899 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetBrightness: Permission denied! [%d]\n", brightness);
2900 return Dali::WindowOperationResult::PERMISSION_DENIED;
2903 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetBrightness: Brightness is changed [%d]\n", mBrightness);
2905 return Dali::WindowOperationResult::SUCCEED;
2908 int WindowBaseEcoreWl2::GetBrightness() const
2910 START_DURATION_CHECK();
2911 while(!mTizenDisplayPolicy)
2913 wl_display_dispatch_queue(mDisplay, mEventQueue);
2918 while(!mBrightnessChangeDone && count < 3)
2920 ecore_wl2_display_flush(ecore_wl2_connected_display_get(NULL));
2921 wl_display_dispatch_queue(mDisplay, mEventQueue);
2924 FINISH_DURATION_CHECK("ecore_wl2_display_flush");
2926 if(!mBrightnessChangeDone)
2928 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetBrightness: Error! [%d]\n", mBrightnessChangeState);
2932 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetBrightness: Brightness [%d]\n", mBrightness);
2937 bool WindowBaseEcoreWl2::GrabKey(Dali::KEY key, KeyGrab::KeyGrabMode grabMode)
2939 Ecore_Wl2_Window_Keygrab_Mode mode;
2943 case KeyGrab::TOPMOST:
2945 mode = ECORE_WL2_WINDOW_KEYGRAB_TOPMOST;
2948 case KeyGrab::SHARED:
2950 mode = ECORE_WL2_WINDOW_KEYGRAB_SHARED;
2953 case KeyGrab::OVERRIDE_EXCLUSIVE:
2955 mode = ECORE_WL2_WINDOW_KEYGRAB_OVERRIDE_EXCLUSIVE;
2958 case KeyGrab::EXCLUSIVE:
2960 mode = ECORE_WL2_WINDOW_KEYGRAB_EXCLUSIVE;
2969 return ecore_wl2_window_keygrab_set(mEcoreWindow, KeyLookup::GetKeyName(key), 0, 0, 0, mode);
2972 bool WindowBaseEcoreWl2::UngrabKey(Dali::KEY key)
2974 return ecore_wl2_window_keygrab_unset(mEcoreWindow, KeyLookup::GetKeyName(key), 0, 0);
2977 bool WindowBaseEcoreWl2::GrabKeyList(const Dali::Vector<Dali::KEY>& key, const Dali::Vector<KeyGrab::KeyGrabMode>& grabMode, Dali::Vector<bool>& result)
2979 int keyCount = key.Count();
2980 int keyGrabModeCount = grabMode.Count();
2982 if(keyCount != keyGrabModeCount || keyCount == 0)
2989 Eina_List* keyList = NULL;
2990 Ecore_Wl2_Window_Keygrab_Info* info = new Ecore_Wl2_Window_Keygrab_Info[keyCount];
2992 for(int index = 0; index < keyCount; ++index)
2994 info[index].key = const_cast<char*>(KeyLookup::GetKeyName(key[index]));
2996 switch(grabMode[index])
2998 case KeyGrab::TOPMOST:
3000 info[index].mode = ECORE_WL2_WINDOW_KEYGRAB_TOPMOST;
3003 case KeyGrab::SHARED:
3005 info[index].mode = ECORE_WL2_WINDOW_KEYGRAB_SHARED;
3008 case KeyGrab::OVERRIDE_EXCLUSIVE:
3010 info[index].mode = ECORE_WL2_WINDOW_KEYGRAB_OVERRIDE_EXCLUSIVE;
3013 case KeyGrab::EXCLUSIVE:
3015 info[index].mode = ECORE_WL2_WINDOW_KEYGRAB_EXCLUSIVE;
3020 info[index].mode = ECORE_WL2_WINDOW_KEYGRAB_UNKNOWN;
3025 keyList = eina_list_append(keyList, &info);
3028 START_DURATION_CHECK();
3029 Eina_List* grabList = ecore_wl2_window_keygrab_list_set(mEcoreWindow, keyList);
3030 FINISH_DURATION_CHECK("ecore_wl2_window_keygrab_list_set");
3032 result.Resize(keyCount, true);
3034 Eina_List* l = NULL;
3035 Eina_List* m = NULL;
3036 void* listData = NULL;
3038 if(grabList != NULL)
3040 EINA_LIST_FOREACH(grabList, m, data)
3043 EINA_LIST_FOREACH(keyList, l, listData)
3045 if(static_cast<Ecore_Wl2_Window_Keygrab_Info*>(listData)->key == NULL)
3047 DALI_LOG_ERROR("input key list has null data!");
3051 if(strcmp(static_cast<char*>(data), static_cast<Ecore_Wl2_Window_Keygrab_Info*>(listData)->key) == 0)
3053 result[index] = false;
3062 eina_list_free(keyList);
3063 eina_list_free(grabList);
3069 bool WindowBaseEcoreWl2::UngrabKeyList(const Dali::Vector<Dali::KEY>& key, Dali::Vector<bool>& result)
3071 int keyCount = key.Count();
3079 Eina_List* keyList = NULL;
3080 Ecore_Wl2_Window_Keygrab_Info* info = new Ecore_Wl2_Window_Keygrab_Info[keyCount];
3082 for(int index = 0; index < keyCount; ++index)
3084 info[index].key = const_cast<char*>(KeyLookup::GetKeyName(key[index]));
3085 keyList = eina_list_append(keyList, &info);
3088 START_DURATION_CHECK();
3089 Eina_List* ungrabList = ecore_wl2_window_keygrab_list_unset(mEcoreWindow, keyList);
3090 FINISH_DURATION_CHECK("ecore_wl2_window_keygrab_list_unset");
3092 result.Resize(keyCount, true);
3094 Eina_List* l = NULL;
3095 Eina_List* m = NULL;
3096 void* listData = NULL;
3099 if(ungrabList != NULL)
3101 EINA_LIST_FOREACH(ungrabList, m, data)
3104 EINA_LIST_FOREACH(keyList, l, listData)
3106 if(strcmp(static_cast<char*>(data), static_cast<Ecore_Wl2_Window_Keygrab_Info*>(listData)->key) == 0)
3108 result[index] = false;
3117 eina_list_free(keyList);
3118 eina_list_free(ungrabList);
3124 void WindowBaseEcoreWl2::GetDpi(unsigned int& dpiHorizontal, unsigned int& dpiVertical)
3129 Ecore_Wl2_Output* output = ecore_wl2_window_output_find(mEcoreWindow);
3131 // 1 inch = 25.4 millimeters
3132 xres = ecore_wl2_output_dpi_get(output);
3133 yres = ecore_wl2_output_dpi_get(output);
3135 dpiHorizontal = int(xres + 0.5f); // rounding
3136 dpiVertical = int(yres + 0.5f);
3139 int WindowBaseEcoreWl2::GetWindowRotationAngle() const
3141 int orientation = mWindowRotationAngle;
3142 if(mSupportedPreProtation)
3149 int WindowBaseEcoreWl2::GetScreenRotationAngle()
3151 if(mSupportedPreProtation)
3153 DALI_LOG_RELEASE_INFO("Support PreRotation and return 0\n");
3157 if(ecore_wl2_window_ignore_output_transform_get(mEcoreWindow))
3163 transform = ecore_wl2_output_transform_get(ecore_wl2_window_output_find(mEcoreWindow));
3165 mScreenRotationAngle = transform * 90;
3166 return mScreenRotationAngle;
3169 void WindowBaseEcoreWl2::SetWindowRotationAngle(int degree)
3171 mWindowRotationAngle = degree;
3172 ecore_wl2_window_rotation_set(mEcoreWindow, degree);
3175 void WindowBaseEcoreWl2::WindowRotationCompleted(int degree, int width, int height)
3177 START_DURATION_CHECK();
3178 ecore_wl2_window_rotation_change_done_send(mEcoreWindow, degree, width, height);
3179 FINISH_DURATION_CHECK("ecore_wl2_window_rotation_change_done_send");
3182 void WindowBaseEcoreWl2::SetTransparency(bool transparent)
3184 START_DURATION_CHECK();
3185 ecore_wl2_window_alpha_set(mEcoreWindow, transparent);
3186 FINISH_DURATION_CHECK("ecore_wl2_window_alpha_set");
3189 void WindowBaseEcoreWl2::CreateWindow(PositionSize positionSize)
3191 Ecore_Wl2_Display* display = ecore_wl2_display_connect(NULL);
3194 DALI_ASSERT_ALWAYS(0 && "Failed to get display");
3197 START_DURATION_CHECK();
3198 ecore_wl2_display_sync(display);
3200 mEcoreWindow = ecore_wl2_window_new(display, NULL, positionSize.x, positionSize.y, positionSize.width, positionSize.height);
3202 if(mEcoreWindow == 0)
3204 DALI_ASSERT_ALWAYS(0 && "Failed to create Wayland window");
3208 ecore_wl2_window_type_set(mEcoreWindow, ECORE_WL2_WINDOW_TYPE_TOPLEVEL);
3209 FINISH_DURATION_CHECK("ecore_wl2 functions");
3212 void WindowBaseEcoreWl2::SetParent(WindowBase* parentWinBase, bool belowParent)
3214 Ecore_Wl2_Window* ecoreParent = NULL;
3217 WindowBaseEcoreWl2* winBaseEcore2 = static_cast<WindowBaseEcoreWl2*>(parentWinBase);
3218 ecoreParent = winBaseEcore2->mEcoreWindow;
3221 START_DURATION_CHECK();
3222 ecore_wl2_window_transient_parent_set(mEcoreWindow, ecoreParent, belowParent);
3223 FINISH_DURATION_CHECK("ecore_wl2_window_transient_parent_set");
3226 int WindowBaseEcoreWl2::CreateFrameRenderedSyncFence()
3228 return wl_egl_window_tizen_create_commit_sync_fd(mEglWindow);
3231 int WindowBaseEcoreWl2::CreateFramePresentedSyncFence()
3233 return wl_egl_window_tizen_create_presentation_sync_fd(mEglWindow);
3236 void WindowBaseEcoreWl2::SetPositionSizeWithAngle(PositionSize positionSize, int angle)
3238 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);
3239 START_DURATION_CHECK();
3240 ecore_wl2_window_rotation_geometry_set(mEcoreWindow, angle, positionSize.x, positionSize.y, positionSize.width, positionSize.height);
3241 FINISH_DURATION_CHECK("ecore_wl2_window_rotation_geometry_set");
3244 void WindowBaseEcoreWl2::InitializeIme()
3246 Eina_Iterator* globals;
3247 struct wl_registry* registry;
3248 Ecore_Wl2_Global* global;
3249 Ecore_Wl2_Display* ecoreWl2Display;
3251 if(!(ecoreWl2Display = ecore_wl2_connected_display_get(NULL)))
3253 DALI_LOG_ERROR("WindowBaseEcoreWl2::InitializeIme(), fail to get ecore_wl2 connected display\n");
3257 DALI_LOG_RELEASE_INFO("InitializeIme: Ecore_Wl2_Display: %p, ecore wl window: %p\n", ecoreWl2Display, mEcoreWindow);
3259 if(!(registry = ecore_wl2_display_registry_get(ecoreWl2Display)))
3261 DALI_LOG_ERROR("WindowBaseEcoreWl2::InitializeIme(), fail to get ecore_wl2 display registry\n");
3265 if(!(globals = ecore_wl2_display_globals_get(ecoreWl2Display)))
3267 DALI_LOG_ERROR("WindowBaseEcoreWl2::InitializeIme(), fail to get ecore_wl2 globals\n");
3271 START_DURATION_CHECK();
3272 EINA_ITERATOR_FOREACH(globals, global)
3274 #ifdef OVER_TIZEN_VERSION_7
3275 if(strcmp(global->interface, "zwp_input_panel_v1") == 0)
3277 mWlInputPanel = (zwp_input_panel_v1*)wl_registry_bind(registry, global->id, &zwp_input_panel_v1_interface, 1);
3280 if(strcmp(global->interface, "wl_input_panel") == 0)
3282 mWlInputPanel = (wl_input_panel*)wl_registry_bind(registry, global->id, &wl_input_panel_interface, 1);
3285 else if(strcmp(global->interface, "wl_output") == 0)
3287 mWlOutput = (wl_output*)wl_registry_bind(registry, global->id, &wl_output_interface, 1);
3293 DALI_LOG_ERROR("WindowBaseEcoreWl2::InitializeIme(), fail to get wayland input panel interface\n");
3299 DALI_LOG_ERROR("WindowBaseEcoreWl2::InitializeIme(), fail to get wayland output panel interface\n");
3302 #ifdef OVER_TIZEN_VERSION_7
3303 mWlInputPanelSurface = zwp_input_panel_v1_get_input_panel_surface(mWlInputPanel, mWlSurface);
3305 mWlInputPanelSurface = wl_input_panel_get_input_panel_surface(mWlInputPanel, mWlSurface);
3307 if(!mWlInputPanelSurface)
3309 DALI_LOG_ERROR("WindowBaseEcoreWl2::InitializeIme(), fail to get wayland input panel surface\n");
3312 #ifdef OVER_TIZEN_VERSION_7
3313 zwp_input_panel_surface_v1_set_toplevel(mWlInputPanelSurface, mWlOutput, ZWP_INPUT_PANEL_SURFACE_V1_POSITION_CENTER_BOTTOM);
3315 wl_input_panel_surface_set_toplevel(mWlInputPanelSurface, mWlOutput, WL_INPUT_PANEL_SURFACE_POSITION_CENTER_BOTTOM);
3317 FINISH_DURATION_CHECK("zwp_input_panel_surface_v1_set_toplevel");
3320 void WindowBaseEcoreWl2::ImeWindowReadyToRender()
3322 if(!mWlInputPanelSurface)
3324 DALI_LOG_ERROR("WindowBaseEcoreWl2::ImeWindowReadyToRender(), wayland input panel surface is null\n");
3328 START_DURATION_CHECK();
3329 #ifdef OVER_TIZEN_VERSION_7
3330 zwp_input_panel_surface_v1_set_ready(mWlInputPanelSurface, 1);
3332 wl_input_panel_surface_set_ready(mWlInputPanelSurface, 1);
3334 FINISH_DURATION_CHECK("zwp_input_panel_surface_v1_set_ready");
3337 void WindowBaseEcoreWl2::RequestMoveToServer()
3339 Ecore_Wl2_Display* display = ecore_wl2_connected_display_get(NULL);
3342 DALI_LOG_ERROR("WindowBaseEcoreWl2::RequestMoveToServer, Fail to get ecore_wl2_display\n");
3346 Ecore_Wl2_Input* input = ecore_wl2_input_default_input_get(display);
3349 DALI_LOG_ERROR("WindowBaseEcoreWl2::RequestMoveToServer, Fail to get default Ecore_Wl2_Input\n");
3353 START_DURATION_CHECK();
3354 ecore_wl2_window_move(mEcoreWindow, input);
3355 FINISH_DURATION_CHECK("ecore_wl2_window_move");
3356 DALI_LOG_RELEASE_INFO("WindowBaseEcoreWl2::RequestMoveToServer, starts the window[%p] is moved by server\n", mEcoreWindow);
3359 void WindowBaseEcoreWl2::RequestResizeToServer(WindowResizeDirection direction)
3361 Ecore_Wl2_Display* display = ecore_wl2_connected_display_get(NULL);
3364 DALI_LOG_ERROR("WindowBaseEcoreWl2::RequestResizeToServer, Fail to get ecore_wl2_display\n");
3368 Ecore_Wl2_Input* input = ecore_wl2_input_default_input_get(display);
3371 DALI_LOG_ERROR("WindowBaseEcoreWl2::RequestResizeToServer, Fail to get default Ecore_Wl2_Input\n");
3375 ResizeLocation location = RecalculateLocationToCurrentOrientation(direction, mWindowRotationAngle);
3377 START_DURATION_CHECK();
3378 ecore_wl2_window_resize(mEcoreWindow, input, static_cast<int>(location));
3379 FINISH_DURATION_CHECK("ecore_wl2_window_resize");
3380 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);
3383 void WindowBaseEcoreWl2::EnableFloatingMode(bool enable)
3385 DALI_LOG_RELEASE_INFO("WindowBaseEcoreWl2::EnableFloatingMode, floating mode flag: [%p], enable [%d]\n", mEcoreWindow, enable);
3386 START_DURATION_CHECK();
3389 ecore_wl2_window_floating_mode_set(mEcoreWindow, EINA_TRUE);
3393 ecore_wl2_window_floating_mode_set(mEcoreWindow, EINA_FALSE);
3395 FINISH_DURATION_CHECK("ecore_wl2_window_floating_mode_set");
3398 bool WindowBaseEcoreWl2::IsFloatingModeEnabled() const
3400 return ecore_wl2_window_floating_mode_get(mEcoreWindow);
3403 void WindowBaseEcoreWl2::IncludeInputRegion(const Rect<int>& inputRegion)
3405 Rect<int> convertRegion = RecalculatePositionSizeToSystem(inputRegion);
3406 Eina_Rectangle rect;
3408 rect.x = convertRegion.x;
3409 rect.y = convertRegion.y;
3410 rect.w = convertRegion.width;
3411 rect.h = convertRegion.height;
3413 DALI_LOG_RELEASE_INFO("%p, Add input_rect(%d, %d, %d x %d)\n", mEcoreWindow, rect.x, rect.y, rect.w, rect.h);
3414 START_DURATION_CHECK();
3415 ecore_wl2_window_input_rect_add(mEcoreWindow, &rect);
3416 FINISH_DURATION_CHECK("ecore_wl2_window_input_rect_add");
3417 ecore_wl2_window_commit(mEcoreWindow, EINA_TRUE);
3420 void WindowBaseEcoreWl2::ExcludeInputRegion(const Rect<int>& inputRegion)
3422 Rect<int> convertRegion = RecalculatePositionSizeToSystem(inputRegion);
3423 Eina_Rectangle rect;
3425 rect.x = convertRegion.x;
3426 rect.y = convertRegion.y;
3427 rect.w = convertRegion.width;
3428 rect.h = convertRegion.height;
3430 DALI_LOG_RELEASE_INFO("%p, Subtract input_rect(%d, %d, %d x %d)\n", mEcoreWindow, rect.x, rect.y, rect.w, rect.h);
3431 START_DURATION_CHECK();
3432 ecore_wl2_window_input_rect_subtract(mEcoreWindow, &rect);
3433 FINISH_DURATION_CHECK("ecore_wl2_window_input_rect_subtract");
3434 ecore_wl2_window_commit(mEcoreWindow, EINA_TRUE);
3437 bool WindowBaseEcoreWl2::PointerConstraintsLock()
3439 #ifdef OVER_TIZEN_VERSION_8
3440 return ecore_wl2_window_pointer_constraints_lock_pointer(mEcoreWindow);
3446 bool WindowBaseEcoreWl2::PointerConstraintsUnlock()
3448 #ifdef OVER_TIZEN_VERSION_8
3449 return ecore_wl2_window_pointer_constraints_unlock_pointer(mEcoreWindow);
3455 void WindowBaseEcoreWl2::LockedPointerRegionSet(int32_t x, int32_t y, int32_t width, int32_t height)
3457 #ifdef OVER_TIZEN_VERSION_8
3458 ecore_wl2_window_locked_pointer_region_set(mEcoreWindow, x, y, width, height);
3459 ecore_wl2_window_commit(mEcoreWindow, EINA_TRUE);
3463 void WindowBaseEcoreWl2::LockedPointerCursorPositionHintSet(int32_t x, int32_t y)
3465 #ifdef OVER_TIZEN_VERSION_8
3466 ecore_wl2_window_locked_pointer_cursor_position_hint_set(mEcoreWindow, x, y);
3467 ecore_wl2_window_commit(mEcoreWindow, EINA_TRUE);
3471 bool WindowBaseEcoreWl2::PointerWarp(int32_t x, int32_t y)
3473 return ecore_wl2_window_pointer_warp(mEcoreWindow, x, y);
3476 void WindowBaseEcoreWl2::CursorVisibleSet(bool visible)
3478 #ifdef OVER_TIZEN_VERSION_8
3479 ecore_wl2_window_cursor_visible_set(mEcoreWindow, visible);
3483 // Request grab key events according to the requested device subtype
3484 //(For now, subtype could be '0'/'11'/'12' which equals to ECORE_DEVICE_SUBCLASS_NONE/REMOCON/VIRTUAL_KEYBOARD)
3485 bool WindowBaseEcoreWl2::KeyboardGrab(Device::Subclass::Type deviceSubclass)
3487 #ifdef OVER_TIZEN_VERSION_8
3488 Ecore_Device_Subclass ecoreDeviceSubclass;
3489 switch(deviceSubclass)
3491 case Device::Subclass::NONE:
3493 ecoreDeviceSubclass = ECORE_DEVICE_SUBCLASS_NONE;
3496 case Device::Subclass::REMOCON:
3498 ecoreDeviceSubclass = ECORE_DEVICE_SUBCLASS_REMOCON;
3501 case Device::Subclass::VIRTUAL_KEYBOARD:
3503 ecoreDeviceSubclass = ECORE_DEVICE_SUBCLASS_VIRTUAL_KEYBOARD;
3508 DALI_LOG_ERROR("deviceSubclass : %d type is not support, subtype could be 'NONE', 'REMOCON', 'VIRTUAL_KEYBOARD'\n");
3512 return ecore_wl2_window_keyboard_grab(mEcoreWindow, ecoreDeviceSubclass);
3518 // Request ungrab key events
3519 bool WindowBaseEcoreWl2::KeyboardUnGrab()
3521 #ifdef OVER_TIZEN_VERSION_8
3522 return ecore_wl2_window_keyboard_ungrab(mEcoreWindow);
3528 void WindowBaseEcoreWl2::SetFullScreen(bool fullscreen)
3530 DALI_LOG_RELEASE_INFO("ecore_wl2_window_fullscreen_set, window: [%p], fullscreen [%d]\n", mEcoreWindow, fullscreen);
3531 START_DURATION_CHECK();
3532 ecore_wl2_window_fullscreen_set(mEcoreWindow, fullscreen);
3533 ecore_wl2_window_commit(mEcoreWindow, EINA_TRUE);
3534 FINISH_DURATION_CHECK("ecore_wl2_window_fullscreen_set");
3537 bool WindowBaseEcoreWl2::GetFullScreen()
3539 return ecore_wl2_window_fullscreen_get(mEcoreWindow);
3542 } // namespace Adaptor
3544 } // namespace Internal
3548 #pragma GCC diagnostic pop