-#ifndef DALI_PROFILE_UBUNTU
- vconf_ignore_key_changed( VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, VconfNotifyFontSizeChanged );
- vconf_ignore_key_changed( DALI_VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, VconfNotifyFontNameChanged );
-#endif // DALI_PROFILE_UBUNTU
-
- for( std::vector<Ecore_Event_Handler*>::iterator iter = mEcoreEventHandler.begin(), endIter = mEcoreEventHandler.end(); iter != endIter; ++iter )
- {
- ecore_event_handler_del( *iter );
- }
- }
-
- // Static methods
-
- /////////////////////////////////////////////////////////////////////////////////////////////////
- // Touch Callbacks
- /////////////////////////////////////////////////////////////////////////////////////////////////
-
- /**
- * Called when a touch down is received.
- */
- static Eina_Bool EcoreEventMouseButtonDown( void* data, int type, void* event )
- {
- Ecore_Event_Mouse_Button *touchEvent( (Ecore_Event_Mouse_Button*)event );
- EventHandler* handler( (EventHandler*)data );
-
- if ( touchEvent->window == (unsigned int)ecore_wl_window_id_get(handler->mImpl->mWindow) )
- {
- TouchPoint::State state ( TouchPoint::Down );
-
- // 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 = TouchPoint::Interrupted;
- }
-
- TouchPoint point( touchEvent->multi.device, state, touchEvent->x, touchEvent->y );
- handler->SendEvent( point, touchEvent->timestamp );
- }
-
- return ECORE_CALLBACK_PASS_ON;
- }
-
- /**
- * Called when a touch up is received.
- */
- static Eina_Bool EcoreEventMouseButtonUp( void* data, int type, void* event )
- {
- Ecore_Event_Mouse_Button *touchEvent( (Ecore_Event_Mouse_Button*)event );
- EventHandler* handler( (EventHandler*)data );
-
- if ( touchEvent->window == (unsigned int)ecore_wl_window_id_get(handler->mImpl->mWindow) )
- {
- TouchPoint point( touchEvent->multi.device, TouchPoint::Up, touchEvent->x, touchEvent->y );
- handler->SendEvent( point, touchEvent->timestamp );
- }
-
- return ECORE_CALLBACK_PASS_ON;
- }
-
- /**
- * Called when a touch up is received.
- */
- static Eina_Bool EcoreEventMouseWheel( void* data, int type, void* event )
- {
- Ecore_Event_Mouse_Wheel *mouseWheelEvent( (Ecore_Event_Mouse_Wheel*)event );
-
- DALI_LOG_INFO( gImfLogging, Debug::General, "EVENT Ecore_Event_Mouse_Wheel: direction: %d, modifiers: %d, x: %d, y: %d, z: %d\n", mouseWheelEvent->direction, mouseWheelEvent->modifiers, mouseWheelEvent->x, mouseWheelEvent->y, mouseWheelEvent->z);
-
- EventHandler* handler( (EventHandler*)data );
- if ( mouseWheelEvent->window == (unsigned int)ecore_wl_window_id_get(handler->mImpl->mWindow) )
- {
- MouseWheelEvent wheelEvent(mouseWheelEvent->direction, mouseWheelEvent->modifiers, Vector2(mouseWheelEvent->x, mouseWheelEvent->y), mouseWheelEvent->z, mouseWheelEvent->timestamp);
- handler->SendMouseWheelEvent( wheelEvent );
- }
- return ECORE_CALLBACK_PASS_ON;
- }
-
- /**
- * Called when a touch motion is received.
- */
- static Eina_Bool EcoreEventMouseButtonMove( void* data, int type, void* event )
- {
- Ecore_Event_Mouse_Move *touchEvent( (Ecore_Event_Mouse_Move*)event );
- EventHandler* handler( (EventHandler*)data );
-
- if ( touchEvent->window == (unsigned int)ecore_wl_window_id_get(handler->mImpl->mWindow) )
- {
- TouchPoint point( touchEvent->multi.device, TouchPoint::Motion, touchEvent->x, touchEvent->y );
- handler->SendEvent( point, touchEvent->timestamp );
- }
-
- return ECORE_CALLBACK_PASS_ON;
- }
-
- /////////////////////////////////////////////////////////////////////////////////////////////////
- // Key Callbacks
- /////////////////////////////////////////////////////////////////////////////////////////////////
-
- /**
- * Called when a key down is received.
- */
- static Eina_Bool EcoreEventKeyDown( void* data, int type, void* event )
- {
- DALI_LOG_INFO( gImfLogging, Debug::General, "EVENT >>EcoreEventKeyDown \n" );
-
- EventHandler* handler( (EventHandler*)data );
- Ecore_Event_Key *keyEvent( (Ecore_Event_Key*)event );
- bool eventHandled( false );
-
- // If a device key then skip ecore_imf_context_filter_event.
- if ( ! KeyLookup::IsDeviceButton( keyEvent->keyname ) )
- {
- Ecore_IMF_Context* imfContext = NULL;
- Dali::ImfManager imfManager( ImfManager::Get() );
- if ( imfManager )
- {
- imfContext = reinterpret_cast<Ecore_IMF_Context*>( imfManager.GetContext() );
- }
-
- if ( imfContext )
- {
- // We're consuming key down event so we have to pass to IMF so that it can parse it as well.
- Ecore_IMF_Event_Key_Down ecoreKeyDownEvent;
- ecoreKeyDownEvent.keyname = keyEvent->keyname;
- ecoreKeyDownEvent.key = keyEvent->key;
- ecoreKeyDownEvent.string = keyEvent->string;
- ecoreKeyDownEvent.compose = keyEvent->compose;
- ecoreKeyDownEvent.timestamp = keyEvent->timestamp;
- ecoreKeyDownEvent.modifiers = EcoreInputModifierToEcoreIMFModifier ( keyEvent->modifiers );
- ecoreKeyDownEvent.locks = (Ecore_IMF_Keyboard_Locks) ECORE_IMF_KEYBOARD_LOCK_NONE;
-
- eventHandled = ecore_imf_context_filter_event( imfContext,
- ECORE_IMF_EVENT_KEY_DOWN,
- (Ecore_IMF_Event *) &ecoreKeyDownEvent );
-
- // If the event has not been handled by IMF then check if we should reset our IMF context
- if( !eventHandled )
- {
- if ( !strcmp( keyEvent->keyname, "Escape" ) ||
- !strcmp( keyEvent->keyname, "Return" ) ||
- !strcmp( keyEvent->keyname, "KP_Enter" ) )
- {
- ecore_imf_context_reset( imfContext );
- }
- }
- }
- }
-
- // If the event wasn't handled then we should send a key event.
- if ( !eventHandled )
- {
- if ( keyEvent->window == (unsigned int)ecore_wl_window_id_get(handler->mImpl->mWindow) )
- {
- std::string keyName( keyEvent->keyname );
- std::string keyString( "" );
- int keyCode = 0/*ecore_x_keysym_keycode_get(keyEvent->keyname)*/;
- int modifier( keyEvent->modifiers );
- unsigned long time = keyEvent->timestamp;
-
- if (!strncmp(keyEvent->keyname, "Keycode-", 8))
- keyCode = atoi(keyEvent->keyname + 8);
-
- // Ensure key event string is not NULL as keys like SHIFT have a null string.
- if ( keyEvent->string )
- {
- keyString = keyEvent->string;
- }
-
- KeyEvent keyEvent(keyName, keyString, keyCode, modifier, time, KeyEvent::Down);
- handler->SendEvent( keyEvent );
- }
- }
-
- return ECORE_CALLBACK_PASS_ON;
- }
-
- /**
- * Called when a key up is received.
- */
- static Eina_Bool EcoreEventKeyUp( void* data, int type, void* event )
- {
- DALI_LOG_INFO( gImfLogging, Debug::General, "EVENT >>EcoreEventKeyUp \n" );
-
- EventHandler* handler( (EventHandler*)data );
- Ecore_Event_Key *keyEvent( (Ecore_Event_Key*)event );
- bool eventHandled( false );
-
- // XF86Stop and XF86Send must skip ecore_imf_context_filter_event.
- if ( strcmp( keyEvent->keyname, "XF86Send" ) &&
- strcmp( keyEvent->keyname, "XF86Phone" ) &&
- strcmp( keyEvent->keyname, "XF86Stop" ) )
- {
- Ecore_IMF_Context* imfContext = NULL;
- Dali::ImfManager imfManager( ImfManager::Get() );
- if ( imfManager )
- {
- imfContext = reinterpret_cast<Ecore_IMF_Context*>( imfManager.GetContext() );
- }
-
- if ( imfContext )
- {
- // We're consuming key up event so we have to pass to IMF so that it can parse it as well.
- Ecore_IMF_Event_Key_Up ecoreKeyUpEvent;
- ecoreKeyUpEvent.keyname = keyEvent->keyname;
- ecoreKeyUpEvent.key = keyEvent->key;
- ecoreKeyUpEvent.string = keyEvent->string;
- ecoreKeyUpEvent.compose = keyEvent->compose;
- ecoreKeyUpEvent.timestamp = keyEvent->timestamp;
- ecoreKeyUpEvent.modifiers = EcoreInputModifierToEcoreIMFModifier ( keyEvent->modifiers );
- ecoreKeyUpEvent.locks = (Ecore_IMF_Keyboard_Locks) ECORE_IMF_KEYBOARD_LOCK_NONE;
-
- eventHandled = ecore_imf_context_filter_event( imfContext,
- ECORE_IMF_EVENT_KEY_UP,
- (Ecore_IMF_Event *) &ecoreKeyUpEvent );
- }
- }
-
- // If the event wasn't handled then we should send a key event.
- if ( !eventHandled )
- {
- if ( keyEvent->window == (unsigned int)ecore_wl_window_id_get(handler->mImpl->mWindow) )
- {
- std::string keyName( keyEvent->keyname );
- std::string keyString( "" );
- int keyCode = 0/*ecore_x_keysym_keycode_get(keyEvent->keyname)*/;
- int modifier( keyEvent->modifiers );
- unsigned long time( keyEvent->timestamp );
-
- if (!strncmp(keyEvent->keyname, "Keycode-", 8))
- keyCode = atoi(keyEvent->keyname + 8);
-
- // Ensure key event string is not NULL as keys like SHIFT have a null string.
- if ( keyEvent->string )
- {
- keyString = keyEvent->string;
- }
-
- KeyEvent keyEvent(keyName, keyString, keyCode, modifier, time, KeyEvent::Up);
- handler->SendEvent( keyEvent );
- }
- }
-
- return ECORE_CALLBACK_PASS_ON;
- }
-
- /////////////////////////////////////////////////////////////////////////////////////////////////
- // Window Callbacks
- /////////////////////////////////////////////////////////////////////////////////////////////////
-
- /**
- * Called when the window gains focus.
- */
- static Eina_Bool EcoreEventWindowFocusIn( void* data, int type, void* event )
- {
- Ecore_Wl_Event_Focus_In* focusInEvent( (Ecore_Wl_Event_Focus_In*)event );
- EventHandler* handler( (EventHandler*)data );
-
- DALI_LOG_INFO( gImfLogging, Debug::General, "EVENT >>EcoreEventWindowFocusIn \n" );
-
- // If the window gains focus and we hid the keyboard then show it again.
- if ( focusInEvent->win == (unsigned int)ecore_wl_window_id_get(handler->mImpl->mWindow) )
- {
- DALI_LOG_INFO( gImfLogging, Debug::General, "EVENT EcoreEventWindowFocusIn - >>WindowFocusGained \n" );
-
- if ( ImfManager::IsAvailable() /* Only get the ImfManager if it's available as we do not want to create it */ )
- {
- Dali::ImfManager imfManager( ImfManager::Get() );
- if ( imfManager )
- {
- ImfManager& imfManagerImpl( ImfManager::GetImplementation( imfManager ) );
- if( imfManagerImpl.RestoreAfterFocusLost() )
- {
- imfManagerImpl.Activate();
- }
- }
- }
- // No need to connect callbacks as KeyboardStatusChanged will be called.
- }
-
- return ECORE_CALLBACK_PASS_ON;
- }
-
- /**
- * Called when the window loses focus.
- */
- static Eina_Bool EcoreEventWindowFocusOut( void* data, int type, void* event )
- {
- Ecore_Wl_Event_Focus_Out* focusOutEvent( (Ecore_Wl_Event_Focus_Out*)event );
- EventHandler* handler( (EventHandler*)data );
-
- DALI_LOG_INFO( gImfLogging, Debug::General, "EVENT >>EcoreEventWindowFocusOut \n" );
-
- // If the window loses focus then hide the keyboard.
- if ( focusOutEvent->win == (unsigned int)ecore_wl_window_id_get(handler->mImpl->mWindow) )
- {
- if ( ImfManager::IsAvailable() /* Only get the ImfManager if it's available as we do not want to create it */ )
- {
- Dali::ImfManager imfManager( ImfManager::Get() );
- if ( imfManager )
- {
- ImfManager& imfManagerImpl( ImfManager::GetImplementation( imfManager ) );
- if( imfManagerImpl.RestoreAfterFocusLost() )
- {
- imfManagerImpl.Deactivate();
- }
- }
- }
-
- // Clipboard don't support that whether clipboard is shown or not. Hide clipboard.
- Dali::Clipboard clipboard = Clipboard::Get();
- clipboard.HideClipboard();
- }
-
- return ECORE_CALLBACK_PASS_ON;
- }
-
- /**
- * Called when the window is damaged.
- */
- static Eina_Bool EcoreEventWindowDamaged(void *data, int type, void *event)
- {
- return ECORE_CALLBACK_PASS_ON;
- }
-
- /**
- * Called when the window properties are changed.
- * We are only interested in the font change.
- */
-
-
- /////////////////////////////////////////////////////////////////////////////////////////////////
- // Drag & Drop Callbacks
- /////////////////////////////////////////////////////////////////////////////////////////////////
-
- /**
- * Called when a dragged item enters our window's bounds.
- * This is when items are dragged INTO our window.
- */
- static Eina_Bool EcoreEventDndEnter( void* data, int type, void* event )
- {
- DALI_LOG_INFO( gDragAndDropLogFilter, Debug::Concise, "EcoreEventDndEnter\n" );
-
- return ECORE_CALLBACK_PASS_ON;
- }
-
- /**
- * Called when a dragged item is moved within our window.
- * This is when items are dragged INTO our window.
- */
- static Eina_Bool EcoreEventDndPosition( void* data, int type, void* event )
- {
- DALI_LOG_INFO(gDragAndDropLogFilter, Debug::Concise, "EcoreEventDndPosition\n" );
-
- return ECORE_CALLBACK_PASS_ON;
- }
-
- /**
- * Called when a dragged item leaves our window's bounds.
- * This is when items are dragged INTO our window.
- */
- static Eina_Bool EcoreEventDndLeave( void* data, int type, void* event )
- {
- DALI_LOG_INFO(gDragAndDropLogFilter, Debug::Concise, "EcoreEventDndLeave\n" );
-
- return ECORE_CALLBACK_PASS_ON;