Support window resizing 20/134520/5
authorHeeyong Song <heeyong.song@samsung.com>
Mon, 19 Jun 2017 05:25:09 +0000 (14:25 +0900)
committerHeeyong Song <heeyong.song@samsung.com>
Mon, 26 Jun 2017 01:21:26 +0000 (10:21 +0900)
Change-Id: Ie4fec40d8b4400233ec35eb09bb5d200ea03b94f

19 files changed:
adaptors/common/adaptor-impl.cpp
adaptors/common/adaptor-impl.h
adaptors/common/adaptor.cpp
adaptors/common/application-impl.cpp
adaptors/common/application-impl.h
adaptors/common/window-impl.h
adaptors/devel-api/adaptor-framework/application-devel.cpp [new file with mode: 0644]
adaptors/devel-api/adaptor-framework/application-devel.h [new file with mode: 0644]
adaptors/devel-api/adaptor-framework/window-devel.cpp
adaptors/devel-api/adaptor-framework/window-devel.h
adaptors/devel-api/file.list
adaptors/ecore/wayland/window-impl-ecore-wl.cpp
adaptors/ecore/wayland/window-render-surface-ecore-wl.cpp
adaptors/ecore/wayland/window-render-surface.h
adaptors/integration-api/adaptor.h
adaptors/public-api/adaptor-framework/application.cpp
adaptors/wayland/window-impl-wl.cpp
adaptors/wearable/watch-application-impl.cpp
adaptors/x11/window-impl-x.cpp

index a3dc3ee..a97a6af 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * 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.
@@ -385,39 +385,6 @@ void Adaptor::FeedKeyEvent( KeyEvent& keyEvent )
   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;
@@ -722,10 +689,10 @@ void Adaptor::OnDamaged( const DamageArea& area )
   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 );
 }
index 4cbbdc2..425bfcf 100644 (file)
@@ -2,7 +2,7 @@
 #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.
@@ -184,16 +184,6 @@ public: // AdaptorInternalServices implementation
   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 );
@@ -348,7 +338,7 @@ public:
   /**
    * Informs core the surface size has changed
    */
-  void SurfaceSizeChanged( const PositionSize& positionSize );
+  void SurfaceSizeChanged( Dali::Adaptor::SurfaceSize surfaceSize );
 
 public:  //AdaptorInternalServices
 
index 3e96cf1..a6810c7 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * 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.
@@ -184,9 +184,9 @@ void Adaptor::SetStereoBase(  float stereoBase )
   mImpl->SetStereoBase( stereoBase );
 }
 
-void Adaptor::SurfaceSizeChanged( const PositionSize& positionSize )
+void Adaptor::SurfaceSizeChanged( SurfaceSize surfaceSize )
 {
-  mImpl->SurfaceSizeChanged( positionSize );
+  mImpl->SurfaceSizeChanged( surfaceSize );
 }
 
 Adaptor::Adaptor()
index c949758..cd05c95 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * 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.
@@ -53,14 +53,15 @@ ApplicationPtr Application::New(
   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(),
@@ -83,6 +84,7 @@ Application::Application( int* argc, char** argv[], const std::string& styleshee
   mName(),
   mStylesheet( stylesheet ),
   mEnvironmentOptions(),
+  mWindowPositionSize( positionSize ),
   mSlotDelegate( this )
 {
   // Get mName from environment options
@@ -110,21 +112,24 @@ Application::~Application()
 
 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 );
@@ -370,18 +375,19 @@ float Application::GetStereoBase() const
 }
 
 
-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()
index 4af4577..509cb54 100644 (file)
@@ -2,7 +2,7 @@
 #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.
@@ -60,14 +60,15 @@ public:
 
   /**
    * 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:
 
@@ -104,7 +105,7 @@ 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();
@@ -287,13 +288,15 @@ protected:
 
   /**
    * 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
@@ -346,6 +349,7 @@ private:
   std::string                           mName;
   std::string                           mStylesheet;
   EnvironmentOptions                    mEnvironmentOptions;
+  PositionSize                          mWindowPositionSize;
   bool                                  mUseRemoteSurface;
 
   SlotDelegate< Application >           mSlotDelegate;
index d4774f1..9ef6140 100644 (file)
@@ -65,13 +65,13 @@ public:
 
   /**
    * 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.
@@ -276,6 +276,26 @@ public:
   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 );
@@ -295,7 +315,7 @@ private:
   /**
    * 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.
@@ -400,6 +420,7 @@ private:
   bool                             mIsFocusAcceptable:1;
   bool                             mVisible:1;
   bool                             mOpaqueState:1;
+  bool                             mResizeEnabled:1;
   IndicatorInterface*              mIndicator;
   Dali::Window::WindowOrientation  mIndicatorOrientation;
   Dali::Window::WindowOrientation  mNextIndicatorOrientation;
diff --git a/adaptors/devel-api/adaptor-framework/application-devel.cpp b/adaptors/devel-api/adaptor-framework/application-devel.cpp
new file mode 100644 (file)
index 0000000..2c30c72
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+ * 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
diff --git a/adaptors/devel-api/adaptor-framework/application-devel.h b/adaptors/devel-api/adaptor-framework/application-devel.h
new file mode 100644 (file)
index 0000000..6360011
--- /dev/null
@@ -0,0 +1,53 @@
+#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
index 447cdd1..0ad934e 100644 (file)
@@ -150,6 +150,26 @@ ResizedSignalType& ResizedSignal( Window window )
   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
index be087f0..0357be8 100644 (file)
@@ -21,6 +21,7 @@
 // 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
@@ -77,8 +78,11 @@ enum Type
   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.
@@ -308,6 +312,38 @@ DALI_IMPORT_API int GetBrightness( Window window );
  */
 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
index 894b0a5..6cdeb53 100644 (file)
@@ -1,5 +1,6 @@
 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 \
@@ -33,6 +34,7 @@ devel_api_adaptor_framework_header_files = \
   $(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 \
index 692749b..f090ad1 100644 (file)
@@ -382,11 +382,11 @@ struct Window::EventHandler
   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;
 }
 
@@ -511,6 +511,7 @@ Window::Window()
   mIsFocusAcceptable( true ),
   mVisible( true ),
   mOpaqueState( false ),
+  mResizeEnabled( false ),
   mIndicator( NULL ),
   mIndicatorOrientation( Dali::Window::PORTRAIT ),
   mNextIndicatorOrientation( Dali::Window::PORTRAIT ),
@@ -552,17 +553,13 @@ Window::~Window()
   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 );
