2 * Copyright (c) 2019 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 // Ecore is littered with C style cast
19 #pragma GCC diagnostic push
20 #pragma GCC diagnostic ignored "-Wold-style-cast"
23 #include <dali/internal/window-system/tizen-wayland/ecore-wl2/window-base-ecore-wl2.h>
26 #include <dali/internal/window-system/common/window-impl.h>
27 #include <dali/internal/window-system/common/window-system.h>
28 #include <dali/internal/window-system/common/window-render-surface.h>
29 #include <dali/internal/input/common/key-impl.h>
32 #include <dali/public-api/object/any.h>
33 #include <dali/public-api/events/mouse-button.h>
34 #include <dali/integration-api/debug.h>
35 #include <Ecore_Input.h>
37 #include <vconf-keys.h>
38 #include <wayland-egl-tizen.h>
52 #if defined(DEBUG_ENABLED)
53 Debug::Filter* gWindowBaseLogFilter = Debug::Filter::New( Debug::NoLogging, false, "LOG_WINDOW_BASE" );
56 const uint32_t MAX_TIZEN_CLIENT_VERSION = 7;
57 const unsigned int PRIMARY_TOUCH_BUTTON_ID = 1;
59 const char* DALI_VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_NAME = "db/setting/accessibility/font_name"; // It will be update at vconf-key.h and replaced.
62 const char* BUS = "org.enlightenment.wm-screen-reader";
63 const char* INTERFACE = "org.tizen.GestureNavigation";
64 const char* PATH = "/org/tizen/GestureNavigation";
67 * Get the device name from the provided ecore key event
69 void GetDeviceName( Ecore_Event_Key* keyEvent, std::string& result )
71 const char* ecoreDeviceName = ecore_device_name_get( keyEvent->dev );
75 result = ecoreDeviceName;
80 * Get the device class from the provided ecore event
82 void GetDeviceClass( Ecore_Device_Class ecoreDeviceClass, Device::Class::Type& deviceClass )
84 switch( ecoreDeviceClass )
86 case ECORE_DEVICE_CLASS_SEAT:
88 deviceClass = Device::Class::USER;
91 case ECORE_DEVICE_CLASS_KEYBOARD:
93 deviceClass = Device::Class::KEYBOARD;
96 case ECORE_DEVICE_CLASS_MOUSE:
98 deviceClass = Device::Class::MOUSE;
101 case ECORE_DEVICE_CLASS_TOUCH:
103 deviceClass = Device::Class::TOUCH;
106 case ECORE_DEVICE_CLASS_PEN:
108 deviceClass = Device::Class::PEN;
111 case ECORE_DEVICE_CLASS_POINTER:
113 deviceClass = Device::Class::POINTER;
116 case ECORE_DEVICE_CLASS_GAMEPAD:
118 deviceClass = Device::Class::GAMEPAD;
123 deviceClass = Device::Class::NONE;
129 void GetDeviceSubclass( Ecore_Device_Subclass ecoreDeviceSubclass, Device::Subclass::Type& deviceSubclass )
131 switch( ecoreDeviceSubclass )
133 case ECORE_DEVICE_SUBCLASS_FINGER:
135 deviceSubclass = Device::Subclass::FINGER;
138 case ECORE_DEVICE_SUBCLASS_FINGERNAIL:
140 deviceSubclass = Device::Subclass::FINGERNAIL;
143 case ECORE_DEVICE_SUBCLASS_KNUCKLE:
145 deviceSubclass = Device::Subclass::KNUCKLE;
148 case ECORE_DEVICE_SUBCLASS_PALM:
150 deviceSubclass = Device::Subclass::PALM;
153 case ECORE_DEVICE_SUBCLASS_HAND_SIZE:
155 deviceSubclass = Device::Subclass::HAND_SIDE;
158 case ECORE_DEVICE_SUBCLASS_HAND_FLAT:
160 deviceSubclass = Device::Subclass::HAND_FLAT;
163 case ECORE_DEVICE_SUBCLASS_PEN_TIP:
165 deviceSubclass = Device::Subclass::PEN_TIP;
168 case ECORE_DEVICE_SUBCLASS_TRACKPAD:
170 deviceSubclass = Device::Subclass::TRACKPAD;
173 case ECORE_DEVICE_SUBCLASS_TRACKPOINT:
175 deviceSubclass = Device::Subclass::TRACKPOINT;
178 case ECORE_DEVICE_SUBCLASS_TRACKBALL:
180 deviceSubclass = Device::Subclass::TRACKBALL;
183 case ECORE_DEVICE_SUBCLASS_REMOCON:
185 deviceSubclass = Device::Subclass::REMOCON;
188 case ECORE_DEVICE_SUBCLASS_VIRTUAL_KEYBOARD:
190 deviceSubclass = Device::Subclass::VIRTUAL_KEYBOARD;
195 deviceSubclass = Device::Subclass::NONE;
201 /////////////////////////////////////////////////////////////////////////////////////////////////
203 /////////////////////////////////////////////////////////////////////////////////////////////////
205 /// Called when the window iconify state is changed.
206 static Eina_Bool EcoreEventWindowIconifyStateChanged( void* data, int type, void* event )
208 WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
211 return windowBase->OnIconifyStateChanged( data, type, event );
214 return ECORE_CALLBACK_PASS_ON;
217 /// Called when the window gains focus
218 static Eina_Bool EcoreEventWindowFocusIn( void* data, int type, void* event )
220 WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
223 return windowBase->OnFocusIn( data, type, event );
226 return ECORE_CALLBACK_PASS_ON;
229 /// Called when the window loses focus
230 static Eina_Bool EcoreEventWindowFocusOut( void* data, int type, void* event )
232 WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
235 return windowBase->OnFocusOut( data, type, event );
238 return ECORE_CALLBACK_PASS_ON;
241 /// Called when the output is transformed
242 static Eina_Bool EcoreEventOutputTransform( void* data, int type, void* event )
244 WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
247 return windowBase->OnOutputTransform( data, type, event );
250 return ECORE_CALLBACK_PASS_ON;
253 /// Called when the output transform should be ignored
254 static Eina_Bool EcoreEventIgnoreOutputTransform( void* data, int type, void* event )
256 WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
259 return windowBase->OnIgnoreOutputTransform( data, type, event );
262 return ECORE_CALLBACK_PASS_ON;
266 * Called when rotate event is recevied.
268 static Eina_Bool EcoreEventRotate( void* data, int type, void* event )
270 WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
273 DALI_LOG_RELEASE_INFO( "WindowBaseEcoreWl2::EcoreEventRotate\n" );
274 windowBase->OnRotation( data, type, event );
276 return ECORE_CALLBACK_PASS_ON;
280 * Called when configure event is recevied.
282 static Eina_Bool EcoreEventConfigure( void* data, int type, void* event )
284 WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
287 windowBase->OnConfiguration( data, type, event );
289 return ECORE_CALLBACK_PASS_ON;
292 /////////////////////////////////////////////////////////////////////////////////////////////////
294 /////////////////////////////////////////////////////////////////////////////////////////////////
297 * Called when a touch down is received.
299 static Eina_Bool EcoreEventMouseButtonDown( void* data, int type, void* event )
301 WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
304 windowBase->OnMouseButtonDown( data, type, event );
306 return ECORE_CALLBACK_PASS_ON;
310 * Called when a touch up is received.
312 static Eina_Bool EcoreEventMouseButtonUp( void* data, int type, void* event )
314 WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
317 windowBase->OnMouseButtonUp( data, type, event );
319 return ECORE_CALLBACK_PASS_ON;
323 * Called when a touch motion is received.
325 static Eina_Bool EcoreEventMouseButtonMove( void* data, int type, void* event )
327 WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
330 windowBase->OnMouseButtonMove( data, type, event );
332 return ECORE_CALLBACK_PASS_ON;
336 * Called when a touch is canceled.
338 static Eina_Bool EcoreEventMouseButtonCancel( void* data, int type, void* event )
340 WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
343 windowBase->OnMouseButtonCancel( data, type, event );
345 return ECORE_CALLBACK_PASS_ON;
349 * Called when a mouse wheel is received.
351 static Eina_Bool EcoreEventMouseWheel( void* data, int type, void* event )
353 WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
356 windowBase->OnMouseWheel( data, type, event );
358 return ECORE_CALLBACK_PASS_ON;
362 * Called when a detent rotation event is recevied.
364 static Eina_Bool EcoreEventDetentRotation( void* data, int type, void* event )
366 WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
369 windowBase->OnDetentRotation( data, type, event );
371 return ECORE_CALLBACK_PASS_ON;
374 /////////////////////////////////////////////////////////////////////////////////////////////////
376 /////////////////////////////////////////////////////////////////////////////////////////////////
379 * Called when a key down is received.
381 static Eina_Bool EcoreEventKeyDown( void* data, int type, void* event )
383 WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
386 windowBase->OnKeyDown( data, type, event );
388 return ECORE_CALLBACK_PASS_ON;
392 * Called when a key up is received.
394 static Eina_Bool EcoreEventKeyUp( void* data, int type, void* event )
396 WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
399 windowBase->OnKeyUp( data, type, event );
401 return ECORE_CALLBACK_PASS_ON;
404 /////////////////////////////////////////////////////////////////////////////////////////////////
405 // Selection Callbacks
406 /////////////////////////////////////////////////////////////////////////////////////////////////
409 * Called when the source window notifies us the content in clipboard is selected.
411 static Eina_Bool EcoreEventDataSend( void* data, int type, void* event )
413 WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
416 windowBase->OnDataSend( data, type, event );
418 return ECORE_CALLBACK_PASS_ON;
422 * Called when the source window sends us about the selected content.
423 * For example, when item is selected in the clipboard.
425 static Eina_Bool EcoreEventDataReceive( void* data, int type, void* event )
427 WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
430 windowBase->OnDataReceive( data, type, event );
432 return ECORE_CALLBACK_PASS_ON;
435 /////////////////////////////////////////////////////////////////////////////////////////////////
436 // Effect Start/End Callbacks
437 /////////////////////////////////////////////////////////////////////////////////////////////////
440 * Called when transition animation of the window's shown/hidden is started by window manager.
442 static Eina_Bool EcoreEventEffectStart(void *data, int type, void *event)
444 WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
445 Ecore_Wl2_Event_Effect_Start *effectStart = static_cast<Ecore_Wl2_Event_Effect_Start*>( event );
446 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::EcoreEventEffectStart, effect type[ %d ]\n", effectStart->type );
449 if( effectStart->type < 3 ) // only under restack
451 windowBase->OnTransitionEffectEvent( DevelWindow::EffectState::START, static_cast<DevelWindow::EffectType>( effectStart->type ) );
454 return ECORE_CALLBACK_PASS_ON;
458 * Called when transition animation of the window's shown/hidden is ended by window manager.
460 static Eina_Bool EcoreEventEffectEnd(void *data, int type, void *event)
462 Ecore_Wl2_Event_Effect_Start *effectEnd = static_cast<Ecore_Wl2_Event_Effect_Start*>( event );
463 WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
464 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::EcoreEventEffectEnd, effect type[ %d ]\n", effectEnd->type );
467 if( effectEnd->type < 3 ) // only under restack
469 windowBase->OnTransitionEffectEvent( DevelWindow::EffectState::END, static_cast<DevelWindow::EffectType>( effectEnd->type ) );
472 return ECORE_CALLBACK_PASS_ON;
475 /////////////////////////////////////////////////////////////////////////////////////////////////
477 /////////////////////////////////////////////////////////////////////////////////////////////////
480 * Called when a font name is changed.
482 static void VconfNotifyFontNameChanged( keynode_t* node, void* data )
484 WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
487 windowBase->OnFontNameChanged();
492 * Called when a font size is changed.
494 static void VconfNotifyFontSizeChanged( keynode_t* node, void* data )
496 WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
499 windowBase->OnFontSizeChanged();
503 /////////////////////////////////////////////////////////////////////////////////////////////////
504 // ElDBus Accessibility Callbacks
505 /////////////////////////////////////////////////////////////////////////////////////////////////
507 #ifdef DALI_ELDBUS_AVAILABLE
508 // Callback for Ecore ElDBus accessibility events.
509 static void EcoreElDBusAccessibilityNotification( void* context, const Eldbus_Message* message )
511 WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( context );
514 windowBase->OnEcoreElDBusAccessibilityNotification( context, message );
517 #endif // DALI_ELDBUS_AVAILABLE
519 static void RegistryGlobalCallback( void* data, struct wl_registry *registry, uint32_t name, const char* interface, uint32_t version )
521 WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
524 windowBase->RegistryGlobalCallback( data, registry, name, interface, version );
528 static void RegistryGlobalCallbackRemove( void* data, struct wl_registry* registry, uint32_t id )
530 WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
533 windowBase->RegistryGlobalCallbackRemove( data, registry, id );
537 static void TizenPolicyConformant( void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, uint32_t isConformant )
541 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 )
545 static void TizenPolicyNotificationChangeDone(void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, int32_t level, uint32_t state )
547 WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
550 windowBase->TizenPolicyNotificationChangeDone( data, tizenPolicy, surface, level, state );
554 static void TizenPolicyTransientForDone( void* data, struct tizen_policy* tizenPolicy, uint32_t childId )
558 static void TizenPolicyScreenModeChangeDone( void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, uint32_t mode, uint32_t state )
560 WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
563 windowBase->TizenPolicyScreenModeChangeDone( data, tizenPolicy, surface, mode, state );
567 static void TizenPolicyIconifyStateChanged( void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, uint32_t iconified, uint32_t force )
571 static void TizenPolicySupportedAuxiliaryHints( void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, struct wl_array* hints, uint32_t numNints )
575 static void TizenPolicyAllowedAuxiliaryHint( void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, int id )
579 static void TizenPolicyAuxiliaryMessage( void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, const char* key, const char* val, struct wl_array* options )
583 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 )
587 static void DisplayPolicyBrightnessChangeDone( void* data, struct tizen_display_policy *displayPolicy, struct wl_surface* surface, int32_t brightness, uint32_t state )
589 WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
592 windowBase->DisplayPolicyBrightnessChangeDone( data, displayPolicy, surface, brightness, state );
596 const struct wl_registry_listener registryListener =
598 RegistryGlobalCallback,
599 RegistryGlobalCallbackRemove
602 const struct tizen_policy_listener tizenPolicyListener =
604 TizenPolicyConformant,
605 TizenPolicyConformantArea,
606 TizenPolicyNotificationChangeDone,
607 TizenPolicyTransientForDone,
608 TizenPolicyScreenModeChangeDone,
609 TizenPolicyIconifyStateChanged,
610 TizenPolicySupportedAuxiliaryHints,
611 TizenPolicyAllowedAuxiliaryHint,
612 TizenPolicyAuxiliaryMessage,
613 TizenPolicyConformantRegion
616 const struct tizen_display_policy_listener tizenDisplayPolicyListener =
618 DisplayPolicyBrightnessChangeDone
621 } // unnamed namespace
623 WindowBaseEcoreWl2::WindowBaseEcoreWl2( Dali::PositionSize positionSize, Any surface, bool isTransparent )
624 : mEcoreEventHandler(),
625 mEcoreWindow( NULL ),
630 mTizenPolicy( NULL ),
631 mTizenDisplayPolicy( NULL ),
632 mSupportedAuxiliaryHints(),
634 mNotificationLevel( -1 ),
635 mNotificationChangeState( 0 ),
636 mNotificationLevelChangeDone( true ),
638 mScreenOffModeChangeState( 0 ),
639 mScreenOffModeChangeDone( true ),
641 mBrightnessChangeState( 0 ),
642 mBrightnessChangeDone( true ),
643 mOwnSurface( false ),
644 mMoveResizeSerial( 0 ),
645 mLastSubmittedMoveResizeSerial( 0 )
646 #ifdef DALI_ELDBUS_AVAILABLE
647 , mSystemConnection( NULL )
650 Initialize( positionSize, surface, isTransparent );
653 WindowBaseEcoreWl2::~WindowBaseEcoreWl2()
655 #ifdef DALI_ELDBUS_AVAILABLE
656 // Close down ElDBus connections.
657 if( mSystemConnection )
659 eldbus_connection_unref( mSystemConnection );
661 #endif // DALI_ELDBUS_AVAILABLE
663 vconf_ignore_key_changed( VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, VconfNotifyFontSizeChanged );
664 vconf_ignore_key_changed( DALI_VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_NAME, VconfNotifyFontNameChanged );
666 for( Dali::Vector< Ecore_Event_Handler* >::Iterator iter = mEcoreEventHandler.Begin(), endIter = mEcoreEventHandler.End(); iter != endIter; ++iter )
668 ecore_event_handler_del( *iter );
670 mEcoreEventHandler.Clear();
674 wl_event_queue_destroy( mEventQueue );
677 mSupportedAuxiliaryHints.clear();
678 mAuxiliaryHints.clear();
680 if( mEglWindow != NULL )
682 wl_egl_window_destroy( mEglWindow );
688 ecore_wl2_window_free( mEcoreWindow );
690 WindowSystem::Shutdown();
694 void WindowBaseEcoreWl2::Initialize( PositionSize positionSize, Any surface, bool isTransparent )
696 if( surface.Empty() == false )
698 // check we have a valid type
699 DALI_ASSERT_ALWAYS( ( surface.GetType() == typeid (Ecore_Wl2_Window *) ) && "Surface type is invalid" );
701 mEcoreWindow = AnyCast< Ecore_Wl2_Window* >( surface );
705 // we own the surface about to created
706 WindowSystem::Initialize();
709 CreateWindow( positionSize );
712 mWlSurface = ecore_wl2_window_surface_get( mEcoreWindow );
714 SetTransparency( isTransparent );
716 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_WL2_EVENT_WINDOW_ICONIFY_STATE_CHANGE, EcoreEventWindowIconifyStateChanged, this ) );
717 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_WL2_EVENT_FOCUS_IN, EcoreEventWindowFocusIn, this ) );
718 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_WL2_EVENT_FOCUS_OUT, EcoreEventWindowFocusOut, this ) );
719 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_WL2_EVENT_OUTPUT_TRANSFORM, EcoreEventOutputTransform, this ) );
720 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_WL2_EVENT_IGNORE_OUTPUT_TRANSFORM, EcoreEventIgnoreOutputTransform, this ) );
722 // Register Rotate event
723 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_WL2_EVENT_WINDOW_ROTATE, EcoreEventRotate, this ) );
725 // Register Configure event
726 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_WL2_EVENT_WINDOW_CONFIGURE, EcoreEventConfigure, this ) );
728 // Register Touch events
729 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_EVENT_MOUSE_BUTTON_DOWN, EcoreEventMouseButtonDown, this ) );
730 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_EVENT_MOUSE_BUTTON_UP, EcoreEventMouseButtonUp, this ) );
731 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_EVENT_MOUSE_MOVE, EcoreEventMouseButtonMove, this ) );
732 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_EVENT_MOUSE_BUTTON_CANCEL, EcoreEventMouseButtonCancel, this ) );
734 // Register Mouse wheel events
735 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_EVENT_MOUSE_WHEEL, EcoreEventMouseWheel, this ) );
737 // Register Detent event
738 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_EVENT_DETENT_ROTATE, EcoreEventDetentRotation, this ) );
740 // Register Key events
741 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_EVENT_KEY_DOWN, EcoreEventKeyDown, this ) );
742 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_EVENT_KEY_UP, EcoreEventKeyUp, this ) );
744 // Register Selection event - clipboard selection
745 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_WL2_EVENT_DATA_SOURCE_SEND, EcoreEventDataSend, this ) );
746 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_WL2_EVENT_SELECTION_DATA_READY, EcoreEventDataReceive, this ) );
748 // Register Effect Start/End event
749 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_WL2_EVENT_EFFECT_START, EcoreEventEffectStart, this ) );
750 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_WL2_EVENT_EFFECT_END, EcoreEventEffectEnd, this ) );
752 // Register Vconf notify - font name and size
753 vconf_notify_key_changed( DALI_VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_NAME, VconfNotifyFontNameChanged, this );
754 vconf_notify_key_changed( VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, VconfNotifyFontSizeChanged, this );
756 InitializeEcoreElDBus();
758 Ecore_Wl2_Display* display = ecore_wl2_connected_display_get( NULL );
759 mDisplay = ecore_wl2_display_get( display );
763 wl_display* displayWrapper = static_cast< wl_display* >( wl_proxy_create_wrapper( mDisplay ) );
766 mEventQueue = wl_display_create_queue( mDisplay );
769 wl_proxy_set_queue( reinterpret_cast< wl_proxy* >( displayWrapper ), mEventQueue );
771 wl_registry* registry = wl_display_get_registry( displayWrapper );
772 wl_registry_add_listener( registry, ®istryListener, this );
775 wl_proxy_wrapper_destroy( displayWrapper );
779 // get auxiliary hint
780 Eina_List* hints = ecore_wl2_window_aux_hints_supported_get( mEcoreWindow );
786 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) ) ) )
788 mSupportedAuxiliaryHints.push_back( hint );
790 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::Initialize: %s\n", hint );
795 Eina_Bool WindowBaseEcoreWl2::OnIconifyStateChanged( void* data, int type, void* event )
797 Ecore_Wl2_Event_Window_Iconify_State_Change* iconifyChangedEvent( static_cast< Ecore_Wl2_Event_Window_Iconify_State_Change* >( event ) );
798 Eina_Bool handled( ECORE_CALLBACK_PASS_ON );
800 if( iconifyChangedEvent->win == static_cast< unsigned int>( ecore_wl2_window_id_get( mEcoreWindow ) ) )
802 if( iconifyChangedEvent->iconified == EINA_TRUE )
804 mIconifyChangedSignal.Emit( true );
808 mIconifyChangedSignal.Emit( false );
810 handled = ECORE_CALLBACK_DONE;
816 Eina_Bool WindowBaseEcoreWl2::OnFocusIn( void* data, int type, void* event )
818 Ecore_Wl2_Event_Focus_In* focusInEvent( static_cast< Ecore_Wl2_Event_Focus_In* >( event ) );
820 if( focusInEvent->window == static_cast< unsigned int >( ecore_wl2_window_id_get( mEcoreWindow ) ) )
822 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "Window EcoreEventWindowFocusIn\n" );
824 mFocusChangedSignal.Emit( true );
827 return ECORE_CALLBACK_PASS_ON;
830 Eina_Bool WindowBaseEcoreWl2::OnFocusOut( void* data, int type, void* event )
832 Ecore_Wl2_Event_Focus_Out* focusOutEvent( static_cast< Ecore_Wl2_Event_Focus_Out* >( event ) );
834 if( focusOutEvent->window == static_cast< unsigned int >( ecore_wl2_window_id_get( mEcoreWindow ) ) )
836 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "Window EcoreEventWindowFocusOut\n" );
838 mFocusChangedSignal.Emit( false );
841 return ECORE_CALLBACK_PASS_ON;
844 Eina_Bool WindowBaseEcoreWl2::OnOutputTransform( void* data, int type, void* event )
846 Ecore_Wl2_Event_Output_Transform* transformEvent( static_cast< Ecore_Wl2_Event_Output_Transform* >( event ) );
848 if( transformEvent->output == ecore_wl2_window_output_find( mEcoreWindow ) )
850 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "Window (%p) EcoreEventOutputTransform\n", mEcoreWindow );
852 mOutputTransformedSignal.Emit();
855 return ECORE_CALLBACK_PASS_ON;
858 Eina_Bool WindowBaseEcoreWl2::OnIgnoreOutputTransform( void* data, int type, void* event )
860 Ecore_Wl2_Event_Ignore_Output_Transform* ignoreTransformEvent( static_cast< Ecore_Wl2_Event_Ignore_Output_Transform* >( event ) );
862 if( ignoreTransformEvent->win == mEcoreWindow )
864 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "Window (%p) EcoreEventIgnoreOutputTransform\n", mEcoreWindow );
866 mOutputTransformedSignal.Emit();
869 return ECORE_CALLBACK_PASS_ON;
872 void WindowBaseEcoreWl2::OnRotation( void* data, int type, void* event )
874 Ecore_Wl2_Event_Window_Rotation* ev( static_cast< Ecore_Wl2_Event_Window_Rotation* >( event ) );
876 if( ev->win == static_cast< unsigned int >( ecore_wl2_window_id_get( mEcoreWindow ) ) )
878 DALI_LOG_RELEASE_INFO( "WindowBaseEcoreWl2::OnRotation, angle: %d, width: %d, height: %d\n", ev->angle, ev->w, ev->h );
880 RotationEvent rotationEvent;
881 rotationEvent.angle = ev->angle;
882 rotationEvent.winResize = 0;
884 if( ev->angle == 0 || ev->angle == 180 )
886 rotationEvent.width = ev->w;
887 rotationEvent.height = ev->h;
891 rotationEvent.width = ev->h;
892 rotationEvent.height = ev->w;
895 mRotationSignal.Emit( rotationEvent );
899 void WindowBaseEcoreWl2::OnConfiguration( void* data, int type, void* event )
901 Ecore_Wl2_Event_Window_Configure* ev( static_cast< Ecore_Wl2_Event_Window_Configure* >( event ) );
903 if( ev->win == static_cast< unsigned int >( ecore_wl2_window_id_get( mEcoreWindow ) ) )
905 // Note: To comply with the wayland protocol, Dali should make an ack_configure
906 // by calling ecore_wl2_window_commit
907 ecore_wl2_window_commit(mEcoreWindow, EINA_FALSE);
911 void WindowBaseEcoreWl2::OnMouseButtonDown( void* data, int type, void* event )
913 Ecore_Event_Mouse_Button* touchEvent = static_cast< Ecore_Event_Mouse_Button* >( event );
915 if( touchEvent->window == static_cast< unsigned int >( ecore_wl2_window_id_get( mEcoreWindow ) ) )
917 Device::Class::Type deviceClass;
918 Device::Subclass::Type deviceSubclass;
920 GetDeviceClass( ecore_device_class_get( touchEvent->dev ), deviceClass );
921 GetDeviceSubclass( ecore_device_subclass_get( touchEvent->dev ), deviceSubclass );
923 PointState::Type state ( PointState::DOWN );
925 if( deviceClass != Device::Class::Type::MOUSE )
927 // Check if the buttons field is set and ensure it's the primary touch button.
928 // If this event was triggered by buttons other than the primary button (used for touch), then
929 // just send an interrupted event to Core.
930 if( touchEvent->buttons && (touchEvent->buttons != PRIMARY_TOUCH_BUTTON_ID ) )
932 state = PointState::INTERRUPTED;
936 Integration::Point point;
937 point.SetDeviceId( touchEvent->multi.device );
938 point.SetState( state );
939 point.SetScreenPosition( Vector2( touchEvent->x, touchEvent->y ) );
940 point.SetRadius( touchEvent->multi.radius, Vector2( touchEvent->multi.radius_x, touchEvent->multi.radius_y ) );
941 point.SetPressure( touchEvent->multi.pressure );
942 point.SetAngle( Degree( touchEvent->multi.angle ) );
943 point.SetDeviceClass( deviceClass );
944 point.SetDeviceSubclass( deviceSubclass );
945 point.SetMouseButton( static_cast< MouseButton::Type >( touchEvent->buttons) );
947 mTouchEventSignal.Emit( point, touchEvent->timestamp );
951 void WindowBaseEcoreWl2::OnMouseButtonUp( void* data, int type, void* event )
953 Ecore_Event_Mouse_Button* touchEvent = static_cast< Ecore_Event_Mouse_Button* >( event );
955 if( touchEvent->window == static_cast< unsigned int >( ecore_wl2_window_id_get( mEcoreWindow ) ) )
957 Device::Class::Type deviceClass;
958 Device::Subclass::Type deviceSubclass;
960 GetDeviceClass( ecore_device_class_get( touchEvent->dev ), deviceClass );
961 GetDeviceSubclass( ecore_device_subclass_get( touchEvent->dev ), deviceSubclass );
963 Integration::Point point;
964 point.SetDeviceId( touchEvent->multi.device );
965 point.SetState( PointState::UP );
966 point.SetScreenPosition( Vector2( touchEvent->x, touchEvent->y ) );
967 point.SetRadius( touchEvent->multi.radius, Vector2( touchEvent->multi.radius_x, touchEvent->multi.radius_y ) );
968 point.SetPressure( touchEvent->multi.pressure );
969 point.SetAngle( Degree( touchEvent->multi.angle ) );
970 point.SetDeviceClass( deviceClass );
971 point.SetDeviceSubclass( deviceSubclass );
972 point.SetMouseButton( static_cast< MouseButton::Type >( touchEvent->buttons) );
974 mTouchEventSignal.Emit( point, touchEvent->timestamp );
978 void WindowBaseEcoreWl2::OnMouseButtonMove( void* data, int type, void* event )
980 Ecore_Event_Mouse_Move* touchEvent = static_cast< Ecore_Event_Mouse_Move* >( event );
982 if( touchEvent->window == static_cast< unsigned int >( ecore_wl2_window_id_get( mEcoreWindow ) ) )
984 Device::Class::Type deviceClass;
985 Device::Subclass::Type deviceSubclass;
987 GetDeviceClass( ecore_device_class_get( touchEvent->dev ), deviceClass );
988 GetDeviceSubclass( ecore_device_subclass_get( touchEvent->dev ), deviceSubclass );
990 Integration::Point point;
991 point.SetDeviceId( touchEvent->multi.device );
992 point.SetState( PointState::MOTION );
993 point.SetScreenPosition( Vector2( touchEvent->x, touchEvent->y ) );
994 point.SetRadius( touchEvent->multi.radius, Vector2( touchEvent->multi.radius_x, touchEvent->multi.radius_y ) );
995 point.SetPressure( touchEvent->multi.pressure );
996 point.SetAngle( Degree( touchEvent->multi.angle ) );
997 point.SetDeviceClass( deviceClass );
998 point.SetDeviceSubclass( deviceSubclass );
1000 mTouchEventSignal.Emit( point, touchEvent->timestamp );
1004 void WindowBaseEcoreWl2::OnMouseButtonCancel( void* data, int type, void* event )
1006 Ecore_Event_Mouse_Button* touchEvent = static_cast< Ecore_Event_Mouse_Button* >( event );
1008 if( touchEvent->window == static_cast< unsigned int >( ecore_wl2_window_id_get( mEcoreWindow ) ) )
1010 Integration::Point point;
1011 point.SetDeviceId( touchEvent->multi.device );
1012 point.SetState( PointState::INTERRUPTED );
1013 point.SetScreenPosition( Vector2( 0.0f, 0.0f ) );
1015 mTouchEventSignal.Emit( point, touchEvent->timestamp );
1017 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl::OnMouseButtonCancel\n" );
1021 void WindowBaseEcoreWl2::OnMouseWheel( void* data, int type, void* event )
1023 Ecore_Event_Mouse_Wheel* mouseWheelEvent = static_cast< Ecore_Event_Mouse_Wheel* >( event );
1025 if( mouseWheelEvent->window == static_cast< unsigned int >( ecore_wl2_window_id_get( mEcoreWindow ) ) )
1027 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 );
1029 WheelEvent wheelEvent( WheelEvent::MOUSE_WHEEL, mouseWheelEvent->direction, mouseWheelEvent->modifiers, Vector2( mouseWheelEvent->x, mouseWheelEvent->y ), mouseWheelEvent->z, mouseWheelEvent->timestamp );
1031 mWheelEventSignal.Emit( wheelEvent );
1035 void WindowBaseEcoreWl2::OnDetentRotation( void* data, int type, void* event )
1037 Ecore_Event_Detent_Rotate* detentEvent = static_cast< Ecore_Event_Detent_Rotate* >( event );
1039 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Concise, "WindowBaseEcoreWl::OnDetentRotation\n" );
1041 int direction = ( detentEvent->direction == ECORE_DETENT_DIRECTION_CLOCKWISE ) ? 1 : -1;
1042 int timeStamp = detentEvent->timestamp;
1044 WheelEvent wheelEvent( WheelEvent::CUSTOM_WHEEL, 0, 0, Vector2( 0.0f, 0.0f ), direction, timeStamp );
1046 mWheelEventSignal.Emit( wheelEvent );
1049 void WindowBaseEcoreWl2::OnKeyDown( void* data, int type, void* event )
1051 Ecore_Event_Key* keyEvent = static_cast< Ecore_Event_Key* >( event );
1053 if( keyEvent->window == static_cast< unsigned int >( ecore_wl2_window_id_get( mEcoreWindow ) ) )
1055 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl::OnKeyDown\n" );
1057 std::string keyName( keyEvent->keyname );
1058 std::string logicalKey( "" );
1059 std::string keyString( "" );
1060 std::string compose( "" );
1062 // Ensure key compose string is not NULL as keys like SHIFT or arrow have a null string.
1063 if( keyEvent->compose )
1065 compose = keyEvent->compose;
1068 // Ensure key symbol is not NULL as keys like SHIFT have a null string.
1071 logicalKey = keyEvent->key;
1074 int keyCode = KeyLookup::GetDaliKeyCode( keyEvent->keyname );
1075 keyCode = ( keyCode == -1 ) ? 0 : keyCode;
1076 int modifier( keyEvent->modifiers );
1077 unsigned long time = keyEvent->timestamp;
1078 if( !strncmp( keyEvent->keyname, "Keycode-", 8 ) )
1080 keyCode = atoi( keyEvent->keyname + 8 );
1083 // Ensure key event string is not NULL as keys like SHIFT have a null string.
1084 if( keyEvent->string )
1086 keyString = keyEvent->string;
1089 std::string deviceName;
1090 Device::Class::Type deviceClass;
1091 Device::Subclass::Type deviceSubclass;
1093 GetDeviceName( keyEvent, deviceName );
1094 GetDeviceClass( ecore_device_class_get( keyEvent->dev ), deviceClass );
1095 GetDeviceSubclass( ecore_device_subclass_get( keyEvent->dev ), deviceSubclass );
1097 Integration::KeyEvent keyEvent( keyName, logicalKey, keyString, keyCode, modifier, time, Integration::KeyEvent::Down, compose, deviceName, deviceClass, deviceSubclass );
1099 mKeyEventSignal.Emit( keyEvent );
1103 void WindowBaseEcoreWl2::OnKeyUp( void* data, int type, void* event )
1105 Ecore_Event_Key* keyEvent = static_cast< Ecore_Event_Key* >( event );
1107 if( keyEvent->window == static_cast< unsigned int >( ecore_wl2_window_id_get( mEcoreWindow ) ) )
1109 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl::OnKeyUp\n" );
1111 std::string keyName( keyEvent->keyname );
1112 std::string logicalKey( "" );
1113 std::string keyString( "" );
1114 std::string compose( "" );
1116 // Ensure key compose string is not NULL as keys like SHIFT or arrow have a null string.
1117 if( keyEvent->compose )
1119 compose = keyEvent->compose;
1122 // Ensure key symbol is not NULL as keys like SHIFT have a null string.
1125 logicalKey = keyEvent->key;
1128 int keyCode = KeyLookup::GetDaliKeyCode( keyEvent->keyname );
1129 keyCode = ( keyCode == -1 ) ? 0 : keyCode;
1130 int modifier( keyEvent->modifiers );
1131 unsigned long time = keyEvent->timestamp;
1132 if( !strncmp( keyEvent->keyname, "Keycode-", 8 ) )
1134 keyCode = atoi( keyEvent->keyname + 8 );
1137 // Ensure key event string is not NULL as keys like SHIFT have a null string.
1138 if( keyEvent->string )
1140 keyString = keyEvent->string;
1143 std::string deviceName;
1144 Device::Class::Type deviceClass;
1145 Device::Subclass::Type deviceSubclass;
1147 GetDeviceName( keyEvent, deviceName );
1148 GetDeviceClass( ecore_device_class_get( keyEvent->dev ), deviceClass );
1149 GetDeviceSubclass( ecore_device_subclass_get( keyEvent->dev ), deviceSubclass );
1151 Integration::KeyEvent keyEvent( keyName, logicalKey, keyString, keyCode, modifier, time, Integration::KeyEvent::Up, compose, deviceName, deviceClass, deviceSubclass );
1153 mKeyEventSignal.Emit( keyEvent );
1157 void WindowBaseEcoreWl2::OnDataSend( void* data, int type, void* event )
1159 mSelectionDataSendSignal.Emit( event );
1162 void WindowBaseEcoreWl2::OnDataReceive( void* data, int type, void* event )
1164 mSelectionDataReceivedSignal.Emit( event );
1167 void WindowBaseEcoreWl2::OnFontNameChanged()
1169 mStyleChangedSignal.Emit( StyleChange::DEFAULT_FONT_CHANGE );
1172 void WindowBaseEcoreWl2::OnFontSizeChanged()
1174 mStyleChangedSignal.Emit( StyleChange::DEFAULT_FONT_SIZE_CHANGE );
1177 void WindowBaseEcoreWl2::OnEcoreElDBusAccessibilityNotification( void* context, const Eldbus_Message* message )
1179 #ifdef DALI_ELDBUS_AVAILABLE
1180 AccessibilityInfo info;
1182 // The string defines the arg-list's respective types.
1183 if( !eldbus_message_arguments_get( message, "iiiiiiu", &info.gestureValue, &info.startX, &info.startY, &info.endX, &info.endY, &info.state, &info.eventTime ) )
1185 DALI_LOG_ERROR( "OnEcoreElDBusAccessibilityNotification: Error getting arguments\n" );
1188 mAccessibilitySignal.Emit( info );
1192 void WindowBaseEcoreWl2::OnTransitionEffectEvent( DevelWindow::EffectState state, DevelWindow::EffectType type )
1194 mTransitionEffectEventSignal.Emit( state, type );
1197 void WindowBaseEcoreWl2::RegistryGlobalCallback( void* data, struct wl_registry *registry, uint32_t name, const char* interface, uint32_t version )
1199 if( strcmp( interface, tizen_policy_interface.name ) == 0 )
1201 uint32_t clientVersion = std::min( version, MAX_TIZEN_CLIENT_VERSION );
1203 mTizenPolicy = static_cast< tizen_policy* >( wl_registry_bind( registry, name, &tizen_policy_interface, clientVersion ) );
1206 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::RegistryGlobalCallback: wl_registry_bind(tizen_policy_interface) is failed.\n" );
1210 tizen_policy_add_listener( mTizenPolicy, &tizenPolicyListener, data );
1212 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::RegistryGlobalCallback: tizen_policy_add_listener is called.\n" );
1214 else if( strcmp( interface, tizen_display_policy_interface.name ) == 0 )
1216 mTizenDisplayPolicy = static_cast< tizen_display_policy* >( wl_registry_bind( registry, name, &tizen_display_policy_interface, version ) );
1217 if( !mTizenDisplayPolicy )
1219 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::RegistryGlobalCallback: wl_registry_bind(tizen_display_policy_interface) is failed.\n" );
1223 tizen_display_policy_add_listener( mTizenDisplayPolicy, &tizenDisplayPolicyListener, data );
1225 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::RegistryGlobalCallback: tizen_display_policy_add_listener is called.\n" );
1229 void WindowBaseEcoreWl2::RegistryGlobalCallbackRemove( void* data, struct wl_registry* registry, uint32_t id )
1231 mTizenPolicy = NULL;
1232 mTizenDisplayPolicy = NULL;
1235 void WindowBaseEcoreWl2::TizenPolicyNotificationChangeDone(void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, int32_t level, uint32_t state )
1237 mNotificationLevel = level;
1238 mNotificationChangeState = state;
1239 mNotificationLevelChangeDone = true;
1241 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::TizenPolicyNotificationChangeDone: level = %d, state = %d\n", level, state );
1244 void WindowBaseEcoreWl2::TizenPolicyScreenModeChangeDone( void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, uint32_t mode, uint32_t state )
1246 mScreenOffMode = mode;
1247 mScreenOffModeChangeState = state;
1248 mScreenOffModeChangeDone = true;
1250 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::TizenPolicyScreenModeChangeDone: mode = %d, state = %d\n", mode, state );
1253 void WindowBaseEcoreWl2::DisplayPolicyBrightnessChangeDone( void* data, struct tizen_display_policy *displayPolicy, struct wl_surface* surface, int32_t brightness, uint32_t state )
1255 mBrightness = brightness;
1256 mBrightnessChangeState = state;
1257 mBrightnessChangeDone = true;
1259 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::DisplayPolicyBrightnessChangeDone: brightness = %d, state = %d\n", brightness, state );
1262 Any WindowBaseEcoreWl2::GetNativeWindow()
1264 return mEcoreWindow;
1267 int WindowBaseEcoreWl2::GetNativeWindowId()
1269 return ecore_wl2_window_id_get( mEcoreWindow );
1272 EGLNativeWindowType WindowBaseEcoreWl2::CreateEglWindow( int width, int height )
1274 mEglWindow = wl_egl_window_create( mWlSurface, width, height );
1276 return static_cast< EGLNativeWindowType >( mEglWindow );
1279 void WindowBaseEcoreWl2::DestroyEglWindow()
1281 if( mEglWindow != NULL )
1283 wl_egl_window_destroy( mEglWindow );
1288 void WindowBaseEcoreWl2::SetEglWindowRotation( int angle )
1290 wl_egl_window_tizen_rotation rotation;
1296 rotation = WL_EGL_WINDOW_TIZEN_ROTATION_0 ;
1301 rotation = WL_EGL_WINDOW_TIZEN_ROTATION_270;
1306 rotation = WL_EGL_WINDOW_TIZEN_ROTATION_180;
1311 rotation = WL_EGL_WINDOW_TIZEN_ROTATION_90;
1316 rotation = WL_EGL_WINDOW_TIZEN_ROTATION_0 ;
1321 wl_egl_window_tizen_set_rotation( mEglWindow, rotation );
1324 void WindowBaseEcoreWl2::SetEglWindowBufferTransform( int angle )
1326 wl_output_transform bufferTransform;
1332 bufferTransform = WL_OUTPUT_TRANSFORM_NORMAL;
1337 bufferTransform = WL_OUTPUT_TRANSFORM_90;
1342 bufferTransform = WL_OUTPUT_TRANSFORM_180;
1347 bufferTransform = WL_OUTPUT_TRANSFORM_270;
1352 bufferTransform = WL_OUTPUT_TRANSFORM_NORMAL;
1357 wl_egl_window_tizen_set_buffer_transform( mEglWindow, bufferTransform );
1360 void WindowBaseEcoreWl2::SetEglWindowTransform( int angle )
1362 wl_output_transform windowTransform;
1368 windowTransform = WL_OUTPUT_TRANSFORM_NORMAL;
1373 windowTransform = WL_OUTPUT_TRANSFORM_90;
1378 windowTransform = WL_OUTPUT_TRANSFORM_180;
1383 windowTransform = WL_OUTPUT_TRANSFORM_270;
1388 windowTransform = WL_OUTPUT_TRANSFORM_NORMAL;
1393 wl_egl_window_tizen_set_window_transform( mEglWindow, windowTransform );
1396 void WindowBaseEcoreWl2::ResizeEglWindow( PositionSize positionSize )
1398 wl_egl_window_resize( mEglWindow, positionSize.width, positionSize.height, positionSize.x, positionSize.y );
1400 // Note: Both "Resize" and "MoveResize" cases can reach here, but only "MoveResize" needs to submit serial number
1401 if( mMoveResizeSerial != mLastSubmittedMoveResizeSerial )
1403 wl_egl_window_tizen_set_window_serial( mEglWindow, mMoveResizeSerial );
1404 mLastSubmittedMoveResizeSerial = mMoveResizeSerial;
1408 bool WindowBaseEcoreWl2::IsEglWindowRotationSupported()
1411 wl_egl_window_tizen_capability capability = static_cast< wl_egl_window_tizen_capability >( wl_egl_window_tizen_get_capabilities( mEglWindow ) );
1412 if( capability == WL_EGL_WINDOW_TIZEN_CAPABILITY_ROTATION_SUPPORTED )
1420 void WindowBaseEcoreWl2::Move( PositionSize positionSize )
1422 ecore_wl2_window_position_set( mEcoreWindow, positionSize.x, positionSize.y );
1425 void WindowBaseEcoreWl2::Resize( PositionSize positionSize )
1427 ecore_wl2_window_geometry_set( mEcoreWindow, positionSize.x, positionSize.y, positionSize.width, positionSize.height );
1430 void WindowBaseEcoreWl2::MoveResize( PositionSize positionSize )
1432 ecore_wl2_window_sync_geometry_set( mEcoreWindow, ++mMoveResizeSerial, positionSize.x, positionSize.y, positionSize.width, positionSize.height );
1435 void WindowBaseEcoreWl2::SetClass( const std::string& name, const std::string& className )
1437 ecore_wl2_window_title_set( mEcoreWindow, name.c_str() );
1438 ecore_wl2_window_class_set( mEcoreWindow, className.c_str() );
1441 void WindowBaseEcoreWl2::Raise()
1443 // Use ecore_wl2_window_activate to prevent the window shown without rendering
1444 ecore_wl2_window_activate( mEcoreWindow );
1447 void WindowBaseEcoreWl2::Lower()
1449 ecore_wl2_window_lower( mEcoreWindow );
1452 void WindowBaseEcoreWl2::Activate()
1454 ecore_wl2_window_activate( mEcoreWindow );
1457 void WindowBaseEcoreWl2::SetAvailableAnlges( const std::vector< int >& angles )
1459 int rotations[4] = { 0 };
1460 DALI_LOG_RELEASE_INFO( "WindowBaseEcoreWl2::SetAvailableAnlges, angle's count: %d\n", angles.size() );
1461 for( std::size_t i = 0; i < angles.size(); ++i )
1463 rotations[i] = static_cast< int >( angles[i] );
1464 DALI_LOG_RELEASE_INFO( "%d ", rotations[i] );
1466 ecore_wl2_window_available_rotations_set( mEcoreWindow, rotations, angles.size() );
1469 void WindowBaseEcoreWl2::SetPreferredAngle( int angle )
1471 DALI_LOG_RELEASE_INFO( "WindowBaseEcoreWl2::SetPreferredAngle, angle: %d\n", angle );
1472 ecore_wl2_window_preferred_rotation_set( mEcoreWindow, angle );
1475 void WindowBaseEcoreWl2::SetAcceptFocus( bool accept )
1477 ecore_wl2_window_focus_skip_set( mEcoreWindow, !accept );
1480 void WindowBaseEcoreWl2::Show()
1482 ecore_wl2_window_show( mEcoreWindow );
1485 void WindowBaseEcoreWl2::Hide()
1487 ecore_wl2_window_hide( mEcoreWindow );
1490 unsigned int WindowBaseEcoreWl2::GetSupportedAuxiliaryHintCount() const
1492 return mSupportedAuxiliaryHints.size();
1495 std::string WindowBaseEcoreWl2::GetSupportedAuxiliaryHint( unsigned int index ) const
1497 if( index >= GetSupportedAuxiliaryHintCount() )
1499 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetSupportedAuxiliaryHint: Invalid index! [%d]\n", index );
1502 return mSupportedAuxiliaryHints[index];
1505 unsigned int WindowBaseEcoreWl2::AddAuxiliaryHint( const std::string& hint, const std::string& value )
1507 bool supported = false;
1509 // Check if the hint is suppported
1510 for( std::vector< std::string >::iterator iter = mSupportedAuxiliaryHints.begin(); iter != mSupportedAuxiliaryHints.end(); ++iter )
1521 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Concise, "WindowBaseEcoreWl2::AddAuxiliaryHint: Not supported auxiliary hint [%s]\n", hint.c_str() );
1525 // Check if the hint is already added
1526 for( unsigned int i = 0; i < mAuxiliaryHints.size(); i++ )
1528 if( mAuxiliaryHints[i].first == hint )
1530 // Just change the value
1531 mAuxiliaryHints[i].second = value;
1533 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::AddAuxiliaryHint: Change! hint = %s, value = %s, id = %d\n", hint.c_str(), value.c_str(), i + 1 );
1535 return i + 1; // id is index + 1
1540 mAuxiliaryHints.push_back( std::pair< std::string, std::string >( hint, value ) );
1542 unsigned int id = mAuxiliaryHints.size();
1544 ecore_wl2_window_aux_hint_add( mEcoreWindow, static_cast< int >( id ), hint.c_str(), value.c_str() );
1546 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::AddAuxiliaryHint: hint = %s, value = %s, id = %d\n", hint.c_str(), value.c_str(), id );
1551 bool WindowBaseEcoreWl2::RemoveAuxiliaryHint( unsigned int id )
1553 if( id == 0 || id > mAuxiliaryHints.size() )
1555 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Concise, "WindowBaseEcoreWl2::RemoveAuxiliaryHint: Invalid id [%d]\n", id );
1559 mAuxiliaryHints[id - 1].second = std::string();
1561 ecore_wl2_window_aux_hint_del( mEcoreWindow, static_cast< int >( id ) );
1563 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::RemoveAuxiliaryHint: id = %d, hint = %s\n", id, mAuxiliaryHints[id - 1].first.c_str() );
1568 bool WindowBaseEcoreWl2::SetAuxiliaryHintValue( unsigned int id, const std::string& value )
1570 if( id == 0 || id > mAuxiliaryHints.size() )
1572 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Concise, "WindowBaseEcoreWl2::SetAuxiliaryHintValue: Invalid id [%d]\n", id );
1576 mAuxiliaryHints[id - 1].second = value;
1578 ecore_wl2_window_aux_hint_change( mEcoreWindow, static_cast< int >( id ), value.c_str() );
1580 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() );
1585 std::string WindowBaseEcoreWl2::GetAuxiliaryHintValue( unsigned int id ) const
1587 if( id == 0 || id > mAuxiliaryHints.size() )
1589 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Concise, "WindowBaseEcoreWl2::GetAuxiliaryHintValue: Invalid id [%d]\n", id );
1590 return std::string();
1593 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() );
1595 return mAuxiliaryHints[id - 1].second;
1598 unsigned int WindowBaseEcoreWl2::GetAuxiliaryHintId( const std::string& hint ) const
1600 for( unsigned int i = 0; i < mAuxiliaryHints.size(); i++ )
1602 if( mAuxiliaryHints[i].first == hint )
1604 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetAuxiliaryHintId: hint = %s, id = %d\n", hint.c_str(), i + 1 );
1609 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetAuxiliaryHintId: Invalid hint! [%s]\n", hint.c_str() );
1614 void WindowBaseEcoreWl2::SetInputRegion( const Rect< int >& inputRegion )
1616 ecore_wl2_window_input_region_set( mEcoreWindow, inputRegion.x, inputRegion.y, inputRegion.width, inputRegion.height );
1619 void WindowBaseEcoreWl2::SetType( Dali::Window::Type type )
1621 Ecore_Wl2_Window_Type windowType;
1625 case Dali::Window::NORMAL:
1627 windowType = ECORE_WL2_WINDOW_TYPE_TOPLEVEL;
1630 case Dali::Window::NOTIFICATION:
1632 windowType = ECORE_WL2_WINDOW_TYPE_NOTIFICATION;
1635 case Dali::Window::UTILITY:
1637 windowType = ECORE_WL2_WINDOW_TYPE_UTILITY;
1640 case Dali::Window::DIALOG:
1642 windowType = ECORE_WL2_WINDOW_TYPE_DIALOG;
1647 windowType = ECORE_WL2_WINDOW_TYPE_TOPLEVEL;
1652 ecore_wl2_window_type_set( mEcoreWindow, windowType );
1655 bool WindowBaseEcoreWl2::SetNotificationLevel( Dali::Window::NotificationLevel::Type level )
1657 while( !mTizenPolicy )
1659 wl_display_dispatch_queue( mDisplay, mEventQueue );
1662 int notificationLevel;
1666 case Dali::Window::NotificationLevel::NONE:
1668 notificationLevel = TIZEN_POLICY_LEVEL_NONE;
1671 case Dali::Window::NotificationLevel::BASE:
1673 notificationLevel = TIZEN_POLICY_LEVEL_DEFAULT;
1676 case Dali::Window::NotificationLevel::MEDIUM:
1678 notificationLevel = TIZEN_POLICY_LEVEL_MEDIUM;
1681 case Dali::Window::NotificationLevel::HIGH:
1683 notificationLevel = TIZEN_POLICY_LEVEL_HIGH;
1686 case Dali::Window::NotificationLevel::TOP:
1688 notificationLevel = TIZEN_POLICY_LEVEL_TOP;
1693 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetNotificationLevel: invalid level [%d]\n", level );
1694 notificationLevel = TIZEN_POLICY_LEVEL_DEFAULT;
1699 mNotificationLevelChangeDone = false;
1700 mNotificationChangeState = TIZEN_POLICY_ERROR_STATE_NONE;
1702 tizen_policy_set_notification_level( mTizenPolicy, ecore_wl2_window_surface_get( mEcoreWindow ), notificationLevel );
1706 while( !mNotificationLevelChangeDone && count < 3 )
1708 ecore_wl2_display_flush( ecore_wl2_connected_display_get( NULL ) );
1709 wl_display_dispatch_queue( mDisplay, mEventQueue );
1713 if( !mNotificationLevelChangeDone )
1715 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetNotificationLevel: Level change is failed [%d, %d]\n", level, mNotificationChangeState );
1718 else if( mNotificationChangeState == TIZEN_POLICY_ERROR_STATE_PERMISSION_DENIED )
1720 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetNotificationLevel: Permission denied! [%d]\n", level );
1724 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetNotificationLevel: Level is changed [%d]\n", mNotificationLevel );
1729 Dali::Window::NotificationLevel::Type WindowBaseEcoreWl2::GetNotificationLevel() const
1731 while( !mTizenPolicy )
1733 wl_display_dispatch_queue( mDisplay, mEventQueue );
1738 while( !mNotificationLevelChangeDone && count < 3 )
1740 ecore_wl2_display_flush( ecore_wl2_connected_display_get( NULL ) );
1741 wl_display_dispatch_queue( mDisplay, mEventQueue );
1745 if( !mNotificationLevelChangeDone )
1747 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetNotificationLevel: Error! [%d]\n", mNotificationChangeState );
1748 return Dali::Window::NotificationLevel::NONE;
1751 Dali::Window::NotificationLevel::Type level;
1753 switch( mNotificationLevel )
1755 case TIZEN_POLICY_LEVEL_NONE:
1757 level = Dali::Window::NotificationLevel::NONE;
1760 case TIZEN_POLICY_LEVEL_DEFAULT:
1762 level = Dali::Window::NotificationLevel::BASE;
1765 case TIZEN_POLICY_LEVEL_MEDIUM:
1767 level = Dali::Window::NotificationLevel::MEDIUM;
1770 case TIZEN_POLICY_LEVEL_HIGH:
1772 level = Dali::Window::NotificationLevel::HIGH;
1775 case TIZEN_POLICY_LEVEL_TOP:
1777 level = Dali::Window::NotificationLevel::TOP;
1782 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetNotificationLevel: invalid level [%d]\n", mNotificationLevel );
1783 level = Dali::Window::NotificationLevel::NONE;
1788 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetNotificationLevel: level [%d]\n", mNotificationLevel );
1793 void WindowBaseEcoreWl2::SetOpaqueState( bool opaque )
1795 while( !mTizenPolicy )
1797 wl_display_dispatch_queue( mDisplay, mEventQueue );
1800 tizen_policy_set_opaque_state( mTizenPolicy, ecore_wl2_window_surface_get( mEcoreWindow ), ( opaque ? 1 : 0 ) );
1803 bool WindowBaseEcoreWl2::SetScreenOffMode(Dali::Window::ScreenOffMode::Type screenOffMode)
1805 while( !mTizenPolicy )
1807 wl_display_dispatch_queue( mDisplay, mEventQueue );
1810 mScreenOffModeChangeDone = false;
1811 mScreenOffModeChangeState = TIZEN_POLICY_ERROR_STATE_NONE;
1813 unsigned int mode = 0;
1815 switch( screenOffMode )
1817 case Dali::Window::ScreenOffMode::TIMEOUT:
1822 case Dali::Window::ScreenOffMode::NEVER:
1829 tizen_policy_set_window_screen_mode( mTizenPolicy, ecore_wl2_window_surface_get( mEcoreWindow ), mode );
1833 while( !mScreenOffModeChangeDone && count < 3 )
1835 ecore_wl2_display_flush( ecore_wl2_connected_display_get( NULL ) );
1836 wl_display_dispatch_queue( mDisplay, mEventQueue );
1840 if( !mScreenOffModeChangeDone )
1842 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetScreenOffMode: Screen mode change is failed [%d, %d]\n", screenOffMode, mScreenOffModeChangeState );
1845 else if( mScreenOffModeChangeState == TIZEN_POLICY_ERROR_STATE_PERMISSION_DENIED )
1847 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetScreenOffMode: Permission denied! [%d]\n", screenOffMode );
1851 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetScreenOffMode: Screen mode is changed [%d]\n", mScreenOffMode );
1856 Dali::Window::ScreenOffMode::Type WindowBaseEcoreWl2::GetScreenOffMode() const
1858 while( !mTizenPolicy )
1860 wl_display_dispatch_queue( mDisplay, mEventQueue );
1865 while( !mScreenOffModeChangeDone && count < 3 )
1867 ecore_wl2_display_flush( ecore_wl2_connected_display_get( NULL ) );
1868 wl_display_dispatch_queue( mDisplay, mEventQueue );
1872 if( !mScreenOffModeChangeDone )
1874 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetScreenOffMode: Error! [%d]\n", mScreenOffModeChangeState );
1875 return Dali::Window::ScreenOffMode::TIMEOUT;
1878 Dali::Window::ScreenOffMode::Type screenMode = Dali::Window::ScreenOffMode::TIMEOUT;
1880 switch( mScreenOffMode )
1884 screenMode = Dali::Window::ScreenOffMode::TIMEOUT;
1889 screenMode = Dali::Window::ScreenOffMode::NEVER;
1894 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetScreenOffMode: screen mode [%d]\n", mScreenOffMode );
1899 bool WindowBaseEcoreWl2::SetBrightness( int brightness )
1901 while( !mTizenDisplayPolicy )
1903 wl_display_dispatch_queue( mDisplay, mEventQueue );
1906 mBrightnessChangeDone = false;
1907 mBrightnessChangeState = TIZEN_POLICY_ERROR_STATE_NONE;
1909 tizen_display_policy_set_window_brightness( mTizenDisplayPolicy, ecore_wl2_window_surface_get( mEcoreWindow ), brightness );
1913 while( !mBrightnessChangeDone && count < 3 )
1915 ecore_wl2_display_flush( ecore_wl2_connected_display_get( NULL ) );
1916 wl_display_dispatch_queue( mDisplay, mEventQueue );
1920 if( !mBrightnessChangeDone )
1922 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetBrightness: Brightness change is failed [%d, %d]\n", brightness, mBrightnessChangeState );
1925 else if( mBrightnessChangeState == TIZEN_POLICY_ERROR_STATE_PERMISSION_DENIED )
1927 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetBrightness: Permission denied! [%d]\n", brightness );
1931 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetBrightness: Brightness is changed [%d]\n", mBrightness );
1936 int WindowBaseEcoreWl2::GetBrightness() const
1938 while( !mTizenDisplayPolicy )
1940 wl_display_dispatch_queue( mDisplay, mEventQueue );
1945 while( !mBrightnessChangeDone && count < 3 )
1947 ecore_wl2_display_flush( ecore_wl2_connected_display_get( NULL ) );
1948 wl_display_dispatch_queue( mDisplay, mEventQueue );
1952 if( !mBrightnessChangeDone )
1954 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetBrightness: Error! [%d]\n", mBrightnessChangeState );
1958 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetBrightness: Brightness [%d]\n", mBrightness );
1963 bool WindowBaseEcoreWl2::GrabKey( Dali::KEY key, KeyGrab::KeyGrabMode grabMode )
1965 Ecore_Wl2_Window_Keygrab_Mode mode;
1969 case KeyGrab::TOPMOST:
1971 mode = ECORE_WL2_WINDOW_KEYGRAB_TOPMOST;
1974 case KeyGrab::SHARED:
1976 mode = ECORE_WL2_WINDOW_KEYGRAB_SHARED;
1979 case KeyGrab::OVERRIDE_EXCLUSIVE:
1981 mode = ECORE_WL2_WINDOW_KEYGRAB_OVERRIDE_EXCLUSIVE;
1984 case KeyGrab::EXCLUSIVE:
1986 mode = ECORE_WL2_WINDOW_KEYGRAB_EXCLUSIVE;
1995 return ecore_wl2_window_keygrab_set( mEcoreWindow, KeyLookup::GetKeyName( key ), 0, 0, 0, mode );
1998 bool WindowBaseEcoreWl2::UngrabKey( Dali::KEY key )
2000 return ecore_wl2_window_keygrab_unset( mEcoreWindow, KeyLookup::GetKeyName( key ), 0, 0 );
2003 bool WindowBaseEcoreWl2::GrabKeyList( const Dali::Vector< Dali::KEY >& key, const Dali::Vector< KeyGrab::KeyGrabMode >& grabMode, Dali::Vector< bool >& result )
2005 int keyCount = key.Count();
2006 int keyGrabModeCount = grabMode.Count();
2008 if( keyCount != keyGrabModeCount || keyCount == 0 )
2015 Eina_List* keyList = NULL;
2016 Ecore_Wl2_Window_Keygrab_Info* info = new Ecore_Wl2_Window_Keygrab_Info[keyCount];
2018 for( int index = 0; index < keyCount; ++index )
2020 info[index].key = const_cast< char* >( KeyLookup::GetKeyName( key[index] ) );
2022 switch( grabMode[index] )
2024 case KeyGrab::TOPMOST:
2026 info[index].mode = ECORE_WL2_WINDOW_KEYGRAB_TOPMOST;
2029 case KeyGrab::SHARED:
2031 info[index].mode = ECORE_WL2_WINDOW_KEYGRAB_SHARED;
2034 case KeyGrab::OVERRIDE_EXCLUSIVE:
2036 info[index].mode = ECORE_WL2_WINDOW_KEYGRAB_OVERRIDE_EXCLUSIVE;
2039 case KeyGrab::EXCLUSIVE:
2041 info[index].mode = ECORE_WL2_WINDOW_KEYGRAB_EXCLUSIVE;
2046 info[index].mode = ECORE_WL2_WINDOW_KEYGRAB_UNKNOWN;
2051 keyList = eina_list_append( keyList, &info );
2054 Eina_List* grabList = ecore_wl2_window_keygrab_list_set( mEcoreWindow, keyList );
2056 result.Resize( keyCount, true );
2058 Eina_List* l = NULL;
2059 Eina_List* m = NULL;
2060 void* listData = NULL;
2062 if( grabList != NULL )
2064 EINA_LIST_FOREACH( grabList, m, data )
2067 EINA_LIST_FOREACH( keyList, l, listData )
2069 if( static_cast< Ecore_Wl2_Window_Keygrab_Info* >( listData )->key == NULL )
2071 DALI_LOG_ERROR( "input key list has null data!" );
2075 if( strcmp( static_cast< char* >( data ), static_cast< Ecore_Wl2_Window_Keygrab_Info* >( listData )->key ) == 0 )
2077 result[index] = false;
2086 eina_list_free( keyList );
2087 eina_list_free( grabList );
2093 bool WindowBaseEcoreWl2::UngrabKeyList( const Dali::Vector< Dali::KEY >& key, Dali::Vector< bool >& result )
2095 int keyCount = key.Count();
2103 Eina_List* keyList = NULL;
2104 Ecore_Wl2_Window_Keygrab_Info* info = new Ecore_Wl2_Window_Keygrab_Info[keyCount];
2106 for( int index = 0; index < keyCount; ++index )
2108 info[index].key = const_cast< char* >( KeyLookup::GetKeyName( key[index] ) );
2109 keyList = eina_list_append( keyList, &info );
2112 Eina_List* ungrabList = ecore_wl2_window_keygrab_list_unset( mEcoreWindow, keyList );
2114 result.Resize( keyCount, true );
2116 Eina_List* l = NULL;
2117 Eina_List* m = NULL;
2118 void *listData = NULL;
2121 if( ungrabList != NULL )
2123 EINA_LIST_FOREACH( ungrabList, m, data )
2126 EINA_LIST_FOREACH( keyList, l, listData )
2128 if( strcmp( static_cast< char* >( data ), static_cast< Ecore_Wl2_Window_Keygrab_Info* >( listData )->key ) == 0 )
2130 result[index] = false;
2139 eina_list_free( keyList );
2140 eina_list_free( ungrabList );
2146 void WindowBaseEcoreWl2::GetDpi( unsigned int& dpiHorizontal, unsigned int& dpiVertical )
2151 Ecore_Wl2_Output* output = ecore_wl2_window_output_find( mEcoreWindow );
2153 // 1 inch = 25.4 millimeters
2154 xres = ecore_wl2_output_dpi_get( output );
2155 yres = ecore_wl2_output_dpi_get( output );
2157 dpiHorizontal = int( xres + 0.5f ); // rounding
2158 dpiVertical = int( yres + 0.5f );
2161 int WindowBaseEcoreWl2::GetScreenRotationAngle()
2165 if( ecore_wl2_window_ignore_output_transform_get( mEcoreWindow ) )
2171 transform = ecore_wl2_output_transform_get( ecore_wl2_window_output_find( mEcoreWindow ) );
2174 return transform * 90;
2177 void WindowBaseEcoreWl2::SetWindowRotationAngle( int degree )
2179 ecore_wl2_window_rotation_set( mEcoreWindow, degree );
2182 void WindowBaseEcoreWl2::WindowRotationCompleted( int degree, int width, int height )
2184 ecore_wl2_window_rotation_change_done_send( mEcoreWindow, degree, width, height );
2187 void WindowBaseEcoreWl2::SetTransparency( bool transparent )
2189 ecore_wl2_window_alpha_set( mEcoreWindow, transparent );
2192 void WindowBaseEcoreWl2::InitializeEcoreElDBus()
2194 #ifdef DALI_ELDBUS_AVAILABLE
2195 Eldbus_Object* object;
2196 Eldbus_Proxy* manager;
2198 if( !( mSystemConnection = eldbus_connection_get( ELDBUS_CONNECTION_TYPE_SYSTEM ) ) )
2200 DALI_LOG_ERROR( "Unable to get system bus\n" );
2203 object = eldbus_object_get( mSystemConnection, BUS, PATH );
2206 DALI_LOG_ERROR( "Getting object failed\n" );
2210 manager = eldbus_proxy_get( object, INTERFACE );
2213 DALI_LOG_ERROR( "Getting proxy failed\n" );
2217 if( !eldbus_proxy_signal_handler_add( manager, "GestureDetected", EcoreElDBusAccessibilityNotification, this ) )
2219 DALI_LOG_ERROR( "No signal handler returned\n" );
2224 void WindowBaseEcoreWl2::CreateWindow( PositionSize positionSize )
2226 Ecore_Wl2_Display* display = ecore_wl2_display_connect( NULL );
2229 DALI_ASSERT_ALWAYS( 0 && "Failed to get display" );
2232 mEcoreWindow = ecore_wl2_window_new( display, NULL, positionSize.x, positionSize.y, positionSize.width, positionSize.height );
2234 if ( mEcoreWindow == 0 )
2236 DALI_ASSERT_ALWAYS( 0 && "Failed to create Wayland window" );
2240 ecore_wl2_window_type_set( mEcoreWindow, ECORE_WL2_WINDOW_TYPE_TOPLEVEL );
2243 void WindowBaseEcoreWl2::SetParent( WindowBase* parentWinBase )
2245 Ecore_Wl2_Window* ecoreParent = NULL;
2248 WindowBaseEcoreWl2* winBaseEcore2 = static_cast<WindowBaseEcoreWl2*>( parentWinBase );
2249 ecoreParent = winBaseEcore2->mEcoreWindow;
2251 ecore_wl2_window_parent_set( mEcoreWindow, ecoreParent );
2254 } // namespace Adaptor
2256 } // namespace Internal
2260 #pragma GCC diagnostic pop