2 * Copyright (c) 2020 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(),
250 mIsTransparent(false), // Should only be set to true once we actually create a transparent window regardless of what isTransparent is.
251 mRotationAppSet(false),
252 mWindowRotationAngle(0)
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 );
269 WindowSystem::Shutdown();
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 WindowSystem::Initialize();
283 // we own the surface about to created
285 CreateWindow( positionSize, isTransparent );
289 // XLib should already be initialized so no point in calling XInitThreads
290 mEcoreWindow = static_cast< Ecore_X_Window >( surfaceId );
293 // set up etc properties to match with ecore-evas
295 if( ( id = getenv("DESKTOP_STARTUP_ID") ) )
297 ecore_x_netwm_startup_id_set( mEcoreWindow, id );
300 ecore_x_icccm_hints_set( mEcoreWindow,
302 ECORE_X_WINDOW_STATE_HINT_NORMAL, // initial_state
309 // we SHOULD guarantee the x11 window was created in x server.
312 ecore_x_input_multi_select( mEcoreWindow );
314 // This ensures that we catch the window close (or delete) request
315 ecore_x_icccm_protocol_set( mEcoreWindow, ECORE_X_WM_PROTOCOL_DELETE_REQUEST, EINA_TRUE );
317 // Enable Drag & Drop
318 ecore_x_dnd_aware_set( mEcoreWindow, EINA_TRUE );
320 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_X_EVENT_WINDOW_PROPERTY, EcoreEventWindowPropertyChanged, this ) );
321 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_X_EVENT_WINDOW_DELETE_REQUEST, EcoreEventWindowDeleteRequest, this ) );
323 // Register window focus events
324 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_X_EVENT_WINDOW_FOCUS_IN, EcoreEventWindowFocusIn, this ) );
325 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_X_EVENT_WINDOW_FOCUS_OUT, EcoreEventWindowFocusOut, this ) );
327 // Register Window damage events
328 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_X_EVENT_WINDOW_DAMAGE, EcoreEventWindowDamaged, this ) );
330 // Register Touch events
331 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_EVENT_MOUSE_BUTTON_DOWN, EcoreEventMouseButtonDown, this ) );
332 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_EVENT_MOUSE_BUTTON_UP, EcoreEventMouseButtonUp, this ) );
333 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_EVENT_MOUSE_MOVE, EcoreEventMouseButtonMove, this ) );
334 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_EVENT_MOUSE_OUT, EcoreEventMouseButtonUp, this ) ); // process mouse out event like up event
336 // Register Mouse wheel events
337 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_EVENT_MOUSE_WHEEL, EcoreEventMouseWheel, this ) );
339 // Register Key events
340 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_EVENT_KEY_DOWN, EcoreEventKeyDown, this ) );
341 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_EVENT_KEY_UP, EcoreEventKeyUp, this ) );
343 // Register Selection event
344 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_X_EVENT_SELECTION_CLEAR, EcoreEventSelectionClear, this ) );
345 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_X_EVENT_SELECTION_NOTIFY, EcoreEventSelectionNotify, this ) );
348 Eina_Bool WindowBaseEcoreX::OnWindowPropertyChanged( void* data, int type, void* event )
350 Ecore_X_Event_Window_Property* propertyChangedEvent = static_cast< Ecore_X_Event_Window_Property* >( event );
351 Eina_Bool handled( ECORE_CALLBACK_PASS_ON );
353 if( propertyChangedEvent->win == mEcoreWindow )
355 Ecore_X_Window_State_Hint state( ecore_x_icccm_state_get( propertyChangedEvent->win ) );
359 case ECORE_X_WINDOW_STATE_HINT_WITHDRAWN:
361 // Window was hidden.
362 mIconifyChangedSignal.Emit( true );
363 handled = ECORE_CALLBACK_DONE;
366 case ECORE_X_WINDOW_STATE_HINT_ICONIC:
368 // Window was iconified (minimised).
369 mIconifyChangedSignal.Emit( true );
370 handled = ECORE_CALLBACK_DONE;
373 case ECORE_X_WINDOW_STATE_HINT_NORMAL:
376 mIconifyChangedSignal.Emit( false );
377 handled = ECORE_CALLBACK_DONE;
391 void WindowBaseEcoreX::OnDeleteRequest()
393 mDeleteRequestSignal.Emit();
396 void WindowBaseEcoreX::OnFocusIn( void* data, int type, void* event )
398 Ecore_X_Event_Window_Focus_In* focusInEvent = static_cast< Ecore_X_Event_Window_Focus_In* >( event );
400 if( focusInEvent->win == mEcoreWindow )
402 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "Window EcoreEventWindowFocusIn\n" );
404 mFocusChangedSignal.Emit( true );
408 void WindowBaseEcoreX::OnFocusOut( void* data, int type, void* event )
410 Ecore_X_Event_Window_Focus_Out* focusOutEvent = static_cast< Ecore_X_Event_Window_Focus_Out* >( event );
412 // If the window loses focus then hide the keyboard.
413 if( focusOutEvent->win == mEcoreWindow )
415 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "Window EcoreEventWindowFocusOut\n" );
417 mFocusChangedSignal.Emit( false );
421 void WindowBaseEcoreX::OnWindowDamaged( void* data, int type, void* event )
423 Ecore_X_Event_Window_Damage* windowDamagedEvent = static_cast< Ecore_X_Event_Window_Damage* >( event );
425 if( windowDamagedEvent->win == mEcoreWindow )
428 area.x = windowDamagedEvent->x;
429 area.y = windowDamagedEvent->y;
430 area.width = windowDamagedEvent->w;
431 area.height = windowDamagedEvent->h;
433 mWindowDamagedSignal.Emit( area );
437 void WindowBaseEcoreX::OnMouseButtonDown( void* data, int type, void* event )
439 Ecore_Event_Mouse_Button* touchEvent = static_cast< Ecore_Event_Mouse_Button* >( event );
441 if( touchEvent->window == mEcoreWindow )
443 PointState::Type state ( PointState::DOWN );
445 Integration::Point point;
446 point.SetDeviceId( touchEvent->multi.device );
447 point.SetState( state );
448 point.SetScreenPosition( Vector2( touchEvent->x, touchEvent->y ) );
449 point.SetRadius( touchEvent->multi.radius, Vector2( touchEvent->multi.radius_x, touchEvent->multi.radius_y ) );
450 point.SetPressure( touchEvent->multi.pressure );
451 point.SetAngle( Degree( touchEvent->multi.angle ) );
452 if( touchEvent->buttons)
454 point.SetMouseButton( static_cast< MouseButton::Type >( touchEvent->buttons) );
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( static_cast<float>( touchEvent->multi.angle ) ) );
474 if( touchEvent->buttons)
476 point.SetMouseButton( static_cast< MouseButton::Type >( touchEvent->buttons) );
479 mTouchEventSignal.Emit( point, touchEvent->timestamp );
483 void WindowBaseEcoreX::OnMouseButtonMove( void* data, int type, void* event )
485 Ecore_Event_Mouse_Move* touchEvent = static_cast< Ecore_Event_Mouse_Move* >( event );
487 if( touchEvent->window == mEcoreWindow )
489 Integration::Point point;
490 point.SetDeviceId( touchEvent->multi.device );
491 point.SetState( PointState::MOTION );
492 point.SetScreenPosition( Vector2( static_cast<float>( touchEvent->x ), static_cast<float>( touchEvent->y ) ) );
493 point.SetRadius( static_cast<float>( touchEvent->multi.radius ), Vector2( static_cast<float>( touchEvent->multi.radius_x ), static_cast<float>( touchEvent->multi.radius_y ) ) );
494 point.SetPressure( static_cast<float>( touchEvent->multi.pressure ) );
495 point.SetAngle( Degree( static_cast<float>( touchEvent->multi.angle ) ) );
497 mTouchEventSignal.Emit( point, touchEvent->timestamp );
501 void WindowBaseEcoreX::OnMouseWheel( void* data, int type, void* event )
503 Ecore_Event_Mouse_Wheel* mouseWheelEvent = static_cast< Ecore_Event_Mouse_Wheel* >( event );
505 if( mouseWheelEvent->window == mEcoreWindow )
507 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 );
509 Integration::WheelEvent wheelEvent( Integration::WheelEvent::MOUSE_WHEEL, mouseWheelEvent->direction, mouseWheelEvent->modifiers, Vector2( static_cast<float>( mouseWheelEvent->x ), static_cast<float>( mouseWheelEvent->y ) ), mouseWheelEvent->z, mouseWheelEvent->timestamp );
511 mWheelEventSignal.Emit( wheelEvent );
515 void WindowBaseEcoreX::OnKeyDown( void* data, int type, void* event )
517 Ecore_Event_Key* keyEvent = static_cast< Ecore_Event_Key* >( event );
519 if( keyEvent->window == mEcoreWindow )
521 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreX::OnKeyDown\n" );
523 std::string keyName( keyEvent->keyname );
524 std::string logicalKey( "" );
525 std::string keyString( "" );
526 std::string compose( "" );
528 // Ensure key compose string is not NULL as keys like SHIFT or arrow have a null string.
529 if( keyEvent->compose )
531 compose = keyEvent->compose;
534 // Ensure key symbol is not NULL as keys like SHIFT have a null string.
537 logicalKey = keyEvent->key;
540 int keyCode = ecore_x_keysym_keycode_get( keyEvent->keyname );
541 int modifier( keyEvent->modifiers );
542 unsigned long time = keyEvent->timestamp;
544 // Ensure key event string is not NULL as keys like SHIFT have a null string.
545 if( keyEvent->string )
547 keyString = keyEvent->string;
550 Integration::KeyEvent keyEvent( keyName, logicalKey, keyString, keyCode, modifier, time, Integration::KeyEvent::DOWN, compose, DEFAULT_DEVICE_NAME, DEFAULT_DEVICE_CLASS, DEFAULT_DEVICE_SUBCLASS );
552 mKeyEventSignal.Emit( keyEvent );
556 void WindowBaseEcoreX::OnKeyUp( void* data, int type, void* event )
558 Ecore_Event_Key* keyEvent = static_cast< Ecore_Event_Key* >( event );
560 if ( keyEvent->window == mEcoreWindow )
562 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, " WindowBaseEcoreX::OnKeyUp\n" );
564 std::string keyName( keyEvent->keyname );
565 std::string logicalKey( "" );
566 std::string keyString( "" );
567 std::string compose( "" );
569 // Ensure key compose string is not NULL as keys like SHIFT or arrow have a null string.
570 if( keyEvent->compose )
572 compose = keyEvent->compose;
574 // Ensure key symbol is not NULL as keys like SHIFT have a null string.
577 logicalKey = keyEvent->key;
580 int keyCode = ecore_x_keysym_keycode_get( keyEvent->keyname );
581 int modifier( keyEvent->modifiers );
582 unsigned long time( keyEvent->timestamp );
584 // Ensure key event string is not NULL as keys like SHIFT have a null string.
585 if( keyEvent->string )
587 keyString = keyEvent->string;
590 Integration::KeyEvent keyEvent( keyName, logicalKey, keyString, keyCode, modifier, time, Integration::KeyEvent::UP, compose, DEFAULT_DEVICE_NAME, DEFAULT_DEVICE_CLASS, DEFAULT_DEVICE_SUBCLASS );
592 mKeyEventSignal.Emit( keyEvent );
596 void WindowBaseEcoreX::OnSelectionClear( void* data, int type, void* event )
598 Ecore_X_Event_Selection_Clear* selectionClearEvent = static_cast< Ecore_X_Event_Selection_Clear* >( event );
600 if( selectionClearEvent->win == mEcoreWindow )
602 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Concise, " WindowBaseEcoreX::OnSelectionClear\n" );
604 if( selectionClearEvent->selection == ECORE_X_SELECTION_SECONDARY )
606 // Request to get the content from Ecore.
607 ecore_x_selection_secondary_request( selectionClearEvent->win, ECORE_X_SELECTION_TARGET_TEXT );
612 void WindowBaseEcoreX::OnSelectionNotify( void* data, int type, void* event )
614 Ecore_X_Event_Selection_Notify* selectionNotifyEvent = static_cast< Ecore_X_Event_Selection_Notify* >( event );
616 if( selectionNotifyEvent->win == mEcoreWindow )
618 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Concise, " WindowBaseEcoreX::OnSelectionNotify\n" );
620 Ecore_X_Selection_Data* selectionData = static_cast< Ecore_X_Selection_Data* >( selectionNotifyEvent->data );
621 if( selectionData->data )
623 if( selectionNotifyEvent->selection == ECORE_X_SELECTION_SECONDARY )
625 mSelectionDataReceivedSignal.Emit( event );
631 Any WindowBaseEcoreX::GetNativeWindow()
636 int WindowBaseEcoreX::GetNativeWindowId()
641 EGLNativeWindowType WindowBaseEcoreX::CreateEglWindow( int width, int height )
643 // need to create X handle as in 64bit system ECore handle is 32 bit whereas EGLnative and XWindow are 64 bit
644 XWindow window( mEcoreWindow );
645 return reinterpret_cast< EGLNativeWindowType >( window );
648 void WindowBaseEcoreX::DestroyEglWindow()
652 void WindowBaseEcoreX::SetEglWindowRotation( int angle )
656 void WindowBaseEcoreX::SetEglWindowBufferTransform( int angle )
660 void WindowBaseEcoreX::SetEglWindowTransform( int angle )
664 void WindowBaseEcoreX::ResizeEglWindow( PositionSize positionSize )
668 bool WindowBaseEcoreX::IsEglWindowRotationSupported()
673 void WindowBaseEcoreX::Move( PositionSize positionSize )
675 ecore_x_window_move( mEcoreWindow, positionSize.x, positionSize.y );
678 void WindowBaseEcoreX::Resize( PositionSize positionSize )
680 ecore_x_window_resize( mEcoreWindow, positionSize.width, positionSize.height );
683 void WindowBaseEcoreX::MoveResize( PositionSize positionSize )
685 ecore_x_window_move_resize( mEcoreWindow, positionSize.x, positionSize.y, positionSize.width, positionSize.height );
688 void WindowBaseEcoreX::SetClass( const std::string& name, const std::string& className )
690 ecore_x_icccm_title_set( mEcoreWindow, name.c_str() );
691 ecore_x_netwm_name_set( mEcoreWindow, name.c_str() );
692 ecore_x_icccm_name_class_set( mEcoreWindow, name.c_str(), className.c_str() );
695 void WindowBaseEcoreX::Raise()
697 ecore_x_window_raise( mEcoreWindow );
700 void WindowBaseEcoreX::Lower()
702 ecore_x_window_lower( mEcoreWindow );
705 void WindowBaseEcoreX::Activate()
707 ecore_x_netwm_client_active_request( ecore_x_window_root_get( mEcoreWindow ), mEcoreWindow, 1 /* request type, 1:application, 2:pager */, 0 );
710 void WindowBaseEcoreX::SetAvailableAnlges( const std::vector< int >& angles )
714 void WindowBaseEcoreX::SetPreferredAngle( int angle )
718 void WindowBaseEcoreX::SetAcceptFocus( bool accept )
722 void WindowBaseEcoreX::Show()
724 ecore_x_window_show( mEcoreWindow );
727 void WindowBaseEcoreX::Hide()
729 ecore_x_window_hide( mEcoreWindow );
732 unsigned int WindowBaseEcoreX::GetSupportedAuxiliaryHintCount() const
737 std::string WindowBaseEcoreX::GetSupportedAuxiliaryHint( unsigned int index ) const
739 return std::string();
742 unsigned int WindowBaseEcoreX::AddAuxiliaryHint( const std::string& hint, const std::string& value )
747 bool WindowBaseEcoreX::RemoveAuxiliaryHint( unsigned int id )
752 bool WindowBaseEcoreX::SetAuxiliaryHintValue( unsigned int id, const std::string& value )
757 std::string WindowBaseEcoreX::GetAuxiliaryHintValue( unsigned int id ) const
759 return std::string();
762 unsigned int WindowBaseEcoreX::GetAuxiliaryHintId( const std::string& hint ) const
767 void WindowBaseEcoreX::SetInputRegion( const Rect< int >& inputRegion )
771 void WindowBaseEcoreX::SetType( Dali::WindowType type )
775 bool WindowBaseEcoreX::SetNotificationLevel( Dali::WindowNotificationLevel level )
780 Dali::WindowNotificationLevel WindowBaseEcoreX::GetNotificationLevel() const
782 return Dali::WindowNotificationLevel::NONE;
785 void WindowBaseEcoreX::SetOpaqueState( bool opaque )
789 bool WindowBaseEcoreX::SetScreenOffMode(WindowScreenOffMode screenOffMode)
794 WindowScreenOffMode WindowBaseEcoreX::GetScreenOffMode() const
796 return WindowScreenOffMode::TIMEOUT;
799 bool WindowBaseEcoreX::SetBrightness( int brightness )
804 int WindowBaseEcoreX::GetBrightness() const
809 bool WindowBaseEcoreX::GrabKey( Dali::KEY key, KeyGrab::KeyGrabMode grabMode )
814 bool WindowBaseEcoreX::UngrabKey( Dali::KEY key )
819 bool WindowBaseEcoreX::GrabKeyList( const Dali::Vector< Dali::KEY >& key, const Dali::Vector< KeyGrab::KeyGrabMode >& grabMode, Dali::Vector< bool >& result )
824 bool WindowBaseEcoreX::UngrabKeyList( const Dali::Vector< Dali::KEY >& key, Dali::Vector< bool >& result )
829 void WindowBaseEcoreX::GetDpi( unsigned int& dpiHorizontal, unsigned int& dpiVertical )
831 // 1 inch = 25.4 millimeters
832 // ecore does not account for differing DPI in the x and y axes, so only get for x is available
834 dpiHorizontal = ecore_x_dpi_get();
835 dpiVertical = ecore_x_dpi_get();
838 int WindowBaseEcoreX::GetOrientation() const
843 int WindowBaseEcoreX::GetScreenRotationAngle()
848 void WindowBaseEcoreX::SetWindowRotationAngle( int degree )
850 mWindowRotationAngle = degree;
853 void WindowBaseEcoreX::WindowRotationCompleted( int degree, int width, int height )
857 void WindowBaseEcoreX::SetTransparency( bool transparent )
861 unsigned int WindowBaseEcoreX::GetSurfaceId( Any surface ) const
863 unsigned int surfaceId = 0;
865 if ( surface.Empty() == false )
867 // check we have a valid type
868 DALI_ASSERT_ALWAYS( ( (surface.GetType() == typeid (XWindow) ) || (surface.GetType() == typeid (Ecore_X_Window) ) )
869 && "Surface type is invalid" );
871 if ( surface.GetType() == typeid (Ecore_X_Window) )
873 surfaceId = AnyCast< Ecore_X_Window >( surface );
877 surfaceId = static_cast<unsigned int>( AnyCast< XWindow >( surface ) );
883 void WindowBaseEcoreX::CreateWindow( PositionSize positionSize, bool isTransparent )
887 // create 32 bit window
888 mEcoreWindow = ecore_x_window_argb_new( 0, positionSize.x, positionSize.y, positionSize.width, positionSize.height );
889 mIsTransparent = true;
893 // create 24 bit window
894 mEcoreWindow = ecore_x_window_new( 0, positionSize.x, positionSize.y, positionSize.width, positionSize.height );
897 if ( mEcoreWindow == 0 )
899 DALI_ASSERT_ALWAYS( 0 && "Failed to create X window" );
903 void WindowBaseEcoreX::SetParent( WindowBase* parentWinBase )
905 Ecore_X_Window ecoreParent = 0;
908 WindowBaseEcoreX* winBaseEcoreX = static_cast<WindowBaseEcoreX*>( parentWinBase );
909 ecoreParent = winBaseEcoreX->mEcoreWindow;
910 ecore_x_icccm_transient_for_set( mEcoreWindow, ecoreParent );
915 ecore_x_icccm_transient_for_unset( mEcoreWindow );
919 int WindowBaseEcoreX::CreateFrameRenderedSyncFence()
924 int WindowBaseEcoreX::CreateFramePresentedSyncFence()
929 } // namespace Adaptor
931 } // namespace Internal