diff --git a/shell/platform/tizen/channels/platform_channel.cc b/shell/platform/tizen/channels/platform_channel.cc index 62d6f2e625982..2dd575ac1f83c 100644 --- a/shell/platform/tizen/channels/platform_channel.cc +++ b/shell/platform/tizen/channels/platform_channel.cc @@ -161,7 +161,7 @@ void PlatformChannel::SystemNavigatorPop() { if (view_->GetType() == TizenViewType::kWindow) { ui_app_exit(); } else { - reinterpret_cast(view_)->Unfocus(); + reinterpret_cast(view_)->SetFocus(false); } } diff --git a/shell/platform/tizen/flutter_tizen.cc b/shell/platform/tizen/flutter_tizen.cc index 6907e68f8d06b..a41b0b9202362 100644 --- a/shell/platform/tizen/flutter_tizen.cc +++ b/shell/platform/tizen/flutter_tizen.cc @@ -13,6 +13,7 @@ #include "flutter/shell/platform/tizen/flutter_tizen_view.h" #include "flutter/shell/platform/tizen/logger.h" #include "flutter/shell/platform/tizen/public/flutter_platform_view.h" +#include "flutter/shell/platform/tizen/tizen_view.h" #include "flutter/shell/platform/tizen/tizen_window.h" #ifndef WEARABLE_PROFILE #include "flutter/shell/platform/tizen/tizen_window_ecore_wl2.h" @@ -274,6 +275,23 @@ void FlutterDesktopViewOnKeyEvent(FlutterDesktopViewRef view, is_down); } +void FlutterDesktopViewSetFocus(FlutterDesktopViewRef view, bool focused) { + auto* tizen_view = reinterpret_cast( + ViewFromHandle(view)->tizen_view()); + if (tizen_view->GetType() == flutter::TizenViewType::kView) { + reinterpret_cast(tizen_view)->SetFocus(focused); + } +} + +bool FlutterDesktopViewIsFocused(FlutterDesktopViewRef view) { + auto* tizen_view = reinterpret_cast( + ViewFromHandle(view)->tizen_view()); + if (tizen_view->GetType() == flutter::TizenViewType::kView) { + return reinterpret_cast(tizen_view)->focused(); + } + return false; +} + void FlutterDesktopRegisterViewFactory( FlutterDesktopPluginRegistrarRef registrar, const char* view_type, diff --git a/shell/platform/tizen/public/flutter_tizen.h b/shell/platform/tizen/public/flutter_tizen.h index 2597014b2b8c8..23b4d3767193d 100644 --- a/shell/platform/tizen/public/flutter_tizen.h +++ b/shell/platform/tizen/public/flutter_tizen.h @@ -216,6 +216,11 @@ FLUTTER_EXPORT void FlutterDesktopViewOnKeyEvent(FlutterDesktopViewRef view, uint32_t scan_code, bool is_down); +FLUTTER_EXPORT void FlutterDesktopViewSetFocus(FlutterDesktopViewRef view, + bool focused); + +FLUTTER_EXPORT bool FlutterDesktopViewIsFocused(FlutterDesktopViewRef view); + // ========== Plugin Registrar (extensions) ========== // Returns the view associated with this registrar's engine instance. diff --git a/shell/platform/tizen/tizen_view.h b/shell/platform/tizen/tizen_view.h index 066ed8d3fd3d4..d9979632c634e 100644 --- a/shell/platform/tizen/tizen_view.h +++ b/shell/platform/tizen/tizen_view.h @@ -20,7 +20,9 @@ class TizenView : public TizenViewBase { TizenViewType GetType() override { return TizenViewType::kView; }; - void Unfocus() { focused_ = false; }; + bool focused() { return focused_; }; + + void SetFocus(bool focused) { focused_ = focused; }; protected: explicit TizenView(int32_t width, int32_t height)