From: Tom Robinson Date: Mon, 27 Jul 2015 09:42:59 +0000 (+0100) Subject: Fix Dali responding to accessibility events when backgrounded X-Git-Tag: dali_1.0.51~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F45%2F44745%2F3;p=platform%2Fcore%2Fuifw%2Fdali-adaptor.git Fix Dali responding to accessibility events when backgrounded Change-Id: I296ab85fc2cbfd7f71ba744ccd2496cff849ee87 --- diff --git a/adaptors/common/adaptor-impl.cpp b/adaptors/common/adaptor-impl.cpp index 90342ae..96b7a5c 100644 --- a/adaptors/common/adaptor-impl.cpp +++ b/adaptors/common/adaptor-impl.cpp @@ -285,7 +285,7 @@ void Adaptor::Pause() // Reset the event handler when adaptor paused if( mEventHandler ) { - mEventHandler->Reset(); + mEventHandler->Pause(); } mUpdateRenderController->Pause(); @@ -317,7 +317,7 @@ void Adaptor::Resume() // Reset the event handler when adaptor resumed if( mEventHandler ) { - mEventHandler->Reset(); + mEventHandler->Resume(); } // Inform observers that we have resumed. diff --git a/adaptors/common/events/event-handler.h b/adaptors/common/events/event-handler.h index ed80e69..67b6bf8 100644 --- a/adaptors/common/events/event-handler.h +++ b/adaptors/common/events/event-handler.h @@ -95,9 +95,14 @@ public: void FeedEvent( Integration::Event& event ); /** - * Resets the event handler. + * Called when the adaptor is paused. */ - void Reset(); + void Pause(); + + /** + * Called when the adaptor is resumed (from pause). + */ + void Resume(); /** * Sets the Drag & Drop detector. @@ -153,7 +158,13 @@ private: /** * Inform rotation observer of rotation prepare event */ - void SendRotationRequestEvent( ); + void SendRotationRequestEvent(); + + /** + * Resets the event handler. + * Called when the adaptor is paused or resumed. + */ + void Reset(); private: @@ -171,6 +182,8 @@ private: struct Impl; ///< Contains Ecore specific information Impl* mImpl; ///< Created on construction and destroyed on destruction. + + bool mPaused; ///< The paused state of the adaptor. }; } // namespace Adaptor diff --git a/adaptors/wayland/event-handler-wl.cpp b/adaptors/wayland/event-handler-wl.cpp index bdabcdd..76e6dda 100644 --- a/adaptors/wayland/event-handler-wl.cpp +++ b/adaptors/wayland/event-handler-wl.cpp @@ -814,6 +814,18 @@ void EventHandler::Reset() mCoreEventInterface.ProcessCoreEvents(); } +void EventHandler::Pause() +{ + mPaused = true; + Reset(); +} + +void EventHandler::Resume() +{ + mPaused = false; + Reset(); +} + void EventHandler::SetDragAndDropDetector( DragAndDropDetectorPtr detector ) { mDragAndDropDetector = detector; diff --git a/adaptors/x11/ecore-x-event-handler.cpp b/adaptors/x11/ecore-x-event-handler.cpp index ac9905d..21d433d 100644 --- a/adaptors/x11/ecore-x-event-handler.cpp +++ b/adaptors/x11/ecore-x-event-handler.cpp @@ -1255,7 +1255,12 @@ struct EventHandler::Impl // Callback for Ecore ElDBus accessibility events. static void OnEcoreElDBusAccessibilityNotification( void *context EINA_UNUSED, const Eldbus_Message *message ) { - EventHandler* handler( (EventHandler*)context ); + EventHandler* handler = static_cast< EventHandler* >( context ); + // Ignore any accessibility events when paused. + if( handler->mPaused ) + { + return; + } if ( !handler->mAccessibilityAdaptor ) { @@ -1671,7 +1676,7 @@ struct EventHandler::Impl }; EventHandler::EventHandler( RenderSurface* surface, CoreEventInterface& coreEventInterface, GestureManager& gestureManager, DamageObserver& damageObserver, DragAndDropDetectorPtr dndDetector ) -: mCoreEventInterface(coreEventInterface), +: mCoreEventInterface( coreEventInterface ), mGestureManager( gestureManager ), mStyleMonitor( StyleMonitor::Get() ), mDamageObserver( damageObserver ), @@ -1679,8 +1684,9 @@ EventHandler::EventHandler( RenderSurface* surface, CoreEventInterface& coreEven mDragAndDropDetector( dndDetector ), mAccessibilityAdaptor( AccessibilityAdaptor::Get() ), mClipboardEventNotifier( ClipboardEventNotifier::Get() ), - mClipboard(Clipboard::Get()), - mImpl( NULL ) + mClipboard( Clipboard::Get() ), + mImpl( NULL ), + mPaused( false ) { Ecore_X_Window window = 0; @@ -1697,10 +1703,7 @@ EventHandler::EventHandler( RenderSurface* surface, CoreEventInterface& coreEven EventHandler::~EventHandler() { - if(mImpl) - { - delete mImpl; - } + delete mImpl; mGestureManager.Stop(); } @@ -1827,6 +1830,18 @@ void EventHandler::Reset() mCoreEventInterface.ProcessCoreEvents(); } +void EventHandler::Pause() +{ + mPaused = true; + Reset(); +} + +void EventHandler::Resume() +{ + mPaused = false; + Reset(); +} + void EventHandler::SetDragAndDropDetector( DragAndDropDetectorPtr detector ) { mDragAndDropDetector = detector; diff --git a/adaptors/x11/x-event-handler.cpp b/adaptors/x11/x-event-handler.cpp index b801cb2..b8cb525 100644 --- a/adaptors/x11/x-event-handler.cpp +++ b/adaptors/x11/x-event-handler.cpp @@ -129,7 +129,8 @@ struct EventHandler::Impl : public WindowEventInterface */ Impl( EventHandler* handler, XID window, Display* display ) : mXEventManager(window, display, this), - mHandler( handler ) + mHandler( handler ), + mPaused( false ) { mXEventManager.Initialize(); } @@ -328,6 +329,18 @@ void EventHandler::Reset() mCoreEventInterface.ProcessCoreEvents(); } +void EventHandler::Pause() +{ + mPaused = true; + Reset(); +} + +void EventHandler::Resume() +{ + mPaused = false; + Reset(); +} + void EventHandler::SetDragAndDropDetector( DragAndDropDetectorPtr detector ) { mDragAndDropDetector = detector;