/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
// INTERNAL HEADERS
#include <dali/internal/window-system/common/window-impl.h>
-#include <dali/internal/window-system/tizen-wayland/ecore-wl2/window-render-surface-ecore-wl2.h>
+#include <dali/internal/window-system/common/window-system.h>
+#include <dali/internal/window-system/common/window-render-surface.h>
#include <dali/internal/input/common/key-impl.h>
// EXTERNAL_HEADERS
#include <dali/public-api/object/any.h>
+#include <dali/public-api/events/mouse-button.h>
#include <dali/integration-api/debug.h>
+#include <Ecore_Input.h>
+#include <vconf.h>
+#include <vconf-keys.h>
+#include <wayland-egl-tizen.h>
namespace Dali
{
#endif
const uint32_t MAX_TIZEN_CLIENT_VERSION = 7;
+const unsigned int PRIMARY_TOUCH_BUTTON_ID = 1;
+
+const char* DALI_VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_NAME = "db/setting/accessibility/font_name"; // It will be update at vconf-key.h and replaced.
+
+// DBUS accessibility
+const char* BUS = "org.enlightenment.wm-screen-reader";
+const char* INTERFACE = "org.tizen.GestureNavigation";
+const char* PATH = "/org/tizen/GestureNavigation";
+
+/**
+ * Get the device name from the provided ecore key event
+ */
+void GetDeviceName( Ecore_Event_Key* keyEvent, std::string& result )
+{
+ const char* ecoreDeviceName = ecore_device_name_get( keyEvent->dev );
+
+ if( ecoreDeviceName )
+ {
+ result = ecoreDeviceName;
+ }
+}
+
+/**
+ * Get the device class from the provided ecore event
+ */
+void GetDeviceClass( Ecore_Device_Class ecoreDeviceClass, Device::Class::Type& deviceClass )
+{
+ switch( ecoreDeviceClass )
+ {
+ case ECORE_DEVICE_CLASS_SEAT:
+ {
+ deviceClass = Device::Class::USER;
+ break;
+ }
+ case ECORE_DEVICE_CLASS_KEYBOARD:
+ {
+ deviceClass = Device::Class::KEYBOARD;
+ break;
+ }
+ case ECORE_DEVICE_CLASS_MOUSE:
+ {
+ deviceClass = Device::Class::MOUSE;
+ break;
+ }
+ case ECORE_DEVICE_CLASS_TOUCH:
+ {
+ deviceClass = Device::Class::TOUCH;
+ break;
+ }
+ case ECORE_DEVICE_CLASS_PEN:
+ {
+ deviceClass = Device::Class::PEN;
+ break;
+ }
+ case ECORE_DEVICE_CLASS_POINTER:
+ {
+ deviceClass = Device::Class::POINTER;
+ break;
+ }
+ case ECORE_DEVICE_CLASS_GAMEPAD:
+ {
+ deviceClass = Device::Class::GAMEPAD;
+ break;
+ }
+ default:
+ {
+ deviceClass = Device::Class::NONE;
+ break;
+ }
+ }
+}
+
+void GetDeviceSubclass( Ecore_Device_Subclass ecoreDeviceSubclass, Device::Subclass::Type& deviceSubclass )
+{
+ switch( ecoreDeviceSubclass )
+ {
+ case ECORE_DEVICE_SUBCLASS_FINGER:
+ {
+ deviceSubclass = Device::Subclass::FINGER;
+ break;
+ }
+ case ECORE_DEVICE_SUBCLASS_FINGERNAIL:
+ {
+ deviceSubclass = Device::Subclass::FINGERNAIL;
+ break;
+ }
+ case ECORE_DEVICE_SUBCLASS_KNUCKLE:
+ {
+ deviceSubclass = Device::Subclass::KNUCKLE;
+ break;
+ }
+ case ECORE_DEVICE_SUBCLASS_PALM:
+ {
+ deviceSubclass = Device::Subclass::PALM;
+ break;
+ }
+ case ECORE_DEVICE_SUBCLASS_HAND_SIZE:
+ {
+ deviceSubclass = Device::Subclass::HAND_SIDE;
+ break;
+ }
+ case ECORE_DEVICE_SUBCLASS_HAND_FLAT:
+ {
+ deviceSubclass = Device::Subclass::HAND_FLAT;
+ break;
+ }
+ case ECORE_DEVICE_SUBCLASS_PEN_TIP:
+ {
+ deviceSubclass = Device::Subclass::PEN_TIP;
+ break;
+ }
+ case ECORE_DEVICE_SUBCLASS_TRACKPAD:
+ {
+ deviceSubclass = Device::Subclass::TRACKPAD;
+ break;
+ }
+ case ECORE_DEVICE_SUBCLASS_TRACKPOINT:
+ {
+ deviceSubclass = Device::Subclass::TRACKPOINT;
+ break;
+ }
+ case ECORE_DEVICE_SUBCLASS_TRACKBALL:
+ {
+ deviceSubclass = Device::Subclass::TRACKBALL;
+ break;
+ }
+ case ECORE_DEVICE_SUBCLASS_REMOCON:
+ {
+ deviceSubclass = Device::Subclass::REMOCON;
+ break;
+ }
+ case ECORE_DEVICE_SUBCLASS_VIRTUAL_KEYBOARD:
+ {
+ deviceSubclass = Device::Subclass::VIRTUAL_KEYBOARD;
+ break;
+ }
+ default:
+ {
+ deviceSubclass = Device::Subclass::NONE;
+ break;
+ }
+ }
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////////////
+// Window Callbacks
+/////////////////////////////////////////////////////////////////////////////////////////////////
/// Called when the window iconify state is changed.
static Eina_Bool EcoreEventWindowIconifyStateChanged( void* data, int type, void* event )
return ECORE_CALLBACK_PASS_ON;
}
+/**
+ * Called when rotate event is recevied.
+ */
+static Eina_Bool EcoreEventRotate( void* data, int type, void* event )
+{
+ WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
+ if( windowBase )
+ {
+ windowBase->OnRotation( data, type, event );
+ }
+ return ECORE_CALLBACK_PASS_ON;
+}
+
+/**
+ * Called when configure event is recevied.
+ */
+static Eina_Bool EcoreEventConfigure( void* data, int type, void* event )
+{
+ WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
+ if( windowBase )
+ {
+ windowBase->OnConfiguration( data, type, event );
+ }
+ return ECORE_CALLBACK_PASS_ON;
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////////////
+// Touch Callbacks
+/////////////////////////////////////////////////////////////////////////////////////////////////
+
+/**
+ * Called when a touch down is received.
+ */
+static Eina_Bool EcoreEventMouseButtonDown( void* data, int type, void* event )
+{
+ WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
+ if( windowBase )
+ {
+ windowBase->OnMouseButtonDown( data, type, event );
+ }
+ return ECORE_CALLBACK_PASS_ON;
+}
+
+/**
+ * Called when a touch up is received.
+ */
+static Eina_Bool EcoreEventMouseButtonUp( void* data, int type, void* event )
+{
+ WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
+ if( windowBase )
+ {
+ windowBase->OnMouseButtonUp( data, type, event );
+ }
+ return ECORE_CALLBACK_PASS_ON;
+}
+
+/**
+ * Called when a touch motion is received.
+ */
+static Eina_Bool EcoreEventMouseButtonMove( void* data, int type, void* event )
+{
+ WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
+ if( windowBase )
+ {
+ windowBase->OnMouseButtonMove( data, type, event );
+ }
+ return ECORE_CALLBACK_PASS_ON;
+}
+
+/**
+ * Called when a touch is canceled.
+ */
+static Eina_Bool EcoreEventMouseButtonCancel( void* data, int type, void* event )
+{
+ WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
+ if( windowBase )
+ {
+ windowBase->OnMouseButtonCancel( data, type, event );
+ }
+ return ECORE_CALLBACK_PASS_ON;
+}
+
+/**
+ * Called when a mouse wheel is received.
+ */
+static Eina_Bool EcoreEventMouseWheel( void* data, int type, void* event )
+{
+ WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
+ if( windowBase )
+ {
+ windowBase->OnMouseWheel( data, type, event );
+ }
+ return ECORE_CALLBACK_PASS_ON;
+}
+
+/**
+ * Called when a detent rotation event is recevied.
+ */
+static Eina_Bool EcoreEventDetentRotation( void* data, int type, void* event )
+{
+ WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
+ if( windowBase )
+ {
+ windowBase->OnDetentRotation( data, type, event );
+ }
+ return ECORE_CALLBACK_PASS_ON;
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////////////
+// Key Callbacks
+/////////////////////////////////////////////////////////////////////////////////////////////////
+
+/**
+ * Called when a key down is received.
+ */
+static Eina_Bool EcoreEventKeyDown( void* data, int type, void* event )
+{
+ WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
+ if( windowBase )
+ {
+ windowBase->OnKeyDown( data, type, event );
+ }
+ return ECORE_CALLBACK_PASS_ON;
+}
+
+/**
+ * Called when a key up is received.
+ */
+static Eina_Bool EcoreEventKeyUp( void* data, int type, void* event )
+{
+ WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
+ if( windowBase )
+ {
+ windowBase->OnKeyUp( data, type, event );
+ }
+ return ECORE_CALLBACK_PASS_ON;
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////////////
+// Selection Callbacks
+/////////////////////////////////////////////////////////////////////////////////////////////////
+
+/**
+ * Called when the source window notifies us the content in clipboard is selected.
+ */
+static Eina_Bool EcoreEventDataSend( void* data, int type, void* event )
+{
+ WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
+ if( windowBase )
+ {
+ windowBase->OnDataSend( data, type, event );
+ }
+ return ECORE_CALLBACK_PASS_ON;
+}
+
+/**
+* Called when the source window sends us about the selected content.
+* For example, when item is selected in the clipboard.
+*/
+static Eina_Bool EcoreEventDataReceive( void* data, int type, void* event )
+{
+ WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
+ if( windowBase )
+ {
+ windowBase->OnDataReceive( data, type, event );
+ }
+ return ECORE_CALLBACK_PASS_ON;
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////////////
+// Effect Start/End Callbacks
+/////////////////////////////////////////////////////////////////////////////////////////////////
+
+/**
+ * Called when transition animation of the window's shown/hidden is started by window manager.
+ */
+static Eina_Bool EcoreEventEffectStart(void *data, int type, void *event)
+{
+ WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
+ Ecore_Wl2_Event_Effect_Start *effectStart = static_cast<Ecore_Wl2_Event_Effect_Start*>( event );
+ DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::EcoreEventEffectStart, effect type[ %d ]\n", effectStart->type );
+ if( windowBase )
+ {
+ if( effectStart->type < 3 ) // only under restack
+ {
+ windowBase->OnTransitionEffectEvent( DevelWindow::EffectState::START, static_cast<DevelWindow::EffectType>( effectStart->type ) );
+ }
+ }
+ return ECORE_CALLBACK_PASS_ON;
+}
+
+/**
+ * Called when transition animation of the window's shown/hidden is ended by window manager.
+ */
+static Eina_Bool EcoreEventEffectEnd(void *data, int type, void *event)
+{
+ Ecore_Wl2_Event_Effect_Start *effectEnd = static_cast<Ecore_Wl2_Event_Effect_Start*>( event );
+ WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
+ DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::EcoreEventEffectEnd, effect type[ %d ]\n", effectEnd->type );
+ if( windowBase )
+ {
+ if( effectEnd->type < 3 ) // only under restack
+ {
+ windowBase->OnTransitionEffectEvent( DevelWindow::EffectState::END, static_cast<DevelWindow::EffectType>( effectEnd->type ) );
+ }
+ }
+ return ECORE_CALLBACK_PASS_ON;
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////////////
+// Font Callbacks
+/////////////////////////////////////////////////////////////////////////////////////////////////
+
+/**
+ * Called when a font name is changed.
+ */
+static void VconfNotifyFontNameChanged( keynode_t* node, void* data )
+{
+ WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
+ if( windowBase )
+ {
+ windowBase->OnFontNameChanged();
+ }
+}
+
+/**
+ * Called when a font size is changed.
+ */
+static void VconfNotifyFontSizeChanged( keynode_t* node, void* data )
+{
+ WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
+ if( windowBase )
+ {
+ windowBase->OnFontSizeChanged();
+ }
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////////////
+// ElDBus Accessibility Callbacks
+/////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifdef DALI_ELDBUS_AVAILABLE
+// Callback for Ecore ElDBus accessibility events.
+static void EcoreElDBusAccessibilityNotification( void* context, const Eldbus_Message* message )
+{
+ WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( context );
+ if( windowBase )
+ {
+ windowBase->OnEcoreElDBusAccessibilityNotification( context, message );
+ }
+}
+#endif // DALI_ELDBUS_AVAILABLE
+
static void RegistryGlobalCallback( void* data, struct wl_registry *registry, uint32_t name, const char* interface, uint32_t version )
{
WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
} // unnamed namespace
-WindowBaseEcoreWl2::WindowBaseEcoreWl2( Window* window, WindowRenderSurface* windowRenderSurface )
+WindowBaseEcoreWl2::WindowBaseEcoreWl2( Dali::PositionSize positionSize, Any surface, bool isTransparent )
: mEcoreEventHandler(),
- mWindow( window ),
- mWindowSurface( NULL ),
mEcoreWindow( NULL ),
+ mWlSurface( NULL ),
+ mEglWindow( NULL ),
mDisplay( NULL ),
mEventQueue( NULL ),
mTizenPolicy( NULL ),
mScreenOffModeChangeDone( true ),
mBrightness( 0 ),
mBrightnessChangeState( 0 ),
- mBrightnessChangeDone( true )
+ mBrightnessChangeDone( true ),
+ mOwnSurface( false ),
+ mMoveResizeSerial( 0 ),
+ mLastSubmittedMoveResizeSerial( 0 ),
+ mWindowRotationAngle( 0 ),
+ mScreenRotationAngle( 0 ),
+ mSupportedPreProtation( 0 )
+#ifdef DALI_ELDBUS_AVAILABLE
+ , mSystemConnection( NULL )
+#endif
{
- mWindowSurface = dynamic_cast< WindowRenderSurfaceEcoreWl2* >( windowRenderSurface );
+ Initialize( positionSize, surface, isTransparent );
}
WindowBaseEcoreWl2::~WindowBaseEcoreWl2()
{
+#ifdef DALI_ELDBUS_AVAILABLE
+ // Close down ElDBus connections.
+ if( mSystemConnection )
+ {
+ eldbus_connection_unref( mSystemConnection );
+ }
+#endif // DALI_ELDBUS_AVAILABLE
+
+ vconf_ignore_key_changed( VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, VconfNotifyFontSizeChanged );
+ vconf_ignore_key_changed( DALI_VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_NAME, VconfNotifyFontNameChanged );
+
for( Dali::Vector< Ecore_Event_Handler* >::Iterator iter = mEcoreEventHandler.Begin(), endIter = mEcoreEventHandler.End(); iter != endIter; ++iter )
{
ecore_event_handler_del( *iter );
}
mEcoreEventHandler.Clear();
- if( mEventQueue )
+ if( mEventQueue )
+ {
+ wl_event_queue_destroy( mEventQueue );
+ }
+
+ mSupportedAuxiliaryHints.clear();
+ mAuxiliaryHints.clear();
+
+ if( mEglWindow != NULL )
+ {
+ wl_egl_window_destroy( mEglWindow );
+ mEglWindow = NULL;
+ }
+
+ if( mOwnSurface )
+ {
+ ecore_wl2_window_free( mEcoreWindow );
+
+ WindowSystem::Shutdown();
+ }
+}
+
+void WindowBaseEcoreWl2::Initialize( PositionSize positionSize, Any surface, bool isTransparent )
+{
+ if( surface.Empty() == false )
+ {
+ // check we have a valid type
+ DALI_ASSERT_ALWAYS( ( surface.GetType() == typeid (Ecore_Wl2_Window *) ) && "Surface type is invalid" );
+
+ mEcoreWindow = AnyCast< Ecore_Wl2_Window* >( surface );
+ }
+ else
+ {
+ // we own the surface about to created
+ WindowSystem::Initialize();
+
+ mOwnSurface = true;
+ CreateWindow( positionSize );
+ }
+
+ mWlSurface = ecore_wl2_window_surface_get( mEcoreWindow );
+
+ SetTransparency( isTransparent );
+
+ mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_WL2_EVENT_WINDOW_ICONIFY_STATE_CHANGE, EcoreEventWindowIconifyStateChanged, this ) );
+ mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_WL2_EVENT_FOCUS_IN, EcoreEventWindowFocusIn, this ) );
+ mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_WL2_EVENT_FOCUS_OUT, EcoreEventWindowFocusOut, this ) );
+ mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_WL2_EVENT_OUTPUT_TRANSFORM, EcoreEventOutputTransform, this ) );
+ mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_WL2_EVENT_IGNORE_OUTPUT_TRANSFORM, EcoreEventIgnoreOutputTransform, this ) );
+
+ // Register Rotate event
+ mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_WL2_EVENT_WINDOW_ROTATE, EcoreEventRotate, this ) );
+
+ // Register Configure event
+ mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_WL2_EVENT_WINDOW_CONFIGURE, EcoreEventConfigure, this ) );
+
+ // Register Touch events
+ mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_EVENT_MOUSE_BUTTON_DOWN, EcoreEventMouseButtonDown, this ) );
+ mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_EVENT_MOUSE_BUTTON_UP, EcoreEventMouseButtonUp, this ) );
+ mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_EVENT_MOUSE_MOVE, EcoreEventMouseButtonMove, this ) );
+ mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_EVENT_MOUSE_BUTTON_CANCEL, EcoreEventMouseButtonCancel, this ) );
+
+ // Register Mouse wheel events
+ mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_EVENT_MOUSE_WHEEL, EcoreEventMouseWheel, this ) );
+
+ // Register Detent event
+ mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_EVENT_DETENT_ROTATE, EcoreEventDetentRotation, this ) );
+
+ // Register Key events
+ mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_EVENT_KEY_DOWN, EcoreEventKeyDown, this ) );
+ mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_EVENT_KEY_UP, EcoreEventKeyUp, this ) );
+
+ // Register Selection event - clipboard selection
+ mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_WL2_EVENT_DATA_SOURCE_SEND, EcoreEventDataSend, this ) );
+ mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_WL2_EVENT_SELECTION_DATA_READY, EcoreEventDataReceive, this ) );
+
+ // Register Effect Start/End event
+ mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_WL2_EVENT_EFFECT_START, EcoreEventEffectStart, this ) );
+ mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_WL2_EVENT_EFFECT_END, EcoreEventEffectEnd, this ) );
+
+ // Register Vconf notify - font name and size
+ vconf_notify_key_changed( DALI_VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_NAME, VconfNotifyFontNameChanged, this );
+ vconf_notify_key_changed( VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, VconfNotifyFontSizeChanged, this );
+
+ InitializeEcoreElDBus();
+
+ Ecore_Wl2_Display* display = ecore_wl2_connected_display_get( NULL );
+ mDisplay = ecore_wl2_display_get( display );
+
+ if( mDisplay )
+ {
+ wl_display* displayWrapper = static_cast< wl_display* >( wl_proxy_create_wrapper( mDisplay ) );
+ if( displayWrapper )
+ {
+ mEventQueue = wl_display_create_queue( mDisplay );
+ if( mEventQueue )
+ {
+ wl_proxy_set_queue( reinterpret_cast< wl_proxy* >( displayWrapper ), mEventQueue );
+
+ wl_registry* registry = wl_display_get_registry( displayWrapper );
+ wl_registry_add_listener( registry, ®istryListener, this );
+ }
+
+ wl_proxy_wrapper_destroy( displayWrapper );
+ }
+ }
+
+ // get auxiliary hint
+ Eina_List* hints = ecore_wl2_window_aux_hints_supported_get( mEcoreWindow );
+ if( hints )
+ {
+ Eina_List* l = NULL;
+ char* hint = NULL;
+
+ 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) ) ) )
+ {
+ mSupportedAuxiliaryHints.push_back( hint );
+
+ DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::Initialize: %s\n", hint );
+ }
+ }
+}
+
+Eina_Bool WindowBaseEcoreWl2::OnIconifyStateChanged( void* data, int type, void* event )
+{
+ Ecore_Wl2_Event_Window_Iconify_State_Change* iconifyChangedEvent( static_cast< Ecore_Wl2_Event_Window_Iconify_State_Change* >( event ) );
+ Eina_Bool handled( ECORE_CALLBACK_PASS_ON );
+
+ if( iconifyChangedEvent->win == static_cast< unsigned int>( ecore_wl2_window_id_get( mEcoreWindow ) ) )
+ {
+ if( iconifyChangedEvent->iconified == EINA_TRUE )
+ {
+ mIconifyChangedSignal.Emit( true );
+ }
+ else
+ {
+ mIconifyChangedSignal.Emit( false );
+ }
+ handled = ECORE_CALLBACK_DONE;
+ }
+
+ return handled;
+}
+
+Eina_Bool WindowBaseEcoreWl2::OnFocusIn( void* data, int type, void* event )
+{
+ Ecore_Wl2_Event_Focus_In* focusInEvent( static_cast< Ecore_Wl2_Event_Focus_In* >( event ) );
+
+ if( focusInEvent->window == static_cast< unsigned int >( ecore_wl2_window_id_get( mEcoreWindow ) ) )
+ {
+ DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "Window EcoreEventWindowFocusIn\n" );
+
+ mFocusChangedSignal.Emit( true );
+ }
+
+ return ECORE_CALLBACK_PASS_ON;
+}
+
+Eina_Bool WindowBaseEcoreWl2::OnFocusOut( void* data, int type, void* event )
+{
+ Ecore_Wl2_Event_Focus_Out* focusOutEvent( static_cast< Ecore_Wl2_Event_Focus_Out* >( event ) );
+
+ if( focusOutEvent->window == static_cast< unsigned int >( ecore_wl2_window_id_get( mEcoreWindow ) ) )
+ {
+ DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "Window EcoreEventWindowFocusOut\n" );
+
+ mFocusChangedSignal.Emit( false );
+ }
+
+ return ECORE_CALLBACK_PASS_ON;
+}
+
+Eina_Bool WindowBaseEcoreWl2::OnOutputTransform( void* data, int type, void* event )
+{
+ Ecore_Wl2_Event_Output_Transform* transformEvent( static_cast< Ecore_Wl2_Event_Output_Transform* >( event ) );
+
+ if( transformEvent->output == ecore_wl2_window_output_find( mEcoreWindow ) )
+ {
+ DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "Window (%p) EcoreEventOutputTransform\n", mEcoreWindow );
+
+ mOutputTransformedSignal.Emit();
+ }
+
+ return ECORE_CALLBACK_PASS_ON;
+}
+
+Eina_Bool WindowBaseEcoreWl2::OnIgnoreOutputTransform( void* data, int type, void* event )
+{
+ Ecore_Wl2_Event_Ignore_Output_Transform* ignoreTransformEvent( static_cast< Ecore_Wl2_Event_Ignore_Output_Transform* >( event ) );
+
+ if( ignoreTransformEvent->win == mEcoreWindow )
+ {
+ DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "Window (%p) EcoreEventIgnoreOutputTransform\n", mEcoreWindow );
+
+ mOutputTransformedSignal.Emit();
+ }
+
+ return ECORE_CALLBACK_PASS_ON;
+}
+
+void WindowBaseEcoreWl2::OnRotation( void* data, int type, void* event )
+{
+ Ecore_Wl2_Event_Window_Rotation* ev( static_cast< Ecore_Wl2_Event_Window_Rotation* >( event ) );
+
+ if( ev->win == static_cast< unsigned int >( ecore_wl2_window_id_get( mEcoreWindow ) ) )
+ {
+ DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Concise, "WindowBaseEcoreWl2::OnRotation\n" );
+
+ RotationEvent rotationEvent;
+ rotationEvent.angle = ev->angle;
+ rotationEvent.winResize = 0;
+
+ if( ev->angle == 0 || ev->angle == 180 )
+ {
+ rotationEvent.width = ev->w;
+ rotationEvent.height = ev->h;
+ }
+ else
+ {
+ rotationEvent.width = ev->h;
+ rotationEvent.height = ev->w;
+ }
+
+ mRotationSignal.Emit( rotationEvent );
+ }
+}
+
+void WindowBaseEcoreWl2::OnConfiguration( void* data, int type, void* event )
+{
+ Ecore_Wl2_Event_Window_Configure* ev( static_cast< Ecore_Wl2_Event_Window_Configure* >( event ) );
+
+ if( ev->win == static_cast< unsigned int >( ecore_wl2_window_id_get( mEcoreWindow ) ) )
+ {
+ // Note: To comply with the wayland protocol, Dali should make an ack_configure
+ // by calling ecore_wl2_window_commit
+ ecore_wl2_window_commit(mEcoreWindow, EINA_FALSE);
+ }
+}
+
+void WindowBaseEcoreWl2::OnMouseButtonDown( void* data, int type, void* event )
+{
+ Ecore_Event_Mouse_Button* touchEvent = static_cast< Ecore_Event_Mouse_Button* >( event );
+
+ if( touchEvent->window == static_cast< unsigned int >( ecore_wl2_window_id_get( mEcoreWindow ) ) )
+ {
+ Device::Class::Type deviceClass;
+ Device::Subclass::Type deviceSubclass;
+
+ GetDeviceClass( ecore_device_class_get( touchEvent->dev ), deviceClass );
+ GetDeviceSubclass( ecore_device_subclass_get( touchEvent->dev ), deviceSubclass );
+
+ PointState::Type state ( PointState::DOWN );
+
+ if( deviceClass != Device::Class::Type::MOUSE )
+ {
+ // Check if the buttons field is set and ensure it's the primary touch button.
+ // If this event was triggered by buttons other than the primary button (used for touch), then
+ // just send an interrupted event to Core.
+ if( touchEvent->buttons && (touchEvent->buttons != PRIMARY_TOUCH_BUTTON_ID ) )
+ {
+ state = PointState::INTERRUPTED;
+ }
+ }
+
+ Integration::Point point;
+ point.SetDeviceId( touchEvent->multi.device );
+ point.SetState( state );
+ point.SetScreenPosition( Vector2( touchEvent->x, touchEvent->y ) );
+ point.SetRadius( touchEvent->multi.radius, Vector2( touchEvent->multi.radius_x, touchEvent->multi.radius_y ) );
+ point.SetPressure( touchEvent->multi.pressure );
+ point.SetAngle( Degree( touchEvent->multi.angle ) );
+ point.SetDeviceClass( deviceClass );
+ point.SetDeviceSubclass( deviceSubclass );
+ point.SetMouseButton( static_cast< MouseButton::Type >( touchEvent->buttons) );
+
+ mTouchEventSignal.Emit( point, touchEvent->timestamp );
+ }
+}
+
+void WindowBaseEcoreWl2::OnMouseButtonUp( void* data, int type, void* event )
+{
+ Ecore_Event_Mouse_Button* touchEvent = static_cast< Ecore_Event_Mouse_Button* >( event );
+
+ if( touchEvent->window == static_cast< unsigned int >( ecore_wl2_window_id_get( mEcoreWindow ) ) )
+ {
+ Device::Class::Type deviceClass;
+ Device::Subclass::Type deviceSubclass;
+
+ GetDeviceClass( ecore_device_class_get( touchEvent->dev ), deviceClass );
+ GetDeviceSubclass( ecore_device_subclass_get( touchEvent->dev ), deviceSubclass );
+
+ Integration::Point point;
+ point.SetDeviceId( touchEvent->multi.device );
+ point.SetState( PointState::UP );
+ point.SetScreenPosition( Vector2( touchEvent->x, touchEvent->y ) );
+ point.SetRadius( touchEvent->multi.radius, Vector2( touchEvent->multi.radius_x, touchEvent->multi.radius_y ) );
+ point.SetPressure( touchEvent->multi.pressure );
+ point.SetAngle( Degree( touchEvent->multi.angle ) );
+ point.SetDeviceClass( deviceClass );
+ point.SetDeviceSubclass( deviceSubclass );
+ point.SetMouseButton( static_cast< MouseButton::Type >( touchEvent->buttons) );
+
+ mTouchEventSignal.Emit( point, touchEvent->timestamp );
+ }
+}
+
+void WindowBaseEcoreWl2::OnMouseButtonMove( void* data, int type, void* event )
+{
+ Ecore_Event_Mouse_Move* touchEvent = static_cast< Ecore_Event_Mouse_Move* >( event );
+
+ if( touchEvent->window == static_cast< unsigned int >( ecore_wl2_window_id_get( mEcoreWindow ) ) )
+ {
+ Device::Class::Type deviceClass;
+ Device::Subclass::Type deviceSubclass;
+
+ GetDeviceClass( ecore_device_class_get( touchEvent->dev ), deviceClass );
+ GetDeviceSubclass( ecore_device_subclass_get( touchEvent->dev ), deviceSubclass );
+
+ Integration::Point point;
+ point.SetDeviceId( touchEvent->multi.device );
+ point.SetState( PointState::MOTION );
+ point.SetScreenPosition( Vector2( touchEvent->x, touchEvent->y ) );
+ point.SetRadius( touchEvent->multi.radius, Vector2( touchEvent->multi.radius_x, touchEvent->multi.radius_y ) );
+ point.SetPressure( touchEvent->multi.pressure );
+ point.SetAngle( Degree( touchEvent->multi.angle ) );
+ point.SetDeviceClass( deviceClass );
+ point.SetDeviceSubclass( deviceSubclass );
+
+ mTouchEventSignal.Emit( point, touchEvent->timestamp );
+ }
+}
+
+void WindowBaseEcoreWl2::OnMouseButtonCancel( void* data, int type, void* event )
+{
+ Ecore_Event_Mouse_Button* touchEvent = static_cast< Ecore_Event_Mouse_Button* >( event );
+
+ if( touchEvent->window == static_cast< unsigned int >( ecore_wl2_window_id_get( mEcoreWindow ) ) )
{
- wl_event_queue_destroy( mEventQueue );
- }
+ Integration::Point point;
+ point.SetDeviceId( touchEvent->multi.device );
+ point.SetState( PointState::INTERRUPTED );
+ point.SetScreenPosition( Vector2( 0.0f, 0.0f ) );
- mSupportedAuxiliaryHints.clear();
- mAuxiliaryHints.clear();
+ mTouchEventSignal.Emit( point, touchEvent->timestamp );
+
+ DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::OnMouseButtonCancel\n" );
+ }
}
-void WindowBaseEcoreWl2::Initialize()
+void WindowBaseEcoreWl2::OnMouseWheel( void* data, int type, void* event )
{
- if( !mWindowSurface )
+ Ecore_Event_Mouse_Wheel* mouseWheelEvent = static_cast< Ecore_Event_Mouse_Wheel* >( event );
+
+ if( mouseWheelEvent->window == static_cast< unsigned int >( ecore_wl2_window_id_get( mEcoreWindow ) ) )
{
- DALI_ASSERT_ALWAYS( "Invalid window surface" );
+ 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 );
+
+ WheelEvent wheelEvent( WheelEvent::MOUSE_WHEEL, mouseWheelEvent->direction, mouseWheelEvent->modifiers, Vector2( mouseWheelEvent->x, mouseWheelEvent->y ), mouseWheelEvent->z, mouseWheelEvent->timestamp );
+
+ mWheelEventSignal.Emit( wheelEvent );
}
+}
- mEcoreWindow = mWindowSurface->GetWlWindow();
- DALI_ASSERT_ALWAYS( mEcoreWindow != 0 && "There is no EcoreWl window" );
+void WindowBaseEcoreWl2::OnDetentRotation( void* data, int type, void* event )
+{
+ Ecore_Event_Detent_Rotate* detentEvent = static_cast< Ecore_Event_Detent_Rotate* >( event );
- mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_WL2_EVENT_WINDOW_ICONIFY_STATE_CHANGE, EcoreEventWindowIconifyStateChanged, this ) );
- mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_WL2_EVENT_FOCUS_IN, EcoreEventWindowFocusIn, this ) );
- mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_WL2_EVENT_FOCUS_OUT, EcoreEventWindowFocusOut, this ) );
- mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_WL2_EVENT_OUTPUT_TRANSFORM, EcoreEventOutputTransform, this) );
- mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_WL2_EVENT_IGNORE_OUTPUT_TRANSFORM, EcoreEventIgnoreOutputTransform, this) );
+ DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Concise, "WindowBaseEcoreWl2::OnDetentRotation\n" );
- Ecore_Wl2_Display* display = ecore_wl2_connected_display_get( NULL );
- mDisplay = ecore_wl2_display_get( display );
+ int direction = ( detentEvent->direction == ECORE_DETENT_DIRECTION_CLOCKWISE ) ? 1 : -1;
+ int timeStamp = detentEvent->timestamp;
- if( mDisplay )
+ WheelEvent wheelEvent( WheelEvent::CUSTOM_WHEEL, 0, 0, Vector2( 0.0f, 0.0f ), direction, timeStamp );
+
+ mWheelEventSignal.Emit( wheelEvent );
+}
+
+void WindowBaseEcoreWl2::OnKeyDown( void* data, int type, void* event )
+{
+ Ecore_Event_Key* keyEvent = static_cast< Ecore_Event_Key* >( event );
+
+ if( keyEvent->window == static_cast< unsigned int >( ecore_wl2_window_id_get( mEcoreWindow ) ) )
{
- wl_display* displayWrapper = static_cast< wl_display* >( wl_proxy_create_wrapper( mDisplay ) );
- if( displayWrapper )
- {
- mEventQueue = wl_display_create_queue( mDisplay );
- if( mEventQueue )
- {
- wl_proxy_set_queue( reinterpret_cast< wl_proxy* >( displayWrapper ), mEventQueue );
+ DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::OnKeyDown\n" );
- wl_registry* registry = wl_display_get_registry( displayWrapper );
- wl_registry_add_listener( registry, ®istryListener, this );
- }
+ std::string keyName( keyEvent->keyname );
+ std::string logicalKey( "" );
+ std::string keyString( "" );
+ std::string compose( "" );
- wl_proxy_wrapper_destroy( displayWrapper );
+ // Ensure key compose string is not NULL as keys like SHIFT or arrow have a null string.
+ if( keyEvent->compose )
+ {
+ compose = keyEvent->compose;
}
- }
- // get auxiliary hint
- Eina_List* hints = ecore_wl2_window_aux_hints_supported_get( mEcoreWindow );
- if( hints )
- {
- Eina_List* l = NULL;
- char* hint = NULL;
+ // Ensure key symbol is not NULL as keys like SHIFT have a null string.
+ if( keyEvent->key )
+ {
+ logicalKey = keyEvent->key;
+ }
- 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) ) ) )
+ int keyCode = KeyLookup::GetDaliKeyCode( keyEvent->keyname );
+ keyCode = ( keyCode == -1 ) ? 0 : keyCode;
+ int modifier( keyEvent->modifiers );
+ unsigned long time = keyEvent->timestamp;
+ if( !strncmp( keyEvent->keyname, "Keycode-", 8 ) )
{
- mSupportedAuxiliaryHints.push_back( hint );
+ keyCode = atoi( keyEvent->keyname + 8 );
+ }
- DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::Initialize: %s\n", hint );
+ // Ensure key event string is not NULL as keys like SHIFT have a null string.
+ if( keyEvent->string )
+ {
+ keyString = keyEvent->string;
}
+
+ std::string deviceName;
+ Device::Class::Type deviceClass;
+ Device::Subclass::Type deviceSubclass;
+
+ GetDeviceName( keyEvent, deviceName );
+ GetDeviceClass( ecore_device_class_get( keyEvent->dev ), deviceClass );
+ GetDeviceSubclass( ecore_device_subclass_get( keyEvent->dev ), deviceSubclass );
+
+ Integration::KeyEvent keyEvent( keyName, logicalKey, keyString, keyCode, modifier, time, Integration::KeyEvent::Down, compose, deviceName, deviceClass, deviceSubclass );
+
+ mKeyEventSignal.Emit( keyEvent );
}
}
-Eina_Bool WindowBaseEcoreWl2::OnIconifyStateChanged( void* data, int type, void* event )
+void WindowBaseEcoreWl2::OnKeyUp( void* data, int type, void* event )
{
- Ecore_Wl2_Event_Window_Iconify_State_Change* iconifyChangedEvent( static_cast< Ecore_Wl2_Event_Window_Iconify_State_Change* >( event ) );
- Eina_Bool handled( ECORE_CALLBACK_PASS_ON );
+ Ecore_Event_Key* keyEvent = static_cast< Ecore_Event_Key* >( event );
- if( iconifyChangedEvent->win == static_cast< unsigned int>( ecore_wl2_window_id_get( mEcoreWindow ) ) )
+ if( keyEvent->window == static_cast< unsigned int >( ecore_wl2_window_id_get( mEcoreWindow ) ) )
{
- if( iconifyChangedEvent->iconified == EINA_TRUE )
+ DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::OnKeyUp\n" );
+
+ std::string keyName( keyEvent->keyname );
+ std::string logicalKey( "" );
+ std::string keyString( "" );
+ std::string compose( "" );
+
+ // Ensure key compose string is not NULL as keys like SHIFT or arrow have a null string.
+ if( keyEvent->compose )
{
- mWindow->OnIconifyChanged( true );
+ compose = keyEvent->compose;
}
- else
+
+ // Ensure key symbol is not NULL as keys like SHIFT have a null string.
+ if( keyEvent->key )
{
- mWindow->OnIconifyChanged( false );
+ logicalKey = keyEvent->key;
}
- handled = ECORE_CALLBACK_DONE;
- }
- return handled;
-}
+ int keyCode = KeyLookup::GetDaliKeyCode( keyEvent->keyname );
+ keyCode = ( keyCode == -1 ) ? 0 : keyCode;
+ int modifier( keyEvent->modifiers );
+ unsigned long time = keyEvent->timestamp;
+ if( !strncmp( keyEvent->keyname, "Keycode-", 8 ) )
+ {
+ keyCode = atoi( keyEvent->keyname + 8 );
+ }
-Eina_Bool WindowBaseEcoreWl2::OnFocusIn( void* data, int type, void* event )
-{
- Ecore_Wl2_Event_Focus_In* focusInEvent( static_cast< Ecore_Wl2_Event_Focus_In* >( event ) );
+ // Ensure key event string is not NULL as keys like SHIFT have a null string.
+ if( keyEvent->string )
+ {
+ keyString = keyEvent->string;
+ }
- if( focusInEvent->window == static_cast< unsigned int >( ecore_wl2_window_id_get( mEcoreWindow ) ) )
- {
- DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "Window EcoreEventWindowFocusIn\n" );
+ std::string deviceName;
+ Device::Class::Type deviceClass;
+ Device::Subclass::Type deviceSubclass;
- mWindow->OnFocusChanged( true );
- }
+ GetDeviceName( keyEvent, deviceName );
+ GetDeviceClass( ecore_device_class_get( keyEvent->dev ), deviceClass );
+ GetDeviceSubclass( ecore_device_subclass_get( keyEvent->dev ), deviceSubclass );
- return ECORE_CALLBACK_PASS_ON;
+ Integration::KeyEvent keyEvent( keyName, logicalKey, keyString, keyCode, modifier, time, Integration::KeyEvent::Up, compose, deviceName, deviceClass, deviceSubclass );
+
+ mKeyEventSignal.Emit( keyEvent );
+ }
}
-Eina_Bool WindowBaseEcoreWl2::OnFocusOut( void* data, int type, void* event )
+void WindowBaseEcoreWl2::OnDataSend( void* data, int type, void* event )
{
- Ecore_Wl2_Event_Focus_Out* focusOutEvent( static_cast< Ecore_Wl2_Event_Focus_Out* >( event ) );
+ mSelectionDataSendSignal.Emit( event );
+}
- if( focusOutEvent->window == static_cast< unsigned int >( ecore_wl2_window_id_get( mEcoreWindow ) ) )
- {
- DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "Window EcoreEventWindowFocusOut\n" );
+void WindowBaseEcoreWl2::OnDataReceive( void* data, int type, void* event )
+{
+ mSelectionDataReceivedSignal.Emit( event );
+}
- mWindow->OnFocusChanged( false );
- }
+void WindowBaseEcoreWl2::OnFontNameChanged()
+{
+ mStyleChangedSignal.Emit( StyleChange::DEFAULT_FONT_CHANGE );
+}
- return ECORE_CALLBACK_PASS_ON;
+void WindowBaseEcoreWl2::OnFontSizeChanged()
+{
+ mStyleChangedSignal.Emit( StyleChange::DEFAULT_FONT_SIZE_CHANGE );
}
-Eina_Bool WindowBaseEcoreWl2::OnOutputTransform( void* data, int type, void* event )
+void WindowBaseEcoreWl2::OnEcoreElDBusAccessibilityNotification( void* context, const Eldbus_Message* message )
{
- Ecore_Wl2_Event_Output_Transform* transformEvent( static_cast< Ecore_Wl2_Event_Output_Transform* >( event ) );
+#ifdef DALI_ELDBUS_AVAILABLE
+ AccessibilityInfo info;
- if( transformEvent->output == ecore_wl2_window_output_find( mEcoreWindow ) )
+ // The string defines the arg-list's respective types.
+ if( !eldbus_message_arguments_get( message, "iiiiiiu", &info.gestureValue, &info.startX, &info.startY, &info.endX, &info.endY, &info.state, &info.eventTime ) )
{
- DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "Window (%p) EcoreEventOutputTransform\n", mEcoreWindow );
-
- mWindowSurface->OutputTransformed();
-
- mWindow->OnOutputTransformed();
+ DALI_LOG_ERROR( "OnEcoreElDBusAccessibilityNotification: Error getting arguments\n" );
}
- return ECORE_CALLBACK_PASS_ON;
+ mAccessibilitySignal.Emit( info );
+#endif
}
-Eina_Bool WindowBaseEcoreWl2::OnIgnoreOutputTransform( void* data, int type, void* event )
+void WindowBaseEcoreWl2::OnTransitionEffectEvent( DevelWindow::EffectState state, DevelWindow::EffectType type )
{
- Ecore_Wl2_Event_Ignore_Output_Transform* ignoreTransformEvent( static_cast< Ecore_Wl2_Event_Ignore_Output_Transform* >( event ) );
-
- if( ignoreTransformEvent->win == mEcoreWindow )
- {
- DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "Window (%p) EcoreEventIgnoreOutputTransform\n", mEcoreWindow );
-
- mWindowSurface->OutputTransformed();
-
- mWindow->OnOutputTransformed();
- }
-
- return ECORE_CALLBACK_PASS_ON;
+ mTransitionEffectEventSignal.Emit( state, type );
}
void WindowBaseEcoreWl2::RegistryGlobalCallback( void* data, struct wl_registry *registry, uint32_t name, const char* interface, uint32_t version )
DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::DisplayPolicyBrightnessChangeDone: brightness = %d, state = %d\n", brightness, state );
}
-void WindowBaseEcoreWl2::ShowIndicator( Dali::Window::IndicatorVisibleMode visibleMode, Dali::Window::IndicatorBgOpacity opacityMode )
+Any WindowBaseEcoreWl2::GetNativeWindow()
+{
+ return mEcoreWindow;
+}
+
+int WindowBaseEcoreWl2::GetNativeWindowId()
+{
+ return ecore_wl2_window_id_get( mEcoreWindow );
+}
+
+EGLNativeWindowType WindowBaseEcoreWl2::CreateEglWindow( int width, int height )
+{
+ mEglWindow = wl_egl_window_create( mWlSurface, width, height );
+
+ return static_cast< EGLNativeWindowType >( mEglWindow );
+}
+
+void WindowBaseEcoreWl2::DestroyEglWindow()
+{
+ if( mEglWindow != NULL )
+ {
+ wl_egl_window_destroy( mEglWindow );
+ mEglWindow = NULL;
+ }
+}
+
+void WindowBaseEcoreWl2::SetEglWindowRotation( int angle )
{
- DALI_LOG_TRACE_METHOD_FMT( gWindowBaseLogFilter, "visible : %d\n", visibleMode );
+ wl_egl_window_tizen_rotation rotation;
- if( visibleMode == Dali::Window::VISIBLE )
+ switch( angle )
{
- // when the indicator is visible, set proper mode for indicator server according to bg mode
- if( opacityMode == Dali::Window::OPAQUE )
+ case 0:
+ {
+ rotation = WL_EGL_WINDOW_TIZEN_ROTATION_0 ;
+ break;
+ }
+ case 90:
{
- ecore_wl2_window_indicator_opacity_set( mEcoreWindow, ECORE_WL2_INDICATOR_OPAQUE );
+ rotation = WL_EGL_WINDOW_TIZEN_ROTATION_270;
+ break;
}
- else if( opacityMode == Dali::Window::TRANSLUCENT )
+ case 180:
{
- ecore_wl2_window_indicator_opacity_set( mEcoreWindow, ECORE_WL2_INDICATOR_TRANSLUCENT );
+ rotation = WL_EGL_WINDOW_TIZEN_ROTATION_180;
+ break;
}
- else if( opacityMode == Dali::Window::TRANSPARENT )
+ case 270:
{
- ecore_wl2_window_indicator_opacity_set( mEcoreWindow, ECORE_WL2_INDICATOR_OPAQUE );
+ rotation = WL_EGL_WINDOW_TIZEN_ROTATION_90;
+ break;
+ }
+ default:
+ {
+ rotation = WL_EGL_WINDOW_TIZEN_ROTATION_0 ;
+ break;
}
}
- else
- {
- // when the indicator is not visible, set TRANSPARENT mode for indicator server
- ecore_wl2_window_indicator_opacity_set( mEcoreWindow, ECORE_WL2_INDICATOR_TRANSPARENT); // it means hidden indicator
- }
+
+ wl_egl_window_tizen_set_rotation( mEglWindow, rotation );
}
-void WindowBaseEcoreWl2::SetIndicatorProperties( bool isShow, Dali::Window::WindowOrientation lastOrientation )
+void WindowBaseEcoreWl2::SetEglWindowBufferTransform( int angle )
{
- if( isShow )
- {
- ecore_wl2_window_indicator_state_set( mEcoreWindow, ECORE_WL2_INDICATOR_STATE_ON );
- }
- else
+ wl_output_transform bufferTransform;
+
+ switch( angle )
{
- ecore_wl2_window_indicator_state_set( mEcoreWindow, ECORE_WL2_INDICATOR_STATE_OFF );
+ case 0:
+ {
+ bufferTransform = WL_OUTPUT_TRANSFORM_NORMAL;
+ break;
+ }
+ case 90:
+ {
+ bufferTransform = WL_OUTPUT_TRANSFORM_90;
+ break;
+ }
+ case 180:
+ {
+ bufferTransform = WL_OUTPUT_TRANSFORM_180;
+ break;
+ }
+ case 270:
+ {
+ bufferTransform = WL_OUTPUT_TRANSFORM_270;
+ break;
+ }
+ default:
+ {
+ bufferTransform = WL_OUTPUT_TRANSFORM_NORMAL;
+ break;
+ }
}
+
+ wl_egl_window_tizen_set_buffer_transform( mEglWindow, bufferTransform );
}
-void WindowBaseEcoreWl2::IndicatorTypeChanged( IndicatorInterface::Type type )
+void WindowBaseEcoreWl2::SetEglWindowTransform( int angle )
{
-#if defined(DALI_PROFILE_MOBILE)
- switch( type )
+ wl_output_transform windowTransform;
+
+ switch( angle )
{
- case IndicatorInterface::INDICATOR_TYPE_1:
+ case 0:
+ {
+ windowTransform = WL_OUTPUT_TRANSFORM_NORMAL;
+ break;
+ }
+ case 90:
+ {
+ windowTransform = WL_OUTPUT_TRANSFORM_90;
+ break;
+ }
+ case 180:
{
- ecore_wl2_indicator_visible_type_set( mEcoreWindow, ECORE_WL2_INDICATOR_VISIBLE_TYPE_SHOWN );
+ windowTransform = WL_OUTPUT_TRANSFORM_180;
break;
}
- case IndicatorInterface::INDICATOR_TYPE_2:
+ case 270:
{
- ecore_wl2_indicator_visible_type_set( mEcoreWindow, ECORE_WL2_INDICATOR_VISIBLE_TYPE_HIDDEN );
+ windowTransform = WL_OUTPUT_TRANSFORM_270;
break;
}
- case IndicatorInterface::INDICATOR_TYPE_UNKNOWN:
default:
{
+ windowTransform = WL_OUTPUT_TRANSFORM_NORMAL;
break;
}
}
-#endif //MOBILE
+
+ wl_egl_window_tizen_set_window_transform( mEglWindow, windowTransform );
+}
+
+void WindowBaseEcoreWl2::ResizeEglWindow( PositionSize positionSize )
+{
+ wl_egl_window_resize( mEglWindow, positionSize.width, positionSize.height, positionSize.x, positionSize.y );
+
+ // Note: Both "Resize" and "MoveResize" cases can reach here, but only "MoveResize" needs to submit serial number
+ if( mMoveResizeSerial != mLastSubmittedMoveResizeSerial )
+ {
+ wl_egl_window_tizen_set_window_serial( mEglWindow, mMoveResizeSerial );
+ mLastSubmittedMoveResizeSerial = mMoveResizeSerial;
+ }
+}
+
+bool WindowBaseEcoreWl2::IsEglWindowRotationSupported()
+{
+ // Check capability
+ wl_egl_window_tizen_capability capability = static_cast< wl_egl_window_tizen_capability >( wl_egl_window_tizen_get_capabilities( mEglWindow ) );
+ if( capability == WL_EGL_WINDOW_TIZEN_CAPABILITY_ROTATION_SUPPORTED )
+ {
+ mSupportedPreProtation = true;
+ return true;
+ }
+ mSupportedPreProtation = false;
+ return false;
+}
+
+void WindowBaseEcoreWl2::Move( PositionSize positionSize )
+{
+ ecore_wl2_window_position_set( mEcoreWindow, positionSize.x, positionSize.y );
+}
+
+void WindowBaseEcoreWl2::Resize( PositionSize positionSize )
+{
+ ecore_wl2_window_geometry_set( mEcoreWindow, positionSize.x, positionSize.y, positionSize.width, positionSize.height );
+}
+
+void WindowBaseEcoreWl2::MoveResize( PositionSize positionSize )
+{
+ ecore_wl2_window_sync_geometry_set( mEcoreWindow, ++mMoveResizeSerial, positionSize.x, positionSize.y, positionSize.width, positionSize.height );
}
-void WindowBaseEcoreWl2::SetClass( std::string name, std::string className )
+void WindowBaseEcoreWl2::SetClass( const std::string& name, const std::string& className )
{
ecore_wl2_window_title_set( mEcoreWindow, name.c_str() );
ecore_wl2_window_class_set( mEcoreWindow, className.c_str() );
return true;
}
+void WindowBaseEcoreWl2::GetDpi( unsigned int& dpiHorizontal, unsigned int& dpiVertical )
+{
+ // calculate DPI
+ float xres, yres;
+
+ Ecore_Wl2_Output* output = ecore_wl2_window_output_find( mEcoreWindow );
+
+ // 1 inch = 25.4 millimeters
+ xres = ecore_wl2_output_dpi_get( output );
+ yres = ecore_wl2_output_dpi_get( output );
+
+ dpiHorizontal = int( xres + 0.5f ); // rounding
+ dpiVertical = int( yres + 0.5f );
+}
+
+int WindowBaseEcoreWl2::GetOrientation() const
+{
+ int orientation = (mScreenRotationAngle + mWindowRotationAngle) % 360;
+ if( mSupportedPreProtation )
+ {
+ orientation = 0;
+ }
+ return orientation;
+}
+
+int WindowBaseEcoreWl2::GetScreenRotationAngle()
+{
+ int transform = 0;
+
+ if( ecore_wl2_window_ignore_output_transform_get( mEcoreWindow ) )
+ {
+ transform = 0;
+ }
+ else
+ {
+ transform = ecore_wl2_output_transform_get( ecore_wl2_window_output_find( mEcoreWindow ) );
+ }
+ mScreenRotationAngle = transform * 90;
+ return mScreenRotationAngle;
+}
+
+void WindowBaseEcoreWl2::SetWindowRotationAngle( int degree )
+{
+ mWindowRotationAngle = degree;
+ ecore_wl2_window_rotation_set( mEcoreWindow, degree );
+}
+
+int WindowBaseEcoreWl2::GetWindowRotationAngle()
+{
+ return mWindowRotationAngle;
+}
+
+void WindowBaseEcoreWl2::WindowRotationCompleted( int degree, int width, int height )
+{
+ ecore_wl2_window_rotation_change_done_send( mEcoreWindow, degree, width, height );
+}
+
+void WindowBaseEcoreWl2::SetTransparency( bool transparent )
+{
+ ecore_wl2_window_alpha_set( mEcoreWindow, transparent );
+}
+
+void WindowBaseEcoreWl2::InitializeEcoreElDBus()
+{
+#ifdef DALI_ELDBUS_AVAILABLE
+ Eldbus_Object* object;
+ Eldbus_Proxy* manager;
+
+ if( !( mSystemConnection = eldbus_connection_get( ELDBUS_CONNECTION_TYPE_SYSTEM ) ) )
+ {
+ DALI_LOG_ERROR( "Unable to get system bus\n" );
+ }
+
+ object = eldbus_object_get( mSystemConnection, BUS, PATH );
+ if( !object )
+ {
+ DALI_LOG_ERROR( "Getting object failed\n" );
+ return;
+ }
+
+ manager = eldbus_proxy_get( object, INTERFACE );
+ if( !manager )
+ {
+ DALI_LOG_ERROR( "Getting proxy failed\n" );
+ return;
+ }
+
+ if( !eldbus_proxy_signal_handler_add( manager, "GestureDetected", EcoreElDBusAccessibilityNotification, this ) )
+ {
+ DALI_LOG_ERROR( "No signal handler returned\n" );
+ }
+#endif
+}
+
+void WindowBaseEcoreWl2::CreateWindow( PositionSize positionSize )
+{
+ Ecore_Wl2_Display* display = ecore_wl2_display_connect( NULL );
+ if( !display )
+ {
+ DALI_ASSERT_ALWAYS( 0 && "Failed to get display" );
+ }
+
+ mEcoreWindow = ecore_wl2_window_new( display, NULL, positionSize.x, positionSize.y, positionSize.width, positionSize.height );
+
+ if ( mEcoreWindow == 0 )
+ {
+ DALI_ASSERT_ALWAYS( 0 && "Failed to create Wayland window" );
+ }
+
+ // Set default type
+ ecore_wl2_window_type_set( mEcoreWindow, ECORE_WL2_WINDOW_TYPE_TOPLEVEL );
+}
+
+void WindowBaseEcoreWl2::SetParent( WindowBase* parentWinBase )
+{
+ Ecore_Wl2_Window* ecoreParent = NULL;
+ if( parentWinBase )
+ {
+ WindowBaseEcoreWl2* winBaseEcore2 = static_cast<WindowBaseEcoreWl2*>( parentWinBase );
+ ecoreParent = winBaseEcore2->mEcoreWindow;
+ }
+ ecore_wl2_window_parent_set( mEcoreWindow, ecoreParent );
+}
+
} // namespace Adaptor
} // namespace Internal