X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;ds=sidebyside;f=dali%2Finternal%2Fevent%2Fevents%2Fwheel-event-processor.cpp;h=c54cd3e939c6c6084413eda5e603ff29a4ca176e;hb=d7775bfee328210d5b7300caf0fccfc2ec3dc2e8;hp=a5c93e81da8b1cb895744f0dc47fc157951aeee2;hpb=5eb804983e9ac526ee4866453ffeb24358917938;p=platform%2Fcore%2Fuifw%2Fdali-core.git diff --git a/dali/internal/event/events/wheel-event-processor.cpp b/dali/internal/event/events/wheel-event-processor.cpp index a5c93e8..c54cd3e 100644 --- a/dali/internal/event/events/wheel-event-processor.cpp +++ b/dali/internal/event/events/wheel-event-processor.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020 Samsung Electronics Co., Ltd. + * Copyright (c) 2023 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,22 +21,22 @@ // INTERNAL INCLUDES #include -#include +#include #include +#include #include #include #include #include +#include namespace Dali { - namespace Internal { - namespace { - +DALI_INIT_TRACE_FILTER(gTraceFilter, DALI_TRACE_PERFORMANCE_MARKER, false); #if defined(DEBUG_ENABLED) Debug::Filter* gLogFilter = Debug::Filter::New(Debug::NoLogging, false, "LOG_WHEEL_PROCESSOR"); #endif @@ -44,40 +44,40 @@ Debug::Filter* gLogFilter = Debug::Filter::New(Debug::NoLogging, false, "LOG_WHE /** * Recursively deliver events to the actor and its parents, until the event is consumed or the stage is reached. */ -Dali::Actor EmitWheelSignals( Dali::Actor actor, const Dali::WheelEvent& event ) +Dali::Actor EmitWheelSignals(Dali::Actor actor, const Dali::WheelEvent& event) { Dali::Actor consumedActor; - if ( actor ) + if(actor) { - Dali::Actor oldParent( actor.GetParent() ); + Dali::Actor oldParent(actor.GetParent()); - Actor& actorImpl( GetImplementation(actor) ); + Actor& actorImpl(GetImplementation(actor)); - bool consumed( false ); + bool consumed(false); // Only do the conversion and emit the signal if the actor's wheel signal has connections. - if ( actorImpl.GetWheelEventRequired() ) + if(actorImpl.GetWheelEventRequired()) { // Emit the signal to the parent - consumed = actorImpl.EmitWheelEventSignal( event ); + consumed = actorImpl.EmitWheelEventSignal(event); } - if ( consumed ) + if(consumed) { // One of this actor's listeners has consumed the event so set this actor as the consumed actor. - consumedActor = Dali::Actor( &actorImpl ); + consumedActor = Dali::Actor(&actorImpl); } else { // The actor may have been removed/reparented during the signal callbacks. Dali::Actor parent = actor.GetParent(); - if ( parent && - (parent == oldParent) ) + if(parent && + (parent == oldParent)) { // One of the actor's parents may consumed the event and they should be set as the consumed actor. - consumedActor = EmitWheelSignals( parent, event ); + consumedActor = EmitWheelSignals(parent, event); } } } @@ -92,12 +92,12 @@ bool IsActorWheelableFunction(Dali::Actor actor, Dali::HitTestAlgorithm::Travers { bool hittable = false; - switch (type) + switch(type) { case Dali::HitTestAlgorithm::CHECK_ACTOR: { - if( GetImplementation(actor).GetWheelEventRequired() && // Does the Application or derived actor type require a wheel event? - GetImplementation(actor).IsHittable() ) + if(GetImplementation(actor).GetWheelEventRequired() && // Does the Application or derived actor type require a wheel event? + GetImplementation(actor).IsHittable()) { hittable = true; } @@ -105,7 +105,7 @@ bool IsActorWheelableFunction(Dali::Actor actor, Dali::HitTestAlgorithm::Travers } case Dali::HitTestAlgorithm::DESCEND_ACTOR_TREE: { - if( actor.GetProperty< bool >( Dali::Actor::Property::VISIBLE ) ) // Actor is visible, if not visible then none of its children are visible. + if(actor.GetProperty(Dali::Actor::Property::VISIBLE)) // Actor is visible, if not visible then none of its children are visible. { hittable = true; } @@ -122,42 +122,41 @@ bool IsActorWheelableFunction(Dali::Actor actor, Dali::HitTestAlgorithm::Travers } // unnamed namespace - -WheelEventProcessor::WheelEventProcessor( Scene& scene ) -: mScene( scene ) +WheelEventProcessor::WheelEventProcessor(Scene& scene) +: mScene(scene) { } -WheelEventProcessor::~WheelEventProcessor() -{ -} +WheelEventProcessor::~WheelEventProcessor() = default; -void WheelEventProcessor::ProcessWheelEvent( const Integration::WheelEvent& event ) +void WheelEventProcessor::ProcessWheelEvent(const Integration::WheelEvent& event) { - WheelEventPtr wheelEvent = WheelEvent::New( static_cast< Dali::WheelEvent::Type >( event.type ), event.direction, event.modifiers, event.point, event.delta, event.timeStamp ); - Dali::WheelEvent wheelEventHandle( wheelEvent.Get() ); + WheelEventPtr wheelEvent = WheelEvent::New(static_cast(event.type), event.direction, event.modifiers, event.point, event.delta, event.timeStamp); + Dali::WheelEvent wheelEventHandle(wheelEvent.Get()); + + DALI_TRACE_SCOPE(gTraceFilter, "DALI_PROCESS_WHEEL_EVENT"); - if( wheelEvent->GetType() == Dali::WheelEvent::MOUSE_WHEEL ) + if(wheelEvent->GetType() == Dali::WheelEvent::MOUSE_WHEEL) { Dali::HitTestAlgorithm::Results hitTestResults; - HitTestAlgorithm::HitTest( mScene.GetSize(), mScene.GetRenderTaskList(), mScene.GetLayerList(), event.point, hitTestResults, IsActorWheelableFunction ); + HitTestAlgorithm::HitTest(mScene.GetSize(), mScene.GetRenderTaskList(), mScene.GetLayerList(), event.point, hitTestResults, IsActorWheelableFunction); - DALI_LOG_INFO( gLogFilter, Debug::General, " Screen(%.0f, %.0f), HitActor(%p, %s), Local(%.2f, %.2f)\n", - event.point.x, event.point.y, - ( hitTestResults.actor ? reinterpret_cast< void* >( &hitTestResults.actor.GetBaseObject() ) : NULL ), - ( hitTestResults.actor ? hitTestResults.actor.GetProperty< std::string >( Dali::Actor::Property::NAME ).c_str() : "" ), - hitTestResults.actorCoordinates.x, hitTestResults.actorCoordinates.y ); + DALI_LOG_INFO(gLogFilter, Debug::General, " Screen(%.0f, %.0f), HitActor(%p, %s), Local(%.2f, %.2f)\n", event.point.x, event.point.y, (hitTestResults.actor ? reinterpret_cast(&hitTestResults.actor.GetBaseObject()) : NULL), (hitTestResults.actor ? hitTestResults.actor.GetProperty(Dali::Actor::Property::NAME).c_str() : ""), hitTestResults.actorCoordinates.x, hitTestResults.actorCoordinates.y); // Recursively deliver events to the actor and its parents, until the event is consumed or the stage is reached. - Dali::Actor consumedActor = EmitWheelSignals( hitTestResults.actor, wheelEventHandle ); + Dali::Actor consumedActor = EmitWheelSignals(hitTestResults.actor, wheelEventHandle); - DALI_LOG_INFO( gLogFilter, Debug::Concise, "HitActor: (%p) %s\n", hitTestResults.actor ? reinterpret_cast< void* >( &hitTestResults.actor.GetBaseObject() ) : NULL, hitTestResults.actor ? hitTestResults.actor.GetProperty< std::string >( Dali::Actor::Property::NAME ).c_str() : "" ); - DALI_LOG_INFO( gLogFilter, Debug::Concise, "ConsumedActor: (%p) %s\n", consumedActor ? reinterpret_cast< void* >( &consumedActor.GetBaseObject() ) : NULL, consumedActor ? consumedActor.GetProperty< std::string >( Dali::Actor::Property::NAME ).c_str() : "" ); + DALI_LOG_INFO(gLogFilter, Debug::Concise, "HitActor: (%p) %s\n", hitTestResults.actor ? reinterpret_cast(&hitTestResults.actor.GetBaseObject()) : NULL, hitTestResults.actor ? hitTestResults.actor.GetProperty(Dali::Actor::Property::NAME).c_str() : ""); + DALI_LOG_INFO(gLogFilter, Debug::Concise, "ConsumedActor: (%p) %s\n", consumedActor ? reinterpret_cast(&consumedActor.GetBaseObject()) : NULL, consumedActor ? consumedActor.GetProperty(Dali::Actor::Property::NAME).c_str() : ""); } else { // if CUSTOM_WHEEL, emit the wheel event signal from the scene. - mScene.EmitWheelEventSignal( wheelEventHandle ); + bool consumed = mScene.EmitWheelEventGeneratedSignal(wheelEventHandle); + if(!consumed) + { + mScene.EmitWheelEventSignal(wheelEventHandle); + } } }