X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=adaptors%2Fecore%2Fwayland%2Fwindow-impl-ecore-wl.cpp;h=04bfc83ad06982a7849cbd39623212f3b0340767;hb=0d26a26e6601ffc17af69c745847d5e56c739c31;hp=32d02278db9a1e04c307c0b48000170a5d743515;hpb=d7e2c3307174da509389bd2745e1deb2a9d5638a;p=platform%2Fcore%2Fuifw%2Fdali-adaptor.git diff --git a/adaptors/ecore/wayland/window-impl-ecore-wl.cpp b/adaptors/ecore/wayland/window-impl-ecore-wl.cpp index 32d0227..04bfc83 100644 --- a/adaptors/ecore/wayland/window-impl-ecore-wl.cpp +++ b/adaptors/ecore/wayland/window-impl-ecore-wl.cpp @@ -34,7 +34,6 @@ #include #include #include - namespace { const float INDICATOR_ANIMATION_DURATION( 0.18f ); // 180 milli seconds @@ -64,7 +63,7 @@ struct Window::EventHandler EventHandler( Window* window ) : mWindow( window ), mWindowPropertyHandler( NULL ), - mClientMessageHandler( NULL ), + mWindowIconifyStateHandler( NULL ), mEcoreWindow( 0 ) { // store ecore window handle @@ -74,6 +73,14 @@ struct Window::EventHandler mEcoreWindow = wlWindow->GetWlWindow(); } DALI_ASSERT_ALWAYS( mEcoreWindow != 0 && "There is no ecore Wl window"); + +#ifndef DALI_PROFILE_UBUNTU + if( mWindow->mEcoreEventHander ) + { + mWindowIconifyStateHandler = ecore_event_handler_add( ECORE_WL_EVENT_WINDOW_ICONIFY_STATE_CHANGE, EcoreEventWindowIconifyStateChanged, this ); + } +#endif + } /** @@ -85,9 +92,9 @@ struct Window::EventHandler { ecore_event_handler_del( mWindowPropertyHandler ); } - if ( mClientMessageHandler ) + if ( mWindowIconifyStateHandler ) { - ecore_event_handler_del( mClientMessageHandler ); + ecore_event_handler_del( mWindowIconifyStateHandler ); } } @@ -99,16 +106,41 @@ struct Window::EventHandler return EINA_FALSE; } - /// Called when the window properties are changed. - static Eina_Bool EcoreEventClientMessage( void* data, int type, void* event ) +#ifndef DALI_PROFILE_UBUNTU + /// Called when the window iconify state is changed. + static Eina_Bool EcoreEventWindowIconifyStateChanged( void* data, int type, void* event ) { - return EINA_FALSE; + Ecore_Wl_Event_Window_Iconify_State_Change* iconifyChangedEvent( (Ecore_Wl_Event_Window_Iconify_State_Change*)event ); + EventHandler* handler( (EventHandler*)data ); + Eina_Bool handled( ECORE_CALLBACK_PASS_ON ); + + if ( handler && handler->mWindow ) + { + WindowVisibilityObserver* observer( handler->mWindow->mAdaptor ); + if ( observer && ( iconifyChangedEvent->win == (unsigned int) ecore_wl_window_id_get( handler->mEcoreWindow ) ) ) + { + if( iconifyChangedEvent->iconified == EINA_TRUE ) + { + observer->OnWindowHidden(); + DALI_LOG_INFO( gWindowLogFilter, Debug::General, "Window (%d) Iconfied\n", handler->mEcoreWindow ); + } + else + { + observer->OnWindowShown(); + DALI_LOG_INFO( gWindowLogFilter, Debug::General, "Window (%d) Shown\n", handler->mEcoreWindow ); + } + handled = ECORE_CALLBACK_DONE; + } + } + + return handled; } +#endif // Data Window* mWindow; Ecore_Event_Handler* mWindowPropertyHandler; - Ecore_Event_Handler* mClientMessageHandler; + Ecore_Event_Handler* mWindowIconifyStateHandler; Ecore_Wl_Window* mEcoreWindow; }; @@ -162,6 +194,34 @@ void Window::ShowIndicator( Dali::Window::IndicatorVisibleMode visibleMode ) DALI_LOG_TRACE_METHOD_FMT( gWindowLogFilter, "visible : %d\n", visibleMode ); DALI_ASSERT_DEBUG(mOverlay); + ECore::WindowRenderSurface* wlSurface( dynamic_cast< ECore::WindowRenderSurface * >( mSurface ) ); + DALI_ASSERT_DEBUG(wlSurface); + Ecore_Wl_Window* wlWindow = wlSurface->GetWlWindow(); + + mIndicatorVisible = visibleMode; + + if ( mIndicatorVisible == Dali::Window::VISIBLE ) + { + // when the indicator is visible, set proper mode for indicator server according to bg mode + if ( mIndicatorOpacityMode == Dali::Window::OPAQUE ) + { + ecore_wl_window_indicator_opacity_set(wlWindow, ECORE_WL_INDICATOR_OPAQUE); + } + else if ( mIndicatorOpacityMode == Dali::Window::TRANSLUCENT ) + { + ecore_wl_window_indicator_opacity_set(wlWindow, ECORE_WL_INDICATOR_TRANSLUCENT); + } + else if ( mIndicatorOpacityMode == Dali::Window::TRANSPARENT ) + { + ecore_wl_window_indicator_opacity_set(wlWindow, ECORE_WL_INDICATOR_OPAQUE); + } + } + else + { + // when the indicator is not visible, set TRANSPARENT mode for indicator server + ecore_wl_window_indicator_opacity_set(wlWindow, ECORE_WL_INDICATOR_TRANSPARENT); // it means hidden indicator + } + DoShowIndicator( mIndicatorOrientation ); } @@ -235,6 +295,11 @@ void Window::Initialize(const PositionSize& windowPosition, const std::string& n mSurface = windowSurface; + std::string appId; + mAdaptor->GetAppId( appId ); + Ecore_Wl_Window* wlWindow = windowSurface ->GetWlWindow(); + ecore_wl_window_class_name_set(wlWindow, appId.c_str()); + mOrientation = Orientation::New(this); // create event handler for Wayland window @@ -299,10 +364,46 @@ void Window::DoRotateIndicator( Dali::Window::WindowOrientation orientation ) void Window::SetIndicatorProperties( bool isShow, Dali::Window::WindowOrientation lastOrientation ) { + ECore::WindowRenderSurface* wlSurface( dynamic_cast< ECore::WindowRenderSurface * >( mSurface ) ); + + if( wlSurface ) + { + Ecore_Wl_Window* wlWindow = wlSurface->GetWlWindow(); + if ( isShow ) + { + ecore_wl_window_indicator_state_set(wlWindow, ECORE_WL_INDICATOR_STATE_ON); + } + else + { + ecore_wl_window_indicator_state_set(wlWindow, ECORE_WL_INDICATOR_STATE_OFF); + } + } } void Window::IndicatorTypeChanged(Indicator::Type type) { +#if defined(DALI_PROFILE_MOBILE) + ECore::WindowRenderSurface* wlSurface( dynamic_cast< ECore::WindowRenderSurface * >( mSurface ) ); + + if( wlSurface ) + { + Ecore_Wl_Window* wlWindow = wlSurface->GetWlWindow(); + switch(type) + { + case Indicator::INDICATOR_TYPE_1: + ecore_wl_indicator_visible_type_set(wlWindow, ECORE_WL_INDICATOR_VISIBLE_TYPE_SHOWN); + break; + + case Indicator::INDICATOR_TYPE_2: + ecore_wl_indicator_visible_type_set(wlWindow, ECORE_WL_INDICATOR_VISIBLE_TYPE_HIDDEN); + break; + + case Indicator::INDICATOR_TYPE_UNKNOWN: + default: + break; + } + } +#endif //MOBILE } void Window::IndicatorClosed( IndicatorInterface* indicator )