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=84e9381fd1aa9f58a152efc81346cbb8efcf227f;hb=b901daa6ea05561c291aab6ab2e8a5fe6cfd2f8d;hp=e062eae82101852c197859b7727f1bfb67ea5d14;hpb=e3baf6238a7a5dd641db663097480717168c2591;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 e062eae..84e9381 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 @@ -57,8 +57,25 @@ Debug::Filter* gWindowBaseLogFilter = Debug::Filter::New(Debug::NoLogging, false DALI_INIT_TRACE_FILTER(gTraceFilter, DALI_TRACE_PERFORMANCE_MARKER, false); -const uint32_t MAX_TIZEN_CLIENT_VERSION = 7; -const unsigned int PRIMARY_TOUCH_BUTTON_ID = 1; +/** + * @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}; #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. @@ -230,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 ///////////////////////////////////////////////////////////////////////////////////////////////// @@ -718,8 +798,6 @@ WindowBaseEcoreWl2::WindowBaseEcoreWl2(Dali::PositionSize positionSize, Any surf mWindowRotationAngle(0), mScreenRotationAngle(0), mSupportedPreProtation(0), - mScreenWidth(0), - mScreenHeight(0), mNotificationChangeState(0), mScreenOffModeChangeState(0), mBrightnessChangeState(0), @@ -1014,8 +1092,8 @@ void WindowBaseEcoreWl2::OnConfiguration(void* data, int type, void* event) // Note: To comply with the wayland protocol, Dali should make an ack_configure // by calling ecore_wl2_window_commit - int tempWidth = static_cast(ev->w); - int tempHeight = static_cast(ev->h); + 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, @@ -1051,6 +1129,8 @@ void WindowBaseEcoreWl2::OnConfiguration(void* data, int type, void* event) mUpdatePositionSizeSignal.Emit(newPositionSize); } + mMaximizeChangedSignal.Emit(static_cast(ev->states & ECORE_WL2_WINDOW_STATE_MAXIMIZED)); + ecore_wl2_window_commit(mEcoreWindow, EINA_FALSE); } } @@ -1203,14 +1283,7 @@ void WindowBaseEcoreWl2::OnKeyDown(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_DOWN [" << keyName << "]\n"; - DALI_TRACE_BEGIN(gTraceFilter, stream.str().c_str()); - } -#endif + DALI_TRACE_SCOPE(gTraceFilter, "DALI_ON_KEY_DOWN"); // Ensure key compose string is not NULL as keys like SHIFT or arrow have a null string. if(keyEvent->compose) @@ -1258,13 +1331,6 @@ 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 } } @@ -1288,14 +1354,7 @@ 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 << "]" << std::endl; - DALI_TRACE_BEGIN(gTraceFilter, stream.str().c_str()); - } -#endif + DALI_TRACE_SCOPE(gTraceFilter, "DALI_ON_KEY_UP"); // Ensure key compose string is not NULL as keys like SHIFT or arrow have a null string. if(keyEvent->compose) @@ -1343,13 +1402,6 @@ 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 } } @@ -1690,24 +1742,26 @@ bool WindowBaseEcoreWl2::IsEglWindowRotationSupported() PositionSize WindowBaseEcoreWl2::RecalculatePositionSizeToSystem(PositionSize positionSize) { PositionSize newPositionSize; + int32_t screenWidth, screenHeight; + WindowSystem::GetScreenSize(screenWidth, screenHeight); if(mWindowRotationAngle == 90) { newPositionSize.x = positionSize.y; - newPositionSize.y = mScreenHeight - (positionSize.x + positionSize.width); + newPositionSize.y = screenHeight - (positionSize.x + positionSize.width); newPositionSize.width = positionSize.height; newPositionSize.height = positionSize.width; } else if(mWindowRotationAngle == 180) { - newPositionSize.x = mScreenWidth - (positionSize.x + positionSize.width); - newPositionSize.y = mScreenHeight - (positionSize.y + positionSize.height); + 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 = mScreenWidth - (positionSize.y + positionSize.height); + newPositionSize.x = screenWidth - (positionSize.y + positionSize.height); newPositionSize.y = positionSize.x; newPositionSize.width = positionSize.height; newPositionSize.height = positionSize.width; @@ -1726,25 +1780,27 @@ PositionSize WindowBaseEcoreWl2::RecalculatePositionSizeToSystem(PositionSize po PositionSize WindowBaseEcoreWl2::RecalculatePositionSizeToCurrentOrientation(PositionSize positionSize) { PositionSize newPositionSize; + int32_t screenWidth, screenHeight; + WindowSystem::GetScreenSize(screenWidth, screenHeight); if(mWindowRotationAngle == 90) { - newPositionSize.x = mScreenHeight - (positionSize.y + positionSize.height); + 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 = mScreenWidth - (positionSize.x + positionSize.width); - newPositionSize.y = mScreenHeight - (positionSize.y + positionSize.height); + 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 = mScreenWidth - (positionSize.x + positionSize.width); + newPositionSize.y = screenWidth - (positionSize.x + positionSize.width); newPositionSize.width = positionSize.height; newPositionSize.height = positionSize.width; } @@ -2634,9 +2690,6 @@ void WindowBaseEcoreWl2::CreateWindow(PositionSize positionSize) // Set default type ecore_wl2_window_type_set(mEcoreWindow, ECORE_WL2_WINDOW_TYPE_TOPLEVEL); - - // Get Screen width, height - ecore_wl2_display_screen_size_get(display, &mScreenWidth, &mScreenHeight); } void WindowBaseEcoreWl2::SetParent(WindowBase* parentWinBase, bool belowParent) @@ -2790,58 +2843,10 @@ void WindowBaseEcoreWl2::RequestResizeToServer(WindowResizeDirection direction) return; } - int location = 0; - switch(direction) - { - case WindowResizeDirection::TOP_LEFT: - { - location = 5; - break; - } - case WindowResizeDirection::TOP: - { - location = 1; - break; - } - case WindowResizeDirection::TOP_RIGHT: - { - location = 9; - break; - } - case WindowResizeDirection::LEFT: - { - location = 4; - break; - } - case WindowResizeDirection::RIGHT: - { - location = 8; - break; - } - case WindowResizeDirection::BOTTOM_LEFT: - { - location = 6; - break; - } - case WindowResizeDirection::BOTTOM: - { - location = 2; - break; - } - case WindowResizeDirection::BOTTOM_RIGHT: - { - location = 10; - break; - } - default: - { - location = 0; - break; - } - } + ResizeLocation location = RecalculateLocationToCurrentOrientation(direction, mWindowRotationAngle); - ecore_wl2_window_resize(mEcoreWindow, input, location); - DALI_LOG_RELEASE_INFO("WindowBaseEcoreWl2::RequestResizeToServer, starts the window[%p] is resized by server, mode:%d\n", mEcoreWindow, location); + 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::EnableFloatingMode(bool enable)