2 * Copyright (c) 2022 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 // Ecore is littered with C style cast
19 #pragma GCC diagnostic push
20 #pragma GCC diagnostic ignored "-Wold-style-cast"
23 #include <dali/internal/window-system/tizen-wayland/ecore-wl2/window-base-ecore-wl2.h>
26 #include <dali/internal/input/common/key-impl.h>
27 #include <dali/internal/window-system/common/window-impl.h>
28 #include <dali/internal/window-system/common/window-render-surface.h>
29 #include <dali/internal/window-system/common/window-system.h>
32 #include <Ecore_Input.h>
33 #include <dali/integration-api/debug.h>
34 #include <dali/integration-api/trace.h>
35 #include <dali/public-api/adaptor-framework/window-enumerations.h>
36 #include <dali/public-api/events/mouse-button.h>
37 #include <dali/public-api/object/any.h>
39 #if defined(VCONF_ENABLED)
40 #include <vconf-keys.h>
44 #include <wayland-egl-tizen.h>
54 #if defined(DEBUG_ENABLED)
55 Debug::Filter* gWindowBaseLogFilter = Debug::Filter::New(Debug::NoLogging, false, "LOG_WINDOW_BASE");
58 DALI_INIT_TRACE_FILTER(gTraceFilter, DALI_TRACE_PERFORMANCE_MARKER, false);
60 const uint32_t MAX_TIZEN_CLIENT_VERSION = 7;
61 const unsigned int PRIMARY_TOUCH_BUTTON_ID = 1;
63 #if defined(VCONF_ENABLED)
64 const char* DALI_VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_NAME = "db/setting/accessibility/font_name"; // It will be update at vconf-key.h and replaced.
70 xkb_keycode_t keyCode;
75 * Get the device name from the provided ecore key event
77 void GetDeviceName(Ecore_Event_Key* keyEvent, std::string& result)
79 const char* ecoreDeviceName = ecore_device_name_get(keyEvent->dev);
83 result = ecoreDeviceName;
88 * Get the device class from the provided ecore event
90 void GetDeviceClass(Ecore_Device_Class ecoreDeviceClass, Device::Class::Type& deviceClass)
92 switch(ecoreDeviceClass)
94 case ECORE_DEVICE_CLASS_SEAT:
96 deviceClass = Device::Class::USER;
99 case ECORE_DEVICE_CLASS_KEYBOARD:
101 deviceClass = Device::Class::KEYBOARD;
104 case ECORE_DEVICE_CLASS_MOUSE:
106 deviceClass = Device::Class::MOUSE;
109 case ECORE_DEVICE_CLASS_TOUCH:
111 deviceClass = Device::Class::TOUCH;
114 case ECORE_DEVICE_CLASS_PEN:
116 deviceClass = Device::Class::PEN;
119 case ECORE_DEVICE_CLASS_POINTER:
121 deviceClass = Device::Class::POINTER;
124 case ECORE_DEVICE_CLASS_GAMEPAD:
126 deviceClass = Device::Class::GAMEPAD;
131 deviceClass = Device::Class::NONE;
137 void GetDeviceSubclass(Ecore_Device_Subclass ecoreDeviceSubclass, Device::Subclass::Type& deviceSubclass)
139 switch(ecoreDeviceSubclass)
141 case ECORE_DEVICE_SUBCLASS_FINGER:
143 deviceSubclass = Device::Subclass::FINGER;
146 case ECORE_DEVICE_SUBCLASS_FINGERNAIL:
148 deviceSubclass = Device::Subclass::FINGERNAIL;
151 case ECORE_DEVICE_SUBCLASS_KNUCKLE:
153 deviceSubclass = Device::Subclass::KNUCKLE;
156 case ECORE_DEVICE_SUBCLASS_PALM:
158 deviceSubclass = Device::Subclass::PALM;
161 case ECORE_DEVICE_SUBCLASS_HAND_SIZE:
163 deviceSubclass = Device::Subclass::HAND_SIDE;
166 case ECORE_DEVICE_SUBCLASS_HAND_FLAT:
168 deviceSubclass = Device::Subclass::HAND_FLAT;
171 case ECORE_DEVICE_SUBCLASS_PEN_TIP:
173 deviceSubclass = Device::Subclass::PEN_TIP;
176 case ECORE_DEVICE_SUBCLASS_TRACKPAD:
178 deviceSubclass = Device::Subclass::TRACKPAD;
181 case ECORE_DEVICE_SUBCLASS_TRACKPOINT:
183 deviceSubclass = Device::Subclass::TRACKPOINT;
186 case ECORE_DEVICE_SUBCLASS_TRACKBALL:
188 deviceSubclass = Device::Subclass::TRACKBALL;
191 case ECORE_DEVICE_SUBCLASS_REMOCON:
193 deviceSubclass = Device::Subclass::REMOCON;
196 case ECORE_DEVICE_SUBCLASS_VIRTUAL_KEYBOARD:
198 deviceSubclass = Device::Subclass::VIRTUAL_KEYBOARD;
203 deviceSubclass = Device::Subclass::NONE;
209 void FindKeyCode(struct xkb_keymap* keyMap, xkb_keycode_t key, void* data)
211 KeyCodeMap* foundKeyCode = static_cast<KeyCodeMap*>(data);
212 if(foundKeyCode->isKeyCode)
217 xkb_keysym_t keySym = foundKeyCode->keySym;
219 const xkb_keysym_t* symsOut = NULL;
221 nsyms = xkb_keymap_key_get_syms_by_level(keyMap, key, 0, 0, &symsOut);
225 if(*symsOut == keySym)
227 foundKeyCode->keyCode = key;
228 foundKeyCode->isKeyCode = true;
233 /////////////////////////////////////////////////////////////////////////////////////////////////
235 /////////////////////////////////////////////////////////////////////////////////////////////////
237 /// Called when the window iconify state is changed.
238 static Eina_Bool EcoreEventWindowIconifyStateChanged(void* data, int type, void* event)
240 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
243 return windowBase->OnIconifyStateChanged(data, type, event);
246 return ECORE_CALLBACK_PASS_ON;
249 /// Called when the window gains focus
250 static Eina_Bool EcoreEventWindowFocusIn(void* data, int type, void* event)
252 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
255 return windowBase->OnFocusIn(data, type, event);
258 return ECORE_CALLBACK_PASS_ON;
261 /// Called when the window loses focus
262 static Eina_Bool EcoreEventWindowFocusOut(void* data, int type, void* event)
264 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
267 return windowBase->OnFocusOut(data, type, event);
270 return ECORE_CALLBACK_PASS_ON;
273 /// Called when the output is transformed
274 static Eina_Bool EcoreEventOutputTransform(void* data, int type, void* event)
276 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
279 return windowBase->OnOutputTransform(data, type, event);
282 return ECORE_CALLBACK_PASS_ON;
285 /// Called when the output transform should be ignored
286 static Eina_Bool EcoreEventIgnoreOutputTransform(void* data, int type, void* event)
288 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
291 return windowBase->OnIgnoreOutputTransform(data, type, event);
294 return ECORE_CALLBACK_PASS_ON;
298 * Called when rotate event is recevied.
300 static Eina_Bool EcoreEventRotate(void* data, int type, void* event)
302 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
305 DALI_LOG_RELEASE_INFO("WindowBaseEcoreWl2::EcoreEventRotate\n");
306 windowBase->OnRotation(data, type, event);
308 return ECORE_CALLBACK_PASS_ON;
312 * Called when configure event is recevied.
314 static Eina_Bool EcoreEventConfigure(void* data, int type, void* event)
316 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
319 windowBase->OnConfiguration(data, type, event);
321 return ECORE_CALLBACK_PASS_ON;
324 /////////////////////////////////////////////////////////////////////////////////////////////////
326 /////////////////////////////////////////////////////////////////////////////////////////////////
329 * Called when a touch down is received.
331 static Eina_Bool EcoreEventMouseButtonDown(void* data, int type, void* event)
333 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
336 windowBase->OnMouseButtonDown(data, type, event);
338 return ECORE_CALLBACK_PASS_ON;
342 * Called when a touch up is received.
344 static Eina_Bool EcoreEventMouseButtonUp(void* data, int type, void* event)
346 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
349 windowBase->OnMouseButtonUp(data, type, event);
351 return ECORE_CALLBACK_PASS_ON;
355 * Called when a touch motion is received.
357 static Eina_Bool EcoreEventMouseButtonMove(void* data, int type, void* event)
359 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
362 windowBase->OnMouseButtonMove(data, type, event);
364 return ECORE_CALLBACK_PASS_ON;
368 * Called when a touch is canceled.
370 static Eina_Bool EcoreEventMouseButtonCancel(void* data, int type, void* event)
372 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
375 windowBase->OnMouseButtonCancel(data, type, event);
377 return ECORE_CALLBACK_PASS_ON;
381 * Called when a mouse wheel is received.
383 static Eina_Bool EcoreEventMouseWheel(void* data, int type, void* event)
385 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
388 windowBase->OnMouseWheel(data, type, event);
390 return ECORE_CALLBACK_PASS_ON;
394 * Called when a detent rotation event is recevied.
396 static Eina_Bool EcoreEventDetentRotation(void* data, int type, void* event)
398 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
401 windowBase->OnDetentRotation(data, type, event);
403 return ECORE_CALLBACK_PASS_ON;
406 /////////////////////////////////////////////////////////////////////////////////////////////////
408 /////////////////////////////////////////////////////////////////////////////////////////////////
411 * Called when a key down is received.
413 static Eina_Bool EcoreEventKeyDown(void* data, int type, void* event)
415 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
418 windowBase->OnKeyDown(data, type, event);
420 return ECORE_CALLBACK_PASS_ON;
424 * Called when a key up is received.
426 static Eina_Bool EcoreEventKeyUp(void* data, int type, void* event)
428 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
431 windowBase->OnKeyUp(data, type, event);
433 return ECORE_CALLBACK_PASS_ON;
436 /////////////////////////////////////////////////////////////////////////////////////////////////
437 // Selection Callbacks
438 /////////////////////////////////////////////////////////////////////////////////////////////////
441 * Called when the source window notifies us the content in clipboard is selected.
443 static Eina_Bool EcoreEventDataSend(void* data, int type, void* event)
445 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
448 windowBase->OnDataSend(data, type, event);
450 return ECORE_CALLBACK_PASS_ON;
454 * Called when the source window sends us about the selected content.
455 * For example, when item is selected in the clipboard.
457 static Eina_Bool EcoreEventDataReceive(void* data, int type, void* event)
459 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
462 windowBase->OnDataReceive(data, type, event);
464 return ECORE_CALLBACK_PASS_ON;
467 /////////////////////////////////////////////////////////////////////////////////////////////////
468 // Effect Start/End Callbacks
469 /////////////////////////////////////////////////////////////////////////////////////////////////
472 * Called when transition animation of the window's shown/hidden is started by window manager.
474 static Eina_Bool EcoreEventEffectStart(void* data, int type, void* event)
476 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
477 Ecore_Wl2_Event_Effect_Start* effectStart = static_cast<Ecore_Wl2_Event_Effect_Start*>(event);
478 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::EcoreEventEffectStart, effect type[ %d ]\n", effectStart->type);
481 if(effectStart->type < 3) // only under restack
483 windowBase->OnTransitionEffectEvent(WindowEffectState::START, static_cast<WindowEffectType>(effectStart->type));
486 return ECORE_CALLBACK_PASS_ON;
490 * Called when transition animation of the window's shown/hidden is ended by window manager.
492 static Eina_Bool EcoreEventEffectEnd(void* data, int type, void* event)
494 Ecore_Wl2_Event_Effect_Start* effectEnd = static_cast<Ecore_Wl2_Event_Effect_Start*>(event);
495 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
496 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::EcoreEventEffectEnd, effect type[ %d ]\n", effectEnd->type);
499 if(effectEnd->type < 3) // only under restack
501 windowBase->OnTransitionEffectEvent(WindowEffectState::END, static_cast<WindowEffectType>(effectEnd->type));
504 return ECORE_CALLBACK_PASS_ON;
507 /////////////////////////////////////////////////////////////////////////////////////////////////
508 // Keyboard Repeat Settings Changed Callbacks
509 /////////////////////////////////////////////////////////////////////////////////////////////////
511 static Eina_Bool EcoreEventSeatKeyboardRepeatChanged(void* data, int type, void* event)
513 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
514 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::EcoreEventSeatKeyboardRepeatChanged, id[ %d ]\n", static_cast<Ecore_Wl2_Event_Seat_Keyboard_Repeat_Changed*>(event)->id);
517 windowBase->OnKeyboardRepeatSettingsChanged();
520 return ECORE_CALLBACK_RENEW;
523 /////////////////////////////////////////////////////////////////////////////////////////////////
524 // Keymap Changed Callbacks
525 /////////////////////////////////////////////////////////////////////////////////////////////////
527 static Eina_Bool EcoreEventSeatKeymapChanged(void* data, int type, void* event)
529 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
532 windowBase->KeymapChanged(data, type, event);
535 return ECORE_CALLBACK_RENEW;
538 /////////////////////////////////////////////////////////////////////////////////////////////////
540 /////////////////////////////////////////////////////////////////////////////////////////////////
542 #if defined(VCONF_ENABLED)
544 * Called when a font name is changed.
546 static void VconfNotifyFontNameChanged(keynode_t* node, void* data)
548 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
551 windowBase->OnFontNameChanged();
556 * Called when a font size is changed.
558 static void VconfNotifyFontSizeChanged(keynode_t* node, void* data)
560 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
563 windowBase->OnFontSizeChanged();
568 /////////////////////////////////////////////////////////////////////////////////////////////////
569 // Window Redraw Request Event Callbacks
570 /////////////////////////////////////////////////////////////////////////////////////////////////
572 static Eina_Bool EcoreEventWindowRedrawRequest(void* data, int type, void* event)
574 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
575 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::EcoreEventWindowRedrawRequest, window[ %d ]\n", static_cast<Ecore_Wl2_Event_Window_Redraw_Request*>(event)->win);
578 windowBase->OnEcoreEventWindowRedrawRequest();
581 return ECORE_CALLBACK_RENEW;
584 /////////////////////////////////////////////////////////////////////////////////////////////////
585 // Window Auxiliary Message Callbacks
586 /////////////////////////////////////////////////////////////////////////////////////////////////
587 static Eina_Bool EcoreEventWindowAuxiliaryMessage(void* data, int type, void* event)
589 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
592 windowBase->OnEcoreEventWindowAuxiliaryMessage(event);
594 return ECORE_CALLBACK_RENEW;
597 static void RegistryGlobalCallback(void* data, struct wl_registry* registry, uint32_t name, const char* interface, uint32_t version)
599 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
602 windowBase->RegistryGlobalCallback(data, registry, name, interface, version);
606 static void RegistryGlobalCallbackRemove(void* data, struct wl_registry* registry, uint32_t id)
608 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
611 windowBase->RegistryGlobalCallbackRemove(data, registry, id);
615 static void TizenPolicyConformant(void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, uint32_t isConformant)
619 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)
623 static void TizenPolicyNotificationChangeDone(void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, int32_t level, uint32_t state)
625 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
628 windowBase->TizenPolicyNotificationChangeDone(data, tizenPolicy, surface, level, state);
632 static void TizenPolicyTransientForDone(void* data, struct tizen_policy* tizenPolicy, uint32_t childId)
636 static void TizenPolicyScreenModeChangeDone(void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, uint32_t mode, uint32_t state)
638 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
641 windowBase->TizenPolicyScreenModeChangeDone(data, tizenPolicy, surface, mode, state);
645 static void TizenPolicyIconifyStateChanged(void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, uint32_t iconified, uint32_t force)
649 static void TizenPolicySupportedAuxiliaryHints(void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, struct wl_array* hints, uint32_t numNints)
653 static void TizenPolicyAllowedAuxiliaryHint(void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, int id)
657 static void TizenPolicyAuxiliaryMessage(void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, const char* key, const char* val, struct wl_array* options)
661 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)
665 static void DisplayPolicyBrightnessChangeDone(void* data, struct tizen_display_policy* displayPolicy, struct wl_surface* surface, int32_t brightness, uint32_t state)
667 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
670 windowBase->DisplayPolicyBrightnessChangeDone(data, displayPolicy, surface, brightness, state);
674 const struct wl_registry_listener registryListener =
676 RegistryGlobalCallback,
677 RegistryGlobalCallbackRemove};
679 const struct tizen_policy_listener tizenPolicyListener =
681 TizenPolicyConformant,
682 TizenPolicyConformantArea,
683 TizenPolicyNotificationChangeDone,
684 TizenPolicyTransientForDone,
685 TizenPolicyScreenModeChangeDone,
686 TizenPolicyIconifyStateChanged,
687 TizenPolicySupportedAuxiliaryHints,
688 TizenPolicyAllowedAuxiliaryHint,
689 TizenPolicyAuxiliaryMessage,
690 TizenPolicyConformantRegion};
692 const struct tizen_display_policy_listener tizenDisplayPolicyListener =
694 DisplayPolicyBrightnessChangeDone};
696 } // unnamed namespace
698 WindowBaseEcoreWl2::WindowBaseEcoreWl2(Dali::PositionSize positionSize, Any surface, bool isTransparent)
699 : mEcoreEventHandler(),
700 mEcoreWindow(nullptr),
702 mWlInputPanel(nullptr),
704 mWlInputPanelSurface(nullptr),
707 mEventQueue(nullptr),
708 mTizenPolicy(nullptr),
709 mTizenDisplayPolicy(nullptr),
711 mSupportedAuxiliaryHints(),
712 mWindowPositionSize(positionSize),
714 mType(WindowType::NORMAL),
715 mNotificationLevel(-1),
718 mWindowRotationAngle(0),
719 mScreenRotationAngle(0),
720 mSupportedPreProtation(0),
723 mNotificationChangeState(0),
724 mScreenOffModeChangeState(0),
725 mBrightnessChangeState(0),
726 mLastSubmittedMoveResizeSerial(0),
727 mMoveResizeSerial(0),
728 mNotificationLevelChangeDone(true),
729 mScreenOffModeChangeDone(true),
732 mBrightnessChangeDone(true)
734 Initialize(positionSize, surface, isTransparent);
737 WindowBaseEcoreWl2::~WindowBaseEcoreWl2()
739 #if defined(VCONF_ENABLED)
740 vconf_ignore_key_changed(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, VconfNotifyFontSizeChanged);
741 vconf_ignore_key_changed(DALI_VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_NAME, VconfNotifyFontNameChanged);
744 for(Dali::Vector<Ecore_Event_Handler*>::Iterator iter = mEcoreEventHandler.Begin(), endIter = mEcoreEventHandler.End(); iter != endIter; ++iter)
746 ecore_event_handler_del(*iter);
748 mEcoreEventHandler.Clear();
752 wl_event_queue_destroy(mEventQueue);
755 mSupportedAuxiliaryHints.clear();
756 mAuxiliaryHints.clear();
758 if(mEglWindow != NULL)
760 wl_egl_window_destroy(mEglWindow);
766 ecore_wl2_window_free(mEcoreWindow);
768 WindowSystem::Shutdown();
772 void WindowBaseEcoreWl2::Initialize(PositionSize positionSize, Any surface, bool isTransparent)
774 if(surface.Empty() == false)
776 // check we have a valid type
777 DALI_ASSERT_ALWAYS((surface.GetType() == typeid(Ecore_Wl2_Window*)) && "Surface type is invalid");
779 mEcoreWindow = AnyCast<Ecore_Wl2_Window*>(surface);
783 // we own the surface about to created
784 WindowSystem::Initialize();
787 CreateWindow(positionSize);
790 mWlSurface = ecore_wl2_window_surface_get(mEcoreWindow);
792 SetTransparency(isTransparent);
794 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_WINDOW_ICONIFY_STATE_CHANGE, EcoreEventWindowIconifyStateChanged, this));
795 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_FOCUS_IN, EcoreEventWindowFocusIn, this));
796 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_FOCUS_OUT, EcoreEventWindowFocusOut, this));
797 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_OUTPUT_TRANSFORM, EcoreEventOutputTransform, this));
798 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_IGNORE_OUTPUT_TRANSFORM, EcoreEventIgnoreOutputTransform, this));
800 // Register Rotate event
801 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_WINDOW_ROTATE, EcoreEventRotate, this));
803 // Register Configure event
804 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_WINDOW_CONFIGURE, EcoreEventConfigure, this));
806 // Register Touch events
807 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_DOWN, EcoreEventMouseButtonDown, this));
808 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_UP, EcoreEventMouseButtonUp, this));
809 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_EVENT_MOUSE_MOVE, EcoreEventMouseButtonMove, this));
810 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_CANCEL, EcoreEventMouseButtonCancel, this));
812 // Register Mouse wheel events
813 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_EVENT_MOUSE_WHEEL, EcoreEventMouseWheel, this));
815 // Register Detent event
816 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_EVENT_DETENT_ROTATE, EcoreEventDetentRotation, this));
818 // Register Key events
819 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_EVENT_KEY_DOWN, EcoreEventKeyDown, this));
820 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_EVENT_KEY_UP, EcoreEventKeyUp, this));
822 // Register Selection event - clipboard selection
823 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_DATA_SOURCE_SEND, EcoreEventDataSend, this));
824 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_SELECTION_DATA_READY, EcoreEventDataReceive, this));
826 // Register Effect Start/End event
827 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_EFFECT_START, EcoreEventEffectStart, this));
828 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_EFFECT_END, EcoreEventEffectEnd, this));
830 // Register Keyboard repeat event
831 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_SEAT_KEYBOARD_REPEAT_CHANGED, EcoreEventSeatKeyboardRepeatChanged, this));
833 // Register Window redraw request event
834 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_WINDOW_REDRAW_REQUEST, EcoreEventWindowRedrawRequest, this));
836 // Register Window auxiliary event
837 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_AUX_MESSAGE, EcoreEventWindowAuxiliaryMessage, this));
839 #if defined(VCONF_ENABLED)
840 // Register Vconf notify - font name and size
841 vconf_notify_key_changed_for_ui_thread(DALI_VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_NAME, VconfNotifyFontNameChanged, this);
842 vconf_notify_key_changed_for_ui_thread(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, VconfNotifyFontSizeChanged, this);
845 Ecore_Wl2_Display* display = ecore_wl2_connected_display_get(NULL);
846 mDisplay = ecore_wl2_display_get(display);
850 wl_display* displayWrapper = static_cast<wl_display*>(wl_proxy_create_wrapper(mDisplay));
853 mEventQueue = wl_display_create_queue(mDisplay);
856 wl_proxy_set_queue(reinterpret_cast<wl_proxy*>(displayWrapper), mEventQueue);
858 wl_registry* registry = wl_display_get_registry(displayWrapper);
859 wl_registry_add_listener(registry, ®istryListener, this);
862 wl_proxy_wrapper_destroy(displayWrapper);
866 Ecore_Wl2_Input* ecoreWlInput = ecore_wl2_input_default_input_get(display);
870 mKeyMap = ecore_wl2_input_keymap_get(ecoreWlInput);
872 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_SEAT_KEYMAP_CHANGED, EcoreEventSeatKeymapChanged, this));
875 // get auxiliary hint
876 Eina_List* hints = ecore_wl2_window_aux_hints_supported_get(mEcoreWindow);
882 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))))
884 mSupportedAuxiliaryHints.push_back(hint);
886 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::Initialize: %s\n", hint);
891 Eina_Bool WindowBaseEcoreWl2::OnIconifyStateChanged(void* data, int type, void* event)
893 Ecore_Wl2_Event_Window_Iconify_State_Change* iconifyChangedEvent(static_cast<Ecore_Wl2_Event_Window_Iconify_State_Change*>(event));
894 Eina_Bool handled(ECORE_CALLBACK_PASS_ON);
896 if(iconifyChangedEvent->win == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
898 if(iconifyChangedEvent->iconified == EINA_TRUE)
900 mIconifyChangedSignal.Emit(true);
904 mIconifyChangedSignal.Emit(false);
906 handled = ECORE_CALLBACK_DONE;
912 Eina_Bool WindowBaseEcoreWl2::OnFocusIn(void* data, int type, void* event)
914 Ecore_Wl2_Event_Focus_In* focusInEvent(static_cast<Ecore_Wl2_Event_Focus_In*>(event));
916 if(focusInEvent->window == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
918 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "Window EcoreEventWindowFocusIn\n");
920 mFocusChangedSignal.Emit(true);
923 return ECORE_CALLBACK_PASS_ON;
926 Eina_Bool WindowBaseEcoreWl2::OnFocusOut(void* data, int type, void* event)
928 Ecore_Wl2_Event_Focus_Out* focusOutEvent(static_cast<Ecore_Wl2_Event_Focus_Out*>(event));
930 if(focusOutEvent->window == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
932 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "Window EcoreEventWindowFocusOut\n");
934 mFocusChangedSignal.Emit(false);
937 return ECORE_CALLBACK_PASS_ON;
940 Eina_Bool WindowBaseEcoreWl2::OnOutputTransform(void* data, int type, void* event)
942 Ecore_Wl2_Event_Output_Transform* transformEvent(static_cast<Ecore_Wl2_Event_Output_Transform*>(event));
944 if(transformEvent->output == ecore_wl2_window_output_find(mEcoreWindow))
946 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "Window (%p) EcoreEventOutputTransform\n", mEcoreWindow);
948 mScreenRotationAngle = GetScreenRotationAngle();
950 mOutputTransformedSignal.Emit();
953 return ECORE_CALLBACK_PASS_ON;
956 Eina_Bool WindowBaseEcoreWl2::OnIgnoreOutputTransform(void* data, int type, void* event)
958 Ecore_Wl2_Event_Ignore_Output_Transform* ignoreTransformEvent(static_cast<Ecore_Wl2_Event_Ignore_Output_Transform*>(event));
960 if(ignoreTransformEvent->win == mEcoreWindow)
962 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "Window (%p) EcoreEventIgnoreOutputTransform\n", mEcoreWindow);
964 mScreenRotationAngle = GetScreenRotationAngle();
966 mOutputTransformedSignal.Emit();
969 return ECORE_CALLBACK_PASS_ON;
972 void WindowBaseEcoreWl2::OnRotation(void* data, int type, void* event)
974 Ecore_Wl2_Event_Window_Rotation* ev(static_cast<Ecore_Wl2_Event_Window_Rotation*>(event));
976 if(ev->win == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
978 DALI_LOG_RELEASE_INFO("WindowBaseEcoreWl2::OnRotation, angle: %d, width: %d, height: %d\n", ev->angle, ev->w, ev->h);
980 RotationEvent rotationEvent;
981 rotationEvent.angle = ev->angle;
982 rotationEvent.winResize = 0;
984 if(ev->w == 0 || ev->h == 0)
986 // When rotation event does not have the window width or height,
987 // previous DALi side window's size are used.
988 ev->w = mWindowPositionSize.width;
989 ev->h = mWindowPositionSize.height;
992 mWindowRotationAngle = ev->angle;
994 mWindowPositionSize.width = ev->w;
995 mWindowPositionSize.height = ev->h;
997 PositionSize newPositionSize = RecalculatePositionSizeToCurrentOrientation(mWindowPositionSize);
999 rotationEvent.x = newPositionSize.x;
1000 rotationEvent.y = newPositionSize.y;
1001 rotationEvent.width = newPositionSize.width;
1002 rotationEvent.height = newPositionSize.height;
1004 mRotationSignal.Emit(rotationEvent);
1008 void WindowBaseEcoreWl2::OnConfiguration(void* data, int type, void* event)
1010 Ecore_Wl2_Event_Window_Configure* ev(static_cast<Ecore_Wl2_Event_Window_Configure*>(event));
1012 if(ev && ev->win == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
1014 // Note: To comply with the wayland protocol, Dali should make an ack_configure
1015 // by calling ecore_wl2_window_commit
1017 int tempWidth = static_cast<int>(ev->w);
1018 int tempHeight = static_cast<int>(ev->h);
1020 // Initialize with previous size for skip resize when new size is 0.
1021 // When window is just moved or window is resized by client application,
1022 // The configure notification event's size will be 0.
1023 // If new size is 0, the resized work should be skip.
1024 int newWidth = mWindowPositionSize.width;
1025 int newHeight = mWindowPositionSize.height;
1026 bool windowMoved = false, windowResized = false;
1028 if(ev->x != mWindowPositionSize.x || ev->y != mWindowPositionSize.y)
1033 if(tempWidth != 0 && tempHeight != 0 && (tempWidth != mWindowPositionSize.width || tempHeight != mWindowPositionSize.height))
1035 windowResized = true;
1036 newWidth = tempWidth;
1037 newHeight = tempHeight;
1040 if(windowMoved || windowResized)
1042 mWindowPositionSize.x = ev->x;
1043 mWindowPositionSize.y = ev->y;
1044 mWindowPositionSize.width = newWidth;
1045 mWindowPositionSize.height = newHeight;
1046 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);
1048 ecore_wl2_window_geometry_set(mEcoreWindow, mWindowPositionSize.x, mWindowPositionSize.y, mWindowPositionSize.width, mWindowPositionSize.height);
1050 Dali::PositionSize newPositionSize = RecalculatePositionSizeToCurrentOrientation(mWindowPositionSize);
1051 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);
1052 mUpdatePositionSizeSignal.Emit(newPositionSize);
1055 ecore_wl2_window_commit(mEcoreWindow, EINA_FALSE);
1059 void WindowBaseEcoreWl2::OnMouseButtonDown(void* data, int type, void* event)
1061 Ecore_Event_Mouse_Button* touchEvent = static_cast<Ecore_Event_Mouse_Button*>(event);
1063 if(touchEvent->window == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
1065 Device::Class::Type deviceClass;
1066 Device::Subclass::Type deviceSubclass;
1068 GetDeviceClass(ecore_device_class_get(touchEvent->dev), deviceClass);
1069 GetDeviceSubclass(ecore_device_subclass_get(touchEvent->dev), deviceSubclass);
1071 PointState::Type state(PointState::DOWN);
1073 if(deviceClass != Device::Class::Type::MOUSE)
1075 // Check if the buttons field is set and ensure it's the primary touch button.
1076 // If this event was triggered by buttons other than the primary button (used for touch), then
1077 // just send an interrupted event to Core.
1078 if(touchEvent->buttons && (touchEvent->buttons != PRIMARY_TOUCH_BUTTON_ID))
1080 state = PointState::INTERRUPTED;
1084 Integration::Point point;
1085 point.SetDeviceId(touchEvent->multi.device);
1086 point.SetState(state);
1087 point.SetScreenPosition(Vector2(touchEvent->x, touchEvent->y));
1088 point.SetRadius(touchEvent->multi.radius, Vector2(touchEvent->multi.radius_x, touchEvent->multi.radius_y));
1089 point.SetPressure(touchEvent->multi.pressure);
1090 point.SetAngle(Degree(touchEvent->multi.angle));
1091 point.SetDeviceClass(deviceClass);
1092 point.SetDeviceSubclass(deviceSubclass);
1093 point.SetMouseButton(static_cast<MouseButton::Type>(touchEvent->buttons));
1095 mTouchEventSignal.Emit(point, touchEvent->timestamp);
1099 void WindowBaseEcoreWl2::OnMouseButtonUp(void* data, int type, void* event)
1101 Ecore_Event_Mouse_Button* touchEvent = static_cast<Ecore_Event_Mouse_Button*>(event);
1103 if(touchEvent->window == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
1105 Device::Class::Type deviceClass;
1106 Device::Subclass::Type deviceSubclass;
1108 GetDeviceClass(ecore_device_class_get(touchEvent->dev), deviceClass);
1109 GetDeviceSubclass(ecore_device_subclass_get(touchEvent->dev), deviceSubclass);
1111 Integration::Point point;
1112 point.SetDeviceId(touchEvent->multi.device);
1113 point.SetState(PointState::UP);
1114 point.SetScreenPosition(Vector2(touchEvent->x, touchEvent->y));
1115 point.SetRadius(touchEvent->multi.radius, Vector2(touchEvent->multi.radius_x, touchEvent->multi.radius_y));
1116 point.SetPressure(touchEvent->multi.pressure);
1117 point.SetAngle(Degree(touchEvent->multi.angle));
1118 point.SetDeviceClass(deviceClass);
1119 point.SetDeviceSubclass(deviceSubclass);
1120 point.SetMouseButton(static_cast<MouseButton::Type>(touchEvent->buttons));
1122 mTouchEventSignal.Emit(point, touchEvent->timestamp);
1126 void WindowBaseEcoreWl2::OnMouseButtonMove(void* data, int type, void* event)
1128 Ecore_Event_Mouse_Move* touchEvent = static_cast<Ecore_Event_Mouse_Move*>(event);
1130 if(touchEvent->window == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
1132 Device::Class::Type deviceClass;
1133 Device::Subclass::Type deviceSubclass;
1135 GetDeviceClass(ecore_device_class_get(touchEvent->dev), deviceClass);
1136 GetDeviceSubclass(ecore_device_subclass_get(touchEvent->dev), deviceSubclass);
1138 Integration::Point point;
1139 point.SetDeviceId(touchEvent->multi.device);
1140 point.SetState(PointState::MOTION);
1141 point.SetScreenPosition(Vector2(touchEvent->x, touchEvent->y));
1142 point.SetRadius(touchEvent->multi.radius, Vector2(touchEvent->multi.radius_x, touchEvent->multi.radius_y));
1143 point.SetPressure(touchEvent->multi.pressure);
1144 point.SetAngle(Degree(touchEvent->multi.angle));
1145 point.SetDeviceClass(deviceClass);
1146 point.SetDeviceSubclass(deviceSubclass);
1148 mTouchEventSignal.Emit(point, touchEvent->timestamp);
1152 void WindowBaseEcoreWl2::OnMouseButtonCancel(void* data, int type, void* event)
1154 Ecore_Event_Mouse_Button* touchEvent = static_cast<Ecore_Event_Mouse_Button*>(event);
1156 if(touchEvent->window == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
1158 Integration::Point point;
1159 point.SetDeviceId(touchEvent->multi.device);
1160 point.SetState(PointState::INTERRUPTED);
1161 point.SetScreenPosition(Vector2(0.0f, 0.0f));
1163 mTouchEventSignal.Emit(point, touchEvent->timestamp);
1165 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::OnMouseButtonCancel\n");
1169 void WindowBaseEcoreWl2::OnMouseWheel(void* data, int type, void* event)
1171 Ecore_Event_Mouse_Wheel* mouseWheelEvent = static_cast<Ecore_Event_Mouse_Wheel*>(event);
1173 if(mouseWheelEvent->window == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
1175 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);
1177 Integration::WheelEvent wheelEvent(Integration::WheelEvent::MOUSE_WHEEL, mouseWheelEvent->direction, mouseWheelEvent->modifiers, Vector2(mouseWheelEvent->x, mouseWheelEvent->y), mouseWheelEvent->z, mouseWheelEvent->timestamp);
1179 mWheelEventSignal.Emit(wheelEvent);
1183 void WindowBaseEcoreWl2::OnDetentRotation(void* data, int type, void* event)
1185 Ecore_Event_Detent_Rotate* detentEvent = static_cast<Ecore_Event_Detent_Rotate*>(event);
1187 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Concise, "WindowBaseEcoreWl2::OnDetentRotation\n");
1189 int32_t clockwise = (detentEvent->direction == ECORE_DETENT_DIRECTION_CLOCKWISE) ? 1 : -1;
1191 Integration::WheelEvent wheelEvent(Integration::WheelEvent::CUSTOM_WHEEL, detentEvent->direction, 0, Vector2(0.0f, 0.0f), clockwise, detentEvent->timestamp);
1193 mWheelEventSignal.Emit(wheelEvent);
1196 void WindowBaseEcoreWl2::OnKeyDown(void* data, int type, void* event)
1198 Ecore_Event_Key* keyEvent = static_cast<Ecore_Event_Key*>(event);
1200 if(keyEvent->window == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
1202 std::string keyName(keyEvent->keyname);
1203 std::string logicalKey("");
1204 std::string keyString("");
1205 std::string compose("");
1207 #ifdef TRACE_ENABLED
1208 std::ostringstream stream;
1209 if(gTraceFilter->IsTraceEnabled())
1211 stream << "DALI_ON_KEY_DOWN [" << keyName << "]\n";
1212 DALI_TRACE_BEGIN(gTraceFilter, stream.str().c_str());
1216 // Ensure key compose string is not NULL as keys like SHIFT or arrow have a null string.
1217 if(keyEvent->compose)
1219 compose = keyEvent->compose;
1222 // Ensure key symbol is not NULL as keys like SHIFT have a null string.
1225 logicalKey = keyEvent->key;
1229 GetKeyCode(keyName, keyCode); // Get key code dynamically.
1233 // Get a specific key code from dali key look up table.
1234 keyCode = KeyLookup::GetDaliKeyCode(keyEvent->keyname);
1237 keyCode = (keyCode == -1) ? 0 : keyCode;
1238 int modifier(keyEvent->modifiers);
1239 unsigned long time = keyEvent->timestamp;
1240 if(!strncmp(keyEvent->keyname, "Keycode-", 8))
1242 keyCode = atoi(keyEvent->keyname + 8);
1245 // Ensure key event string is not NULL as keys like SHIFT have a null string.
1246 if(keyEvent->string)
1248 keyString = keyEvent->string;
1251 std::string deviceName;
1252 Device::Class::Type deviceClass;
1253 Device::Subclass::Type deviceSubclass;
1255 GetDeviceName(keyEvent, deviceName);
1256 GetDeviceClass(ecore_device_class_get(keyEvent->dev), deviceClass);
1257 GetDeviceSubclass(ecore_device_subclass_get(keyEvent->dev), deviceSubclass);
1259 Integration::KeyEvent keyEvent(keyName, logicalKey, keyString, keyCode, modifier, time, Integration::KeyEvent::DOWN, compose, deviceName, deviceClass, deviceSubclass);
1261 mKeyEventSignal.Emit(keyEvent);
1263 #ifdef TRACE_ENABLED
1264 if(gTraceFilter->IsTraceEnabled())
1266 DALI_TRACE_END(gTraceFilter, stream.str().c_str());
1272 void WindowBaseEcoreWl2::OnKeyUp(void* data, int type, void* event)
1274 Ecore_Event_Key* keyEvent = static_cast<Ecore_Event_Key*>(event);
1276 if(keyEvent->window == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
1278 #if defined(ECORE_VERSION_MAJOR) && (ECORE_VERSION_MAJOR >= 1) && defined(ECORE_VERSION_MINOR) && (ECORE_VERSION_MINOR >= 23)
1279 // Cancel processing flag is sent because this key event will combine with the previous key. So, the event should not actually perform anything.
1280 if(keyEvent->event_flags & ECORE_EVENT_FLAG_CANCEL)
1282 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::OnKeyUp: This event flag indicates the event is canceled. \n");
1285 #endif // Since ecore 1.23 version
1287 std::string keyName(keyEvent->keyname);
1288 std::string logicalKey("");
1289 std::string keyString("");
1290 std::string compose("");
1292 #ifdef TRACE_ENABLED
1293 std::ostringstream stream;
1294 if(gTraceFilter->IsTraceEnabled())
1296 stream << "DALI_ON_KEY_UP [" << keyName << "]" << std::endl;
1297 DALI_TRACE_BEGIN(gTraceFilter, stream.str().c_str());
1301 // Ensure key compose string is not NULL as keys like SHIFT or arrow have a null string.
1302 if(keyEvent->compose)
1304 compose = keyEvent->compose;
1307 // Ensure key symbol is not NULL as keys like SHIFT have a null string.
1310 logicalKey = keyEvent->key;
1314 GetKeyCode(keyName, keyCode); // Get key code dynamically.
1318 // Get a specific key code from dali key look up table.
1319 keyCode = KeyLookup::GetDaliKeyCode(keyEvent->keyname);
1322 keyCode = (keyCode == -1) ? 0 : keyCode;
1323 int modifier(keyEvent->modifiers);
1324 unsigned long time = keyEvent->timestamp;
1325 if(!strncmp(keyEvent->keyname, "Keycode-", 8))
1327 keyCode = atoi(keyEvent->keyname + 8);
1330 // Ensure key event string is not NULL as keys like SHIFT have a null string.
1331 if(keyEvent->string)
1333 keyString = keyEvent->string;
1336 std::string deviceName;
1337 Device::Class::Type deviceClass;
1338 Device::Subclass::Type deviceSubclass;
1340 GetDeviceName(keyEvent, deviceName);
1341 GetDeviceClass(ecore_device_class_get(keyEvent->dev), deviceClass);
1342 GetDeviceSubclass(ecore_device_subclass_get(keyEvent->dev), deviceSubclass);
1344 Integration::KeyEvent keyEvent(keyName, logicalKey, keyString, keyCode, modifier, time, Integration::KeyEvent::UP, compose, deviceName, deviceClass, deviceSubclass);
1346 mKeyEventSignal.Emit(keyEvent);
1348 #ifdef TRACE_ENABLED
1349 if(gTraceFilter->IsTraceEnabled())
1351 DALI_TRACE_END(gTraceFilter, stream.str().c_str());
1357 void WindowBaseEcoreWl2::OnDataSend(void* data, int type, void* event)
1359 mSelectionDataSendSignal.Emit(event);
1362 void WindowBaseEcoreWl2::OnDataReceive(void* data, int type, void* event)
1364 mSelectionDataReceivedSignal.Emit(event);
1367 void WindowBaseEcoreWl2::OnFontNameChanged()
1369 mStyleChangedSignal.Emit(StyleChange::DEFAULT_FONT_CHANGE);
1372 void WindowBaseEcoreWl2::OnFontSizeChanged()
1374 mStyleChangedSignal.Emit(StyleChange::DEFAULT_FONT_SIZE_CHANGE);
1377 void WindowBaseEcoreWl2::OnTransitionEffectEvent(WindowEffectState state, WindowEffectType type)
1379 mTransitionEffectEventSignal.Emit(state, type);
1382 void WindowBaseEcoreWl2::OnKeyboardRepeatSettingsChanged()
1384 mKeyboardRepeatSettingsChangedSignal.Emit();
1387 void WindowBaseEcoreWl2::OnEcoreEventWindowRedrawRequest()
1389 mWindowRedrawRequestSignal.Emit();
1392 void WindowBaseEcoreWl2::OnEcoreEventWindowAuxiliaryMessage(void* event)
1394 Ecore_Wl2_Event_Aux_Message* message = static_cast<Ecore_Wl2_Event_Aux_Message*>(event);
1397 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::OnEcoreEventWindowAuxiliaryMessage, key:%s, value:%s \n", message->key, message->val);
1398 std::string key(message->key);
1399 std::string value(message->val);
1400 Dali::Property::Array options;
1402 if(message->options)
1406 EINA_LIST_FOREACH(message->options, l, data)
1408 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::OnEcoreEventWindowAuxiliaryMessage, option: %s\n", (char*)data);
1409 std::string option(static_cast<char*>(data));
1410 options.Add(option);
1414 mAuxiliaryMessageSignal.Emit(key, value, options);
1418 void WindowBaseEcoreWl2::KeymapChanged(void* data, int type, void* event)
1420 Ecore_Wl2_Event_Seat_Keymap_Changed* changed = static_cast<Ecore_Wl2_Event_Seat_Keymap_Changed*>(event);
1421 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::KeymapChanged, keymap id[ %d ]\n", changed->id);
1422 Ecore_Wl2_Input* ecoreWlInput = ecore_wl2_input_default_input_get(changed->display);
1425 mKeyMap = ecore_wl2_input_keymap_get(ecoreWlInput);
1429 void WindowBaseEcoreWl2::RegistryGlobalCallback(void* data, struct wl_registry* registry, uint32_t name, const char* interface, uint32_t version)
1431 if(strcmp(interface, tizen_policy_interface.name) == 0)
1433 uint32_t clientVersion = std::min(version, MAX_TIZEN_CLIENT_VERSION);
1435 mTizenPolicy = static_cast<tizen_policy*>(wl_registry_bind(registry, name, &tizen_policy_interface, clientVersion));
1438 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::RegistryGlobalCallback: wl_registry_bind(tizen_policy_interface) is failed.\n");
1442 tizen_policy_add_listener(mTizenPolicy, &tizenPolicyListener, data);
1444 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::RegistryGlobalCallback: tizen_policy_add_listener is called.\n");
1446 else if(strcmp(interface, tizen_display_policy_interface.name) == 0)
1448 mTizenDisplayPolicy = static_cast<tizen_display_policy*>(wl_registry_bind(registry, name, &tizen_display_policy_interface, version));
1449 if(!mTizenDisplayPolicy)
1451 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::RegistryGlobalCallback: wl_registry_bind(tizen_display_policy_interface) is failed.\n");
1455 tizen_display_policy_add_listener(mTizenDisplayPolicy, &tizenDisplayPolicyListener, data);
1457 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::RegistryGlobalCallback: tizen_display_policy_add_listener is called.\n");
1461 void WindowBaseEcoreWl2::RegistryGlobalCallbackRemove(void* data, struct wl_registry* registry, uint32_t id)
1463 mTizenPolicy = NULL;
1464 mTizenDisplayPolicy = NULL;
1467 void WindowBaseEcoreWl2::TizenPolicyNotificationChangeDone(void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, int32_t level, uint32_t state)
1469 mNotificationLevel = level;
1470 mNotificationChangeState = state;
1471 mNotificationLevelChangeDone = true;
1473 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::TizenPolicyNotificationChangeDone: level = %d, state = %d\n", level, state);
1476 void WindowBaseEcoreWl2::TizenPolicyScreenModeChangeDone(void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, uint32_t mode, uint32_t state)
1478 mScreenOffMode = mode;
1479 mScreenOffModeChangeState = state;
1480 mScreenOffModeChangeDone = true;
1482 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::TizenPolicyScreenModeChangeDone: mode = %d, state = %d\n", mode, state);
1485 void WindowBaseEcoreWl2::DisplayPolicyBrightnessChangeDone(void* data, struct tizen_display_policy* displayPolicy, struct wl_surface* surface, int32_t brightness, uint32_t state)
1487 mBrightness = brightness;
1488 mBrightnessChangeState = state;
1489 mBrightnessChangeDone = true;
1491 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::DisplayPolicyBrightnessChangeDone: brightness = %d, state = %d\n", brightness, state);
1494 void WindowBaseEcoreWl2::GetKeyCode(std::string keyName, int32_t& keyCode)
1496 xkb_keysym_t sym = XKB_KEY_NoSymbol;
1497 KeyCodeMap foundKeyCode;
1499 sym = xkb_keysym_from_name(keyName.c_str(), XKB_KEYSYM_NO_FLAGS);
1500 if(sym == XKB_KEY_NoSymbol)
1502 DALI_LOG_ERROR("Failed to get keysym in WindowBaseEcoreWl2\n");
1506 foundKeyCode.keySym = sym;
1507 foundKeyCode.isKeyCode = false;
1508 xkb_keymap_key_for_each(mKeyMap, FindKeyCode, &foundKeyCode);
1509 keyCode = static_cast<int32_t>(foundKeyCode.keyCode);
1512 Any WindowBaseEcoreWl2::GetNativeWindow()
1514 return mEcoreWindow;
1517 int WindowBaseEcoreWl2::GetNativeWindowId()
1519 return ecore_wl2_window_id_get(mEcoreWindow);
1522 std::string WindowBaseEcoreWl2::GetNativeWindowResourceId()
1524 #ifdef OVER_TIZEN_VERSION_7
1525 return std::to_string(ecore_wl2_window_resource_id_get(mEcoreWindow));
1527 return std::string();
1531 EGLNativeWindowType WindowBaseEcoreWl2::CreateEglWindow(int width, int height)
1533 int totalAngle = (mWindowRotationAngle + mScreenRotationAngle) % 360;
1534 if(totalAngle == 90 || totalAngle == 270)
1536 mEglWindow = wl_egl_window_create(mWlSurface, height, width);
1540 mEglWindow = wl_egl_window_create(mWlSurface, width, height);
1543 return static_cast<EGLNativeWindowType>(mEglWindow);
1546 void WindowBaseEcoreWl2::DestroyEglWindow()
1548 if(mEglWindow != NULL)
1550 wl_egl_window_destroy(mEglWindow);
1555 void WindowBaseEcoreWl2::SetEglWindowRotation(int angle)
1557 wl_egl_window_tizen_rotation rotation;
1563 rotation = WL_EGL_WINDOW_TIZEN_ROTATION_0;
1568 rotation = WL_EGL_WINDOW_TIZEN_ROTATION_270;
1573 rotation = WL_EGL_WINDOW_TIZEN_ROTATION_180;
1578 rotation = WL_EGL_WINDOW_TIZEN_ROTATION_90;
1583 rotation = WL_EGL_WINDOW_TIZEN_ROTATION_0;
1588 wl_egl_window_tizen_set_rotation(mEglWindow, rotation);
1591 void WindowBaseEcoreWl2::SetEglWindowBufferTransform(int angle)
1593 wl_output_transform bufferTransform;
1599 bufferTransform = WL_OUTPUT_TRANSFORM_NORMAL;
1604 bufferTransform = WL_OUTPUT_TRANSFORM_90;
1609 bufferTransform = WL_OUTPUT_TRANSFORM_180;
1614 bufferTransform = WL_OUTPUT_TRANSFORM_270;
1619 bufferTransform = WL_OUTPUT_TRANSFORM_NORMAL;
1624 wl_egl_window_tizen_set_buffer_transform(mEglWindow, bufferTransform);
1627 void WindowBaseEcoreWl2::SetEglWindowTransform(int angle)
1629 wl_output_transform windowTransform;
1635 windowTransform = WL_OUTPUT_TRANSFORM_NORMAL;
1640 windowTransform = WL_OUTPUT_TRANSFORM_90;
1645 windowTransform = WL_OUTPUT_TRANSFORM_180;
1650 windowTransform = WL_OUTPUT_TRANSFORM_270;
1655 windowTransform = WL_OUTPUT_TRANSFORM_NORMAL;
1660 wl_egl_window_tizen_set_window_transform(mEglWindow, windowTransform);
1663 void WindowBaseEcoreWl2::ResizeEglWindow(PositionSize positionSize)
1665 wl_egl_window_resize(mEglWindow, positionSize.width, positionSize.height, positionSize.x, positionSize.y);
1667 // Note: Both "Resize" and "MoveResize" cases can reach here, but only "MoveResize" needs to submit serial number
1668 if(mMoveResizeSerial != mLastSubmittedMoveResizeSerial)
1670 wl_egl_window_tizen_set_window_serial(mEglWindow, mMoveResizeSerial);
1671 mLastSubmittedMoveResizeSerial = mMoveResizeSerial;
1675 bool WindowBaseEcoreWl2::IsEglWindowRotationSupported()
1678 wl_egl_window_tizen_capability capability = static_cast<wl_egl_window_tizen_capability>(wl_egl_window_tizen_get_capabilities(mEglWindow));
1679 if(capability == WL_EGL_WINDOW_TIZEN_CAPABILITY_ROTATION_SUPPORTED)
1681 mSupportedPreProtation = true;
1684 mSupportedPreProtation = false;
1688 PositionSize WindowBaseEcoreWl2::RecalculatePositionSizeToSystem(PositionSize positionSize)
1690 PositionSize newPositionSize;
1692 if(mWindowRotationAngle == 90)
1694 newPositionSize.x = positionSize.y;
1695 newPositionSize.y = mScreenHeight - (positionSize.x + positionSize.width);
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 = mScreenWidth - (positionSize.y + positionSize.height);
1709 newPositionSize.y = positionSize.x;
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 coord x[%d], y[%d], w{%d], h[%d]\n", newPositionSize.x, newPositionSize.y, newPositionSize.width, newPositionSize.height);
1724 return newPositionSize;
1727 PositionSize WindowBaseEcoreWl2::RecalculatePositionSizeToCurrentOrientation(PositionSize positionSize)
1729 PositionSize newPositionSize;
1731 if(mWindowRotationAngle == 90)
1733 newPositionSize.x = mScreenHeight - (positionSize.y + positionSize.height);
1734 newPositionSize.y = positionSize.x;
1735 newPositionSize.width = positionSize.height;
1736 newPositionSize.height = positionSize.width;
1738 else if(mWindowRotationAngle == 180)
1740 newPositionSize.x = mScreenWidth - (positionSize.x + positionSize.width);
1741 newPositionSize.y = mScreenHeight - (positionSize.y + positionSize.height);
1742 newPositionSize.width = positionSize.width;
1743 newPositionSize.height = positionSize.height;
1745 else if(mWindowRotationAngle == 270)
1747 newPositionSize.x = positionSize.y;
1748 newPositionSize.y = mScreenWidth - (positionSize.x + positionSize.width);
1749 newPositionSize.width = positionSize.height;
1750 newPositionSize.height = positionSize.width;
1754 newPositionSize.x = positionSize.x;
1755 newPositionSize.y = positionSize.y;
1756 newPositionSize.width = positionSize.width;
1757 newPositionSize.height = positionSize.height;
1760 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);
1761 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);
1763 return newPositionSize;
1766 void WindowBaseEcoreWl2::Move(PositionSize positionSize)
1768 PositionSize newPositionSize = RecalculatePositionSizeToSystem(positionSize);
1770 mWindowPositionSize = newPositionSize;
1771 DALI_LOG_RELEASE_INFO("ecore_wl2_window_position_set x[%d], y[%d]\n", newPositionSize.x, newPositionSize.y);
1772 ecore_wl2_window_position_set(mEcoreWindow, newPositionSize.x, newPositionSize.y);
1775 void WindowBaseEcoreWl2::Resize(PositionSize positionSize)
1777 PositionSize newPositionSize = RecalculatePositionSizeToSystem(positionSize);
1779 mWindowPositionSize = newPositionSize;
1780 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);
1781 ecore_wl2_window_sync_geometry_set(mEcoreWindow, ++mMoveResizeSerial, newPositionSize.x, newPositionSize.y, newPositionSize.width, newPositionSize.height);
1784 void WindowBaseEcoreWl2::MoveResize(PositionSize positionSize)
1786 PositionSize newPositionSize = RecalculatePositionSizeToSystem(positionSize);
1788 mWindowPositionSize = newPositionSize;
1789 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);
1790 ecore_wl2_window_sync_geometry_set(mEcoreWindow, ++mMoveResizeSerial, newPositionSize.x, newPositionSize.y, newPositionSize.width, newPositionSize.height);
1793 void WindowBaseEcoreWl2::SetClass(const std::string& name, const std::string& className)
1795 ecore_wl2_window_title_set(mEcoreWindow, name.c_str());
1796 ecore_wl2_window_class_set(mEcoreWindow, className.c_str());
1799 void WindowBaseEcoreWl2::Raise()
1801 // Use ecore_wl2_window_activate to prevent the window shown without rendering
1802 ecore_wl2_window_activate(mEcoreWindow);
1805 void WindowBaseEcoreWl2::Lower()
1807 ecore_wl2_window_lower(mEcoreWindow);
1810 void WindowBaseEcoreWl2::Activate()
1812 ecore_wl2_window_activate(mEcoreWindow);
1815 void WindowBaseEcoreWl2::Maximize(bool maximize)
1817 ecore_wl2_window_maximized_set(mEcoreWindow, maximize);
1820 bool WindowBaseEcoreWl2::IsMaximized() const
1822 return ecore_wl2_window_maximized_get(mEcoreWindow);
1825 void WindowBaseEcoreWl2::SetMaximumSize(Dali::Window::WindowSize size)
1827 DALI_LOG_RELEASE_INFO("ecore_wl2_window_maximum_size_set, width: %d, height: %d\n", size.GetWidth(), size.GetHeight());
1828 ecore_wl2_window_maximum_size_set(mEcoreWindow, size.GetWidth(), size.GetHeight());
1831 void WindowBaseEcoreWl2::Minimize(bool minimize)
1833 ecore_wl2_window_iconified_set(mEcoreWindow, minimize);
1836 bool WindowBaseEcoreWl2::IsMinimized() const
1838 return ecore_wl2_window_iconified_get(mEcoreWindow);
1841 void WindowBaseEcoreWl2::SetMimimumSize(Dali::Window::WindowSize size)
1843 DALI_LOG_RELEASE_INFO("ecore_wl2_window_minimum_size_set, width: %d, height: %d\n", size.GetWidth(), size.GetHeight());
1844 ecore_wl2_window_minimum_size_set(mEcoreWindow, size.GetWidth(), size.GetHeight());
1847 void WindowBaseEcoreWl2::SetAvailableAnlges(const std::vector<int>& angles)
1849 int rotations[4] = {0};
1850 DALI_LOG_RELEASE_INFO("WindowBaseEcoreWl2::SetAvailableAnlges, angle's count: %d, angles\n", angles.size());
1851 for(std::size_t i = 0; i < angles.size(); ++i)
1853 rotations[i] = static_cast<int>(angles[i]);
1854 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "%d ", rotations[i]);
1856 ecore_wl2_window_available_rotations_set(mEcoreWindow, rotations, angles.size());
1859 void WindowBaseEcoreWl2::SetPreferredAngle(int angle)
1861 DALI_LOG_RELEASE_INFO("WindowBaseEcoreWl2::SetPreferredAngle, angle: %d\n", angle);
1862 ecore_wl2_window_preferred_rotation_set(mEcoreWindow, angle);
1865 void WindowBaseEcoreWl2::SetAcceptFocus(bool accept)
1867 ecore_wl2_window_focus_skip_set(mEcoreWindow, !accept);
1870 void WindowBaseEcoreWl2::Show()
1874 ecore_wl2_window_geometry_set(mEcoreWindow, mWindowPositionSize.x, mWindowPositionSize.y, mWindowPositionSize.width, mWindowPositionSize.height);
1878 ecore_wl2_window_show(mEcoreWindow);
1881 void WindowBaseEcoreWl2::Hide()
1884 ecore_wl2_window_hide(mEcoreWindow);
1887 unsigned int WindowBaseEcoreWl2::GetSupportedAuxiliaryHintCount() const
1889 return mSupportedAuxiliaryHints.size();
1892 std::string WindowBaseEcoreWl2::GetSupportedAuxiliaryHint(unsigned int index) const
1894 if(index >= GetSupportedAuxiliaryHintCount())
1896 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetSupportedAuxiliaryHint: Invalid index! [%d]\n", index);
1899 return mSupportedAuxiliaryHints[index];
1902 unsigned int WindowBaseEcoreWl2::AddAuxiliaryHint(const std::string& hint, const std::string& value)
1904 bool supported = false;
1906 // Check if the hint is suppported
1907 for(std::vector<std::string>::iterator iter = mSupportedAuxiliaryHints.begin(); iter != mSupportedAuxiliaryHints.end(); ++iter)
1918 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Concise, "WindowBaseEcoreWl2::AddAuxiliaryHint: Not supported auxiliary hint [%s]\n", hint.c_str());
1922 // Check if the hint is already added
1923 for(unsigned int i = 0; i < mAuxiliaryHints.size(); i++)
1925 if(mAuxiliaryHints[i].first == hint)
1927 // Just change the value
1928 mAuxiliaryHints[i].second = value;
1930 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::AddAuxiliaryHint: Change! hint = %s, value = %s, id = %d\n", hint.c_str(), value.c_str(), i + 1);
1932 return i + 1; // id is index + 1
1937 mAuxiliaryHints.push_back(std::pair<std::string, std::string>(hint, value));
1939 unsigned int id = mAuxiliaryHints.size();
1941 ecore_wl2_window_aux_hint_add(mEcoreWindow, static_cast<int>(id), hint.c_str(), value.c_str());
1943 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::AddAuxiliaryHint: hint = %s, value = %s, id = %d\n", hint.c_str(), value.c_str(), id);
1948 bool WindowBaseEcoreWl2::RemoveAuxiliaryHint(unsigned int id)
1950 if(id == 0 || id > mAuxiliaryHints.size())
1952 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Concise, "WindowBaseEcoreWl2::RemoveAuxiliaryHint: Invalid id [%d]\n", id);
1956 mAuxiliaryHints[id - 1].second = std::string();
1958 ecore_wl2_window_aux_hint_del(mEcoreWindow, static_cast<int>(id));
1960 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::RemoveAuxiliaryHint: id = %d, hint = %s\n", id, mAuxiliaryHints[id - 1].first.c_str());
1965 bool WindowBaseEcoreWl2::SetAuxiliaryHintValue(unsigned int id, const std::string& value)
1967 if(id == 0 || id > mAuxiliaryHints.size())
1969 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Concise, "WindowBaseEcoreWl2::SetAuxiliaryHintValue: Invalid id [%d]\n", id);
1973 mAuxiliaryHints[id - 1].second = value;
1975 ecore_wl2_window_aux_hint_change(mEcoreWindow, static_cast<int>(id), value.c_str());
1977 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());
1982 std::string WindowBaseEcoreWl2::GetAuxiliaryHintValue(unsigned int id) const
1984 if(id == 0 || id > mAuxiliaryHints.size())
1986 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Concise, "WindowBaseEcoreWl2::GetAuxiliaryHintValue: Invalid id [%d]\n", id);
1987 return std::string();
1990 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());
1992 return mAuxiliaryHints[id - 1].second;
1995 unsigned int WindowBaseEcoreWl2::GetAuxiliaryHintId(const std::string& hint) const
1997 for(unsigned int i = 0; i < mAuxiliaryHints.size(); i++)
1999 if(mAuxiliaryHints[i].first == hint)
2001 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetAuxiliaryHintId: hint = %s, id = %d\n", hint.c_str(), i + 1);
2006 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetAuxiliaryHintId: Invalid hint! [%s]\n", hint.c_str());
2011 void WindowBaseEcoreWl2::SetInputRegion(const Rect<int>& inputRegion)
2013 ecore_wl2_window_input_region_set(mEcoreWindow, inputRegion.x, inputRegion.y, inputRegion.width, inputRegion.height);
2016 void WindowBaseEcoreWl2::SetType(Dali::WindowType type)
2021 Ecore_Wl2_Window_Type windowType;
2025 case Dali::WindowType::NORMAL:
2027 windowType = ECORE_WL2_WINDOW_TYPE_TOPLEVEL;
2030 case Dali::WindowType::NOTIFICATION:
2032 windowType = ECORE_WL2_WINDOW_TYPE_NOTIFICATION;
2035 case Dali::WindowType::UTILITY:
2037 windowType = ECORE_WL2_WINDOW_TYPE_UTILITY;
2040 case Dali::WindowType::DIALOG:
2042 windowType = ECORE_WL2_WINDOW_TYPE_DIALOG;
2045 case Dali::WindowType::IME:
2047 windowType = ECORE_WL2_WINDOW_TYPE_NONE;
2052 windowType = ECORE_WL2_WINDOW_TYPE_TOPLEVEL;
2056 ecore_wl2_window_type_set(mEcoreWindow, windowType);
2060 Dali::WindowType WindowBaseEcoreWl2::GetType() const
2065 Dali::WindowOperationResult WindowBaseEcoreWl2::SetNotificationLevel(Dali::WindowNotificationLevel level)
2067 while(!mTizenPolicy)
2069 wl_display_dispatch_queue(mDisplay, mEventQueue);
2072 int notificationLevel;
2076 case Dali::WindowNotificationLevel::NONE:
2078 notificationLevel = TIZEN_POLICY_LEVEL_NONE;
2081 case Dali::WindowNotificationLevel::BASE:
2083 notificationLevel = TIZEN_POLICY_LEVEL_DEFAULT;
2086 case Dali::WindowNotificationLevel::MEDIUM:
2088 notificationLevel = TIZEN_POLICY_LEVEL_MEDIUM;
2091 case Dali::WindowNotificationLevel::HIGH:
2093 notificationLevel = TIZEN_POLICY_LEVEL_HIGH;
2096 case Dali::WindowNotificationLevel::TOP:
2098 notificationLevel = TIZEN_POLICY_LEVEL_TOP;
2103 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetNotificationLevel: invalid level [%d]\n", level);
2104 notificationLevel = TIZEN_POLICY_LEVEL_DEFAULT;
2109 mNotificationLevelChangeDone = false;
2110 mNotificationChangeState = TIZEN_POLICY_ERROR_STATE_NONE;
2112 tizen_policy_set_notification_level(mTizenPolicy, ecore_wl2_window_surface_get(mEcoreWindow), notificationLevel);
2116 while(!mNotificationLevelChangeDone && count < 3)
2118 ecore_wl2_display_flush(ecore_wl2_connected_display_get(NULL));
2119 wl_display_dispatch_queue(mDisplay, mEventQueue);
2123 if(!mNotificationLevelChangeDone)
2125 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetNotificationLevel: Level change is failed [%d, %d]\n", level, mNotificationChangeState);
2126 return Dali::WindowOperationResult::UNKNOWN_ERROR;
2128 else if(mNotificationChangeState == TIZEN_POLICY_ERROR_STATE_PERMISSION_DENIED)
2130 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetNotificationLevel: Permission denied! [%d]\n", level);
2131 return Dali::WindowOperationResult::PERMISSION_DENIED;
2134 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetNotificationLevel: Level is changed [%d]\n", mNotificationLevel);
2136 return Dali::WindowOperationResult::SUCCEED;
2139 Dali::WindowNotificationLevel WindowBaseEcoreWl2::GetNotificationLevel() const
2141 while(!mTizenPolicy)
2143 wl_display_dispatch_queue(mDisplay, mEventQueue);
2148 while(!mNotificationLevelChangeDone && count < 3)
2150 ecore_wl2_display_flush(ecore_wl2_connected_display_get(NULL));
2151 wl_display_dispatch_queue(mDisplay, mEventQueue);
2155 if(!mNotificationLevelChangeDone)
2157 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetNotificationLevel: Error! [%d]\n", mNotificationChangeState);
2158 return Dali::WindowNotificationLevel::NONE;
2161 Dali::WindowNotificationLevel level;
2163 switch(mNotificationLevel)
2165 case TIZEN_POLICY_LEVEL_NONE:
2167 level = Dali::WindowNotificationLevel::NONE;
2170 case TIZEN_POLICY_LEVEL_DEFAULT:
2172 level = Dali::WindowNotificationLevel::BASE;
2175 case TIZEN_POLICY_LEVEL_MEDIUM:
2177 level = Dali::WindowNotificationLevel::MEDIUM;
2180 case TIZEN_POLICY_LEVEL_HIGH:
2182 level = Dali::WindowNotificationLevel::HIGH;
2185 case TIZEN_POLICY_LEVEL_TOP:
2187 level = Dali::WindowNotificationLevel::TOP;
2192 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetNotificationLevel: invalid level [%d]\n", mNotificationLevel);
2193 level = Dali::WindowNotificationLevel::NONE;
2198 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetNotificationLevel: level [%d]\n", mNotificationLevel);
2203 void WindowBaseEcoreWl2::SetOpaqueState(bool opaque)
2205 while(!mTizenPolicy)
2207 wl_display_dispatch_queue(mDisplay, mEventQueue);
2210 tizen_policy_set_opaque_state(mTizenPolicy, ecore_wl2_window_surface_get(mEcoreWindow), (opaque ? 1 : 0));
2213 Dali::WindowOperationResult WindowBaseEcoreWl2::SetScreenOffMode(WindowScreenOffMode screenOffMode)
2215 while(!mTizenPolicy)
2217 wl_display_dispatch_queue(mDisplay, mEventQueue);
2220 mScreenOffModeChangeDone = false;
2221 mScreenOffModeChangeState = TIZEN_POLICY_ERROR_STATE_NONE;
2223 unsigned int mode = 0;
2225 switch(screenOffMode)
2227 case WindowScreenOffMode::TIMEOUT:
2232 case WindowScreenOffMode::NEVER:
2239 tizen_policy_set_window_screen_mode(mTizenPolicy, ecore_wl2_window_surface_get(mEcoreWindow), mode);
2243 while(!mScreenOffModeChangeDone && count < 3)
2245 ecore_wl2_display_flush(ecore_wl2_connected_display_get(NULL));
2246 wl_display_dispatch_queue(mDisplay, mEventQueue);
2250 if(!mScreenOffModeChangeDone)
2252 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetScreenOffMode: Screen mode change is failed [%d, %d]\n", screenOffMode, mScreenOffModeChangeState);
2253 return Dali::WindowOperationResult::UNKNOWN_ERROR;
2255 else if(mScreenOffModeChangeState == TIZEN_POLICY_ERROR_STATE_PERMISSION_DENIED)
2257 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetScreenOffMode: Permission denied! [%d]\n", screenOffMode);
2258 return Dali::WindowOperationResult::PERMISSION_DENIED;
2261 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetScreenOffMode: Screen mode is changed [%d]\n", mScreenOffMode);
2263 return Dali::WindowOperationResult::SUCCEED;
2266 WindowScreenOffMode WindowBaseEcoreWl2::GetScreenOffMode() const
2268 while(!mTizenPolicy)
2270 wl_display_dispatch_queue(mDisplay, mEventQueue);
2275 while(!mScreenOffModeChangeDone && count < 3)
2277 ecore_wl2_display_flush(ecore_wl2_connected_display_get(NULL));
2278 wl_display_dispatch_queue(mDisplay, mEventQueue);
2282 if(!mScreenOffModeChangeDone)
2284 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetScreenOffMode: Error! [%d]\n", mScreenOffModeChangeState);
2285 return WindowScreenOffMode::TIMEOUT;
2288 WindowScreenOffMode screenMode = WindowScreenOffMode::TIMEOUT;
2290 switch(mScreenOffMode)
2294 screenMode = WindowScreenOffMode::TIMEOUT;
2299 screenMode = WindowScreenOffMode::NEVER;
2304 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetScreenOffMode: screen mode [%d]\n", mScreenOffMode);
2309 Dali::WindowOperationResult WindowBaseEcoreWl2::SetBrightness(int brightness)
2311 while(!mTizenDisplayPolicy)
2313 wl_display_dispatch_queue(mDisplay, mEventQueue);
2316 mBrightnessChangeDone = false;
2317 mBrightnessChangeState = TIZEN_POLICY_ERROR_STATE_NONE;
2319 tizen_display_policy_set_window_brightness(mTizenDisplayPolicy, ecore_wl2_window_surface_get(mEcoreWindow), brightness);
2323 while(!mBrightnessChangeDone && count < 3)
2325 ecore_wl2_display_flush(ecore_wl2_connected_display_get(NULL));
2326 wl_display_dispatch_queue(mDisplay, mEventQueue);
2330 if(!mBrightnessChangeDone)
2332 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetBrightness: Brightness change is failed [%d, %d]\n", brightness, mBrightnessChangeState);
2333 return Dali::WindowOperationResult::UNKNOWN_ERROR;
2335 else if(mBrightnessChangeState == TIZEN_POLICY_ERROR_STATE_PERMISSION_DENIED)
2337 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetBrightness: Permission denied! [%d]\n", brightness);
2338 return Dali::WindowOperationResult::PERMISSION_DENIED;
2341 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetBrightness: Brightness is changed [%d]\n", mBrightness);
2343 return Dali::WindowOperationResult::SUCCEED;
2346 int WindowBaseEcoreWl2::GetBrightness() const
2348 while(!mTizenDisplayPolicy)
2350 wl_display_dispatch_queue(mDisplay, mEventQueue);
2355 while(!mBrightnessChangeDone && count < 3)
2357 ecore_wl2_display_flush(ecore_wl2_connected_display_get(NULL));
2358 wl_display_dispatch_queue(mDisplay, mEventQueue);
2362 if(!mBrightnessChangeDone)
2364 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetBrightness: Error! [%d]\n", mBrightnessChangeState);
2368 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetBrightness: Brightness [%d]\n", mBrightness);
2373 bool WindowBaseEcoreWl2::GrabKey(Dali::KEY key, KeyGrab::KeyGrabMode grabMode)
2375 Ecore_Wl2_Window_Keygrab_Mode mode;
2379 case KeyGrab::TOPMOST:
2381 mode = ECORE_WL2_WINDOW_KEYGRAB_TOPMOST;
2384 case KeyGrab::SHARED:
2386 mode = ECORE_WL2_WINDOW_KEYGRAB_SHARED;
2389 case KeyGrab::OVERRIDE_EXCLUSIVE:
2391 mode = ECORE_WL2_WINDOW_KEYGRAB_OVERRIDE_EXCLUSIVE;
2394 case KeyGrab::EXCLUSIVE:
2396 mode = ECORE_WL2_WINDOW_KEYGRAB_EXCLUSIVE;
2405 return ecore_wl2_window_keygrab_set(mEcoreWindow, KeyLookup::GetKeyName(key), 0, 0, 0, mode);
2408 bool WindowBaseEcoreWl2::UngrabKey(Dali::KEY key)
2410 return ecore_wl2_window_keygrab_unset(mEcoreWindow, KeyLookup::GetKeyName(key), 0, 0);
2413 bool WindowBaseEcoreWl2::GrabKeyList(const Dali::Vector<Dali::KEY>& key, const Dali::Vector<KeyGrab::KeyGrabMode>& grabMode, Dali::Vector<bool>& result)
2415 int keyCount = key.Count();
2416 int keyGrabModeCount = grabMode.Count();
2418 if(keyCount != keyGrabModeCount || keyCount == 0)
2425 Eina_List* keyList = NULL;
2426 Ecore_Wl2_Window_Keygrab_Info* info = new Ecore_Wl2_Window_Keygrab_Info[keyCount];
2428 for(int index = 0; index < keyCount; ++index)
2430 info[index].key = const_cast<char*>(KeyLookup::GetKeyName(key[index]));
2432 switch(grabMode[index])
2434 case KeyGrab::TOPMOST:
2436 info[index].mode = ECORE_WL2_WINDOW_KEYGRAB_TOPMOST;
2439 case KeyGrab::SHARED:
2441 info[index].mode = ECORE_WL2_WINDOW_KEYGRAB_SHARED;
2444 case KeyGrab::OVERRIDE_EXCLUSIVE:
2446 info[index].mode = ECORE_WL2_WINDOW_KEYGRAB_OVERRIDE_EXCLUSIVE;
2449 case KeyGrab::EXCLUSIVE:
2451 info[index].mode = ECORE_WL2_WINDOW_KEYGRAB_EXCLUSIVE;
2456 info[index].mode = ECORE_WL2_WINDOW_KEYGRAB_UNKNOWN;
2461 keyList = eina_list_append(keyList, &info);
2464 Eina_List* grabList = ecore_wl2_window_keygrab_list_set(mEcoreWindow, keyList);
2466 result.Resize(keyCount, true);
2468 Eina_List* l = NULL;
2469 Eina_List* m = NULL;
2470 void* listData = NULL;
2472 if(grabList != NULL)
2474 EINA_LIST_FOREACH(grabList, m, data)
2477 EINA_LIST_FOREACH(keyList, l, listData)
2479 if(static_cast<Ecore_Wl2_Window_Keygrab_Info*>(listData)->key == NULL)
2481 DALI_LOG_ERROR("input key list has null data!");
2485 if(strcmp(static_cast<char*>(data), static_cast<Ecore_Wl2_Window_Keygrab_Info*>(listData)->key) == 0)
2487 result[index] = false;
2496 eina_list_free(keyList);
2497 eina_list_free(grabList);
2503 bool WindowBaseEcoreWl2::UngrabKeyList(const Dali::Vector<Dali::KEY>& key, Dali::Vector<bool>& result)
2505 int keyCount = key.Count();
2513 Eina_List* keyList = NULL;
2514 Ecore_Wl2_Window_Keygrab_Info* info = new Ecore_Wl2_Window_Keygrab_Info[keyCount];
2516 for(int index = 0; index < keyCount; ++index)
2518 info[index].key = const_cast<char*>(KeyLookup::GetKeyName(key[index]));
2519 keyList = eina_list_append(keyList, &info);
2522 Eina_List* ungrabList = ecore_wl2_window_keygrab_list_unset(mEcoreWindow, keyList);
2524 result.Resize(keyCount, true);
2526 Eina_List* l = NULL;
2527 Eina_List* m = NULL;
2528 void* listData = NULL;
2531 if(ungrabList != NULL)
2533 EINA_LIST_FOREACH(ungrabList, m, data)
2536 EINA_LIST_FOREACH(keyList, l, listData)
2538 if(strcmp(static_cast<char*>(data), static_cast<Ecore_Wl2_Window_Keygrab_Info*>(listData)->key) == 0)
2540 result[index] = false;
2549 eina_list_free(keyList);
2550 eina_list_free(ungrabList);
2556 void WindowBaseEcoreWl2::GetDpi(unsigned int& dpiHorizontal, unsigned int& dpiVertical)
2561 Ecore_Wl2_Output* output = ecore_wl2_window_output_find(mEcoreWindow);
2563 // 1 inch = 25.4 millimeters
2564 xres = ecore_wl2_output_dpi_get(output);
2565 yres = ecore_wl2_output_dpi_get(output);
2567 dpiHorizontal = int(xres + 0.5f); // rounding
2568 dpiVertical = int(yres + 0.5f);
2571 int WindowBaseEcoreWl2::GetOrientation() const
2573 int orientation = (mScreenRotationAngle + mWindowRotationAngle) % 360;
2574 if(mSupportedPreProtation)
2581 int WindowBaseEcoreWl2::GetScreenRotationAngle()
2585 if(ecore_wl2_window_ignore_output_transform_get(mEcoreWindow))
2591 transform = ecore_wl2_output_transform_get(ecore_wl2_window_output_find(mEcoreWindow));
2593 mScreenRotationAngle = transform * 90;
2594 return mScreenRotationAngle;
2597 void WindowBaseEcoreWl2::SetWindowRotationAngle(int degree)
2599 mWindowRotationAngle = degree;
2600 ecore_wl2_window_rotation_set(mEcoreWindow, degree);
2603 void WindowBaseEcoreWl2::WindowRotationCompleted(int degree, int width, int height)
2605 ecore_wl2_window_rotation_change_done_send(mEcoreWindow, degree, width, height);
2608 void WindowBaseEcoreWl2::SetTransparency(bool transparent)
2610 ecore_wl2_window_alpha_set(mEcoreWindow, transparent);
2613 void WindowBaseEcoreWl2::CreateWindow(PositionSize positionSize)
2615 Ecore_Wl2_Display* display = ecore_wl2_display_connect(NULL);
2618 DALI_ASSERT_ALWAYS(0 && "Failed to get display");
2621 ecore_wl2_display_sync(display);
2623 mEcoreWindow = ecore_wl2_window_new(display, NULL, positionSize.x, positionSize.y, positionSize.width, positionSize.height);
2625 if(mEcoreWindow == 0)
2627 DALI_ASSERT_ALWAYS(0 && "Failed to create Wayland window");
2631 ecore_wl2_window_type_set(mEcoreWindow, ECORE_WL2_WINDOW_TYPE_TOPLEVEL);
2633 // Get Screen width, height
2634 ecore_wl2_display_screen_size_get(display, &mScreenWidth, &mScreenHeight);
2637 void WindowBaseEcoreWl2::SetParent(WindowBase* parentWinBase, bool belowParent)
2639 Ecore_Wl2_Window* ecoreParent = NULL;
2642 WindowBaseEcoreWl2* winBaseEcore2 = static_cast<WindowBaseEcoreWl2*>(parentWinBase);
2643 ecoreParent = winBaseEcore2->mEcoreWindow;
2645 ecore_wl2_window_transient_parent_set(mEcoreWindow, ecoreParent, belowParent);
2648 int WindowBaseEcoreWl2::CreateFrameRenderedSyncFence()
2650 return wl_egl_window_tizen_create_commit_sync_fd(mEglWindow);
2653 int WindowBaseEcoreWl2::CreateFramePresentedSyncFence()
2655 return wl_egl_window_tizen_create_presentation_sync_fd(mEglWindow);
2658 void WindowBaseEcoreWl2::SetPositionSizeWithAngle(PositionSize positionSize, int angle)
2660 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);
2661 ecore_wl2_window_rotation_geometry_set(mEcoreWindow, angle, positionSize.x, positionSize.y, positionSize.width, positionSize.height);
2664 void WindowBaseEcoreWl2::InitializeIme()
2666 Eina_Iterator* globals;
2667 struct wl_registry* registry;
2668 Ecore_Wl2_Global* global;
2669 Ecore_Wl2_Display* ecoreWl2Display;
2671 if(!(ecoreWl2Display = ecore_wl2_connected_display_get(NULL)))
2673 DALI_LOG_ERROR("WindowBaseEcoreWl2::InitializeIme(), fail to get ecore_wl2 connected display\n");
2677 DALI_LOG_RELEASE_INFO("InitializeIme: Ecore_Wl2_Display: %p, ecore wl window: %p\n", ecoreWl2Display, mEcoreWindow);
2679 if(!(registry = ecore_wl2_display_registry_get(ecoreWl2Display)))
2681 DALI_LOG_ERROR("WindowBaseEcoreWl2::InitializeIme(), fail to get ecore_wl2 display registry\n");
2685 if(!(globals = ecore_wl2_display_globals_get(ecoreWl2Display)))
2687 DALI_LOG_ERROR("WindowBaseEcoreWl2::InitializeIme(), fail to get ecore_wl2 globals\n");
2691 EINA_ITERATOR_FOREACH(globals, global)
2693 #ifdef OVER_TIZEN_VERSION_7
2694 if(strcmp(global->interface, "zwp_input_panel_v1") == 0)
2696 mWlInputPanel = (zwp_input_panel_v1*)wl_registry_bind(registry, global->id, &zwp_input_panel_v1_interface, 1);
2699 if(strcmp(global->interface, "wl_input_panel") == 0)
2701 mWlInputPanel = (wl_input_panel*)wl_registry_bind(registry, global->id, &wl_input_panel_interface, 1);
2704 else if(strcmp(global->interface, "wl_output") == 0)
2706 mWlOutput = (wl_output*)wl_registry_bind(registry, global->id, &wl_output_interface, 1);
2712 DALI_LOG_ERROR("WindowBaseEcoreWl2::InitializeIme(), fail to get wayland input panel interface\n");
2718 DALI_LOG_ERROR("WindowBaseEcoreWl2::InitializeIme(), fail to get wayland output panel interface\n");
2721 #ifdef OVER_TIZEN_VERSION_7
2722 mWlInputPanelSurface = zwp_input_panel_v1_get_input_panel_surface(mWlInputPanel, mWlSurface);
2724 mWlInputPanelSurface = wl_input_panel_get_input_panel_surface(mWlInputPanel, mWlSurface);
2726 if(!mWlInputPanelSurface)
2728 DALI_LOG_ERROR("WindowBaseEcoreWl2::InitializeIme(), fail to get wayland input panel surface\n");
2731 #ifdef OVER_TIZEN_VERSION_7
2732 zwp_input_panel_surface_v1_set_toplevel(mWlInputPanelSurface, mWlOutput, ZWP_INPUT_PANEL_SURFACE_V1_POSITION_CENTER_BOTTOM);
2734 wl_input_panel_surface_set_toplevel(mWlInputPanelSurface, mWlOutput, WL_INPUT_PANEL_SURFACE_POSITION_CENTER_BOTTOM);
2738 void WindowBaseEcoreWl2::ImeWindowReadyToRender()
2740 if(!mWlInputPanelSurface)
2742 DALI_LOG_ERROR("WindowBaseEcoreWl2::ImeWindowReadyToRender(), wayland input panel surface is null\n");
2745 #ifdef OVER_TIZEN_VERSION_7
2746 zwp_input_panel_surface_v1_set_ready(mWlInputPanelSurface, 1);
2748 wl_input_panel_surface_set_ready(mWlInputPanelSurface, 1);
2752 void WindowBaseEcoreWl2::RequestMoveToServer()
2754 Ecore_Wl2_Display* display = ecore_wl2_connected_display_get(NULL);
2757 DALI_LOG_ERROR("WindowBaseEcoreWl2::RequestMoveToServer, Fail to get ecore_wl2_display\n");
2761 Ecore_Wl2_Input* input = ecore_wl2_input_default_input_get(display);
2764 DALI_LOG_ERROR("WindowBaseEcoreWl2::RequestMoveToServer, Fail to get default Ecore_Wl2_Input\n");
2768 ecore_wl2_window_move(mEcoreWindow, input);
2769 DALI_LOG_RELEASE_INFO("WindowBaseEcoreWl2::RequestMoveToServer, starts the window[%p] is moved by server\n", mEcoreWindow);
2772 void WindowBaseEcoreWl2::RequestResizeToServer(WindowResizeDirection direction)
2774 Ecore_Wl2_Display* display = ecore_wl2_connected_display_get(NULL);
2777 DALI_LOG_ERROR("WindowBaseEcoreWl2::RequestResizeToServer, Fail to get ecore_wl2_display\n");
2781 Ecore_Wl2_Input* input = ecore_wl2_input_default_input_get(display);
2784 DALI_LOG_ERROR("WindowBaseEcoreWl2::RequestResizeToServer, Fail to get default Ecore_Wl2_Input\n");
2791 case WindowResizeDirection::TOP_LEFT:
2796 case WindowResizeDirection::TOP:
2801 case WindowResizeDirection::TOP_RIGHT:
2806 case WindowResizeDirection::LEFT:
2811 case WindowResizeDirection::RIGHT:
2816 case WindowResizeDirection::BOTTOM_LEFT:
2821 case WindowResizeDirection::BOTTOM:
2826 case WindowResizeDirection::BOTTOM_RIGHT:
2838 ecore_wl2_window_resize(mEcoreWindow, input, location);
2839 DALI_LOG_RELEASE_INFO("WindowBaseEcoreWl2::RequestResizeToServer, starts the window[%p] is resized by server, mode:%d\n", mEcoreWindow, location);
2842 void WindowBaseEcoreWl2::EnableFloatingMode(bool enable)
2844 DALI_LOG_RELEASE_INFO("WindowBaseEcoreWl2::EnableFloatingMode, floating mode flag: [%p], enable [%d]\n", mEcoreWindow, enable);
2847 ecore_wl2_window_floating_mode_set(mEcoreWindow, EINA_TRUE);
2851 ecore_wl2_window_floating_mode_set(mEcoreWindow, EINA_FALSE);
2855 bool WindowBaseEcoreWl2::IsFloatingModeEnabled() const
2857 return ecore_wl2_window_floating_mode_get(mEcoreWindow);
2860 void WindowBaseEcoreWl2::IncludeInputRegion(const Rect<int>& inputRegion)
2862 Eina_Rectangle rect;
2863 rect.x = inputRegion.x;
2864 rect.y = inputRegion.y;
2865 rect.w = inputRegion.width;
2866 rect.h = inputRegion.height;
2868 ecore_wl2_window_input_rect_add(mEcoreWindow, &rect);
2869 ecore_wl2_window_commit(mEcoreWindow, EINA_TRUE);
2872 void WindowBaseEcoreWl2::ExcludeInputRegion(const Rect<int>& inputRegion)
2874 Eina_Rectangle rect;
2875 rect.x = inputRegion.x;
2876 rect.y = inputRegion.y;
2877 rect.w = inputRegion.width;
2878 rect.h = inputRegion.height;
2880 ecore_wl2_window_input_rect_subtract(mEcoreWindow, &rect);
2881 ecore_wl2_window_commit(mEcoreWindow, EINA_TRUE);
2884 } // namespace Adaptor
2886 } // namespace Internal
2890 #pragma GCC diagnostic pop