X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Finternal%2Fevent%2Fevents%2Fevent-processor.cpp;h=06250bafc4b47afaeebe7fde90adc3c0e0539a9a;hb=bc2c41d0daf648700e0f5c4732f44772945d035b;hp=9d63a3c70278cf1a79eb4a98c91031d4363a06d6;hpb=b724ab3f8d46a3fb40095ee626e91dd034b151dd;p=platform%2Fcore%2Fuifw%2Fdali-core.git diff --git a/dali/internal/event/events/event-processor.cpp b/dali/internal/event/events/event-processor.cpp index 9d63a3c..06250ba 100644 --- a/dali/internal/event/events/event-processor.cpp +++ b/dali/internal/event/events/event-processor.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 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. @@ -21,15 +21,10 @@ // INTERNAL INCLUDES #include #include -#include #include -#include +#include #include #include -#include -#include -#include -#include #include #include #include @@ -46,8 +41,7 @@ namespace // unnamed namespace { static const std::size_t MAX_MESSAGE_SIZE = std::max( sizeof(Integration::TouchEvent), - std::max( sizeof(Integration::KeyEvent), - std::max( sizeof(Integration::MouseWheelEvent), sizeof(Integration::GestureEvent) ) ) ); + std::max( sizeof(Integration::KeyEvent), sizeof(Integration::WheelEvent) ) ); static const std::size_t INITIAL_MIN_CAPACITY = 4; @@ -55,12 +49,13 @@ static const std::size_t INITIAL_BUFFER_SIZE = MAX_MESSAGE_SIZE * INITIAL_MIN_CA } // unnamed namespace -EventProcessor::EventProcessor(Stage& stage, NotificationManager& /* notificationManager */, GestureEventProcessor& gestureEventProcessor) -: mTouchEventProcessor(stage), - mHoverEventProcessor(stage), - mGestureEventProcessor(gestureEventProcessor), - mKeyEventProcessor(stage), - mMouseWheelEventProcessor(stage), +EventProcessor::EventProcessor( Scene& scene, GestureEventProcessor& gestureEventProcessor ) +: mScene( scene ), + mTouchEventProcessor( scene ), + mHoverEventProcessor( scene ), + mGestureEventProcessor( gestureEventProcessor ), + mKeyEventProcessor( scene ), + mWheelEventProcessor( scene ), mEventQueue0( INITIAL_BUFFER_SIZE ), mEventQueue1( INITIAL_BUFFER_SIZE ), mCurrentEventQueue( &mEventQueue0 ) @@ -93,7 +88,7 @@ void EventProcessor::QueueEvent( const Event& event ) typedef Integration::TouchEvent DerivedType; // Reserve some memory inside the message queue - unsigned int* slot = mCurrentEventQueue->ReserveMessageSlot( sizeof( DerivedType ) ); + uint32_t* slot = mCurrentEventQueue->ReserveMessageSlot( sizeof( DerivedType ) ); // Construct message in the message queue memory; note that delete should not be called on the return value new (slot) DerivedType( static_cast(event) ); @@ -106,7 +101,7 @@ void EventProcessor::QueueEvent( const Event& event ) typedef Integration::HoverEvent DerivedType; // Reserve some memory inside the message queue - unsigned int* slot = mCurrentEventQueue->ReserveMessageSlot( sizeof( DerivedType ) ); + uint32_t* slot = mCurrentEventQueue->ReserveMessageSlot( sizeof( DerivedType ) ); // Construct message in the message queue memory; note that delete should not be called on the return value new (slot) DerivedType( static_cast(event) ); @@ -119,7 +114,7 @@ void EventProcessor::QueueEvent( const Event& event ) typedef Integration::KeyEvent DerivedType; // Reserve some memory inside the message queue - unsigned int* slot = mCurrentEventQueue->ReserveMessageSlot( sizeof( DerivedType ) ); + uint32_t* slot = mCurrentEventQueue->ReserveMessageSlot( sizeof( DerivedType ) ); // Construct message in the message queue memory; note that delete should not be called on the return value new (slot) DerivedType( static_cast(event) ); @@ -127,77 +122,12 @@ void EventProcessor::QueueEvent( const Event& event ) break; } - case Event::MouseWheel: + case Event::Wheel: { - typedef Integration::MouseWheelEvent DerivedType; + typedef Integration::WheelEvent DerivedType; // Reserve some memory inside the message queue - unsigned int* slot = mCurrentEventQueue->ReserveMessageSlot( sizeof( DerivedType ) ); - - // Construct message in the message queue memory; note that delete should not be called on the return value - new (slot) DerivedType( static_cast(event) ); - - break; - } - - case Event::Gesture: - { - QueueGestureEvent( static_cast(event) ); - break; - } - - } -} - -void EventProcessor::QueueGestureEvent(const Integration::GestureEvent& event) -{ - switch( event.gestureType ) - { - case Gesture::Pinch: - { - typedef Integration::PinchGestureEvent DerivedType; - - // Reserve some memory inside the message queue - unsigned int* slot = mCurrentEventQueue->ReserveMessageSlot( sizeof( DerivedType ) ); - - // Construct message in the message queue memory; note that delete should not be called on the return value - new (slot) DerivedType( static_cast(event) ); - - break; - } - - case Gesture::Pan: - { - typedef Integration::PanGestureEvent DerivedType; - - // Reserve some memory inside the message queue - unsigned int* slot = mCurrentEventQueue->ReserveMessageSlot( sizeof( DerivedType ) ); - - // Construct message in the message queue memory; note that delete should not be called on the return value - new (slot) DerivedType( static_cast(event) ); - - break; - } - - case Gesture::Tap: - { - typedef Integration::TapGestureEvent DerivedType; - - // Reserve some memory inside the message queue - unsigned int* slot = mCurrentEventQueue->ReserveMessageSlot( sizeof( DerivedType ) ); - - // Construct message in the message queue memory; note that delete should not be called on the return value - new (slot) DerivedType( static_cast(event) ); - - break; - } - - case Gesture::LongPress: - { - typedef Integration::LongPressGestureEvent DerivedType; - - // Reserve some memory inside the message queue - unsigned int* slot = mCurrentEventQueue->ReserveMessageSlot( sizeof( DerivedType ) ); + uint32_t* slot = mCurrentEventQueue->ReserveMessageSlot( sizeof( DerivedType ) ); // Construct message in the message queue memory; note that delete should not be called on the return value new (slot) DerivedType( static_cast(event) ); @@ -212,7 +142,7 @@ void EventProcessor::ProcessEvents() MessageBuffer* queueToProcess = mCurrentEventQueue; // Switch current queue; events can be added safely while iterating through the other queue. - mCurrentEventQueue = (&mEventQueue0 == mCurrentEventQueue) ? &mEventQueue1 : &mEventQueue0; + mCurrentEventQueue = ( &mEventQueue0 == mCurrentEventQueue ) ? &mEventQueue1 : &mEventQueue0; for( MessageBuffer::Iterator iter = queueToProcess->Begin(); iter.IsValid(); iter.Next() ) { @@ -223,6 +153,7 @@ void EventProcessor::ProcessEvents() case Event::Touch: { mTouchEventProcessor.ProcessTouchEvent( static_cast(*event) ); + mGestureEventProcessor.ProcessTouchEvent(mScene, static_cast(*event)); break; } @@ -238,18 +169,11 @@ void EventProcessor::ProcessEvents() break; } - case Event::MouseWheel: - { - mMouseWheelEventProcessor.ProcessMouseWheelEvent( static_cast(*event) ); - break; - } - - case Event::Gesture: + case Event::Wheel: { - mGestureEventProcessor.ProcessGestureEvent( static_cast(*event) ); + mWheelEventProcessor.ProcessWheelEvent( static_cast(*event) ); break; } - } // Call virtual destructor explictly; since delete will not be called after placement new event->~Event();