2 * Copyright (c) 2019 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/ubuntu-x11/window-base-ecore-x.h>
22 #include <dali/internal/window-system/common/window-impl.h>
23 #include <dali/internal/window-system/common/window-render-surface.h>
24 #include <dali/internal/window-system/ubuntu-x11/ecore-x-types.h>
27 #include <dali/public-api/object/any.h>
28 #include <dali/public-api/events/mouse-button.h>
29 #include <dali/integration-api/debug.h>
30 #include <dali/internal/input/ubuntu-x11/dali-ecore-input.h>
44 const std::string DEFAULT_DEVICE_NAME = "";
45 const Device::Class::Type DEFAULT_DEVICE_CLASS = Device::Class::NONE;
46 const Device::Subclass::Type DEFAULT_DEVICE_SUBCLASS = Device::Subclass::NONE;
48 const unsigned int PRIMARY_TOUCH_BUTTON_ID( 1 );
50 #if defined(DEBUG_ENABLED)
51 Debug::Filter* gWindowBaseLogFilter = Debug::Filter::New( Debug::NoLogging, false, "LOG_WINDOW_BASE" );
54 /////////////////////////////////////////////////////////////////////////////////////////////////
56 /////////////////////////////////////////////////////////////////////////////////////////////////
58 static Eina_Bool EcoreEventWindowPropertyChanged( void* data, int type, void* event )
60 WindowBaseEcoreX* windowBase = static_cast< WindowBaseEcoreX* >( data );
63 return windowBase->OnWindowPropertyChanged( data, type, event );
66 return ECORE_CALLBACK_PASS_ON;
70 * Called when the window receives a delete request
72 static Eina_Bool EcoreEventWindowDeleteRequest( void* data, int type, void* event )
74 WindowBaseEcoreX* windowBase = static_cast< WindowBaseEcoreX* >( data );
77 windowBase->OnDeleteRequest();
79 return ECORE_CALLBACK_DONE;
83 * Called when the window gains focus.
85 static Eina_Bool EcoreEventWindowFocusIn( void* data, int type, void* event )
87 WindowBaseEcoreX* windowBase = static_cast< WindowBaseEcoreX* >( data );
90 windowBase->OnFocusIn( data, type, event );
92 return ECORE_CALLBACK_PASS_ON;
96 * Called when the window loses focus.
98 static Eina_Bool EcoreEventWindowFocusOut( void* data, int type, void* event )
100 WindowBaseEcoreX* windowBase = static_cast< WindowBaseEcoreX* >( data );
103 windowBase->OnFocusOut( data, type, event );
105 return ECORE_CALLBACK_PASS_ON;
109 * Called when the window is damaged.
111 static Eina_Bool EcoreEventWindowDamaged( void* data, int type, void* event )
113 WindowBaseEcoreX* windowBase = static_cast< WindowBaseEcoreX* >( data );
116 windowBase->OnWindowDamaged( data, type, event );
119 return ECORE_CALLBACK_PASS_ON;
122 /////////////////////////////////////////////////////////////////////////////////////////////////
123 // Selection Callbacks
124 /////////////////////////////////////////////////////////////////////////////////////////////////
127 * Called when the source window notifies us the content in clipboard is selected.
129 static Eina_Bool EcoreEventSelectionClear( void* data, int type, void* event )
131 WindowBaseEcoreX* windowBase = static_cast< WindowBaseEcoreX* >( data );
134 windowBase->OnSelectionClear( data, type, event );
136 return ECORE_CALLBACK_PASS_ON;
140 * Called when the source window sends us about the selected content.
141 * For example, when dragged items are dragged INTO our window or when items are selected in the clipboard.
143 static Eina_Bool EcoreEventSelectionNotify( void* data, int type, void* event )
145 WindowBaseEcoreX* windowBase = static_cast< WindowBaseEcoreX* >( data );
148 windowBase->OnSelectionNotify( data, type, event );
150 return ECORE_CALLBACK_PASS_ON;
153 /////////////////////////////////////////////////////////////////////////////////////////////////
155 /////////////////////////////////////////////////////////////////////////////////////////////////
158 * Called when a touch down is received.
160 static Eina_Bool EcoreEventMouseButtonDown( void* data, int type, void* event )
162 WindowBaseEcoreX* windowBase = static_cast< WindowBaseEcoreX* >( data );
165 windowBase->OnMouseButtonDown( data, type, event );
167 return ECORE_CALLBACK_PASS_ON;
171 * Called when a touch up is received.
173 static Eina_Bool EcoreEventMouseButtonUp( void* data, int type, void* event )
175 WindowBaseEcoreX* windowBase = static_cast< WindowBaseEcoreX* >( data );
178 windowBase->OnMouseButtonUp( data, type, event );
180 return ECORE_CALLBACK_PASS_ON;
184 * Called when a touch motion is received.
186 static Eina_Bool EcoreEventMouseButtonMove( void* data, int type, void* event )
188 WindowBaseEcoreX* windowBase = static_cast< WindowBaseEcoreX* >( data );
191 windowBase->OnMouseButtonMove( data, type, event );
193 return ECORE_CALLBACK_PASS_ON;
196 /////////////////////////////////////////////////////////////////////////////////////////////////
198 /////////////////////////////////////////////////////////////////////////////////////////////////
201 * Called when a mouse wheel is received.
203 static Eina_Bool EcoreEventMouseWheel( void* data, int type, void* event )
205 WindowBaseEcoreX* windowBase = static_cast< WindowBaseEcoreX* >( data );
208 windowBase->OnMouseWheel( data, type, event );
210 return ECORE_CALLBACK_PASS_ON;
213 /////////////////////////////////////////////////////////////////////////////////////////////////
215 /////////////////////////////////////////////////////////////////////////////////////////////////
218 * Called when a key down is received.
220 static Eina_Bool EcoreEventKeyDown( void* data, int type, void* event )
222 WindowBaseEcoreX* windowBase = static_cast< WindowBaseEcoreX* >( data );
225 windowBase->OnKeyDown( data, type, event );
227 return ECORE_CALLBACK_PASS_ON;
231 * Called when a key up is received.
233 static Eina_Bool EcoreEventKeyUp( void* data, int type, void* event )
235 WindowBaseEcoreX* windowBase = static_cast< WindowBaseEcoreX* >( data );
238 windowBase->OnKeyUp( data, type, event );
240 return ECORE_CALLBACK_PASS_ON;
243 } // unnamed namespace
245 WindowBaseEcoreX::WindowBaseEcoreX( Dali::PositionSize positionSize, Any surface, bool isTransparent )
246 : mEcoreEventHandler(),
248 mOwnSurface( false ),
249 mIsTransparent( false ), // Should only be set to true once we actually create a transparent window regardless of what isTransparent is.
250 mRotationAppSet( false )
252 Initialize( positionSize, surface, isTransparent );
255 WindowBaseEcoreX::~WindowBaseEcoreX()
257 for( Dali::Vector< Ecore_Event_Handler* >::Iterator iter = mEcoreEventHandler.Begin(), endIter = mEcoreEventHandler.End(); iter != endIter; ++iter )
259 ecore_event_handler_del( *iter );
261 mEcoreEventHandler.Clear();
265 ecore_x_window_free( mEcoreWindow );
269 void WindowBaseEcoreX::Initialize( PositionSize positionSize, Any surface, bool isTransparent )
271 // see if there is a surface in Any surface
272 unsigned int surfaceId = GetSurfaceId( surface );
274 // if the surface is empty, create a new one.
277 // we own the surface about to created
279 CreateWindow( positionSize, isTransparent );
283 // XLib should already be initialized so no point in calling XInitThreads
284 mEcoreWindow = static_cast< Ecore_X_Window >( surfaceId );
287 // set up etc properties to match with ecore-evas
289 if( ( id = getenv("DESKTOP_STARTUP_ID") ) )
291 ecore_x_netwm_startup_id_set( mEcoreWindow, id );
294 ecore_x_icccm_hints_set( mEcoreWindow,
296 ECORE_X_WINDOW_STATE_HINT_NORMAL, // initial_state
303 // we SHOULD guarantee the x11 window was created in x server.
306 ecore_x_input_multi_select( mEcoreWindow );
308 // This ensures that we catch the window close (or delete) request
309 ecore_x_icccm_protocol_set( mEcoreWindow, ECORE_X_WM_PROTOCOL_DELETE_REQUEST, EINA_TRUE );
311 // Enable Drag & Drop
312 ecore_x_dnd_aware_set( mEcoreWindow, EINA_TRUE );
314 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_X_EVENT_WINDOW_PROPERTY, EcoreEventWindowPropertyChanged, this ) );
315 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_X_EVENT_WINDOW_DELETE_REQUEST, EcoreEventWindowDeleteRequest, this ) );
317 // Register window focus events
318 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_X_EVENT_WINDOW_FOCUS_IN, EcoreEventWindowFocusIn, this ) );
319 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_X_EVENT_WINDOW_FOCUS_OUT, EcoreEventWindowFocusOut, this ) );
321 // Register Window damage events
322 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_X_EVENT_WINDOW_DAMAGE, EcoreEventWindowDamaged, this ) );
324 // Register Touch events
325 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_EVENT_MOUSE_BUTTON_DOWN, EcoreEventMouseButtonDown, this ) );
326 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_EVENT_MOUSE_BUTTON_UP, EcoreEventMouseButtonUp, this ) );
327 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_EVENT_MOUSE_MOVE, EcoreEventMouseButtonMove, this ) );
328 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_EVENT_MOUSE_OUT, EcoreEventMouseButtonUp, this ) ); // process mouse out event like up event
330 // Register Mouse wheel events
331 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_EVENT_MOUSE_WHEEL, EcoreEventMouseWheel, this ) );
333 // Register Key events
334 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_EVENT_KEY_DOWN, EcoreEventKeyDown, this ) );
335 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_EVENT_KEY_UP, EcoreEventKeyUp, this ) );
337 // Register Selection event
338 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_X_EVENT_SELECTION_CLEAR, EcoreEventSelectionClear, this ) );
339 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_X_EVENT_SELECTION_NOTIFY, EcoreEventSelectionNotify, this ) );
342 Eina_Bool WindowBaseEcoreX::OnWindowPropertyChanged( void* data, int type, void* event )
344 Ecore_X_Event_Window_Property* propertyChangedEvent = static_cast< Ecore_X_Event_Window_Property* >( event );
345 Eina_Bool handled( ECORE_CALLBACK_PASS_ON );
347 if( propertyChangedEvent->win == mEcoreWindow )
349 Ecore_X_Window_State_Hint state( ecore_x_icccm_state_get( propertyChangedEvent->win ) );
353 case ECORE_X_WINDOW_STATE_HINT_WITHDRAWN:
355 // Window was hidden.
356 mIconifyChangedSignal.Emit( true );
357 handled = ECORE_CALLBACK_DONE;
360 case ECORE_X_WINDOW_STATE_HINT_ICONIC:
362 // Window was iconified (minimised).
363 mIconifyChangedSignal.Emit( true );
364 handled = ECORE_CALLBACK_DONE;
367 case ECORE_X_WINDOW_STATE_HINT_NORMAL:
370 mIconifyChangedSignal.Emit( false );
371 handled = ECORE_CALLBACK_DONE;
385 void WindowBaseEcoreX::OnDeleteRequest()
387 mDeleteRequestSignal.Emit();
390 void WindowBaseEcoreX::OnFocusIn( void* data, int type, void* event )
392 Ecore_X_Event_Window_Focus_In* focusInEvent = static_cast< Ecore_X_Event_Window_Focus_In* >( event );
394 if( focusInEvent->win == mEcoreWindow )
396 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "Window EcoreEventWindowFocusIn\n" );
398 mFocusChangedSignal.Emit( true );
402 void WindowBaseEcoreX::OnFocusOut( void* data, int type, void* event )
404 Ecore_X_Event_Window_Focus_Out* focusOutEvent = static_cast< Ecore_X_Event_Window_Focus_Out* >( event );
406 // If the window loses focus then hide the keyboard.
407 if( focusOutEvent->win == mEcoreWindow )
409 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "Window EcoreEventWindowFocusOut\n" );
411 mFocusChangedSignal.Emit( false );
415 void WindowBaseEcoreX::OnWindowDamaged( void* data, int type, void* event )
417 Ecore_X_Event_Window_Damage* windowDamagedEvent = static_cast< Ecore_X_Event_Window_Damage* >( event );
419 if( windowDamagedEvent->win == mEcoreWindow )
422 area.x = windowDamagedEvent->x;
423 area.y = windowDamagedEvent->y;
424 area.width = windowDamagedEvent->w;
425 area.height = windowDamagedEvent->h;
427 mWindowDamagedSignal.Emit( area );
431 void WindowBaseEcoreX::OnMouseButtonDown( void* data, int type, void* event )
433 Ecore_Event_Mouse_Button* touchEvent = static_cast< Ecore_Event_Mouse_Button* >( event );
435 if( touchEvent->window == mEcoreWindow )
437 PointState::Type state ( PointState::DOWN );
439 Integration::Point point;
440 point.SetDeviceId( touchEvent->multi.device );
441 point.SetState( state );
442 point.SetScreenPosition( Vector2( touchEvent->x, touchEvent->y ) );
443 point.SetRadius( touchEvent->multi.radius, Vector2( touchEvent->multi.radius_x, touchEvent->multi.radius_y ) );
444 point.SetPressure( touchEvent->multi.pressure );
445 point.SetAngle( Degree( touchEvent->multi.angle ) );
446 if( touchEvent->buttons)
448 point.SetMouseButton( static_cast< MouseButton::Type >( touchEvent->buttons) );
451 mTouchEventSignal.Emit( point, touchEvent->timestamp );
455 void WindowBaseEcoreX::OnMouseButtonUp( void* data, int type, void* event )
457 Ecore_Event_Mouse_Button* touchEvent = static_cast< Ecore_Event_Mouse_Button* >( event );
459 if( touchEvent->window == mEcoreWindow )
461 Integration::Point point;
462 point.SetDeviceId( touchEvent->multi.device );
463 point.SetState( PointState::UP );
464 point.SetScreenPosition( Vector2( touchEvent->x, touchEvent->y ) );
465 point.SetRadius( touchEvent->multi.radius, Vector2( touchEvent->multi.radius_x, touchEvent->multi.radius_y ) );
466 point.SetPressure( touchEvent->multi.pressure );
467 point.SetAngle( Degree( static_cast<float>( touchEvent->multi.angle ) ) );
468 if( touchEvent->buttons)
470 point.SetMouseButton( static_cast< MouseButton::Type >( touchEvent->buttons) );
473 mTouchEventSignal.Emit( point, touchEvent->timestamp );
477 void WindowBaseEcoreX::OnMouseButtonMove( void* data, int type, void* event )
479 Ecore_Event_Mouse_Move* touchEvent = static_cast< Ecore_Event_Mouse_Move* >( event );
481 if( touchEvent->window == mEcoreWindow )
483 Integration::Point point;
484 point.SetDeviceId( touchEvent->multi.device );
485 point.SetState( PointState::MOTION );
486 point.SetScreenPosition( Vector2( static_cast<float>( touchEvent->x ), static_cast<float>( touchEvent->y ) ) );
487 point.SetRadius( static_cast<float>( touchEvent->multi.radius ), Vector2( static_cast<float>( touchEvent->multi.radius_x ), static_cast<float>( touchEvent->multi.radius_y ) ) );
488 point.SetPressure( static_cast<float>( touchEvent->multi.pressure ) );
489 point.SetAngle( Degree( static_cast<float>( touchEvent->multi.angle ) ) );
491 mTouchEventSignal.Emit( point, touchEvent->timestamp );
495 void WindowBaseEcoreX::OnMouseWheel( void* data, int type, void* event )
497 Ecore_Event_Mouse_Wheel* mouseWheelEvent = static_cast< Ecore_Event_Mouse_Wheel* >( event );
499 if( mouseWheelEvent->window == mEcoreWindow )
501 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 );
503 WheelEvent wheelEvent( WheelEvent::MOUSE_WHEEL, mouseWheelEvent->direction, mouseWheelEvent->modifiers, Vector2( static_cast<float>( mouseWheelEvent->x ), static_cast<float>( mouseWheelEvent->y ) ), mouseWheelEvent->z, mouseWheelEvent->timestamp );
505 mWheelEventSignal.Emit( wheelEvent );
509 void WindowBaseEcoreX::OnKeyDown( void* data, int type, void* event )
511 Ecore_Event_Key* keyEvent = static_cast< Ecore_Event_Key* >( event );
513 if( keyEvent->window == mEcoreWindow )
515 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreX::OnKeyDown\n" );
517 std::string keyName( keyEvent->keyname );
518 std::string logicalKey( "" );
519 std::string keyString( "" );
520 std::string compose( "" );
522 // Ensure key compose string is not NULL as keys like SHIFT or arrow have a null string.
523 if( keyEvent->compose )
525 compose = keyEvent->compose;
528 // Ensure key symbol is not NULL as keys like SHIFT have a null string.
531 logicalKey = keyEvent->key;
534 int keyCode = ecore_x_keysym_keycode_get( keyEvent->keyname );
535 int modifier( keyEvent->modifiers );
536 unsigned long time = keyEvent->timestamp;
538 // Ensure key event string is not NULL as keys like SHIFT have a null string.
539 if( keyEvent->string )
541 keyString = keyEvent->string;
544 Integration::KeyEvent keyEvent( keyName, logicalKey, keyString, keyCode, modifier, time, Integration::KeyEvent::Down, compose, DEFAULT_DEVICE_NAME, DEFAULT_DEVICE_CLASS, DEFAULT_DEVICE_SUBCLASS );
546 mKeyEventSignal.Emit( keyEvent );
550 void WindowBaseEcoreX::OnKeyUp( void* data, int type, void* event )
552 Ecore_Event_Key* keyEvent = static_cast< Ecore_Event_Key* >( event );
554 if ( keyEvent->window == mEcoreWindow )
556 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, " WindowBaseEcoreX::OnKeyUp\n" );
558 std::string keyName( keyEvent->keyname );
559 std::string logicalKey( "" );
560 std::string keyString( "" );
561 std::string compose( "" );
563 // Ensure key compose string is not NULL as keys like SHIFT or arrow have a null string.
564 if( keyEvent->compose )
566 compose = keyEvent->compose;
568 // Ensure key symbol is not NULL as keys like SHIFT have a null string.
571 logicalKey = keyEvent->key;
574 int keyCode = ecore_x_keysym_keycode_get( keyEvent->keyname );
575 int modifier( keyEvent->modifiers );
576 unsigned long time( keyEvent->timestamp );
578 // Ensure key event string is not NULL as keys like SHIFT have a null string.
579 if( keyEvent->string )
581 keyString = keyEvent->string;
584 Integration::KeyEvent keyEvent( keyName, logicalKey, keyString, keyCode, modifier, time, Integration::KeyEvent::Up, compose, DEFAULT_DEVICE_NAME, DEFAULT_DEVICE_CLASS, DEFAULT_DEVICE_SUBCLASS );
586 mKeyEventSignal.Emit( keyEvent );
590 void WindowBaseEcoreX::OnSelectionClear( void* data, int type, void* event )
592 Ecore_X_Event_Selection_Clear* selectionClearEvent = static_cast< Ecore_X_Event_Selection_Clear* >( event );
594 if( selectionClearEvent->win == mEcoreWindow )
596 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Concise, " WindowBaseEcoreX::OnSelectionClear\n" );
598 if( selectionClearEvent->selection == ECORE_X_SELECTION_SECONDARY )
600 // Request to get the content from Ecore.
601 ecore_x_selection_secondary_request( selectionClearEvent->win, ECORE_X_SELECTION_TARGET_TEXT );
606 void WindowBaseEcoreX::OnSelectionNotify( void* data, int type, void* event )
608 Ecore_X_Event_Selection_Notify* selectionNotifyEvent = static_cast< Ecore_X_Event_Selection_Notify* >( event );
610 if( selectionNotifyEvent->win == mEcoreWindow )
612 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Concise, " WindowBaseEcoreX::OnSelectionNotify\n" );
614 Ecore_X_Selection_Data* selectionData = static_cast< Ecore_X_Selection_Data* >( selectionNotifyEvent->data );
615 if( selectionData->data )
617 if( selectionNotifyEvent->selection == ECORE_X_SELECTION_SECONDARY )
619 mSelectionDataReceivedSignal.Emit( event );
625 Any WindowBaseEcoreX::GetNativeWindow()
630 int WindowBaseEcoreX::GetNativeWindowId()
635 EGLNativeWindowType WindowBaseEcoreX::CreateEglWindow( int width, int height )
637 // need to create X handle as in 64bit system ECore handle is 32 bit whereas EGLnative and XWindow are 64 bit
638 XWindow window( mEcoreWindow );
639 return reinterpret_cast< EGLNativeWindowType >( window );
642 void WindowBaseEcoreX::DestroyEglWindow()
646 void WindowBaseEcoreX::SetEglWindowRotation( int angle )
650 void WindowBaseEcoreX::SetEglWindowBufferTransform( int angle )
654 void WindowBaseEcoreX::SetEglWindowTransform( int angle )
658 void WindowBaseEcoreX::ResizeEglWindow( PositionSize positionSize )
662 bool WindowBaseEcoreX::IsEglWindowRotationSupported()
667 void WindowBaseEcoreX::Move( PositionSize positionSize )
669 ecore_x_window_move( mEcoreWindow, positionSize.x, positionSize.y );
672 void WindowBaseEcoreX::Resize( PositionSize positionSize )
674 ecore_x_window_resize( mEcoreWindow, positionSize.width, positionSize.height );
677 void WindowBaseEcoreX::MoveResize( PositionSize positionSize )
679 ecore_x_window_move_resize( mEcoreWindow, positionSize.x, positionSize.y, positionSize.width, positionSize.height );
682 void WindowBaseEcoreX::SetClass( const std::string& name, const std::string& className )
684 ecore_x_icccm_title_set( mEcoreWindow, name.c_str() );
685 ecore_x_netwm_name_set( mEcoreWindow, name.c_str() );
686 ecore_x_icccm_name_class_set( mEcoreWindow, name.c_str(), className.c_str() );
689 void WindowBaseEcoreX::Raise()
691 ecore_x_window_raise( mEcoreWindow );
694 void WindowBaseEcoreX::Lower()
696 ecore_x_window_lower( mEcoreWindow );
699 void WindowBaseEcoreX::Activate()
701 ecore_x_netwm_client_active_request( ecore_x_window_root_get( mEcoreWindow ), mEcoreWindow, 1 /* request type, 1:application, 2:pager */, 0 );
704 void WindowBaseEcoreX::SetAvailableOrientations( const std::vector< Dali::Window::WindowOrientation >& orientations )
708 void WindowBaseEcoreX::SetPreferredOrientation( Dali::Window::WindowOrientation orientation )
712 void WindowBaseEcoreX::SetAcceptFocus( bool accept )
716 void WindowBaseEcoreX::Show()
718 ecore_x_window_show( mEcoreWindow );
721 void WindowBaseEcoreX::Hide()
723 ecore_x_window_hide( mEcoreWindow );
726 unsigned int WindowBaseEcoreX::GetSupportedAuxiliaryHintCount() const
731 std::string WindowBaseEcoreX::GetSupportedAuxiliaryHint( unsigned int index ) const
733 return std::string();
736 unsigned int WindowBaseEcoreX::AddAuxiliaryHint( const std::string& hint, const std::string& value )
741 bool WindowBaseEcoreX::RemoveAuxiliaryHint( unsigned int id )
746 bool WindowBaseEcoreX::SetAuxiliaryHintValue( unsigned int id, const std::string& value )
751 std::string WindowBaseEcoreX::GetAuxiliaryHintValue( unsigned int id ) const
753 return std::string();
756 unsigned int WindowBaseEcoreX::GetAuxiliaryHintId( const std::string& hint ) const
761 void WindowBaseEcoreX::SetInputRegion( const Rect< int >& inputRegion )
765 void WindowBaseEcoreX::SetType( Dali::Window::Type type )
769 bool WindowBaseEcoreX::SetNotificationLevel( Dali::Window::NotificationLevel::Type level )
774 Dali::Window::NotificationLevel::Type WindowBaseEcoreX::GetNotificationLevel() const
776 return Dali::Window::NotificationLevel::NONE;
779 void WindowBaseEcoreX::SetOpaqueState( bool opaque )
783 bool WindowBaseEcoreX::SetScreenOffMode(Dali::Window::ScreenOffMode::Type screenOffMode)
788 Dali::Window::ScreenOffMode::Type WindowBaseEcoreX::GetScreenOffMode() const
790 return Dali::Window::ScreenOffMode::TIMEOUT;
793 bool WindowBaseEcoreX::SetBrightness( int brightness )
798 int WindowBaseEcoreX::GetBrightness() const
803 bool WindowBaseEcoreX::GrabKey( Dali::KEY key, KeyGrab::KeyGrabMode grabMode )
808 bool WindowBaseEcoreX::UngrabKey( Dali::KEY key )
813 bool WindowBaseEcoreX::GrabKeyList( const Dali::Vector< Dali::KEY >& key, const Dali::Vector< KeyGrab::KeyGrabMode >& grabMode, Dali::Vector< bool >& result )
818 bool WindowBaseEcoreX::UngrabKeyList( const Dali::Vector< Dali::KEY >& key, Dali::Vector< bool >& result )
823 void WindowBaseEcoreX::GetDpi( unsigned int& dpiHorizontal, unsigned int& dpiVertical )
825 // 1 inch = 25.4 millimeters
826 // ecore does not account for differing DPI in the x and y axes, so only get for x is available
828 dpiHorizontal = ecore_x_dpi_get();
829 dpiVertical = ecore_x_dpi_get();
832 int WindowBaseEcoreX::GetOrientation() const
837 int WindowBaseEcoreX::GetScreenRotationAngle()
842 void WindowBaseEcoreX::SetWindowRotationAngle( int degree )
846 int WindowBaseEcoreX::GetWindowRotationAngle()
851 void WindowBaseEcoreX::WindowRotationCompleted( int degree, int width, int height )
855 void WindowBaseEcoreX::SetTransparency( bool transparent )
859 unsigned int WindowBaseEcoreX::GetSurfaceId( Any surface ) const
861 unsigned int surfaceId = 0;
863 if ( surface.Empty() == false )
865 // check we have a valid type
866 DALI_ASSERT_ALWAYS( ( (surface.GetType() == typeid (XWindow) ) || (surface.GetType() == typeid (Ecore_X_Window) ) )
867 && "Surface type is invalid" );
869 if ( surface.GetType() == typeid (Ecore_X_Window) )
871 surfaceId = AnyCast< Ecore_X_Window >( surface );
875 surfaceId = static_cast<unsigned int>( AnyCast< XWindow >( surface ) );
881 void WindowBaseEcoreX::CreateWindow( PositionSize positionSize, bool isTransparent )
885 // create 32 bit window
886 mEcoreWindow = ecore_x_window_argb_new( 0, positionSize.x, positionSize.y, positionSize.width, positionSize.height );
887 mIsTransparent = true;
891 // create 24 bit window
892 mEcoreWindow = ecore_x_window_new( 0, positionSize.x, positionSize.y, positionSize.width, positionSize.height );
895 if ( mEcoreWindow == 0 )
897 DALI_ASSERT_ALWAYS( 0 && "Failed to create X window" );
901 void WindowBaseEcoreX::SetParent( Any parent )
903 Ecore_X_Window mEcoreParent;
904 if ( parent.Empty() == false )
906 // check we have a valid type
907 DALI_ASSERT_ALWAYS( ( (parent.GetType() == typeid (Ecore_X_Window) ) )
908 && "Surface type is invalid" );
910 if ( parent.GetType() == typeid (Ecore_X_Window) )
912 mEcoreParent = AnyCast< Ecore_X_Window >( parent );
913 ecore_x_icccm_transient_for_set( mEcoreWindow, mEcoreParent );
918 ecore_x_icccm_transient_for_unset( mEcoreWindow );
924 ecore_x_icccm_transient_for_unset( mEcoreWindow );
928 bool WindowBaseEcoreX::IsMatchedWindow( Any window )
931 if ( window.Empty() == false )
933 // check we have a valid type
934 DALI_ASSERT_ALWAYS( ( (window.GetType() == typeid (Ecore_X_Window) ) ) && "Surface type is invalid" );
935 if ( AnyCast< Ecore_X_Window >( window ) == mEcoreWindow )
943 } // namespace Adaptor
945 } // namespace Internal