2 * Copyright (c) 2023 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 // Ecore is littered with C style cast
19 #pragma GCC diagnostic push
20 #pragma GCC diagnostic ignored "-Wold-style-cast"
23 #include <dali/internal/window-system/tizen-wayland/ecore-wl2/window-base-ecore-wl2.h>
26 #include <dali/internal/input/common/key-impl.h>
27 #include <dali/internal/system/common/time-service.h>
28 #include <dali/internal/window-system/common/window-impl.h>
29 #include <dali/internal/window-system/common/window-render-surface.h>
30 #include <dali/internal/window-system/common/window-system.h>
33 #include <Ecore_Input.h>
34 #include <dali/integration-api/debug.h>
35 #include <dali/integration-api/trace.h>
36 #include <dali/public-api/adaptor-framework/window-enumerations.h>
37 #include <dali/public-api/events/mouse-button.h>
38 #include <dali/public-api/object/any.h>
40 #if defined(VCONF_ENABLED)
41 #include <vconf-keys.h>
45 #define START_DURATION_CHECK() \
46 uint32_t durationMilliSeconds = static_cast<uint32_t>(-1); \
47 uint32_t startTime, endTime; \
48 startTime = TimeService::GetMilliSeconds();
50 #define FINISH_DURATION_CHECK(functionName) \
51 endTime = TimeService::GetMilliSeconds(); \
52 durationMilliSeconds = endTime - startTime; \
53 if(durationMilliSeconds > 0) \
55 DALI_LOG_DEBUG_INFO("%s : duration [%u ms]\n", functionName, durationMilliSeconds); \
58 #include <wayland-egl-tizen.h>
68 #if defined(DEBUG_ENABLED)
69 Debug::Filter* gWindowBaseLogFilter = Debug::Filter::New(Debug::NoLogging, false, "LOG_WINDOW_BASE");
72 DALI_INIT_TRACE_FILTER(gTraceFilter, DALI_TRACE_PERFORMANCE_MARKER, false);
75 * @brief Enumeration of location for window resized by display server.
77 enum class ResizeLocation
79 INVALID = 0, ///< Invalid value
80 TOP_LEFT = 5, ///< Start resizing window to the top-left edge.
81 LEFT = 4, ///< Start resizing window to the left side.
82 BOTTOM_LEFT = 6, ///< Start resizing window to the bottom-left edge.
83 BOTTOM = 2, ///< Start resizing window to the bottom side.
84 BOTTOM_RIGHT = 10, ///< Start resizing window to the bottom-right edge.
85 RIGHT = 8, ///< Start resizing window to the right side.
86 TOP_RIGHT = 9, ///< Start resizing window to the top-right edge.
87 TOP = 1 ///< Start resizing window to the top side.
90 const uint32_t MAX_TIZEN_CLIENT_VERSION = 7;
91 const unsigned int PRIMARY_TOUCH_BUTTON_ID = 1;
92 const ResizeLocation RESIZE_LOCATIONS[] = {ResizeLocation::TOP_LEFT, ResizeLocation::LEFT, ResizeLocation::BOTTOM_LEFT, ResizeLocation::BOTTOM, ResizeLocation::BOTTOM_RIGHT, ResizeLocation::RIGHT, ResizeLocation::TOP_RIGHT, ResizeLocation::TOP, ResizeLocation::INVALID};
94 #if defined(VCONF_ENABLED)
95 const char* DALI_VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_NAME = "db/setting/accessibility/font_name"; // It will be update at vconf-key.h and replaced.
101 xkb_keycode_t keyCode;
106 * Get the device name from the provided ecore key event
108 void GetDeviceName(Ecore_Event_Key* keyEvent, std::string& result)
110 const char* ecoreDeviceName = ecore_device_name_get(keyEvent->dev);
114 result = ecoreDeviceName;
119 * Get the device class from the provided ecore event
121 void GetDeviceClass(Ecore_Device_Class ecoreDeviceClass, Device::Class::Type& deviceClass)
123 switch(ecoreDeviceClass)
125 case ECORE_DEVICE_CLASS_SEAT:
127 deviceClass = Device::Class::USER;
130 case ECORE_DEVICE_CLASS_KEYBOARD:
132 deviceClass = Device::Class::KEYBOARD;
135 case ECORE_DEVICE_CLASS_MOUSE:
137 deviceClass = Device::Class::MOUSE;
140 case ECORE_DEVICE_CLASS_TOUCH:
142 deviceClass = Device::Class::TOUCH;
145 case ECORE_DEVICE_CLASS_PEN:
147 deviceClass = Device::Class::PEN;
150 case ECORE_DEVICE_CLASS_POINTER:
152 deviceClass = Device::Class::POINTER;
155 case ECORE_DEVICE_CLASS_GAMEPAD:
157 deviceClass = Device::Class::GAMEPAD;
162 deviceClass = Device::Class::NONE;
168 void GetDeviceSubclass(Ecore_Device_Subclass ecoreDeviceSubclass, Device::Subclass::Type& deviceSubclass)
170 switch(ecoreDeviceSubclass)
172 case ECORE_DEVICE_SUBCLASS_FINGER:
174 deviceSubclass = Device::Subclass::FINGER;
177 case ECORE_DEVICE_SUBCLASS_FINGERNAIL:
179 deviceSubclass = Device::Subclass::FINGERNAIL;
182 case ECORE_DEVICE_SUBCLASS_KNUCKLE:
184 deviceSubclass = Device::Subclass::KNUCKLE;
187 case ECORE_DEVICE_SUBCLASS_PALM:
189 deviceSubclass = Device::Subclass::PALM;
192 case ECORE_DEVICE_SUBCLASS_HAND_SIZE:
194 deviceSubclass = Device::Subclass::HAND_SIDE;
197 case ECORE_DEVICE_SUBCLASS_HAND_FLAT:
199 deviceSubclass = Device::Subclass::HAND_FLAT;
202 case ECORE_DEVICE_SUBCLASS_PEN_TIP:
204 deviceSubclass = Device::Subclass::PEN_TIP;
207 case ECORE_DEVICE_SUBCLASS_TRACKPAD:
209 deviceSubclass = Device::Subclass::TRACKPAD;
212 case ECORE_DEVICE_SUBCLASS_TRACKPOINT:
214 deviceSubclass = Device::Subclass::TRACKPOINT;
217 case ECORE_DEVICE_SUBCLASS_TRACKBALL:
219 deviceSubclass = Device::Subclass::TRACKBALL;
222 case ECORE_DEVICE_SUBCLASS_REMOCON:
224 deviceSubclass = Device::Subclass::REMOCON;
227 case ECORE_DEVICE_SUBCLASS_VIRTUAL_KEYBOARD:
229 deviceSubclass = Device::Subclass::VIRTUAL_KEYBOARD;
234 deviceSubclass = Device::Subclass::NONE;
240 void FindKeyCode(struct xkb_keymap* keyMap, xkb_keycode_t key, void* data)
242 KeyCodeMap* foundKeyCode = static_cast<KeyCodeMap*>(data);
243 if(foundKeyCode->isKeyCode)
248 xkb_keysym_t keySym = foundKeyCode->keySym;
250 const xkb_keysym_t* symsOut = NULL;
252 nsyms = xkb_keymap_key_get_syms_by_level(keyMap, key, 0, 0, &symsOut);
256 if(*symsOut == keySym)
258 foundKeyCode->keyCode = key;
259 foundKeyCode->isKeyCode = true;
265 * Return the recalculated window resizing location according to the current orientation.
267 ResizeLocation RecalculateLocationToCurrentOrientation(WindowResizeDirection direction, int windowRotationAngle)
272 case WindowResizeDirection::TOP_LEFT:
277 case WindowResizeDirection::LEFT:
282 case WindowResizeDirection::BOTTOM_LEFT:
287 case WindowResizeDirection::BOTTOM:
292 case WindowResizeDirection::BOTTOM_RIGHT:
297 case WindowResizeDirection::RIGHT:
302 case WindowResizeDirection::TOP_RIGHT:
307 case WindowResizeDirection::TOP:
319 if(index != 8 && windowRotationAngle != 0)
321 index = (index + (windowRotationAngle / 90) * 2) % 8;
324 return RESIZE_LOCATIONS[index];
327 /////////////////////////////////////////////////////////////////////////////////////////////////
329 /////////////////////////////////////////////////////////////////////////////////////////////////
331 /// Called when the window iconify state is changed.
332 static Eina_Bool EcoreEventWindowIconifyStateChanged(void* data, int type, void* event)
334 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
337 return windowBase->OnIconifyStateChanged(data, type, event);
340 return ECORE_CALLBACK_PASS_ON;
343 /// Called when the window gains focus
344 static Eina_Bool EcoreEventWindowFocusIn(void* data, int type, void* event)
346 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
349 return windowBase->OnFocusIn(data, type, event);
352 return ECORE_CALLBACK_PASS_ON;
355 /// Called when the window loses focus
356 static Eina_Bool EcoreEventWindowFocusOut(void* data, int type, void* event)
358 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
361 return windowBase->OnFocusOut(data, type, event);
364 return ECORE_CALLBACK_PASS_ON;
367 /// Called when the output is transformed
368 static Eina_Bool EcoreEventOutputTransform(void* data, int type, void* event)
370 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
373 return windowBase->OnOutputTransform(data, type, event);
376 return ECORE_CALLBACK_PASS_ON;
379 /// Called when the output transform should be ignored
380 static Eina_Bool EcoreEventIgnoreOutputTransform(void* data, int type, void* event)
382 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
385 return windowBase->OnIgnoreOutputTransform(data, type, event);
388 return ECORE_CALLBACK_PASS_ON;
392 * Called when rotate event is recevied.
394 static Eina_Bool EcoreEventRotate(void* data, int type, void* event)
396 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
399 DALI_LOG_RELEASE_INFO("WindowBaseEcoreWl2::EcoreEventRotate\n");
400 windowBase->OnRotation(data, type, event);
402 return ECORE_CALLBACK_PASS_ON;
406 * Called when configure event is recevied.
408 static Eina_Bool EcoreEventConfigure(void* data, int type, void* event)
410 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
413 windowBase->OnConfiguration(data, type, event);
415 return ECORE_CALLBACK_PASS_ON;
418 /////////////////////////////////////////////////////////////////////////////////////////////////
420 /////////////////////////////////////////////////////////////////////////////////////////////////
423 * Called when a touch down is received.
425 static Eina_Bool EcoreEventMouseButtonDown(void* data, int type, void* event)
427 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
430 windowBase->OnMouseButtonDown(data, type, event);
432 return ECORE_CALLBACK_PASS_ON;
436 * Called when a touch up is received.
438 static Eina_Bool EcoreEventMouseButtonUp(void* data, int type, void* event)
440 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
443 windowBase->OnMouseButtonUp(data, type, event);
445 return ECORE_CALLBACK_PASS_ON;
449 * Called when a touch motion is received.
451 static Eina_Bool EcoreEventMouseButtonMove(void* data, int type, void* event)
453 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
456 windowBase->OnMouseButtonMove(data, type, event);
458 return ECORE_CALLBACK_PASS_ON;
462 * Called when a touch motion is received.
464 static Eina_Bool EcoreEventMouseButtonRelativeMove(void* data, int type, void* event)
466 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
469 windowBase->OnMouseButtonRelativeMove(data, type, event);
471 return ECORE_CALLBACK_PASS_ON;
475 * Called when a touch is canceled.
477 static Eina_Bool EcoreEventMouseButtonCancel(void* data, int type, void* event)
479 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
482 windowBase->OnMouseButtonCancel(data, type, event);
484 return ECORE_CALLBACK_PASS_ON;
488 * Called when a mouse wheel is received.
490 static Eina_Bool EcoreEventMouseWheel(void* data, int type, void* event)
492 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
495 windowBase->OnMouseWheel(data, type, event);
497 return ECORE_CALLBACK_PASS_ON;
501 * Called when a mouse in is received.
503 static Eina_Bool EcoreEventMouseIn(void* data, int type, void* event)
505 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
508 windowBase->OnMouseInOut(data, type, event, Dali::DevelWindow::MouseInOutEvent::Type::IN);
510 return ECORE_CALLBACK_PASS_ON;
514 * Called when a mouse out is received.
516 static Eina_Bool EcoreEventMouseOut(void* data, int type, void* event)
518 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
521 // When the mouse is out, the previous mouse must be canceled.
522 windowBase->OnMouseButtonCancel(data, type, event);
523 windowBase->OnMouseInOut(data, type, event, Dali::DevelWindow::MouseInOutEvent::Type::OUT);
525 return ECORE_CALLBACK_PASS_ON;
529 * Called when a detent rotation event is recevied.
531 static Eina_Bool EcoreEventDetentRotation(void* data, int type, void* event)
533 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
536 windowBase->OnDetentRotation(data, type, event);
538 return ECORE_CALLBACK_PASS_ON;
541 /////////////////////////////////////////////////////////////////////////////////////////////////
543 /////////////////////////////////////////////////////////////////////////////////////////////////
546 * Called when a key down is received.
548 static Eina_Bool EcoreEventKeyDown(void* data, int type, void* event)
550 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
553 windowBase->OnKeyDown(data, type, event);
555 return ECORE_CALLBACK_PASS_ON;
559 * Called when a key up is received.
561 static Eina_Bool EcoreEventKeyUp(void* data, int type, void* event)
563 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
566 windowBase->OnKeyUp(data, type, event);
568 return ECORE_CALLBACK_PASS_ON;
571 /////////////////////////////////////////////////////////////////////////////////////////////////
572 // Selection Callbacks
573 /////////////////////////////////////////////////////////////////////////////////////////////////
576 * Called when the source window notifies us the content in clipboard is selected.
578 static Eina_Bool EcoreEventDataSend(void* data, int type, void* event)
580 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
583 windowBase->OnDataSend(data, type, event);
585 return ECORE_CALLBACK_PASS_ON;
589 * Called when the source window sends us about the selected content.
590 * For example, when item is selected in the clipboard.
592 static Eina_Bool EcoreEventDataReceive(void* data, int type, void* event)
594 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
597 windowBase->OnDataReceive(data, type, event);
599 return ECORE_CALLBACK_PASS_ON;
602 /////////////////////////////////////////////////////////////////////////////////////////////////
603 // Effect Start/End Callbacks
604 /////////////////////////////////////////////////////////////////////////////////////////////////
607 * Called when transition animation of the window's shown/hidden is started by window manager.
609 static Eina_Bool EcoreEventEffectStart(void* data, int type, void* event)
611 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
612 Ecore_Wl2_Event_Effect_Start* effectStart = static_cast<Ecore_Wl2_Event_Effect_Start*>(event);
613 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::EcoreEventEffectStart, effect type[ %d ]\n", effectStart->type);
616 if(effectStart->type < 3) // only under restack
618 windowBase->OnTransitionEffectEvent(WindowEffectState::START, static_cast<WindowEffectType>(effectStart->type));
621 return ECORE_CALLBACK_PASS_ON;
625 * Called when transition animation of the window's shown/hidden is ended by window manager.
627 static Eina_Bool EcoreEventEffectEnd(void* data, int type, void* event)
629 Ecore_Wl2_Event_Effect_Start* effectEnd = static_cast<Ecore_Wl2_Event_Effect_Start*>(event);
630 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
631 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::EcoreEventEffectEnd, effect type[ %d ]\n", effectEnd->type);
634 if(effectEnd->type < 3) // only under restack
636 windowBase->OnTransitionEffectEvent(WindowEffectState::END, static_cast<WindowEffectType>(effectEnd->type));
639 return ECORE_CALLBACK_PASS_ON;
642 /////////////////////////////////////////////////////////////////////////////////////////////////
643 // Keyboard Repeat Settings Changed Callbacks
644 /////////////////////////////////////////////////////////////////////////////////////////////////
646 static Eina_Bool EcoreEventSeatKeyboardRepeatChanged(void* data, int type, void* event)
648 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
649 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::EcoreEventSeatKeyboardRepeatChanged, id[ %d ]\n", static_cast<Ecore_Wl2_Event_Seat_Keyboard_Repeat_Changed*>(event)->id);
652 windowBase->OnKeyboardRepeatSettingsChanged();
655 return ECORE_CALLBACK_RENEW;
658 /////////////////////////////////////////////////////////////////////////////////////////////////
659 // Keymap Changed Callbacks
660 /////////////////////////////////////////////////////////////////////////////////////////////////
662 static Eina_Bool EcoreEventSeatKeymapChanged(void* data, int type, void* event)
664 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
667 windowBase->KeymapChanged(data, type, event);
670 return ECORE_CALLBACK_RENEW;
673 /////////////////////////////////////////////////////////////////////////////////////////////////
675 /////////////////////////////////////////////////////////////////////////////////////////////////
677 #if defined(VCONF_ENABLED)
679 * Called when a font name is changed.
681 static void VconfNotifyFontNameChanged(keynode_t* node, void* data)
683 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
686 windowBase->OnFontNameChanged();
691 * Called when a font size is changed.
693 static void VconfNotifyFontSizeChanged(keynode_t* node, void* data)
695 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
698 windowBase->OnFontSizeChanged();
703 /////////////////////////////////////////////////////////////////////////////////////////////////
704 // Window Redraw Request Event Callbacks
705 /////////////////////////////////////////////////////////////////////////////////////////////////
707 static Eina_Bool EcoreEventWindowRedrawRequest(void* data, int type, void* event)
709 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
710 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::EcoreEventWindowRedrawRequest, window[ %d ]\n", static_cast<Ecore_Wl2_Event_Window_Redraw_Request*>(event)->win);
713 windowBase->OnEcoreEventWindowRedrawRequest();
716 return ECORE_CALLBACK_RENEW;
719 /////////////////////////////////////////////////////////////////////////////////////////////////
720 // Window Auxiliary Message Callbacks
721 /////////////////////////////////////////////////////////////////////////////////////////////////
722 static Eina_Bool EcoreEventWindowAuxiliaryMessage(void* data, int type, void* event)
724 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
727 windowBase->OnEcoreEventWindowAuxiliaryMessage(event);
729 return ECORE_CALLBACK_RENEW;
732 /////////////////////////////////////////////////////////////////////////////////////////////////
733 // Window is Moved/Resized By Server Callbacks
734 /////////////////////////////////////////////////////////////////////////////////////////////////
735 static Eina_Bool EcoreEventWindowMoveCompleted(void* data, int type, void* event)
737 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
740 windowBase->OnMoveCompleted(event);
742 return ECORE_CALLBACK_RENEW;
745 static Eina_Bool EcoreEventWindowResizeCompleted(void* data, int type, void* event)
747 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
750 windowBase->OnResizeCompleted(event);
752 return ECORE_CALLBACK_RENEW;
755 /////////////////////////////////////////////////////////////////////////////////////////////////
756 // Conformant Change Callback
757 /////////////////////////////////////////////////////////////////////////////////////////////////
758 static Eina_Bool EcoreEventConformantChange(void* data, int type, void* event)
760 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
763 windowBase->OnEcoreEventConformantChange(event);
765 return ECORE_CALLBACK_RENEW;
768 static void RegistryGlobalCallback(void* data, struct wl_registry* registry, uint32_t name, const char* interface, uint32_t version)
770 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
773 windowBase->RegistryGlobalCallback(data, registry, name, interface, version);
777 static void RegistryGlobalCallbackRemove(void* data, struct wl_registry* registry, uint32_t id)
779 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
782 windowBase->RegistryGlobalCallbackRemove(data, registry, id);
786 static void TizenPolicyConformant(void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, uint32_t isConformant)
790 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)
792 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
795 windowBase->TizenPolicyConformantArea(data, tizenPolicy, surface, conformantPart, state, x, y, w, h);
799 static void TizenPolicyNotificationChangeDone(void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, int32_t level, uint32_t state)
801 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
804 windowBase->TizenPolicyNotificationChangeDone(data, tizenPolicy, surface, level, state);
808 static void TizenPolicyTransientForDone(void* data, struct tizen_policy* tizenPolicy, uint32_t childId)
812 static void TizenPolicyScreenModeChangeDone(void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, uint32_t mode, uint32_t state)
814 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
817 windowBase->TizenPolicyScreenModeChangeDone(data, tizenPolicy, surface, mode, state);
821 static void TizenPolicyIconifyStateChanged(void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, uint32_t iconified, uint32_t force)
825 static void TizenPolicySupportedAuxiliaryHints(void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, struct wl_array* hints, uint32_t numNints)
829 static void TizenPolicyAllowedAuxiliaryHint(void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, int id)
833 static void TizenPolicyAuxiliaryMessage(void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, const char* key, const char* val, struct wl_array* options)
837 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)
841 static void DisplayPolicyBrightnessChangeDone(void* data, struct tizen_display_policy* displayPolicy, struct wl_surface* surface, int32_t brightness, uint32_t state)
843 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
846 windowBase->DisplayPolicyBrightnessChangeDone(data, displayPolicy, surface, brightness, state);
850 const struct wl_registry_listener registryListener =
852 RegistryGlobalCallback,
853 RegistryGlobalCallbackRemove};
855 const struct tizen_policy_listener tizenPolicyListener =
857 TizenPolicyConformant,
858 TizenPolicyConformantArea,
859 TizenPolicyNotificationChangeDone,
860 TizenPolicyTransientForDone,
861 TizenPolicyScreenModeChangeDone,
862 TizenPolicyIconifyStateChanged,
863 TizenPolicySupportedAuxiliaryHints,
864 TizenPolicyAllowedAuxiliaryHint,
865 TizenPolicyAuxiliaryMessage,
866 TizenPolicyConformantRegion};
868 const struct tizen_display_policy_listener tizenDisplayPolicyListener =
870 DisplayPolicyBrightnessChangeDone};
872 } // unnamed namespace
874 WindowBaseEcoreWl2::WindowBaseEcoreWl2(Dali::PositionSize positionSize, Any surface, bool isTransparent)
875 : mEcoreEventHandler(),
876 mEcoreWindow(nullptr),
878 mWlInputPanel(nullptr),
880 mWlInputPanelSurface(nullptr),
883 mEventQueue(nullptr),
884 mTizenPolicy(nullptr),
885 mTizenDisplayPolicy(nullptr),
887 mSupportedAuxiliaryHints(),
888 mWindowPositionSize(positionSize),
890 mType(WindowType::NORMAL),
891 mNotificationLevel(-1),
894 mWindowRotationAngle(0),
895 mScreenRotationAngle(0),
896 mSupportedPreProtation(0),
897 mNotificationChangeState(0),
898 mScreenOffModeChangeState(0),
899 mBrightnessChangeState(0),
900 mLastSubmittedMoveResizeSerial(0),
901 mMoveResizeSerial(0),
902 mNotificationLevelChangeDone(true),
903 mScreenOffModeChangeDone(true),
906 mBrightnessChangeDone(true)
908 Initialize(positionSize, surface, isTransparent);
911 WindowBaseEcoreWl2::~WindowBaseEcoreWl2()
913 #if defined(VCONF_ENABLED)
914 vconf_ignore_key_changed(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, VconfNotifyFontSizeChanged);
915 vconf_ignore_key_changed(DALI_VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_NAME, VconfNotifyFontNameChanged);
918 for(Dali::Vector<Ecore_Event_Handler*>::Iterator iter = mEcoreEventHandler.Begin(), endIter = mEcoreEventHandler.End(); iter != endIter; ++iter)
920 ecore_event_handler_del(*iter);
922 mEcoreEventHandler.Clear();
926 wl_event_queue_destroy(mEventQueue);
929 mSupportedAuxiliaryHints.clear();
930 mAuxiliaryHints.clear();
932 if(mEglWindow != NULL)
934 wl_egl_window_destroy(mEglWindow);
940 ecore_wl2_window_free(mEcoreWindow);
944 void WindowBaseEcoreWl2::Initialize(PositionSize positionSize, Any surface, bool isTransparent)
946 if(surface.Empty() == false)
948 // check we have a valid type
949 DALI_ASSERT_ALWAYS((surface.GetType() == typeid(Ecore_Wl2_Window*)) && "Surface type is invalid");
951 mEcoreWindow = AnyCast<Ecore_Wl2_Window*>(surface);
955 // we own the surface about to created
957 CreateWindow(positionSize);
960 mWlSurface = ecore_wl2_window_surface_get(mEcoreWindow);
962 SetTransparency(isTransparent);
964 Ecore_Wl2_Display* display = ecore_wl2_connected_display_get(NULL);
965 Ecore_Wl2_Input* ecoreWlInput = ecore_wl2_input_default_input_get(display);
969 mKeyMap = ecore_wl2_input_keymap_get(ecoreWlInput);
971 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_SEAT_KEYMAP_CHANGED, EcoreEventSeatKeymapChanged, this));
974 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_WINDOW_ICONIFY_STATE_CHANGE, EcoreEventWindowIconifyStateChanged, this));
975 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_FOCUS_IN, EcoreEventWindowFocusIn, this));
976 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_FOCUS_OUT, EcoreEventWindowFocusOut, this));
977 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_OUTPUT_TRANSFORM, EcoreEventOutputTransform, this));
978 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_IGNORE_OUTPUT_TRANSFORM, EcoreEventIgnoreOutputTransform, this));
980 // Register Rotate event
981 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_WINDOW_ROTATE, EcoreEventRotate, this));
983 // Register Configure event
984 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_WINDOW_CONFIGURE, EcoreEventConfigure, this));
986 // Register Touch events
987 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_DOWN, EcoreEventMouseButtonDown, this));
988 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_UP, EcoreEventMouseButtonUp, this));
989 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_EVENT_MOUSE_MOVE, EcoreEventMouseButtonMove, this));
990 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_CANCEL, EcoreEventMouseButtonCancel, this));
991 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_EVENT_MOUSE_RELATIVE_MOVE, EcoreEventMouseButtonRelativeMove, this));
993 // Register Mouse wheel events
994 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_EVENT_MOUSE_WHEEL, EcoreEventMouseWheel, this));
996 // Register Mouse IO events
997 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_EVENT_MOUSE_IN, EcoreEventMouseIn, this));
998 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_EVENT_MOUSE_OUT, EcoreEventMouseOut, this));
1000 // Register Detent event
1001 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_EVENT_DETENT_ROTATE, EcoreEventDetentRotation, this));
1003 // Register Key events
1004 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_EVENT_KEY_DOWN, EcoreEventKeyDown, this));
1005 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_EVENT_KEY_UP, EcoreEventKeyUp, this));
1007 // Register Selection event - clipboard selection
1008 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_DATA_SOURCE_SEND, EcoreEventDataSend, this));
1009 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_OFFER_DATA_READY, EcoreEventDataReceive, this));
1011 // Register Effect Start/End event
1012 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_EFFECT_START, EcoreEventEffectStart, this));
1013 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_EFFECT_END, EcoreEventEffectEnd, this));
1015 // Register Keyboard repeat event
1016 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_SEAT_KEYBOARD_REPEAT_CHANGED, EcoreEventSeatKeyboardRepeatChanged, this));
1018 // Register Window redraw request event
1019 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_WINDOW_REDRAW_REQUEST, EcoreEventWindowRedrawRequest, this));
1021 // Register Window auxiliary event
1022 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_AUX_MESSAGE, EcoreEventWindowAuxiliaryMessage, this));
1024 // Register Conformant change event
1025 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_CONFORMANT_CHANGE, EcoreEventConformantChange, this));
1027 #if defined(VCONF_ENABLED)
1028 // Register Vconf notify - font name and size
1029 vconf_notify_key_changed_for_ui_thread(DALI_VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_NAME, VconfNotifyFontNameChanged, this);
1030 vconf_notify_key_changed_for_ui_thread(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, VconfNotifyFontSizeChanged, this);
1033 // Register Window is moved and resized done event.
1034 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_WINDOW_INTERACTIVE_MOVE_DONE, EcoreEventWindowMoveCompleted, this));
1035 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_WINDOW_INTERACTIVE_RESIZE_DONE, EcoreEventWindowResizeCompleted, this));
1037 mDisplay = ecore_wl2_display_get(display);
1040 wl_display* displayWrapper = static_cast<wl_display*>(wl_proxy_create_wrapper(mDisplay));
1043 mEventQueue = wl_display_create_queue(mDisplay);
1046 wl_proxy_set_queue(reinterpret_cast<wl_proxy*>(displayWrapper), mEventQueue);
1048 wl_registry* registry = wl_display_get_registry(displayWrapper);
1049 wl_registry_add_listener(registry, ®istryListener, this);
1051 // To support ECORE_WL2_EVENT_CONFORMANT_CHANGE event handler
1052 ecore_wl2_window_conformant_set(mEcoreWindow, true);
1055 wl_proxy_wrapper_destroy(displayWrapper);
1059 // get auxiliary hint
1060 Eina_List* hints = ecore_wl2_window_aux_hints_supported_get(mEcoreWindow);
1063 Eina_List* l = NULL;
1066 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))))
1068 mSupportedAuxiliaryHints.push_back(hint);
1070 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::Initialize: %s\n", hint);
1075 Eina_Bool WindowBaseEcoreWl2::OnIconifyStateChanged(void* data, int type, void* event)
1077 Ecore_Wl2_Event_Window_Iconify_State_Change* iconifyChangedEvent(static_cast<Ecore_Wl2_Event_Window_Iconify_State_Change*>(event));
1078 Eina_Bool handled(ECORE_CALLBACK_PASS_ON);
1080 if(iconifyChangedEvent->win == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
1082 if(iconifyChangedEvent->iconified == EINA_TRUE)
1084 mIconifyChangedSignal.Emit(true);
1088 mIconifyChangedSignal.Emit(false);
1090 handled = ECORE_CALLBACK_DONE;
1096 Eina_Bool WindowBaseEcoreWl2::OnFocusIn(void* data, int type, void* event)
1098 Ecore_Wl2_Event_Focus_In* focusInEvent(static_cast<Ecore_Wl2_Event_Focus_In*>(event));
1100 if(focusInEvent->window == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
1102 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "Window EcoreEventWindowFocusIn\n");
1104 mFocusChangedSignal.Emit(true);
1107 return ECORE_CALLBACK_PASS_ON;
1110 Eina_Bool WindowBaseEcoreWl2::OnFocusOut(void* data, int type, void* event)
1112 Ecore_Wl2_Event_Focus_Out* focusOutEvent(static_cast<Ecore_Wl2_Event_Focus_Out*>(event));
1114 if(focusOutEvent->window == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
1116 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "Window EcoreEventWindowFocusOut\n");
1118 mFocusChangedSignal.Emit(false);
1121 return ECORE_CALLBACK_PASS_ON;
1124 Eina_Bool WindowBaseEcoreWl2::OnOutputTransform(void* data, int type, void* event)
1126 Ecore_Wl2_Event_Output_Transform* transformEvent(static_cast<Ecore_Wl2_Event_Output_Transform*>(event));
1128 if(transformEvent->output == ecore_wl2_window_output_find(mEcoreWindow))
1130 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "Window (%p) EcoreEventOutputTransform\n", mEcoreWindow);
1132 mScreenRotationAngle = GetScreenRotationAngle();
1134 mOutputTransformedSignal.Emit();
1137 return ECORE_CALLBACK_PASS_ON;
1140 Eina_Bool WindowBaseEcoreWl2::OnIgnoreOutputTransform(void* data, int type, void* event)
1142 Ecore_Wl2_Event_Ignore_Output_Transform* ignoreTransformEvent(static_cast<Ecore_Wl2_Event_Ignore_Output_Transform*>(event));
1144 if(ignoreTransformEvent->win == mEcoreWindow)
1146 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "Window (%p) EcoreEventIgnoreOutputTransform\n", mEcoreWindow);
1148 mScreenRotationAngle = GetScreenRotationAngle();
1150 mOutputTransformedSignal.Emit();
1153 return ECORE_CALLBACK_PASS_ON;
1156 void WindowBaseEcoreWl2::OnRotation(void* data, int type, void* event)
1158 Ecore_Wl2_Event_Window_Rotation* ev(static_cast<Ecore_Wl2_Event_Window_Rotation*>(event));
1160 if(ev->win == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
1162 DALI_LOG_RELEASE_INFO("WindowBaseEcoreWl2::OnRotation, angle: %d, width: %d, height: %d\n", ev->angle, ev->w, ev->h);
1164 RotationEvent rotationEvent;
1165 rotationEvent.angle = ev->angle;
1166 rotationEvent.winResize = 0;
1168 if(ev->w == 0 || ev->h == 0)
1170 // When rotation event does not have the window width or height,
1171 // previous DALi side window's size are used.
1172 ev->w = mWindowPositionSize.width;
1173 ev->h = mWindowPositionSize.height;
1176 mWindowRotationAngle = ev->angle;
1178 mWindowPositionSize.width = ev->w;
1179 mWindowPositionSize.height = ev->h;
1181 PositionSize newPositionSize = RecalculatePositionSizeToCurrentOrientation(mWindowPositionSize);
1183 rotationEvent.x = newPositionSize.x;
1184 rotationEvent.y = newPositionSize.y;
1185 rotationEvent.width = newPositionSize.width;
1186 rotationEvent.height = newPositionSize.height;
1188 mRotationSignal.Emit(rotationEvent);
1192 void WindowBaseEcoreWl2::OnConfiguration(void* data, int type, void* event)
1194 Ecore_Wl2_Event_Window_Configure* ev(static_cast<Ecore_Wl2_Event_Window_Configure*>(event));
1196 if(ev && ev->win == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
1198 // Note: To comply with the wayland protocol, Dali should make an ack_configure
1199 // by calling ecore_wl2_window_commit
1201 int tempWidth = ev->w;
1202 int tempHeight = ev->h;
1204 // Initialize with previous size for skip resize when new size is 0.
1205 // When window is just moved or window is resized by client application,
1206 // The configure notification event's size will be 0.
1207 // If new size is 0, the resized work should be skip.
1208 int newWidth = mWindowPositionSize.width;
1209 int newHeight = mWindowPositionSize.height;
1210 bool windowMoved = false, windowResized = false;
1212 if(ev->x != mWindowPositionSize.x || ev->y != mWindowPositionSize.y)
1217 if(tempWidth != 0 && tempHeight != 0 && (tempWidth != mWindowPositionSize.width || tempHeight != mWindowPositionSize.height))
1219 windowResized = true;
1220 newWidth = tempWidth;
1221 newHeight = tempHeight;
1224 if(windowMoved || windowResized)
1226 mWindowPositionSize.x = ev->x;
1227 mWindowPositionSize.y = ev->y;
1228 mWindowPositionSize.width = newWidth;
1229 mWindowPositionSize.height = newHeight;
1230 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);
1232 ecore_wl2_window_geometry_set(mEcoreWindow, mWindowPositionSize.x, mWindowPositionSize.y, mWindowPositionSize.width, mWindowPositionSize.height);
1234 Dali::PositionSize newPositionSize = RecalculatePositionSizeToCurrentOrientation(mWindowPositionSize);
1235 mUpdatePositionSizeSignal.Emit(newPositionSize);
1238 mMaximizeChangedSignal.Emit(static_cast<bool>(ev->states & ECORE_WL2_WINDOW_STATE_MAXIMIZED));
1240 ecore_wl2_window_commit(mEcoreWindow, EINA_FALSE);
1244 void WindowBaseEcoreWl2::OnMouseButtonDown(void* data, int type, void* event)
1246 Ecore_Event_Mouse_Button* touchEvent = static_cast<Ecore_Event_Mouse_Button*>(event);
1248 if(touchEvent->window == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
1250 DALI_TRACE_SCOPE(gTraceFilter, "DALI_ON_MOUSE_DOWN");
1252 Device::Class::Type deviceClass;
1253 Device::Subclass::Type deviceSubclass;
1255 GetDeviceClass(ecore_device_class_get(touchEvent->dev), deviceClass);
1256 GetDeviceSubclass(ecore_device_subclass_get(touchEvent->dev), deviceSubclass);
1258 PointState::Type state(PointState::DOWN);
1260 if(deviceClass != Device::Class::Type::MOUSE)
1262 // Check if the buttons field is set and ensure it's the primary touch button.
1263 // If this event was triggered by buttons other than the primary button (used for touch), then
1264 // just send an interrupted event to Core.
1265 if(touchEvent->buttons && (touchEvent->buttons != PRIMARY_TOUCH_BUTTON_ID))
1267 state = PointState::INTERRUPTED;
1271 Integration::Point point;
1272 point.SetDeviceId(touchEvent->multi.device);
1273 point.SetState(state);
1274 point.SetScreenPosition(Vector2(touchEvent->x, touchEvent->y));
1275 point.SetRadius(touchEvent->multi.radius, Vector2(touchEvent->multi.radius_x, touchEvent->multi.radius_y));
1276 point.SetPressure(touchEvent->multi.pressure);
1277 point.SetAngle(Degree(touchEvent->multi.angle));
1278 point.SetDeviceClass(deviceClass);
1279 point.SetDeviceSubclass(deviceSubclass);
1280 point.SetMouseButton(static_cast<MouseButton::Type>(touchEvent->buttons));
1282 mTouchEventSignal.Emit(point, touchEvent->timestamp);
1286 void WindowBaseEcoreWl2::OnMouseButtonUp(void* data, int type, void* event)
1288 Ecore_Event_Mouse_Button* touchEvent = static_cast<Ecore_Event_Mouse_Button*>(event);
1290 if(touchEvent->window == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
1292 DALI_TRACE_SCOPE(gTraceFilter, "DALI_ON_MOUSE_UP");
1294 Device::Class::Type deviceClass;
1295 Device::Subclass::Type deviceSubclass;
1297 GetDeviceClass(ecore_device_class_get(touchEvent->dev), deviceClass);
1298 GetDeviceSubclass(ecore_device_subclass_get(touchEvent->dev), deviceSubclass);
1300 Integration::Point point;
1301 point.SetDeviceId(touchEvent->multi.device);
1302 point.SetState(PointState::UP);
1303 point.SetScreenPosition(Vector2(touchEvent->x, touchEvent->y));
1304 point.SetRadius(touchEvent->multi.radius, Vector2(touchEvent->multi.radius_x, touchEvent->multi.radius_y));
1305 point.SetPressure(touchEvent->multi.pressure);
1306 point.SetAngle(Degree(touchEvent->multi.angle));
1307 point.SetDeviceClass(deviceClass);
1308 point.SetDeviceSubclass(deviceSubclass);
1309 point.SetMouseButton(static_cast<MouseButton::Type>(touchEvent->buttons));
1311 mTouchEventSignal.Emit(point, touchEvent->timestamp);
1315 void WindowBaseEcoreWl2::OnMouseButtonMove(void* data, int type, void* event)
1317 Ecore_Event_Mouse_Move* touchEvent = static_cast<Ecore_Event_Mouse_Move*>(event);
1319 if(touchEvent->window == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
1321 DALI_TRACE_SCOPE(gTraceFilter, "DALI_ON_MOUSE_MOVE");
1323 Device::Class::Type deviceClass;
1324 Device::Subclass::Type deviceSubclass;
1326 GetDeviceClass(ecore_device_class_get(touchEvent->dev), deviceClass);
1327 GetDeviceSubclass(ecore_device_subclass_get(touchEvent->dev), deviceSubclass);
1329 Integration::Point point;
1330 point.SetDeviceId(touchEvent->multi.device);
1331 point.SetState(PointState::MOTION);
1332 point.SetScreenPosition(Vector2(touchEvent->x, touchEvent->y));
1333 point.SetRadius(touchEvent->multi.radius, Vector2(touchEvent->multi.radius_x, touchEvent->multi.radius_y));
1334 point.SetPressure(touchEvent->multi.pressure);
1335 point.SetAngle(Degree(touchEvent->multi.angle));
1336 point.SetDeviceClass(deviceClass);
1337 point.SetDeviceSubclass(deviceSubclass);
1339 mTouchEventSignal.Emit(point, touchEvent->timestamp);
1343 void WindowBaseEcoreWl2::OnMouseButtonRelativeMove(void* data, int type, void* event)
1345 Ecore_Event_Mouse_Relative_Move* relativeMoveEvent = static_cast<Ecore_Event_Mouse_Relative_Move*>(event);
1347 if(relativeMoveEvent->window == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
1349 DALI_TRACE_SCOPE(gTraceFilter, "DALI_ON_MOUSE_RELATIVE_MOVE");
1351 Device::Class::Type deviceClass;
1352 Device::Subclass::Type deviceSubclass;
1354 GetDeviceClass(ecore_device_class_get(relativeMoveEvent->dev), deviceClass);
1355 GetDeviceSubclass(ecore_device_subclass_get(relativeMoveEvent->dev), deviceSubclass);
1357 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);
1359 mMouseRelativeEventSignal.Emit(MouseRelativeEvent);
1363 void WindowBaseEcoreWl2::OnMouseButtonCancel(void* data, int type, void* event)
1365 Ecore_Event_Mouse_Button* touchEvent = static_cast<Ecore_Event_Mouse_Button*>(event);
1367 if(touchEvent->window == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
1369 DALI_TRACE_SCOPE(gTraceFilter, "DALI_ON_MOUSE_CANCEL");
1371 Integration::Point point;
1372 point.SetDeviceId(touchEvent->multi.device);
1373 point.SetState(PointState::INTERRUPTED);
1374 point.SetScreenPosition(Vector2(0.0f, 0.0f));
1376 mTouchEventSignal.Emit(point, touchEvent->timestamp);
1378 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::OnMouseButtonCancel\n");
1382 void WindowBaseEcoreWl2::OnMouseWheel(void* data, int type, void* event)
1384 Ecore_Event_Mouse_Wheel* mouseWheelEvent = static_cast<Ecore_Event_Mouse_Wheel*>(event);
1386 if(mouseWheelEvent->window == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
1388 DALI_TRACE_SCOPE(gTraceFilter, "DALI_ON_MOUSE_WHEEL");
1390 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);
1392 Integration::WheelEvent wheelEvent(Integration::WheelEvent::MOUSE_WHEEL, mouseWheelEvent->direction, mouseWheelEvent->modifiers, Vector2(mouseWheelEvent->x, mouseWheelEvent->y), mouseWheelEvent->z, mouseWheelEvent->timestamp);
1394 mWheelEventSignal.Emit(wheelEvent);
1398 void WindowBaseEcoreWl2::OnMouseInOut(void* data, int type, void* event, Dali::DevelWindow::MouseInOutEvent::Type action)
1400 Ecore_Event_Mouse_IO* mouseInOutEvent = static_cast<Ecore_Event_Mouse_IO*>(event);
1402 if(mouseInOutEvent->window == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
1404 DALI_TRACE_SCOPE(gTraceFilter, "DALI_ON_MOUSE_IN_OUT");
1406 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);
1408 Device::Class::Type deviceClass;
1409 Device::Subclass::Type deviceSubclass;
1411 GetDeviceClass(ecore_device_class_get(mouseInOutEvent->dev), deviceClass);
1412 GetDeviceSubclass(ecore_device_subclass_get(mouseInOutEvent->dev), deviceSubclass);
1414 Dali::DevelWindow::MouseInOutEvent inOutEvent(action, mouseInOutEvent->modifiers, Vector2(mouseInOutEvent->x, mouseInOutEvent->y), mouseInOutEvent->timestamp, deviceClass, deviceSubclass);
1416 mMouseInOutEventSignal.Emit(inOutEvent);
1420 void WindowBaseEcoreWl2::OnDetentRotation(void* data, int type, void* event)
1422 Ecore_Event_Detent_Rotate* detentEvent = static_cast<Ecore_Event_Detent_Rotate*>(event);
1424 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Concise, "WindowBaseEcoreWl2::OnDetentRotation\n");
1426 int32_t clockwise = (detentEvent->direction == ECORE_DETENT_DIRECTION_CLOCKWISE) ? 1 : -1;
1428 Integration::WheelEvent wheelEvent(Integration::WheelEvent::CUSTOM_WHEEL, detentEvent->direction, 0, Vector2(0.0f, 0.0f), clockwise, detentEvent->timestamp);
1430 mWheelEventSignal.Emit(wheelEvent);
1433 void WindowBaseEcoreWl2::OnKeyDown(void* data, int type, void* event)
1435 Ecore_Event_Key* keyEvent = static_cast<Ecore_Event_Key*>(event);
1437 if(keyEvent->window == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
1439 std::string keyName(keyEvent->keyname);
1440 std::string logicalKey("");
1441 std::string keyString("");
1442 std::string compose("");
1444 DALI_TRACE_SCOPE(gTraceFilter, "DALI_ON_KEY_DOWN");
1446 // Ensure key compose string is not NULL as keys like SHIFT or arrow have a null string.
1447 if(keyEvent->compose)
1449 compose = keyEvent->compose;
1452 // Ensure key symbol is not NULL as keys like SHIFT have a null string.
1455 logicalKey = keyEvent->key;
1459 GetKeyCode(keyName, keyCode); // Get key code dynamically.
1463 // Get a specific key code from dali key look up table.
1464 keyCode = KeyLookup::GetDaliKeyCode(keyEvent->keyname);
1467 keyCode = (keyCode == -1) ? 0 : keyCode;
1468 int modifier(keyEvent->modifiers);
1469 unsigned long time = keyEvent->timestamp;
1470 if(!strncmp(keyEvent->keyname, "Keycode-", 8))
1472 keyCode = atoi(keyEvent->keyname + 8);
1475 // Ensure key event string is not NULL as keys like SHIFT have a null string.
1476 if(keyEvent->string)
1478 keyString = keyEvent->string;
1481 std::string deviceName;
1482 Device::Class::Type deviceClass;
1483 Device::Subclass::Type deviceSubclass;
1485 GetDeviceName(keyEvent, deviceName);
1486 GetDeviceClass(ecore_device_class_get(keyEvent->dev), deviceClass);
1487 GetDeviceSubclass(ecore_device_subclass_get(keyEvent->dev), deviceSubclass);
1489 Integration::KeyEvent keyEvent(keyName, logicalKey, keyString, keyCode, modifier, time, Integration::KeyEvent::DOWN, compose, deviceName, deviceClass, deviceSubclass);
1491 mKeyEventSignal.Emit(keyEvent);
1495 void WindowBaseEcoreWl2::OnKeyUp(void* data, int type, void* event)
1497 Ecore_Event_Key* keyEvent = static_cast<Ecore_Event_Key*>(event);
1499 if(keyEvent->window == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
1501 #if defined(ECORE_VERSION_MAJOR) && (ECORE_VERSION_MAJOR >= 1) && defined(ECORE_VERSION_MINOR) && (ECORE_VERSION_MINOR >= 23)
1502 // Cancel processing flag is sent because this key event will combine with the previous key. So, the event should not actually perform anything.
1503 if(keyEvent->event_flags & ECORE_EVENT_FLAG_CANCEL)
1505 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::OnKeyUp: This event flag indicates the event is canceled. \n");
1508 #endif // Since ecore 1.23 version
1510 std::string keyName(keyEvent->keyname);
1511 std::string logicalKey("");
1512 std::string keyString("");
1513 std::string compose("");
1515 DALI_TRACE_SCOPE(gTraceFilter, "DALI_ON_KEY_UP");
1517 // Ensure key compose string is not NULL as keys like SHIFT or arrow have a null string.
1518 if(keyEvent->compose)
1520 compose = keyEvent->compose;
1523 // Ensure key symbol is not NULL as keys like SHIFT have a null string.
1526 logicalKey = keyEvent->key;
1530 GetKeyCode(keyName, keyCode); // Get key code dynamically.
1534 // Get a specific key code from dali key look up table.
1535 keyCode = KeyLookup::GetDaliKeyCode(keyEvent->keyname);
1538 keyCode = (keyCode == -1) ? 0 : keyCode;
1539 int modifier(keyEvent->modifiers);
1540 unsigned long time = keyEvent->timestamp;
1541 if(!strncmp(keyEvent->keyname, "Keycode-", 8))
1543 keyCode = atoi(keyEvent->keyname + 8);
1546 // Ensure key event string is not NULL as keys like SHIFT have a null string.
1547 if(keyEvent->string)
1549 keyString = keyEvent->string;
1552 std::string deviceName;
1553 Device::Class::Type deviceClass;
1554 Device::Subclass::Type deviceSubclass;
1556 GetDeviceName(keyEvent, deviceName);
1557 GetDeviceClass(ecore_device_class_get(keyEvent->dev), deviceClass);
1558 GetDeviceSubclass(ecore_device_subclass_get(keyEvent->dev), deviceSubclass);
1560 Integration::KeyEvent keyEvent(keyName, logicalKey, keyString, keyCode, modifier, time, Integration::KeyEvent::UP, compose, deviceName, deviceClass, deviceSubclass);
1562 mKeyEventSignal.Emit(keyEvent);
1566 void WindowBaseEcoreWl2::OnDataSend(void* data, int type, void* event)
1568 mSelectionDataSendSignal.Emit(event);
1571 void WindowBaseEcoreWl2::OnDataReceive(void* data, int type, void* event)
1573 mSelectionDataReceivedSignal.Emit(event);
1576 void WindowBaseEcoreWl2::OnFontNameChanged()
1578 mStyleChangedSignal.Emit(StyleChange::DEFAULT_FONT_CHANGE);
1581 void WindowBaseEcoreWl2::OnFontSizeChanged()
1583 mStyleChangedSignal.Emit(StyleChange::DEFAULT_FONT_SIZE_CHANGE);
1586 void WindowBaseEcoreWl2::OnTransitionEffectEvent(WindowEffectState state, WindowEffectType type)
1588 mTransitionEffectEventSignal.Emit(state, type);
1591 void WindowBaseEcoreWl2::OnKeyboardRepeatSettingsChanged()
1593 mKeyboardRepeatSettingsChangedSignal.Emit();
1596 void WindowBaseEcoreWl2::OnEcoreEventWindowRedrawRequest()
1598 mWindowRedrawRequestSignal.Emit();
1601 void WindowBaseEcoreWl2::OnEcoreEventWindowAuxiliaryMessage(void* event)
1603 Ecore_Wl2_Event_Aux_Message* message = static_cast<Ecore_Wl2_Event_Aux_Message*>(event);
1606 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::OnEcoreEventWindowAuxiliaryMessage, key:%s, value:%s \n", message->key, message->val);
1607 std::string key(message->key);
1608 std::string value(message->val);
1609 Dali::Property::Array options;
1611 if(message->options)
1615 EINA_LIST_FOREACH(message->options, l, data)
1617 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::OnEcoreEventWindowAuxiliaryMessage, option: %s\n", (char*)data);
1618 std::string option(static_cast<char*>(data));
1619 options.Add(option);
1623 mAuxiliaryMessageSignal.Emit(key, value, options);
1627 void WindowBaseEcoreWl2::OnEcoreEventConformantChange(void* event)
1629 Ecore_Wl2_Event_Conformant_Change* ev = static_cast<Ecore_Wl2_Event_Conformant_Change*>(event);
1630 if(ev && ev->win == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
1632 WindowInsetsPartType partType = WindowInsetsPartType::STATUS_BAR;
1639 switch(ev->part_type)
1641 case ECORE_WL2_INDICATOR_PART:
1643 partType = WindowInsetsPartType::STATUS_BAR;
1644 ecore_wl2_window_indicator_geometry_get(mEcoreWindow, &x, &y, &w, &h);
1647 case ECORE_WL2_KEYBOARD_PART:
1649 partType = WindowInsetsPartType::KEYBOARD;
1650 ecore_wl2_window_keyboard_geometry_get(mEcoreWindow, &x, &y, &w, &h);
1653 case ECORE_WL2_CLIPBOARD_PART:
1655 partType = WindowInsetsPartType::CLIPBOARD;
1656 ecore_wl2_window_clipboard_geometry_get(mEcoreWindow, &x, &y, &w, &h);
1665 WindowInsetsPartState partState = WindowInsetsPartState::INVISIBLE;
1672 // Insets are applied only if system UI(e.g. virtual keyboard) satisfies the following 2 conditions.
1673 // 1. System UI fits to the window width or height.
1674 // 2. System UI begins or ends from the edge of window.
1675 // Otherwise, we should not resize window content because there would be empty space around system UI.
1676 bool applyInsets = false;
1678 // Zero insets are applied if state is invisible
1685 partState = WindowInsetsPartState::VISIBLE;
1687 int winX = mWindowPositionSize.x;
1688 int winY = mWindowPositionSize.y;
1689 int winW = mWindowPositionSize.width;
1690 int winH = mWindowPositionSize.height;
1692 if((x <= winX) && (x + w >= winX + winW))
1694 if((y <= winY) && (y + h >= winY) && (y + h <= winY + winH))
1699 else if((y + h >= winY + winH) && (y >= winY) && (y <= winY + winH))
1701 bottom = winY + winH - y;
1705 else if((y <= winY) && (y + h >= winY + winH))
1707 if((x <= winX) && (x + w >= winX) && (x + w <= winX + winW))
1709 left = x + w - winX;
1712 else if((x + w >= winX + winW) && (x >= winX) && (x <= winX + winW))
1714 right = winX + winW - x;
1722 mInsetsChangedSignal.Emit(partType, partState, Extents(left, right, top, bottom));
1727 void WindowBaseEcoreWl2::KeymapChanged(void* data, int type, void* event)
1729 Ecore_Wl2_Event_Seat_Keymap_Changed* changed = static_cast<Ecore_Wl2_Event_Seat_Keymap_Changed*>(event);
1730 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::KeymapChanged, keymap id[ %d ]\n", changed->id);
1731 Ecore_Wl2_Input* ecoreWlInput = ecore_wl2_input_default_input_get(changed->display);
1734 mKeyMap = ecore_wl2_input_keymap_get(ecoreWlInput);
1738 void WindowBaseEcoreWl2::OnMoveCompleted(void* event)
1740 Ecore_Wl2_Event_Window_Interactive_Move_Done* movedDoneEvent = static_cast<Ecore_Wl2_Event_Window_Interactive_Move_Done*>(event);
1741 if(movedDoneEvent && movedDoneEvent->win == static_cast<uint32_t>(ecore_wl2_window_id_get(mEcoreWindow)))
1743 Dali::PositionSize orgPositionSize(movedDoneEvent->x, movedDoneEvent->y, movedDoneEvent->w, movedDoneEvent->h);
1744 Dali::PositionSize newPositionSize = RecalculatePositionSizeToCurrentOrientation(orgPositionSize);
1745 Dali::Int32Pair newPosition(newPositionSize.x, newPositionSize.y);
1746 DALI_LOG_RELEASE_INFO("window(%p) has been moved by server[%d, %d]\n", mEcoreWindow, newPositionSize.x, newPositionSize.y);
1747 mMoveCompletedSignal.Emit(newPosition);
1751 void WindowBaseEcoreWl2::OnResizeCompleted(void* event)
1753 Ecore_Wl2_Event_Window_Interactive_Resize_Done* resizedDoneEvent = static_cast<Ecore_Wl2_Event_Window_Interactive_Resize_Done*>(event);
1754 if(resizedDoneEvent && resizedDoneEvent->win == static_cast<uint32_t>(ecore_wl2_window_id_get(mEcoreWindow)))
1756 Dali::PositionSize orgPositionSize(resizedDoneEvent->x, resizedDoneEvent->y, resizedDoneEvent->w, resizedDoneEvent->h);
1757 Dali::PositionSize newPositionSize = RecalculatePositionSizeToCurrentOrientation(orgPositionSize);
1758 Dali::Uint16Pair newSize(newPositionSize.width, newPositionSize.height);
1759 DALI_LOG_RELEASE_INFO("window(%p) has been resized by server[%d, %d]\n", mEcoreWindow, newPositionSize.width, newPositionSize.height);
1760 mResizeCompletedSignal.Emit(newSize);
1764 void WindowBaseEcoreWl2::RegistryGlobalCallback(void* data, struct wl_registry* registry, uint32_t name, const char* interface, uint32_t version)
1766 if(strcmp(interface, tizen_policy_interface.name) == 0)
1768 uint32_t clientVersion = std::min(version, MAX_TIZEN_CLIENT_VERSION);
1770 mTizenPolicy = static_cast<tizen_policy*>(wl_registry_bind(registry, name, &tizen_policy_interface, clientVersion));
1773 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::RegistryGlobalCallback: wl_registry_bind(tizen_policy_interface) is failed.\n");
1777 tizen_policy_add_listener(mTizenPolicy, &tizenPolicyListener, data);
1779 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::RegistryGlobalCallback: tizen_policy_add_listener is called.\n");
1781 else if(strcmp(interface, tizen_display_policy_interface.name) == 0)
1783 mTizenDisplayPolicy = static_cast<tizen_display_policy*>(wl_registry_bind(registry, name, &tizen_display_policy_interface, version));
1784 if(!mTizenDisplayPolicy)
1786 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::RegistryGlobalCallback: wl_registry_bind(tizen_display_policy_interface) is failed.\n");
1790 tizen_display_policy_add_listener(mTizenDisplayPolicy, &tizenDisplayPolicyListener, data);
1792 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::RegistryGlobalCallback: tizen_display_policy_add_listener is called.\n");
1796 void WindowBaseEcoreWl2::RegistryGlobalCallbackRemove(void* data, struct wl_registry* registry, uint32_t id)
1798 mTizenPolicy = NULL;
1799 mTizenDisplayPolicy = NULL;
1802 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)
1804 int originalX, originalY, originalWidth, originalHeight;
1805 bool changed = false;
1809 DALI_LOG_ERROR("Failed to get wayland surface in WindowBaseEcoreWl2::TizenPolicyConformantArea()\n");
1813 if(conformantPart == TIZEN_POLICY_CONFORMANT_PART_INDICATOR)
1815 ecore_wl2_window_indicator_geometry_get(mEcoreWindow, &originalX, &originalY, &originalWidth, &originalHeight);
1816 if((originalX != x) || (originalY != y) || (originalWidth != w) || (originalHeight != h))
1818 ecore_wl2_window_indicator_geometry_set(mEcoreWindow, x, y, w, h);
1823 * The given state is based on the visibility value of indicator.
1824 * Thus we need to add 1 to it before comparing with indicator state.
1826 Ecore_Wl2_Indicator_State indState = ecore_wl2_window_indicator_state_get(mEcoreWindow);
1827 if((state + 1) != indState)
1829 ecore_wl2_window_indicator_state_set(mEcoreWindow, static_cast<Ecore_Wl2_Indicator_State>(state + 1));
1833 else if(conformantPart == TIZEN_POLICY_CONFORMANT_PART_KEYBOARD)
1835 ecore_wl2_window_keyboard_geometry_get(mEcoreWindow, &originalX, &originalY, &originalWidth, &originalHeight);
1836 if((originalX != x) || (originalY != y) || (originalWidth != w) || (originalHeight != h))
1838 ecore_wl2_window_keyboard_geometry_set(mEcoreWindow, x, y, w, h);
1843 * The given state is based on the visibility value of virtual keyboard window.
1844 * Thus we need to add 1 to it before comparing with keyboard state.
1846 Ecore_Wl2_Virtual_Keyboard_State kbdState = ecore_wl2_window_keyboard_state_get(mEcoreWindow);
1847 if((state + 1) != (kbdState))
1849 ecore_wl2_window_keyboard_state_set(mEcoreWindow, static_cast<Ecore_Wl2_Virtual_Keyboard_State>(state + 1));
1853 else if(conformantPart == TIZEN_POLICY_CONFORMANT_PART_CLIPBOARD)
1855 ecore_wl2_window_clipboard_geometry_get(mEcoreWindow, &originalX, &originalY, &originalWidth, &originalHeight);
1856 if((originalX != x) || (originalY != y) || (originalWidth != w) || (originalHeight != h))
1858 ecore_wl2_window_clipboard_geometry_set(mEcoreWindow, x, y, w, h);
1863 * The given state is based on the visibility value of clipboard window.
1864 * Thus we need to add 1 to it before comparing with clipboard state.
1866 Ecore_Wl2_Clipboard_State clipState = ecore_wl2_window_clipboard_state_get(mEcoreWindow);
1867 if((state + 1) != clipState)
1869 ecore_wl2_window_clipboard_state_set(mEcoreWindow, static_cast<Ecore_Wl2_Clipboard_State>(state + 1));
1876 Ecore_Wl2_Event_Conformant_Change* ev = static_cast<Ecore_Wl2_Event_Conformant_Change*>(calloc(1, sizeof(Ecore_Wl2_Event_Conformant_Change)));
1882 ev->win = GetNativeWindowId();
1883 ev->part_type = static_cast<Ecore_Wl2_Conformant_Part_Type>(conformantPart);
1885 ecore_event_add(ECORE_WL2_EVENT_CONFORMANT_CHANGE, ev, NULL, NULL);
1888 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);
1891 void WindowBaseEcoreWl2::TizenPolicyNotificationChangeDone(void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, int32_t level, uint32_t state)
1893 mNotificationLevel = level;
1894 mNotificationChangeState = state;
1895 mNotificationLevelChangeDone = true;
1897 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::TizenPolicyNotificationChangeDone: level = %d, state = %d\n", level, state);
1900 void WindowBaseEcoreWl2::TizenPolicyScreenModeChangeDone(void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, uint32_t mode, uint32_t state)
1902 mScreenOffMode = mode;
1903 mScreenOffModeChangeState = state;
1904 mScreenOffModeChangeDone = true;
1906 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::TizenPolicyScreenModeChangeDone: mode = %d, state = %d\n", mode, state);
1909 void WindowBaseEcoreWl2::DisplayPolicyBrightnessChangeDone(void* data, struct tizen_display_policy* displayPolicy, struct wl_surface* surface, int32_t brightness, uint32_t state)
1911 mBrightness = brightness;
1912 mBrightnessChangeState = state;
1913 mBrightnessChangeDone = true;
1915 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::DisplayPolicyBrightnessChangeDone: brightness = %d, state = %d\n", brightness, state);
1918 void WindowBaseEcoreWl2::GetKeyCode(std::string keyName, int32_t& keyCode)
1920 xkb_keysym_t sym = XKB_KEY_NoSymbol;
1921 KeyCodeMap foundKeyCode;
1923 sym = xkb_keysym_from_name(keyName.c_str(), XKB_KEYSYM_NO_FLAGS);
1924 if(sym == XKB_KEY_NoSymbol || !mKeyMap)
1926 DALI_LOG_ERROR("Failed to get keysym or keymap in WindowBaseEcoreWl2\n");
1930 foundKeyCode.keySym = sym;
1931 foundKeyCode.isKeyCode = false;
1932 xkb_keymap_key_for_each(mKeyMap, FindKeyCode, &foundKeyCode);
1933 keyCode = static_cast<int32_t>(foundKeyCode.keyCode);
1936 Any WindowBaseEcoreWl2::GetNativeWindow()
1938 return mEcoreWindow;
1941 int WindowBaseEcoreWl2::GetNativeWindowId()
1943 return ecore_wl2_window_id_get(mEcoreWindow);
1946 std::string WindowBaseEcoreWl2::GetNativeWindowResourceId()
1948 #ifdef OVER_TIZEN_VERSION_7
1949 return std::to_string(ecore_wl2_window_resource_id_get(mEcoreWindow));
1951 return std::string();
1955 EGLNativeWindowType WindowBaseEcoreWl2::CreateEglWindow(int width, int height)
1957 int totalAngle = (mWindowRotationAngle + mScreenRotationAngle) % 360;
1959 START_DURATION_CHECK();
1960 if(totalAngle == 90 || totalAngle == 270)
1962 mEglWindow = wl_egl_window_create(mWlSurface, height, width);
1966 mEglWindow = wl_egl_window_create(mWlSurface, width, height);
1968 FINISH_DURATION_CHECK("wl_egl_window_create");
1970 return static_cast<EGLNativeWindowType>(mEglWindow);
1973 void WindowBaseEcoreWl2::DestroyEglWindow()
1975 if(mEglWindow != NULL)
1977 START_DURATION_CHECK();
1978 wl_egl_window_destroy(mEglWindow);
1979 FINISH_DURATION_CHECK("wl_egl_window_destroy");
1985 void WindowBaseEcoreWl2::SetEglWindowRotation(int angle)
1987 wl_egl_window_tizen_rotation rotation;
1993 rotation = WL_EGL_WINDOW_TIZEN_ROTATION_0;
1998 rotation = WL_EGL_WINDOW_TIZEN_ROTATION_270;
2003 rotation = WL_EGL_WINDOW_TIZEN_ROTATION_180;
2008 rotation = WL_EGL_WINDOW_TIZEN_ROTATION_90;
2013 rotation = WL_EGL_WINDOW_TIZEN_ROTATION_0;
2018 START_DURATION_CHECK();
2019 wl_egl_window_tizen_set_rotation(mEglWindow, rotation);
2020 FINISH_DURATION_CHECK("wl_egl_window_tizen_set_rotation");
2023 void WindowBaseEcoreWl2::SetEglWindowBufferTransform(int angle)
2025 wl_output_transform bufferTransform;
2031 bufferTransform = WL_OUTPUT_TRANSFORM_NORMAL;
2036 bufferTransform = WL_OUTPUT_TRANSFORM_90;
2041 bufferTransform = WL_OUTPUT_TRANSFORM_180;
2046 bufferTransform = WL_OUTPUT_TRANSFORM_270;
2051 bufferTransform = WL_OUTPUT_TRANSFORM_NORMAL;
2056 DALI_LOG_RELEASE_INFO("wl_egl_window_tizen_set_buffer_transform() with buffer Transform [%d]\n", bufferTransform);
2057 START_DURATION_CHECK();
2058 wl_egl_window_tizen_set_buffer_transform(mEglWindow, bufferTransform);
2059 FINISH_DURATION_CHECK("wl_egl_window_tizen_set_buffer_transform");
2062 void WindowBaseEcoreWl2::SetEglWindowTransform(int angle)
2064 wl_output_transform windowTransform;
2070 windowTransform = WL_OUTPUT_TRANSFORM_NORMAL;
2075 windowTransform = WL_OUTPUT_TRANSFORM_90;
2080 windowTransform = WL_OUTPUT_TRANSFORM_180;
2085 windowTransform = WL_OUTPUT_TRANSFORM_270;
2090 windowTransform = WL_OUTPUT_TRANSFORM_NORMAL;
2095 DALI_LOG_RELEASE_INFO("wl_egl_window_tizen_set_window_transform() with window Transform [%d]\n", windowTransform);
2096 START_DURATION_CHECK();
2097 wl_egl_window_tizen_set_window_transform(mEglWindow, windowTransform);
2098 FINISH_DURATION_CHECK("wl_egl_window_tizen_set_window_transform");
2101 void WindowBaseEcoreWl2::ResizeEglWindow(PositionSize positionSize)
2103 DALI_LOG_RELEASE_INFO("wl_egl_window_resize(), (%d, %d) [%d x %d]\n", positionSize.x, positionSize.y, positionSize.width, positionSize.height);
2104 START_DURATION_CHECK();
2105 wl_egl_window_resize(mEglWindow, positionSize.width, positionSize.height, positionSize.x, positionSize.y);
2107 // Note: Both "Resize" and "MoveResize" cases can reach here, but only "MoveResize" needs to submit serial number
2108 if(mMoveResizeSerial != mLastSubmittedMoveResizeSerial)
2110 wl_egl_window_tizen_set_window_serial(mEglWindow, mMoveResizeSerial);
2111 mLastSubmittedMoveResizeSerial = mMoveResizeSerial;
2113 FINISH_DURATION_CHECK("wl_egl_window functions");
2116 bool WindowBaseEcoreWl2::IsEglWindowRotationSupported()
2118 START_DURATION_CHECK();
2120 wl_egl_window_tizen_capability capability = static_cast<wl_egl_window_tizen_capability>(wl_egl_window_tizen_get_capabilities(mEglWindow));
2121 FINISH_DURATION_CHECK("wl_egl_window_tizen_get_capabilities");
2123 if(capability == WL_EGL_WINDOW_TIZEN_CAPABILITY_ROTATION_SUPPORTED)
2125 mSupportedPreProtation = true;
2128 mSupportedPreProtation = false;
2132 PositionSize WindowBaseEcoreWl2::RecalculatePositionSizeToSystem(PositionSize positionSize)
2134 PositionSize newPositionSize;
2135 int32_t screenWidth, screenHeight;
2136 WindowSystem::GetScreenSize(screenWidth, screenHeight);
2138 if(mWindowRotationAngle == 90)
2140 newPositionSize.x = positionSize.y;
2141 newPositionSize.y = screenHeight - (positionSize.x + positionSize.width);
2142 newPositionSize.width = positionSize.height;
2143 newPositionSize.height = positionSize.width;
2145 else if(mWindowRotationAngle == 180)
2147 newPositionSize.x = screenWidth - (positionSize.x + positionSize.width);
2148 newPositionSize.y = screenHeight - (positionSize.y + positionSize.height);
2149 newPositionSize.width = positionSize.width;
2150 newPositionSize.height = positionSize.height;
2152 else if(mWindowRotationAngle == 270)
2154 newPositionSize.x = screenWidth - (positionSize.y + positionSize.height);
2155 newPositionSize.y = positionSize.x;
2156 newPositionSize.width = positionSize.height;
2157 newPositionSize.height = positionSize.width;
2161 newPositionSize.x = positionSize.x;
2162 newPositionSize.y = positionSize.y;
2163 newPositionSize.width = positionSize.width;
2164 newPositionSize.height = positionSize.height;
2167 return newPositionSize;
2170 PositionSize WindowBaseEcoreWl2::RecalculatePositionSizeToCurrentOrientation(PositionSize positionSize)
2172 PositionSize newPositionSize;
2173 int32_t screenWidth, screenHeight;
2174 WindowSystem::GetScreenSize(screenWidth, screenHeight);
2176 if(mWindowRotationAngle == 90)
2178 newPositionSize.x = screenHeight - (positionSize.y + positionSize.height);
2179 newPositionSize.y = positionSize.x;
2180 newPositionSize.width = positionSize.height;
2181 newPositionSize.height = positionSize.width;
2183 else if(mWindowRotationAngle == 180)
2185 newPositionSize.x = screenWidth - (positionSize.x + positionSize.width);
2186 newPositionSize.y = screenHeight - (positionSize.y + positionSize.height);
2187 newPositionSize.width = positionSize.width;
2188 newPositionSize.height = positionSize.height;
2190 else if(mWindowRotationAngle == 270)
2192 newPositionSize.x = positionSize.y;
2193 newPositionSize.y = screenWidth - (positionSize.x + positionSize.width);
2194 newPositionSize.width = positionSize.height;
2195 newPositionSize.height = positionSize.width;
2199 newPositionSize.x = positionSize.x;
2200 newPositionSize.y = positionSize.y;
2201 newPositionSize.width = positionSize.width;
2202 newPositionSize.height = positionSize.height;
2205 return newPositionSize;
2208 void WindowBaseEcoreWl2::Move(PositionSize positionSize)
2210 PositionSize newPositionSize = RecalculatePositionSizeToSystem(positionSize);
2212 mWindowPositionSize = newPositionSize;
2213 DALI_LOG_RELEASE_INFO("ecore_wl2_window_position_set x[%d], y[%d]\n", newPositionSize.x, newPositionSize.y);
2214 START_DURATION_CHECK();
2215 ecore_wl2_window_position_set(mEcoreWindow, newPositionSize.x, newPositionSize.y);
2216 FINISH_DURATION_CHECK("ecore_wl2_window_position_set");
2219 void WindowBaseEcoreWl2::Resize(PositionSize positionSize)
2221 PositionSize newPositionSize = RecalculatePositionSizeToSystem(positionSize);
2223 mWindowPositionSize = newPositionSize;
2224 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);
2225 START_DURATION_CHECK();
2226 ecore_wl2_window_sync_geometry_set(mEcoreWindow, ++mMoveResizeSerial, newPositionSize.x, newPositionSize.y, newPositionSize.width, newPositionSize.height);
2227 FINISH_DURATION_CHECK("ecore_wl2_window_sync_geometry_set");
2230 void WindowBaseEcoreWl2::MoveResize(PositionSize positionSize)
2232 PositionSize newPositionSize = RecalculatePositionSizeToSystem(positionSize);
2234 mWindowPositionSize = newPositionSize;
2235 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);
2236 START_DURATION_CHECK();
2237 ecore_wl2_window_sync_geometry_set(mEcoreWindow, ++mMoveResizeSerial, newPositionSize.x, newPositionSize.y, newPositionSize.width, newPositionSize.height);
2238 FINISH_DURATION_CHECK("ecore_wl2_window_sync_geometry_set");
2241 void WindowBaseEcoreWl2::SetLayout(unsigned int numCols, unsigned int numRows, unsigned int column, unsigned int row, unsigned int colSpan, unsigned int rowSpan)
2243 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);
2244 START_DURATION_CHECK();
2245 ecore_wl2_window_layout_set(mEcoreWindow, numCols, numRows, column, row, colSpan, rowSpan);
2246 FINISH_DURATION_CHECK("ecore_wl2_window_layout_set");
2249 void WindowBaseEcoreWl2::SetClass(const std::string& name, const std::string& className)
2251 ecore_wl2_window_title_set(mEcoreWindow, name.c_str());
2252 ecore_wl2_window_class_set(mEcoreWindow, className.c_str());
2255 void WindowBaseEcoreWl2::Raise()
2257 START_DURATION_CHECK();
2258 // Use ecore_wl2_window_activate to prevent the window shown without rendering
2259 ecore_wl2_window_activate(mEcoreWindow);
2260 FINISH_DURATION_CHECK("ecore_wl2_window_activate");
2263 void WindowBaseEcoreWl2::Lower()
2265 START_DURATION_CHECK();
2266 ecore_wl2_window_lower(mEcoreWindow);
2267 FINISH_DURATION_CHECK("ecore_wl2_window_lower");
2270 void WindowBaseEcoreWl2::Activate()
2272 START_DURATION_CHECK();
2273 ecore_wl2_window_activate(mEcoreWindow);
2274 FINISH_DURATION_CHECK("ecore_wl2_window_activate");
2277 void WindowBaseEcoreWl2::Maximize(bool maximize)
2279 START_DURATION_CHECK();
2280 ecore_wl2_window_maximized_set(mEcoreWindow, maximize);
2281 FINISH_DURATION_CHECK("ecore_wl2_window_maximized_set");
2284 bool WindowBaseEcoreWl2::IsMaximized() const
2286 return ecore_wl2_window_maximized_get(mEcoreWindow);
2289 void WindowBaseEcoreWl2::SetMaximumSize(Dali::Window::WindowSize size)
2291 DALI_LOG_RELEASE_INFO("ecore_wl2_window_maximum_size_set, width: %d, height: %d\n", size.GetWidth(), size.GetHeight());
2292 START_DURATION_CHECK();
2293 ecore_wl2_window_maximum_size_set(mEcoreWindow, size.GetWidth(), size.GetHeight());
2294 FINISH_DURATION_CHECK("ecore_wl2_window_maximum_size_set");
2295 ecore_wl2_window_commit(mEcoreWindow, EINA_TRUE);
2298 void WindowBaseEcoreWl2::Minimize(bool minimize)
2300 START_DURATION_CHECK();
2301 ecore_wl2_window_iconified_set(mEcoreWindow, minimize);
2302 FINISH_DURATION_CHECK("ecore_wl2_window_iconified_set");
2305 bool WindowBaseEcoreWl2::IsMinimized() const
2307 return ecore_wl2_window_iconified_get(mEcoreWindow);
2310 void WindowBaseEcoreWl2::SetMimimumSize(Dali::Window::WindowSize size)
2312 DALI_LOG_RELEASE_INFO("ecore_wl2_window_minimum_size_set, width: %d, height: %d\n", size.GetWidth(), size.GetHeight());
2313 START_DURATION_CHECK();
2314 ecore_wl2_window_minimum_size_set(mEcoreWindow, size.GetWidth(), size.GetHeight());
2315 FINISH_DURATION_CHECK("ecore_wl2_window_minimum_size_set");
2316 ecore_wl2_window_commit(mEcoreWindow, EINA_TRUE);
2319 void WindowBaseEcoreWl2::SetAvailableAnlges(const std::vector<int>& angles)
2321 int rotations[4] = {0};
2322 DALI_LOG_RELEASE_INFO("WindowBaseEcoreWl2::SetAvailableAnlges, angle's count: %d, angles\n", angles.size());
2323 for(std::size_t i = 0; i < angles.size(); ++i)
2325 rotations[i] = static_cast<int>(angles[i]);
2326 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "%d ", rotations[i]);
2329 START_DURATION_CHECK();
2330 ecore_wl2_window_available_rotations_set(mEcoreWindow, rotations, angles.size());
2331 FINISH_DURATION_CHECK("ecore_wl2_window_available_rotations_set");
2334 void WindowBaseEcoreWl2::SetPreferredAngle(int angle)
2336 DALI_LOG_RELEASE_INFO("WindowBaseEcoreWl2::SetPreferredAngle, angle: %d\n", angle);
2337 START_DURATION_CHECK();
2338 ecore_wl2_window_preferred_rotation_set(mEcoreWindow, angle);
2339 FINISH_DURATION_CHECK("ecore_wl2_window_preferred_rotation_set");
2342 void WindowBaseEcoreWl2::SetAcceptFocus(bool accept)
2344 START_DURATION_CHECK();
2345 ecore_wl2_window_focus_skip_set(mEcoreWindow, !accept);
2346 FINISH_DURATION_CHECK("ecore_wl2_window_focus_skip_set");
2349 void WindowBaseEcoreWl2::Show()
2353 START_DURATION_CHECK();
2354 ecore_wl2_window_geometry_set(mEcoreWindow, mWindowPositionSize.x, mWindowPositionSize.y, mWindowPositionSize.width, mWindowPositionSize.height);
2355 FINISH_DURATION_CHECK("ecore_wl2_window_geometry_set");
2359 ecore_wl2_window_show(mEcoreWindow);
2362 void WindowBaseEcoreWl2::Hide()
2365 ecore_wl2_window_hide(mEcoreWindow);
2368 unsigned int WindowBaseEcoreWl2::GetSupportedAuxiliaryHintCount() const
2370 return mSupportedAuxiliaryHints.size();
2373 std::string WindowBaseEcoreWl2::GetSupportedAuxiliaryHint(unsigned int index) const
2375 if(index >= GetSupportedAuxiliaryHintCount())
2377 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetSupportedAuxiliaryHint: Invalid index! [%d]\n", index);
2380 return mSupportedAuxiliaryHints[index];
2383 unsigned int WindowBaseEcoreWl2::AddAuxiliaryHint(const std::string& hint, const std::string& value)
2385 bool supported = false;
2387 // Check if the hint is suppported
2388 for(std::vector<std::string>::iterator iter = mSupportedAuxiliaryHints.begin(); iter != mSupportedAuxiliaryHints.end(); ++iter)
2399 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Concise, "WindowBaseEcoreWl2::AddAuxiliaryHint: Not supported auxiliary hint [%s]\n", hint.c_str());
2403 // Check if the hint is already added
2404 for(unsigned int i = 0; i < mAuxiliaryHints.size(); i++)
2406 if(mAuxiliaryHints[i].first == hint)
2408 // Just change the value
2409 mAuxiliaryHints[i].second = value;
2411 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::AddAuxiliaryHint: Change! hint = %s, value = %s, id = %d\n", hint.c_str(), value.c_str(), i + 1);
2413 return i + 1; // id is index + 1
2418 mAuxiliaryHints.push_back(std::pair<std::string, std::string>(hint, value));
2420 unsigned int id = mAuxiliaryHints.size();
2422 START_DURATION_CHECK();
2423 ecore_wl2_window_aux_hint_add(mEcoreWindow, static_cast<int>(id), hint.c_str(), value.c_str());
2424 FINISH_DURATION_CHECK("ecore_wl2_window_aux_hint_add");
2426 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::AddAuxiliaryHint: hint = %s, value = %s, id = %d\n", hint.c_str(), value.c_str(), id);
2431 bool WindowBaseEcoreWl2::RemoveAuxiliaryHint(unsigned int id)
2433 if(id == 0 || id > mAuxiliaryHints.size())
2435 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Concise, "WindowBaseEcoreWl2::RemoveAuxiliaryHint: Invalid id [%d]\n", id);
2439 mAuxiliaryHints[id - 1].second = std::string();
2441 START_DURATION_CHECK();
2442 ecore_wl2_window_aux_hint_del(mEcoreWindow, static_cast<int>(id));
2443 FINISH_DURATION_CHECK("ecore_wl2_window_aux_hint_del");
2445 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::RemoveAuxiliaryHint: id = %d, hint = %s\n", id, mAuxiliaryHints[id - 1].first.c_str());
2450 bool WindowBaseEcoreWl2::SetAuxiliaryHintValue(unsigned int id, const std::string& value)
2452 if(id == 0 || id > mAuxiliaryHints.size())
2454 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Concise, "WindowBaseEcoreWl2::SetAuxiliaryHintValue: Invalid id [%d]\n", id);
2458 mAuxiliaryHints[id - 1].second = value;
2460 START_DURATION_CHECK();
2461 ecore_wl2_window_aux_hint_change(mEcoreWindow, static_cast<int>(id), value.c_str());
2462 FINISH_DURATION_CHECK("ecore_wl2_window_aux_hint_change");
2464 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());
2469 std::string WindowBaseEcoreWl2::GetAuxiliaryHintValue(unsigned int id) const
2471 if(id == 0 || id > mAuxiliaryHints.size())
2473 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Concise, "WindowBaseEcoreWl2::GetAuxiliaryHintValue: Invalid id [%d]\n", id);
2474 return std::string();
2477 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());
2479 return mAuxiliaryHints[id - 1].second;
2482 unsigned int WindowBaseEcoreWl2::GetAuxiliaryHintId(const std::string& hint) const
2484 for(unsigned int i = 0; i < mAuxiliaryHints.size(); i++)
2486 if(mAuxiliaryHints[i].first == hint)
2488 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetAuxiliaryHintId: hint = %s, id = %d\n", hint.c_str(), i + 1);
2493 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetAuxiliaryHintId: Invalid hint! [%s]\n", hint.c_str());
2498 void WindowBaseEcoreWl2::SetInputRegion(const Rect<int>& inputRegion)
2500 Rect<int> convertRegion = RecalculatePositionSizeToSystem(inputRegion);
2502 Eina_Rectangle rect;
2503 rect.x = convertRegion.x;
2504 rect.y = convertRegion.y;
2505 rect.w = convertRegion.width;
2506 rect.h = convertRegion.height;
2508 DALI_LOG_RELEASE_INFO("%p, Set input rect (%d, %d, %d x %d)\n", mEcoreWindow, rect.x, rect.y, rect.w, rect.h);
2509 START_DURATION_CHECK();
2510 ecore_wl2_window_input_rect_set(mEcoreWindow, &rect);
2511 FINISH_DURATION_CHECK("ecore_wl2_window_input_rect_set");
2512 ecore_wl2_window_commit(mEcoreWindow, EINA_TRUE);
2515 void WindowBaseEcoreWl2::SetType(Dali::WindowType type)
2520 Ecore_Wl2_Window_Type windowType;
2524 case Dali::WindowType::NORMAL:
2526 windowType = ECORE_WL2_WINDOW_TYPE_TOPLEVEL;
2529 case Dali::WindowType::NOTIFICATION:
2531 windowType = ECORE_WL2_WINDOW_TYPE_NOTIFICATION;
2534 case Dali::WindowType::UTILITY:
2536 windowType = ECORE_WL2_WINDOW_TYPE_UTILITY;
2539 case Dali::WindowType::DIALOG:
2541 windowType = ECORE_WL2_WINDOW_TYPE_DIALOG;
2544 case Dali::WindowType::IME:
2546 windowType = ECORE_WL2_WINDOW_TYPE_NONE;
2549 case Dali::WindowType::DESKTOP:
2551 windowType = ECORE_WL2_WINDOW_TYPE_DESKTOP;
2556 windowType = ECORE_WL2_WINDOW_TYPE_TOPLEVEL;
2561 START_DURATION_CHECK();
2562 ecore_wl2_window_type_set(mEcoreWindow, windowType);
2563 FINISH_DURATION_CHECK("ecore_wl2_window_type_set");
2567 Dali::WindowType WindowBaseEcoreWl2::GetType() const
2572 Dali::WindowOperationResult WindowBaseEcoreWl2::SetNotificationLevel(Dali::WindowNotificationLevel level)
2574 START_DURATION_CHECK();
2575 while(!mTizenPolicy)
2577 wl_display_dispatch_queue(mDisplay, mEventQueue);
2580 int notificationLevel;
2584 case Dali::WindowNotificationLevel::NONE:
2586 notificationLevel = TIZEN_POLICY_LEVEL_NONE;
2589 case Dali::WindowNotificationLevel::BASE:
2591 notificationLevel = TIZEN_POLICY_LEVEL_DEFAULT;
2594 case Dali::WindowNotificationLevel::MEDIUM:
2596 notificationLevel = TIZEN_POLICY_LEVEL_MEDIUM;
2599 case Dali::WindowNotificationLevel::HIGH:
2601 notificationLevel = TIZEN_POLICY_LEVEL_HIGH;
2604 case Dali::WindowNotificationLevel::TOP:
2606 notificationLevel = TIZEN_POLICY_LEVEL_TOP;
2611 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetNotificationLevel: invalid level [%d]\n", level);
2612 notificationLevel = TIZEN_POLICY_LEVEL_DEFAULT;
2617 mNotificationLevelChangeDone = false;
2618 mNotificationChangeState = TIZEN_POLICY_ERROR_STATE_NONE;
2620 tizen_policy_set_notification_level(mTizenPolicy, ecore_wl2_window_surface_get(mEcoreWindow), notificationLevel);
2624 while(!mNotificationLevelChangeDone && count < 3)
2626 ecore_wl2_display_flush(ecore_wl2_connected_display_get(NULL));
2627 wl_display_dispatch_queue(mDisplay, mEventQueue);
2630 FINISH_DURATION_CHECK("ecore_wl2 & wl_display");
2632 if(!mNotificationLevelChangeDone)
2634 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetNotificationLevel: Level change is failed [%d, %d]\n", level, mNotificationChangeState);
2635 return Dali::WindowOperationResult::UNKNOWN_ERROR;
2637 else if(mNotificationChangeState == TIZEN_POLICY_ERROR_STATE_PERMISSION_DENIED)
2639 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetNotificationLevel: Permission denied! [%d]\n", level);
2640 return Dali::WindowOperationResult::PERMISSION_DENIED;
2643 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetNotificationLevel: Level is changed [%d]\n", mNotificationLevel);
2645 return Dali::WindowOperationResult::SUCCEED;
2648 Dali::WindowNotificationLevel WindowBaseEcoreWl2::GetNotificationLevel() const
2650 while(!mTizenPolicy)
2652 wl_display_dispatch_queue(mDisplay, mEventQueue);
2657 while(!mNotificationLevelChangeDone && count < 3)
2659 ecore_wl2_display_flush(ecore_wl2_connected_display_get(NULL));
2660 wl_display_dispatch_queue(mDisplay, mEventQueue);
2664 if(!mNotificationLevelChangeDone)
2666 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetNotificationLevel: Error! [%d]\n", mNotificationChangeState);
2667 return Dali::WindowNotificationLevel::NONE;
2670 Dali::WindowNotificationLevel level;
2672 switch(mNotificationLevel)
2674 case TIZEN_POLICY_LEVEL_NONE:
2676 level = Dali::WindowNotificationLevel::NONE;
2679 case TIZEN_POLICY_LEVEL_DEFAULT:
2681 level = Dali::WindowNotificationLevel::BASE;
2684 case TIZEN_POLICY_LEVEL_MEDIUM:
2686 level = Dali::WindowNotificationLevel::MEDIUM;
2689 case TIZEN_POLICY_LEVEL_HIGH:
2691 level = Dali::WindowNotificationLevel::HIGH;
2694 case TIZEN_POLICY_LEVEL_TOP:
2696 level = Dali::WindowNotificationLevel::TOP;
2701 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetNotificationLevel: invalid level [%d]\n", mNotificationLevel);
2702 level = Dali::WindowNotificationLevel::NONE;
2707 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetNotificationLevel: level [%d]\n", mNotificationLevel);
2712 void WindowBaseEcoreWl2::SetOpaqueState(bool opaque)
2714 while(!mTizenPolicy)
2716 wl_display_dispatch_queue(mDisplay, mEventQueue);
2719 tizen_policy_set_opaque_state(mTizenPolicy, ecore_wl2_window_surface_get(mEcoreWindow), (opaque ? 1 : 0));
2722 Dali::WindowOperationResult WindowBaseEcoreWl2::SetScreenOffMode(WindowScreenOffMode screenOffMode)
2724 while(!mTizenPolicy)
2726 wl_display_dispatch_queue(mDisplay, mEventQueue);
2729 mScreenOffModeChangeDone = false;
2730 mScreenOffModeChangeState = TIZEN_POLICY_ERROR_STATE_NONE;
2732 unsigned int mode = 0;
2734 switch(screenOffMode)
2736 case WindowScreenOffMode::TIMEOUT:
2741 case WindowScreenOffMode::NEVER:
2748 tizen_policy_set_window_screen_mode(mTizenPolicy, ecore_wl2_window_surface_get(mEcoreWindow), mode);
2752 while(!mScreenOffModeChangeDone && count < 3)
2754 ecore_wl2_display_flush(ecore_wl2_connected_display_get(NULL));
2755 wl_display_dispatch_queue(mDisplay, mEventQueue);
2759 if(!mScreenOffModeChangeDone)
2761 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetScreenOffMode: Screen mode change is failed [%d, %d]\n", screenOffMode, mScreenOffModeChangeState);
2762 return Dali::WindowOperationResult::UNKNOWN_ERROR;
2764 else if(mScreenOffModeChangeState == TIZEN_POLICY_ERROR_STATE_PERMISSION_DENIED)
2766 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetScreenOffMode: Permission denied! [%d]\n", screenOffMode);
2767 return Dali::WindowOperationResult::PERMISSION_DENIED;
2770 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetScreenOffMode: Screen mode is changed [%d]\n", mScreenOffMode);
2772 return Dali::WindowOperationResult::SUCCEED;
2775 WindowScreenOffMode WindowBaseEcoreWl2::GetScreenOffMode() const
2777 while(!mTizenPolicy)
2779 wl_display_dispatch_queue(mDisplay, mEventQueue);
2784 while(!mScreenOffModeChangeDone && count < 3)
2786 ecore_wl2_display_flush(ecore_wl2_connected_display_get(NULL));
2787 wl_display_dispatch_queue(mDisplay, mEventQueue);
2791 if(!mScreenOffModeChangeDone)
2793 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetScreenOffMode: Error! [%d]\n", mScreenOffModeChangeState);
2794 return WindowScreenOffMode::TIMEOUT;
2797 WindowScreenOffMode screenMode = WindowScreenOffMode::TIMEOUT;
2799 switch(mScreenOffMode)
2803 screenMode = WindowScreenOffMode::TIMEOUT;
2808 screenMode = WindowScreenOffMode::NEVER;
2813 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetScreenOffMode: screen mode [%d]\n", mScreenOffMode);
2818 Dali::WindowOperationResult WindowBaseEcoreWl2::SetBrightness(int brightness)
2820 START_DURATION_CHECK();
2821 while(!mTizenDisplayPolicy)
2823 wl_display_dispatch_queue(mDisplay, mEventQueue);
2826 mBrightnessChangeDone = false;
2827 mBrightnessChangeState = TIZEN_POLICY_ERROR_STATE_NONE;
2829 tizen_display_policy_set_window_brightness(mTizenDisplayPolicy, ecore_wl2_window_surface_get(mEcoreWindow), brightness);
2833 while(!mBrightnessChangeDone && count < 3)
2835 ecore_wl2_display_flush(ecore_wl2_connected_display_get(NULL));
2836 wl_display_dispatch_queue(mDisplay, mEventQueue);
2839 FINISH_DURATION_CHECK("ecore_wl2_display_flush");
2841 if(!mBrightnessChangeDone)
2843 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetBrightness: Brightness change is failed [%d, %d]\n", brightness, mBrightnessChangeState);
2844 return Dali::WindowOperationResult::UNKNOWN_ERROR;
2846 else if(mBrightnessChangeState == TIZEN_POLICY_ERROR_STATE_PERMISSION_DENIED)
2848 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetBrightness: Permission denied! [%d]\n", brightness);
2849 return Dali::WindowOperationResult::PERMISSION_DENIED;
2852 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetBrightness: Brightness is changed [%d]\n", mBrightness);
2854 return Dali::WindowOperationResult::SUCCEED;
2857 int WindowBaseEcoreWl2::GetBrightness() const
2859 START_DURATION_CHECK();
2860 while(!mTizenDisplayPolicy)
2862 wl_display_dispatch_queue(mDisplay, mEventQueue);
2867 while(!mBrightnessChangeDone && count < 3)
2869 ecore_wl2_display_flush(ecore_wl2_connected_display_get(NULL));
2870 wl_display_dispatch_queue(mDisplay, mEventQueue);
2873 FINISH_DURATION_CHECK("ecore_wl2_display_flush");
2875 if(!mBrightnessChangeDone)
2877 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetBrightness: Error! [%d]\n", mBrightnessChangeState);
2881 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetBrightness: Brightness [%d]\n", mBrightness);
2886 bool WindowBaseEcoreWl2::GrabKey(Dali::KEY key, KeyGrab::KeyGrabMode grabMode)
2888 Ecore_Wl2_Window_Keygrab_Mode mode;
2892 case KeyGrab::TOPMOST:
2894 mode = ECORE_WL2_WINDOW_KEYGRAB_TOPMOST;
2897 case KeyGrab::SHARED:
2899 mode = ECORE_WL2_WINDOW_KEYGRAB_SHARED;
2902 case KeyGrab::OVERRIDE_EXCLUSIVE:
2904 mode = ECORE_WL2_WINDOW_KEYGRAB_OVERRIDE_EXCLUSIVE;
2907 case KeyGrab::EXCLUSIVE:
2909 mode = ECORE_WL2_WINDOW_KEYGRAB_EXCLUSIVE;
2918 return ecore_wl2_window_keygrab_set(mEcoreWindow, KeyLookup::GetKeyName(key), 0, 0, 0, mode);
2921 bool WindowBaseEcoreWl2::UngrabKey(Dali::KEY key)
2923 return ecore_wl2_window_keygrab_unset(mEcoreWindow, KeyLookup::GetKeyName(key), 0, 0);
2926 bool WindowBaseEcoreWl2::GrabKeyList(const Dali::Vector<Dali::KEY>& key, const Dali::Vector<KeyGrab::KeyGrabMode>& grabMode, Dali::Vector<bool>& result)
2928 int keyCount = key.Count();
2929 int keyGrabModeCount = grabMode.Count();
2931 if(keyCount != keyGrabModeCount || keyCount == 0)
2938 Eina_List* keyList = NULL;
2939 Ecore_Wl2_Window_Keygrab_Info* info = new Ecore_Wl2_Window_Keygrab_Info[keyCount];
2941 for(int index = 0; index < keyCount; ++index)
2943 info[index].key = const_cast<char*>(KeyLookup::GetKeyName(key[index]));
2945 switch(grabMode[index])
2947 case KeyGrab::TOPMOST:
2949 info[index].mode = ECORE_WL2_WINDOW_KEYGRAB_TOPMOST;
2952 case KeyGrab::SHARED:
2954 info[index].mode = ECORE_WL2_WINDOW_KEYGRAB_SHARED;
2957 case KeyGrab::OVERRIDE_EXCLUSIVE:
2959 info[index].mode = ECORE_WL2_WINDOW_KEYGRAB_OVERRIDE_EXCLUSIVE;
2962 case KeyGrab::EXCLUSIVE:
2964 info[index].mode = ECORE_WL2_WINDOW_KEYGRAB_EXCLUSIVE;
2969 info[index].mode = ECORE_WL2_WINDOW_KEYGRAB_UNKNOWN;
2974 keyList = eina_list_append(keyList, &info);
2977 START_DURATION_CHECK();
2978 Eina_List* grabList = ecore_wl2_window_keygrab_list_set(mEcoreWindow, keyList);
2979 FINISH_DURATION_CHECK("ecore_wl2_window_keygrab_list_set");
2981 result.Resize(keyCount, true);
2983 Eina_List* l = NULL;
2984 Eina_List* m = NULL;
2985 void* listData = NULL;
2987 if(grabList != NULL)
2989 EINA_LIST_FOREACH(grabList, m, data)
2992 EINA_LIST_FOREACH(keyList, l, listData)
2994 if(static_cast<Ecore_Wl2_Window_Keygrab_Info*>(listData)->key == NULL)
2996 DALI_LOG_ERROR("input key list has null data!");
3000 if(strcmp(static_cast<char*>(data), static_cast<Ecore_Wl2_Window_Keygrab_Info*>(listData)->key) == 0)
3002 result[index] = false;
3011 eina_list_free(keyList);
3012 eina_list_free(grabList);
3018 bool WindowBaseEcoreWl2::UngrabKeyList(const Dali::Vector<Dali::KEY>& key, Dali::Vector<bool>& result)
3020 int keyCount = key.Count();
3028 Eina_List* keyList = NULL;
3029 Ecore_Wl2_Window_Keygrab_Info* info = new Ecore_Wl2_Window_Keygrab_Info[keyCount];
3031 for(int index = 0; index < keyCount; ++index)
3033 info[index].key = const_cast<char*>(KeyLookup::GetKeyName(key[index]));
3034 keyList = eina_list_append(keyList, &info);
3037 START_DURATION_CHECK();
3038 Eina_List* ungrabList = ecore_wl2_window_keygrab_list_unset(mEcoreWindow, keyList);
3039 FINISH_DURATION_CHECK("ecore_wl2_window_keygrab_list_unset");
3041 result.Resize(keyCount, true);
3043 Eina_List* l = NULL;
3044 Eina_List* m = NULL;
3045 void* listData = NULL;
3048 if(ungrabList != NULL)
3050 EINA_LIST_FOREACH(ungrabList, m, data)
3053 EINA_LIST_FOREACH(keyList, l, listData)
3055 if(strcmp(static_cast<char*>(data), static_cast<Ecore_Wl2_Window_Keygrab_Info*>(listData)->key) == 0)
3057 result[index] = false;
3066 eina_list_free(keyList);
3067 eina_list_free(ungrabList);
3073 void WindowBaseEcoreWl2::GetDpi(unsigned int& dpiHorizontal, unsigned int& dpiVertical)
3078 Ecore_Wl2_Output* output = ecore_wl2_window_output_find(mEcoreWindow);
3080 // 1 inch = 25.4 millimeters
3081 xres = ecore_wl2_output_dpi_get(output);
3082 yres = ecore_wl2_output_dpi_get(output);
3084 dpiHorizontal = int(xres + 0.5f); // rounding
3085 dpiVertical = int(yres + 0.5f);
3088 int WindowBaseEcoreWl2::GetWindowRotationAngle() const
3090 int orientation = mWindowRotationAngle;
3091 if(mSupportedPreProtation)
3098 int WindowBaseEcoreWl2::GetScreenRotationAngle()
3100 if(mSupportedPreProtation)
3102 DALI_LOG_RELEASE_INFO("Support PreRotation and return 0\n");
3106 if(ecore_wl2_window_ignore_output_transform_get(mEcoreWindow))
3112 transform = ecore_wl2_output_transform_get(ecore_wl2_window_output_find(mEcoreWindow));
3114 mScreenRotationAngle = transform * 90;
3115 return mScreenRotationAngle;
3118 void WindowBaseEcoreWl2::SetWindowRotationAngle(int degree)
3120 mWindowRotationAngle = degree;
3121 ecore_wl2_window_rotation_set(mEcoreWindow, degree);
3124 void WindowBaseEcoreWl2::WindowRotationCompleted(int degree, int width, int height)
3126 START_DURATION_CHECK();
3127 ecore_wl2_window_rotation_change_done_send(mEcoreWindow, degree, width, height);
3128 FINISH_DURATION_CHECK("ecore_wl2_window_rotation_change_done_send");
3131 void WindowBaseEcoreWl2::SetTransparency(bool transparent)
3133 START_DURATION_CHECK();
3134 ecore_wl2_window_alpha_set(mEcoreWindow, transparent);
3135 FINISH_DURATION_CHECK("ecore_wl2_window_alpha_set");
3138 void WindowBaseEcoreWl2::CreateWindow(PositionSize positionSize)
3140 Ecore_Wl2_Display* display = ecore_wl2_display_connect(NULL);
3143 DALI_ASSERT_ALWAYS(0 && "Failed to get display");
3146 START_DURATION_CHECK();
3147 ecore_wl2_display_sync(display);
3149 mEcoreWindow = ecore_wl2_window_new(display, NULL, positionSize.x, positionSize.y, positionSize.width, positionSize.height);
3151 if(mEcoreWindow == 0)
3153 DALI_ASSERT_ALWAYS(0 && "Failed to create Wayland window");
3157 ecore_wl2_window_type_set(mEcoreWindow, ECORE_WL2_WINDOW_TYPE_TOPLEVEL);
3158 FINISH_DURATION_CHECK("ecore_wl2 functions");
3161 void WindowBaseEcoreWl2::SetParent(WindowBase* parentWinBase, bool belowParent)
3163 Ecore_Wl2_Window* ecoreParent = NULL;
3166 WindowBaseEcoreWl2* winBaseEcore2 = static_cast<WindowBaseEcoreWl2*>(parentWinBase);
3167 ecoreParent = winBaseEcore2->mEcoreWindow;
3170 START_DURATION_CHECK();
3171 ecore_wl2_window_transient_parent_set(mEcoreWindow, ecoreParent, belowParent);
3172 FINISH_DURATION_CHECK("ecore_wl2_window_transient_parent_set");
3175 int WindowBaseEcoreWl2::CreateFrameRenderedSyncFence()
3177 return wl_egl_window_tizen_create_commit_sync_fd(mEglWindow);
3180 int WindowBaseEcoreWl2::CreateFramePresentedSyncFence()
3182 return wl_egl_window_tizen_create_presentation_sync_fd(mEglWindow);
3185 void WindowBaseEcoreWl2::SetPositionSizeWithAngle(PositionSize positionSize, int angle)
3187 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);
3188 START_DURATION_CHECK();
3189 ecore_wl2_window_rotation_geometry_set(mEcoreWindow, angle, positionSize.x, positionSize.y, positionSize.width, positionSize.height);
3190 FINISH_DURATION_CHECK("ecore_wl2_window_rotation_geometry_set");
3193 void WindowBaseEcoreWl2::InitializeIme()
3195 Eina_Iterator* globals;
3196 struct wl_registry* registry;
3197 Ecore_Wl2_Global* global;
3198 Ecore_Wl2_Display* ecoreWl2Display;
3200 if(!(ecoreWl2Display = ecore_wl2_connected_display_get(NULL)))
3202 DALI_LOG_ERROR("WindowBaseEcoreWl2::InitializeIme(), fail to get ecore_wl2 connected display\n");
3206 DALI_LOG_RELEASE_INFO("InitializeIme: Ecore_Wl2_Display: %p, ecore wl window: %p\n", ecoreWl2Display, mEcoreWindow);
3208 if(!(registry = ecore_wl2_display_registry_get(ecoreWl2Display)))
3210 DALI_LOG_ERROR("WindowBaseEcoreWl2::InitializeIme(), fail to get ecore_wl2 display registry\n");
3214 if(!(globals = ecore_wl2_display_globals_get(ecoreWl2Display)))
3216 DALI_LOG_ERROR("WindowBaseEcoreWl2::InitializeIme(), fail to get ecore_wl2 globals\n");
3220 START_DURATION_CHECK();
3221 EINA_ITERATOR_FOREACH(globals, global)
3223 #ifdef OVER_TIZEN_VERSION_7
3224 if(strcmp(global->interface, "zwp_input_panel_v1") == 0)
3226 mWlInputPanel = (zwp_input_panel_v1*)wl_registry_bind(registry, global->id, &zwp_input_panel_v1_interface, 1);
3229 if(strcmp(global->interface, "wl_input_panel") == 0)
3231 mWlInputPanel = (wl_input_panel*)wl_registry_bind(registry, global->id, &wl_input_panel_interface, 1);
3234 else if(strcmp(global->interface, "wl_output") == 0)
3236 mWlOutput = (wl_output*)wl_registry_bind(registry, global->id, &wl_output_interface, 1);
3242 DALI_LOG_ERROR("WindowBaseEcoreWl2::InitializeIme(), fail to get wayland input panel interface\n");
3248 DALI_LOG_ERROR("WindowBaseEcoreWl2::InitializeIme(), fail to get wayland output panel interface\n");
3251 #ifdef OVER_TIZEN_VERSION_7
3252 mWlInputPanelSurface = zwp_input_panel_v1_get_input_panel_surface(mWlInputPanel, mWlSurface);
3254 mWlInputPanelSurface = wl_input_panel_get_input_panel_surface(mWlInputPanel, mWlSurface);
3256 if(!mWlInputPanelSurface)
3258 DALI_LOG_ERROR("WindowBaseEcoreWl2::InitializeIme(), fail to get wayland input panel surface\n");
3261 #ifdef OVER_TIZEN_VERSION_7
3262 zwp_input_panel_surface_v1_set_toplevel(mWlInputPanelSurface, mWlOutput, ZWP_INPUT_PANEL_SURFACE_V1_POSITION_CENTER_BOTTOM);
3264 wl_input_panel_surface_set_toplevel(mWlInputPanelSurface, mWlOutput, WL_INPUT_PANEL_SURFACE_POSITION_CENTER_BOTTOM);
3266 FINISH_DURATION_CHECK("zwp_input_panel_surface_v1_set_toplevel");
3269 void WindowBaseEcoreWl2::ImeWindowReadyToRender()
3271 if(!mWlInputPanelSurface)
3273 DALI_LOG_ERROR("WindowBaseEcoreWl2::ImeWindowReadyToRender(), wayland input panel surface is null\n");
3277 START_DURATION_CHECK();
3278 #ifdef OVER_TIZEN_VERSION_7
3279 zwp_input_panel_surface_v1_set_ready(mWlInputPanelSurface, 1);
3281 wl_input_panel_surface_set_ready(mWlInputPanelSurface, 1);
3283 FINISH_DURATION_CHECK("zwp_input_panel_surface_v1_set_ready");
3286 void WindowBaseEcoreWl2::RequestMoveToServer()
3288 Ecore_Wl2_Display* display = ecore_wl2_connected_display_get(NULL);
3291 DALI_LOG_ERROR("WindowBaseEcoreWl2::RequestMoveToServer, Fail to get ecore_wl2_display\n");
3295 Ecore_Wl2_Input* input = ecore_wl2_input_default_input_get(display);
3298 DALI_LOG_ERROR("WindowBaseEcoreWl2::RequestMoveToServer, Fail to get default Ecore_Wl2_Input\n");
3302 START_DURATION_CHECK();
3303 ecore_wl2_window_move(mEcoreWindow, input);
3304 FINISH_DURATION_CHECK("ecore_wl2_window_move");
3305 DALI_LOG_RELEASE_INFO("WindowBaseEcoreWl2::RequestMoveToServer, starts the window[%p] is moved by server\n", mEcoreWindow);
3308 void WindowBaseEcoreWl2::RequestResizeToServer(WindowResizeDirection direction)
3310 Ecore_Wl2_Display* display = ecore_wl2_connected_display_get(NULL);
3313 DALI_LOG_ERROR("WindowBaseEcoreWl2::RequestResizeToServer, Fail to get ecore_wl2_display\n");
3317 Ecore_Wl2_Input* input = ecore_wl2_input_default_input_get(display);
3320 DALI_LOG_ERROR("WindowBaseEcoreWl2::RequestResizeToServer, Fail to get default Ecore_Wl2_Input\n");
3324 ResizeLocation location = RecalculateLocationToCurrentOrientation(direction, mWindowRotationAngle);
3326 START_DURATION_CHECK();
3327 ecore_wl2_window_resize(mEcoreWindow, input, static_cast<int>(location));
3328 FINISH_DURATION_CHECK("ecore_wl2_window_resize");
3329 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);
3332 void WindowBaseEcoreWl2::EnableFloatingMode(bool enable)
3334 DALI_LOG_RELEASE_INFO("WindowBaseEcoreWl2::EnableFloatingMode, floating mode flag: [%p], enable [%d]\n", mEcoreWindow, enable);
3335 START_DURATION_CHECK();
3338 ecore_wl2_window_floating_mode_set(mEcoreWindow, EINA_TRUE);
3342 ecore_wl2_window_floating_mode_set(mEcoreWindow, EINA_FALSE);
3344 FINISH_DURATION_CHECK("ecore_wl2_window_floating_mode_set");
3347 bool WindowBaseEcoreWl2::IsFloatingModeEnabled() const
3349 return ecore_wl2_window_floating_mode_get(mEcoreWindow);
3352 void WindowBaseEcoreWl2::IncludeInputRegion(const Rect<int>& inputRegion)
3354 Rect<int> convertRegion = RecalculatePositionSizeToSystem(inputRegion);
3355 Eina_Rectangle rect;
3357 rect.x = convertRegion.x;
3358 rect.y = convertRegion.y;
3359 rect.w = convertRegion.width;
3360 rect.h = convertRegion.height;
3362 DALI_LOG_RELEASE_INFO("%p, Add input_rect(%d, %d, %d x %d)\n", mEcoreWindow, rect.x, rect.y, rect.w, rect.h);
3363 START_DURATION_CHECK();
3364 ecore_wl2_window_input_rect_add(mEcoreWindow, &rect);
3365 FINISH_DURATION_CHECK("ecore_wl2_window_input_rect_add");
3366 ecore_wl2_window_commit(mEcoreWindow, EINA_TRUE);
3369 void WindowBaseEcoreWl2::ExcludeInputRegion(const Rect<int>& inputRegion)
3371 Rect<int> convertRegion = RecalculatePositionSizeToSystem(inputRegion);
3372 Eina_Rectangle rect;
3374 rect.x = convertRegion.x;
3375 rect.y = convertRegion.y;
3376 rect.w = convertRegion.width;
3377 rect.h = convertRegion.height;
3379 DALI_LOG_RELEASE_INFO("%p, Subtract input_rect(%d, %d, %d x %d)\n", mEcoreWindow, rect.x, rect.y, rect.w, rect.h);
3380 START_DURATION_CHECK();
3381 ecore_wl2_window_input_rect_subtract(mEcoreWindow, &rect);
3382 FINISH_DURATION_CHECK("ecore_wl2_window_input_rect_subtract");
3383 ecore_wl2_window_commit(mEcoreWindow, EINA_TRUE);
3386 bool WindowBaseEcoreWl2::PointerConstraintsLock()
3388 return ecore_wl2_window_pointer_constraints_lock_pointer(mEcoreWindow);
3391 bool WindowBaseEcoreWl2::PointerConstraintsUnlock()
3393 return ecore_wl2_window_pointer_constraints_unlock_pointer(mEcoreWindow);
3396 void WindowBaseEcoreWl2::LockedPointerRegionSet(int32_t x, int32_t y, int32_t width, int32_t height)
3398 ecore_wl2_window_locked_pointer_region_set(mEcoreWindow, x, y, width, height);
3401 void WindowBaseEcoreWl2::LockedPointerCursorPositionHintSet(int32_t x, int32_t y)
3403 ecore_wl2_window_locked_pointer_cursor_position_hint_set(mEcoreWindow, x, y);
3406 bool WindowBaseEcoreWl2::PointerWarp(int32_t x, int32_t y)
3408 return ecore_wl2_window_pointer_warp(mEcoreWindow, x, y);
3411 void WindowBaseEcoreWl2::CursorVisibleSet(bool visible)
3413 ecore_wl2_window_cursor_visible_set(mEcoreWindow, visible);
3416 } // namespace Adaptor
3418 } // namespace Internal
3422 #pragma GCC diagnostic pop