From: Adeel Kazmi Date: Tue, 17 Mar 2015 10:05:44 +0000 (+0000) Subject: Change the width and height of a dali-window through an environment option X-Git-Tag: dali_1.0.34~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F47%2F36947%2F1;p=platform%2Fcore%2Fuifw%2Fdali-adaptor.git Change the width and height of a dali-window through an environment option Change-Id: Ib74f6ea9e8fd75c1cea53521cdf3a1e1657ea63b --- diff --git a/adaptors/base/environment-options.cpp b/adaptors/base/environment-options.cpp index 8f2cb00..94ae425 100644 --- a/adaptors/base/environment-options.cpp +++ b/adaptors/base/environment-options.cpp @@ -48,6 +48,8 @@ EnvironmentOptions::EnvironmentOptions() mPanMinimumDistance(-1), mPanMinimumEvents(-1), mGlesCallTime(0), + mWindowWidth( 0 ), + mWindowHeight( 0 ), mLogFunction( NULL ) { } @@ -156,6 +158,16 @@ int EnvironmentOptions::GetMinimumPanEvents() const return mPanMinimumEvents; } +unsigned int EnvironmentOptions::GetWindowWidth() const +{ + return mWindowWidth; +} + +unsigned int EnvironmentOptions::GetWindowHeight() const +{ + return mWindowHeight; +} + void EnvironmentOptions::SetPanGesturePredictionMode( unsigned int mode ) { mPanGesturePredictionMode = mode; @@ -211,6 +223,16 @@ int EnvironmentOptions::GetGlesCallTime() const return mGlesCallTime; } +void EnvironmentOptions::SetWindowWidth( int width ) +{ + mWindowWidth = width; +} + +void EnvironmentOptions::SetWindowHeight( int height ) +{ + mWindowHeight = height; +} + bool EnvironmentOptions::PerformanceServerRequired() const { return ( (GetPerformanceStatsLoggingOptions() > 0) || diff --git a/adaptors/base/environment-options.h b/adaptors/base/environment-options.h index 29336da..6c98ae1 100644 --- a/adaptors/base/environment-options.h +++ b/adaptors/base/environment-options.h @@ -30,6 +30,8 @@ namespace Adaptor /** * Contains environment options which define settings and the ability to install a log function. + * + * TODO: This file and adaptor needs cleaning up. There should not be any environment options in the adaptor class, only here! */ class EnvironmentOptions { @@ -150,6 +152,16 @@ public: int GetMinimumPanEvents() const; /** + * @return The width of the window + */ + unsigned int GetWindowWidth() const; + + /** + * @return The height of the window + */ + unsigned int GetWindowHeight() const; + + /** * @brief Sets the mode used to predict pan gesture movement * * @param[in] mode The prediction mode to use @@ -229,6 +241,16 @@ public: int GetGlesCallTime() const; /** + * @brief Sets the width of the window + */ + void SetWindowWidth( int width ); + + /** + * @brief Sets the width of the window + */ + void SetWindowHeight( int height ); + + /** * @return true if performance server is required */ bool PerformanceServerRequired() const; @@ -246,11 +268,13 @@ private: int mPanGestureMaxPredictionAmount; ///< maximum prediction amount for pan gestures int mPanGestureMinPredictionAmount; ///< minimum prediction amount for pan gestures int mPanGesturePredictionAmountAdjustment; ///< adjustment of prediction amount for pan gestures - int mPanGestureSmoothingMode; ///< prediction mode for pan gestures - float mPanGestureSmoothingAmount; ///< prediction amount for pan gestures + int mPanGestureSmoothingMode; ///< prediction mode for pan gestures + float mPanGestureSmoothingAmount; ///< prediction amount for pan gestures int mPanMinimumDistance; ///< minimum distance required before pan starts int mPanMinimumEvents; ///< minimum events required before pan starts int mGlesCallTime; ///< time in seconds between status updates + unsigned int mWindowWidth; ///< width of the window + unsigned int mWindowHeight; ///< height of the window Dali::Integration::Log::LogFunction mLogFunction; diff --git a/adaptors/base/environment-variables.h b/adaptors/base/environment-variables.h index 006b058..d0eb97d 100644 --- a/adaptors/base/environment-variables.h +++ b/adaptors/base/environment-variables.h @@ -73,6 +73,10 @@ namespace Adaptor #define DALI_GLES_CALL_TIME "DALI_GLES_CALL_TIME" +#define DALI_WINDOW_WIDTH "DALI_WINDOW_WIDTH" + +#define DALI_WINDOW_HEIGHT "DALI_WINDOW_HEIGHT" + } // namespace Adaptor } // namespace Internal diff --git a/adaptors/common/adaptor-impl.cpp b/adaptors/common/adaptor-impl.cpp index e32ae32..aeb8e3b 100644 --- a/adaptors/common/adaptor-impl.cpp +++ b/adaptors/common/adaptor-impl.cpp @@ -215,6 +215,13 @@ void Adaptor::ParseEnvironmentOptions() mEnvironmentOptions.SetGlesCallTime( glesCallTime ); } + int windowWidth(0), windowHeight(0); + if ( GetIntegerEnvironmentVariable( DALI_WINDOW_WIDTH, windowWidth ) && GetIntegerEnvironmentVariable( DALI_WINDOW_HEIGHT, windowHeight ) ) + { + mEnvironmentOptions.SetWindowWidth( windowWidth ); + mEnvironmentOptions.SetWindowHeight( windowHeight ); + } + mEnvironmentOptions.InstallLogFunction(); } @@ -305,6 +312,10 @@ void Adaptor::Initialize(Dali::Configuration::ContextLoss configuration) { Integration::SetPanGestureSmoothingAmount(mEnvironmentOptions.GetPanGestureSmoothingAmount()); } + if( mEnvironmentOptions.GetWindowWidth() && mEnvironmentOptions.GetWindowHeight() ) + { + SurfaceResized( PositionSize( 0, 0, mEnvironmentOptions.GetWindowWidth(), mEnvironmentOptions.GetWindowHeight() )); + } } Adaptor::~Adaptor()