2 * Copyright (c) 2018 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.
18 // Ecore is littered with C style cast
19 #pragma GCC diagnostic push
20 #pragma GCC diagnostic ignored "-Wold-style-cast"
23 #include <dali/internal/window-system/ubuntu-x11/window-base-ecore-x.h>
26 #include <dali/internal/window-system/common/window-impl.h>
27 #include <dali/internal/window-system/common/window-render-surface.h>
28 #include <dali/internal/window-system/ubuntu-x11/ecore-x-types.h>
31 #include <dali/public-api/object/any.h>
32 #include <dali/integration-api/debug.h>
33 #include <Ecore_Input.h>
47 const std::string DEFAULT_DEVICE_NAME = "";
48 const Device::Class::Type DEFAULT_DEVICE_CLASS = Device::Class::NONE;
49 const Device::Subclass::Type DEFAULT_DEVICE_SUBCLASS = Device::Subclass::NONE;
51 const unsigned int PRIMARY_TOUCH_BUTTON_ID( 1 );
53 #if defined(DEBUG_ENABLED)
54 Debug::Filter* gWindowBaseLogFilter = Debug::Filter::New( Debug::NoLogging, false, "LOG_WINDOW_BASE" );
57 /////////////////////////////////////////////////////////////////////////////////////////////////
59 /////////////////////////////////////////////////////////////////////////////////////////////////
61 static Eina_Bool EcoreEventWindowPropertyChanged( void* data, int type, void* event )
63 WindowBaseEcoreX* windowBase = static_cast< WindowBaseEcoreX* >( data );
66 return windowBase->OnWindowPropertyChanged( data, type, event );
69 return ECORE_CALLBACK_PASS_ON;
73 * Called when the window receives a delete request
75 static Eina_Bool EcoreEventWindowDeleteRequest( void* data, int type, void* event )
77 WindowBaseEcoreX* windowBase = static_cast< WindowBaseEcoreX* >( data );
80 windowBase->OnDeleteRequest();
82 return ECORE_CALLBACK_DONE;
86 * Called when the window gains focus.
88 static Eina_Bool EcoreEventWindowFocusIn( void* data, int type, void* event )
90 WindowBaseEcoreX* windowBase = static_cast< WindowBaseEcoreX* >( data );
93 windowBase->OnFocusIn( data, type, event );
95 return ECORE_CALLBACK_PASS_ON;
99 * Called when the window loses focus.
101 static Eina_Bool EcoreEventWindowFocusOut( void* data, int type, void* event )
103 WindowBaseEcoreX* windowBase = static_cast< WindowBaseEcoreX* >( data );
106 windowBase->OnFocusOut( data, type, event );
108 return ECORE_CALLBACK_PASS_ON;
112 * Called when the window is damaged.
114 static Eina_Bool EcoreEventWindowDamaged( void* data, int type, void* event )
116 WindowBaseEcoreX* windowBase = static_cast< WindowBaseEcoreX* >( data );
119 windowBase->OnWindowDamaged( data, type, event );
122 return ECORE_CALLBACK_PASS_ON;
125 /////////////////////////////////////////////////////////////////////////////////////////////////
126 // Selection Callbacks
127 /////////////////////////////////////////////////////////////////////////////////////////////////
130 * Called when the source window notifies us the content in clipboard is selected.
132 static Eina_Bool EcoreEventSelectionClear( void* data, int type, void* event )
134 WindowBaseEcoreX* windowBase = static_cast< WindowBaseEcoreX* >( data );
137 windowBase->OnSelectionClear( data, type, event );
139 return ECORE_CALLBACK_PASS_ON;
143 * Called when the source window sends us about the selected content.
144 * For example, when dragged items are dragged INTO our window or when items are selected in the clipboard.
146 static Eina_Bool EcoreEventSelectionNotify( void* data, int type, void* event )
148 WindowBaseEcoreX* windowBase = static_cast< WindowBaseEcoreX* >( data );
151 windowBase->OnSelectionNotify( data, type, event );
153 return ECORE_CALLBACK_PASS_ON;
156 /////////////////////////////////////////////////////////////////////////////////////////////////
158 /////////////////////////////////////////////////////////////////////////////////////////////////
161 * Called when a touch down is received.
163 static Eina_Bool EcoreEventMouseButtonDown( void* data, int type, void* event )
165 WindowBaseEcoreX* windowBase = static_cast< WindowBaseEcoreX* >( data );
168 windowBase->OnMouseButtonDown( data, type, event );
170 return ECORE_CALLBACK_PASS_ON;
174 * Called when a touch up is received.
176 static Eina_Bool EcoreEventMouseButtonUp( void* data, int type, void* event )
178 WindowBaseEcoreX* windowBase = static_cast< WindowBaseEcoreX* >( data );
181 windowBase->OnMouseButtonUp( data, type, event );
183 return ECORE_CALLBACK_PASS_ON;
187 * Called when a touch motion is received.
189 static Eina_Bool EcoreEventMouseButtonMove( void* data, int type, void* event )
191 WindowBaseEcoreX* windowBase = static_cast< WindowBaseEcoreX* >( data );
194 windowBase->OnMouseButtonMove( data, type, event );
196 return ECORE_CALLBACK_PASS_ON;
199 /////////////////////////////////////////////////////////////////////////////////////////////////
201 /////////////////////////////////////////////////////////////////////////////////////////////////
204 * Called when a mouse wheel is received.
206 static Eina_Bool EcoreEventMouseWheel( void* data, int type, void* event )
208 WindowBaseEcoreX* windowBase = static_cast< WindowBaseEcoreX* >( data );
211 windowBase->OnMouseWheel( data, type, event );
213 return ECORE_CALLBACK_PASS_ON;
216 /////////////////////////////////////////////////////////////////////////////////////////////////
218 /////////////////////////////////////////////////////////////////////////////////////////////////
221 * Called when a key down is received.
223 static Eina_Bool EcoreEventKeyDown( void* data, int type, void* event )
225 WindowBaseEcoreX* windowBase = static_cast< WindowBaseEcoreX* >( data );
228 windowBase->OnKeyDown( data, type, event );
230 return ECORE_CALLBACK_PASS_ON;
234 * Called when a key up is received.
236 static Eina_Bool EcoreEventKeyUp( void* data, int type, void* event )
238 WindowBaseEcoreX* windowBase = static_cast< WindowBaseEcoreX* >( data );
241 windowBase->OnKeyUp( data, type, event );
243 return ECORE_CALLBACK_PASS_ON;
246 } // unnamed namespace
248 WindowBaseEcoreX::WindowBaseEcoreX( Dali::PositionSize positionSize, Any surface, bool isTransparent )
249 : mEcoreEventHandler(),
251 mOwnSurface( false ),
252 mRotationAppSet( false )
254 Initialize( positionSize, surface, isTransparent );
257 WindowBaseEcoreX::~WindowBaseEcoreX()
259 for( Dali::Vector< Ecore_Event_Handler* >::Iterator iter = mEcoreEventHandler.Begin(), endIter = mEcoreEventHandler.End(); iter != endIter; ++iter )
261 ecore_event_handler_del( *iter );
263 mEcoreEventHandler.Clear();
267 ecore_x_window_free( mEcoreWindow );
271 void WindowBaseEcoreX::Initialize( PositionSize positionSize, Any surface, bool isTransparent )
273 // see if there is a surface in Any surface
274 unsigned int surfaceId = GetSurfaceId( surface );
276 // if the surface is empty, create a new one.
279 // we own the surface about to created
281 CreateWindow( positionSize, isTransparent );
285 // XLib should already be initialized so no point in calling XInitThreads
286 mEcoreWindow = static_cast< Ecore_X_Window >( surfaceId );
289 // set up etc properties to match with ecore-evas
291 if( ( id = getenv("DESKTOP_STARTUP_ID") ) )
293 ecore_x_netwm_startup_id_set( mEcoreWindow, id );
296 ecore_x_icccm_hints_set( mEcoreWindow,
298 ECORE_X_WINDOW_STATE_HINT_NORMAL, // initial_state
305 // we SHOULD guarantee the x11 window was created in x server.
308 ecore_x_input_multi_select( mEcoreWindow );
310 // This ensures that we catch the window close (or delete) request
311 ecore_x_icccm_protocol_set( mEcoreWindow, ECORE_X_WM_PROTOCOL_DELETE_REQUEST, EINA_TRUE );
313 // Enable Drag & Drop
314 ecore_x_dnd_aware_set( mEcoreWindow, EINA_TRUE );
316 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_X_EVENT_WINDOW_PROPERTY, EcoreEventWindowPropertyChanged, this ) );
317 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_X_EVENT_WINDOW_DELETE_REQUEST, EcoreEventWindowDeleteRequest, this ) );
319 // Register window focus events
320 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_X_EVENT_WINDOW_FOCUS_IN, EcoreEventWindowFocusIn, this ) );
321 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_X_EVENT_WINDOW_FOCUS_OUT, EcoreEventWindowFocusOut, this ) );
323 // Register Window damage events
324 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_X_EVENT_WINDOW_DAMAGE, EcoreEventWindowDamaged, this ) );
326 // Register Touch events
327 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_EVENT_MOUSE_BUTTON_DOWN, EcoreEventMouseButtonDown, this ) );
328 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_EVENT_MOUSE_BUTTON_UP, EcoreEventMouseButtonUp, this ) );
329 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_EVENT_MOUSE_MOVE, EcoreEventMouseButtonMove, this ) );
330 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_EVENT_MOUSE_OUT, EcoreEventMouseButtonUp, this ) ); // process mouse out event like up event
332 // Register Mouse wheel events
333 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_EVENT_MOUSE_WHEEL, EcoreEventMouseWheel, this ) );
335 // Register Key events
336 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_EVENT_KEY_DOWN, EcoreEventKeyDown, this ) );
337 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_EVENT_KEY_UP, EcoreEventKeyUp, this ) );
339 // Register Selection event
340 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_X_EVENT_SELECTION_CLEAR, EcoreEventSelectionClear, this ) );
341 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_X_EVENT_SELECTION_NOTIFY, EcoreEventSelectionNotify, this ) );
344 Eina_Bool WindowBaseEcoreX::OnWindowPropertyChanged( void* data, int type, void* event )
346 Ecore_X_Event_Window_Property* propertyChangedEvent = static_cast< Ecore_X_Event_Window_Property* >( event );
347 Eina_Bool handled( ECORE_CALLBACK_PASS_ON );
349 if( propertyChangedEvent->win == mEcoreWindow )
351 Ecore_X_Window_State_Hint state( ecore_x_icccm_state_get( propertyChangedEvent->win ) );
355 case ECORE_X_WINDOW_STATE_HINT_WITHDRAWN:
357 // Window was hidden.
358 mIconifyChangedSignal.Emit( true );
359 handled = ECORE_CALLBACK_DONE;
362 case ECORE_X_WINDOW_STATE_HINT_ICONIC:
364 // Window was iconified (minimised).
365 mIconifyChangedSignal.Emit( true );
366 handled = ECORE_CALLBACK_DONE;
369 case ECORE_X_WINDOW_STATE_HINT_NORMAL:
372 mIconifyChangedSignal.Emit( false );
373 handled = ECORE_CALLBACK_DONE;
387 void WindowBaseEcoreX::OnDeleteRequest()
389 mDeleteRequestSignal.Emit();
392 void WindowBaseEcoreX::OnFocusIn( void* data, int type, void* event )
394 Ecore_X_Event_Window_Focus_In* focusInEvent = static_cast< Ecore_X_Event_Window_Focus_In* >( event );
396 if( focusInEvent->win == mEcoreWindow )
398 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "Window EcoreEventWindowFocusIn\n" );
400 mFocusChangedSignal.Emit( true );
404 void WindowBaseEcoreX::OnFocusOut( void* data, int type, void* event )
406 Ecore_X_Event_Window_Focus_Out* focusOutEvent = static_cast< Ecore_X_Event_Window_Focus_Out* >( event );
408 // If the window loses focus then hide the keyboard.
409 if( focusOutEvent->win == mEcoreWindow )
411 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "Window EcoreEventWindowFocusOut\n" );
413 mFocusChangedSignal.Emit( false );
417 void WindowBaseEcoreX::OnWindowDamaged( void* data, int type, void* event )
419 Ecore_X_Event_Window_Damage* windowDamagedEvent = static_cast< Ecore_X_Event_Window_Damage* >( event );
421 if( windowDamagedEvent->win == mEcoreWindow )
424 area.x = windowDamagedEvent->x;
425 area.y = windowDamagedEvent->y;
426 area.width = windowDamagedEvent->w;
427 area.height = windowDamagedEvent->h;
429 mWindowDamagedSignal.Emit( area );
433 void WindowBaseEcoreX::OnMouseButtonDown( void* data, int type, void* event )
435 Ecore_Event_Mouse_Button* touchEvent = static_cast< Ecore_Event_Mouse_Button* >( event );
437 if( touchEvent->window == mEcoreWindow )
439 PointState::Type state ( PointState::DOWN );
441 // Check if the buttons field is set and ensure it's the primary touch button.
442 // If this event was triggered by buttons other than the primary button (used for touch), then
443 // just send an interrupted event to Core.
444 if( touchEvent->buttons && ( touchEvent->buttons != PRIMARY_TOUCH_BUTTON_ID ) )
446 state = PointState::INTERRUPTED;
449 Integration::Point point;
450 point.SetDeviceId( touchEvent->multi.device );
451 point.SetState( state );
452 point.SetScreenPosition( Vector2( touchEvent->x, touchEvent->y ) );
453 point.SetRadius( touchEvent->multi.radius, Vector2( touchEvent->multi.radius_x, touchEvent->multi.radius_y ) );
454 point.SetPressure( touchEvent->multi.pressure );
455 point.SetAngle( Degree( touchEvent->multi.angle ) );
457 mTouchEventSignal.Emit( point, touchEvent->timestamp );
461 void WindowBaseEcoreX::OnMouseButtonUp( void* data, int type, void* event )
463 Ecore_Event_Mouse_Button* touchEvent = static_cast< Ecore_Event_Mouse_Button* >( event );
465 if( touchEvent->window == mEcoreWindow )
467 Integration::Point point;
468 point.SetDeviceId( touchEvent->multi.device );
469 point.SetState( PointState::UP );
470 point.SetScreenPosition( Vector2( touchEvent->x, touchEvent->y ) );
471 point.SetRadius( touchEvent->multi.radius, Vector2( touchEvent->multi.radius_x, touchEvent->multi.radius_y ) );
472 point.SetPressure( touchEvent->multi.pressure );
473 point.SetAngle( Degree( touchEvent->multi.angle ) );
475 mTouchEventSignal.Emit( point, touchEvent->timestamp );
479 void WindowBaseEcoreX::OnMouseButtonMove( void* data, int type, void* event )
481 Ecore_Event_Mouse_Move* touchEvent = static_cast< Ecore_Event_Mouse_Move* >( event );
483 if( touchEvent->window == mEcoreWindow )
485 Integration::Point point;
486 point.SetDeviceId( touchEvent->multi.device );
487 point.SetState( PointState::MOTION );
488 point.SetScreenPosition( Vector2( touchEvent->x, touchEvent->y ) );
489 point.SetRadius( touchEvent->multi.radius, Vector2( touchEvent->multi.radius_x, touchEvent->multi.radius_y ) );
490 point.SetPressure( touchEvent->multi.pressure );
491 point.SetAngle( Degree( touchEvent->multi.angle ) );
493 mTouchEventSignal.Emit( point, touchEvent->timestamp );
497 void WindowBaseEcoreX::OnMouseWheel( void* data, int type, void* event )
499 Ecore_Event_Mouse_Wheel* mouseWheelEvent = static_cast< Ecore_Event_Mouse_Wheel* >( event );
501 if( mouseWheelEvent->window == mEcoreWindow )
503 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreX::OnMouseWheel: direction: %d, modifiers: %d, x: %d, y: %d, z: %d\n", mouseWheelEvent->direction, mouseWheelEvent->modifiers, mouseWheelEvent->x, mouseWheelEvent->y, mouseWheelEvent->z );
505 WheelEvent wheelEvent( WheelEvent::MOUSE_WHEEL, mouseWheelEvent->direction, mouseWheelEvent->modifiers, Vector2( mouseWheelEvent->x, mouseWheelEvent->y ), mouseWheelEvent->z, mouseWheelEvent->timestamp );
507 mWheelEventSignal.Emit( wheelEvent );
511 void WindowBaseEcoreX::OnKeyDown( void* data, int type, void* event )
513 Ecore_Event_Key* keyEvent = static_cast< Ecore_Event_Key* >( event );
515 if( keyEvent->window == mEcoreWindow )
517 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreX::OnKeyDown\n" );
519 std::string keyName( keyEvent->keyname );
520 std::string keyString( "" );
521 std::string compose( "" );
523 // Ensure key compose string is not NULL as keys like SHIFT or arrow have a null string.
524 if( keyEvent->compose )
526 compose = keyEvent->compose;
529 int keyCode = ecore_x_keysym_keycode_get( keyEvent->keyname );
530 int modifier( keyEvent->modifiers );
531 unsigned long time = keyEvent->timestamp;
533 // Ensure key event string is not NULL as keys like SHIFT have a null string.
534 if( keyEvent->string )
536 keyString = keyEvent->string;
539 Integration::KeyEvent keyEvent( keyName, keyString, keyCode, modifier, time, Integration::KeyEvent::Down, compose, DEFAULT_DEVICE_NAME, DEFAULT_DEVICE_CLASS, DEFAULT_DEVICE_SUBCLASS );
541 mKeyEventSignal.Emit( keyEvent );
545 void WindowBaseEcoreX::OnKeyUp( void* data, int type, void* event )
547 Ecore_Event_Key* keyEvent = static_cast< Ecore_Event_Key* >( event );
549 if ( keyEvent->window == mEcoreWindow )
551 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, " WindowBaseEcoreX::OnKeyUp\n" );
553 std::string keyName( keyEvent->keyname );
554 std::string keyString( "" );
555 std::string compose( "" );
557 // Ensure key compose string is not NULL as keys like SHIFT or arrow have a null string.
558 if( keyEvent->compose )
560 compose = keyEvent->compose;
562 int keyCode = ecore_x_keysym_keycode_get( keyEvent->keyname );
563 int modifier( keyEvent->modifiers );
564 unsigned long time( keyEvent->timestamp );
566 // Ensure key event string is not NULL as keys like SHIFT have a null string.
567 if( keyEvent->string )
569 keyString = keyEvent->string;
572 Integration::KeyEvent keyEvent( keyName, keyString, keyCode, modifier, time, Integration::KeyEvent::Up, compose, DEFAULT_DEVICE_NAME, DEFAULT_DEVICE_CLASS, DEFAULT_DEVICE_SUBCLASS );
574 mKeyEventSignal.Emit( keyEvent );
578 void WindowBaseEcoreX::OnSelectionClear( void* data, int type, void* event )
580 Ecore_X_Event_Selection_Clear* selectionClearEvent = static_cast< Ecore_X_Event_Selection_Clear* >( event );
582 if( selectionClearEvent->win == mEcoreWindow )
584 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Concise, " WindowBaseEcoreX::OnSelectionClear\n" );
586 if( selectionClearEvent->selection == ECORE_X_SELECTION_SECONDARY )
588 // Request to get the content from Ecore.
589 ecore_x_selection_secondary_request( selectionClearEvent->win, ECORE_X_SELECTION_TARGET_TEXT );
594 void WindowBaseEcoreX::OnSelectionNotify( void* data, int type, void* event )
596 Ecore_X_Event_Selection_Notify* selectionNotifyEvent = static_cast< Ecore_X_Event_Selection_Notify* >( event );
598 if( selectionNotifyEvent->win == mEcoreWindow )
600 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Concise, " WindowBaseEcoreX::OnSelectionNotify\n" );
602 Ecore_X_Selection_Data* selectionData = static_cast< Ecore_X_Selection_Data* >( selectionNotifyEvent->data );
603 if( selectionData->data )
605 if( selectionNotifyEvent->selection == ECORE_X_SELECTION_SECONDARY )
607 mSelectionDataReceivedSignal.Emit( event );
613 Any WindowBaseEcoreX::GetNativeWindow()
618 int WindowBaseEcoreX::GetNativeWindowId()
623 EGLNativeWindowType WindowBaseEcoreX::CreateEglWindow( int width, int height )
625 // need to create X handle as in 64bit system ECore handle is 32 bit whereas EGLnative and XWindow are 64 bit
626 XWindow window( mEcoreWindow );
627 return reinterpret_cast< EGLNativeWindowType >( window );
630 void WindowBaseEcoreX::DestroyEglWindow()
634 void WindowBaseEcoreX::SetEglWindowRotation( int angle )
638 void WindowBaseEcoreX::SetEglWindowBufferTransform( int angle )
642 void WindowBaseEcoreX::SetEglWindowTransform( int angle )
646 void WindowBaseEcoreX::ResizeEglWindow( PositionSize positionSize )
650 bool WindowBaseEcoreX::IsEglWindowRotationSupported()
655 void WindowBaseEcoreX::Move( PositionSize positionSize )
657 ecore_x_window_move( mEcoreWindow, positionSize.x, positionSize.y );
660 void WindowBaseEcoreX::Resize( PositionSize positionSize )
662 ecore_x_window_resize( mEcoreWindow, positionSize.width, positionSize.height );
665 void WindowBaseEcoreX::MoveResize( PositionSize positionSize )
667 ecore_x_window_move_resize( mEcoreWindow, positionSize.x, positionSize.y, positionSize.width, positionSize.height );
670 void WindowBaseEcoreX::ShowIndicator( Dali::Window::IndicatorVisibleMode visibleMode, Dali::Window::IndicatorBgOpacity opacityMode )
672 DALI_LOG_TRACE_METHOD_FMT( gWindowBaseLogFilter, "visible : %d\n", visibleMode );
674 if( visibleMode == Dali::Window::VISIBLE )
676 // when the indicator is visible, set proper mode for indicator server according to bg mode
677 if( opacityMode == Dali::Window::OPAQUE )
679 ecore_x_e_illume_indicator_opacity_set( mEcoreWindow, ECORE_X_ILLUME_INDICATOR_OPAQUE );
681 else if( opacityMode == Dali::Window::TRANSLUCENT )
683 ecore_x_e_illume_indicator_opacity_set( mEcoreWindow, ECORE_X_ILLUME_INDICATOR_TRANSLUCENT );
688 // when the indicator is not visible, set TRANSPARENT mode for indicator server
689 ecore_x_e_illume_indicator_opacity_set( mEcoreWindow, ECORE_X_ILLUME_INDICATOR_TRANSPARENT ); // it means hidden indicator
693 void WindowBaseEcoreX::SetIndicatorProperties( bool isShow, Dali::Window::WindowOrientation lastOrientation )
695 int show_state = static_cast< int >( isShow );
696 ecore_x_window_prop_property_set( mEcoreWindow, ECORE_X_ATOM_E_ILLUME_INDICATOR_STATE,
697 ECORE_X_ATOM_CARDINAL, 32, &show_state, 1 );
701 ecore_x_e_illume_indicator_state_set( mEcoreWindow, ECORE_X_ILLUME_INDICATOR_STATE_ON );
705 ecore_x_e_illume_indicator_state_set( mEcoreWindow, ECORE_X_ILLUME_INDICATOR_STATE_OFF );
709 void WindowBaseEcoreX::IndicatorTypeChanged( IndicatorInterface::Type type )
713 void WindowBaseEcoreX::SetClass( const std::string& name, const std::string& className )
715 ecore_x_icccm_title_set( mEcoreWindow, name.c_str() );
716 ecore_x_netwm_name_set( mEcoreWindow, name.c_str() );
717 ecore_x_icccm_name_class_set( mEcoreWindow, name.c_str(), className.c_str() );
720 void WindowBaseEcoreX::Raise()
722 ecore_x_window_raise( mEcoreWindow );
725 void WindowBaseEcoreX::Lower()
727 ecore_x_window_lower( mEcoreWindow );
730 void WindowBaseEcoreX::Activate()
732 ecore_x_netwm_client_active_request( ecore_x_window_root_get( mEcoreWindow ), mEcoreWindow, 1 /* request type, 1:application, 2:pager */, 0 );
735 void WindowBaseEcoreX::SetAvailableOrientations( const std::vector< Dali::Window::WindowOrientation >& orientations )
739 void WindowBaseEcoreX::SetPreferredOrientation( Dali::Window::WindowOrientation orientation )
743 void WindowBaseEcoreX::SetAcceptFocus( bool accept )
747 void WindowBaseEcoreX::Show()
749 ecore_x_window_show( mEcoreWindow );
752 void WindowBaseEcoreX::Hide()
754 ecore_x_window_hide( mEcoreWindow );
757 unsigned int WindowBaseEcoreX::GetSupportedAuxiliaryHintCount() const
762 std::string WindowBaseEcoreX::GetSupportedAuxiliaryHint( unsigned int index ) const
764 return std::string();
767 unsigned int WindowBaseEcoreX::AddAuxiliaryHint( const std::string& hint, const std::string& value )
772 bool WindowBaseEcoreX::RemoveAuxiliaryHint( unsigned int id )
777 bool WindowBaseEcoreX::SetAuxiliaryHintValue( unsigned int id, const std::string& value )
782 std::string WindowBaseEcoreX::GetAuxiliaryHintValue( unsigned int id ) const
784 return std::string();
787 unsigned int WindowBaseEcoreX::GetAuxiliaryHintId( const std::string& hint ) const
792 void WindowBaseEcoreX::SetInputRegion( const Rect< int >& inputRegion )
796 void WindowBaseEcoreX::SetType( Dali::Window::Type type )
800 bool WindowBaseEcoreX::SetNotificationLevel( Dali::Window::NotificationLevel::Type level )
805 Dali::Window::NotificationLevel::Type WindowBaseEcoreX::GetNotificationLevel() const
807 return Dali::Window::NotificationLevel::NONE;
810 void WindowBaseEcoreX::SetOpaqueState( bool opaque )
814 bool WindowBaseEcoreX::SetScreenOffMode(Dali::Window::ScreenOffMode::Type screenOffMode)
819 Dali::Window::ScreenOffMode::Type WindowBaseEcoreX::GetScreenOffMode() const
821 return Dali::Window::ScreenOffMode::TIMEOUT;
824 bool WindowBaseEcoreX::SetBrightness( int brightness )
829 int WindowBaseEcoreX::GetBrightness() const
834 bool WindowBaseEcoreX::GrabKey( Dali::KEY key, KeyGrab::KeyGrabMode grabMode )
839 bool WindowBaseEcoreX::UngrabKey( Dali::KEY key )
844 bool WindowBaseEcoreX::GrabKeyList( const Dali::Vector< Dali::KEY >& key, const Dali::Vector< KeyGrab::KeyGrabMode >& grabMode, Dali::Vector< bool >& result )
849 bool WindowBaseEcoreX::UngrabKeyList( const Dali::Vector< Dali::KEY >& key, Dali::Vector< bool >& result )
854 void WindowBaseEcoreX::GetDpi( unsigned int& dpiHorizontal, unsigned int& dpiVertical )
859 // 1 inch = 25.4 millimeters
860 xres = ecore_x_dpi_get();
861 yres = ecore_x_dpi_get();
863 dpiHorizontal = int( xres + 0.5f ); // rounding
864 dpiVertical = int( yres + 0.5f );
867 void WindowBaseEcoreX::SetViewMode( ViewMode viewMode )
869 Ecore_X_Atom viewModeAtom( ecore_x_atom_get( "_E_COMP_3D_APP_WIN" ) );
871 if( viewModeAtom != None )
873 unsigned int value( static_cast< unsigned int >( viewMode ) );
874 ecore_x_window_prop_card32_set( mEcoreWindow, viewModeAtom, &value, 1 );
878 int WindowBaseEcoreX::GetScreenRotationAngle()
883 void WindowBaseEcoreX::SetWindowRotationAngle( int degree )
887 void WindowBaseEcoreX::WindowRotationCompleted( int degree, int width, int height )
891 void WindowBaseEcoreX::SetTransparency( bool transparent )
895 unsigned int WindowBaseEcoreX::GetSurfaceId( Any surface ) const
897 unsigned int surfaceId = 0;
899 if ( surface.Empty() == false )
901 // check we have a valid type
902 DALI_ASSERT_ALWAYS( ( (surface.GetType() == typeid (XWindow) ) || (surface.GetType() == typeid (Ecore_X_Window) ) )
903 && "Surface type is invalid" );
905 if ( surface.GetType() == typeid (Ecore_X_Window) )
907 surfaceId = AnyCast< Ecore_X_Window >( surface );
911 surfaceId = AnyCast< XWindow >( surface );
917 void WindowBaseEcoreX::CreateWindow( PositionSize positionSize, bool isTransparent )
921 // create 32 bit window
922 mEcoreWindow = ecore_x_window_argb_new( 0, positionSize.x, positionSize.y, positionSize.width, positionSize.height );
926 // create 24 bit window
927 mEcoreWindow = ecore_x_window_new( 0, positionSize.x, positionSize.y, positionSize.width, positionSize.height );
930 if ( mEcoreWindow == 0 )
932 DALI_ASSERT_ALWAYS( 0 && "Failed to create X window" );
936 } // namespace Adaptor
938 } // namespace Internal
942 #pragma GCC diagnostic pop