Change the width and height of a dali-window through an environment option 47/36947/1
authorAdeel Kazmi <adeel.kazmi@samsung.com>
Tue, 17 Mar 2015 10:05:44 +0000 (10:05 +0000)
committerAdeel Kazmi <adeel.kazmi@samsung.com>
Tue, 17 Mar 2015 10:05:44 +0000 (10:05 +0000)
Change-Id: Ib74f6ea9e8fd75c1cea53521cdf3a1e1657ea63b

adaptors/base/environment-options.cpp
adaptors/base/environment-options.h
adaptors/base/environment-variables.h
adaptors/common/adaptor-impl.cpp

index 8f2cb00..94ae425 100644 (file)
@@ -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) ||
index 29336da..6c98ae1 100644 (file)
@@ -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;
 
index 006b058..d0eb97d 100644 (file)
@@ -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
index e32ae32..aeb8e3b 100644 (file)
@@ -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()