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.
58 #ifdef DALI_ELDBUS_AVAILABLE
60 const char* BUS = "org.enlightenment.wm-screen-reader";
61 const char* INTERFACE = "org.tizen.GestureNavigation";
62 const char* PATH = "/org/tizen/GestureNavigation";
63 #endif // DALI_ELDBUS_AVAILABLE
68 xkb_keycode_t keyCode;
73 * Get the device name from the provided ecore key event
75 void GetDeviceName(Ecore_Event_Key* keyEvent, std::string& result)
77 const char* ecoreDeviceName = ecore_device_name_get(keyEvent->dev);
81 result = ecoreDeviceName;
86 * Get the device class from the provided ecore event
88 void GetDeviceClass(Ecore_Device_Class ecoreDeviceClass, Device::Class::Type& deviceClass)
90 switch(ecoreDeviceClass)
92 case ECORE_DEVICE_CLASS_SEAT:
94 deviceClass = Device::Class::USER;
97 case ECORE_DEVICE_CLASS_KEYBOARD:
99 deviceClass = Device::Class::KEYBOARD;
102 case ECORE_DEVICE_CLASS_MOUSE:
104 deviceClass = Device::Class::MOUSE;
107 case ECORE_DEVICE_CLASS_TOUCH:
109 deviceClass = Device::Class::TOUCH;
112 case ECORE_DEVICE_CLASS_PEN:
114 deviceClass = Device::Class::PEN;
117 case ECORE_DEVICE_CLASS_POINTER:
119 deviceClass = Device::Class::POINTER;
122 case ECORE_DEVICE_CLASS_GAMEPAD:
124 deviceClass = Device::Class::GAMEPAD;
129 deviceClass = Device::Class::NONE;
135 void GetDeviceSubclass(Ecore_Device_Subclass ecoreDeviceSubclass, Device::Subclass::Type& deviceSubclass)
137 switch(ecoreDeviceSubclass)
139 case ECORE_DEVICE_SUBCLASS_FINGER:
141 deviceSubclass = Device::Subclass::FINGER;
144 case ECORE_DEVICE_SUBCLASS_FINGERNAIL:
146 deviceSubclass = Device::Subclass::FINGERNAIL;
149 case ECORE_DEVICE_SUBCLASS_KNUCKLE:
151 deviceSubclass = Device::Subclass::KNUCKLE;
154 case ECORE_DEVICE_SUBCLASS_PALM:
156 deviceSubclass = Device::Subclass::PALM;
159 case ECORE_DEVICE_SUBCLASS_HAND_SIZE:
161 deviceSubclass = Device::Subclass::HAND_SIDE;
164 case ECORE_DEVICE_SUBCLASS_HAND_FLAT:
166 deviceSubclass = Device::Subclass::HAND_FLAT;
169 case ECORE_DEVICE_SUBCLASS_PEN_TIP:
171 deviceSubclass = Device::Subclass::PEN_TIP;
174 case ECORE_DEVICE_SUBCLASS_TRACKPAD:
176 deviceSubclass = Device::Subclass::TRACKPAD;
179 case ECORE_DEVICE_SUBCLASS_TRACKPOINT:
181 deviceSubclass = Device::Subclass::TRACKPOINT;
184 case ECORE_DEVICE_SUBCLASS_TRACKBALL:
186 deviceSubclass = Device::Subclass::TRACKBALL;
189 case ECORE_DEVICE_SUBCLASS_REMOCON:
191 deviceSubclass = Device::Subclass::REMOCON;
194 case ECORE_DEVICE_SUBCLASS_VIRTUAL_KEYBOARD:
196 deviceSubclass = Device::Subclass::VIRTUAL_KEYBOARD;
201 deviceSubclass = Device::Subclass::NONE;
207 void FindKeyCode(struct xkb_keymap* keyMap, xkb_keycode_t key, void* data)
209 KeyCodeMap* foundKeyCode = static_cast<KeyCodeMap*>(data);
210 if(foundKeyCode->isKeyCode)
215 xkb_keysym_t keySym = foundKeyCode->keySym;
217 const xkb_keysym_t* symsOut = NULL;
219 nsyms = xkb_keymap_key_get_syms_by_level(keyMap, key, 0, 0, &symsOut);
223 if(*symsOut == keySym)
225 foundKeyCode->keyCode = key;
226 foundKeyCode->isKeyCode = true;
231 /////////////////////////////////////////////////////////////////////////////////////////////////
233 /////////////////////////////////////////////////////////////////////////////////////////////////
235 /// Called when the window iconify state is changed.
236 static Eina_Bool EcoreEventWindowIconifyStateChanged(void* data, int type, void* event)
238 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
241 return windowBase->OnIconifyStateChanged(data, type, event);
244 return ECORE_CALLBACK_PASS_ON;
247 /// Called when the window gains focus
248 static Eina_Bool EcoreEventWindowFocusIn(void* data, int type, void* event)
250 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
253 return windowBase->OnFocusIn(data, type, event);
256 return ECORE_CALLBACK_PASS_ON;
259 /// Called when the window loses focus
260 static Eina_Bool EcoreEventWindowFocusOut(void* data, int type, void* event)
262 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
265 return windowBase->OnFocusOut(data, type, event);
268 return ECORE_CALLBACK_PASS_ON;
271 /// Called when the output is transformed
272 static Eina_Bool EcoreEventOutputTransform(void* data, int type, void* event)
274 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
277 return windowBase->OnOutputTransform(data, type, event);
280 return ECORE_CALLBACK_PASS_ON;
283 /// Called when the output transform should be ignored
284 static Eina_Bool EcoreEventIgnoreOutputTransform(void* data, int type, void* event)
286 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
289 return windowBase->OnIgnoreOutputTransform(data, type, event);
292 return ECORE_CALLBACK_PASS_ON;
296 * Called when rotate event is recevied.
298 static Eina_Bool EcoreEventRotate(void* data, int type, void* event)
300 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
303 DALI_LOG_RELEASE_INFO("WindowBaseEcoreWl2::EcoreEventRotate\n");
304 windowBase->OnRotation(data, type, event);
306 return ECORE_CALLBACK_PASS_ON;
310 * Called when configure event is recevied.
312 static Eina_Bool EcoreEventConfigure(void* data, int type, void* event)
314 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
317 windowBase->OnConfiguration(data, type, event);
319 return ECORE_CALLBACK_PASS_ON;
322 /////////////////////////////////////////////////////////////////////////////////////////////////
324 /////////////////////////////////////////////////////////////////////////////////////////////////
327 * Called when a touch down is received.
329 static Eina_Bool EcoreEventMouseButtonDown(void* data, int type, void* event)
331 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
334 windowBase->OnMouseButtonDown(data, type, event);
336 return ECORE_CALLBACK_PASS_ON;
340 * Called when a touch up is received.
342 static Eina_Bool EcoreEventMouseButtonUp(void* data, int type, void* event)
344 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
347 windowBase->OnMouseButtonUp(data, type, event);
349 return ECORE_CALLBACK_PASS_ON;
353 * Called when a touch motion is received.
355 static Eina_Bool EcoreEventMouseButtonMove(void* data, int type, void* event)
357 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
360 windowBase->OnMouseButtonMove(data, type, event);
362 return ECORE_CALLBACK_PASS_ON;
366 * Called when a touch is canceled.
368 static Eina_Bool EcoreEventMouseButtonCancel(void* data, int type, void* event)
370 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
373 windowBase->OnMouseButtonCancel(data, type, event);
375 return ECORE_CALLBACK_PASS_ON;
379 * Called when a mouse wheel is received.
381 static Eina_Bool EcoreEventMouseWheel(void* data, int type, void* event)
383 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
386 windowBase->OnMouseWheel(data, type, event);
388 return ECORE_CALLBACK_PASS_ON;
392 * Called when a detent rotation event is recevied.
394 static Eina_Bool EcoreEventDetentRotation(void* data, int type, void* event)
396 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
399 windowBase->OnDetentRotation(data, type, event);
401 return ECORE_CALLBACK_PASS_ON;
404 /////////////////////////////////////////////////////////////////////////////////////////////////
406 /////////////////////////////////////////////////////////////////////////////////////////////////
409 * Called when a key down is received.
411 static Eina_Bool EcoreEventKeyDown(void* data, int type, void* event)
413 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
416 windowBase->OnKeyDown(data, type, event);
418 return ECORE_CALLBACK_PASS_ON;
422 * Called when a key up is received.
424 static Eina_Bool EcoreEventKeyUp(void* data, int type, void* event)
426 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
429 windowBase->OnKeyUp(data, type, event);
431 return ECORE_CALLBACK_PASS_ON;
434 /////////////////////////////////////////////////////////////////////////////////////////////////
435 // Selection Callbacks
436 /////////////////////////////////////////////////////////////////////////////////////////////////
439 * Called when the source window notifies us the content in clipboard is selected.
441 static Eina_Bool EcoreEventDataSend(void* data, int type, void* event)
443 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
446 windowBase->OnDataSend(data, type, event);
448 return ECORE_CALLBACK_PASS_ON;
452 * Called when the source window sends us about the selected content.
453 * For example, when item is selected in the clipboard.
455 static Eina_Bool EcoreEventDataReceive(void* data, int type, void* event)
457 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
460 windowBase->OnDataReceive(data, type, event);
462 return ECORE_CALLBACK_PASS_ON;
465 /////////////////////////////////////////////////////////////////////////////////////////////////
466 // Effect Start/End Callbacks
467 /////////////////////////////////////////////////////////////////////////////////////////////////
470 * Called when transition animation of the window's shown/hidden is started by window manager.
472 static Eina_Bool EcoreEventEffectStart(void* data, int type, void* event)
474 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
475 Ecore_Wl2_Event_Effect_Start* effectStart = static_cast<Ecore_Wl2_Event_Effect_Start*>(event);
476 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::EcoreEventEffectStart, effect type[ %d ]\n", effectStart->type);
479 if(effectStart->type < 3) // only under restack
481 windowBase->OnTransitionEffectEvent(WindowEffectState::START, static_cast<WindowEffectType>(effectStart->type));
484 return ECORE_CALLBACK_PASS_ON;
488 * Called when transition animation of the window's shown/hidden is ended by window manager.
490 static Eina_Bool EcoreEventEffectEnd(void* data, int type, void* event)
492 Ecore_Wl2_Event_Effect_Start* effectEnd = static_cast<Ecore_Wl2_Event_Effect_Start*>(event);
493 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
494 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::EcoreEventEffectEnd, effect type[ %d ]\n", effectEnd->type);
497 if(effectEnd->type < 3) // only under restack
499 windowBase->OnTransitionEffectEvent(WindowEffectState::END, static_cast<WindowEffectType>(effectEnd->type));
502 return ECORE_CALLBACK_PASS_ON;
505 /////////////////////////////////////////////////////////////////////////////////////////////////
506 // Keyboard Repeat Settings Changed Callbacks
507 /////////////////////////////////////////////////////////////////////////////////////////////////
509 static Eina_Bool EcoreEventSeatKeyboardRepeatChanged(void* data, int type, void* event)
511 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
512 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::EcoreEventSeatKeyboardRepeatChanged, id[ %d ]\n", static_cast<Ecore_Wl2_Event_Seat_Keyboard_Repeat_Changed*>(event)->id);
515 windowBase->OnKeyboardRepeatSettingsChanged();
518 return ECORE_CALLBACK_RENEW;
521 /////////////////////////////////////////////////////////////////////////////////////////////////
522 // Keymap Changed Callbacks
523 /////////////////////////////////////////////////////////////////////////////////////////////////
525 static Eina_Bool EcoreEventSeatKeymapChanged(void* data, int type, void* event)
527 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
530 windowBase->KeymapChanged(data, type, event);
533 return ECORE_CALLBACK_RENEW;
536 /////////////////////////////////////////////////////////////////////////////////////////////////
538 /////////////////////////////////////////////////////////////////////////////////////////////////
541 * Called when a font name is changed.
543 static void VconfNotifyFontNameChanged(keynode_t* node, void* data)
545 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
548 windowBase->OnFontNameChanged();
553 * Called when a font size is changed.
555 static void VconfNotifyFontSizeChanged(keynode_t* node, void* data)
557 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
560 windowBase->OnFontSizeChanged();
564 /////////////////////////////////////////////////////////////////////////////////////////////////
565 // Window Redraw Request Event Callbacks
566 /////////////////////////////////////////////////////////////////////////////////////////////////
568 static Eina_Bool EcoreEventWindowRedrawRequest(void* data, int type, void* event)
570 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
571 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::EcoreEventWindowRedrawRequest, window[ %d ]\n", static_cast<Ecore_Wl2_Event_Window_Redraw_Request*>(event)->win);
574 windowBase->OnEcoreEventWindowRedrawRequest();
577 return ECORE_CALLBACK_RENEW;
580 /////////////////////////////////////////////////////////////////////////////////////////////////
581 // Window Auxiliary Message Callbacks
582 /////////////////////////////////////////////////////////////////////////////////////////////////
583 static Eina_Bool EcoreEventWindowAuxiliaryMessage(void* data, int type, void* event)
585 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
588 windowBase->OnEcoreEventWindowAuxiliaryMessage(event);
590 return ECORE_CALLBACK_RENEW;
593 /////////////////////////////////////////////////////////////////////////////////////////////////
594 // ElDBus Accessibility Callbacks
595 /////////////////////////////////////////////////////////////////////////////////////////////////
597 #ifdef DALI_ELDBUS_AVAILABLE
598 // Callback for Ecore ElDBus accessibility events.
599 static void EcoreElDBusAccessibilityNotification(void* context, const Eldbus_Message* message)
601 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(context);
604 windowBase->OnEcoreElDBusAccessibilityNotification(context, message);
607 #endif // DALI_ELDBUS_AVAILABLE
609 static void RegistryGlobalCallback(void* data, struct wl_registry* registry, uint32_t name, const char* interface, uint32_t version)
611 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
614 windowBase->RegistryGlobalCallback(data, registry, name, interface, version);
618 static void RegistryGlobalCallbackRemove(void* data, struct wl_registry* registry, uint32_t id)
620 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
623 windowBase->RegistryGlobalCallbackRemove(data, registry, id);
627 static void TizenPolicyConformant(void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, uint32_t isConformant)
631 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)
635 static void TizenPolicyNotificationChangeDone(void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, int32_t level, uint32_t state)
637 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
640 windowBase->TizenPolicyNotificationChangeDone(data, tizenPolicy, surface, level, state);
644 static void TizenPolicyTransientForDone(void* data, struct tizen_policy* tizenPolicy, uint32_t childId)
648 static void TizenPolicyScreenModeChangeDone(void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, uint32_t mode, uint32_t state)
650 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
653 windowBase->TizenPolicyScreenModeChangeDone(data, tizenPolicy, surface, mode, state);
657 static void TizenPolicyIconifyStateChanged(void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, uint32_t iconified, uint32_t force)
661 static void TizenPolicySupportedAuxiliaryHints(void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, struct wl_array* hints, uint32_t numNints)
665 static void TizenPolicyAllowedAuxiliaryHint(void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, int id)
669 static void TizenPolicyAuxiliaryMessage(void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, const char* key, const char* val, struct wl_array* options)
673 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)
677 static void DisplayPolicyBrightnessChangeDone(void* data, struct tizen_display_policy* displayPolicy, struct wl_surface* surface, int32_t brightness, uint32_t state)
679 WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
682 windowBase->DisplayPolicyBrightnessChangeDone(data, displayPolicy, surface, brightness, state);
686 const struct wl_registry_listener registryListener =
688 RegistryGlobalCallback,
689 RegistryGlobalCallbackRemove};
691 const struct tizen_policy_listener tizenPolicyListener =
693 TizenPolicyConformant,
694 TizenPolicyConformantArea,
695 TizenPolicyNotificationChangeDone,
696 TizenPolicyTransientForDone,
697 TizenPolicyScreenModeChangeDone,
698 TizenPolicyIconifyStateChanged,
699 TizenPolicySupportedAuxiliaryHints,
700 TizenPolicyAllowedAuxiliaryHint,
701 TizenPolicyAuxiliaryMessage,
702 TizenPolicyConformantRegion};
704 const struct tizen_display_policy_listener tizenDisplayPolicyListener =
706 DisplayPolicyBrightnessChangeDone};
708 } // unnamed namespace
710 WindowBaseEcoreWl2::WindowBaseEcoreWl2(Dali::PositionSize positionSize, Any surface, bool isTransparent)
711 : mEcoreEventHandler(),
712 mEcoreWindow(nullptr),
714 mWlInputPanel(nullptr),
716 mWlInputPanelSurface(nullptr),
719 mEventQueue(nullptr),
720 mTizenPolicy(nullptr),
721 mTizenDisplayPolicy(nullptr),
723 mSupportedAuxiliaryHints(),
724 mWindowPositionSize(positionSize),
726 mType(WindowType::NORMAL),
727 mNotificationLevel(-1),
730 mWindowRotationAngle(0),
731 mScreenRotationAngle(0),
732 mSupportedPreProtation(0),
735 mNotificationChangeState(0),
736 mScreenOffModeChangeState(0),
737 mBrightnessChangeState(0),
738 mLastSubmittedMoveResizeSerial(0),
739 mMoveResizeSerial(0),
740 mNotificationLevelChangeDone(true),
741 mScreenOffModeChangeDone(true),
744 mBrightnessChangeDone(true)
745 #ifdef DALI_ELDBUS_AVAILABLE
747 mSystemConnection(NULL)
750 Initialize(positionSize, surface, isTransparent);
753 WindowBaseEcoreWl2::~WindowBaseEcoreWl2()
755 #ifdef DALI_ELDBUS_AVAILABLE
756 // Close down ElDBus connections.
757 if(mSystemConnection)
759 eldbus_connection_unref(mSystemConnection);
761 #endif // DALI_ELDBUS_AVAILABLE
763 vconf_ignore_key_changed(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, VconfNotifyFontSizeChanged);
764 vconf_ignore_key_changed(DALI_VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_NAME, VconfNotifyFontNameChanged);
766 for(Dali::Vector<Ecore_Event_Handler*>::Iterator iter = mEcoreEventHandler.Begin(), endIter = mEcoreEventHandler.End(); iter != endIter; ++iter)
768 ecore_event_handler_del(*iter);
770 mEcoreEventHandler.Clear();
774 wl_event_queue_destroy(mEventQueue);
777 mSupportedAuxiliaryHints.clear();
778 mAuxiliaryHints.clear();
780 if(mEglWindow != NULL)
782 wl_egl_window_destroy(mEglWindow);
788 ecore_wl2_window_free(mEcoreWindow);
790 WindowSystem::Shutdown();
794 void WindowBaseEcoreWl2::Initialize(PositionSize positionSize, Any surface, bool isTransparent)
796 if(surface.Empty() == false)
798 // check we have a valid type
799 DALI_ASSERT_ALWAYS((surface.GetType() == typeid(Ecore_Wl2_Window*)) && "Surface type is invalid");
801 mEcoreWindow = AnyCast<Ecore_Wl2_Window*>(surface);
805 // we own the surface about to created
806 WindowSystem::Initialize();
809 CreateWindow(positionSize);
812 mWlSurface = ecore_wl2_window_surface_get(mEcoreWindow);
814 SetTransparency(isTransparent);
816 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_WINDOW_ICONIFY_STATE_CHANGE, EcoreEventWindowIconifyStateChanged, this));
817 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_FOCUS_IN, EcoreEventWindowFocusIn, this));
818 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_FOCUS_OUT, EcoreEventWindowFocusOut, this));
819 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_OUTPUT_TRANSFORM, EcoreEventOutputTransform, this));
820 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_IGNORE_OUTPUT_TRANSFORM, EcoreEventIgnoreOutputTransform, this));
822 // Register Rotate event
823 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_WINDOW_ROTATE, EcoreEventRotate, this));
825 // Register Configure event
826 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_WINDOW_CONFIGURE, EcoreEventConfigure, this));
828 // Register Touch events
829 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_DOWN, EcoreEventMouseButtonDown, this));
830 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_UP, EcoreEventMouseButtonUp, this));
831 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_EVENT_MOUSE_MOVE, EcoreEventMouseButtonMove, this));
832 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_CANCEL, EcoreEventMouseButtonCancel, this));
834 // Register Mouse wheel events
835 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_EVENT_MOUSE_WHEEL, EcoreEventMouseWheel, this));
837 // Register Detent event
838 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_EVENT_DETENT_ROTATE, EcoreEventDetentRotation, this));
840 // Register Key events
841 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_EVENT_KEY_DOWN, EcoreEventKeyDown, this));
842 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_EVENT_KEY_UP, EcoreEventKeyUp, this));
844 // Register Selection event - clipboard selection
845 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_DATA_SOURCE_SEND, EcoreEventDataSend, this));
846 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_SELECTION_DATA_READY, EcoreEventDataReceive, this));
848 // Register Effect Start/End event
849 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_EFFECT_START, EcoreEventEffectStart, this));
850 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_EFFECT_END, EcoreEventEffectEnd, this));
852 // Register Keyboard repeat event
853 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_SEAT_KEYBOARD_REPEAT_CHANGED, EcoreEventSeatKeyboardRepeatChanged, this));
855 // Register Window redraw request event
856 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_WINDOW_REDRAW_REQUEST, EcoreEventWindowRedrawRequest, this));
858 // Register Window auxiliary event
859 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_AUX_MESSAGE, EcoreEventWindowAuxiliaryMessage, this));
861 // Register Vconf notify - font name and size
862 vconf_notify_key_changed(DALI_VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_NAME, VconfNotifyFontNameChanged, this);
863 vconf_notify_key_changed(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, VconfNotifyFontSizeChanged, this);
865 InitializeEcoreElDBus();
867 Ecore_Wl2_Display* display = ecore_wl2_connected_display_get(NULL);
868 mDisplay = ecore_wl2_display_get(display);
872 wl_display* displayWrapper = static_cast<wl_display*>(wl_proxy_create_wrapper(mDisplay));
875 mEventQueue = wl_display_create_queue(mDisplay);
878 wl_proxy_set_queue(reinterpret_cast<wl_proxy*>(displayWrapper), mEventQueue);
880 wl_registry* registry = wl_display_get_registry(displayWrapper);
881 wl_registry_add_listener(registry, ®istryListener, this);
884 wl_proxy_wrapper_destroy(displayWrapper);
888 Ecore_Wl2_Input* ecoreWlInput = ecore_wl2_input_default_input_get(display);
892 mKeyMap = ecore_wl2_input_keymap_get(ecoreWlInput);
894 mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_SEAT_KEYMAP_CHANGED, EcoreEventSeatKeymapChanged, this));
897 // get auxiliary hint
898 Eina_List* hints = ecore_wl2_window_aux_hints_supported_get(mEcoreWindow);
904 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))))
906 mSupportedAuxiliaryHints.push_back(hint);
908 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::Initialize: %s\n", hint);
913 Eina_Bool WindowBaseEcoreWl2::OnIconifyStateChanged(void* data, int type, void* event)
915 Ecore_Wl2_Event_Window_Iconify_State_Change* iconifyChangedEvent(static_cast<Ecore_Wl2_Event_Window_Iconify_State_Change*>(event));
916 Eina_Bool handled(ECORE_CALLBACK_PASS_ON);
918 if(iconifyChangedEvent->win == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
920 if(iconifyChangedEvent->iconified == EINA_TRUE)
922 mIconifyChangedSignal.Emit(true);
926 mIconifyChangedSignal.Emit(false);
928 handled = ECORE_CALLBACK_DONE;
934 Eina_Bool WindowBaseEcoreWl2::OnFocusIn(void* data, int type, void* event)
936 Ecore_Wl2_Event_Focus_In* focusInEvent(static_cast<Ecore_Wl2_Event_Focus_In*>(event));
938 if(focusInEvent->window == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
940 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "Window EcoreEventWindowFocusIn\n");
942 mFocusChangedSignal.Emit(true);
945 return ECORE_CALLBACK_PASS_ON;
948 Eina_Bool WindowBaseEcoreWl2::OnFocusOut(void* data, int type, void* event)
950 Ecore_Wl2_Event_Focus_Out* focusOutEvent(static_cast<Ecore_Wl2_Event_Focus_Out*>(event));
952 if(focusOutEvent->window == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
954 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "Window EcoreEventWindowFocusOut\n");
956 mFocusChangedSignal.Emit(false);
959 return ECORE_CALLBACK_PASS_ON;
962 Eina_Bool WindowBaseEcoreWl2::OnOutputTransform(void* data, int type, void* event)
964 Ecore_Wl2_Event_Output_Transform* transformEvent(static_cast<Ecore_Wl2_Event_Output_Transform*>(event));
966 if(transformEvent->output == ecore_wl2_window_output_find(mEcoreWindow))
968 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "Window (%p) EcoreEventOutputTransform\n", mEcoreWindow);
970 mScreenRotationAngle = GetScreenRotationAngle();
972 mOutputTransformedSignal.Emit();
975 return ECORE_CALLBACK_PASS_ON;
978 Eina_Bool WindowBaseEcoreWl2::OnIgnoreOutputTransform(void* data, int type, void* event)
980 Ecore_Wl2_Event_Ignore_Output_Transform* ignoreTransformEvent(static_cast<Ecore_Wl2_Event_Ignore_Output_Transform*>(event));
982 if(ignoreTransformEvent->win == mEcoreWindow)
984 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "Window (%p) EcoreEventIgnoreOutputTransform\n", mEcoreWindow);
986 mScreenRotationAngle = GetScreenRotationAngle();
988 mOutputTransformedSignal.Emit();
991 return ECORE_CALLBACK_PASS_ON;
994 void WindowBaseEcoreWl2::OnRotation(void* data, int type, void* event)
996 Ecore_Wl2_Event_Window_Rotation* ev(static_cast<Ecore_Wl2_Event_Window_Rotation*>(event));
998 if(ev->win == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
1000 DALI_LOG_RELEASE_INFO("WindowBaseEcoreWl2::OnRotation, angle: %d, width: %d, height: %d\n", ev->angle, ev->w, ev->h);
1002 RotationEvent rotationEvent;
1003 rotationEvent.angle = ev->angle;
1004 rotationEvent.winResize = 0;
1006 if(ev->w == 0 || ev->h == 0)
1008 // When rotation event does not have the window width or height,
1009 // previous DALi side window's size are used.
1010 ev->w = mWindowPositionSize.width;
1011 ev->h = mWindowPositionSize.height;
1014 mWindowRotationAngle = ev->angle;
1016 mWindowPositionSize.width = ev->w;
1017 mWindowPositionSize.height = ev->h;
1019 PositionSize newPositionSize = RecalculatePositionSizeToCurrentOrientation(mWindowPositionSize);
1021 rotationEvent.x = newPositionSize.x;
1022 rotationEvent.y = newPositionSize.y;
1023 rotationEvent.width = newPositionSize.width;
1024 rotationEvent.height = newPositionSize.height;
1026 mRotationSignal.Emit(rotationEvent);
1030 void WindowBaseEcoreWl2::OnConfiguration(void* data, int type, void* event)
1032 Ecore_Wl2_Event_Window_Configure* ev(static_cast<Ecore_Wl2_Event_Window_Configure*>(event));
1034 if(ev && ev->win == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
1036 // Note: To comply with the wayland protocol, Dali should make an ack_configure
1037 // by calling ecore_wl2_window_commit
1039 int tempWidth = static_cast<int>(ev->w);
1040 int tempHeight = static_cast<int>(ev->h);
1042 // Initialize with previous size for skip resize when new size is 0.
1043 // When window is just moved or window is resized by client application,
1044 // The configure notification event's size will be 0.
1045 // If new size is 0, the resized work should be skip.
1046 int newWidth = mWindowPositionSize.width;
1047 int newHeight = mWindowPositionSize.height;
1048 bool windowMoved = false, windowResized = false;
1050 if(ev->x != mWindowPositionSize.x || ev->y != mWindowPositionSize.y)
1055 if(tempWidth != 0 && tempHeight != 0 && (tempWidth != mWindowPositionSize.width || tempHeight != mWindowPositionSize.height))
1057 windowResized = true;
1058 newWidth = tempWidth;
1059 newHeight = tempHeight;
1062 if(windowMoved || windowResized)
1064 mWindowPositionSize.x = ev->x;
1065 mWindowPositionSize.y = ev->y;
1066 mWindowPositionSize.width = newWidth;
1067 mWindowPositionSize.height = newHeight;
1068 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);
1070 Dali::PositionSize newPositionSize = RecalculatePositionSizeToCurrentOrientation(mWindowPositionSize);
1071 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);
1072 mUpdatePositionSizeSignal.Emit(newPositionSize);
1075 ecore_wl2_window_commit(mEcoreWindow, EINA_FALSE);
1079 void WindowBaseEcoreWl2::OnMouseButtonDown(void* data, int type, void* event)
1081 Ecore_Event_Mouse_Button* touchEvent = static_cast<Ecore_Event_Mouse_Button*>(event);
1083 if(touchEvent->window == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
1085 Device::Class::Type deviceClass;
1086 Device::Subclass::Type deviceSubclass;
1088 GetDeviceClass(ecore_device_class_get(touchEvent->dev), deviceClass);
1089 GetDeviceSubclass(ecore_device_subclass_get(touchEvent->dev), deviceSubclass);
1091 PointState::Type state(PointState::DOWN);
1093 if(deviceClass != Device::Class::Type::MOUSE)
1095 // Check if the buttons field is set and ensure it's the primary touch button.
1096 // If this event was triggered by buttons other than the primary button (used for touch), then
1097 // just send an interrupted event to Core.
1098 if(touchEvent->buttons && (touchEvent->buttons != PRIMARY_TOUCH_BUTTON_ID))
1100 state = PointState::INTERRUPTED;
1104 Integration::Point point;
1105 point.SetDeviceId(touchEvent->multi.device);
1106 point.SetState(state);
1107 point.SetScreenPosition(Vector2(touchEvent->x, touchEvent->y));
1108 point.SetRadius(touchEvent->multi.radius, Vector2(touchEvent->multi.radius_x, touchEvent->multi.radius_y));
1109 point.SetPressure(touchEvent->multi.pressure);
1110 point.SetAngle(Degree(touchEvent->multi.angle));
1111 point.SetDeviceClass(deviceClass);
1112 point.SetDeviceSubclass(deviceSubclass);
1113 point.SetMouseButton(static_cast<MouseButton::Type>(touchEvent->buttons));
1115 mTouchEventSignal.Emit(point, touchEvent->timestamp);
1119 void WindowBaseEcoreWl2::OnMouseButtonUp(void* data, int type, void* event)
1121 Ecore_Event_Mouse_Button* touchEvent = static_cast<Ecore_Event_Mouse_Button*>(event);
1123 if(touchEvent->window == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
1125 Device::Class::Type deviceClass;
1126 Device::Subclass::Type deviceSubclass;
1128 GetDeviceClass(ecore_device_class_get(touchEvent->dev), deviceClass);
1129 GetDeviceSubclass(ecore_device_subclass_get(touchEvent->dev), deviceSubclass);
1131 Integration::Point point;
1132 point.SetDeviceId(touchEvent->multi.device);
1133 point.SetState(PointState::UP);
1134 point.SetScreenPosition(Vector2(touchEvent->x, touchEvent->y));
1135 point.SetRadius(touchEvent->multi.radius, Vector2(touchEvent->multi.radius_x, touchEvent->multi.radius_y));
1136 point.SetPressure(touchEvent->multi.pressure);
1137 point.SetAngle(Degree(touchEvent->multi.angle));
1138 point.SetDeviceClass(deviceClass);
1139 point.SetDeviceSubclass(deviceSubclass);
1140 point.SetMouseButton(static_cast<MouseButton::Type>(touchEvent->buttons));
1142 mTouchEventSignal.Emit(point, touchEvent->timestamp);
1146 void WindowBaseEcoreWl2::OnMouseButtonMove(void* data, int type, void* event)
1148 Ecore_Event_Mouse_Move* touchEvent = static_cast<Ecore_Event_Mouse_Move*>(event);
1150 if(touchEvent->window == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
1152 Device::Class::Type deviceClass;
1153 Device::Subclass::Type deviceSubclass;
1155 GetDeviceClass(ecore_device_class_get(touchEvent->dev), deviceClass);
1156 GetDeviceSubclass(ecore_device_subclass_get(touchEvent->dev), deviceSubclass);
1158 Integration::Point point;
1159 point.SetDeviceId(touchEvent->multi.device);
1160 point.SetState(PointState::MOTION);
1161 point.SetScreenPosition(Vector2(touchEvent->x, touchEvent->y));
1162 point.SetRadius(touchEvent->multi.radius, Vector2(touchEvent->multi.radius_x, touchEvent->multi.radius_y));
1163 point.SetPressure(touchEvent->multi.pressure);
1164 point.SetAngle(Degree(touchEvent->multi.angle));
1165 point.SetDeviceClass(deviceClass);
1166 point.SetDeviceSubclass(deviceSubclass);
1168 mTouchEventSignal.Emit(point, touchEvent->timestamp);
1172 void WindowBaseEcoreWl2::OnMouseButtonCancel(void* data, int type, void* event)
1174 Ecore_Event_Mouse_Button* touchEvent = static_cast<Ecore_Event_Mouse_Button*>(event);
1176 if(touchEvent->window == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
1178 Integration::Point point;
1179 point.SetDeviceId(touchEvent->multi.device);
1180 point.SetState(PointState::INTERRUPTED);
1181 point.SetScreenPosition(Vector2(0.0f, 0.0f));
1183 mTouchEventSignal.Emit(point, touchEvent->timestamp);
1185 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::OnMouseButtonCancel\n");
1189 void WindowBaseEcoreWl2::OnMouseWheel(void* data, int type, void* event)
1191 Ecore_Event_Mouse_Wheel* mouseWheelEvent = static_cast<Ecore_Event_Mouse_Wheel*>(event);
1193 if(mouseWheelEvent->window == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
1195 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);
1197 Integration::WheelEvent wheelEvent(Integration::WheelEvent::MOUSE_WHEEL, mouseWheelEvent->direction, mouseWheelEvent->modifiers, Vector2(mouseWheelEvent->x, mouseWheelEvent->y), mouseWheelEvent->z, mouseWheelEvent->timestamp);
1199 mWheelEventSignal.Emit(wheelEvent);
1203 void WindowBaseEcoreWl2::OnDetentRotation(void* data, int type, void* event)
1205 Ecore_Event_Detent_Rotate* detentEvent = static_cast<Ecore_Event_Detent_Rotate*>(event);
1207 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Concise, "WindowBaseEcoreWl2::OnDetentRotation\n");
1209 int32_t clockwise = (detentEvent->direction == ECORE_DETENT_DIRECTION_CLOCKWISE) ? 1 : -1;
1211 Integration::WheelEvent wheelEvent(Integration::WheelEvent::CUSTOM_WHEEL, detentEvent->direction, 0, Vector2(0.0f, 0.0f), clockwise, detentEvent->timestamp);
1213 mWheelEventSignal.Emit(wheelEvent);
1216 void WindowBaseEcoreWl2::OnKeyDown(void* data, int type, void* event)
1218 Ecore_Event_Key* keyEvent = static_cast<Ecore_Event_Key*>(event);
1220 if(keyEvent->window == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
1222 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::OnKeyDown\n");
1224 std::string keyName(keyEvent->keyname);
1225 std::string logicalKey("");
1226 std::string keyString("");
1227 std::string compose("");
1229 // Ensure key compose string is not NULL as keys like SHIFT or arrow have a null string.
1230 if(keyEvent->compose)
1232 compose = keyEvent->compose;
1235 // Ensure key symbol is not NULL as keys like SHIFT have a null string.
1238 logicalKey = keyEvent->key;
1242 GetKeyCode(keyName, keyCode); // Get key code dynamically.
1246 // Get a specific key code from dali key look up table.
1247 keyCode = KeyLookup::GetDaliKeyCode(keyEvent->keyname);
1250 keyCode = (keyCode == -1) ? 0 : keyCode;
1251 int modifier(keyEvent->modifiers);
1252 unsigned long time = keyEvent->timestamp;
1253 if(!strncmp(keyEvent->keyname, "Keycode-", 8))
1255 keyCode = atoi(keyEvent->keyname + 8);
1258 // Ensure key event string is not NULL as keys like SHIFT have a null string.
1259 if(keyEvent->string)
1261 keyString = keyEvent->string;
1264 std::string deviceName;
1265 Device::Class::Type deviceClass;
1266 Device::Subclass::Type deviceSubclass;
1268 GetDeviceName(keyEvent, deviceName);
1269 GetDeviceClass(ecore_device_class_get(keyEvent->dev), deviceClass);
1270 GetDeviceSubclass(ecore_device_subclass_get(keyEvent->dev), deviceSubclass);
1272 Integration::KeyEvent keyEvent(keyName, logicalKey, keyString, keyCode, modifier, time, Integration::KeyEvent::DOWN, compose, deviceName, deviceClass, deviceSubclass);
1274 mKeyEventSignal.Emit(keyEvent);
1278 void WindowBaseEcoreWl2::OnKeyUp(void* data, int type, void* event)
1280 Ecore_Event_Key* keyEvent = static_cast<Ecore_Event_Key*>(event);
1282 if(keyEvent->window == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
1284 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::OnKeyUp\n");
1286 #if defined(ECORE_VERSION_MAJOR) && (ECORE_VERSION_MAJOR >= 1) && defined(ECORE_VERSION_MINOR) && (ECORE_VERSION_MINOR >= 23)
1287 // Cancel processing flag is sent because this key event will combine with the previous key. So, the event should not actually perform anything.
1288 if(keyEvent->event_flags & ECORE_EVENT_FLAG_CANCEL)
1290 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::OnKeyUp: This event flag indicates the event is canceled. \n");
1293 #endif // Since ecore 1.23 version
1295 std::string keyName(keyEvent->keyname);
1296 std::string logicalKey("");
1297 std::string keyString("");
1298 std::string compose("");
1300 // Ensure key compose string is not NULL as keys like SHIFT or arrow have a null string.
1301 if(keyEvent->compose)
1303 compose = keyEvent->compose;
1306 // Ensure key symbol is not NULL as keys like SHIFT have a null string.
1309 logicalKey = keyEvent->key;
1313 GetKeyCode(keyName, keyCode); // Get key code dynamically.
1317 // Get a specific key code from dali key look up table.
1318 keyCode = KeyLookup::GetDaliKeyCode(keyEvent->keyname);
1321 keyCode = (keyCode == -1) ? 0 : keyCode;
1322 int modifier(keyEvent->modifiers);
1323 unsigned long time = keyEvent->timestamp;
1324 if(!strncmp(keyEvent->keyname, "Keycode-", 8))
1326 keyCode = atoi(keyEvent->keyname + 8);
1329 // Ensure key event string is not NULL as keys like SHIFT have a null string.
1330 if(keyEvent->string)
1332 keyString = keyEvent->string;
1335 std::string deviceName;
1336 Device::Class::Type deviceClass;
1337 Device::Subclass::Type deviceSubclass;
1339 GetDeviceName(keyEvent, deviceName);
1340 GetDeviceClass(ecore_device_class_get(keyEvent->dev), deviceClass);
1341 GetDeviceSubclass(ecore_device_subclass_get(keyEvent->dev), deviceSubclass);
1343 Integration::KeyEvent keyEvent(keyName, logicalKey, keyString, keyCode, modifier, time, Integration::KeyEvent::UP, compose, deviceName, deviceClass, deviceSubclass);
1345 mKeyEventSignal.Emit(keyEvent);
1349 void WindowBaseEcoreWl2::OnDataSend(void* data, int type, void* event)
1351 mSelectionDataSendSignal.Emit(event);
1354 void WindowBaseEcoreWl2::OnDataReceive(void* data, int type, void* event)
1356 mSelectionDataReceivedSignal.Emit(event);
1359 void WindowBaseEcoreWl2::OnFontNameChanged()
1361 mStyleChangedSignal.Emit(StyleChange::DEFAULT_FONT_CHANGE);
1364 void WindowBaseEcoreWl2::OnFontSizeChanged()
1366 mStyleChangedSignal.Emit(StyleChange::DEFAULT_FONT_SIZE_CHANGE);
1369 #ifdef DALI_ELDBUS_AVAILABLE
1370 void WindowBaseEcoreWl2::OnEcoreElDBusAccessibilityNotification(void* context, const Eldbus_Message* message)
1372 AccessibilityInfo info;
1374 // The string defines the arg-list's respective types.
1375 if(!eldbus_message_arguments_get(message, "iiiiiiu", &info.gestureValue, &info.startX, &info.startY, &info.endX, &info.endY, &info.state, &info.eventTime))
1377 DALI_LOG_ERROR("OnEcoreElDBusAccessibilityNotification: Error getting arguments\n");
1380 mAccessibilitySignal.Emit(info);
1382 #endif // DALI_ELDBUS_AVAILABLE
1384 void WindowBaseEcoreWl2::OnTransitionEffectEvent(WindowEffectState state, WindowEffectType type)
1386 mTransitionEffectEventSignal.Emit(state, type);
1389 void WindowBaseEcoreWl2::OnKeyboardRepeatSettingsChanged()
1391 mKeyboardRepeatSettingsChangedSignal.Emit();
1394 void WindowBaseEcoreWl2::OnEcoreEventWindowRedrawRequest()
1396 mWindowRedrawRequestSignal.Emit();
1399 void WindowBaseEcoreWl2::OnEcoreEventWindowAuxiliaryMessage(void* event)
1401 Ecore_Wl2_Event_Aux_Message* message = static_cast<Ecore_Wl2_Event_Aux_Message*>(event);
1404 DALI_LOG_RELEASE_INFO("WindowBaseEcoreWl2::OnEcoreEventWindowAuxiliaryMessage, key:%s, value:%s \n", message->key, message->val);
1405 std::string key(message->key);
1406 std::string value(message->val);
1407 Dali::Property::Array options;
1409 if(message->options)
1413 EINA_LIST_FOREACH(message->options, l, data)
1415 DALI_LOG_RELEASE_INFO("WindowBaseEcoreWl2::OnEcoreEventWindowAuxiliaryMessage, option: %s\n", (char*)data);
1416 std::string option(static_cast<char*>(data));
1417 options.Add(option);
1421 mAuxiliaryMessageSignal.Emit(key, value, options);
1425 void WindowBaseEcoreWl2::KeymapChanged(void* data, int type, void* event)
1427 Ecore_Wl2_Event_Seat_Keymap_Changed* changed = static_cast<Ecore_Wl2_Event_Seat_Keymap_Changed*>(event);
1428 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::KeymapChanged, keymap id[ %d ]\n", changed->id);
1429 Ecore_Wl2_Input* ecoreWlInput = ecore_wl2_input_default_input_get(changed->display);
1432 mKeyMap = ecore_wl2_input_keymap_get(ecoreWlInput);
1436 void WindowBaseEcoreWl2::RegistryGlobalCallback(void* data, struct wl_registry* registry, uint32_t name, const char* interface, uint32_t version)
1438 if(strcmp(interface, tizen_policy_interface.name) == 0)
1440 uint32_t clientVersion = std::min(version, MAX_TIZEN_CLIENT_VERSION);
1442 mTizenPolicy = static_cast<tizen_policy*>(wl_registry_bind(registry, name, &tizen_policy_interface, clientVersion));
1445 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::RegistryGlobalCallback: wl_registry_bind(tizen_policy_interface) is failed.\n");
1449 tizen_policy_add_listener(mTizenPolicy, &tizenPolicyListener, data);
1451 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::RegistryGlobalCallback: tizen_policy_add_listener is called.\n");
1453 else if(strcmp(interface, tizen_display_policy_interface.name) == 0)
1455 mTizenDisplayPolicy = static_cast<tizen_display_policy*>(wl_registry_bind(registry, name, &tizen_display_policy_interface, version));
1456 if(!mTizenDisplayPolicy)
1458 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::RegistryGlobalCallback: wl_registry_bind(tizen_display_policy_interface) is failed.\n");
1462 tizen_display_policy_add_listener(mTizenDisplayPolicy, &tizenDisplayPolicyListener, data);
1464 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::RegistryGlobalCallback: tizen_display_policy_add_listener is called.\n");
1468 void WindowBaseEcoreWl2::RegistryGlobalCallbackRemove(void* data, struct wl_registry* registry, uint32_t id)
1470 mTizenPolicy = NULL;
1471 mTizenDisplayPolicy = NULL;
1474 void WindowBaseEcoreWl2::TizenPolicyNotificationChangeDone(void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, int32_t level, uint32_t state)
1476 mNotificationLevel = level;
1477 mNotificationChangeState = state;
1478 mNotificationLevelChangeDone = true;
1480 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::TizenPolicyNotificationChangeDone: level = %d, state = %d\n", level, state);
1483 void WindowBaseEcoreWl2::TizenPolicyScreenModeChangeDone(void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, uint32_t mode, uint32_t state)
1485 mScreenOffMode = mode;
1486 mScreenOffModeChangeState = state;
1487 mScreenOffModeChangeDone = true;
1489 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::TizenPolicyScreenModeChangeDone: mode = %d, state = %d\n", mode, state);
1492 void WindowBaseEcoreWl2::DisplayPolicyBrightnessChangeDone(void* data, struct tizen_display_policy* displayPolicy, struct wl_surface* surface, int32_t brightness, uint32_t state)
1494 mBrightness = brightness;
1495 mBrightnessChangeState = state;
1496 mBrightnessChangeDone = true;
1498 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::DisplayPolicyBrightnessChangeDone: brightness = %d, state = %d\n", brightness, state);
1501 void WindowBaseEcoreWl2::GetKeyCode(std::string keyName, int32_t& keyCode)
1503 xkb_keysym_t sym = XKB_KEY_NoSymbol;
1504 KeyCodeMap foundKeyCode;
1506 sym = xkb_keysym_from_name(keyName.c_str(), XKB_KEYSYM_NO_FLAGS);
1507 if(sym == XKB_KEY_NoSymbol)
1509 DALI_LOG_ERROR("Failed to get keysym in WindowBaseEcoreWl2\n");
1513 foundKeyCode.keySym = sym;
1514 foundKeyCode.isKeyCode = false;
1515 xkb_keymap_key_for_each(mKeyMap, FindKeyCode, &foundKeyCode);
1516 keyCode = static_cast<int32_t>(foundKeyCode.keyCode);
1519 Any WindowBaseEcoreWl2::GetNativeWindow()
1521 return mEcoreWindow;
1524 int WindowBaseEcoreWl2::GetNativeWindowId()
1526 return ecore_wl2_window_id_get(mEcoreWindow);
1529 std::string WindowBaseEcoreWl2::GetNativeWindowResourceId()
1531 #ifdef OVER_TIZEN_VERSION_7
1532 return std::to_string(ecore_wl2_window_resource_id_get(mEcoreWindow));
1534 return std::string();
1538 EGLNativeWindowType WindowBaseEcoreWl2::CreateEglWindow(int width, int height)
1540 int totalAngle = (mWindowRotationAngle + mScreenRotationAngle) % 360;
1541 if(totalAngle == 90 || totalAngle == 270)
1543 mEglWindow = wl_egl_window_create(mWlSurface, height, width);
1547 mEglWindow = wl_egl_window_create(mWlSurface, width, height);
1550 return static_cast<EGLNativeWindowType>(mEglWindow);
1553 void WindowBaseEcoreWl2::DestroyEglWindow()
1555 if(mEglWindow != NULL)
1557 wl_egl_window_destroy(mEglWindow);
1562 void WindowBaseEcoreWl2::SetEglWindowRotation(int angle)
1564 wl_egl_window_tizen_rotation rotation;
1570 rotation = WL_EGL_WINDOW_TIZEN_ROTATION_0;
1575 rotation = WL_EGL_WINDOW_TIZEN_ROTATION_270;
1580 rotation = WL_EGL_WINDOW_TIZEN_ROTATION_180;
1585 rotation = WL_EGL_WINDOW_TIZEN_ROTATION_90;
1590 rotation = WL_EGL_WINDOW_TIZEN_ROTATION_0;
1595 wl_egl_window_tizen_set_rotation(mEglWindow, rotation);
1598 void WindowBaseEcoreWl2::SetEglWindowBufferTransform(int angle)
1600 wl_output_transform bufferTransform;
1606 bufferTransform = WL_OUTPUT_TRANSFORM_NORMAL;
1611 bufferTransform = WL_OUTPUT_TRANSFORM_90;
1616 bufferTransform = WL_OUTPUT_TRANSFORM_180;
1621 bufferTransform = WL_OUTPUT_TRANSFORM_270;
1626 bufferTransform = WL_OUTPUT_TRANSFORM_NORMAL;
1631 wl_egl_window_tizen_set_buffer_transform(mEglWindow, bufferTransform);
1634 void WindowBaseEcoreWl2::SetEglWindowTransform(int angle)
1636 wl_output_transform windowTransform;
1642 windowTransform = WL_OUTPUT_TRANSFORM_NORMAL;
1647 windowTransform = WL_OUTPUT_TRANSFORM_90;
1652 windowTransform = WL_OUTPUT_TRANSFORM_180;
1657 windowTransform = WL_OUTPUT_TRANSFORM_270;
1662 windowTransform = WL_OUTPUT_TRANSFORM_NORMAL;
1667 wl_egl_window_tizen_set_window_transform(mEglWindow, windowTransform);
1670 void WindowBaseEcoreWl2::ResizeEglWindow(PositionSize positionSize)
1672 wl_egl_window_resize(mEglWindow, positionSize.width, positionSize.height, positionSize.x, positionSize.y);
1674 // Note: Both "Resize" and "MoveResize" cases can reach here, but only "MoveResize" needs to submit serial number
1675 if(mMoveResizeSerial != mLastSubmittedMoveResizeSerial)
1677 wl_egl_window_tizen_set_window_serial(mEglWindow, mMoveResizeSerial);
1678 mLastSubmittedMoveResizeSerial = mMoveResizeSerial;
1682 bool WindowBaseEcoreWl2::IsEglWindowRotationSupported()
1685 wl_egl_window_tizen_capability capability = static_cast<wl_egl_window_tizen_capability>(wl_egl_window_tizen_get_capabilities(mEglWindow));
1686 if(capability == WL_EGL_WINDOW_TIZEN_CAPABILITY_ROTATION_SUPPORTED)
1688 mSupportedPreProtation = true;
1691 mSupportedPreProtation = false;
1695 PositionSize WindowBaseEcoreWl2::RecalculatePositionSizeToSystem(PositionSize positionSize)
1697 PositionSize newPositionSize;
1699 if(mWindowRotationAngle == 90)
1701 newPositionSize.x = positionSize.y;
1702 newPositionSize.y = mScreenHeight - (positionSize.x + positionSize.width);
1703 newPositionSize.width = positionSize.height;
1704 newPositionSize.height = positionSize.width;
1706 else if(mWindowRotationAngle == 180)
1708 newPositionSize.x = mScreenWidth - (positionSize.x + positionSize.width);
1709 newPositionSize.y = mScreenHeight - (positionSize.y + positionSize.height);
1710 newPositionSize.width = positionSize.width;
1711 newPositionSize.height = positionSize.height;
1713 else if(mWindowRotationAngle == 270)
1715 newPositionSize.x = mScreenWidth - (positionSize.y + positionSize.height);
1716 newPositionSize.y = positionSize.x;
1717 newPositionSize.width = positionSize.height;
1718 newPositionSize.height = positionSize.width;
1722 newPositionSize.x = positionSize.x;
1723 newPositionSize.y = positionSize.y;
1724 newPositionSize.width = positionSize.width;
1725 newPositionSize.height = positionSize.height;
1728 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);
1729 DALI_LOG_RELEASE_INFO("recalc coord x[%d], y[%d], w{%d], h[%d]\n", newPositionSize.x, newPositionSize.y, newPositionSize.width, newPositionSize.height);
1731 return newPositionSize;
1734 PositionSize WindowBaseEcoreWl2::RecalculatePositionSizeToCurrentOrientation(PositionSize positionSize)
1736 PositionSize newPositionSize;
1738 if(mWindowRotationAngle == 90)
1740 newPositionSize.x = mScreenHeight - (positionSize.y + positionSize.height);
1741 newPositionSize.y = positionSize.x;
1742 newPositionSize.width = positionSize.height;
1743 newPositionSize.height = positionSize.width;
1745 else if(mWindowRotationAngle == 180)
1747 newPositionSize.x = mScreenWidth - (positionSize.x + positionSize.width);
1748 newPositionSize.y = mScreenHeight - (positionSize.y + positionSize.height);
1749 newPositionSize.width = positionSize.width;
1750 newPositionSize.height = positionSize.height;
1752 else if(mWindowRotationAngle == 270)
1754 newPositionSize.x = positionSize.y;
1755 newPositionSize.y = mScreenWidth - (positionSize.x + positionSize.width);
1756 newPositionSize.width = positionSize.height;
1757 newPositionSize.height = positionSize.width;
1761 newPositionSize.x = positionSize.x;
1762 newPositionSize.y = positionSize.y;
1763 newPositionSize.width = positionSize.width;
1764 newPositionSize.height = positionSize.height;
1767 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);
1768 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);
1770 return newPositionSize;
1773 void WindowBaseEcoreWl2::Move(PositionSize positionSize)
1775 PositionSize newPositionSize = RecalculatePositionSizeToSystem(positionSize);
1777 mWindowPositionSize = newPositionSize;
1778 DALI_LOG_RELEASE_INFO("ecore_wl2_window_position_set x[%d], y[%d]\n", newPositionSize.x, newPositionSize.y);
1779 ecore_wl2_window_position_set(mEcoreWindow, newPositionSize.x, newPositionSize.y);
1782 void WindowBaseEcoreWl2::Resize(PositionSize positionSize)
1784 PositionSize newPositionSize = RecalculatePositionSizeToSystem(positionSize);
1786 mWindowPositionSize = newPositionSize;
1787 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);
1788 ecore_wl2_window_sync_geometry_set(mEcoreWindow, ++mMoveResizeSerial, newPositionSize.x, newPositionSize.y, newPositionSize.width, newPositionSize.height);
1791 void WindowBaseEcoreWl2::MoveResize(PositionSize positionSize)
1793 PositionSize newPositionSize = RecalculatePositionSizeToSystem(positionSize);
1795 mWindowPositionSize = newPositionSize;
1796 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);
1797 ecore_wl2_window_sync_geometry_set(mEcoreWindow, ++mMoveResizeSerial, newPositionSize.x, newPositionSize.y, newPositionSize.width, newPositionSize.height);
1800 void WindowBaseEcoreWl2::SetClass(const std::string& name, const std::string& className)
1802 ecore_wl2_window_title_set(mEcoreWindow, name.c_str());
1803 ecore_wl2_window_class_set(mEcoreWindow, className.c_str());
1806 void WindowBaseEcoreWl2::Raise()
1808 // Use ecore_wl2_window_activate to prevent the window shown without rendering
1809 ecore_wl2_window_activate(mEcoreWindow);
1812 void WindowBaseEcoreWl2::Lower()
1814 ecore_wl2_window_lower(mEcoreWindow);
1817 void WindowBaseEcoreWl2::Activate()
1819 ecore_wl2_window_activate(mEcoreWindow);
1822 void WindowBaseEcoreWl2::Maximize(bool maximize)
1824 ecore_wl2_window_maximized_set(mEcoreWindow, maximize);
1827 bool WindowBaseEcoreWl2::IsMaximized() const
1829 return ecore_wl2_window_maximized_get(mEcoreWindow);
1832 void WindowBaseEcoreWl2::Minimize(bool minimize)
1834 ecore_wl2_window_iconified_set(mEcoreWindow, minimize);
1837 bool WindowBaseEcoreWl2::IsMinimized() const
1839 return ecore_wl2_window_iconified_get(mEcoreWindow);
1842 void WindowBaseEcoreWl2::SetAvailableAnlges(const std::vector<int>& angles)
1844 int rotations[4] = {0};
1845 DALI_LOG_RELEASE_INFO("WindowBaseEcoreWl2::SetAvailableAnlges, angle's count: %d, angles\n", angles.size());
1846 for(std::size_t i = 0; i < angles.size(); ++i)
1848 rotations[i] = static_cast<int>(angles[i]);
1849 DALI_LOG_RELEASE_INFO("%d ", rotations[i]);
1851 ecore_wl2_window_available_rotations_set(mEcoreWindow, rotations, angles.size());
1854 void WindowBaseEcoreWl2::SetPreferredAngle(int angle)
1856 DALI_LOG_RELEASE_INFO("WindowBaseEcoreWl2::SetPreferredAngle, angle: %d\n", angle);
1857 ecore_wl2_window_preferred_rotation_set(mEcoreWindow, angle);
1860 void WindowBaseEcoreWl2::SetAcceptFocus(bool accept)
1862 ecore_wl2_window_focus_skip_set(mEcoreWindow, !accept);
1865 void WindowBaseEcoreWl2::Show()
1869 ecore_wl2_window_geometry_set(mEcoreWindow, mWindowPositionSize.x, mWindowPositionSize.y, mWindowPositionSize.width, mWindowPositionSize.height);
1873 ecore_wl2_window_show(mEcoreWindow);
1876 void WindowBaseEcoreWl2::Hide()
1879 ecore_wl2_window_hide(mEcoreWindow);
1882 unsigned int WindowBaseEcoreWl2::GetSupportedAuxiliaryHintCount() const
1884 return mSupportedAuxiliaryHints.size();
1887 std::string WindowBaseEcoreWl2::GetSupportedAuxiliaryHint(unsigned int index) const
1889 if(index >= GetSupportedAuxiliaryHintCount())
1891 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetSupportedAuxiliaryHint: Invalid index! [%d]\n", index);
1894 return mSupportedAuxiliaryHints[index];
1897 unsigned int WindowBaseEcoreWl2::AddAuxiliaryHint(const std::string& hint, const std::string& value)
1899 bool supported = false;
1901 // Check if the hint is suppported
1902 for(std::vector<std::string>::iterator iter = mSupportedAuxiliaryHints.begin(); iter != mSupportedAuxiliaryHints.end(); ++iter)
1913 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Concise, "WindowBaseEcoreWl2::AddAuxiliaryHint: Not supported auxiliary hint [%s]\n", hint.c_str());
1917 // Check if the hint is already added
1918 for(unsigned int i = 0; i < mAuxiliaryHints.size(); i++)
1920 if(mAuxiliaryHints[i].first == hint)
1922 // Just change the value
1923 mAuxiliaryHints[i].second = value;
1925 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::AddAuxiliaryHint: Change! hint = %s, value = %s, id = %d\n", hint.c_str(), value.c_str(), i + 1);
1927 return i + 1; // id is index + 1
1932 mAuxiliaryHints.push_back(std::pair<std::string, std::string>(hint, value));
1934 unsigned int id = mAuxiliaryHints.size();
1936 ecore_wl2_window_aux_hint_add(mEcoreWindow, static_cast<int>(id), hint.c_str(), value.c_str());
1938 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::AddAuxiliaryHint: hint = %s, value = %s, id = %d\n", hint.c_str(), value.c_str(), id);
1943 bool WindowBaseEcoreWl2::RemoveAuxiliaryHint(unsigned int id)
1945 if(id == 0 || id > mAuxiliaryHints.size())
1947 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Concise, "WindowBaseEcoreWl2::RemoveAuxiliaryHint: Invalid id [%d]\n", id);
1951 mAuxiliaryHints[id - 1].second = std::string();
1953 ecore_wl2_window_aux_hint_del(mEcoreWindow, static_cast<int>(id));
1955 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::RemoveAuxiliaryHint: id = %d, hint = %s\n", id, mAuxiliaryHints[id - 1].first.c_str());
1960 bool WindowBaseEcoreWl2::SetAuxiliaryHintValue(unsigned int id, const std::string& value)
1962 if(id == 0 || id > mAuxiliaryHints.size())
1964 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Concise, "WindowBaseEcoreWl2::SetAuxiliaryHintValue: Invalid id [%d]\n", id);
1968 mAuxiliaryHints[id - 1].second = value;
1970 ecore_wl2_window_aux_hint_change(mEcoreWindow, static_cast<int>(id), value.c_str());
1972 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());
1977 std::string WindowBaseEcoreWl2::GetAuxiliaryHintValue(unsigned int id) const
1979 if(id == 0 || id > mAuxiliaryHints.size())
1981 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Concise, "WindowBaseEcoreWl2::GetAuxiliaryHintValue: Invalid id [%d]\n", id);
1982 return std::string();
1985 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());
1987 return mAuxiliaryHints[id - 1].second;
1990 unsigned int WindowBaseEcoreWl2::GetAuxiliaryHintId(const std::string& hint) const
1992 for(unsigned int i = 0; i < mAuxiliaryHints.size(); i++)
1994 if(mAuxiliaryHints[i].first == hint)
1996 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetAuxiliaryHintId: hint = %s, id = %d\n", hint.c_str(), i + 1);
2001 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetAuxiliaryHintId: Invalid hint! [%s]\n", hint.c_str());
2006 void WindowBaseEcoreWl2::SetInputRegion(const Rect<int>& inputRegion)
2008 ecore_wl2_window_input_region_set(mEcoreWindow, inputRegion.x, inputRegion.y, inputRegion.width, inputRegion.height);
2011 void WindowBaseEcoreWl2::SetType(Dali::WindowType type)
2016 Ecore_Wl2_Window_Type windowType;
2020 case Dali::WindowType::NORMAL:
2022 windowType = ECORE_WL2_WINDOW_TYPE_TOPLEVEL;
2025 case Dali::WindowType::NOTIFICATION:
2027 windowType = ECORE_WL2_WINDOW_TYPE_NOTIFICATION;
2030 case Dali::WindowType::UTILITY:
2032 windowType = ECORE_WL2_WINDOW_TYPE_UTILITY;
2035 case Dali::WindowType::DIALOG:
2037 windowType = ECORE_WL2_WINDOW_TYPE_DIALOG;
2040 case Dali::WindowType::IME:
2042 windowType = ECORE_WL2_WINDOW_TYPE_NONE;
2047 windowType = ECORE_WL2_WINDOW_TYPE_TOPLEVEL;
2051 ecore_wl2_window_type_set(mEcoreWindow, windowType);
2055 Dali::WindowType WindowBaseEcoreWl2::GetType() const
2060 Dali::WindowOperationResult WindowBaseEcoreWl2::SetNotificationLevel(Dali::WindowNotificationLevel level)
2062 while(!mTizenPolicy)
2064 wl_display_dispatch_queue(mDisplay, mEventQueue);
2067 int notificationLevel;
2071 case Dali::WindowNotificationLevel::NONE:
2073 notificationLevel = TIZEN_POLICY_LEVEL_NONE;
2076 case Dali::WindowNotificationLevel::BASE:
2078 notificationLevel = TIZEN_POLICY_LEVEL_DEFAULT;
2081 case Dali::WindowNotificationLevel::MEDIUM:
2083 notificationLevel = TIZEN_POLICY_LEVEL_MEDIUM;
2086 case Dali::WindowNotificationLevel::HIGH:
2088 notificationLevel = TIZEN_POLICY_LEVEL_HIGH;
2091 case Dali::WindowNotificationLevel::TOP:
2093 notificationLevel = TIZEN_POLICY_LEVEL_TOP;
2098 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetNotificationLevel: invalid level [%d]\n", level);
2099 notificationLevel = TIZEN_POLICY_LEVEL_DEFAULT;
2104 mNotificationLevelChangeDone = false;
2105 mNotificationChangeState = TIZEN_POLICY_ERROR_STATE_NONE;
2107 tizen_policy_set_notification_level(mTizenPolicy, ecore_wl2_window_surface_get(mEcoreWindow), notificationLevel);
2111 while(!mNotificationLevelChangeDone && count < 3)
2113 ecore_wl2_display_flush(ecore_wl2_connected_display_get(NULL));
2114 wl_display_dispatch_queue(mDisplay, mEventQueue);
2118 if(!mNotificationLevelChangeDone)
2120 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetNotificationLevel: Level change is failed [%d, %d]\n", level, mNotificationChangeState);
2121 return Dali::WindowOperationResult::UNKNOWN_ERROR;
2123 else if(mNotificationChangeState == TIZEN_POLICY_ERROR_STATE_PERMISSION_DENIED)
2125 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetNotificationLevel: Permission denied! [%d]\n", level);
2126 return Dali::WindowOperationResult::PERMISSION_DENIED;
2129 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetNotificationLevel: Level is changed [%d]\n", mNotificationLevel);
2131 return Dali::WindowOperationResult::SUCCEED;
2134 Dali::WindowNotificationLevel WindowBaseEcoreWl2::GetNotificationLevel() const
2136 while(!mTizenPolicy)
2138 wl_display_dispatch_queue(mDisplay, mEventQueue);
2143 while(!mNotificationLevelChangeDone && count < 3)
2145 ecore_wl2_display_flush(ecore_wl2_connected_display_get(NULL));
2146 wl_display_dispatch_queue(mDisplay, mEventQueue);
2150 if(!mNotificationLevelChangeDone)
2152 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetNotificationLevel: Error! [%d]\n", mNotificationChangeState);
2153 return Dali::WindowNotificationLevel::NONE;
2156 Dali::WindowNotificationLevel level;
2158 switch(mNotificationLevel)
2160 case TIZEN_POLICY_LEVEL_NONE:
2162 level = Dali::WindowNotificationLevel::NONE;
2165 case TIZEN_POLICY_LEVEL_DEFAULT:
2167 level = Dali::WindowNotificationLevel::BASE;
2170 case TIZEN_POLICY_LEVEL_MEDIUM:
2172 level = Dali::WindowNotificationLevel::MEDIUM;
2175 case TIZEN_POLICY_LEVEL_HIGH:
2177 level = Dali::WindowNotificationLevel::HIGH;
2180 case TIZEN_POLICY_LEVEL_TOP:
2182 level = Dali::WindowNotificationLevel::TOP;
2187 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetNotificationLevel: invalid level [%d]\n", mNotificationLevel);
2188 level = Dali::WindowNotificationLevel::NONE;
2193 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetNotificationLevel: level [%d]\n", mNotificationLevel);
2198 void WindowBaseEcoreWl2::SetOpaqueState(bool opaque)
2200 while(!mTizenPolicy)
2202 wl_display_dispatch_queue(mDisplay, mEventQueue);
2205 tizen_policy_set_opaque_state(mTizenPolicy, ecore_wl2_window_surface_get(mEcoreWindow), (opaque ? 1 : 0));
2208 Dali::WindowOperationResult WindowBaseEcoreWl2::SetScreenOffMode(WindowScreenOffMode screenOffMode)
2210 while(!mTizenPolicy)
2212 wl_display_dispatch_queue(mDisplay, mEventQueue);
2215 mScreenOffModeChangeDone = false;
2216 mScreenOffModeChangeState = TIZEN_POLICY_ERROR_STATE_NONE;
2218 unsigned int mode = 0;
2220 switch(screenOffMode)
2222 case WindowScreenOffMode::TIMEOUT:
2227 case WindowScreenOffMode::NEVER:
2234 tizen_policy_set_window_screen_mode(mTizenPolicy, ecore_wl2_window_surface_get(mEcoreWindow), mode);
2238 while(!mScreenOffModeChangeDone && count < 3)
2240 ecore_wl2_display_flush(ecore_wl2_connected_display_get(NULL));
2241 wl_display_dispatch_queue(mDisplay, mEventQueue);
2245 if(!mScreenOffModeChangeDone)
2247 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetScreenOffMode: Screen mode change is failed [%d, %d]\n", screenOffMode, mScreenOffModeChangeState);
2248 return Dali::WindowOperationResult::UNKNOWN_ERROR;
2250 else if(mScreenOffModeChangeState == TIZEN_POLICY_ERROR_STATE_PERMISSION_DENIED)
2252 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetScreenOffMode: Permission denied! [%d]\n", screenOffMode);
2253 return Dali::WindowOperationResult::PERMISSION_DENIED;
2256 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetScreenOffMode: Screen mode is changed [%d]\n", mScreenOffMode);
2258 return Dali::WindowOperationResult::SUCCEED;
2261 WindowScreenOffMode WindowBaseEcoreWl2::GetScreenOffMode() const
2263 while(!mTizenPolicy)
2265 wl_display_dispatch_queue(mDisplay, mEventQueue);
2270 while(!mScreenOffModeChangeDone && count < 3)
2272 ecore_wl2_display_flush(ecore_wl2_connected_display_get(NULL));
2273 wl_display_dispatch_queue(mDisplay, mEventQueue);
2277 if(!mScreenOffModeChangeDone)
2279 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetScreenOffMode: Error! [%d]\n", mScreenOffModeChangeState);
2280 return WindowScreenOffMode::TIMEOUT;
2283 WindowScreenOffMode screenMode = WindowScreenOffMode::TIMEOUT;
2285 switch(mScreenOffMode)
2289 screenMode = WindowScreenOffMode::TIMEOUT;
2294 screenMode = WindowScreenOffMode::NEVER;
2299 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetScreenOffMode: screen mode [%d]\n", mScreenOffMode);
2304 Dali::WindowOperationResult WindowBaseEcoreWl2::SetBrightness(int brightness)
2306 while(!mTizenDisplayPolicy)
2308 wl_display_dispatch_queue(mDisplay, mEventQueue);
2311 mBrightnessChangeDone = false;
2312 mBrightnessChangeState = TIZEN_POLICY_ERROR_STATE_NONE;
2314 tizen_display_policy_set_window_brightness(mTizenDisplayPolicy, ecore_wl2_window_surface_get(mEcoreWindow), brightness);
2318 while(!mBrightnessChangeDone && count < 3)
2320 ecore_wl2_display_flush(ecore_wl2_connected_display_get(NULL));
2321 wl_display_dispatch_queue(mDisplay, mEventQueue);
2325 if(!mBrightnessChangeDone)
2327 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetBrightness: Brightness change is failed [%d, %d]\n", brightness, mBrightnessChangeState);
2328 return Dali::WindowOperationResult::UNKNOWN_ERROR;
2330 else if(mBrightnessChangeState == TIZEN_POLICY_ERROR_STATE_PERMISSION_DENIED)
2332 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetBrightness: Permission denied! [%d]\n", brightness);
2333 return Dali::WindowOperationResult::PERMISSION_DENIED;
2336 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetBrightness: Brightness is changed [%d]\n", mBrightness);
2338 return Dali::WindowOperationResult::SUCCEED;
2341 int WindowBaseEcoreWl2::GetBrightness() const
2343 while(!mTizenDisplayPolicy)
2345 wl_display_dispatch_queue(mDisplay, mEventQueue);
2350 while(!mBrightnessChangeDone && count < 3)
2352 ecore_wl2_display_flush(ecore_wl2_connected_display_get(NULL));
2353 wl_display_dispatch_queue(mDisplay, mEventQueue);
2357 if(!mBrightnessChangeDone)
2359 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetBrightness: Error! [%d]\n", mBrightnessChangeState);
2363 DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetBrightness: Brightness [%d]\n", mBrightness);
2368 bool WindowBaseEcoreWl2::GrabKey(Dali::KEY key, KeyGrab::KeyGrabMode grabMode)
2370 Ecore_Wl2_Window_Keygrab_Mode mode;
2374 case KeyGrab::TOPMOST:
2376 mode = ECORE_WL2_WINDOW_KEYGRAB_TOPMOST;
2379 case KeyGrab::SHARED:
2381 mode = ECORE_WL2_WINDOW_KEYGRAB_SHARED;
2384 case KeyGrab::OVERRIDE_EXCLUSIVE:
2386 mode = ECORE_WL2_WINDOW_KEYGRAB_OVERRIDE_EXCLUSIVE;
2389 case KeyGrab::EXCLUSIVE:
2391 mode = ECORE_WL2_WINDOW_KEYGRAB_EXCLUSIVE;
2400 return ecore_wl2_window_keygrab_set(mEcoreWindow, KeyLookup::GetKeyName(key), 0, 0, 0, mode);
2403 bool WindowBaseEcoreWl2::UngrabKey(Dali::KEY key)
2405 return ecore_wl2_window_keygrab_unset(mEcoreWindow, KeyLookup::GetKeyName(key), 0, 0);
2408 bool WindowBaseEcoreWl2::GrabKeyList(const Dali::Vector<Dali::KEY>& key, const Dali::Vector<KeyGrab::KeyGrabMode>& grabMode, Dali::Vector<bool>& result)
2410 int keyCount = key.Count();
2411 int keyGrabModeCount = grabMode.Count();
2413 if(keyCount != keyGrabModeCount || keyCount == 0)
2420 Eina_List* keyList = NULL;
2421 Ecore_Wl2_Window_Keygrab_Info* info = new Ecore_Wl2_Window_Keygrab_Info[keyCount];
2423 for(int index = 0; index < keyCount; ++index)
2425 info[index].key = const_cast<char*>(KeyLookup::GetKeyName(key[index]));
2427 switch(grabMode[index])
2429 case KeyGrab::TOPMOST:
2431 info[index].mode = ECORE_WL2_WINDOW_KEYGRAB_TOPMOST;
2434 case KeyGrab::SHARED:
2436 info[index].mode = ECORE_WL2_WINDOW_KEYGRAB_SHARED;
2439 case KeyGrab::OVERRIDE_EXCLUSIVE:
2441 info[index].mode = ECORE_WL2_WINDOW_KEYGRAB_OVERRIDE_EXCLUSIVE;
2444 case KeyGrab::EXCLUSIVE:
2446 info[index].mode = ECORE_WL2_WINDOW_KEYGRAB_EXCLUSIVE;
2451 info[index].mode = ECORE_WL2_WINDOW_KEYGRAB_UNKNOWN;
2456 keyList = eina_list_append(keyList, &info);
2459 Eina_List* grabList = ecore_wl2_window_keygrab_list_set(mEcoreWindow, keyList);
2461 result.Resize(keyCount, true);
2463 Eina_List* l = NULL;
2464 Eina_List* m = NULL;
2465 void* listData = NULL;
2467 if(grabList != NULL)
2469 EINA_LIST_FOREACH(grabList, m, data)
2472 EINA_LIST_FOREACH(keyList, l, listData)
2474 if(static_cast<Ecore_Wl2_Window_Keygrab_Info*>(listData)->key == NULL)
2476 DALI_LOG_ERROR("input key list has null data!");
2480 if(strcmp(static_cast<char*>(data), static_cast<Ecore_Wl2_Window_Keygrab_Info*>(listData)->key) == 0)
2482 result[index] = false;
2491 eina_list_free(keyList);
2492 eina_list_free(grabList);
2498 bool WindowBaseEcoreWl2::UngrabKeyList(const Dali::Vector<Dali::KEY>& key, Dali::Vector<bool>& result)
2500 int keyCount = key.Count();
2508 Eina_List* keyList = NULL;
2509 Ecore_Wl2_Window_Keygrab_Info* info = new Ecore_Wl2_Window_Keygrab_Info[keyCount];
2511 for(int index = 0; index < keyCount; ++index)
2513 info[index].key = const_cast<char*>(KeyLookup::GetKeyName(key[index]));
2514 keyList = eina_list_append(keyList, &info);
2517 Eina_List* ungrabList = ecore_wl2_window_keygrab_list_unset(mEcoreWindow, keyList);
2519 result.Resize(keyCount, true);
2521 Eina_List* l = NULL;
2522 Eina_List* m = NULL;
2523 void* listData = NULL;
2526 if(ungrabList != NULL)
2528 EINA_LIST_FOREACH(ungrabList, m, data)
2531 EINA_LIST_FOREACH(keyList, l, listData)
2533 if(strcmp(static_cast<char*>(data), static_cast<Ecore_Wl2_Window_Keygrab_Info*>(listData)->key) == 0)
2535 result[index] = false;
2544 eina_list_free(keyList);
2545 eina_list_free(ungrabList);
2551 void WindowBaseEcoreWl2::GetDpi(unsigned int& dpiHorizontal, unsigned int& dpiVertical)
2556 Ecore_Wl2_Output* output = ecore_wl2_window_output_find(mEcoreWindow);
2558 // 1 inch = 25.4 millimeters
2559 xres = ecore_wl2_output_dpi_get(output);
2560 yres = ecore_wl2_output_dpi_get(output);
2562 dpiHorizontal = int(xres + 0.5f); // rounding
2563 dpiVertical = int(yres + 0.5f);
2566 int WindowBaseEcoreWl2::GetOrientation() const
2568 int orientation = (mScreenRotationAngle + mWindowRotationAngle) % 360;
2569 if(mSupportedPreProtation)
2576 int WindowBaseEcoreWl2::GetScreenRotationAngle()
2580 if(ecore_wl2_window_ignore_output_transform_get(mEcoreWindow))
2586 transform = ecore_wl2_output_transform_get(ecore_wl2_window_output_find(mEcoreWindow));
2588 mScreenRotationAngle = transform * 90;
2589 return mScreenRotationAngle;
2592 void WindowBaseEcoreWl2::SetWindowRotationAngle(int degree)
2594 mWindowRotationAngle = degree;
2595 ecore_wl2_window_rotation_set(mEcoreWindow, degree);
2598 void WindowBaseEcoreWl2::WindowRotationCompleted(int degree, int width, int height)
2600 ecore_wl2_window_rotation_change_done_send(mEcoreWindow, degree, width, height);
2603 void WindowBaseEcoreWl2::SetTransparency(bool transparent)
2605 ecore_wl2_window_alpha_set(mEcoreWindow, transparent);
2608 void WindowBaseEcoreWl2::InitializeEcoreElDBus()
2610 #ifdef DALI_ELDBUS_AVAILABLE
2611 Eldbus_Object* object;
2612 Eldbus_Proxy* manager;
2614 if(!(mSystemConnection = eldbus_connection_get(ELDBUS_CONNECTION_TYPE_SYSTEM)))
2616 DALI_LOG_ERROR("Unable to get system bus\n");
2619 object = eldbus_object_get(mSystemConnection, BUS, PATH);
2622 DALI_LOG_ERROR("Getting object failed\n");
2626 manager = eldbus_proxy_get(object, INTERFACE);
2629 DALI_LOG_ERROR("Getting proxy failed\n");
2633 if(!eldbus_proxy_signal_handler_add(manager, "GestureDetected", EcoreElDBusAccessibilityNotification, this))
2635 DALI_LOG_ERROR("No signal handler returned\n");
2640 void WindowBaseEcoreWl2::CreateWindow(PositionSize positionSize)
2642 Ecore_Wl2_Display* display = ecore_wl2_display_connect(NULL);
2645 DALI_ASSERT_ALWAYS(0 && "Failed to get display");
2648 ecore_wl2_display_sync(display);
2650 mEcoreWindow = ecore_wl2_window_new(display, NULL, positionSize.x, positionSize.y, positionSize.width, positionSize.height);
2652 if(mEcoreWindow == 0)
2654 DALI_ASSERT_ALWAYS(0 && "Failed to create Wayland window");
2658 ecore_wl2_window_type_set(mEcoreWindow, ECORE_WL2_WINDOW_TYPE_TOPLEVEL);
2660 // Get Screen width, height
2661 ecore_wl2_display_screen_size_get(display, &mScreenWidth, &mScreenHeight);
2664 void WindowBaseEcoreWl2::SetParent(WindowBase* parentWinBase, bool belowParent)
2666 Ecore_Wl2_Window* ecoreParent = NULL;
2669 WindowBaseEcoreWl2* winBaseEcore2 = static_cast<WindowBaseEcoreWl2*>(parentWinBase);
2670 ecoreParent = winBaseEcore2->mEcoreWindow;
2672 ecore_wl2_window_transient_parent_set(mEcoreWindow, ecoreParent, belowParent);
2675 int WindowBaseEcoreWl2::CreateFrameRenderedSyncFence()
2677 return wl_egl_window_tizen_create_commit_sync_fd(mEglWindow);
2680 int WindowBaseEcoreWl2::CreateFramePresentedSyncFence()
2682 return wl_egl_window_tizen_create_presentation_sync_fd(mEglWindow);
2685 void WindowBaseEcoreWl2::SetPositionSizeWithAngle(PositionSize positionSize, int angle)
2687 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);
2688 ecore_wl2_window_rotation_geometry_set(mEcoreWindow, angle, positionSize.x, positionSize.y, positionSize.width, positionSize.height);
2691 void WindowBaseEcoreWl2::InitializeIme()
2693 Eina_Iterator* globals;
2694 struct wl_registry* registry;
2695 Ecore_Wl2_Global* global;
2696 Ecore_Wl2_Display* ecoreWl2Display;
2698 if(!(ecoreWl2Display = ecore_wl2_connected_display_get(NULL)))
2700 DALI_LOG_ERROR("WindowBaseEcoreWl2::InitializeIme(), fail to get ecore_wl2 connected display\n");
2704 DALI_LOG_RELEASE_INFO("InitializeIme: Ecore_Wl2_Display: %p, ecore wl window: %p\n", ecoreWl2Display, mEcoreWindow);
2706 if(!(registry = ecore_wl2_display_registry_get(ecoreWl2Display)))
2708 DALI_LOG_ERROR("WindowBaseEcoreWl2::InitializeIme(), fail to get ecore_wl2 display registry\n");
2712 if(!(globals = ecore_wl2_display_globals_get(ecoreWl2Display)))
2714 DALI_LOG_ERROR("WindowBaseEcoreWl2::InitializeIme(), fail to get ecore_wl2 globals\n");
2718 EINA_ITERATOR_FOREACH(globals, global)
2720 #ifdef OVER_TIZEN_VERSION_7
2721 if(strcmp(global->interface, "zwp_input_panel_v1") == 0)
2723 mWlInputPanel = (zwp_input_panel_v1*)wl_registry_bind(registry, global->id, &zwp_input_panel_v1_interface, 1);
2726 if(strcmp(global->interface, "wl_input_panel") == 0)
2728 mWlInputPanel = (wl_input_panel*)wl_registry_bind(registry, global->id, &wl_input_panel_interface, 1);
2731 else if(strcmp(global->interface, "wl_output") == 0)
2733 mWlOutput = (wl_output*)wl_registry_bind(registry, global->id, &wl_output_interface, 1);
2739 DALI_LOG_ERROR("WindowBaseEcoreWl2::InitializeIme(), fail to get wayland input panel interface\n");
2745 DALI_LOG_ERROR("WindowBaseEcoreWl2::InitializeIme(), fail to get wayland output panel interface\n");
2748 #ifdef OVER_TIZEN_VERSION_7
2749 mWlInputPanelSurface = zwp_input_panel_v1_get_input_panel_surface(mWlInputPanel, mWlSurface);
2751 mWlInputPanelSurface = wl_input_panel_get_input_panel_surface(mWlInputPanel, mWlSurface);
2753 if(!mWlInputPanelSurface)
2755 DALI_LOG_ERROR("WindowBaseEcoreWl2::InitializeIme(), fail to get wayland input panel surface\n");
2758 #ifdef OVER_TIZEN_VERSION_7
2759 zwp_input_panel_surface_v1_set_toplevel(mWlInputPanelSurface, mWlOutput, ZWP_INPUT_PANEL_SURFACE_V1_POSITION_CENTER_BOTTOM);
2761 wl_input_panel_surface_set_toplevel(mWlInputPanelSurface, mWlOutput, WL_INPUT_PANEL_SURFACE_POSITION_CENTER_BOTTOM);
2765 void WindowBaseEcoreWl2::ImeWindowReadyToRender()
2767 if(!mWlInputPanelSurface)
2769 DALI_LOG_ERROR("WindowBaseEcoreWl2::ImeWindowReadyToRender(), wayland input panel surface is null\n");
2772 #ifdef OVER_TIZEN_VERSION_7
2773 zwp_input_panel_surface_v1_set_ready(mWlInputPanelSurface, 1);
2775 wl_input_panel_surface_set_ready(mWlInputPanelSurface, 1);
2779 void WindowBaseEcoreWl2::RequestMoveToServer()
2781 Ecore_Wl2_Display* display = ecore_wl2_connected_display_get(NULL);
2784 DALI_LOG_ERROR("WindowBaseEcoreWl2::RequestMoveToServer, Fail to get ecore_wl2_display\n");
2788 Ecore_Wl2_Input* input = ecore_wl2_input_default_input_get(display);
2791 DALI_LOG_ERROR("WindowBaseEcoreWl2::RequestMoveToServer, Fail to get default Ecore_Wl2_Input\n");
2795 ecore_wl2_window_move(mEcoreWindow, input);
2796 DALI_LOG_RELEASE_INFO("WindowBaseEcoreWl2::RequestMoveToServer, starts the window[%p] is moved by server\n", mEcoreWindow);
2799 void WindowBaseEcoreWl2::RequestResizeToServer(WindowResizeDirection direction)
2801 Ecore_Wl2_Display* display = ecore_wl2_connected_display_get(NULL);
2804 DALI_LOG_ERROR("WindowBaseEcoreWl2::RequestResizeToServer, Fail to get ecore_wl2_display\n");
2808 Ecore_Wl2_Input* input = ecore_wl2_input_default_input_get(display);
2811 DALI_LOG_ERROR("WindowBaseEcoreWl2::RequestResizeToServer, Fail to get default Ecore_Wl2_Input\n");
2818 case WindowResizeDirection::TOP_LEFT:
2823 case WindowResizeDirection::TOP:
2828 case WindowResizeDirection::TOP_RIGHT:
2833 case WindowResizeDirection::LEFT:
2838 case WindowResizeDirection::RIGHT:
2843 case WindowResizeDirection::BOTTOM_LEFT:
2848 case WindowResizeDirection::BOTTOM:
2853 case WindowResizeDirection::BOTTOM_RIGHT:
2865 ecore_wl2_window_resize(mEcoreWindow, input, location);
2866 DALI_LOG_RELEASE_INFO("WindowBaseEcoreWl2::RequestResizeToServer, starts the window[%p] is resized by server, mode:%d\n", mEcoreWindow, location);
2869 void WindowBaseEcoreWl2::EnableFloatingMode(bool enable)
2871 DALI_LOG_RELEASE_INFO("WindowBaseEcoreWl2::EnableFloatingMode, floating mode flag: [%p], enable [%d]\n", mEcoreWindow, enable);
2874 ecore_wl2_window_floating_mode_set(mEcoreWindow, EINA_TRUE);
2878 ecore_wl2_window_floating_mode_set(mEcoreWindow, EINA_FALSE);
2882 bool WindowBaseEcoreWl2::IsFloatingModeEnabled() const
2884 return ecore_wl2_window_floating_mode_get(mEcoreWindow);
2887 void WindowBaseEcoreWl2::IncludeInputRegion(const Rect<int>& inputRegion)
2889 Eina_Rectangle rect;
2890 rect.x = inputRegion.x;
2891 rect.y = inputRegion.y;
2892 rect.w = inputRegion.width;
2893 rect.h = inputRegion.height;
2895 ecore_wl2_window_input_rect_add(mEcoreWindow, &rect);
2896 ecore_wl2_window_commit(mEcoreWindow, EINA_TRUE);
2899 void WindowBaseEcoreWl2::ExcludeInputRegion(const Rect<int>& inputRegion)
2901 Eina_Rectangle rect;
2902 rect.x = inputRegion.x;
2903 rect.y = inputRegion.y;
2904 rect.w = inputRegion.width;
2905 rect.h = inputRegion.height;
2907 ecore_wl2_window_input_rect_subtract(mEcoreWindow, &rect);
2908 ecore_wl2_window_commit(mEcoreWindow, EINA_TRUE);
2911 } // namespace Adaptor
2913 } // namespace Internal
2917 #pragma GCC diagnostic pop