Problem: EnvironmentOptions class was created by adaptor. The window class gets created before
environment options are parsed by the adaptor and some window managers ignore resize
requests.
Solution: Create EnvironmentOptions in Application class and pass them to Adaptor. Adaptor still
has the ability to create the class if it is not passed the options.
Change-Id: I634ebc999049fcc5e09116cbfa3a6e03f4a52563
#include <vsync-monitor.h>
#include <object-profiler.h>
#include <base/display-connection.h>
+#include <window-impl.h>
#include <tizen-logging.h>
__thread Adaptor* gThreadLocalAdaptor = NULL; // raw thread specific pointer to allow Adaptor::Get
} // unnamed namespace
-Dali::Adaptor* Adaptor::New( Any nativeWindow, RenderSurface *surface, Dali::Configuration::ContextLoss configuration )
+Dali::Adaptor* Adaptor::New( Any nativeWindow, RenderSurface *surface, Dali::Configuration::ContextLoss configuration, EnvironmentOptions* environmentOptions )
{
Dali::Adaptor* adaptor = new Dali::Adaptor;
- Adaptor* impl = new Adaptor( nativeWindow, *adaptor, surface );
+ Adaptor* impl = new Adaptor( nativeWindow, *adaptor, surface, environmentOptions );
adaptor->mImpl = impl;
impl->Initialize(configuration);
return adaptor;
}
+Dali::Adaptor* Adaptor::New( Dali::Window window, Dali::Configuration::ContextLoss configuration, EnvironmentOptions* environmentOptions )
+{
+ Any winId = window.GetNativeHandle();
+
+ Window& windowImpl = Dali::GetImplementation(window);
+ Dali::Adaptor* adaptor = New( winId, windowImpl.GetSurface(), configuration, environmentOptions );
+ windowImpl.SetAdaptor(*adaptor);
+ return adaptor;
+}
void Adaptor::Initialize( Dali::Configuration::ContextLoss configuration )
{
// all threads here (event, update, and render) will send their logs to TIZEN Platform's LogMessage handler.
Dali::Integration::Log::LogFunction logFunction( Dali::TizenPlatform::LogMessage );
- mEnvironmentOptions.SetLogFunction( logFunction );
- mEnvironmentOptions.InstallLogFunction(); // install logging for main thread
+ mEnvironmentOptions->SetLogFunction( logFunction );
+ mEnvironmentOptions->InstallLogFunction(); // install logging for main thread
mPlatformAbstraction = new TizenPlatform::TizenPlatformAbstraction;
// Note, Tizen does not use DALI_RETAINS_ALL_DATA, as it can reload images from
// files automatically.
- if( mEnvironmentOptions.PerformanceServerRequired() )
+ if( mEnvironmentOptions->PerformanceServerRequired() )
{
- mPerformanceInterface = PerformanceInterfaceFactory::CreateInterface( *this, mEnvironmentOptions );
+ mPerformanceInterface = PerformanceInterfaceFactory::CreateInterface( *this, *mEnvironmentOptions );
}
mCallbackManager = CallbackManager::New();
PositionSize size = mSurface->GetPositionSize();
- mGestureManager = new GestureManager(*this, Vector2(size.width, size.height), mCallbackManager, mEnvironmentOptions);
+ mGestureManager = new GestureManager(*this, Vector2(size.width, size.height), mCallbackManager, *mEnvironmentOptions);
- if( mEnvironmentOptions.GetGlesCallTime() > 0 )
+ if( mEnvironmentOptions->GetGlesCallTime() > 0 )
{
- mGLES = new GlProxyImplementation( mEnvironmentOptions );
+ mGLES = new GlProxyImplementation( *mEnvironmentOptions );
}
else
{
mVSyncMonitor = new VSyncMonitor;
- mUpdateRenderController = new UpdateRenderController( *this, mEnvironmentOptions );
+ mUpdateRenderController = new UpdateRenderController( *this, *mEnvironmentOptions );
mDaliFeedbackPlugin = new FeedbackPluginProxy( FeedbackPluginProxy::DEFAULT_OBJECT_NAME );
// Should be called after Core creation
- if( mEnvironmentOptions.GetPanGestureLoggingLevel() )
+ if( mEnvironmentOptions->GetPanGestureLoggingLevel() )
{
Integration::EnableProfiling( Dali::Integration::PROFILING_TYPE_PAN_GESTURE );
}
- if( mEnvironmentOptions.GetPanGesturePredictionMode() >= 0 )
+ if( mEnvironmentOptions->GetPanGesturePredictionMode() >= 0 )
{
- Integration::SetPanGesturePredictionMode(mEnvironmentOptions.GetPanGesturePredictionMode());
+ Integration::SetPanGesturePredictionMode(mEnvironmentOptions->GetPanGesturePredictionMode());
}
- if( mEnvironmentOptions.GetPanGesturePredictionAmount() >= 0 )
+ if( mEnvironmentOptions->GetPanGesturePredictionAmount() >= 0 )
{
- Integration::SetPanGesturePredictionAmount(mEnvironmentOptions.GetPanGesturePredictionAmount());
+ Integration::SetPanGesturePredictionAmount(mEnvironmentOptions->GetPanGesturePredictionAmount());
}
- if( mEnvironmentOptions.GetPanGestureMaximumPredictionAmount() >= 0 )
+ if( mEnvironmentOptions->GetPanGestureMaximumPredictionAmount() >= 0 )
{
- Integration::SetPanGestureMaximumPredictionAmount(mEnvironmentOptions.GetPanGestureMaximumPredictionAmount());
+ Integration::SetPanGestureMaximumPredictionAmount(mEnvironmentOptions->GetPanGestureMaximumPredictionAmount());
}
- if( mEnvironmentOptions.GetPanGestureMinimumPredictionAmount() >= 0 )
+ if( mEnvironmentOptions->GetPanGestureMinimumPredictionAmount() >= 0 )
{
- Integration::SetPanGestureMinimumPredictionAmount(mEnvironmentOptions.GetPanGestureMinimumPredictionAmount());
+ Integration::SetPanGestureMinimumPredictionAmount(mEnvironmentOptions->GetPanGestureMinimumPredictionAmount());
}
- if( mEnvironmentOptions.GetPanGesturePredictionAmountAdjustment() >= 0 )
+ if( mEnvironmentOptions->GetPanGesturePredictionAmountAdjustment() >= 0 )
{
- Integration::SetPanGesturePredictionAmountAdjustment(mEnvironmentOptions.GetPanGesturePredictionAmountAdjustment());
+ Integration::SetPanGesturePredictionAmountAdjustment(mEnvironmentOptions->GetPanGesturePredictionAmountAdjustment());
}
- if( mEnvironmentOptions.GetPanGestureSmoothingMode() >= 0 )
+ if( mEnvironmentOptions->GetPanGestureSmoothingMode() >= 0 )
{
- Integration::SetPanGestureSmoothingMode(mEnvironmentOptions.GetPanGestureSmoothingMode());
+ Integration::SetPanGestureSmoothingMode(mEnvironmentOptions->GetPanGestureSmoothingMode());
}
- if( mEnvironmentOptions.GetPanGestureSmoothingAmount() >= 0.0f )
+ if( mEnvironmentOptions->GetPanGestureSmoothingAmount() >= 0.0f )
{
- Integration::SetPanGestureSmoothingAmount(mEnvironmentOptions.GetPanGestureSmoothingAmount());
- }
- if( mEnvironmentOptions.GetWindowWidth() && mEnvironmentOptions.GetWindowHeight() )
- {
- SurfaceResized( PositionSize( 0, 0, mEnvironmentOptions.GetWindowWidth(), mEnvironmentOptions.GetWindowHeight() ));
+ Integration::SetPanGestureSmoothingAmount(mEnvironmentOptions->GetPanGestureSmoothingAmount());
}
}
// uninstall it on this thread (main actor thread)
Dali::Integration::Log::UninstallLogFunction();
+
+ // Delete environment options if we own it
+ if( mEnvironmentOptionsOwned )
+ {
+ delete mEnvironmentOptions;
+ }
}
void Adaptor::Start()
mNotificationOnIdleInstalled = false;
}
-Adaptor::Adaptor(Any nativeWindow, Dali::Adaptor& adaptor, RenderSurface* surface)
+Adaptor::Adaptor(Any nativeWindow, Dali::Adaptor& adaptor, RenderSurface* surface, EnvironmentOptions* environmentOptions)
: mResizedSignal(),
mLanguageChangedSignal(),
mAdaptor(adaptor),
mObservers(),
mDragAndDropDetector(),
mDeferredRotationObserver(NULL),
- mEnvironmentOptions(),
+ mEnvironmentOptions( environmentOptions ? environmentOptions : new EnvironmentOptions /* Create the options if not provided */),
mPerformanceInterface(NULL),
- mObjectProfiler(NULL)
+ mObjectProfiler(NULL),
+ mEnvironmentOptionsOwned( environmentOptions ? false : true /* If not provided then we own the object */ )
{
DALI_ASSERT_ALWAYS( !IsAvailable() && "Cannot create more than one Adaptor per thread" );
gThreadLocalAdaptor = this;
{
class RenderSurface;
+class Window;
namespace Integration
{
/**
* Creates a New Adaptor
- * @param[in] nativeWindow native window handle
- * @param[in] surface A render surface can be one of the following
- * - Pixmap, adaptor will use existing Pixmap to draw on to
- * - Window, adaptor will use existing Window to draw on to
- * @param[in] configuration The context loss configuration ( to choose resource discard policy )
+ * @param[in] nativeWindow Native window handle
+ * @param[in] surface A render surface can be one of the following
+ * - Pixmap, adaptor will use existing Pixmap to draw on to
+ * - Window, adaptor will use existing Window to draw on to
+ * @param[in] configuration The context loss configuration ( to choose resource discard policy )
+ * @param[in] environmentOptions A pointer to the environment options. If NULL then one is created.
*/
static Dali::Adaptor* New( Any nativeWindow,
RenderSurface* surface,
- Dali::Configuration::ContextLoss configuration );
+ Dali::Configuration::ContextLoss configuration,
+ EnvironmentOptions* environmentOptions );
+
+ /**
+ * Creates a New Adaptor
+ * @param[in] nativeWindow native window handle
+ * @param[in] configuration The context loss configuration ( to choose resource discard policy )
+ * @param[in] environmentOptions A pointer to the environment options. If NULL then one is created.
+ */
+ static Dali::Adaptor* New( Dali::Window window, Dali::Configuration::ContextLoss configuration, EnvironmentOptions* environmentOptions );
/**
* 2-step initialisation, this should be called after creating an adaptor instance.
* @param[in] surface A render surface can be one of the following
* - Pixmap, adaptor will use existing Pixmap to draw on to
* - Window, adaptor will use existing Window to draw on to
+ * @param[in] environmentOptions A pointer to the environment options. If NULL then one is created.
*/
- Adaptor( Any nativeWindow, Dali::Adaptor& adaptor, RenderSurface* surface );
+ Adaptor( Any nativeWindow, Dali::Adaptor& adaptor, RenderSurface* surface, EnvironmentOptions* environmentOptions );
private: // Types
ObserverContainer mObservers; ///< A list of adaptor observer pointers
DragAndDropDetectorPtr mDragAndDropDetector; ///< The Drag & Drop detector
RotationObserver* mDeferredRotationObserver; ///< deferred Rotation observer needs event handler
- EnvironmentOptions mEnvironmentOptions; ///< environment options
+ EnvironmentOptions* mEnvironmentOptions; ///< environment options
PerformanceInterface* mPerformanceInterface; ///< Performance interface
KernelTrace mKernelTracer; ///< Kernel tracer
SystemTrace mSystemTracer; ///< System tracer
TriggerEventFactory mTriggerEventFactory; ///< Trigger event factory
ObjectProfiler* mObjectProfiler; ///< Tracks object lifetime for profiling
SocketFactory mSocketFactory; ///< Socket factory
+ const bool mEnvironmentOptionsOwned:1; ///< Whether we own the EnvironmentOptions (and thus, need to delete it)
public:
inline static Adaptor& GetImplementation(Dali::Adaptor& adaptor) {return *adaptor.mImpl;}
};
#include <accessibility-manager.h>
#include <imf-manager.h>
#include <style-monitor.h>
-#include <window.h>
#include <render-surface.h>
#include <adaptor-impl.h>
-#include <window-impl.h>
namespace Dali
{
Adaptor& Adaptor::New( Window window, Configuration::ContextLoss configuration )
{
- Any winId = window.GetNativeHandle();
-
- Internal::Adaptor::Window& windowImpl = GetImplementation(window);
- Adaptor* adaptor = Internal::Adaptor::Adaptor::New( winId, windowImpl.GetSurface(), configuration );
- windowImpl.SetAdaptor(*adaptor);
+ Adaptor* adaptor = Internal::Adaptor::Adaptor::New( window, configuration, NULL );
return *adaptor;
}
Adaptor& Adaptor::New( Any nativeWindow, const Dali::RenderSurface& surface, Configuration::ContextLoss configuration )
{
Dali::RenderSurface* pSurface = const_cast<Dali::RenderSurface *>(&surface);
- Adaptor* adaptor = Internal::Adaptor::Adaptor::New( nativeWindow, pSurface, configuration );
+ Adaptor* adaptor = Internal::Adaptor::Adaptor::New( nativeWindow, pSurface, configuration, NULL );
return *adaptor;
}
mMemoryLowSignal(),
mEventLoop( NULL ),
mFramework( NULL ),
+ mContextLossConfiguration( Configuration::APPLICATION_DOES_NOT_HANDLE_CONTEXT_LOSS ),
mCommandLineOptions( NULL ),
mSingletonService( SingletonService::New() ),
mAdaptor( NULL ),
mWindowMode( windowMode ),
mName(),
mStylesheet( stylesheet ),
+ mEnvironmentOptions(),
mInitialized( false ),
mSlotDelegate( this )
{
mCommandLineOptions = new CommandLineOptions(argc, argv);
- mFramework = new Framework(*this, argc, argv, mName);
+ mFramework = new Framework( *this, argc, argv );
}
Application::~Application()
if( mCommandLineOptions->stageWidth > 0 && mCommandLineOptions->stageHeight > 0 )
{
- // let the command line options over ride
+ // Command line options override environment options and full screen
windowPosition = PositionSize( 0, 0, mCommandLineOptions->stageWidth, mCommandLineOptions->stageHeight );
}
+ else if( mEnvironmentOptions.GetWindowWidth() && mEnvironmentOptions.GetWindowHeight() )
+ {
+ // Environment options override full screen functionality if command line arguments not provided
+ windowPosition = PositionSize( 0, 0, mEnvironmentOptions.GetWindowWidth(), mEnvironmentOptions.GetWindowHeight() );
+ }
mWindow = Dali::Window::New( windowPosition, mName, mWindowMode == Dali::Application::TRANSPARENT );
}
{
DALI_ASSERT_ALWAYS( mWindow && "Window required to create adaptor" );
- mAdaptor = &Dali::Adaptor::New( mWindow, mContextLossConfiguration );
+ mAdaptor = Dali::Internal::Adaptor::Adaptor::New( mWindow, mContextLossConfiguration, &mEnvironmentOptions );
mAdaptor->ResizedSignal().Connect( mSlotDelegate, &Application::OnResize );
}
#include <framework.h>
#include <window-impl.h>
+#include <base/environment-options.h>
namespace Dali
{
Dali::Application::WINDOW_MODE mWindowMode;
std::string mName;
std::string mStylesheet;
+ EnvironmentOptions mEnvironmentOptions;
bool mInitialized;
* @param[in] argc A pointer to the number of arguments.
* @param[in] argv A pointer the the argument list.
*/
- Framework(Observer& observer, int* argc, char ***argv, const std::string& name);
+ Framework( Observer& observer, int* argc, char ***argv );
/**
* Destructor
bool mRunning;
int* mArgc;
char*** mArgv;
- std::string mName;
std::string mBundleName;
std::string mBundleId;
AbortHandler mAbortHandler;
};
-Framework::Framework(Framework::Observer& observer, int *argc, char ***argv, const std::string& name)
+Framework::Framework( Framework::Observer& observer, int *argc, char ***argv )
: mObserver(observer),
mInitialised(false),
mRunning(false),
mArgc(argc),
mArgv(argv),
- mName(name),
mBundleName(""),
mBundleId(""),
mAbortHandler( MakeCallback( this, &Framework::AbortCallback ) ),
};
-Framework::Framework(Framework::Observer& observer, int *argc, char ***argv, const std::string& name)
+Framework::Framework( Framework::Observer& observer, int *argc, char ***argv )
: mObserver(observer),
mInitialised(false),
mRunning(false),
mArgc(argc),
mArgv(argv),
- mName(name),
mBundleName(""),
mBundleId(""),
mAbortHandler( MakeCallback( this, &Framework::AbortCallback ) ),