[4.0] Fix Coverity issues
[platform/core/uifw/dali-adaptor.git] / adaptors / ecore / wayland / window-impl-ecore-wl.cpp
index 971be10..97ee23e 100644 (file)
 
 namespace
 {
+
 const float INDICATOR_ANIMATION_DURATION( 0.18f ); // 180 milli seconds
 const float INDICATOR_SHOW_Y_POSITION( 0.0f );
 const float INDICATOR_HIDE_Y_POSITION( -52.0f );
+
+const uint32_t MAX_TIZEN_CLIENT_VERSION = 7;
+
 }
 
 namespace Dali
@@ -77,9 +81,9 @@ struct Window::EventHandler
     mNotificationLevel( -1 ),
     mNotificationChangeState( 0 ),
     mNotificationLevelChangeDone( true ),
-    mScreenMode( 0 ),
-    mScreenModeChangeState( 0 ),
-    mScreenModeChangeDone( true ),
+    mScreenOffMode( 0 ),
+    mScreenOffModeChangeState( 0 ),
+    mScreenOffModeChangeDone( true ),
     mBrightness( 0 ),
     mBrightnessChangeState( 0 ),
     mBrightnessChangeDone( true )
@@ -155,13 +159,21 @@ struct Window::EventHandler
       {
         if( iconifyChangedEvent->iconified == EINA_TRUE )
         {
-          observer->OnWindowHidden();
-          DALI_LOG_INFO( gWindowLogFilter, Debug::General, "Window (%d) Iconfied\n", handler->mEcoreWindow );
+          handler->mWindow->mIconified = true;
+          if( handler->mWindow->mVisible )
+          {
+            observer->OnWindowHidden();
+          }
+          DALI_LOG_RELEASE_INFO( "EcoreEventWindowIconifyStateChanged: Iconified, mVisible [%d]\n", handler->mWindow->mVisible );
         }
         else
         {
-          observer->OnWindowShown();
-          DALI_LOG_INFO( gWindowLogFilter, Debug::General, "Window (%d) Shown\n", handler->mEcoreWindow );
+          handler->mWindow->mIconified = false;
+          if( handler->mWindow->mVisible )
+          {
+            observer->OnWindowShown();
+          }
+          DALI_LOG_RELEASE_INFO( "EcoreEventWindowIconifyStateChanged: Deiconified, mVisible [%d]\n", handler->mWindow->mVisible );
         }
         handled = ECORE_CALLBACK_DONE;
       }
@@ -210,8 +222,17 @@ struct Window::EventHandler
 
     if ( handler && handler->mWindow && transformEvent->output == ecore_wl_window_output_find( handler->mEcoreWindow ) )
     {
+      DALI_LOG_INFO( gWindowLogFilter, Debug::General, "Window (%p) EcoreEventOutputTransform\n", handler->mEcoreWindow );
+
       ECore::WindowRenderSurface* wlSurface( dynamic_cast< ECore::WindowRenderSurface * >( handler->mWindow->mSurface ) );
-      wlSurface->OutputTransformed();
+      if( wlSurface )
+      {
+        wlSurface->OutputTransformed();
+
+        PositionSize positionSize = wlSurface->GetPositionSize();
+        handler->mWindow->mAdaptor->SurfaceResizePrepare( Adaptor::SurfaceSize( positionSize.width, positionSize.height ) );
+        handler->mWindow->mAdaptor->SurfaceResizeComplete( Adaptor::SurfaceSize( positionSize.width, positionSize.height ) );
+      }
     }
 
     return ECORE_CALLBACK_PASS_ON;
@@ -225,8 +246,17 @@ struct Window::EventHandler
 
     if ( handler && handler->mWindow && ignoreTransformEvent->win == handler->mEcoreWindow )
     {
+      DALI_LOG_INFO( gWindowLogFilter, Debug::General, "Window (%p) EcoreEventIgnoreOutputTransform\n", handler->mEcoreWindow );
+
       ECore::WindowRenderSurface* wlSurface( dynamic_cast< ECore::WindowRenderSurface * >( handler->mWindow->mSurface ) );
-      wlSurface->OutputTransformed();
+      if( wlSurface )
+      {
+        wlSurface->OutputTransformed();
+
+        PositionSize positionSize = wlSurface->GetPositionSize();
+        handler->mWindow->mAdaptor->SurfaceResizePrepare( Adaptor::SurfaceSize( positionSize.width, positionSize.height ) );
+        handler->mWindow->mAdaptor->SurfaceResizeComplete( Adaptor::SurfaceSize( positionSize.width, positionSize.height ) );
+      }
     }
 
     return ECORE_CALLBACK_PASS_ON;
