X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Finternal%2Fwindow-system%2Ftizen-wayland%2Fecore-wl2%2Fwindow-system-ecore-wl2.cpp;h=4b3eb66bddaeea4025c93430a20772af18dca97b;hb=aacd2634a24ed8cf4ee00245eeae60cb1f43307b;hp=4974602b0997914ebae39e2247a6f647f8e754e7;hpb=8521b460a0048db65f92c15b09efc6ed7acaebcb;p=platform%2Fcore%2Fuifw%2Fdali-adaptor.git diff --git a/dali/internal/window-system/tizen-wayland/ecore-wl2/window-system-ecore-wl2.cpp b/dali/internal/window-system/tizen-wayland/ecore-wl2/window-system-ecore-wl2.cpp index 4974602..4b3eb66 100644 --- a/dali/internal/window-system/tizen-wayland/ecore-wl2/window-system-ecore-wl2.cpp +++ b/dali/internal/window-system/tizen-wayland/ecore-wl2/window-system-ecore-wl2.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018 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. @@ -16,23 +16,40 @@ */ // INTERNAL HEADERS -#include #include +#include +#include // EXTERNAL_HEADERS #include +#include + +#define START_DURATION_CHECK() \ + uint32_t durationMilliSeconds = static_cast(-1); \ + uint32_t startTime, endTime; \ + startTime = TimeService::GetMilliSeconds(); + +#define FINISH_DURATION_CHECK(functionName) \ + endTime = TimeService::GetMilliSeconds(); \ + durationMilliSeconds = endTime - startTime; \ + if(durationMilliSeconds > 0) \ + { \ + DALI_LOG_DEBUG_INFO("%s : duration [%u ms]\n", functionName, durationMilliSeconds); \ + } namespace Dali { - namespace Internal { - namespace Adaptor { - namespace WindowSystem { +namespace +{ +static int32_t gScreenWidth = 0; +static int32_t gScreenHeight = 0; +} // unnamed namespace void Initialize() { @@ -44,30 +61,49 @@ void Shutdown() ecore_wl2_shutdown(); } -void GetScreenSize( int& width, int& height ) +void GetScreenSize(int32_t& width, int32_t& height) +{ + if(gScreenWidth == 0 || gScreenHeight == 0) + { + Ecore_Wl2_Display* display = ecore_wl2_display_connect(NULL); + if(display) + { + START_DURATION_CHECK(); + ecore_wl2_display_screen_size_get(display, &gScreenWidth, &gScreenHeight); + FINISH_DURATION_CHECK("ecore_wl2_display_screen_size_get"); + + DALI_ASSERT_ALWAYS((gScreenWidth > 0) && "screen width is 0"); + DALI_ASSERT_ALWAYS((gScreenHeight > 0) && "screen height is 0"); + } + } + width = gScreenWidth; + height = gScreenHeight; +} + +void UpdateScreenSize() { - Ecore_Wl2_Display* display = ecore_wl2_display_connect( NULL ); - if( display ) + Ecore_Wl2_Display* display = ecore_wl2_display_connect(NULL); + if(display) { - ecore_wl2_display_screen_size_get( display, &width, &height ); - DALI_ASSERT_ALWAYS((width>0) && "screen width is 0"); - DALI_ASSERT_ALWAYS((height>0) && "screen height is 0"); + START_DURATION_CHECK(); + ecore_wl2_display_screen_size_get(display, &gScreenWidth, &gScreenHeight); + FINISH_DURATION_CHECK("ecore_wl2_display_screen_size_get"); } } -bool SetKeyboardRepeatInfo( float rate, float delay ) +bool SetKeyboardRepeatInfo(float rate, float delay) { - Ecore_Wl2_Input* input = ecore_wl2_input_default_input_get( ecore_wl2_connected_display_get( NULL ) ); - return ecore_wl2_input_keyboard_repeat_set( input, static_cast( rate ), static_cast( delay ) ); + Ecore_Wl2_Input* input = ecore_wl2_input_default_input_get(ecore_wl2_connected_display_get(NULL)); + return ecore_wl2_input_keyboard_repeat_set(input, static_cast(rate), static_cast(delay)); } -bool GetKeyboardRepeatInfo( float& rate, float& delay ) +bool GetKeyboardRepeatInfo(float& rate, float& delay) { - Ecore_Wl2_Input* input = ecore_wl2_input_default_input_get( ecore_wl2_connected_display_get( NULL ) ); - double rateVal, delayVal; - bool ret = ecore_wl2_input_keyboard_repeat_get( input, &rateVal, &delayVal ); - rate = static_cast( rateVal ); - delay = static_cast( delayVal ); + Ecore_Wl2_Input* input = ecore_wl2_input_default_input_get(ecore_wl2_connected_display_get(NULL)); + double rateVal, delayVal; + bool ret = ecore_wl2_input_keyboard_repeat_get(input, &rateVal, &delayVal); + rate = static_cast(rateVal); + delay = static_cast(delayVal); return ret; }