diff --git a/shell/platform/tizen/channels/platform_view_channel.cc b/shell/platform/tizen/channels/platform_view_channel.cc index 10781e87420b4..104ece968af10 100644 --- a/shell/platform/tizen/channels/platform_view_channel.cc +++ b/shell/platform/tizen/channels/platform_view_channel.cc @@ -12,7 +12,7 @@ static constexpr char kChannelName[] = "flutter/platform_views"; -std::string extractStringFromMap(const flutter::EncodableValue& arguments, +std::string ExtractStringFromMap(const flutter::EncodableValue& arguments, const char* key) { if (std::holds_alternative(arguments)) { flutter::EncodableMap values = std::get(arguments); @@ -22,7 +22,7 @@ std::string extractStringFromMap(const flutter::EncodableValue& arguments, } return std::string(); } -int extractIntFromMap(const flutter::EncodableValue& arguments, +int ExtractIntFromMap(const flutter::EncodableValue& arguments, const char* key) { if (std::holds_alternative(arguments)) { flutter::EncodableMap values = std::get(arguments); @@ -31,7 +31,7 @@ int extractIntFromMap(const flutter::EncodableValue& arguments, } return -1; } -double extractDoubleFromMap(const flutter::EncodableValue& arguments, +double ExtractDoubleFromMap(const flutter::EncodableValue& arguments, const char* key) { if (std::holds_alternative(arguments)) { flutter::EncodableMap values = std::get(arguments); @@ -41,7 +41,7 @@ double extractDoubleFromMap(const flutter::EncodableValue& arguments, return -1; } -flutter::EncodableMap extractMapFromMap( +flutter::EncodableMap ExtractMapFromMap( const flutter::EncodableValue& arguments, const char* key) { if (std::holds_alternative(arguments)) { flutter::EncodableMap values = std::get(arguments); @@ -52,7 +52,7 @@ flutter::EncodableMap extractMapFromMap( return flutter::EncodableMap(); } -flutter::EncodableList extractListFromMap( +flutter::EncodableList ExtractListFromMap( const flutter::EncodableValue& arguments, const char* key) { if (std::holds_alternative(arguments)) { flutter::EncodableMap values = std::get(arguments); @@ -77,34 +77,34 @@ PlatformViewChannel::PlatformViewChannel(flutter::BinaryMessenger* messenger) PlatformViewChannel::~PlatformViewChannel() { // Clean-up view_factories_ for (auto const& [viewType, viewFactory] : view_factories_) { - viewFactory->dispose(); + viewFactory->Dispose(); } view_factories_.clear(); // Clean-up view_instances_ for (auto const& [viewId, viewInstance] : view_instances_) { - viewInstance->dispose(); + viewInstance->Dispose(); delete viewInstance; } view_instances_.clear(); } -void PlatformViewChannel::sendKeyEvent(Ecore_Event_Key* key, bool is_down) { - auto instances = viewInstances(); - auto it = instances.find(currentFocusedViewId()); +void PlatformViewChannel::SendKeyEvent(Ecore_Event_Key* key, bool is_down) { + auto instances = ViewInstances(); + auto it = instances.find(CurrentFocusedViewId()); if (it != instances.end()) { if (is_down) { - it->second->dispatchKeyDownEvent(key); + it->second->DispatchKeyDownEvent(key); } else { - it->second->dispatchKeyUpEvent(key); + it->second->DispatchKeyUpEvent(key); } } } -int PlatformViewChannel::currentFocusedViewId() { +int PlatformViewChannel::CurrentFocusedViewId() { for (auto it = view_instances_.begin(); it != view_instances_.end(); it++) { - if (it->second->isFocused()) { - return it->second->getViewId(); + if (it->second->IsFocused()) { + return it->second->GetViewId(); } } return -1; @@ -117,10 +117,10 @@ void PlatformViewChannel::HandleMethodCall( const auto& arguments = *call.arguments(); if (method == "create") { - std::string viewType = extractStringFromMap(arguments, "viewType"); - int viewId = extractIntFromMap(arguments, "id"); - double width = extractDoubleFromMap(arguments, "width"); - double height = extractDoubleFromMap(arguments, "height"); + std::string viewType = ExtractStringFromMap(arguments, "viewType"); + int viewId = ExtractIntFromMap(arguments, "id"); + double width = ExtractDoubleFromMap(arguments, "width"); + double height = ExtractDoubleFromMap(arguments, "height"); LoggerD( "PlatformViewChannel create viewType: %s id: %d width: %f height: %f ", @@ -134,14 +134,14 @@ void PlatformViewChannel::HandleMethodCall( } auto it = view_factories_.find(viewType); if (it != view_factories_.end()) { - auto focuesdView = view_instances_.find(currentFocusedViewId()); + auto focuesdView = view_instances_.find(CurrentFocusedViewId()); if (focuesdView != view_instances_.end()) { - focuesdView->second->setFocus(false); + focuesdView->second->SetFocus(false); } auto viewInstance = - it->second->create(viewId, width, height, byteMessage); - viewInstance->setFocus(true); + it->second->Create(viewId, width, height, byteMessage); + viewInstance->SetFocus(true); view_instances_.insert( std::pair(viewId, viewInstance)); @@ -150,30 +150,30 @@ void PlatformViewChannel::HandleMethodCall( channel_->InvokeMethod("viewFocused", std::move(id)); } - result->Success(flutter::EncodableValue(viewInstance->getTextureId())); + result->Success(flutter::EncodableValue(viewInstance->GetTextureId())); } else { LoggerE("can't find view type = %s", viewType.c_str()); result->Error("0", "can't find view type"); } } else { - int viewId = extractIntFromMap(arguments, "id"); + int viewId = ExtractIntFromMap(arguments, "id"); auto it = view_instances_.find(viewId); if (viewId >= 0 && it != view_instances_.end()) { if (method == "dispose") { LoggerD("PlatformViewChannel dispose"); - it->second->dispose(); + it->second->Dispose(); result->Success(); } else if (method == "resize") { LoggerD("PlatformViewChannel resize"); - double width = extractDoubleFromMap(arguments, "width"); - double height = extractDoubleFromMap(arguments, "height"); - it->second->resize(width, height); + double width = ExtractDoubleFromMap(arguments, "width"); + double height = ExtractDoubleFromMap(arguments, "height"); + it->second->Resize(width, height); result->NotImplemented(); } else if (method == "touch") { int type, button; double x, y, dx, dy; - flutter::EncodableList event = extractListFromMap(arguments, "event"); + flutter::EncodableList event = ExtractListFromMap(arguments, "event"); if (event.size() != 6) { result->Error("Invalid Arguments"); return; @@ -185,14 +185,14 @@ void PlatformViewChannel::HandleMethodCall( dx = std::get(event[4]); dy = std::get(event[5]); - it->second->touch(type, button, x, y, dx, dy); + it->second->Touch(type, button, x, y, dx, dy); result->Success(); } else if (method == "setDirection") { LoggerD("PlatformViewChannel setDirection"); result->NotImplemented(); } else if (method == "clearFocus") { LoggerD("PlatformViewChannel clearFocus"); - it->second->clearFocus(); + it->second->ClearFocus(); result->NotImplemented(); } else { LoggerD("Unimplemented method: %s", method.c_str()); diff --git a/shell/platform/tizen/channels/platform_view_channel.h b/shell/platform/tizen/channels/platform_view_channel.h index a6d13c8449f52..d9fb4082d8ee9 100644 --- a/shell/platform/tizen/channels/platform_view_channel.h +++ b/shell/platform/tizen/channels/platform_view_channel.h @@ -19,13 +19,13 @@ class PlatformViewChannel { public: explicit PlatformViewChannel(flutter::BinaryMessenger* messenger); virtual ~PlatformViewChannel(); - std::map>& viewFactories() { + std::map>& ViewFactories() { return view_factories_; } - std::map& viewInstances() { return view_instances_; } + std::map& ViewInstances() { return view_instances_; } - void sendKeyEvent(Ecore_Event_Key* key, bool is_down); - int currentFocusedViewId(); + void SendKeyEvent(Ecore_Event_Key* key, bool is_down); + int CurrentFocusedViewId(); private: std::unique_ptr> channel_; diff --git a/shell/platform/tizen/channels/text_input_channel.h b/shell/platform/tizen/channels/text_input_channel.h index 76346114a440b..539dd9fb9babb 100644 --- a/shell/platform/tizen/channels/text_input_channel.h +++ b/shell/platform/tizen/channels/text_input_channel.h @@ -31,7 +31,7 @@ class TextInputChannel { void OnPredit(const char* str, int cursorPos); void ShowSoftwareKeyboard(); void HideSoftwareKeyboard(); - bool isSoftwareKeyboardShowing() { return isSoftwareKeyboardShowing_; } + bool IsSoftwareKeyboardShowing() { return isSoftwareKeyboardShowing_; } SoftwareKeyboardGeometry GetCurrentKeyboardGeometry() { return current_keyboard_geometry_; } diff --git a/shell/platform/tizen/flutter_tizen.cc b/shell/platform/tizen/flutter_tizen.cc index a945cb3776ef2..9d2103e33b76f 100644 --- a/shell/platform/tizen/flutter_tizen.cc +++ b/shell/platform/tizen/flutter_tizen.cc @@ -6,13 +6,14 @@ #include "public/flutter_tizen.h" #include + #include "flutter/shell/platform/common/cpp/client_wrapper/include/flutter/plugin_registrar.h" -#include "flutter/shell/platform/common/cpp/incoming_message_dispatcher.h" #include "flutter/shell/platform/common/cpp/client_wrapper/include/flutter/standard_message_codec.h" +#include "flutter/shell/platform/common/cpp/incoming_message_dispatcher.h" #include "flutter/shell/platform/tizen/logger.h" +#include "flutter/shell/platform/tizen/public/flutter_platform_view.h" #include "flutter/shell/platform/tizen/public/flutter_texture_registrar.h" #include "flutter/shell/platform/tizen/tizen_embedder_engine.h" -#include "flutter/shell/platform/tizen/public/flutter_platform_view.h" // Opaque reference to a Tizen embedder engine. struct FlutterWindowControllerState { @@ -266,7 +267,7 @@ bool FlutterMarkExternalTextureFrameAvailable( void FlutterRegisterViewFactory( FlutterDesktopPluginRegistrarRef registrar, const char* view_type, std::unique_ptr view_factory) { - registrar->engine->platform_view_channel->viewFactories().insert( + registrar->engine->platform_view_channel->ViewFactories().insert( std::pair>( view_type, std::move(view_factory))); } diff --git a/shell/platform/tizen/key_event_handler.cc b/shell/platform/tizen/key_event_handler.cc index 34bc1c7c355a3..dfa5b15226097 100644 --- a/shell/platform/tizen/key_event_handler.cc +++ b/shell/platform/tizen/key_event_handler.cc @@ -40,7 +40,7 @@ Eina_Bool KeyEventHandler::OnKey(void *data, int type, void *event) { if (is_down) { engine->text_input_channel->OnKeyDown(key); } - if (engine->text_input_channel->isSoftwareKeyboardShowing()) { + if (engine->text_input_channel->IsSoftwareKeyboardShowing()) { return ECORE_CALLBACK_PASS_ON; } } @@ -48,7 +48,7 @@ Eina_Bool KeyEventHandler::OnKey(void *data, int type, void *event) { engine->key_event_channel->SendKeyEvent(key, is_down); } if (engine->platform_view_channel) { - engine->platform_view_channel->sendKeyEvent(key, is_down); + engine->platform_view_channel->SendKeyEvent(key, is_down); } } return ECORE_CALLBACK_PASS_ON; diff --git a/shell/platform/tizen/public/flutter_platform_view.h b/shell/platform/tizen/public/flutter_platform_view.h index f07b18118c176..3c160e83ae8d9 100644 --- a/shell/platform/tizen/public/flutter_platform_view.h +++ b/shell/platform/tizen/public/flutter_platform_view.h @@ -21,22 +21,22 @@ class PlatformView { textureId_(0), isFocused_(false) {} virtual ~PlatformView() {} - int getViewId() { return viewId_; } - int getTextureId() { return textureId_; } - void setTextureId(int textureId) { textureId_ = textureId; } - flutter::PluginRegistrar* getPluginRegistrar() { return registrar_; } - virtual void dispose() = 0; - virtual void resize(double width, double height) = 0; - virtual void touch(int type, int button, double x, double y, double dx, + int GetViewId() { return viewId_; } + int GetTextureId() { return textureId_; } + void SetTextureId(int textureId) { textureId_ = textureId; } + flutter::PluginRegistrar* GetPluginRegistrar() { return registrar_; } + virtual void Dispose() = 0; + virtual void Resize(double width, double height) = 0; + virtual void Touch(int type, int button, double x, double y, double dx, double dy) = 0; - virtual void setDirection(int direction) = 0; - virtual void clearFocus() = 0; - void setFocus(bool f) { isFocused_ = f; } - bool isFocused() { return isFocused_; } + virtual void SetDirection(int direction) = 0; + virtual void ClearFocus() = 0; + void SetFocus(bool f) { isFocused_ = f; } + bool IsFocused() { return isFocused_; } // Key input event - virtual void dispatchKeyDownEvent(Ecore_Event_Key* key) = 0; - virtual void dispatchKeyUpEvent(Ecore_Event_Key* key) = 0; + virtual void DispatchKeyDownEvent(Ecore_Event_Key* key) = 0; + virtual void DispatchKeyUpEvent(Ecore_Event_Key* key) = 0; private: flutter::PluginRegistrar* registrar_; @@ -51,13 +51,13 @@ class PlatformViewFactory { : registrar_(registrar), codec_(flutter::StandardMessageCodec::GetInstance(nullptr)) {} virtual ~PlatformViewFactory() {} - flutter::PluginRegistrar* getPluginRegistrar() { return registrar_; } - const flutter::MessageCodec& getCodec() { + flutter::PluginRegistrar* GetPluginRegistrar() { return registrar_; } + const flutter::MessageCodec& GetCodec() { return codec_; } - virtual PlatformView* create(int viewId, double width, double height, + virtual PlatformView* Create(int viewId, double width, double height, const ByteMessage& createParams) = 0; - virtual void dispose() = 0; + virtual void Dispose() = 0; private: flutter::PluginRegistrar* registrar_; diff --git a/shell/platform/tizen/tizen_embedder_engine.cc b/shell/platform/tizen/tizen_embedder_engine.cc index 86f4e44f564a5..cbfe7db46094f 100644 --- a/shell/platform/tizen/tizen_embedder_engine.cc +++ b/shell/platform/tizen/tizen_embedder_engine.cc @@ -269,7 +269,7 @@ void TizenEmbedderEngine::SetWindowOrientation(int32_t degree) { double width = geometry.w; double height = geometry.h; - if (text_input_channel->isSoftwareKeyboardShowing()) { + if (text_input_channel->IsSoftwareKeyboardShowing()) { height -= text_input_channel->GetCurrentKeyboardGeometry().h; }