@@ -238,7 +268,9 @@ struct Window::EventHandler
 
     if( strcmp( interface, tizen_policy_interface.name ) == 0 )
     {
-      eventHandler->mTizenPolicy = static_cast< tizen_policy* >( wl_registry_bind( registry, name, &tizen_policy_interface, version ) );
+      uint32_t clientVersion = std::min( version, MAX_TIZEN_CLIENT_VERSION );
+
+      eventHandler->mTizenPolicy = static_cast< tizen_policy* >( wl_registry_bind( registry, name, &tizen_policy_interface, clientVersion ) );
       if( !eventHandler->mTizenPolicy )
       {
         DALI_LOG_INFO( gWindowLogFilter, Debug::General, "Window::EventHandler::RegistryGlobalCallback: wl_registry_bind(tizen_policy_interface) is failed.\n" );
@@ -271,6 +303,14 @@ struct Window::EventHandler
     eventHandler->mTizenDisplayPolicy = NULL;
   }
 
+  static void TizenPolicyConformant( void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, uint32_t isConformant )
+  {
+  }
+
+  static void TizenPolicyConformantArea( void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, uint32_t conformantPart, uint32_t state, int32_t x, int32_t y, int32_t w, int32_t h )
+  {
+  }
+
   static void TizenPolicyNotificationChangeDone(void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, int32_t level, uint32_t state )
   {
     Window::EventHandler* eventHandler = static_cast< Window::EventHandler* >( data );
@@ -282,18 +322,42 @@ struct Window::EventHandler
     DALI_LOG_INFO( gWindowLogFilter, Debug::General, "Window::EventHandler::TizenPolicyNotificationChangeDone: level = %d, state = %d\n", level, state );
   }
 
-  static void TizenPolicyScreenModeChangeDone(void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, uint32_t mode, uint32_t state )
+  static void TizenPolicyTransientForDone( void* data, struct tizen_policy* tizenPolicy, uint32_t childId )
+  {
+  }
+
+  static void TizenPolicyScreenModeChangeDone( void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, uint32_t mode, uint32_t state )
   {
     Window::EventHandler* eventHandler = static_cast< Window::EventHandler* >( data );
 
-    eventHandler->mScreenMode = mode;
-    eventHandler->mScreenModeChangeState = state;
-    eventHandler->mScreenModeChangeDone = true;
+    eventHandler->mScreenOffMode = mode;
+    eventHandler->mScreenOffModeChangeState = state;
+    eventHandler->mScreenOffModeChangeDone = true;
 
     DALI_LOG_INFO( gWindowLogFilter, Debug::General, "Window::EventHandler::TizenPolicyScreenModeChangeDone: mode = %d, state = %d\n", mode, state );
   }
 
-  static void DisplayPolicyBrightnessChangeDone(void* data, struct tizen_display_policy *displayPolicy, struct wl_surface* surface, int32_t brightness, uint32_t state )
+  static void TizenPolicyIconifyStateChanged( void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, uint32_t iconified, uint32_t force )
+  {
+  }
+
+  static void TizenPolicySupportedAuxiliaryHints( void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, struct wl_array* hints, uint32_t numNints )
+  {
+  }
+
+  static void TizenPolicyAllowedAuxiliaryHint( void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, int id )
+  {
+  }
+
+  static void TizenPolicyAuxiliaryMessage( void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, const char* key, const char* val, struct wl_array* options )
+  {
+  }
+
+  static void TizenPolicyConformantRegion( void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, uint32_t conformantPart, uint32_t state, int32_t x, int32_t y, int32_t w, int32_t h, uint32_t serial )
+  {
+  }
+
+  static void DisplayPolicyBrightnessChangeDone( void* data, struct tizen_display_policy *displayPolicy, struct wl_surface* surface, int32_t brightness, uint32_t state )
   {
     Window::EventHandler* eventHandler = static_cast< Window::EventHandler* >( data );
 
@@ -312,15 +376,16 @@ struct Window::EventHandler
 
   const struct tizen_policy_listener mTizenPolicyListener =
   {
-     NULL,
-     NULL,
+     TizenPolicyConformant,
+     TizenPolicyConformantArea,
      TizenPolicyNotificationChangeDone,
-     NULL,
+     TizenPolicyTransientForDone,
      TizenPolicyScreenModeChangeDone,
-     NULL,
-     NULL,
-     NULL,
-     NULL
+     TizenPolicyIconifyStateChanged,
+     TizenPolicySupportedAuxiliaryHints,
+     TizenPolicyAllowedAuxiliaryHint,
+     TizenPolicyAuxiliaryMessage,
+     TizenPolicyConformantRegion
   };
 
   const struct tizen_display_policy_listener mTizenDisplayPolicyListener =
@@ -342,9 +407,9 @@ struct Window::EventHandler
   uint32_t mNotificationChangeState;
   bool mNotificationLevelChangeDone;
 
-  int mScreenMode;
-  uint32_t mScreenModeChangeState;
-  bool mScreenModeChangeDone;
+  int mScreenOffMode;
+  uint32_t mScreenOffModeChangeState;
+  bool mScreenOffModeChangeDone;
 
   int mBrightness;
   uint32_t mBrightnessChangeState;
@@ -479,6 +544,7 @@ Window::Window()
   mEcoreEventHander( true ),
   mIsFocusAcceptable( true ),
   mVisible( true ),
+  mIconified( false ),
   mOpaqueState( false ),
   mResizeEnabled( false ),
   mIndicator( NULL ),
@@ -487,7 +553,7 @@ Window::Window()
   mIndicatorOpacityMode( Dali::Window::OPAQUE ),
   mOverlay( NULL ),
   mAdaptor( NULL ),
-  mType( Dali::DevelWindow::NORMAL ),
+  mType( Dali::Window::NORMAL ),
   mEventHandler( NULL ),
   mPreferredOrientation( Dali::Window::PORTRAIT ),
   mSupportedAuxiliaryHints(),
@@ -712,17 +778,24 @@ void Window::SetIndicatorActorRotation()
 
 void Window::Raise()
 {
-  ecore_wl_window_raise( mEventHandler->mEcoreWindow );
+  // Use ecore_wl_window_activate to prevent the window shown without rendering
+  ecore_wl_window_activate( mEventHandler->mEcoreWindow );
+
+  DALI_LOG_RELEASE_INFO( "Window::Raise is called.\n" );
 }
 
 void Window::Lower()
 {
   ecore_wl_window_lower( mEventHandler->mEcoreWindow );
+
+  DALI_LOG_RELEASE_INFO( "Window::Lower is called.\n" );
 }
 
 void Window::Activate()
 {
   ecore_wl_window_activate( mEventHandler->mEcoreWindow );
+
+  DALI_LOG_RELEASE_INFO( "Window::Activate is called.\n" );
 }
 
 Dali::DragAndDropDetector Window::GetDragAndDropDetector() const
@@ -782,19 +855,22 @@ void Window::AddAvailableOrientation(Dali::Window::WindowOrientation orientation
 {
   bool found = false;
 
-  for( std::size_t i=0; i<mAvailableOrientations.size(); i++ )
+  if ( orientation <= Dali::Window::LANDSCAPE_INVERSE )
   {
-    if(mAvailableOrientations[i] == orientation)
+    for( std::size_t i = 0; i < mAvailableOrientations.size(); i++ )
     {
-      found = true;
-      break;
+      if( mAvailableOrientations[i] == orientation )
+      {
+        found = true;
+        break;
+      }
     }
-  }
 
-  if( ! found )
-  {
-    mAvailableOrientations.push_back(orientation);
-    SetAvailableOrientations( mAvailableOrientations );
+    if( ! found )
+    {
+      mAvailableOrientations.push_back(orientation);
+      SetAvailableOrientations( mAvailableOrientations );
+    }
   }
 }
 
@@ -814,7 +890,7 @@ void Window::RemoveAvailableOrientation(Dali::Window::WindowOrientation orientat
 
 void Window::SetAvailableOrientations(const std::vector<Dali::Window::WindowOrientation>& orientations)
 {
-  int rotations[4];
+  int rotations[4] = { 0 };
   for( std::size_t i = 0; i < mAvailableOrientations.size(); ++i )
   {
     rotations[i] = static_cast< int >( mAvailableOrientations[i] );
@@ -846,7 +922,7 @@ void Window::SetAcceptFocus( bool accept )
   ecore_wl_window_focus_skip_set( mEventHandler->mEcoreWindow, !accept );
 }
 
-bool Window::IsFocusAcceptable()
+bool Window::IsFocusAcceptable() const
 {
   return mIsFocusAcceptable;
 }
@@ -856,10 +932,15 @@ void Window::Show()
   mVisible = true;
   ecore_wl_window_show( mEventHandler->mEcoreWindow );
 
-  // Need an update request
-  if( mAdaptor )
+  DALI_LOG_RELEASE_INFO( "Window::Show is called : mIconified [%d]\n", mIconified );
+
+  if( !mIconified )
   {
-    mAdaptor->RequestUpdateOnce();
+    if( mAdaptor )
+    {
+      WindowVisibilityObserver* observer( mAdaptor );
+      observer->OnWindowShown();
+    }
   }
 }
 
@@ -867,6 +948,17 @@ void Window::Hide()
 {
   mVisible = false;
   ecore_wl_window_hide( mEventHandler->mEcoreWindow );
+
+  DALI_LOG_RELEASE_INFO( "Window::Hide is called : mIconified [%d]\n", mIconified );
+
+  if( !mIconified )
+  {
+    if( mAdaptor )
+    {
+      WindowVisibilityObserver* observer( mAdaptor );
+      observer->OnWindowHidden();
+    }
+  }
 }
 
 bool Window::IsVisible() const
@@ -882,20 +974,25 @@ void Window::RotationDone( int orientation, int width, int height )
     wlSurface->RequestRotation( orientation, width, height );
   }
 
-  mAdaptor->SurfaceResizePrepare( Dali::Adaptor::SurfaceSize( width, height ) );
+  mAdaptor->SurfaceResizePrepare( Adaptor::SurfaceSize( width, height ) );
 
   // Emit signal
-  mResizedSignal.Emit( Dali::DevelWindow::WindowSize( width, height ) );
+  mResizedSignal.Emit( Dali::Window::WindowSize( width, height ) );
 
-  mAdaptor->SurfaceResizeComplete( Dali::Adaptor::SurfaceSize( width, height ) );
+  mAdaptor->SurfaceResizeComplete( Adaptor::SurfaceSize( width, height ) );
+}
+
+void Window::SetIndicatorVisibleMode( Dali::Window::IndicatorVisibleMode mode )
+{
+  mIndicatorVisible = mode;
 }
 
-unsigned int Window::GetSupportedAuxiliaryHintCount()
+unsigned int Window::GetSupportedAuxiliaryHintCount() const
 {
   return mSupportedAuxiliaryHints.size();
 }
 
-std::string Window::GetSupportedAuxiliaryHint( unsigned int index )
+std::string Window::GetSupportedAuxiliaryHint( unsigned int index ) const
 {
   if( index >= GetSupportedAuxiliaryHintCount() )
   {
@@ -1021,7 +1118,7 @@ void Window::SetInputRegion( const Rect< int >& inputRegion )
   DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::SetInputRegion: x = %d, y = %d, w = %d, h = %d\n", inputRegion.x, inputRegion.y, inputRegion.width, inputRegion.height );
 }
 
-void Window::SetType( Dali::DevelWindow::Type type )
+void Window::SetType( Dali::Window::Type type )
 {
   Ecore_Wl_Window_Type windowType;
 
@@ -1029,22 +1126,22 @@ void Window::SetType( Dali::DevelWindow::Type type )
   {
     switch( type )
     {
-      case Dali::DevelWindow::NORMAL:
+      case Dali::Window::NORMAL:
       {
         windowType = ECORE_WL_WINDOW_TYPE_TOPLEVEL;
         break;
       }
-      case Dali::DevelWindow::NOTIFICATION:
+      case Dali::Window::NOTIFICATION:
       {
         windowType = ECORE_WL_WINDOW_TYPE_NOTIFICATION;
         break;
       }
-      case Dali::DevelWindow::UTILITY:
+      case Dali::Window::UTILITY:
       {
         windowType = ECORE_WL_WINDOW_TYPE_UTILITY;
         break;
       }
-      case Dali::DevelWindow::DIALOG:
+      case Dali::Window::DIALOG:
       {
         windowType = ECORE_WL_WINDOW_TYPE_DIALOG;
         break;
@@ -1062,14 +1159,14 @@ void Window::SetType( Dali::DevelWindow::Type type )
   mType = type;
 }
 
-Dali::DevelWindow::Type Window::GetType() const
+Dali::Window::Type Window::GetType() const
 {
   return mType;
 }
 
-bool Window::SetNotificationLevel( Dali::DevelWindow::NotificationLevel::Type level )
+bool Window::SetNotificationLevel( Dali::Window::NotificationLevel::Type level )
 {
-  if( mType != Dali::DevelWindow::NOTIFICATION )
+  if( mType != Dali::Window::NOTIFICATION )
   {
     DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::SetNotificationLevel: Not supported window type [%d]\n", mType );
     return false;
@@ -1084,27 +1181,27 @@ bool Window::SetNotificationLevel( Dali::DevelWindow::NotificationLevel::Type le
 
   switch( level )
   {
-    case Dali::DevelWindow::NotificationLevel::NONE:
+    case Dali::Window::NotificationLevel::NONE:
     {
       notificationLevel = TIZEN_POLICY_LEVEL_NONE;
       break;
     }
-    case Dali::DevelWindow::NotificationLevel::BASE:
+    case Dali::Window::NotificationLevel::BASE:
     {
       notificationLevel = TIZEN_POLICY_LEVEL_DEFAULT;
       break;
     }
-    case Dali::DevelWindow::NotificationLevel::MEDIUM:
+    case Dali::Window::NotificationLevel::MEDIUM:
     {
       notificationLevel = TIZEN_POLICY_LEVEL_MEDIUM;
       break;
     }
-    case Dali::DevelWindow::NotificationLevel::HIGH:
+    case Dali::Window::NotificationLevel::HIGH:
     {
       notificationLevel = TIZEN_POLICY_LEVEL_HIGH;
       break;
     }
-    case Dali::DevelWindow::NotificationLevel::TOP:
+    case Dali::Window::NotificationLevel::TOP:
     {
       notificationLevel = TIZEN_POLICY_LEVEL_TOP;
       break;
@@ -1147,12 +1244,12 @@ bool Window::SetNotificationLevel( Dali::DevelWindow::NotificationLevel::Type le
   return true;
 }
 
-Dali::DevelWindow::NotificationLevel::Type Window::GetNotificationLevel()
+Dali::Window::NotificationLevel::Type Window::GetNotificationLevel() const
 {
-  if( mType != Dali::DevelWindow::NOTIFICATION )
+  if( mType != Dali::Window::NOTIFICATION )
   {
     DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::GetNotificationLevel: Not supported window type [%d]\n", mType );
-    return Dali::DevelWindow::NotificationLevel::NONE;
+    return Dali::Window::NotificationLevel::NONE;
   }
 
   while( !mEventHandler->mTizenPolicy )
@@ -1172,42 +1269,42 @@ Dali::DevelWindow::NotificationLevel::Type Window::GetNotificationLevel()
   if( !mEventHandler->mNotificationLevelChangeDone )
   {
     DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::GetNotificationLevel: Error! [%d]\n", mEventHandler->mNotificationChangeState );
-    return Dali::DevelWindow::NotificationLevel::NONE;
+    return Dali::Window::NotificationLevel::NONE;
   }
 
-  Dali::DevelWindow::NotificationLevel::Type level;
+  Dali::Window::NotificationLevel::Type level;
 
   switch( mEventHandler->mNotificationLevel )
   {
     case TIZEN_POLICY_LEVEL_NONE:
     {
-      level = Dali::DevelWindow::NotificationLevel::NONE;
+      level = Dali::Window::NotificationLevel::NONE;
       break;
     }
     case TIZEN_POLICY_LEVEL_DEFAULT:
     {
-      level = Dali::DevelWindow::NotificationLevel::BASE;
+      level = Dali::Window::NotificationLevel::BASE;
       break;
     }
     case TIZEN_POLICY_LEVEL_MEDIUM:
     {
-      level = Dali::DevelWindow::NotificationLevel::MEDIUM;
+      level = Dali::Window::NotificationLevel::MEDIUM;
       break;
     }
     case TIZEN_POLICY_LEVEL_HIGH:
     {
-      level = Dali::DevelWindow::NotificationLevel::HIGH;
+      level = Dali::Window::NotificationLevel::HIGH;
       break;
     }
     case TIZEN_POLICY_LEVEL_TOP:
     {
-      level = Dali::DevelWindow::NotificationLevel::TOP;
+      level = Dali::Window::NotificationLevel::TOP;
       break;
     }
     default:
     {
       DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::GetNotificationLevel: invalid level [%d]\n", mEventHandler->mNotificationLevel );
-      level = Dali::DevelWindow::NotificationLevel::NONE;
+      level = Dali::Window::NotificationLevel::NONE;
       break;
     }
   }
@@ -1231,31 +1328,31 @@ void Window::SetOpaqueState( bool opaque )
   DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::SetOpaqueState: opaque = %d\n", opaque );
 }
 
-bool Window::IsOpaqueState()
+bool Window::IsOpaqueState() const
 {
   return mOpaqueState;
 }
 
-bool Window::SetScreenMode( Dali::DevelWindow::ScreenMode::Type screenMode )
+bool Window::SetScreenOffMode(Dali::Window::ScreenOffMode::Type screenOffMode)
 {
   while( !mEventHandler->mTizenPolicy )
   {
     wl_display_dispatch_queue( mEventHandler->mDisplay, mEventHandler->mEventQueue );
   }
 
-  mEventHandler->mScreenModeChangeDone = false;
-  mEventHandler->mScreenModeChangeState = TIZEN_POLICY_ERROR_STATE_NONE;
+  mEventHandler->mScreenOffModeChangeDone = false;
+  mEventHandler->mScreenOffModeChangeState = TIZEN_POLICY_ERROR_STATE_NONE;
 
   unsigned int mode = 0;
 
-  switch( screenMode )
+  switch( screenOffMode )
   {
-    case Dali::DevelWindow::ScreenMode::DEFAULT:
+    case Dali::Window::ScreenOffMode::TIMEOUT:
     {
       mode = 0;
       break;
     }
-    case Dali::DevelWindow::ScreenMode::ALWAYS_ON:
+    case Dali::Window::ScreenOffMode::NEVER:
     {
       mode = 1;
       break;
@@ -1266,30 +1363,30 @@ bool Window::SetScreenMode( Dali::DevelWindow::ScreenMode::Type screenMode )
 
   int count = 0;
 
-  while( !mEventHandler->mScreenModeChangeDone && count < 3 )
+  while( !mEventHandler->mScreenOffModeChangeDone && count < 3 )
   {
     ecore_wl_flush();
     wl_display_dispatch_queue( mEventHandler->mDisplay, mEventHandler->mEventQueue );
     count++;
   }
 
-  if( !mEventHandler->mScreenModeChangeDone )
+  if( !mEventHandler->mScreenOffModeChangeDone )
   {
-    DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::SetScreenMode: Screen mode change is failed [%d, %d]\n", screenMode, mEventHandler->mScreenModeChangeState );
+    DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::SetScreenOffMode: Screen mode change is failed [%d, %d]\n", screenOffMode, mEventHandler->mScreenOffModeChangeState );
     return false;
   }
-  else if( mEventHandler->mScreenModeChangeState == TIZEN_POLICY_ERROR_STATE_PERMISSION_DENIED )
+  else if( mEventHandler->mScreenOffModeChangeState == TIZEN_POLICY_ERROR_STATE_PERMISSION_DENIED )
   {
-    DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::SetScreenMode: Permission denied! [%d]\n", screenMode );
+    DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::SetScreenOffMode: Permission denied! [%d]\n", screenOffMode );
     return false;
   }
 
-  DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::SetScreenMode: Screen mode is changed [%d]\n", mEventHandler->mScreenMode );
+  DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::SetScreenOffMode: Screen mode is changed [%d]\n", mEventHandler->mScreenOffMode );
 
   return true;
 }
 
-Dali::DevelWindow::ScreenMode::Type Window::GetScreenMode()
+Dali::Window::ScreenOffMode::Type Window::GetScreenOffMode() const
 {
   while( !mEventHandler->mTizenPolicy )
   {
@@ -1298,36 +1395,36 @@ Dali::DevelWindow::ScreenMode::Type Window::GetScreenMode()
 
   int count = 0;
 
-  while( !mEventHandler->mScreenModeChangeDone && count < 3 )
+  while( !mEventHandler->mScreenOffModeChangeDone && count < 3 )
   {
     ecore_wl_flush();
     wl_display_dispatch_queue( mEventHandler->mDisplay, mEventHandler->mEventQueue );
     count++;
   }
 
-  if( !mEventHandler->mScreenModeChangeDone )
+  if( !mEventHandler->mScreenOffModeChangeDone )
   {
-    DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::GetScreenMode: Error! [%d]\n", mEventHandler->mScreenModeChangeState );
-    return Dali::DevelWindow::ScreenMode::DEFAULT;
+    DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::GetScreenOffMode: Error! [%d]\n", mEventHandler->mScreenOffModeChangeState );
+    return Dali::Window::ScreenOffMode::TIMEOUT;
   }
 
-  Dali::DevelWindow::ScreenMode::Type screenMode = Dali::DevelWindow::ScreenMode::DEFAULT;
+  Dali::Window::ScreenOffMode::Type screenMode = Dali::Window::ScreenOffMode::TIMEOUT;
 
-  switch( mEventHandler->mScreenMode )
+  switch( mEventHandler->mScreenOffMode )
   {
     case 0:
     {
-      screenMode = Dali::DevelWindow::ScreenMode::DEFAULT;
+      screenMode = Dali::Window::ScreenOffMode::TIMEOUT;
       break;
     }
     case 1:
     {
-      screenMode = Dali::DevelWindow::ScreenMode::ALWAYS_ON;
+      screenMode = Dali::Window::ScreenOffMode::NEVER;
       break;
     }
   }
 
-  DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::GetScreenMode: screen mode [%d]\n", mEventHandler->mScreenMode );
+  DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::GetScreenOffMode: screen mode [%d]\n", mEventHandler->mScreenOffMode );
 
   return screenMode;
 }
@@ -1375,7 +1472,7 @@ bool Window::SetBrightness( int brightness )
   return true;
 }
 
-int Window::GetBrightness()
+int Window::GetBrightness() const
 {
   while( !mEventHandler->mTizenDisplayPolicy )
   {
@@ -1402,7 +1499,7 @@ int Window::GetBrightness()
   return mEventHandler->mBrightness;
 }
 
-void Window::SetSize( Dali::DevelWindow::WindowSize size )
+void Window::SetSize( Dali::Window::WindowSize size )
 {
   if( !mResizeEnabled )
   {
@@ -1419,23 +1516,23 @@ void Window::SetSize( Dali::DevelWindow::WindowSize size )
 
     mSurface->MoveResize( positionSize );
 
-    mAdaptor->SurfaceResizePrepare( Dali::Adaptor::SurfaceSize( positionSize.width, positionSize.height ) );
+    mAdaptor->SurfaceResizePrepare( Adaptor::SurfaceSize( positionSize.width, positionSize.height ) );
 
     // Emit signal
-    mResizedSignal.Emit( Dali::DevelWindow::WindowSize( positionSize.width, positionSize.height ) );
+    mResizedSignal.Emit( Dali::Window::WindowSize( positionSize.width, positionSize.height ) );
 
-    mAdaptor->SurfaceResizeComplete( Dali::Adaptor::SurfaceSize( positionSize.width, positionSize.height ) );
+    mAdaptor->SurfaceResizeComplete( Adaptor::SurfaceSize( positionSize.width, positionSize.height ) );
   }
 }
 
-Dali::DevelWindow::WindowSize Window::GetSize()
+Dali::Window::WindowSize Window::GetSize() const
 {
   PositionSize positionSize = mSurface->GetPositionSize();
 
-  return Dali::DevelWindow::WindowSize( positionSize.width, positionSize.height );
+  return Dali::Window::WindowSize( positionSize.width, positionSize.height );
 }
 
-void Window::SetPosition( Dali::DevelWindow::WindowPosition position )
+void Window::SetPosition( Dali::Window::WindowPosition position )
 {
   if( !mResizeEnabled )
   {
@@ -1454,11 +1551,11 @@ void Window::SetPosition( Dali::DevelWindow::WindowPosition position )
   }
 }
 
-Dali::DevelWindow::WindowPosition Window::GetPosition()
+Dali::Window::WindowPosition Window::GetPosition() const
 {
   PositionSize positionSize = mSurface->GetPositionSize();
 
-  return Dali::DevelWindow::WindowPosition( positionSize.x, positionSize.y );
+  return Dali::Window::WindowPosition( positionSize.x, positionSize.y );
 }
 
 void Window::SetTransparency( bool transparent )