2 * Copyright (c) 2017 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
19 #include <dali/internal/window-system/common/window-impl.h>
22 // Ecore is littered with C style cast
23 #pragma GCC diagnostic push
24 #pragma GCC diagnostic ignored "-Wold-style-cast"
26 #include <Ecore_Wayland.h>
27 #include <tizen-extension-client-protocol.h>
29 #include <dali/integration-api/core.h>
30 #include <dali/integration-api/system-overlay.h>
31 #include <dali/public-api/render-tasks/render-task.h>
32 #include <dali/public-api/render-tasks/render-task-list.h>
33 #include <dali/devel-api/adaptor-framework/orientation.h>
36 #include <dali/internal/window-system/tizen-wayland/window-render-surface-ecore-wl.h>
37 #include <dali/internal/input/common/drag-and-drop-detector-impl.h>
38 #include <dali/internal/window-system/common/ecore-indicator-impl.h>
39 #include <dali/internal/window-system/common/window-visibility-observer.h>
40 #include <dali/internal/window-system/common/orientation-impl.h>
45 const float INDICATOR_ANIMATION_DURATION( 0.18f ); // 180 milli seconds
46 const float INDICATOR_SHOW_Y_POSITION( 0.0f );
47 const float INDICATOR_HIDE_Y_POSITION( -52.0f );
49 const uint32_t MAX_TIZEN_CLIENT_VERSION = 7;
60 #if defined(DEBUG_ENABLED)
61 Debug::Filter* gWindowLogFilter = Debug::Filter::New(Debug::NoLogging, false, "LOG_WINDOW");
65 * TODO: Abstract Window class out and move this into a window implementation for Ecore
67 struct Window::EventHandler
71 * @param[in] window A pointer to the window class.
73 EventHandler( Window* window )
80 mTizenDisplayPolicy( NULL ),
81 mNotificationLevel( -1 ),
82 mNotificationChangeState( 0 ),
83 mNotificationLevelChangeDone( true ),
85 mScreenOffModeChangeState( 0 ),
86 mScreenOffModeChangeDone( true ),
88 mBrightnessChangeState( 0 ),
89 mBrightnessChangeDone( true )
91 // store ecore window handle
92 ECore::WindowRenderSurface* wlWindow( dynamic_cast< ECore::WindowRenderSurface * >( mWindow->mSurface ) );
95 mEcoreWindow = wlWindow->GetWlWindow();
97 DALI_ASSERT_ALWAYS( mEcoreWindow != 0 && "There is no ecore Wl window");
99 if( mWindow->mEcoreEventHander )
101 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_WL_EVENT_WINDOW_ICONIFY_STATE_CHANGE, EcoreEventWindowIconifyStateChanged, this ) );
102 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_WL_EVENT_FOCUS_IN, EcoreEventWindowFocusIn, this ) );
103 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_WL_EVENT_FOCUS_OUT, EcoreEventWindowFocusOut, this ) );
104 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_WL_EVENT_OUTPUT_TRANSFORM, EcoreEventOutputTransform, this) );
105 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_WL_EVENT_IGNORE_OUTPUT_TRANSFORM, EcoreEventIgnoreOutputTransform, this) );
108 mDisplay = ecore_wl_display_get();
112 wl_display* displayWrapper = static_cast< wl_display* >( wl_proxy_create_wrapper( mDisplay ) );
115 mEventQueue = wl_display_create_queue( mDisplay );
118 wl_proxy_set_queue( reinterpret_cast< wl_proxy* >( displayWrapper ), mEventQueue );
120 wl_registry* registry = wl_display_get_registry( displayWrapper );
121 wl_registry_add_listener( registry, &mRegistryListener, this );
124 wl_proxy_wrapper_destroy( displayWrapper );
134 for( Dali::Vector< Ecore_Event_Handler* >::Iterator iter = mEcoreEventHandler.Begin(), endIter = mEcoreEventHandler.End(); iter != endIter; ++iter )
136 ecore_event_handler_del( *iter );
138 mEcoreEventHandler.Clear();
142 wl_event_queue_destroy( mEventQueue );
148 /// Called when the window iconify state is changed.
149 static Eina_Bool EcoreEventWindowIconifyStateChanged( void* data, int type, void* event )
151 Ecore_Wl_Event_Window_Iconify_State_Change* iconifyChangedEvent( static_cast< Ecore_Wl_Event_Window_Iconify_State_Change* >( event ) );
152 EventHandler* handler( static_cast< EventHandler* >( data ) );
153 Eina_Bool handled( ECORE_CALLBACK_PASS_ON );
155 if ( handler && handler->mWindow )
157 WindowVisibilityObserver* observer( handler->mWindow->mAdaptor );
158 if ( observer && ( iconifyChangedEvent->win == static_cast< unsigned int> ( ecore_wl_window_id_get( handler->mEcoreWindow ) ) ) )
160 if( iconifyChangedEvent->iconified == EINA_TRUE )
162 handler->mWindow->mIconified = true;
163 if( handler->mWindow->mVisible )
165 observer->OnWindowHidden();
167 DALI_LOG_RELEASE_INFO( "Window (%p) Iconified\n", handler->mEcoreWindow);
171 handler->mWindow->mIconified = false;
172 if( handler->mWindow->mVisible )
174 observer->OnWindowShown();
176 DALI_LOG_RELEASE_INFO( "Window (%p) Deiconified\n", handler->mEcoreWindow );
178 handled = ECORE_CALLBACK_DONE;
185 /// Called when the window gains focus
186 static Eina_Bool EcoreEventWindowFocusIn( void* data, int type, void* event )
188 Ecore_Wl_Event_Focus_In* focusInEvent( static_cast< Ecore_Wl_Event_Focus_In* >( event ) );
189 EventHandler* handler( static_cast< EventHandler* >( data ) );
191 if ( handler && handler->mWindow && focusInEvent->win == static_cast< unsigned int >( ecore_wl_window_id_get( handler->mEcoreWindow ) ) )
193 DALI_LOG_INFO( gWindowLogFilter, Debug::General, "Window EcoreEventWindowFocusIn\n" );
195 handler->mWindow->mFocusChangedSignal.Emit( true );
198 return ECORE_CALLBACK_PASS_ON;
201 /// Called when the window loses focus
202 static Eina_Bool EcoreEventWindowFocusOut( void* data, int type, void* event )
204 Ecore_Wl_Event_Focus_Out* focusOutEvent( static_cast< Ecore_Wl_Event_Focus_Out* >( event ) );
205 EventHandler* handler( static_cast< EventHandler* >( data ) );
207 if ( handler && handler->mWindow && focusOutEvent->win == static_cast< unsigned int >(ecore_wl_window_id_get( handler->mEcoreWindow ) ) )
209 DALI_LOG_INFO( gWindowLogFilter, Debug::General, "Window EcoreEventWindowFocusOut\n" );
211 handler->mWindow->mFocusChangedSignal.Emit( false );
214 return ECORE_CALLBACK_PASS_ON;
217 /// Called when the output is transformed
218 static Eina_Bool EcoreEventOutputTransform( void* data, int type, void* event )
220 Ecore_Wl_Event_Output_Transform* transformEvent( static_cast< Ecore_Wl_Event_Output_Transform* >( event ) );
221 EventHandler* handler( static_cast< EventHandler* >( data ) );
223 if ( handler && handler->mWindow && transformEvent->output == ecore_wl_window_output_find( handler->mEcoreWindow ) )
225 DALI_LOG_INFO( gWindowLogFilter, Debug::General, "Window (%p) EcoreEventOutputTransform\n", handler->mEcoreWindow );
227 ECore::WindowRenderSurface* wlSurface( dynamic_cast< ECore::WindowRenderSurface * >( handler->mWindow->mSurface ) );
230 wlSurface->OutputTransformed();
232 PositionSize positionSize = wlSurface->GetPositionSize();
233 handler->mWindow->mAdaptor->SurfaceResizePrepare( Adaptor::SurfaceSize( positionSize.width, positionSize.height ) );
234 handler->mWindow->mAdaptor->SurfaceResizeComplete( Adaptor::SurfaceSize( positionSize.width, positionSize.height ) );
238 return ECORE_CALLBACK_PASS_ON;
241 /// Called when the output transform should be ignored
242 static Eina_Bool EcoreEventIgnoreOutputTransform( void* data, int type, void* event )
244 Ecore_Wl_Event_Ignore_Output_Transform* ignoreTransformEvent( static_cast< Ecore_Wl_Event_Ignore_Output_Transform* >( event ) );
245 EventHandler* handler( static_cast< EventHandler* >( data ) );
247 if ( handler && handler->mWindow && ignoreTransformEvent->win == handler->mEcoreWindow )
249 DALI_LOG_INFO( gWindowLogFilter, Debug::General, "Window (%p) EcoreEventIgnoreOutputTransform\n", handler->mEcoreWindow );
251 ECore::WindowRenderSurface* wlSurface( dynamic_cast< ECore::WindowRenderSurface * >( handler->mWindow->mSurface ) );
254 wlSurface->OutputTransformed();
256 PositionSize positionSize = wlSurface->GetPositionSize();
257 handler->mWindow->mAdaptor->SurfaceResizePrepare( Adaptor::SurfaceSize( positionSize.width, positionSize.height ) );
258 handler->mWindow->mAdaptor->SurfaceResizeComplete( Adaptor::SurfaceSize( positionSize.width, positionSize.height ) );
262 return ECORE_CALLBACK_PASS_ON;
265 static void RegistryGlobalCallback( void* data, struct wl_registry *registry, uint32_t name, const char* interface, uint32_t version )
267 Window::EventHandler* eventHandler = static_cast< Window::EventHandler* >( data );
269 if( strcmp( interface, tizen_policy_interface.name ) == 0 )
271 uint32_t clientVersion = std::min( version, MAX_TIZEN_CLIENT_VERSION );
273 eventHandler->mTizenPolicy = static_cast< tizen_policy* >( wl_registry_bind( registry, name, &tizen_policy_interface, clientVersion ) );
274 if( !eventHandler->mTizenPolicy )
276 DALI_LOG_INFO( gWindowLogFilter, Debug::General, "Window::EventHandler::RegistryGlobalCallback: wl_registry_bind(tizen_policy_interface) is failed.\n" );
280 tizen_policy_add_listener( eventHandler->mTizenPolicy, &eventHandler->mTizenPolicyListener, data );
282 DALI_LOG_INFO( gWindowLogFilter, Debug::General, "Window::EventHandler::RegistryGlobalCallback: tizen_policy_add_listener is called.\n" );
284 else if( strcmp( interface, tizen_display_policy_interface.name ) == 0 )
286 eventHandler->mTizenDisplayPolicy = static_cast< tizen_display_policy* >( wl_registry_bind( registry, name, &tizen_display_policy_interface, version ) );
287 if( !eventHandler->mTizenDisplayPolicy )
289 DALI_LOG_INFO( gWindowLogFilter, Debug::General, "Window::EventHandler::RegistryGlobalCallback: wl_registry_bind(tizen_display_policy_interface) is failed.\n" );
293 tizen_display_policy_add_listener( eventHandler->mTizenDisplayPolicy, &eventHandler->mTizenDisplayPolicyListener, data );
295 DALI_LOG_INFO( gWindowLogFilter, Debug::General, "Window::EventHandler::RegistryGlobalCallback: tizen_display_policy_add_listener is called.\n" );
299 static void RegistryGlobalCallbackRemove( void* data, struct wl_registry* registry, uint32_t id )
301 Window::EventHandler* eventHandler = static_cast< Window::EventHandler* >( data );
302 eventHandler->mTizenPolicy = NULL;
303 eventHandler->mTizenDisplayPolicy = NULL;
306 static void TizenPolicyConformant( void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, uint32_t isConformant )
310 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 )
314 static void TizenPolicyNotificationChangeDone(void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, int32_t level, uint32_t state )
316 Window::EventHandler* eventHandler = static_cast< Window::EventHandler* >( data );
318 eventHandler->mNotificationLevel = level;
319 eventHandler->mNotificationChangeState = state;
320 eventHandler->mNotificationLevelChangeDone = true;
322 DALI_LOG_INFO( gWindowLogFilter, Debug::General, "Window::EventHandler::TizenPolicyNotificationChangeDone: level = %d, state = %d\n", level, state );
325 static void TizenPolicyTransientForDone( void* data, struct tizen_policy* tizenPolicy, uint32_t childId )
329 static void TizenPolicyScreenModeChangeDone( void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, uint32_t mode, uint32_t state )
331 Window::EventHandler* eventHandler = static_cast< Window::EventHandler* >( data );
333 eventHandler->mScreenOffMode = mode;
334 eventHandler->mScreenOffModeChangeState = state;
335 eventHandler->mScreenOffModeChangeDone = true;
337 DALI_LOG_INFO( gWindowLogFilter, Debug::General, "Window::EventHandler::TizenPolicyScreenModeChangeDone: mode = %d, state = %d\n", mode, state );
340 static void TizenPolicyIconifyStateChanged( void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, uint32_t iconified, uint32_t force )
344 static void TizenPolicySupportedAuxiliaryHints( void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, struct wl_array* hints, uint32_t numNints )
348 static void TizenPolicyAllowedAuxiliaryHint( void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, int id )
352 static void TizenPolicyAuxiliaryMessage( void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, const char* key, const char* val, struct wl_array* options )
356 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 )
360 static void DisplayPolicyBrightnessChangeDone( void* data, struct tizen_display_policy *displayPolicy, struct wl_surface* surface, int32_t brightness, uint32_t state )
362 Window::EventHandler* eventHandler = static_cast< Window::EventHandler* >( data );
364 eventHandler->mBrightness = brightness;
365 eventHandler->mBrightnessChangeState = state;
366 eventHandler->mBrightnessChangeDone = true;
368 DALI_LOG_INFO( gWindowLogFilter, Debug::General, "Window::EventHandler::DisplayPolicyBrightnessChangeDone: brightness = %d, state = %d\n", brightness, state );
371 const struct wl_registry_listener mRegistryListener =
373 RegistryGlobalCallback,
374 RegistryGlobalCallbackRemove
377 const struct tizen_policy_listener mTizenPolicyListener =
379 TizenPolicyConformant,
380 TizenPolicyConformantArea,
381 TizenPolicyNotificationChangeDone,
382 TizenPolicyTransientForDone,
383 TizenPolicyScreenModeChangeDone,
384 TizenPolicyIconifyStateChanged,
385 TizenPolicySupportedAuxiliaryHints,
386 TizenPolicyAllowedAuxiliaryHint,
387 TizenPolicyAuxiliaryMessage,
388 TizenPolicyConformantRegion
391 const struct tizen_display_policy_listener mTizenDisplayPolicyListener =
393 DisplayPolicyBrightnessChangeDone
398 Dali::Vector< Ecore_Event_Handler* > mEcoreEventHandler;
399 Ecore_Wl_Window* mEcoreWindow;
401 wl_display* mDisplay;
402 wl_event_queue* mEventQueue;
403 tizen_policy* mTizenPolicy;
404 tizen_display_policy* mTizenDisplayPolicy;
406 int mNotificationLevel;
407 uint32_t mNotificationChangeState;
408 bool mNotificationLevelChangeDone;
411 uint32_t mScreenOffModeChangeState;
412 bool mScreenOffModeChangeDone;
415 uint32_t mBrightnessChangeState;
416 bool mBrightnessChangeDone;
419 Window* Window::New( const PositionSize& positionSize, const std::string& name, const std::string& className, bool isTransparent )
421 Window* window = new Window();
422 window->mIsTransparent = isTransparent;
423 window->Initialize( positionSize, name, className );
427 void Window::SetAdaptor(Dali::Adaptor& adaptor)
429 DALI_ASSERT_ALWAYS( !mStarted && "Adaptor already started" );
432 // Only create one overlay per window
433 Internal::Adaptor::Adaptor& adaptorImpl = Internal::Adaptor::Adaptor::GetImplementation(adaptor);
434 Integration::Core& core = adaptorImpl.GetCore();
435 mOverlay = &core.GetSystemOverlay();
437 Dali::RenderTaskList taskList = mOverlay->GetOverlayRenderTasks();
438 taskList.CreateTask();
440 mAdaptor = &adaptorImpl;
441 mAdaptor->AddObserver( *this );
443 // Can only create the detector when we know the Core has been instantiated.
444 mDragAndDropDetector = DragAndDropDetector::New();
445 mAdaptor->SetDragAndDropDetector( &GetImplementation( mDragAndDropDetector ) );
449 mOrientation->SetAdaptor(adaptor);
452 if( mIndicator != NULL )
454 mIndicator->SetAdaptor(mAdaptor);
458 RenderSurface* Window::GetSurface()
463 void Window::ShowIndicator( Dali::Window::IndicatorVisibleMode visibleMode )
465 DALI_LOG_TRACE_METHOD_FMT( gWindowLogFilter, "visible : %d\n", visibleMode );
466 DALI_ASSERT_DEBUG(mOverlay);
468 ECore::WindowRenderSurface* wlSurface( dynamic_cast< ECore::WindowRenderSurface * >( mSurface ) );
469 DALI_ASSERT_DEBUG(wlSurface);
473 Ecore_Wl_Window* wlWindow = wlSurface->GetWlWindow();
475 mIndicatorVisible = visibleMode;
477 if ( mIndicatorVisible == Dali::Window::VISIBLE )
479 // when the indicator is visible, set proper mode for indicator server according to bg mode
480 if ( mIndicatorOpacityMode == Dali::Window::OPAQUE )
482 ecore_wl_window_indicator_opacity_set(wlWindow, ECORE_WL_INDICATOR_OPAQUE);
484 else if ( mIndicatorOpacityMode == Dali::Window::TRANSLUCENT )
486 ecore_wl_window_indicator_opacity_set(wlWindow, ECORE_WL_INDICATOR_TRANSLUCENT);
488 else if ( mIndicatorOpacityMode == Dali::Window::TRANSPARENT )
490 ecore_wl_window_indicator_opacity_set(wlWindow, ECORE_WL_INDICATOR_OPAQUE);
495 // when the indicator is not visible, set TRANSPARENT mode for indicator server
496 ecore_wl_window_indicator_opacity_set(wlWindow, ECORE_WL_INDICATOR_TRANSPARENT); // it means hidden indicator
500 DoShowIndicator( mIndicatorOrientation );
503 void Window::RotateIndicator( Dali::Window::WindowOrientation orientation )
505 DALI_LOG_TRACE_METHOD_FMT( gWindowLogFilter, "Orientation: %d\n", orientation );
507 DoRotateIndicator( orientation );
510 void Window::SetIndicatorBgOpacity( Dali::Window::IndicatorBgOpacity opacityMode )
512 mIndicatorOpacityMode = opacityMode;
514 if( mIndicator != NULL )
516 mIndicator->SetOpacityMode( opacityMode );
520 void Window::SetClass(std::string name, std::string klass)
522 ECore::WindowRenderSurface* wlSurface( dynamic_cast< ECore::WindowRenderSurface * >( mSurface ) );
526 Ecore_Wl_Window* wlWindow = wlSurface->GetWlWindow();
527 ecore_wl_window_title_set( wlWindow, name.c_str() );
528 ecore_wl_window_class_name_set( wlWindow, klass.c_str() );
532 DALI_LOG_INFO( gWindowLogFilter, Debug::General, "Window has no surface\n" );
538 mIndicatorVisible( Dali::Window::VISIBLE ),
539 mIndicatorIsShown( false ),
540 mShowRotatedIndicatorOnClose( false ),
542 mIsTransparent( false ),
543 mWMRotationAppSet( false ),
544 mEcoreEventHander( true ),
545 mIsFocusAcceptable( true ),
548 mOpaqueState( false ),
549 mResizeEnabled( false ),
551 mIndicatorOrientation( Dali::Window::PORTRAIT ),
552 mNextIndicatorOrientation( Dali::Window::PORTRAIT ),
553 mIndicatorOpacityMode( Dali::Window::OPAQUE ),
556 mType( Dali::Window::NORMAL ),
557 mEventHandler( NULL ),
558 mPreferredOrientation( Dali::Window::PORTRAIT ),
559 mSupportedAuxiliaryHints(),
561 mIndicatorVisibilityChangedSignal(),
562 mFocusChangedSignal(),
564 mDeleteRequestSignal()
570 delete mEventHandler;
580 mAdaptor->RemoveObserver( *this );
581 mAdaptor->SetDragAndDropDetector( NULL );
587 mSupportedAuxiliaryHints.clear();
588 mAuxiliaryHints.clear();
591 void Window::Initialize(const PositionSize& positionSize, const std::string& name, const std::string& className)
593 // create an Wayland window by default
595 ECore::WindowRenderSurface* windowSurface = new ECore::WindowRenderSurface( positionSize, surface, name, mIsTransparent );
597 mSurface = windowSurface;
599 // create event handler for Wayland window
600 mEventHandler = new EventHandler( this );
602 // get auxiliary hint
603 Eina_List* hints = ecore_wl_window_aux_hints_supported_get( mEventHandler->mEcoreWindow );
609 for( l = hints, ( hint = static_cast< char* >( eina_list_data_get(l) ) ); l; l = eina_list_next(l), ( hint = static_cast< char* >( eina_list_data_get(l) ) ) )
611 mSupportedAuxiliaryHints.push_back( hint );
613 DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::Initialize: %s\n", hint );
617 if( !positionSize.IsEmpty() )
619 AddAuxiliaryHint( "wm.policy.win.user.geometry", "1" );
620 mResizeEnabled = true;
623 SetClass( name, className );
624 windowSurface->Map();
626 mOrientation = Orientation::New(this);
629 void Window::DoShowIndicator( Dali::Window::WindowOrientation lastOrientation )
631 if( mIndicator == NULL )
633 if( mIndicatorVisible != Dali::Window::INVISIBLE )
635 mIndicator = new Indicator( mAdaptor, mIndicatorOrientation, this );
636 mIndicator->SetOpacityMode( mIndicatorOpacityMode );
637 Dali::Actor actor = mIndicator->GetActor();
638 SetIndicatorActorRotation();
639 mOverlay->Add(actor);
641 // else don't create a hidden indicator
643 else // Already have indicator
645 if( mIndicatorVisible == Dali::Window::VISIBLE )
647 // If we are resuming, and rotation has changed,
648 if( mIndicatorIsShown == false && mIndicatorOrientation != mNextIndicatorOrientation )
650 // then close current indicator and open new one
651 mShowRotatedIndicatorOnClose = true;
652 mIndicator->Close(); // May synchronously call IndicatorClosed() callback & 1 level of recursion
653 // Don't show actor - will contain indicator for old orientation.
658 // set indicator visible mode
659 if( mIndicator != NULL )
661 mIndicator->SetVisible( mIndicatorVisible );
664 bool show = (mIndicatorVisible != Dali::Window::INVISIBLE );
665 SetIndicatorProperties( show, lastOrientation );
666 mIndicatorIsShown = show;
669 void Window::DoRotateIndicator( Dali::Window::WindowOrientation orientation )
671 if( mIndicatorIsShown )
673 mShowRotatedIndicatorOnClose = true;
674 mNextIndicatorOrientation = orientation;
675 mIndicator->Close(); // May synchronously call IndicatorClosed() callback
679 // Save orientation for when the indicator is next shown
680 mShowRotatedIndicatorOnClose = false;
681 mNextIndicatorOrientation = orientation;
685 void Window::SetIndicatorProperties( bool isShow, Dali::Window::WindowOrientation lastOrientation )
687 ECore::WindowRenderSurface* wlSurface( dynamic_cast< ECore::WindowRenderSurface * >( mSurface ) );
691 Ecore_Wl_Window* wlWindow = wlSurface->GetWlWindow();
694 ecore_wl_window_indicator_state_set(wlWindow, ECORE_WL_INDICATOR_STATE_ON);
698 ecore_wl_window_indicator_state_set(wlWindow, ECORE_WL_INDICATOR_STATE_OFF);
703 void Window::IndicatorTypeChanged(Indicator::Type type)
705 #if defined(DALI_PROFILE_MOBILE)
706 ECore::WindowRenderSurface* wlSurface( dynamic_cast< ECore::WindowRenderSurface * >( mSurface ) );
710 Ecore_Wl_Window* wlWindow = wlSurface->GetWlWindow();
713 case Indicator::INDICATOR_TYPE_1:
714 ecore_wl_indicator_visible_type_set(wlWindow, ECORE_WL_INDICATOR_VISIBLE_TYPE_SHOWN);
717 case Indicator::INDICATOR_TYPE_2:
718 ecore_wl_indicator_visible_type_set(wlWindow, ECORE_WL_INDICATOR_VISIBLE_TYPE_HIDDEN);
721 case Indicator::INDICATOR_TYPE_UNKNOWN:
729 void Window::IndicatorClosed( IndicatorInterface* indicator )
731 DALI_LOG_TRACE_METHOD( gWindowLogFilter );
733 if( mShowRotatedIndicatorOnClose )
735 Dali::Window::WindowOrientation currentOrientation = mIndicatorOrientation;
736 mIndicator->Open(mNextIndicatorOrientation);
737 mIndicatorOrientation = mNextIndicatorOrientation;
738 SetIndicatorActorRotation();
739 DoShowIndicator(currentOrientation);
743 void Window::IndicatorVisibilityChanged(bool isVisible)
745 mIndicatorVisibilityChangedSignal.Emit(isVisible);
748 void Window::SetIndicatorActorRotation()
750 DALI_LOG_TRACE_METHOD( gWindowLogFilter );
751 DALI_ASSERT_DEBUG( mIndicator != NULL );
753 Dali::Actor actor = mIndicator->GetActor();
754 switch( mIndicatorOrientation )
756 case Dali::Window::PORTRAIT:
757 actor.SetParentOrigin( ParentOrigin::TOP_CENTER );
758 actor.SetAnchorPoint( AnchorPoint::TOP_CENTER );
759 actor.SetOrientation( Degree(0), Vector3::ZAXIS );
761 case Dali::Window::PORTRAIT_INVERSE:
762 actor.SetParentOrigin( ParentOrigin::BOTTOM_CENTER );
763 actor.SetAnchorPoint( AnchorPoint::TOP_CENTER );
764 actor.SetOrientation( Degree(180), Vector3::ZAXIS );
766 case Dali::Window::LANDSCAPE:
767 actor.SetParentOrigin( ParentOrigin::CENTER_LEFT );
768 actor.SetAnchorPoint( AnchorPoint::TOP_CENTER );
769 actor.SetOrientation( Degree(270), Vector3::ZAXIS );
771 case Dali::Window::LANDSCAPE_INVERSE:
772 actor.SetParentOrigin( ParentOrigin::CENTER_RIGHT );
773 actor.SetAnchorPoint( AnchorPoint::TOP_CENTER );
774 actor.SetOrientation( Degree(90), Vector3::ZAXIS );
781 // Use ecore_wl_window_activate to prevent the window shown without rendering
782 ecore_wl_window_activate( mEventHandler->mEcoreWindow );
787 ecore_wl_window_lower( mEventHandler->mEcoreWindow );
790 void Window::Activate()
792 ecore_wl_window_activate( mEventHandler->mEcoreWindow );
795 Dali::DragAndDropDetector Window::GetDragAndDropDetector() const
797 return mDragAndDropDetector;
800 Dali::Any Window::GetNativeHandle() const
804 return mEventHandler->mEcoreWindow;
812 void Window::OnStart()
814 DoShowIndicator( mIndicatorOrientation );
817 void Window::OnPause()
821 void Window::OnResume()
823 // resume indicator status
824 if( mIndicator != NULL )
826 // Restore own indicator opacity
827 // Send opacity mode to indicator service when app resumed
828 mIndicator->SetOpacityMode( mIndicatorOpacityMode );
832 void Window::OnStop()
843 void Window::OnDestroy()
848 void Window::AddAvailableOrientation(Dali::Window::WindowOrientation orientation)
852 if ( orientation <= Dali::Window::LANDSCAPE_INVERSE )
854 for( std::size_t i = 0; i < mAvailableOrientations.size(); i++ )
856 if( mAvailableOrientations[i] == orientation )
865 mAvailableOrientations.push_back(orientation);
866 SetAvailableOrientations( mAvailableOrientations );
871 void Window::RemoveAvailableOrientation(Dali::Window::WindowOrientation orientation)
873 for( std::vector<Dali::Window::WindowOrientation>::iterator iter = mAvailableOrientations.begin();
874 iter != mAvailableOrientations.end(); ++iter )
876 if( *iter == orientation )
878 mAvailableOrientations.erase( iter );
882 SetAvailableOrientations( mAvailableOrientations );
885 void Window::SetAvailableOrientations(const std::vector<Dali::Window::WindowOrientation>& orientations)
888 for( std::size_t i = 0; i < mAvailableOrientations.size(); ++i )
890 rotations[i] = static_cast< int >( mAvailableOrientations[i] );
892 ecore_wl_window_rotation_available_rotations_set( mEventHandler->mEcoreWindow, rotations, mAvailableOrientations.size() );
895 const std::vector<Dali::Window::WindowOrientation>& Window::GetAvailableOrientations()
897 return mAvailableOrientations;
900 void Window::SetPreferredOrientation(Dali::Window::WindowOrientation orientation)
902 mPreferredOrientation = orientation;
904 ecore_wl_window_rotation_preferred_rotation_set( mEventHandler->mEcoreWindow, orientation );
907 Dali::Window::WindowOrientation Window::GetPreferredOrientation()
909 return mPreferredOrientation;
912 void Window::SetAcceptFocus( bool accept )
914 mIsFocusAcceptable = accept;
916 ecore_wl_window_focus_skip_set( mEventHandler->mEcoreWindow, !accept );
919 bool Window::IsFocusAcceptable() const
921 return mIsFocusAcceptable;
927 ecore_wl_window_show( mEventHandler->mEcoreWindow );
933 WindowVisibilityObserver* observer( mAdaptor );
934 observer->OnWindowShown();
935 DALI_LOG_RELEASE_INFO( "Window (%p) ::Show() \n", mEventHandler->mEcoreWindow);
943 ecore_wl_window_hide( mEventHandler->mEcoreWindow );
949 WindowVisibilityObserver* observer( mAdaptor );
950 observer->OnWindowHidden();
951 DALI_LOG_RELEASE_INFO( "Window (%p) ::Hide() \n", mEventHandler->mEcoreWindow);
956 bool Window::IsVisible() const
961 void Window::RotationDone( int orientation, int width, int height )
963 ECore::WindowRenderSurface* wlSurface( dynamic_cast< ECore::WindowRenderSurface * >( mSurface ) );
966 wlSurface->RequestRotation( orientation, width, height );
969 mAdaptor->SurfaceResizePrepare( Adaptor::SurfaceSize( width, height ) );
972 mResizedSignal.Emit( Dali::Window::WindowSize( width, height ) );
974 mAdaptor->SurfaceResizeComplete( Adaptor::SurfaceSize( width, height ) );
977 void Window::SetIndicatorVisibleMode( Dali::Window::IndicatorVisibleMode mode )
979 mIndicatorVisible = mode;
982 unsigned int Window::GetSupportedAuxiliaryHintCount() const
984 return mSupportedAuxiliaryHints.size();
987 std::string Window::GetSupportedAuxiliaryHint( unsigned int index ) const
989 if( index >= GetSupportedAuxiliaryHintCount() )
991 DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::GetSupportedAuxiliaryHint: Invalid index! [%d]\n", index );
994 return mSupportedAuxiliaryHints[index];
997 unsigned int Window::AddAuxiliaryHint( const std::string& hint, const std::string& value )
999 bool supported = false;
1001 // Check if the hint is suppported
1002 for( std::vector< std::string >::iterator iter = mSupportedAuxiliaryHints.begin(); iter != mSupportedAuxiliaryHints.end(); ++iter )
1013 DALI_LOG_INFO( gWindowLogFilter, Debug::Concise, "Window::AddAuxiliaryHint: Not supported auxiliary hint [%s]\n", hint.c_str() );
1017 // Check if the hint is already added
1018 for( unsigned int i = 0; i < mAuxiliaryHints.size(); i++ )
1020 if( mAuxiliaryHints[i].first == hint )
1022 // Just change the value
1023 mAuxiliaryHints[i].second = value;
1025 DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::AddAuxiliaryHint: Change! hint = %s, value = %s, id = %d\n", hint.c_str(), value.c_str(), i + 1 );
1027 return i + 1; // id is index + 1
1032 mAuxiliaryHints.push_back( std::pair< std::string, std::string >( hint, value ) );
1034 unsigned int id = mAuxiliaryHints.size();
1036 ecore_wl_window_aux_hint_add( mEventHandler->mEcoreWindow, static_cast< int >( id ), hint.c_str(), value.c_str() );
1038 DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::AddAuxiliaryHint: hint = %s, value = %s, id = %d\n", hint.c_str(), value.c_str(), id );
1043 bool Window::RemoveAuxiliaryHint( unsigned int id )
1045 if( id == 0 || id > mAuxiliaryHints.size() )
1047 DALI_LOG_INFO( gWindowLogFilter, Debug::Concise, "Window::RemoveAuxiliaryHint: Invalid id [%d]\n", id );
1051 mAuxiliaryHints[id - 1].second = std::string();
1053 ecore_wl_window_aux_hint_del( mEventHandler->mEcoreWindow, static_cast< int >( id ) );
1055 DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::RemoveAuxiliaryHint: id = %d, hint = %s\n", id, mAuxiliaryHints[id - 1].first.c_str() );
1060 bool Window::SetAuxiliaryHintValue( unsigned int id, const std::string& value )
1062 if( id == 0 || id > mAuxiliaryHints.size() )
1064 DALI_LOG_INFO( gWindowLogFilter, Debug::Concise, "Window::SetAuxiliaryHintValue: Invalid id [%d]\n", id );
1068 mAuxiliaryHints[id - 1].second = value;
1070 ecore_wl_window_aux_hint_change( mEventHandler->mEcoreWindow, static_cast< int >( id ), value.c_str() );
1072 DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::SetAuxiliaryHintValue: id = %d, hint = %s, value = %s\n", id, mAuxiliaryHints[id - 1].first.c_str(), mAuxiliaryHints[id - 1].second.c_str() );
1077 std::string Window::GetAuxiliaryHintValue( unsigned int id ) const
1079 if( id == 0 || id > mAuxiliaryHints.size() )
1081 DALI_LOG_INFO( gWindowLogFilter, Debug::Concise, "Window::GetAuxiliaryHintValue: Invalid id [%d]\n", id );
1082 return std::string();
1085 DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::GetAuxiliaryHintValue: id = %d, hint = %s, value = %s\n", id, mAuxiliaryHints[id - 1].first.c_str(), mAuxiliaryHints[id - 1].second.c_str() );
1087 return mAuxiliaryHints[id - 1].second;
1090 unsigned int Window::GetAuxiliaryHintId( const std::string& hint ) const
1092 for( unsigned int i = 0; i < mAuxiliaryHints.size(); i++ )
1094 if( mAuxiliaryHints[i].first == hint )
1096 DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::GetAuxiliaryHintId: hint = %s, id = %d\n", hint.c_str(), i + 1 );
1101 DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::GetAuxiliaryHintId: Invalid hint! [%s]\n", hint.c_str() );
1106 void Window::SetInputRegion( const Rect< int >& inputRegion )
1108 ecore_wl_window_input_region_set( mEventHandler->mEcoreWindow, inputRegion.x, inputRegion.y, inputRegion.width, inputRegion.height );
1110 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 );
1113 void Window::SetType( Dali::Window::Type type )
1115 Ecore_Wl_Window_Type windowType;
1121 case Dali::Window::NORMAL:
1123 windowType = ECORE_WL_WINDOW_TYPE_TOPLEVEL;
1126 case Dali::Window::NOTIFICATION:
1128 windowType = ECORE_WL_WINDOW_TYPE_NOTIFICATION;
1131 case Dali::Window::UTILITY:
1133 windowType = ECORE_WL_WINDOW_TYPE_UTILITY;
1136 case Dali::Window::DIALOG:
1138 windowType = ECORE_WL_WINDOW_TYPE_DIALOG;
1143 windowType = ECORE_WL_WINDOW_TYPE_TOPLEVEL;
1148 ecore_wl_window_type_set( mEventHandler->mEcoreWindow, windowType );
1154 Dali::Window::Type Window::GetType() const
1159 bool Window::SetNotificationLevel( Dali::Window::NotificationLevel::Type level )
1161 if( mType != Dali::Window::NOTIFICATION )
1163 DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::SetNotificationLevel: Not supported window type [%d]\n", mType );
1167 while( !mEventHandler->mTizenPolicy )
1169 wl_display_dispatch_queue( mEventHandler->mDisplay, mEventHandler->mEventQueue );
1172 int notificationLevel;
1176 case Dali::Window::NotificationLevel::NONE:
1178 notificationLevel = TIZEN_POLICY_LEVEL_NONE;
1181 case Dali::Window::NotificationLevel::BASE:
1183 notificationLevel = TIZEN_POLICY_LEVEL_DEFAULT;
1186 case Dali::Window::NotificationLevel::MEDIUM:
1188 notificationLevel = TIZEN_POLICY_LEVEL_MEDIUM;
1191 case Dali::Window::NotificationLevel::HIGH:
1193 notificationLevel = TIZEN_POLICY_LEVEL_HIGH;
1196 case Dali::Window::NotificationLevel::TOP:
1198 notificationLevel = TIZEN_POLICY_LEVEL_TOP;
1203 DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::SetNotificationLevel: invalid level [%d]\n", level );
1204 notificationLevel = TIZEN_POLICY_LEVEL_DEFAULT;
1209 mEventHandler->mNotificationLevelChangeDone = false;
1210 mEventHandler->mNotificationChangeState = TIZEN_POLICY_ERROR_STATE_NONE;
1212 tizen_policy_set_notification_level( mEventHandler->mTizenPolicy, ecore_wl_window_surface_get( mEventHandler->mEcoreWindow ), notificationLevel );
1216 while( !mEventHandler->mNotificationLevelChangeDone && count < 3 )
1219 wl_display_dispatch_queue( mEventHandler->mDisplay, mEventHandler->mEventQueue );
1223 if( !mEventHandler->mNotificationLevelChangeDone )
1225 DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::SetNotificationLevel: Level change is failed [%d, %d]\n", level, mEventHandler->mNotificationChangeState );
1228 else if( mEventHandler->mNotificationChangeState == TIZEN_POLICY_ERROR_STATE_PERMISSION_DENIED )
1230 DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::SetNotificationLevel: Permission denied! [%d]\n", level );
1234 DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::SetNotificationLevel: Level is changed [%d]\n", mEventHandler->mNotificationLevel );
1239 Dali::Window::NotificationLevel::Type Window::GetNotificationLevel() const
1241 if( mType != Dali::Window::NOTIFICATION )
1243 DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::GetNotificationLevel: Not supported window type [%d]\n", mType );
1244 return Dali::Window::NotificationLevel::NONE;
1247 while( !mEventHandler->mTizenPolicy )
1249 wl_display_dispatch_queue( mEventHandler->mDisplay, mEventHandler->mEventQueue );
1254 while( !mEventHandler->mNotificationLevelChangeDone && count < 3 )
1257 wl_display_dispatch_queue( mEventHandler->mDisplay, mEventHandler->mEventQueue );
1261 if( !mEventHandler->mNotificationLevelChangeDone )
1263 DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::GetNotificationLevel: Error! [%d]\n", mEventHandler->mNotificationChangeState );
1264 return Dali::Window::NotificationLevel::NONE;
1267 Dali::Window::NotificationLevel::Type level;
1269 switch( mEventHandler->mNotificationLevel )
1271 case TIZEN_POLICY_LEVEL_NONE:
1273 level = Dali::Window::NotificationLevel::NONE;
1276 case TIZEN_POLICY_LEVEL_DEFAULT:
1278 level = Dali::Window::NotificationLevel::BASE;
1281 case TIZEN_POLICY_LEVEL_MEDIUM:
1283 level = Dali::Window::NotificationLevel::MEDIUM;
1286 case TIZEN_POLICY_LEVEL_HIGH:
1288 level = Dali::Window::NotificationLevel::HIGH;
1291 case TIZEN_POLICY_LEVEL_TOP:
1293 level = Dali::Window::NotificationLevel::TOP;
1298 DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::GetNotificationLevel: invalid level [%d]\n", mEventHandler->mNotificationLevel );
1299 level = Dali::Window::NotificationLevel::NONE;
1304 DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::GetNotificationLevel: level [%d]\n", mEventHandler->mNotificationLevel );
1309 void Window::SetOpaqueState( bool opaque )
1311 while( !mEventHandler->mTizenPolicy )
1313 wl_display_dispatch_queue( mEventHandler->mDisplay, mEventHandler->mEventQueue );
1316 tizen_policy_set_opaque_state( mEventHandler->mTizenPolicy, ecore_wl_window_surface_get( mEventHandler->mEcoreWindow ), ( opaque ? 1 : 0 ) );
1318 mOpaqueState = opaque;
1320 DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::SetOpaqueState: opaque = %d\n", opaque );
1323 bool Window::IsOpaqueState() const
1325 return mOpaqueState;
1328 bool Window::SetScreenOffMode(Dali::Window::ScreenOffMode::Type screenOffMode)
1330 while( !mEventHandler->mTizenPolicy )
1332 wl_display_dispatch_queue( mEventHandler->mDisplay, mEventHandler->mEventQueue );
1335 mEventHandler->mScreenOffModeChangeDone = false;
1336 mEventHandler->mScreenOffModeChangeState = TIZEN_POLICY_ERROR_STATE_NONE;
1338 unsigned int mode = 0;
1340 switch( screenOffMode )
1342 case Dali::Window::ScreenOffMode::TIMEOUT:
1347 case Dali::Window::ScreenOffMode::NEVER:
1354 tizen_policy_set_window_screen_mode( mEventHandler->mTizenPolicy, ecore_wl_window_surface_get( mEventHandler->mEcoreWindow ), mode );
1358 while( !mEventHandler->mScreenOffModeChangeDone && count < 3 )
1361 wl_display_dispatch_queue( mEventHandler->mDisplay, mEventHandler->mEventQueue );
1365 if( !mEventHandler->mScreenOffModeChangeDone )
1367 DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::SetScreenOffMode: Screen mode change is failed [%d, %d]\n", screenOffMode, mEventHandler->mScreenOffModeChangeState );
1370 else if( mEventHandler->mScreenOffModeChangeState == TIZEN_POLICY_ERROR_STATE_PERMISSION_DENIED )
1372 DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::SetScreenOffMode: Permission denied! [%d]\n", screenOffMode );
1376 DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::SetScreenOffMode: Screen mode is changed [%d]\n", mEventHandler->mScreenOffMode );
1381 Dali::Window::ScreenOffMode::Type Window::GetScreenOffMode() const
1383 while( !mEventHandler->mTizenPolicy )
1385 wl_display_dispatch_queue( mEventHandler->mDisplay, mEventHandler->mEventQueue );
1390 while( !mEventHandler->mScreenOffModeChangeDone && count < 3 )
1393 wl_display_dispatch_queue( mEventHandler->mDisplay, mEventHandler->mEventQueue );
1397 if( !mEventHandler->mScreenOffModeChangeDone )
1399 DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::GetScreenOffMode: Error! [%d]\n", mEventHandler->mScreenOffModeChangeState );
1400 return Dali::Window::ScreenOffMode::TIMEOUT;
1403 Dali::Window::ScreenOffMode::Type screenMode = Dali::Window::ScreenOffMode::TIMEOUT;
1405 switch( mEventHandler->mScreenOffMode )
1409 screenMode = Dali::Window::ScreenOffMode::TIMEOUT;
1414 screenMode = Dali::Window::ScreenOffMode::NEVER;
1419 DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::GetScreenOffMode: screen mode [%d]\n", mEventHandler->mScreenOffMode );
1424 bool Window::SetBrightness( int brightness )
1426 if( brightness < 0 || brightness > 100 )
1428 DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::SetBrightness: Invalid brightness value [%d]\n", brightness );
1432 while( !mEventHandler->mTizenDisplayPolicy )
1434 wl_display_dispatch_queue( mEventHandler->mDisplay, mEventHandler->mEventQueue );
1437 mEventHandler->mBrightnessChangeDone = false;
1438 mEventHandler->mBrightnessChangeState = TIZEN_POLICY_ERROR_STATE_NONE;
1440 tizen_display_policy_set_window_brightness( mEventHandler->mTizenDisplayPolicy, ecore_wl_window_surface_get( mEventHandler->mEcoreWindow ), brightness );
1444 while( !mEventHandler->mBrightnessChangeDone && count < 3 )
1447 wl_display_dispatch_queue( mEventHandler->mDisplay, mEventHandler->mEventQueue );
1451 if( !mEventHandler->mBrightnessChangeDone )
1453 DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::SetBrightness: Brightness change is failed [%d, %d]\n", brightness, mEventHandler->mBrightnessChangeState );
1456 else if( mEventHandler->mBrightnessChangeState == TIZEN_POLICY_ERROR_STATE_PERMISSION_DENIED )
1458 DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::SetBrightness: Permission denied! [%d]\n", brightness );
1462 DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::SetBrightness: Brightness is changed [%d]\n", mEventHandler->mBrightness );
1467 int Window::GetBrightness() const
1469 while( !mEventHandler->mTizenDisplayPolicy )
1471 wl_display_dispatch_queue( mEventHandler->mDisplay, mEventHandler->mEventQueue );
1476 while( !mEventHandler->mBrightnessChangeDone && count < 3 )
1479 wl_display_dispatch_queue( mEventHandler->mDisplay, mEventHandler->mEventQueue );
1483 if( !mEventHandler->mBrightnessChangeDone )
1485 DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::GetBrightness: Error! [%d]\n", mEventHandler->mBrightnessChangeState );
1489 DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::GetBrightness: Brightness [%d]\n", mEventHandler->mBrightness );
1491 return mEventHandler->mBrightness;
1494 void Window::SetSize( Dali::Window::WindowSize size )
1496 if( !mResizeEnabled )
1498 AddAuxiliaryHint( "wm.policy.win.user.geometry", "1" );
1499 mResizeEnabled = true;
1502 PositionSize positionSize = mSurface->GetPositionSize();
1504 if( positionSize.width != size.GetWidth() || positionSize.height != size.GetHeight() )
1506 positionSize.width = size.GetWidth();
1507 positionSize.height = size.GetHeight();
1509 mSurface->MoveResize( positionSize );
1511 mAdaptor->SurfaceResizePrepare( Adaptor::SurfaceSize( positionSize.width, positionSize.height ) );
1514 mResizedSignal.Emit( Dali::Window::WindowSize( positionSize.width, positionSize.height ) );
1516 mAdaptor->SurfaceResizeComplete( Adaptor::SurfaceSize( positionSize.width, positionSize.height ) );
1520 Dali::Window::WindowSize Window::GetSize() const
1522 PositionSize positionSize = mSurface->GetPositionSize();
1524 return Dali::Window::WindowSize( positionSize.width, positionSize.height );
1527 void Window::SetPosition( Dali::Window::WindowPosition position )
1529 if( !mResizeEnabled )
1531 AddAuxiliaryHint( "wm.policy.win.user.geometry", "1" );
1532 mResizeEnabled = true;
1535 PositionSize positionSize = mSurface->GetPositionSize();
1537 if( positionSize.x != position.GetX() || positionSize.y != position.GetY() )
1539 positionSize.x = position.GetX();
1540 positionSize.y = position.GetY();
1542 mSurface->MoveResize( positionSize );
1546 Dali::Window::WindowPosition Window::GetPosition() const
1548 PositionSize positionSize = mSurface->GetPositionSize();
1550 return Dali::Window::WindowPosition( positionSize.x, positionSize.y );
1553 void Window::SetTransparency( bool transparent )
1555 ECore::WindowRenderSurface* wlSurface( dynamic_cast< ECore::WindowRenderSurface * >( mSurface ) );
1558 wlSurface->SetTransparency( transparent );
1568 #pragma GCC diagnostic pop