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>
37 #include <vconf-keys.h>
39 #include <wayland-egl-tizen.h>
49 #if defined(DEBUG_ENABLED)
50 Debug::Filter* gWindowBaseLogFilter = Debug::Filter::New(Debug::NoLogging, false, "LOG_WINDOW_BASE");
53 const uint32_t MAX_TIZEN_CLIENT_VERSION = 7;
54 const unsigned int PRIMARY_TOUCH_BUTTON_ID = 1;
56 const char* DALI_VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_NAME = "db/setting/accessibility/font_name"; // It will be update at vconf-key.h and replaced.
61 xkb_keycode_t keyCode;
66 * Get the device name from the provided ecore key event
68 void GetDeviceName(Ecore_Event_Key* keyEvent, std::string& result)
70 const char* ecoreDeviceName = ecore_device_name_get(keyEvent->dev);
74 result = ecoreDeviceName;
79 * Get the device class from the provided ecore event
81 void GetDeviceClass(Ecore_Device_Class ecoreDeviceClass, Device::Class::Type& deviceClass)
83 switch(ecoreDeviceClass)
85 case ECORE_DEVICE_CLASS_SEAT:
87 deviceClass = Device::Class::USER;
90 case ECORE_DEVICE_CLASS_KEYBOARD:
92 deviceClass = Device::Class::KEYBOARD;
95 case ECORE_DEVICE_CLASS_MOUSE:
97 deviceClass = Device::Class::MOUSE;
100 case ECORE_DEVICE_CLASS_TOUCH:
102 deviceClass = Device::Class::TOUCH;
105 case ECORE_DEVICE_CLASS_PEN:
107 deviceClass = Device::Class::PEN;
110 case ECORE_DEVICE_CLASS_POINTER:
112 deviceClass = Device::Class::POINTER;
115 case ECORE_DEVICE_CLASS_GAMEPAD:
117 deviceClass = Device::Class::GAMEPAD;
122 deviceClass = Device::Class::NONE;
128 void GetDeviceSubclass(Ecore_Device_Subclass ecoreDeviceSubclass, Device::Subclass::Type& deviceSubclass)
130 switch(ecoreDeviceSubclass)
132 case ECORE_DEVICE_SUBCLASS_FINGER:
134 deviceSubclass = Device::Subclass::FINGER;
137 case ECORE_DEVICE_SUBCLASS_FINGERNAIL:
139 deviceSubclass = Device::Subclass::FINGERNAIL;
142 case ECORE_DEVICE_SUBCLASS_KNUCKLE:
144 deviceSubclass = Device::Subclass::KNUCKLE;
147 case ECORE_DEVICE_SUBCLASS_PALM:
149 deviceSubclass = Device::Subclass::PALM;
152 case ECORE_DEVICE_SUBCLASS_HAND_SIZE:
154 deviceSubclass = Device::Subclass::HAND_SIDE;
157 case ECORE_DEVICE_SUBCLASS_HAND_FLAT:
159 deviceSubclass = Device::Subclass::HAND_FLAT;
162 case ECORE_DEVICE_SUBCLASS_PEN_TIP:
164 deviceSubclass = Device::Subclass::PEN_TIP;
167 case ECORE_DEVICE_SUBCLASS_TRACKPAD:
169 deviceSubclass = Device::Subclass::TRACKPAD;
172 case ECORE_DEVICE_SUBCLASS_TRACKPOINT:
174 deviceSubclass = Device::Subclass::TRACKPOINT;
177 case ECORE_DEVICE_SUBCLASS_TRACKBALL:
179 deviceSubclass = Device::Subclass::TRACKBALL;
182 case ECORE_DEVICE_SUBCLASS_REMOCON:
184 deviceSubclass = Device::Subclass::REMOCON;
187 case ECORE_DEVICE_SUBCLASS_VIRTUAL_KEYBOARD:
189 deviceSubclass = Device::Subclass::VIRTUAL_KEYBOARD;
194 deviceSubclass = Device::Subclass::NONE;
200 void FindKeyCode(struct xkb_keymap* keyMap, xkb_keycode_t key, void* data)
202 KeyCodeMap* foundKeyCode = static_cast<KeyCodeMap*>(data);
203 if(foundKeyCode->isKeyCode)
208 xkb_keysym_t keySym = foundKeyCode->keySym;
210 const xkb_keysym_t* symsOut = NULL;
212 nsyms = xkb_keymap_key_get_syms_by_level(keyMap, key, 0, 0, &symsOut);
216 if(*symsOut == keySym)
218 foundKeyCode->keyCode = key;
219 foundKeyCode->isKeyCode = true;
224 /////////////////////////////////////////////////////////////////////////////////////////////////
226 /////////////////////////////////////////////////////////////////////////////////////////////////
228 /// Called when the window iconify state is changed.
229 static Eina_Bool EcoreEventWindowIconifyStateChanged(void* data, int type, void* event)
231 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
234 return windowBase->OnIconifyStateChanged(data, type, event);
237 return ECORE_CALLBACK_PASS_ON;
240 /// Called when the window gains focus
241 static Eina_Bool EcoreEventWindowFocusIn(void* data, int type, void* event)
243 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
246 return windowBase->OnFocusIn(data, type, event);
249 return ECORE_CALLBACK_PASS_ON;
252 /// Called when the window loses focus
253 static Eina_Bool EcoreEventWindowFocusOut(void* data, int type, void* event)
255 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
258 return windowBase->OnFocusOut(data, type, event);
261 return ECORE_CALLBACK_PASS_ON;
264 /// Called when the output is transformed
265 static Eina_Bool EcoreEventOutputTransform(void* data, int type, void* event)
267 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
270 return windowBase->OnOutputTransform(data, type, event);
273 return ECORE_CALLBACK_PASS_ON;
276 /// Called when the output transform should be ignored
277 static Eina_Bool EcoreEventIgnoreOutputTransform(void* data, int type, void* event)
279 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
282 return windowBase->OnIgnoreOutputTransform(data, type, event);
285 return ECORE_CALLBACK_PASS_ON;
289 * Called when rotate event is recevied.
291 static Eina_Bool EcoreEventRotate(void* data, int type, void* event)
293 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
296 DALI_LOG_RELEASE_INFO("WindowBaseEcoreWl2::EcoreEventRotate\n");
297 windowBase->OnRotation(data, type, event);
299 return ECORE_CALLBACK_PASS_ON;
303 * Called when configure event is recevied.
305 static Eina_Bool EcoreEventConfigure(void* data, int type, void* event)
307 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
310 windowBase->OnConfiguration(data, type, event);
312 return ECORE_CALLBACK_PASS_ON;
315 /////////////////////////////////////////////////////////////////////////////////////////////////
317 /////////////////////////////////////////////////////////////////////////////////////////////////
320 * Called when a touch down is received.
322 static Eina_Bool EcoreEventMouseButtonDown(void* data, int type, void* event)
324 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
327 windowBase->OnMouseButtonDown(data, type, event);
329 return ECORE_CALLBACK_PASS_ON;
333 * Called when a touch up is received.
335 static Eina_Bool EcoreEventMouseButtonUp(void* data, int type, void* event)
337 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
340 windowBase->OnMouseButtonUp(data, type, event);
342 return ECORE_CALLBACK_PASS_ON;
346 * Called when a touch motion is received.
348 static Eina_Bool EcoreEventMouseButtonMove(void* data, int type, void* event)
350 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
353 windowBase->OnMouseButtonMove(data, type, event);
355 return ECORE_CALLBACK_PASS_ON;
359 * Called when a touch is canceled.
361 static Eina_Bool EcoreEventMouseButtonCancel(void* data, int type, void* event)
363 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
366 windowBase->OnMouseButtonCancel(data, type, event);
368 return ECORE_CALLBACK_PASS_ON;
372 * Called when a mouse wheel is received.
374 static Eina_Bool EcoreEventMouseWheel(void* data, int type, void* event)
376 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
379 windowBase->OnMouseWheel(data, type, event);
381 return ECORE_CALLBACK_PASS_ON;
385 * Called when a detent rotation event is recevied.
387 static Eina_Bool EcoreEventDetentRotation(void* data, int type, void* event)
389 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
392 windowBase->OnDetentRotation(data, type, event);
394 return ECORE_CALLBACK_PASS_ON;
397 /////////////////////////////////////////////////////////////////////////////////////////////////
399 /////////////////////////////////////////////////////////////////////////////////////////////////
402 * Called when a key down is received.
404 static Eina_Bool EcoreEventKeyDown(void* data, int type, void* event)
406 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
409 windowBase->OnKeyDown(data, type, event);
411 return ECORE_CALLBACK_PASS_ON;
415 * Called when a key up is received.
417 static Eina_Bool EcoreEventKeyUp(void* data, int type, void* event)
419 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
422 windowBase->OnKeyUp(data, type, event);
424 return ECORE_CALLBACK_PASS_ON;
427 /////////////////////////////////////////////////////////////////////////////////////////////////
428 // Selection Callbacks
429 /////////////////////////////////////////////////////////////////////////////////////////////////
432 * Called when the source window notifies us the content in clipboard is selected.
434 static Eina_Bool EcoreEventDataSend(void* data, int type, void* event)
436 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
439 windowBase->OnDataSend(data, type, event);
441 return ECORE_CALLBACK_PASS_ON;
445 * Called when the source window sends us about the selected content.
446 * For example, when item is selected in the clipboard.
448 static Eina_Bool EcoreEventDataReceive(void* data, int type, void* event)
450 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
453 windowBase->OnDataReceive(data, type, event);
455 return ECORE_CALLBACK_PASS_ON;
458 /////////////////////////////////////////////////////////////////////////////////////////////////
459 // Effect Start/End Callbacks
460 /////////////////////////////////////////////////////////////////////////////////////////////////
463 * Called when transition animation of the window's shown/hidden is started by window manager.
465 static Eina_Bool EcoreEventEffectStart(void* data, int type, void* event)
467 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
468 Ecore_Wl2_Event_Effect_Start* effectStart = static_cast<Ecore_Wl2_Event_Effect_Start*>(event);
469 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::EcoreEventEffectStart, effect type[ %d ]\n", effectStart->type);
472 if(effectStart->type < 3) // only under restack
474 windowBase->OnTransitionEffectEvent(WindowEffectState::START, static_cast<WindowEffectType>(effectStart->type));
477 return ECORE_CALLBACK_PASS_ON;
481 * Called when transition animation of the window's shown/hidden is ended by window manager.
483 static Eina_Bool EcoreEventEffectEnd(void* data, int type, void* event)
485 Ecore_Wl2_Event_Effect_Start* effectEnd = static_cast<Ecore_Wl2_Event_Effect_Start*>(event);
486 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
487 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::EcoreEventEffectEnd, effect type[ %d ]\n", effectEnd->type);
490 if(effectEnd->type < 3) // only under restack
492 windowBase->OnTransitionEffectEvent(WindowEffectState::END, static_cast<WindowEffectType>(effectEnd->type));
495 return ECORE_CALLBACK_PASS_ON;
498 /////////////////////////////////////////////////////////////////////////////////////////////////
499 // Keyboard Repeat Settings Changed Callbacks
500 /////////////////////////////////////////////////////////////////////////////////////////////////
502 static Eina_Bool EcoreEventSeatKeyboardRepeatChanged(void* data, int type, void* event)
504 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
505 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::EcoreEventSeatKeyboardRepeatChanged, id[ %d ]\n", static_cast<Ecore_Wl2_Event_Seat_Keyboard_Repeat_Changed*>(event)->id);
508 windowBase->OnKeyboardRepeatSettingsChanged();
511 return ECORE_CALLBACK_RENEW;
514 /////////////////////////////////////////////////////////////////////////////////////////////////
515 // Keymap Changed Callbacks
516 /////////////////////////////////////////////////////////////////////////////////////////////////
518 static Eina_Bool EcoreEventSeatKeymapChanged(void* data, int type, void* event)
520 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
523 windowBase->KeymapChanged(data, type, event);
526 return ECORE_CALLBACK_RENEW;
529 /////////////////////////////////////////////////////////////////////////////////////////////////
531 /////////////////////////////////////////////////////////////////////////////////////////////////
534 * Called when a font name is changed.
536 static void VconfNotifyFontNameChanged(keynode_t* node, void* data)
538 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
541 windowBase->OnFontNameChanged();
546 * Called when a font size is changed.
548 static void VconfNotifyFontSizeChanged(keynode_t* node, void* data)
550 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
553 windowBase->OnFontSizeChanged();
557 /////////////////////////////////////////////////////////////////////////////////////////////////
558 // Window Redraw Request Event Callbacks
559 /////////////////////////////////////////////////////////////////////////////////////////////////
561 static Eina_Bool EcoreEventWindowRedrawRequest(void* data, int type, void* event)
563 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
564 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::EcoreEventWindowRedrawRequest, window[ %d ]\n", static_cast<Ecore_Wl2_Event_Window_Redraw_Request*>(event)->win);
567 windowBase->OnEcoreEventWindowRedrawRequest();
570 return ECORE_CALLBACK_RENEW;
573 /////////////////////////////////////////////////////////////////////////////////////////////////
574 // Window Auxiliary Message Callbacks
575 /////////////////////////////////////////////////////////////////////////////////////////////////
576 static Eina_Bool EcoreEventWindowAuxiliaryMessage(void* data, int type, void* event)
578 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
581 windowBase->OnEcoreEventWindowAuxiliaryMessage(event);
583 return ECORE_CALLBACK_RENEW;
586 static void RegistryGlobalCallback(void* data, struct wl_registry* registry, uint32_t name, const char* interface, uint32_t version)
588 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
591 windowBase->RegistryGlobalCallback(data, registry, name, interface, version);
595 static void RegistryGlobalCallbackRemove(void* data, struct wl_registry* registry, uint32_t id)
597 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
600 windowBase->RegistryGlobalCallbackRemove(data, registry, id);
604 static void TizenPolicyConformant(void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, uint32_t isConformant)
608 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)
612 static void TizenPolicyNotificationChangeDone(void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, int32_t level, uint32_t state)
614 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
617 windowBase->TizenPolicyNotificationChangeDone(data, tizenPolicy, surface, level, state);
621 static void TizenPolicyTransientForDone(void* data, struct tizen_policy* tizenPolicy, uint32_t childId)
625 static void TizenPolicyScreenModeChangeDone(void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, uint32_t mode, uint32_t state)
627 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
630 windowBase->TizenPolicyScreenModeChangeDone(data, tizenPolicy, surface, mode, state);
634 static void TizenPolicyIconifyStateChanged(void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, uint32_t iconified, uint32_t force)
638 static void TizenPolicySupportedAuxiliaryHints(void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, struct wl_array* hints, uint32_t numNints)
642 static void TizenPolicyAllowedAuxiliaryHint(void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, int id)
646 static void TizenPolicyAuxiliaryMessage(void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, const char* key, const char* val, struct wl_array* options)
650 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)
654 static void DisplayPolicyBrightnessChangeDone(void* data, struct tizen_display_policy* displayPolicy, struct wl_surface* surface, int32_t brightness, uint32_t state)
656 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
659 windowBase->DisplayPolicyBrightnessChangeDone(data, displayPolicy, surface, brightness, state);
663 const struct wl_registry_listener registryListener =
665 RegistryGlobalCallback,
666 RegistryGlobalCallbackRemove};
668 const struct tizen_policy_listener tizenPolicyListener =
670 TizenPolicyConformant,
671 TizenPolicyConformantArea,
672 TizenPolicyNotificationChangeDone,
673 TizenPolicyTransientForDone,
674 TizenPolicyScreenModeChangeDone,
675 TizenPolicyIconifyStateChanged,
676 TizenPolicySupportedAuxiliaryHints,
677 TizenPolicyAllowedAuxiliaryHint,
678 TizenPolicyAuxiliaryMessage,
679 TizenPolicyConformantRegion};
681 const struct tizen_display_policy_listener tizenDisplayPolicyListener =
683 DisplayPolicyBrightnessChangeDone};
685 } // unnamed namespace
687 WindowBaseEcoreWl2::WindowBaseEcoreWl2(Dali::PositionSize positionSize, Any surface, bool isTransparent)
688 : mEcoreEventHandler(),
689 mEcoreWindow(nullptr),
691 mWlInputPanel(nullptr),
693 mWlInputPanelSurface(nullptr),
696 mEventQueue(nullptr),
697 mTizenPolicy(nullptr),
698 mTizenDisplayPolicy(nullptr),
700 mSupportedAuxiliaryHints(),
701 mWindowPositionSize(positionSize),
703 mType(WindowType::NORMAL),
704 mNotificationLevel(-1),
707 mWindowRotationAngle(0),
708 mScreenRotationAngle(0),
709 mSupportedPreProtation(0),
712 mNotificationChangeState(0),
713 mScreenOffModeChangeState(0),
714 mBrightnessChangeState(0),
715 mLastSubmittedMoveResizeSerial(0),
716 mMoveResizeSerial(0),
717 mNotificationLevelChangeDone(true),
718 mScreenOffModeChangeDone(true),
721 mBrightnessChangeDone(true)
723 Initialize(positionSize, surface, isTransparent);
726 WindowBaseEcoreWl2::~WindowBaseEcoreWl2()
728 vconf_ignore_key_changed(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, VconfNotifyFontSizeChanged);
729 vconf_ignore_key_changed(DALI_VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_NAME, VconfNotifyFontNameChanged);
731 for(Dali::Vector<Ecore_Event_Handler*>::Iterator iter = mEcoreEventHandler.Begin(), endIter = mEcoreEventHandler.End(); iter != endIter; ++iter)
733 ecore_event_handler_del(*iter);
735 mEcoreEventHandler.Clear();
739 wl_event_queue_destroy(mEventQueue);
742 mSupportedAuxiliaryHints.clear();
743 mAuxiliaryHints.clear();
745 if(mEglWindow != NULL)
747 wl_egl_window_destroy(mEglWindow);
753 ecore_wl2_window_free(mEcoreWindow);
755 WindowSystem::Shutdown();
759 void WindowBaseEcoreWl2::Initialize(PositionSize positionSize, Any surface, bool isTransparent)
761 if(surface.Empty() == false)
763 // check we have a valid type
764 DALI_ASSERT_ALWAYS((surface.GetType() == typeid(Ecore_Wl2_Window*)) && "Surface type is invalid");
766 mEcoreWindow = AnyCast<Ecore_Wl2_Window*>(surface);
770 // we own the surface about to created
771 WindowSystem::Initialize();
774 CreateWindow(positionSize);
777 mWlSurface = ecore_wl2_window_surface_get(mEcoreWindow);
779 SetTransparency(isTransparent);
781 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_WINDOW_ICONIFY_STATE_CHANGE, EcoreEventWindowIconifyStateChanged, this));
782 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_FOCUS_IN, EcoreEventWindowFocusIn, this));
783 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_FOCUS_OUT, EcoreEventWindowFocusOut, this));
784 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_OUTPUT_TRANSFORM, EcoreEventOutputTransform, this));
785 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_IGNORE_OUTPUT_TRANSFORM, EcoreEventIgnoreOutputTransform, this));
787 // Register Rotate event
788 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_WINDOW_ROTATE, EcoreEventRotate, this));
790 // Register Configure event
791 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_WINDOW_CONFIGURE, EcoreEventConfigure, this));
793 // Register Touch events
794 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_DOWN, EcoreEventMouseButtonDown, this));
795 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_UP, EcoreEventMouseButtonUp, this));
796 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_EVENT_MOUSE_MOVE, EcoreEventMouseButtonMove, this));
797 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_CANCEL, EcoreEventMouseButtonCancel, this));
799 // Register Mouse wheel events
800 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_EVENT_MOUSE_WHEEL, EcoreEventMouseWheel, this));
802 // Register Detent event
803 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_EVENT_DETENT_ROTATE, EcoreEventDetentRotation, this));
805 // Register Key events
806 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_EVENT_KEY_DOWN, EcoreEventKeyDown, this));
807 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_EVENT_KEY_UP, EcoreEventKeyUp, this));
809 // Register Selection event - clipboard selection
810 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_DATA_SOURCE_SEND, EcoreEventDataSend, this));
811 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_SELECTION_DATA_READY, EcoreEventDataReceive, this));
813 // Register Effect Start/End event
814 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_EFFECT_START, EcoreEventEffectStart, this));
815 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_EFFECT_END, EcoreEventEffectEnd, this));
817 // Register Keyboard repeat event
818 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_SEAT_KEYBOARD_REPEAT_CHANGED, EcoreEventSeatKeyboardRepeatChanged, this));
820 // Register Window redraw request event
821 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_WINDOW_REDRAW_REQUEST, EcoreEventWindowRedrawRequest, this));
823 // Register Window auxiliary event
824 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_AUX_MESSAGE, EcoreEventWindowAuxiliaryMessage, this));
826 // Register Vconf notify - font name and size
827 vconf_notify_key_changed_for_ui_thread(DALI_VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_NAME, VconfNotifyFontNameChanged, this);
828 vconf_notify_key_changed_for_ui_thread(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, VconfNotifyFontSizeChanged, this);
830 Ecore_Wl2_Display* display = ecore_wl2_connected_display_get(NULL);
831 mDisplay = ecore_wl2_display_get(display);
835 wl_display* displayWrapper = static_cast<wl_display*>(wl_proxy_create_wrapper(mDisplay));
838 mEventQueue = wl_display_create_queue(mDisplay);
841 wl_proxy_set_queue(reinterpret_cast<wl_proxy*>(displayWrapper), mEventQueue);
843 wl_registry* registry = wl_display_get_registry(displayWrapper);
844 wl_registry_add_listener(registry, ®istryListener, this);
847 wl_proxy_wrapper_destroy(displayWrapper);
851 Ecore_Wl2_Input* ecoreWlInput = ecore_wl2_input_default_input_get(display);
855 mKeyMap = ecore_wl2_input_keymap_get(ecoreWlInput);
857 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_SEAT_KEYMAP_CHANGED, EcoreEventSeatKeymapChanged, this));
860 // get auxiliary hint
861 Eina_List* hints = ecore_wl2_window_aux_hints_supported_get(mEcoreWindow);
867 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))))
869 mSupportedAuxiliaryHints.push_back(hint);
871 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::Initialize: %s\n", hint);
876 Eina_Bool WindowBaseEcoreWl2::OnIconifyStateChanged(void* data, int type, void* event)
878 Ecore_Wl2_Event_Window_Iconify_State_Change* iconifyChangedEvent(static_cast<Ecore_Wl2_Event_Window_Iconify_State_Change*>(event));
879 Eina_Bool handled(ECORE_CALLBACK_PASS_ON);
881 if(iconifyChangedEvent->win == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
883 if(iconifyChangedEvent->iconified == EINA_TRUE)
885 mIconifyChangedSignal.Emit(true);
889 mIconifyChangedSignal.Emit(false);
891 handled = ECORE_CALLBACK_DONE;
897 Eina_Bool WindowBaseEcoreWl2::OnFocusIn(void* data, int type, void* event)
899 Ecore_Wl2_Event_Focus_In* focusInEvent(static_cast<Ecore_Wl2_Event_Focus_In*>(event));
901 if(focusInEvent->window == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
903 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "Window EcoreEventWindowFocusIn\n");
905 mFocusChangedSignal.Emit(true);
908 return ECORE_CALLBACK_PASS_ON;
911 Eina_Bool WindowBaseEcoreWl2::OnFocusOut(void* data, int type, void* event)
913 Ecore_Wl2_Event_Focus_Out* focusOutEvent(static_cast<Ecore_Wl2_Event_Focus_Out*>(event));
915 if(focusOutEvent->window == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
917 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "Window EcoreEventWindowFocusOut\n");
919 mFocusChangedSignal.Emit(false);
922 return ECORE_CALLBACK_PASS_ON;
925 Eina_Bool WindowBaseEcoreWl2::OnOutputTransform(void* data, int type, void* event)
927 Ecore_Wl2_Event_Output_Transform* transformEvent(static_cast<Ecore_Wl2_Event_Output_Transform*>(event));
929 if(transformEvent->output == ecore_wl2_window_output_find(mEcoreWindow))
931 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "Window (%p) EcoreEventOutputTransform\n", mEcoreWindow);
933 mScreenRotationAngle = GetScreenRotationAngle();
935 mOutputTransformedSignal.Emit();
938 return ECORE_CALLBACK_PASS_ON;
941 Eina_Bool WindowBaseEcoreWl2::OnIgnoreOutputTransform(void* data, int type, void* event)
943 Ecore_Wl2_Event_Ignore_Output_Transform* ignoreTransformEvent(static_cast<Ecore_Wl2_Event_Ignore_Output_Transform*>(event));
945 if(ignoreTransformEvent->win == mEcoreWindow)
947 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "Window (%p) EcoreEventIgnoreOutputTransform\n", mEcoreWindow);
949 mScreenRotationAngle = GetScreenRotationAngle();
951 mOutputTransformedSignal.Emit();
954 return ECORE_CALLBACK_PASS_ON;
957 void WindowBaseEcoreWl2::OnRotation(void* data, int type, void* event)
959 Ecore_Wl2_Event_Window_Rotation* ev(static_cast<Ecore_Wl2_Event_Window_Rotation*>(event));
961 if(ev->win == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
963 DALI_LOG_RELEASE_INFO("WindowBaseEcoreWl2::OnRotation, angle: %d, width: %d, height: %d\n", ev->angle, ev->w, ev->h);
965 RotationEvent rotationEvent;
966 rotationEvent.angle = ev->angle;
967 rotationEvent.winResize = 0;
969 if(ev->w == 0 || ev->h == 0)
971 // When rotation event does not have the window width or height,
972 // previous DALi side window's size are used.
973 ev->w = mWindowPositionSize.width;
974 ev->h = mWindowPositionSize.height;
977 mWindowRotationAngle = ev->angle;
979 mWindowPositionSize.width = ev->w;
980 mWindowPositionSize.height = ev->h;
982 PositionSize newPositionSize = RecalculatePositionSizeToCurrentOrientation(mWindowPositionSize);
984 rotationEvent.x = newPositionSize.x;
985 rotationEvent.y = newPositionSize.y;
986 rotationEvent.width = newPositionSize.width;
987 rotationEvent.height = newPositionSize.height;
989 mRotationSignal.Emit(rotationEvent);
993 void WindowBaseEcoreWl2::OnConfiguration(void* data, int type, void* event)
995 Ecore_Wl2_Event_Window_Configure* ev(static_cast<Ecore_Wl2_Event_Window_Configure*>(event));
997 if(ev && ev->win == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
999 // Note: To comply with the wayland protocol, Dali should make an ack_configure
1000 // by calling ecore_wl2_window_commit
1002 int tempWidth = static_cast<int>(ev->w);
1003 int tempHeight = static_cast<int>(ev->h);
1005 // Initialize with previous size for skip resize when new size is 0.
1006 // When window is just moved or window is resized by client application,
1007 // The configure notification event's size will be 0.
1008 // If new size is 0, the resized work should be skip.
1009 int newWidth = mWindowPositionSize.width;
1010 int newHeight = mWindowPositionSize.height;
1011 bool windowMoved = false, windowResized = false;
1013 if(ev->x != mWindowPositionSize.x || ev->y != mWindowPositionSize.y)
1018 if(tempWidth != 0 && tempHeight != 0 && (tempWidth != mWindowPositionSize.width || tempHeight != mWindowPositionSize.height))
1020 windowResized = true;
1021 newWidth = tempWidth;
1022 newHeight = tempHeight;
1025 if(windowMoved || windowResized)
1027 mWindowPositionSize.x = ev->x;
1028 mWindowPositionSize.y = ev->y;
1029 mWindowPositionSize.width = newWidth;
1030 mWindowPositionSize.height = newHeight;
1031 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);
1033 ecore_wl2_window_geometry_set(mEcoreWindow, mWindowPositionSize.x, mWindowPositionSize.y, mWindowPositionSize.width, mWindowPositionSize.height);
1035 Dali::PositionSize newPositionSize = RecalculatePositionSizeToCurrentOrientation(mWindowPositionSize);
1036 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);
1037 mUpdatePositionSizeSignal.Emit(newPositionSize);
1040 ecore_wl2_window_commit(mEcoreWindow, EINA_FALSE);
1044 void WindowBaseEcoreWl2::OnMouseButtonDown(void* data, int type, void* event)
1046 Ecore_Event_Mouse_Button* touchEvent = static_cast<Ecore_Event_Mouse_Button*>(event);
1048 if(touchEvent->window == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
1050 Device::Class::Type deviceClass;
1051 Device::Subclass::Type deviceSubclass;
1053 GetDeviceClass(ecore_device_class_get(touchEvent->dev), deviceClass);
1054 GetDeviceSubclass(ecore_device_subclass_get(touchEvent->dev), deviceSubclass);
1056 PointState::Type state(PointState::DOWN);
1058 if(deviceClass != Device::Class::Type::MOUSE)
1060 // Check if the buttons field is set and ensure it's the primary touch button.
1061 // If this event was triggered by buttons other than the primary button (used for touch), then
1062 // just send an interrupted event to Core.
1063 if(touchEvent->buttons && (touchEvent->buttons != PRIMARY_TOUCH_BUTTON_ID))
1065 state = PointState::INTERRUPTED;
1069 Integration::Point point;
1070 point.SetDeviceId(touchEvent->multi.device);
1071 point.SetState(state);
1072 point.SetScreenPosition(Vector2(touchEvent->x, touchEvent->y));
1073 point.SetRadius(touchEvent->multi.radius, Vector2(touchEvent->multi.radius_x, touchEvent->multi.radius_y));
1074 point.SetPressure(touchEvent->multi.pressure);
1075 point.SetAngle(Degree(touchEvent->multi.angle));
1076 point.SetDeviceClass(deviceClass);
1077 point.SetDeviceSubclass(deviceSubclass);
1078 point.SetMouseButton(static_cast<MouseButton::Type>(touchEvent->buttons));
1080 mTouchEventSignal.Emit(point, touchEvent->timestamp);
1084 void WindowBaseEcoreWl2::OnMouseButtonUp(void* data, int type, void* event)
1086 Ecore_Event_Mouse_Button* touchEvent = static_cast<Ecore_Event_Mouse_Button*>(event);
1088 if(touchEvent->window == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
1090 Device::Class::Type deviceClass;
1091 Device::Subclass::Type deviceSubclass;
1093 GetDeviceClass(ecore_device_class_get(touchEvent->dev), deviceClass);
1094 GetDeviceSubclass(ecore_device_subclass_get(touchEvent->dev), deviceSubclass);
1096 Integration::Point point;
1097 point.SetDeviceId(touchEvent->multi.device);
1098 point.SetState(PointState::UP);
1099 point.SetScreenPosition(Vector2(touchEvent->x, touchEvent->y));
1100 point.SetRadius(touchEvent->multi.radius, Vector2(touchEvent->multi.radius_x, touchEvent->multi.radius_y));
1101 point.SetPressure(touchEvent->multi.pressure);
1102 point.SetAngle(Degree(touchEvent->multi.angle));
1103 point.SetDeviceClass(deviceClass);
1104 point.SetDeviceSubclass(deviceSubclass);
1105 point.SetMouseButton(static_cast<MouseButton::Type>(touchEvent->buttons));
1107 mTouchEventSignal.Emit(point, touchEvent->timestamp);
1111 void WindowBaseEcoreWl2::OnMouseButtonMove(void* data, int type, void* event)
1113 Ecore_Event_Mouse_Move* touchEvent = static_cast<Ecore_Event_Mouse_Move*>(event);
1115 if(touchEvent->window == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
1117 Device::Class::Type deviceClass;
1118 Device::Subclass::Type deviceSubclass;
1120 GetDeviceClass(ecore_device_class_get(touchEvent->dev), deviceClass);
1121 GetDeviceSubclass(ecore_device_subclass_get(touchEvent->dev), deviceSubclass);
1123 Integration::Point point;
1124 point.SetDeviceId(touchEvent->multi.device);
1125 point.SetState(PointState::MOTION);
1126 point.SetScreenPosition(Vector2(touchEvent->x, touchEvent->y));
1127 point.SetRadius(touchEvent->multi.radius, Vector2(touchEvent->multi.radius_x, touchEvent->multi.radius_y));
1128 point.SetPressure(touchEvent->multi.pressure);
1129 point.SetAngle(Degree(touchEvent->multi.angle));
1130 point.SetDeviceClass(deviceClass);
1131 point.SetDeviceSubclass(deviceSubclass);
1133 mTouchEventSignal.Emit(point, touchEvent->timestamp);
1137 void WindowBaseEcoreWl2::OnMouseButtonCancel(void* data, int type, void* event)
1139 Ecore_Event_Mouse_Button* touchEvent = static_cast<Ecore_Event_Mouse_Button*>(event);
1141 if(touchEvent->window == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
1143 Integration::Point point;
1144 point.SetDeviceId(touchEvent->multi.device);
1145 point.SetState(PointState::INTERRUPTED);
1146 point.SetScreenPosition(Vector2(0.0f, 0.0f));
1148 mTouchEventSignal.Emit(point, touchEvent->timestamp);
1150 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::OnMouseButtonCancel\n");
1154 void WindowBaseEcoreWl2::OnMouseWheel(void* data, int type, void* event)
1156 Ecore_Event_Mouse_Wheel* mouseWheelEvent = static_cast<Ecore_Event_Mouse_Wheel*>(event);
1158 if(mouseWheelEvent->window == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
1160 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);
1162 Integration::WheelEvent wheelEvent(Integration::WheelEvent::MOUSE_WHEEL, mouseWheelEvent->direction, mouseWheelEvent->modifiers, Vector2(mouseWheelEvent->x, mouseWheelEvent->y), mouseWheelEvent->z, mouseWheelEvent->timestamp);
1164 mWheelEventSignal.Emit(wheelEvent);
1168 void WindowBaseEcoreWl2::OnDetentRotation(void* data, int type, void* event)
1170 Ecore_Event_Detent_Rotate* detentEvent = static_cast<Ecore_Event_Detent_Rotate*>(event);
1172 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Concise, "WindowBaseEcoreWl2::OnDetentRotation\n");
1174 int32_t clockwise = (detentEvent->direction == ECORE_DETENT_DIRECTION_CLOCKWISE) ? 1 : -1;
1176 Integration::WheelEvent wheelEvent(Integration::WheelEvent::CUSTOM_WHEEL, detentEvent->direction, 0, Vector2(0.0f, 0.0f), clockwise, detentEvent->timestamp);
1178 mWheelEventSignal.Emit(wheelEvent);
1181 void WindowBaseEcoreWl2::OnKeyDown(void* data, int type, void* event)
1183 Ecore_Event_Key* keyEvent = static_cast<Ecore_Event_Key*>(event);
1185 if(keyEvent->window == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
1187 std::string keyName(keyEvent->keyname);
1188 std::string logicalKey("");
1189 std::string keyString("");
1190 std::string compose("");
1192 DALI_LOG_RELEASE_INFO("OnKeyDown Start [%s]\n", keyName.c_str());
1194 // Ensure key compose string is not NULL as keys like SHIFT or arrow have a null string.
1195 if(keyEvent->compose)
1197 compose = keyEvent->compose;
1200 // Ensure key symbol is not NULL as keys like SHIFT have a null string.
1203 logicalKey = keyEvent->key;
1207 GetKeyCode(keyName, keyCode); // Get key code dynamically.
1211 // Get a specific key code from dali key look up table.
1212 keyCode = KeyLookup::GetDaliKeyCode(keyEvent->keyname);
1215 keyCode = (keyCode == -1) ? 0 : keyCode;
1216 int modifier(keyEvent->modifiers);
1217 unsigned long time = keyEvent->timestamp;
1218 if(!strncmp(keyEvent->keyname, "Keycode-", 8))
1220 keyCode = atoi(keyEvent->keyname + 8);
1223 // Ensure key event string is not NULL as keys like SHIFT have a null string.
1224 if(keyEvent->string)
1226 keyString = keyEvent->string;
1229 std::string deviceName;
1230 Device::Class::Type deviceClass;
1231 Device::Subclass::Type deviceSubclass;
1233 GetDeviceName(keyEvent, deviceName);
1234 GetDeviceClass(ecore_device_class_get(keyEvent->dev), deviceClass);
1235 GetDeviceSubclass(ecore_device_subclass_get(keyEvent->dev), deviceSubclass);
1237 Integration::KeyEvent keyEvent(keyName, logicalKey, keyString, keyCode, modifier, time, Integration::KeyEvent::DOWN, compose, deviceName, deviceClass, deviceSubclass);
1239 mKeyEventSignal.Emit(keyEvent);
1241 DALI_LOG_RELEASE_INFO("OnKeyDown End [%s]\n", keyName.c_str());
1245 void WindowBaseEcoreWl2::OnKeyUp(void* data, int type, void* event)
1247 Ecore_Event_Key* keyEvent = static_cast<Ecore_Event_Key*>(event);
1249 if(keyEvent->window == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
1251 #if defined(ECORE_VERSION_MAJOR) && (ECORE_VERSION_MAJOR >= 1) && defined(ECORE_VERSION_MINOR) && (ECORE_VERSION_MINOR >= 23)
1252 // Cancel processing flag is sent because this key event will combine with the previous key. So, the event should not actually perform anything.
1253 if(keyEvent->event_flags & ECORE_EVENT_FLAG_CANCEL)
1255 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::OnKeyUp: This event flag indicates the event is canceled. \n");
1258 #endif // Since ecore 1.23 version
1260 std::string keyName(keyEvent->keyname);
1261 std::string logicalKey("");
1262 std::string keyString("");
1263 std::string compose("");
1265 DALI_LOG_RELEASE_INFO("OnKeyUp Start [%s]\n", keyName.c_str());
1267 // Ensure key compose string is not NULL as keys like SHIFT or arrow have a null string.
1268 if(keyEvent->compose)
1270 compose = keyEvent->compose;
1273 // Ensure key symbol is not NULL as keys like SHIFT have a null string.
1276 logicalKey = keyEvent->key;
1280 GetKeyCode(keyName, keyCode); // Get key code dynamically.
1284 // Get a specific key code from dali key look up table.
1285 keyCode = KeyLookup::GetDaliKeyCode(keyEvent->keyname);
1288 keyCode = (keyCode == -1) ? 0 : keyCode;
1289 int modifier(keyEvent->modifiers);
1290 unsigned long time = keyEvent->timestamp;
1291 if(!strncmp(keyEvent->keyname, "Keycode-", 8))
1293 keyCode = atoi(keyEvent->keyname + 8);
1296 // Ensure key event string is not NULL as keys like SHIFT have a null string.
1297 if(keyEvent->string)
1299 keyString = keyEvent->string;
1302 std::string deviceName;
1303 Device::Class::Type deviceClass;
1304 Device::Subclass::Type deviceSubclass;
1306 GetDeviceName(keyEvent, deviceName);
1307 GetDeviceClass(ecore_device_class_get(keyEvent->dev), deviceClass);
1308 GetDeviceSubclass(ecore_device_subclass_get(keyEvent->dev), deviceSubclass);
1310 Integration::KeyEvent keyEvent(keyName, logicalKey, keyString, keyCode, modifier, time, Integration::KeyEvent::UP, compose, deviceName, deviceClass, deviceSubclass);
1312 mKeyEventSignal.Emit(keyEvent);
1314 DALI_LOG_RELEASE_INFO("OnKeyUp End [%s]\n", keyName.c_str());
1318 void WindowBaseEcoreWl2::OnDataSend(void* data, int type, void* event)
1320 mSelectionDataSendSignal.Emit(event);
1323 void WindowBaseEcoreWl2::OnDataReceive(void* data, int type, void* event)
1325 mSelectionDataReceivedSignal.Emit(event);
1328 void WindowBaseEcoreWl2::OnFontNameChanged()
1330 mStyleChangedSignal.Emit(StyleChange::DEFAULT_FONT_CHANGE);
1333 void WindowBaseEcoreWl2::OnFontSizeChanged()
1335 mStyleChangedSignal.Emit(StyleChange::DEFAULT_FONT_SIZE_CHANGE);
1338 void WindowBaseEcoreWl2::OnTransitionEffectEvent(WindowEffectState state, WindowEffectType type)
1340 mTransitionEffectEventSignal.Emit(state, type);
1343 void WindowBaseEcoreWl2::OnKeyboardRepeatSettingsChanged()
1345 mKeyboardRepeatSettingsChangedSignal.Emit();
1348 void WindowBaseEcoreWl2::OnEcoreEventWindowRedrawRequest()
1350 mWindowRedrawRequestSignal.Emit();
1353 void WindowBaseEcoreWl2::OnEcoreEventWindowAuxiliaryMessage(void* event)
1355 Ecore_Wl2_Event_Aux_Message* message = static_cast<Ecore_Wl2_Event_Aux_Message*>(event);
1358 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::OnEcoreEventWindowAuxiliaryMessage, key:%s, value:%s \n", message->key, message->val);
1359 std::string key(message->key);
1360 std::string value(message->val);
1361 Dali::Property::Array options;
1363 if(message->options)
1367 EINA_LIST_FOREACH(message->options, l, data)
1369 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::OnEcoreEventWindowAuxiliaryMessage, option: %s\n", (char*)data);
1370 std::string option(static_cast<char*>(data));
1371 options.Add(option);
1375 mAuxiliaryMessageSignal.Emit(key, value, options);
1379 void WindowBaseEcoreWl2::KeymapChanged(void* data, int type, void* event)
1381 Ecore_Wl2_Event_Seat_Keymap_Changed* changed = static_cast<Ecore_Wl2_Event_Seat_Keymap_Changed*>(event);
1382 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::KeymapChanged, keymap id[ %d ]\n", changed->id);
1383 Ecore_Wl2_Input* ecoreWlInput = ecore_wl2_input_default_input_get(changed->display);
1386 mKeyMap = ecore_wl2_input_keymap_get(ecoreWlInput);
1390 void WindowBaseEcoreWl2::RegistryGlobalCallback(void* data, struct wl_registry* registry, uint32_t name, const char* interface, uint32_t version)
1392 if(strcmp(interface, tizen_policy_interface.name) == 0)
1394 uint32_t clientVersion = std::min(version, MAX_TIZEN_CLIENT_VERSION);
1396 mTizenPolicy = static_cast<tizen_policy*>(wl_registry_bind(registry, name, &tizen_policy_interface, clientVersion));
1399 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::RegistryGlobalCallback: wl_registry_bind(tizen_policy_interface) is failed.\n");
1403 tizen_policy_add_listener(mTizenPolicy, &tizenPolicyListener, data);
1405 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::RegistryGlobalCallback: tizen_policy_add_listener is called.\n");
1407 else if(strcmp(interface, tizen_display_policy_interface.name) == 0)
1409 mTizenDisplayPolicy = static_cast<tizen_display_policy*>(wl_registry_bind(registry, name, &tizen_display_policy_interface, version));
1410 if(!mTizenDisplayPolicy)
1412 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::RegistryGlobalCallback: wl_registry_bind(tizen_display_policy_interface) is failed.\n");
1416 tizen_display_policy_add_listener(mTizenDisplayPolicy, &tizenDisplayPolicyListener, data);
1418 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::RegistryGlobalCallback: tizen_display_policy_add_listener is called.\n");
1422 void WindowBaseEcoreWl2::RegistryGlobalCallbackRemove(void* data, struct wl_registry* registry, uint32_t id)
1424 mTizenPolicy = NULL;
1425 mTizenDisplayPolicy = NULL;
1428 void WindowBaseEcoreWl2::TizenPolicyNotificationChangeDone(void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, int32_t level, uint32_t state)
1430 mNotificationLevel = level;
1431 mNotificationChangeState = state;
1432 mNotificationLevelChangeDone = true;
1434 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::TizenPolicyNotificationChangeDone: level = %d, state = %d\n", level, state);
1437 void WindowBaseEcoreWl2::TizenPolicyScreenModeChangeDone(void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, uint32_t mode, uint32_t state)
1439 mScreenOffMode = mode;
1440 mScreenOffModeChangeState = state;
1441 mScreenOffModeChangeDone = true;
1443 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::TizenPolicyScreenModeChangeDone: mode = %d, state = %d\n", mode, state);
1446 void WindowBaseEcoreWl2::DisplayPolicyBrightnessChangeDone(void* data, struct tizen_display_policy* displayPolicy, struct wl_surface* surface, int32_t brightness, uint32_t state)
1448 mBrightness = brightness;
1449 mBrightnessChangeState = state;
1450 mBrightnessChangeDone = true;
1452 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::DisplayPolicyBrightnessChangeDone: brightness = %d, state = %d\n", brightness, state);
1455 void WindowBaseEcoreWl2::GetKeyCode(std::string keyName, int32_t& keyCode)
1457 xkb_keysym_t sym = XKB_KEY_NoSymbol;
1458 KeyCodeMap foundKeyCode;
1460 sym = xkb_keysym_from_name(keyName.c_str(), XKB_KEYSYM_NO_FLAGS);
1461 if(sym == XKB_KEY_NoSymbol)
1463 DALI_LOG_ERROR("Failed to get keysym in WindowBaseEcoreWl2\n");
1467 foundKeyCode.keySym = sym;
1468 foundKeyCode.isKeyCode = false;
1469 xkb_keymap_key_for_each(mKeyMap, FindKeyCode, &foundKeyCode);
1470 keyCode = static_cast<int32_t>(foundKeyCode.keyCode);
1473 Any WindowBaseEcoreWl2::GetNativeWindow()
1475 return mEcoreWindow;
1478 int WindowBaseEcoreWl2::GetNativeWindowId()
1480 return ecore_wl2_window_id_get(mEcoreWindow);
1483 std::string WindowBaseEcoreWl2::GetNativeWindowResourceId()
1485 #ifdef OVER_TIZEN_VERSION_7
1486 return std::to_string(ecore_wl2_window_resource_id_get(mEcoreWindow));
1488 return std::string();
1492 EGLNativeWindowType WindowBaseEcoreWl2::CreateEglWindow(int width, int height)
1494 int totalAngle = (mWindowRotationAngle + mScreenRotationAngle) % 360;
1495 if(totalAngle == 90 || totalAngle == 270)
1497 mEglWindow = wl_egl_window_create(mWlSurface, height, width);
1501 mEglWindow = wl_egl_window_create(mWlSurface, width, height);
1504 return static_cast<EGLNativeWindowType>(mEglWindow);
1507 void WindowBaseEcoreWl2::DestroyEglWindow()
1509 if(mEglWindow != NULL)
1511 wl_egl_window_destroy(mEglWindow);
1516 void WindowBaseEcoreWl2::SetEglWindowRotation(int angle)
1518 wl_egl_window_tizen_rotation rotation;
1524 rotation = WL_EGL_WINDOW_TIZEN_ROTATION_0;
1529 rotation = WL_EGL_WINDOW_TIZEN_ROTATION_270;
1534 rotation = WL_EGL_WINDOW_TIZEN_ROTATION_180;
1539 rotation = WL_EGL_WINDOW_TIZEN_ROTATION_90;
1544 rotation = WL_EGL_WINDOW_TIZEN_ROTATION_0;
1549 wl_egl_window_tizen_set_rotation(mEglWindow, rotation);
1552 void WindowBaseEcoreWl2::SetEglWindowBufferTransform(int angle)
1554 wl_output_transform bufferTransform;
1560 bufferTransform = WL_OUTPUT_TRANSFORM_NORMAL;
1565 bufferTransform = WL_OUTPUT_TRANSFORM_90;
1570 bufferTransform = WL_OUTPUT_TRANSFORM_180;
1575 bufferTransform = WL_OUTPUT_TRANSFORM_270;
1580 bufferTransform = WL_OUTPUT_TRANSFORM_NORMAL;
1585 wl_egl_window_tizen_set_buffer_transform(mEglWindow, bufferTransform);
1588 void WindowBaseEcoreWl2::SetEglWindowTransform(int angle)
1590 wl_output_transform windowTransform;
1596 windowTransform = WL_OUTPUT_TRANSFORM_NORMAL;
1601 windowTransform = WL_OUTPUT_TRANSFORM_90;
1606 windowTransform = WL_OUTPUT_TRANSFORM_180;
1611 windowTransform = WL_OUTPUT_TRANSFORM_270;
1616 windowTransform = WL_OUTPUT_TRANSFORM_NORMAL;
1621 wl_egl_window_tizen_set_window_transform(mEglWindow, windowTransform);
1624 void WindowBaseEcoreWl2::ResizeEglWindow(PositionSize positionSize)
1626 wl_egl_window_resize(mEglWindow, positionSize.width, positionSize.height, positionSize.x, positionSize.y);
1628 // Note: Both "Resize" and "MoveResize" cases can reach here, but only "MoveResize" needs to submit serial number
1629 if(mMoveResizeSerial != mLastSubmittedMoveResizeSerial)
1631 wl_egl_window_tizen_set_window_serial(mEglWindow, mMoveResizeSerial);
1632 mLastSubmittedMoveResizeSerial = mMoveResizeSerial;
1636 bool WindowBaseEcoreWl2::IsEglWindowRotationSupported()
1639 wl_egl_window_tizen_capability capability = static_cast<wl_egl_window_tizen_capability>(wl_egl_window_tizen_get_capabilities(mEglWindow));
1640 if(capability == WL_EGL_WINDOW_TIZEN_CAPABILITY_ROTATION_SUPPORTED)
1642 mSupportedPreProtation = true;
1645 mSupportedPreProtation = false;
1649 PositionSize WindowBaseEcoreWl2::RecalculatePositionSizeToSystem(PositionSize positionSize)
1651 PositionSize newPositionSize;
1653 if(mWindowRotationAngle == 90)
1655 newPositionSize.x = positionSize.y;
1656 newPositionSize.y = mScreenHeight - (positionSize.x + positionSize.width);
1657 newPositionSize.width = positionSize.height;
1658 newPositionSize.height = positionSize.width;
1660 else if(mWindowRotationAngle == 180)
1662 newPositionSize.x = mScreenWidth - (positionSize.x + positionSize.width);
1663 newPositionSize.y = mScreenHeight - (positionSize.y + positionSize.height);
1664 newPositionSize.width = positionSize.width;
1665 newPositionSize.height = positionSize.height;
1667 else if(mWindowRotationAngle == 270)
1669 newPositionSize.x = mScreenWidth - (positionSize.y + positionSize.height);
1670 newPositionSize.y = positionSize.x;
1671 newPositionSize.width = positionSize.height;
1672 newPositionSize.height = positionSize.width;
1676 newPositionSize.x = positionSize.x;
1677 newPositionSize.y = positionSize.y;
1678 newPositionSize.width = positionSize.width;
1679 newPositionSize.height = positionSize.height;
1682 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);
1683 DALI_LOG_RELEASE_INFO("recalc coord x[%d], y[%d], w{%d], h[%d]\n", newPositionSize.x, newPositionSize.y, newPositionSize.width, newPositionSize.height);
1685 return newPositionSize;
1688 PositionSize WindowBaseEcoreWl2::RecalculatePositionSizeToCurrentOrientation(PositionSize positionSize)
1690 PositionSize newPositionSize;
1692 if(mWindowRotationAngle == 90)
1694 newPositionSize.x = mScreenHeight - (positionSize.y + positionSize.height);
1695 newPositionSize.y = positionSize.x;
1696 newPositionSize.width = positionSize.height;
1697 newPositionSize.height = positionSize.width;
1699 else if(mWindowRotationAngle == 180)
1701 newPositionSize.x = mScreenWidth - (positionSize.x + positionSize.width);
1702 newPositionSize.y = mScreenHeight - (positionSize.y + positionSize.height);
1703 newPositionSize.width = positionSize.width;
1704 newPositionSize.height = positionSize.height;
1706 else if(mWindowRotationAngle == 270)
1708 newPositionSize.x = positionSize.y;
1709 newPositionSize.y = mScreenWidth - (positionSize.x + positionSize.width);
1710 newPositionSize.width = positionSize.height;
1711 newPositionSize.height = positionSize.width;
1715 newPositionSize.x = positionSize.x;
1716 newPositionSize.y = positionSize.y;
1717 newPositionSize.width = positionSize.width;
1718 newPositionSize.height = positionSize.height;
1721 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);
1722 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);
1724 return newPositionSize;
1727 void WindowBaseEcoreWl2::Move(PositionSize positionSize)
1729 PositionSize newPositionSize = RecalculatePositionSizeToSystem(positionSize);
1731 mWindowPositionSize = newPositionSize;
1732 DALI_LOG_RELEASE_INFO("ecore_wl2_window_position_set x[%d], y[%d]\n", newPositionSize.x, newPositionSize.y);
1733 ecore_wl2_window_position_set(mEcoreWindow, newPositionSize.x, newPositionSize.y);
1736 void WindowBaseEcoreWl2::Resize(PositionSize positionSize)
1738 PositionSize newPositionSize = RecalculatePositionSizeToSystem(positionSize);
1740 mWindowPositionSize = newPositionSize;
1741 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);
1742 ecore_wl2_window_sync_geometry_set(mEcoreWindow, ++mMoveResizeSerial, newPositionSize.x, newPositionSize.y, newPositionSize.width, newPositionSize.height);
1745 void WindowBaseEcoreWl2::MoveResize(PositionSize positionSize)
1747 PositionSize newPositionSize = RecalculatePositionSizeToSystem(positionSize);
1749 mWindowPositionSize = newPositionSize;
1750 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);
1751 ecore_wl2_window_sync_geometry_set(mEcoreWindow, ++mMoveResizeSerial, newPositionSize.x, newPositionSize.y, newPositionSize.width, newPositionSize.height);
1754 void WindowBaseEcoreWl2::SetClass(const std::string& name, const std::string& className)
1756 ecore_wl2_window_title_set(mEcoreWindow, name.c_str());
1757 ecore_wl2_window_class_set(mEcoreWindow, className.c_str());
1760 void WindowBaseEcoreWl2::Raise()
1762 // Use ecore_wl2_window_activate to prevent the window shown without rendering
1763 ecore_wl2_window_activate(mEcoreWindow);
1766 void WindowBaseEcoreWl2::Lower()
1768 ecore_wl2_window_lower(mEcoreWindow);
1771 void WindowBaseEcoreWl2::Activate()
1773 ecore_wl2_window_activate(mEcoreWindow);
1776 void WindowBaseEcoreWl2::Maximize(bool maximize)
1778 ecore_wl2_window_maximized_set(mEcoreWindow, maximize);
1781 bool WindowBaseEcoreWl2::IsMaximized() const
1783 return ecore_wl2_window_maximized_get(mEcoreWindow);
1786 void WindowBaseEcoreWl2::SetMaximumSize(Dali::Window::WindowSize size)
1788 DALI_LOG_RELEASE_INFO("ecore_wl2_window_maximum_size_set, width: %d, height: %d\n", size.GetWidth(), size.GetHeight());
1789 ecore_wl2_window_maximum_size_set(mEcoreWindow, size.GetWidth(), size.GetHeight());
1792 void WindowBaseEcoreWl2::Minimize(bool minimize)
1794 ecore_wl2_window_iconified_set(mEcoreWindow, minimize);
1797 bool WindowBaseEcoreWl2::IsMinimized() const
1799 return ecore_wl2_window_iconified_get(mEcoreWindow);
1802 void WindowBaseEcoreWl2::SetMimimumSize(Dali::Window::WindowSize size)
1804 DALI_LOG_RELEASE_INFO("ecore_wl2_window_minimum_size_set, width: %d, height: %d\n", size.GetWidth(), size.GetHeight());
1805 ecore_wl2_window_minimum_size_set(mEcoreWindow, size.GetWidth(), size.GetHeight());
1808 void WindowBaseEcoreWl2::SetAvailableAnlges(const std::vector<int>& angles)
1810 int rotations[4] = {0};
1811 DALI_LOG_RELEASE_INFO("WindowBaseEcoreWl2::SetAvailableAnlges, angle's count: %d, angles\n", angles.size());
1812 for(std::size_t i = 0; i < angles.size(); ++i)
1814 rotations[i] = static_cast<int>(angles[i]);
1815 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "%d ", rotations[i]);
1817 ecore_wl2_window_available_rotations_set(mEcoreWindow, rotations, angles.size());
1820 void WindowBaseEcoreWl2::SetPreferredAngle(int angle)
1822 DALI_LOG_RELEASE_INFO("WindowBaseEcoreWl2::SetPreferredAngle, angle: %d\n", angle);
1823 ecore_wl2_window_preferred_rotation_set(mEcoreWindow, angle);
1826 void WindowBaseEcoreWl2::SetAcceptFocus(bool accept)
1828 ecore_wl2_window_focus_skip_set(mEcoreWindow, !accept);
1831 void WindowBaseEcoreWl2::Show()
1835 ecore_wl2_window_geometry_set(mEcoreWindow, mWindowPositionSize.x, mWindowPositionSize.y, mWindowPositionSize.width, mWindowPositionSize.height);
1839 ecore_wl2_window_show(mEcoreWindow);
1842 void WindowBaseEcoreWl2::Hide()
1845 ecore_wl2_window_hide(mEcoreWindow);
1848 unsigned int WindowBaseEcoreWl2::GetSupportedAuxiliaryHintCount() const
1850 return mSupportedAuxiliaryHints.size();
1853 std::string WindowBaseEcoreWl2::GetSupportedAuxiliaryHint(unsigned int index) const
1855 if(index >= GetSupportedAuxiliaryHintCount())
1857 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetSupportedAuxiliaryHint: Invalid index! [%d]\n", index);
1860 return mSupportedAuxiliaryHints[index];
1863 unsigned int WindowBaseEcoreWl2::AddAuxiliaryHint(const std::string& hint, const std::string& value)
1865 bool supported = false;
1867 // Check if the hint is suppported
1868 for(std::vector<std::string>::iterator iter = mSupportedAuxiliaryHints.begin(); iter != mSupportedAuxiliaryHints.end(); ++iter)
1879 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Concise, "WindowBaseEcoreWl2::AddAuxiliaryHint: Not supported auxiliary hint [%s]\n", hint.c_str());
1883 // Check if the hint is already added
1884 for(unsigned int i = 0; i < mAuxiliaryHints.size(); i++)
1886 if(mAuxiliaryHints[i].first == hint)
1888 // Just change the value
1889 mAuxiliaryHints[i].second = value;
1891 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::AddAuxiliaryHint: Change! hint = %s, value = %s, id = %d\n", hint.c_str(), value.c_str(), i + 1);
1893 return i + 1; // id is index + 1
1898 mAuxiliaryHints.push_back(std::pair<std::string, std::string>(hint, value));
1900 unsigned int id = mAuxiliaryHints.size();
1902 ecore_wl2_window_aux_hint_add(mEcoreWindow, static_cast<int>(id), hint.c_str(), value.c_str());
1904 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::AddAuxiliaryHint: hint = %s, value = %s, id = %d\n", hint.c_str(), value.c_str(), id);
1909 bool WindowBaseEcoreWl2::RemoveAuxiliaryHint(unsigned int id)
1911 if(id == 0 || id > mAuxiliaryHints.size())
1913 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Concise, "WindowBaseEcoreWl2::RemoveAuxiliaryHint: Invalid id [%d]\n", id);
1917 mAuxiliaryHints[id - 1].second = std::string();
1919 ecore_wl2_window_aux_hint_del(mEcoreWindow, static_cast<int>(id));
1921 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::RemoveAuxiliaryHint: id = %d, hint = %s\n", id, mAuxiliaryHints[id - 1].first.c_str());
1926 bool WindowBaseEcoreWl2::SetAuxiliaryHintValue(unsigned int id, const std::string& value)
1928 if(id == 0 || id > mAuxiliaryHints.size())
1930 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Concise, "WindowBaseEcoreWl2::SetAuxiliaryHintValue: Invalid id [%d]\n", id);
1934 mAuxiliaryHints[id - 1].second = value;
1936 ecore_wl2_window_aux_hint_change(mEcoreWindow, static_cast<int>(id), value.c_str());
1938 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());
1943 std::string WindowBaseEcoreWl2::GetAuxiliaryHintValue(unsigned int id) const
1945 if(id == 0 || id > mAuxiliaryHints.size())
1947 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Concise, "WindowBaseEcoreWl2::GetAuxiliaryHintValue: Invalid id [%d]\n", id);
1948 return std::string();
1951 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());
1953 return mAuxiliaryHints[id - 1].second;
1956 unsigned int WindowBaseEcoreWl2::GetAuxiliaryHintId(const std::string& hint) const
1958 for(unsigned int i = 0; i < mAuxiliaryHints.size(); i++)
1960 if(mAuxiliaryHints[i].first == hint)
1962 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetAuxiliaryHintId: hint = %s, id = %d\n", hint.c_str(), i + 1);
1967 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetAuxiliaryHintId: Invalid hint! [%s]\n", hint.c_str());
1972 void WindowBaseEcoreWl2::SetInputRegion(const Rect<int>& inputRegion)
1974 ecore_wl2_window_input_region_set(mEcoreWindow, inputRegion.x, inputRegion.y, inputRegion.width, inputRegion.height);
1977 void WindowBaseEcoreWl2::SetType(Dali::WindowType type)
1982 Ecore_Wl2_Window_Type windowType;
1986 case Dali::WindowType::NORMAL:
1988 windowType = ECORE_WL2_WINDOW_TYPE_TOPLEVEL;
1991 case Dali::WindowType::NOTIFICATION:
1993 windowType = ECORE_WL2_WINDOW_TYPE_NOTIFICATION;
1996 case Dali::WindowType::UTILITY:
1998 windowType = ECORE_WL2_WINDOW_TYPE_UTILITY;
2001 case Dali::WindowType::DIALOG:
2003 windowType = ECORE_WL2_WINDOW_TYPE_DIALOG;
2006 case Dali::WindowType::IME:
2008 windowType = ECORE_WL2_WINDOW_TYPE_NONE;
2013 windowType = ECORE_WL2_WINDOW_TYPE_TOPLEVEL;
2017 ecore_wl2_window_type_set(mEcoreWindow, windowType);
2021 Dali::WindowType WindowBaseEcoreWl2::GetType() const
2026 Dali::WindowOperationResult WindowBaseEcoreWl2::SetNotificationLevel(Dali::WindowNotificationLevel level)
2028 while(!mTizenPolicy)
2030 wl_display_dispatch_queue(mDisplay, mEventQueue);
2033 int notificationLevel;
2037 case Dali::WindowNotificationLevel::NONE:
2039 notificationLevel = TIZEN_POLICY_LEVEL_NONE;
2042 case Dali::WindowNotificationLevel::BASE:
2044 notificationLevel = TIZEN_POLICY_LEVEL_DEFAULT;
2047 case Dali::WindowNotificationLevel::MEDIUM:
2049 notificationLevel = TIZEN_POLICY_LEVEL_MEDIUM;
2052 case Dali::WindowNotificationLevel::HIGH:
2054 notificationLevel = TIZEN_POLICY_LEVEL_HIGH;
2057 case Dali::WindowNotificationLevel::TOP:
2059 notificationLevel = TIZEN_POLICY_LEVEL_TOP;
2064 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetNotificationLevel: invalid level [%d]\n", level);
2065 notificationLevel = TIZEN_POLICY_LEVEL_DEFAULT;
2070 mNotificationLevelChangeDone = false;
2071 mNotificationChangeState = TIZEN_POLICY_ERROR_STATE_NONE;
2073 tizen_policy_set_notification_level(mTizenPolicy, ecore_wl2_window_surface_get(mEcoreWindow), notificationLevel);
2077 while(!mNotificationLevelChangeDone && count < 3)
2079 ecore_wl2_display_flush(ecore_wl2_connected_display_get(NULL));
2080 wl_display_dispatch_queue(mDisplay, mEventQueue);
2084 if(!mNotificationLevelChangeDone)
2086 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetNotificationLevel: Level change is failed [%d, %d]\n", level, mNotificationChangeState);
2087 return Dali::WindowOperationResult::UNKNOWN_ERROR;
2089 else if(mNotificationChangeState == TIZEN_POLICY_ERROR_STATE_PERMISSION_DENIED)
2091 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetNotificationLevel: Permission denied! [%d]\n", level);
2092 return Dali::WindowOperationResult::PERMISSION_DENIED;
2095 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetNotificationLevel: Level is changed [%d]\n", mNotificationLevel);
2097 return Dali::WindowOperationResult::SUCCEED;
2100 Dali::WindowNotificationLevel WindowBaseEcoreWl2::GetNotificationLevel() const
2102 while(!mTizenPolicy)
2104 wl_display_dispatch_queue(mDisplay, mEventQueue);
2109 while(!mNotificationLevelChangeDone && count < 3)
2111 ecore_wl2_display_flush(ecore_wl2_connected_display_get(NULL));
2112 wl_display_dispatch_queue(mDisplay, mEventQueue);
2116 if(!mNotificationLevelChangeDone)
2118 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetNotificationLevel: Error! [%d]\n", mNotificationChangeState);
2119 return Dali::WindowNotificationLevel::NONE;
2122 Dali::WindowNotificationLevel level;
2124 switch(mNotificationLevel)
2126 case TIZEN_POLICY_LEVEL_NONE:
2128 level = Dali::WindowNotificationLevel::NONE;
2131 case TIZEN_POLICY_LEVEL_DEFAULT:
2133 level = Dali::WindowNotificationLevel::BASE;
2136 case TIZEN_POLICY_LEVEL_MEDIUM:
2138 level = Dali::WindowNotificationLevel::MEDIUM;
2141 case TIZEN_POLICY_LEVEL_HIGH:
2143 level = Dali::WindowNotificationLevel::HIGH;
2146 case TIZEN_POLICY_LEVEL_TOP:
2148 level = Dali::WindowNotificationLevel::TOP;
2153 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetNotificationLevel: invalid level [%d]\n", mNotificationLevel);
2154 level = Dali::WindowNotificationLevel::NONE;
2159 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetNotificationLevel: level [%d]\n", mNotificationLevel);
2164 void WindowBaseEcoreWl2::SetOpaqueState(bool opaque)
2166 while(!mTizenPolicy)
2168 wl_display_dispatch_queue(mDisplay, mEventQueue);
2171 tizen_policy_set_opaque_state(mTizenPolicy, ecore_wl2_window_surface_get(mEcoreWindow), (opaque ? 1 : 0));
2174 Dali::WindowOperationResult WindowBaseEcoreWl2::SetScreenOffMode(WindowScreenOffMode screenOffMode)
2176 while(!mTizenPolicy)
2178 wl_display_dispatch_queue(mDisplay, mEventQueue);
2181 mScreenOffModeChangeDone = false;
2182 mScreenOffModeChangeState = TIZEN_POLICY_ERROR_STATE_NONE;
2184 unsigned int mode = 0;
2186 switch(screenOffMode)
2188 case WindowScreenOffMode::TIMEOUT:
2193 case WindowScreenOffMode::NEVER:
2200 tizen_policy_set_window_screen_mode(mTizenPolicy, ecore_wl2_window_surface_get(mEcoreWindow), mode);
2204 while(!mScreenOffModeChangeDone && count < 3)
2206 ecore_wl2_display_flush(ecore_wl2_connected_display_get(NULL));
2207 wl_display_dispatch_queue(mDisplay, mEventQueue);
2211 if(!mScreenOffModeChangeDone)
2213 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetScreenOffMode: Screen mode change is failed [%d, %d]\n", screenOffMode, mScreenOffModeChangeState);
2214 return Dali::WindowOperationResult::UNKNOWN_ERROR;
2216 else if(mScreenOffModeChangeState == TIZEN_POLICY_ERROR_STATE_PERMISSION_DENIED)
2218 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetScreenOffMode: Permission denied! [%d]\n", screenOffMode);
2219 return Dali::WindowOperationResult::PERMISSION_DENIED;
2222 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetScreenOffMode: Screen mode is changed [%d]\n", mScreenOffMode);
2224 return Dali::WindowOperationResult::SUCCEED;
2227 WindowScreenOffMode WindowBaseEcoreWl2::GetScreenOffMode() const
2229 while(!mTizenPolicy)
2231 wl_display_dispatch_queue(mDisplay, mEventQueue);
2236 while(!mScreenOffModeChangeDone && count < 3)
2238 ecore_wl2_display_flush(ecore_wl2_connected_display_get(NULL));
2239 wl_display_dispatch_queue(mDisplay, mEventQueue);
2243 if(!mScreenOffModeChangeDone)
2245 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetScreenOffMode: Error! [%d]\n", mScreenOffModeChangeState);
2246 return WindowScreenOffMode::TIMEOUT;
2249 WindowScreenOffMode screenMode = WindowScreenOffMode::TIMEOUT;
2251 switch(mScreenOffMode)
2255 screenMode = WindowScreenOffMode::TIMEOUT;
2260 screenMode = WindowScreenOffMode::NEVER;
2265 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetScreenOffMode: screen mode [%d]\n", mScreenOffMode);
2270 Dali::WindowOperationResult WindowBaseEcoreWl2::SetBrightness(int brightness)
2272 while(!mTizenDisplayPolicy)
2274 wl_display_dispatch_queue(mDisplay, mEventQueue);
2277 mBrightnessChangeDone = false;
2278 mBrightnessChangeState = TIZEN_POLICY_ERROR_STATE_NONE;
2280 tizen_display_policy_set_window_brightness(mTizenDisplayPolicy, ecore_wl2_window_surface_get(mEcoreWindow), brightness);
2284 while(!mBrightnessChangeDone && count < 3)
2286 ecore_wl2_display_flush(ecore_wl2_connected_display_get(NULL));
2287 wl_display_dispatch_queue(mDisplay, mEventQueue);
2291 if(!mBrightnessChangeDone)
2293 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetBrightness: Brightness change is failed [%d, %d]\n", brightness, mBrightnessChangeState);
2294 return Dali::WindowOperationResult::UNKNOWN_ERROR;
2296 else if(mBrightnessChangeState == TIZEN_POLICY_ERROR_STATE_PERMISSION_DENIED)
2298 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetBrightness: Permission denied! [%d]\n", brightness);
2299 return Dali::WindowOperationResult::PERMISSION_DENIED;
2302 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetBrightness: Brightness is changed [%d]\n", mBrightness);
2304 return Dali::WindowOperationResult::SUCCEED;
2307 int WindowBaseEcoreWl2::GetBrightness() const
2309 while(!mTizenDisplayPolicy)
2311 wl_display_dispatch_queue(mDisplay, mEventQueue);
2316 while(!mBrightnessChangeDone && count < 3)
2318 ecore_wl2_display_flush(ecore_wl2_connected_display_get(NULL));
2319 wl_display_dispatch_queue(mDisplay, mEventQueue);
2323 if(!mBrightnessChangeDone)
2325 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetBrightness: Error! [%d]\n", mBrightnessChangeState);
2329 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetBrightness: Brightness [%d]\n", mBrightness);
2334 bool WindowBaseEcoreWl2::GrabKey(Dali::KEY key, KeyGrab::KeyGrabMode grabMode)
2336 Ecore_Wl2_Window_Keygrab_Mode mode;
2340 case KeyGrab::TOPMOST:
2342 mode = ECORE_WL2_WINDOW_KEYGRAB_TOPMOST;
2345 case KeyGrab::SHARED:
2347 mode = ECORE_WL2_WINDOW_KEYGRAB_SHARED;
2350 case KeyGrab::OVERRIDE_EXCLUSIVE:
2352 mode = ECORE_WL2_WINDOW_KEYGRAB_OVERRIDE_EXCLUSIVE;
2355 case KeyGrab::EXCLUSIVE:
2357 mode = ECORE_WL2_WINDOW_KEYGRAB_EXCLUSIVE;
2366 return ecore_wl2_window_keygrab_set(mEcoreWindow, KeyLookup::GetKeyName(key), 0, 0, 0, mode);
2369 bool WindowBaseEcoreWl2::UngrabKey(Dali::KEY key)
2371 return ecore_wl2_window_keygrab_unset(mEcoreWindow, KeyLookup::GetKeyName(key), 0, 0);
2374 bool WindowBaseEcoreWl2::GrabKeyList(const Dali::Vector<Dali::KEY>& key, const Dali::Vector<KeyGrab::KeyGrabMode>& grabMode, Dali::Vector<bool>& result)
2376 int keyCount = key.Count();
2377 int keyGrabModeCount = grabMode.Count();
2379 if(keyCount != keyGrabModeCount || keyCount == 0)
2386 Eina_List* keyList = NULL;
2387 Ecore_Wl2_Window_Keygrab_Info* info = new Ecore_Wl2_Window_Keygrab_Info[keyCount];
2389 for(int index = 0; index < keyCount; ++index)
2391 info[index].key = const_cast<char*>(KeyLookup::GetKeyName(key[index]));
2393 switch(grabMode[index])
2395 case KeyGrab::TOPMOST:
2397 info[index].mode = ECORE_WL2_WINDOW_KEYGRAB_TOPMOST;
2400 case KeyGrab::SHARED:
2402 info[index].mode = ECORE_WL2_WINDOW_KEYGRAB_SHARED;
2405 case KeyGrab::OVERRIDE_EXCLUSIVE:
2407 info[index].mode = ECORE_WL2_WINDOW_KEYGRAB_OVERRIDE_EXCLUSIVE;
2410 case KeyGrab::EXCLUSIVE:
2412 info[index].mode = ECORE_WL2_WINDOW_KEYGRAB_EXCLUSIVE;
2417 info[index].mode = ECORE_WL2_WINDOW_KEYGRAB_UNKNOWN;
2422 keyList = eina_list_append(keyList, &info);
2425 Eina_List* grabList = ecore_wl2_window_keygrab_list_set(mEcoreWindow, keyList);
2427 result.Resize(keyCount, true);
2429 Eina_List* l = NULL;
2430 Eina_List* m = NULL;
2431 void* listData = NULL;
2433 if(grabList != NULL)
2435 EINA_LIST_FOREACH(grabList, m, data)
2438 EINA_LIST_FOREACH(keyList, l, listData)
2440 if(static_cast<Ecore_Wl2_Window_Keygrab_Info*>(listData)->key == NULL)
2442 DALI_LOG_ERROR("input key list has null data!");
2446 if(strcmp(static_cast<char*>(data), static_cast<Ecore_Wl2_Window_Keygrab_Info*>(listData)->key) == 0)
2448 result[index] = false;
2457 eina_list_free(keyList);
2458 eina_list_free(grabList);
2464 bool WindowBaseEcoreWl2::UngrabKeyList(const Dali::Vector<Dali::KEY>& key, Dali::Vector<bool>& result)
2466 int keyCount = key.Count();
2474 Eina_List* keyList = NULL;
2475 Ecore_Wl2_Window_Keygrab_Info* info = new Ecore_Wl2_Window_Keygrab_Info[keyCount];
2477 for(int index = 0; index < keyCount; ++index)
2479 info[index].key = const_cast<char*>(KeyLookup::GetKeyName(key[index]));
2480 keyList = eina_list_append(keyList, &info);
2483 Eina_List* ungrabList = ecore_wl2_window_keygrab_list_unset(mEcoreWindow, keyList);
2485 result.Resize(keyCount, true);
2487 Eina_List* l = NULL;
2488 Eina_List* m = NULL;
2489 void* listData = NULL;
2492 if(ungrabList != NULL)
2494 EINA_LIST_FOREACH(ungrabList, m, data)
2497 EINA_LIST_FOREACH(keyList, l, listData)
2499 if(strcmp(static_cast<char*>(data), static_cast<Ecore_Wl2_Window_Keygrab_Info*>(listData)->key) == 0)
2501 result[index] = false;
2510 eina_list_free(keyList);
2511 eina_list_free(ungrabList);
2517 void WindowBaseEcoreWl2::GetDpi(unsigned int& dpiHorizontal, unsigned int& dpiVertical)
2522 Ecore_Wl2_Output* output = ecore_wl2_window_output_find(mEcoreWindow);
2524 // 1 inch = 25.4 millimeters
2525 xres = ecore_wl2_output_dpi_get(output);
2526 yres = ecore_wl2_output_dpi_get(output);
2528 dpiHorizontal = int(xres + 0.5f); // rounding
2529 dpiVertical = int(yres + 0.5f);
2532 int WindowBaseEcoreWl2::GetOrientation() const
2534 int orientation = (mScreenRotationAngle + mWindowRotationAngle) % 360;
2535 if(mSupportedPreProtation)
2542 int WindowBaseEcoreWl2::GetScreenRotationAngle()
2546 if(ecore_wl2_window_ignore_output_transform_get(mEcoreWindow))
2552 transform = ecore_wl2_output_transform_get(ecore_wl2_window_output_find(mEcoreWindow));
2554 mScreenRotationAngle = transform * 90;
2555 return mScreenRotationAngle;
2558 void WindowBaseEcoreWl2::SetWindowRotationAngle(int degree)
2560 mWindowRotationAngle = degree;
2561 ecore_wl2_window_rotation_set(mEcoreWindow, degree);
2564 void WindowBaseEcoreWl2::WindowRotationCompleted(int degree, int width, int height)
2566 ecore_wl2_window_rotation_change_done_send(mEcoreWindow, degree, width, height);
2569 void WindowBaseEcoreWl2::SetTransparency(bool transparent)
2571 ecore_wl2_window_alpha_set(mEcoreWindow, transparent);
2574 void WindowBaseEcoreWl2::CreateWindow(PositionSize positionSize)
2576 Ecore_Wl2_Display* display = ecore_wl2_display_connect(NULL);
2579 DALI_ASSERT_ALWAYS(0 && "Failed to get display");
2582 ecore_wl2_display_sync(display);
2584 mEcoreWindow = ecore_wl2_window_new(display, NULL, positionSize.x, positionSize.y, positionSize.width, positionSize.height);
2586 if(mEcoreWindow == 0)
2588 DALI_ASSERT_ALWAYS(0 && "Failed to create Wayland window");
2592 ecore_wl2_window_type_set(mEcoreWindow, ECORE_WL2_WINDOW_TYPE_TOPLEVEL);
2594 // Get Screen width, height
2595 ecore_wl2_display_screen_size_get(display, &mScreenWidth, &mScreenHeight);
2598 void WindowBaseEcoreWl2::SetParent(WindowBase* parentWinBase, bool belowParent)
2600 Ecore_Wl2_Window* ecoreParent = NULL;
2603 WindowBaseEcoreWl2* winBaseEcore2 = static_cast<WindowBaseEcoreWl2*>(parentWinBase);
2604 ecoreParent = winBaseEcore2->mEcoreWindow;
2606 ecore_wl2_window_transient_parent_set(mEcoreWindow, ecoreParent, belowParent);
2609 int WindowBaseEcoreWl2::CreateFrameRenderedSyncFence()
2611 return wl_egl_window_tizen_create_commit_sync_fd(mEglWindow);
2614 int WindowBaseEcoreWl2::CreateFramePresentedSyncFence()
2616 return wl_egl_window_tizen_create_presentation_sync_fd(mEglWindow);
2619 void WindowBaseEcoreWl2::SetPositionSizeWithAngle(PositionSize positionSize, int angle)
2621 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);
2622 ecore_wl2_window_rotation_geometry_set(mEcoreWindow, angle, positionSize.x, positionSize.y, positionSize.width, positionSize.height);
2625 void WindowBaseEcoreWl2::InitializeIme()
2627 Eina_Iterator* globals;
2628 struct wl_registry* registry;
2629 Ecore_Wl2_Global* global;
2630 Ecore_Wl2_Display* ecoreWl2Display;
2632 if(!(ecoreWl2Display = ecore_wl2_connected_display_get(NULL)))
2634 DALI_LOG_ERROR("WindowBaseEcoreWl2::InitializeIme(), fail to get ecore_wl2 connected display\n");
2638 DALI_LOG_RELEASE_INFO("InitializeIme: Ecore_Wl2_Display: %p, ecore wl window: %p\n", ecoreWl2Display, mEcoreWindow);
2640 if(!(registry = ecore_wl2_display_registry_get(ecoreWl2Display)))
2642 DALI_LOG_ERROR("WindowBaseEcoreWl2::InitializeIme(), fail to get ecore_wl2 display registry\n");
2646 if(!(globals = ecore_wl2_display_globals_get(ecoreWl2Display)))
2648 DALI_LOG_ERROR("WindowBaseEcoreWl2::InitializeIme(), fail to get ecore_wl2 globals\n");
2652 EINA_ITERATOR_FOREACH(globals, global)
2654 #ifdef OVER_TIZEN_VERSION_7
2655 if(strcmp(global->interface, "zwp_input_panel_v1") == 0)
2657 mWlInputPanel = (zwp_input_panel_v1*)wl_registry_bind(registry, global->id, &zwp_input_panel_v1_interface, 1);
2660 if(strcmp(global->interface, "wl_input_panel") == 0)
2662 mWlInputPanel = (wl_input_panel*)wl_registry_bind(registry, global->id, &wl_input_panel_interface, 1);
2665 else if(strcmp(global->interface, "wl_output") == 0)
2667 mWlOutput = (wl_output*)wl_registry_bind(registry, global->id, &wl_output_interface, 1);
2673 DALI_LOG_ERROR("WindowBaseEcoreWl2::InitializeIme(), fail to get wayland input panel interface\n");
2679 DALI_LOG_ERROR("WindowBaseEcoreWl2::InitializeIme(), fail to get wayland output panel interface\n");
2682 #ifdef OVER_TIZEN_VERSION_7
2683 mWlInputPanelSurface = zwp_input_panel_v1_get_input_panel_surface(mWlInputPanel, mWlSurface);
2685 mWlInputPanelSurface = wl_input_panel_get_input_panel_surface(mWlInputPanel, mWlSurface);
2687 if(!mWlInputPanelSurface)
2689 DALI_LOG_ERROR("WindowBaseEcoreWl2::InitializeIme(), fail to get wayland input panel surface\n");
2692 #ifdef OVER_TIZEN_VERSION_7
2693 zwp_input_panel_surface_v1_set_toplevel(mWlInputPanelSurface, mWlOutput, ZWP_INPUT_PANEL_SURFACE_V1_POSITION_CENTER_BOTTOM);
2695 wl_input_panel_surface_set_toplevel(mWlInputPanelSurface, mWlOutput, WL_INPUT_PANEL_SURFACE_POSITION_CENTER_BOTTOM);
2699 void WindowBaseEcoreWl2::ImeWindowReadyToRender()
2701 if(!mWlInputPanelSurface)
2703 DALI_LOG_ERROR("WindowBaseEcoreWl2::ImeWindowReadyToRender(), wayland input panel surface is null\n");
2706 #ifdef OVER_TIZEN_VERSION_7
2707 zwp_input_panel_surface_v1_set_ready(mWlInputPanelSurface, 1);
2709 wl_input_panel_surface_set_ready(mWlInputPanelSurface, 1);
2713 void WindowBaseEcoreWl2::RequestMoveToServer()
2715 Ecore_Wl2_Display* display = ecore_wl2_connected_display_get(NULL);
2718 DALI_LOG_ERROR("WindowBaseEcoreWl2::RequestMoveToServer, Fail to get ecore_wl2_display\n");
2722 Ecore_Wl2_Input* input = ecore_wl2_input_default_input_get(display);
2725 DALI_LOG_ERROR("WindowBaseEcoreWl2::RequestMoveToServer, Fail to get default Ecore_Wl2_Input\n");
2729 ecore_wl2_window_move(mEcoreWindow, input);
2730 DALI_LOG_RELEASE_INFO("WindowBaseEcoreWl2::RequestMoveToServer, starts the window[%p] is moved by server\n", mEcoreWindow);
2733 void WindowBaseEcoreWl2::RequestResizeToServer(WindowResizeDirection direction)
2735 Ecore_Wl2_Display* display = ecore_wl2_connected_display_get(NULL);
2738 DALI_LOG_ERROR("WindowBaseEcoreWl2::RequestResizeToServer, Fail to get ecore_wl2_display\n");
2742 Ecore_Wl2_Input* input = ecore_wl2_input_default_input_get(display);
2745 DALI_LOG_ERROR("WindowBaseEcoreWl2::RequestResizeToServer, Fail to get default Ecore_Wl2_Input\n");
2752 case WindowResizeDirection::TOP_LEFT:
2757 case WindowResizeDirection::TOP:
2762 case WindowResizeDirection::TOP_RIGHT:
2767 case WindowResizeDirection::LEFT:
2772 case WindowResizeDirection::RIGHT:
2777 case WindowResizeDirection::BOTTOM_LEFT:
2782 case WindowResizeDirection::BOTTOM:
2787 case WindowResizeDirection::BOTTOM_RIGHT:
2799 ecore_wl2_window_resize(mEcoreWindow, input, location);
2800 DALI_LOG_RELEASE_INFO("WindowBaseEcoreWl2::RequestResizeToServer, starts the window[%p] is resized by server, mode:%d\n", mEcoreWindow, location);
2803 void WindowBaseEcoreWl2::EnableFloatingMode(bool enable)
2805 DALI_LOG_RELEASE_INFO("WindowBaseEcoreWl2::EnableFloatingMode, floating mode flag: [%p], enable [%d]\n", mEcoreWindow, enable);
2808 ecore_wl2_window_floating_mode_set(mEcoreWindow, EINA_TRUE);
2812 ecore_wl2_window_floating_mode_set(mEcoreWindow, EINA_FALSE);
2816 bool WindowBaseEcoreWl2::IsFloatingModeEnabled() const
2818 return ecore_wl2_window_floating_mode_get(mEcoreWindow);
2821 void WindowBaseEcoreWl2::IncludeInputRegion(const Rect<int>& inputRegion)
2823 Eina_Rectangle rect;
2824 rect.x = inputRegion.x;
2825 rect.y = inputRegion.y;
2826 rect.w = inputRegion.width;
2827 rect.h = inputRegion.height;
2829 ecore_wl2_window_input_rect_add(mEcoreWindow, &rect);
2830 ecore_wl2_window_commit(mEcoreWindow, EINA_TRUE);
2833 void WindowBaseEcoreWl2::ExcludeInputRegion(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_subtract(mEcoreWindow, &rect);
2842 ecore_wl2_window_commit(mEcoreWindow, EINA_TRUE);
2845 } // namespace Adaptor
2847 } // namespace Internal
2851 #pragma GCC diagnostic pop