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 windowBase->OnRotation( data, type, event );
275 return ECORE_CALLBACK_PASS_ON;
279 * Called when configure event is recevied.
281 static Eina_Bool EcoreEventConfigure( void* data, int type, void* event )
283 WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
286 windowBase->OnConfiguration( data, type, event );
288 return ECORE_CALLBACK_PASS_ON;
291 /////////////////////////////////////////////////////////////////////////////////////////////////
293 /////////////////////////////////////////////////////////////////////////////////////////////////
296 * Called when a touch down is received.
298 static Eina_Bool EcoreEventMouseButtonDown( void* data, int type, void* event )
300 WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
303 windowBase->OnMouseButtonDown( data, type, event );
305 return ECORE_CALLBACK_PASS_ON;
309 * Called when a touch up is received.
311 static Eina_Bool EcoreEventMouseButtonUp( void* data, int type, void* event )
313 WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
316 windowBase->OnMouseButtonUp( data, type, event );
318 return ECORE_CALLBACK_PASS_ON;
322 * Called when a touch motion is received.
324 static Eina_Bool EcoreEventMouseButtonMove( void* data, int type, void* event )
326 WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
329 windowBase->OnMouseButtonMove( data, type, event );
331 return ECORE_CALLBACK_PASS_ON;
335 * Called when a touch is canceled.
337 static Eina_Bool EcoreEventMouseButtonCancel( void* data, int type, void* event )
339 WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
342 windowBase->OnMouseButtonCancel( data, type, event );
344 return ECORE_CALLBACK_PASS_ON;
348 * Called when a mouse wheel is received.
350 static Eina_Bool EcoreEventMouseWheel( void* data, int type, void* event )
352 WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
355 windowBase->OnMouseWheel( data, type, event );
357 return ECORE_CALLBACK_PASS_ON;
361 * Called when a detent rotation event is recevied.
363 static Eina_Bool EcoreEventDetentRotation( void* data, int type, void* event )
365 WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
368 windowBase->OnDetentRotation( data, type, event );
370 return ECORE_CALLBACK_PASS_ON;
373 /////////////////////////////////////////////////////////////////////////////////////////////////
375 /////////////////////////////////////////////////////////////////////////////////////////////////
378 * Called when a key down is received.
380 static Eina_Bool EcoreEventKeyDown( void* data, int type, void* event )
382 WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
385 windowBase->OnKeyDown( data, type, event );
387 return ECORE_CALLBACK_PASS_ON;
391 * Called when a key up is received.
393 static Eina_Bool EcoreEventKeyUp( void* data, int type, void* event )
395 WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
398 windowBase->OnKeyUp( data, type, event );
400 return ECORE_CALLBACK_PASS_ON;
403 /////////////////////////////////////////////////////////////////////////////////////////////////
404 // Selection Callbacks
405 /////////////////////////////////////////////////////////////////////////////////////////////////
408 * Called when the source window notifies us the content in clipboard is selected.
410 static Eina_Bool EcoreEventDataSend( void* data, int type, void* event )
412 WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
415 windowBase->OnDataSend( data, type, event );
417 return ECORE_CALLBACK_PASS_ON;
421 * Called when the source window sends us about the selected content.
422 * For example, when item is selected in the clipboard.
424 static Eina_Bool EcoreEventDataReceive( void* data, int type, void* event )
426 WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
429 windowBase->OnDataReceive( data, type, event );
431 return ECORE_CALLBACK_PASS_ON;
434 /////////////////////////////////////////////////////////////////////////////////////////////////
436 /////////////////////////////////////////////////////////////////////////////////////////////////
439 * Called when a font name is changed.
441 static void VconfNotifyFontNameChanged( keynode_t* node, void* data )
443 WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
446 windowBase->OnFontNameChanged();
451 * Called when a font size is changed.
453 static void VconfNotifyFontSizeChanged( keynode_t* node, void* data )
455 WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
458 windowBase->OnFontSizeChanged();
462 /////////////////////////////////////////////////////////////////////////////////////////////////
463 // ElDBus Accessibility Callbacks
464 /////////////////////////////////////////////////////////////////////////////////////////////////
466 #ifdef DALI_ELDBUS_AVAILABLE
467 // Callback for Ecore ElDBus accessibility events.
468 static void EcoreElDBusAccessibilityNotification( void* context, const Eldbus_Message* message )
470 WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( context );
473 windowBase->OnEcoreElDBusAccessibilityNotification( context, message );
476 #endif // DALI_ELDBUS_AVAILABLE
478 static void RegistryGlobalCallback( void* data, struct wl_registry *registry, uint32_t name, const char* interface, uint32_t version )
480 WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
483 windowBase->RegistryGlobalCallback( data, registry, name, interface, version );
487 static void RegistryGlobalCallbackRemove( void* data, struct wl_registry* registry, uint32_t id )
489 WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
492 windowBase->RegistryGlobalCallbackRemove( data, registry, id );
496 static void TizenPolicyConformant( void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, uint32_t isConformant )
500 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 )
504 static void TizenPolicyNotificationChangeDone(void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, int32_t level, uint32_t state )
506 WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
509 windowBase->TizenPolicyNotificationChangeDone( data, tizenPolicy, surface, level, state );
513 static void TizenPolicyTransientForDone( void* data, struct tizen_policy* tizenPolicy, uint32_t childId )
517 static void TizenPolicyScreenModeChangeDone( void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, uint32_t mode, uint32_t state )
519 WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
522 windowBase->TizenPolicyScreenModeChangeDone( data, tizenPolicy, surface, mode, state );
526 static void TizenPolicyIconifyStateChanged( void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, uint32_t iconified, uint32_t force )
530 static void TizenPolicySupportedAuxiliaryHints( void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, struct wl_array* hints, uint32_t numNints )
534 static void TizenPolicyAllowedAuxiliaryHint( void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, int id )
538 static void TizenPolicyAuxiliaryMessage( void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, const char* key, const char* val, struct wl_array* options )
542 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 )
546 static void DisplayPolicyBrightnessChangeDone( void* data, struct tizen_display_policy *displayPolicy, struct wl_surface* surface, int32_t brightness, uint32_t state )
548 WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
551 windowBase->DisplayPolicyBrightnessChangeDone( data, displayPolicy, surface, brightness, state );
555 const struct wl_registry_listener registryListener =
557 RegistryGlobalCallback,
558 RegistryGlobalCallbackRemove
561 const struct tizen_policy_listener tizenPolicyListener =
563 TizenPolicyConformant,
564 TizenPolicyConformantArea,
565 TizenPolicyNotificationChangeDone,
566 TizenPolicyTransientForDone,
567 TizenPolicyScreenModeChangeDone,
568 TizenPolicyIconifyStateChanged,
569 TizenPolicySupportedAuxiliaryHints,
570 TizenPolicyAllowedAuxiliaryHint,
571 TizenPolicyAuxiliaryMessage,
572 TizenPolicyConformantRegion
575 const struct tizen_display_policy_listener tizenDisplayPolicyListener =
577 DisplayPolicyBrightnessChangeDone
580 } // unnamed namespace
582 WindowBaseEcoreWl2::WindowBaseEcoreWl2( Dali::PositionSize positionSize, Any surface, bool isTransparent )
583 : mEcoreEventHandler(),
584 mEcoreWindow( NULL ),
589 mTizenPolicy( NULL ),
590 mTizenDisplayPolicy( NULL ),
591 mSupportedAuxiliaryHints(),
593 mNotificationLevel( -1 ),
594 mNotificationChangeState( 0 ),
595 mNotificationLevelChangeDone( true ),
597 mScreenOffModeChangeState( 0 ),
598 mScreenOffModeChangeDone( true ),
600 mBrightnessChangeState( 0 ),
601 mBrightnessChangeDone( true ),
602 mOwnSurface( false ),
603 mMoveResizeSerial( 0 ),
604 mLastSubmittedMoveResizeSerial( 0 ),
605 mWindowRotationAngle( 0 ),
606 mScreenRotationAngle( 0 ),
607 mSupportedPreProtation( 0 )
608 #ifdef DALI_ELDBUS_AVAILABLE
609 , mSystemConnection( NULL )
612 Initialize( positionSize, surface, isTransparent );
615 WindowBaseEcoreWl2::~WindowBaseEcoreWl2()
617 #ifdef DALI_ELDBUS_AVAILABLE
618 // Close down ElDBus connections.
619 if( mSystemConnection )
621 eldbus_connection_unref( mSystemConnection );
623 #endif // DALI_ELDBUS_AVAILABLE
625 vconf_ignore_key_changed( VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, VconfNotifyFontSizeChanged );
626 vconf_ignore_key_changed( DALI_VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_NAME, VconfNotifyFontNameChanged );
628 for( Dali::Vector< Ecore_Event_Handler* >::Iterator iter = mEcoreEventHandler.Begin(), endIter = mEcoreEventHandler.End(); iter != endIter; ++iter )
630 ecore_event_handler_del( *iter );
632 mEcoreEventHandler.Clear();
636 wl_event_queue_destroy( mEventQueue );
639 mSupportedAuxiliaryHints.clear();
640 mAuxiliaryHints.clear();
642 if( mEglWindow != NULL )
644 wl_egl_window_destroy( mEglWindow );
650 ecore_wl2_window_free( mEcoreWindow );
652 WindowSystem::Shutdown();
656 void WindowBaseEcoreWl2::Initialize( PositionSize positionSize, Any surface, bool isTransparent )
658 if( surface.Empty() == false )
660 // check we have a valid type
661 DALI_ASSERT_ALWAYS( ( surface.GetType() == typeid (Ecore_Wl2_Window *) ) && "Surface type is invalid" );
663 mEcoreWindow = AnyCast< Ecore_Wl2_Window* >( surface );
667 // we own the surface about to created
668 WindowSystem::Initialize();
671 CreateWindow( positionSize );
674 mWlSurface = ecore_wl2_window_surface_get( mEcoreWindow );
676 SetTransparency( isTransparent );
678 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_WL2_EVENT_WINDOW_ICONIFY_STATE_CHANGE, EcoreEventWindowIconifyStateChanged, this ) );
679 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_WL2_EVENT_FOCUS_IN, EcoreEventWindowFocusIn, this ) );
680 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_WL2_EVENT_FOCUS_OUT, EcoreEventWindowFocusOut, this ) );
681 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_WL2_EVENT_OUTPUT_TRANSFORM, EcoreEventOutputTransform, this ) );
682 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_WL2_EVENT_IGNORE_OUTPUT_TRANSFORM, EcoreEventIgnoreOutputTransform, this ) );
684 // Register Rotate event
685 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_WL2_EVENT_WINDOW_ROTATE, EcoreEventRotate, this ) );
687 // Register Configure event
688 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_WL2_EVENT_WINDOW_CONFIGURE, EcoreEventConfigure, this ) );
690 // Register Touch events
691 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_EVENT_MOUSE_BUTTON_DOWN, EcoreEventMouseButtonDown, this ) );
692 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_EVENT_MOUSE_BUTTON_UP, EcoreEventMouseButtonUp, this ) );
693 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_EVENT_MOUSE_MOVE, EcoreEventMouseButtonMove, this ) );
694 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_EVENT_MOUSE_BUTTON_CANCEL, EcoreEventMouseButtonCancel, this ) );
696 // Register Mouse wheel events
697 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_EVENT_MOUSE_WHEEL, EcoreEventMouseWheel, this ) );
699 // Register Detent event
700 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_EVENT_DETENT_ROTATE, EcoreEventDetentRotation, this ) );
702 // Register Key events
703 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_EVENT_KEY_DOWN, EcoreEventKeyDown, this ) );
704 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_EVENT_KEY_UP, EcoreEventKeyUp, this ) );
706 // Register Selection event - clipboard selection
707 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_WL2_EVENT_DATA_SOURCE_SEND, EcoreEventDataSend, this ) );
708 mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_WL2_EVENT_SELECTION_DATA_READY, EcoreEventDataReceive, this ) );
710 // Register Vconf notify - font name and size
711 vconf_notify_key_changed( DALI_VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_NAME, VconfNotifyFontNameChanged, this );
712 vconf_notify_key_changed( VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, VconfNotifyFontSizeChanged, this );
714 InitializeEcoreElDBus();
716 Ecore_Wl2_Display* display = ecore_wl2_connected_display_get( NULL );
717 mDisplay = ecore_wl2_display_get( display );
721 wl_display* displayWrapper = static_cast< wl_display* >( wl_proxy_create_wrapper( mDisplay ) );
724 mEventQueue = wl_display_create_queue( mDisplay );
727 wl_proxy_set_queue( reinterpret_cast< wl_proxy* >( displayWrapper ), mEventQueue );
729 wl_registry* registry = wl_display_get_registry( displayWrapper );
730 wl_registry_add_listener( registry, ®istryListener, this );
733 wl_proxy_wrapper_destroy( displayWrapper );
737 // get auxiliary hint
738 Eina_List* hints = ecore_wl2_window_aux_hints_supported_get( mEcoreWindow );
744 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) ) ) )
746 mSupportedAuxiliaryHints.push_back( hint );
748 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::Initialize: %s\n", hint );
753 Eina_Bool WindowBaseEcoreWl2::OnIconifyStateChanged( void* data, int type, void* event )
755 Ecore_Wl2_Event_Window_Iconify_State_Change* iconifyChangedEvent( static_cast< Ecore_Wl2_Event_Window_Iconify_State_Change* >( event ) );
756 Eina_Bool handled( ECORE_CALLBACK_PASS_ON );
758 if( iconifyChangedEvent->win == static_cast< unsigned int>( ecore_wl2_window_id_get( mEcoreWindow ) ) )
760 if( iconifyChangedEvent->iconified == EINA_TRUE )
762 mIconifyChangedSignal.Emit( true );
766 mIconifyChangedSignal.Emit( false );
768 handled = ECORE_CALLBACK_DONE;
774 Eina_Bool WindowBaseEcoreWl2::OnFocusIn( void* data, int type, void* event )
776 Ecore_Wl2_Event_Focus_In* focusInEvent( static_cast< Ecore_Wl2_Event_Focus_In* >( event ) );
778 if( focusInEvent->window == static_cast< unsigned int >( ecore_wl2_window_id_get( mEcoreWindow ) ) )
780 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "Window EcoreEventWindowFocusIn\n" );
782 mFocusChangedSignal.Emit( true );
785 return ECORE_CALLBACK_PASS_ON;
788 Eina_Bool WindowBaseEcoreWl2::OnFocusOut( void* data, int type, void* event )
790 Ecore_Wl2_Event_Focus_Out* focusOutEvent( static_cast< Ecore_Wl2_Event_Focus_Out* >( event ) );
792 if( focusOutEvent->window == static_cast< unsigned int >( ecore_wl2_window_id_get( mEcoreWindow ) ) )
794 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "Window EcoreEventWindowFocusOut\n" );
796 mFocusChangedSignal.Emit( false );
799 return ECORE_CALLBACK_PASS_ON;
802 Eina_Bool WindowBaseEcoreWl2::OnOutputTransform( void* data, int type, void* event )
804 Ecore_Wl2_Event_Output_Transform* transformEvent( static_cast< Ecore_Wl2_Event_Output_Transform* >( event ) );
806 if( transformEvent->output == ecore_wl2_window_output_find( mEcoreWindow ) )
808 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "Window (%p) EcoreEventOutputTransform\n", mEcoreWindow );
810 mOutputTransformedSignal.Emit();
813 return ECORE_CALLBACK_PASS_ON;
816 Eina_Bool WindowBaseEcoreWl2::OnIgnoreOutputTransform( void* data, int type, void* event )
818 Ecore_Wl2_Event_Ignore_Output_Transform* ignoreTransformEvent( static_cast< Ecore_Wl2_Event_Ignore_Output_Transform* >( event ) );
820 if( ignoreTransformEvent->win == mEcoreWindow )
822 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "Window (%p) EcoreEventIgnoreOutputTransform\n", mEcoreWindow );
824 mOutputTransformedSignal.Emit();
827 return ECORE_CALLBACK_PASS_ON;
830 void WindowBaseEcoreWl2::OnRotation( void* data, int type, void* event )
832 Ecore_Wl2_Event_Window_Rotation* ev( static_cast< Ecore_Wl2_Event_Window_Rotation* >( event ) );
834 if( ev->win == static_cast< unsigned int >( ecore_wl2_window_id_get( mEcoreWindow ) ) )
836 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Concise, "WindowBaseEcoreWl2::OnRotation\n" );
838 RotationEvent rotationEvent;
839 rotationEvent.angle = ev->angle;
840 rotationEvent.winResize = 0;
842 if( ev->angle == 0 || ev->angle == 180 )
844 rotationEvent.width = ev->w;
845 rotationEvent.height = ev->h;
849 rotationEvent.width = ev->h;
850 rotationEvent.height = ev->w;
853 mRotationSignal.Emit( rotationEvent );
857 void WindowBaseEcoreWl2::OnConfiguration( void* data, int type, void* event )
859 Ecore_Wl2_Event_Window_Configure* ev( static_cast< Ecore_Wl2_Event_Window_Configure* >( event ) );
861 if( ev->win == static_cast< unsigned int >( ecore_wl2_window_id_get( mEcoreWindow ) ) )
863 // Note: To comply with the wayland protocol, Dali should make an ack_configure
864 // by calling ecore_wl2_window_commit
865 ecore_wl2_window_commit(mEcoreWindow, EINA_FALSE);
869 void WindowBaseEcoreWl2::OnMouseButtonDown( void* data, int type, void* event )
871 Ecore_Event_Mouse_Button* touchEvent = static_cast< Ecore_Event_Mouse_Button* >( event );
873 if( touchEvent->window == static_cast< unsigned int >( ecore_wl2_window_id_get( mEcoreWindow ) ) )
875 Device::Class::Type deviceClass;
876 Device::Subclass::Type deviceSubclass;
878 GetDeviceClass( ecore_device_class_get( touchEvent->dev ), deviceClass );
879 GetDeviceSubclass( ecore_device_subclass_get( touchEvent->dev ), deviceSubclass );
881 PointState::Type state ( PointState::DOWN );
883 if( deviceClass != Device::Class::Type::MOUSE )
885 // Check if the buttons field is set and ensure it's the primary touch button.
886 // If this event was triggered by buttons other than the primary button (used for touch), then
887 // just send an interrupted event to Core.
888 if( touchEvent->buttons && (touchEvent->buttons != PRIMARY_TOUCH_BUTTON_ID ) )
890 state = PointState::INTERRUPTED;
894 Integration::Point point;
895 point.SetDeviceId( touchEvent->multi.device );
896 point.SetState( state );
897 point.SetScreenPosition( Vector2( touchEvent->x, touchEvent->y ) );
898 point.SetRadius( touchEvent->multi.radius, Vector2( touchEvent->multi.radius_x, touchEvent->multi.radius_y ) );
899 point.SetPressure( touchEvent->multi.pressure );
900 point.SetAngle( Degree( touchEvent->multi.angle ) );
901 point.SetDeviceClass( deviceClass );
902 point.SetDeviceSubclass( deviceSubclass );
903 point.SetMouseButton( static_cast< MouseButton::Type >( touchEvent->buttons) );
905 mTouchEventSignal.Emit( point, touchEvent->timestamp );
909 void WindowBaseEcoreWl2::OnMouseButtonUp( void* data, int type, void* event )
911 Ecore_Event_Mouse_Button* touchEvent = static_cast< Ecore_Event_Mouse_Button* >( event );
913 if( touchEvent->window == static_cast< unsigned int >( ecore_wl2_window_id_get( mEcoreWindow ) ) )
915 Device::Class::Type deviceClass;
916 Device::Subclass::Type deviceSubclass;
918 GetDeviceClass( ecore_device_class_get( touchEvent->dev ), deviceClass );
919 GetDeviceSubclass( ecore_device_subclass_get( touchEvent->dev ), deviceSubclass );
921 Integration::Point point;
922 point.SetDeviceId( touchEvent->multi.device );
923 point.SetState( PointState::UP );
924 point.SetScreenPosition( Vector2( touchEvent->x, touchEvent->y ) );
925 point.SetRadius( touchEvent->multi.radius, Vector2( touchEvent->multi.radius_x, touchEvent->multi.radius_y ) );
926 point.SetPressure( touchEvent->multi.pressure );
927 point.SetAngle( Degree( touchEvent->multi.angle ) );
928 point.SetDeviceClass( deviceClass );
929 point.SetDeviceSubclass( deviceSubclass );
930 point.SetMouseButton( static_cast< MouseButton::Type >( touchEvent->buttons) );
932 mTouchEventSignal.Emit( point, touchEvent->timestamp );
936 void WindowBaseEcoreWl2::OnMouseButtonMove( void* data, int type, void* event )
938 Ecore_Event_Mouse_Move* touchEvent = static_cast< Ecore_Event_Mouse_Move* >( event );
940 if( touchEvent->window == static_cast< unsigned int >( ecore_wl2_window_id_get( mEcoreWindow ) ) )
942 Device::Class::Type deviceClass;
943 Device::Subclass::Type deviceSubclass;
945 GetDeviceClass( ecore_device_class_get( touchEvent->dev ), deviceClass );
946 GetDeviceSubclass( ecore_device_subclass_get( touchEvent->dev ), deviceSubclass );
948 Integration::Point point;
949 point.SetDeviceId( touchEvent->multi.device );
950 point.SetState( PointState::MOTION );
951 point.SetScreenPosition( Vector2( touchEvent->x, touchEvent->y ) );
952 point.SetRadius( touchEvent->multi.radius, Vector2( touchEvent->multi.radius_x, touchEvent->multi.radius_y ) );
953 point.SetPressure( touchEvent->multi.pressure );
954 point.SetAngle( Degree( touchEvent->multi.angle ) );
955 point.SetDeviceClass( deviceClass );
956 point.SetDeviceSubclass( deviceSubclass );
958 mTouchEventSignal.Emit( point, touchEvent->timestamp );
962 void WindowBaseEcoreWl2::OnMouseButtonCancel( void* data, int type, void* event )
964 Ecore_Event_Mouse_Button* touchEvent = static_cast< Ecore_Event_Mouse_Button* >( event );
966 if( touchEvent->window == static_cast< unsigned int >( ecore_wl2_window_id_get( mEcoreWindow ) ) )
968 Integration::Point point;
969 point.SetDeviceId( touchEvent->multi.device );
970 point.SetState( PointState::INTERRUPTED );
971 point.SetScreenPosition( Vector2( 0.0f, 0.0f ) );
973 mTouchEventSignal.Emit( point, touchEvent->timestamp );
975 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::OnMouseButtonCancel\n" );
979 void WindowBaseEcoreWl2::OnMouseWheel( void* data, int type, void* event )
981 Ecore_Event_Mouse_Wheel* mouseWheelEvent = static_cast< Ecore_Event_Mouse_Wheel* >( event );
983 if( mouseWheelEvent->window == static_cast< unsigned int >( ecore_wl2_window_id_get( mEcoreWindow ) ) )
985 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::OnMouseWheel: direction: %d, modifiers: %d, x: %d, y: %d, z: %d\n", mouseWheelEvent->direction, mouseWheelEvent->modifiers, mouseWheelEvent->x, mouseWheelEvent->y, mouseWheelEvent->z );
987 WheelEvent wheelEvent( WheelEvent::MOUSE_WHEEL, mouseWheelEvent->direction, mouseWheelEvent->modifiers, Vector2( mouseWheelEvent->x, mouseWheelEvent->y ), mouseWheelEvent->z, mouseWheelEvent->timestamp );
989 mWheelEventSignal.Emit( wheelEvent );
993 void WindowBaseEcoreWl2::OnDetentRotation( void* data, int type, void* event )
995 Ecore_Event_Detent_Rotate* detentEvent = static_cast< Ecore_Event_Detent_Rotate* >( event );
997 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Concise, "WindowBaseEcoreWl2::OnDetentRotation\n" );
999 int direction = ( detentEvent->direction == ECORE_DETENT_DIRECTION_CLOCKWISE ) ? 1 : -1;
1000 int timeStamp = detentEvent->timestamp;
1002 WheelEvent wheelEvent( WheelEvent::CUSTOM_WHEEL, 0, 0, Vector2( 0.0f, 0.0f ), direction, timeStamp );
1004 mWheelEventSignal.Emit( wheelEvent );
1007 void WindowBaseEcoreWl2::OnKeyDown( void* data, int type, void* event )
1009 Ecore_Event_Key* keyEvent = static_cast< Ecore_Event_Key* >( event );
1011 if( keyEvent->window == static_cast< unsigned int >( ecore_wl2_window_id_get( mEcoreWindow ) ) )
1013 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::OnKeyDown\n" );
1015 std::string keyName( keyEvent->keyname );
1016 std::string logicalKey( "" );
1017 std::string keyString( "" );
1018 std::string compose( "" );
1020 // Ensure key compose string is not NULL as keys like SHIFT or arrow have a null string.
1021 if( keyEvent->compose )
1023 compose = keyEvent->compose;
1026 // Ensure key symbol is not NULL as keys like SHIFT have a null string.
1029 logicalKey = keyEvent->key;
1032 int keyCode = KeyLookup::GetDaliKeyCode( keyEvent->keyname );
1033 keyCode = ( keyCode == -1 ) ? 0 : keyCode;
1034 int modifier( keyEvent->modifiers );
1035 unsigned long time = keyEvent->timestamp;
1036 if( !strncmp( keyEvent->keyname, "Keycode-", 8 ) )
1038 keyCode = atoi( keyEvent->keyname + 8 );
1041 // Ensure key event string is not NULL as keys like SHIFT have a null string.
1042 if( keyEvent->string )
1044 keyString = keyEvent->string;
1047 std::string deviceName;
1048 Device::Class::Type deviceClass;
1049 Device::Subclass::Type deviceSubclass;
1051 GetDeviceName( keyEvent, deviceName );
1052 GetDeviceClass( ecore_device_class_get( keyEvent->dev ), deviceClass );
1053 GetDeviceSubclass( ecore_device_subclass_get( keyEvent->dev ), deviceSubclass );
1055 Integration::KeyEvent keyEvent( keyName, logicalKey, keyString, keyCode, modifier, time, Integration::KeyEvent::Down, compose, deviceName, deviceClass, deviceSubclass );
1057 mKeyEventSignal.Emit( keyEvent );
1061 void WindowBaseEcoreWl2::OnKeyUp( void* data, int type, void* event )
1063 Ecore_Event_Key* keyEvent = static_cast< Ecore_Event_Key* >( event );
1065 if( keyEvent->window == static_cast< unsigned int >( ecore_wl2_window_id_get( mEcoreWindow ) ) )
1067 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::OnKeyUp\n" );
1069 std::string keyName( keyEvent->keyname );
1070 std::string logicalKey( "" );
1071 std::string keyString( "" );
1072 std::string compose( "" );
1074 // Ensure key compose string is not NULL as keys like SHIFT or arrow have a null string.
1075 if( keyEvent->compose )
1077 compose = keyEvent->compose;
1080 // Ensure key symbol is not NULL as keys like SHIFT have a null string.
1083 logicalKey = keyEvent->key;
1086 int keyCode = KeyLookup::GetDaliKeyCode( keyEvent->keyname );
1087 keyCode = ( keyCode == -1 ) ? 0 : keyCode;
1088 int modifier( keyEvent->modifiers );
1089 unsigned long time = keyEvent->timestamp;
1090 if( !strncmp( keyEvent->keyname, "Keycode-", 8 ) )
1092 keyCode = atoi( keyEvent->keyname + 8 );
1095 // Ensure key event string is not NULL as keys like SHIFT have a null string.
1096 if( keyEvent->string )
1098 keyString = keyEvent->string;
1101 std::string deviceName;
1102 Device::Class::Type deviceClass;
1103 Device::Subclass::Type deviceSubclass;
1105 GetDeviceName( keyEvent, deviceName );
1106 GetDeviceClass( ecore_device_class_get( keyEvent->dev ), deviceClass );
1107 GetDeviceSubclass( ecore_device_subclass_get( keyEvent->dev ), deviceSubclass );
1109 Integration::KeyEvent keyEvent( keyName, logicalKey, keyString, keyCode, modifier, time, Integration::KeyEvent::Up, compose, deviceName, deviceClass, deviceSubclass );
1111 mKeyEventSignal.Emit( keyEvent );
1115 void WindowBaseEcoreWl2::OnDataSend( void* data, int type, void* event )
1117 mSelectionDataSendSignal.Emit( event );
1120 void WindowBaseEcoreWl2::OnDataReceive( void* data, int type, void* event )
1122 mSelectionDataReceivedSignal.Emit( event );
1125 void WindowBaseEcoreWl2::OnFontNameChanged()
1127 mStyleChangedSignal.Emit( StyleChange::DEFAULT_FONT_CHANGE );
1130 void WindowBaseEcoreWl2::OnFontSizeChanged()
1132 mStyleChangedSignal.Emit( StyleChange::DEFAULT_FONT_SIZE_CHANGE );
1135 void WindowBaseEcoreWl2::OnEcoreElDBusAccessibilityNotification( void* context, const Eldbus_Message* message )
1137 #ifdef DALI_ELDBUS_AVAILABLE
1138 AccessibilityInfo info;
1140 // The string defines the arg-list's respective types.
1141 if( !eldbus_message_arguments_get( message, "iiiiiiu", &info.gestureValue, &info.startX, &info.startY, &info.endX, &info.endY, &info.state, &info.eventTime ) )
1143 DALI_LOG_ERROR( "OnEcoreElDBusAccessibilityNotification: Error getting arguments\n" );
1146 mAccessibilitySignal.Emit( info );
1150 void WindowBaseEcoreWl2::RegistryGlobalCallback( void* data, struct wl_registry *registry, uint32_t name, const char* interface, uint32_t version )
1152 if( strcmp( interface, tizen_policy_interface.name ) == 0 )
1154 uint32_t clientVersion = std::min( version, MAX_TIZEN_CLIENT_VERSION );
1156 mTizenPolicy = static_cast< tizen_policy* >( wl_registry_bind( registry, name, &tizen_policy_interface, clientVersion ) );
1159 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::RegistryGlobalCallback: wl_registry_bind(tizen_policy_interface) is failed.\n" );
1163 tizen_policy_add_listener( mTizenPolicy, &tizenPolicyListener, data );
1165 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::RegistryGlobalCallback: tizen_policy_add_listener is called.\n" );
1167 else if( strcmp( interface, tizen_display_policy_interface.name ) == 0 )
1169 mTizenDisplayPolicy = static_cast< tizen_display_policy* >( wl_registry_bind( registry, name, &tizen_display_policy_interface, version ) );
1170 if( !mTizenDisplayPolicy )
1172 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::RegistryGlobalCallback: wl_registry_bind(tizen_display_policy_interface) is failed.\n" );
1176 tizen_display_policy_add_listener( mTizenDisplayPolicy, &tizenDisplayPolicyListener, data );
1178 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::RegistryGlobalCallback: tizen_display_policy_add_listener is called.\n" );
1182 void WindowBaseEcoreWl2::RegistryGlobalCallbackRemove( void* data, struct wl_registry* registry, uint32_t id )
1184 mTizenPolicy = NULL;
1185 mTizenDisplayPolicy = NULL;
1188 void WindowBaseEcoreWl2::TizenPolicyNotificationChangeDone(void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, int32_t level, uint32_t state )
1190 mNotificationLevel = level;
1191 mNotificationChangeState = state;
1192 mNotificationLevelChangeDone = true;
1194 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::TizenPolicyNotificationChangeDone: level = %d, state = %d\n", level, state );
1197 void WindowBaseEcoreWl2::TizenPolicyScreenModeChangeDone( void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, uint32_t mode, uint32_t state )
1199 mScreenOffMode = mode;
1200 mScreenOffModeChangeState = state;
1201 mScreenOffModeChangeDone = true;
1203 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::TizenPolicyScreenModeChangeDone: mode = %d, state = %d\n", mode, state );
1206 void WindowBaseEcoreWl2::DisplayPolicyBrightnessChangeDone( void* data, struct tizen_display_policy *displayPolicy, struct wl_surface* surface, int32_t brightness, uint32_t state )
1208 mBrightness = brightness;
1209 mBrightnessChangeState = state;
1210 mBrightnessChangeDone = true;
1212 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::DisplayPolicyBrightnessChangeDone: brightness = %d, state = %d\n", brightness, state );
1215 Any WindowBaseEcoreWl2::GetNativeWindow()
1217 return mEcoreWindow;
1220 int WindowBaseEcoreWl2::GetNativeWindowId()
1222 return ecore_wl2_window_id_get( mEcoreWindow );
1225 EGLNativeWindowType WindowBaseEcoreWl2::CreateEglWindow( int width, int height )
1227 mEglWindow = wl_egl_window_create( mWlSurface, width, height );
1229 return static_cast< EGLNativeWindowType >( mEglWindow );
1232 void WindowBaseEcoreWl2::DestroyEglWindow()
1234 if( mEglWindow != NULL )
1236 wl_egl_window_destroy( mEglWindow );
1241 void WindowBaseEcoreWl2::SetEglWindowRotation( int angle )
1243 wl_egl_window_tizen_rotation rotation;
1249 rotation = WL_EGL_WINDOW_TIZEN_ROTATION_0 ;
1254 rotation = WL_EGL_WINDOW_TIZEN_ROTATION_90;
1259 rotation = WL_EGL_WINDOW_TIZEN_ROTATION_180;
1264 rotation = WL_EGL_WINDOW_TIZEN_ROTATION_90;
1269 rotation = WL_EGL_WINDOW_TIZEN_ROTATION_0 ;
1274 wl_egl_window_tizen_set_rotation( mEglWindow, rotation );
1277 void WindowBaseEcoreWl2::SetEglWindowBufferTransform( int angle )
1279 wl_output_transform bufferTransform;
1285 bufferTransform = WL_OUTPUT_TRANSFORM_NORMAL;
1290 bufferTransform = WL_OUTPUT_TRANSFORM_90;
1295 bufferTransform = WL_OUTPUT_TRANSFORM_180;
1300 bufferTransform = WL_OUTPUT_TRANSFORM_270;
1305 bufferTransform = WL_OUTPUT_TRANSFORM_NORMAL;
1310 wl_egl_window_tizen_set_buffer_transform( mEglWindow, bufferTransform );
1313 void WindowBaseEcoreWl2::SetEglWindowTransform( int angle )
1315 wl_output_transform windowTransform;
1321 windowTransform = WL_OUTPUT_TRANSFORM_NORMAL;
1326 windowTransform = WL_OUTPUT_TRANSFORM_90;
1331 windowTransform = WL_OUTPUT_TRANSFORM_180;
1336 windowTransform = WL_OUTPUT_TRANSFORM_270;
1341 windowTransform = WL_OUTPUT_TRANSFORM_NORMAL;
1346 wl_egl_window_tizen_set_window_transform( mEglWindow, windowTransform );
1349 void WindowBaseEcoreWl2::ResizeEglWindow( PositionSize positionSize )
1351 wl_egl_window_resize( mEglWindow, positionSize.width, positionSize.height, positionSize.x, positionSize.y );
1353 // Note: Both "Resize" and "MoveResize" cases can reach here, but only "MoveResize" needs to submit serial number
1354 if( mMoveResizeSerial != mLastSubmittedMoveResizeSerial )
1356 wl_egl_window_tizen_set_window_serial( mEglWindow, mMoveResizeSerial );
1357 mLastSubmittedMoveResizeSerial = mMoveResizeSerial;
1361 bool WindowBaseEcoreWl2::IsEglWindowRotationSupported()
1364 wl_egl_window_tizen_capability capability = static_cast< wl_egl_window_tizen_capability >( wl_egl_window_tizen_get_capabilities( mEglWindow ) );
1365 if( capability == WL_EGL_WINDOW_TIZEN_CAPABILITY_ROTATION_SUPPORTED )
1367 mSupportedPreProtation = true;
1370 mSupportedPreProtation = false;
1374 void WindowBaseEcoreWl2::Move( PositionSize positionSize )
1376 ecore_wl2_window_position_set( mEcoreWindow, positionSize.x, positionSize.y );
1379 void WindowBaseEcoreWl2::Resize( PositionSize positionSize )
1381 ecore_wl2_window_geometry_set( mEcoreWindow, positionSize.x, positionSize.y, positionSize.width, positionSize.height );
1384 void WindowBaseEcoreWl2::MoveResize( PositionSize positionSize )
1386 ecore_wl2_window_sync_geometry_set( mEcoreWindow, ++mMoveResizeSerial, positionSize.x, positionSize.y, positionSize.width, positionSize.height );
1389 void WindowBaseEcoreWl2::SetClass( const std::string& name, const std::string& className )
1391 ecore_wl2_window_title_set( mEcoreWindow, name.c_str() );
1392 ecore_wl2_window_class_set( mEcoreWindow, className.c_str() );
1395 void WindowBaseEcoreWl2::Raise()
1397 // Use ecore_wl2_window_activate to prevent the window shown without rendering
1398 ecore_wl2_window_activate( mEcoreWindow );
1401 void WindowBaseEcoreWl2::Lower()
1403 ecore_wl2_window_lower( mEcoreWindow );
1406 void WindowBaseEcoreWl2::Activate()
1408 ecore_wl2_window_activate( mEcoreWindow );
1411 void WindowBaseEcoreWl2::SetAvailableOrientations( const std::vector< Dali::Window::WindowOrientation >& orientations )
1413 int rotations[4] = { 0 };
1414 for( std::size_t i = 0; i < orientations.size(); ++i )
1416 rotations[i] = static_cast< int >( orientations[i] );
1418 ecore_wl2_window_available_rotations_set( mEcoreWindow, rotations, orientations.size() );
1421 void WindowBaseEcoreWl2::SetPreferredOrientation( Dali::Window::WindowOrientation orientation )
1423 ecore_wl2_window_preferred_rotation_set( mEcoreWindow, orientation );
1426 void WindowBaseEcoreWl2::SetAcceptFocus( bool accept )
1428 ecore_wl2_window_focus_skip_set( mEcoreWindow, !accept );
1431 void WindowBaseEcoreWl2::Show()
1433 ecore_wl2_window_show( mEcoreWindow );
1436 void WindowBaseEcoreWl2::Hide()
1438 ecore_wl2_window_hide( mEcoreWindow );
1441 unsigned int WindowBaseEcoreWl2::GetSupportedAuxiliaryHintCount() const
1443 return mSupportedAuxiliaryHints.size();
1446 std::string WindowBaseEcoreWl2::GetSupportedAuxiliaryHint( unsigned int index ) const
1448 if( index >= GetSupportedAuxiliaryHintCount() )
1450 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetSupportedAuxiliaryHint: Invalid index! [%d]\n", index );
1453 return mSupportedAuxiliaryHints[index];
1456 unsigned int WindowBaseEcoreWl2::AddAuxiliaryHint( const std::string& hint, const std::string& value )
1458 bool supported = false;
1460 // Check if the hint is suppported
1461 for( std::vector< std::string >::iterator iter = mSupportedAuxiliaryHints.begin(); iter != mSupportedAuxiliaryHints.end(); ++iter )
1472 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Concise, "WindowBaseEcoreWl2::AddAuxiliaryHint: Not supported auxiliary hint [%s]\n", hint.c_str() );
1476 // Check if the hint is already added
1477 for( unsigned int i = 0; i < mAuxiliaryHints.size(); i++ )
1479 if( mAuxiliaryHints[i].first == hint )
1481 // Just change the value
1482 mAuxiliaryHints[i].second = value;
1484 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::AddAuxiliaryHint: Change! hint = %s, value = %s, id = %d\n", hint.c_str(), value.c_str(), i + 1 );
1486 return i + 1; // id is index + 1
1491 mAuxiliaryHints.push_back( std::pair< std::string, std::string >( hint, value ) );
1493 unsigned int id = mAuxiliaryHints.size();
1495 ecore_wl2_window_aux_hint_add( mEcoreWindow, static_cast< int >( id ), hint.c_str(), value.c_str() );
1497 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::AddAuxiliaryHint: hint = %s, value = %s, id = %d\n", hint.c_str(), value.c_str(), id );
1502 bool WindowBaseEcoreWl2::RemoveAuxiliaryHint( unsigned int id )
1504 if( id == 0 || id > mAuxiliaryHints.size() )
1506 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Concise, "WindowBaseEcoreWl2::RemoveAuxiliaryHint: Invalid id [%d]\n", id );
1510 mAuxiliaryHints[id - 1].second = std::string();
1512 ecore_wl2_window_aux_hint_del( mEcoreWindow, static_cast< int >( id ) );
1514 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::RemoveAuxiliaryHint: id = %d, hint = %s\n", id, mAuxiliaryHints[id - 1].first.c_str() );
1519 bool WindowBaseEcoreWl2::SetAuxiliaryHintValue( unsigned int id, const std::string& value )
1521 if( id == 0 || id > mAuxiliaryHints.size() )
1523 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Concise, "WindowBaseEcoreWl2::SetAuxiliaryHintValue: Invalid id [%d]\n", id );
1527 mAuxiliaryHints[id - 1].second = value;
1529 ecore_wl2_window_aux_hint_change( mEcoreWindow, static_cast< int >( id ), value.c_str() );
1531 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() );
1536 std::string WindowBaseEcoreWl2::GetAuxiliaryHintValue( unsigned int id ) const
1538 if( id == 0 || id > mAuxiliaryHints.size() )
1540 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Concise, "WindowBaseEcoreWl2::GetAuxiliaryHintValue: Invalid id [%d]\n", id );
1541 return std::string();
1544 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() );
1546 return mAuxiliaryHints[id - 1].second;
1549 unsigned int WindowBaseEcoreWl2::GetAuxiliaryHintId( const std::string& hint ) const
1551 for( unsigned int i = 0; i < mAuxiliaryHints.size(); i++ )
1553 if( mAuxiliaryHints[i].first == hint )
1555 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetAuxiliaryHintId: hint = %s, id = %d\n", hint.c_str(), i + 1 );
1560 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetAuxiliaryHintId: Invalid hint! [%s]\n", hint.c_str() );
1565 void WindowBaseEcoreWl2::SetInputRegion( const Rect< int >& inputRegion )
1567 ecore_wl2_window_input_region_set( mEcoreWindow, inputRegion.x, inputRegion.y, inputRegion.width, inputRegion.height );
1570 void WindowBaseEcoreWl2::SetType( Dali::Window::Type type )
1572 Ecore_Wl2_Window_Type windowType;
1576 case Dali::Window::NORMAL:
1578 windowType = ECORE_WL2_WINDOW_TYPE_TOPLEVEL;
1581 case Dali::Window::NOTIFICATION:
1583 windowType = ECORE_WL2_WINDOW_TYPE_NOTIFICATION;
1586 case Dali::Window::UTILITY:
1588 windowType = ECORE_WL2_WINDOW_TYPE_UTILITY;
1591 case Dali::Window::DIALOG:
1593 windowType = ECORE_WL2_WINDOW_TYPE_DIALOG;
1598 windowType = ECORE_WL2_WINDOW_TYPE_TOPLEVEL;
1603 ecore_wl2_window_type_set( mEcoreWindow, windowType );
1606 bool WindowBaseEcoreWl2::SetNotificationLevel( Dali::Window::NotificationLevel::Type level )
1608 while( !mTizenPolicy )
1610 wl_display_dispatch_queue( mDisplay, mEventQueue );
1613 int notificationLevel;
1617 case Dali::Window::NotificationLevel::NONE:
1619 notificationLevel = TIZEN_POLICY_LEVEL_NONE;
1622 case Dali::Window::NotificationLevel::BASE:
1624 notificationLevel = TIZEN_POLICY_LEVEL_DEFAULT;
1627 case Dali::Window::NotificationLevel::MEDIUM:
1629 notificationLevel = TIZEN_POLICY_LEVEL_MEDIUM;
1632 case Dali::Window::NotificationLevel::HIGH:
1634 notificationLevel = TIZEN_POLICY_LEVEL_HIGH;
1637 case Dali::Window::NotificationLevel::TOP:
1639 notificationLevel = TIZEN_POLICY_LEVEL_TOP;
1644 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetNotificationLevel: invalid level [%d]\n", level );
1645 notificationLevel = TIZEN_POLICY_LEVEL_DEFAULT;
1650 mNotificationLevelChangeDone = false;
1651 mNotificationChangeState = TIZEN_POLICY_ERROR_STATE_NONE;
1653 tizen_policy_set_notification_level( mTizenPolicy, ecore_wl2_window_surface_get( mEcoreWindow ), notificationLevel );
1657 while( !mNotificationLevelChangeDone && count < 3 )
1659 ecore_wl2_display_flush( ecore_wl2_connected_display_get( NULL ) );
1660 wl_display_dispatch_queue( mDisplay, mEventQueue );
1664 if( !mNotificationLevelChangeDone )
1666 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetNotificationLevel: Level change is failed [%d, %d]\n", level, mNotificationChangeState );
1669 else if( mNotificationChangeState == TIZEN_POLICY_ERROR_STATE_PERMISSION_DENIED )
1671 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetNotificationLevel: Permission denied! [%d]\n", level );
1675 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetNotificationLevel: Level is changed [%d]\n", mNotificationLevel );
1680 Dali::Window::NotificationLevel::Type WindowBaseEcoreWl2::GetNotificationLevel() const
1682 while( !mTizenPolicy )
1684 wl_display_dispatch_queue( mDisplay, mEventQueue );
1689 while( !mNotificationLevelChangeDone && count < 3 )
1691 ecore_wl2_display_flush( ecore_wl2_connected_display_get( NULL ) );
1692 wl_display_dispatch_queue( mDisplay, mEventQueue );
1696 if( !mNotificationLevelChangeDone )
1698 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetNotificationLevel: Error! [%d]\n", mNotificationChangeState );
1699 return Dali::Window::NotificationLevel::NONE;
1702 Dali::Window::NotificationLevel::Type level;
1704 switch( mNotificationLevel )
1706 case TIZEN_POLICY_LEVEL_NONE:
1708 level = Dali::Window::NotificationLevel::NONE;
1711 case TIZEN_POLICY_LEVEL_DEFAULT:
1713 level = Dali::Window::NotificationLevel::BASE;
1716 case TIZEN_POLICY_LEVEL_MEDIUM:
1718 level = Dali::Window::NotificationLevel::MEDIUM;
1721 case TIZEN_POLICY_LEVEL_HIGH:
1723 level = Dali::Window::NotificationLevel::HIGH;
1726 case TIZEN_POLICY_LEVEL_TOP:
1728 level = Dali::Window::NotificationLevel::TOP;
1733 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetNotificationLevel: invalid level [%d]\n", mNotificationLevel );
1734 level = Dali::Window::NotificationLevel::NONE;
1739 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetNotificationLevel: level [%d]\n", mNotificationLevel );
1744 void WindowBaseEcoreWl2::SetOpaqueState( bool opaque )
1746 while( !mTizenPolicy )
1748 wl_display_dispatch_queue( mDisplay, mEventQueue );
1751 tizen_policy_set_opaque_state( mTizenPolicy, ecore_wl2_window_surface_get( mEcoreWindow ), ( opaque ? 1 : 0 ) );
1754 bool WindowBaseEcoreWl2::SetScreenOffMode(Dali::Window::ScreenOffMode::Type screenOffMode)
1756 while( !mTizenPolicy )
1758 wl_display_dispatch_queue( mDisplay, mEventQueue );
1761 mScreenOffModeChangeDone = false;
1762 mScreenOffModeChangeState = TIZEN_POLICY_ERROR_STATE_NONE;
1764 unsigned int mode = 0;
1766 switch( screenOffMode )
1768 case Dali::Window::ScreenOffMode::TIMEOUT:
1773 case Dali::Window::ScreenOffMode::NEVER:
1780 tizen_policy_set_window_screen_mode( mTizenPolicy, ecore_wl2_window_surface_get( mEcoreWindow ), mode );
1784 while( !mScreenOffModeChangeDone && count < 3 )
1786 ecore_wl2_display_flush( ecore_wl2_connected_display_get( NULL ) );
1787 wl_display_dispatch_queue( mDisplay, mEventQueue );
1791 if( !mScreenOffModeChangeDone )
1793 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetScreenOffMode: Screen mode change is failed [%d, %d]\n", screenOffMode, mScreenOffModeChangeState );
1796 else if( mScreenOffModeChangeState == TIZEN_POLICY_ERROR_STATE_PERMISSION_DENIED )
1798 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetScreenOffMode: Permission denied! [%d]\n", screenOffMode );
1802 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetScreenOffMode: Screen mode is changed [%d]\n", mScreenOffMode );
1807 Dali::Window::ScreenOffMode::Type WindowBaseEcoreWl2::GetScreenOffMode() const
1809 while( !mTizenPolicy )
1811 wl_display_dispatch_queue( mDisplay, mEventQueue );
1816 while( !mScreenOffModeChangeDone && count < 3 )
1818 ecore_wl2_display_flush( ecore_wl2_connected_display_get( NULL ) );
1819 wl_display_dispatch_queue( mDisplay, mEventQueue );
1823 if( !mScreenOffModeChangeDone )
1825 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetScreenOffMode: Error! [%d]\n", mScreenOffModeChangeState );
1826 return Dali::Window::ScreenOffMode::TIMEOUT;
1829 Dali::Window::ScreenOffMode::Type screenMode = Dali::Window::ScreenOffMode::TIMEOUT;
1831 switch( mScreenOffMode )
1835 screenMode = Dali::Window::ScreenOffMode::TIMEOUT;
1840 screenMode = Dali::Window::ScreenOffMode::NEVER;
1845 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetScreenOffMode: screen mode [%d]\n", mScreenOffMode );
1850 bool WindowBaseEcoreWl2::SetBrightness( int brightness )
1852 while( !mTizenDisplayPolicy )
1854 wl_display_dispatch_queue( mDisplay, mEventQueue );
1857 mBrightnessChangeDone = false;
1858 mBrightnessChangeState = TIZEN_POLICY_ERROR_STATE_NONE;
1860 tizen_display_policy_set_window_brightness( mTizenDisplayPolicy, ecore_wl2_window_surface_get( mEcoreWindow ), brightness );
1864 while( !mBrightnessChangeDone && count < 3 )
1866 ecore_wl2_display_flush( ecore_wl2_connected_display_get( NULL ) );
1867 wl_display_dispatch_queue( mDisplay, mEventQueue );
1871 if( !mBrightnessChangeDone )
1873 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetBrightness: Brightness change is failed [%d, %d]\n", brightness, mBrightnessChangeState );
1876 else if( mBrightnessChangeState == TIZEN_POLICY_ERROR_STATE_PERMISSION_DENIED )
1878 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetBrightness: Permission denied! [%d]\n", brightness );
1882 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetBrightness: Brightness is changed [%d]\n", mBrightness );
1887 int WindowBaseEcoreWl2::GetBrightness() const
1889 while( !mTizenDisplayPolicy )
1891 wl_display_dispatch_queue( mDisplay, mEventQueue );
1896 while( !mBrightnessChangeDone && count < 3 )
1898 ecore_wl2_display_flush( ecore_wl2_connected_display_get( NULL ) );
1899 wl_display_dispatch_queue( mDisplay, mEventQueue );
1903 if( !mBrightnessChangeDone )
1905 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetBrightness: Error! [%d]\n", mBrightnessChangeState );
1909 DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::GetBrightness: Brightness [%d]\n", mBrightness );
1914 bool WindowBaseEcoreWl2::GrabKey( Dali::KEY key, KeyGrab::KeyGrabMode grabMode )
1916 Ecore_Wl2_Window_Keygrab_Mode mode;
1920 case KeyGrab::TOPMOST:
1922 mode = ECORE_WL2_WINDOW_KEYGRAB_TOPMOST;
1925 case KeyGrab::SHARED:
1927 mode = ECORE_WL2_WINDOW_KEYGRAB_SHARED;
1930 case KeyGrab::OVERRIDE_EXCLUSIVE:
1932 mode = ECORE_WL2_WINDOW_KEYGRAB_OVERRIDE_EXCLUSIVE;
1935 case KeyGrab::EXCLUSIVE:
1937 mode = ECORE_WL2_WINDOW_KEYGRAB_EXCLUSIVE;
1946 return ecore_wl2_window_keygrab_set( mEcoreWindow, KeyLookup::GetKeyName( key ), 0, 0, 0, mode );
1949 bool WindowBaseEcoreWl2::UngrabKey( Dali::KEY key )
1951 return ecore_wl2_window_keygrab_unset( mEcoreWindow, KeyLookup::GetKeyName( key ), 0, 0 );
1954 bool WindowBaseEcoreWl2::GrabKeyList( const Dali::Vector< Dali::KEY >& key, const Dali::Vector< KeyGrab::KeyGrabMode >& grabMode, Dali::Vector< bool >& result )
1956 int keyCount = key.Count();
1957 int keyGrabModeCount = grabMode.Count();
1959 if( keyCount != keyGrabModeCount || keyCount == 0 )
1966 Eina_List* keyList = NULL;
1967 Ecore_Wl2_Window_Keygrab_Info* info = new Ecore_Wl2_Window_Keygrab_Info[keyCount];
1969 for( int index = 0; index < keyCount; ++index )
1971 info[index].key = const_cast< char* >( KeyLookup::GetKeyName( key[index] ) );
1973 switch( grabMode[index] )
1975 case KeyGrab::TOPMOST:
1977 info[index].mode = ECORE_WL2_WINDOW_KEYGRAB_TOPMOST;
1980 case KeyGrab::SHARED:
1982 info[index].mode = ECORE_WL2_WINDOW_KEYGRAB_SHARED;
1985 case KeyGrab::OVERRIDE_EXCLUSIVE:
1987 info[index].mode = ECORE_WL2_WINDOW_KEYGRAB_OVERRIDE_EXCLUSIVE;
1990 case KeyGrab::EXCLUSIVE:
1992 info[index].mode = ECORE_WL2_WINDOW_KEYGRAB_EXCLUSIVE;
1997 info[index].mode = ECORE_WL2_WINDOW_KEYGRAB_UNKNOWN;
2002 keyList = eina_list_append( keyList, &info );
2005 Eina_List* grabList = ecore_wl2_window_keygrab_list_set( mEcoreWindow, keyList );
2007 result.Resize( keyCount, true );
2009 Eina_List* l = NULL;
2010 Eina_List* m = NULL;
2011 void* listData = NULL;
2013 if( grabList != NULL )
2015 EINA_LIST_FOREACH( grabList, m, data )
2018 EINA_LIST_FOREACH( keyList, l, listData )
2020 if( static_cast< Ecore_Wl2_Window_Keygrab_Info* >( listData )->key == NULL )
2022 DALI_LOG_ERROR( "input key list has null data!" );
2026 if( strcmp( static_cast< char* >( data ), static_cast< Ecore_Wl2_Window_Keygrab_Info* >( listData )->key ) == 0 )
2028 result[index] = false;
2037 eina_list_free( keyList );
2038 eina_list_free( grabList );
2044 bool WindowBaseEcoreWl2::UngrabKeyList( const Dali::Vector< Dali::KEY >& key, Dali::Vector< bool >& result )
2046 int keyCount = key.Count();
2054 Eina_List* keyList = NULL;
2055 Ecore_Wl2_Window_Keygrab_Info* info = new Ecore_Wl2_Window_Keygrab_Info[keyCount];
2057 for( int index = 0; index < keyCount; ++index )
2059 info[index].key = const_cast< char* >( KeyLookup::GetKeyName( key[index] ) );
2060 keyList = eina_list_append( keyList, &info );
2063 Eina_List* ungrabList = ecore_wl2_window_keygrab_list_unset( mEcoreWindow, keyList );
2065 result.Resize( keyCount, true );
2067 Eina_List* l = NULL;
2068 Eina_List* m = NULL;
2069 void *listData = NULL;
2072 if( ungrabList != NULL )
2074 EINA_LIST_FOREACH( ungrabList, m, data )
2077 EINA_LIST_FOREACH( keyList, l, listData )
2079 if( strcmp( static_cast< char* >( data ), static_cast< Ecore_Wl2_Window_Keygrab_Info* >( listData )->key ) == 0 )
2081 result[index] = false;
2090 eina_list_free( keyList );
2091 eina_list_free( ungrabList );
2097 void WindowBaseEcoreWl2::GetDpi( unsigned int& dpiHorizontal, unsigned int& dpiVertical )
2102 Ecore_Wl2_Output* output = ecore_wl2_window_output_find( mEcoreWindow );
2104 // 1 inch = 25.4 millimeters
2105 xres = ecore_wl2_output_dpi_get( output );
2106 yres = ecore_wl2_output_dpi_get( output );
2108 dpiHorizontal = int( xres + 0.5f ); // rounding
2109 dpiVertical = int( yres + 0.5f );
2112 int WindowBaseEcoreWl2::GetOrientation() const
2114 int orientation = (mScreenRotationAngle + mWindowRotationAngle) % 360;
2115 if( mSupportedPreProtation )
2122 int WindowBaseEcoreWl2::GetScreenRotationAngle()
2126 if( ecore_wl2_window_ignore_output_transform_get( mEcoreWindow ) )
2132 transform = ecore_wl2_output_transform_get( ecore_wl2_window_output_find( mEcoreWindow ) );
2134 mScreenRotationAngle = transform * 90;
2135 return mScreenRotationAngle;
2138 void WindowBaseEcoreWl2::SetWindowRotationAngle( int degree )
2140 mWindowRotationAngle = degree;
2141 ecore_wl2_window_rotation_set( mEcoreWindow, degree );
2144 int WindowBaseEcoreWl2::GetWindowRotationAngle()
2146 return mWindowRotationAngle;
2149 void WindowBaseEcoreWl2::WindowRotationCompleted( int degree, int width, int height )
2151 ecore_wl2_window_rotation_change_done_send( mEcoreWindow, degree, width, height );
2154 void WindowBaseEcoreWl2::SetTransparency( bool transparent )
2156 ecore_wl2_window_alpha_set( mEcoreWindow, transparent );
2159 void WindowBaseEcoreWl2::InitializeEcoreElDBus()
2161 #ifdef DALI_ELDBUS_AVAILABLE
2162 Eldbus_Object* object;
2163 Eldbus_Proxy* manager;
2165 if( !( mSystemConnection = eldbus_connection_get( ELDBUS_CONNECTION_TYPE_SYSTEM ) ) )
2167 DALI_LOG_ERROR( "Unable to get system bus\n" );
2170 object = eldbus_object_get( mSystemConnection, BUS, PATH );
2173 DALI_LOG_ERROR( "Getting object failed\n" );
2177 manager = eldbus_proxy_get( object, INTERFACE );
2180 DALI_LOG_ERROR( "Getting proxy failed\n" );
2184 if( !eldbus_proxy_signal_handler_add( manager, "GestureDetected", EcoreElDBusAccessibilityNotification, this ) )
2186 DALI_LOG_ERROR( "No signal handler returned\n" );
2191 void WindowBaseEcoreWl2::CreateWindow( PositionSize positionSize )
2193 Ecore_Wl2_Display* display = ecore_wl2_display_connect( NULL );
2196 DALI_ASSERT_ALWAYS( 0 && "Failed to get display" );
2199 mEcoreWindow = ecore_wl2_window_new( display, NULL, positionSize.x, positionSize.y, positionSize.width, positionSize.height );
2201 if ( mEcoreWindow == 0 )
2203 DALI_ASSERT_ALWAYS( 0 && "Failed to create Wayland window" );
2207 ecore_wl2_window_type_set( mEcoreWindow, ECORE_WL2_WINDOW_TYPE_TOPLEVEL );
2210 } // namespace Adaptor
2212 } // namespace Internal
2216 #pragma GCC diagnostic pop