2 * Copyright (c) 2018 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 // Ecore is littered with C style cast
19 #pragma GCC diagnostic push
20 #pragma GCC diagnostic ignored "-Wold-style-cast"
23 #include <dali/internal/window-system/tizen-wayland/ecore-wl2/window-base-ecore-wl2.h>
26 #include <dali/internal/window-system/common/window-impl.h>
27 #include <dali/internal/window-system/common/window-system.h>
28 #include <dali/internal/window-system/common/window-render-surface.h>
29 #include <dali/internal/input/common/key-impl.h>
32 #include <dali/public-api/object/any.h>
33 #include <dali/public-api/events/mouse-button.h>
34 #include <dali/integration-api/debug.h>
35 #include <Ecore_Input.h>
37 #include <vconf-keys.h>
38 #include <wayland-egl-tizen.h>
52 #if defined(DEBUG_ENABLED)
53 Debug::Filter* gWindowBaseLogFilter = Debug::Filter::New( Debug::NoLogging, false, "LOG_WINDOW_BASE" );
56 const uint32_t MAX_TIZEN_CLIENT_VERSION = 7;
57 const unsigned int PRIMARY_TOUCH_BUTTON_ID = 1;
59 const char* DALI_VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_NAME = "db/setting/accessibility/font_name"; // It will be update at vconf-key.h and replaced.
62 const char* BUS = "org.enlightenment.wm-screen-reader";
63 const char* INTERFACE = "org.tizen.GestureNavigation";
64 const char* PATH = "/org/tizen/GestureNavigation";
67 * Get the device name from the provided ecore key event
69 void GetDeviceName( Ecore_Event_Key* keyEvent, std::string& result )
71 const char* ecoreDeviceName = ecore_device_name_get( keyEvent->dev );
75 result = ecoreDeviceName;
80 * Get the device class from the provided ecore event
82 void GetDeviceClass( Ecore_Device_Class ecoreDeviceClass, Device::Class::Type& deviceClass )
84 switch( ecoreDeviceClass )
86 case ECORE_DEVICE_CLASS_SEAT:
88 deviceClass = Device::Class::USER;
91 case ECORE_DEVICE_CLASS_KEYBOARD:
93 deviceClass = Device::Class::KEYBOARD;
96 case ECORE_DEVICE_CLASS_MOUSE:
98 deviceClass = Device::Class::MOUSE;
101 case ECORE_DEVICE_CLASS_TOUCH:
103 deviceClass = Device::Class::TOUCH;
106 case ECORE_DEVICE_CLASS_PEN:
108 deviceClass = Device::Class::PEN;
111 case ECORE_DEVICE_CLASS_POINTER:
113 deviceClass = Device::Class::POINTER;
116 case ECORE_DEVICE_CLASS_GAMEPAD:
118 deviceClass = Device::Class::GAMEPAD;
123 deviceClass = Device::Class::NONE;
129 void GetDeviceSubclass( Ecore_Device_Subclass ecoreDeviceSubclass, Device::Subclass::Type& deviceSubclass )
131 switch( ecoreDeviceSubclass )
133 case ECORE_DEVICE_SUBCLASS_FINGER:
135 deviceSubclass = Device::Subclass::FINGER;
138 case ECORE_DEVICE_SUBCLASS_FINGERNAIL:
140 deviceSubclass = Device::Subclass::FINGERNAIL;
143 case ECORE_DEVICE_SUBCLASS_KNUCKLE:
145 deviceSubclass = Device::Subclass::KNUCKLE;
148 case ECORE_DEVICE_SUBCLASS_PALM:
150 deviceSubclass = Device::Subclass::PALM;
153 case ECORE_DEVICE_SUBCLASS_HAND_SIZE:
155 deviceSubclass = Device::Subclass::HAND_SIDE;
158 case ECORE_DEVICE_SUBCLASS_HAND_FLAT:
160 deviceSubclass = Device::Subclass::HAND_FLAT;
163 case ECORE_DEVICE_SUBCLASS_PEN_TIP:
165 deviceSubclass = Device::Subclass::PEN_TIP;
168 case ECORE_DEVICE_SUBCLASS_TRACKPAD:
170 deviceSubclass = Device::Subclass::TRACKPAD;
173 case ECORE_DEVICE_SUBCLASS_TRACKPOINT:
175 deviceSubclass = Device::Subclass::TRACKPOINT;
178 case ECORE_DEVICE_SUBCLASS_TRACKBALL:
180 deviceSubclass = Device::Subclass::TRACKBALL;
183 #ifdef OVER_TIZEN_VERSION_4
184 case ECORE_DEVICE_SUBCLASS_REMOCON:
186 deviceSubclass = Device::Subclass::REMOCON;
189 case ECORE_DEVICE_SUBCLASS_VIRTUAL_KEYBOARD:
191 deviceSubclass = Device::Subclass::VIRTUAL_KEYBOARD;
197 deviceSubclass = Device::Subclass::NONE;
203 /////////////////////////////////////////////////////////////////////////////////////////////////
205 /////////////////////////////////////////////////////////////////////////////////////////////////
207 /// Called when the window iconify state is changed.
208 static Eina_Bool EcoreEventWindowIconifyStateChanged( void* data, int type, void* event )
210 WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
213 return windowBase->OnIconifyStateChanged( data, type, event );
216 return ECORE_CALLBACK_PASS_ON;
219 /// Called when the window gains focus
220 static Eina_Bool EcoreEventWindowFocusIn( void* data, int type, void* event )
222 WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
225 return windowBase->OnFocusIn( data, type, event );
228 return ECORE_CALLBACK_PASS_ON;
231 /// Called when the window loses focus
232 static Eina_Bool EcoreEventWindowFocusOut( void* data, int type, void* event )
234 WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
237 return windowBase->OnFocusOut( data, type, event );
240 return ECORE_CALLBACK_PASS_ON;
243 /// Called when the output is transformed
244 static Eina_Bool EcoreEventOutputTransform( void* data, int type, void* event )
246 WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
249 return windowBase->OnOutputTransform( data, type, event );
252 return ECORE_CALLBACK_PASS_ON;
255 /// Called when the output transform should be ignored
256 static Eina_Bool EcoreEventIgnoreOutputTransform( void* data, int type, void* event )
258 WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
261 return windowBase->OnIgnoreOutputTransform( data, type, event );
264 return ECORE_CALLBACK_PASS_ON;
268 * Called when rotate event is recevied.
270 static Eina_Bool EcoreEventRotate( void* data, int type, void* event )
272 WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
275 windowBase->OnRotation( data, type, event );
277 return ECORE_CALLBACK_PASS_ON;
281 * Called when configure event is recevied.
283 static Eina_Bool EcoreEventConfigure( void* data, int type, void* event )
285 WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
288 windowBase->OnConfiguration( data, type, event );
290 return ECORE_CALLBACK_PASS_ON;
293 /////////////////////////////////////////////////////////////////////////////////////////////////
295 /////////////////////////////////////////////////////////////////////////////////////////////////
298 * Called when a touch down is received.
300 static Eina_Bool EcoreEventMouseButtonDown( void* data, int type, void* event )
302 WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
305 windowBase->OnMouseButtonDown( data, type, event );
307 return ECORE_CALLBACK_PASS_ON;
311 * Called when a touch up is received.
313 static Eina_Bool EcoreEventMouseButtonUp( void* data, int type, void* event )
315 WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
318 windowBase->OnMouseButtonUp( data, type, event );
320 return ECORE_CALLBACK_PASS_ON;
324 * Called when a touch motion is received.
326 static Eina_Bool EcoreEventMouseButtonMove( void* data, int type, void* event )
328 WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
331 windowBase->OnMouseButtonMove( data, type, event );
333 return ECORE_CALLBACK_PASS_ON;
337 * Called when a touch is canceled.
339 static Eina_Bool EcoreEventMouseButtonCancel( void* data, int type, void* event )
341 WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
344 windowBase->OnMouseButtonCancel( data, type, event );
346 return ECORE_CALLBACK_PASS_ON;
350 * Called when a mouse wheel is received.
352 static Eina_Bool EcoreEventMouseWheel( void* data, int type, void* event )
354 WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
357 windowBase->OnMouseWheel( data, type, event );
359 return ECORE_CALLBACK_PASS_ON;
363 * Called when a detent rotation event is recevied.
365 static Eina_Bool EcoreEventDetentRotation( void* data, int type, void* event )
367 WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
370 windowBase->OnDetentRotation( data, type, event );
372 return ECORE_CALLBACK_PASS_ON;
375 /////////////////////////////////////////////////////////////////////////////////////////////////
377 /////////////////////////////////////////////////////////////////////////////////////////////////
380 * Called when a key down is received.
382 static Eina_Bool EcoreEventKeyDown( void* data, int type, void* event )
384 WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
387 windowBase->OnKeyDown( data, type, event );
389 return ECORE_CALLBACK_PASS_ON;
393 * Called when a key up is received.
395 static Eina_Bool EcoreEventKeyUp( void* data, int type, void* event )
397 WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
400 windowBase->OnKeyUp( data, type, event );
402 return ECORE_CALLBACK_PASS_ON;
405 /////////////////////////////////////////////////////////////////////////////////////////////////
406 // Selection Callbacks
407 /////////////////////////////////////////////////////////////////////////////////////////////////
410 * Called when the source window notifies us the content in clipboard is selected.
412 static Eina_Bool EcoreEventDataSend( void* data, int type, void* event )
414 WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
417 windowBase->OnDataSend( data, type, event );
419 return ECORE_CALLBACK_PASS_ON;
423 * Called when the source window sends us about the selected content.
424 * For example, when item is selected in the clipboard.
426 static Eina_Bool EcoreEventDataReceive( void* data, int type, void* event )
428 WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
431 windowBase->OnDataReceive( data, type, event );
433 return ECORE_CALLBACK_PASS_ON;
436 /////////////////////////////////////////////////////////////////////////////////////////////////
437 // Indicator Callbacks
438 /////////////////////////////////////////////////////////////////////////////////////////////////
440 #if defined (DALI_PROFILE_MOBILE)
442 * Called when the Ecore indicator event is received.
444 static Eina_Bool EcoreEventIndicator( void* data, int type, void* event )
446 WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
449 windowBase->OnIndicatorFlicked( data, type, event );
451 return ECORE_CALLBACK_PASS_ON;
453 #endif // DALI_PROFILE_MOBILE
455 /////////////////////////////////////////////////////////////////////////////////////////////////
457 /////////////////////////////////////////////////////////////////////////////////////////////////
460 * Called when a font name is changed.
462 static void VconfNotifyFontNameChanged( keynode_t* node, void* data )
464 WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
467 windowBase->OnFontNameChanged();
472 * Called when a font size is changed.
474 static void VconfNotifyFontSizeChanged( keynode_t* node, void* data )
476 WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
479 windowBase->OnFontSizeChanged();
483 /////////////////////////////////////////////////////////////////////////////////////////////////
484 // ElDBus Accessibility Callbacks
485 /////////////////////////////////////////////////////////////////////////////////////////////////
487 #ifdef DALI_ELDBUS_AVAILABLE
488 // Callback for Ecore ElDBus accessibility events.
489 static void EcoreElDBusAccessibilityNotification( void* context, const Eldbus_Message* message )
491 WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( context );
494 windowBase->OnEcoreElDBusAccessibilityNotification( context, message );
497 #endif // DALI_ELDBUS_AVAILABLE
499 static void RegistryGlobalCallback( void* data, struct wl_registry *registry, uint32_t name, const char* interface, uint32_t version )
501 WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
504 windowBase->RegistryGlobalCallback( data, registry, name, interface, version );
508 static void RegistryGlobalCallbackRemove( void* data, struct wl_registry* registry, uint32_t id )
510 WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
513 windowBase->RegistryGlobalCallbackRemove( data, registry, id );
517 static void TizenPolicyConformant( void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, uint32_t isConformant )
521 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 )
525 static void TizenPolicyNotificationChangeDone(void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, int32_t level, uint32_t state )
527 WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
530 windowBase->TizenPolicyNotificationChangeDone( data, tizenPolicy, surface, level, state );
534 static void TizenPolicyTransientForDone( void* data, struct tizen_policy* tizenPolicy, uint32_t childId )
538 static void TizenPolicyScreenModeChangeDone( void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, uint32_t mode, uint32_t state )
540 WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
543 windowBase->TizenPolicyScreenModeChangeDone( data, tizenPolicy, surface, mode, state );
547 static void TizenPolicyIconifyStateChanged( void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, uint32_t iconified, uint32_t force )
551 static void TizenPolicySupportedAuxiliaryHints( void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, struct wl_array* hints, uint32_t numNints )
555 static void TizenPolicyAllowedAuxiliaryHint( void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, int id )
559 static void TizenPolicyAuxiliaryMessage( void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, const char* key, const char* val, struct wl_array* options )
563 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 )
567 static void DisplayPolicyBrightnessChangeDone( void* data, struct tizen_display_policy *displayPolicy, struct wl_surface* surface, int32_t brightness, uint32_t state )
569 WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
572 windowBase->DisplayPolicyBrightnessChangeDone( data, displayPolicy, surface, brightness, state );
576 const struct wl_registry_listener registryListener =
578 RegistryGlobalCallback,
579 RegistryGlobalCallbackRemove
582 const struct tizen_policy_listener tizenPolicyListener =
584 TizenPolicyConformant,
585 TizenPolicyConformantArea,
586 TizenPolicyNotificationChangeDone,
587 TizenPolicyTransientForDone,
588 TizenPolicyScreenModeChangeDone,
589 TizenPolicyIconifyStateChanged,
590 TizenPolicySupportedAuxiliaryHints,
591 TizenPolicyAllowedAuxiliaryHint,
592 TizenPolicyAuxiliaryMessage,
593 TizenPolicyConformantRegion
596 const struct tizen_display_policy_listener tizenDisplayPolicyListener =
598 DisplayPolicyBrightnessChangeDone
601 } // unnamed namespace
603 WindowBaseEcoreWl2::WindowBaseEcoreWl2( Dali::PositionSize positionSize, Any surface, bool isTransparent )
604 : mEcoreEventHandler(),
605 mEcoreWindow( NULL ),
610 mTizenPolicy( NULL ),
611 mTizenDisplayPolicy( NULL ),
612 mSupportedAuxiliaryHints(),
614 mNotificationLevel( -1 ),
615 mNotificationChangeState( 0 ),
616 mNotificationLevelChangeDone( true ),
618 mScreenOffModeChangeState( 0 ),
619 mScreenOffModeChangeDone( true ),
621 mBrightnessChangeState( 0 ),
622 mBrightnessChangeDone( true ),
623 mOwnSurface( false ),
624 mMoveResizeSerial( 0 ),
625 mLastSubmittedMoveResizeSerial( 0 )
626 #ifdef DALI_ELDBUS_AVAILABLE
627 , mSystemConnection( NULL )
630 Initialize( positionSize, surface, isTransparent );
633 WindowBaseEcoreWl2::~WindowBaseEcoreWl2()
635 #ifdef DALI_ELDBUS_AVAILABLE
636 // Close down ElDBus connections.
637 if( mSystemConnection )
639 eldbus_connection_unref( mSystemConnection );
641 #endif // DALI_ELDBUS_AVAILABLE
643 vconf_ignore_key_changed( VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, VconfNotifyFontSizeChanged );
644 vconf_ignore_key_changed( DALI_VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_NAME, VconfNotifyFontNameChanged );
646 for( Dali::Vector< Ecore_Event_Handler* >::Iterator iter = mEcoreEventHandler.Begin(), endIter = mEcoreEventHandler.End(); iter != endIter; ++iter )
648 ecore_event_handler_del( *iter );
650 mEcoreEventHandler.Clear();
654 wl_event_queue_destroy( mEventQueue );
657 mSupportedAuxiliaryHints.clear();
658 mAuxiliaryHints.clear();
660 if( mEglWindow != NULL )
662 wl_egl_window_destroy( mEglWindow );
668 ecore_wl2_window_free( mEcoreWindow );
670 WindowSystem::Shutdown();
674 void WindowBaseEcoreWl2::Initialize( PositionSize positionSize, Any surface, bool isTransparent )
676 if( surface.Empty() == false )
678 // check we have a valid type
679 DALI_ASSERT_ALWAYS( ( surface.GetType() == typeid (Ecore_Wl2_Window *) ) && "Surface type is invalid" );
681 mEcoreWindow = AnyCast< Ecore_Wl2_Window* >( surface );
685 // we own the surface about to created
686 WindowSystem::Initialize();
689 CreateWindow( positionSize );
692 mWlSurface = ecore_wl2_window_surface_get( mEcoreWindow );
694 SetTransparency( isTransparent );
696 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_WL2_EVENT_WINDOW_ICONIFY_STATE_CHANGE, EcoreEventWindowIconifyStateChanged, this ) );
697 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_WL2_EVENT_FOCUS_IN, EcoreEventWindowFocusIn, this ) );
698 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_WL2_EVENT_FOCUS_OUT, EcoreEventWindowFocusOut, this ) );
699 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_WL2_EVENT_OUTPUT_TRANSFORM, EcoreEventOutputTransform, this ) );
700 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_WL2_EVENT_IGNORE_OUTPUT_TRANSFORM, EcoreEventIgnoreOutputTransform, this ) );
702 // Register Rotate event
703 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_WL2_EVENT_WINDOW_ROTATE, EcoreEventRotate, this ) );
705 // Register Configure event
706 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_WL2_EVENT_WINDOW_CONFIGURE, EcoreEventConfigure, this ) );
708 // Register Touch events
709 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_EVENT_MOUSE_BUTTON_DOWN, EcoreEventMouseButtonDown, this ) );
710 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_EVENT_MOUSE_BUTTON_UP, EcoreEventMouseButtonUp, this ) );
711 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_EVENT_MOUSE_MOVE, EcoreEventMouseButtonMove, this ) );
712 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_EVENT_MOUSE_BUTTON_CANCEL, EcoreEventMouseButtonCancel, this ) );
714 // Register Mouse wheel events
715 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_EVENT_MOUSE_WHEEL, EcoreEventMouseWheel, this ) );
717 // Register Detent event
718 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_EVENT_DETENT_ROTATE, EcoreEventDetentRotation, this ) );
720 // Register Key events
721 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_EVENT_KEY_DOWN, EcoreEventKeyDown, this ) );
722 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_EVENT_KEY_UP, EcoreEventKeyUp, this ) );
724 // Register Selection event - clipboard selection
725 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_WL2_EVENT_DATA_SOURCE_SEND, EcoreEventDataSend, this ) );
726 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_WL2_EVENT_SELECTION_DATA_READY, EcoreEventDataReceive, this ) );
728 #if defined (DALI_PROFILE_MOBILE)
729 // Register indicator event
730 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_WL2_EVENT_INDICATOR_FLICK, EcoreEventIndicator, this ) );
733 // Register Vconf notify - font name and size
734 vconf_notify_key_changed( DALI_VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_NAME, VconfNotifyFontNameChanged, this );
735 vconf_notify_key_changed( VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, VconfNotifyFontSizeChanged, this );
737 InitializeEcoreElDBus();
739 Ecore_Wl2_Display* display = ecore_wl2_connected_display_get( NULL );
740 mDisplay = ecore_wl2_display_get( display );
744 wl_display* displayWrapper = static_cast< wl_display* >( wl_proxy_create_wrapper( mDisplay ) );
747 mEventQueue = wl_display_create_queue( mDisplay );
750 wl_proxy_set_queue( reinterpret_cast< wl_proxy* >( displayWrapper ), mEventQueue );
752 wl_registry* registry = wl_display_get_registry( displayWrapper );
753 wl_registry_add_listener( registry, ®istryListener, this );
756 wl_proxy_wrapper_destroy( displayWrapper );
760 // get auxiliary hint
761 Eina_List* hints = ecore_wl2_window_aux_hints_supported_get( mEcoreWindow );
767 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) ) ) )
769 mSupportedAuxiliaryHints.push_back( hint );
771 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::Initialize: %s\n", hint );
776 Eina_Bool WindowBaseEcoreWl2::OnIconifyStateChanged( void* data, int type, void* event )
778 Ecore_Wl2_Event_Window_Iconify_State_Change* iconifyChangedEvent( static_cast< Ecore_Wl2_Event_Window_Iconify_State_Change* >( event ) );
779 Eina_Bool handled( ECORE_CALLBACK_PASS_ON );
781 if( iconifyChangedEvent->win == static_cast< unsigned int>( ecore_wl2_window_id_get( mEcoreWindow ) ) )
783 if( iconifyChangedEvent->iconified == EINA_TRUE )
785 mIconifyChangedSignal.Emit( true );
789 mIconifyChangedSignal.Emit( false );
791 handled = ECORE_CALLBACK_DONE;
797 Eina_Bool WindowBaseEcoreWl2::OnFocusIn( void* data, int type, void* event )
799 Ecore_Wl2_Event_Focus_In* focusInEvent( static_cast< Ecore_Wl2_Event_Focus_In* >( event ) );
801 if( focusInEvent->window == static_cast< unsigned int >( ecore_wl2_window_id_get( mEcoreWindow ) ) )
803 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "Window EcoreEventWindowFocusIn\n" );
805 mFocusChangedSignal.Emit( true );
808 return ECORE_CALLBACK_PASS_ON;
811 Eina_Bool WindowBaseEcoreWl2::OnFocusOut( void* data, int type, void* event )
813 Ecore_Wl2_Event_Focus_Out* focusOutEvent( static_cast< Ecore_Wl2_Event_Focus_Out* >( event ) );
815 if( focusOutEvent->window == static_cast< unsigned int >( ecore_wl2_window_id_get( mEcoreWindow ) ) )
817 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "Window EcoreEventWindowFocusOut\n" );
819 mFocusChangedSignal.Emit( false );
822 return ECORE_CALLBACK_PASS_ON;
825 Eina_Bool WindowBaseEcoreWl2::OnOutputTransform( void* data, int type, void* event )
827 Ecore_Wl2_Event_Output_Transform* transformEvent( static_cast< Ecore_Wl2_Event_Output_Transform* >( event ) );
829 if( transformEvent->output == ecore_wl2_window_output_find( mEcoreWindow ) )
831 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "Window (%p) EcoreEventOutputTransform\n", mEcoreWindow );
833 mOutputTransformedSignal.Emit();
836 return ECORE_CALLBACK_PASS_ON;
839 Eina_Bool WindowBaseEcoreWl2::OnIgnoreOutputTransform( void* data, int type, void* event )
841 Ecore_Wl2_Event_Ignore_Output_Transform* ignoreTransformEvent( static_cast< Ecore_Wl2_Event_Ignore_Output_Transform* >( event ) );
843 if( ignoreTransformEvent->win == mEcoreWindow )
845 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "Window (%p) EcoreEventIgnoreOutputTransform\n", mEcoreWindow );
847 mOutputTransformedSignal.Emit();
850 return ECORE_CALLBACK_PASS_ON;
853 void WindowBaseEcoreWl2::OnRotation( void* data, int type, void* event )
855 Ecore_Wl2_Event_Window_Rotation* ev( static_cast< Ecore_Wl2_Event_Window_Rotation* >( event ) );
857 if( ev->win == static_cast< unsigned int >( ecore_wl2_window_id_get( mEcoreWindow ) ) )
859 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Concise, "WindowBaseEcoreWl::OnRotation\n" );
861 RotationEvent rotationEvent;
862 rotationEvent.angle = ev->angle;
863 rotationEvent.winResize = 0;
865 if( ev->angle == 0 || ev->angle == 180 )
867 rotationEvent.width = ev->w;
868 rotationEvent.height = ev->h;
872 rotationEvent.width = ev->h;
873 rotationEvent.height = ev->w;
876 mRotationSignal.Emit( rotationEvent );
880 void WindowBaseEcoreWl2::OnConfiguration( void* data, int type, void* event )
882 Ecore_Wl2_Event_Window_Configure* ev( static_cast< Ecore_Wl2_Event_Window_Configure* >( event ) );
884 if( ev->win == static_cast< unsigned int >( ecore_wl2_window_id_get( mEcoreWindow ) ) )
886 // Note: To comply with the wayland protocol, Dali should make an ack_configure
887 // by calling ecore_wl2_window_commit
888 ecore_wl2_window_commit(mEcoreWindow, EINA_FALSE);
892 void WindowBaseEcoreWl2::OnMouseButtonDown( void* data, int type, void* event )
894 Ecore_Event_Mouse_Button* touchEvent = static_cast< Ecore_Event_Mouse_Button* >( event );
896 if( touchEvent->window == static_cast< unsigned int >( ecore_wl2_window_id_get( mEcoreWindow ) ) )
898 Device::Class::Type deviceClass;
899 Device::Subclass::Type deviceSubclass;
901 GetDeviceClass( ecore_device_class_get( touchEvent->dev ), deviceClass );
902 GetDeviceSubclass( ecore_device_subclass_get( touchEvent->dev ), deviceSubclass );
904 PointState::Type state ( PointState::DOWN );
906 if( deviceClass != Device::Class::Type::MOUSE )
908 // Check if the buttons field is set and ensure it's the primary touch button.
909 // If this event was triggered by buttons other than the primary button (used for touch), then
910 // just send an interrupted event to Core.
911 if( touchEvent->buttons && (touchEvent->buttons != PRIMARY_TOUCH_BUTTON_ID ) )
913 state = PointState::INTERRUPTED;
917 Integration::Point point;
918 point.SetDeviceId( touchEvent->multi.device );
919 point.SetState( state );
920 point.SetScreenPosition( Vector2( touchEvent->x, touchEvent->y ) );
921 point.SetRadius( touchEvent->multi.radius, Vector2( touchEvent->multi.radius_x, touchEvent->multi.radius_y ) );
922 point.SetPressure( touchEvent->multi.pressure );
923 point.SetAngle( Degree( touchEvent->multi.angle ) );
924 point.SetDeviceClass( deviceClass );
925 point.SetDeviceSubclass( deviceSubclass );
926 point.SetMouseButton( static_cast< MouseButton::Type >( touchEvent->buttons) );
928 mTouchEventSignal.Emit( point, touchEvent->timestamp );
932 void WindowBaseEcoreWl2::OnMouseButtonUp( void* data, int type, void* event )
934 Ecore_Event_Mouse_Button* touchEvent = static_cast< Ecore_Event_Mouse_Button* >( event );
936 if( touchEvent->window == static_cast< unsigned int >( ecore_wl2_window_id_get( mEcoreWindow ) ) )
938 Device::Class::Type deviceClass;
939 Device::Subclass::Type deviceSubclass;
941 GetDeviceClass( ecore_device_class_get( touchEvent->dev ), deviceClass );
942 GetDeviceSubclass( ecore_device_subclass_get( touchEvent->dev ), deviceSubclass );
944 Integration::Point point;
945 point.SetDeviceId( touchEvent->multi.device );
946 point.SetState( PointState::UP );
947 point.SetScreenPosition( Vector2( touchEvent->x, touchEvent->y ) );
948 point.SetRadius( touchEvent->multi.radius, Vector2( touchEvent->multi.radius_x, touchEvent->multi.radius_y ) );
949 point.SetPressure( touchEvent->multi.pressure );
950 point.SetAngle( Degree( touchEvent->multi.angle ) );
951 point.SetDeviceClass( deviceClass );
952 point.SetDeviceSubclass( deviceSubclass );
953 point.SetMouseButton( static_cast< MouseButton::Type >( touchEvent->buttons) );
955 mTouchEventSignal.Emit( point, touchEvent->timestamp );
959 void WindowBaseEcoreWl2::OnMouseButtonMove( void* data, int type, void* event )
961 Ecore_Event_Mouse_Move* touchEvent = static_cast< Ecore_Event_Mouse_Move* >( event );
963 if( touchEvent->window == static_cast< unsigned int >( ecore_wl2_window_id_get( mEcoreWindow ) ) )
965 Device::Class::Type deviceClass;
966 Device::Subclass::Type deviceSubclass;
968 GetDeviceClass( ecore_device_class_get( touchEvent->dev ), deviceClass );
969 GetDeviceSubclass( ecore_device_subclass_get( touchEvent->dev ), deviceSubclass );
971 Integration::Point point;
972 point.SetDeviceId( touchEvent->multi.device );
973 point.SetState( PointState::MOTION );
974 point.SetScreenPosition( Vector2( touchEvent->x, touchEvent->y ) );
975 point.SetRadius( touchEvent->multi.radius, Vector2( touchEvent->multi.radius_x, touchEvent->multi.radius_y ) );
976 point.SetPressure( touchEvent->multi.pressure );
977 point.SetAngle( Degree( touchEvent->multi.angle ) );
978 point.SetDeviceClass( deviceClass );
979 point.SetDeviceSubclass( deviceSubclass );
981 mTouchEventSignal.Emit( point, touchEvent->timestamp );
985 void WindowBaseEcoreWl2::OnMouseButtonCancel( void* data, int type, void* event )
987 Ecore_Event_Mouse_Button* touchEvent = static_cast< Ecore_Event_Mouse_Button* >( event );
989 if( touchEvent->window == static_cast< unsigned int >( ecore_wl2_window_id_get( mEcoreWindow ) ) )
991 Integration::Point point;
992 point.SetDeviceId( touchEvent->multi.device );
993 point.SetState( PointState::INTERRUPTED );
994 point.SetScreenPosition( Vector2( 0.0f, 0.0f ) );
996 mTouchEventSignal.Emit( point, touchEvent->timestamp );
998 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl::OnMouseButtonCancel\n" );
1002 void WindowBaseEcoreWl2::OnMouseWheel( void* data, int type, void* event )
1004 Ecore_Event_Mouse_Wheel* mouseWheelEvent = static_cast< Ecore_Event_Mouse_Wheel* >( event );
1006 if( mouseWheelEvent->window == static_cast< unsigned int >( ecore_wl2_window_id_get( mEcoreWindow ) ) )
1008 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 );
1010 WheelEvent wheelEvent( WheelEvent::MOUSE_WHEEL, mouseWheelEvent->direction, mouseWheelEvent->modifiers, Vector2( mouseWheelEvent->x, mouseWheelEvent->y ), mouseWheelEvent->z, mouseWheelEvent->timestamp );
1012 mWheelEventSignal.Emit( wheelEvent );
1016 void WindowBaseEcoreWl2::OnDetentRotation( void* data, int type, void* event )
1018 Ecore_Event_Detent_Rotate* detentEvent = static_cast< Ecore_Event_Detent_Rotate* >( event );
1020 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Concise, "WindowBaseEcoreWl::OnDetentRotation\n" );
1022 int direction = ( detentEvent->direction == ECORE_DETENT_DIRECTION_CLOCKWISE ) ? 1 : -1;
1023 int timeStamp = detentEvent->timestamp;
1025 WheelEvent wheelEvent( WheelEvent::CUSTOM_WHEEL, 0, 0, Vector2( 0.0f, 0.0f ), direction, timeStamp );
1027 mWheelEventSignal.Emit( wheelEvent );
1030 void WindowBaseEcoreWl2::OnKeyDown( void* data, int type, void* event )
1032 Ecore_Event_Key* keyEvent = static_cast< Ecore_Event_Key* >( event );
1034 if( keyEvent->window == static_cast< unsigned int >( ecore_wl2_window_id_get( mEcoreWindow ) ) )
1036 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl::OnKeyDown\n" );
1038 std::string keyName( keyEvent->keyname );
1039 std::string logicalKey( "" );
1040 std::string keyString( "" );
1041 std::string compose( "" );
1043 // Ensure key compose string is not NULL as keys like SHIFT or arrow have a null string.
1044 if( keyEvent->compose )
1046 compose = keyEvent->compose;
1049 // Ensure key symbol is not NULL as keys like SHIFT have a null string.
1052 logicalKey = keyEvent->key;
1055 int keyCode = KeyLookup::GetDaliKeyCode( keyEvent->keyname );
1056 keyCode = ( keyCode == -1 ) ? 0 : keyCode;
1057 int modifier( keyEvent->modifiers );
1058 unsigned long time = keyEvent->timestamp;
1059 if( !strncmp( keyEvent->keyname, "Keycode-", 8 ) )
1061 keyCode = atoi( keyEvent->keyname + 8 );
1064 // Ensure key event string is not NULL as keys like SHIFT have a null string.
1065 if( keyEvent->string )
1067 keyString = keyEvent->string;
1070 std::string deviceName;
1071 Device::Class::Type deviceClass;
1072 Device::Subclass::Type deviceSubclass;
1074 GetDeviceName( keyEvent, deviceName );
1075 GetDeviceClass( ecore_device_class_get( keyEvent->dev ), deviceClass );
1076 GetDeviceSubclass( ecore_device_subclass_get( keyEvent->dev ), deviceSubclass );
1078 Integration::KeyEvent keyEvent( keyName, logicalKey, keyString, keyCode, modifier, time, Integration::KeyEvent::Down, compose, deviceName, deviceClass, deviceSubclass );
1080 mKeyEventSignal.Emit( keyEvent );
1084 void WindowBaseEcoreWl2::OnKeyUp( void* data, int type, void* event )
1086 Ecore_Event_Key* keyEvent = static_cast< Ecore_Event_Key* >( event );
1088 if( keyEvent->window == static_cast< unsigned int >( ecore_wl2_window_id_get( mEcoreWindow ) ) )
1090 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl::OnKeyUp\n" );
1092 std::string keyName( keyEvent->keyname );
1093 std::string logicalKey( "" );
1094 std::string keyString( "" );
1095 std::string compose( "" );
1097 // Ensure key compose string is not NULL as keys like SHIFT or arrow have a null string.
1098 if( keyEvent->compose )
1100 compose = keyEvent->compose;
1103 // Ensure key symbol is not NULL as keys like SHIFT have a null string.
1106 logicalKey = keyEvent->key;
1109 int keyCode = KeyLookup::GetDaliKeyCode( keyEvent->keyname );
1110 keyCode = ( keyCode == -1 ) ? 0 : keyCode;
1111 int modifier( keyEvent->modifiers );
1112 unsigned long time = keyEvent->timestamp;
1113 if( !strncmp( keyEvent->keyname, "Keycode-", 8 ) )
1115 keyCode = atoi( keyEvent->keyname + 8 );
1118 // Ensure key event string is not NULL as keys like SHIFT have a null string.
1119 if( keyEvent->string )
1121 keyString = keyEvent->string;
1124 std::string deviceName;
1125 Device::Class::Type deviceClass;
1126 Device::Subclass::Type deviceSubclass;
1128 GetDeviceName( keyEvent, deviceName );
1129 GetDeviceClass( ecore_device_class_get( keyEvent->dev ), deviceClass );
1130 GetDeviceSubclass( ecore_device_subclass_get( keyEvent->dev ), deviceSubclass );
1132 Integration::KeyEvent keyEvent( keyName, logicalKey, keyString, keyCode, modifier, time, Integration::KeyEvent::Up, compose, deviceName, deviceClass, deviceSubclass );
1134 mKeyEventSignal.Emit( keyEvent );
1138 void WindowBaseEcoreWl2::OnDataSend( void* data, int type, void* event )
1140 mSelectionDataSendSignal.Emit( event );
1143 void WindowBaseEcoreWl2::OnDataReceive( void* data, int type, void* event )
1145 mSelectionDataReceivedSignal.Emit( event );
1148 void WindowBaseEcoreWl2::OnIndicatorFlicked( void* data, int type, void* event )
1150 mIndicatorFlickedSignal.Emit();
1153 void WindowBaseEcoreWl2::OnFontNameChanged()
1155 mStyleChangedSignal.Emit( StyleChange::DEFAULT_FONT_CHANGE );
1158 void WindowBaseEcoreWl2::OnFontSizeChanged()
1160 mStyleChangedSignal.Emit( StyleChange::DEFAULT_FONT_SIZE_CHANGE );
1163 void WindowBaseEcoreWl2::OnEcoreElDBusAccessibilityNotification( void* context, const Eldbus_Message* message )
1165 #ifdef DALI_ELDBUS_AVAILABLE
1166 AccessibilityInfo info;
1168 // The string defines the arg-list's respective types.
1169 if( !eldbus_message_arguments_get( message, "iiiiiiu", &info.gestureValue, &info.startX, &info.startY, &info.endX, &info.endY, &info.state, &info.eventTime ) )
1171 DALI_LOG_ERROR( "OnEcoreElDBusAccessibilityNotification: Error getting arguments\n" );
1174 mAccessibilitySignal.Emit( info );
1178 void WindowBaseEcoreWl2::RegistryGlobalCallback( void* data, struct wl_registry *registry, uint32_t name, const char* interface, uint32_t version )
1180 if( strcmp( interface, tizen_policy_interface.name ) == 0 )
1182 uint32_t clientVersion = std::min( version, MAX_TIZEN_CLIENT_VERSION );
1184 mTizenPolicy = static_cast< tizen_policy* >( wl_registry_bind( registry, name, &tizen_policy_interface, clientVersion ) );
1187 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::RegistryGlobalCallback: wl_registry_bind(tizen_policy_interface) is failed.\n" );
1191 tizen_policy_add_listener( mTizenPolicy, &tizenPolicyListener, data );
1193 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::RegistryGlobalCallback: tizen_policy_add_listener is called.\n" );
1195 else if( strcmp( interface, tizen_display_policy_interface.name ) == 0 )
1197 mTizenDisplayPolicy = static_cast< tizen_display_policy* >( wl_registry_bind( registry, name, &tizen_display_policy_interface, version ) );
1198 if( !mTizenDisplayPolicy )
1200 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::RegistryGlobalCallback: wl_registry_bind(tizen_display_policy_interface) is failed.\n" );
1204 tizen_display_policy_add_listener( mTizenDisplayPolicy, &tizenDisplayPolicyListener, data );
1206 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::RegistryGlobalCallback: tizen_display_policy_add_listener is called.\n" );
1210 void WindowBaseEcoreWl2::RegistryGlobalCallbackRemove( void* data, struct wl_registry* registry, uint32_t id )
1212 mTizenPolicy = NULL;
1213 mTizenDisplayPolicy = NULL;
1216 void WindowBaseEcoreWl2::TizenPolicyNotificationChangeDone(void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, int32_t level, uint32_t state )
1218 mNotificationLevel = level;
1219 mNotificationChangeState = state;
1220 mNotificationLevelChangeDone = true;
1222 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::TizenPolicyNotificationChangeDone: level = %d, state = %d\n", level, state );
1225 void WindowBaseEcoreWl2::TizenPolicyScreenModeChangeDone( void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, uint32_t mode, uint32_t state )
1227 mScreenOffMode = mode;
1228 mScreenOffModeChangeState = state;
1229 mScreenOffModeChangeDone = true;
1231 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::TizenPolicyScreenModeChangeDone: mode = %d, state = %d\n", mode, state );
1234 void WindowBaseEcoreWl2::DisplayPolicyBrightnessChangeDone( void* data, struct tizen_display_policy *displayPolicy, struct wl_surface* surface, int32_t brightness, uint32_t state )
1236 mBrightness = brightness;
1237 mBrightnessChangeState = state;
1238 mBrightnessChangeDone = true;
1240 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::DisplayPolicyBrightnessChangeDone: brightness = %d, state = %d\n", brightness, state );
1243 Any WindowBaseEcoreWl2::GetNativeWindow()
1245 return mEcoreWindow;
1248 int WindowBaseEcoreWl2::GetNativeWindowId()
1250 return ecore_wl2_window_id_get( mEcoreWindow );
1253 EGLNativeWindowType WindowBaseEcoreWl2::CreateEglWindow( int width, int height )
1255 mEglWindow = wl_egl_window_create( mWlSurface, width, height );
1257 return static_cast< EGLNativeWindowType >( mEglWindow );
1260 void WindowBaseEcoreWl2::DestroyEglWindow()
1262 if( mEglWindow != NULL )
1264 wl_egl_window_destroy( mEglWindow );
1269 void WindowBaseEcoreWl2::SetEglWindowRotation( int angle )
1271 wl_egl_window_rotation rotation;
1277 rotation = ROTATION_0;
1282 rotation = ROTATION_270;
1287 rotation = ROTATION_180;
1292 rotation = ROTATION_90;
1297 rotation = ROTATION_0;
1302 wl_egl_window_set_rotation( mEglWindow, rotation );
1305 void WindowBaseEcoreWl2::SetEglWindowBufferTransform( int angle )
1307 wl_output_transform bufferTransform;
1313 bufferTransform = WL_OUTPUT_TRANSFORM_NORMAL;
1318 bufferTransform = WL_OUTPUT_TRANSFORM_90;
1323 bufferTransform = WL_OUTPUT_TRANSFORM_180;
1328 bufferTransform = WL_OUTPUT_TRANSFORM_270;
1333 bufferTransform = WL_OUTPUT_TRANSFORM_NORMAL;
1338 wl_egl_window_set_buffer_transform( mEglWindow, bufferTransform );
1341 void WindowBaseEcoreWl2::SetEglWindowTransform( int angle )
1343 wl_output_transform windowTransform;
1349 windowTransform = WL_OUTPUT_TRANSFORM_NORMAL;
1354 windowTransform = WL_OUTPUT_TRANSFORM_90;
1359 windowTransform = WL_OUTPUT_TRANSFORM_180;
1364 windowTransform = WL_OUTPUT_TRANSFORM_270;
1369 windowTransform = WL_OUTPUT_TRANSFORM_NORMAL;
1374 wl_egl_window_set_window_transform( mEglWindow, windowTransform );
1377 void WindowBaseEcoreWl2::ResizeEglWindow( PositionSize positionSize )
1379 wl_egl_window_resize( mEglWindow, positionSize.width, positionSize.height, positionSize.x, positionSize.y );
1381 // Note: Both "Resize" and "MoveResize" cases can reach here, but only "MoveResize" needs to submit serial number
1382 if( mMoveResizeSerial != mLastSubmittedMoveResizeSerial )
1384 wl_egl_window_tizen_set_window_serial( mEglWindow, mMoveResizeSerial );
1385 mLastSubmittedMoveResizeSerial = mMoveResizeSerial;
1389 bool WindowBaseEcoreWl2::IsEglWindowRotationSupported()
1392 wl_egl_window_capability capability = static_cast< wl_egl_window_capability >( wl_egl_window_get_capabilities( mEglWindow ) );
1393 if( capability == WL_EGL_WINDOW_CAPABILITY_ROTATION_SUPPORTED )
1401 void WindowBaseEcoreWl2::Move( PositionSize positionSize )
1403 ecore_wl2_window_position_set( mEcoreWindow, positionSize.x, positionSize.y );
1406 void WindowBaseEcoreWl2::Resize( PositionSize positionSize )
1408 ecore_wl2_window_geometry_set( mEcoreWindow, positionSize.x, positionSize.y, positionSize.width, positionSize.height );
1411 void WindowBaseEcoreWl2::MoveResize( PositionSize positionSize )
1413 ecore_wl2_window_sync_geometry_set( mEcoreWindow, ++mMoveResizeSerial, positionSize.x, positionSize.y, positionSize.width, positionSize.height );
1416 void WindowBaseEcoreWl2::ShowIndicator( Dali::Window::IndicatorVisibleMode visibleMode, Dali::Window::IndicatorBgOpacity opacityMode )
1418 DALI_LOG_TRACE_METHOD_FMT( gWindowBaseLogFilter, "visible : %d\n", visibleMode );
1420 if( visibleMode == Dali::Window::VISIBLE )
1422 // when the indicator is visible, set proper mode for indicator server according to bg mode
1423 if( opacityMode == Dali::Window::OPAQUE )
1425 ecore_wl2_window_indicator_opacity_set( mEcoreWindow, ECORE_WL2_INDICATOR_OPAQUE );
1427 else if( opacityMode == Dali::Window::TRANSLUCENT )
1429 ecore_wl2_window_indicator_opacity_set( mEcoreWindow, ECORE_WL2_INDICATOR_TRANSLUCENT );
1431 else if( opacityMode == Dali::Window::TRANSPARENT )
1433 ecore_wl2_window_indicator_opacity_set( mEcoreWindow, ECORE_WL2_INDICATOR_OPAQUE );
1438 // when the indicator is not visible, set TRANSPARENT mode for indicator server
1439 ecore_wl2_window_indicator_opacity_set( mEcoreWindow, ECORE_WL2_INDICATOR_TRANSPARENT); // it means hidden indicator
1443 void WindowBaseEcoreWl2::SetIndicatorProperties( bool isShow, Dali::Window::WindowOrientation lastOrientation )
1447 ecore_wl2_window_indicator_state_set( mEcoreWindow, ECORE_WL2_INDICATOR_STATE_ON );
1451 ecore_wl2_window_indicator_state_set( mEcoreWindow, ECORE_WL2_INDICATOR_STATE_OFF );
1455 void WindowBaseEcoreWl2::IndicatorTypeChanged( IndicatorInterface::Type type )
1457 #if defined(DALI_PROFILE_MOBILE)
1460 case IndicatorInterface::INDICATOR_TYPE_1:
1462 ecore_wl2_indicator_visible_type_set( mEcoreWindow, ECORE_WL2_INDICATOR_VISIBLE_TYPE_SHOWN );
1465 case IndicatorInterface::INDICATOR_TYPE_2:
1467 ecore_wl2_indicator_visible_type_set( mEcoreWindow, ECORE_WL2_INDICATOR_VISIBLE_TYPE_HIDDEN );
1470 case IndicatorInterface::INDICATOR_TYPE_UNKNOWN:
1479 void WindowBaseEcoreWl2::SetClass( const std::string& name, const std::string& className )
1481 ecore_wl2_window_title_set( mEcoreWindow, name.c_str() );
1482 ecore_wl2_window_class_set( mEcoreWindow, className.c_str() );
1485 void WindowBaseEcoreWl2::Raise()
1487 // Use ecore_wl2_window_activate to prevent the window shown without rendering
1488 ecore_wl2_window_activate( mEcoreWindow );
1491 void WindowBaseEcoreWl2::Lower()
1493 ecore_wl2_window_lower( mEcoreWindow );
1496 void WindowBaseEcoreWl2::Activate()
1498 ecore_wl2_window_activate( mEcoreWindow );
1501 void WindowBaseEcoreWl2::SetAvailableOrientations( const std::vector< Dali::Window::WindowOrientation >& orientations )
1503 int rotations[4] = { 0 };
1504 for( std::size_t i = 0; i < orientations.size(); ++i )
1506 rotations[i] = static_cast< int >( orientations[i] );
1508 ecore_wl2_window_available_rotations_set( mEcoreWindow, rotations, orientations.size() );
1511 void WindowBaseEcoreWl2::SetPreferredOrientation( Dali::Window::WindowOrientation orientation )
1513 ecore_wl2_window_preferred_rotation_set( mEcoreWindow, orientation );
1516 void WindowBaseEcoreWl2::SetAcceptFocus( bool accept )
1518 ecore_wl2_window_focus_skip_set( mEcoreWindow, !accept );
1521 void WindowBaseEcoreWl2::Show()
1523 ecore_wl2_window_show( mEcoreWindow );
1526 void WindowBaseEcoreWl2::Hide()
1528 ecore_wl2_window_hide( mEcoreWindow );
1531 unsigned int WindowBaseEcoreWl2::GetSupportedAuxiliaryHintCount() const
1533 return mSupportedAuxiliaryHints.size();
1536 std::string WindowBaseEcoreWl2::GetSupportedAuxiliaryHint( unsigned int index ) const
1538 if( index >= GetSupportedAuxiliaryHintCount() )
1540 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetSupportedAuxiliaryHint: Invalid index! [%d]\n", index );
1543 return mSupportedAuxiliaryHints[index];
1546 unsigned int WindowBaseEcoreWl2::AddAuxiliaryHint( const std::string& hint, const std::string& value )
1548 bool supported = false;
1550 // Check if the hint is suppported
1551 for( std::vector< std::string >::iterator iter = mSupportedAuxiliaryHints.begin(); iter != mSupportedAuxiliaryHints.end(); ++iter )
1562 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Concise, "WindowBaseEcoreWl2::AddAuxiliaryHint: Not supported auxiliary hint [%s]\n", hint.c_str() );
1566 // Check if the hint is already added
1567 for( unsigned int i = 0; i < mAuxiliaryHints.size(); i++ )
1569 if( mAuxiliaryHints[i].first == hint )
1571 // Just change the value
1572 mAuxiliaryHints[i].second = value;
1574 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::AddAuxiliaryHint: Change! hint = %s, value = %s, id = %d\n", hint.c_str(), value.c_str(), i + 1 );
1576 return i + 1; // id is index + 1
1581 mAuxiliaryHints.push_back( std::pair< std::string, std::string >( hint, value ) );
1583 unsigned int id = mAuxiliaryHints.size();
1585 ecore_wl2_window_aux_hint_add( mEcoreWindow, static_cast< int >( id ), hint.c_str(), value.c_str() );
1587 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::AddAuxiliaryHint: hint = %s, value = %s, id = %d\n", hint.c_str(), value.c_str(), id );
1592 bool WindowBaseEcoreWl2::RemoveAuxiliaryHint( unsigned int id )
1594 if( id == 0 || id > mAuxiliaryHints.size() )
1596 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Concise, "WindowBaseEcoreWl2::RemoveAuxiliaryHint: Invalid id [%d]\n", id );
1600 mAuxiliaryHints[id - 1].second = std::string();
1602 ecore_wl2_window_aux_hint_del( mEcoreWindow, static_cast< int >( id ) );
1604 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::RemoveAuxiliaryHint: id = %d, hint = %s\n", id, mAuxiliaryHints[id - 1].first.c_str() );
1609 bool WindowBaseEcoreWl2::SetAuxiliaryHintValue( unsigned int id, const std::string& value )
1611 if( id == 0 || id > mAuxiliaryHints.size() )
1613 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Concise, "WindowBaseEcoreWl2::SetAuxiliaryHintValue: Invalid id [%d]\n", id );
1617 mAuxiliaryHints[id - 1].second = value;
1619 ecore_wl2_window_aux_hint_change( mEcoreWindow, static_cast< int >( id ), value.c_str() );
1621 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() );
1626 std::string WindowBaseEcoreWl2::GetAuxiliaryHintValue( unsigned int id ) const
1628 if( id == 0 || id > mAuxiliaryHints.size() )
1630 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Concise, "WindowBaseEcoreWl2::GetAuxiliaryHintValue: Invalid id [%d]\n", id );
1631 return std::string();
1634 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() );
1636 return mAuxiliaryHints[id - 1].second;
1639 unsigned int WindowBaseEcoreWl2::GetAuxiliaryHintId( const std::string& hint ) const
1641 for( unsigned int i = 0; i < mAuxiliaryHints.size(); i++ )
1643 if( mAuxiliaryHints[i].first == hint )
1645 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetAuxiliaryHintId: hint = %s, id = %d\n", hint.c_str(), i + 1 );
1650 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetAuxiliaryHintId: Invalid hint! [%s]\n", hint.c_str() );
1655 void WindowBaseEcoreWl2::SetInputRegion( const Rect< int >& inputRegion )
1657 ecore_wl2_window_input_region_set( mEcoreWindow, inputRegion.x, inputRegion.y, inputRegion.width, inputRegion.height );
1660 void WindowBaseEcoreWl2::SetType( Dali::Window::Type type )
1662 Ecore_Wl2_Window_Type windowType;
1666 case Dali::Window::NORMAL:
1668 windowType = ECORE_WL2_WINDOW_TYPE_TOPLEVEL;
1671 case Dali::Window::NOTIFICATION:
1673 windowType = ECORE_WL2_WINDOW_TYPE_NOTIFICATION;
1676 case Dali::Window::UTILITY:
1678 windowType = ECORE_WL2_WINDOW_TYPE_UTILITY;
1681 case Dali::Window::DIALOG:
1683 windowType = ECORE_WL2_WINDOW_TYPE_DIALOG;
1688 windowType = ECORE_WL2_WINDOW_TYPE_TOPLEVEL;
1693 ecore_wl2_window_type_set( mEcoreWindow, windowType );
1696 bool WindowBaseEcoreWl2::SetNotificationLevel( Dali::Window::NotificationLevel::Type level )
1698 while( !mTizenPolicy )
1700 wl_display_dispatch_queue( mDisplay, mEventQueue );
1703 int notificationLevel;
1707 case Dali::Window::NotificationLevel::NONE:
1709 notificationLevel = TIZEN_POLICY_LEVEL_NONE;
1712 case Dali::Window::NotificationLevel::BASE:
1714 notificationLevel = TIZEN_POLICY_LEVEL_DEFAULT;
1717 case Dali::Window::NotificationLevel::MEDIUM:
1719 notificationLevel = TIZEN_POLICY_LEVEL_MEDIUM;
1722 case Dali::Window::NotificationLevel::HIGH:
1724 notificationLevel = TIZEN_POLICY_LEVEL_HIGH;
1727 case Dali::Window::NotificationLevel::TOP:
1729 notificationLevel = TIZEN_POLICY_LEVEL_TOP;
1734 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetNotificationLevel: invalid level [%d]\n", level );
1735 notificationLevel = TIZEN_POLICY_LEVEL_DEFAULT;
1740 mNotificationLevelChangeDone = false;
1741 mNotificationChangeState = TIZEN_POLICY_ERROR_STATE_NONE;
1743 tizen_policy_set_notification_level( mTizenPolicy, ecore_wl2_window_surface_get( mEcoreWindow ), notificationLevel );
1747 while( !mNotificationLevelChangeDone && count < 3 )
1749 ecore_wl2_display_flush( ecore_wl2_connected_display_get( NULL ) );
1750 wl_display_dispatch_queue( mDisplay, mEventQueue );
1754 if( !mNotificationLevelChangeDone )
1756 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetNotificationLevel: Level change is failed [%d, %d]\n", level, mNotificationChangeState );
1759 else if( mNotificationChangeState == TIZEN_POLICY_ERROR_STATE_PERMISSION_DENIED )
1761 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetNotificationLevel: Permission denied! [%d]\n", level );
1765 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetNotificationLevel: Level is changed [%d]\n", mNotificationLevel );
1770 Dali::Window::NotificationLevel::Type WindowBaseEcoreWl2::GetNotificationLevel() const
1772 while( !mTizenPolicy )
1774 wl_display_dispatch_queue( mDisplay, mEventQueue );
1779 while( !mNotificationLevelChangeDone && count < 3 )
1781 ecore_wl2_display_flush( ecore_wl2_connected_display_get( NULL ) );
1782 wl_display_dispatch_queue( mDisplay, mEventQueue );
1786 if( !mNotificationLevelChangeDone )
1788 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetNotificationLevel: Error! [%d]\n", mNotificationChangeState );
1789 return Dali::Window::NotificationLevel::NONE;
1792 Dali::Window::NotificationLevel::Type level;
1794 switch( mNotificationLevel )
1796 case TIZEN_POLICY_LEVEL_NONE:
1798 level = Dali::Window::NotificationLevel::NONE;
1801 case TIZEN_POLICY_LEVEL_DEFAULT:
1803 level = Dali::Window::NotificationLevel::BASE;
1806 case TIZEN_POLICY_LEVEL_MEDIUM:
1808 level = Dali::Window::NotificationLevel::MEDIUM;
1811 case TIZEN_POLICY_LEVEL_HIGH:
1813 level = Dali::Window::NotificationLevel::HIGH;
1816 case TIZEN_POLICY_LEVEL_TOP:
1818 level = Dali::Window::NotificationLevel::TOP;
1823 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetNotificationLevel: invalid level [%d]\n", mNotificationLevel );
1824 level = Dali::Window::NotificationLevel::NONE;
1829 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetNotificationLevel: level [%d]\n", mNotificationLevel );
1834 void WindowBaseEcoreWl2::SetOpaqueState( bool opaque )
1836 while( !mTizenPolicy )
1838 wl_display_dispatch_queue( mDisplay, mEventQueue );
1841 tizen_policy_set_opaque_state( mTizenPolicy, ecore_wl2_window_surface_get( mEcoreWindow ), ( opaque ? 1 : 0 ) );
1844 bool WindowBaseEcoreWl2::SetScreenOffMode(Dali::Window::ScreenOffMode::Type screenOffMode)
1846 while( !mTizenPolicy )
1848 wl_display_dispatch_queue( mDisplay, mEventQueue );
1851 mScreenOffModeChangeDone = false;
1852 mScreenOffModeChangeState = TIZEN_POLICY_ERROR_STATE_NONE;
1854 unsigned int mode = 0;
1856 switch( screenOffMode )
1858 case Dali::Window::ScreenOffMode::TIMEOUT:
1863 case Dali::Window::ScreenOffMode::NEVER:
1870 tizen_policy_set_window_screen_mode( mTizenPolicy, ecore_wl2_window_surface_get( mEcoreWindow ), mode );
1874 while( !mScreenOffModeChangeDone && count < 3 )
1876 ecore_wl2_display_flush( ecore_wl2_connected_display_get( NULL ) );
1877 wl_display_dispatch_queue( mDisplay, mEventQueue );
1881 if( !mScreenOffModeChangeDone )
1883 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetScreenOffMode: Screen mode change is failed [%d, %d]\n", screenOffMode, mScreenOffModeChangeState );
1886 else if( mScreenOffModeChangeState == TIZEN_POLICY_ERROR_STATE_PERMISSION_DENIED )
1888 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetScreenOffMode: Permission denied! [%d]\n", screenOffMode );
1892 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetScreenOffMode: Screen mode is changed [%d]\n", mScreenOffMode );
1897 Dali::Window::ScreenOffMode::Type WindowBaseEcoreWl2::GetScreenOffMode() const
1899 while( !mTizenPolicy )
1901 wl_display_dispatch_queue( mDisplay, mEventQueue );
1906 while( !mScreenOffModeChangeDone && count < 3 )
1908 ecore_wl2_display_flush( ecore_wl2_connected_display_get( NULL ) );
1909 wl_display_dispatch_queue( mDisplay, mEventQueue );
1913 if( !mScreenOffModeChangeDone )
1915 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetScreenOffMode: Error! [%d]\n", mScreenOffModeChangeState );
1916 return Dali::Window::ScreenOffMode::TIMEOUT;
1919 Dali::Window::ScreenOffMode::Type screenMode = Dali::Window::ScreenOffMode::TIMEOUT;
1921 switch( mScreenOffMode )
1925 screenMode = Dali::Window::ScreenOffMode::TIMEOUT;
1930 screenMode = Dali::Window::ScreenOffMode::NEVER;
1935 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetScreenOffMode: screen mode [%d]\n", mScreenOffMode );
1940 bool WindowBaseEcoreWl2::SetBrightness( int brightness )
1942 while( !mTizenDisplayPolicy )
1944 wl_display_dispatch_queue( mDisplay, mEventQueue );
1947 mBrightnessChangeDone = false;
1948 mBrightnessChangeState = TIZEN_POLICY_ERROR_STATE_NONE;
1950 tizen_display_policy_set_window_brightness( mTizenDisplayPolicy, ecore_wl2_window_surface_get( mEcoreWindow ), brightness );
1954 while( !mBrightnessChangeDone && count < 3 )
1956 ecore_wl2_display_flush( ecore_wl2_connected_display_get( NULL ) );
1957 wl_display_dispatch_queue( mDisplay, mEventQueue );
1961 if( !mBrightnessChangeDone )
1963 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetBrightness: Brightness change is failed [%d, %d]\n", brightness, mBrightnessChangeState );
1966 else if( mBrightnessChangeState == TIZEN_POLICY_ERROR_STATE_PERMISSION_DENIED )
1968 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetBrightness: Permission denied! [%d]\n", brightness );
1972 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetBrightness: Brightness is changed [%d]\n", mBrightness );
1977 int WindowBaseEcoreWl2::GetBrightness() const
1979 while( !mTizenDisplayPolicy )
1981 wl_display_dispatch_queue( mDisplay, mEventQueue );
1986 while( !mBrightnessChangeDone && count < 3 )
1988 ecore_wl2_display_flush( ecore_wl2_connected_display_get( NULL ) );
1989 wl_display_dispatch_queue( mDisplay, mEventQueue );
1993 if( !mBrightnessChangeDone )
1995 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetBrightness: Error! [%d]\n", mBrightnessChangeState );
1999 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetBrightness: Brightness [%d]\n", mBrightness );
2004 bool WindowBaseEcoreWl2::GrabKey( Dali::KEY key, KeyGrab::KeyGrabMode grabMode )
2006 Ecore_Wl2_Window_Keygrab_Mode mode;
2010 case KeyGrab::TOPMOST:
2012 mode = ECORE_WL2_WINDOW_KEYGRAB_TOPMOST;
2015 case KeyGrab::SHARED:
2017 mode = ECORE_WL2_WINDOW_KEYGRAB_SHARED;
2020 case KeyGrab::OVERRIDE_EXCLUSIVE:
2022 mode = ECORE_WL2_WINDOW_KEYGRAB_OVERRIDE_EXCLUSIVE;
2025 case KeyGrab::EXCLUSIVE:
2027 mode = ECORE_WL2_WINDOW_KEYGRAB_EXCLUSIVE;
2036 return ecore_wl2_window_keygrab_set( mEcoreWindow, KeyLookup::GetKeyName( key ), 0, 0, 0, mode );
2039 bool WindowBaseEcoreWl2::UngrabKey( Dali::KEY key )
2041 return ecore_wl2_window_keygrab_unset( mEcoreWindow, KeyLookup::GetKeyName( key ), 0, 0 );
2044 bool WindowBaseEcoreWl2::GrabKeyList( const Dali::Vector< Dali::KEY >& key, const Dali::Vector< KeyGrab::KeyGrabMode >& grabMode, Dali::Vector< bool >& result )
2046 int keyCount = key.Count();
2047 int keyGrabModeCount = grabMode.Count();
2049 if( keyCount != keyGrabModeCount || keyCount == 0 )
2056 Eina_List* keyList = NULL;
2057 Ecore_Wl2_Window_Keygrab_Info* info = new Ecore_Wl2_Window_Keygrab_Info[keyCount];
2059 for( int index = 0; index < keyCount; ++index )
2061 info[index].key = const_cast< char* >( KeyLookup::GetKeyName( key[index] ) );
2063 switch( grabMode[index] )
2065 case KeyGrab::TOPMOST:
2067 info[index].mode = ECORE_WL2_WINDOW_KEYGRAB_TOPMOST;
2070 case KeyGrab::SHARED:
2072 info[index].mode = ECORE_WL2_WINDOW_KEYGRAB_SHARED;
2075 case KeyGrab::OVERRIDE_EXCLUSIVE:
2077 info[index].mode = ECORE_WL2_WINDOW_KEYGRAB_OVERRIDE_EXCLUSIVE;
2080 case KeyGrab::EXCLUSIVE:
2082 info[index].mode = ECORE_WL2_WINDOW_KEYGRAB_EXCLUSIVE;
2087 info[index].mode = ECORE_WL2_WINDOW_KEYGRAB_UNKNOWN;
2092 keyList = eina_list_append( keyList, &info );
2095 Eina_List* grabList = ecore_wl2_window_keygrab_list_set( mEcoreWindow, keyList );
2097 result.Resize( keyCount, true );
2099 Eina_List* l = NULL;
2100 Eina_List* m = NULL;
2101 void* listData = NULL;
2103 if( grabList != NULL )
2105 EINA_LIST_FOREACH( grabList, m, data )
2108 EINA_LIST_FOREACH( keyList, l, listData )
2110 if( static_cast< Ecore_Wl2_Window_Keygrab_Info* >( listData )->key == NULL )
2112 DALI_LOG_ERROR( "input key list has null data!" );
2116 if( strcmp( static_cast< char* >( data ), static_cast< Ecore_Wl2_Window_Keygrab_Info* >( listData )->key ) == 0 )
2118 result[index] = false;
2127 eina_list_free( keyList );
2128 eina_list_free( grabList );
2134 bool WindowBaseEcoreWl2::UngrabKeyList( const Dali::Vector< Dali::KEY >& key, Dali::Vector< bool >& result )
2136 int keyCount = key.Count();
2144 Eina_List* keyList = NULL;
2145 Ecore_Wl2_Window_Keygrab_Info* info = new Ecore_Wl2_Window_Keygrab_Info[keyCount];
2147 for( int index = 0; index < keyCount; ++index )
2149 info[index].key = const_cast< char* >( KeyLookup::GetKeyName( key[index] ) );
2150 keyList = eina_list_append( keyList, &info );
2153 Eina_List* ungrabList = ecore_wl2_window_keygrab_list_unset( mEcoreWindow, keyList );
2155 result.Resize( keyCount, true );
2157 Eina_List* l = NULL;
2158 Eina_List* m = NULL;
2159 void *listData = NULL;
2162 if( ungrabList != NULL )
2164 EINA_LIST_FOREACH( ungrabList, m, data )
2167 EINA_LIST_FOREACH( keyList, l, listData )
2169 if( strcmp( static_cast< char* >( data ), static_cast< Ecore_Wl2_Window_Keygrab_Info* >( listData )->key ) == 0 )
2171 result[index] = false;
2180 eina_list_free( keyList );
2181 eina_list_free( ungrabList );
2187 void WindowBaseEcoreWl2::GetDpi( unsigned int& dpiHorizontal, unsigned int& dpiVertical )
2192 Ecore_Wl2_Output* output = ecore_wl2_window_output_find( mEcoreWindow );
2194 // 1 inch = 25.4 millimeters
2195 xres = ecore_wl2_output_dpi_get( output );
2196 yres = ecore_wl2_output_dpi_get( output );
2198 dpiHorizontal = int( xres + 0.5f ); // rounding
2199 dpiVertical = int( yres + 0.5f );
2202 int WindowBaseEcoreWl2::GetScreenRotationAngle()
2206 if( ecore_wl2_window_ignore_output_transform_get( mEcoreWindow ) )
2212 transform = ecore_wl2_output_transform_get( ecore_wl2_window_output_find( mEcoreWindow ) );
2215 return transform * 90;
2218 void WindowBaseEcoreWl2::SetWindowRotationAngle( int degree )
2220 ecore_wl2_window_rotation_set( mEcoreWindow, degree );
2223 void WindowBaseEcoreWl2::WindowRotationCompleted( int degree, int width, int height )
2225 ecore_wl2_window_rotation_change_done_send( mEcoreWindow, degree, width, height );
2228 void WindowBaseEcoreWl2::SetTransparency( bool transparent )
2230 ecore_wl2_window_alpha_set( mEcoreWindow, transparent );
2233 void WindowBaseEcoreWl2::InitializeEcoreElDBus()
2235 #ifdef DALI_ELDBUS_AVAILABLE
2236 Eldbus_Object* object;
2237 Eldbus_Proxy* manager;
2239 if( !( mSystemConnection = eldbus_connection_get( ELDBUS_CONNECTION_TYPE_SYSTEM ) ) )
2241 DALI_LOG_ERROR( "Unable to get system bus\n" );
2244 object = eldbus_object_get( mSystemConnection, BUS, PATH );
2247 DALI_LOG_ERROR( "Getting object failed\n" );
2251 manager = eldbus_proxy_get( object, INTERFACE );
2254 DALI_LOG_ERROR( "Getting proxy failed\n" );
2258 if( !eldbus_proxy_signal_handler_add( manager, "GestureDetected", EcoreElDBusAccessibilityNotification, this ) )
2260 DALI_LOG_ERROR( "No signal handler returned\n" );
2265 void WindowBaseEcoreWl2::CreateWindow( PositionSize positionSize )
2267 Ecore_Wl2_Display* display = ecore_wl2_display_connect( NULL );
2270 DALI_ASSERT_ALWAYS( 0 && "Failed to get display" );
2273 mEcoreWindow = ecore_wl2_window_new( display, NULL, positionSize.x, positionSize.y, positionSize.width, positionSize.height );
2275 if ( mEcoreWindow == 0 )
2277 DALI_ASSERT_ALWAYS( 0 && "Failed to create Wayland window" );
2281 ecore_wl2_window_type_set( mEcoreWindow, ECORE_WL2_WINDOW_TYPE_TOPLEVEL );
2284 } // namespace Adaptor
2286 } // namespace Internal
2290 #pragma GCC diagnostic pop