X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Finternal%2Fwindow-system%2Fcommon%2Fevent-handler.cpp;h=8bdec19194965500d8226a1519dab947d1c44822;hb=a4aa6816b571cbb258d1a4b3ef06b40a6fdf136f;hp=99f1796ce6a4bd39756aa2b906e39b14dcf342d9;hpb=7d7521fcb7f6c3020443ca87b11576aabfcb590e;p=platform%2Fcore%2Fuifw%2Fdali-adaptor.git diff --git a/dali/internal/window-system/common/event-handler.cpp b/dali/internal/window-system/common/event-handler.cpp index 99f1796..8bdec19 100755 --- a/dali/internal/window-system/common/event-handler.cpp +++ b/dali/internal/window-system/common/event-handler.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 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. @@ -22,7 +22,7 @@ #include #include -#include +#include #include #include #include @@ -56,6 +56,9 @@ Integration::Log::Filter* gSelectionEventLogFilter = Integration::Log::Filter::N namespace { +static constexpr auto QUICKPANEL_TYPE_SYSTEM_DEFAULT = 1; +static constexpr auto QUICKPANEL_TYPE_APPS_MENU = 3; + // Copied from x server static uint32_t GetCurrentMilliSeconds(void) { @@ -95,7 +98,7 @@ static uint32_t GetCurrentMilliSeconds(void) } // unnamed namespace #endif -EventHandler::EventHandler( WindowRenderSurface* surface, DamageObserver& damageObserver ) +EventHandler::EventHandler( WindowBase* windowBase, DamageObserver& damageObserver ) : mStyleMonitor( StyleMonitor::Get() ), mDamageObserver( damageObserver ), mAccessibilityAdaptor( AccessibilityAdaptor::Get() ), @@ -103,11 +106,9 @@ EventHandler::EventHandler( WindowRenderSurface* surface, DamageObserver& damage mClipboard( Clipboard::Get() ), mPaused( false ) { - if( surface ) + // Connect signals + if( windowBase ) { - WindowBase* windowBase = surface->GetWindowBase(); - - // Connect signals windowBase->WindowDamagedSignal().Connect( this, &EventHandler::OnWindowDamaged ); windowBase->FocusChangedSignal().Connect( this, &EventHandler::OnFocusChanged ); windowBase->RotationSignal().Connect( this, &EventHandler::OnRotation ); @@ -118,6 +119,11 @@ EventHandler::EventHandler( WindowRenderSurface* surface, DamageObserver& damage windowBase->SelectionDataReceivedSignal().Connect( this, &EventHandler::OnSelectionDataReceived ); windowBase->StyleChangedSignal().Connect( this, &EventHandler::OnStyleChanged ); windowBase->AccessibilitySignal().Connect( this, &EventHandler::OnAccessibilityNotification ); + windowBase->QuickPanelSignal().Connect( this, &EventHandler::OnAccessibilityQuickpanelChanged ); + } + else + { + DALI_LOG_ERROR("WindowBase is invalid!!!\n"); } } @@ -154,13 +160,11 @@ void EventHandler::OnTouchEvent( Integration::Point& point, uint32_t timeStamp ) } } -void EventHandler::OnWheelEvent( WheelEvent& wheelEvent ) +void EventHandler::OnWheelEvent( Integration::WheelEvent& wheelEvent ) { - Integration::WheelEvent event( static_cast< Integration::WheelEvent::Type >(wheelEvent.type), wheelEvent.direction, wheelEvent.modifiers, wheelEvent.point, wheelEvent.z, wheelEvent.timeStamp ); - for ( ObserverContainer::iterator iter = mObservers.begin(), endIter = mObservers.end(); iter != endIter; ++iter ) { - (*iter)->OnWheelEvent( event ); + (*iter)->OnWheelEvent( wheelEvent ); } } @@ -267,23 +271,35 @@ void EventHandler::OnAccessibilityNotification( const WindowBase::AccessibilityI return; } + if( !accessibilityAdaptor->IsEnabled() ) + { + DALI_LOG_ERROR( "The current dali accessibility is not available. \n" ); + return; + } + + if( ( info.quickpanelInfo & ( 1 << QUICKPANEL_TYPE_SYSTEM_DEFAULT ) ) && ( info.quickpanelInfo & ( 1 << QUICKPANEL_TYPE_APPS_MENU ) ) ) + { + DALI_LOG_ERROR("Quickpanel is top now, so all dali apps should be stopped \n"); + return; + } + // Create a touch point object. - TouchPoint::State touchPointState( TouchPoint::Down ); + PointState::Type touchPointState( PointState::DOWN ); if( info.state == 0 ) { - touchPointState = TouchPoint::Down; // Mouse down. + touchPointState = PointState::DOWN; // Mouse down. } else if( info.state == 1 ) { - touchPointState = TouchPoint::Motion; // Mouse move. + touchPointState = PointState::MOTION; // Mouse move. } else if( info.state == 2 ) { - touchPointState = TouchPoint::Up; // Mouse up. + touchPointState = PointState::UP; // Mouse up. } else { - touchPointState = TouchPoint::Interrupted; // Error. + touchPointState = PointState::INTERRUPTED; // Error. } // Send touch event to accessibility adaptor. @@ -500,6 +516,57 @@ void EventHandler::OnAccessibilityNotification( const WindowBase::AccessibilityI #endif } +void EventHandler::OnAccessibilityQuickpanelChanged( const unsigned char& info ) +{ +#ifdef DALI_ELDBUS_AVAILABLE + if( mPaused ) + { + return; + } + + if( !mAccessibilityAdaptor ) + { + DALI_LOG_ERROR( "Invalid accessibility adaptor\n" ); + return; + } + + AccessibilityAdaptor* accessibilityAdaptor( &AccessibilityAdaptor::GetImplementation( mAccessibilityAdaptor ) ); + if( !accessibilityAdaptor ) + { + DALI_LOG_ERROR( "Cannot access accessibility adaptor\n" ); + return; + } + + if( ( ( info & ( 1 << QUICKPANEL_TYPE_SYSTEM_DEFAULT ) ) && ( info & ( 1 << QUICKPANEL_TYPE_APPS_MENU ) ) ) || // Both QuickPanel and Apps are shown + ( info & ( 1 << QUICKPANEL_TYPE_SYSTEM_DEFAULT ) ) ) // QuickPanel is shown + { + // dali apps should be disabled. + DALI_LOG_INFO( gSelectionEventLogFilter, Debug::General, "OnAccessibilityQuickpanelChanged: Quickpanel show -> DisableAccessibility \n" ); + accessibilityAdaptor->DisableAccessibility(); + } + else if( info & ( 1 << QUICKPANEL_TYPE_APPS_MENU ) ) // Only Apps menu (dali application) is shown + { + if( !accessibilityAdaptor->IsForcedEnable() ) // It is not in case of that an application controls the accessibility status itself + { + DALI_LOG_INFO( gSelectionEventLogFilter, Debug::General, "OnAccessibilityQuickpanelChanged: Only Apps show, but not forced dali -> DisableAccessibility \n" ); + accessibilityAdaptor->DisableAccessibility(); + } + else + { + DALI_LOG_INFO( gSelectionEventLogFilter, Debug::General, "OnAccessibilityQuickpanelChanged: Only Apps show and it is a forced dali -> EnableAccessibility \n" ); + accessibilityAdaptor->EnableAccessibility(); + } + } + else + { + DALI_LOG_INFO( gSelectionEventLogFilter, Debug::General, "OnAccessibilityQuickpanelChanged: Nothing shows -> EnableAccessibility \n" ); + // dali app should be enabled. + accessibilityAdaptor->EnableAccessibility(); + } + +#endif +} + void EventHandler::AddObserver( Observer& observer ) { ObserverContainer::iterator match ( find(mObservers.begin(), mObservers.end(), &observer) );