X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Finternal%2Fwindow-system%2Ftizen-wayland%2Fecore-wl2%2Fwindow-base-ecore-wl2.cpp;h=162af6c0f6e1f6454c258200a701c0aacb5d4b02;hb=89f64ddecdf8497ede9b3e8c4120cc4aeb64b6b4;hp=4c91c353f45dd900186644d96ba85047c47ab7e9;hpb=d1051bbb344a46e075ff54242944db63b0b483fd;p=platform%2Fcore%2Fuifw%2Fdali-adaptor.git diff --git a/dali/internal/window-system/tizen-wayland/ecore-wl2/window-base-ecore-wl2.cpp b/dali/internal/window-system/tizen-wayland/ecore-wl2/window-base-ecore-wl2.cpp index 4c91c35..162af6c 100644 --- a/dali/internal/window-system/tizen-wayland/ecore-wl2/window-base-ecore-wl2.cpp +++ b/dali/internal/window-system/tizen-wayland/ecore-wl2/window-base-ecore-wl2.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Samsung Electronics Co., Ltd. + * Copyright (c) 2022 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,11 +31,16 @@ // EXTERNAL_HEADERS #include #include +#include #include #include #include + +#if defined(VCONF_ENABLED) #include #include +#endif + #include namespace Dali @@ -50,15 +55,31 @@ namespace Debug::Filter* gWindowBaseLogFilter = Debug::Filter::New(Debug::NoLogging, false, "LOG_WINDOW_BASE"); #endif -const uint32_t MAX_TIZEN_CLIENT_VERSION = 7; -const unsigned int PRIMARY_TOUCH_BUTTON_ID = 1; +DALI_INIT_TRACE_FILTER(gTraceFilter, DALI_TRACE_PERFORMANCE_MARKER, false); -const char* DALI_VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_NAME = "db/setting/accessibility/font_name"; // It will be update at vconf-key.h and replaced. +/** + * @brief Enumeration of location for window resized by display server. + */ +enum class ResizeLocation +{ + INVALID = 0, ///< Invalid value + TOP_LEFT = 5, ///< Start resizing window to the top-left edge. + LEFT = 4, ///< Start resizing window to the left side. + BOTTOM_LEFT = 6, ///< Start resizing window to the bottom-left edge. + BOTTOM = 2, ///< Start resizing window to the bottom side. + BOTTOM_RIGHT = 10, ///< Start resizing window to the bottom-right edge. + RIGHT = 8, ///< Start resizing window to the right side. + TOP_RIGHT = 9, ///< Start resizing window to the top-right edge. + TOP = 1 ///< Start resizing window to the top side. +}; + +const uint32_t MAX_TIZEN_CLIENT_VERSION = 7; +const unsigned int PRIMARY_TOUCH_BUTTON_ID = 1; +const ResizeLocation RESIZE_LOCATIONS[] = {ResizeLocation::TOP_LEFT, ResizeLocation::LEFT, ResizeLocation::BOTTOM_LEFT, ResizeLocation::BOTTOM, ResizeLocation::BOTTOM_RIGHT, ResizeLocation::RIGHT, ResizeLocation::TOP_RIGHT, ResizeLocation::TOP, ResizeLocation::INVALID}; -// DBUS accessibility -const char* BUS = "org.enlightenment.wm-screen-reader"; -const char* INTERFACE = "org.tizen.GestureNavigation"; -const char* PATH = "/org/tizen/GestureNavigation"; +#if defined(VCONF_ENABLED) +const char* DALI_VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_NAME = "db/setting/accessibility/font_name"; // It will be update at vconf-key.h and replaced. +#endif struct KeyCodeMap { @@ -226,6 +247,69 @@ void FindKeyCode(struct xkb_keymap* keyMap, xkb_keycode_t key, void* data) } } +/** + * Return the recalculated window resizing location according to the current orientation. + */ +ResizeLocation RecalculateLocationToCurrentOrientation(WindowResizeDirection direction, int windowRotationAngle) +{ + int index = 8; + switch(direction) + { + case WindowResizeDirection::TOP_LEFT: + { + index = 0; + break; + } + case WindowResizeDirection::LEFT: + { + index = 1; + break; + } + case WindowResizeDirection::BOTTOM_LEFT: + { + index = 2; + break; + } + case WindowResizeDirection::BOTTOM: + { + index = 3; + break; + } + case WindowResizeDirection::BOTTOM_RIGHT: + { + index = 4; + break; + } + case WindowResizeDirection::RIGHT: + { + index = 5; + break; + } + case WindowResizeDirection::TOP_RIGHT: + { + index = 6; + break; + } + case WindowResizeDirection::TOP: + { + index = 7; + break; + } + default: + { + index = 8; + break; + } + } + + if(index != 8 && windowRotationAngle != 0) + { + index = (index + (windowRotationAngle / 90) * 2) % 8; + } + + return RESIZE_LOCATIONS[index]; +} + ///////////////////////////////////////////////////////////////////////////////////////////////// // Window Callbacks ///////////////////////////////////////////////////////////////////////////////////////////////// @@ -447,9 +531,9 @@ static Eina_Bool EcoreEventDataSend(void* data, int type, void* event) } /** -* Called when the source window sends us about the selected content. -* For example, when item is selected in the clipboard. -*/ + * Called when the source window sends us about the selected content. + * For example, when item is selected in the clipboard. + */ static Eina_Bool EcoreEventDataReceive(void* data, int type, void* event) { WindowBaseEcoreWl2* windowBase = static_cast(data); @@ -506,9 +590,8 @@ static Eina_Bool EcoreEventEffectEnd(void* data, int type, void* event) static Eina_Bool EcoreEventSeatKeyboardRepeatChanged(void* data, int type, void* event) { - Ecore_Wl2_Event_Seat_Keyboard_Repeat_Changed* keyboardRepeat = static_cast(event); - WindowBaseEcoreWl2* windowBase = static_cast(data); - DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::EcoreEventSeatKeyboardRepeatChanged, id[ %d ]\n", keyboardRepeat->id); + WindowBaseEcoreWl2* windowBase = static_cast(data); + DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::EcoreEventSeatKeyboardRepeatChanged, id[ %d ]\n", static_cast(event)->id); if(windowBase) { windowBase->OnKeyboardRepeatSettingsChanged(); @@ -536,6 +619,7 @@ static Eina_Bool EcoreEventSeatKeymapChanged(void* data, int type, void* event) // Font Callbacks ///////////////////////////////////////////////////////////////////////////////////////////////// +#if defined(VCONF_ENABLED) /** * Called when a font name is changed. */ @@ -559,6 +643,7 @@ static void VconfNotifyFontSizeChanged(keynode_t* node, void* data) windowBase->OnFontSizeChanged(); } } +#endif ///////////////////////////////////////////////////////////////////////////////////////////////// // Window Redraw Request Event Callbacks @@ -566,9 +651,8 @@ static void VconfNotifyFontSizeChanged(keynode_t* node, void* data) static Eina_Bool EcoreEventWindowRedrawRequest(void* data, int type, void* event) { - Ecore_Wl2_Event_Window_Redraw_Request* windowRedrawRequest = static_cast(event); - WindowBaseEcoreWl2* windowBase = static_cast(data); - DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::EcoreEventWindowRedrawRequest, window[ %d ]\n", windowRedrawRequest->win); + WindowBaseEcoreWl2* windowBase = static_cast(data); + DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::EcoreEventWindowRedrawRequest, window[ %d ]\n", static_cast(event)->win); if(windowBase) { windowBase->OnEcoreEventWindowRedrawRequest(); @@ -578,20 +662,17 @@ static Eina_Bool EcoreEventWindowRedrawRequest(void* data, int type, void* event } ///////////////////////////////////////////////////////////////////////////////////////////////// -// ElDBus Accessibility Callbacks +// Window Auxiliary Message Callbacks ///////////////////////////////////////////////////////////////////////////////////////////////// - -#ifdef DALI_ELDBUS_AVAILABLE -// Callback for Ecore ElDBus accessibility events. -static void EcoreElDBusAccessibilityNotification(void* context, const Eldbus_Message* message) +static Eina_Bool EcoreEventWindowAuxiliaryMessage(void* data, int type, void* event) { - WindowBaseEcoreWl2* windowBase = static_cast(context); + WindowBaseEcoreWl2* windowBase = static_cast(data); if(windowBase) { - windowBase->OnEcoreElDBusAccessibilityNotification(context, message); + windowBase->OnEcoreEventWindowAuxiliaryMessage(event); } + return ECORE_CALLBACK_RENEW; } -#endif // DALI_ELDBUS_AVAILABLE static void RegistryGlobalCallback(void* data, struct wl_registry* registry, uint32_t name, const char* interface, uint32_t version) { @@ -698,6 +779,9 @@ WindowBaseEcoreWl2::WindowBaseEcoreWl2(Dali::PositionSize positionSize, Any surf : mEcoreEventHandler(), mEcoreWindow(nullptr), mWlSurface(nullptr), + mWlInputPanel(nullptr), + mWlOutput(nullptr), + mWlInputPanelSurface(nullptr), mEglWindow(nullptr), mDisplay(nullptr), mEventQueue(nullptr), @@ -705,44 +789,35 @@ WindowBaseEcoreWl2::WindowBaseEcoreWl2(Dali::PositionSize positionSize, Any surf mTizenDisplayPolicy(nullptr), mKeyMap(nullptr), mSupportedAuxiliaryHints(), + mWindowPositionSize(positionSize), mAuxiliaryHints(), + mType(WindowType::NORMAL), mNotificationLevel(-1), - mNotificationChangeState(0), - mNotificationLevelChangeDone(true), mScreenOffMode(0), - mScreenOffModeChangeState(0), - mScreenOffModeChangeDone(true), mBrightness(0), + mWindowRotationAngle(0), + mScreenRotationAngle(0), + mSupportedPreProtation(0), + mNotificationChangeState(0), + mScreenOffModeChangeState(0), mBrightnessChangeState(0), - mBrightnessChangeDone(true), + mLastSubmittedMoveResizeSerial(0), + mMoveResizeSerial(0), + mNotificationLevelChangeDone(true), + mScreenOffModeChangeDone(true), mVisible(true), - mWindowPositionSize(positionSize), mOwnSurface(false), - mMoveResizeSerial(0), - mLastSubmittedMoveResizeSerial(0), - mWindowRotationAngle(0), - mScreenRotationAngle(0), - mSupportedPreProtation(0) -#ifdef DALI_ELDBUS_AVAILABLE - , - mSystemConnection(NULL) -#endif + mBrightnessChangeDone(true) { Initialize(positionSize, surface, isTransparent); } WindowBaseEcoreWl2::~WindowBaseEcoreWl2() { -#ifdef DALI_ELDBUS_AVAILABLE - // Close down ElDBus connections. - if(mSystemConnection) - { - eldbus_connection_unref(mSystemConnection); - } -#endif // DALI_ELDBUS_AVAILABLE - +#if defined(VCONF_ENABLED) vconf_ignore_key_changed(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, VconfNotifyFontSizeChanged); vconf_ignore_key_changed(DALI_VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_NAME, VconfNotifyFontNameChanged); +#endif for(Dali::Vector::Iterator iter = mEcoreEventHandler.Begin(), endIter = mEcoreEventHandler.End(); iter != endIter; ++iter) { @@ -836,11 +911,14 @@ void WindowBaseEcoreWl2::Initialize(PositionSize positionSize, Any surface, bool // Register Window redraw request event mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_WINDOW_REDRAW_REQUEST, EcoreEventWindowRedrawRequest, this)); - // Register Vconf notify - font name and size - vconf_notify_key_changed(DALI_VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_NAME, VconfNotifyFontNameChanged, this); - vconf_notify_key_changed(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, VconfNotifyFontSizeChanged, this); + // Register Window auxiliary event + mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_AUX_MESSAGE, EcoreEventWindowAuxiliaryMessage, this)); - InitializeEcoreElDBus(); +#if defined(VCONF_ENABLED) + // Register Vconf notify - font name and size + vconf_notify_key_changed_for_ui_thread(DALI_VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_NAME, VconfNotifyFontNameChanged, this); + vconf_notify_key_changed_for_ui_thread(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, VconfNotifyFontSizeChanged, this); +#endif Ecore_Wl2_Display* display = ecore_wl2_connected_display_get(NULL); mDisplay = ecore_wl2_display_get(display); @@ -980,21 +1058,26 @@ void WindowBaseEcoreWl2::OnRotation(void* data, int type, void* event) RotationEvent rotationEvent; rotationEvent.angle = ev->angle; rotationEvent.winResize = 0; - mWindowRotationAngle = ev->angle; - if(ev->angle == 0 || ev->angle == 180) - { - rotationEvent.width = ev->w; - rotationEvent.height = ev->h; - } - else + if(ev->w == 0 || ev->h == 0) { - rotationEvent.width = ev->h; - rotationEvent.height = ev->w; + // When rotation event does not have the window width or height, + // previous DALi side window's size are used. + ev->w = mWindowPositionSize.width; + ev->h = mWindowPositionSize.height; } - mWindowPositionSize.width = rotationEvent.width; - mWindowPositionSize.height = rotationEvent.height; + mWindowRotationAngle = ev->angle; + + mWindowPositionSize.width = ev->w; + mWindowPositionSize.height = ev->h; + + PositionSize newPositionSize = RecalculatePositionSizeToCurrentOrientation(mWindowPositionSize); + + rotationEvent.x = newPositionSize.x; + rotationEvent.y = newPositionSize.y; + rotationEvent.width = newPositionSize.width; + rotationEvent.height = newPositionSize.height; mRotationSignal.Emit(rotationEvent); } @@ -1004,10 +1087,50 @@ void WindowBaseEcoreWl2::OnConfiguration(void* data, int type, void* event) { Ecore_Wl2_Event_Window_Configure* ev(static_cast(event)); - if(ev->win == static_cast(ecore_wl2_window_id_get(mEcoreWindow))) + if(ev && ev->win == static_cast(ecore_wl2_window_id_get(mEcoreWindow))) { // Note: To comply with the wayland protocol, Dali should make an ack_configure // by calling ecore_wl2_window_commit + + int tempWidth = ev->w; + int tempHeight = ev->h; + + // Initialize with previous size for skip resize when new size is 0. + // When window is just moved or window is resized by client application, + // The configure notification event's size will be 0. + // If new size is 0, the resized work should be skip. + int newWidth = mWindowPositionSize.width; + int newHeight = mWindowPositionSize.height; + bool windowMoved = false, windowResized = false; + + if(ev->x != mWindowPositionSize.x || ev->y != mWindowPositionSize.y) + { + windowMoved = true; + } + + if(tempWidth != 0 && tempHeight != 0 && (tempWidth != mWindowPositionSize.width || tempHeight != mWindowPositionSize.height)) + { + windowResized = true; + newWidth = tempWidth; + newHeight = tempHeight; + } + + if(windowMoved || windowResized) + { + mWindowPositionSize.x = ev->x; + mWindowPositionSize.y = ev->y; + mWindowPositionSize.width = newWidth; + mWindowPositionSize.height = newHeight; + 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); + + ecore_wl2_window_geometry_set(mEcoreWindow, mWindowPositionSize.x, mWindowPositionSize.y, mWindowPositionSize.width, mWindowPositionSize.height); + + Dali::PositionSize newPositionSize = RecalculatePositionSizeToCurrentOrientation(mWindowPositionSize); + mUpdatePositionSizeSignal.Emit(newPositionSize); + } + + mMaximizeChangedSignal.Emit(static_cast(ev->states & ECORE_WL2_WINDOW_STATE_MAXIMIZED)); + ecore_wl2_window_commit(mEcoreWindow, EINA_FALSE); } } @@ -1142,10 +1265,9 @@ void WindowBaseEcoreWl2::OnDetentRotation(void* data, int type, void* event) DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Concise, "WindowBaseEcoreWl2::OnDetentRotation\n"); - int direction = (detentEvent->direction == ECORE_DETENT_DIRECTION_CLOCKWISE) ? 1 : -1; - int timeStamp = detentEvent->timestamp; + int32_t clockwise = (detentEvent->direction == ECORE_DETENT_DIRECTION_CLOCKWISE) ? 1 : -1; - Integration::WheelEvent wheelEvent(Integration::WheelEvent::CUSTOM_WHEEL, direction, 0, Vector2(0.0f, 0.0f), 0, timeStamp); + Integration::WheelEvent wheelEvent(Integration::WheelEvent::CUSTOM_WHEEL, detentEvent->direction, 0, Vector2(0.0f, 0.0f), clockwise, detentEvent->timestamp); mWheelEventSignal.Emit(wheelEvent); } @@ -1156,13 +1278,20 @@ void WindowBaseEcoreWl2::OnKeyDown(void* data, int type, void* event) if(keyEvent->window == static_cast(ecore_wl2_window_id_get(mEcoreWindow))) { - DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::OnKeyDown\n"); - std::string keyName(keyEvent->keyname); std::string logicalKey(""); std::string keyString(""); std::string compose(""); +#ifdef TRACE_ENABLED + std::ostringstream stream; + if(gTraceFilter->IsTraceEnabled()) + { + stream << "DALI_ON_KEY_DOWN [" << keyName << "]"; + DALI_TRACE_BEGIN(gTraceFilter, stream.str().c_str()); + } +#endif + // Ensure key compose string is not NULL as keys like SHIFT or arrow have a null string. if(keyEvent->compose) { @@ -1209,6 +1338,13 @@ void WindowBaseEcoreWl2::OnKeyDown(void* data, int type, void* event) Integration::KeyEvent keyEvent(keyName, logicalKey, keyString, keyCode, modifier, time, Integration::KeyEvent::DOWN, compose, deviceName, deviceClass, deviceSubclass); mKeyEventSignal.Emit(keyEvent); + +#ifdef TRACE_ENABLED + if(gTraceFilter->IsTraceEnabled()) + { + DALI_TRACE_END(gTraceFilter, stream.str().c_str()); + } +#endif } } @@ -1218,8 +1354,6 @@ void WindowBaseEcoreWl2::OnKeyUp(void* data, int type, void* event) if(keyEvent->window == static_cast(ecore_wl2_window_id_get(mEcoreWindow))) { - DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::OnKeyUp\n"); - #if defined(ECORE_VERSION_MAJOR) && (ECORE_VERSION_MAJOR >= 1) && defined(ECORE_VERSION_MINOR) && (ECORE_VERSION_MINOR >= 23) // Cancel processing flag is sent because this key event will combine with the previous key. So, the event should not actually perform anything. if(keyEvent->event_flags & ECORE_EVENT_FLAG_CANCEL) @@ -1234,6 +1368,15 @@ void WindowBaseEcoreWl2::OnKeyUp(void* data, int type, void* event) std::string keyString(""); std::string compose(""); +#ifdef TRACE_ENABLED + std::ostringstream stream; + if(gTraceFilter->IsTraceEnabled()) + { + stream << "DALI_ON_KEY_UP [" << keyName << "]"; + DALI_TRACE_BEGIN(gTraceFilter, stream.str().c_str()); + } +#endif + // Ensure key compose string is not NULL as keys like SHIFT or arrow have a null string. if(keyEvent->compose) { @@ -1280,6 +1423,13 @@ void WindowBaseEcoreWl2::OnKeyUp(void* data, int type, void* event) Integration::KeyEvent keyEvent(keyName, logicalKey, keyString, keyCode, modifier, time, Integration::KeyEvent::UP, compose, deviceName, deviceClass, deviceSubclass); mKeyEventSignal.Emit(keyEvent); + +#ifdef TRACE_ENABLED + if(gTraceFilter->IsTraceEnabled()) + { + DALI_TRACE_END(gTraceFilter, stream.str().c_str()); + } +#endif } } @@ -1303,21 +1453,6 @@ void WindowBaseEcoreWl2::OnFontSizeChanged() mStyleChangedSignal.Emit(StyleChange::DEFAULT_FONT_SIZE_CHANGE); } -void WindowBaseEcoreWl2::OnEcoreElDBusAccessibilityNotification(void* context, const Eldbus_Message* message) -{ -#ifdef DALI_ELDBUS_AVAILABLE - AccessibilityInfo info; - - // The string defines the arg-list's respective types. - if(!eldbus_message_arguments_get(message, "iiiiiiu", &info.gestureValue, &info.startX, &info.startY, &info.endX, &info.endY, &info.state, &info.eventTime)) - { - DALI_LOG_ERROR("OnEcoreElDBusAccessibilityNotification: Error getting arguments\n"); - } - - mAccessibilitySignal.Emit(info); -#endif -} - void WindowBaseEcoreWl2::OnTransitionEffectEvent(WindowEffectState state, WindowEffectType type) { mTransitionEffectEventSignal.Emit(state, type); @@ -1333,6 +1468,32 @@ void WindowBaseEcoreWl2::OnEcoreEventWindowRedrawRequest() mWindowRedrawRequestSignal.Emit(); } +void WindowBaseEcoreWl2::OnEcoreEventWindowAuxiliaryMessage(void* event) +{ + Ecore_Wl2_Event_Aux_Message* message = static_cast(event); + if(message) + { + DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::OnEcoreEventWindowAuxiliaryMessage, key:%s, value:%s \n", message->key, message->val); + std::string key(message->key); + std::string value(message->val); + Dali::Property::Array options; + + if(message->options) + { + Eina_List* l; + void* data; + EINA_LIST_FOREACH(message->options, l, data) + { + DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::OnEcoreEventWindowAuxiliaryMessage, option: %s\n", (char*)data); + std::string option(static_cast(data)); + options.Add(option); + } + } + + mAuxiliaryMessageSignal.Emit(key, value, options); + } +} + void WindowBaseEcoreWl2::KeymapChanged(void* data, int type, void* event) { Ecore_Wl2_Event_Seat_Keymap_Changed* changed = static_cast(event); @@ -1437,6 +1598,15 @@ int WindowBaseEcoreWl2::GetNativeWindowId() return ecore_wl2_window_id_get(mEcoreWindow); } +std::string WindowBaseEcoreWl2::GetNativeWindowResourceId() +{ +#ifdef OVER_TIZEN_VERSION_7 + return std::to_string(ecore_wl2_window_resource_id_get(mEcoreWindow)); +#else + return std::string(); +#endif +} + EGLNativeWindowType WindowBaseEcoreWl2::CreateEglWindow(int width, int height) { int totalAngle = (mWindowRotationAngle + mScreenRotationAngle) % 360; @@ -1530,6 +1700,7 @@ void WindowBaseEcoreWl2::SetEglWindowBufferTransform(int angle) } } + DALI_LOG_RELEASE_INFO("wl_egl_window_tizen_set_buffer_transform() with buffer Transform [%d]\n", bufferTransform); wl_egl_window_tizen_set_buffer_transform(mEglWindow, bufferTransform); } @@ -1566,11 +1737,13 @@ void WindowBaseEcoreWl2::SetEglWindowTransform(int angle) } } + DALI_LOG_RELEASE_INFO("wl_egl_window_tizen_set_window_transform() with window Transform [%d]\n", windowTransform); wl_egl_window_tizen_set_window_transform(mEglWindow, windowTransform); } void WindowBaseEcoreWl2::ResizeEglWindow(PositionSize positionSize) { + DALI_LOG_RELEASE_INFO("wl_egl_window_resize(), (%d, %d) [%d x %d]\n", positionSize.x, positionSize.y, positionSize.width, positionSize.height); wl_egl_window_resize(mEglWindow, positionSize.width, positionSize.height, positionSize.x, positionSize.y); // Note: Both "Resize" and "MoveResize" cases can reach here, but only "MoveResize" needs to submit serial number @@ -1594,22 +1767,107 @@ bool WindowBaseEcoreWl2::IsEglWindowRotationSupported() return false; } +PositionSize WindowBaseEcoreWl2::RecalculatePositionSizeToSystem(PositionSize positionSize) +{ + PositionSize newPositionSize; + int32_t screenWidth, screenHeight; + WindowSystem::GetScreenSize(screenWidth, screenHeight); + + if(mWindowRotationAngle == 90) + { + newPositionSize.x = positionSize.y; + newPositionSize.y = screenHeight - (positionSize.x + positionSize.width); + newPositionSize.width = positionSize.height; + newPositionSize.height = positionSize.width; + } + else if(mWindowRotationAngle == 180) + { + newPositionSize.x = screenWidth - (positionSize.x + positionSize.width); + newPositionSize.y = screenHeight - (positionSize.y + positionSize.height); + newPositionSize.width = positionSize.width; + newPositionSize.height = positionSize.height; + } + else if(mWindowRotationAngle == 270) + { + newPositionSize.x = screenWidth - (positionSize.y + positionSize.height); + newPositionSize.y = positionSize.x; + newPositionSize.width = positionSize.height; + newPositionSize.height = positionSize.width; + } + else + { + newPositionSize.x = positionSize.x; + newPositionSize.y = positionSize.y; + newPositionSize.width = positionSize.width; + newPositionSize.height = positionSize.height; + } + + return newPositionSize; +} + +PositionSize WindowBaseEcoreWl2::RecalculatePositionSizeToCurrentOrientation(PositionSize positionSize) +{ + PositionSize newPositionSize; + int32_t screenWidth, screenHeight; + WindowSystem::GetScreenSize(screenWidth, screenHeight); + + if(mWindowRotationAngle == 90) + { + newPositionSize.x = screenHeight - (positionSize.y + positionSize.height); + newPositionSize.y = positionSize.x; + newPositionSize.width = positionSize.height; + newPositionSize.height = positionSize.width; + } + else if(mWindowRotationAngle == 180) + { + newPositionSize.x = screenWidth - (positionSize.x + positionSize.width); + newPositionSize.y = screenHeight - (positionSize.y + positionSize.height); + newPositionSize.width = positionSize.width; + newPositionSize.height = positionSize.height; + } + else if(mWindowRotationAngle == 270) + { + newPositionSize.x = positionSize.y; + newPositionSize.y = screenWidth - (positionSize.x + positionSize.width); + newPositionSize.width = positionSize.height; + newPositionSize.height = positionSize.width; + } + else + { + newPositionSize.x = positionSize.x; + newPositionSize.y = positionSize.y; + newPositionSize.width = positionSize.width; + newPositionSize.height = positionSize.height; + } + + return newPositionSize; +} + void WindowBaseEcoreWl2::Move(PositionSize positionSize) { - mWindowPositionSize = positionSize; - ecore_wl2_window_position_set(mEcoreWindow, positionSize.x, positionSize.y); + PositionSize newPositionSize = RecalculatePositionSizeToSystem(positionSize); + + mWindowPositionSize = newPositionSize; + DALI_LOG_RELEASE_INFO("ecore_wl2_window_position_set x[%d], y[%d]\n", newPositionSize.x, newPositionSize.y); + ecore_wl2_window_position_set(mEcoreWindow, newPositionSize.x, newPositionSize.y); } void WindowBaseEcoreWl2::Resize(PositionSize positionSize) { - mWindowPositionSize = positionSize; - ecore_wl2_window_geometry_set(mEcoreWindow, positionSize.x, positionSize.y, positionSize.width, positionSize.height); + PositionSize newPositionSize = RecalculatePositionSizeToSystem(positionSize); + + mWindowPositionSize = newPositionSize; + 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); + ecore_wl2_window_sync_geometry_set(mEcoreWindow, ++mMoveResizeSerial, newPositionSize.x, newPositionSize.y, newPositionSize.width, newPositionSize.height); } void WindowBaseEcoreWl2::MoveResize(PositionSize positionSize) { - mWindowPositionSize = positionSize; - ecore_wl2_window_sync_geometry_set(mEcoreWindow, ++mMoveResizeSerial, positionSize.x, positionSize.y, positionSize.width, positionSize.height); + PositionSize newPositionSize = RecalculatePositionSizeToSystem(positionSize); + + mWindowPositionSize = newPositionSize; + 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); + ecore_wl2_window_sync_geometry_set(mEcoreWindow, ++mMoveResizeSerial, newPositionSize.x, newPositionSize.y, newPositionSize.width, newPositionSize.height); } void WindowBaseEcoreWl2::SetClass(const std::string& name, const std::string& className) @@ -1634,6 +1892,38 @@ void WindowBaseEcoreWl2::Activate() ecore_wl2_window_activate(mEcoreWindow); } +void WindowBaseEcoreWl2::Maximize(bool maximize) +{ + ecore_wl2_window_maximized_set(mEcoreWindow, maximize); +} + +bool WindowBaseEcoreWl2::IsMaximized() const +{ + return ecore_wl2_window_maximized_get(mEcoreWindow); +} + +void WindowBaseEcoreWl2::SetMaximumSize(Dali::Window::WindowSize size) +{ + DALI_LOG_RELEASE_INFO("ecore_wl2_window_maximum_size_set, width: %d, height: %d\n", size.GetWidth(), size.GetHeight()); + ecore_wl2_window_maximum_size_set(mEcoreWindow, size.GetWidth(), size.GetHeight()); +} + +void WindowBaseEcoreWl2::Minimize(bool minimize) +{ + ecore_wl2_window_iconified_set(mEcoreWindow, minimize); +} + +bool WindowBaseEcoreWl2::IsMinimized() const +{ + return ecore_wl2_window_iconified_get(mEcoreWindow); +} + +void WindowBaseEcoreWl2::SetMimimumSize(Dali::Window::WindowSize size) +{ + DALI_LOG_RELEASE_INFO("ecore_wl2_window_minimum_size_set, width: %d, height: %d\n", size.GetWidth(), size.GetHeight()); + ecore_wl2_window_minimum_size_set(mEcoreWindow, size.GetWidth(), size.GetHeight()); +} + void WindowBaseEcoreWl2::SetAvailableAnlges(const std::vector& angles) { int rotations[4] = {0}; @@ -1641,7 +1931,7 @@ void WindowBaseEcoreWl2::SetAvailableAnlges(const std::vector& angles) for(std::size_t i = 0; i < angles.size(); ++i) { rotations[i] = static_cast(angles[i]); - DALI_LOG_RELEASE_INFO("%d ", rotations[i]); + DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "%d ", rotations[i]); } ecore_wl2_window_available_rotations_set(mEcoreWindow, rotations, angles.size()); } @@ -1661,17 +1951,7 @@ void WindowBaseEcoreWl2::Show() { if(!mVisible) { - // Ecore-wl2 has the original window size - // and he always sends the window rotation event with the swapped size. - // So, to restore, dali should set the reswapped size(original window size) to ecore-wl2 for restoring. - if(mWindowRotationAngle == 0 || mWindowRotationAngle == 180) - { - ecore_wl2_window_geometry_set(mEcoreWindow, mWindowPositionSize.x, mWindowPositionSize.y, mWindowPositionSize.width, mWindowPositionSize.height); - } - else - { - ecore_wl2_window_geometry_set(mEcoreWindow, mWindowPositionSize.x, mWindowPositionSize.y, mWindowPositionSize.height, mWindowPositionSize.width); - } + ecore_wl2_window_geometry_set(mEcoreWindow, mWindowPositionSize.x, mWindowPositionSize.y, mWindowPositionSize.width, mWindowPositionSize.height); } mVisible = true; @@ -1815,41 +2095,59 @@ void WindowBaseEcoreWl2::SetInputRegion(const Rect& inputRegion) void WindowBaseEcoreWl2::SetType(Dali::WindowType type) { - Ecore_Wl2_Window_Type windowType; - - switch(type) + if(mType != type) { - case Dali::WindowType::NORMAL: - { - windowType = ECORE_WL2_WINDOW_TYPE_TOPLEVEL; - break; - } - case Dali::WindowType::NOTIFICATION: - { - windowType = ECORE_WL2_WINDOW_TYPE_NOTIFICATION; - break; - } - case Dali::WindowType::UTILITY: - { - windowType = ECORE_WL2_WINDOW_TYPE_UTILITY; - break; - } - case Dali::WindowType::DIALOG: - { - windowType = ECORE_WL2_WINDOW_TYPE_DIALOG; - break; - } - default: + mType = type; + Ecore_Wl2_Window_Type windowType; + + switch(type) { - windowType = ECORE_WL2_WINDOW_TYPE_TOPLEVEL; - break; + case Dali::WindowType::NORMAL: + { + windowType = ECORE_WL2_WINDOW_TYPE_TOPLEVEL; + break; + } + case Dali::WindowType::NOTIFICATION: + { + windowType = ECORE_WL2_WINDOW_TYPE_NOTIFICATION; + break; + } + case Dali::WindowType::UTILITY: + { + windowType = ECORE_WL2_WINDOW_TYPE_UTILITY; + break; + } + case Dali::WindowType::DIALOG: + { + windowType = ECORE_WL2_WINDOW_TYPE_DIALOG; + break; + } + case Dali::WindowType::IME: + { + windowType = ECORE_WL2_WINDOW_TYPE_NONE; + break; + } + case Dali::WindowType::DESKTOP: + { + windowType = ECORE_WL2_WINDOW_TYPE_DESKTOP; + break; + } + default: + { + windowType = ECORE_WL2_WINDOW_TYPE_TOPLEVEL; + break; + } } + ecore_wl2_window_type_set(mEcoreWindow, windowType); } +} - ecore_wl2_window_type_set(mEcoreWindow, windowType); +Dali::WindowType WindowBaseEcoreWl2::GetType() const +{ + return mType; } -bool WindowBaseEcoreWl2::SetNotificationLevel(Dali::WindowNotificationLevel level) +Dali::WindowOperationResult WindowBaseEcoreWl2::SetNotificationLevel(Dali::WindowNotificationLevel level) { while(!mTizenPolicy) { @@ -1910,17 +2208,17 @@ bool WindowBaseEcoreWl2::SetNotificationLevel(Dali::WindowNotificationLevel leve if(!mNotificationLevelChangeDone) { DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetNotificationLevel: Level change is failed [%d, %d]\n", level, mNotificationChangeState); - return false; + return Dali::WindowOperationResult::UNKNOWN_ERROR; } else if(mNotificationChangeState == TIZEN_POLICY_ERROR_STATE_PERMISSION_DENIED) { DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetNotificationLevel: Permission denied! [%d]\n", level); - return false; + return Dali::WindowOperationResult::PERMISSION_DENIED; } DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetNotificationLevel: Level is changed [%d]\n", mNotificationLevel); - return true; + return Dali::WindowOperationResult::SUCCEED; } Dali::WindowNotificationLevel WindowBaseEcoreWl2::GetNotificationLevel() const @@ -1997,7 +2295,7 @@ void WindowBaseEcoreWl2::SetOpaqueState(bool opaque) tizen_policy_set_opaque_state(mTizenPolicy, ecore_wl2_window_surface_get(mEcoreWindow), (opaque ? 1 : 0)); } -bool WindowBaseEcoreWl2::SetScreenOffMode(WindowScreenOffMode screenOffMode) +Dali::WindowOperationResult WindowBaseEcoreWl2::SetScreenOffMode(WindowScreenOffMode screenOffMode) { while(!mTizenPolicy) { @@ -2037,17 +2335,17 @@ bool WindowBaseEcoreWl2::SetScreenOffMode(WindowScreenOffMode screenOffMode) if(!mScreenOffModeChangeDone) { DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetScreenOffMode: Screen mode change is failed [%d, %d]\n", screenOffMode, mScreenOffModeChangeState); - return false; + return Dali::WindowOperationResult::UNKNOWN_ERROR; } else if(mScreenOffModeChangeState == TIZEN_POLICY_ERROR_STATE_PERMISSION_DENIED) { DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetScreenOffMode: Permission denied! [%d]\n", screenOffMode); - return false; + return Dali::WindowOperationResult::PERMISSION_DENIED; } DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetScreenOffMode: Screen mode is changed [%d]\n", mScreenOffMode); - return true; + return Dali::WindowOperationResult::SUCCEED; } WindowScreenOffMode WindowBaseEcoreWl2::GetScreenOffMode() const @@ -2093,7 +2391,7 @@ WindowScreenOffMode WindowBaseEcoreWl2::GetScreenOffMode() const return screenMode; } -bool WindowBaseEcoreWl2::SetBrightness(int brightness) +Dali::WindowOperationResult WindowBaseEcoreWl2::SetBrightness(int brightness) { while(!mTizenDisplayPolicy) { @@ -2117,17 +2415,17 @@ bool WindowBaseEcoreWl2::SetBrightness(int brightness) if(!mBrightnessChangeDone) { DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetBrightness: Brightness change is failed [%d, %d]\n", brightness, mBrightnessChangeState); - return false; + return Dali::WindowOperationResult::UNKNOWN_ERROR; } else if(mBrightnessChangeState == TIZEN_POLICY_ERROR_STATE_PERMISSION_DENIED) { DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetBrightness: Permission denied! [%d]\n", brightness); - return false; + return Dali::WindowOperationResult::PERMISSION_DENIED; } DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetBrightness: Brightness is changed [%d]\n", mBrightness); - return true; + return Dali::WindowOperationResult::SUCCEED; } int WindowBaseEcoreWl2::GetBrightness() const @@ -2355,9 +2653,9 @@ void WindowBaseEcoreWl2::GetDpi(unsigned int& dpiHorizontal, unsigned int& dpiVe dpiVertical = int(yres + 0.5f); } -int WindowBaseEcoreWl2::GetOrientation() const +int WindowBaseEcoreWl2::GetWindowRotationAngle() const { - int orientation = (mScreenRotationAngle + mWindowRotationAngle) % 360; + int orientation = mWindowRotationAngle; if(mSupportedPreProtation) { orientation = 0; @@ -2367,8 +2665,12 @@ int WindowBaseEcoreWl2::GetOrientation() const int WindowBaseEcoreWl2::GetScreenRotationAngle() { - int transform = 0; - + if(mSupportedPreProtation) + { + DALI_LOG_RELEASE_INFO("Support PreRotation and return 0\n"); + return 0; + } + int transform; if(ecore_wl2_window_ignore_output_transform_get(mEcoreWindow)) { transform = 0; @@ -2397,78 +2699,224 @@ void WindowBaseEcoreWl2::SetTransparency(bool transparent) ecore_wl2_window_alpha_set(mEcoreWindow, transparent); } -void WindowBaseEcoreWl2::InitializeEcoreElDBus() +void WindowBaseEcoreWl2::CreateWindow(PositionSize positionSize) { -#ifdef DALI_ELDBUS_AVAILABLE - Eldbus_Object* object; - Eldbus_Proxy* manager; + Ecore_Wl2_Display* display = ecore_wl2_display_connect(NULL); + if(!display) + { + DALI_ASSERT_ALWAYS(0 && "Failed to get display"); + } - if(!(mSystemConnection = eldbus_connection_get(ELDBUS_CONNECTION_TYPE_SYSTEM))) + ecore_wl2_display_sync(display); + + mEcoreWindow = ecore_wl2_window_new(display, NULL, positionSize.x, positionSize.y, positionSize.width, positionSize.height); + + if(mEcoreWindow == 0) { - DALI_LOG_ERROR("Unable to get system bus\n"); + DALI_ASSERT_ALWAYS(0 && "Failed to create Wayland window"); } - object = eldbus_object_get(mSystemConnection, BUS, PATH); - if(!object) + // Set default type + ecore_wl2_window_type_set(mEcoreWindow, ECORE_WL2_WINDOW_TYPE_TOPLEVEL); +} + +void WindowBaseEcoreWl2::SetParent(WindowBase* parentWinBase, bool belowParent) +{ + Ecore_Wl2_Window* ecoreParent = NULL; + if(parentWinBase) { - DALI_LOG_ERROR("Getting object failed\n"); + WindowBaseEcoreWl2* winBaseEcore2 = static_cast(parentWinBase); + ecoreParent = winBaseEcore2->mEcoreWindow; + } + ecore_wl2_window_transient_parent_set(mEcoreWindow, ecoreParent, belowParent); +} + +int WindowBaseEcoreWl2::CreateFrameRenderedSyncFence() +{ + return wl_egl_window_tizen_create_commit_sync_fd(mEglWindow); +} + +int WindowBaseEcoreWl2::CreateFramePresentedSyncFence() +{ + return wl_egl_window_tizen_create_presentation_sync_fd(mEglWindow); +} + +void WindowBaseEcoreWl2::SetPositionSizeWithAngle(PositionSize positionSize, int angle) +{ + 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); + ecore_wl2_window_rotation_geometry_set(mEcoreWindow, angle, positionSize.x, positionSize.y, positionSize.width, positionSize.height); +} + +void WindowBaseEcoreWl2::InitializeIme() +{ + Eina_Iterator* globals; + struct wl_registry* registry; + Ecore_Wl2_Global* global; + Ecore_Wl2_Display* ecoreWl2Display; + + if(!(ecoreWl2Display = ecore_wl2_connected_display_get(NULL))) + { + DALI_LOG_ERROR("WindowBaseEcoreWl2::InitializeIme(), fail to get ecore_wl2 connected display\n"); + return; + } + + DALI_LOG_RELEASE_INFO("InitializeIme: Ecore_Wl2_Display: %p, ecore wl window: %p\n", ecoreWl2Display, mEcoreWindow); + + if(!(registry = ecore_wl2_display_registry_get(ecoreWl2Display))) + { + DALI_LOG_ERROR("WindowBaseEcoreWl2::InitializeIme(), fail to get ecore_wl2 display registry\n"); return; } - manager = eldbus_proxy_get(object, INTERFACE); - if(!manager) + if(!(globals = ecore_wl2_display_globals_get(ecoreWl2Display))) { - DALI_LOG_ERROR("Getting proxy failed\n"); + DALI_LOG_ERROR("WindowBaseEcoreWl2::InitializeIme(), fail to get ecore_wl2 globals\n"); return; } - if(!eldbus_proxy_signal_handler_add(manager, "GestureDetected", EcoreElDBusAccessibilityNotification, this)) + EINA_ITERATOR_FOREACH(globals, global) { - DALI_LOG_ERROR("No signal handler returned\n"); +#ifdef OVER_TIZEN_VERSION_7 + if(strcmp(global->interface, "zwp_input_panel_v1") == 0) + { + mWlInputPanel = (zwp_input_panel_v1*)wl_registry_bind(registry, global->id, &zwp_input_panel_v1_interface, 1); + } +#else + if(strcmp(global->interface, "wl_input_panel") == 0) + { + mWlInputPanel = (wl_input_panel*)wl_registry_bind(registry, global->id, &wl_input_panel_interface, 1); + } +#endif + else if(strcmp(global->interface, "wl_output") == 0) + { + mWlOutput = (wl_output*)wl_registry_bind(registry, global->id, &wl_output_interface, 1); + } } + + if(!mWlInputPanel) + { + DALI_LOG_ERROR("WindowBaseEcoreWl2::InitializeIme(), fail to get wayland input panel interface\n"); + return; + } + + if(!mWlOutput) + { + DALI_LOG_ERROR("WindowBaseEcoreWl2::InitializeIme(), fail to get wayland output panel interface\n"); + return; + } +#ifdef OVER_TIZEN_VERSION_7 + mWlInputPanelSurface = zwp_input_panel_v1_get_input_panel_surface(mWlInputPanel, mWlSurface); +#else + mWlInputPanelSurface = wl_input_panel_get_input_panel_surface(mWlInputPanel, mWlSurface); +#endif + if(!mWlInputPanelSurface) + { + DALI_LOG_ERROR("WindowBaseEcoreWl2::InitializeIme(), fail to get wayland input panel surface\n"); + return; + } +#ifdef OVER_TIZEN_VERSION_7 + zwp_input_panel_surface_v1_set_toplevel(mWlInputPanelSurface, mWlOutput, ZWP_INPUT_PANEL_SURFACE_V1_POSITION_CENTER_BOTTOM); +#else + wl_input_panel_surface_set_toplevel(mWlInputPanelSurface, mWlOutput, WL_INPUT_PANEL_SURFACE_POSITION_CENTER_BOTTOM); #endif } -void WindowBaseEcoreWl2::CreateWindow(PositionSize positionSize) +void WindowBaseEcoreWl2::ImeWindowReadyToRender() { - Ecore_Wl2_Display* display = ecore_wl2_display_connect(NULL); + if(!mWlInputPanelSurface) + { + DALI_LOG_ERROR("WindowBaseEcoreWl2::ImeWindowReadyToRender(), wayland input panel surface is null\n"); + return; + } +#ifdef OVER_TIZEN_VERSION_7 + zwp_input_panel_surface_v1_set_ready(mWlInputPanelSurface, 1); +#else + wl_input_panel_surface_set_ready(mWlInputPanelSurface, 1); +#endif +} + +void WindowBaseEcoreWl2::RequestMoveToServer() +{ + Ecore_Wl2_Display* display = ecore_wl2_connected_display_get(NULL); if(!display) { - DALI_ASSERT_ALWAYS(0 && "Failed to get display"); + DALI_LOG_ERROR("WindowBaseEcoreWl2::RequestMoveToServer, Fail to get ecore_wl2_display\n"); + return; } - ecore_wl2_display_sync(display); + Ecore_Wl2_Input* input = ecore_wl2_input_default_input_get(display); + if(!input) + { + DALI_LOG_ERROR("WindowBaseEcoreWl2::RequestMoveToServer, Fail to get default Ecore_Wl2_Input\n"); + return; + } - mEcoreWindow = ecore_wl2_window_new(display, NULL, positionSize.x, positionSize.y, positionSize.width, positionSize.height); + ecore_wl2_window_move(mEcoreWindow, input); + DALI_LOG_RELEASE_INFO("WindowBaseEcoreWl2::RequestMoveToServer, starts the window[%p] is moved by server\n", mEcoreWindow); +} - if(mEcoreWindow == 0) +void WindowBaseEcoreWl2::RequestResizeToServer(WindowResizeDirection direction) +{ + Ecore_Wl2_Display* display = ecore_wl2_connected_display_get(NULL); + if(!display) { - DALI_ASSERT_ALWAYS(0 && "Failed to create Wayland window"); + DALI_LOG_ERROR("WindowBaseEcoreWl2::RequestResizeToServer, Fail to get ecore_wl2_display\n"); + return; } - // Set default type - ecore_wl2_window_type_set(mEcoreWindow, ECORE_WL2_WINDOW_TYPE_TOPLEVEL); + Ecore_Wl2_Input* input = ecore_wl2_input_default_input_get(display); + if(!input) + { + DALI_LOG_ERROR("WindowBaseEcoreWl2::RequestResizeToServer, Fail to get default Ecore_Wl2_Input\n"); + return; + } + + ResizeLocation location = RecalculateLocationToCurrentOrientation(direction, mWindowRotationAngle); + + ecore_wl2_window_resize(mEcoreWindow, input, static_cast(location)); + DALI_LOG_RELEASE_INFO("WindowBaseEcoreWl2::RequestResizeToServer, starts the window[%p] is resized by server, direction:%d oriention:%d mode:%d\n", mEcoreWindow, direction, mWindowRotationAngle, location); } -void WindowBaseEcoreWl2::SetParent(WindowBase* parentWinBase) +void WindowBaseEcoreWl2::EnableFloatingMode(bool enable) { - Ecore_Wl2_Window* ecoreParent = NULL; - if(parentWinBase) + DALI_LOG_RELEASE_INFO("WindowBaseEcoreWl2::EnableFloatingMode, floating mode flag: [%p], enable [%d]\n", mEcoreWindow, enable); + if(enable == true) { - WindowBaseEcoreWl2* winBaseEcore2 = static_cast(parentWinBase); - ecoreParent = winBaseEcore2->mEcoreWindow; + ecore_wl2_window_floating_mode_set(mEcoreWindow, EINA_TRUE); + } + else + { + ecore_wl2_window_floating_mode_set(mEcoreWindow, EINA_FALSE); } - ecore_wl2_window_parent_set(mEcoreWindow, ecoreParent); } -int WindowBaseEcoreWl2::CreateFrameRenderedSyncFence() +bool WindowBaseEcoreWl2::IsFloatingModeEnabled() const { - return wl_egl_window_tizen_create_commit_sync_fd(mEglWindow); + return ecore_wl2_window_floating_mode_get(mEcoreWindow); } -int WindowBaseEcoreWl2::CreateFramePresentedSyncFence() +void WindowBaseEcoreWl2::IncludeInputRegion(const Rect& inputRegion) { - return wl_egl_window_tizen_create_presentation_sync_fd(mEglWindow); + Eina_Rectangle rect; + rect.x = inputRegion.x; + rect.y = inputRegion.y; + rect.w = inputRegion.width; + rect.h = inputRegion.height; + + ecore_wl2_window_input_rect_add(mEcoreWindow, &rect); + ecore_wl2_window_commit(mEcoreWindow, EINA_TRUE); +} + +void WindowBaseEcoreWl2::ExcludeInputRegion(const Rect& inputRegion) +{ + Eina_Rectangle rect; + rect.x = inputRegion.x; + rect.y = inputRegion.y; + rect.w = inputRegion.width; + rect.h = inputRegion.height; + + ecore_wl2_window_input_rect_subtract(mEcoreWindow, &rect); + ecore_wl2_window_commit(mEcoreWindow, EINA_TRUE); } } // namespace Adaptor