/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2015 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.
#include <dali/public-api/common/vector-wrapper.h>
#include <dali/public-api/events/touch-point.h>
#include <dali/public-api/events/key-event.h>
-#include <dali/public-api/events/mouse-wheel-event.h>
+#include <dali/public-api/events/wheel-event.h>
#include <dali/integration-api/debug.h>
#include <dali/integration-api/events/key-event-integ.h>
#include <dali/integration-api/events/touch-event-integ.h>
#include <dali/integration-api/events/hover-event-integ.h>
-#include <dali/integration-api/events/mouse-wheel-event-integ.h>
+#include <dali/integration-api/events/wheel-event-integ.h>
// INTERNAL INCLUDES
#include <events/gesture-manager.h>
#include <style-monitor-impl.h>
#include <base/core-event-interface.h>
-using namespace std;
-
namespace Dali
{
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 );
+ WheelEvent wheelEvent( WheelEvent::MOUSE_WHEEL, mouseWheelEvent->direction, mouseWheelEvent->modifiers, Vector2(mouseWheelEvent->x, mouseWheelEvent->y), mouseWheelEvent->z, mouseWheelEvent->timestamp );
+ handler->SendWheelEvent( wheelEvent );
}
return ECORE_CALLBACK_PASS_ON;
}
Ecore_Event_Key *keyEvent( (Ecore_Event_Key*)event );
bool eventHandled( false );
- Ecore_IMF_Context* imfContext = NULL;
- if ( Dali::Adaptor::IsAvailable() && handler->mImfManager )
- {
- imfContext = reinterpret_cast<Ecore_IMF_Context*>( handler->mImfManager.GetContext() );
- }
-
// If a device key then skip ecore_imf_context_filter_event.
- if ( imfContext && !( KeyLookup::IsDeviceButton( keyEvent->keyname ) ) )
+ if ( ! KeyLookup::IsDeviceButton( keyEvent->keyname ) )
{
- // 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 )
+ Ecore_IMF_Context* imfContext = NULL;
+ Dali::ImfManager imfManager( ImfManager::Get() );
+ if ( imfManager )
+ {
+ imfContext = ImfManager::GetImplementation( imfManager ).GetContext();
+ }
+
+ if ( imfContext )
{
- if ( !strcmp( keyEvent->keyname, "Escape" ) ||
- !strcmp( keyEvent->keyname, "Return" ) ||
- !strcmp( keyEvent->keyname, "KP_Enter" ) )
+ // 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 )
{
- ecore_imf_context_reset( imfContext );
+ if ( !strcmp( keyEvent->keyname, "Escape" ) ||
+ !strcmp( keyEvent->keyname, "Return" ) ||
+ !strcmp( keyEvent->keyname, "KP_Enter" ) )
+ {
+ ecore_imf_context_reset( imfContext );
+ }
}
}
}
Ecore_Event_Key *keyEvent( (Ecore_Event_Key*)event );
bool eventHandled( false );
- Ecore_IMF_Context* imfContext = NULL;
- if ( Dali::Adaptor::IsAvailable() && handler->mImfManager )
+ // Menu, home, back button must skip ecore_imf_context_filter_event.
+ static const char* menuKeyName = KeyLookup::GetKeyName( DALI_KEY_MENU );
+ static const char* homeKeyName = KeyLookup::GetKeyName( DALI_KEY_HOME );
+ static const char* backKeyName = KeyLookup::GetKeyName( DALI_KEY_BACK );
+ if ( ( menuKeyName && strcmp( keyEvent->keyname, menuKeyName ) != 0 ) &&
+ ( homeKeyName && strcmp( keyEvent->keyname, homeKeyName ) != 0 ) &&
+ ( backKeyName && strcmp( keyEvent->keyname, backKeyName ) != 0 ) )
{
- imfContext = reinterpret_cast<Ecore_IMF_Context*>( handler->mImfManager.GetContext() );
- }
-
- // XF86Stop and XF86Send must skip ecore_imf_context_filter_event.
- if ( imfContext && 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 = ImfManager::GetImplementation( imfManager ).GetContext();
+ }
- {
- // 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 ( 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.
{
DALI_LOG_INFO( gImfLogging, Debug::General, "EVENT EcoreEventWindowFocusIn - >>WindowFocusGained \n" );
- if ( handler->mImfManager )
+ if ( ImfManager::IsAvailable() /* Only get the ImfManager if it's available as we do not want to create it */ )
{
- ImfManager& imfManager( ImfManager::GetImplementation( handler->mImfManager ) );
- if( imfManager.RestoreAfterFocusLost() )
+ Dali::ImfManager imfManager( ImfManager::Get() );
+ if ( imfManager )
{
- imfManager.Activate();
+ ImfManager& imfManagerImpl( ImfManager::GetImplementation( imfManager ) );
+ if( imfManagerImpl.RestoreAfterFocusLost() )
+ {
+ imfManagerImpl.Activate();
+ }
}
}
// No need to connect callbacks as KeyboardStatusChanged will be called.
// If the window loses focus then hide the keyboard.
if ( focusOutEvent->win == (unsigned int)ecore_wl_window_id_get(handler->mImpl->mWindow) )
{
- if ( handler->mImfManager )
+ if ( ImfManager::IsAvailable() /* Only get the ImfManager if it's available as we do not want to create it */ )
{
- ImfManager& imfManager( ImfManager::GetImplementation( handler->mImfManager ) );
- if( imfManager.RestoreAfterFocusLost() )
+ Dali::ImfManager imfManager( ImfManager::Get() );
+ if ( imfManager )
{
- imfManager.Deactivate();
+ ImfManager& imfManagerImpl( ImfManager::GetImplementation( imfManager ) );
+ if( imfManagerImpl.RestoreAfterFocusLost() )
+ {
+ imfManagerImpl.Deactivate();
+ }
}
}
static void VconfNotifyFontNameChanged( keynode_t* node, void* data )
{
EventHandler* handler = static_cast<EventHandler*>( data );
-
- StyleChange fontChange;
- fontChange.defaultFontChange = true;
-
- handler->SendEvent( fontChange );
+ handler->SendEvent( StyleChange::DEFAULT_FONT_CHANGE );
}
/**
static void VconfNotifyFontSizeChanged( keynode_t* node, void* data )
{
EventHandler* handler = static_cast<EventHandler*>( data );
-
- StyleChange fontChange;
- fontChange.defaultFontSizeChange = true;
-
- handler->SendEvent( fontChange );
+ handler->SendEvent( StyleChange::DEFAULT_FONT_SIZE_CHANGE );
}
// Data
mDamageObserver( damageObserver ),
mRotationObserver( NULL ),
mDragAndDropDetector( dndDetector ),
- mAccessibilityManager( AccessibilityManager::Get() ),
+ mAccessibilityAdaptor( AccessibilityAdaptor::Get() ),
mClipboardEventNotifier( ClipboardEventNotifier::Get() ),
mClipboard(Clipboard::Get()),
- mImfManager( ImfManager::Get() ),
mImpl( NULL )
{
Ecore_Wl_Window* window = 0;
- if( surface->GetType() == Dali::RenderSurface::WINDOW )
+ // this code only works with the Ecore RenderSurface so need to downcast
+ ECore::WindowRenderSurface* ecoreSurface = dynamic_cast< ECore::WindowRenderSurface* >( surface );
+ if( ecoreSurface )
{
- // this code only works with the Ecore RenderSurface so need to downcast
- ECore::WindowRenderSurface* ecoreSurface = dynamic_cast< ECore::WindowRenderSurface* >( surface );
- if( ecoreSurface )
- {
- window = ecoreSurface->GetWlWindow();
- }
+ window = ecoreSurface->GetWlWindow();
}
mImpl = new Impl(this, window);
mCoreEventInterface.ProcessCoreEvents();
}
-void EventHandler::SendMouseWheelEvent( MouseWheelEvent& wheelEvent )
+void EventHandler::SendWheelEvent( WheelEvent& wheelEvent )
{
- // Create MouseWheelEvent and send to Core.
- Integration::MouseWheelEvent event(wheelEvent.direction, wheelEvent.modifiers, wheelEvent.point, wheelEvent.z, wheelEvent.timeStamp);
+ // Create WheelEvent and send to Core.
+ Integration::WheelEvent event( static_cast< Integration::WheelEvent::Type >(wheelEvent.type), wheelEvent.direction, wheelEvent.modifiers, wheelEvent.point, wheelEvent.z, wheelEvent.timeStamp );
mCoreEventInterface.QueueCoreEvent( event );
mCoreEventInterface.ProcessCoreEvents();
}
-void EventHandler::SendEvent(StyleChange styleChange)
+void EventHandler::SendEvent( StyleChange::Type styleChange )
{
DALI_ASSERT_DEBUG( mStyleMonitor && "StyleMonitor Not Available" );
GetImplementation( mStyleMonitor ).StyleChanged(styleChange);
SendEvent(point, timeStamp);
}
-void EventHandler::FeedWheelEvent( MouseWheelEvent& wheelEvent )
+void EventHandler::FeedWheelEvent( WheelEvent& wheelEvent )
{
- SendMouseWheelEvent( wheelEvent );
+ SendWheelEvent( wheelEvent );
}
void EventHandler::FeedKeyEvent( KeyEvent& event )
mCoreEventInterface.ProcessCoreEvents();
}
+void EventHandler::Pause()
+{
+ mPaused = true;
+ Reset();
+}
+
+void EventHandler::Resume()
+{
+ mPaused = false;
+ Reset();
+}
+
void EventHandler::SetDragAndDropDetector( DragAndDropDetectorPtr detector )
{
mDragAndDropDetector = detector;