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/tizen-wayland/ecore-wl2/window-base-ecore-wl2.h>
26 #include <dali/internal/window-system/common/window-impl.h>
27 #include <dali/internal/window-system/common/window-system.h>
28 #include <dali/internal/window-system/common/window-render-surface.h>
29 #include <dali/internal/input/common/key-impl.h>
32 #include <dali/public-api/object/any.h>
33 #include <dali/public-api/events/mouse-button.h>
34 #include <dali/integration-api/debug.h>
35 #include <Ecore_Input.h>
37 #include <vconf-keys.h>
38 #include <wayland-egl-tizen.h>
52 #if defined(DEBUG_ENABLED)
53 Debug::Filter* gWindowBaseLogFilter = Debug::Filter::New( Debug::NoLogging, false, "LOG_WINDOW_BASE" );
56 const uint32_t MAX_TIZEN_CLIENT_VERSION = 7;
57 const unsigned int PRIMARY_TOUCH_BUTTON_ID = 1;
59 const char* DALI_VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_NAME = "db/setting/accessibility/font_name"; // It will be update at vconf-key.h and replaced.
62 const char* BUS = "org.enlightenment.wm-screen-reader";
63 const char* INTERFACE = "org.tizen.GestureNavigation";
64 const char* PATH = "/org/tizen/GestureNavigation";
67 * Get the device name from the provided ecore key event
69 void GetDeviceName( Ecore_Event_Key* keyEvent, std::string& result )
71 const char* ecoreDeviceName = ecore_device_name_get( keyEvent->dev );
75 result = ecoreDeviceName;
80 * Get the device class from the provided ecore event
82 void GetDeviceClass( Ecore_Device_Class ecoreDeviceClass, Device::Class::Type& deviceClass )
84 switch( ecoreDeviceClass )
86 case ECORE_DEVICE_CLASS_SEAT:
88 deviceClass = Device::Class::USER;
91 case ECORE_DEVICE_CLASS_KEYBOARD:
93 deviceClass = Device::Class::KEYBOARD;
96 case ECORE_DEVICE_CLASS_MOUSE:
98 deviceClass = Device::Class::MOUSE;
101 case ECORE_DEVICE_CLASS_TOUCH:
103 deviceClass = Device::Class::TOUCH;
106 case ECORE_DEVICE_CLASS_PEN:
108 deviceClass = Device::Class::PEN;
111 case ECORE_DEVICE_CLASS_POINTER:
113 deviceClass = Device::Class::POINTER;
116 case ECORE_DEVICE_CLASS_GAMEPAD:
118 deviceClass = Device::Class::GAMEPAD;
123 deviceClass = Device::Class::NONE;
129 void GetDeviceSubclass( Ecore_Device_Subclass ecoreDeviceSubclass, Device::Subclass::Type& deviceSubclass )
131 switch( ecoreDeviceSubclass )
133 case ECORE_DEVICE_SUBCLASS_FINGER:
135 deviceSubclass = Device::Subclass::FINGER;
138 case ECORE_DEVICE_SUBCLASS_FINGERNAIL:
140 deviceSubclass = Device::Subclass::FINGERNAIL;
143 case ECORE_DEVICE_SUBCLASS_KNUCKLE:
145 deviceSubclass = Device::Subclass::KNUCKLE;
148 case ECORE_DEVICE_SUBCLASS_PALM:
150 deviceSubclass = Device::Subclass::PALM;
153 case ECORE_DEVICE_SUBCLASS_HAND_SIZE:
155 deviceSubclass = Device::Subclass::HAND_SIDE;
158 case ECORE_DEVICE_SUBCLASS_HAND_FLAT:
160 deviceSubclass = Device::Subclass::HAND_FLAT;
163 case ECORE_DEVICE_SUBCLASS_PEN_TIP:
165 deviceSubclass = Device::Subclass::PEN_TIP;
168 case ECORE_DEVICE_SUBCLASS_TRACKPAD:
170 deviceSubclass = Device::Subclass::TRACKPAD;
173 case ECORE_DEVICE_SUBCLASS_TRACKPOINT:
175 deviceSubclass = Device::Subclass::TRACKPOINT;
178 case ECORE_DEVICE_SUBCLASS_TRACKBALL:
180 deviceSubclass = Device::Subclass::TRACKBALL;
183 #ifdef OVER_TIZEN_VERSION_4
184 case ECORE_DEVICE_SUBCLASS_REMOCON:
186 deviceSubclass = Device::Subclass::REMOCON;
189 case ECORE_DEVICE_SUBCLASS_VIRTUAL_KEYBOARD:
191 deviceSubclass = Device::Subclass::VIRTUAL_KEYBOARD;
197 deviceSubclass = Device::Subclass::NONE;
203 /////////////////////////////////////////////////////////////////////////////////////////////////
205 /////////////////////////////////////////////////////////////////////////////////////////////////
207 /// Called when the window iconify state is changed.
208 static Eina_Bool EcoreEventWindowIconifyStateChanged( void* data, int type, void* event )
210 WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
213 return windowBase->OnIconifyStateChanged( data, type, event );
216 return ECORE_CALLBACK_PASS_ON;
219 /// Called when the window gains focus
220 static Eina_Bool EcoreEventWindowFocusIn( void* data, int type, void* event )
222 WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
225 return windowBase->OnFocusIn( data, type, event );
228 return ECORE_CALLBACK_PASS_ON;
231 /// Called when the window loses focus
232 static Eina_Bool EcoreEventWindowFocusOut( void* data, int type, void* event )
234 WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
237 return windowBase->OnFocusOut( data, type, event );
240 return ECORE_CALLBACK_PASS_ON;
243 /// Called when the output is transformed
244 static Eina_Bool EcoreEventOutputTransform( void* data, int type, void* event )
246 WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
249 return windowBase->OnOutputTransform( data, type, event );
252 return ECORE_CALLBACK_PASS_ON;
255 /// Called when the output transform should be ignored
256 static Eina_Bool EcoreEventIgnoreOutputTransform( void* data, int type, void* event )
258 WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
261 return windowBase->OnIgnoreOutputTransform( data, type, event );
264 return ECORE_CALLBACK_PASS_ON;
268 * Called when rotate event is recevied.
270 static Eina_Bool EcoreEventRotate( void* data, int type, void* event )
272 WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
275 windowBase->OnRotation( data, type, event );
277 return ECORE_CALLBACK_PASS_ON;
280 /////////////////////////////////////////////////////////////////////////////////////////////////
282 /////////////////////////////////////////////////////////////////////////////////////////////////
285 * Called when a touch down is received.
287 static Eina_Bool EcoreEventMouseButtonDown( void* data, int type, void* event )
289 WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
292 windowBase->OnMouseButtonDown( data, type, event );
294 return ECORE_CALLBACK_PASS_ON;
298 * Called when a touch up is received.
300 static Eina_Bool EcoreEventMouseButtonUp( void* data, int type, void* event )
302 WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
305 windowBase->OnMouseButtonUp( data, type, event );
307 return ECORE_CALLBACK_PASS_ON;
311 * Called when a touch motion is received.
313 static Eina_Bool EcoreEventMouseButtonMove( void* data, int type, void* event )
315 WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
318 windowBase->OnMouseButtonMove( data, type, event );
320 return ECORE_CALLBACK_PASS_ON;
324 * Called when a touch is canceled.
326 static Eina_Bool EcoreEventMouseButtonCancel( void* data, int type, void* event )
328 WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
331 windowBase->OnMouseButtonCancel( data, type, event );
333 return ECORE_CALLBACK_PASS_ON;
337 * Called when a mouse wheel is received.
339 static Eina_Bool EcoreEventMouseWheel( void* data, int type, void* event )
341 WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
344 windowBase->OnMouseWheel( data, type, event );
346 return ECORE_CALLBACK_PASS_ON;
350 * Called when a detent rotation event is recevied.
352 static Eina_Bool EcoreEventDetentRotation( void* data, int type, void* event )
354 WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
357 windowBase->OnDetentRotation( data, type, event );
359 return ECORE_CALLBACK_PASS_ON;
362 /////////////////////////////////////////////////////////////////////////////////////////////////
364 /////////////////////////////////////////////////////////////////////////////////////////////////
367 * Called when a key down is received.
369 static Eina_Bool EcoreEventKeyDown( void* data, int type, void* event )
371 WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
374 windowBase->OnKeyDown( data, type, event );
376 return ECORE_CALLBACK_PASS_ON;
380 * Called when a key up is received.
382 static Eina_Bool EcoreEventKeyUp( void* data, int type, void* event )
384 WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
387 windowBase->OnKeyUp( data, type, event );
389 return ECORE_CALLBACK_PASS_ON;
392 /////////////////////////////////////////////////////////////////////////////////////////////////
393 // Selection Callbacks
394 /////////////////////////////////////////////////////////////////////////////////////////////////
397 * Called when the source window notifies us the content in clipboard is selected.
399 static Eina_Bool EcoreEventDataSend( void* data, int type, void* event )
401 WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
404 windowBase->OnDataSend( data, type, event );
406 return ECORE_CALLBACK_PASS_ON;
410 * Called when the source window sends us about the selected content.
411 * For example, when item is selected in the clipboard.
413 static Eina_Bool EcoreEventDataReceive( void* data, int type, void* event )
415 WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
418 windowBase->OnDataReceive( data, type, event );
420 return ECORE_CALLBACK_PASS_ON;
423 /////////////////////////////////////////////////////////////////////////////////////////////////
424 // Indicator Callbacks
425 /////////////////////////////////////////////////////////////////////////////////////////////////
427 #if defined (DALI_PROFILE_MOBILE)
429 * Called when the Ecore indicator event is received.
431 static Eina_Bool EcoreEventIndicator( void* data, int type, void* event )
433 WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
436 windowBase->OnIndicatorFlicked( data, type, event );
438 return ECORE_CALLBACK_PASS_ON;
440 #endif // DALI_PROFILE_MOBILE
442 /////////////////////////////////////////////////////////////////////////////////////////////////
444 /////////////////////////////////////////////////////////////////////////////////////////////////
447 * Called when a font name is changed.
449 static void VconfNotifyFontNameChanged( keynode_t* node, void* data )
451 WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
454 windowBase->OnFontNameChanged();
459 * Called when a font size is changed.
461 static void VconfNotifyFontSizeChanged( keynode_t* node, void* data )
463 WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
466 windowBase->OnFontSizeChanged();
470 /////////////////////////////////////////////////////////////////////////////////////////////////
471 // ElDBus Accessibility Callbacks
472 /////////////////////////////////////////////////////////////////////////////////////////////////
474 #ifdef DALI_ELDBUS_AVAILABLE
475 // Callback for Ecore ElDBus accessibility events.
476 static void EcoreElDBusAccessibilityNotification( void* context, const Eldbus_Message* message )
478 WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( context );
481 windowBase->OnEcoreElDBusAccessibilityNotification( context, message );
484 #endif // DALI_ELDBUS_AVAILABLE
486 static void RegistryGlobalCallback( void* data, struct wl_registry *registry, uint32_t name, const char* interface, uint32_t version )
488 WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
491 windowBase->RegistryGlobalCallback( data, registry, name, interface, version );
495 static void RegistryGlobalCallbackRemove( void* data, struct wl_registry* registry, uint32_t id )
497 WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
500 windowBase->RegistryGlobalCallbackRemove( data, registry, id );
504 static void TizenPolicyConformant( void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, uint32_t isConformant )
508 static void TizenPolicyConformantArea( void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, uint32_t conformantPart, uint32_t state, int32_t x, int32_t y, int32_t w, int32_t h )
512 static void TizenPolicyNotificationChangeDone(void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, int32_t level, uint32_t state )
514 WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
517 windowBase->TizenPolicyNotificationChangeDone( data, tizenPolicy, surface, level, state );
521 static void TizenPolicyTransientForDone( void* data, struct tizen_policy* tizenPolicy, uint32_t childId )
525 static void TizenPolicyScreenModeChangeDone( void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, uint32_t mode, uint32_t state )
527 WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
530 windowBase->TizenPolicyScreenModeChangeDone( data, tizenPolicy, surface, mode, state );
534 static void TizenPolicyIconifyStateChanged( void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, uint32_t iconified, uint32_t force )
538 static void TizenPolicySupportedAuxiliaryHints( void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, struct wl_array* hints, uint32_t numNints )
542 static void TizenPolicyAllowedAuxiliaryHint( void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, int id )
546 static void TizenPolicyAuxiliaryMessage( void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, const char* key, const char* val, struct wl_array* options )
550 static void TizenPolicyConformantRegion( void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, uint32_t conformantPart, uint32_t state, int32_t x, int32_t y, int32_t w, int32_t h, uint32_t serial )
554 static void DisplayPolicyBrightnessChangeDone( void* data, struct tizen_display_policy *displayPolicy, struct wl_surface* surface, int32_t brightness, uint32_t state )
556 WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
559 windowBase->DisplayPolicyBrightnessChangeDone( data, displayPolicy, surface, brightness, state );
563 const struct wl_registry_listener registryListener =
565 RegistryGlobalCallback,
566 RegistryGlobalCallbackRemove
569 const struct tizen_policy_listener tizenPolicyListener =
571 TizenPolicyConformant,
572 TizenPolicyConformantArea,
573 TizenPolicyNotificationChangeDone,
574 TizenPolicyTransientForDone,
575 TizenPolicyScreenModeChangeDone,
576 TizenPolicyIconifyStateChanged,
577 TizenPolicySupportedAuxiliaryHints,
578 TizenPolicyAllowedAuxiliaryHint,
579 TizenPolicyAuxiliaryMessage,
580 TizenPolicyConformantRegion
583 const struct tizen_display_policy_listener tizenDisplayPolicyListener =
585 DisplayPolicyBrightnessChangeDone
588 } // unnamed namespace
590 WindowBaseEcoreWl2::WindowBaseEcoreWl2( Dali::PositionSize positionSize, Any surface, bool isTransparent )
591 : mEcoreEventHandler(),
592 mEcoreWindow( NULL ),
597 mTizenPolicy( NULL ),
598 mTizenDisplayPolicy( NULL ),
599 mSupportedAuxiliaryHints(),
601 mNotificationLevel( -1 ),
602 mNotificationChangeState( 0 ),
603 mNotificationLevelChangeDone( true ),
605 mScreenOffModeChangeState( 0 ),
606 mScreenOffModeChangeDone( true ),
608 mBrightnessChangeState( 0 ),
609 mBrightnessChangeDone( true ),
610 mOwnSurface( false ),
611 mMoveResizeSerial( 0 ),
612 mLastSubmittedMoveResizeSerial( 0 )
613 #ifdef DALI_ELDBUS_AVAILABLE
614 , mSystemConnection( NULL )
617 Initialize( positionSize, surface, isTransparent );
620 WindowBaseEcoreWl2::~WindowBaseEcoreWl2()
622 #ifdef DALI_ELDBUS_AVAILABLE
623 // Close down ElDBus connections.
624 if( mSystemConnection )
626 eldbus_connection_unref( mSystemConnection );
628 #endif // DALI_ELDBUS_AVAILABLE
630 vconf_ignore_key_changed( VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, VconfNotifyFontSizeChanged );
631 vconf_ignore_key_changed( DALI_VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_NAME, VconfNotifyFontNameChanged );
633 for( Dali::Vector< Ecore_Event_Handler* >::Iterator iter = mEcoreEventHandler.Begin(), endIter = mEcoreEventHandler.End(); iter != endIter; ++iter )
635 ecore_event_handler_del( *iter );
637 mEcoreEventHandler.Clear();
641 wl_event_queue_destroy( mEventQueue );
644 mSupportedAuxiliaryHints.clear();
645 mAuxiliaryHints.clear();
647 if( mEglWindow != NULL )
649 wl_egl_window_destroy( mEglWindow );
655 ecore_wl2_window_free( mEcoreWindow );
657 WindowSystem::Shutdown();
661 void WindowBaseEcoreWl2::Initialize( PositionSize positionSize, Any surface, bool isTransparent )
663 if( surface.Empty() == false )
665 // check we have a valid type
666 DALI_ASSERT_ALWAYS( ( surface.GetType() == typeid (Ecore_Wl2_Window *) ) && "Surface type is invalid" );
668 mEcoreWindow = AnyCast< Ecore_Wl2_Window* >( surface );
672 // we own the surface about to created
673 WindowSystem::Initialize();
676 CreateWindow( positionSize );
679 mWlSurface = ecore_wl2_window_surface_get( mEcoreWindow );
681 SetTransparency( isTransparent );
683 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_WL2_EVENT_WINDOW_ICONIFY_STATE_CHANGE, EcoreEventWindowIconifyStateChanged, this ) );
684 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_WL2_EVENT_FOCUS_IN, EcoreEventWindowFocusIn, this ) );
685 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_WL2_EVENT_FOCUS_OUT, EcoreEventWindowFocusOut, this ) );
686 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_WL2_EVENT_OUTPUT_TRANSFORM, EcoreEventOutputTransform, this ) );
687 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_WL2_EVENT_IGNORE_OUTPUT_TRANSFORM, EcoreEventIgnoreOutputTransform, this ) );
689 // Register Rotate event
690 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_WL2_EVENT_WINDOW_ROTATE, EcoreEventRotate, this ) );
692 // Register Touch events
693 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_EVENT_MOUSE_BUTTON_DOWN, EcoreEventMouseButtonDown, this ) );
694 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_EVENT_MOUSE_BUTTON_UP, EcoreEventMouseButtonUp, this ) );
695 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_EVENT_MOUSE_MOVE, EcoreEventMouseButtonMove, this ) );
696 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_EVENT_MOUSE_BUTTON_CANCEL, EcoreEventMouseButtonCancel, this ) );
698 // Register Mouse wheel events
699 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_EVENT_MOUSE_WHEEL, EcoreEventMouseWheel, this ) );
701 // Register Detent event
702 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_EVENT_DETENT_ROTATE, EcoreEventDetentRotation, this ) );
704 // Register Key events
705 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_EVENT_KEY_DOWN, EcoreEventKeyDown, this ) );
706 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_EVENT_KEY_UP, EcoreEventKeyUp, this ) );
708 // Register Selection event - clipboard selection
709 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_WL2_EVENT_DATA_SOURCE_SEND, EcoreEventDataSend, this ) );
710 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_WL2_EVENT_SELECTION_DATA_READY, EcoreEventDataReceive, this ) );
712 #if defined (DALI_PROFILE_MOBILE)
713 // Register indicator event
714 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_WL2_EVENT_INDICATOR_FLICK, EcoreEventIndicator, this ) );
717 // Register Vconf notify - font name and size
718 vconf_notify_key_changed( DALI_VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_NAME, VconfNotifyFontNameChanged, this );
719 vconf_notify_key_changed( VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, VconfNotifyFontSizeChanged, this );
721 InitializeEcoreElDBus();
723 Ecore_Wl2_Display* display = ecore_wl2_connected_display_get( NULL );
724 mDisplay = ecore_wl2_display_get( display );
728 wl_display* displayWrapper = static_cast< wl_display* >( wl_proxy_create_wrapper( mDisplay ) );
731 mEventQueue = wl_display_create_queue( mDisplay );
734 wl_proxy_set_queue( reinterpret_cast< wl_proxy* >( displayWrapper ), mEventQueue );
736 wl_registry* registry = wl_display_get_registry( displayWrapper );
737 wl_registry_add_listener( registry, ®istryListener, this );
740 wl_proxy_wrapper_destroy( displayWrapper );
744 // get auxiliary hint
745 Eina_List* hints = ecore_wl2_window_aux_hints_supported_get( mEcoreWindow );
751 for( l = hints, ( hint = static_cast< char* >( eina_list_data_get(l) ) ); l; l = eina_list_next(l), ( hint = static_cast< char* >( eina_list_data_get(l) ) ) )
753 mSupportedAuxiliaryHints.push_back( hint );
755 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::Initialize: %s\n", hint );
760 Eina_Bool WindowBaseEcoreWl2::OnIconifyStateChanged( void* data, int type, void* event )
762 Ecore_Wl2_Event_Window_Iconify_State_Change* iconifyChangedEvent( static_cast< Ecore_Wl2_Event_Window_Iconify_State_Change* >( event ) );
763 Eina_Bool handled( ECORE_CALLBACK_PASS_ON );
765 if( iconifyChangedEvent->win == static_cast< unsigned int>( ecore_wl2_window_id_get( mEcoreWindow ) ) )
767 if( iconifyChangedEvent->iconified == EINA_TRUE )
769 mIconifyChangedSignal.Emit( true );
773 mIconifyChangedSignal.Emit( false );
775 handled = ECORE_CALLBACK_DONE;
781 Eina_Bool WindowBaseEcoreWl2::OnFocusIn( void* data, int type, void* event )
783 Ecore_Wl2_Event_Focus_In* focusInEvent( static_cast< Ecore_Wl2_Event_Focus_In* >( event ) );
785 if( focusInEvent->window == static_cast< unsigned int >( ecore_wl2_window_id_get( mEcoreWindow ) ) )
787 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "Window EcoreEventWindowFocusIn\n" );
789 mFocusChangedSignal.Emit( true );
792 return ECORE_CALLBACK_PASS_ON;
795 Eina_Bool WindowBaseEcoreWl2::OnFocusOut( void* data, int type, void* event )
797 Ecore_Wl2_Event_Focus_Out* focusOutEvent( static_cast< Ecore_Wl2_Event_Focus_Out* >( event ) );
799 if( focusOutEvent->window == static_cast< unsigned int >( ecore_wl2_window_id_get( mEcoreWindow ) ) )
801 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "Window EcoreEventWindowFocusOut\n" );
803 mFocusChangedSignal.Emit( false );
806 return ECORE_CALLBACK_PASS_ON;
809 Eina_Bool WindowBaseEcoreWl2::OnOutputTransform( void* data, int type, void* event )
811 Ecore_Wl2_Event_Output_Transform* transformEvent( static_cast< Ecore_Wl2_Event_Output_Transform* >( event ) );
813 if( transformEvent->output == ecore_wl2_window_output_find( mEcoreWindow ) )
815 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "Window (%p) EcoreEventOutputTransform\n", mEcoreWindow );
817 mOutputTransformedSignal.Emit();
820 return ECORE_CALLBACK_PASS_ON;
823 Eina_Bool WindowBaseEcoreWl2::OnIgnoreOutputTransform( void* data, int type, void* event )
825 Ecore_Wl2_Event_Ignore_Output_Transform* ignoreTransformEvent( static_cast< Ecore_Wl2_Event_Ignore_Output_Transform* >( event ) );
827 if( ignoreTransformEvent->win == mEcoreWindow )
829 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "Window (%p) EcoreEventIgnoreOutputTransform\n", mEcoreWindow );
831 mOutputTransformedSignal.Emit();
834 return ECORE_CALLBACK_PASS_ON;
837 void WindowBaseEcoreWl2::OnRotation( void* data, int type, void* event )
839 Ecore_Wl2_Event_Window_Rotation* ev( static_cast< Ecore_Wl2_Event_Window_Rotation* >( event ) );
841 if( ev->win == static_cast< unsigned int >( ecore_wl2_window_id_get( mEcoreWindow ) ) )
843 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Concise, "WindowBaseEcoreWl::OnRotation\n" );
845 RotationEvent rotationEvent;
846 rotationEvent.angle = ev->angle;
847 rotationEvent.winResize = 0;
849 if( ev->angle == 0 || ev->angle == 180 )
851 rotationEvent.width = ev->w;
852 rotationEvent.height = ev->h;
856 rotationEvent.width = ev->h;
857 rotationEvent.height = ev->w;
860 mRotationSignal.Emit( rotationEvent );
864 void WindowBaseEcoreWl2::OnMouseButtonDown( void* data, int type, void* event )
866 Ecore_Event_Mouse_Button* touchEvent = static_cast< Ecore_Event_Mouse_Button* >( event );
868 if( touchEvent->window == static_cast< unsigned int >( ecore_wl2_window_id_get( mEcoreWindow ) ) )
870 Device::Class::Type deviceClass;
871 Device::Subclass::Type deviceSubclass;
873 GetDeviceClass( ecore_device_class_get( touchEvent->dev ), deviceClass );
874 GetDeviceSubclass( ecore_device_subclass_get( touchEvent->dev ), deviceSubclass );
876 PointState::Type state ( PointState::DOWN );
878 if( deviceClass != Device::Class::Type::MOUSE )
880 // Check if the buttons field is set and ensure it's the primary touch button.
881 // If this event was triggered by buttons other than the primary button (used for touch), then
882 // just send an interrupted event to Core.
883 if( touchEvent->buttons && (touchEvent->buttons != PRIMARY_TOUCH_BUTTON_ID ) )
885 state = PointState::INTERRUPTED;
889 Integration::Point point;
890 point.SetDeviceId( touchEvent->multi.device );
891 point.SetState( state );
892 point.SetScreenPosition( Vector2( touchEvent->x, touchEvent->y ) );
893 point.SetRadius( touchEvent->multi.radius, Vector2( touchEvent->multi.radius_x, touchEvent->multi.radius_y ) );
894 point.SetPressure( touchEvent->multi.pressure );
895 point.SetAngle( Degree( touchEvent->multi.angle ) );
896 point.SetDeviceClass( deviceClass );
897 point.SetDeviceSubclass( deviceSubclass );
898 point.SetMouseButton( static_cast< MouseButton::Type >( touchEvent->buttons) );
900 mTouchEventSignal.Emit( point, touchEvent->timestamp );
904 void WindowBaseEcoreWl2::OnMouseButtonUp( void* data, int type, void* event )
906 Ecore_Event_Mouse_Button* touchEvent = static_cast< Ecore_Event_Mouse_Button* >( event );
908 if( touchEvent->window == static_cast< unsigned int >( ecore_wl2_window_id_get( mEcoreWindow ) ) )
910 Device::Class::Type deviceClass;
911 Device::Subclass::Type deviceSubclass;
913 GetDeviceClass( ecore_device_class_get( touchEvent->dev ), deviceClass );
914 GetDeviceSubclass( ecore_device_subclass_get( touchEvent->dev ), deviceSubclass );
916 Integration::Point point;
917 point.SetDeviceId( touchEvent->multi.device );
918 point.SetState( PointState::UP );
919 point.SetScreenPosition( Vector2( touchEvent->x, touchEvent->y ) );
920 point.SetRadius( touchEvent->multi.radius, Vector2( touchEvent->multi.radius_x, touchEvent->multi.radius_y ) );
921 point.SetPressure( touchEvent->multi.pressure );
922 point.SetAngle( Degree( touchEvent->multi.angle ) );
923 point.SetDeviceClass( deviceClass );
924 point.SetDeviceSubclass( deviceSubclass );
925 point.SetMouseButton( static_cast< MouseButton::Type >( touchEvent->buttons) );
927 mTouchEventSignal.Emit( point, touchEvent->timestamp );
931 void WindowBaseEcoreWl2::OnMouseButtonMove( void* data, int type, void* event )
933 Ecore_Event_Mouse_Move* touchEvent = static_cast< Ecore_Event_Mouse_Move* >( event );
935 if( touchEvent->window == static_cast< unsigned int >( ecore_wl2_window_id_get( mEcoreWindow ) ) )
937 Device::Class::Type deviceClass;
938 Device::Subclass::Type deviceSubclass;
940 GetDeviceClass( ecore_device_class_get( touchEvent->dev ), deviceClass );
941 GetDeviceSubclass( ecore_device_subclass_get( touchEvent->dev ), deviceSubclass );
943 Integration::Point point;
944 point.SetDeviceId( touchEvent->multi.device );
945 point.SetState( PointState::MOTION );
946 point.SetScreenPosition( Vector2( touchEvent->x, touchEvent->y ) );
947 point.SetRadius( touchEvent->multi.radius, Vector2( touchEvent->multi.radius_x, touchEvent->multi.radius_y ) );
948 point.SetPressure( touchEvent->multi.pressure );
949 point.SetAngle( Degree( touchEvent->multi.angle ) );
950 point.SetDeviceClass( deviceClass );
951 point.SetDeviceSubclass( deviceSubclass );
953 mTouchEventSignal.Emit( point, touchEvent->timestamp );
957 void WindowBaseEcoreWl2::OnMouseButtonCancel( void* data, int type, void* event )
959 Ecore_Event_Mouse_Button* touchEvent = static_cast< Ecore_Event_Mouse_Button* >( event );
961 if( touchEvent->window == static_cast< unsigned int >( ecore_wl2_window_id_get( mEcoreWindow ) ) )
963 Integration::Point point;
964 point.SetDeviceId( touchEvent->multi.device );
965 point.SetState( PointState::INTERRUPTED );
966 point.SetScreenPosition( Vector2( 0.0f, 0.0f ) );
968 mTouchEventSignal.Emit( point, touchEvent->timestamp );
970 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl::OnMouseButtonCancel\n" );
974 void WindowBaseEcoreWl2::OnMouseWheel( void* data, int type, void* event )
976 Ecore_Event_Mouse_Wheel* mouseWheelEvent = static_cast< Ecore_Event_Mouse_Wheel* >( event );
978 if( mouseWheelEvent->window == static_cast< unsigned int >( ecore_wl2_window_id_get( mEcoreWindow ) ) )
980 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl::OnMouseWheel: direction: %d, modifiers: %d, x: %d, y: %d, z: %d\n", mouseWheelEvent->direction, mouseWheelEvent->modifiers, mouseWheelEvent->x, mouseWheelEvent->y, mouseWheelEvent->z );
982 WheelEvent wheelEvent( WheelEvent::MOUSE_WHEEL, mouseWheelEvent->direction, mouseWheelEvent->modifiers, Vector2( mouseWheelEvent->x, mouseWheelEvent->y ), mouseWheelEvent->z, mouseWheelEvent->timestamp );
984 mWheelEventSignal.Emit( wheelEvent );
988 void WindowBaseEcoreWl2::OnDetentRotation( void* data, int type, void* event )
990 Ecore_Event_Detent_Rotate* detentEvent = static_cast< Ecore_Event_Detent_Rotate* >( event );
992 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Concise, "WindowBaseEcoreWl::OnDetentRotation\n" );
994 int direction = ( detentEvent->direction == ECORE_DETENT_DIRECTION_CLOCKWISE ) ? 1 : -1;
995 int timeStamp = detentEvent->timestamp;
997 WheelEvent wheelEvent( WheelEvent::CUSTOM_WHEEL, 0, 0, Vector2( 0.0f, 0.0f ), direction, timeStamp );
999 mWheelEventSignal.Emit( wheelEvent );
1002 void WindowBaseEcoreWl2::OnKeyDown( void* data, int type, void* event )
1004 Ecore_Event_Key* keyEvent = static_cast< Ecore_Event_Key* >( event );
1006 if( keyEvent->window == static_cast< unsigned int >( ecore_wl2_window_id_get( mEcoreWindow ) ) )
1008 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl::OnKeyDown\n" );
1010 std::string keyName( keyEvent->keyname );
1011 std::string keyString( "" );
1012 std::string compose( "" );
1014 // Ensure key compose string is not NULL as keys like SHIFT or arrow have a null string.
1015 if( keyEvent->compose )
1017 compose = keyEvent->compose;
1020 int keyCode = KeyLookup::GetDaliKeyCode( keyEvent->keyname );
1021 keyCode = ( keyCode == -1 ) ? 0 : keyCode;
1022 int modifier( keyEvent->modifiers );
1023 unsigned long time = keyEvent->timestamp;
1024 if( !strncmp( keyEvent->keyname, "Keycode-", 8 ) )
1026 keyCode = atoi( keyEvent->keyname + 8 );
1029 // Ensure key event string is not NULL as keys like SHIFT have a null string.
1030 if( keyEvent->string )
1032 keyString = keyEvent->string;
1035 std::string deviceName;
1036 Device::Class::Type deviceClass;
1037 Device::Subclass::Type deviceSubclass;
1039 GetDeviceName( keyEvent, deviceName );
1040 GetDeviceClass( ecore_device_class_get( keyEvent->dev ), deviceClass );
1041 GetDeviceSubclass( ecore_device_subclass_get( keyEvent->dev ), deviceSubclass );
1043 Integration::KeyEvent keyEvent( keyName, keyString, keyCode, modifier, time, Integration::KeyEvent::Down, compose, deviceName, deviceClass, deviceSubclass );
1045 mKeyEventSignal.Emit( keyEvent );
1049 void WindowBaseEcoreWl2::OnKeyUp( void* data, int type, void* event )
1051 Ecore_Event_Key* keyEvent = static_cast< Ecore_Event_Key* >( event );
1053 if( keyEvent->window == static_cast< unsigned int >( ecore_wl2_window_id_get( mEcoreWindow ) ) )
1055 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl::OnKeyUp\n" );
1057 std::string keyName( keyEvent->keyname );
1058 std::string keyString( "" );
1059 std::string compose( "" );
1061 // Ensure key compose string is not NULL as keys like SHIFT or arrow have a null string.
1062 if( keyEvent->compose )
1064 compose = keyEvent->compose;
1067 int keyCode = KeyLookup::GetDaliKeyCode( keyEvent->keyname );
1068 keyCode = ( keyCode == -1 ) ? 0 : keyCode;
1069 int modifier( keyEvent->modifiers );
1070 unsigned long time = keyEvent->timestamp;
1071 if( !strncmp( keyEvent->keyname, "Keycode-", 8 ) )
1073 keyCode = atoi( keyEvent->keyname + 8 );
1076 // Ensure key event string is not NULL as keys like SHIFT have a null string.
1077 if( keyEvent->string )
1079 keyString = keyEvent->string;
1082 std::string deviceName;
1083 Device::Class::Type deviceClass;
1084 Device::Subclass::Type deviceSubclass;
1086 GetDeviceName( keyEvent, deviceName );
1087 GetDeviceClass( ecore_device_class_get( keyEvent->dev ), deviceClass );
1088 GetDeviceSubclass( ecore_device_subclass_get( keyEvent->dev ), deviceSubclass );
1090 Integration::KeyEvent keyEvent( keyName, keyString, keyCode, modifier, time, Integration::KeyEvent::Up, compose, deviceName, deviceClass, deviceSubclass );
1092 mKeyEventSignal.Emit( keyEvent );
1096 void WindowBaseEcoreWl2::OnDataSend( void* data, int type, void* event )
1098 mSelectionDataSendSignal.Emit( event );
1101 void WindowBaseEcoreWl2::OnDataReceive( void* data, int type, void* event )
1103 mSelectionDataReceivedSignal.Emit( event );
1106 void WindowBaseEcoreWl2::OnIndicatorFlicked( void* data, int type, void* event )
1108 mIndicatorFlickedSignal.Emit();
1111 void WindowBaseEcoreWl2::OnFontNameChanged()
1113 mStyleChangedSignal.Emit( StyleChange::DEFAULT_FONT_CHANGE );
1116 void WindowBaseEcoreWl2::OnFontSizeChanged()
1118 mStyleChangedSignal.Emit( StyleChange::DEFAULT_FONT_SIZE_CHANGE );
1121 void WindowBaseEcoreWl2::OnEcoreElDBusAccessibilityNotification( void* context, const Eldbus_Message* message )
1123 #ifdef DALI_ELDBUS_AVAILABLE
1124 AccessibilityInfo info;
1126 // The string defines the arg-list's respective types.
1127 if( !eldbus_message_arguments_get( message, "iiiiiiu", &info.gestureValue, &info.startX, &info.startY, &info.endX, &info.endY, &info.state, &info.eventTime ) )
1129 DALI_LOG_ERROR( "OnEcoreElDBusAccessibilityNotification: Error getting arguments\n" );
1132 mAccessibilitySignal.Emit( info );
1136 void WindowBaseEcoreWl2::RegistryGlobalCallback( void* data, struct wl_registry *registry, uint32_t name, const char* interface, uint32_t version )
1138 if( strcmp( interface, tizen_policy_interface.name ) == 0 )
1140 uint32_t clientVersion = std::min( version, MAX_TIZEN_CLIENT_VERSION );
1142 mTizenPolicy = static_cast< tizen_policy* >( wl_registry_bind( registry, name, &tizen_policy_interface, clientVersion ) );
1145 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::RegistryGlobalCallback: wl_registry_bind(tizen_policy_interface) is failed.\n" );
1149 tizen_policy_add_listener( mTizenPolicy, &tizenPolicyListener, data );
1151 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::RegistryGlobalCallback: tizen_policy_add_listener is called.\n" );
1153 else if( strcmp( interface, tizen_display_policy_interface.name ) == 0 )
1155 mTizenDisplayPolicy = static_cast< tizen_display_policy* >( wl_registry_bind( registry, name, &tizen_display_policy_interface, version ) );
1156 if( !mTizenDisplayPolicy )
1158 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::RegistryGlobalCallback: wl_registry_bind(tizen_display_policy_interface) is failed.\n" );
1162 tizen_display_policy_add_listener( mTizenDisplayPolicy, &tizenDisplayPolicyListener, data );
1164 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::RegistryGlobalCallback: tizen_display_policy_add_listener is called.\n" );
1168 void WindowBaseEcoreWl2::RegistryGlobalCallbackRemove( void* data, struct wl_registry* registry, uint32_t id )
1170 mTizenPolicy = NULL;
1171 mTizenDisplayPolicy = NULL;
1174 void WindowBaseEcoreWl2::TizenPolicyNotificationChangeDone(void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, int32_t level, uint32_t state )
1176 mNotificationLevel = level;
1177 mNotificationChangeState = state;
1178 mNotificationLevelChangeDone = true;
1180 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::TizenPolicyNotificationChangeDone: level = %d, state = %d\n", level, state );
1183 void WindowBaseEcoreWl2::TizenPolicyScreenModeChangeDone( void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, uint32_t mode, uint32_t state )
1185 mScreenOffMode = mode;
1186 mScreenOffModeChangeState = state;
1187 mScreenOffModeChangeDone = true;
1189 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::TizenPolicyScreenModeChangeDone: mode = %d, state = %d\n", mode, state );
1192 void WindowBaseEcoreWl2::DisplayPolicyBrightnessChangeDone( void* data, struct tizen_display_policy *displayPolicy, struct wl_surface* surface, int32_t brightness, uint32_t state )
1194 mBrightness = brightness;
1195 mBrightnessChangeState = state;
1196 mBrightnessChangeDone = true;
1198 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::DisplayPolicyBrightnessChangeDone: brightness = %d, state = %d\n", brightness, state );
1201 Any WindowBaseEcoreWl2::GetNativeWindow()
1203 return mEcoreWindow;
1206 int WindowBaseEcoreWl2::GetNativeWindowId()
1208 return ecore_wl2_window_id_get( mEcoreWindow );
1211 EGLNativeWindowType WindowBaseEcoreWl2::CreateEglWindow( int width, int height )
1213 mEglWindow = wl_egl_window_create( mWlSurface, width, height );
1215 return static_cast< EGLNativeWindowType >( mEglWindow );
1218 void WindowBaseEcoreWl2::DestroyEglWindow()
1220 if( mEglWindow != NULL )
1222 wl_egl_window_destroy( mEglWindow );
1227 void WindowBaseEcoreWl2::SetEglWindowRotation( int angle )
1229 wl_egl_window_rotation rotation;
1235 rotation = ROTATION_0;
1240 rotation = ROTATION_270;
1245 rotation = ROTATION_180;
1250 rotation = ROTATION_90;
1255 rotation = ROTATION_0;
1260 wl_egl_window_set_rotation( mEglWindow, rotation );
1263 void WindowBaseEcoreWl2::SetEglWindowBufferTransform( int angle )
1265 wl_output_transform bufferTransform;
1271 bufferTransform = WL_OUTPUT_TRANSFORM_NORMAL;
1276 bufferTransform = WL_OUTPUT_TRANSFORM_90;
1281 bufferTransform = WL_OUTPUT_TRANSFORM_180;
1286 bufferTransform = WL_OUTPUT_TRANSFORM_270;
1291 bufferTransform = WL_OUTPUT_TRANSFORM_NORMAL;
1296 wl_egl_window_set_buffer_transform( mEglWindow, bufferTransform );
1299 void WindowBaseEcoreWl2::SetEglWindowTransform( int angle )
1301 wl_output_transform windowTransform;
1307 windowTransform = WL_OUTPUT_TRANSFORM_NORMAL;
1312 windowTransform = WL_OUTPUT_TRANSFORM_90;
1317 windowTransform = WL_OUTPUT_TRANSFORM_180;
1322 windowTransform = WL_OUTPUT_TRANSFORM_270;
1327 windowTransform = WL_OUTPUT_TRANSFORM_NORMAL;
1332 wl_egl_window_set_window_transform( mEglWindow, windowTransform );
1335 void WindowBaseEcoreWl2::ResizeEglWindow( PositionSize positionSize )
1337 wl_egl_window_resize( mEglWindow, positionSize.width, positionSize.height, positionSize.x, positionSize.y );
1339 // Note: Both "Resize" and "MoveResize" cases can reach here, but only "MoveResize" needs to submit serial number
1340 if( mMoveResizeSerial != mLastSubmittedMoveResizeSerial )
1342 wl_egl_window_tizen_set_window_serial( mEglWindow, mMoveResizeSerial );
1343 mLastSubmittedMoveResizeSerial = mMoveResizeSerial;
1347 bool WindowBaseEcoreWl2::IsEglWindowRotationSupported()
1350 wl_egl_window_capability capability = static_cast< wl_egl_window_capability >( wl_egl_window_get_capabilities( mEglWindow ) );
1351 if( capability == WL_EGL_WINDOW_CAPABILITY_ROTATION_SUPPORTED )
1359 void WindowBaseEcoreWl2::Move( PositionSize positionSize )
1361 ecore_wl2_window_position_set( mEcoreWindow, positionSize.x, positionSize.y );
1364 void WindowBaseEcoreWl2::Resize( PositionSize positionSize )
1366 ecore_wl2_window_geometry_set( mEcoreWindow, positionSize.x, positionSize.y, positionSize.width, positionSize.height );
1369 void WindowBaseEcoreWl2::MoveResize( PositionSize positionSize )
1371 ecore_wl2_window_sync_geometry_set( mEcoreWindow, ++mMoveResizeSerial, positionSize.x, positionSize.y, positionSize.width, positionSize.height );
1374 void WindowBaseEcoreWl2::ShowIndicator( Dali::Window::IndicatorVisibleMode visibleMode, Dali::Window::IndicatorBgOpacity opacityMode )
1376 DALI_LOG_TRACE_METHOD_FMT( gWindowBaseLogFilter, "visible : %d\n", visibleMode );
1378 if( visibleMode == Dali::Window::VISIBLE )
1380 // when the indicator is visible, set proper mode for indicator server according to bg mode
1381 if( opacityMode == Dali::Window::OPAQUE )
1383 ecore_wl2_window_indicator_opacity_set( mEcoreWindow, ECORE_WL2_INDICATOR_OPAQUE );
1385 else if( opacityMode == Dali::Window::TRANSLUCENT )
1387 ecore_wl2_window_indicator_opacity_set( mEcoreWindow, ECORE_WL2_INDICATOR_TRANSLUCENT );
1389 else if( opacityMode == Dali::Window::TRANSPARENT )
1391 ecore_wl2_window_indicator_opacity_set( mEcoreWindow, ECORE_WL2_INDICATOR_OPAQUE );
1396 // when the indicator is not visible, set TRANSPARENT mode for indicator server
1397 ecore_wl2_window_indicator_opacity_set( mEcoreWindow, ECORE_WL2_INDICATOR_TRANSPARENT); // it means hidden indicator
1401 void WindowBaseEcoreWl2::SetIndicatorProperties( bool isShow, Dali::Window::WindowOrientation lastOrientation )
1405 ecore_wl2_window_indicator_state_set( mEcoreWindow, ECORE_WL2_INDICATOR_STATE_ON );
1409 ecore_wl2_window_indicator_state_set( mEcoreWindow, ECORE_WL2_INDICATOR_STATE_OFF );
1413 void WindowBaseEcoreWl2::IndicatorTypeChanged( IndicatorInterface::Type type )
1415 #if defined(DALI_PROFILE_MOBILE)
1418 case IndicatorInterface::INDICATOR_TYPE_1:
1420 ecore_wl2_indicator_visible_type_set( mEcoreWindow, ECORE_WL2_INDICATOR_VISIBLE_TYPE_SHOWN );
1423 case IndicatorInterface::INDICATOR_TYPE_2:
1425 ecore_wl2_indicator_visible_type_set( mEcoreWindow, ECORE_WL2_INDICATOR_VISIBLE_TYPE_HIDDEN );
1428 case IndicatorInterface::INDICATOR_TYPE_UNKNOWN:
1437 void WindowBaseEcoreWl2::SetClass( const std::string& name, const std::string& className )
1439 ecore_wl2_window_title_set( mEcoreWindow, name.c_str() );
1440 ecore_wl2_window_class_set( mEcoreWindow, className.c_str() );
1443 void WindowBaseEcoreWl2::Raise()
1445 // Use ecore_wl2_window_activate to prevent the window shown without rendering
1446 ecore_wl2_window_activate( mEcoreWindow );
1449 void WindowBaseEcoreWl2::Lower()
1451 ecore_wl2_window_lower( mEcoreWindow );
1454 void WindowBaseEcoreWl2::Activate()
1456 ecore_wl2_window_activate( mEcoreWindow );
1459 void WindowBaseEcoreWl2::SetAvailableOrientations( const std::vector< Dali::Window::WindowOrientation >& orientations )
1461 int rotations[4] = { 0 };
1462 for( std::size_t i = 0; i < orientations.size(); ++i )
1464 rotations[i] = static_cast< int >( orientations[i] );
1466 ecore_wl2_window_available_rotations_set( mEcoreWindow, rotations, orientations.size() );
1469 void WindowBaseEcoreWl2::SetPreferredOrientation( Dali::Window::WindowOrientation orientation )
1471 ecore_wl2_window_preferred_rotation_set( mEcoreWindow, orientation );
1474 void WindowBaseEcoreWl2::SetAcceptFocus( bool accept )
1476 ecore_wl2_window_focus_skip_set( mEcoreWindow, !accept );
1479 void WindowBaseEcoreWl2::Show()
1481 ecore_wl2_window_show( mEcoreWindow );
1484 void WindowBaseEcoreWl2::Hide()
1486 ecore_wl2_window_hide( mEcoreWindow );
1489 unsigned int WindowBaseEcoreWl2::GetSupportedAuxiliaryHintCount() const
1491 return mSupportedAuxiliaryHints.size();
1494 std::string WindowBaseEcoreWl2::GetSupportedAuxiliaryHint( unsigned int index ) const
1496 if( index >= GetSupportedAuxiliaryHintCount() )
1498 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetSupportedAuxiliaryHint: Invalid index! [%d]\n", index );
1501 return mSupportedAuxiliaryHints[index];
1504 unsigned int WindowBaseEcoreWl2::AddAuxiliaryHint( const std::string& hint, const std::string& value )
1506 bool supported = false;
1508 // Check if the hint is suppported
1509 for( std::vector< std::string >::iterator iter = mSupportedAuxiliaryHints.begin(); iter != mSupportedAuxiliaryHints.end(); ++iter )
1520 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Concise, "WindowBaseEcoreWl2::AddAuxiliaryHint: Not supported auxiliary hint [%s]\n", hint.c_str() );
1524 // Check if the hint is already added
1525 for( unsigned int i = 0; i < mAuxiliaryHints.size(); i++ )
1527 if( mAuxiliaryHints[i].first == hint )
1529 // Just change the value
1530 mAuxiliaryHints[i].second = value;
1532 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::AddAuxiliaryHint: Change! hint = %s, value = %s, id = %d\n", hint.c_str(), value.c_str(), i + 1 );
1534 return i + 1; // id is index + 1
1539 mAuxiliaryHints.push_back( std::pair< std::string, std::string >( hint, value ) );
1541 unsigned int id = mAuxiliaryHints.size();
1543 ecore_wl2_window_aux_hint_add( mEcoreWindow, static_cast< int >( id ), hint.c_str(), value.c_str() );
1545 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::AddAuxiliaryHint: hint = %s, value = %s, id = %d\n", hint.c_str(), value.c_str(), id );
1550 bool WindowBaseEcoreWl2::RemoveAuxiliaryHint( unsigned int id )
1552 if( id == 0 || id > mAuxiliaryHints.size() )
1554 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Concise, "WindowBaseEcoreWl2::RemoveAuxiliaryHint: Invalid id [%d]\n", id );
1558 mAuxiliaryHints[id - 1].second = std::string();
1560 ecore_wl2_window_aux_hint_del( mEcoreWindow, static_cast< int >( id ) );
1562 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::RemoveAuxiliaryHint: id = %d, hint = %s\n", id, mAuxiliaryHints[id - 1].first.c_str() );
1567 bool WindowBaseEcoreWl2::SetAuxiliaryHintValue( unsigned int id, const std::string& value )
1569 if( id == 0 || id > mAuxiliaryHints.size() )
1571 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Concise, "WindowBaseEcoreWl2::SetAuxiliaryHintValue: Invalid id [%d]\n", id );
1575 mAuxiliaryHints[id - 1].second = value;
1577 ecore_wl2_window_aux_hint_change( mEcoreWindow, static_cast< int >( id ), value.c_str() );
1579 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetAuxiliaryHintValue: id = %d, hint = %s, value = %s\n", id, mAuxiliaryHints[id - 1].first.c_str(), mAuxiliaryHints[id - 1].second.c_str() );
1584 std::string WindowBaseEcoreWl2::GetAuxiliaryHintValue( unsigned int id ) const
1586 if( id == 0 || id > mAuxiliaryHints.size() )
1588 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Concise, "WindowBaseEcoreWl2::GetAuxiliaryHintValue: Invalid id [%d]\n", id );
1589 return std::string();
1592 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetAuxiliaryHintValue: id = %d, hint = %s, value = %s\n", id, mAuxiliaryHints[id - 1].first.c_str(), mAuxiliaryHints[id - 1].second.c_str() );
1594 return mAuxiliaryHints[id - 1].second;
1597 unsigned int WindowBaseEcoreWl2::GetAuxiliaryHintId( const std::string& hint ) const
1599 for( unsigned int i = 0; i < mAuxiliaryHints.size(); i++ )
1601 if( mAuxiliaryHints[i].first == hint )
1603 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetAuxiliaryHintId: hint = %s, id = %d\n", hint.c_str(), i + 1 );
1608 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetAuxiliaryHintId: Invalid hint! [%s]\n", hint.c_str() );
1613 void WindowBaseEcoreWl2::SetInputRegion( const Rect< int >& inputRegion )
1615 ecore_wl2_window_input_region_set( mEcoreWindow, inputRegion.x, inputRegion.y, inputRegion.width, inputRegion.height );
1618 void WindowBaseEcoreWl2::SetType( Dali::Window::Type type )
1620 Ecore_Wl2_Window_Type windowType;
1624 case Dali::Window::NORMAL:
1626 windowType = ECORE_WL2_WINDOW_TYPE_TOPLEVEL;
1629 case Dali::Window::NOTIFICATION:
1631 windowType = ECORE_WL2_WINDOW_TYPE_NOTIFICATION;
1634 case Dali::Window::UTILITY:
1636 windowType = ECORE_WL2_WINDOW_TYPE_UTILITY;
1639 case Dali::Window::DIALOG:
1641 windowType = ECORE_WL2_WINDOW_TYPE_DIALOG;
1646 windowType = ECORE_WL2_WINDOW_TYPE_TOPLEVEL;
1651 ecore_wl2_window_type_set( mEcoreWindow, windowType );
1654 bool WindowBaseEcoreWl2::SetNotificationLevel( Dali::Window::NotificationLevel::Type level )
1656 while( !mTizenPolicy )
1658 wl_display_dispatch_queue( mDisplay, mEventQueue );
1661 int notificationLevel;
1665 case Dali::Window::NotificationLevel::NONE:
1667 notificationLevel = TIZEN_POLICY_LEVEL_NONE;
1670 case Dali::Window::NotificationLevel::BASE:
1672 notificationLevel = TIZEN_POLICY_LEVEL_DEFAULT;
1675 case Dali::Window::NotificationLevel::MEDIUM:
1677 notificationLevel = TIZEN_POLICY_LEVEL_MEDIUM;
1680 case Dali::Window::NotificationLevel::HIGH:
1682 notificationLevel = TIZEN_POLICY_LEVEL_HIGH;
1685 case Dali::Window::NotificationLevel::TOP:
1687 notificationLevel = TIZEN_POLICY_LEVEL_TOP;
1692 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetNotificationLevel: invalid level [%d]\n", level );
1693 notificationLevel = TIZEN_POLICY_LEVEL_DEFAULT;
1698 mNotificationLevelChangeDone = false;
1699 mNotificationChangeState = TIZEN_POLICY_ERROR_STATE_NONE;
1701 tizen_policy_set_notification_level( mTizenPolicy, ecore_wl2_window_surface_get( mEcoreWindow ), notificationLevel );
1705 while( !mNotificationLevelChangeDone && count < 3 )
1707 ecore_wl2_display_flush( ecore_wl2_connected_display_get( NULL ) );
1708 wl_display_dispatch_queue( mDisplay, mEventQueue );
1712 if( !mNotificationLevelChangeDone )
1714 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetNotificationLevel: Level change is failed [%d, %d]\n", level, mNotificationChangeState );
1717 else if( mNotificationChangeState == TIZEN_POLICY_ERROR_STATE_PERMISSION_DENIED )
1719 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetNotificationLevel: Permission denied! [%d]\n", level );
1723 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetNotificationLevel: Level is changed [%d]\n", mNotificationLevel );
1728 Dali::Window::NotificationLevel::Type WindowBaseEcoreWl2::GetNotificationLevel() const
1730 while( !mTizenPolicy )
1732 wl_display_dispatch_queue( mDisplay, mEventQueue );
1737 while( !mNotificationLevelChangeDone && count < 3 )
1739 ecore_wl2_display_flush( ecore_wl2_connected_display_get( NULL ) );
1740 wl_display_dispatch_queue( mDisplay, mEventQueue );
1744 if( !mNotificationLevelChangeDone )
1746 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetNotificationLevel: Error! [%d]\n", mNotificationChangeState );
1747 return Dali::Window::NotificationLevel::NONE;
1750 Dali::Window::NotificationLevel::Type level;
1752 switch( mNotificationLevel )
1754 case TIZEN_POLICY_LEVEL_NONE:
1756 level = Dali::Window::NotificationLevel::NONE;
1759 case TIZEN_POLICY_LEVEL_DEFAULT:
1761 level = Dali::Window::NotificationLevel::BASE;
1764 case TIZEN_POLICY_LEVEL_MEDIUM:
1766 level = Dali::Window::NotificationLevel::MEDIUM;
1769 case TIZEN_POLICY_LEVEL_HIGH:
1771 level = Dali::Window::NotificationLevel::HIGH;
1774 case TIZEN_POLICY_LEVEL_TOP:
1776 level = Dali::Window::NotificationLevel::TOP;
1781 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetNotificationLevel: invalid level [%d]\n", mNotificationLevel );
1782 level = Dali::Window::NotificationLevel::NONE;
1787 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetNotificationLevel: level [%d]\n", mNotificationLevel );
1792 void WindowBaseEcoreWl2::SetOpaqueState( bool opaque )
1794 while( !mTizenPolicy )
1796 wl_display_dispatch_queue( mDisplay, mEventQueue );
1799 tizen_policy_set_opaque_state( mTizenPolicy, ecore_wl2_window_surface_get( mEcoreWindow ), ( opaque ? 1 : 0 ) );
1802 bool WindowBaseEcoreWl2::SetScreenOffMode(Dali::Window::ScreenOffMode::Type screenOffMode)
1804 while( !mTizenPolicy )
1806 wl_display_dispatch_queue( mDisplay, mEventQueue );
1809 mScreenOffModeChangeDone = false;
1810 mScreenOffModeChangeState = TIZEN_POLICY_ERROR_STATE_NONE;
1812 unsigned int mode = 0;
1814 switch( screenOffMode )
1816 case Dali::Window::ScreenOffMode::TIMEOUT:
1821 case Dali::Window::ScreenOffMode::NEVER:
1828 tizen_policy_set_window_screen_mode( mTizenPolicy, ecore_wl2_window_surface_get( mEcoreWindow ), mode );
1832 while( !mScreenOffModeChangeDone && count < 3 )
1834 ecore_wl2_display_flush( ecore_wl2_connected_display_get( NULL ) );
1835 wl_display_dispatch_queue( mDisplay, mEventQueue );
1839 if( !mScreenOffModeChangeDone )
1841 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetScreenOffMode: Screen mode change is failed [%d, %d]\n", screenOffMode, mScreenOffModeChangeState );
1844 else if( mScreenOffModeChangeState == TIZEN_POLICY_ERROR_STATE_PERMISSION_DENIED )
1846 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetScreenOffMode: Permission denied! [%d]\n", screenOffMode );
1850 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetScreenOffMode: Screen mode is changed [%d]\n", mScreenOffMode );
1855 Dali::Window::ScreenOffMode::Type WindowBaseEcoreWl2::GetScreenOffMode() const
1857 while( !mTizenPolicy )
1859 wl_display_dispatch_queue( mDisplay, mEventQueue );
1864 while( !mScreenOffModeChangeDone && count < 3 )
1866 ecore_wl2_display_flush( ecore_wl2_connected_display_get( NULL ) );
1867 wl_display_dispatch_queue( mDisplay, mEventQueue );
1871 if( !mScreenOffModeChangeDone )
1873 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetScreenOffMode: Error! [%d]\n", mScreenOffModeChangeState );
1874 return Dali::Window::ScreenOffMode::TIMEOUT;
1877 Dali::Window::ScreenOffMode::Type screenMode = Dali::Window::ScreenOffMode::TIMEOUT;
1879 switch( mScreenOffMode )
1883 screenMode = Dali::Window::ScreenOffMode::TIMEOUT;
1888 screenMode = Dali::Window::ScreenOffMode::NEVER;
1893 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetScreenOffMode: screen mode [%d]\n", mScreenOffMode );
1898 bool WindowBaseEcoreWl2::SetBrightness( int brightness )
1900 while( !mTizenDisplayPolicy )
1902 wl_display_dispatch_queue( mDisplay, mEventQueue );
1905 mBrightnessChangeDone = false;
1906 mBrightnessChangeState = TIZEN_POLICY_ERROR_STATE_NONE;
1908 tizen_display_policy_set_window_brightness( mTizenDisplayPolicy, ecore_wl2_window_surface_get( mEcoreWindow ), brightness );
1912 while( !mBrightnessChangeDone && count < 3 )
1914 ecore_wl2_display_flush( ecore_wl2_connected_display_get( NULL ) );
1915 wl_display_dispatch_queue( mDisplay, mEventQueue );
1919 if( !mBrightnessChangeDone )
1921 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetBrightness: Brightness change is failed [%d, %d]\n", brightness, mBrightnessChangeState );
1924 else if( mBrightnessChangeState == TIZEN_POLICY_ERROR_STATE_PERMISSION_DENIED )
1926 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetBrightness: Permission denied! [%d]\n", brightness );
1930 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetBrightness: Brightness is changed [%d]\n", mBrightness );
1935 int WindowBaseEcoreWl2::GetBrightness() const
1937 while( !mTizenDisplayPolicy )
1939 wl_display_dispatch_queue( mDisplay, mEventQueue );
1944 while( !mBrightnessChangeDone && count < 3 )
1946 ecore_wl2_display_flush( ecore_wl2_connected_display_get( NULL ) );
1947 wl_display_dispatch_queue( mDisplay, mEventQueue );
1951 if( !mBrightnessChangeDone )
1953 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetBrightness: Error! [%d]\n", mBrightnessChangeState );
1957 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetBrightness: Brightness [%d]\n", mBrightness );
1962 bool WindowBaseEcoreWl2::GrabKey( Dali::KEY key, KeyGrab::KeyGrabMode grabMode )
1964 Ecore_Wl2_Window_Keygrab_Mode mode;
1968 case KeyGrab::TOPMOST:
1970 mode = ECORE_WL2_WINDOW_KEYGRAB_TOPMOST;
1973 case KeyGrab::SHARED:
1975 mode = ECORE_WL2_WINDOW_KEYGRAB_SHARED;
1978 case KeyGrab::OVERRIDE_EXCLUSIVE:
1980 mode = ECORE_WL2_WINDOW_KEYGRAB_OVERRIDE_EXCLUSIVE;
1983 case KeyGrab::EXCLUSIVE:
1985 mode = ECORE_WL2_WINDOW_KEYGRAB_EXCLUSIVE;
1994 return ecore_wl2_window_keygrab_set( mEcoreWindow, KeyLookup::GetKeyName( key ), 0, 0, 0, mode );
1997 bool WindowBaseEcoreWl2::UngrabKey( Dali::KEY key )
1999 return ecore_wl2_window_keygrab_unset( mEcoreWindow, KeyLookup::GetKeyName( key ), 0, 0 );
2002 bool WindowBaseEcoreWl2::GrabKeyList( const Dali::Vector< Dali::KEY >& key, const Dali::Vector< KeyGrab::KeyGrabMode >& grabMode, Dali::Vector< bool >& result )
2004 int keyCount = key.Count();
2005 int keyGrabModeCount = grabMode.Count();
2007 if( keyCount != keyGrabModeCount || keyCount == 0 )
2014 Eina_List* keyList = NULL;
2015 Ecore_Wl2_Window_Keygrab_Info* info = new Ecore_Wl2_Window_Keygrab_Info[keyCount];
2017 for( int index = 0; index < keyCount; ++index )
2019 info[index].key = const_cast< char* >( KeyLookup::GetKeyName( key[index] ) );
2021 switch( grabMode[index] )
2023 case KeyGrab::TOPMOST:
2025 info[index].mode = ECORE_WL2_WINDOW_KEYGRAB_TOPMOST;
2028 case KeyGrab::SHARED:
2030 info[index].mode = ECORE_WL2_WINDOW_KEYGRAB_SHARED;
2033 case KeyGrab::OVERRIDE_EXCLUSIVE:
2035 info[index].mode = ECORE_WL2_WINDOW_KEYGRAB_OVERRIDE_EXCLUSIVE;
2038 case KeyGrab::EXCLUSIVE:
2040 info[index].mode = ECORE_WL2_WINDOW_KEYGRAB_EXCLUSIVE;
2045 info[index].mode = ECORE_WL2_WINDOW_KEYGRAB_UNKNOWN;
2050 keyList = eina_list_append( keyList, &info );
2053 Eina_List* grabList = ecore_wl2_window_keygrab_list_set( mEcoreWindow, keyList );
2055 result.Resize( keyCount, true );
2057 Eina_List* l = NULL;
2058 Eina_List* m = NULL;
2059 void* listData = NULL;
2061 if( grabList != NULL )
2063 EINA_LIST_FOREACH( grabList, m, data )
2066 EINA_LIST_FOREACH( keyList, l, listData )
2068 if( static_cast< Ecore_Wl2_Window_Keygrab_Info* >( listData )->key == NULL )
2070 DALI_LOG_ERROR( "input key list has null data!" );
2074 if( strcmp( static_cast< char* >( data ), static_cast< Ecore_Wl2_Window_Keygrab_Info* >( listData )->key ) == 0 )
2076 result[index] = false;
2085 eina_list_free( keyList );
2086 eina_list_free( grabList );
2092 bool WindowBaseEcoreWl2::UngrabKeyList( const Dali::Vector< Dali::KEY >& key, Dali::Vector< bool >& result )
2094 int keyCount = key.Count();
2102 Eina_List* keyList = NULL;
2103 Ecore_Wl2_Window_Keygrab_Info* info = new Ecore_Wl2_Window_Keygrab_Info[keyCount];
2105 for( int index = 0; index < keyCount; ++index )
2107 info[index].key = const_cast< char* >( KeyLookup::GetKeyName( key[index] ) );
2108 keyList = eina_list_append( keyList, &info );
2111 Eina_List* ungrabList = ecore_wl2_window_keygrab_list_unset( mEcoreWindow, keyList );
2113 result.Resize( keyCount, true );
2115 Eina_List* l = NULL;
2116 Eina_List* m = NULL;
2117 void *listData = NULL;
2120 if( ungrabList != NULL )
2122 EINA_LIST_FOREACH( ungrabList, m, data )
2125 EINA_LIST_FOREACH( keyList, l, listData )
2127 if( strcmp( static_cast< char* >( data ), static_cast< Ecore_Wl2_Window_Keygrab_Info* >( listData )->key ) == 0 )
2129 result[index] = false;
2138 eina_list_free( keyList );
2139 eina_list_free( ungrabList );
2145 void WindowBaseEcoreWl2::GetDpi( unsigned int& dpiHorizontal, unsigned int& dpiVertical )
2150 Ecore_Wl2_Output* output = ecore_wl2_window_output_find( mEcoreWindow );
2152 // 1 inch = 25.4 millimeters
2153 xres = ecore_wl2_output_dpi_get( output );
2154 yres = ecore_wl2_output_dpi_get( output );
2156 dpiHorizontal = int( xres + 0.5f ); // rounding
2157 dpiVertical = int( yres + 0.5f );
2160 int WindowBaseEcoreWl2::GetScreenRotationAngle()
2164 if( ecore_wl2_window_ignore_output_transform_get( mEcoreWindow ) )
2170 transform = ecore_wl2_output_transform_get( ecore_wl2_window_output_find( mEcoreWindow ) );
2173 return transform * 90;
2176 void WindowBaseEcoreWl2::SetWindowRotationAngle( int degree )
2178 ecore_wl2_window_rotation_set( mEcoreWindow, degree );
2181 void WindowBaseEcoreWl2::WindowRotationCompleted( int degree, int width, int height )
2183 ecore_wl2_window_rotation_change_done_send( mEcoreWindow, degree, width, height );
2186 void WindowBaseEcoreWl2::SetTransparency( bool transparent )
2188 ecore_wl2_window_alpha_set( mEcoreWindow, transparent );
2191 void WindowBaseEcoreWl2::InitializeEcoreElDBus()
2193 #ifdef DALI_ELDBUS_AVAILABLE
2194 Eldbus_Object* object;
2195 Eldbus_Proxy* manager;
2197 if( !( mSystemConnection = eldbus_connection_get( ELDBUS_CONNECTION_TYPE_SYSTEM ) ) )
2199 DALI_LOG_ERROR( "Unable to get system bus\n" );
2202 object = eldbus_object_get( mSystemConnection, BUS, PATH );
2205 DALI_LOG_ERROR( "Getting object failed\n" );
2209 manager = eldbus_proxy_get( object, INTERFACE );
2212 DALI_LOG_ERROR( "Getting proxy failed\n" );
2216 if( !eldbus_proxy_signal_handler_add( manager, "GestureDetected", EcoreElDBusAccessibilityNotification, this ) )
2218 DALI_LOG_ERROR( "No signal handler returned\n" );
2223 void WindowBaseEcoreWl2::CreateWindow( PositionSize positionSize )
2225 Ecore_Wl2_Display* display = ecore_wl2_display_connect( NULL );
2228 DALI_ASSERT_ALWAYS( 0 && "Failed to get display" );
2231 mEcoreWindow = ecore_wl2_window_new( display, NULL, positionSize.x, positionSize.y, positionSize.width, positionSize.height );
2233 if ( mEcoreWindow == 0 )
2235 DALI_ASSERT_ALWAYS( 0 && "Failed to create Wayland window" );
2239 ecore_wl2_window_type_set( mEcoreWindow, ECORE_WL2_WINDOW_TYPE_TOPLEVEL );
2242 } // namespace Adaptor
2244 } // namespace Internal
2248 #pragma GCC diagnostic pop