2 * Copyright (c) 2022 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/window-system/common/window-impl.h>
28 #include <dali/internal/window-system/common/window-render-surface.h>
29 #include <dali/internal/window-system/common/window-system.h>
32 #include <Ecore_Input.h>
33 #include <dali/integration-api/debug.h>
34 #include <dali/integration-api/trace.h>
35 #include <dali/public-api/adaptor-framework/window-enumerations.h>
36 #include <dali/public-api/events/mouse-button.h>
37 #include <dali/public-api/object/any.h>
39 #if defined(VCONF_ENABLED)
40 #include <vconf-keys.h>
44 #include <wayland-egl-tizen.h>
54 #if defined(DEBUG_ENABLED)
55 Debug::Filter* gWindowBaseLogFilter = Debug::Filter::New(Debug::NoLogging, false, "LOG_WINDOW_BASE");
58 DALI_INIT_TRACE_FILTER(gTraceFilter, DALI_TRACE_PERFORMANCE_MARKER, false);
61 * @brief Enumeration of location for window resized by display server.
63 enum class ResizeLocation
65 INVALID = 0, ///< Invalid value
66 TOP_LEFT = 5, ///< Start resizing window to the top-left edge.
67 LEFT = 4, ///< Start resizing window to the left side.
68 BOTTOM_LEFT = 6, ///< Start resizing window to the bottom-left edge.
69 BOTTOM = 2, ///< Start resizing window to the bottom side.
70 BOTTOM_RIGHT = 10, ///< Start resizing window to the bottom-right edge.
71 RIGHT = 8, ///< Start resizing window to the right side.
72 TOP_RIGHT = 9, ///< Start resizing window to the top-right edge.
73 TOP = 1 ///< Start resizing window to the top side.
76 const uint32_t MAX_TIZEN_CLIENT_VERSION = 7;
77 const unsigned int PRIMARY_TOUCH_BUTTON_ID = 1;
78 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};
80 #if defined(VCONF_ENABLED)
81 const char* DALI_VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_NAME = "db/setting/accessibility/font_name"; // It will be update at vconf-key.h and replaced.
87 xkb_keycode_t keyCode;
92 * Get the device name from the provided ecore key event
94 void GetDeviceName(Ecore_Event_Key* keyEvent, std::string& result)
96 const char* ecoreDeviceName = ecore_device_name_get(keyEvent->dev);
100 result = ecoreDeviceName;
105 * Get the device class from the provided ecore event
107 void GetDeviceClass(Ecore_Device_Class ecoreDeviceClass, Device::Class::Type& deviceClass)
109 switch(ecoreDeviceClass)
111 case ECORE_DEVICE_CLASS_SEAT:
113 deviceClass = Device::Class::USER;
116 case ECORE_DEVICE_CLASS_KEYBOARD:
118 deviceClass = Device::Class::KEYBOARD;
121 case ECORE_DEVICE_CLASS_MOUSE:
123 deviceClass = Device::Class::MOUSE;
126 case ECORE_DEVICE_CLASS_TOUCH:
128 deviceClass = Device::Class::TOUCH;
131 case ECORE_DEVICE_CLASS_PEN:
133 deviceClass = Device::Class::PEN;
136 case ECORE_DEVICE_CLASS_POINTER:
138 deviceClass = Device::Class::POINTER;
141 case ECORE_DEVICE_CLASS_GAMEPAD:
143 deviceClass = Device::Class::GAMEPAD;
148 deviceClass = Device::Class::NONE;
154 void GetDeviceSubclass(Ecore_Device_Subclass ecoreDeviceSubclass, Device::Subclass::Type& deviceSubclass)
156 switch(ecoreDeviceSubclass)
158 case ECORE_DEVICE_SUBCLASS_FINGER:
160 deviceSubclass = Device::Subclass::FINGER;
163 case ECORE_DEVICE_SUBCLASS_FINGERNAIL:
165 deviceSubclass = Device::Subclass::FINGERNAIL;
168 case ECORE_DEVICE_SUBCLASS_KNUCKLE:
170 deviceSubclass = Device::Subclass::KNUCKLE;
173 case ECORE_DEVICE_SUBCLASS_PALM:
175 deviceSubclass = Device::Subclass::PALM;
178 case ECORE_DEVICE_SUBCLASS_HAND_SIZE:
180 deviceSubclass = Device::Subclass::HAND_SIDE;
183 case ECORE_DEVICE_SUBCLASS_HAND_FLAT:
185 deviceSubclass = Device::Subclass::HAND_FLAT;
188 case ECORE_DEVICE_SUBCLASS_PEN_TIP:
190 deviceSubclass = Device::Subclass::PEN_TIP;
193 case ECORE_DEVICE_SUBCLASS_TRACKPAD:
195 deviceSubclass = Device::Subclass::TRACKPAD;
198 case ECORE_DEVICE_SUBCLASS_TRACKPOINT:
200 deviceSubclass = Device::Subclass::TRACKPOINT;
203 case ECORE_DEVICE_SUBCLASS_TRACKBALL:
205 deviceSubclass = Device::Subclass::TRACKBALL;
208 case ECORE_DEVICE_SUBCLASS_REMOCON:
210 deviceSubclass = Device::Subclass::REMOCON;
213 case ECORE_DEVICE_SUBCLASS_VIRTUAL_KEYBOARD:
215 deviceSubclass = Device::Subclass::VIRTUAL_KEYBOARD;
220 deviceSubclass = Device::Subclass::NONE;
226 void FindKeyCode(struct xkb_keymap* keyMap, xkb_keycode_t key, void* data)
228 KeyCodeMap* foundKeyCode = static_cast<KeyCodeMap*>(data);
229 if(foundKeyCode->isKeyCode)
234 xkb_keysym_t keySym = foundKeyCode->keySym;
236 const xkb_keysym_t* symsOut = NULL;
238 nsyms = xkb_keymap_key_get_syms_by_level(keyMap, key, 0, 0, &symsOut);
242 if(*symsOut == keySym)
244 foundKeyCode->keyCode = key;
245 foundKeyCode->isKeyCode = true;
251 * Return the recalculated window resizing location according to the current orientation.
253 ResizeLocation RecalculateLocationToCurrentOrientation(WindowResizeDirection direction, int windowRotationAngle)
258 case WindowResizeDirection::TOP_LEFT:
263 case WindowResizeDirection::LEFT:
268 case WindowResizeDirection::BOTTOM_LEFT:
273 case WindowResizeDirection::BOTTOM:
278 case WindowResizeDirection::BOTTOM_RIGHT:
283 case WindowResizeDirection::RIGHT:
288 case WindowResizeDirection::TOP_RIGHT:
293 case WindowResizeDirection::TOP:
305 if(index != 8 && windowRotationAngle != 0)
307 index = (index + (windowRotationAngle / 90) * 2) % 8;
310 return RESIZE_LOCATIONS[index];
313 /////////////////////////////////////////////////////////////////////////////////////////////////
315 /////////////////////////////////////////////////////////////////////////////////////////////////
317 /// Called when the window iconify state is changed.
318 static Eina_Bool EcoreEventWindowIconifyStateChanged(void* data, int type, void* event)
320 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
323 return windowBase->OnIconifyStateChanged(data, type, event);
326 return ECORE_CALLBACK_PASS_ON;
329 /// Called when the window gains focus
330 static Eina_Bool EcoreEventWindowFocusIn(void* data, int type, void* event)
332 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
335 return windowBase->OnFocusIn(data, type, event);
338 return ECORE_CALLBACK_PASS_ON;
341 /// Called when the window loses focus
342 static Eina_Bool EcoreEventWindowFocusOut(void* data, int type, void* event)
344 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
347 return windowBase->OnFocusOut(data, type, event);
350 return ECORE_CALLBACK_PASS_ON;
353 /// Called when the output is transformed
354 static Eina_Bool EcoreEventOutputTransform(void* data, int type, void* event)
356 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
359 return windowBase->OnOutputTransform(data, type, event);
362 return ECORE_CALLBACK_PASS_ON;
365 /// Called when the output transform should be ignored
366 static Eina_Bool EcoreEventIgnoreOutputTransform(void* data, int type, void* event)
368 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
371 return windowBase->OnIgnoreOutputTransform(data, type, event);
374 return ECORE_CALLBACK_PASS_ON;
378 * Called when rotate event is recevied.
380 static Eina_Bool EcoreEventRotate(void* data, int type, void* event)
382 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
385 DALI_LOG_RELEASE_INFO("WindowBaseEcoreWl2::EcoreEventRotate\n");
386 windowBase->OnRotation(data, type, event);
388 return ECORE_CALLBACK_PASS_ON;
392 * Called when configure event is recevied.
394 static Eina_Bool EcoreEventConfigure(void* data, int type, void* event)
396 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
399 windowBase->OnConfiguration(data, type, event);
401 return ECORE_CALLBACK_PASS_ON;
404 /////////////////////////////////////////////////////////////////////////////////////////////////
406 /////////////////////////////////////////////////////////////////////////////////////////////////
409 * Called when a touch down is received.
411 static Eina_Bool EcoreEventMouseButtonDown(void* data, int type, void* event)
413 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
416 windowBase->OnMouseButtonDown(data, type, event);
418 return ECORE_CALLBACK_PASS_ON;
422 * Called when a touch up is received.
424 static Eina_Bool EcoreEventMouseButtonUp(void* data, int type, void* event)
426 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
429 windowBase->OnMouseButtonUp(data, type, event);
431 return ECORE_CALLBACK_PASS_ON;
435 * Called when a touch motion is received.
437 static Eina_Bool EcoreEventMouseButtonMove(void* data, int type, void* event)
439 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
442 windowBase->OnMouseButtonMove(data, type, event);
444 return ECORE_CALLBACK_PASS_ON;
448 * Called when a touch is canceled.
450 static Eina_Bool EcoreEventMouseButtonCancel(void* data, int type, void* event)
452 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
455 windowBase->OnMouseButtonCancel(data, type, event);
457 return ECORE_CALLBACK_PASS_ON;
461 * Called when a mouse wheel is received.
463 static Eina_Bool EcoreEventMouseWheel(void* data, int type, void* event)
465 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
468 windowBase->OnMouseWheel(data, type, event);
470 return ECORE_CALLBACK_PASS_ON;
474 * Called when a detent rotation event is recevied.
476 static Eina_Bool EcoreEventDetentRotation(void* data, int type, void* event)
478 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
481 windowBase->OnDetentRotation(data, type, event);
483 return ECORE_CALLBACK_PASS_ON;
486 /////////////////////////////////////////////////////////////////////////////////////////////////
488 /////////////////////////////////////////////////////////////////////////////////////////////////
491 * Called when a key down is received.
493 static Eina_Bool EcoreEventKeyDown(void* data, int type, void* event)
495 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
498 windowBase->OnKeyDown(data, type, event);
500 return ECORE_CALLBACK_PASS_ON;
504 * Called when a key up is received.
506 static Eina_Bool EcoreEventKeyUp(void* data, int type, void* event)
508 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
511 windowBase->OnKeyUp(data, type, event);
513 return ECORE_CALLBACK_PASS_ON;
516 /////////////////////////////////////////////////////////////////////////////////////////////////
517 // Selection Callbacks
518 /////////////////////////////////////////////////////////////////////////////////////////////////
521 * Called when the source window notifies us the content in clipboard is selected.
523 static Eina_Bool EcoreEventDataSend(void* data, int type, void* event)
525 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
528 windowBase->OnDataSend(data, type, event);
530 return ECORE_CALLBACK_PASS_ON;
534 * Called when the source window sends us about the selected content.
535 * For example, when item is selected in the clipboard.
537 static Eina_Bool EcoreEventDataReceive(void* data, int type, void* event)
539 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
542 windowBase->OnDataReceive(data, type, event);
544 return ECORE_CALLBACK_PASS_ON;
547 /////////////////////////////////////////////////////////////////////////////////////////////////
548 // Effect Start/End Callbacks
549 /////////////////////////////////////////////////////////////////////////////////////////////////
552 * Called when transition animation of the window's shown/hidden is started by window manager.
554 static Eina_Bool EcoreEventEffectStart(void* data, int type, void* event)
556 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
557 Ecore_Wl2_Event_Effect_Start* effectStart = static_cast<Ecore_Wl2_Event_Effect_Start*>(event);
558 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::EcoreEventEffectStart, effect type[ %d ]\n", effectStart->type);
561 if(effectStart->type < 3) // only under restack
563 windowBase->OnTransitionEffectEvent(WindowEffectState::START, static_cast<WindowEffectType>(effectStart->type));
566 return ECORE_CALLBACK_PASS_ON;
570 * Called when transition animation of the window's shown/hidden is ended by window manager.
572 static Eina_Bool EcoreEventEffectEnd(void* data, int type, void* event)
574 Ecore_Wl2_Event_Effect_Start* effectEnd = static_cast<Ecore_Wl2_Event_Effect_Start*>(event);
575 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
576 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::EcoreEventEffectEnd, effect type[ %d ]\n", effectEnd->type);
579 if(effectEnd->type < 3) // only under restack
581 windowBase->OnTransitionEffectEvent(WindowEffectState::END, static_cast<WindowEffectType>(effectEnd->type));
584 return ECORE_CALLBACK_PASS_ON;
587 /////////////////////////////////////////////////////////////////////////////////////////////////
588 // Keyboard Repeat Settings Changed Callbacks
589 /////////////////////////////////////////////////////////////////////////////////////////////////
591 static Eina_Bool EcoreEventSeatKeyboardRepeatChanged(void* data, int type, void* event)
593 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
594 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::EcoreEventSeatKeyboardRepeatChanged, id[ %d ]\n", static_cast<Ecore_Wl2_Event_Seat_Keyboard_Repeat_Changed*>(event)->id);
597 windowBase->OnKeyboardRepeatSettingsChanged();
600 return ECORE_CALLBACK_RENEW;
603 /////////////////////////////////////////////////////////////////////////////////////////////////
604 // Keymap Changed Callbacks
605 /////////////////////////////////////////////////////////////////////////////////////////////////
607 static Eina_Bool EcoreEventSeatKeymapChanged(void* data, int type, void* event)
609 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
612 windowBase->KeymapChanged(data, type, event);
615 return ECORE_CALLBACK_RENEW;
618 /////////////////////////////////////////////////////////////////////////////////////////////////
620 /////////////////////////////////////////////////////////////////////////////////////////////////
622 #if defined(VCONF_ENABLED)
624 * Called when a font name is changed.
626 static void VconfNotifyFontNameChanged(keynode_t* node, void* data)
628 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
631 windowBase->OnFontNameChanged();
636 * Called when a font size is changed.
638 static void VconfNotifyFontSizeChanged(keynode_t* node, void* data)
640 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
643 windowBase->OnFontSizeChanged();
648 /////////////////////////////////////////////////////////////////////////////////////////////////
649 // Window Redraw Request Event Callbacks
650 /////////////////////////////////////////////////////////////////////////////////////////////////
652 static Eina_Bool EcoreEventWindowRedrawRequest(void* data, int type, void* event)
654 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
655 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::EcoreEventWindowRedrawRequest, window[ %d ]\n", static_cast<Ecore_Wl2_Event_Window_Redraw_Request*>(event)->win);
658 windowBase->OnEcoreEventWindowRedrawRequest();
661 return ECORE_CALLBACK_RENEW;
664 /////////////////////////////////////////////////////////////////////////////////////////////////
665 // Window Auxiliary Message Callbacks
666 /////////////////////////////////////////////////////////////////////////////////////////////////
667 static Eina_Bool EcoreEventWindowAuxiliaryMessage(void* data, int type, void* event)
669 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
672 windowBase->OnEcoreEventWindowAuxiliaryMessage(event);
674 return ECORE_CALLBACK_RENEW;
677 static void RegistryGlobalCallback(void* data, struct wl_registry* registry, uint32_t name, const char* interface, uint32_t version)
679 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
682 windowBase->RegistryGlobalCallback(data, registry, name, interface, version);
686 static void RegistryGlobalCallbackRemove(void* data, struct wl_registry* registry, uint32_t id)
688 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
691 windowBase->RegistryGlobalCallbackRemove(data, registry, id);
695 static void TizenPolicyConformant(void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, uint32_t isConformant)
699 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)
703 static void TizenPolicyNotificationChangeDone(void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, int32_t level, uint32_t state)
705 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
708 windowBase->TizenPolicyNotificationChangeDone(data, tizenPolicy, surface, level, state);
712 static void TizenPolicyTransientForDone(void* data, struct tizen_policy* tizenPolicy, uint32_t childId)
716 static void TizenPolicyScreenModeChangeDone(void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, uint32_t mode, uint32_t state)
718 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
721 windowBase->TizenPolicyScreenModeChangeDone(data, tizenPolicy, surface, mode, state);
725 static void TizenPolicyIconifyStateChanged(void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, uint32_t iconified, uint32_t force)
729 static void TizenPolicySupportedAuxiliaryHints(void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, struct wl_array* hints, uint32_t numNints)
733 static void TizenPolicyAllowedAuxiliaryHint(void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, int id)
737 static void TizenPolicyAuxiliaryMessage(void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, const char* key, const char* val, struct wl_array* options)
741 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)
745 static void DisplayPolicyBrightnessChangeDone(void* data, struct tizen_display_policy* displayPolicy, struct wl_surface* surface, int32_t brightness, uint32_t state)
747 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
750 windowBase->DisplayPolicyBrightnessChangeDone(data, displayPolicy, surface, brightness, state);
754 const struct wl_registry_listener registryListener =
756 RegistryGlobalCallback,
757 RegistryGlobalCallbackRemove};
759 const struct tizen_policy_listener tizenPolicyListener =
761 TizenPolicyConformant,
762 TizenPolicyConformantArea,
763 TizenPolicyNotificationChangeDone,
764 TizenPolicyTransientForDone,
765 TizenPolicyScreenModeChangeDone,
766 TizenPolicyIconifyStateChanged,
767 TizenPolicySupportedAuxiliaryHints,
768 TizenPolicyAllowedAuxiliaryHint,
769 TizenPolicyAuxiliaryMessage,
770 TizenPolicyConformantRegion};
772 const struct tizen_display_policy_listener tizenDisplayPolicyListener =
774 DisplayPolicyBrightnessChangeDone};
776 } // unnamed namespace
778 WindowBaseEcoreWl2::WindowBaseEcoreWl2(Dali::PositionSize positionSize, Any surface, bool isTransparent)
779 : mEcoreEventHandler(),
780 mEcoreWindow(nullptr),
782 mWlInputPanel(nullptr),
784 mWlInputPanelSurface(nullptr),
787 mEventQueue(nullptr),
788 mTizenPolicy(nullptr),
789 mTizenDisplayPolicy(nullptr),
791 mSupportedAuxiliaryHints(),
792 mWindowPositionSize(positionSize),
794 mType(WindowType::NORMAL),
795 mNotificationLevel(-1),
798 mWindowRotationAngle(0),
799 mScreenRotationAngle(0),
800 mSupportedPreProtation(0),
801 mNotificationChangeState(0),
802 mScreenOffModeChangeState(0),
803 mBrightnessChangeState(0),
804 mLastSubmittedMoveResizeSerial(0),
805 mMoveResizeSerial(0),
806 mNotificationLevelChangeDone(true),
807 mScreenOffModeChangeDone(true),
810 mBrightnessChangeDone(true)
812 Initialize(positionSize, surface, isTransparent);
815 WindowBaseEcoreWl2::~WindowBaseEcoreWl2()
817 #if defined(VCONF_ENABLED)
818 vconf_ignore_key_changed(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, VconfNotifyFontSizeChanged);
819 vconf_ignore_key_changed(DALI_VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_NAME, VconfNotifyFontNameChanged);
822 for(Dali::Vector<Ecore_Event_Handler*>::Iterator iter = mEcoreEventHandler.Begin(), endIter = mEcoreEventHandler.End(); iter != endIter; ++iter)
824 ecore_event_handler_del(*iter);
826 mEcoreEventHandler.Clear();
830 wl_event_queue_destroy(mEventQueue);
833 mSupportedAuxiliaryHints.clear();
834 mAuxiliaryHints.clear();
836 if(mEglWindow != NULL)
838 wl_egl_window_destroy(mEglWindow);
844 ecore_wl2_window_free(mEcoreWindow);
846 WindowSystem::Shutdown();
850 void WindowBaseEcoreWl2::Initialize(PositionSize positionSize, Any surface, bool isTransparent)
852 if(surface.Empty() == false)
854 // check we have a valid type
855 DALI_ASSERT_ALWAYS((surface.GetType() == typeid(Ecore_Wl2_Window*)) && "Surface type is invalid");
857 mEcoreWindow = AnyCast<Ecore_Wl2_Window*>(surface);
861 // we own the surface about to created
862 WindowSystem::Initialize();
865 CreateWindow(positionSize);
868 mWlSurface = ecore_wl2_window_surface_get(mEcoreWindow);
870 SetTransparency(isTransparent);
872 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_WINDOW_ICONIFY_STATE_CHANGE, EcoreEventWindowIconifyStateChanged, this));
873 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_FOCUS_IN, EcoreEventWindowFocusIn, this));
874 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_FOCUS_OUT, EcoreEventWindowFocusOut, this));
875 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_OUTPUT_TRANSFORM, EcoreEventOutputTransform, this));
876 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_IGNORE_OUTPUT_TRANSFORM, EcoreEventIgnoreOutputTransform, this));
878 // Register Rotate event
879 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_WINDOW_ROTATE, EcoreEventRotate, this));
881 // Register Configure event
882 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_WINDOW_CONFIGURE, EcoreEventConfigure, this));
884 // Register Touch events
885 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_DOWN, EcoreEventMouseButtonDown, this));
886 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_UP, EcoreEventMouseButtonUp, this));
887 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_EVENT_MOUSE_MOVE, EcoreEventMouseButtonMove, this));
888 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_CANCEL, EcoreEventMouseButtonCancel, this));
890 // Register Mouse wheel events
891 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_EVENT_MOUSE_WHEEL, EcoreEventMouseWheel, this));
893 // Register Detent event
894 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_EVENT_DETENT_ROTATE, EcoreEventDetentRotation, this));
896 // Register Key events
897 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_EVENT_KEY_DOWN, EcoreEventKeyDown, this));
898 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_EVENT_KEY_UP, EcoreEventKeyUp, this));
900 // Register Selection event - clipboard selection
901 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_DATA_SOURCE_SEND, EcoreEventDataSend, this));
902 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_SELECTION_DATA_READY, EcoreEventDataReceive, this));
904 // Register Effect Start/End event
905 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_EFFECT_START, EcoreEventEffectStart, this));
906 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_EFFECT_END, EcoreEventEffectEnd, this));
908 // Register Keyboard repeat event
909 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_SEAT_KEYBOARD_REPEAT_CHANGED, EcoreEventSeatKeyboardRepeatChanged, this));
911 // Register Window redraw request event
912 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_WINDOW_REDRAW_REQUEST, EcoreEventWindowRedrawRequest, this));
914 // Register Window auxiliary event
915 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_AUX_MESSAGE, EcoreEventWindowAuxiliaryMessage, this));
917 #if defined(VCONF_ENABLED)
918 // Register Vconf notify - font name and size
919 vconf_notify_key_changed_for_ui_thread(DALI_VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_NAME, VconfNotifyFontNameChanged, this);
920 vconf_notify_key_changed_for_ui_thread(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, VconfNotifyFontSizeChanged, this);
923 Ecore_Wl2_Display* display = ecore_wl2_connected_display_get(NULL);
924 mDisplay = ecore_wl2_display_get(display);
928 wl_display* displayWrapper = static_cast<wl_display*>(wl_proxy_create_wrapper(mDisplay));
931 mEventQueue = wl_display_create_queue(mDisplay);
934 wl_proxy_set_queue(reinterpret_cast<wl_proxy*>(displayWrapper), mEventQueue);
936 wl_registry* registry = wl_display_get_registry(displayWrapper);
937 wl_registry_add_listener(registry, ®istryListener, this);
940 wl_proxy_wrapper_destroy(displayWrapper);
944 Ecore_Wl2_Input* ecoreWlInput = ecore_wl2_input_default_input_get(display);
948 mKeyMap = ecore_wl2_input_keymap_get(ecoreWlInput);
950 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_SEAT_KEYMAP_CHANGED, EcoreEventSeatKeymapChanged, this));
953 // get auxiliary hint
954 Eina_List* hints = ecore_wl2_window_aux_hints_supported_get(mEcoreWindow);
960 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))))
962 mSupportedAuxiliaryHints.push_back(hint);
964 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::Initialize: %s\n", hint);
969 Eina_Bool WindowBaseEcoreWl2::OnIconifyStateChanged(void* data, int type, void* event)
971 Ecore_Wl2_Event_Window_Iconify_State_Change* iconifyChangedEvent(static_cast<Ecore_Wl2_Event_Window_Iconify_State_Change*>(event));
972 Eina_Bool handled(ECORE_CALLBACK_PASS_ON);
974 if(iconifyChangedEvent->win == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
976 if(iconifyChangedEvent->iconified == EINA_TRUE)
978 mIconifyChangedSignal.Emit(true);
982 mIconifyChangedSignal.Emit(false);
984 handled = ECORE_CALLBACK_DONE;
990 Eina_Bool WindowBaseEcoreWl2::OnFocusIn(void* data, int type, void* event)
992 Ecore_Wl2_Event_Focus_In* focusInEvent(static_cast<Ecore_Wl2_Event_Focus_In*>(event));
994 if(focusInEvent->window == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
996 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "Window EcoreEventWindowFocusIn\n");
998 mFocusChangedSignal.Emit(true);
1001 return ECORE_CALLBACK_PASS_ON;
1004 Eina_Bool WindowBaseEcoreWl2::OnFocusOut(void* data, int type, void* event)
1006 Ecore_Wl2_Event_Focus_Out* focusOutEvent(static_cast<Ecore_Wl2_Event_Focus_Out*>(event));
1008 if(focusOutEvent->window == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
1010 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "Window EcoreEventWindowFocusOut\n");
1012 mFocusChangedSignal.Emit(false);
1015 return ECORE_CALLBACK_PASS_ON;
1018 Eina_Bool WindowBaseEcoreWl2::OnOutputTransform(void* data, int type, void* event)
1020 Ecore_Wl2_Event_Output_Transform* transformEvent(static_cast<Ecore_Wl2_Event_Output_Transform*>(event));
1022 if(transformEvent->output == ecore_wl2_window_output_find(mEcoreWindow))
1024 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "Window (%p) EcoreEventOutputTransform\n", mEcoreWindow);
1026 mScreenRotationAngle = GetScreenRotationAngle();
1028 mOutputTransformedSignal.Emit();
1031 return ECORE_CALLBACK_PASS_ON;
1034 Eina_Bool WindowBaseEcoreWl2::OnIgnoreOutputTransform(void* data, int type, void* event)
1036 Ecore_Wl2_Event_Ignore_Output_Transform* ignoreTransformEvent(static_cast<Ecore_Wl2_Event_Ignore_Output_Transform*>(event));
1038 if(ignoreTransformEvent->win == mEcoreWindow)
1040 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "Window (%p) EcoreEventIgnoreOutputTransform\n", mEcoreWindow);
1042 mScreenRotationAngle = GetScreenRotationAngle();
1044 mOutputTransformedSignal.Emit();
1047 return ECORE_CALLBACK_PASS_ON;
1050 void WindowBaseEcoreWl2::OnRotation(void* data, int type, void* event)
1052 Ecore_Wl2_Event_Window_Rotation* ev(static_cast<Ecore_Wl2_Event_Window_Rotation*>(event));
1054 if(ev->win == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
1056 DALI_LOG_RELEASE_INFO("WindowBaseEcoreWl2::OnRotation, angle: %d, width: %d, height: %d\n", ev->angle, ev->w, ev->h);
1058 RotationEvent rotationEvent;
1059 rotationEvent.angle = ev->angle;
1060 rotationEvent.winResize = 0;
1062 if(ev->w == 0 || ev->h == 0)
1064 // When rotation event does not have the window width or height,
1065 // previous DALi side window's size are used.
1066 ev->w = mWindowPositionSize.width;
1067 ev->h = mWindowPositionSize.height;
1070 mWindowRotationAngle = ev->angle;
1072 mWindowPositionSize.width = ev->w;
1073 mWindowPositionSize.height = ev->h;
1075 PositionSize newPositionSize = RecalculatePositionSizeToCurrentOrientation(mWindowPositionSize);
1077 rotationEvent.x = newPositionSize.x;
1078 rotationEvent.y = newPositionSize.y;
1079 rotationEvent.width = newPositionSize.width;
1080 rotationEvent.height = newPositionSize.height;
1082 mRotationSignal.Emit(rotationEvent);
1086 void WindowBaseEcoreWl2::OnConfiguration(void* data, int type, void* event)
1088 Ecore_Wl2_Event_Window_Configure* ev(static_cast<Ecore_Wl2_Event_Window_Configure*>(event));
1090 if(ev && ev->win == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
1092 // Note: To comply with the wayland protocol, Dali should make an ack_configure
1093 // by calling ecore_wl2_window_commit
1095 int tempWidth = ev->w;
1096 int tempHeight = ev->h;
1098 // Initialize with previous size for skip resize when new size is 0.
1099 // When window is just moved or window is resized by client application,
1100 // The configure notification event's size will be 0.
1101 // If new size is 0, the resized work should be skip.
1102 int newWidth = mWindowPositionSize.width;
1103 int newHeight = mWindowPositionSize.height;
1104 bool windowMoved = false, windowResized = false;
1106 if(ev->x != mWindowPositionSize.x || ev->y != mWindowPositionSize.y)
1111 if(tempWidth != 0 && tempHeight != 0 && (tempWidth != mWindowPositionSize.width || tempHeight != mWindowPositionSize.height))
1113 windowResized = true;
1114 newWidth = tempWidth;
1115 newHeight = tempHeight;
1118 if(windowMoved || windowResized)
1120 mWindowPositionSize.x = ev->x;
1121 mWindowPositionSize.y = ev->y;
1122 mWindowPositionSize.width = newWidth;
1123 mWindowPositionSize.height = newHeight;
1124 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);
1126 ecore_wl2_window_geometry_set(mEcoreWindow, mWindowPositionSize.x, mWindowPositionSize.y, mWindowPositionSize.width, mWindowPositionSize.height);
1128 Dali::PositionSize newPositionSize = RecalculatePositionSizeToCurrentOrientation(mWindowPositionSize);
1129 mUpdatePositionSizeSignal.Emit(newPositionSize);
1132 mMaximizeChangedSignal.Emit(static_cast<bool>(ev->states & ECORE_WL2_WINDOW_STATE_MAXIMIZED));
1134 ecore_wl2_window_commit(mEcoreWindow, EINA_FALSE);
1138 void WindowBaseEcoreWl2::OnMouseButtonDown(void* data, int type, void* event)
1140 Ecore_Event_Mouse_Button* touchEvent = static_cast<Ecore_Event_Mouse_Button*>(event);
1142 if(touchEvent->window == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
1144 Device::Class::Type deviceClass;
1145 Device::Subclass::Type deviceSubclass;
1147 GetDeviceClass(ecore_device_class_get(touchEvent->dev), deviceClass);
1148 GetDeviceSubclass(ecore_device_subclass_get(touchEvent->dev), deviceSubclass);
1150 PointState::Type state(PointState::DOWN);
1152 if(deviceClass != Device::Class::Type::MOUSE)
1154 // Check if the buttons field is set and ensure it's the primary touch button.
1155 // If this event was triggered by buttons other than the primary button (used for touch), then
1156 // just send an interrupted event to Core.
1157 if(touchEvent->buttons && (touchEvent->buttons != PRIMARY_TOUCH_BUTTON_ID))
1159 state = PointState::INTERRUPTED;
1163 Integration::Point point;
1164 point.SetDeviceId(touchEvent->multi.device);
1165 point.SetState(state);
1166 point.SetScreenPosition(Vector2(touchEvent->x, touchEvent->y));
1167 point.SetRadius(touchEvent->multi.radius, Vector2(touchEvent->multi.radius_x, touchEvent->multi.radius_y));
1168 point.SetPressure(touchEvent->multi.pressure);
1169 point.SetAngle(Degree(touchEvent->multi.angle));
1170 point.SetDeviceClass(deviceClass);
1171 point.SetDeviceSubclass(deviceSubclass);
1172 point.SetMouseButton(static_cast<MouseButton::Type>(touchEvent->buttons));
1174 mTouchEventSignal.Emit(point, touchEvent->timestamp);
1178 void WindowBaseEcoreWl2::OnMouseButtonUp(void* data, int type, void* event)
1180 Ecore_Event_Mouse_Button* touchEvent = static_cast<Ecore_Event_Mouse_Button*>(event);
1182 if(touchEvent->window == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
1184 Device::Class::Type deviceClass;
1185 Device::Subclass::Type deviceSubclass;
1187 GetDeviceClass(ecore_device_class_get(touchEvent->dev), deviceClass);
1188 GetDeviceSubclass(ecore_device_subclass_get(touchEvent->dev), deviceSubclass);
1190 Integration::Point point;
1191 point.SetDeviceId(touchEvent->multi.device);
1192 point.SetState(PointState::UP);
1193 point.SetScreenPosition(Vector2(touchEvent->x, touchEvent->y));
1194 point.SetRadius(touchEvent->multi.radius, Vector2(touchEvent->multi.radius_x, touchEvent->multi.radius_y));
1195 point.SetPressure(touchEvent->multi.pressure);
1196 point.SetAngle(Degree(touchEvent->multi.angle));
1197 point.SetDeviceClass(deviceClass);
1198 point.SetDeviceSubclass(deviceSubclass);
1199 point.SetMouseButton(static_cast<MouseButton::Type>(touchEvent->buttons));
1201 mTouchEventSignal.Emit(point, touchEvent->timestamp);
1205 void WindowBaseEcoreWl2::OnMouseButtonMove(void* data, int type, void* event)
1207 Ecore_Event_Mouse_Move* touchEvent = static_cast<Ecore_Event_Mouse_Move*>(event);
1209 if(touchEvent->window == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
1211 Device::Class::Type deviceClass;
1212 Device::Subclass::Type deviceSubclass;
1214 GetDeviceClass(ecore_device_class_get(touchEvent->dev), deviceClass);
1215 GetDeviceSubclass(ecore_device_subclass_get(touchEvent->dev), deviceSubclass);
1217 Integration::Point point;
1218 point.SetDeviceId(touchEvent->multi.device);
1219 point.SetState(PointState::MOTION);
1220 point.SetScreenPosition(Vector2(touchEvent->x, touchEvent->y));
1221 point.SetRadius(touchEvent->multi.radius, Vector2(touchEvent->multi.radius_x, touchEvent->multi.radius_y));
1222 point.SetPressure(touchEvent->multi.pressure);
1223 point.SetAngle(Degree(touchEvent->multi.angle));
1224 point.SetDeviceClass(deviceClass);
1225 point.SetDeviceSubclass(deviceSubclass);
1227 mTouchEventSignal.Emit(point, touchEvent->timestamp);
1231 void WindowBaseEcoreWl2::OnMouseButtonCancel(void* data, int type, void* event)
1233 Ecore_Event_Mouse_Button* touchEvent = static_cast<Ecore_Event_Mouse_Button*>(event);
1235 if(touchEvent->window == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
1237 Integration::Point point;
1238 point.SetDeviceId(touchEvent->multi.device);
1239 point.SetState(PointState::INTERRUPTED);
1240 point.SetScreenPosition(Vector2(0.0f, 0.0f));
1242 mTouchEventSignal.Emit(point, touchEvent->timestamp);
1244 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::OnMouseButtonCancel\n");
1248 void WindowBaseEcoreWl2::OnMouseWheel(void* data, int type, void* event)
1250 Ecore_Event_Mouse_Wheel* mouseWheelEvent = static_cast<Ecore_Event_Mouse_Wheel*>(event);
1252 if(mouseWheelEvent->window == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
1254 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);
1256 Integration::WheelEvent wheelEvent(Integration::WheelEvent::MOUSE_WHEEL, mouseWheelEvent->direction, mouseWheelEvent->modifiers, Vector2(mouseWheelEvent->x, mouseWheelEvent->y), mouseWheelEvent->z, mouseWheelEvent->timestamp);
1258 mWheelEventSignal.Emit(wheelEvent);
1262 void WindowBaseEcoreWl2::OnDetentRotation(void* data, int type, void* event)
1264 Ecore_Event_Detent_Rotate* detentEvent = static_cast<Ecore_Event_Detent_Rotate*>(event);
1266 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Concise, "WindowBaseEcoreWl2::OnDetentRotation\n");
1268 int32_t clockwise = (detentEvent->direction == ECORE_DETENT_DIRECTION_CLOCKWISE) ? 1 : -1;
1270 Integration::WheelEvent wheelEvent(Integration::WheelEvent::CUSTOM_WHEEL, detentEvent->direction, 0, Vector2(0.0f, 0.0f), clockwise, detentEvent->timestamp);
1272 mWheelEventSignal.Emit(wheelEvent);
1275 void WindowBaseEcoreWl2::OnKeyDown(void* data, int type, void* event)
1277 Ecore_Event_Key* keyEvent = static_cast<Ecore_Event_Key*>(event);
1279 if(keyEvent->window == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
1281 std::string keyName(keyEvent->keyname);
1282 std::string logicalKey("");
1283 std::string keyString("");
1284 std::string compose("");
1286 DALI_TRACE_SCOPE(gTraceFilter, "DALI_ON_KEY_DOWN");
1288 // Ensure key compose string is not NULL as keys like SHIFT or arrow have a null string.
1289 if(keyEvent->compose)
1291 compose = keyEvent->compose;
1294 // Ensure key symbol is not NULL as keys like SHIFT have a null string.
1297 logicalKey = keyEvent->key;
1301 GetKeyCode(keyName, keyCode); // Get key code dynamically.
1305 // Get a specific key code from dali key look up table.
1306 keyCode = KeyLookup::GetDaliKeyCode(keyEvent->keyname);
1309 keyCode = (keyCode == -1) ? 0 : keyCode;
1310 int modifier(keyEvent->modifiers);
1311 unsigned long time = keyEvent->timestamp;
1312 if(!strncmp(keyEvent->keyname, "Keycode-", 8))
1314 keyCode = atoi(keyEvent->keyname + 8);
1317 // Ensure key event string is not NULL as keys like SHIFT have a null string.
1318 if(keyEvent->string)
1320 keyString = keyEvent->string;
1323 std::string deviceName;
1324 Device::Class::Type deviceClass;
1325 Device::Subclass::Type deviceSubclass;
1327 GetDeviceName(keyEvent, deviceName);
1328 GetDeviceClass(ecore_device_class_get(keyEvent->dev), deviceClass);
1329 GetDeviceSubclass(ecore_device_subclass_get(keyEvent->dev), deviceSubclass);
1331 Integration::KeyEvent keyEvent(keyName, logicalKey, keyString, keyCode, modifier, time, Integration::KeyEvent::DOWN, compose, deviceName, deviceClass, deviceSubclass);
1333 mKeyEventSignal.Emit(keyEvent);
1337 void WindowBaseEcoreWl2::OnKeyUp(void* data, int type, void* event)
1339 Ecore_Event_Key* keyEvent = static_cast<Ecore_Event_Key*>(event);
1341 if(keyEvent->window == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
1343 #if defined(ECORE_VERSION_MAJOR) && (ECORE_VERSION_MAJOR >= 1) && defined(ECORE_VERSION_MINOR) && (ECORE_VERSION_MINOR >= 23)
1344 // Cancel processing flag is sent because this key event will combine with the previous key. So, the event should not actually perform anything.
1345 if(keyEvent->event_flags & ECORE_EVENT_FLAG_CANCEL)
1347 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::OnKeyUp: This event flag indicates the event is canceled. \n");
1350 #endif // Since ecore 1.23 version
1352 std::string keyName(keyEvent->keyname);
1353 std::string logicalKey("");
1354 std::string keyString("");
1355 std::string compose("");
1357 DALI_TRACE_SCOPE(gTraceFilter, "DALI_ON_KEY_UP");
1359 // Ensure key compose string is not NULL as keys like SHIFT or arrow have a null string.
1360 if(keyEvent->compose)
1362 compose = keyEvent->compose;
1365 // Ensure key symbol is not NULL as keys like SHIFT have a null string.
1368 logicalKey = keyEvent->key;
1372 GetKeyCode(keyName, keyCode); // Get key code dynamically.
1376 // Get a specific key code from dali key look up table.
1377 keyCode = KeyLookup::GetDaliKeyCode(keyEvent->keyname);
1380 keyCode = (keyCode == -1) ? 0 : keyCode;
1381 int modifier(keyEvent->modifiers);
1382 unsigned long time = keyEvent->timestamp;
1383 if(!strncmp(keyEvent->keyname, "Keycode-", 8))
1385 keyCode = atoi(keyEvent->keyname + 8);
1388 // Ensure key event string is not NULL as keys like SHIFT have a null string.
1389 if(keyEvent->string)
1391 keyString = keyEvent->string;
1394 std::string deviceName;
1395 Device::Class::Type deviceClass;
1396 Device::Subclass::Type deviceSubclass;
1398 GetDeviceName(keyEvent, deviceName);
1399 GetDeviceClass(ecore_device_class_get(keyEvent->dev), deviceClass);
1400 GetDeviceSubclass(ecore_device_subclass_get(keyEvent->dev), deviceSubclass);
1402 Integration::KeyEvent keyEvent(keyName, logicalKey, keyString, keyCode, modifier, time, Integration::KeyEvent::UP, compose, deviceName, deviceClass, deviceSubclass);
1404 mKeyEventSignal.Emit(keyEvent);
1408 void WindowBaseEcoreWl2::OnDataSend(void* data, int type, void* event)
1410 mSelectionDataSendSignal.Emit(event);
1413 void WindowBaseEcoreWl2::OnDataReceive(void* data, int type, void* event)
1415 mSelectionDataReceivedSignal.Emit(event);
1418 void WindowBaseEcoreWl2::OnFontNameChanged()
1420 mStyleChangedSignal.Emit(StyleChange::DEFAULT_FONT_CHANGE);
1423 void WindowBaseEcoreWl2::OnFontSizeChanged()
1425 mStyleChangedSignal.Emit(StyleChange::DEFAULT_FONT_SIZE_CHANGE);
1428 void WindowBaseEcoreWl2::OnTransitionEffectEvent(WindowEffectState state, WindowEffectType type)
1430 mTransitionEffectEventSignal.Emit(state, type);
1433 void WindowBaseEcoreWl2::OnKeyboardRepeatSettingsChanged()
1435 mKeyboardRepeatSettingsChangedSignal.Emit();
1438 void WindowBaseEcoreWl2::OnEcoreEventWindowRedrawRequest()
1440 mWindowRedrawRequestSignal.Emit();
1443 void WindowBaseEcoreWl2::OnEcoreEventWindowAuxiliaryMessage(void* event)
1445 Ecore_Wl2_Event_Aux_Message* message = static_cast<Ecore_Wl2_Event_Aux_Message*>(event);
1448 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::OnEcoreEventWindowAuxiliaryMessage, key:%s, value:%s \n", message->key, message->val);
1449 std::string key(message->key);
1450 std::string value(message->val);
1451 Dali::Property::Array options;
1453 if(message->options)
1457 EINA_LIST_FOREACH(message->options, l, data)
1459 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::OnEcoreEventWindowAuxiliaryMessage, option: %s\n", (char*)data);
1460 std::string option(static_cast<char*>(data));
1461 options.Add(option);
1465 mAuxiliaryMessageSignal.Emit(key, value, options);
1469 void WindowBaseEcoreWl2::KeymapChanged(void* data, int type, void* event)
1471 Ecore_Wl2_Event_Seat_Keymap_Changed* changed = static_cast<Ecore_Wl2_Event_Seat_Keymap_Changed*>(event);
1472 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::KeymapChanged, keymap id[ %d ]\n", changed->id);
1473 Ecore_Wl2_Input* ecoreWlInput = ecore_wl2_input_default_input_get(changed->display);
1476 mKeyMap = ecore_wl2_input_keymap_get(ecoreWlInput);
1480 void WindowBaseEcoreWl2::RegistryGlobalCallback(void* data, struct wl_registry* registry, uint32_t name, const char* interface, uint32_t version)
1482 if(strcmp(interface, tizen_policy_interface.name) == 0)
1484 uint32_t clientVersion = std::min(version, MAX_TIZEN_CLIENT_VERSION);
1486 mTizenPolicy = static_cast<tizen_policy*>(wl_registry_bind(registry, name, &tizen_policy_interface, clientVersion));
1489 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::RegistryGlobalCallback: wl_registry_bind(tizen_policy_interface) is failed.\n");
1493 tizen_policy_add_listener(mTizenPolicy, &tizenPolicyListener, data);
1495 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::RegistryGlobalCallback: tizen_policy_add_listener is called.\n");
1497 else if(strcmp(interface, tizen_display_policy_interface.name) == 0)
1499 mTizenDisplayPolicy = static_cast<tizen_display_policy*>(wl_registry_bind(registry, name, &tizen_display_policy_interface, version));
1500 if(!mTizenDisplayPolicy)
1502 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::RegistryGlobalCallback: wl_registry_bind(tizen_display_policy_interface) is failed.\n");
1506 tizen_display_policy_add_listener(mTizenDisplayPolicy, &tizenDisplayPolicyListener, data);
1508 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::RegistryGlobalCallback: tizen_display_policy_add_listener is called.\n");
1512 void WindowBaseEcoreWl2::RegistryGlobalCallbackRemove(void* data, struct wl_registry* registry, uint32_t id)
1514 mTizenPolicy = NULL;
1515 mTizenDisplayPolicy = NULL;
1518 void WindowBaseEcoreWl2::TizenPolicyNotificationChangeDone(void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, int32_t level, uint32_t state)
1520 mNotificationLevel = level;
1521 mNotificationChangeState = state;
1522 mNotificationLevelChangeDone = true;
1524 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::TizenPolicyNotificationChangeDone: level = %d, state = %d\n", level, state);
1527 void WindowBaseEcoreWl2::TizenPolicyScreenModeChangeDone(void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, uint32_t mode, uint32_t state)
1529 mScreenOffMode = mode;
1530 mScreenOffModeChangeState = state;
1531 mScreenOffModeChangeDone = true;
1533 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::TizenPolicyScreenModeChangeDone: mode = %d, state = %d\n", mode, state);
1536 void WindowBaseEcoreWl2::DisplayPolicyBrightnessChangeDone(void* data, struct tizen_display_policy* displayPolicy, struct wl_surface* surface, int32_t brightness, uint32_t state)
1538 mBrightness = brightness;
1539 mBrightnessChangeState = state;
1540 mBrightnessChangeDone = true;
1542 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::DisplayPolicyBrightnessChangeDone: brightness = %d, state = %d\n", brightness, state);
1545 void WindowBaseEcoreWl2::GetKeyCode(std::string keyName, int32_t& keyCode)
1547 xkb_keysym_t sym = XKB_KEY_NoSymbol;
1548 KeyCodeMap foundKeyCode;
1550 sym = xkb_keysym_from_name(keyName.c_str(), XKB_KEYSYM_NO_FLAGS);
1551 if(sym == XKB_KEY_NoSymbol)
1553 DALI_LOG_ERROR("Failed to get keysym in WindowBaseEcoreWl2\n");
1557 foundKeyCode.keySym = sym;
1558 foundKeyCode.isKeyCode = false;
1559 xkb_keymap_key_for_each(mKeyMap, FindKeyCode, &foundKeyCode);
1560 keyCode = static_cast<int32_t>(foundKeyCode.keyCode);
1563 Any WindowBaseEcoreWl2::GetNativeWindow()
1565 return mEcoreWindow;
1568 int WindowBaseEcoreWl2::GetNativeWindowId()
1570 return ecore_wl2_window_id_get(mEcoreWindow);
1573 std::string WindowBaseEcoreWl2::GetNativeWindowResourceId()
1575 #ifdef OVER_TIZEN_VERSION_7
1576 return std::to_string(ecore_wl2_window_resource_id_get(mEcoreWindow));
1578 return std::string();
1582 EGLNativeWindowType WindowBaseEcoreWl2::CreateEglWindow(int width, int height)
1584 int totalAngle = (mWindowRotationAngle + mScreenRotationAngle) % 360;
1585 if(totalAngle == 90 || totalAngle == 270)
1587 mEglWindow = wl_egl_window_create(mWlSurface, height, width);
1591 mEglWindow = wl_egl_window_create(mWlSurface, width, height);
1594 return static_cast<EGLNativeWindowType>(mEglWindow);
1597 void WindowBaseEcoreWl2::DestroyEglWindow()
1599 if(mEglWindow != NULL)
1601 wl_egl_window_destroy(mEglWindow);
1606 void WindowBaseEcoreWl2::SetEglWindowRotation(int angle)
1608 wl_egl_window_tizen_rotation rotation;
1614 rotation = WL_EGL_WINDOW_TIZEN_ROTATION_0;
1619 rotation = WL_EGL_WINDOW_TIZEN_ROTATION_270;
1624 rotation = WL_EGL_WINDOW_TIZEN_ROTATION_180;
1629 rotation = WL_EGL_WINDOW_TIZEN_ROTATION_90;
1634 rotation = WL_EGL_WINDOW_TIZEN_ROTATION_0;
1639 wl_egl_window_tizen_set_rotation(mEglWindow, rotation);
1642 void WindowBaseEcoreWl2::SetEglWindowBufferTransform(int angle)
1644 wl_output_transform bufferTransform;
1650 bufferTransform = WL_OUTPUT_TRANSFORM_NORMAL;
1655 bufferTransform = WL_OUTPUT_TRANSFORM_90;
1660 bufferTransform = WL_OUTPUT_TRANSFORM_180;
1665 bufferTransform = WL_OUTPUT_TRANSFORM_270;
1670 bufferTransform = WL_OUTPUT_TRANSFORM_NORMAL;
1675 DALI_LOG_RELEASE_INFO("wl_egl_window_tizen_set_buffer_transform() with buffer Transform [%d]\n", bufferTransform);
1676 wl_egl_window_tizen_set_buffer_transform(mEglWindow, bufferTransform);
1679 void WindowBaseEcoreWl2::SetEglWindowTransform(int angle)
1681 wl_output_transform windowTransform;
1687 windowTransform = WL_OUTPUT_TRANSFORM_NORMAL;
1692 windowTransform = WL_OUTPUT_TRANSFORM_90;
1697 windowTransform = WL_OUTPUT_TRANSFORM_180;
1702 windowTransform = WL_OUTPUT_TRANSFORM_270;
1707 windowTransform = WL_OUTPUT_TRANSFORM_NORMAL;
1712 DALI_LOG_RELEASE_INFO("wl_egl_window_tizen_set_window_transform() with window Transform [%d]\n", windowTransform);
1713 wl_egl_window_tizen_set_window_transform(mEglWindow, windowTransform);
1716 void WindowBaseEcoreWl2::ResizeEglWindow(PositionSize positionSize)
1718 DALI_LOG_RELEASE_INFO("wl_egl_window_resize(), (%d, %d) [%d x %d]\n", positionSize.x, positionSize.y, positionSize.width, positionSize.height);
1719 wl_egl_window_resize(mEglWindow, positionSize.width, positionSize.height, positionSize.x, positionSize.y);
1721 // Note: Both "Resize" and "MoveResize" cases can reach here, but only "MoveResize" needs to submit serial number
1722 if(mMoveResizeSerial != mLastSubmittedMoveResizeSerial)
1724 wl_egl_window_tizen_set_window_serial(mEglWindow, mMoveResizeSerial);
1725 mLastSubmittedMoveResizeSerial = mMoveResizeSerial;
1729 bool WindowBaseEcoreWl2::IsEglWindowRotationSupported()
1732 wl_egl_window_tizen_capability capability = static_cast<wl_egl_window_tizen_capability>(wl_egl_window_tizen_get_capabilities(mEglWindow));
1733 if(capability == WL_EGL_WINDOW_TIZEN_CAPABILITY_ROTATION_SUPPORTED)
1735 mSupportedPreProtation = true;
1738 mSupportedPreProtation = false;
1742 PositionSize WindowBaseEcoreWl2::RecalculatePositionSizeToSystem(PositionSize positionSize)
1744 PositionSize newPositionSize;
1745 int32_t screenWidth, screenHeight;
1746 WindowSystem::GetScreenSize(screenWidth, screenHeight);
1748 if(mWindowRotationAngle == 90)
1750 newPositionSize.x = positionSize.y;
1751 newPositionSize.y = screenHeight - (positionSize.x + positionSize.width);
1752 newPositionSize.width = positionSize.height;
1753 newPositionSize.height = positionSize.width;
1755 else if(mWindowRotationAngle == 180)
1757 newPositionSize.x = screenWidth - (positionSize.x + positionSize.width);
1758 newPositionSize.y = screenHeight - (positionSize.y + positionSize.height);
1759 newPositionSize.width = positionSize.width;
1760 newPositionSize.height = positionSize.height;
1762 else if(mWindowRotationAngle == 270)
1764 newPositionSize.x = screenWidth - (positionSize.y + positionSize.height);
1765 newPositionSize.y = positionSize.x;
1766 newPositionSize.width = positionSize.height;
1767 newPositionSize.height = positionSize.width;
1771 newPositionSize.x = positionSize.x;
1772 newPositionSize.y = positionSize.y;
1773 newPositionSize.width = positionSize.width;
1774 newPositionSize.height = positionSize.height;
1777 return newPositionSize;
1780 PositionSize WindowBaseEcoreWl2::RecalculatePositionSizeToCurrentOrientation(PositionSize positionSize)
1782 PositionSize newPositionSize;
1783 int32_t screenWidth, screenHeight;
1784 WindowSystem::GetScreenSize(screenWidth, screenHeight);
1786 if(mWindowRotationAngle == 90)
1788 newPositionSize.x = screenHeight - (positionSize.y + positionSize.height);
1789 newPositionSize.y = positionSize.x;
1790 newPositionSize.width = positionSize.height;
1791 newPositionSize.height = positionSize.width;
1793 else if(mWindowRotationAngle == 180)
1795 newPositionSize.x = screenWidth - (positionSize.x + positionSize.width);
1796 newPositionSize.y = screenHeight - (positionSize.y + positionSize.height);
1797 newPositionSize.width = positionSize.width;
1798 newPositionSize.height = positionSize.height;
1800 else if(mWindowRotationAngle == 270)
1802 newPositionSize.x = positionSize.y;
1803 newPositionSize.y = screenWidth - (positionSize.x + positionSize.width);
1804 newPositionSize.width = positionSize.height;
1805 newPositionSize.height = positionSize.width;
1809 newPositionSize.x = positionSize.x;
1810 newPositionSize.y = positionSize.y;
1811 newPositionSize.width = positionSize.width;
1812 newPositionSize.height = positionSize.height;
1815 return newPositionSize;
1818 void WindowBaseEcoreWl2::Move(PositionSize positionSize)
1820 PositionSize newPositionSize = RecalculatePositionSizeToSystem(positionSize);
1822 mWindowPositionSize = newPositionSize;
1823 DALI_LOG_RELEASE_INFO("ecore_wl2_window_position_set x[%d], y[%d]\n", newPositionSize.x, newPositionSize.y);
1824 ecore_wl2_window_position_set(mEcoreWindow, newPositionSize.x, newPositionSize.y);
1827 void WindowBaseEcoreWl2::Resize(PositionSize positionSize)
1829 PositionSize newPositionSize = RecalculatePositionSizeToSystem(positionSize);
1831 mWindowPositionSize = newPositionSize;
1832 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);
1833 ecore_wl2_window_sync_geometry_set(mEcoreWindow, ++mMoveResizeSerial, newPositionSize.x, newPositionSize.y, newPositionSize.width, newPositionSize.height);
1836 void WindowBaseEcoreWl2::MoveResize(PositionSize positionSize)
1838 PositionSize newPositionSize = RecalculatePositionSizeToSystem(positionSize);
1840 mWindowPositionSize = newPositionSize;
1841 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);
1842 ecore_wl2_window_sync_geometry_set(mEcoreWindow, ++mMoveResizeSerial, newPositionSize.x, newPositionSize.y, newPositionSize.width, newPositionSize.height);
1845 void WindowBaseEcoreWl2::SetClass(const std::string& name, const std::string& className)
1847 ecore_wl2_window_title_set(mEcoreWindow, name.c_str());
1848 ecore_wl2_window_class_set(mEcoreWindow, className.c_str());
1851 void WindowBaseEcoreWl2::Raise()
1853 // Use ecore_wl2_window_activate to prevent the window shown without rendering
1854 ecore_wl2_window_activate(mEcoreWindow);
1857 void WindowBaseEcoreWl2::Lower()
1859 ecore_wl2_window_lower(mEcoreWindow);
1862 void WindowBaseEcoreWl2::Activate()
1864 ecore_wl2_window_activate(mEcoreWindow);
1867 void WindowBaseEcoreWl2::Maximize(bool maximize)
1869 ecore_wl2_window_maximized_set(mEcoreWindow, maximize);
1872 bool WindowBaseEcoreWl2::IsMaximized() const
1874 return ecore_wl2_window_maximized_get(mEcoreWindow);
1877 void WindowBaseEcoreWl2::SetMaximumSize(Dali::Window::WindowSize size)
1879 DALI_LOG_RELEASE_INFO("ecore_wl2_window_maximum_size_set, width: %d, height: %d\n", size.GetWidth(), size.GetHeight());
1880 ecore_wl2_window_maximum_size_set(mEcoreWindow, size.GetWidth(), size.GetHeight());
1883 void WindowBaseEcoreWl2::Minimize(bool minimize)
1885 ecore_wl2_window_iconified_set(mEcoreWindow, minimize);
1888 bool WindowBaseEcoreWl2::IsMinimized() const
1890 return ecore_wl2_window_iconified_get(mEcoreWindow);
1893 void WindowBaseEcoreWl2::SetMimimumSize(Dali::Window::WindowSize size)
1895 DALI_LOG_RELEASE_INFO("ecore_wl2_window_minimum_size_set, width: %d, height: %d\n", size.GetWidth(), size.GetHeight());
1896 ecore_wl2_window_minimum_size_set(mEcoreWindow, size.GetWidth(), size.GetHeight());
1899 void WindowBaseEcoreWl2::SetAvailableAnlges(const std::vector<int>& angles)
1901 int rotations[4] = {0};
1902 DALI_LOG_RELEASE_INFO("WindowBaseEcoreWl2::SetAvailableAnlges, angle's count: %d, angles\n", angles.size());
1903 for(std::size_t i = 0; i < angles.size(); ++i)
1905 rotations[i] = static_cast<int>(angles[i]);
1906 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "%d ", rotations[i]);
1908 ecore_wl2_window_available_rotations_set(mEcoreWindow, rotations, angles.size());
1911 void WindowBaseEcoreWl2::SetPreferredAngle(int angle)
1913 DALI_LOG_RELEASE_INFO("WindowBaseEcoreWl2::SetPreferredAngle, angle: %d\n", angle);
1914 ecore_wl2_window_preferred_rotation_set(mEcoreWindow, angle);
1917 void WindowBaseEcoreWl2::SetAcceptFocus(bool accept)
1919 ecore_wl2_window_focus_skip_set(mEcoreWindow, !accept);
1922 void WindowBaseEcoreWl2::Show()
1926 ecore_wl2_window_geometry_set(mEcoreWindow, mWindowPositionSize.x, mWindowPositionSize.y, mWindowPositionSize.width, mWindowPositionSize.height);
1930 ecore_wl2_window_show(mEcoreWindow);
1933 void WindowBaseEcoreWl2::Hide()
1936 ecore_wl2_window_hide(mEcoreWindow);
1939 unsigned int WindowBaseEcoreWl2::GetSupportedAuxiliaryHintCount() const
1941 return mSupportedAuxiliaryHints.size();
1944 std::string WindowBaseEcoreWl2::GetSupportedAuxiliaryHint(unsigned int index) const
1946 if(index >= GetSupportedAuxiliaryHintCount())
1948 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetSupportedAuxiliaryHint: Invalid index! [%d]\n", index);
1951 return mSupportedAuxiliaryHints[index];
1954 unsigned int WindowBaseEcoreWl2::AddAuxiliaryHint(const std::string& hint, const std::string& value)
1956 bool supported = false;
1958 // Check if the hint is suppported
1959 for(std::vector<std::string>::iterator iter = mSupportedAuxiliaryHints.begin(); iter != mSupportedAuxiliaryHints.end(); ++iter)
1970 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Concise, "WindowBaseEcoreWl2::AddAuxiliaryHint: Not supported auxiliary hint [%s]\n", hint.c_str());
1974 // Check if the hint is already added
1975 for(unsigned int i = 0; i < mAuxiliaryHints.size(); i++)
1977 if(mAuxiliaryHints[i].first == hint)
1979 // Just change the value
1980 mAuxiliaryHints[i].second = value;
1982 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::AddAuxiliaryHint: Change! hint = %s, value = %s, id = %d\n", hint.c_str(), value.c_str(), i + 1);
1984 return i + 1; // id is index + 1
1989 mAuxiliaryHints.push_back(std::pair<std::string, std::string>(hint, value));
1991 unsigned int id = mAuxiliaryHints.size();
1993 ecore_wl2_window_aux_hint_add(mEcoreWindow, static_cast<int>(id), hint.c_str(), value.c_str());
1995 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::AddAuxiliaryHint: hint = %s, value = %s, id = %d\n", hint.c_str(), value.c_str(), id);
2000 bool WindowBaseEcoreWl2::RemoveAuxiliaryHint(unsigned int id)
2002 if(id == 0 || id > mAuxiliaryHints.size())
2004 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Concise, "WindowBaseEcoreWl2::RemoveAuxiliaryHint: Invalid id [%d]\n", id);
2008 mAuxiliaryHints[id - 1].second = std::string();
2010 ecore_wl2_window_aux_hint_del(mEcoreWindow, static_cast<int>(id));
2012 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::RemoveAuxiliaryHint: id = %d, hint = %s\n", id, mAuxiliaryHints[id - 1].first.c_str());
2017 bool WindowBaseEcoreWl2::SetAuxiliaryHintValue(unsigned int id, const std::string& value)
2019 if(id == 0 || id > mAuxiliaryHints.size())
2021 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Concise, "WindowBaseEcoreWl2::SetAuxiliaryHintValue: Invalid id [%d]\n", id);
2025 mAuxiliaryHints[id - 1].second = value;
2027 ecore_wl2_window_aux_hint_change(mEcoreWindow, static_cast<int>(id), value.c_str());
2029 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());
2034 std::string WindowBaseEcoreWl2::GetAuxiliaryHintValue(unsigned int id) const
2036 if(id == 0 || id > mAuxiliaryHints.size())
2038 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Concise, "WindowBaseEcoreWl2::GetAuxiliaryHintValue: Invalid id [%d]\n", id);
2039 return std::string();
2042 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());
2044 return mAuxiliaryHints[id - 1].second;
2047 unsigned int WindowBaseEcoreWl2::GetAuxiliaryHintId(const std::string& hint) const
2049 for(unsigned int i = 0; i < mAuxiliaryHints.size(); i++)
2051 if(mAuxiliaryHints[i].first == hint)
2053 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetAuxiliaryHintId: hint = %s, id = %d\n", hint.c_str(), i + 1);
2058 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetAuxiliaryHintId: Invalid hint! [%s]\n", hint.c_str());
2063 void WindowBaseEcoreWl2::SetInputRegion(const Rect<int>& inputRegion)
2065 ecore_wl2_window_input_region_set(mEcoreWindow, inputRegion.x, inputRegion.y, inputRegion.width, inputRegion.height);
2068 void WindowBaseEcoreWl2::SetType(Dali::WindowType type)
2073 Ecore_Wl2_Window_Type windowType;
2077 case Dali::WindowType::NORMAL:
2079 windowType = ECORE_WL2_WINDOW_TYPE_TOPLEVEL;
2082 case Dali::WindowType::NOTIFICATION:
2084 windowType = ECORE_WL2_WINDOW_TYPE_NOTIFICATION;
2087 case Dali::WindowType::UTILITY:
2089 windowType = ECORE_WL2_WINDOW_TYPE_UTILITY;
2092 case Dali::WindowType::DIALOG:
2094 windowType = ECORE_WL2_WINDOW_TYPE_DIALOG;
2097 case Dali::WindowType::IME:
2099 windowType = ECORE_WL2_WINDOW_TYPE_NONE;
2102 case Dali::WindowType::DESKTOP:
2104 windowType = ECORE_WL2_WINDOW_TYPE_DESKTOP;
2109 windowType = ECORE_WL2_WINDOW_TYPE_TOPLEVEL;
2113 ecore_wl2_window_type_set(mEcoreWindow, windowType);
2117 Dali::WindowType WindowBaseEcoreWl2::GetType() const
2122 Dali::WindowOperationResult WindowBaseEcoreWl2::SetNotificationLevel(Dali::WindowNotificationLevel level)
2124 while(!mTizenPolicy)
2126 wl_display_dispatch_queue(mDisplay, mEventQueue);
2129 int notificationLevel;
2133 case Dali::WindowNotificationLevel::NONE:
2135 notificationLevel = TIZEN_POLICY_LEVEL_NONE;
2138 case Dali::WindowNotificationLevel::BASE:
2140 notificationLevel = TIZEN_POLICY_LEVEL_DEFAULT;
2143 case Dali::WindowNotificationLevel::MEDIUM:
2145 notificationLevel = TIZEN_POLICY_LEVEL_MEDIUM;
2148 case Dali::WindowNotificationLevel::HIGH:
2150 notificationLevel = TIZEN_POLICY_LEVEL_HIGH;
2153 case Dali::WindowNotificationLevel::TOP:
2155 notificationLevel = TIZEN_POLICY_LEVEL_TOP;
2160 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetNotificationLevel: invalid level [%d]\n", level);
2161 notificationLevel = TIZEN_POLICY_LEVEL_DEFAULT;
2166 mNotificationLevelChangeDone = false;
2167 mNotificationChangeState = TIZEN_POLICY_ERROR_STATE_NONE;
2169 tizen_policy_set_notification_level(mTizenPolicy, ecore_wl2_window_surface_get(mEcoreWindow), notificationLevel);
2173 while(!mNotificationLevelChangeDone && count < 3)
2175 ecore_wl2_display_flush(ecore_wl2_connected_display_get(NULL));
2176 wl_display_dispatch_queue(mDisplay, mEventQueue);
2180 if(!mNotificationLevelChangeDone)
2182 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetNotificationLevel: Level change is failed [%d, %d]\n", level, mNotificationChangeState);
2183 return Dali::WindowOperationResult::UNKNOWN_ERROR;
2185 else if(mNotificationChangeState == TIZEN_POLICY_ERROR_STATE_PERMISSION_DENIED)
2187 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetNotificationLevel: Permission denied! [%d]\n", level);
2188 return Dali::WindowOperationResult::PERMISSION_DENIED;
2191 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetNotificationLevel: Level is changed [%d]\n", mNotificationLevel);
2193 return Dali::WindowOperationResult::SUCCEED;
2196 Dali::WindowNotificationLevel WindowBaseEcoreWl2::GetNotificationLevel() const
2198 while(!mTizenPolicy)
2200 wl_display_dispatch_queue(mDisplay, mEventQueue);
2205 while(!mNotificationLevelChangeDone && count < 3)
2207 ecore_wl2_display_flush(ecore_wl2_connected_display_get(NULL));
2208 wl_display_dispatch_queue(mDisplay, mEventQueue);
2212 if(!mNotificationLevelChangeDone)
2214 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetNotificationLevel: Error! [%d]\n", mNotificationChangeState);
2215 return Dali::WindowNotificationLevel::NONE;
2218 Dali::WindowNotificationLevel level;
2220 switch(mNotificationLevel)
2222 case TIZEN_POLICY_LEVEL_NONE:
2224 level = Dali::WindowNotificationLevel::NONE;
2227 case TIZEN_POLICY_LEVEL_DEFAULT:
2229 level = Dali::WindowNotificationLevel::BASE;
2232 case TIZEN_POLICY_LEVEL_MEDIUM:
2234 level = Dali::WindowNotificationLevel::MEDIUM;
2237 case TIZEN_POLICY_LEVEL_HIGH:
2239 level = Dali::WindowNotificationLevel::HIGH;
2242 case TIZEN_POLICY_LEVEL_TOP:
2244 level = Dali::WindowNotificationLevel::TOP;
2249 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetNotificationLevel: invalid level [%d]\n", mNotificationLevel);
2250 level = Dali::WindowNotificationLevel::NONE;
2255 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetNotificationLevel: level [%d]\n", mNotificationLevel);
2260 void WindowBaseEcoreWl2::SetOpaqueState(bool opaque)
2262 while(!mTizenPolicy)
2264 wl_display_dispatch_queue(mDisplay, mEventQueue);
2267 tizen_policy_set_opaque_state(mTizenPolicy, ecore_wl2_window_surface_get(mEcoreWindow), (opaque ? 1 : 0));
2270 Dali::WindowOperationResult WindowBaseEcoreWl2::SetScreenOffMode(WindowScreenOffMode screenOffMode)
2272 while(!mTizenPolicy)
2274 wl_display_dispatch_queue(mDisplay, mEventQueue);
2277 mScreenOffModeChangeDone = false;
2278 mScreenOffModeChangeState = TIZEN_POLICY_ERROR_STATE_NONE;
2280 unsigned int mode = 0;
2282 switch(screenOffMode)
2284 case WindowScreenOffMode::TIMEOUT:
2289 case WindowScreenOffMode::NEVER:
2296 tizen_policy_set_window_screen_mode(mTizenPolicy, ecore_wl2_window_surface_get(mEcoreWindow), mode);
2300 while(!mScreenOffModeChangeDone && count < 3)
2302 ecore_wl2_display_flush(ecore_wl2_connected_display_get(NULL));
2303 wl_display_dispatch_queue(mDisplay, mEventQueue);
2307 if(!mScreenOffModeChangeDone)
2309 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetScreenOffMode: Screen mode change is failed [%d, %d]\n", screenOffMode, mScreenOffModeChangeState);
2310 return Dali::WindowOperationResult::UNKNOWN_ERROR;
2312 else if(mScreenOffModeChangeState == TIZEN_POLICY_ERROR_STATE_PERMISSION_DENIED)
2314 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetScreenOffMode: Permission denied! [%d]\n", screenOffMode);
2315 return Dali::WindowOperationResult::PERMISSION_DENIED;
2318 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetScreenOffMode: Screen mode is changed [%d]\n", mScreenOffMode);
2320 return Dali::WindowOperationResult::SUCCEED;
2323 WindowScreenOffMode WindowBaseEcoreWl2::GetScreenOffMode() const
2325 while(!mTizenPolicy)
2327 wl_display_dispatch_queue(mDisplay, mEventQueue);
2332 while(!mScreenOffModeChangeDone && count < 3)
2334 ecore_wl2_display_flush(ecore_wl2_connected_display_get(NULL));
2335 wl_display_dispatch_queue(mDisplay, mEventQueue);
2339 if(!mScreenOffModeChangeDone)
2341 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetScreenOffMode: Error! [%d]\n", mScreenOffModeChangeState);
2342 return WindowScreenOffMode::TIMEOUT;
2345 WindowScreenOffMode screenMode = WindowScreenOffMode::TIMEOUT;
2347 switch(mScreenOffMode)
2351 screenMode = WindowScreenOffMode::TIMEOUT;
2356 screenMode = WindowScreenOffMode::NEVER;
2361 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetScreenOffMode: screen mode [%d]\n", mScreenOffMode);
2366 Dali::WindowOperationResult WindowBaseEcoreWl2::SetBrightness(int brightness)
2368 while(!mTizenDisplayPolicy)
2370 wl_display_dispatch_queue(mDisplay, mEventQueue);
2373 mBrightnessChangeDone = false;
2374 mBrightnessChangeState = TIZEN_POLICY_ERROR_STATE_NONE;
2376 tizen_display_policy_set_window_brightness(mTizenDisplayPolicy, ecore_wl2_window_surface_get(mEcoreWindow), brightness);
2380 while(!mBrightnessChangeDone && count < 3)
2382 ecore_wl2_display_flush(ecore_wl2_connected_display_get(NULL));
2383 wl_display_dispatch_queue(mDisplay, mEventQueue);
2387 if(!mBrightnessChangeDone)
2389 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetBrightness: Brightness change is failed [%d, %d]\n", brightness, mBrightnessChangeState);
2390 return Dali::WindowOperationResult::UNKNOWN_ERROR;
2392 else if(mBrightnessChangeState == TIZEN_POLICY_ERROR_STATE_PERMISSION_DENIED)
2394 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetBrightness: Permission denied! [%d]\n", brightness);
2395 return Dali::WindowOperationResult::PERMISSION_DENIED;
2398 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetBrightness: Brightness is changed [%d]\n", mBrightness);
2400 return Dali::WindowOperationResult::SUCCEED;
2403 int WindowBaseEcoreWl2::GetBrightness() const
2405 while(!mTizenDisplayPolicy)
2407 wl_display_dispatch_queue(mDisplay, mEventQueue);
2412 while(!mBrightnessChangeDone && count < 3)
2414 ecore_wl2_display_flush(ecore_wl2_connected_display_get(NULL));
2415 wl_display_dispatch_queue(mDisplay, mEventQueue);
2419 if(!mBrightnessChangeDone)
2421 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetBrightness: Error! [%d]\n", mBrightnessChangeState);
2425 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetBrightness: Brightness [%d]\n", mBrightness);
2430 bool WindowBaseEcoreWl2::GrabKey(Dali::KEY key, KeyGrab::KeyGrabMode grabMode)
2432 Ecore_Wl2_Window_Keygrab_Mode mode;
2436 case KeyGrab::TOPMOST:
2438 mode = ECORE_WL2_WINDOW_KEYGRAB_TOPMOST;
2441 case KeyGrab::SHARED:
2443 mode = ECORE_WL2_WINDOW_KEYGRAB_SHARED;
2446 case KeyGrab::OVERRIDE_EXCLUSIVE:
2448 mode = ECORE_WL2_WINDOW_KEYGRAB_OVERRIDE_EXCLUSIVE;
2451 case KeyGrab::EXCLUSIVE:
2453 mode = ECORE_WL2_WINDOW_KEYGRAB_EXCLUSIVE;
2462 return ecore_wl2_window_keygrab_set(mEcoreWindow, KeyLookup::GetKeyName(key), 0, 0, 0, mode);
2465 bool WindowBaseEcoreWl2::UngrabKey(Dali::KEY key)
2467 return ecore_wl2_window_keygrab_unset(mEcoreWindow, KeyLookup::GetKeyName(key), 0, 0);
2470 bool WindowBaseEcoreWl2::GrabKeyList(const Dali::Vector<Dali::KEY>& key, const Dali::Vector<KeyGrab::KeyGrabMode>& grabMode, Dali::Vector<bool>& result)
2472 int keyCount = key.Count();
2473 int keyGrabModeCount = grabMode.Count();
2475 if(keyCount != keyGrabModeCount || keyCount == 0)
2482 Eina_List* keyList = NULL;
2483 Ecore_Wl2_Window_Keygrab_Info* info = new Ecore_Wl2_Window_Keygrab_Info[keyCount];
2485 for(int index = 0; index < keyCount; ++index)
2487 info[index].key = const_cast<char*>(KeyLookup::GetKeyName(key[index]));
2489 switch(grabMode[index])
2491 case KeyGrab::TOPMOST:
2493 info[index].mode = ECORE_WL2_WINDOW_KEYGRAB_TOPMOST;
2496 case KeyGrab::SHARED:
2498 info[index].mode = ECORE_WL2_WINDOW_KEYGRAB_SHARED;
2501 case KeyGrab::OVERRIDE_EXCLUSIVE:
2503 info[index].mode = ECORE_WL2_WINDOW_KEYGRAB_OVERRIDE_EXCLUSIVE;
2506 case KeyGrab::EXCLUSIVE:
2508 info[index].mode = ECORE_WL2_WINDOW_KEYGRAB_EXCLUSIVE;
2513 info[index].mode = ECORE_WL2_WINDOW_KEYGRAB_UNKNOWN;
2518 keyList = eina_list_append(keyList, &info);
2521 Eina_List* grabList = ecore_wl2_window_keygrab_list_set(mEcoreWindow, keyList);
2523 result.Resize(keyCount, true);
2525 Eina_List* l = NULL;
2526 Eina_List* m = NULL;
2527 void* listData = NULL;
2529 if(grabList != NULL)
2531 EINA_LIST_FOREACH(grabList, m, data)
2534 EINA_LIST_FOREACH(keyList, l, listData)
2536 if(static_cast<Ecore_Wl2_Window_Keygrab_Info*>(listData)->key == NULL)
2538 DALI_LOG_ERROR("input key list has null data!");
2542 if(strcmp(static_cast<char*>(data), static_cast<Ecore_Wl2_Window_Keygrab_Info*>(listData)->key) == 0)
2544 result[index] = false;
2553 eina_list_free(keyList);
2554 eina_list_free(grabList);
2560 bool WindowBaseEcoreWl2::UngrabKeyList(const Dali::Vector<Dali::KEY>& key, Dali::Vector<bool>& result)
2562 int keyCount = key.Count();
2570 Eina_List* keyList = NULL;
2571 Ecore_Wl2_Window_Keygrab_Info* info = new Ecore_Wl2_Window_Keygrab_Info[keyCount];
2573 for(int index = 0; index < keyCount; ++index)
2575 info[index].key = const_cast<char*>(KeyLookup::GetKeyName(key[index]));
2576 keyList = eina_list_append(keyList, &info);
2579 Eina_List* ungrabList = ecore_wl2_window_keygrab_list_unset(mEcoreWindow, keyList);
2581 result.Resize(keyCount, true);
2583 Eina_List* l = NULL;
2584 Eina_List* m = NULL;
2585 void* listData = NULL;
2588 if(ungrabList != NULL)
2590 EINA_LIST_FOREACH(ungrabList, m, data)
2593 EINA_LIST_FOREACH(keyList, l, listData)
2595 if(strcmp(static_cast<char*>(data), static_cast<Ecore_Wl2_Window_Keygrab_Info*>(listData)->key) == 0)
2597 result[index] = false;
2606 eina_list_free(keyList);
2607 eina_list_free(ungrabList);
2613 void WindowBaseEcoreWl2::GetDpi(unsigned int& dpiHorizontal, unsigned int& dpiVertical)
2618 Ecore_Wl2_Output* output = ecore_wl2_window_output_find(mEcoreWindow);
2620 // 1 inch = 25.4 millimeters
2621 xres = ecore_wl2_output_dpi_get(output);
2622 yres = ecore_wl2_output_dpi_get(output);
2624 dpiHorizontal = int(xres + 0.5f); // rounding
2625 dpiVertical = int(yres + 0.5f);
2628 int WindowBaseEcoreWl2::GetWindowRotationAngle() const
2630 int orientation = mWindowRotationAngle;
2631 if(mSupportedPreProtation)
2638 int WindowBaseEcoreWl2::GetScreenRotationAngle()
2640 if(mSupportedPreProtation)
2642 DALI_LOG_RELEASE_INFO("Support PreRotation and return 0\n");
2646 if(ecore_wl2_window_ignore_output_transform_get(mEcoreWindow))
2652 transform = ecore_wl2_output_transform_get(ecore_wl2_window_output_find(mEcoreWindow));
2654 mScreenRotationAngle = transform * 90;
2655 return mScreenRotationAngle;
2658 void WindowBaseEcoreWl2::SetWindowRotationAngle(int degree)
2660 mWindowRotationAngle = degree;
2661 ecore_wl2_window_rotation_set(mEcoreWindow, degree);
2664 void WindowBaseEcoreWl2::WindowRotationCompleted(int degree, int width, int height)
2666 ecore_wl2_window_rotation_change_done_send(mEcoreWindow, degree, width, height);
2669 void WindowBaseEcoreWl2::SetTransparency(bool transparent)
2671 ecore_wl2_window_alpha_set(mEcoreWindow, transparent);
2674 void WindowBaseEcoreWl2::CreateWindow(PositionSize positionSize)
2676 Ecore_Wl2_Display* display = ecore_wl2_display_connect(NULL);
2679 DALI_ASSERT_ALWAYS(0 && "Failed to get display");
2682 ecore_wl2_display_sync(display);
2684 mEcoreWindow = ecore_wl2_window_new(display, NULL, positionSize.x, positionSize.y, positionSize.width, positionSize.height);
2686 if(mEcoreWindow == 0)
2688 DALI_ASSERT_ALWAYS(0 && "Failed to create Wayland window");
2692 ecore_wl2_window_type_set(mEcoreWindow, ECORE_WL2_WINDOW_TYPE_TOPLEVEL);
2695 void WindowBaseEcoreWl2::SetParent(WindowBase* parentWinBase, bool belowParent)
2697 Ecore_Wl2_Window* ecoreParent = NULL;
2700 WindowBaseEcoreWl2* winBaseEcore2 = static_cast<WindowBaseEcoreWl2*>(parentWinBase);
2701 ecoreParent = winBaseEcore2->mEcoreWindow;
2703 ecore_wl2_window_transient_parent_set(mEcoreWindow, ecoreParent, belowParent);
2706 int WindowBaseEcoreWl2::CreateFrameRenderedSyncFence()
2708 return wl_egl_window_tizen_create_commit_sync_fd(mEglWindow);
2711 int WindowBaseEcoreWl2::CreateFramePresentedSyncFence()
2713 return wl_egl_window_tizen_create_presentation_sync_fd(mEglWindow);
2716 void WindowBaseEcoreWl2::SetPositionSizeWithAngle(PositionSize positionSize, int angle)
2718 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);
2719 ecore_wl2_window_rotation_geometry_set(mEcoreWindow, angle, positionSize.x, positionSize.y, positionSize.width, positionSize.height);
2722 void WindowBaseEcoreWl2::InitializeIme()
2724 Eina_Iterator* globals;
2725 struct wl_registry* registry;
2726 Ecore_Wl2_Global* global;
2727 Ecore_Wl2_Display* ecoreWl2Display;
2729 if(!(ecoreWl2Display = ecore_wl2_connected_display_get(NULL)))
2731 DALI_LOG_ERROR("WindowBaseEcoreWl2::InitializeIme(), fail to get ecore_wl2 connected display\n");
2735 DALI_LOG_RELEASE_INFO("InitializeIme: Ecore_Wl2_Display: %p, ecore wl window: %p\n", ecoreWl2Display, mEcoreWindow);
2737 if(!(registry = ecore_wl2_display_registry_get(ecoreWl2Display)))
2739 DALI_LOG_ERROR("WindowBaseEcoreWl2::InitializeIme(), fail to get ecore_wl2 display registry\n");
2743 if(!(globals = ecore_wl2_display_globals_get(ecoreWl2Display)))
2745 DALI_LOG_ERROR("WindowBaseEcoreWl2::InitializeIme(), fail to get ecore_wl2 globals\n");
2749 EINA_ITERATOR_FOREACH(globals, global)
2751 #ifdef OVER_TIZEN_VERSION_7
2752 if(strcmp(global->interface, "zwp_input_panel_v1") == 0)
2754 mWlInputPanel = (zwp_input_panel_v1*)wl_registry_bind(registry, global->id, &zwp_input_panel_v1_interface, 1);
2757 if(strcmp(global->interface, "wl_input_panel") == 0)
2759 mWlInputPanel = (wl_input_panel*)wl_registry_bind(registry, global->id, &wl_input_panel_interface, 1);
2762 else if(strcmp(global->interface, "wl_output") == 0)
2764 mWlOutput = (wl_output*)wl_registry_bind(registry, global->id, &wl_output_interface, 1);
2770 DALI_LOG_ERROR("WindowBaseEcoreWl2::InitializeIme(), fail to get wayland input panel interface\n");
2776 DALI_LOG_ERROR("WindowBaseEcoreWl2::InitializeIme(), fail to get wayland output panel interface\n");
2779 #ifdef OVER_TIZEN_VERSION_7
2780 mWlInputPanelSurface = zwp_input_panel_v1_get_input_panel_surface(mWlInputPanel, mWlSurface);
2782 mWlInputPanelSurface = wl_input_panel_get_input_panel_surface(mWlInputPanel, mWlSurface);
2784 if(!mWlInputPanelSurface)
2786 DALI_LOG_ERROR("WindowBaseEcoreWl2::InitializeIme(), fail to get wayland input panel surface\n");
2789 #ifdef OVER_TIZEN_VERSION_7
2790 zwp_input_panel_surface_v1_set_toplevel(mWlInputPanelSurface, mWlOutput, ZWP_INPUT_PANEL_SURFACE_V1_POSITION_CENTER_BOTTOM);
2792 wl_input_panel_surface_set_toplevel(mWlInputPanelSurface, mWlOutput, WL_INPUT_PANEL_SURFACE_POSITION_CENTER_BOTTOM);
2796 void WindowBaseEcoreWl2::ImeWindowReadyToRender()
2798 if(!mWlInputPanelSurface)
2800 DALI_LOG_ERROR("WindowBaseEcoreWl2::ImeWindowReadyToRender(), wayland input panel surface is null\n");
2803 #ifdef OVER_TIZEN_VERSION_7
2804 zwp_input_panel_surface_v1_set_ready(mWlInputPanelSurface, 1);
2806 wl_input_panel_surface_set_ready(mWlInputPanelSurface, 1);
2810 void WindowBaseEcoreWl2::RequestMoveToServer()
2812 Ecore_Wl2_Display* display = ecore_wl2_connected_display_get(NULL);
2815 DALI_LOG_ERROR("WindowBaseEcoreWl2::RequestMoveToServer, Fail to get ecore_wl2_display\n");
2819 Ecore_Wl2_Input* input = ecore_wl2_input_default_input_get(display);
2822 DALI_LOG_ERROR("WindowBaseEcoreWl2::RequestMoveToServer, Fail to get default Ecore_Wl2_Input\n");
2826 ecore_wl2_window_move(mEcoreWindow, input);
2827 DALI_LOG_RELEASE_INFO("WindowBaseEcoreWl2::RequestMoveToServer, starts the window[%p] is moved by server\n", mEcoreWindow);
2830 void WindowBaseEcoreWl2::RequestResizeToServer(WindowResizeDirection direction)
2832 Ecore_Wl2_Display* display = ecore_wl2_connected_display_get(NULL);
2835 DALI_LOG_ERROR("WindowBaseEcoreWl2::RequestResizeToServer, Fail to get ecore_wl2_display\n");
2839 Ecore_Wl2_Input* input = ecore_wl2_input_default_input_get(display);
2842 DALI_LOG_ERROR("WindowBaseEcoreWl2::RequestResizeToServer, Fail to get default Ecore_Wl2_Input\n");
2846 ResizeLocation location = RecalculateLocationToCurrentOrientation(direction, mWindowRotationAngle);
2848 ecore_wl2_window_resize(mEcoreWindow, input, static_cast<int>(location));
2849 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);
2852 void WindowBaseEcoreWl2::EnableFloatingMode(bool enable)
2854 DALI_LOG_RELEASE_INFO("WindowBaseEcoreWl2::EnableFloatingMode, floating mode flag: [%p], enable [%d]\n", mEcoreWindow, enable);
2857 ecore_wl2_window_floating_mode_set(mEcoreWindow, EINA_TRUE);
2861 ecore_wl2_window_floating_mode_set(mEcoreWindow, EINA_FALSE);
2865 bool WindowBaseEcoreWl2::IsFloatingModeEnabled() const
2867 return ecore_wl2_window_floating_mode_get(mEcoreWindow);
2870 void WindowBaseEcoreWl2::IncludeInputRegion(const Rect<int>& inputRegion)
2872 Eina_Rectangle rect;
2873 rect.x = inputRegion.x;
2874 rect.y = inputRegion.y;
2875 rect.w = inputRegion.width;
2876 rect.h = inputRegion.height;
2878 ecore_wl2_window_input_rect_add(mEcoreWindow, &rect);
2879 ecore_wl2_window_commit(mEcoreWindow, EINA_TRUE);
2882 void WindowBaseEcoreWl2::ExcludeInputRegion(const Rect<int>& inputRegion)
2884 Eina_Rectangle rect;
2885 rect.x = inputRegion.x;
2886 rect.y = inputRegion.y;
2887 rect.w = inputRegion.width;
2888 rect.h = inputRegion.height;
2890 ecore_wl2_window_input_rect_subtract(mEcoreWindow, &rect);
2891 ecore_wl2_window_commit(mEcoreWindow, EINA_TRUE);
2894 } // namespace Adaptor
2896 } // namespace Internal
2900 #pragma GCC diagnostic pop