/*
- * Copyright (c) 2022 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.
mFocusGroupLoopEnabled(false),
mIsWaitingKeyboardFocusChangeCommit(false),
mClearFocusOnTouch(true),
- mEnableDefaultAlgorithm(false)
+ mEnableDefaultAlgorithm(false),
+ mCurrentWindowId(0)
{
// TODO: Get FocusIndicatorEnable constant from stylesheet to set mIsFocusIndicatorShown.
Toolkit::StyleManager styleManager = Toolkit::StyleManager::Get();
if(styleManager)
{
- const Property::Map& config = Toolkit::DevelStyleManager::GetConfigurations(styleManager);
- const auto alwaysShowFocusValue = config.Find("alwaysShowFocus", Property::Type::BOOLEAN);
+ const auto alwaysShowFocusValue = Toolkit::DevelStyleManager::GetConfigurations(styleManager).Find("alwaysShowFocus", Property::Type::BOOLEAN);
mAlwaysShowIndicator = (alwaysShowFocusValue && alwaysShowFocusValue->Get<bool>()) ? ALWAYS_SHOW : NONE;
mIsFocusIndicatorShown = (mAlwaysShowIndicator == ALWAYS_SHOW) ? SHOW : HIDE;
{
Layer rootLayer = currentWindow.GetRootLayer();
mCurrentFocusedWindow = rootLayer;
+ mCurrentWindowId = static_cast<uint32_t>(currentWindow.GetNativeId());
}
if((mIsFocusIndicatorShown == SHOW) && (mEnableFocusIndicator == ENABLE))
Actor actor = GetCurrentFocusActor();
if(actor)
{
+ DALI_LOG_RELEASE_INFO("ClearFocus id:(%d)\n", actor.GetProperty<int32_t>(Dali::Actor::Property::ID));
// Send notification for the change of focus actor
if(!mFocusChangedSignal.Empty())
{
return mFocusIndicatorActor;
}
+uint32_t KeyboardFocusManager::GetCurrentWindowId() const
+{
+ return mCurrentWindowId;
+}
+
void KeyboardFocusManager::OnKeyEvent(const KeyEvent& event)
{
+ if(mCurrentFocusedWindow.GetHandle())
+ {
+ // If it is a key event that occurred in another window, it returns.
+ uint32_t eventWindowId = event.GetWindowId();
+ if(eventWindowId > 0 && GetCurrentWindowId() != eventWindowId)
+ {
+ DALI_LOG_RELEASE_INFO("CurrentFocusedWindow id %d, window ID where key event occurred %d : key event skip\n", GetCurrentWindowId(), eventWindowId);
+ return;
+ }
+ }
+
const std::string& keyName = event.GetKeyName();
const std::string& deviceName = event.GetDeviceName();
// Change Current Focused Window
Layer rootLayer = window.GetRootLayer();
mCurrentFocusedWindow = rootLayer;
+ mCurrentWindowId = static_cast<uint32_t>(Integration::SceneHolder::Get(rootLayer).GetNativeId());
// Get Current Focused Actor from window
Actor currentFocusedActor = GetFocusActorFromCurrentWindow();