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=f7993df7487a9542b354e540d47af96d2ca75884;hb=f79805402bf8bd9b7ceb4561d4c089411fb5927f;hp=3c086b6fc078666fe401064f78bbcb3c5cd4740a;hpb=de66ef5b56bea3c4ad4d9b67faf1b8f0d4190d20;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 3c086b6..f7993df 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) 2022 Samsung Electronics Co., Ltd. + * Copyright (c) 2023 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. @@ -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 ///////////////////////////////////////////////////////////////////////////////////////////////// @@ -762,8 +842,6 @@ WindowBaseEcoreWl2::~WindowBaseEcoreWl2() if(mOwnSurface) { ecore_wl2_window_free(mEcoreWindow); - - WindowSystem::Shutdown(); } } @@ -779,8 +857,6 @@ void WindowBaseEcoreWl2::Initialize(PositionSize positionSize, Any surface, bool else { // we own the surface about to created - WindowSystem::Initialize(); - mOwnSurface = true; CreateWindow(positionSize); } @@ -1203,14 +1279,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 << "]"; - 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 +1327,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 +1350,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 << "]"; - 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 +1398,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 } } @@ -1790,6 +1838,12 @@ void WindowBaseEcoreWl2::MoveResize(PositionSize positionSize) ecore_wl2_window_sync_geometry_set(mEcoreWindow, ++mMoveResizeSerial, newPositionSize.x, newPositionSize.y, newPositionSize.width, newPositionSize.height); } +void WindowBaseEcoreWl2::SetLayout(unsigned int numCols, unsigned int numRows, unsigned int column, unsigned int row, unsigned int colSpan, unsigned int rowSpan) +{ + DALI_LOG_RELEASE_INFO("ecore_wl2_window_layout_set, numCols[%d], numRows[%d], column[%d], row[%d], colSpan[%d], rowSpan[%d]\n", numCols, numRows, column, row, colSpan, rowSpan); + ecore_wl2_window_layout_set(mEcoreWindow, numCols, numRows, column, row, colSpan, rowSpan); +} + void WindowBaseEcoreWl2::SetClass(const std::string& name, const std::string& className) { ecore_wl2_window_title_set(mEcoreWindow, name.c_str()); @@ -1826,6 +1880,7 @@ 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()); + ecore_wl2_window_commit(mEcoreWindow, EINA_TRUE); } void WindowBaseEcoreWl2::Minimize(bool minimize) @@ -1842,6 +1897,7 @@ 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()); + ecore_wl2_window_commit(mEcoreWindow, EINA_TRUE); } void WindowBaseEcoreWl2::SetAvailableAnlges(const std::vector& angles) @@ -2010,7 +2066,15 @@ unsigned int WindowBaseEcoreWl2::GetAuxiliaryHintId(const std::string& hint) con void WindowBaseEcoreWl2::SetInputRegion(const Rect& inputRegion) { - ecore_wl2_window_input_region_set(mEcoreWindow, inputRegion.x, inputRegion.y, inputRegion.width, inputRegion.height); + DALI_LOG_RELEASE_INFO("%p, Set input rect (%d, %d, %d x %d)\n", mEcoreWindow, inputRegion.x, inputRegion.y, inputRegion.width, inputRegion.height); + Eina_Rectangle rect; + rect.x = inputRegion.x; + rect.y = inputRegion.y; + rect.w = inputRegion.width; + rect.h = inputRegion.height; + + ecore_wl2_window_input_rect_set(mEcoreWindow, &rect); + ecore_wl2_window_commit(mEcoreWindow, EINA_TRUE); } void WindowBaseEcoreWl2::SetType(Dali::WindowType type) @@ -2791,58 +2855,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) @@ -2871,6 +2887,7 @@ void WindowBaseEcoreWl2::IncludeInputRegion(const Rect& inputRegion) rect.w = inputRegion.width; rect.h = inputRegion.height; + DALI_LOG_RELEASE_INFO("%p, Add input_rect(%d, %d, %d x %d)\n", mEcoreWindow, rect.x, rect.y, rect.w, rect.h); ecore_wl2_window_input_rect_add(mEcoreWindow, &rect); ecore_wl2_window_commit(mEcoreWindow, EINA_TRUE); } @@ -2883,6 +2900,7 @@ void WindowBaseEcoreWl2::ExcludeInputRegion(const Rect& inputRegion) rect.w = inputRegion.width; rect.h = inputRegion.height; + DALI_LOG_RELEASE_INFO("%p, Subtract input_rect(%d, %d, %d x %d)\n", mEcoreWindow, rect.x, rect.y, rect.w, rect.h); ecore_wl2_window_input_rect_subtract(mEcoreWindow, &rect); ecore_wl2_window_commit(mEcoreWindow, EINA_TRUE); }