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>
51 #if defined(DEBUG_ENABLED)
52 Debug::Filter* gWindowBaseLogFilter = Debug::Filter::New( Debug::NoLogging, false, "LOG_WINDOW_BASE" );
55 const uint32_t MAX_TIZEN_CLIENT_VERSION = 7;
56 const unsigned int PRIMARY_TOUCH_BUTTON_ID = 1;
58 const char* DALI_VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_NAME = "db/setting/accessibility/font_name"; // It will be update at vconf-key.h and replaced.
61 const char* BUS = "org.enlightenment.wm-screen-reader";
62 const char* INTERFACE = "org.tizen.GestureNavigation";
63 const char* PATH = "/org/tizen/GestureNavigation";
66 * Get the device name from the provided ecore key event
68 void GetDeviceName( Ecore_Event_Key* keyEvent, std::string& result )
70 const char* ecoreDeviceName = ecore_device_name_get( keyEvent->dev );
74 result = ecoreDeviceName;
79 * Get the device class from the provided ecore event
81 void GetDeviceClass( Ecore_Device_Class ecoreDeviceClass, Device::Class::Type& deviceClass )
83 switch( ecoreDeviceClass )
85 case ECORE_DEVICE_CLASS_SEAT:
87 deviceClass = Device::Class::USER;
90 case ECORE_DEVICE_CLASS_KEYBOARD:
92 deviceClass = Device::Class::KEYBOARD;
95 case ECORE_DEVICE_CLASS_MOUSE:
97 deviceClass = Device::Class::MOUSE;
100 case ECORE_DEVICE_CLASS_TOUCH:
102 deviceClass = Device::Class::TOUCH;
105 case ECORE_DEVICE_CLASS_PEN:
107 deviceClass = Device::Class::PEN;
110 case ECORE_DEVICE_CLASS_POINTER:
112 deviceClass = Device::Class::POINTER;
115 case ECORE_DEVICE_CLASS_GAMEPAD:
117 deviceClass = Device::Class::GAMEPAD;
122 deviceClass = Device::Class::NONE;
128 void GetDeviceSubclass( Ecore_Device_Subclass ecoreDeviceSubclass, Device::Subclass::Type& deviceSubclass )
130 switch( ecoreDeviceSubclass )
132 case ECORE_DEVICE_SUBCLASS_FINGER:
134 deviceSubclass = Device::Subclass::FINGER;
137 case ECORE_DEVICE_SUBCLASS_FINGERNAIL:
139 deviceSubclass = Device::Subclass::FINGERNAIL;
142 case ECORE_DEVICE_SUBCLASS_KNUCKLE:
144 deviceSubclass = Device::Subclass::KNUCKLE;
147 case ECORE_DEVICE_SUBCLASS_PALM:
149 deviceSubclass = Device::Subclass::PALM;
152 case ECORE_DEVICE_SUBCLASS_HAND_SIZE:
154 deviceSubclass = Device::Subclass::HAND_SIDE;
157 case ECORE_DEVICE_SUBCLASS_HAND_FLAT:
159 deviceSubclass = Device::Subclass::HAND_FLAT;
162 case ECORE_DEVICE_SUBCLASS_PEN_TIP:
164 deviceSubclass = Device::Subclass::PEN_TIP;
167 case ECORE_DEVICE_SUBCLASS_TRACKPAD:
169 deviceSubclass = Device::Subclass::TRACKPAD;
172 case ECORE_DEVICE_SUBCLASS_TRACKPOINT:
174 deviceSubclass = Device::Subclass::TRACKPOINT;
177 case ECORE_DEVICE_SUBCLASS_TRACKBALL:
179 deviceSubclass = Device::Subclass::TRACKBALL;
182 #ifdef OVER_TIZEN_VERSION_4
183 case ECORE_DEVICE_SUBCLASS_REMOCON:
185 deviceSubclass = Device::Subclass::REMOCON;
188 case ECORE_DEVICE_SUBCLASS_VIRTUAL_KEYBOARD:
190 deviceSubclass = Device::Subclass::VIRTUAL_KEYBOARD;
196 deviceSubclass = Device::Subclass::NONE;
202 /////////////////////////////////////////////////////////////////////////////////////////////////
204 /////////////////////////////////////////////////////////////////////////////////////////////////
206 /// Called when the window iconify state is changed.
207 static Eina_Bool EcoreEventWindowIconifyStateChanged( void* data, int type, void* event )
209 WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
212 return windowBase->OnIconifyStateChanged( data, type, event );
215 return ECORE_CALLBACK_PASS_ON;
218 /// Called when the window gains focus
219 static Eina_Bool EcoreEventWindowFocusIn( void* data, int type, void* event )
221 WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
224 return windowBase->OnFocusIn( data, type, event );
227 return ECORE_CALLBACK_PASS_ON;
230 /// Called when the window loses focus
231 static Eina_Bool EcoreEventWindowFocusOut( void* data, int type, void* event )
233 WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
236 return windowBase->OnFocusOut( data, type, event );
239 return ECORE_CALLBACK_PASS_ON;
242 /// Called when the output is transformed
243 static Eina_Bool EcoreEventOutputTransform( void* data, int type, void* event )
245 WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
248 return windowBase->OnOutputTransform( data, type, event );
251 return ECORE_CALLBACK_PASS_ON;
254 /// Called when the output transform should be ignored
255 static Eina_Bool EcoreEventIgnoreOutputTransform( void* data, int type, void* event )
257 WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
260 return windowBase->OnIgnoreOutputTransform( data, type, event );
263 return ECORE_CALLBACK_PASS_ON;
267 * Called when rotate event is recevied.
269 static Eina_Bool EcoreEventRotate( void* data, int type, void* event )
271 WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
274 windowBase->OnRotation( data, type, event );
276 return ECORE_CALLBACK_PASS_ON;
279 /////////////////////////////////////////////////////////////////////////////////////////////////
281 /////////////////////////////////////////////////////////////////////////////////////////////////
284 * Called when a touch down is received.
286 static Eina_Bool EcoreEventMouseButtonDown( void* data, int type, void* event )
288 WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
291 windowBase->OnMouseButtonDown( data, type, event );
293 return ECORE_CALLBACK_PASS_ON;
297 * Called when a touch up is received.
299 static Eina_Bool EcoreEventMouseButtonUp( void* data, int type, void* event )
301 WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
304 windowBase->OnMouseButtonUp( data, type, event );
306 return ECORE_CALLBACK_PASS_ON;
310 * Called when a touch motion is received.
312 static Eina_Bool EcoreEventMouseButtonMove( void* data, int type, void* event )
314 WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
317 windowBase->OnMouseButtonMove( data, type, event );
319 return ECORE_CALLBACK_PASS_ON;
323 * Called when a touch is canceled.
325 static Eina_Bool EcoreEventMouseButtonCancel( void* data, int type, void* event )
327 WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
330 windowBase->OnMouseButtonCancel( data, type, event );
332 return ECORE_CALLBACK_PASS_ON;
336 * Called when a mouse wheel is received.
338 static Eina_Bool EcoreEventMouseWheel( void* data, int type, void* event )
340 WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
343 windowBase->OnMouseWheel( data, type, event );
345 return ECORE_CALLBACK_PASS_ON;
349 * Called when a detent rotation event is recevied.
351 static Eina_Bool EcoreEventDetentRotation( void* data, int type, void* event )
353 WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
356 windowBase->OnDetentRotation( data, type, event );
358 return ECORE_CALLBACK_PASS_ON;
361 /////////////////////////////////////////////////////////////////////////////////////////////////
363 /////////////////////////////////////////////////////////////////////////////////////////////////
366 * Called when a key down is received.
368 static Eina_Bool EcoreEventKeyDown( void* data, int type, void* event )
370 WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
373 windowBase->OnKeyDown( data, type, event );
375 return ECORE_CALLBACK_PASS_ON;
379 * Called when a key up is received.
381 static Eina_Bool EcoreEventKeyUp( void* data, int type, void* event )
383 WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
386 windowBase->OnKeyUp( data, type, event );
388 return ECORE_CALLBACK_PASS_ON;
391 /////////////////////////////////////////////////////////////////////////////////////////////////
392 // Selection Callbacks
393 /////////////////////////////////////////////////////////////////////////////////////////////////
396 * Called when the source window notifies us the content in clipboard is selected.
398 static Eina_Bool EcoreEventDataSend( void* data, int type, void* event )
400 WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
403 windowBase->OnDataSend( data, type, event );
405 return ECORE_CALLBACK_PASS_ON;
409 * Called when the source window sends us about the selected content.
410 * For example, when item is selected in the clipboard.
412 static Eina_Bool EcoreEventDataReceive( void* data, int type, void* event )
414 WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
417 windowBase->OnDataReceive( data, type, event );
419 return ECORE_CALLBACK_PASS_ON;
422 /////////////////////////////////////////////////////////////////////////////////////////////////
423 // Indicator Callbacks
424 /////////////////////////////////////////////////////////////////////////////////////////////////
426 #if defined (DALI_PROFILE_MOBILE)
428 * Called when the Ecore indicator event is received.
430 static Eina_Bool EcoreEventIndicator( void* data, int type, void* event )
432 WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
435 windowBase->OnIndicatorFlicked( data, type, event );
437 return ECORE_CALLBACK_PASS_ON;
439 #endif // DALI_PROFILE_MOBILE
441 /////////////////////////////////////////////////////////////////////////////////////////////////
443 /////////////////////////////////////////////////////////////////////////////////////////////////
446 * Called when a font name is changed.
448 static void VconfNotifyFontNameChanged( keynode_t* node, void* data )
450 WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
453 windowBase->OnFontNameChanged();
458 * Called when a font size is changed.
460 static void VconfNotifyFontSizeChanged( keynode_t* node, void* data )
462 WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
465 windowBase->OnFontSizeChanged();
469 /////////////////////////////////////////////////////////////////////////////////////////////////
470 // ElDBus Accessibility Callbacks
471 /////////////////////////////////////////////////////////////////////////////////////////////////
473 #ifdef DALI_ELDBUS_AVAILABLE
474 // Callback for Ecore ElDBus accessibility events.
475 static void EcoreElDBusAccessibilityNotification( void* context, const Eldbus_Message* message )
477 WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( context );
480 windowBase->OnEcoreElDBusAccessibilityNotification( context, message );
483 #endif // DALI_ELDBUS_AVAILABLE
485 static void RegistryGlobalCallback( void* data, struct wl_registry *registry, uint32_t name, const char* interface, uint32_t version )
487 WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
490 windowBase->RegistryGlobalCallback( data, registry, name, interface, version );
494 static void RegistryGlobalCallbackRemove( void* data, struct wl_registry* registry, uint32_t id )
496 WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
499 windowBase->RegistryGlobalCallbackRemove( data, registry, id );
503 static void TizenPolicyConformant( void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, uint32_t isConformant )
507 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 )
511 static void TizenPolicyNotificationChangeDone(void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, int32_t level, uint32_t state )
513 WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
516 windowBase->TizenPolicyNotificationChangeDone( data, tizenPolicy, surface, level, state );
520 static void TizenPolicyTransientForDone( void* data, struct tizen_policy* tizenPolicy, uint32_t childId )
524 static void TizenPolicyScreenModeChangeDone( void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, uint32_t mode, uint32_t state )
526 WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
529 windowBase->TizenPolicyScreenModeChangeDone( data, tizenPolicy, surface, mode, state );
533 static void TizenPolicyIconifyStateChanged( void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, uint32_t iconified, uint32_t force )
537 static void TizenPolicySupportedAuxiliaryHints( void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, struct wl_array* hints, uint32_t numNints )
541 static void TizenPolicyAllowedAuxiliaryHint( void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, int id )
545 static void TizenPolicyAuxiliaryMessage( void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, const char* key, const char* val, struct wl_array* options )
549 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 )
553 static void DisplayPolicyBrightnessChangeDone( void* data, struct tizen_display_policy *displayPolicy, struct wl_surface* surface, int32_t brightness, uint32_t state )
555 WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
558 windowBase->DisplayPolicyBrightnessChangeDone( data, displayPolicy, surface, brightness, state );
562 const struct wl_registry_listener registryListener =
564 RegistryGlobalCallback,
565 RegistryGlobalCallbackRemove
568 const struct tizen_policy_listener tizenPolicyListener =
570 TizenPolicyConformant,
571 TizenPolicyConformantArea,
572 TizenPolicyNotificationChangeDone,
573 TizenPolicyTransientForDone,
574 TizenPolicyScreenModeChangeDone,
575 TizenPolicyIconifyStateChanged,
576 TizenPolicySupportedAuxiliaryHints,
577 TizenPolicyAllowedAuxiliaryHint,
578 TizenPolicyAuxiliaryMessage,
579 TizenPolicyConformantRegion
582 const struct tizen_display_policy_listener tizenDisplayPolicyListener =
584 DisplayPolicyBrightnessChangeDone
587 } // unnamed namespace
589 WindowBaseEcoreWl2::WindowBaseEcoreWl2( Dali::PositionSize positionSize, Any surface, bool isTransparent )
590 : mEcoreEventHandler(),
591 mEcoreWindow( NULL ),
596 mTizenPolicy( NULL ),
597 mTizenDisplayPolicy( NULL ),
598 mSupportedAuxiliaryHints(),
600 mNotificationLevel( -1 ),
601 mNotificationChangeState( 0 ),
602 mNotificationLevelChangeDone( true ),
604 mScreenOffModeChangeState( 0 ),
605 mScreenOffModeChangeDone( true ),
607 mBrightnessChangeState( 0 ),
608 mBrightnessChangeDone( true ),
610 #ifdef DALI_ELDBUS_AVAILABLE
611 , mSystemConnection( NULL )
614 Initialize( positionSize, surface, isTransparent );
617 WindowBaseEcoreWl2::~WindowBaseEcoreWl2()
619 #ifdef DALI_ELDBUS_AVAILABLE
620 // Close down ElDBus connections.
621 if( mSystemConnection )
623 eldbus_connection_unref( mSystemConnection );
625 #endif // DALI_ELDBUS_AVAILABLE
627 vconf_ignore_key_changed( VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, VconfNotifyFontSizeChanged );
628 vconf_ignore_key_changed( DALI_VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_NAME, VconfNotifyFontNameChanged );
630 for( Dali::Vector< Ecore_Event_Handler* >::Iterator iter = mEcoreEventHandler.Begin(), endIter = mEcoreEventHandler.End(); iter != endIter; ++iter )
632 ecore_event_handler_del( *iter );
634 mEcoreEventHandler.Clear();
638 wl_event_queue_destroy( mEventQueue );
641 mSupportedAuxiliaryHints.clear();
642 mAuxiliaryHints.clear();
644 if( mEglWindow != NULL )
646 wl_egl_window_destroy( mEglWindow );
652 ecore_wl2_window_free( mEcoreWindow );
654 WindowSystem::Shutdown();
658 void WindowBaseEcoreWl2::Initialize( PositionSize positionSize, Any surface, bool isTransparent )
660 if( surface.Empty() == false )
662 // check we have a valid type
663 DALI_ASSERT_ALWAYS( ( surface.GetType() == typeid (Ecore_Wl2_Window *) ) && "Surface type is invalid" );
665 mEcoreWindow = AnyCast< Ecore_Wl2_Window* >( surface );
669 // we own the surface about to created
670 WindowSystem::Initialize();
673 CreateWindow( positionSize );
676 mWlSurface = ecore_wl2_window_surface_get( mEcoreWindow );
678 SetTransparency( isTransparent );
680 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_WL2_EVENT_WINDOW_ICONIFY_STATE_CHANGE, EcoreEventWindowIconifyStateChanged, this ) );
681 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_WL2_EVENT_FOCUS_IN, EcoreEventWindowFocusIn, this ) );
682 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_WL2_EVENT_FOCUS_OUT, EcoreEventWindowFocusOut, this ) );
683 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_WL2_EVENT_OUTPUT_TRANSFORM, EcoreEventOutputTransform, this ) );
684 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_WL2_EVENT_IGNORE_OUTPUT_TRANSFORM, EcoreEventIgnoreOutputTransform, this ) );
686 // Register Rotate event
687 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_WL2_EVENT_WINDOW_ROTATE, EcoreEventRotate, this ) );
689 // Register Touch events
690 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_EVENT_MOUSE_BUTTON_DOWN, EcoreEventMouseButtonDown, this ) );
691 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_EVENT_MOUSE_BUTTON_UP, EcoreEventMouseButtonUp, this ) );
692 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_EVENT_MOUSE_MOVE, EcoreEventMouseButtonMove, this ) );
693 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_EVENT_MOUSE_BUTTON_CANCEL, EcoreEventMouseButtonCancel, this ) );
695 // Register Mouse wheel events
696 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_EVENT_MOUSE_WHEEL, EcoreEventMouseWheel, this ) );
698 // Register Detent event
699 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_EVENT_DETENT_ROTATE, EcoreEventDetentRotation, this ) );
701 // Register Key events
702 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_EVENT_KEY_DOWN, EcoreEventKeyDown, this ) );
703 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_EVENT_KEY_UP, EcoreEventKeyUp, this ) );
705 // Register Selection event - clipboard selection
706 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_WL2_EVENT_DATA_SOURCE_SEND, EcoreEventDataSend, this ) );
707 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_WL2_EVENT_SELECTION_DATA_READY, EcoreEventDataReceive, this ) );
709 #if defined (DALI_PROFILE_MOBILE)
710 // Register indicator event
711 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_WL2_EVENT_INDICATOR_FLICK, EcoreEventIndicator, this ) );
714 // Register Vconf notify - font name and size
715 vconf_notify_key_changed( DALI_VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_NAME, VconfNotifyFontNameChanged, this );
716 vconf_notify_key_changed( VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, VconfNotifyFontSizeChanged, this );
718 InitializeEcoreElDBus();
720 Ecore_Wl2_Display* display = ecore_wl2_connected_display_get( NULL );
721 mDisplay = ecore_wl2_display_get( display );
725 wl_display* displayWrapper = static_cast< wl_display* >( wl_proxy_create_wrapper( mDisplay ) );
728 mEventQueue = wl_display_create_queue( mDisplay );
731 wl_proxy_set_queue( reinterpret_cast< wl_proxy* >( displayWrapper ), mEventQueue );
733 wl_registry* registry = wl_display_get_registry( displayWrapper );
734 wl_registry_add_listener( registry, ®istryListener, this );
737 wl_proxy_wrapper_destroy( displayWrapper );
741 // get auxiliary hint
742 Eina_List* hints = ecore_wl2_window_aux_hints_supported_get( mEcoreWindow );
748 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) ) ) )
750 mSupportedAuxiliaryHints.push_back( hint );
752 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::Initialize: %s\n", hint );
757 Eina_Bool WindowBaseEcoreWl2::OnIconifyStateChanged( void* data, int type, void* event )
759 Ecore_Wl2_Event_Window_Iconify_State_Change* iconifyChangedEvent( static_cast< Ecore_Wl2_Event_Window_Iconify_State_Change* >( event ) );
760 Eina_Bool handled( ECORE_CALLBACK_PASS_ON );
762 if( iconifyChangedEvent->win == static_cast< unsigned int>( ecore_wl2_window_id_get( mEcoreWindow ) ) )
764 if( iconifyChangedEvent->iconified == EINA_TRUE )
766 mIconifyChangedSignal.Emit( true );
770 mIconifyChangedSignal.Emit( false );
772 handled = ECORE_CALLBACK_DONE;
778 Eina_Bool WindowBaseEcoreWl2::OnFocusIn( void* data, int type, void* event )
780 Ecore_Wl2_Event_Focus_In* focusInEvent( static_cast< Ecore_Wl2_Event_Focus_In* >( event ) );
782 if( focusInEvent->window == static_cast< unsigned int >( ecore_wl2_window_id_get( mEcoreWindow ) ) )
784 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "Window EcoreEventWindowFocusIn\n" );
786 mFocusChangedSignal.Emit( true );
789 return ECORE_CALLBACK_PASS_ON;
792 Eina_Bool WindowBaseEcoreWl2::OnFocusOut( void* data, int type, void* event )
794 Ecore_Wl2_Event_Focus_Out* focusOutEvent( static_cast< Ecore_Wl2_Event_Focus_Out* >( event ) );
796 if( focusOutEvent->window == static_cast< unsigned int >( ecore_wl2_window_id_get( mEcoreWindow ) ) )
798 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "Window EcoreEventWindowFocusOut\n" );
800 mFocusChangedSignal.Emit( false );
803 return ECORE_CALLBACK_PASS_ON;
806 Eina_Bool WindowBaseEcoreWl2::OnOutputTransform( void* data, int type, void* event )
808 Ecore_Wl2_Event_Output_Transform* transformEvent( static_cast< Ecore_Wl2_Event_Output_Transform* >( event ) );
810 if( transformEvent->output == ecore_wl2_window_output_find( mEcoreWindow ) )
812 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "Window (%p) EcoreEventOutputTransform\n", mEcoreWindow );
814 mOutputTransformedSignal.Emit();
817 return ECORE_CALLBACK_PASS_ON;
820 Eina_Bool WindowBaseEcoreWl2::OnIgnoreOutputTransform( void* data, int type, void* event )
822 Ecore_Wl2_Event_Ignore_Output_Transform* ignoreTransformEvent( static_cast< Ecore_Wl2_Event_Ignore_Output_Transform* >( event ) );
824 if( ignoreTransformEvent->win == mEcoreWindow )
826 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "Window (%p) EcoreEventIgnoreOutputTransform\n", mEcoreWindow );
828 mOutputTransformedSignal.Emit();
831 return ECORE_CALLBACK_PASS_ON;
834 void WindowBaseEcoreWl2::OnRotation( void* data, int type, void* event )
836 Ecore_Wl2_Event_Window_Rotation* ev( static_cast< Ecore_Wl2_Event_Window_Rotation* >( event ) );
838 if( ev->win == static_cast< unsigned int >( ecore_wl2_window_id_get( mEcoreWindow ) ) )
840 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Concise, "WindowBaseEcoreWl::OnRotation\n" );
842 RotationEvent rotationEvent;
843 rotationEvent.angle = ev->angle;
844 rotationEvent.winResize = 0;
846 if( ev->angle == 0 || ev->angle == 180 )
848 rotationEvent.width = ev->w;
849 rotationEvent.height = ev->h;
853 rotationEvent.width = ev->h;
854 rotationEvent.height = ev->w;
857 mRotationSignal.Emit( rotationEvent );
861 void WindowBaseEcoreWl2::OnMouseButtonDown( void* data, int type, void* event )
863 Ecore_Event_Mouse_Button* touchEvent = static_cast< Ecore_Event_Mouse_Button* >( event );
865 if( touchEvent->window == static_cast< unsigned int >( ecore_wl2_window_id_get( mEcoreWindow ) ) )
867 Device::Class::Type deviceClass;
868 Device::Subclass::Type deviceSubclass;
870 GetDeviceClass( ecore_device_class_get( touchEvent->dev ), deviceClass );
871 GetDeviceSubclass( ecore_device_subclass_get( touchEvent->dev ), deviceSubclass );
873 PointState::Type state ( PointState::DOWN );
875 if( deviceClass != Device::Class::Type::MOUSE )
877 // Check if the buttons field is set and ensure it's the primary touch button.
878 // If this event was triggered by buttons other than the primary button (used for touch), then
879 // just send an interrupted event to Core.
880 if( touchEvent->buttons && (touchEvent->buttons != PRIMARY_TOUCH_BUTTON_ID ) )
882 state = PointState::INTERRUPTED;
886 Integration::Point point;
887 point.SetDeviceId( touchEvent->multi.device );
888 point.SetState( state );
889 point.SetScreenPosition( Vector2( touchEvent->x, touchEvent->y ) );
890 point.SetRadius( touchEvent->multi.radius, Vector2( touchEvent->multi.radius_x, touchEvent->multi.radius_y ) );
891 point.SetPressure( touchEvent->multi.pressure );
892 point.SetAngle( Degree( touchEvent->multi.angle ) );
893 point.SetDeviceClass( deviceClass );
894 point.SetDeviceSubclass( deviceSubclass );
895 point.SetMouseButton( static_cast< MouseButton::Type >( touchEvent->buttons) );
897 mTouchEventSignal.Emit( point, touchEvent->timestamp );
901 void WindowBaseEcoreWl2::OnMouseButtonUp( void* data, int type, void* event )
903 Ecore_Event_Mouse_Button* touchEvent = static_cast< Ecore_Event_Mouse_Button* >( event );
905 if( touchEvent->window == static_cast< unsigned int >( ecore_wl2_window_id_get( mEcoreWindow ) ) )
907 Device::Class::Type deviceClass;
908 Device::Subclass::Type deviceSubclass;
910 GetDeviceClass( ecore_device_class_get( touchEvent->dev ), deviceClass );
911 GetDeviceSubclass( ecore_device_subclass_get( touchEvent->dev ), deviceSubclass );
913 Integration::Point point;
914 point.SetDeviceId( touchEvent->multi.device );
915 point.SetState( PointState::UP );
916 point.SetScreenPosition( Vector2( touchEvent->x, touchEvent->y ) );
917 point.SetRadius( touchEvent->multi.radius, Vector2( touchEvent->multi.radius_x, touchEvent->multi.radius_y ) );
918 point.SetPressure( touchEvent->multi.pressure );
919 point.SetAngle( Degree( touchEvent->multi.angle ) );
920 point.SetDeviceClass( deviceClass );
921 point.SetDeviceSubclass( deviceSubclass );
922 point.SetMouseButton( static_cast< MouseButton::Type >( touchEvent->buttons) );
924 mTouchEventSignal.Emit( point, touchEvent->timestamp );
928 void WindowBaseEcoreWl2::OnMouseButtonMove( void* data, int type, void* event )
930 Ecore_Event_Mouse_Move* touchEvent = static_cast< Ecore_Event_Mouse_Move* >( event );
932 if( touchEvent->window == static_cast< unsigned int >( ecore_wl2_window_id_get( mEcoreWindow ) ) )
934 Device::Class::Type deviceClass;
935 Device::Subclass::Type deviceSubclass;
937 GetDeviceClass( ecore_device_class_get( touchEvent->dev ), deviceClass );
938 GetDeviceSubclass( ecore_device_subclass_get( touchEvent->dev ), deviceSubclass );
940 Integration::Point point;
941 point.SetDeviceId( touchEvent->multi.device );
942 point.SetState( PointState::MOTION );
943 point.SetScreenPosition( Vector2( touchEvent->x, touchEvent->y ) );
944 point.SetRadius( touchEvent->multi.radius, Vector2( touchEvent->multi.radius_x, touchEvent->multi.radius_y ) );
945 point.SetPressure( touchEvent->multi.pressure );
946 point.SetAngle( Degree( touchEvent->multi.angle ) );
947 point.SetDeviceClass( deviceClass );
948 point.SetDeviceSubclass( deviceSubclass );
950 mTouchEventSignal.Emit( point, touchEvent->timestamp );
954 void WindowBaseEcoreWl2::OnMouseButtonCancel( void* data, int type, void* event )
956 Ecore_Event_Mouse_Button* touchEvent = static_cast< Ecore_Event_Mouse_Button* >( event );
958 if( touchEvent->window == static_cast< unsigned int >( ecore_wl2_window_id_get( mEcoreWindow ) ) )
960 Integration::Point point;
961 point.SetDeviceId( touchEvent->multi.device );
962 point.SetState( PointState::INTERRUPTED );
963 point.SetScreenPosition( Vector2( 0.0f, 0.0f ) );
965 mTouchEventSignal.Emit( point, touchEvent->timestamp );
967 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl::OnMouseButtonCancel\n" );
971 void WindowBaseEcoreWl2::OnMouseWheel( void* data, int type, void* event )
973 Ecore_Event_Mouse_Wheel* mouseWheelEvent = static_cast< Ecore_Event_Mouse_Wheel* >( event );
975 if( mouseWheelEvent->window == static_cast< unsigned int >( ecore_wl2_window_id_get( mEcoreWindow ) ) )
977 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 );
979 WheelEvent wheelEvent( WheelEvent::MOUSE_WHEEL, mouseWheelEvent->direction, mouseWheelEvent->modifiers, Vector2( mouseWheelEvent->x, mouseWheelEvent->y ), mouseWheelEvent->z, mouseWheelEvent->timestamp );
981 mWheelEventSignal.Emit( wheelEvent );
985 void WindowBaseEcoreWl2::OnDetentRotation( void* data, int type, void* event )
987 Ecore_Event_Detent_Rotate* detentEvent = static_cast< Ecore_Event_Detent_Rotate* >( event );
989 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Concise, "WindowBaseEcoreWl::OnDetentRotation\n" );
991 int direction = ( detentEvent->direction == ECORE_DETENT_DIRECTION_CLOCKWISE ) ? 1 : -1;
992 int timeStamp = detentEvent->timestamp;
994 WheelEvent wheelEvent( WheelEvent::CUSTOM_WHEEL, 0, 0, Vector2( 0.0f, 0.0f ), direction, timeStamp );
996 mWheelEventSignal.Emit( wheelEvent );
999 void WindowBaseEcoreWl2::OnKeyDown( void* data, int type, void* event )
1001 Ecore_Event_Key* keyEvent = static_cast< Ecore_Event_Key* >( event );
1003 if( keyEvent->window == static_cast< unsigned int >( ecore_wl2_window_id_get( mEcoreWindow ) ) )
1005 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl::OnKeyDown\n" );
1007 std::string keyName( keyEvent->keyname );
1008 std::string keyString( "" );
1009 std::string compose( "" );
1011 // Ensure key compose string is not NULL as keys like SHIFT or arrow have a null string.
1012 if( keyEvent->compose )
1014 compose = keyEvent->compose;
1017 int keyCode = KeyLookup::GetDaliKeyCode( keyEvent->keyname );
1018 keyCode = ( keyCode == -1 ) ? 0 : keyCode;
1019 int modifier( keyEvent->modifiers );
1020 unsigned long time = keyEvent->timestamp;
1021 if( !strncmp( keyEvent->keyname, "Keycode-", 8 ) )
1023 keyCode = atoi( keyEvent->keyname + 8 );
1026 // Ensure key event string is not NULL as keys like SHIFT have a null string.
1027 if( keyEvent->string )
1029 keyString = keyEvent->string;
1032 std::string deviceName;
1033 Device::Class::Type deviceClass;
1034 Device::Subclass::Type deviceSubclass;
1036 GetDeviceName( keyEvent, deviceName );
1037 GetDeviceClass( ecore_device_class_get( keyEvent->dev ), deviceClass );
1038 GetDeviceSubclass( ecore_device_subclass_get( keyEvent->dev ), deviceSubclass );
1040 Integration::KeyEvent keyEvent( keyName, keyString, keyCode, modifier, time, Integration::KeyEvent::Down, compose, deviceName, deviceClass, deviceSubclass );
1042 mKeyEventSignal.Emit( keyEvent );
1046 void WindowBaseEcoreWl2::OnKeyUp( void* data, int type, void* event )
1048 Ecore_Event_Key* keyEvent = static_cast< Ecore_Event_Key* >( event );
1050 if( keyEvent->window == static_cast< unsigned int >( ecore_wl2_window_id_get( mEcoreWindow ) ) )
1052 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl::OnKeyUp\n" );
1054 std::string keyName( keyEvent->keyname );
1055 std::string keyString( "" );
1056 std::string compose( "" );
1058 // Ensure key compose string is not NULL as keys like SHIFT or arrow have a null string.
1059 if( keyEvent->compose )
1061 compose = keyEvent->compose;
1064 int keyCode = KeyLookup::GetDaliKeyCode( keyEvent->keyname );
1065 keyCode = ( keyCode == -1 ) ? 0 : keyCode;
1066 int modifier( keyEvent->modifiers );
1067 unsigned long time = keyEvent->timestamp;
1068 if( !strncmp( keyEvent->keyname, "Keycode-", 8 ) )
1070 keyCode = atoi( keyEvent->keyname + 8 );
1073 // Ensure key event string is not NULL as keys like SHIFT have a null string.
1074 if( keyEvent->string )
1076 keyString = keyEvent->string;
1079 std::string deviceName;
1080 Device::Class::Type deviceClass;
1081 Device::Subclass::Type deviceSubclass;
1083 GetDeviceName( keyEvent, deviceName );
1084 GetDeviceClass( ecore_device_class_get( keyEvent->dev ), deviceClass );
1085 GetDeviceSubclass( ecore_device_subclass_get( keyEvent->dev ), deviceSubclass );
1087 Integration::KeyEvent keyEvent( keyName, keyString, keyCode, modifier, time, Integration::KeyEvent::Up, compose, deviceName, deviceClass, deviceSubclass );
1089 mKeyEventSignal.Emit( keyEvent );
1093 void WindowBaseEcoreWl2::OnDataSend( void* data, int type, void* event )
1095 mSelectionDataSendSignal.Emit( event );
1098 void WindowBaseEcoreWl2::OnDataReceive( void* data, int type, void* event )
1100 mSelectionDataReceivedSignal.Emit( event );
1103 void WindowBaseEcoreWl2::OnIndicatorFlicked( void* data, int type, void* event )
1105 mIndicatorFlickedSignal.Emit();
1108 void WindowBaseEcoreWl2::OnFontNameChanged()
1110 mStyleChangedSignal.Emit( StyleChange::DEFAULT_FONT_CHANGE );
1113 void WindowBaseEcoreWl2::OnFontSizeChanged()
1115 mStyleChangedSignal.Emit( StyleChange::DEFAULT_FONT_SIZE_CHANGE );
1118 void WindowBaseEcoreWl2::OnEcoreElDBusAccessibilityNotification( void* context, const Eldbus_Message* message )
1120 #ifdef DALI_ELDBUS_AVAILABLE
1121 AccessibilityInfo info;
1123 // The string defines the arg-list's respective types.
1124 if( !eldbus_message_arguments_get( message, "iiiiiiu", &info.gestureValue, &info.startX, &info.startY, &info.endX, &info.endY, &info.state, &info.eventTime ) )
1126 DALI_LOG_ERROR( "OnEcoreElDBusAccessibilityNotification: Error getting arguments\n" );
1129 mAccessibilitySignal.Emit( info );
1133 void WindowBaseEcoreWl2::RegistryGlobalCallback( void* data, struct wl_registry *registry, uint32_t name, const char* interface, uint32_t version )
1135 if( strcmp( interface, tizen_policy_interface.name ) == 0 )
1137 uint32_t clientVersion = std::min( version, MAX_TIZEN_CLIENT_VERSION );
1139 mTizenPolicy = static_cast< tizen_policy* >( wl_registry_bind( registry, name, &tizen_policy_interface, clientVersion ) );
1142 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::RegistryGlobalCallback: wl_registry_bind(tizen_policy_interface) is failed.\n" );
1146 tizen_policy_add_listener( mTizenPolicy, &tizenPolicyListener, data );
1148 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::RegistryGlobalCallback: tizen_policy_add_listener is called.\n" );
1150 else if( strcmp( interface, tizen_display_policy_interface.name ) == 0 )
1152 mTizenDisplayPolicy = static_cast< tizen_display_policy* >( wl_registry_bind( registry, name, &tizen_display_policy_interface, version ) );
1153 if( !mTizenDisplayPolicy )
1155 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::RegistryGlobalCallback: wl_registry_bind(tizen_display_policy_interface) is failed.\n" );
1159 tizen_display_policy_add_listener( mTizenDisplayPolicy, &tizenDisplayPolicyListener, data );
1161 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::RegistryGlobalCallback: tizen_display_policy_add_listener is called.\n" );
1165 void WindowBaseEcoreWl2::RegistryGlobalCallbackRemove( void* data, struct wl_registry* registry, uint32_t id )
1167 mTizenPolicy = NULL;
1168 mTizenDisplayPolicy = NULL;
1171 void WindowBaseEcoreWl2::TizenPolicyNotificationChangeDone(void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, int32_t level, uint32_t state )
1173 mNotificationLevel = level;
1174 mNotificationChangeState = state;
1175 mNotificationLevelChangeDone = true;
1177 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::TizenPolicyNotificationChangeDone: level = %d, state = %d\n", level, state );
1180 void WindowBaseEcoreWl2::TizenPolicyScreenModeChangeDone( void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, uint32_t mode, uint32_t state )
1182 mScreenOffMode = mode;
1183 mScreenOffModeChangeState = state;
1184 mScreenOffModeChangeDone = true;
1186 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::TizenPolicyScreenModeChangeDone: mode = %d, state = %d\n", mode, state );
1189 void WindowBaseEcoreWl2::DisplayPolicyBrightnessChangeDone( void* data, struct tizen_display_policy *displayPolicy, struct wl_surface* surface, int32_t brightness, uint32_t state )
1191 mBrightness = brightness;
1192 mBrightnessChangeState = state;
1193 mBrightnessChangeDone = true;
1195 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::DisplayPolicyBrightnessChangeDone: brightness = %d, state = %d\n", brightness, state );
1198 Any WindowBaseEcoreWl2::GetNativeWindow()
1200 return mEcoreWindow;
1203 int WindowBaseEcoreWl2::GetNativeWindowId()
1205 return ecore_wl2_window_id_get( mEcoreWindow );
1208 EGLNativeWindowType WindowBaseEcoreWl2::CreateEglWindow( int width, int height )
1210 mEglWindow = wl_egl_window_create( mWlSurface, width, height );
1212 return static_cast< EGLNativeWindowType >( mEglWindow );
1215 void WindowBaseEcoreWl2::DestroyEglWindow()
1217 if( mEglWindow != NULL )
1219 wl_egl_window_destroy( mEglWindow );
1224 void WindowBaseEcoreWl2::SetEglWindowRotation( int angle )
1226 wl_egl_window_rotation rotation;
1232 rotation = ROTATION_0;
1237 rotation = ROTATION_270;
1242 rotation = ROTATION_180;
1247 rotation = ROTATION_90;
1252 rotation = ROTATION_0;
1257 wl_egl_window_set_rotation( mEglWindow, rotation );
1260 void WindowBaseEcoreWl2::SetEglWindowBufferTransform( int angle )
1262 wl_output_transform bufferTransform;
1268 bufferTransform = WL_OUTPUT_TRANSFORM_NORMAL;
1273 bufferTransform = WL_OUTPUT_TRANSFORM_90;
1278 bufferTransform = WL_OUTPUT_TRANSFORM_180;
1283 bufferTransform = WL_OUTPUT_TRANSFORM_270;
1288 bufferTransform = WL_OUTPUT_TRANSFORM_NORMAL;
1293 wl_egl_window_set_buffer_transform( mEglWindow, bufferTransform );
1296 void WindowBaseEcoreWl2::SetEglWindowTransform( int angle )
1298 wl_output_transform windowTransform;
1304 windowTransform = WL_OUTPUT_TRANSFORM_NORMAL;
1309 windowTransform = WL_OUTPUT_TRANSFORM_90;
1314 windowTransform = WL_OUTPUT_TRANSFORM_180;
1319 windowTransform = WL_OUTPUT_TRANSFORM_270;
1324 windowTransform = WL_OUTPUT_TRANSFORM_NORMAL;
1329 wl_egl_window_set_window_transform( mEglWindow, windowTransform );
1332 void WindowBaseEcoreWl2::ResizeEglWindow( PositionSize positionSize )
1334 wl_egl_window_resize( mEglWindow, positionSize.width, positionSize.height, positionSize.x, positionSize.y );
1337 bool WindowBaseEcoreWl2::IsEglWindowRotationSupported()
1340 wl_egl_window_capability capability = static_cast< wl_egl_window_capability >( wl_egl_window_get_capabilities( mEglWindow ) );
1341 if( capability == WL_EGL_WINDOW_CAPABILITY_ROTATION_SUPPORTED )
1349 void WindowBaseEcoreWl2::Move( PositionSize positionSize )
1351 ecore_wl2_window_position_set( mEcoreWindow, positionSize.x, positionSize.y );
1354 void WindowBaseEcoreWl2::Resize( PositionSize positionSize )
1356 ecore_wl2_window_geometry_set( mEcoreWindow, positionSize.x, positionSize.y, positionSize.width, positionSize.height );
1359 void WindowBaseEcoreWl2::MoveResize( PositionSize positionSize )
1361 ecore_wl2_window_position_set( mEcoreWindow, positionSize.x, positionSize.y );
1362 ecore_wl2_window_geometry_set( mEcoreWindow, positionSize.x, positionSize.y, positionSize.width, positionSize.height );
1365 void WindowBaseEcoreWl2::ShowIndicator( Dali::Window::IndicatorVisibleMode visibleMode, Dali::Window::IndicatorBgOpacity opacityMode )
1367 DALI_LOG_TRACE_METHOD_FMT( gWindowBaseLogFilter, "visible : %d\n", visibleMode );
1369 if( visibleMode == Dali::Window::VISIBLE )
1371 // when the indicator is visible, set proper mode for indicator server according to bg mode
1372 if( opacityMode == Dali::Window::OPAQUE )
1374 ecore_wl2_window_indicator_opacity_set( mEcoreWindow, ECORE_WL2_INDICATOR_OPAQUE );
1376 else if( opacityMode == Dali::Window::TRANSLUCENT )
1378 ecore_wl2_window_indicator_opacity_set( mEcoreWindow, ECORE_WL2_INDICATOR_TRANSLUCENT );
1380 else if( opacityMode == Dali::Window::TRANSPARENT )
1382 ecore_wl2_window_indicator_opacity_set( mEcoreWindow, ECORE_WL2_INDICATOR_OPAQUE );
1387 // when the indicator is not visible, set TRANSPARENT mode for indicator server
1388 ecore_wl2_window_indicator_opacity_set( mEcoreWindow, ECORE_WL2_INDICATOR_TRANSPARENT); // it means hidden indicator
1392 void WindowBaseEcoreWl2::SetIndicatorProperties( bool isShow, Dali::Window::WindowOrientation lastOrientation )
1396 ecore_wl2_window_indicator_state_set( mEcoreWindow, ECORE_WL2_INDICATOR_STATE_ON );
1400 ecore_wl2_window_indicator_state_set( mEcoreWindow, ECORE_WL2_INDICATOR_STATE_OFF );
1404 void WindowBaseEcoreWl2::IndicatorTypeChanged( IndicatorInterface::Type type )
1406 #if defined(DALI_PROFILE_MOBILE)
1409 case IndicatorInterface::INDICATOR_TYPE_1:
1411 ecore_wl2_indicator_visible_type_set( mEcoreWindow, ECORE_WL2_INDICATOR_VISIBLE_TYPE_SHOWN );
1414 case IndicatorInterface::INDICATOR_TYPE_2:
1416 ecore_wl2_indicator_visible_type_set( mEcoreWindow, ECORE_WL2_INDICATOR_VISIBLE_TYPE_HIDDEN );
1419 case IndicatorInterface::INDICATOR_TYPE_UNKNOWN:
1428 void WindowBaseEcoreWl2::SetClass( const std::string& name, const std::string& className )
1430 ecore_wl2_window_title_set( mEcoreWindow, name.c_str() );
1431 ecore_wl2_window_class_set( mEcoreWindow, className.c_str() );
1434 void WindowBaseEcoreWl2::Raise()
1436 // Use ecore_wl2_window_activate to prevent the window shown without rendering
1437 ecore_wl2_window_activate( mEcoreWindow );
1440 void WindowBaseEcoreWl2::Lower()
1442 ecore_wl2_window_lower( mEcoreWindow );
1445 void WindowBaseEcoreWl2::Activate()
1447 ecore_wl2_window_activate( mEcoreWindow );
1450 void WindowBaseEcoreWl2::SetAvailableOrientations( const std::vector< Dali::Window::WindowOrientation >& orientations )
1452 int rotations[4] = { 0 };
1453 for( std::size_t i = 0; i < orientations.size(); ++i )
1455 rotations[i] = static_cast< int >( orientations[i] );
1457 ecore_wl2_window_available_rotations_set( mEcoreWindow, rotations, orientations.size() );
1460 void WindowBaseEcoreWl2::SetPreferredOrientation( Dali::Window::WindowOrientation orientation )
1462 ecore_wl2_window_preferred_rotation_set( mEcoreWindow, orientation );
1465 void WindowBaseEcoreWl2::SetAcceptFocus( bool accept )
1467 ecore_wl2_window_focus_skip_set( mEcoreWindow, !accept );
1470 void WindowBaseEcoreWl2::Show()
1472 ecore_wl2_window_show( mEcoreWindow );
1475 void WindowBaseEcoreWl2::Hide()
1477 ecore_wl2_window_hide( mEcoreWindow );
1480 unsigned int WindowBaseEcoreWl2::GetSupportedAuxiliaryHintCount() const
1482 return mSupportedAuxiliaryHints.size();
1485 std::string WindowBaseEcoreWl2::GetSupportedAuxiliaryHint( unsigned int index ) const
1487 if( index >= GetSupportedAuxiliaryHintCount() )
1489 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetSupportedAuxiliaryHint: Invalid index! [%d]\n", index );
1492 return mSupportedAuxiliaryHints[index];
1495 unsigned int WindowBaseEcoreWl2::AddAuxiliaryHint( const std::string& hint, const std::string& value )
1497 bool supported = false;
1499 // Check if the hint is suppported
1500 for( std::vector< std::string >::iterator iter = mSupportedAuxiliaryHints.begin(); iter != mSupportedAuxiliaryHints.end(); ++iter )
1511 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Concise, "WindowBaseEcoreWl2::AddAuxiliaryHint: Not supported auxiliary hint [%s]\n", hint.c_str() );
1515 // Check if the hint is already added
1516 for( unsigned int i = 0; i < mAuxiliaryHints.size(); i++ )
1518 if( mAuxiliaryHints[i].first == hint )
1520 // Just change the value
1521 mAuxiliaryHints[i].second = value;
1523 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::AddAuxiliaryHint: Change! hint = %s, value = %s, id = %d\n", hint.c_str(), value.c_str(), i + 1 );
1525 return i + 1; // id is index + 1
1530 mAuxiliaryHints.push_back( std::pair< std::string, std::string >( hint, value ) );
1532 unsigned int id = mAuxiliaryHints.size();
1534 ecore_wl2_window_aux_hint_add( mEcoreWindow, static_cast< int >( id ), hint.c_str(), value.c_str() );
1536 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::AddAuxiliaryHint: hint = %s, value = %s, id = %d\n", hint.c_str(), value.c_str(), id );
1541 bool WindowBaseEcoreWl2::RemoveAuxiliaryHint( unsigned int id )
1543 if( id == 0 || id > mAuxiliaryHints.size() )
1545 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Concise, "WindowBaseEcoreWl2::RemoveAuxiliaryHint: Invalid id [%d]\n", id );
1549 mAuxiliaryHints[id - 1].second = std::string();
1551 ecore_wl2_window_aux_hint_del( mEcoreWindow, static_cast< int >( id ) );
1553 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::RemoveAuxiliaryHint: id = %d, hint = %s\n", id, mAuxiliaryHints[id - 1].first.c_str() );
1558 bool WindowBaseEcoreWl2::SetAuxiliaryHintValue( unsigned int id, const std::string& value )
1560 if( id == 0 || id > mAuxiliaryHints.size() )
1562 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Concise, "WindowBaseEcoreWl2::SetAuxiliaryHintValue: Invalid id [%d]\n", id );
1566 mAuxiliaryHints[id - 1].second = value;
1568 ecore_wl2_window_aux_hint_change( mEcoreWindow, static_cast< int >( id ), value.c_str() );
1570 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() );
1575 std::string WindowBaseEcoreWl2::GetAuxiliaryHintValue( unsigned int id ) const
1577 if( id == 0 || id > mAuxiliaryHints.size() )
1579 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Concise, "WindowBaseEcoreWl2::GetAuxiliaryHintValue: Invalid id [%d]\n", id );
1580 return std::string();
1583 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() );
1585 return mAuxiliaryHints[id - 1].second;
1588 unsigned int WindowBaseEcoreWl2::GetAuxiliaryHintId( const std::string& hint ) const
1590 for( unsigned int i = 0; i < mAuxiliaryHints.size(); i++ )
1592 if( mAuxiliaryHints[i].first == hint )
1594 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetAuxiliaryHintId: hint = %s, id = %d\n", hint.c_str(), i + 1 );
1599 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetAuxiliaryHintId: Invalid hint! [%s]\n", hint.c_str() );
1604 void WindowBaseEcoreWl2::SetInputRegion( const Rect< int >& inputRegion )
1606 ecore_wl2_window_input_region_set( mEcoreWindow, inputRegion.x, inputRegion.y, inputRegion.width, inputRegion.height );
1609 void WindowBaseEcoreWl2::SetType( Dali::Window::Type type )
1611 Ecore_Wl2_Window_Type windowType;
1615 case Dali::Window::NORMAL:
1617 windowType = ECORE_WL2_WINDOW_TYPE_TOPLEVEL;
1620 case Dali::Window::NOTIFICATION:
1622 windowType = ECORE_WL2_WINDOW_TYPE_NOTIFICATION;
1625 case Dali::Window::UTILITY:
1627 windowType = ECORE_WL2_WINDOW_TYPE_UTILITY;
1630 case Dali::Window::DIALOG:
1632 windowType = ECORE_WL2_WINDOW_TYPE_DIALOG;
1637 windowType = ECORE_WL2_WINDOW_TYPE_TOPLEVEL;
1642 ecore_wl2_window_type_set( mEcoreWindow, windowType );
1645 bool WindowBaseEcoreWl2::SetNotificationLevel( Dali::Window::NotificationLevel::Type level )
1647 while( !mTizenPolicy )
1649 wl_display_dispatch_queue( mDisplay, mEventQueue );
1652 int notificationLevel;
1656 case Dali::Window::NotificationLevel::NONE:
1658 notificationLevel = TIZEN_POLICY_LEVEL_NONE;
1661 case Dali::Window::NotificationLevel::BASE:
1663 notificationLevel = TIZEN_POLICY_LEVEL_DEFAULT;
1666 case Dali::Window::NotificationLevel::MEDIUM:
1668 notificationLevel = TIZEN_POLICY_LEVEL_MEDIUM;
1671 case Dali::Window::NotificationLevel::HIGH:
1673 notificationLevel = TIZEN_POLICY_LEVEL_HIGH;
1676 case Dali::Window::NotificationLevel::TOP:
1678 notificationLevel = TIZEN_POLICY_LEVEL_TOP;
1683 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetNotificationLevel: invalid level [%d]\n", level );
1684 notificationLevel = TIZEN_POLICY_LEVEL_DEFAULT;
1689 mNotificationLevelChangeDone = false;
1690 mNotificationChangeState = TIZEN_POLICY_ERROR_STATE_NONE;
1692 tizen_policy_set_notification_level( mTizenPolicy, ecore_wl2_window_surface_get( mEcoreWindow ), notificationLevel );
1696 while( !mNotificationLevelChangeDone && count < 3 )
1698 ecore_wl2_display_flush( ecore_wl2_connected_display_get( NULL ) );
1699 wl_display_dispatch_queue( mDisplay, mEventQueue );
1703 if( !mNotificationLevelChangeDone )
1705 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetNotificationLevel: Level change is failed [%d, %d]\n", level, mNotificationChangeState );
1708 else if( mNotificationChangeState == TIZEN_POLICY_ERROR_STATE_PERMISSION_DENIED )
1710 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetNotificationLevel: Permission denied! [%d]\n", level );
1714 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetNotificationLevel: Level is changed [%d]\n", mNotificationLevel );
1719 Dali::Window::NotificationLevel::Type WindowBaseEcoreWl2::GetNotificationLevel() const
1721 while( !mTizenPolicy )
1723 wl_display_dispatch_queue( mDisplay, mEventQueue );
1728 while( !mNotificationLevelChangeDone && count < 3 )
1730 ecore_wl2_display_flush( ecore_wl2_connected_display_get( NULL ) );
1731 wl_display_dispatch_queue( mDisplay, mEventQueue );
1735 if( !mNotificationLevelChangeDone )
1737 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetNotificationLevel: Error! [%d]\n", mNotificationChangeState );
1738 return Dali::Window::NotificationLevel::NONE;
1741 Dali::Window::NotificationLevel::Type level;
1743 switch( mNotificationLevel )
1745 case TIZEN_POLICY_LEVEL_NONE:
1747 level = Dali::Window::NotificationLevel::NONE;
1750 case TIZEN_POLICY_LEVEL_DEFAULT:
1752 level = Dali::Window::NotificationLevel::BASE;
1755 case TIZEN_POLICY_LEVEL_MEDIUM:
1757 level = Dali::Window::NotificationLevel::MEDIUM;
1760 case TIZEN_POLICY_LEVEL_HIGH:
1762 level = Dali::Window::NotificationLevel::HIGH;
1765 case TIZEN_POLICY_LEVEL_TOP:
1767 level = Dali::Window::NotificationLevel::TOP;
1772 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetNotificationLevel: invalid level [%d]\n", mNotificationLevel );
1773 level = Dali::Window::NotificationLevel::NONE;
1778 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetNotificationLevel: level [%d]\n", mNotificationLevel );
1783 void WindowBaseEcoreWl2::SetOpaqueState( bool opaque )
1785 while( !mTizenPolicy )
1787 wl_display_dispatch_queue( mDisplay, mEventQueue );
1790 tizen_policy_set_opaque_state( mTizenPolicy, ecore_wl2_window_surface_get( mEcoreWindow ), ( opaque ? 1 : 0 ) );
1793 bool WindowBaseEcoreWl2::SetScreenOffMode(Dali::Window::ScreenOffMode::Type screenOffMode)
1795 while( !mTizenPolicy )
1797 wl_display_dispatch_queue( mDisplay, mEventQueue );
1800 mScreenOffModeChangeDone = false;
1801 mScreenOffModeChangeState = TIZEN_POLICY_ERROR_STATE_NONE;
1803 unsigned int mode = 0;
1805 switch( screenOffMode )
1807 case Dali::Window::ScreenOffMode::TIMEOUT:
1812 case Dali::Window::ScreenOffMode::NEVER:
1819 tizen_policy_set_window_screen_mode( mTizenPolicy, ecore_wl2_window_surface_get( mEcoreWindow ), mode );
1823 while( !mScreenOffModeChangeDone && count < 3 )
1825 ecore_wl2_display_flush( ecore_wl2_connected_display_get( NULL ) );
1826 wl_display_dispatch_queue( mDisplay, mEventQueue );
1830 if( !mScreenOffModeChangeDone )
1832 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetScreenOffMode: Screen mode change is failed [%d, %d]\n", screenOffMode, mScreenOffModeChangeState );
1835 else if( mScreenOffModeChangeState == TIZEN_POLICY_ERROR_STATE_PERMISSION_DENIED )
1837 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetScreenOffMode: Permission denied! [%d]\n", screenOffMode );
1841 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetScreenOffMode: Screen mode is changed [%d]\n", mScreenOffMode );
1846 Dali::Window::ScreenOffMode::Type WindowBaseEcoreWl2::GetScreenOffMode() const
1848 while( !mTizenPolicy )
1850 wl_display_dispatch_queue( mDisplay, mEventQueue );
1855 while( !mScreenOffModeChangeDone && count < 3 )
1857 ecore_wl2_display_flush( ecore_wl2_connected_display_get( NULL ) );
1858 wl_display_dispatch_queue( mDisplay, mEventQueue );
1862 if( !mScreenOffModeChangeDone )
1864 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetScreenOffMode: Error! [%d]\n", mScreenOffModeChangeState );
1865 return Dali::Window::ScreenOffMode::TIMEOUT;
1868 Dali::Window::ScreenOffMode::Type screenMode = Dali::Window::ScreenOffMode::TIMEOUT;
1870 switch( mScreenOffMode )
1874 screenMode = Dali::Window::ScreenOffMode::TIMEOUT;
1879 screenMode = Dali::Window::ScreenOffMode::NEVER;
1884 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetScreenOffMode: screen mode [%d]\n", mScreenOffMode );
1889 bool WindowBaseEcoreWl2::SetBrightness( int brightness )
1891 while( !mTizenDisplayPolicy )
1893 wl_display_dispatch_queue( mDisplay, mEventQueue );
1896 mBrightnessChangeDone = false;
1897 mBrightnessChangeState = TIZEN_POLICY_ERROR_STATE_NONE;
1899 tizen_display_policy_set_window_brightness( mTizenDisplayPolicy, ecore_wl2_window_surface_get( mEcoreWindow ), brightness );
1903 while( !mBrightnessChangeDone && count < 3 )
1905 ecore_wl2_display_flush( ecore_wl2_connected_display_get( NULL ) );
1906 wl_display_dispatch_queue( mDisplay, mEventQueue );
1910 if( !mBrightnessChangeDone )
1912 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetBrightness: Brightness change is failed [%d, %d]\n", brightness, mBrightnessChangeState );
1915 else if( mBrightnessChangeState == TIZEN_POLICY_ERROR_STATE_PERMISSION_DENIED )
1917 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetBrightness: Permission denied! [%d]\n", brightness );
1921 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetBrightness: Brightness is changed [%d]\n", mBrightness );
1926 int WindowBaseEcoreWl2::GetBrightness() const
1928 while( !mTizenDisplayPolicy )
1930 wl_display_dispatch_queue( mDisplay, mEventQueue );
1935 while( !mBrightnessChangeDone && count < 3 )
1937 ecore_wl2_display_flush( ecore_wl2_connected_display_get( NULL ) );
1938 wl_display_dispatch_queue( mDisplay, mEventQueue );
1942 if( !mBrightnessChangeDone )
1944 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetBrightness: Error! [%d]\n", mBrightnessChangeState );
1948 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetBrightness: Brightness [%d]\n", mBrightness );
1953 bool WindowBaseEcoreWl2::GrabKey( Dali::KEY key, KeyGrab::KeyGrabMode grabMode )
1955 Ecore_Wl2_Window_Keygrab_Mode mode;
1959 case KeyGrab::TOPMOST:
1961 mode = ECORE_WL2_WINDOW_KEYGRAB_TOPMOST;
1964 case KeyGrab::SHARED:
1966 mode = ECORE_WL2_WINDOW_KEYGRAB_SHARED;
1969 case KeyGrab::OVERRIDE_EXCLUSIVE:
1971 mode = ECORE_WL2_WINDOW_KEYGRAB_OVERRIDE_EXCLUSIVE;
1974 case KeyGrab::EXCLUSIVE:
1976 mode = ECORE_WL2_WINDOW_KEYGRAB_EXCLUSIVE;
1985 return ecore_wl2_window_keygrab_set( mEcoreWindow, KeyLookup::GetKeyName( key ), 0, 0, 0, mode );
1988 bool WindowBaseEcoreWl2::UngrabKey( Dali::KEY key )
1990 return ecore_wl2_window_keygrab_unset( mEcoreWindow, KeyLookup::GetKeyName( key ), 0, 0 );
1993 bool WindowBaseEcoreWl2::GrabKeyList( const Dali::Vector< Dali::KEY >& key, const Dali::Vector< KeyGrab::KeyGrabMode >& grabMode, Dali::Vector< bool >& result )
1995 int keyCount = key.Count();
1996 int keyGrabModeCount = grabMode.Count();
1998 if( keyCount != keyGrabModeCount || keyCount == 0 )
2005 Eina_List* keyList = NULL;
2006 Ecore_Wl2_Window_Keygrab_Info* info = new Ecore_Wl2_Window_Keygrab_Info[keyCount];
2008 for( int index = 0; index < keyCount; ++index )
2010 info[index].key = const_cast< char* >( KeyLookup::GetKeyName( key[index] ) );
2012 switch( grabMode[index] )
2014 case KeyGrab::TOPMOST:
2016 info[index].mode = ECORE_WL2_WINDOW_KEYGRAB_TOPMOST;
2019 case KeyGrab::SHARED:
2021 info[index].mode = ECORE_WL2_WINDOW_KEYGRAB_SHARED;
2024 case KeyGrab::OVERRIDE_EXCLUSIVE:
2026 info[index].mode = ECORE_WL2_WINDOW_KEYGRAB_OVERRIDE_EXCLUSIVE;
2029 case KeyGrab::EXCLUSIVE:
2031 info[index].mode = ECORE_WL2_WINDOW_KEYGRAB_EXCLUSIVE;
2036 info[index].mode = ECORE_WL2_WINDOW_KEYGRAB_UNKNOWN;
2041 keyList = eina_list_append( keyList, &info );
2044 Eina_List* grabList = ecore_wl2_window_keygrab_list_set( mEcoreWindow, keyList );
2046 result.Resize( keyCount, true );
2048 Eina_List* l = NULL;
2049 Eina_List* m = NULL;
2050 void* listData = NULL;
2052 if( grabList != NULL )
2054 EINA_LIST_FOREACH( grabList, m, data )
2057 EINA_LIST_FOREACH( keyList, l, listData )
2059 if( static_cast< Ecore_Wl2_Window_Keygrab_Info* >( listData )->key == NULL )
2061 DALI_LOG_ERROR( "input key list has null data!" );
2065 if( strcmp( static_cast< char* >( data ), static_cast< Ecore_Wl2_Window_Keygrab_Info* >( listData )->key ) == 0 )
2067 result[index] = false;
2076 eina_list_free( keyList );
2077 eina_list_free( grabList );
2083 bool WindowBaseEcoreWl2::UngrabKeyList( const Dali::Vector< Dali::KEY >& key, Dali::Vector< bool >& result )
2085 int keyCount = key.Count();
2093 Eina_List* keyList = NULL;
2094 Ecore_Wl2_Window_Keygrab_Info* info = new Ecore_Wl2_Window_Keygrab_Info[keyCount];
2096 for( int index = 0; index < keyCount; ++index )
2098 info[index].key = const_cast< char* >( KeyLookup::GetKeyName( key[index] ) );
2099 keyList = eina_list_append( keyList, &info );
2102 Eina_List* ungrabList = ecore_wl2_window_keygrab_list_unset( mEcoreWindow, keyList );
2104 result.Resize( keyCount, true );
2106 Eina_List* l = NULL;
2107 Eina_List* m = NULL;
2108 void *listData = NULL;
2111 if( ungrabList != NULL )
2113 EINA_LIST_FOREACH( ungrabList, m, data )
2116 EINA_LIST_FOREACH( keyList, l, listData )
2118 if( strcmp( static_cast< char* >( data ), static_cast< Ecore_Wl2_Window_Keygrab_Info* >( listData )->key ) == 0 )
2120 result[index] = false;
2129 eina_list_free( keyList );
2130 eina_list_free( ungrabList );
2136 void WindowBaseEcoreWl2::GetDpi( unsigned int& dpiHorizontal, unsigned int& dpiVertical )
2141 Ecore_Wl2_Output* output = ecore_wl2_window_output_find( mEcoreWindow );
2143 // 1 inch = 25.4 millimeters
2144 xres = ecore_wl2_output_dpi_get( output );
2145 yres = ecore_wl2_output_dpi_get( output );
2147 dpiHorizontal = int( xres + 0.5f ); // rounding
2148 dpiVertical = int( yres + 0.5f );
2151 int WindowBaseEcoreWl2::GetScreenRotationAngle()
2155 if( ecore_wl2_window_ignore_output_transform_get( mEcoreWindow ) )
2161 transform = ecore_wl2_output_transform_get( ecore_wl2_window_output_find( mEcoreWindow ) );
2164 return transform * 90;
2167 void WindowBaseEcoreWl2::SetWindowRotationAngle( int degree )
2169 ecore_wl2_window_rotation_set( mEcoreWindow, degree );
2172 void WindowBaseEcoreWl2::WindowRotationCompleted( int degree, int width, int height )
2174 ecore_wl2_window_rotation_change_done_send( mEcoreWindow, degree, width, height );
2177 void WindowBaseEcoreWl2::SetTransparency( bool transparent )
2179 ecore_wl2_window_alpha_set( mEcoreWindow, transparent );
2182 void WindowBaseEcoreWl2::InitializeEcoreElDBus()
2184 #ifdef DALI_ELDBUS_AVAILABLE
2185 Eldbus_Object* object;
2186 Eldbus_Proxy* manager;
2188 if( !( mSystemConnection = eldbus_connection_get( ELDBUS_CONNECTION_TYPE_SYSTEM ) ) )
2190 DALI_LOG_ERROR( "Unable to get system bus\n" );
2193 object = eldbus_object_get( mSystemConnection, BUS, PATH );
2196 DALI_LOG_ERROR( "Getting object failed\n" );
2200 manager = eldbus_proxy_get( object, INTERFACE );
2203 DALI_LOG_ERROR( "Getting proxy failed\n" );
2207 if( !eldbus_proxy_signal_handler_add( manager, "GestureDetected", EcoreElDBusAccessibilityNotification, this ) )
2209 DALI_LOG_ERROR( "No signal handler returned\n" );
2214 void WindowBaseEcoreWl2::CreateWindow( PositionSize positionSize )
2216 Ecore_Wl2_Display* display = ecore_wl2_display_connect( NULL );
2219 DALI_ASSERT_ALWAYS( 0 && "Failed to get display" );
2222 mEcoreWindow = ecore_wl2_window_new( display, NULL, positionSize.x, positionSize.y, positionSize.width, positionSize.height );
2224 if ( mEcoreWindow == 0 )
2226 DALI_ASSERT_ALWAYS( 0 && "Failed to create Wayland window" );
2230 ecore_wl2_window_type_set( mEcoreWindow, ECORE_WL2_WINDOW_TYPE_TOPLEVEL );
2233 } // namespace Adaptor
2235 } // namespace Internal
2239 #pragma GCC diagnostic pop