/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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.
mEventHandler->FeedKeyEvent( keyEvent );
}
-bool Adaptor::MoveResize( const PositionSize& positionSize )
-{
- PositionSize old = mSurface->GetPositionSize();
-
- // just resize the surface. The driver should automatically resize the egl Surface (untested)
- // EGL Spec says : EGL window surfaces need to be resized when their corresponding native window
- // is resized. Implementations typically use hooks into the OS and native window
- // system to perform this resizing on demand, transparently to the client.
- mSurface->MoveResize( positionSize );
-
- if(old.width != positionSize.width || old.height != positionSize.height)
- {
- SurfaceSizeChanged(positionSize);
- }
-
- return true;
-}
-
-void Adaptor::SurfaceResized( const PositionSize& positionSize )
-{
- PositionSize old = mSurface->GetPositionSize();
-
- // Called by an application, when it has resized a window outside of Dali.
- // The EGL driver automatically detects X Window resize calls, and resizes
- // the EGL surface for us.
- mSurface->MoveResize( positionSize );
-
- if(old.width != positionSize.width || old.height != positionSize.height)
- {
- SurfaceSizeChanged(positionSize);
- }
-}
-
void Adaptor::ReplaceSurface( Any nativeWindow, RenderSurface& surface )
{
mNativeWindow = nativeWindow;
RequestUpdate();
}
-void Adaptor::SurfaceSizeChanged( const PositionSize& positionSize )
+void Adaptor::SurfaceSizeChanged( Dali::Adaptor::SurfaceSize surfaceSize )
{
// let the core know the surface size has changed
- mCore->SurfaceResized(positionSize.width, positionSize.height);
+ mCore->SurfaceResized( surfaceSize.GetWidth(), surfaceSize.GetHeight() );
mResizedSignal.Emit( mAdaptor );
}
#define __DALI_INTERNAL_ADAPTOR_IMPL_H__
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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.
virtual void FeedKeyEvent( KeyEvent& keyEvent );
/**
- * @copydoc AdaptorInterface::MoveResize()
- */
- virtual bool MoveResize( const PositionSize& positionSize );
-
- /**
- * @copydoc AdaptorInterface::SurfaceResized()
- */
- virtual void SurfaceResized( const PositionSize& positionSize );
-
- /**
* @copydoc AdaptorInterface::ReplaceSurface()
*/
virtual void ReplaceSurface( Any nativeWindow, RenderSurface& surface );
/**
* Informs core the surface size has changed
*/
- void SurfaceSizeChanged( const PositionSize& positionSize );
+ void SurfaceSizeChanged( Dali::Adaptor::SurfaceSize surfaceSize );
public: //AdaptorInternalServices
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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.
mImpl->SetStereoBase( stereoBase );
}
-void Adaptor::SurfaceSizeChanged( const PositionSize& positionSize )
+void Adaptor::SurfaceSizeChanged( SurfaceSize surfaceSize )
{
- mImpl->SurfaceSizeChanged( positionSize );
+ mImpl->SurfaceSizeChanged( surfaceSize );
}
Adaptor::Adaptor()
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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.
char **argv[],
const std::string& stylesheet,
Dali::Application::WINDOW_MODE windowMode,
+ const PositionSize& positionSize,
Framework::Type applicationType)
{
- ApplicationPtr application ( new Application (argc, argv, stylesheet, windowMode, applicationType ) );
+ ApplicationPtr application ( new Application (argc, argv, stylesheet, windowMode, positionSize, applicationType ) );
return application;
}
Application::Application( int* argc, char** argv[], const std::string& stylesheet,
- Dali::Application::WINDOW_MODE windowMode, Framework::Type applicationType )
+ Dali::Application::WINDOW_MODE windowMode, const PositionSize& positionSize, Framework::Type applicationType )
: mInitSignal(),
mTerminateSignal(),
mPauseSignal(),
mName(),
mStylesheet( stylesheet ),
mEnvironmentOptions(),
+ mWindowPositionSize( positionSize ),
mSlotDelegate( this )
{
// Get mName from environment options
void Application::CreateWindow()
{
- PositionSize windowPosition(0, 0, 0, 0); // this will use full screen
-
- if( mCommandLineOptions->stageWidth > 0 && mCommandLineOptions->stageHeight > 0 )
- {
- // Command line options override environment options and full screen
- windowPosition = PositionSize( 0, 0, mCommandLineOptions->stageWidth, mCommandLineOptions->stageHeight );
- }
- else if( mEnvironmentOptions.GetWindowWidth() && mEnvironmentOptions.GetWindowHeight() )
+ if( mWindowPositionSize.width == 0 && mWindowPositionSize.height == 0 )
{
- // Environment options override full screen functionality if command line arguments not provided
- windowPosition = PositionSize( 0, 0, mEnvironmentOptions.GetWindowWidth(), mEnvironmentOptions.GetWindowHeight() );
+ if( mCommandLineOptions->stageWidth > 0 && mCommandLineOptions->stageHeight > 0 )
+ {
+ // Command line options override environment options and full screen
+ mWindowPositionSize.width = mCommandLineOptions->stageWidth;
+ mWindowPositionSize.height = mCommandLineOptions->stageHeight;
+ }
+ else if( mEnvironmentOptions.GetWindowWidth() && mEnvironmentOptions.GetWindowHeight() )
+ {
+ // Environment options override full screen functionality if command line arguments not provided
+ mWindowPositionSize.width = mEnvironmentOptions.GetWindowWidth();
+ mWindowPositionSize.height = mEnvironmentOptions.GetWindowHeight();
+ }
}
const std::string& windowClassName = mEnvironmentOptions.GetWindowClassName();
- mWindow = Dali::Window::New( windowPosition, mName, windowClassName, mWindowMode == Dali::Application::TRANSPARENT );
+ mWindow = Dali::Window::New( mWindowPositionSize, mName, windowClassName, mWindowMode == Dali::Application::TRANSPARENT );
// Quit the application when the window is closed
GetImplementation( mWindow ).DeleteRequestSignal().Connect( mSlotDelegate, &Application::Quit );
}
-void Application::ReplaceWindow(PositionSize windowPosition, const std::string& name)
+void Application::ReplaceWindow( const PositionSize& positionSize, const std::string& name )
{
- Dali::Window newWindow = Dali::Window::New( windowPosition, name, mWindowMode == Dali::Application::TRANSPARENT );
+ Dali::Window newWindow = Dali::Window::New( positionSize, name, mWindowMode == Dali::Application::TRANSPARENT );
Window& windowImpl = GetImplementation(newWindow);
windowImpl.SetAdaptor(*mAdaptor);
newWindow.ShowIndicator(Dali::Window::INVISIBLE);
Dali::RenderSurface* renderSurface = windowImpl.GetSurface();
Any nativeWindow = newWindow.GetNativeHandle();
- Internal::Adaptor::Adaptor::GetImplementation( *mAdaptor ).SurfaceSizeChanged( windowPosition );
+ Internal::Adaptor::Adaptor::GetImplementation( *mAdaptor ).SurfaceSizeChanged( Dali::Adaptor::SurfaceSize( positionSize.width, positionSize.height ) );
Internal::Adaptor::Adaptor::GetImplementation( *mAdaptor ).ReplaceSurface(nativeWindow, *renderSurface);
mWindow = newWindow;
+ mWindowPositionSize = positionSize;
}
std::string Application::GetResourcePath()
#define __DALI_INTERNAL_APPLICATION_H__
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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.
/**
* Create a new application
- * @param[in] argc A pointer to the number of arguments
- * @param[in] argv A pointer to the argument list
- * @param[in] stylesheet The path to user defined theme file
- * @param[in] windowMode A member of Dali::Application::WINDOW_MODE
+ * @param[in] argc A pointer to the number of arguments
+ * @param[in] argv A pointer to the argument list
+ * @param[in] stylesheet The path to user defined theme file
+ * @param[in] windowMode A member of Dali::Application::WINDOW_MODE
+ * @param[in] positionSize A position and a size of the window
* @param[in] applicationType A member of Dali::Framework::Type
*/
static ApplicationPtr New( int* argc, char **argv[], const std::string& stylesheet,
- WINDOW_MODE windowMode, Framework::Type applicationType );
+ WINDOW_MODE windowMode, const PositionSize& positionSize, Framework::Type applicationType );
public:
/**
* @copydoc Dali::Application::ReplaceWindow();
*/
- void ReplaceWindow(PositionSize windowPosition, const std::string& name);
+ void ReplaceWindow( const PositionSize& positionSize, const std::string& name);
/**
* @copydoc Dali::Application::GetResourcePath();
/**
* Private Constructor
- * @param[in] argc A pointer to the number of arguments
- * @param[in] argv A pointer to the argument list
- * @param[in] stylesheet The path to user defined theme file
- * @param[in] windowMode A member of Dali::Application::WINDOW_MODE
+ * @param[in] argc A pointer to the number of arguments
+ * @param[in] argv A pointer to the argument list
+ * @param[in] stylesheet The path to user defined theme file
+ * @param[in] windowMode A member of Dali::Application::WINDOW_MODE
+ * @param[in] positionSize A position and a size of the window
+ * @param[in] applicationType A member of Dali::Framework::Type
*/
Application( int* argc, char **argv[], const std::string& stylesheet,
- WINDOW_MODE windowMode, Framework::Type applicationType );
+ WINDOW_MODE windowMode, const PositionSize& positionSize, Framework::Type applicationType );
/**
* Destructor
std::string mName;
std::string mStylesheet;
EnvironmentOptions mEnvironmentOptions;
+ PositionSize mWindowPositionSize;
bool mUseRemoteSurface;
SlotDelegate< Application > mSlotDelegate;
/**
* Create a new Window. This should only be called once by the Application class
- * @param[in] windowPosition The position and size of the window
+ * @param[in] positionSize The position and size of the window
* @param[in] name The window title
* @param[in] className The window class name
* @param[in] isTransparent Whether window is transparent
* @return A newly allocated Window
*/
- static Window* New(const PositionSize& posSize, const std::string& name, const std::string& className, bool isTransparent = false);
+ static Window* New(const PositionSize& positionSize, const std::string& name, const std::string& className, bool isTransparent = false);
/**
* Pass the adaptor back to the overlay. This allows the window to access Core's overlay.
int GetBrightness();
/**
+ * @copydoc Dali::DevelWindow::SetSize()
+ */
+ void SetSize( Dali::DevelWindow::WindowSize size );
+
+ /**
+ * @copydoc Dali::DevelWindow::GetSize()
+ */
+ Dali::DevelWindow::WindowSize GetSize();
+
+ /**
+ * @copydoc Dali::DevelWindow::SetPosition()
+ */
+ void SetPosition( Dali::DevelWindow::WindowPosition position );
+
+ /**
+ * @copydoc Dali::DevelWindow::GetPosition()
+ */
+ Dali::DevelWindow::WindowPosition GetPosition();
+
+ /**
* Called from Orientation after the Change signal has been sent
*/
void RotationDone( int orientation, int width, int height );
/**
* Second stage initialization
*/
- void Initialize(const PositionSize& posSize, const std::string& name, const std::string& className);
+ void Initialize(const PositionSize& positionSize, const std::string& name, const std::string& className);
/**
* Shows / hides the indicator bar.
bool mIsFocusAcceptable:1;
bool mVisible:1;
bool mOpaqueState:1;
+ bool mResizeEnabled:1;
IndicatorInterface* mIndicator;
Dali::Window::WindowOrientation mIndicatorOrientation;
Dali::Window::WindowOrientation mNextIndicatorOrientation;
--- /dev/null
+/*
+ * Copyright (c) 2017 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <adaptors/devel-api/adaptor-framework/application-devel.h>
+#include <adaptors/common/application-impl.h>
+
+namespace Dali
+{
+
+namespace DevelApplication
+{
+
+Application New( int* argc, char **argv[], const std::string& stylesheet, Application::WINDOW_MODE windowMode, PositionSize positionSize )
+{
+ Internal::Adaptor::ApplicationPtr internal = Internal::Adaptor::Application::New( argc, argv, stylesheet, windowMode, positionSize, Internal::Adaptor::Framework::NORMAL );
+ return Application( internal.Get() );
+}
+
+} // namespace DevelApplication
+
+} // namespace Dali
--- /dev/null
+#ifndef DALI_APPLICATION_DEVEL_H
+#define DALI_APPLICATION_DEVEL_H
+
+/*
+ * Copyright (c) 2017 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// INTERNAL INCLUDES
+#ifdef DALI_ADAPTOR_COMPILATION // full path doesn't exist until adaptor is installed so we have to use relative
+#include <application.h>
+#else
+#include <dali/public-api/adaptor-framework/application.h>
+#endif
+
+namespace Dali
+{
+
+namespace DevelApplication
+{
+
+/**
+ * @brief This is the constructor for applications.
+ *
+ * @PRIVLEVEL_PUBLIC
+ * @PRIVILEGE_DISPLAY
+ * @param[in,out] argc A pointer to the number of arguments
+ * @param[in,out] argv A pointer to the argument list
+ * @param[in] stylesheet The path to user defined theme file
+ * @param[in] windowMode A member of WINDOW_MODE
+ * @param[in] positionSize A position and a size of the window
+ * @return A handle to the Application
+ * @note If the stylesheet is not specified, then the library's default stylesheet will not be overridden.
+ */
+DALI_IMPORT_API Application New( int* argc, char **argv[], const std::string& stylesheet, Application::WINDOW_MODE windowMode, PositionSize positionSize );
+
+} // namespace DevelApplication
+
+} // namespace Dali
+
+#endif // DALI_APPLICATION_DEVEL_H
return GetImplementation( window ).ResizedSignal();
}
+void SetSize( Window window, WindowSize size )
+{
+ GetImplementation( window ).SetSize( size );
+}
+
+WindowSize GetSize( Window window )
+{
+ return GetImplementation( window ).GetSize();
+}
+
+void SetPosition( Window window, WindowPosition position )
+{
+ GetImplementation( window ).SetPosition( position );
+}
+
+WindowPosition GetPosition( Window window )
+{
+ return GetImplementation( window ).GetPosition();
+}
+
} // namespace DevelWindow
} // namespace Dali
// EXTERNAL INCLUDES
#include <string>
#include <dali/public-api/math/rect.h>
+#include <dali/public-api/math/uint-16-pair.h>
// INTERNAL INCLUDES
#ifdef DALI_ADAPTOR_COMPILATION // full path doesn't exist until adaptor is installed so we have to use relative
DIALOG ///< Used for simple dialog windows.
};
-typedef Signal< void (bool) > FocusSignalType; ///< Window focus signal type
-typedef Signal< void (int, int) > ResizedSignalType; ///< Window resized signal type
+typedef Uint16Pair WindowSize; ///< Window size type
+typedef Uint16Pair WindowPosition; ///< Window position type
+
+typedef Signal< void ( bool ) > FocusSignalType; ///< Window focus signal type
+typedef Signal< void ( WindowSize ) > ResizedSignalType; ///< Window resized signal type
/**
* @brief The user should connect to this signal to get a timing when window gains focus or loses focus.
*/
DALI_IMPORT_API ResizedSignalType& ResizedSignal( Window window );
+/**
+ * @brief Sets a size of the window.
+ *
+ * @param[in] window The window to set a size
+ * @param[in] size The new window size
+ */
+DALI_IMPORT_API void SetSize( Window window, WindowSize size );
+
+/**
+ * @brief Gets a size of the window.
+ *
+ * @param[in] window The window to get a size
+ * @return The size of the window
+ */
+DALI_IMPORT_API WindowSize GetSize( Window window );
+
+/**
+ * @brief Sets a position of the window.
+ *
+ * @param[in] window The window to set a position
+ * @param[in] position The new window position
+ */
+DALI_IMPORT_API void SetPosition( Window window, WindowPosition position );
+
+/**
+ * @brief Gets a position of the window.
+ *
+ * @param[in] window The window to get a position
+ * @return The position of the window
+ */
+DALI_IMPORT_API WindowPosition GetPosition( Window window );
+
} // namespace DevelWindow
} // namespace Dali
devel_api_src_files = \
$(adaptor_devel_api_dir)/adaptor-framework/accessibility-adaptor.cpp \
+ $(adaptor_devel_api_dir)/adaptor-framework/application-devel.cpp \
$(adaptor_devel_api_dir)/adaptor-framework/application-extensions.cpp \
$(adaptor_devel_api_dir)/adaptor-framework/bitmap-loader.cpp \
$(adaptor_devel_api_dir)/adaptor-framework/bitmap-saver.cpp \
$(adaptor_devel_api_dir)/adaptor-framework/accessibility-adaptor.h \
$(adaptor_devel_api_dir)/adaptor-framework/accessibility-action-handler.h \
$(adaptor_devel_api_dir)/adaptor-framework/accessibility-gesture-handler.h \
+ $(adaptor_devel_api_dir)/adaptor-framework/application-devel.h \
$(adaptor_devel_api_dir)/adaptor-framework/application-extensions.h \
$(adaptor_devel_api_dir)/adaptor-framework/bitmap-loader.h \
$(adaptor_devel_api_dir)/adaptor-framework/bitmap-saver.h \
bool mBrightnessChangeDone;
};
-Window* Window::New(const PositionSize& posSize, const std::string& name, const std::string& className, bool isTransparent)
+Window* Window::New( const PositionSize& positionSize, const std::string& name, const std::string& className, bool isTransparent )
{
Window* window = new Window();
window->mIsTransparent = isTransparent;
- window->Initialize(posSize, name, className);
+ window->Initialize( positionSize, name, className );
return window;
}
mIsFocusAcceptable( true ),
mVisible( true ),
mOpaqueState( false ),
+ mResizeEnabled( false ),
mIndicator( NULL ),
mIndicatorOrientation( Dali::Window::PORTRAIT ),
mNextIndicatorOrientation( Dali::Window::PORTRAIT ),
mAuxiliaryHints.clear();
}
-void Window::Initialize(const PositionSize& windowPosition, const std::string& name, const std::string& className)
+void Window::Initialize(const PositionSize& positionSize, const std::string& name, const std::string& className)
{
// create an Wayland window by default
Any surface;
- ECore::WindowRenderSurface* windowSurface = new ECore::WindowRenderSurface( windowPosition, surface, name, mIsTransparent );
+ ECore::WindowRenderSurface* windowSurface = new ECore::WindowRenderSurface( positionSize, surface, name, mIsTransparent );
mSurface = windowSurface;
- SetClass( name, className );
- windowSurface->Map();
-
- mOrientation = Orientation::New(this);
// create event handler for Wayland window
mEventHandler = new EventHandler( this );
DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::Initialize: %s\n", hint );
}
}
+
+ if( !positionSize.IsEmpty() )
+ {
+ AddAuxiliaryHint( "wm.policy.win.user.geometry", "1" );
+ mResizeEnabled = true;
+ }
+
+ SetClass( name, className );
+ windowSurface->Map();
+
+ mOrientation = Orientation::New(this);
}
void Window::DoShowIndicator( Dali::Window::WindowOrientation lastOrientation )
void Window::RotationDone( int orientation, int width, int height )
{
- PositionSize positionSize( 0, 0, width, height );
-
- mAdaptor->SurfaceSizeChanged( positionSize );
+ mAdaptor->SurfaceSizeChanged( Dali::Adaptor::SurfaceSize( width, height ) );
// Emit signal
- mResizedSignal.Emit( positionSize.width, positionSize.height );
+ mResizedSignal.Emit( Dali::DevelWindow::WindowSize( width, height ) );
Dali::Window::WindowOrientation windowOrientation;
switch( orientation )
}
ECore::WindowRenderSurface* wlSurface( dynamic_cast< ECore::WindowRenderSurface * >( mSurface ) );
- wlSurface->RequestRotation( windowOrientation, positionSize.width, positionSize.height );
+ wlSurface->RequestRotation( windowOrientation, width, height );
}
unsigned int Window::GetSupportedAuxiliaryHintCount()
return mEventHandler->mBrightness;
}
+void Window::SetSize( Dali::DevelWindow::WindowSize size )
+{
+ if( !mResizeEnabled )
+ {
+ AddAuxiliaryHint( "wm.policy.win.user.geometry", "1" );
+ mResizeEnabled = true;
+ }
+
+ PositionSize positionSize = mSurface->GetPositionSize();
+
+ if( positionSize.width != size.GetWidth() || positionSize.height != size.GetHeight() )
+ {
+ positionSize.width = size.GetWidth();
+ positionSize.height = size.GetHeight();
+
+ mSurface->MoveResize( positionSize );
+
+ mAdaptor->SurfaceSizeChanged( Dali::Adaptor::SurfaceSize( positionSize.width, positionSize.height ) );
+
+ // Emit signal
+ mResizedSignal.Emit( Dali::DevelWindow::WindowSize( positionSize.width, positionSize.height ) );
+ }
+}
+
+Dali::DevelWindow::WindowSize Window::GetSize()
+{
+ PositionSize positionSize = mSurface->GetPositionSize();
+
+ return Dali::DevelWindow::WindowSize( positionSize.width, positionSize.height );
+}
+
+void Window::SetPosition( Dali::DevelWindow::WindowPosition position )
+{
+ if( !mResizeEnabled )
+ {
+ AddAuxiliaryHint( "wm.policy.win.user.geometry", "1" );
+ mResizeEnabled = true;
+ }
+
+ PositionSize positionSize = mSurface->GetPositionSize();
+
+ if( positionSize.x != position.GetX() || positionSize.y != position.GetY() )
+ {
+ positionSize.x = position.GetX();
+ positionSize.y = position.GetY();
+
+ mSurface->MoveResize( positionSize );
+ }
+}
+
+Dali::DevelWindow::WindowPosition Window::GetPosition()
+{
+ PositionSize positionSize = mSurface->GetPositionSize();
+
+ return Dali::DevelWindow::WindowPosition( positionSize.x, positionSize.y );
+}
+
} // Adaptor
} // Internal
mEglWinSetRotationPtr( NULL ),
mLibHandle( NULL ),
mWlWindow( NULL ),
+ mWlSurface( NULL ),
mEglWindow( NULL ),
mThreadSynchronization( NULL ),
mRotationTrigger( NULL ),
ecore_wl_window_alpha_set( mWlWindow, false );
}
- // create the EGL surface
- ecore_wl_window_surface_create(mWlWindow);
- mEglWindow = wl_egl_window_create(ecore_wl_window_surface_get(mWlWindow), mPosition.width, mPosition.height);
+ // create the EGL window
+ mEglWindow = wl_egl_window_create( mWlSurface, mPosition.width, mPosition.height );
EGLNativeWindowType windowType( mEglWindow );
eglImpl.CreateSurfaceWindow( windowType, mColorDepth );
ecore_wl_window_alpha_set( mWlWindow, false );
}
- mEglWindow = wl_egl_window_create(ecore_wl_window_surface_get(mWlWindow), mPosition.width, mPosition.height);
+ mEglWindow = wl_egl_window_create( mWlSurface, mPosition.width, mPosition.height );
Internal::Adaptor::EglImplementation& eglImpl = static_cast<Internal::Adaptor::EglImplementation&>( egl );
EGLNativeWindowType windowType( mEglWindow );
if(needToMove)
{
- ecore_wl_window_move(mWlWindow, positionSize.x, positionSize.y);
- mPosition = positionSize;
+ ecore_wl_window_position_set( mWlWindow, positionSize.x, positionSize.y );
}
if (needToResize)
{
- ecore_wl_window_resize(mWlWindow, positionSize.width, positionSize.height, 0);
- mPosition = positionSize;
+ ecore_wl_window_update_size( mWlWindow, positionSize.width, positionSize.height );
}
+ mPosition = positionSize;
+
+ wl_egl_window_resize( mEglWindow, mPosition.width, mPosition.height, mPosition.x, mPosition.y );
+
+ DALI_LOG_INFO( gRenderSurfaceLogFilter, Debug::Verbose, "WindowRenderSurface::MoveResize: %d, %d, %d, %d\n", mPosition.x, mPosition.y, mPosition.width, mPosition.height );
}
void WindowRenderSurface::Map()
{
DALI_ASSERT_ALWAYS(0 && "Failed to create Wayland window");
}
+
+ mWlSurface = ecore_wl_window_surface_create( mWlWindow );
}
void WindowRenderSurface::UseExistingRenderable( unsigned int surfaceId )
void* mLibHandle; ///< Handle for the loaded library
Ecore_Wl_Window* mWlWindow; ///< Wayland-Window
+ wl_surface* mWlSurface;
wl_egl_window* mEglWindow;
ThreadSynchronizationInterface* mThreadSynchronization;
TriggerEventInterface* mRotationTrigger;
#define __DALI_INTEGRATION_ADAPTOR_H__
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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.
#include <dali/public-api/math/rect.h>
#include <dali/public-api/events/touch-event.h>
#include <dali/public-api/common/view-mode.h>
+#include <dali/public-api/math/uint-16-pair.h>
// INTERNAL INCLUDES
-
#ifdef DALI_ADAPTOR_COMPILATION // full path doesn't exist until adaptor is installed so we have to use relative
// @todo Make dali-adaptor code folder structure mirror the folder structure installed to dali-env
#include <window.h>
typedef Signal< void (Adaptor&) > AdaptorSignalType; ///< Generic Type for adaptor signals
+ typedef Uint16Pair SurfaceSize; ///< Surface size type
+
public:
/**
* @brief Create a new adaptor using the window.
/**
* @brief Informs core the surface size has changed
*/
- void SurfaceSizeChanged( const PositionSize& positionSize );
+ void SurfaceSizeChanged( SurfaceSize surfaceSize );
public: // Signals
Application Application::New( int* argc, char **argv[] )
{
- Internal::Adaptor::ApplicationPtr internal = Internal::Adaptor::Application::New( argc, argv, "", OPAQUE,
+ Internal::Adaptor::ApplicationPtr internal = Internal::Adaptor::Application::New( argc, argv, "", OPAQUE, PositionSize(),
Internal::Adaptor::Framework::NORMAL);
return Application(internal.Get());
}
Application Application::New( int* argc, char **argv[], const std::string& stylesheet )
{
- Internal::Adaptor::ApplicationPtr internal = Internal::Adaptor::Application::New( argc, argv, stylesheet, OPAQUE,
+ Internal::Adaptor::ApplicationPtr internal = Internal::Adaptor::Application::New( argc, argv, stylesheet, OPAQUE, PositionSize(),
Internal::Adaptor::Framework::NORMAL);
return Application(internal.Get());
}
Application Application::New( int* argc, char **argv[], const std::string& stylesheet, WINDOW_MODE windowMode )
{
- Internal::Adaptor::ApplicationPtr internal = Internal::Adaptor::Application::New( argc, argv, stylesheet, windowMode,
+ Internal::Adaptor::ApplicationPtr internal = Internal::Adaptor::Application::New( argc, argv, stylesheet, windowMode, PositionSize(),
Internal::Adaptor::Framework::NORMAL);
return Application(internal.Get());
}
// place holder
};
-Window* Window::New(const PositionSize& posSize, const std::string& name, const std::string& className, bool isTransparent)
+Window* Window::New( const PositionSize& positionSize, const std::string& name, const std::string& className, bool isTransparent )
{
Window* window = new Window();
window->mIsTransparent = isTransparent;
- window->Initialize(posSize, name, className);
+ window->Initialize( positionSize, name, className );
return window;
}
mIsFocusAcceptable( true ),
mVisible( true ),
mOpaqueState( false ),
+ mResizeEnabled( true ),
mIndicator( NULL ),
mIndicatorOrientation( Dali::Window::PORTRAIT ),
mNextIndicatorOrientation( Dali::Window::PORTRAIT ),
delete mSurface;
}
-void Window::Initialize(const PositionSize& windowPosition, const std::string& name, const std::string& className)
+void Window::Initialize(const PositionSize& positionSize, const std::string& name, const std::string& className)
{
// create an Wayland window by default
Any surface;
- Wayland::RenderSurface* windowSurface = new Wayland::RenderSurface( windowPosition, surface, name, mIsTransparent );
+ Wayland::RenderSurface* windowSurface = new Wayland::RenderSurface( positionSize, surface, name, mIsTransparent );
mSurface = windowSurface;
mOrientation = Orientation::New(this);
-
}
void Window::DoShowIndicator( Dali::Window::WindowOrientation lastOrientation )
return 0;
}
+void Window::SetSize( Dali::DevelWindow::WindowSize size )
+{
+ PositionSize positionSize = mSurface->GetPositionSize();
+
+ if( positionSize.width != size.GetWidth() || positionSize.height != size.GetHeight() )
+ {
+ positionSize.width = size.GetWidth();
+ positionSize.height = size.GetHeight();
+
+ mSurface->MoveResize( positionSize );
+
+ mAdaptor->SurfaceSizeChanged( Dali::Adaptor::SurfaceSize( positionSize.width, positionSize.height ) );
+
+ // Emit signal
+ mResizedSignal.Emit( Dali::DevelWindow::WindowSize( positionSize.width, positionSize.height ) );
+ }
+}
+
+Dali::DevelWindow::WindowSize Window::GetSize()
+{
+ PositionSize positionSize = mSurface->GetPositionSize();
+
+ return Dali::DevelWindow::WindowSize( positionSize.width, positionSize.height );
+}
+
+void Window::SetPosition( Dali::DevelWindow::WindowPosition position )
+{
+ PositionSize positionSize = mSurface->GetPositionSize();
+
+ if( positionSize.x != position.GetX() || positionSize.y != position.GetY() )
+ {
+ positionSize.x = position.GetX();
+ positionSize.y = position.GetY();
+
+ mSurface->MoveResize( positionSize );
+ }
+}
+
+Dali::DevelWindow::WindowPosition Window::GetPosition()
+{
+ PositionSize positionSize = mSurface->GetPositionSize();
+
+ return Dali::DevelWindow::WindowPosition( positionSize.x, positionSize.y );
+}
+
} // Adaptor
} // Internal
} // Dali
}
WatchApplication::WatchApplication( int* argc, char** argv[], const std::string& stylesheet, Dali::Application::WINDOW_MODE windowMode )
-: Application(argc, argv, stylesheet, windowMode, Framework::WATCH)
+: Application(argc, argv, stylesheet, windowMode, PositionSize(), Framework::WATCH)
{
}
};
-Window* Window::New(const PositionSize& posSize, const std::string& name, const std::string& className, bool isTransparent)
+Window* Window::New( const PositionSize& positionSize, const std::string& name, const std::string& className, bool isTransparent )
{
Window* window = new Window();
window->mIsTransparent = isTransparent;
- window->Initialize(posSize, name, className);
+ window->Initialize( positionSize, name, className );
return window;
}
mIsFocusAcceptable( true ),
mVisible( true ),
mOpaqueState( false ),
+ mResizeEnabled( true ),
mIndicator( NULL ),
mIndicatorOrientation( Dali::Window::PORTRAIT ),
mNextIndicatorOrientation( Dali::Window::PORTRAIT ),
delete mSurface;
}
-void Window::Initialize(const PositionSize& windowPosition, const std::string& name, const std::string& className)
+void Window::Initialize(const PositionSize& positionSize, const std::string& name, const std::string& className)
{
// create an X11 window by default
Any surface;
- ECore::WindowRenderSurface* windowSurface = new ECore::WindowRenderSurface( windowPosition, surface, name, className, mIsTransparent );
+ ECore::WindowRenderSurface* windowSurface = new ECore::WindowRenderSurface( positionSize, surface, name, className, mIsTransparent );
windowSurface->Map();
mSurface = windowSurface;
return 0;
}
+void Window::SetSize( Dali::DevelWindow::WindowSize size )
+{
+ PositionSize positionSize = mSurface->GetPositionSize();
+
+ if( positionSize.width != size.GetWidth() || positionSize.height != size.GetHeight() )
+ {
+ positionSize.width = size.GetWidth();
+ positionSize.height = size.GetHeight();
+
+ mSurface->MoveResize( positionSize );
+
+ mAdaptor->SurfaceSizeChanged( Dali::Adaptor::SurfaceSize( positionSize.width, positionSize.height ) );
+
+ // Emit signal
+ mResizedSignal.Emit( Dali::DevelWindow::WindowSize( positionSize.width, positionSize.height ) );
+ }
+}
+
+Dali::DevelWindow::WindowSize Window::GetSize()
+{
+ PositionSize positionSize = mSurface->GetPositionSize();
+
+ return Dali::DevelWindow::WindowSize( positionSize.width, positionSize.height );
+}
+
+void Window::SetPosition( Dali::DevelWindow::WindowPosition position )
+{
+ PositionSize positionSize = mSurface->GetPositionSize();
+
+ if( positionSize.x != position.GetX() || positionSize.y != position.GetY() )
+ {
+ positionSize.x = position.GetX();
+ positionSize.y = position.GetY();
+
+ mSurface->MoveResize( positionSize );
+ }
+}
+
+Dali::DevelWindow::WindowPosition Window::GetPosition()
+{
+ PositionSize positionSize = mSurface->GetPositionSize();
+
+ return Dali::DevelWindow::WindowPosition( positionSize.x, positionSize.y );
+}
+
} // Adaptor
} // Internal