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_geometry_set( mEcoreWindow, positionSize.x, positionSize.y, positionSize.width, positionSize.height );
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_geometry_set( mEcoreWindow, positionSize.x, positionSize.y, positionSize.width, positionSize.height );
1364 void WindowBaseEcoreWl2::ShowIndicator( Dali::Window::IndicatorVisibleMode visibleMode, Dali::Window::IndicatorBgOpacity opacityMode )
1366 DALI_LOG_TRACE_METHOD_FMT( gWindowBaseLogFilter, "visible : %d\n", visibleMode );
1368 if( visibleMode == Dali::Window::VISIBLE )
1370 // when the indicator is visible, set proper mode for indicator server according to bg mode
1371 if( opacityMode == Dali::Window::OPAQUE )
1373 ecore_wl2_window_indicator_opacity_set( mEcoreWindow, ECORE_WL2_INDICATOR_OPAQUE );
1375 else if( opacityMode == Dali::Window::TRANSLUCENT )
1377 ecore_wl2_window_indicator_opacity_set( mEcoreWindow, ECORE_WL2_INDICATOR_TRANSLUCENT );
1379 else if( opacityMode == Dali::Window::TRANSPARENT )
1381 ecore_wl2_window_indicator_opacity_set( mEcoreWindow, ECORE_WL2_INDICATOR_OPAQUE );
1386 // when the indicator is not visible, set TRANSPARENT mode for indicator server
1387 ecore_wl2_window_indicator_opacity_set( mEcoreWindow, ECORE_WL2_INDICATOR_TRANSPARENT); // it means hidden indicator
1391 void WindowBaseEcoreWl2::SetIndicatorProperties( bool isShow, Dali::Window::WindowOrientation lastOrientation )
1395 ecore_wl2_window_indicator_state_set( mEcoreWindow, ECORE_WL2_INDICATOR_STATE_ON );
1399 ecore_wl2_window_indicator_state_set( mEcoreWindow, ECORE_WL2_INDICATOR_STATE_OFF );
1403 void WindowBaseEcoreWl2::IndicatorTypeChanged( IndicatorInterface::Type type )
1405 #if defined(DALI_PROFILE_MOBILE)
1408 case IndicatorInterface::INDICATOR_TYPE_1:
1410 ecore_wl2_indicator_visible_type_set( mEcoreWindow, ECORE_WL2_INDICATOR_VISIBLE_TYPE_SHOWN );
1413 case IndicatorInterface::INDICATOR_TYPE_2:
1415 ecore_wl2_indicator_visible_type_set( mEcoreWindow, ECORE_WL2_INDICATOR_VISIBLE_TYPE_HIDDEN );
1418 case IndicatorInterface::INDICATOR_TYPE_UNKNOWN:
1427 void WindowBaseEcoreWl2::SetClass( const std::string& name, const std::string& className )
1429 ecore_wl2_window_title_set( mEcoreWindow, name.c_str() );
1430 ecore_wl2_window_class_set( mEcoreWindow, className.c_str() );
1433 void WindowBaseEcoreWl2::Raise()
1435 // Use ecore_wl2_window_activate to prevent the window shown without rendering
1436 ecore_wl2_window_activate( mEcoreWindow );
1439 void WindowBaseEcoreWl2::Lower()
1441 ecore_wl2_window_lower( mEcoreWindow );
1444 void WindowBaseEcoreWl2::Activate()
1446 ecore_wl2_window_activate( mEcoreWindow );
1449 void WindowBaseEcoreWl2::SetAvailableOrientations( const std::vector< Dali::Window::WindowOrientation >& orientations )
1451 int rotations[4] = { 0 };
1452 for( std::size_t i = 0; i < orientations.size(); ++i )
1454 rotations[i] = static_cast< int >( orientations[i] );
1456 ecore_wl2_window_available_rotations_set( mEcoreWindow, rotations, orientations.size() );
1459 void WindowBaseEcoreWl2::SetPreferredOrientation( Dali::Window::WindowOrientation orientation )
1461 ecore_wl2_window_preferred_rotation_set( mEcoreWindow, orientation );
1464 void WindowBaseEcoreWl2::SetAcceptFocus( bool accept )
1466 ecore_wl2_window_focus_skip_set( mEcoreWindow, !accept );
1469 void WindowBaseEcoreWl2::Show()
1471 ecore_wl2_window_show( mEcoreWindow );
1474 void WindowBaseEcoreWl2::Hide()
1476 ecore_wl2_window_hide( mEcoreWindow );
1479 unsigned int WindowBaseEcoreWl2::GetSupportedAuxiliaryHintCount() const
1481 return mSupportedAuxiliaryHints.size();
1484 std::string WindowBaseEcoreWl2::GetSupportedAuxiliaryHint( unsigned int index ) const
1486 if( index >= GetSupportedAuxiliaryHintCount() )
1488 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetSupportedAuxiliaryHint: Invalid index! [%d]\n", index );
1491 return mSupportedAuxiliaryHints[index];
1494 unsigned int WindowBaseEcoreWl2::AddAuxiliaryHint( const std::string& hint, const std::string& value )
1496 bool supported = false;
1498 // Check if the hint is suppported
1499 for( std::vector< std::string >::iterator iter = mSupportedAuxiliaryHints.begin(); iter != mSupportedAuxiliaryHints.end(); ++iter )
1510 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Concise, "WindowBaseEcoreWl2::AddAuxiliaryHint: Not supported auxiliary hint [%s]\n", hint.c_str() );
1514 // Check if the hint is already added
1515 for( unsigned int i = 0; i < mAuxiliaryHints.size(); i++ )
1517 if( mAuxiliaryHints[i].first == hint )
1519 // Just change the value
1520 mAuxiliaryHints[i].second = value;
1522 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::AddAuxiliaryHint: Change! hint = %s, value = %s, id = %d\n", hint.c_str(), value.c_str(), i + 1 );
1524 return i + 1; // id is index + 1
1529 mAuxiliaryHints.push_back( std::pair< std::string, std::string >( hint, value ) );
1531 unsigned int id = mAuxiliaryHints.size();
1533 ecore_wl2_window_aux_hint_add( mEcoreWindow, static_cast< int >( id ), hint.c_str(), value.c_str() );
1535 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::AddAuxiliaryHint: hint = %s, value = %s, id = %d\n", hint.c_str(), value.c_str(), id );
1540 bool WindowBaseEcoreWl2::RemoveAuxiliaryHint( unsigned int id )
1542 if( id == 0 || id > mAuxiliaryHints.size() )
1544 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Concise, "WindowBaseEcoreWl2::RemoveAuxiliaryHint: Invalid id [%d]\n", id );
1548 mAuxiliaryHints[id - 1].second = std::string();
1550 ecore_wl2_window_aux_hint_del( mEcoreWindow, static_cast< int >( id ) );
1552 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::RemoveAuxiliaryHint: id = %d, hint = %s\n", id, mAuxiliaryHints[id - 1].first.c_str() );
1557 bool WindowBaseEcoreWl2::SetAuxiliaryHintValue( unsigned int id, const std::string& value )
1559 if( id == 0 || id > mAuxiliaryHints.size() )
1561 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Concise, "WindowBaseEcoreWl2::SetAuxiliaryHintValue: Invalid id [%d]\n", id );
1565 mAuxiliaryHints[id - 1].second = value;
1567 ecore_wl2_window_aux_hint_change( mEcoreWindow, static_cast< int >( id ), value.c_str() );
1569 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() );
1574 std::string WindowBaseEcoreWl2::GetAuxiliaryHintValue( unsigned int id ) const
1576 if( id == 0 || id > mAuxiliaryHints.size() )
1578 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Concise, "WindowBaseEcoreWl2::GetAuxiliaryHintValue: Invalid id [%d]\n", id );
1579 return std::string();
1582 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() );
1584 return mAuxiliaryHints[id - 1].second;
1587 unsigned int WindowBaseEcoreWl2::GetAuxiliaryHintId( const std::string& hint ) const
1589 for( unsigned int i = 0; i < mAuxiliaryHints.size(); i++ )
1591 if( mAuxiliaryHints[i].first == hint )
1593 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetAuxiliaryHintId: hint = %s, id = %d\n", hint.c_str(), i + 1 );
1598 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetAuxiliaryHintId: Invalid hint! [%s]\n", hint.c_str() );
1603 void WindowBaseEcoreWl2::SetInputRegion( const Rect< int >& inputRegion )
1605 ecore_wl2_window_input_region_set( mEcoreWindow, inputRegion.x, inputRegion.y, inputRegion.width, inputRegion.height );
1608 void WindowBaseEcoreWl2::SetType( Dali::Window::Type type )
1610 Ecore_Wl2_Window_Type windowType;
1614 case Dali::Window::NORMAL:
1616 windowType = ECORE_WL2_WINDOW_TYPE_TOPLEVEL;
1619 case Dali::Window::NOTIFICATION:
1621 windowType = ECORE_WL2_WINDOW_TYPE_NOTIFICATION;
1624 case Dali::Window::UTILITY:
1626 windowType = ECORE_WL2_WINDOW_TYPE_UTILITY;
1629 case Dali::Window::DIALOG:
1631 windowType = ECORE_WL2_WINDOW_TYPE_DIALOG;
1636 windowType = ECORE_WL2_WINDOW_TYPE_TOPLEVEL;
1641 ecore_wl2_window_type_set( mEcoreWindow, windowType );
1644 bool WindowBaseEcoreWl2::SetNotificationLevel( Dali::Window::NotificationLevel::Type level )
1646 while( !mTizenPolicy )
1648 wl_display_dispatch_queue( mDisplay, mEventQueue );
1651 int notificationLevel;
1655 case Dali::Window::NotificationLevel::NONE:
1657 notificationLevel = TIZEN_POLICY_LEVEL_NONE;
1660 case Dali::Window::NotificationLevel::BASE:
1662 notificationLevel = TIZEN_POLICY_LEVEL_DEFAULT;
1665 case Dali::Window::NotificationLevel::MEDIUM:
1667 notificationLevel = TIZEN_POLICY_LEVEL_MEDIUM;
1670 case Dali::Window::NotificationLevel::HIGH:
1672 notificationLevel = TIZEN_POLICY_LEVEL_HIGH;
1675 case Dali::Window::NotificationLevel::TOP:
1677 notificationLevel = TIZEN_POLICY_LEVEL_TOP;
1682 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetNotificationLevel: invalid level [%d]\n", level );
1683 notificationLevel = TIZEN_POLICY_LEVEL_DEFAULT;
1688 mNotificationLevelChangeDone = false;
1689 mNotificationChangeState = TIZEN_POLICY_ERROR_STATE_NONE;
1691 tizen_policy_set_notification_level( mTizenPolicy, ecore_wl2_window_surface_get( mEcoreWindow ), notificationLevel );
1695 while( !mNotificationLevelChangeDone && count < 3 )
1697 ecore_wl2_display_flush( ecore_wl2_connected_display_get( NULL ) );
1698 wl_display_dispatch_queue( mDisplay, mEventQueue );
1702 if( !mNotificationLevelChangeDone )
1704 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetNotificationLevel: Level change is failed [%d, %d]\n", level, mNotificationChangeState );
1707 else if( mNotificationChangeState == TIZEN_POLICY_ERROR_STATE_PERMISSION_DENIED )
1709 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetNotificationLevel: Permission denied! [%d]\n", level );
1713 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetNotificationLevel: Level is changed [%d]\n", mNotificationLevel );
1718 Dali::Window::NotificationLevel::Type WindowBaseEcoreWl2::GetNotificationLevel() const
1720 while( !mTizenPolicy )
1722 wl_display_dispatch_queue( mDisplay, mEventQueue );
1727 while( !mNotificationLevelChangeDone && count < 3 )
1729 ecore_wl2_display_flush( ecore_wl2_connected_display_get( NULL ) );
1730 wl_display_dispatch_queue( mDisplay, mEventQueue );
1734 if( !mNotificationLevelChangeDone )
1736 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetNotificationLevel: Error! [%d]\n", mNotificationChangeState );
1737 return Dali::Window::NotificationLevel::NONE;
1740 Dali::Window::NotificationLevel::Type level;
1742 switch( mNotificationLevel )
1744 case TIZEN_POLICY_LEVEL_NONE:
1746 level = Dali::Window::NotificationLevel::NONE;
1749 case TIZEN_POLICY_LEVEL_DEFAULT:
1751 level = Dali::Window::NotificationLevel::BASE;
1754 case TIZEN_POLICY_LEVEL_MEDIUM:
1756 level = Dali::Window::NotificationLevel::MEDIUM;
1759 case TIZEN_POLICY_LEVEL_HIGH:
1761 level = Dali::Window::NotificationLevel::HIGH;
1764 case TIZEN_POLICY_LEVEL_TOP:
1766 level = Dali::Window::NotificationLevel::TOP;
1771 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetNotificationLevel: invalid level [%d]\n", mNotificationLevel );
1772 level = Dali::Window::NotificationLevel::NONE;
1777 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetNotificationLevel: level [%d]\n", mNotificationLevel );
1782 void WindowBaseEcoreWl2::SetOpaqueState( bool opaque )
1784 while( !mTizenPolicy )
1786 wl_display_dispatch_queue( mDisplay, mEventQueue );
1789 tizen_policy_set_opaque_state( mTizenPolicy, ecore_wl2_window_surface_get( mEcoreWindow ), ( opaque ? 1 : 0 ) );
1792 bool WindowBaseEcoreWl2::SetScreenOffMode(Dali::Window::ScreenOffMode::Type screenOffMode)
1794 while( !mTizenPolicy )
1796 wl_display_dispatch_queue( mDisplay, mEventQueue );
1799 mScreenOffModeChangeDone = false;
1800 mScreenOffModeChangeState = TIZEN_POLICY_ERROR_STATE_NONE;
1802 unsigned int mode = 0;
1804 switch( screenOffMode )
1806 case Dali::Window::ScreenOffMode::TIMEOUT:
1811 case Dali::Window::ScreenOffMode::NEVER:
1818 tizen_policy_set_window_screen_mode( mTizenPolicy, ecore_wl2_window_surface_get( mEcoreWindow ), mode );
1822 while( !mScreenOffModeChangeDone && count < 3 )
1824 ecore_wl2_display_flush( ecore_wl2_connected_display_get( NULL ) );
1825 wl_display_dispatch_queue( mDisplay, mEventQueue );
1829 if( !mScreenOffModeChangeDone )
1831 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetScreenOffMode: Screen mode change is failed [%d, %d]\n", screenOffMode, mScreenOffModeChangeState );
1834 else if( mScreenOffModeChangeState == TIZEN_POLICY_ERROR_STATE_PERMISSION_DENIED )
1836 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetScreenOffMode: Permission denied! [%d]\n", screenOffMode );
1840 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetScreenOffMode: Screen mode is changed [%d]\n", mScreenOffMode );
1845 Dali::Window::ScreenOffMode::Type WindowBaseEcoreWl2::GetScreenOffMode() const
1847 while( !mTizenPolicy )
1849 wl_display_dispatch_queue( mDisplay, mEventQueue );
1854 while( !mScreenOffModeChangeDone && count < 3 )
1856 ecore_wl2_display_flush( ecore_wl2_connected_display_get( NULL ) );
1857 wl_display_dispatch_queue( mDisplay, mEventQueue );
1861 if( !mScreenOffModeChangeDone )
1863 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetScreenOffMode: Error! [%d]\n", mScreenOffModeChangeState );
1864 return Dali::Window::ScreenOffMode::TIMEOUT;
1867 Dali::Window::ScreenOffMode::Type screenMode = Dali::Window::ScreenOffMode::TIMEOUT;
1869 switch( mScreenOffMode )
1873 screenMode = Dali::Window::ScreenOffMode::TIMEOUT;
1878 screenMode = Dali::Window::ScreenOffMode::NEVER;
1883 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetScreenOffMode: screen mode [%d]\n", mScreenOffMode );
1888 bool WindowBaseEcoreWl2::SetBrightness( int brightness )
1890 while( !mTizenDisplayPolicy )
1892 wl_display_dispatch_queue( mDisplay, mEventQueue );
1895 mBrightnessChangeDone = false;
1896 mBrightnessChangeState = TIZEN_POLICY_ERROR_STATE_NONE;
1898 tizen_display_policy_set_window_brightness( mTizenDisplayPolicy, ecore_wl2_window_surface_get( mEcoreWindow ), brightness );
1902 while( !mBrightnessChangeDone && count < 3 )
1904 ecore_wl2_display_flush( ecore_wl2_connected_display_get( NULL ) );
1905 wl_display_dispatch_queue( mDisplay, mEventQueue );
1909 if( !mBrightnessChangeDone )
1911 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetBrightness: Brightness change is failed [%d, %d]\n", brightness, mBrightnessChangeState );
1914 else if( mBrightnessChangeState == TIZEN_POLICY_ERROR_STATE_PERMISSION_DENIED )
1916 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetBrightness: Permission denied! [%d]\n", brightness );
1920 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetBrightness: Brightness is changed [%d]\n", mBrightness );
1925 int WindowBaseEcoreWl2::GetBrightness() const
1927 while( !mTizenDisplayPolicy )
1929 wl_display_dispatch_queue( mDisplay, mEventQueue );
1934 while( !mBrightnessChangeDone && count < 3 )
1936 ecore_wl2_display_flush( ecore_wl2_connected_display_get( NULL ) );
1937 wl_display_dispatch_queue( mDisplay, mEventQueue );
1941 if( !mBrightnessChangeDone )
1943 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetBrightness: Error! [%d]\n", mBrightnessChangeState );
1947 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetBrightness: Brightness [%d]\n", mBrightness );
1952 bool WindowBaseEcoreWl2::GrabKey( Dali::KEY key, KeyGrab::KeyGrabMode grabMode )
1954 Ecore_Wl2_Window_Keygrab_Mode mode;
1958 case KeyGrab::TOPMOST:
1960 mode = ECORE_WL2_WINDOW_KEYGRAB_TOPMOST;
1963 case KeyGrab::SHARED:
1965 mode = ECORE_WL2_WINDOW_KEYGRAB_SHARED;
1968 case KeyGrab::OVERRIDE_EXCLUSIVE:
1970 mode = ECORE_WL2_WINDOW_KEYGRAB_OVERRIDE_EXCLUSIVE;
1973 case KeyGrab::EXCLUSIVE:
1975 mode = ECORE_WL2_WINDOW_KEYGRAB_EXCLUSIVE;
1984 return ecore_wl2_window_keygrab_set( mEcoreWindow, KeyLookup::GetKeyName( key ), 0, 0, 0, mode );
1987 bool WindowBaseEcoreWl2::UngrabKey( Dali::KEY key )
1989 return ecore_wl2_window_keygrab_unset( mEcoreWindow, KeyLookup::GetKeyName( key ), 0, 0 );
1992 bool WindowBaseEcoreWl2::GrabKeyList( const Dali::Vector< Dali::KEY >& key, const Dali::Vector< KeyGrab::KeyGrabMode >& grabMode, Dali::Vector< bool >& result )
1994 int keyCount = key.Count();
1995 int keyGrabModeCount = grabMode.Count();
1997 if( keyCount != keyGrabModeCount || keyCount == 0 )
2004 Eina_List* keyList = NULL;
2005 Ecore_Wl2_Window_Keygrab_Info* info = new Ecore_Wl2_Window_Keygrab_Info[keyCount];
2007 for( int index = 0; index < keyCount; ++index )
2009 info[index].key = const_cast< char* >( KeyLookup::GetKeyName( key[index] ) );
2011 switch( grabMode[index] )
2013 case KeyGrab::TOPMOST:
2015 info[index].mode = ECORE_WL2_WINDOW_KEYGRAB_TOPMOST;
2018 case KeyGrab::SHARED:
2020 info[index].mode = ECORE_WL2_WINDOW_KEYGRAB_SHARED;
2023 case KeyGrab::OVERRIDE_EXCLUSIVE:
2025 info[index].mode = ECORE_WL2_WINDOW_KEYGRAB_OVERRIDE_EXCLUSIVE;
2028 case KeyGrab::EXCLUSIVE:
2030 info[index].mode = ECORE_WL2_WINDOW_KEYGRAB_EXCLUSIVE;
2035 info[index].mode = ECORE_WL2_WINDOW_KEYGRAB_UNKNOWN;
2040 keyList = eina_list_append( keyList, &info );
2043 Eina_List* grabList = ecore_wl2_window_keygrab_list_set( mEcoreWindow, keyList );
2045 result.Resize( keyCount, true );
2047 Eina_List* l = NULL;
2048 Eina_List* m = NULL;
2049 void* listData = NULL;
2051 if( grabList != NULL )
2053 EINA_LIST_FOREACH( grabList, m, data )
2056 EINA_LIST_FOREACH( keyList, l, listData )
2058 if( static_cast< Ecore_Wl2_Window_Keygrab_Info* >( listData )->key == NULL )
2060 DALI_LOG_ERROR( "input key list has null data!" );
2064 if( strcmp( static_cast< char* >( data ), static_cast< Ecore_Wl2_Window_Keygrab_Info* >( listData )->key ) == 0 )
2066 result[index] = false;
2075 eina_list_free( keyList );
2076 eina_list_free( grabList );
2082 bool WindowBaseEcoreWl2::UngrabKeyList( const Dali::Vector< Dali::KEY >& key, Dali::Vector< bool >& result )
2084 int keyCount = key.Count();
2092 Eina_List* keyList = NULL;
2093 Ecore_Wl2_Window_Keygrab_Info* info = new Ecore_Wl2_Window_Keygrab_Info[keyCount];
2095 for( int index = 0; index < keyCount; ++index )
2097 info[index].key = const_cast< char* >( KeyLookup::GetKeyName( key[index] ) );
2098 keyList = eina_list_append( keyList, &info );
2101 Eina_List* ungrabList = ecore_wl2_window_keygrab_list_unset( mEcoreWindow, keyList );
2103 result.Resize( keyCount, true );
2105 Eina_List* l = NULL;
2106 Eina_List* m = NULL;
2107 void *listData = NULL;
2110 if( ungrabList != NULL )
2112 EINA_LIST_FOREACH( ungrabList, m, data )
2115 EINA_LIST_FOREACH( keyList, l, listData )
2117 if( strcmp( static_cast< char* >( data ), static_cast< Ecore_Wl2_Window_Keygrab_Info* >( listData )->key ) == 0 )
2119 result[index] = false;
2128 eina_list_free( keyList );
2129 eina_list_free( ungrabList );
2135 void WindowBaseEcoreWl2::GetDpi( unsigned int& dpiHorizontal, unsigned int& dpiVertical )
2140 Ecore_Wl2_Output* output = ecore_wl2_window_output_find( mEcoreWindow );
2142 // 1 inch = 25.4 millimeters
2143 xres = ecore_wl2_output_dpi_get( output );
2144 yres = ecore_wl2_output_dpi_get( output );
2146 dpiHorizontal = int( xres + 0.5f ); // rounding
2147 dpiVertical = int( yres + 0.5f );
2150 void WindowBaseEcoreWl2::SetViewMode( ViewMode viewMode )
2154 int WindowBaseEcoreWl2::GetScreenRotationAngle()
2158 if( ecore_wl2_window_ignore_output_transform_get( mEcoreWindow ) )
2164 transform = ecore_wl2_output_transform_get( ecore_wl2_window_output_find( mEcoreWindow ) );
2167 return transform * 90;
2170 void WindowBaseEcoreWl2::SetWindowRotationAngle( int degree )
2172 ecore_wl2_window_rotation_set( mEcoreWindow, degree );
2175 void WindowBaseEcoreWl2::WindowRotationCompleted( int degree, int width, int height )
2177 ecore_wl2_window_rotation_change_done_send( mEcoreWindow, degree, width, height );
2180 void WindowBaseEcoreWl2::SetTransparency( bool transparent )
2182 ecore_wl2_window_alpha_set( mEcoreWindow, transparent );
2185 void WindowBaseEcoreWl2::InitializeEcoreElDBus()
2187 #ifdef DALI_ELDBUS_AVAILABLE
2188 Eldbus_Object* object;
2189 Eldbus_Proxy* manager;
2191 if( !( mSystemConnection = eldbus_connection_get( ELDBUS_CONNECTION_TYPE_SYSTEM ) ) )
2193 DALI_LOG_ERROR( "Unable to get system bus\n" );
2196 object = eldbus_object_get( mSystemConnection, BUS, PATH );
2199 DALI_LOG_ERROR( "Getting object failed\n" );
2203 manager = eldbus_proxy_get( object, INTERFACE );
2206 DALI_LOG_ERROR( "Getting proxy failed\n" );
2210 if( !eldbus_proxy_signal_handler_add( manager, "GestureDetected", EcoreElDBusAccessibilityNotification, this ) )
2212 DALI_LOG_ERROR( "No signal handler returned\n" );
2217 void WindowBaseEcoreWl2::CreateWindow( PositionSize positionSize )
2219 Ecore_Wl2_Display* display = ecore_wl2_display_connect( NULL );
2222 DALI_ASSERT_ALWAYS( 0 && "Failed to get display" );
2225 mEcoreWindow = ecore_wl2_window_new( display, NULL, positionSize.x, positionSize.y, positionSize.width, positionSize.height );
2227 if ( mEcoreWindow == 0 )
2229 DALI_ASSERT_ALWAYS( 0 && "Failed to create Wayland window" );
2233 ecore_wl2_window_type_set( mEcoreWindow, ECORE_WL2_WINDOW_TYPE_TOPLEVEL );
2236 } // namespace Adaptor
2238 } // namespace Internal
2242 #pragma GCC diagnostic pop