X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Finternal%2Faccessibility%2Fbridge%2Fbridge-impl.cpp;h=2fd6c49614bb9ed2b9a482c006d8423a9db3d9e7;hb=0c1d27e964b7ef74d70c38f850af69869191afa5;hp=de479b117935b378a296e39b6f75a2a20f8fadc4;hpb=41cf5e592be130a8cdcf12f3896345ca34951cb6;p=platform%2Fcore%2Fuifw%2Fdali-adaptor.git diff --git a/dali/internal/accessibility/bridge/bridge-impl.cpp b/dali/internal/accessibility/bridge/bridge-impl.cpp index de479b1..2fd6c49 100644 --- a/dali/internal/accessibility/bridge/bridge-impl.cpp +++ b/dali/internal/accessibility/bridge/bridge-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Samsung Electronics Co., Ltd. + * Copyright (c) 2024 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. @@ -39,8 +39,8 @@ #include #include #include -#include #include +#include #include #include #include @@ -94,36 +94,43 @@ public: BridgeImpl() = default; /** - * @copydoc Dali::Accessibility::Bridge::Emit() + * @copydoc Dali::Accessibility::Bridge::EmitKeyEvent() */ - Consumed Emit(KeyEventType type, unsigned int keyCode, const std::string& keyName, unsigned int timeStamp, bool isText) override + bool EmitKeyEvent(Dali::KeyEvent keyEvent, std::function callback) override { + using ArgumentTypes = std::tuple; + + static const char* methodName = "NotifyListenersSync"; + if(!IsUp()) { - return Consumed::NO; + return false; } - unsigned int keyType = 0; + uint32_t keyType = (keyEvent.GetState() == Dali::KeyEvent::DOWN ? 0U : 1U); + auto timeStamp = static_cast(keyEvent.GetTime()); + bool isText = !keyEvent.GetKeyString().empty(); - switch(type) - { - case KeyEventType::KEY_PRESSED: - { - keyType = 0; - break; - } - case KeyEventType::KEY_RELEASED: + ArgumentTypes arguments(keyType, 0, keyEvent.GetKeyCode(), 0, timeStamp, keyEvent.GetKeyName(), isText); + + auto functor = [keyEvent = std::move(keyEvent), callback = std::move(callback)](DBus::ValueOrError reply) { + bool consumed = false; + + if(!reply) { - keyType = 1; - break; + DALI_LOG_ERROR("%s call failed: %s", methodName, reply.getError().message.c_str()); } - default: + else { - return Consumed::NO; + consumed = std::get<0>(reply.getValues()); } - } - return Consumed::NO; + callback(std::move(keyEvent), consumed); + }; + + mRegistryClient.method(methodName).asyncCall(std::move(functor), arguments); + + return true; } /** @@ -361,6 +368,21 @@ public: } /** + * @brief Sends a signal to dbus that the window is created. + * + * @param[in] window The window to be created + * @see BridgeObject::Emit() + */ + void EmitCreated(Dali::Window window) + { + auto windowAccessible = mApplication.GetWindowAccessible(window); + if(windowAccessible) + { + windowAccessible->Emit(WindowEvent::CREATE, 0); + } + } + + /** * @brief Sends a signal to dbus that the window is shown. * * @param[in] window The window to be shown @@ -467,6 +489,17 @@ public: } /** + * @copydoc Dali::Accessibility::Bridge::WindowCreated() + */ + void WindowCreated(Dali::Window window) override + { + if(IsUp()) + { + EmitCreated(window); + } + } + + /** * @copydoc Dali::Accessibility::Bridge::WindowShown() */ void WindowShown(Dali::Window window) override @@ -743,7 +776,11 @@ public: if(NULL == mIdleCallback) { mIdleCallback = MakeCallback(this, &BridgeImpl::OnIdleSignal); - adaptor.AddIdle(mIdleCallback, true); + if(DALI_UNLIKELY(!adaptor.AddIdle(mIdleCallback, true))) + { + DALI_LOG_ERROR("Fail to add idle callback for bridge initialize. Call it synchronously.\n"); + OnIdleSignal(); + } } } }