X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=adaptors%2Fx11%2Fwindow-impl-x.cpp;h=a460d8c8b46ea3287d5bd835d7bd9f4cdc8208ce;hb=2210a10c19e542a2c4d81372e6e0e171845e4c01;hp=b617086379f40c79e53fab52b9035ecc4cd42e3b;hpb=399fe35eb71b405f1b52ab4fdcb3e788898b8c9a;p=platform%2Fcore%2Fuifw%2Fdali-adaptor.git diff --git a/adaptors/x11/window-impl-x.cpp b/adaptors/x11/window-impl-x.cpp index b617086..a460d8c 100644 --- a/adaptors/x11/window-impl-x.cpp +++ b/adaptors/x11/window-impl-x.cpp @@ -26,13 +26,13 @@ #include #include #include -#include // INTERNAL HEADERS #include #include #include #include +#include #include namespace @@ -63,8 +63,8 @@ struct Window::EventHandler */ EventHandler( Window* window ) : mWindow( window ), - mWindowPropertyHandler( ecore_event_handler_add( ECORE_X_EVENT_WINDOW_PROPERTY, EcoreEventWindowPropertyChanged, this ) ), - mClientMessagehandler( ecore_event_handler_add( ECORE_X_EVENT_CLIENT_MESSAGE, EcoreEventClientMessage, this ) ), + mWindowPropertyHandler( NULL ), + mClientMessagehandler( NULL ), mEcoreWindow( 0 ) { // store ecore window handle @@ -82,6 +82,14 @@ struct Window::EventHandler ECORE_X_ATOM_E_DEICONIFY_APPROVE, &tmp, 1); #endif // DALI_PROFILE_UBUNTU + + if( mWindow->mEcoreEventHander ) + { + ecore_x_input_multi_select( mEcoreWindow ); + mWindowPropertyHandler= ecore_event_handler_add( ECORE_X_EVENT_WINDOW_PROPERTY, EcoreEventWindowPropertyChanged, this ); + mClientMessagehandler = ecore_event_handler_add( ECORE_X_EVENT_CLIENT_MESSAGE, EcoreEventClientMessage, this ); + } + } /** @@ -196,11 +204,11 @@ struct Window::EventHandler }; -Window* Window::New(const PositionSize& posSize, const std::string& name, bool isTransparent) +Window* Window::New(const PositionSize& posSize, const std::string& name, const std::string& className, bool isTransparent) { Window* window = new Window(); window->mIsTransparent = isTransparent; - window->Initialize(posSize, name); + window->Initialize(posSize, name, className); return window; } @@ -240,11 +248,6 @@ RenderSurface* Window::GetSurface() return mSurface; } -void Window::SetIndicatorStyle( Dali::Window::IndicatorStyle style ) -{ - mIndicatorStyle = style; -} - void Window::ShowIndicator( Dali::Window::IndicatorVisibleMode visibleMode ) { DALI_LOG_TRACE_METHOD_FMT( gWindowLogFilter, "visible : %d\n", visibleMode ); @@ -270,7 +273,7 @@ void Window::ShowIndicator( Dali::Window::IndicatorVisibleMode visibleMode ) #if defined(DALI_PROFILE_MOBILE) else if ( mIndicatorOpacityMode == Dali::Window::TRANSPARENT ) { - ecore_x_e_illume_indicator_opacity_set(xWinId, ECORE_X_ILLUME_INDICATOR_BG_TRANSPARENT); + ecore_x_e_illume_indicator_opacity_set(xWinId, ECORE_X_ILLUME_INDICATOR_OPAQUE); } #endif } @@ -315,13 +318,13 @@ void Window::SetClass(std::string name, std::string klass) Window::Window() : mSurface(NULL), - mIndicatorStyle(Dali::Window::CHANGEABLE_COLOR), mIndicatorVisible(Dali::Window::INVISIBLE), mIndicatorIsShown(false), mShowRotatedIndicatorOnClose(false), mStarted(false), mIsTransparent(false), mWMRotationAppSet(false), + mEcoreEventHander(true), mIndicator(NULL), mIndicatorOrientation(Dali::Window::PORTRAIT), mNextIndicatorOrientation(Dali::Window::PORTRAIT), @@ -331,6 +334,17 @@ Window::Window() mEventHandler(NULL), mPreferredOrientation(Dali::Window::PORTRAIT) { + + // Detect if we're not running in a ecore main loop (e.g. libuv). + // Typically ecore_x_init is called by app_efl_main->elm_init + // but if we're not using app_efl_main then we have to call it ourselves + // This is a hack until we create a pure X Window class + if( ecore_x_display_get() == NULL ) + { + mEcoreEventHander = false; + ecore_x_init (NULL); // internally calls _ecore_x_input_init + } + } Window::~Window() @@ -357,12 +371,15 @@ Window::~Window() delete mSurface; } -void Window::Initialize(const PositionSize& windowPosition, const std::string& name) +void Window::Initialize(const PositionSize& windowPosition, const std::string& name, const std::string& className) { // create an X11 window by default Any surface; - Any display; - mSurface = new ECore::WindowRenderSurface( windowPosition, surface, display, name, mIsTransparent ); + ECore::WindowRenderSurface* windowSurface = new ECore::WindowRenderSurface( windowPosition, surface, name, className, mIsTransparent ); + windowSurface->Map(); + + mSurface = windowSurface; + mOrientation = Orientation::New(this); // create event handler for X11 window @@ -375,7 +392,7 @@ void Window::DoShowIndicator( Dali::Window::WindowOrientation lastOrientation ) { if( mIndicatorVisible != Dali::Window::INVISIBLE ) { - mIndicator = new Indicator( mAdaptor, mIndicatorOrientation, mIndicatorStyle, this ); + mIndicator = new Indicator( mAdaptor, mIndicatorOrientation, this ); mIndicator->SetOpacityMode( mIndicatorOpacityMode ); Dali::Actor actor = mIndicator->GetActor(); SetIndicatorActorRotation(); @@ -489,7 +506,7 @@ void Window::IndicatorClosed( Indicator* indicator ) void Window::IndicatorVisibilityChanged(bool isVisible) { - mIndicatorVisibilityChangedSignalV2.Emit(isVisible); + mIndicatorVisibilityChangedSignal.Emit(isVisible); } void Window::SetIndicatorActorRotation() @@ -503,22 +520,22 @@ void Window::SetIndicatorActorRotation() case Dali::Window::PORTRAIT: actor.SetParentOrigin( ParentOrigin::TOP_CENTER ); actor.SetAnchorPoint( AnchorPoint::TOP_CENTER ); - actor.SetRotation( Degree(0), Vector3::ZAXIS ); + actor.SetOrientation( Degree(0), Vector3::ZAXIS ); break; case Dali::Window::PORTRAIT_INVERSE: actor.SetParentOrigin( ParentOrigin::BOTTOM_CENTER ); actor.SetAnchorPoint( AnchorPoint::TOP_CENTER ); - actor.SetRotation( Degree(180), Vector3::ZAXIS ); + actor.SetOrientation( Degree(180), Vector3::ZAXIS ); break; case Dali::Window::LANDSCAPE: actor.SetParentOrigin( ParentOrigin::CENTER_LEFT ); actor.SetAnchorPoint( AnchorPoint::TOP_CENTER ); - actor.SetRotation( Degree(270), Vector3::ZAXIS ); + actor.SetOrientation( Degree(270), Vector3::ZAXIS ); break; case Dali::Window::LANDSCAPE_INVERSE: actor.SetParentOrigin( ParentOrigin::CENTER_RIGHT ); actor.SetAnchorPoint( AnchorPoint::TOP_CENTER ); - actor.SetRotation( Degree(90), Vector3::ZAXIS ); + actor.SetOrientation( Degree(90), Vector3::ZAXIS ); break; } } @@ -606,11 +623,6 @@ void Window::OnDestroy() mAdaptor = NULL; } -OrientationPtr Window::GetOrientation() -{ - return mOrientation; -} - void Window::AddAvailableOrientation(Dali::Window::WindowOrientation orientation) { bool found = false;