From 05a3d060973db14eb49a75e762cb41a05bddab13 Mon Sep 17 00:00:00 2001 From: Richard Huang Date: Fri, 19 Sep 2014 11:46:52 +0100 Subject: [PATCH] Event handling for hover event Change-Id: If80f5cf4facd93bedcdb4ea8f76d98ffe14bb0e1 --- adaptors/tizen/accessibility-manager-impl-tizen.cpp | 15 +++++++++------ .../ubuntu/accessibility-manager-impl-ubuntu.cpp | 15 +++++++++------ adaptors/wayland/accessibility-manager-impl-wl.cpp | 1 - adaptors/wayland/event-handler-wl.cpp | 21 ++++++++++++++++----- adaptors/x11/accessibility-manager-impl-x.cpp | 1 - adaptors/x11/event-handler-x.cpp | 21 ++++++++++++++++----- 6 files changed, 50 insertions(+), 24 deletions(-) diff --git a/adaptors/tizen/accessibility-manager-impl-tizen.cpp b/adaptors/tizen/accessibility-manager-impl-tizen.cpp index feb5551..d2d4f14 100644 --- a/adaptors/tizen/accessibility-manager-impl-tizen.cpp +++ b/adaptors/tizen/accessibility-manager-impl-tizen.cpp @@ -24,6 +24,7 @@ #include #include #include +#include #include // INTERNAL INCLUDES @@ -155,8 +156,8 @@ bool AccessibilityManager::HandleActionScrollEvent(const TouchPoint& point, unsi Dali::AccessibilityManager handle( this ); - Dali::TouchEvent touchEvent(timeStamp); - touchEvent.points.push_back(point); + Dali::TouchEvent event(timeStamp); + event.points.push_back(point); /* * In order to application decide touch action first, @@ -166,17 +167,19 @@ bool AccessibilityManager::HandleActionScrollEvent(const TouchPoint& point, unsi { if( !mActionScrollSignalV2.Empty() ) { - mActionScrollSignalV2.Emit( handle, touchEvent ); + mActionScrollSignalV2.Emit( handle, event ); } } - Integration::TouchEvent event; - if (mCombiner.GetNextTouchEvent(point, timeStamp, event)) + Integration::TouchEvent touchEvent; + Integration::HoverEvent hoverEvent; + Integration::TouchEventCombiner::EventDispatchType type = mCombiner.GetNextTouchEvent(point, timeStamp, touchEvent, hoverEvent); + if(type == Integration::TouchEventCombiner::DispatchTouch || type == Integration::TouchEventCombiner::DispatchBoth) // hover event is ignored { // Process the touch event in accessibility gesture detector if( mAccessibilityGestureDetector ) { - mAccessibilityGestureDetector->SendEvent(event); + mAccessibilityGestureDetector->SendEvent(touchEvent); ret = true; } } diff --git a/adaptors/ubuntu/accessibility-manager-impl-ubuntu.cpp b/adaptors/ubuntu/accessibility-manager-impl-ubuntu.cpp index 8c4214a..278bf6c 100644 --- a/adaptors/ubuntu/accessibility-manager-impl-ubuntu.cpp +++ b/adaptors/ubuntu/accessibility-manager-impl-ubuntu.cpp @@ -23,6 +23,7 @@ #include #include #include +#include #include // INTERNAL INCLUDES @@ -136,8 +137,8 @@ bool AccessibilityManager::HandleActionScrollEvent(const TouchPoint& point, unsi Dali::AccessibilityManager handle( this ); - Dali::TouchEvent touchEvent(timeStamp); - touchEvent.points.push_back(point); + Dali::TouchEvent event(timeStamp); + event.points.push_back(point); /* * In order to application decide touch action first, @@ -147,17 +148,19 @@ bool AccessibilityManager::HandleActionScrollEvent(const TouchPoint& point, unsi { if( !mActionScrollSignalV2.Empty() ) { - mActionScrollSignalV2.Emit( handle, touchEvent ); + mActionScrollSignalV2.Emit( handle, event ); } } - Integration::TouchEvent event; - if (mCombiner.GetNextTouchEvent(point, timeStamp, event)) + Integration::TouchEvent touchEvent; + Integration::HoverEvent hoverEvent; + Integration::TouchEventCombiner::EventDispatchType type = mCombiner.GetNextTouchEvent(point, timeStamp, touchEvent, hoverEvent); + if(type == Integration::TouchEventCombiner::DispatchTouch || type == Integration::TouchEventCombiner::DispatchBoth) // hover event is ignored { // Process the touch event in accessibility gesture detector if( mAccessibilityGestureDetector ) { - mAccessibilityGestureDetector->SendEvent(event); + mAccessibilityGestureDetector->SendEvent(touchEvent); ret = true; } } diff --git a/adaptors/wayland/accessibility-manager-impl-wl.cpp b/adaptors/wayland/accessibility-manager-impl-wl.cpp index b57bc54..0147608 100644 --- a/adaptors/wayland/accessibility-manager-impl-wl.cpp +++ b/adaptors/wayland/accessibility-manager-impl-wl.cpp @@ -26,7 +26,6 @@ #include #include -#include #include #include "system-settings.h" diff --git a/adaptors/wayland/event-handler-wl.cpp b/adaptors/wayland/event-handler-wl.cpp index b60efea..e67bda9 100644 --- a/adaptors/wayland/event-handler-wl.cpp +++ b/adaptors/wayland/event-handler-wl.cpp @@ -38,6 +38,7 @@ #include #include #include +#include #include // INTERNAL INCLUDES @@ -692,14 +693,24 @@ void EventHandler::SendEvent(TouchPoint& point, unsigned long timeStamp) timeStamp = GetCurrentMilliSeconds(); } - Integration::TouchEvent event; - if (mCombiner.GetNextTouchEvent(point, timeStamp, event)) + Integration::TouchEvent touchEvent; + Integration::HoverEvent hoverEvent; + Integration::TouchEventCombiner::EventDispatchType type = mCombiner.GetNextTouchEvent(point, timeStamp, touchEvent, hoverEvent); + if(type != Integration::TouchEventCombiner::DispatchNone ) { DALI_LOG_INFO(gTouchEventLogFilter, Debug::General, "%d: Device %d: Button state %d (%.2f, %.2f)\n", timeStamp, point.deviceId, point.state, point.local.x, point.local.y); - // First the touch event & related gesture events are queued - mCoreEventInterface.QueueCoreEvent( event ); - mGestureManager.SendEvent(event); + // First the touch and/or hover event & related gesture events are queued + if(type == Integration::TouchEventCombiner::DispatchTouch || type == Integration::TouchEventCombiner::DispatchBoth) + { + mCoreEventInterface.QueueCoreEvent( touchEvent ); + mGestureManager.SendEvent(touchEvent); + } + + if(type == Integration::TouchEventCombiner::DispatchHover || type == Integration::TouchEventCombiner::DispatchBoth) + { + mCoreEventInterface.QueueCoreEvent( hoverEvent ); + } // Next the events are processed with a single call into Core mCoreEventInterface.ProcessCoreEvents(); diff --git a/adaptors/x11/accessibility-manager-impl-x.cpp b/adaptors/x11/accessibility-manager-impl-x.cpp index e70f2b8..97ff5dd 100644 --- a/adaptors/x11/accessibility-manager-impl-x.cpp +++ b/adaptors/x11/accessibility-manager-impl-x.cpp @@ -25,7 +25,6 @@ #include #include -#include #include #include "system-settings.h" diff --git a/adaptors/x11/event-handler-x.cpp b/adaptors/x11/event-handler-x.cpp index f702cea..4fbe2a3 100644 --- a/adaptors/x11/event-handler-x.cpp +++ b/adaptors/x11/event-handler-x.cpp @@ -39,6 +39,7 @@ #include #include #include +#include #include // INTERNAL INCLUDES @@ -1137,14 +1138,24 @@ void EventHandler::SendEvent(TouchPoint& point, unsigned long timeStamp) timeStamp = GetCurrentMilliSeconds(); } - Integration::TouchEvent event; - if (mCombiner.GetNextTouchEvent(point, timeStamp, event)) + Integration::TouchEvent touchEvent; + Integration::HoverEvent hoverEvent; + Integration::TouchEventCombiner::EventDispatchType type = mCombiner.GetNextTouchEvent(point, timeStamp, touchEvent, hoverEvent); + if(type != Integration::TouchEventCombiner::DispatchNone ) { DALI_LOG_INFO(gTouchEventLogFilter, Debug::General, "%d: Device %d: Button state %d (%.2f, %.2f)\n", timeStamp, point.deviceId, point.state, point.local.x, point.local.y); - // First the touch event & related gesture events are queued - mCoreEventInterface.QueueCoreEvent( event ); - mGestureManager.SendEvent(event); + // First the touch and/or hover event & related gesture events are queued + if(type == Integration::TouchEventCombiner::DispatchTouch || type == Integration::TouchEventCombiner::DispatchBoth) + { + mCoreEventInterface.QueueCoreEvent( touchEvent ); + mGestureManager.SendEvent(touchEvent); + } + + if(type == Integration::TouchEventCombiner::DispatchHover || type == Integration::TouchEventCombiner::DispatchBoth) + { + mCoreEventInterface.QueueCoreEvent( hoverEvent ); + } // Next the events are processed with a single call into Core mCoreEventInterface.ProcessCoreEvents(); -- 2.7.4