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/public-api/events/mouse-button.h>
33 #include <dali/integration-api/debug.h>
34 #include <Ecore_Input.h>
48 const std::string DEFAULT_DEVICE_NAME = "";
49 const Device::Class::Type DEFAULT_DEVICE_CLASS = Device::Class::NONE;
50 const Device::Subclass::Type DEFAULT_DEVICE_SUBCLASS = Device::Subclass::NONE;
52 const unsigned int PRIMARY_TOUCH_BUTTON_ID( 1 );
54 #if defined(DEBUG_ENABLED)
55 Debug::Filter* gWindowBaseLogFilter = Debug::Filter::New( Debug::NoLogging, false, "LOG_WINDOW_BASE" );
58 /////////////////////////////////////////////////////////////////////////////////////////////////
60 /////////////////////////////////////////////////////////////////////////////////////////////////
62 static Eina_Bool EcoreEventWindowPropertyChanged( void* data, int type, void* event )
64 WindowBaseEcoreX* windowBase = static_cast< WindowBaseEcoreX* >( data );
67 return windowBase->OnWindowPropertyChanged( data, type, event );
70 return ECORE_CALLBACK_PASS_ON;
74 * Called when the window receives a delete request
76 static Eina_Bool EcoreEventWindowDeleteRequest( void* data, int type, void* event )
78 WindowBaseEcoreX* windowBase = static_cast< WindowBaseEcoreX* >( data );
81 windowBase->OnDeleteRequest();
83 return ECORE_CALLBACK_DONE;
87 * Called when the window gains focus.
89 static Eina_Bool EcoreEventWindowFocusIn( void* data, int type, void* event )
91 WindowBaseEcoreX* windowBase = static_cast< WindowBaseEcoreX* >( data );
94 windowBase->OnFocusIn( data, type, event );
96 return ECORE_CALLBACK_PASS_ON;
100 * Called when the window loses focus.
102 static Eina_Bool EcoreEventWindowFocusOut( void* data, int type, void* event )
104 WindowBaseEcoreX* windowBase = static_cast< WindowBaseEcoreX* >( data );
107 windowBase->OnFocusOut( data, type, event );
109 return ECORE_CALLBACK_PASS_ON;
113 * Called when the window is damaged.
115 static Eina_Bool EcoreEventWindowDamaged( void* data, int type, void* event )
117 WindowBaseEcoreX* windowBase = static_cast< WindowBaseEcoreX* >( data );
120 windowBase->OnWindowDamaged( data, type, event );
123 return ECORE_CALLBACK_PASS_ON;
126 /////////////////////////////////////////////////////////////////////////////////////////////////
127 // Selection Callbacks
128 /////////////////////////////////////////////////////////////////////////////////////////////////
131 * Called when the source window notifies us the content in clipboard is selected.
133 static Eina_Bool EcoreEventSelectionClear( void* data, int type, void* event )
135 WindowBaseEcoreX* windowBase = static_cast< WindowBaseEcoreX* >( data );
138 windowBase->OnSelectionClear( data, type, event );
140 return ECORE_CALLBACK_PASS_ON;
144 * Called when the source window sends us about the selected content.
145 * For example, when dragged items are dragged INTO our window or when items are selected in the clipboard.
147 static Eina_Bool EcoreEventSelectionNotify( void* data, int type, void* event )
149 WindowBaseEcoreX* windowBase = static_cast< WindowBaseEcoreX* >( data );
152 windowBase->OnSelectionNotify( data, type, event );
154 return ECORE_CALLBACK_PASS_ON;
157 /////////////////////////////////////////////////////////////////////////////////////////////////
159 /////////////////////////////////////////////////////////////////////////////////////////////////
162 * Called when a touch down is received.
164 static Eina_Bool EcoreEventMouseButtonDown( void* data, int type, void* event )
166 WindowBaseEcoreX* windowBase = static_cast< WindowBaseEcoreX* >( data );
169 windowBase->OnMouseButtonDown( data, type, event );
171 return ECORE_CALLBACK_PASS_ON;
175 * Called when a touch up is received.
177 static Eina_Bool EcoreEventMouseButtonUp( void* data, int type, void* event )
179 WindowBaseEcoreX* windowBase = static_cast< WindowBaseEcoreX* >( data );
182 windowBase->OnMouseButtonUp( data, type, event );
184 return ECORE_CALLBACK_PASS_ON;
188 * Called when a touch motion is received.
190 static Eina_Bool EcoreEventMouseButtonMove( void* data, int type, void* event )
192 WindowBaseEcoreX* windowBase = static_cast< WindowBaseEcoreX* >( data );
195 windowBase->OnMouseButtonMove( data, type, event );
197 return ECORE_CALLBACK_PASS_ON;
200 /////////////////////////////////////////////////////////////////////////////////////////////////
202 /////////////////////////////////////////////////////////////////////////////////////////////////
205 * Called when a mouse wheel is received.
207 static Eina_Bool EcoreEventMouseWheel( void* data, int type, void* event )
209 WindowBaseEcoreX* windowBase = static_cast< WindowBaseEcoreX* >( data );
212 windowBase->OnMouseWheel( data, type, event );
214 return ECORE_CALLBACK_PASS_ON;
217 /////////////////////////////////////////////////////////////////////////////////////////////////
219 /////////////////////////////////////////////////////////////////////////////////////////////////
222 * Called when a key down is received.
224 static Eina_Bool EcoreEventKeyDown( void* data, int type, void* event )
226 WindowBaseEcoreX* windowBase = static_cast< WindowBaseEcoreX* >( data );
229 windowBase->OnKeyDown( data, type, event );
231 return ECORE_CALLBACK_PASS_ON;
235 * Called when a key up is received.
237 static Eina_Bool EcoreEventKeyUp( void* data, int type, void* event )
239 WindowBaseEcoreX* windowBase = static_cast< WindowBaseEcoreX* >( data );
242 windowBase->OnKeyUp( data, type, event );
244 return ECORE_CALLBACK_PASS_ON;
247 } // unnamed namespace
249 WindowBaseEcoreX::WindowBaseEcoreX( Dali::PositionSize positionSize, Any surface, bool isTransparent )
250 : mEcoreEventHandler(),
252 mOwnSurface( false ),
253 mIsTransparent( false ), // Should only be set to true once we actually create a transparent window regardless of what isTransparent is.
254 mRotationAppSet( false )
256 Initialize( positionSize, surface, isTransparent );
259 WindowBaseEcoreX::~WindowBaseEcoreX()
261 for( Dali::Vector< Ecore_Event_Handler* >::Iterator iter = mEcoreEventHandler.Begin(), endIter = mEcoreEventHandler.End(); iter != endIter; ++iter )
263 ecore_event_handler_del( *iter );
265 mEcoreEventHandler.Clear();
269 ecore_x_window_free( mEcoreWindow );
273 void WindowBaseEcoreX::Initialize( PositionSize positionSize, Any surface, bool isTransparent )
275 // see if there is a surface in Any surface
276 unsigned int surfaceId = GetSurfaceId( surface );
278 // if the surface is empty, create a new one.
281 // we own the surface about to created
283 CreateWindow( positionSize, isTransparent );
287 // XLib should already be initialized so no point in calling XInitThreads
288 mEcoreWindow = static_cast< Ecore_X_Window >( surfaceId );
291 // set up etc properties to match with ecore-evas
293 if( ( id = getenv("DESKTOP_STARTUP_ID") ) )
295 ecore_x_netwm_startup_id_set( mEcoreWindow, id );
298 ecore_x_icccm_hints_set( mEcoreWindow,
300 ECORE_X_WINDOW_STATE_HINT_NORMAL, // initial_state
307 // we SHOULD guarantee the x11 window was created in x server.
310 ecore_x_input_multi_select( mEcoreWindow );
312 // This ensures that we catch the window close (or delete) request
313 ecore_x_icccm_protocol_set( mEcoreWindow, ECORE_X_WM_PROTOCOL_DELETE_REQUEST, EINA_TRUE );
315 // Enable Drag & Drop
316 ecore_x_dnd_aware_set( mEcoreWindow, EINA_TRUE );
318 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_X_EVENT_WINDOW_PROPERTY, EcoreEventWindowPropertyChanged, this ) );
319 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_X_EVENT_WINDOW_DELETE_REQUEST, EcoreEventWindowDeleteRequest, this ) );
321 // Register window focus events
322 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_X_EVENT_WINDOW_FOCUS_IN, EcoreEventWindowFocusIn, this ) );
323 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_X_EVENT_WINDOW_FOCUS_OUT, EcoreEventWindowFocusOut, this ) );
325 // Register Window damage events
326 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_X_EVENT_WINDOW_DAMAGE, EcoreEventWindowDamaged, this ) );
328 // Register Touch events
329 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_EVENT_MOUSE_BUTTON_DOWN, EcoreEventMouseButtonDown, this ) );
330 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_EVENT_MOUSE_BUTTON_UP, EcoreEventMouseButtonUp, this ) );
331 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_EVENT_MOUSE_MOVE, EcoreEventMouseButtonMove, this ) );
332 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_EVENT_MOUSE_OUT, EcoreEventMouseButtonUp, this ) ); // process mouse out event like up event
334 // Register Mouse wheel events
335 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_EVENT_MOUSE_WHEEL, EcoreEventMouseWheel, this ) );
337 // Register Key events
338 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_EVENT_KEY_DOWN, EcoreEventKeyDown, this ) );
339 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_EVENT_KEY_UP, EcoreEventKeyUp, this ) );
341 // Register Selection event
342 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_X_EVENT_SELECTION_CLEAR, EcoreEventSelectionClear, this ) );
343 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_X_EVENT_SELECTION_NOTIFY, EcoreEventSelectionNotify, this ) );
346 Eina_Bool WindowBaseEcoreX::OnWindowPropertyChanged( void* data, int type, void* event )
348 Ecore_X_Event_Window_Property* propertyChangedEvent = static_cast< Ecore_X_Event_Window_Property* >( event );
349 Eina_Bool handled( ECORE_CALLBACK_PASS_ON );
351 if( propertyChangedEvent->win == mEcoreWindow )
353 Ecore_X_Window_State_Hint state( ecore_x_icccm_state_get( propertyChangedEvent->win ) );
357 case ECORE_X_WINDOW_STATE_HINT_WITHDRAWN:
359 // Window was hidden.
360 mIconifyChangedSignal.Emit( true );
361 handled = ECORE_CALLBACK_DONE;
364 case ECORE_X_WINDOW_STATE_HINT_ICONIC:
366 // Window was iconified (minimised).
367 mIconifyChangedSignal.Emit( true );
368 handled = ECORE_CALLBACK_DONE;
371 case ECORE_X_WINDOW_STATE_HINT_NORMAL:
374 mIconifyChangedSignal.Emit( false );
375 handled = ECORE_CALLBACK_DONE;
389 void WindowBaseEcoreX::OnDeleteRequest()
391 mDeleteRequestSignal.Emit();
394 void WindowBaseEcoreX::OnFocusIn( void* data, int type, void* event )
396 Ecore_X_Event_Window_Focus_In* focusInEvent = static_cast< Ecore_X_Event_Window_Focus_In* >( event );
398 if( focusInEvent->win == mEcoreWindow )
400 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "Window EcoreEventWindowFocusIn\n" );
402 mFocusChangedSignal.Emit( true );
406 void WindowBaseEcoreX::OnFocusOut( void* data, int type, void* event )
408 Ecore_X_Event_Window_Focus_Out* focusOutEvent = static_cast< Ecore_X_Event_Window_Focus_Out* >( event );
410 // If the window loses focus then hide the keyboard.
411 if( focusOutEvent->win == mEcoreWindow )
413 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "Window EcoreEventWindowFocusOut\n" );
415 mFocusChangedSignal.Emit( false );
419 void WindowBaseEcoreX::OnWindowDamaged( void* data, int type, void* event )
421 Ecore_X_Event_Window_Damage* windowDamagedEvent = static_cast< Ecore_X_Event_Window_Damage* >( event );
423 if( windowDamagedEvent->win == mEcoreWindow )
426 area.x = windowDamagedEvent->x;
427 area.y = windowDamagedEvent->y;
428 area.width = windowDamagedEvent->w;
429 area.height = windowDamagedEvent->h;
431 mWindowDamagedSignal.Emit( area );
435 void WindowBaseEcoreX::OnMouseButtonDown( void* data, int type, void* event )
437 Ecore_Event_Mouse_Button* touchEvent = static_cast< Ecore_Event_Mouse_Button* >( event );
439 if( touchEvent->window == mEcoreWindow )
441 PointState::Type state ( PointState::DOWN );
443 Integration::Point point;
444 point.SetDeviceId( touchEvent->multi.device );
445 point.SetState( state );
446 point.SetScreenPosition( Vector2( touchEvent->x, touchEvent->y ) );
447 point.SetRadius( touchEvent->multi.radius, Vector2( touchEvent->multi.radius_x, touchEvent->multi.radius_y ) );
448 point.SetPressure( touchEvent->multi.pressure );
449 point.SetAngle( Degree( touchEvent->multi.angle ) );
450 if( touchEvent->buttons)
452 point.SetMouseButton( static_cast< MouseButton::Type >( touchEvent->buttons) );
455 mTouchEventSignal.Emit( point, touchEvent->timestamp );
459 void WindowBaseEcoreX::OnMouseButtonUp( void* data, int type, void* event )
461 Ecore_Event_Mouse_Button* touchEvent = static_cast< Ecore_Event_Mouse_Button* >( event );
463 if( touchEvent->window == mEcoreWindow )
465 Integration::Point point;
466 point.SetDeviceId( touchEvent->multi.device );
467 point.SetState( PointState::UP );
468 point.SetScreenPosition( Vector2( touchEvent->x, touchEvent->y ) );
469 point.SetRadius( touchEvent->multi.radius, Vector2( touchEvent->multi.radius_x, touchEvent->multi.radius_y ) );
470 point.SetPressure( touchEvent->multi.pressure );
471 point.SetAngle( Degree( touchEvent->multi.angle ) );
472 if( touchEvent->buttons)
474 point.SetMouseButton( static_cast< MouseButton::Type >( touchEvent->buttons) );
477 mTouchEventSignal.Emit( point, touchEvent->timestamp );
481 void WindowBaseEcoreX::OnMouseButtonMove( void* data, int type, void* event )
483 Ecore_Event_Mouse_Move* touchEvent = static_cast< Ecore_Event_Mouse_Move* >( event );
485 if( touchEvent->window == mEcoreWindow )
487 Integration::Point point;
488 point.SetDeviceId( touchEvent->multi.device );
489 point.SetState( PointState::MOTION );
490 point.SetScreenPosition( Vector2( touchEvent->x, touchEvent->y ) );
491 point.SetRadius( touchEvent->multi.radius, Vector2( touchEvent->multi.radius_x, touchEvent->multi.radius_y ) );
492 point.SetPressure( touchEvent->multi.pressure );
493 point.SetAngle( Degree( touchEvent->multi.angle ) );
495 mTouchEventSignal.Emit( point, touchEvent->timestamp );
499 void WindowBaseEcoreX::OnMouseWheel( void* data, int type, void* event )
501 Ecore_Event_Mouse_Wheel* mouseWheelEvent = static_cast< Ecore_Event_Mouse_Wheel* >( event );
503 if( mouseWheelEvent->window == mEcoreWindow )
505 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 );
507 WheelEvent wheelEvent( WheelEvent::MOUSE_WHEEL, mouseWheelEvent->direction, mouseWheelEvent->modifiers, Vector2( mouseWheelEvent->x, mouseWheelEvent->y ), mouseWheelEvent->z, mouseWheelEvent->timestamp );
509 mWheelEventSignal.Emit( wheelEvent );
513 void WindowBaseEcoreX::OnKeyDown( void* data, int type, void* event )
515 Ecore_Event_Key* keyEvent = static_cast< Ecore_Event_Key* >( event );
517 if( keyEvent->window == mEcoreWindow )
519 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreX::OnKeyDown\n" );
521 std::string keyName( keyEvent->keyname );
522 std::string keyString( "" );
523 std::string compose( "" );
525 // Ensure key compose string is not NULL as keys like SHIFT or arrow have a null string.
526 if( keyEvent->compose )
528 compose = keyEvent->compose;
531 int keyCode = ecore_x_keysym_keycode_get( keyEvent->keyname );
532 int modifier( keyEvent->modifiers );
533 unsigned long time = keyEvent->timestamp;
535 // Ensure key event string is not NULL as keys like SHIFT have a null string.
536 if( keyEvent->string )
538 keyString = keyEvent->string;
541 Integration::KeyEvent keyEvent( keyName, keyString, keyCode, modifier, time, Integration::KeyEvent::Down, compose, DEFAULT_DEVICE_NAME, DEFAULT_DEVICE_CLASS, DEFAULT_DEVICE_SUBCLASS );
543 mKeyEventSignal.Emit( keyEvent );
547 void WindowBaseEcoreX::OnKeyUp( void* data, int type, void* event )
549 Ecore_Event_Key* keyEvent = static_cast< Ecore_Event_Key* >( event );
551 if ( keyEvent->window == mEcoreWindow )
553 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, " WindowBaseEcoreX::OnKeyUp\n" );
555 std::string keyName( keyEvent->keyname );
556 std::string keyString( "" );
557 std::string compose( "" );
559 // Ensure key compose string is not NULL as keys like SHIFT or arrow have a null string.
560 if( keyEvent->compose )
562 compose = keyEvent->compose;
564 int keyCode = ecore_x_keysym_keycode_get( keyEvent->keyname );
565 int modifier( keyEvent->modifiers );
566 unsigned long time( keyEvent->timestamp );
568 // Ensure key event string is not NULL as keys like SHIFT have a null string.
569 if( keyEvent->string )
571 keyString = keyEvent->string;
574 Integration::KeyEvent keyEvent( keyName, keyString, keyCode, modifier, time, Integration::KeyEvent::Up, compose, DEFAULT_DEVICE_NAME, DEFAULT_DEVICE_CLASS, DEFAULT_DEVICE_SUBCLASS );
576 mKeyEventSignal.Emit( keyEvent );
580 void WindowBaseEcoreX::OnSelectionClear( void* data, int type, void* event )
582 Ecore_X_Event_Selection_Clear* selectionClearEvent = static_cast< Ecore_X_Event_Selection_Clear* >( event );
584 if( selectionClearEvent->win == mEcoreWindow )
586 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Concise, " WindowBaseEcoreX::OnSelectionClear\n" );
588 if( selectionClearEvent->selection == ECORE_X_SELECTION_SECONDARY )
590 // Request to get the content from Ecore.
591 ecore_x_selection_secondary_request( selectionClearEvent->win, ECORE_X_SELECTION_TARGET_TEXT );
596 void WindowBaseEcoreX::OnSelectionNotify( void* data, int type, void* event )
598 Ecore_X_Event_Selection_Notify* selectionNotifyEvent = static_cast< Ecore_X_Event_Selection_Notify* >( event );
600 if( selectionNotifyEvent->win == mEcoreWindow )
602 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Concise, " WindowBaseEcoreX::OnSelectionNotify\n" );
604 Ecore_X_Selection_Data* selectionData = static_cast< Ecore_X_Selection_Data* >( selectionNotifyEvent->data );
605 if( selectionData->data )
607 if( selectionNotifyEvent->selection == ECORE_X_SELECTION_SECONDARY )
609 mSelectionDataReceivedSignal.Emit( event );
615 Any WindowBaseEcoreX::GetNativeWindow()
620 int WindowBaseEcoreX::GetNativeWindowId()
625 EGLNativeWindowType WindowBaseEcoreX::CreateEglWindow( int width, int height )
627 // need to create X handle as in 64bit system ECore handle is 32 bit whereas EGLnative and XWindow are 64 bit
628 XWindow window( mEcoreWindow );
629 return reinterpret_cast< EGLNativeWindowType >( window );
632 void WindowBaseEcoreX::DestroyEglWindow()
636 void WindowBaseEcoreX::SetEglWindowRotation( int angle )
640 void WindowBaseEcoreX::SetEglWindowBufferTransform( int angle )
644 void WindowBaseEcoreX::SetEglWindowTransform( int angle )
648 void WindowBaseEcoreX::ResizeEglWindow( PositionSize positionSize )
652 bool WindowBaseEcoreX::IsEglWindowRotationSupported()
657 void WindowBaseEcoreX::Move( PositionSize positionSize )
659 ecore_x_window_move( mEcoreWindow, positionSize.x, positionSize.y );
662 void WindowBaseEcoreX::Resize( PositionSize positionSize )
664 ecore_x_window_resize( mEcoreWindow, positionSize.width, positionSize.height );
667 void WindowBaseEcoreX::MoveResize( PositionSize positionSize )
669 ecore_x_window_move_resize( mEcoreWindow, positionSize.x, positionSize.y, positionSize.width, positionSize.height );
672 void WindowBaseEcoreX::ShowIndicator( Dali::Window::IndicatorVisibleMode visibleMode, Dali::Window::IndicatorBgOpacity opacityMode )
674 DALI_LOG_TRACE_METHOD_FMT( gWindowBaseLogFilter, "visible : %d\n", visibleMode );
676 if( visibleMode == Dali::Window::VISIBLE )
678 // when the indicator is visible, set proper mode for indicator server according to bg mode
679 if( opacityMode == Dali::Window::OPAQUE )
681 ecore_x_e_illume_indicator_opacity_set( mEcoreWindow, ECORE_X_ILLUME_INDICATOR_OPAQUE );
683 else if( opacityMode == Dali::Window::TRANSLUCENT )
685 ecore_x_e_illume_indicator_opacity_set( mEcoreWindow, ECORE_X_ILLUME_INDICATOR_TRANSLUCENT );
690 // when the indicator is not visible, set TRANSPARENT mode for indicator server
691 ecore_x_e_illume_indicator_opacity_set( mEcoreWindow, ECORE_X_ILLUME_INDICATOR_TRANSPARENT ); // it means hidden indicator
695 void WindowBaseEcoreX::SetIndicatorProperties( bool isShow, Dali::Window::WindowOrientation lastOrientation )
697 int show_state = static_cast< int >( isShow );
698 ecore_x_window_prop_property_set( mEcoreWindow, ECORE_X_ATOM_E_ILLUME_INDICATOR_STATE,
699 ECORE_X_ATOM_CARDINAL, 32, &show_state, 1 );
703 ecore_x_e_illume_indicator_state_set( mEcoreWindow, ECORE_X_ILLUME_INDICATOR_STATE_ON );
707 ecore_x_e_illume_indicator_state_set( mEcoreWindow, ECORE_X_ILLUME_INDICATOR_STATE_OFF );
711 void WindowBaseEcoreX::IndicatorTypeChanged( IndicatorInterface::Type type )
715 void WindowBaseEcoreX::SetClass( const std::string& name, const std::string& className )
717 ecore_x_icccm_title_set( mEcoreWindow, name.c_str() );
718 ecore_x_netwm_name_set( mEcoreWindow, name.c_str() );
719 ecore_x_icccm_name_class_set( mEcoreWindow, name.c_str(), className.c_str() );
722 void WindowBaseEcoreX::Raise()
724 ecore_x_window_raise( mEcoreWindow );
727 void WindowBaseEcoreX::Lower()
729 ecore_x_window_lower( mEcoreWindow );
732 void WindowBaseEcoreX::Activate()
734 ecore_x_netwm_client_active_request( ecore_x_window_root_get( mEcoreWindow ), mEcoreWindow, 1 /* request type, 1:application, 2:pager */, 0 );
737 void WindowBaseEcoreX::SetAvailableOrientations( const std::vector< Dali::Window::WindowOrientation >& orientations )
741 void WindowBaseEcoreX::SetPreferredOrientation( Dali::Window::WindowOrientation orientation )
745 void WindowBaseEcoreX::SetAcceptFocus( bool accept )
749 void WindowBaseEcoreX::Show()
751 ecore_x_window_show( mEcoreWindow );
754 void WindowBaseEcoreX::Hide()
756 ecore_x_window_hide( mEcoreWindow );
759 unsigned int WindowBaseEcoreX::GetSupportedAuxiliaryHintCount() const
764 std::string WindowBaseEcoreX::GetSupportedAuxiliaryHint( unsigned int index ) const
766 return std::string();
769 unsigned int WindowBaseEcoreX::AddAuxiliaryHint( const std::string& hint, const std::string& value )
774 bool WindowBaseEcoreX::RemoveAuxiliaryHint( unsigned int id )
779 bool WindowBaseEcoreX::SetAuxiliaryHintValue( unsigned int id, const std::string& value )
784 std::string WindowBaseEcoreX::GetAuxiliaryHintValue( unsigned int id ) const
786 return std::string();
789 unsigned int WindowBaseEcoreX::GetAuxiliaryHintId( const std::string& hint ) const
794 void WindowBaseEcoreX::SetInputRegion( const Rect< int >& inputRegion )
798 void WindowBaseEcoreX::SetType( Dali::Window::Type type )
802 bool WindowBaseEcoreX::SetNotificationLevel( Dali::Window::NotificationLevel::Type level )
807 Dali::Window::NotificationLevel::Type WindowBaseEcoreX::GetNotificationLevel() const
809 return Dali::Window::NotificationLevel::NONE;
812 void WindowBaseEcoreX::SetOpaqueState( bool opaque )
816 bool WindowBaseEcoreX::SetScreenOffMode(Dali::Window::ScreenOffMode::Type screenOffMode)
821 Dali::Window::ScreenOffMode::Type WindowBaseEcoreX::GetScreenOffMode() const
823 return Dali::Window::ScreenOffMode::TIMEOUT;
826 bool WindowBaseEcoreX::SetBrightness( int brightness )
831 int WindowBaseEcoreX::GetBrightness() const
836 bool WindowBaseEcoreX::GrabKey( Dali::KEY key, KeyGrab::KeyGrabMode grabMode )
841 bool WindowBaseEcoreX::UngrabKey( Dali::KEY key )
846 bool WindowBaseEcoreX::GrabKeyList( const Dali::Vector< Dali::KEY >& key, const Dali::Vector< KeyGrab::KeyGrabMode >& grabMode, Dali::Vector< bool >& result )
851 bool WindowBaseEcoreX::UngrabKeyList( const Dali::Vector< Dali::KEY >& key, Dali::Vector< bool >& result )
856 void WindowBaseEcoreX::GetDpi( unsigned int& dpiHorizontal, unsigned int& dpiVertical )
861 // 1 inch = 25.4 millimeters
862 xres = ecore_x_dpi_get();
863 yres = ecore_x_dpi_get();
865 dpiHorizontal = int( xres + 0.5f ); // rounding
866 dpiVertical = int( yres + 0.5f );
869 int WindowBaseEcoreX::GetScreenRotationAngle()
874 void WindowBaseEcoreX::SetWindowRotationAngle( int degree )
878 void WindowBaseEcoreX::WindowRotationCompleted( int degree, int width, int height )
882 void WindowBaseEcoreX::SetTransparency( bool transparent )
886 unsigned int WindowBaseEcoreX::GetSurfaceId( Any surface ) const
888 unsigned int surfaceId = 0;
890 if ( surface.Empty() == false )
892 // check we have a valid type
893 DALI_ASSERT_ALWAYS( ( (surface.GetType() == typeid (XWindow) ) || (surface.GetType() == typeid (Ecore_X_Window) ) )
894 && "Surface type is invalid" );
896 if ( surface.GetType() == typeid (Ecore_X_Window) )
898 surfaceId = AnyCast< Ecore_X_Window >( surface );
902 surfaceId = AnyCast< XWindow >( surface );
908 void WindowBaseEcoreX::CreateWindow( PositionSize positionSize, bool isTransparent )
912 // create 32 bit window
913 mEcoreWindow = ecore_x_window_argb_new( 0, positionSize.x, positionSize.y, positionSize.width, positionSize.height );
914 mIsTransparent = true;
918 // create 24 bit window
919 mEcoreWindow = ecore_x_window_new( 0, positionSize.x, positionSize.y, positionSize.width, positionSize.height );
922 if ( mEcoreWindow == 0 )
924 DALI_ASSERT_ALWAYS( 0 && "Failed to create X window" );
928 } // namespace Adaptor
930 } // namespace Internal
934 #pragma GCC diagnostic pop