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/public-api/adaptor-framework/window-enumerations.h>
35 #include <dali/public-api/events/mouse-button.h>
36 #include <dali/public-api/object/any.h>
38 #if defined(VCONF_ENABLED)
39 #include <vconf-keys.h>
43 #include <wayland-egl-tizen.h>
53 #if defined(DEBUG_ENABLED)
54 Debug::Filter* gWindowBaseLogFilter = Debug::Filter::New(Debug::NoLogging, false, "LOG_WINDOW_BASE");
57 const uint32_t MAX_TIZEN_CLIENT_VERSION = 7;
58 const unsigned int PRIMARY_TOUCH_BUTTON_ID = 1;
60 #if defined(VCONF_ENABLED)
61 const char* DALI_VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_NAME = "db/setting/accessibility/font_name"; // It will be update at vconf-key.h and replaced.
67 xkb_keycode_t keyCode;
72 * Get the device name from the provided ecore key event
74 void GetDeviceName(Ecore_Event_Key* keyEvent, std::string& result)
76 const char* ecoreDeviceName = ecore_device_name_get(keyEvent->dev);
80 result = ecoreDeviceName;
85 * Get the device class from the provided ecore event
87 void GetDeviceClass(Ecore_Device_Class ecoreDeviceClass, Device::Class::Type& deviceClass)
89 switch(ecoreDeviceClass)
91 case ECORE_DEVICE_CLASS_SEAT:
93 deviceClass = Device::Class::USER;
96 case ECORE_DEVICE_CLASS_KEYBOARD:
98 deviceClass = Device::Class::KEYBOARD;
101 case ECORE_DEVICE_CLASS_MOUSE:
103 deviceClass = Device::Class::MOUSE;
106 case ECORE_DEVICE_CLASS_TOUCH:
108 deviceClass = Device::Class::TOUCH;
111 case ECORE_DEVICE_CLASS_PEN:
113 deviceClass = Device::Class::PEN;
116 case ECORE_DEVICE_CLASS_POINTER:
118 deviceClass = Device::Class::POINTER;
121 case ECORE_DEVICE_CLASS_GAMEPAD:
123 deviceClass = Device::Class::GAMEPAD;
128 deviceClass = Device::Class::NONE;
134 void GetDeviceSubclass(Ecore_Device_Subclass ecoreDeviceSubclass, Device::Subclass::Type& deviceSubclass)
136 switch(ecoreDeviceSubclass)
138 case ECORE_DEVICE_SUBCLASS_FINGER:
140 deviceSubclass = Device::Subclass::FINGER;
143 case ECORE_DEVICE_SUBCLASS_FINGERNAIL:
145 deviceSubclass = Device::Subclass::FINGERNAIL;
148 case ECORE_DEVICE_SUBCLASS_KNUCKLE:
150 deviceSubclass = Device::Subclass::KNUCKLE;
153 case ECORE_DEVICE_SUBCLASS_PALM:
155 deviceSubclass = Device::Subclass::PALM;
158 case ECORE_DEVICE_SUBCLASS_HAND_SIZE:
160 deviceSubclass = Device::Subclass::HAND_SIDE;
163 case ECORE_DEVICE_SUBCLASS_HAND_FLAT:
165 deviceSubclass = Device::Subclass::HAND_FLAT;
168 case ECORE_DEVICE_SUBCLASS_PEN_TIP:
170 deviceSubclass = Device::Subclass::PEN_TIP;
173 case ECORE_DEVICE_SUBCLASS_TRACKPAD:
175 deviceSubclass = Device::Subclass::TRACKPAD;
178 case ECORE_DEVICE_SUBCLASS_TRACKPOINT:
180 deviceSubclass = Device::Subclass::TRACKPOINT;
183 case ECORE_DEVICE_SUBCLASS_TRACKBALL:
185 deviceSubclass = Device::Subclass::TRACKBALL;
188 case ECORE_DEVICE_SUBCLASS_REMOCON:
190 deviceSubclass = Device::Subclass::REMOCON;
193 case ECORE_DEVICE_SUBCLASS_VIRTUAL_KEYBOARD:
195 deviceSubclass = Device::Subclass::VIRTUAL_KEYBOARD;
200 deviceSubclass = Device::Subclass::NONE;
206 void FindKeyCode(struct xkb_keymap* keyMap, xkb_keycode_t key, void* data)
208 KeyCodeMap* foundKeyCode = static_cast<KeyCodeMap*>(data);
209 if(foundKeyCode->isKeyCode)
214 xkb_keysym_t keySym = foundKeyCode->keySym;
216 const xkb_keysym_t* symsOut = NULL;
218 nsyms = xkb_keymap_key_get_syms_by_level(keyMap, key, 0, 0, &symsOut);
222 if(*symsOut == keySym)
224 foundKeyCode->keyCode = key;
225 foundKeyCode->isKeyCode = true;
230 /////////////////////////////////////////////////////////////////////////////////////////////////
232 /////////////////////////////////////////////////////////////////////////////////////////////////
234 /// Called when the window iconify state is changed.
235 static Eina_Bool EcoreEventWindowIconifyStateChanged(void* data, int type, void* event)
237 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
240 return windowBase->OnIconifyStateChanged(data, type, event);
243 return ECORE_CALLBACK_PASS_ON;
246 /// Called when the window gains focus
247 static Eina_Bool EcoreEventWindowFocusIn(void* data, int type, void* event)
249 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
252 return windowBase->OnFocusIn(data, type, event);
255 return ECORE_CALLBACK_PASS_ON;
258 /// Called when the window loses focus
259 static Eina_Bool EcoreEventWindowFocusOut(void* data, int type, void* event)
261 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
264 return windowBase->OnFocusOut(data, type, event);
267 return ECORE_CALLBACK_PASS_ON;
270 /// Called when the output is transformed
271 static Eina_Bool EcoreEventOutputTransform(void* data, int type, void* event)
273 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
276 return windowBase->OnOutputTransform(data, type, event);
279 return ECORE_CALLBACK_PASS_ON;
282 /// Called when the output transform should be ignored
283 static Eina_Bool EcoreEventIgnoreOutputTransform(void* data, int type, void* event)
285 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
288 return windowBase->OnIgnoreOutputTransform(data, type, event);
291 return ECORE_CALLBACK_PASS_ON;
295 * Called when rotate event is recevied.
297 static Eina_Bool EcoreEventRotate(void* data, int type, void* event)
299 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
302 DALI_LOG_RELEASE_INFO("WindowBaseEcoreWl2::EcoreEventRotate\n");
303 windowBase->OnRotation(data, type, event);
305 return ECORE_CALLBACK_PASS_ON;
309 * Called when configure event is recevied.
311 static Eina_Bool EcoreEventConfigure(void* data, int type, void* event)
313 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
316 windowBase->OnConfiguration(data, type, event);
318 return ECORE_CALLBACK_PASS_ON;
321 /////////////////////////////////////////////////////////////////////////////////////////////////
323 /////////////////////////////////////////////////////////////////////////////////////////////////
326 * Called when a touch down is received.
328 static Eina_Bool EcoreEventMouseButtonDown(void* data, int type, void* event)
330 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
333 windowBase->OnMouseButtonDown(data, type, event);
335 return ECORE_CALLBACK_PASS_ON;
339 * Called when a touch up is received.
341 static Eina_Bool EcoreEventMouseButtonUp(void* data, int type, void* event)
343 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
346 windowBase->OnMouseButtonUp(data, type, event);
348 return ECORE_CALLBACK_PASS_ON;
352 * Called when a touch motion is received.
354 static Eina_Bool EcoreEventMouseButtonMove(void* data, int type, void* event)
356 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
359 windowBase->OnMouseButtonMove(data, type, event);
361 return ECORE_CALLBACK_PASS_ON;
365 * Called when a touch is canceled.
367 static Eina_Bool EcoreEventMouseButtonCancel(void* data, int type, void* event)
369 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
372 windowBase->OnMouseButtonCancel(data, type, event);
374 return ECORE_CALLBACK_PASS_ON;
378 * Called when a mouse wheel is received.
380 static Eina_Bool EcoreEventMouseWheel(void* data, int type, void* event)
382 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
385 windowBase->OnMouseWheel(data, type, event);
387 return ECORE_CALLBACK_PASS_ON;
391 * Called when a detent rotation event is recevied.
393 static Eina_Bool EcoreEventDetentRotation(void* data, int type, void* event)
395 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
398 windowBase->OnDetentRotation(data, type, event);
400 return ECORE_CALLBACK_PASS_ON;
403 /////////////////////////////////////////////////////////////////////////////////////////////////
405 /////////////////////////////////////////////////////////////////////////////////////////////////
408 * Called when a key down is received.
410 static Eina_Bool EcoreEventKeyDown(void* data, int type, void* event)
412 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
415 windowBase->OnKeyDown(data, type, event);
417 return ECORE_CALLBACK_PASS_ON;
421 * Called when a key up is received.
423 static Eina_Bool EcoreEventKeyUp(void* data, int type, void* event)
425 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
428 windowBase->OnKeyUp(data, type, event);
430 return ECORE_CALLBACK_PASS_ON;
433 /////////////////////////////////////////////////////////////////////////////////////////////////
434 // Selection Callbacks
435 /////////////////////////////////////////////////////////////////////////////////////////////////
438 * Called when the source window notifies us the content in clipboard is selected.
440 static Eina_Bool EcoreEventDataSend(void* data, int type, void* event)
442 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
445 windowBase->OnDataSend(data, type, event);
447 return ECORE_CALLBACK_PASS_ON;
451 * Called when the source window sends us about the selected content.
452 * For example, when item is selected in the clipboard.
454 static Eina_Bool EcoreEventDataReceive(void* data, int type, void* event)
456 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
459 windowBase->OnDataReceive(data, type, event);
461 return ECORE_CALLBACK_PASS_ON;
464 /////////////////////////////////////////////////////////////////////////////////////////////////
465 // Effect Start/End Callbacks
466 /////////////////////////////////////////////////////////////////////////////////////////////////
469 * Called when transition animation of the window's shown/hidden is started by window manager.
471 static Eina_Bool EcoreEventEffectStart(void* data, int type, void* event)
473 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
474 Ecore_Wl2_Event_Effect_Start* effectStart = static_cast<Ecore_Wl2_Event_Effect_Start*>(event);
475 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::EcoreEventEffectStart, effect type[ %d ]\n", effectStart->type);
478 if(effectStart->type < 3) // only under restack
480 windowBase->OnTransitionEffectEvent(WindowEffectState::START, static_cast<WindowEffectType>(effectStart->type));
483 return ECORE_CALLBACK_PASS_ON;
487 * Called when transition animation of the window's shown/hidden is ended by window manager.
489 static Eina_Bool EcoreEventEffectEnd(void* data, int type, void* event)
491 Ecore_Wl2_Event_Effect_Start* effectEnd = static_cast<Ecore_Wl2_Event_Effect_Start*>(event);
492 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
493 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::EcoreEventEffectEnd, effect type[ %d ]\n", effectEnd->type);
496 if(effectEnd->type < 3) // only under restack
498 windowBase->OnTransitionEffectEvent(WindowEffectState::END, static_cast<WindowEffectType>(effectEnd->type));
501 return ECORE_CALLBACK_PASS_ON;
504 /////////////////////////////////////////////////////////////////////////////////////////////////
505 // Keyboard Repeat Settings Changed Callbacks
506 /////////////////////////////////////////////////////////////////////////////////////////////////
508 static Eina_Bool EcoreEventSeatKeyboardRepeatChanged(void* data, int type, void* event)
510 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
511 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::EcoreEventSeatKeyboardRepeatChanged, id[ %d ]\n", static_cast<Ecore_Wl2_Event_Seat_Keyboard_Repeat_Changed*>(event)->id);
514 windowBase->OnKeyboardRepeatSettingsChanged();
517 return ECORE_CALLBACK_RENEW;
520 /////////////////////////////////////////////////////////////////////////////////////////////////
521 // Keymap Changed Callbacks
522 /////////////////////////////////////////////////////////////////////////////////////////////////
524 static Eina_Bool EcoreEventSeatKeymapChanged(void* data, int type, void* event)
526 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
529 windowBase->KeymapChanged(data, type, event);
532 return ECORE_CALLBACK_RENEW;
535 /////////////////////////////////////////////////////////////////////////////////////////////////
537 /////////////////////////////////////////////////////////////////////////////////////////////////
539 #if defined(VCONF_ENABLED)
541 * Called when a font name is changed.
543 static void VconfNotifyFontNameChanged(keynode_t* node, void* data)
545 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
548 windowBase->OnFontNameChanged();
553 * Called when a font size is changed.
555 static void VconfNotifyFontSizeChanged(keynode_t* node, void* data)
557 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
560 windowBase->OnFontSizeChanged();
565 /////////////////////////////////////////////////////////////////////////////////////////////////
566 // Window Redraw Request Event Callbacks
567 /////////////////////////////////////////////////////////////////////////////////////////////////
569 static Eina_Bool EcoreEventWindowRedrawRequest(void* data, int type, void* event)
571 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
572 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::EcoreEventWindowRedrawRequest, window[ %d ]\n", static_cast<Ecore_Wl2_Event_Window_Redraw_Request*>(event)->win);
575 windowBase->OnEcoreEventWindowRedrawRequest();
578 return ECORE_CALLBACK_RENEW;
581 /////////////////////////////////////////////////////////////////////////////////////////////////
582 // Window Auxiliary Message Callbacks
583 /////////////////////////////////////////////////////////////////////////////////////////////////
584 static Eina_Bool EcoreEventWindowAuxiliaryMessage(void* data, int type, void* event)
586 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
589 windowBase->OnEcoreEventWindowAuxiliaryMessage(event);
591 return ECORE_CALLBACK_RENEW;
594 static void RegistryGlobalCallback(void* data, struct wl_registry* registry, uint32_t name, const char* interface, uint32_t version)
596 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
599 windowBase->RegistryGlobalCallback(data, registry, name, interface, version);
603 static void RegistryGlobalCallbackRemove(void* data, struct wl_registry* registry, uint32_t id)
605 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
608 windowBase->RegistryGlobalCallbackRemove(data, registry, id);
612 static void TizenPolicyConformant(void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, uint32_t isConformant)
616 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)
620 static void TizenPolicyNotificationChangeDone(void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, int32_t level, uint32_t state)
622 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
625 windowBase->TizenPolicyNotificationChangeDone(data, tizenPolicy, surface, level, state);
629 static void TizenPolicyTransientForDone(void* data, struct tizen_policy* tizenPolicy, uint32_t childId)
633 static void TizenPolicyScreenModeChangeDone(void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, uint32_t mode, uint32_t state)
635 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
638 windowBase->TizenPolicyScreenModeChangeDone(data, tizenPolicy, surface, mode, state);
642 static void TizenPolicyIconifyStateChanged(void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, uint32_t iconified, uint32_t force)
646 static void TizenPolicySupportedAuxiliaryHints(void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, struct wl_array* hints, uint32_t numNints)
650 static void TizenPolicyAllowedAuxiliaryHint(void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, int id)
654 static void TizenPolicyAuxiliaryMessage(void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, const char* key, const char* val, struct wl_array* options)
658 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)
662 static void DisplayPolicyBrightnessChangeDone(void* data, struct tizen_display_policy* displayPolicy, struct wl_surface* surface, int32_t brightness, uint32_t state)
664 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
667 windowBase->DisplayPolicyBrightnessChangeDone(data, displayPolicy, surface, brightness, state);
671 const struct wl_registry_listener registryListener =
673 RegistryGlobalCallback,
674 RegistryGlobalCallbackRemove};
676 const struct tizen_policy_listener tizenPolicyListener =
678 TizenPolicyConformant,
679 TizenPolicyConformantArea,
680 TizenPolicyNotificationChangeDone,
681 TizenPolicyTransientForDone,
682 TizenPolicyScreenModeChangeDone,
683 TizenPolicyIconifyStateChanged,
684 TizenPolicySupportedAuxiliaryHints,
685 TizenPolicyAllowedAuxiliaryHint,
686 TizenPolicyAuxiliaryMessage,
687 TizenPolicyConformantRegion};
689 const struct tizen_display_policy_listener tizenDisplayPolicyListener =
691 DisplayPolicyBrightnessChangeDone};
693 } // unnamed namespace
695 WindowBaseEcoreWl2::WindowBaseEcoreWl2(Dali::PositionSize positionSize, Any surface, bool isTransparent)
696 : mEcoreEventHandler(),
697 mEcoreWindow(nullptr),
699 mWlInputPanel(nullptr),
701 mWlInputPanelSurface(nullptr),
704 mEventQueue(nullptr),
705 mTizenPolicy(nullptr),
706 mTizenDisplayPolicy(nullptr),
708 mSupportedAuxiliaryHints(),
709 mWindowPositionSize(positionSize),
711 mType(WindowType::NORMAL),
712 mNotificationLevel(-1),
715 mWindowRotationAngle(0),
716 mScreenRotationAngle(0),
717 mSupportedPreProtation(0),
720 mNotificationChangeState(0),
721 mScreenOffModeChangeState(0),
722 mBrightnessChangeState(0),
723 mLastSubmittedMoveResizeSerial(0),
724 mMoveResizeSerial(0),
725 mNotificationLevelChangeDone(true),
726 mScreenOffModeChangeDone(true),
729 mBrightnessChangeDone(true)
731 Initialize(positionSize, surface, isTransparent);
734 WindowBaseEcoreWl2::~WindowBaseEcoreWl2()
736 #if defined(VCONF_ENABLED)
737 vconf_ignore_key_changed(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, VconfNotifyFontSizeChanged);
738 vconf_ignore_key_changed(DALI_VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_NAME, VconfNotifyFontNameChanged);
741 for(Dali::Vector<Ecore_Event_Handler*>::Iterator iter = mEcoreEventHandler.Begin(), endIter = mEcoreEventHandler.End(); iter != endIter; ++iter)
743 ecore_event_handler_del(*iter);
745 mEcoreEventHandler.Clear();
749 wl_event_queue_destroy(mEventQueue);
752 mSupportedAuxiliaryHints.clear();
753 mAuxiliaryHints.clear();
755 if(mEglWindow != NULL)
757 wl_egl_window_destroy(mEglWindow);
763 ecore_wl2_window_free(mEcoreWindow);
765 WindowSystem::Shutdown();
769 void WindowBaseEcoreWl2::Initialize(PositionSize positionSize, Any surface, bool isTransparent)
771 if(surface.Empty() == false)
773 // check we have a valid type
774 DALI_ASSERT_ALWAYS((surface.GetType() == typeid(Ecore_Wl2_Window*)) && "Surface type is invalid");
776 mEcoreWindow = AnyCast<Ecore_Wl2_Window*>(surface);
780 // we own the surface about to created
781 WindowSystem::Initialize();
784 CreateWindow(positionSize);
787 mWlSurface = ecore_wl2_window_surface_get(mEcoreWindow);
789 SetTransparency(isTransparent);
791 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_WINDOW_ICONIFY_STATE_CHANGE, EcoreEventWindowIconifyStateChanged, this));
792 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_FOCUS_IN, EcoreEventWindowFocusIn, this));
793 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_FOCUS_OUT, EcoreEventWindowFocusOut, this));
794 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_OUTPUT_TRANSFORM, EcoreEventOutputTransform, this));
795 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_IGNORE_OUTPUT_TRANSFORM, EcoreEventIgnoreOutputTransform, this));
797 // Register Rotate event
798 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_WINDOW_ROTATE, EcoreEventRotate, this));
800 // Register Configure event
801 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_WINDOW_CONFIGURE, EcoreEventConfigure, this));
803 // Register Touch events
804 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_DOWN, EcoreEventMouseButtonDown, this));
805 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_UP, EcoreEventMouseButtonUp, this));
806 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_EVENT_MOUSE_MOVE, EcoreEventMouseButtonMove, this));
807 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_CANCEL, EcoreEventMouseButtonCancel, this));
809 // Register Mouse wheel events
810 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_EVENT_MOUSE_WHEEL, EcoreEventMouseWheel, this));
812 // Register Detent event
813 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_EVENT_DETENT_ROTATE, EcoreEventDetentRotation, this));
815 // Register Key events
816 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_EVENT_KEY_DOWN, EcoreEventKeyDown, this));
817 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_EVENT_KEY_UP, EcoreEventKeyUp, this));
819 // Register Selection event - clipboard selection
820 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_DATA_SOURCE_SEND, EcoreEventDataSend, this));
821 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_SELECTION_DATA_READY, EcoreEventDataReceive, this));
823 // Register Effect Start/End event
824 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_EFFECT_START, EcoreEventEffectStart, this));
825 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_EFFECT_END, EcoreEventEffectEnd, this));
827 // Register Keyboard repeat event
828 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_SEAT_KEYBOARD_REPEAT_CHANGED, EcoreEventSeatKeyboardRepeatChanged, this));
830 // Register Window redraw request event
831 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_WINDOW_REDRAW_REQUEST, EcoreEventWindowRedrawRequest, this));
833 // Register Window auxiliary event
834 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_AUX_MESSAGE, EcoreEventWindowAuxiliaryMessage, this));
836 #if defined(VCONF_ENABLED)
837 // Register Vconf notify - font name and size
838 vconf_notify_key_changed_for_ui_thread(DALI_VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_NAME, VconfNotifyFontNameChanged, this);
839 vconf_notify_key_changed_for_ui_thread(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, VconfNotifyFontSizeChanged, this);
842 Ecore_Wl2_Display* display = ecore_wl2_connected_display_get(NULL);
843 mDisplay = ecore_wl2_display_get(display);
847 wl_display* displayWrapper = static_cast<wl_display*>(wl_proxy_create_wrapper(mDisplay));
850 mEventQueue = wl_display_create_queue(mDisplay);
853 wl_proxy_set_queue(reinterpret_cast<wl_proxy*>(displayWrapper), mEventQueue);
855 wl_registry* registry = wl_display_get_registry(displayWrapper);
856 wl_registry_add_listener(registry, ®istryListener, this);
859 wl_proxy_wrapper_destroy(displayWrapper);
863 Ecore_Wl2_Input* ecoreWlInput = ecore_wl2_input_default_input_get(display);
867 mKeyMap = ecore_wl2_input_keymap_get(ecoreWlInput);
869 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_SEAT_KEYMAP_CHANGED, EcoreEventSeatKeymapChanged, this));
872 // get auxiliary hint
873 Eina_List* hints = ecore_wl2_window_aux_hints_supported_get(mEcoreWindow);
879 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))))
881 mSupportedAuxiliaryHints.push_back(hint);
883 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::Initialize: %s\n", hint);
888 Eina_Bool WindowBaseEcoreWl2::OnIconifyStateChanged(void* data, int type, void* event)
890 Ecore_Wl2_Event_Window_Iconify_State_Change* iconifyChangedEvent(static_cast<Ecore_Wl2_Event_Window_Iconify_State_Change*>(event));
891 Eina_Bool handled(ECORE_CALLBACK_PASS_ON);
893 if(iconifyChangedEvent->win == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
895 if(iconifyChangedEvent->iconified == EINA_TRUE)
897 mIconifyChangedSignal.Emit(true);
901 mIconifyChangedSignal.Emit(false);
903 handled = ECORE_CALLBACK_DONE;
909 Eina_Bool WindowBaseEcoreWl2::OnFocusIn(void* data, int type, void* event)
911 Ecore_Wl2_Event_Focus_In* focusInEvent(static_cast<Ecore_Wl2_Event_Focus_In*>(event));
913 if(focusInEvent->window == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
915 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "Window EcoreEventWindowFocusIn\n");
917 mFocusChangedSignal.Emit(true);
920 return ECORE_CALLBACK_PASS_ON;
923 Eina_Bool WindowBaseEcoreWl2::OnFocusOut(void* data, int type, void* event)
925 Ecore_Wl2_Event_Focus_Out* focusOutEvent(static_cast<Ecore_Wl2_Event_Focus_Out*>(event));
927 if(focusOutEvent->window == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
929 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "Window EcoreEventWindowFocusOut\n");
931 mFocusChangedSignal.Emit(false);
934 return ECORE_CALLBACK_PASS_ON;
937 Eina_Bool WindowBaseEcoreWl2::OnOutputTransform(void* data, int type, void* event)
939 Ecore_Wl2_Event_Output_Transform* transformEvent(static_cast<Ecore_Wl2_Event_Output_Transform*>(event));
941 if(transformEvent->output == ecore_wl2_window_output_find(mEcoreWindow))
943 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "Window (%p) EcoreEventOutputTransform\n", mEcoreWindow);
945 mScreenRotationAngle = GetScreenRotationAngle();
947 mOutputTransformedSignal.Emit();
950 return ECORE_CALLBACK_PASS_ON;
953 Eina_Bool WindowBaseEcoreWl2::OnIgnoreOutputTransform(void* data, int type, void* event)
955 Ecore_Wl2_Event_Ignore_Output_Transform* ignoreTransformEvent(static_cast<Ecore_Wl2_Event_Ignore_Output_Transform*>(event));
957 if(ignoreTransformEvent->win == mEcoreWindow)
959 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "Window (%p) EcoreEventIgnoreOutputTransform\n", mEcoreWindow);
961 mScreenRotationAngle = GetScreenRotationAngle();
963 mOutputTransformedSignal.Emit();
966 return ECORE_CALLBACK_PASS_ON;
969 void WindowBaseEcoreWl2::OnRotation(void* data, int type, void* event)
971 Ecore_Wl2_Event_Window_Rotation* ev(static_cast<Ecore_Wl2_Event_Window_Rotation*>(event));
973 if(ev->win == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
975 DALI_LOG_RELEASE_INFO("WindowBaseEcoreWl2::OnRotation, angle: %d, width: %d, height: %d\n", ev->angle, ev->w, ev->h);
977 RotationEvent rotationEvent;
978 rotationEvent.angle = ev->angle;
979 rotationEvent.winResize = 0;
981 if(ev->w == 0 || ev->h == 0)
983 // When rotation event does not have the window width or height,
984 // previous DALi side window's size are used.
985 ev->w = mWindowPositionSize.width;
986 ev->h = mWindowPositionSize.height;
989 mWindowRotationAngle = ev->angle;
991 mWindowPositionSize.width = ev->w;
992 mWindowPositionSize.height = ev->h;
994 PositionSize newPositionSize = RecalculatePositionSizeToCurrentOrientation(mWindowPositionSize);
996 rotationEvent.x = newPositionSize.x;
997 rotationEvent.y = newPositionSize.y;
998 rotationEvent.width = newPositionSize.width;
999 rotationEvent.height = newPositionSize.height;
1001 mRotationSignal.Emit(rotationEvent);
1005 void WindowBaseEcoreWl2::OnConfiguration(void* data, int type, void* event)
1007 Ecore_Wl2_Event_Window_Configure* ev(static_cast<Ecore_Wl2_Event_Window_Configure*>(event));
1009 if(ev && ev->win == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
1011 // Note: To comply with the wayland protocol, Dali should make an ack_configure
1012 // by calling ecore_wl2_window_commit
1014 int tempWidth = static_cast<int>(ev->w);
1015 int tempHeight = static_cast<int>(ev->h);
1017 // Initialize with previous size for skip resize when new size is 0.
1018 // When window is just moved or window is resized by client application,
1019 // The configure notification event's size will be 0.
1020 // If new size is 0, the resized work should be skip.
1021 int newWidth = mWindowPositionSize.width;
1022 int newHeight = mWindowPositionSize.height;
1023 bool windowMoved = false, windowResized = false;
1025 if(ev->x != mWindowPositionSize.x || ev->y != mWindowPositionSize.y)
1030 if(tempWidth != 0 && tempHeight != 0 && (tempWidth != mWindowPositionSize.width || tempHeight != mWindowPositionSize.height))
1032 windowResized = true;
1033 newWidth = tempWidth;
1034 newHeight = tempHeight;
1037 if(windowMoved || windowResized)
1039 mWindowPositionSize.x = ev->x;
1040 mWindowPositionSize.y = ev->y;
1041 mWindowPositionSize.width = newWidth;
1042 mWindowPositionSize.height = newHeight;
1043 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);
1045 ecore_wl2_window_geometry_set(mEcoreWindow, mWindowPositionSize.x, mWindowPositionSize.y, mWindowPositionSize.width, mWindowPositionSize.height);
1047 Dali::PositionSize newPositionSize = RecalculatePositionSizeToCurrentOrientation(mWindowPositionSize);
1048 DALI_LOG_RELEASE_INFO("emit signal to update window's position and size, x[%d] y[%d] w[%d] h[%d]\n", newPositionSize.x, newPositionSize.y, newPositionSize.width, newPositionSize.height);
1049 mUpdatePositionSizeSignal.Emit(newPositionSize);
1052 ecore_wl2_window_commit(mEcoreWindow, EINA_FALSE);
1056 void WindowBaseEcoreWl2::OnMouseButtonDown(void* data, int type, void* event)
1058 Ecore_Event_Mouse_Button* touchEvent = static_cast<Ecore_Event_Mouse_Button*>(event);
1060 if(touchEvent->window == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
1062 Device::Class::Type deviceClass;
1063 Device::Subclass::Type deviceSubclass;
1065 GetDeviceClass(ecore_device_class_get(touchEvent->dev), deviceClass);
1066 GetDeviceSubclass(ecore_device_subclass_get(touchEvent->dev), deviceSubclass);
1068 PointState::Type state(PointState::DOWN);
1070 if(deviceClass != Device::Class::Type::MOUSE)
1072 // Check if the buttons field is set and ensure it's the primary touch button.
1073 // If this event was triggered by buttons other than the primary button (used for touch), then
1074 // just send an interrupted event to Core.
1075 if(touchEvent->buttons && (touchEvent->buttons != PRIMARY_TOUCH_BUTTON_ID))
1077 state = PointState::INTERRUPTED;
1081 Integration::Point point;
1082 point.SetDeviceId(touchEvent->multi.device);
1083 point.SetState(state);
1084 point.SetScreenPosition(Vector2(touchEvent->x, touchEvent->y));
1085 point.SetRadius(touchEvent->multi.radius, Vector2(touchEvent->multi.radius_x, touchEvent->multi.radius_y));
1086 point.SetPressure(touchEvent->multi.pressure);
1087 point.SetAngle(Degree(touchEvent->multi.angle));
1088 point.SetDeviceClass(deviceClass);
1089 point.SetDeviceSubclass(deviceSubclass);
1090 point.SetMouseButton(static_cast<MouseButton::Type>(touchEvent->buttons));
1092 mTouchEventSignal.Emit(point, touchEvent->timestamp);
1096 void WindowBaseEcoreWl2::OnMouseButtonUp(void* data, int type, void* event)
1098 Ecore_Event_Mouse_Button* touchEvent = static_cast<Ecore_Event_Mouse_Button*>(event);
1100 if(touchEvent->window == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
1102 Device::Class::Type deviceClass;
1103 Device::Subclass::Type deviceSubclass;
1105 GetDeviceClass(ecore_device_class_get(touchEvent->dev), deviceClass);
1106 GetDeviceSubclass(ecore_device_subclass_get(touchEvent->dev), deviceSubclass);
1108 Integration::Point point;
1109 point.SetDeviceId(touchEvent->multi.device);
1110 point.SetState(PointState::UP);
1111 point.SetScreenPosition(Vector2(touchEvent->x, touchEvent->y));
1112 point.SetRadius(touchEvent->multi.radius, Vector2(touchEvent->multi.radius_x, touchEvent->multi.radius_y));
1113 point.SetPressure(touchEvent->multi.pressure);
1114 point.SetAngle(Degree(touchEvent->multi.angle));
1115 point.SetDeviceClass(deviceClass);
1116 point.SetDeviceSubclass(deviceSubclass);
1117 point.SetMouseButton(static_cast<MouseButton::Type>(touchEvent->buttons));
1119 mTouchEventSignal.Emit(point, touchEvent->timestamp);
1123 void WindowBaseEcoreWl2::OnMouseButtonMove(void* data, int type, void* event)
1125 Ecore_Event_Mouse_Move* touchEvent = static_cast<Ecore_Event_Mouse_Move*>(event);
1127 if(touchEvent->window == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
1129 Device::Class::Type deviceClass;
1130 Device::Subclass::Type deviceSubclass;
1132 GetDeviceClass(ecore_device_class_get(touchEvent->dev), deviceClass);
1133 GetDeviceSubclass(ecore_device_subclass_get(touchEvent->dev), deviceSubclass);
1135 Integration::Point point;
1136 point.SetDeviceId(touchEvent->multi.device);
1137 point.SetState(PointState::MOTION);
1138 point.SetScreenPosition(Vector2(touchEvent->x, touchEvent->y));
1139 point.SetRadius(touchEvent->multi.radius, Vector2(touchEvent->multi.radius_x, touchEvent->multi.radius_y));
1140 point.SetPressure(touchEvent->multi.pressure);
1141 point.SetAngle(Degree(touchEvent->multi.angle));
1142 point.SetDeviceClass(deviceClass);
1143 point.SetDeviceSubclass(deviceSubclass);
1145 mTouchEventSignal.Emit(point, touchEvent->timestamp);
1149 void WindowBaseEcoreWl2::OnMouseButtonCancel(void* data, int type, void* event)
1151 Ecore_Event_Mouse_Button* touchEvent = static_cast<Ecore_Event_Mouse_Button*>(event);
1153 if(touchEvent->window == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
1155 Integration::Point point;
1156 point.SetDeviceId(touchEvent->multi.device);
1157 point.SetState(PointState::INTERRUPTED);
1158 point.SetScreenPosition(Vector2(0.0f, 0.0f));
1160 mTouchEventSignal.Emit(point, touchEvent->timestamp);
1162 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::OnMouseButtonCancel\n");
1166 void WindowBaseEcoreWl2::OnMouseWheel(void* data, int type, void* event)
1168 Ecore_Event_Mouse_Wheel* mouseWheelEvent = static_cast<Ecore_Event_Mouse_Wheel*>(event);
1170 if(mouseWheelEvent->window == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
1172 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);
1174 Integration::WheelEvent wheelEvent(Integration::WheelEvent::MOUSE_WHEEL, mouseWheelEvent->direction, mouseWheelEvent->modifiers, Vector2(mouseWheelEvent->x, mouseWheelEvent->y), mouseWheelEvent->z, mouseWheelEvent->timestamp);
1176 mWheelEventSignal.Emit(wheelEvent);
1180 void WindowBaseEcoreWl2::OnDetentRotation(void* data, int type, void* event)
1182 Ecore_Event_Detent_Rotate* detentEvent = static_cast<Ecore_Event_Detent_Rotate*>(event);
1184 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Concise, "WindowBaseEcoreWl2::OnDetentRotation\n");
1186 int32_t clockwise = (detentEvent->direction == ECORE_DETENT_DIRECTION_CLOCKWISE) ? 1 : -1;
1188 Integration::WheelEvent wheelEvent(Integration::WheelEvent::CUSTOM_WHEEL, detentEvent->direction, 0, Vector2(0.0f, 0.0f), clockwise, detentEvent->timestamp);
1190 mWheelEventSignal.Emit(wheelEvent);
1193 void WindowBaseEcoreWl2::OnKeyDown(void* data, int type, void* event)
1195 Ecore_Event_Key* keyEvent = static_cast<Ecore_Event_Key*>(event);
1197 if(keyEvent->window == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
1199 std::string keyName(keyEvent->keyname);
1200 std::string logicalKey("");
1201 std::string keyString("");
1202 std::string compose("");
1204 DALI_LOG_RELEASE_INFO("OnKeyDown Start [%s]\n", keyName.c_str());
1206 // Ensure key compose string is not NULL as keys like SHIFT or arrow have a null string.
1207 if(keyEvent->compose)
1209 compose = keyEvent->compose;
1212 // Ensure key symbol is not NULL as keys like SHIFT have a null string.
1215 logicalKey = keyEvent->key;
1219 GetKeyCode(keyName, keyCode); // Get key code dynamically.
1223 // Get a specific key code from dali key look up table.
1224 keyCode = KeyLookup::GetDaliKeyCode(keyEvent->keyname);
1227 keyCode = (keyCode == -1) ? 0 : keyCode;
1228 int modifier(keyEvent->modifiers);
1229 unsigned long time = keyEvent->timestamp;
1230 if(!strncmp(keyEvent->keyname, "Keycode-", 8))
1232 keyCode = atoi(keyEvent->keyname + 8);
1235 // Ensure key event string is not NULL as keys like SHIFT have a null string.
1236 if(keyEvent->string)
1238 keyString = keyEvent->string;
1241 std::string deviceName;
1242 Device::Class::Type deviceClass;
1243 Device::Subclass::Type deviceSubclass;
1245 GetDeviceName(keyEvent, deviceName);
1246 GetDeviceClass(ecore_device_class_get(keyEvent->dev), deviceClass);
1247 GetDeviceSubclass(ecore_device_subclass_get(keyEvent->dev), deviceSubclass);
1249 Integration::KeyEvent keyEvent(keyName, logicalKey, keyString, keyCode, modifier, time, Integration::KeyEvent::DOWN, compose, deviceName, deviceClass, deviceSubclass);
1251 mKeyEventSignal.Emit(keyEvent);
1253 DALI_LOG_RELEASE_INFO("OnKeyDown End [%s]\n", keyName.c_str());
1257 void WindowBaseEcoreWl2::OnKeyUp(void* data, int type, void* event)
1259 Ecore_Event_Key* keyEvent = static_cast<Ecore_Event_Key*>(event);
1261 if(keyEvent->window == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
1263 #if defined(ECORE_VERSION_MAJOR) && (ECORE_VERSION_MAJOR >= 1) && defined(ECORE_VERSION_MINOR) && (ECORE_VERSION_MINOR >= 23)
1264 // Cancel processing flag is sent because this key event will combine with the previous key. So, the event should not actually perform anything.
1265 if(keyEvent->event_flags & ECORE_EVENT_FLAG_CANCEL)
1267 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::OnKeyUp: This event flag indicates the event is canceled. \n");
1270 #endif // Since ecore 1.23 version
1272 std::string keyName(keyEvent->keyname);
1273 std::string logicalKey("");
1274 std::string keyString("");
1275 std::string compose("");
1277 DALI_LOG_RELEASE_INFO("OnKeyUp Start [%s]\n", keyName.c_str());
1279 // Ensure key compose string is not NULL as keys like SHIFT or arrow have a null string.
1280 if(keyEvent->compose)
1282 compose = keyEvent->compose;
1285 // Ensure key symbol is not NULL as keys like SHIFT have a null string.
1288 logicalKey = keyEvent->key;
1292 GetKeyCode(keyName, keyCode); // Get key code dynamically.
1296 // Get a specific key code from dali key look up table.
1297 keyCode = KeyLookup::GetDaliKeyCode(keyEvent->keyname);
1300 keyCode = (keyCode == -1) ? 0 : keyCode;
1301 int modifier(keyEvent->modifiers);
1302 unsigned long time = keyEvent->timestamp;
1303 if(!strncmp(keyEvent->keyname, "Keycode-", 8))
1305 keyCode = atoi(keyEvent->keyname + 8);
1308 // Ensure key event string is not NULL as keys like SHIFT have a null string.
1309 if(keyEvent->string)
1311 keyString = keyEvent->string;
1314 std::string deviceName;
1315 Device::Class::Type deviceClass;
1316 Device::Subclass::Type deviceSubclass;
1318 GetDeviceName(keyEvent, deviceName);
1319 GetDeviceClass(ecore_device_class_get(keyEvent->dev), deviceClass);
1320 GetDeviceSubclass(ecore_device_subclass_get(keyEvent->dev), deviceSubclass);
1322 Integration::KeyEvent keyEvent(keyName, logicalKey, keyString, keyCode, modifier, time, Integration::KeyEvent::UP, compose, deviceName, deviceClass, deviceSubclass);
1324 mKeyEventSignal.Emit(keyEvent);
1326 DALI_LOG_RELEASE_INFO("OnKeyUp End [%s]\n", keyName.c_str());
1330 void WindowBaseEcoreWl2::OnDataSend(void* data, int type, void* event)
1332 mSelectionDataSendSignal.Emit(event);
1335 void WindowBaseEcoreWl2::OnDataReceive(void* data, int type, void* event)
1337 mSelectionDataReceivedSignal.Emit(event);
1340 void WindowBaseEcoreWl2::OnFontNameChanged()
1342 mStyleChangedSignal.Emit(StyleChange::DEFAULT_FONT_CHANGE);
1345 void WindowBaseEcoreWl2::OnFontSizeChanged()
1347 mStyleChangedSignal.Emit(StyleChange::DEFAULT_FONT_SIZE_CHANGE);
1350 void WindowBaseEcoreWl2::OnTransitionEffectEvent(WindowEffectState state, WindowEffectType type)
1352 mTransitionEffectEventSignal.Emit(state, type);
1355 void WindowBaseEcoreWl2::OnKeyboardRepeatSettingsChanged()
1357 mKeyboardRepeatSettingsChangedSignal.Emit();
1360 void WindowBaseEcoreWl2::OnEcoreEventWindowRedrawRequest()
1362 mWindowRedrawRequestSignal.Emit();
1365 void WindowBaseEcoreWl2::OnEcoreEventWindowAuxiliaryMessage(void* event)
1367 Ecore_Wl2_Event_Aux_Message* message = static_cast<Ecore_Wl2_Event_Aux_Message*>(event);
1370 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::OnEcoreEventWindowAuxiliaryMessage, key:%s, value:%s \n", message->key, message->val);
1371 std::string key(message->key);
1372 std::string value(message->val);
1373 Dali::Property::Array options;
1375 if(message->options)
1379 EINA_LIST_FOREACH(message->options, l, data)
1381 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::OnEcoreEventWindowAuxiliaryMessage, option: %s\n", (char*)data);
1382 std::string option(static_cast<char*>(data));
1383 options.Add(option);
1387 mAuxiliaryMessageSignal.Emit(key, value, options);
1391 void WindowBaseEcoreWl2::KeymapChanged(void* data, int type, void* event)
1393 Ecore_Wl2_Event_Seat_Keymap_Changed* changed = static_cast<Ecore_Wl2_Event_Seat_Keymap_Changed*>(event);
1394 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::KeymapChanged, keymap id[ %d ]\n", changed->id);
1395 Ecore_Wl2_Input* ecoreWlInput = ecore_wl2_input_default_input_get(changed->display);
1398 mKeyMap = ecore_wl2_input_keymap_get(ecoreWlInput);
1402 void WindowBaseEcoreWl2::RegistryGlobalCallback(void* data, struct wl_registry* registry, uint32_t name, const char* interface, uint32_t version)
1404 if(strcmp(interface, tizen_policy_interface.name) == 0)
1406 uint32_t clientVersion = std::min(version, MAX_TIZEN_CLIENT_VERSION);
1408 mTizenPolicy = static_cast<tizen_policy*>(wl_registry_bind(registry, name, &tizen_policy_interface, clientVersion));
1411 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::RegistryGlobalCallback: wl_registry_bind(tizen_policy_interface) is failed.\n");
1415 tizen_policy_add_listener(mTizenPolicy, &tizenPolicyListener, data);
1417 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::RegistryGlobalCallback: tizen_policy_add_listener is called.\n");
1419 else if(strcmp(interface, tizen_display_policy_interface.name) == 0)
1421 mTizenDisplayPolicy = static_cast<tizen_display_policy*>(wl_registry_bind(registry, name, &tizen_display_policy_interface, version));
1422 if(!mTizenDisplayPolicy)
1424 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::RegistryGlobalCallback: wl_registry_bind(tizen_display_policy_interface) is failed.\n");
1428 tizen_display_policy_add_listener(mTizenDisplayPolicy, &tizenDisplayPolicyListener, data);
1430 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::RegistryGlobalCallback: tizen_display_policy_add_listener is called.\n");
1434 void WindowBaseEcoreWl2::RegistryGlobalCallbackRemove(void* data, struct wl_registry* registry, uint32_t id)
1436 mTizenPolicy = NULL;
1437 mTizenDisplayPolicy = NULL;
1440 void WindowBaseEcoreWl2::TizenPolicyNotificationChangeDone(void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, int32_t level, uint32_t state)
1442 mNotificationLevel = level;
1443 mNotificationChangeState = state;
1444 mNotificationLevelChangeDone = true;
1446 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::TizenPolicyNotificationChangeDone: level = %d, state = %d\n", level, state);
1449 void WindowBaseEcoreWl2::TizenPolicyScreenModeChangeDone(void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, uint32_t mode, uint32_t state)
1451 mScreenOffMode = mode;
1452 mScreenOffModeChangeState = state;
1453 mScreenOffModeChangeDone = true;
1455 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::TizenPolicyScreenModeChangeDone: mode = %d, state = %d\n", mode, state);
1458 void WindowBaseEcoreWl2::DisplayPolicyBrightnessChangeDone(void* data, struct tizen_display_policy* displayPolicy, struct wl_surface* surface, int32_t brightness, uint32_t state)
1460 mBrightness = brightness;
1461 mBrightnessChangeState = state;
1462 mBrightnessChangeDone = true;
1464 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::DisplayPolicyBrightnessChangeDone: brightness = %d, state = %d\n", brightness, state);
1467 void WindowBaseEcoreWl2::GetKeyCode(std::string keyName, int32_t& keyCode)
1469 xkb_keysym_t sym = XKB_KEY_NoSymbol;
1470 KeyCodeMap foundKeyCode;
1472 sym = xkb_keysym_from_name(keyName.c_str(), XKB_KEYSYM_NO_FLAGS);
1473 if(sym == XKB_KEY_NoSymbol)
1475 DALI_LOG_ERROR("Failed to get keysym in WindowBaseEcoreWl2\n");
1479 foundKeyCode.keySym = sym;
1480 foundKeyCode.isKeyCode = false;
1481 xkb_keymap_key_for_each(mKeyMap, FindKeyCode, &foundKeyCode);
1482 keyCode = static_cast<int32_t>(foundKeyCode.keyCode);
1485 Any WindowBaseEcoreWl2::GetNativeWindow()
1487 return mEcoreWindow;
1490 int WindowBaseEcoreWl2::GetNativeWindowId()
1492 return ecore_wl2_window_id_get(mEcoreWindow);
1495 std::string WindowBaseEcoreWl2::GetNativeWindowResourceId()
1497 #ifdef OVER_TIZEN_VERSION_7
1498 return std::to_string(ecore_wl2_window_resource_id_get(mEcoreWindow));
1500 return std::string();
1504 EGLNativeWindowType WindowBaseEcoreWl2::CreateEglWindow(int width, int height)
1506 int totalAngle = (mWindowRotationAngle + mScreenRotationAngle) % 360;
1507 if(totalAngle == 90 || totalAngle == 270)
1509 mEglWindow = wl_egl_window_create(mWlSurface, height, width);
1513 mEglWindow = wl_egl_window_create(mWlSurface, width, height);
1516 return static_cast<EGLNativeWindowType>(mEglWindow);
1519 void WindowBaseEcoreWl2::DestroyEglWindow()
1521 if(mEglWindow != NULL)
1523 wl_egl_window_destroy(mEglWindow);
1528 void WindowBaseEcoreWl2::SetEglWindowRotation(int angle)
1530 wl_egl_window_tizen_rotation rotation;
1536 rotation = WL_EGL_WINDOW_TIZEN_ROTATION_0;
1541 rotation = WL_EGL_WINDOW_TIZEN_ROTATION_270;
1546 rotation = WL_EGL_WINDOW_TIZEN_ROTATION_180;
1551 rotation = WL_EGL_WINDOW_TIZEN_ROTATION_90;
1556 rotation = WL_EGL_WINDOW_TIZEN_ROTATION_0;
1561 wl_egl_window_tizen_set_rotation(mEglWindow, rotation);
1564 void WindowBaseEcoreWl2::SetEglWindowBufferTransform(int angle)
1566 wl_output_transform bufferTransform;
1572 bufferTransform = WL_OUTPUT_TRANSFORM_NORMAL;
1577 bufferTransform = WL_OUTPUT_TRANSFORM_90;
1582 bufferTransform = WL_OUTPUT_TRANSFORM_180;
1587 bufferTransform = WL_OUTPUT_TRANSFORM_270;
1592 bufferTransform = WL_OUTPUT_TRANSFORM_NORMAL;
1597 wl_egl_window_tizen_set_buffer_transform(mEglWindow, bufferTransform);
1600 void WindowBaseEcoreWl2::SetEglWindowTransform(int angle)
1602 wl_output_transform windowTransform;
1608 windowTransform = WL_OUTPUT_TRANSFORM_NORMAL;
1613 windowTransform = WL_OUTPUT_TRANSFORM_90;
1618 windowTransform = WL_OUTPUT_TRANSFORM_180;
1623 windowTransform = WL_OUTPUT_TRANSFORM_270;
1628 windowTransform = WL_OUTPUT_TRANSFORM_NORMAL;
1633 wl_egl_window_tizen_set_window_transform(mEglWindow, windowTransform);
1636 void WindowBaseEcoreWl2::ResizeEglWindow(PositionSize positionSize)
1638 wl_egl_window_resize(mEglWindow, positionSize.width, positionSize.height, positionSize.x, positionSize.y);
1640 // Note: Both "Resize" and "MoveResize" cases can reach here, but only "MoveResize" needs to submit serial number
1641 if(mMoveResizeSerial != mLastSubmittedMoveResizeSerial)
1643 wl_egl_window_tizen_set_window_serial(mEglWindow, mMoveResizeSerial);
1644 mLastSubmittedMoveResizeSerial = mMoveResizeSerial;
1648 bool WindowBaseEcoreWl2::IsEglWindowRotationSupported()
1651 wl_egl_window_tizen_capability capability = static_cast<wl_egl_window_tizen_capability>(wl_egl_window_tizen_get_capabilities(mEglWindow));
1652 if(capability == WL_EGL_WINDOW_TIZEN_CAPABILITY_ROTATION_SUPPORTED)
1654 mSupportedPreProtation = true;
1657 mSupportedPreProtation = false;
1661 PositionSize WindowBaseEcoreWl2::RecalculatePositionSizeToSystem(PositionSize positionSize)
1663 PositionSize newPositionSize;
1665 if(mWindowRotationAngle == 90)
1667 newPositionSize.x = positionSize.y;
1668 newPositionSize.y = mScreenHeight - (positionSize.x + positionSize.width);
1669 newPositionSize.width = positionSize.height;
1670 newPositionSize.height = positionSize.width;
1672 else if(mWindowRotationAngle == 180)
1674 newPositionSize.x = mScreenWidth - (positionSize.x + positionSize.width);
1675 newPositionSize.y = mScreenHeight - (positionSize.y + positionSize.height);
1676 newPositionSize.width = positionSize.width;
1677 newPositionSize.height = positionSize.height;
1679 else if(mWindowRotationAngle == 270)
1681 newPositionSize.x = mScreenWidth - (positionSize.y + positionSize.height);
1682 newPositionSize.y = positionSize.x;
1683 newPositionSize.width = positionSize.height;
1684 newPositionSize.height = positionSize.width;
1688 newPositionSize.x = positionSize.x;
1689 newPositionSize.y = positionSize.y;
1690 newPositionSize.width = positionSize.width;
1691 newPositionSize.height = positionSize.height;
1694 DALI_LOG_RELEASE_INFO("input coord x[%d], y[%d], w{%d], h[%d], screen w[%d], h[%d]\n", positionSize.x, positionSize.y, positionSize.width, positionSize.height, mScreenWidth, mScreenHeight);
1695 DALI_LOG_RELEASE_INFO("recalc coord x[%d], y[%d], w{%d], h[%d]\n", newPositionSize.x, newPositionSize.y, newPositionSize.width, newPositionSize.height);
1697 return newPositionSize;
1700 PositionSize WindowBaseEcoreWl2::RecalculatePositionSizeToCurrentOrientation(PositionSize positionSize)
1702 PositionSize newPositionSize;
1704 if(mWindowRotationAngle == 90)
1706 newPositionSize.x = mScreenHeight - (positionSize.y + positionSize.height);
1707 newPositionSize.y = positionSize.x;
1708 newPositionSize.width = positionSize.height;
1709 newPositionSize.height = positionSize.width;
1711 else if(mWindowRotationAngle == 180)
1713 newPositionSize.x = mScreenWidth - (positionSize.x + positionSize.width);
1714 newPositionSize.y = mScreenHeight - (positionSize.y + positionSize.height);
1715 newPositionSize.width = positionSize.width;
1716 newPositionSize.height = positionSize.height;
1718 else if(mWindowRotationAngle == 270)
1720 newPositionSize.x = positionSize.y;
1721 newPositionSize.y = mScreenWidth - (positionSize.x + positionSize.width);
1722 newPositionSize.width = positionSize.height;
1723 newPositionSize.height = positionSize.width;
1727 newPositionSize.x = positionSize.x;
1728 newPositionSize.y = positionSize.y;
1729 newPositionSize.width = positionSize.width;
1730 newPositionSize.height = positionSize.height;
1733 DALI_LOG_RELEASE_INFO("input coord x[%d], y[%d], w{%d], h[%d], screen w[%d], h[%d]\n", positionSize.x, positionSize.y, positionSize.width, positionSize.height, mScreenWidth, mScreenHeight);
1734 DALI_LOG_RELEASE_INFO("recalc by current orientation coord x[%d], y[%d], w{%d], h[%d]\n", newPositionSize.x, newPositionSize.y, newPositionSize.width, newPositionSize.height);
1736 return newPositionSize;
1739 void WindowBaseEcoreWl2::Move(PositionSize positionSize)
1741 PositionSize newPositionSize = RecalculatePositionSizeToSystem(positionSize);
1743 mWindowPositionSize = newPositionSize;
1744 DALI_LOG_RELEASE_INFO("ecore_wl2_window_position_set x[%d], y[%d]\n", newPositionSize.x, newPositionSize.y);
1745 ecore_wl2_window_position_set(mEcoreWindow, newPositionSize.x, newPositionSize.y);
1748 void WindowBaseEcoreWl2::Resize(PositionSize positionSize)
1750 PositionSize newPositionSize = RecalculatePositionSizeToSystem(positionSize);
1752 mWindowPositionSize = newPositionSize;
1753 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);
1754 ecore_wl2_window_sync_geometry_set(mEcoreWindow, ++mMoveResizeSerial, newPositionSize.x, newPositionSize.y, newPositionSize.width, newPositionSize.height);
1757 void WindowBaseEcoreWl2::MoveResize(PositionSize positionSize)
1759 PositionSize newPositionSize = RecalculatePositionSizeToSystem(positionSize);
1761 mWindowPositionSize = newPositionSize;
1762 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);
1763 ecore_wl2_window_sync_geometry_set(mEcoreWindow, ++mMoveResizeSerial, newPositionSize.x, newPositionSize.y, newPositionSize.width, newPositionSize.height);
1766 void WindowBaseEcoreWl2::SetClass(const std::string& name, const std::string& className)
1768 ecore_wl2_window_title_set(mEcoreWindow, name.c_str());
1769 ecore_wl2_window_class_set(mEcoreWindow, className.c_str());
1772 void WindowBaseEcoreWl2::Raise()
1774 // Use ecore_wl2_window_activate to prevent the window shown without rendering
1775 ecore_wl2_window_activate(mEcoreWindow);
1778 void WindowBaseEcoreWl2::Lower()
1780 ecore_wl2_window_lower(mEcoreWindow);
1783 void WindowBaseEcoreWl2::Activate()
1785 ecore_wl2_window_activate(mEcoreWindow);
1788 void WindowBaseEcoreWl2::Maximize(bool maximize)
1790 ecore_wl2_window_maximized_set(mEcoreWindow, maximize);
1793 bool WindowBaseEcoreWl2::IsMaximized() const
1795 return ecore_wl2_window_maximized_get(mEcoreWindow);
1798 void WindowBaseEcoreWl2::SetMaximumSize(Dali::Window::WindowSize size)
1800 DALI_LOG_RELEASE_INFO("ecore_wl2_window_maximum_size_set, width: %d, height: %d\n", size.GetWidth(), size.GetHeight());
1801 ecore_wl2_window_maximum_size_set(mEcoreWindow, size.GetWidth(), size.GetHeight());
1804 void WindowBaseEcoreWl2::Minimize(bool minimize)
1806 ecore_wl2_window_iconified_set(mEcoreWindow, minimize);
1809 bool WindowBaseEcoreWl2::IsMinimized() const
1811 return ecore_wl2_window_iconified_get(mEcoreWindow);
1814 void WindowBaseEcoreWl2::SetMimimumSize(Dali::Window::WindowSize size)
1816 DALI_LOG_RELEASE_INFO("ecore_wl2_window_minimum_size_set, width: %d, height: %d\n", size.GetWidth(), size.GetHeight());
1817 ecore_wl2_window_minimum_size_set(mEcoreWindow, size.GetWidth(), size.GetHeight());
1820 void WindowBaseEcoreWl2::SetAvailableAnlges(const std::vector<int>& angles)
1822 int rotations[4] = {0};
1823 DALI_LOG_RELEASE_INFO("WindowBaseEcoreWl2::SetAvailableAnlges, angle's count: %d, angles\n", angles.size());
1824 for(std::size_t i = 0; i < angles.size(); ++i)
1826 rotations[i] = static_cast<int>(angles[i]);
1827 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "%d ", rotations[i]);
1829 ecore_wl2_window_available_rotations_set(mEcoreWindow, rotations, angles.size());
1832 void WindowBaseEcoreWl2::SetPreferredAngle(int angle)
1834 DALI_LOG_RELEASE_INFO("WindowBaseEcoreWl2::SetPreferredAngle, angle: %d\n", angle);
1835 ecore_wl2_window_preferred_rotation_set(mEcoreWindow, angle);
1838 void WindowBaseEcoreWl2::SetAcceptFocus(bool accept)
1840 ecore_wl2_window_focus_skip_set(mEcoreWindow, !accept);
1843 void WindowBaseEcoreWl2::Show()
1847 ecore_wl2_window_geometry_set(mEcoreWindow, mWindowPositionSize.x, mWindowPositionSize.y, mWindowPositionSize.width, mWindowPositionSize.height);
1851 ecore_wl2_window_show(mEcoreWindow);
1854 void WindowBaseEcoreWl2::Hide()
1857 ecore_wl2_window_hide(mEcoreWindow);
1860 unsigned int WindowBaseEcoreWl2::GetSupportedAuxiliaryHintCount() const
1862 return mSupportedAuxiliaryHints.size();
1865 std::string WindowBaseEcoreWl2::GetSupportedAuxiliaryHint(unsigned int index) const
1867 if(index >= GetSupportedAuxiliaryHintCount())
1869 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetSupportedAuxiliaryHint: Invalid index! [%d]\n", index);
1872 return mSupportedAuxiliaryHints[index];
1875 unsigned int WindowBaseEcoreWl2::AddAuxiliaryHint(const std::string& hint, const std::string& value)
1877 bool supported = false;
1879 // Check if the hint is suppported
1880 for(std::vector<std::string>::iterator iter = mSupportedAuxiliaryHints.begin(); iter != mSupportedAuxiliaryHints.end(); ++iter)
1891 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Concise, "WindowBaseEcoreWl2::AddAuxiliaryHint: Not supported auxiliary hint [%s]\n", hint.c_str());
1895 // Check if the hint is already added
1896 for(unsigned int i = 0; i < mAuxiliaryHints.size(); i++)
1898 if(mAuxiliaryHints[i].first == hint)
1900 // Just change the value
1901 mAuxiliaryHints[i].second = value;
1903 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::AddAuxiliaryHint: Change! hint = %s, value = %s, id = %d\n", hint.c_str(), value.c_str(), i + 1);
1905 return i + 1; // id is index + 1
1910 mAuxiliaryHints.push_back(std::pair<std::string, std::string>(hint, value));
1912 unsigned int id = mAuxiliaryHints.size();
1914 ecore_wl2_window_aux_hint_add(mEcoreWindow, static_cast<int>(id), hint.c_str(), value.c_str());
1916 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::AddAuxiliaryHint: hint = %s, value = %s, id = %d\n", hint.c_str(), value.c_str(), id);
1921 bool WindowBaseEcoreWl2::RemoveAuxiliaryHint(unsigned int id)
1923 if(id == 0 || id > mAuxiliaryHints.size())
1925 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Concise, "WindowBaseEcoreWl2::RemoveAuxiliaryHint: Invalid id [%d]\n", id);
1929 mAuxiliaryHints[id - 1].second = std::string();
1931 ecore_wl2_window_aux_hint_del(mEcoreWindow, static_cast<int>(id));
1933 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::RemoveAuxiliaryHint: id = %d, hint = %s\n", id, mAuxiliaryHints[id - 1].first.c_str());
1938 bool WindowBaseEcoreWl2::SetAuxiliaryHintValue(unsigned int id, const std::string& value)
1940 if(id == 0 || id > mAuxiliaryHints.size())
1942 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Concise, "WindowBaseEcoreWl2::SetAuxiliaryHintValue: Invalid id [%d]\n", id);
1946 mAuxiliaryHints[id - 1].second = value;
1948 ecore_wl2_window_aux_hint_change(mEcoreWindow, static_cast<int>(id), value.c_str());
1950 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());
1955 std::string WindowBaseEcoreWl2::GetAuxiliaryHintValue(unsigned int id) const
1957 if(id == 0 || id > mAuxiliaryHints.size())
1959 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Concise, "WindowBaseEcoreWl2::GetAuxiliaryHintValue: Invalid id [%d]\n", id);
1960 return std::string();
1963 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());
1965 return mAuxiliaryHints[id - 1].second;
1968 unsigned int WindowBaseEcoreWl2::GetAuxiliaryHintId(const std::string& hint) const
1970 for(unsigned int i = 0; i < mAuxiliaryHints.size(); i++)
1972 if(mAuxiliaryHints[i].first == hint)
1974 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetAuxiliaryHintId: hint = %s, id = %d\n", hint.c_str(), i + 1);
1979 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetAuxiliaryHintId: Invalid hint! [%s]\n", hint.c_str());
1984 void WindowBaseEcoreWl2::SetInputRegion(const Rect<int>& inputRegion)
1986 ecore_wl2_window_input_region_set(mEcoreWindow, inputRegion.x, inputRegion.y, inputRegion.width, inputRegion.height);
1989 void WindowBaseEcoreWl2::SetType(Dali::WindowType type)
1994 Ecore_Wl2_Window_Type windowType;
1998 case Dali::WindowType::NORMAL:
2000 windowType = ECORE_WL2_WINDOW_TYPE_TOPLEVEL;
2003 case Dali::WindowType::NOTIFICATION:
2005 windowType = ECORE_WL2_WINDOW_TYPE_NOTIFICATION;
2008 case Dali::WindowType::UTILITY:
2010 windowType = ECORE_WL2_WINDOW_TYPE_UTILITY;
2013 case Dali::WindowType::DIALOG:
2015 windowType = ECORE_WL2_WINDOW_TYPE_DIALOG;
2018 case Dali::WindowType::IME:
2020 windowType = ECORE_WL2_WINDOW_TYPE_NONE;
2025 windowType = ECORE_WL2_WINDOW_TYPE_TOPLEVEL;
2029 ecore_wl2_window_type_set(mEcoreWindow, windowType);
2033 Dali::WindowType WindowBaseEcoreWl2::GetType() const
2038 Dali::WindowOperationResult WindowBaseEcoreWl2::SetNotificationLevel(Dali::WindowNotificationLevel level)
2040 while(!mTizenPolicy)
2042 wl_display_dispatch_queue(mDisplay, mEventQueue);
2045 int notificationLevel;
2049 case Dali::WindowNotificationLevel::NONE:
2051 notificationLevel = TIZEN_POLICY_LEVEL_NONE;
2054 case Dali::WindowNotificationLevel::BASE:
2056 notificationLevel = TIZEN_POLICY_LEVEL_DEFAULT;
2059 case Dali::WindowNotificationLevel::MEDIUM:
2061 notificationLevel = TIZEN_POLICY_LEVEL_MEDIUM;
2064 case Dali::WindowNotificationLevel::HIGH:
2066 notificationLevel = TIZEN_POLICY_LEVEL_HIGH;
2069 case Dali::WindowNotificationLevel::TOP:
2071 notificationLevel = TIZEN_POLICY_LEVEL_TOP;
2076 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetNotificationLevel: invalid level [%d]\n", level);
2077 notificationLevel = TIZEN_POLICY_LEVEL_DEFAULT;
2082 mNotificationLevelChangeDone = false;
2083 mNotificationChangeState = TIZEN_POLICY_ERROR_STATE_NONE;
2085 tizen_policy_set_notification_level(mTizenPolicy, ecore_wl2_window_surface_get(mEcoreWindow), notificationLevel);
2089 while(!mNotificationLevelChangeDone && count < 3)
2091 ecore_wl2_display_flush(ecore_wl2_connected_display_get(NULL));
2092 wl_display_dispatch_queue(mDisplay, mEventQueue);
2096 if(!mNotificationLevelChangeDone)
2098 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetNotificationLevel: Level change is failed [%d, %d]\n", level, mNotificationChangeState);
2099 return Dali::WindowOperationResult::UNKNOWN_ERROR;
2101 else if(mNotificationChangeState == TIZEN_POLICY_ERROR_STATE_PERMISSION_DENIED)
2103 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetNotificationLevel: Permission denied! [%d]\n", level);
2104 return Dali::WindowOperationResult::PERMISSION_DENIED;
2107 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetNotificationLevel: Level is changed [%d]\n", mNotificationLevel);
2109 return Dali::WindowOperationResult::SUCCEED;
2112 Dali::WindowNotificationLevel WindowBaseEcoreWl2::GetNotificationLevel() const
2114 while(!mTizenPolicy)
2116 wl_display_dispatch_queue(mDisplay, mEventQueue);
2121 while(!mNotificationLevelChangeDone && count < 3)
2123 ecore_wl2_display_flush(ecore_wl2_connected_display_get(NULL));
2124 wl_display_dispatch_queue(mDisplay, mEventQueue);
2128 if(!mNotificationLevelChangeDone)
2130 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetNotificationLevel: Error! [%d]\n", mNotificationChangeState);
2131 return Dali::WindowNotificationLevel::NONE;
2134 Dali::WindowNotificationLevel level;
2136 switch(mNotificationLevel)
2138 case TIZEN_POLICY_LEVEL_NONE:
2140 level = Dali::WindowNotificationLevel::NONE;
2143 case TIZEN_POLICY_LEVEL_DEFAULT:
2145 level = Dali::WindowNotificationLevel::BASE;
2148 case TIZEN_POLICY_LEVEL_MEDIUM:
2150 level = Dali::WindowNotificationLevel::MEDIUM;
2153 case TIZEN_POLICY_LEVEL_HIGH:
2155 level = Dali::WindowNotificationLevel::HIGH;
2158 case TIZEN_POLICY_LEVEL_TOP:
2160 level = Dali::WindowNotificationLevel::TOP;
2165 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetNotificationLevel: invalid level [%d]\n", mNotificationLevel);
2166 level = Dali::WindowNotificationLevel::NONE;
2171 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetNotificationLevel: level [%d]\n", mNotificationLevel);
2176 void WindowBaseEcoreWl2::SetOpaqueState(bool opaque)
2178 while(!mTizenPolicy)
2180 wl_display_dispatch_queue(mDisplay, mEventQueue);
2183 tizen_policy_set_opaque_state(mTizenPolicy, ecore_wl2_window_surface_get(mEcoreWindow), (opaque ? 1 : 0));
2186 Dali::WindowOperationResult WindowBaseEcoreWl2::SetScreenOffMode(WindowScreenOffMode screenOffMode)
2188 while(!mTizenPolicy)
2190 wl_display_dispatch_queue(mDisplay, mEventQueue);
2193 mScreenOffModeChangeDone = false;
2194 mScreenOffModeChangeState = TIZEN_POLICY_ERROR_STATE_NONE;
2196 unsigned int mode = 0;
2198 switch(screenOffMode)
2200 case WindowScreenOffMode::TIMEOUT:
2205 case WindowScreenOffMode::NEVER:
2212 tizen_policy_set_window_screen_mode(mTizenPolicy, ecore_wl2_window_surface_get(mEcoreWindow), mode);
2216 while(!mScreenOffModeChangeDone && count < 3)
2218 ecore_wl2_display_flush(ecore_wl2_connected_display_get(NULL));
2219 wl_display_dispatch_queue(mDisplay, mEventQueue);
2223 if(!mScreenOffModeChangeDone)
2225 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetScreenOffMode: Screen mode change is failed [%d, %d]\n", screenOffMode, mScreenOffModeChangeState);
2226 return Dali::WindowOperationResult::UNKNOWN_ERROR;
2228 else if(mScreenOffModeChangeState == TIZEN_POLICY_ERROR_STATE_PERMISSION_DENIED)
2230 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetScreenOffMode: Permission denied! [%d]\n", screenOffMode);
2231 return Dali::WindowOperationResult::PERMISSION_DENIED;
2234 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetScreenOffMode: Screen mode is changed [%d]\n", mScreenOffMode);
2236 return Dali::WindowOperationResult::SUCCEED;
2239 WindowScreenOffMode WindowBaseEcoreWl2::GetScreenOffMode() const
2241 while(!mTizenPolicy)
2243 wl_display_dispatch_queue(mDisplay, mEventQueue);
2248 while(!mScreenOffModeChangeDone && count < 3)
2250 ecore_wl2_display_flush(ecore_wl2_connected_display_get(NULL));
2251 wl_display_dispatch_queue(mDisplay, mEventQueue);
2255 if(!mScreenOffModeChangeDone)
2257 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetScreenOffMode: Error! [%d]\n", mScreenOffModeChangeState);
2258 return WindowScreenOffMode::TIMEOUT;
2261 WindowScreenOffMode screenMode = WindowScreenOffMode::TIMEOUT;
2263 switch(mScreenOffMode)
2267 screenMode = WindowScreenOffMode::TIMEOUT;
2272 screenMode = WindowScreenOffMode::NEVER;
2277 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetScreenOffMode: screen mode [%d]\n", mScreenOffMode);
2282 Dali::WindowOperationResult WindowBaseEcoreWl2::SetBrightness(int brightness)
2284 while(!mTizenDisplayPolicy)
2286 wl_display_dispatch_queue(mDisplay, mEventQueue);
2289 mBrightnessChangeDone = false;
2290 mBrightnessChangeState = TIZEN_POLICY_ERROR_STATE_NONE;
2292 tizen_display_policy_set_window_brightness(mTizenDisplayPolicy, ecore_wl2_window_surface_get(mEcoreWindow), brightness);
2296 while(!mBrightnessChangeDone && count < 3)
2298 ecore_wl2_display_flush(ecore_wl2_connected_display_get(NULL));
2299 wl_display_dispatch_queue(mDisplay, mEventQueue);
2303 if(!mBrightnessChangeDone)
2305 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetBrightness: Brightness change is failed [%d, %d]\n", brightness, mBrightnessChangeState);
2306 return Dali::WindowOperationResult::UNKNOWN_ERROR;
2308 else if(mBrightnessChangeState == TIZEN_POLICY_ERROR_STATE_PERMISSION_DENIED)
2310 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetBrightness: Permission denied! [%d]\n", brightness);
2311 return Dali::WindowOperationResult::PERMISSION_DENIED;
2314 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetBrightness: Brightness is changed [%d]\n", mBrightness);
2316 return Dali::WindowOperationResult::SUCCEED;
2319 int WindowBaseEcoreWl2::GetBrightness() const
2321 while(!mTizenDisplayPolicy)
2323 wl_display_dispatch_queue(mDisplay, mEventQueue);
2328 while(!mBrightnessChangeDone && count < 3)
2330 ecore_wl2_display_flush(ecore_wl2_connected_display_get(NULL));
2331 wl_display_dispatch_queue(mDisplay, mEventQueue);
2335 if(!mBrightnessChangeDone)
2337 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetBrightness: Error! [%d]\n", mBrightnessChangeState);
2341 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetBrightness: Brightness [%d]\n", mBrightness);
2346 bool WindowBaseEcoreWl2::GrabKey(Dali::KEY key, KeyGrab::KeyGrabMode grabMode)
2348 Ecore_Wl2_Window_Keygrab_Mode mode;
2352 case KeyGrab::TOPMOST:
2354 mode = ECORE_WL2_WINDOW_KEYGRAB_TOPMOST;
2357 case KeyGrab::SHARED:
2359 mode = ECORE_WL2_WINDOW_KEYGRAB_SHARED;
2362 case KeyGrab::OVERRIDE_EXCLUSIVE:
2364 mode = ECORE_WL2_WINDOW_KEYGRAB_OVERRIDE_EXCLUSIVE;
2367 case KeyGrab::EXCLUSIVE:
2369 mode = ECORE_WL2_WINDOW_KEYGRAB_EXCLUSIVE;
2378 return ecore_wl2_window_keygrab_set(mEcoreWindow, KeyLookup::GetKeyName(key), 0, 0, 0, mode);
2381 bool WindowBaseEcoreWl2::UngrabKey(Dali::KEY key)
2383 return ecore_wl2_window_keygrab_unset(mEcoreWindow, KeyLookup::GetKeyName(key), 0, 0);
2386 bool WindowBaseEcoreWl2::GrabKeyList(const Dali::Vector<Dali::KEY>& key, const Dali::Vector<KeyGrab::KeyGrabMode>& grabMode, Dali::Vector<bool>& result)
2388 int keyCount = key.Count();
2389 int keyGrabModeCount = grabMode.Count();
2391 if(keyCount != keyGrabModeCount || keyCount == 0)
2398 Eina_List* keyList = NULL;
2399 Ecore_Wl2_Window_Keygrab_Info* info = new Ecore_Wl2_Window_Keygrab_Info[keyCount];
2401 for(int index = 0; index < keyCount; ++index)
2403 info[index].key = const_cast<char*>(KeyLookup::GetKeyName(key[index]));
2405 switch(grabMode[index])
2407 case KeyGrab::TOPMOST:
2409 info[index].mode = ECORE_WL2_WINDOW_KEYGRAB_TOPMOST;
2412 case KeyGrab::SHARED:
2414 info[index].mode = ECORE_WL2_WINDOW_KEYGRAB_SHARED;
2417 case KeyGrab::OVERRIDE_EXCLUSIVE:
2419 info[index].mode = ECORE_WL2_WINDOW_KEYGRAB_OVERRIDE_EXCLUSIVE;
2422 case KeyGrab::EXCLUSIVE:
2424 info[index].mode = ECORE_WL2_WINDOW_KEYGRAB_EXCLUSIVE;
2429 info[index].mode = ECORE_WL2_WINDOW_KEYGRAB_UNKNOWN;
2434 keyList = eina_list_append(keyList, &info);
2437 Eina_List* grabList = ecore_wl2_window_keygrab_list_set(mEcoreWindow, keyList);
2439 result.Resize(keyCount, true);
2441 Eina_List* l = NULL;
2442 Eina_List* m = NULL;
2443 void* listData = NULL;
2445 if(grabList != NULL)
2447 EINA_LIST_FOREACH(grabList, m, data)
2450 EINA_LIST_FOREACH(keyList, l, listData)
2452 if(static_cast<Ecore_Wl2_Window_Keygrab_Info*>(listData)->key == NULL)
2454 DALI_LOG_ERROR("input key list has null data!");
2458 if(strcmp(static_cast<char*>(data), static_cast<Ecore_Wl2_Window_Keygrab_Info*>(listData)->key) == 0)
2460 result[index] = false;
2469 eina_list_free(keyList);
2470 eina_list_free(grabList);
2476 bool WindowBaseEcoreWl2::UngrabKeyList(const Dali::Vector<Dali::KEY>& key, Dali::Vector<bool>& result)
2478 int keyCount = key.Count();
2486 Eina_List* keyList = NULL;
2487 Ecore_Wl2_Window_Keygrab_Info* info = new Ecore_Wl2_Window_Keygrab_Info[keyCount];
2489 for(int index = 0; index < keyCount; ++index)
2491 info[index].key = const_cast<char*>(KeyLookup::GetKeyName(key[index]));
2492 keyList = eina_list_append(keyList, &info);
2495 Eina_List* ungrabList = ecore_wl2_window_keygrab_list_unset(mEcoreWindow, keyList);
2497 result.Resize(keyCount, true);
2499 Eina_List* l = NULL;
2500 Eina_List* m = NULL;
2501 void* listData = NULL;
2504 if(ungrabList != NULL)
2506 EINA_LIST_FOREACH(ungrabList, m, data)
2509 EINA_LIST_FOREACH(keyList, l, listData)
2511 if(strcmp(static_cast<char*>(data), static_cast<Ecore_Wl2_Window_Keygrab_Info*>(listData)->key) == 0)
2513 result[index] = false;
2522 eina_list_free(keyList);
2523 eina_list_free(ungrabList);
2529 void WindowBaseEcoreWl2::GetDpi(unsigned int& dpiHorizontal, unsigned int& dpiVertical)
2534 Ecore_Wl2_Output* output = ecore_wl2_window_output_find(mEcoreWindow);
2536 // 1 inch = 25.4 millimeters
2537 xres = ecore_wl2_output_dpi_get(output);
2538 yres = ecore_wl2_output_dpi_get(output);
2540 dpiHorizontal = int(xres + 0.5f); // rounding
2541 dpiVertical = int(yres + 0.5f);
2544 int WindowBaseEcoreWl2::GetOrientation() const
2546 int orientation = (mScreenRotationAngle + mWindowRotationAngle) % 360;
2547 if(mSupportedPreProtation)
2554 int WindowBaseEcoreWl2::GetScreenRotationAngle()
2558 if(ecore_wl2_window_ignore_output_transform_get(mEcoreWindow))
2564 transform = ecore_wl2_output_transform_get(ecore_wl2_window_output_find(mEcoreWindow));
2566 mScreenRotationAngle = transform * 90;
2567 return mScreenRotationAngle;
2570 void WindowBaseEcoreWl2::SetWindowRotationAngle(int degree)
2572 mWindowRotationAngle = degree;
2573 ecore_wl2_window_rotation_set(mEcoreWindow, degree);
2576 void WindowBaseEcoreWl2::WindowRotationCompleted(int degree, int width, int height)
2578 ecore_wl2_window_rotation_change_done_send(mEcoreWindow, degree, width, height);
2581 void WindowBaseEcoreWl2::SetTransparency(bool transparent)
2583 ecore_wl2_window_alpha_set(mEcoreWindow, transparent);
2586 void WindowBaseEcoreWl2::CreateWindow(PositionSize positionSize)
2588 Ecore_Wl2_Display* display = ecore_wl2_display_connect(NULL);
2591 DALI_ASSERT_ALWAYS(0 && "Failed to get display");
2594 ecore_wl2_display_sync(display);
2596 mEcoreWindow = ecore_wl2_window_new(display, NULL, positionSize.x, positionSize.y, positionSize.width, positionSize.height);
2598 if(mEcoreWindow == 0)
2600 DALI_ASSERT_ALWAYS(0 && "Failed to create Wayland window");
2604 ecore_wl2_window_type_set(mEcoreWindow, ECORE_WL2_WINDOW_TYPE_TOPLEVEL);
2606 // Get Screen width, height
2607 ecore_wl2_display_screen_size_get(display, &mScreenWidth, &mScreenHeight);
2610 void WindowBaseEcoreWl2::SetParent(WindowBase* parentWinBase, bool belowParent)
2612 Ecore_Wl2_Window* ecoreParent = NULL;
2615 WindowBaseEcoreWl2* winBaseEcore2 = static_cast<WindowBaseEcoreWl2*>(parentWinBase);
2616 ecoreParent = winBaseEcore2->mEcoreWindow;
2618 ecore_wl2_window_transient_parent_set(mEcoreWindow, ecoreParent, belowParent);
2621 int WindowBaseEcoreWl2::CreateFrameRenderedSyncFence()
2623 return wl_egl_window_tizen_create_commit_sync_fd(mEglWindow);
2626 int WindowBaseEcoreWl2::CreateFramePresentedSyncFence()
2628 return wl_egl_window_tizen_create_presentation_sync_fd(mEglWindow);
2631 void WindowBaseEcoreWl2::SetPositionSizeWithAngle(PositionSize positionSize, int angle)
2633 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);
2634 ecore_wl2_window_rotation_geometry_set(mEcoreWindow, angle, positionSize.x, positionSize.y, positionSize.width, positionSize.height);
2637 void WindowBaseEcoreWl2::InitializeIme()
2639 Eina_Iterator* globals;
2640 struct wl_registry* registry;
2641 Ecore_Wl2_Global* global;
2642 Ecore_Wl2_Display* ecoreWl2Display;
2644 if(!(ecoreWl2Display = ecore_wl2_connected_display_get(NULL)))
2646 DALI_LOG_ERROR("WindowBaseEcoreWl2::InitializeIme(), fail to get ecore_wl2 connected display\n");
2650 DALI_LOG_RELEASE_INFO("InitializeIme: Ecore_Wl2_Display: %p, ecore wl window: %p\n", ecoreWl2Display, mEcoreWindow);
2652 if(!(registry = ecore_wl2_display_registry_get(ecoreWl2Display)))
2654 DALI_LOG_ERROR("WindowBaseEcoreWl2::InitializeIme(), fail to get ecore_wl2 display registry\n");
2658 if(!(globals = ecore_wl2_display_globals_get(ecoreWl2Display)))
2660 DALI_LOG_ERROR("WindowBaseEcoreWl2::InitializeIme(), fail to get ecore_wl2 globals\n");
2664 EINA_ITERATOR_FOREACH(globals, global)
2666 #ifdef OVER_TIZEN_VERSION_7
2667 if(strcmp(global->interface, "zwp_input_panel_v1") == 0)
2669 mWlInputPanel = (zwp_input_panel_v1*)wl_registry_bind(registry, global->id, &zwp_input_panel_v1_interface, 1);
2672 if(strcmp(global->interface, "wl_input_panel") == 0)
2674 mWlInputPanel = (wl_input_panel*)wl_registry_bind(registry, global->id, &wl_input_panel_interface, 1);
2677 else if(strcmp(global->interface, "wl_output") == 0)
2679 mWlOutput = (wl_output*)wl_registry_bind(registry, global->id, &wl_output_interface, 1);
2685 DALI_LOG_ERROR("WindowBaseEcoreWl2::InitializeIme(), fail to get wayland input panel interface\n");
2691 DALI_LOG_ERROR("WindowBaseEcoreWl2::InitializeIme(), fail to get wayland output panel interface\n");
2694 #ifdef OVER_TIZEN_VERSION_7
2695 mWlInputPanelSurface = zwp_input_panel_v1_get_input_panel_surface(mWlInputPanel, mWlSurface);
2697 mWlInputPanelSurface = wl_input_panel_get_input_panel_surface(mWlInputPanel, mWlSurface);
2699 if(!mWlInputPanelSurface)
2701 DALI_LOG_ERROR("WindowBaseEcoreWl2::InitializeIme(), fail to get wayland input panel surface\n");
2704 #ifdef OVER_TIZEN_VERSION_7
2705 zwp_input_panel_surface_v1_set_toplevel(mWlInputPanelSurface, mWlOutput, ZWP_INPUT_PANEL_SURFACE_V1_POSITION_CENTER_BOTTOM);
2707 wl_input_panel_surface_set_toplevel(mWlInputPanelSurface, mWlOutput, WL_INPUT_PANEL_SURFACE_POSITION_CENTER_BOTTOM);
2711 void WindowBaseEcoreWl2::ImeWindowReadyToRender()
2713 if(!mWlInputPanelSurface)
2715 DALI_LOG_ERROR("WindowBaseEcoreWl2::ImeWindowReadyToRender(), wayland input panel surface is null\n");
2718 #ifdef OVER_TIZEN_VERSION_7
2719 zwp_input_panel_surface_v1_set_ready(mWlInputPanelSurface, 1);
2721 wl_input_panel_surface_set_ready(mWlInputPanelSurface, 1);
2725 void WindowBaseEcoreWl2::RequestMoveToServer()
2727 Ecore_Wl2_Display* display = ecore_wl2_connected_display_get(NULL);
2730 DALI_LOG_ERROR("WindowBaseEcoreWl2::RequestMoveToServer, Fail to get ecore_wl2_display\n");
2734 Ecore_Wl2_Input* input = ecore_wl2_input_default_input_get(display);
2737 DALI_LOG_ERROR("WindowBaseEcoreWl2::RequestMoveToServer, Fail to get default Ecore_Wl2_Input\n");
2741 ecore_wl2_window_move(mEcoreWindow, input);
2742 DALI_LOG_RELEASE_INFO("WindowBaseEcoreWl2::RequestMoveToServer, starts the window[%p] is moved by server\n", mEcoreWindow);
2745 void WindowBaseEcoreWl2::RequestResizeToServer(WindowResizeDirection direction)
2747 Ecore_Wl2_Display* display = ecore_wl2_connected_display_get(NULL);
2750 DALI_LOG_ERROR("WindowBaseEcoreWl2::RequestResizeToServer, Fail to get ecore_wl2_display\n");
2754 Ecore_Wl2_Input* input = ecore_wl2_input_default_input_get(display);
2757 DALI_LOG_ERROR("WindowBaseEcoreWl2::RequestResizeToServer, Fail to get default Ecore_Wl2_Input\n");
2764 case WindowResizeDirection::TOP_LEFT:
2769 case WindowResizeDirection::TOP:
2774 case WindowResizeDirection::TOP_RIGHT:
2779 case WindowResizeDirection::LEFT:
2784 case WindowResizeDirection::RIGHT:
2789 case WindowResizeDirection::BOTTOM_LEFT:
2794 case WindowResizeDirection::BOTTOM:
2799 case WindowResizeDirection::BOTTOM_RIGHT:
2811 ecore_wl2_window_resize(mEcoreWindow, input, location);
2812 DALI_LOG_RELEASE_INFO("WindowBaseEcoreWl2::RequestResizeToServer, starts the window[%p] is resized by server, mode:%d\n", mEcoreWindow, location);
2815 void WindowBaseEcoreWl2::EnableFloatingMode(bool enable)
2817 DALI_LOG_RELEASE_INFO("WindowBaseEcoreWl2::EnableFloatingMode, floating mode flag: [%p], enable [%d]\n", mEcoreWindow, enable);
2820 ecore_wl2_window_floating_mode_set(mEcoreWindow, EINA_TRUE);
2824 ecore_wl2_window_floating_mode_set(mEcoreWindow, EINA_FALSE);
2828 bool WindowBaseEcoreWl2::IsFloatingModeEnabled() const
2830 return ecore_wl2_window_floating_mode_get(mEcoreWindow);
2833 void WindowBaseEcoreWl2::IncludeInputRegion(const Rect<int>& inputRegion)
2835 Eina_Rectangle rect;
2836 rect.x = inputRegion.x;
2837 rect.y = inputRegion.y;
2838 rect.w = inputRegion.width;
2839 rect.h = inputRegion.height;
2841 ecore_wl2_window_input_rect_add(mEcoreWindow, &rect);
2842 ecore_wl2_window_commit(mEcoreWindow, EINA_TRUE);
2845 void WindowBaseEcoreWl2::ExcludeInputRegion(const Rect<int>& inputRegion)
2847 Eina_Rectangle rect;
2848 rect.x = inputRegion.x;
2849 rect.y = inputRegion.y;
2850 rect.w = inputRegion.width;
2851 rect.h = inputRegion.height;
2853 ecore_wl2_window_input_rect_subtract(mEcoreWindow, &rect);
2854 ecore_wl2_window_commit(mEcoreWindow, EINA_TRUE);
2857 } // namespace Adaptor
2859 } // namespace Internal
2863 #pragma GCC diagnostic pop