From 3ceb53acf36fead27a2eb1fde1b9ea99c0fa97eb Mon Sep 17 00:00:00 2001 From: Seoyeon Kim Date: Thu, 3 Dec 2020 17:40:50 +0900 Subject: [PATCH] [Tizen] Add QuickPanel changed signal in WindowBase - Added QuickPanelSignal to check QuickPanel changed or not. - For example, If Quickpanel is shown, dali accessibility should be disabled. If All Apps application is shown, dali accessibility should be enabled. Change-Id: I35246c883416b7990a19179c6c711702a9af0607 Signed-off-by: Seoyeon Kim --- .../window-system/common/event-handler.cpp | 59 ++++++++++++++++++++++ dali/internal/window-system/common/event-handler.h | 5 ++ dali/internal/window-system/common/window-base.cpp | 8 ++- dali/internal/window-system/common/window-base.h | 8 +++ .../ecore-wl2/window-base-ecore-wl2.cpp | 42 +++++++++++++++ .../ecore-wl2/window-base-ecore-wl2.h | 5 ++ 6 files changed, 126 insertions(+), 1 deletion(-) diff --git a/dali/internal/window-system/common/event-handler.cpp b/dali/internal/window-system/common/event-handler.cpp index 911a3bd..f412ce1 100755 --- a/dali/internal/window-system/common/event-handler.cpp +++ b/dali/internal/window-system/common/event-handler.cpp @@ -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) { @@ -116,6 +119,7 @@ EventHandler::EventHandler( WindowBase* windowBase, DamageObserver& damageObserv 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 { @@ -267,6 +271,12 @@ void EventHandler::OnAccessibilityNotification( const WindowBase::AccessibilityI 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. PointState::Type touchPointState( PointState::DOWN ); if( info.state == 0 ) @@ -500,6 +510,55 @@ 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; + } + + // Both QuickPanel and Apps are shown + if( ( info & ( 1 << QUICKPANEL_TYPE_SYSTEM_DEFAULT ) ) && ( info & ( 1 << QUICKPANEL_TYPE_APPS_MENU ) ) ) + { + // dali apps should be disabled. + accessibilityAdaptor->DisableAccessibility(); + } + // Only Apps menu (dali application) is shown + else if( info & ( 1 << QUICKPANEL_TYPE_APPS_MENU ) ) + { + // dali app should be enabled. + accessibilityAdaptor->EnableAccessibility(); + } + // QuickPanel is shown + else if( info & ( 1 << QUICKPANEL_TYPE_SYSTEM_DEFAULT ) ) + { + // dali app should be disabled. + accessibilityAdaptor->DisableAccessibility(); + } + else + { + // dali app should be enabled. + accessibilityAdaptor->EnableAccessibility(); + } + + +#endif +} + void EventHandler::AddObserver( Observer& observer ) { ObserverContainer::iterator match ( find(mObservers.begin(), mObservers.end(), &observer) ); diff --git a/dali/internal/window-system/common/event-handler.h b/dali/internal/window-system/common/event-handler.h index ba23ce3..7077a49 100644 --- a/dali/internal/window-system/common/event-handler.h +++ b/dali/internal/window-system/common/event-handler.h @@ -209,6 +209,11 @@ private: */ void OnAccessibilityNotification( const WindowBase::AccessibilityInfo& info ); + /** + * Called when Ecore ElDBus quick panel event for accessibility is received. + */ + void OnAccessibilityQuickpanelChanged( const unsigned char& info ); + private: // Undefined diff --git a/dali/internal/window-system/common/window-base.cpp b/dali/internal/window-system/common/window-base.cpp index eb39d96..22bcb56 100644 --- a/dali/internal/window-system/common/window-base.cpp +++ b/dali/internal/window-system/common/window-base.cpp @@ -42,7 +42,8 @@ WindowBase::WindowBase() mStyleChangedSignal(), mAccessibilitySignal(), mTransitionEffectEventSignal(), - mKeyboardRepeatSettingsChangedSignal() + mKeyboardRepeatSettingsChangedSignal(), + mQuickPanelSignal() { } @@ -115,6 +116,11 @@ WindowBase::AccessibilitySignalType& WindowBase::AccessibilitySignal() return mAccessibilitySignal; } +WindowBase::QuickPanelSignalType& WindowBase::QuickPanelSignal() +{ + return mQuickPanelSignal; +} + WindowBase::TransitionEffectEventSignalType& WindowBase::TransitionEffectEventSignal() { return mTransitionEffectEventSignal; diff --git a/dali/internal/window-system/common/window-base.h b/dali/internal/window-system/common/window-base.h index b3a824d..46eefd2 100644 --- a/dali/internal/window-system/common/window-base.h +++ b/dali/internal/window-system/common/window-base.h @@ -61,6 +61,7 @@ public: int endY; int state; int eventTime; + unsigned char quickpanelInfo; // to retrieve quick panel information for Accessibility }; // Window @@ -85,6 +86,7 @@ public: // Accessibility typedef Signal< void ( StyleChange::Type ) > StyleSignalType; typedef Signal< void ( const AccessibilityInfo& ) > AccessibilitySignalType; + typedef Signal< void ( const unsigned char& ) > QuickPanelSignalType; /** * @brief Default constructor @@ -428,6 +430,11 @@ public: AccessibilitySignalType& AccessibilitySignal(); /** + * @brief This signal is emitted when a quick panel event for accessibility is received. + */ + QuickPanelSignalType& QuickPanelSignal(); + + /** * @brief This signal is emitted when window's transition animation is started or ended. */ TransitionEffectEventSignalType& TransitionEffectEventSignal(); @@ -468,6 +475,7 @@ protected: TransitionEffectEventSignalType mTransitionEffectEventSignal; KeyboardRepeatSettingsChangedSignalType mKeyboardRepeatSettingsChangedSignal; WindowRedrawRequestSignalType mWindowRedrawRequestSignal; + QuickPanelSignalType mQuickPanelSignal; }; } // namespace Adaptor diff --git a/dali/internal/window-system/tizen-wayland/ecore-wl2/window-base-ecore-wl2.cpp b/dali/internal/window-system/tizen-wayland/ecore-wl2/window-base-ecore-wl2.cpp index b596096..e307f22 100755 --- a/dali/internal/window-system/tizen-wayland/ecore-wl2/window-base-ecore-wl2.cpp +++ b/dali/internal/window-system/tizen-wayland/ecore-wl2/window-base-ecore-wl2.cpp @@ -595,6 +595,16 @@ static void EcoreElDBusAccessibilityNotification( void* context, const Eldbus_Me windowBase->OnEcoreElDBusAccessibilityNotification( context, message ); } } + +// Callback for Ecore ElDBus accessibility quickpanel changed event. +static void EcoreElDBusAccessibilityQuickpanelChanged( void* context, const Eldbus_Message* message ) +{ + WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( context ); + if( windowBase ) + { + windowBase->OnEcoreElDBusAccessibilityQuickpanelChanged( context, message ); + } +} #endif // DALI_ELDBUS_AVAILABLE static void RegistryGlobalCallback( void* data, struct wl_registry *registry, uint32_t name, const char* interface, uint32_t version ) @@ -1319,6 +1329,33 @@ void WindowBaseEcoreWl2::OnEcoreElDBusAccessibilityNotification( void* context, #endif } +void WindowBaseEcoreWl2::OnEcoreElDBusAccessibilityQuickpanelChanged( void* context, const Eldbus_Message* message ) +{ +#ifdef DALI_ELDBUS_AVAILABLE + AccessibilityInfo info; + + unsigned int type = 0; // For example, type 1 is QuickPanel, type 3 is AllApps + unsigned int state = 0; // 0 is hidden, 1 is shown + + // The string defines the arg-list's respective types. + if( !eldbus_message_arguments_get( message, "uu", &type, &state ) ) + { + DALI_LOG_ERROR( "OnEcoreElDBusAccessibilityQuickpanelChanged: Error getting arguments\n" ); + } + + if( state == 1 ) // Shown + { + info.quickpanelInfo |= 1 << type; + } + else // Hidden + { + info.quickpanelInfo &= ~( 1 << type ); + } + + mQuickPanelSignal.Emit( info.quickpanelInfo ); +#endif +} + void WindowBaseEcoreWl2::OnTransitionEffectEvent( DevelWindow::EffectState state, DevelWindow::EffectType type ) { mTransitionEffectEventSignal.Emit( state, type ); @@ -2422,6 +2459,11 @@ void WindowBaseEcoreWl2::InitializeEcoreElDBus() { DALI_LOG_ERROR( "No signal handler returned\n" ); } + + if( !eldbus_proxy_signal_handler_add( manager, "QuickpanelChanged", EcoreElDBusAccessibilityQuickpanelChanged, this ) ) + { + DALI_LOG_ERROR( "No signal handler returned for QuickpanelChanged signal\n" ); + } #endif } diff --git a/dali/internal/window-system/tizen-wayland/ecore-wl2/window-base-ecore-wl2.h b/dali/internal/window-system/tizen-wayland/ecore-wl2/window-base-ecore-wl2.h index dbf7734..05b4084 100644 --- a/dali/internal/window-system/tizen-wayland/ecore-wl2/window-base-ecore-wl2.h +++ b/dali/internal/window-system/tizen-wayland/ecore-wl2/window-base-ecore-wl2.h @@ -176,6 +176,11 @@ public: * @brief Called when Ecore ElDBus accessibility event is received. */ void OnEcoreElDBusAccessibilityNotification( void* context, const Eldbus_Message* message ); + + /** + * @brief Called when Ecore ElDBus quick panel event for accessibility is received. + */ + void OnEcoreElDBusAccessibilityQuickpanelChanged( void* context, const Eldbus_Message* message ); #endif /** -- 2.7.4