@@ -581,6 +578,17 @@ void Window::Initialize(const PositionSize& windowPosition, const std::string& n
       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 )
@@ -899,12 +907,10 @@ bool Window::IsVisible() const
 
 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 )
@@ -937,7 +943,7 @@ void Window::RotationDone( int orientation, int width, int height )
   }
 
   ECore::WindowRenderSurface* wlSurface( dynamic_cast< ECore::WindowRenderSurface * >( mSurface ) );
-  wlSurface->RequestRotation( windowOrientation, positionSize.width, positionSize.height );
+  wlSurface->RequestRotation( windowOrientation, width, height );
 }
 
 unsigned int Window::GetSupportedAuxiliaryHintCount()
@@ -1452,6 +1458,63 @@ int Window::GetBrightness()
   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
index 40858ed..6fc7677 100644 (file)
@@ -58,6 +58,7 @@ WindowRenderSurface::WindowRenderSurface( Dali::PositionSize positionSize,
   mEglWinSetRotationPtr( NULL ),
   mLibHandle( NULL ),
   mWlWindow( NULL ),
+  mWlSurface( NULL ),
   mEglWindow( NULL ),
   mThreadSynchronization( NULL ),
   mRotationTrigger( NULL ),
@@ -200,9 +201,8 @@ void WindowRenderSurface::CreateEglSurface( EglInterface& eglIf )
     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 );
 
@@ -278,7 +278,7 @@ bool WindowRenderSurface::ReplaceEGLSurface( EglInterface& egl )
     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 );
@@ -306,15 +306,18 @@ void WindowRenderSurface::MoveResize( Dali::PositionSize positionSize )
 
   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()
@@ -392,6 +395,8 @@ void WindowRenderSurface::CreateWlRenderable()
   {
     DALI_ASSERT_ALWAYS(0 && "Failed to create Wayland window");
   }
+
+  mWlSurface = ecore_wl_window_surface_create( mWlWindow );
 }
 
 void WindowRenderSurface::UseExistingRenderable( unsigned int surfaceId )
index 19d7c7a..b5a9e81 100644 (file)
@@ -178,6 +178,7 @@ private: // Data
 
   void*                           mLibHandle; ///< Handle for the loaded library
   Ecore_Wl_Window*                mWlWindow;  ///< Wayland-Window
+  wl_surface*                     mWlSurface;
   wl_egl_window*                  mEglWindow;
   ThreadSynchronizationInterface* mThreadSynchronization;
   TriggerEventInterface*          mRotationTrigger;
index 93fbd7b..1d023ad 100644 (file)
@@ -2,7 +2,7 @@
 #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>
@@ -115,6 +115,8 @@ public:
 
   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.
@@ -340,7 +342,7 @@ public:
   /**
    * @brief Informs core the surface size has changed
    */
-  void SurfaceSizeChanged( const PositionSize& positionSize );
+  void SurfaceSizeChanged( SurfaceSize surfaceSize );
 
 public:  // Signals
 
index 1d4fb36..3530906 100644 (file)
@@ -34,21 +34,21 @@ Application Application::New()
 
 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());
 }
index 79e2555..51d5899 100644 (file)
@@ -48,11 +48,11 @@ struct Window::EventHandler
   // 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;
 }
 
@@ -112,6 +112,7 @@ Window::Window()
   mIsFocusAcceptable( true ),
   mVisible( true ),
   mOpaqueState( false ),
+  mResizeEnabled( true ),
   mIndicator( NULL ),
   mIndicatorOrientation( Dali::Window::PORTRAIT ),
   mNextIndicatorOrientation( Dali::Window::PORTRAIT ),
@@ -144,16 +145,15 @@ Window::~Window()
   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 )
@@ -407,6 +407,51 @@ int Window::GetBrightness()
   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
index da3eae8..2f47a33 100644 (file)
@@ -38,7 +38,7 @@ WatchApplicationPtr WatchApplication::New(
 }
 
 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)
 {
 }
 
index c748c56..b6a0b8a 100644 (file)
@@ -225,11 +225,11 @@ struct Window::EventHandler
 };
 
 
-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;
 }
 
@@ -349,6 +349,7 @@ Window::Window()
   mIsFocusAcceptable( true ),
   mVisible( true ),
   mOpaqueState( false ),
+  mResizeEnabled( true ),
   mIndicator( NULL ),
   mIndicatorOrientation( Dali::Window::PORTRAIT ),
   mNextIndicatorOrientation( Dali::Window::PORTRAIT ),
@@ -402,11 +403,11 @@ Window::~Window()
   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;
@@ -911,6 +912,51 @@ int Window::GetBrightness()
   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