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-system.h>
24 #include <dali/internal/window-system/common/window-render-surface.h>
25 #include <dali/internal/window-system/ubuntu-x11/ecore-x-types.h>
28 #include <dali/public-api/object/any.h>
29 #include <dali/public-api/events/mouse-button.h>
30 #include <dali/integration-api/debug.h>
31 #include <dali/internal/input/ubuntu-x11/dali-ecore-input.h>
45 const std::string DEFAULT_DEVICE_NAME = "";
46 const Device::Class::Type DEFAULT_DEVICE_CLASS = Device::Class::NONE;
47 const Device::Subclass::Type DEFAULT_DEVICE_SUBCLASS = Device::Subclass::NONE;
49 const unsigned int PRIMARY_TOUCH_BUTTON_ID( 1 );
51 #if defined(DEBUG_ENABLED)
52 Debug::Filter* gWindowBaseLogFilter = Debug::Filter::New( Debug::NoLogging, false, "LOG_WINDOW_BASE" );
55 /////////////////////////////////////////////////////////////////////////////////////////////////
57 /////////////////////////////////////////////////////////////////////////////////////////////////
59 static Eina_Bool EcoreEventWindowPropertyChanged( void* data, int type, void* event )
61 WindowBaseEcoreX* windowBase = static_cast< WindowBaseEcoreX* >( data );
64 return windowBase->OnWindowPropertyChanged( data, type, event );
67 return ECORE_CALLBACK_PASS_ON;
71 * Called when the window receives a delete request
73 static Eina_Bool EcoreEventWindowDeleteRequest( void* data, int type, void* event )
75 WindowBaseEcoreX* windowBase = static_cast< WindowBaseEcoreX* >( data );
78 windowBase->OnDeleteRequest();
80 return ECORE_CALLBACK_DONE;
84 * Called when the window gains focus.
86 static Eina_Bool EcoreEventWindowFocusIn( void* data, int type, void* event )
88 WindowBaseEcoreX* windowBase = static_cast< WindowBaseEcoreX* >( data );
91 windowBase->OnFocusIn( data, type, event );
93 return ECORE_CALLBACK_PASS_ON;
97 * Called when the window loses focus.
99 static Eina_Bool EcoreEventWindowFocusOut( void* data, int type, void* event )
101 WindowBaseEcoreX* windowBase = static_cast< WindowBaseEcoreX* >( data );
104 windowBase->OnFocusOut( data, type, event );
106 return ECORE_CALLBACK_PASS_ON;
110 * Called when the window is damaged.
112 static Eina_Bool EcoreEventWindowDamaged( void* data, int type, void* event )
114 WindowBaseEcoreX* windowBase = static_cast< WindowBaseEcoreX* >( data );
117 windowBase->OnWindowDamaged( data, type, event );
120 return ECORE_CALLBACK_PASS_ON;
123 /////////////////////////////////////////////////////////////////////////////////////////////////
124 // Selection Callbacks
125 /////////////////////////////////////////////////////////////////////////////////////////////////
128 * Called when the source window notifies us the content in clipboard is selected.
130 static Eina_Bool EcoreEventSelectionClear( void* data, int type, void* event )
132 WindowBaseEcoreX* windowBase = static_cast< WindowBaseEcoreX* >( data );
135 windowBase->OnSelectionClear( data, type, event );
137 return ECORE_CALLBACK_PASS_ON;
141 * Called when the source window sends us about the selected content.
142 * For example, when dragged items are dragged INTO our window or when items are selected in the clipboard.
144 static Eina_Bool EcoreEventSelectionNotify( void* data, int type, void* event )
146 WindowBaseEcoreX* windowBase = static_cast< WindowBaseEcoreX* >( data );
149 windowBase->OnSelectionNotify( data, type, event );
151 return ECORE_CALLBACK_PASS_ON;
154 /////////////////////////////////////////////////////////////////////////////////////////////////
156 /////////////////////////////////////////////////////////////////////////////////////////////////
159 * Called when a touch down is received.
161 static Eina_Bool EcoreEventMouseButtonDown( void* data, int type, void* event )
163 WindowBaseEcoreX* windowBase = static_cast< WindowBaseEcoreX* >( data );
166 windowBase->OnMouseButtonDown( data, type, event );
168 return ECORE_CALLBACK_PASS_ON;
172 * Called when a touch up is received.
174 static Eina_Bool EcoreEventMouseButtonUp( void* data, int type, void* event )
176 WindowBaseEcoreX* windowBase = static_cast< WindowBaseEcoreX* >( data );
179 windowBase->OnMouseButtonUp( data, type, event );
181 return ECORE_CALLBACK_PASS_ON;
185 * Called when a touch motion is received.
187 static Eina_Bool EcoreEventMouseButtonMove( void* data, int type, void* event )
189 WindowBaseEcoreX* windowBase = static_cast< WindowBaseEcoreX* >( data );
192 windowBase->OnMouseButtonMove( data, type, event );
194 return ECORE_CALLBACK_PASS_ON;
197 /////////////////////////////////////////////////////////////////////////////////////////////////
199 /////////////////////////////////////////////////////////////////////////////////////////////////
202 * Called when a mouse wheel is received.
204 static Eina_Bool EcoreEventMouseWheel( void* data, int type, void* event )
206 WindowBaseEcoreX* windowBase = static_cast< WindowBaseEcoreX* >( data );
209 windowBase->OnMouseWheel( data, type, event );
211 return ECORE_CALLBACK_PASS_ON;
214 /////////////////////////////////////////////////////////////////////////////////////////////////
216 /////////////////////////////////////////////////////////////////////////////////////////////////
219 * Called when a key down is received.
221 static Eina_Bool EcoreEventKeyDown( void* data, int type, void* event )
223 WindowBaseEcoreX* windowBase = static_cast< WindowBaseEcoreX* >( data );
226 windowBase->OnKeyDown( data, type, event );
228 return ECORE_CALLBACK_PASS_ON;
232 * Called when a key up is received.
234 static Eina_Bool EcoreEventKeyUp( void* data, int type, void* event )
236 WindowBaseEcoreX* windowBase = static_cast< WindowBaseEcoreX* >( data );
239 windowBase->OnKeyUp( data, type, event );
241 return ECORE_CALLBACK_PASS_ON;
244 } // unnamed namespace
246 WindowBaseEcoreX::WindowBaseEcoreX( Dali::PositionSize positionSize, Any surface, bool isTransparent )
247 : mEcoreEventHandler(),
249 mOwnSurface( false ),
250 mIsTransparent( false ), // Should only be set to true once we actually create a transparent window regardless of what isTransparent is.
251 mRotationAppSet( false )
253 Initialize( positionSize, surface, isTransparent );
256 WindowBaseEcoreX::~WindowBaseEcoreX()
258 for( Dali::Vector< Ecore_Event_Handler* >::Iterator iter = mEcoreEventHandler.Begin(), endIter = mEcoreEventHandler.End(); iter != endIter; ++iter )
260 ecore_event_handler_del( *iter );
262 mEcoreEventHandler.Clear();
266 ecore_x_window_free( mEcoreWindow );
268 WindowSystem::Shutdown();
272 void WindowBaseEcoreX::Initialize( PositionSize positionSize, Any surface, bool isTransparent )
274 // see if there is a surface in Any surface
275 unsigned int surfaceId = GetSurfaceId( surface );
277 // if the surface is empty, create a new one.
280 WindowSystem::Initialize();
282 // we own the surface about to created
284 CreateWindow( positionSize, isTransparent );
288 // XLib should already be initialized so no point in calling XInitThreads
289 mEcoreWindow = static_cast< Ecore_X_Window >( surfaceId );
292 // set up etc properties to match with ecore-evas
294 if( ( id = getenv("DESKTOP_STARTUP_ID") ) )
296 ecore_x_netwm_startup_id_set( mEcoreWindow, id );
299 ecore_x_icccm_hints_set( mEcoreWindow,
301 ECORE_X_WINDOW_STATE_HINT_NORMAL, // initial_state
308 // we SHOULD guarantee the x11 window was created in x server.
311 ecore_x_input_multi_select( mEcoreWindow );
313 // This ensures that we catch the window close (or delete) request
314 ecore_x_icccm_protocol_set( mEcoreWindow, ECORE_X_WM_PROTOCOL_DELETE_REQUEST, EINA_TRUE );
316 // Enable Drag & Drop
317 ecore_x_dnd_aware_set( mEcoreWindow, EINA_TRUE );
319 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_X_EVENT_WINDOW_PROPERTY, EcoreEventWindowPropertyChanged, this ) );
320 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_X_EVENT_WINDOW_DELETE_REQUEST, EcoreEventWindowDeleteRequest, this ) );
322 // Register window focus events
323 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_X_EVENT_WINDOW_FOCUS_IN, EcoreEventWindowFocusIn, this ) );
324 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_X_EVENT_WINDOW_FOCUS_OUT, EcoreEventWindowFocusOut, this ) );
326 // Register Window damage events
327 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_X_EVENT_WINDOW_DAMAGE, EcoreEventWindowDamaged, this ) );
329 // Register Touch events
330 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_EVENT_MOUSE_BUTTON_DOWN, EcoreEventMouseButtonDown, this ) );
331 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_EVENT_MOUSE_BUTTON_UP, EcoreEventMouseButtonUp, this ) );
332 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_EVENT_MOUSE_MOVE, EcoreEventMouseButtonMove, this ) );
333 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_EVENT_MOUSE_OUT, EcoreEventMouseButtonUp, this ) ); // process mouse out event like up event
335 // Register Mouse wheel events
336 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_EVENT_MOUSE_WHEEL, EcoreEventMouseWheel, this ) );
338 // Register Key events
339 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_EVENT_KEY_DOWN, EcoreEventKeyDown, this ) );
340 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_EVENT_KEY_UP, EcoreEventKeyUp, this ) );
342 // Register Selection event
343 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_X_EVENT_SELECTION_CLEAR, EcoreEventSelectionClear, this ) );
344 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_X_EVENT_SELECTION_NOTIFY, EcoreEventSelectionNotify, this ) );
347 Eina_Bool WindowBaseEcoreX::OnWindowPropertyChanged( void* data, int type, void* event )
349 Ecore_X_Event_Window_Property* propertyChangedEvent = static_cast< Ecore_X_Event_Window_Property* >( event );
350 Eina_Bool handled( ECORE_CALLBACK_PASS_ON );
352 if( propertyChangedEvent->win == mEcoreWindow )
354 Ecore_X_Window_State_Hint state( ecore_x_icccm_state_get( propertyChangedEvent->win ) );
358 case ECORE_X_WINDOW_STATE_HINT_WITHDRAWN:
360 // Window was hidden.
361 mIconifyChangedSignal.Emit( true );
362 handled = ECORE_CALLBACK_DONE;
365 case ECORE_X_WINDOW_STATE_HINT_ICONIC:
367 // Window was iconified (minimised).
368 mIconifyChangedSignal.Emit( true );
369 handled = ECORE_CALLBACK_DONE;
372 case ECORE_X_WINDOW_STATE_HINT_NORMAL:
375 mIconifyChangedSignal.Emit( false );
376 handled = ECORE_CALLBACK_DONE;
390 void WindowBaseEcoreX::OnDeleteRequest()
392 mDeleteRequestSignal.Emit();
395 void WindowBaseEcoreX::OnFocusIn( void* data, int type, void* event )
397 Ecore_X_Event_Window_Focus_In* focusInEvent = static_cast< Ecore_X_Event_Window_Focus_In* >( event );
399 if( focusInEvent->win == mEcoreWindow )
401 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "Window EcoreEventWindowFocusIn\n" );
403 mFocusChangedSignal.Emit( true );
407 void WindowBaseEcoreX::OnFocusOut( void* data, int type, void* event )
409 Ecore_X_Event_Window_Focus_Out* focusOutEvent = static_cast< Ecore_X_Event_Window_Focus_Out* >( event );
411 // If the window loses focus then hide the keyboard.
412 if( focusOutEvent->win == mEcoreWindow )
414 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "Window EcoreEventWindowFocusOut\n" );
416 mFocusChangedSignal.Emit( false );
420 void WindowBaseEcoreX::OnWindowDamaged( void* data, int type, void* event )
422 Ecore_X_Event_Window_Damage* windowDamagedEvent = static_cast< Ecore_X_Event_Window_Damage* >( event );
424 if( windowDamagedEvent->win == mEcoreWindow )
427 area.x = windowDamagedEvent->x;
428 area.y = windowDamagedEvent->y;
429 area.width = windowDamagedEvent->w;
430 area.height = windowDamagedEvent->h;
432 mWindowDamagedSignal.Emit( area );
436 void WindowBaseEcoreX::OnMouseButtonDown( void* data, int type, void* event )
438 Ecore_Event_Mouse_Button* touchEvent = static_cast< Ecore_Event_Mouse_Button* >( event );
440 if( touchEvent->window == mEcoreWindow )
442 PointState::Type state ( PointState::DOWN );
444 Integration::Point point;
445 point.SetDeviceId( touchEvent->multi.device );
446 point.SetState( state );
447 point.SetScreenPosition( Vector2( touchEvent->x, touchEvent->y ) );
448 point.SetRadius( touchEvent->multi.radius, Vector2( touchEvent->multi.radius_x, touchEvent->multi.radius_y ) );
449 point.SetPressure( touchEvent->multi.pressure );
450 point.SetAngle( Degree( touchEvent->multi.angle ) );
451 if( touchEvent->buttons)
453 point.SetMouseButton( static_cast< MouseButton::Type >( touchEvent->buttons) );
456 mTouchEventSignal.Emit( point, touchEvent->timestamp );
460 void WindowBaseEcoreX::OnMouseButtonUp( void* data, int type, void* event )
462 Ecore_Event_Mouse_Button* touchEvent = static_cast< Ecore_Event_Mouse_Button* >( event );
464 if( touchEvent->window == mEcoreWindow )
466 Integration::Point point;
467 point.SetDeviceId( touchEvent->multi.device );
468 point.SetState( PointState::UP );
469 point.SetScreenPosition( Vector2( touchEvent->x, touchEvent->y ) );
470 point.SetRadius( touchEvent->multi.radius, Vector2( touchEvent->multi.radius_x, touchEvent->multi.radius_y ) );
471 point.SetPressure( touchEvent->multi.pressure );
472 point.SetAngle( Degree( static_cast<float>( touchEvent->multi.angle ) ) );
473 if( touchEvent->buttons)
475 point.SetMouseButton( static_cast< MouseButton::Type >( touchEvent->buttons) );
478 mTouchEventSignal.Emit( point, touchEvent->timestamp );
482 void WindowBaseEcoreX::OnMouseButtonMove( void* data, int type, void* event )
484 Ecore_Event_Mouse_Move* touchEvent = static_cast< Ecore_Event_Mouse_Move* >( event );
486 if( touchEvent->window == mEcoreWindow )
488 Integration::Point point;
489 point.SetDeviceId( touchEvent->multi.device );
490 point.SetState( PointState::MOTION );
491 point.SetScreenPosition( Vector2( static_cast<float>( touchEvent->x ), static_cast<float>( touchEvent->y ) ) );
492 point.SetRadius( static_cast<float>( touchEvent->multi.radius ), Vector2( static_cast<float>( touchEvent->multi.radius_x ), static_cast<float>( touchEvent->multi.radius_y ) ) );
493 point.SetPressure( static_cast<float>( touchEvent->multi.pressure ) );
494 point.SetAngle( Degree( static_cast<float>( touchEvent->multi.angle ) ) );
496 mTouchEventSignal.Emit( point, touchEvent->timestamp );
500 void WindowBaseEcoreX::OnMouseWheel( void* data, int type, void* event )
502 Ecore_Event_Mouse_Wheel* mouseWheelEvent = static_cast< Ecore_Event_Mouse_Wheel* >( event );
504 if( mouseWheelEvent->window == mEcoreWindow )
506 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 );
508 WheelEvent wheelEvent( WheelEvent::MOUSE_WHEEL, mouseWheelEvent->direction, mouseWheelEvent->modifiers, Vector2( static_cast<float>( mouseWheelEvent->x ), static_cast<float>( mouseWheelEvent->y ) ), mouseWheelEvent->z, mouseWheelEvent->timestamp );
510 mWheelEventSignal.Emit( wheelEvent );
514 void WindowBaseEcoreX::OnKeyDown( void* data, int type, void* event )
516 Ecore_Event_Key* keyEvent = static_cast< Ecore_Event_Key* >( event );
518 if( keyEvent->window == mEcoreWindow )
520 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreX::OnKeyDown\n" );
522 std::string keyName( keyEvent->keyname );
523 std::string logicalKey( "" );
524 std::string keyString( "" );
525 std::string compose( "" );
527 // Ensure key compose string is not NULL as keys like SHIFT or arrow have a null string.
528 if( keyEvent->compose )
530 compose = keyEvent->compose;
533 // Ensure key symbol is not NULL as keys like SHIFT have a null string.
536 logicalKey = keyEvent->key;
539 int keyCode = ecore_x_keysym_keycode_get( keyEvent->keyname );
540 int modifier( keyEvent->modifiers );
541 unsigned long time = keyEvent->timestamp;
543 // Ensure key event string is not NULL as keys like SHIFT have a null string.
544 if( keyEvent->string )
546 keyString = keyEvent->string;
549 Integration::KeyEvent keyEvent( keyName, logicalKey, keyString, keyCode, modifier, time, Integration::KeyEvent::Down, compose, DEFAULT_DEVICE_NAME, DEFAULT_DEVICE_CLASS, DEFAULT_DEVICE_SUBCLASS );
551 mKeyEventSignal.Emit( keyEvent );
555 void WindowBaseEcoreX::OnKeyUp( void* data, int type, void* event )
557 Ecore_Event_Key* keyEvent = static_cast< Ecore_Event_Key* >( event );
559 if ( keyEvent->window == mEcoreWindow )
561 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, " WindowBaseEcoreX::OnKeyUp\n" );
563 std::string keyName( keyEvent->keyname );
564 std::string logicalKey( "" );
565 std::string keyString( "" );
566 std::string compose( "" );
568 // Ensure key compose string is not NULL as keys like SHIFT or arrow have a null string.
569 if( keyEvent->compose )
571 compose = keyEvent->compose;
573 // Ensure key symbol is not NULL as keys like SHIFT have a null string.
576 logicalKey = keyEvent->key;
579 int keyCode = ecore_x_keysym_keycode_get( keyEvent->keyname );
580 int modifier( keyEvent->modifiers );
581 unsigned long time( keyEvent->timestamp );
583 // Ensure key event string is not NULL as keys like SHIFT have a null string.
584 if( keyEvent->string )
586 keyString = keyEvent->string;
589 Integration::KeyEvent keyEvent( keyName, logicalKey, keyString, keyCode, modifier, time, Integration::KeyEvent::Up, compose, DEFAULT_DEVICE_NAME, DEFAULT_DEVICE_CLASS, DEFAULT_DEVICE_SUBCLASS );
591 mKeyEventSignal.Emit( keyEvent );
595 void WindowBaseEcoreX::OnSelectionClear( void* data, int type, void* event )
597 Ecore_X_Event_Selection_Clear* selectionClearEvent = static_cast< Ecore_X_Event_Selection_Clear* >( event );
599 if( selectionClearEvent->win == mEcoreWindow )
601 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Concise, " WindowBaseEcoreX::OnSelectionClear\n" );
603 if( selectionClearEvent->selection == ECORE_X_SELECTION_SECONDARY )
605 // Request to get the content from Ecore.
606 ecore_x_selection_secondary_request( selectionClearEvent->win, ECORE_X_SELECTION_TARGET_TEXT );
611 void WindowBaseEcoreX::OnSelectionNotify( void* data, int type, void* event )
613 Ecore_X_Event_Selection_Notify* selectionNotifyEvent = static_cast< Ecore_X_Event_Selection_Notify* >( event );
615 if( selectionNotifyEvent->win == mEcoreWindow )
617 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Concise, " WindowBaseEcoreX::OnSelectionNotify\n" );
619 Ecore_X_Selection_Data* selectionData = static_cast< Ecore_X_Selection_Data* >( selectionNotifyEvent->data );
620 if( selectionData->data )
622 if( selectionNotifyEvent->selection == ECORE_X_SELECTION_SECONDARY )
624 mSelectionDataReceivedSignal.Emit( event );
630 Any WindowBaseEcoreX::GetNativeWindow()
635 int WindowBaseEcoreX::GetNativeWindowId()
640 EGLNativeWindowType WindowBaseEcoreX::CreateEglWindow( int width, int height )
642 // need to create X handle as in 64bit system ECore handle is 32 bit whereas EGLnative and XWindow are 64 bit
643 XWindow window( mEcoreWindow );
644 return reinterpret_cast< EGLNativeWindowType >( window );
647 void WindowBaseEcoreX::DestroyEglWindow()
651 void WindowBaseEcoreX::SetEglWindowRotation( int angle )
655 void WindowBaseEcoreX::SetEglWindowBufferTransform( int angle )
659 void WindowBaseEcoreX::SetEglWindowTransform( int angle )
663 void WindowBaseEcoreX::ResizeEglWindow( PositionSize positionSize )
667 bool WindowBaseEcoreX::IsEglWindowRotationSupported()
672 void WindowBaseEcoreX::Move( PositionSize positionSize )
674 ecore_x_window_move( mEcoreWindow, positionSize.x, positionSize.y );
677 void WindowBaseEcoreX::Resize( PositionSize positionSize )
679 ecore_x_window_resize( mEcoreWindow, positionSize.width, positionSize.height );
682 void WindowBaseEcoreX::MoveResize( PositionSize positionSize )
684 ecore_x_window_move_resize( mEcoreWindow, positionSize.x, positionSize.y, positionSize.width, positionSize.height );
687 void WindowBaseEcoreX::SetClass( const std::string& name, const std::string& className )
689 ecore_x_icccm_title_set( mEcoreWindow, name.c_str() );
690 ecore_x_netwm_name_set( mEcoreWindow, name.c_str() );
691 ecore_x_icccm_name_class_set( mEcoreWindow, name.c_str(), className.c_str() );
694 void WindowBaseEcoreX::Raise()
696 ecore_x_window_raise( mEcoreWindow );
699 void WindowBaseEcoreX::Lower()
701 ecore_x_window_lower( mEcoreWindow );
704 void WindowBaseEcoreX::Activate()
706 ecore_x_netwm_client_active_request( ecore_x_window_root_get( mEcoreWindow ), mEcoreWindow, 1 /* request type, 1:application, 2:pager */, 0 );
709 void WindowBaseEcoreX::SetAvailableAnlges( const std::vector< int >& angles )
713 void WindowBaseEcoreX::SetPreferredAngle( int angle )
717 void WindowBaseEcoreX::SetAcceptFocus( bool accept )
721 void WindowBaseEcoreX::Show()
723 ecore_x_window_show( mEcoreWindow );
726 void WindowBaseEcoreX::Hide()
728 ecore_x_window_hide( mEcoreWindow );
731 unsigned int WindowBaseEcoreX::GetSupportedAuxiliaryHintCount() const
736 std::string WindowBaseEcoreX::GetSupportedAuxiliaryHint( unsigned int index ) const
738 return std::string();
741 unsigned int WindowBaseEcoreX::AddAuxiliaryHint( const std::string& hint, const std::string& value )
746 bool WindowBaseEcoreX::RemoveAuxiliaryHint( unsigned int id )
751 bool WindowBaseEcoreX::SetAuxiliaryHintValue( unsigned int id, const std::string& value )
756 std::string WindowBaseEcoreX::GetAuxiliaryHintValue( unsigned int id ) const
758 return std::string();
761 unsigned int WindowBaseEcoreX::GetAuxiliaryHintId( const std::string& hint ) const
766 void WindowBaseEcoreX::SetInputRegion( const Rect< int >& inputRegion )
770 void WindowBaseEcoreX::SetType( Dali::Window::Type type )
774 bool WindowBaseEcoreX::SetNotificationLevel( Dali::Window::NotificationLevel::Type level )
779 Dali::Window::NotificationLevel::Type WindowBaseEcoreX::GetNotificationLevel() const
781 return Dali::Window::NotificationLevel::NONE;
784 void WindowBaseEcoreX::SetOpaqueState( bool opaque )
788 bool WindowBaseEcoreX::SetScreenOffMode(Dali::Window::ScreenOffMode::Type screenOffMode)
793 Dali::Window::ScreenOffMode::Type WindowBaseEcoreX::GetScreenOffMode() const
795 return Dali::Window::ScreenOffMode::TIMEOUT;
798 bool WindowBaseEcoreX::SetBrightness( int brightness )
803 int WindowBaseEcoreX::GetBrightness() const
808 bool WindowBaseEcoreX::GrabKey( Dali::KEY key, KeyGrab::KeyGrabMode grabMode )
813 bool WindowBaseEcoreX::UngrabKey( Dali::KEY key )
818 bool WindowBaseEcoreX::GrabKeyList( const Dali::Vector< Dali::KEY >& key, const Dali::Vector< KeyGrab::KeyGrabMode >& grabMode, Dali::Vector< bool >& result )
823 bool WindowBaseEcoreX::UngrabKeyList( const Dali::Vector< Dali::KEY >& key, Dali::Vector< bool >& result )
828 void WindowBaseEcoreX::GetDpi( unsigned int& dpiHorizontal, unsigned int& dpiVertical )
830 // 1 inch = 25.4 millimeters
831 // ecore does not account for differing DPI in the x and y axes, so only get for x is available
833 dpiHorizontal = ecore_x_dpi_get();
834 dpiVertical = ecore_x_dpi_get();
837 int WindowBaseEcoreX::GetOrientation() const
842 int WindowBaseEcoreX::GetScreenRotationAngle()
847 void WindowBaseEcoreX::SetWindowRotationAngle( int degree )
851 int WindowBaseEcoreX::GetWindowRotationAngle()
856 void WindowBaseEcoreX::WindowRotationCompleted( int degree, int width, int height )
860 void WindowBaseEcoreX::SetTransparency( bool transparent )
864 unsigned int WindowBaseEcoreX::GetSurfaceId( Any surface ) const
866 unsigned int surfaceId = 0;
868 if ( surface.Empty() == false )
870 // check we have a valid type
871 DALI_ASSERT_ALWAYS( ( (surface.GetType() == typeid (XWindow) ) || (surface.GetType() == typeid (Ecore_X_Window) ) )
872 && "Surface type is invalid" );
874 if ( surface.GetType() == typeid (Ecore_X_Window) )
876 surfaceId = AnyCast< Ecore_X_Window >( surface );
880 surfaceId = static_cast<unsigned int>( AnyCast< XWindow >( surface ) );
886 void WindowBaseEcoreX::CreateWindow( PositionSize positionSize, bool isTransparent )
890 // create 32 bit window
891 mEcoreWindow = ecore_x_window_argb_new( 0, positionSize.x, positionSize.y, positionSize.width, positionSize.height );
892 mIsTransparent = true;
896 // create 24 bit window
897 mEcoreWindow = ecore_x_window_new( 0, positionSize.x, positionSize.y, positionSize.width, positionSize.height );
900 if ( mEcoreWindow == 0 )
902 DALI_ASSERT_ALWAYS( 0 && "Failed to create X window" );
906 void WindowBaseEcoreX::SetParent( WindowBase* parentWinBase )
908 Ecore_X_Window ecoreParent = 0;
911 WindowBaseEcoreX* winBaseEcoreX = static_cast<WindowBaseEcoreX*>( parentWinBase );
912 ecoreParent = winBaseEcoreX->mEcoreWindow;
913 ecore_x_icccm_transient_for_set( mEcoreWindow, ecoreParent );
918 ecore_x_icccm_transient_for_unset( mEcoreWindow );
922 } // namespace Adaptor
924 } // namespace Internal