diff --git a/packages/webview_flutter/example/tizen/lib/arm/liblightweight-web-engine.mobile.so b/packages/webview_flutter/example/tizen/lib/arm/liblightweight-web-engine.mobile.so index 377fb56be..799121f85 100755 Binary files a/packages/webview_flutter/example/tizen/lib/arm/liblightweight-web-engine.mobile.so and b/packages/webview_flutter/example/tizen/lib/arm/liblightweight-web-engine.mobile.so differ diff --git a/packages/webview_flutter/tizen/lib/liblightweight-web-engine.mobile.so b/packages/webview_flutter/tizen/lib/liblightweight-web-engine.mobile.so index 377fb56be..799121f85 100755 Binary files a/packages/webview_flutter/tizen/lib/liblightweight-web-engine.mobile.so and b/packages/webview_flutter/tizen/lib/liblightweight-web-engine.mobile.so differ diff --git a/packages/webview_flutter/tizen/src/webview.cc b/packages/webview_flutter/tizen/src/webview.cc index 48e2a5982..5d24f4df5 100644 --- a/packages/webview_flutter/tizen/src/webview.cc +++ b/packages/webview_flutter/tizen/src/webview.cc @@ -160,7 +160,8 @@ WebView::WebView(flutter::PluginRegistrar* registrar, int viewId, height_(height), tbmSurface_(nullptr), isMouseLButtonDown_(false), - hasNavigationDelegate_(false) { + hasNavigationDelegate_(false), + context_(nullptr) { SetTextureId(FlutterRegisterExternalTexture(textureRegistrar_)); InitWebView(); @@ -697,32 +698,51 @@ void WebView::DispatchKeyUpEvent(Ecore_Event_Key* keyEvent) { p); } +void WebView::DispatchCompositionUpdateEvent(const char* str, int size) { + LOG_DEBUG("WebView::DispatchCompositionUpdateEvent [%s]", str); + webViewInstance_->DispatchCompositionUpdateEvent(std::string(str, size)); +} + +void WebView::DispatchCompositionEndEvent(const char* str, int size) { + LOG_DEBUG("WebView::DispatchCompositionEndEvent [%s]", str); + webViewInstance_->DispatchCompositionEndEvent(std::string(str, size)); +} + +void WebView::ShowPanel() { + LOG_DEBUG("WebView - Show Keyboard()\n"); + if (!context_) { + LOG_ERROR("Ecore_IMF_Context NULL\n"); + return; + } + ecore_imf_context_input_panel_show(context_); + ecore_imf_context_focus_in(context_); +} + +void WebView::HidePanel() { + LOG_DEBUG("WebView - Hide Keyboard()\n"); + if (!context_) { + LOG_ERROR("Ecore_IMF_Context NULL\n"); + return; + } + ecore_imf_context_reset(context_); + ecore_imf_context_focus_out(context_); + ecore_imf_context_input_panel_hide(context_); +} + void WebView::SetSoftwareKeyboardContext(Ecore_IMF_Context* context) { + context_ = context; + webViewInstance_->RegisterOnShowSoftwareKeyboardIfPossibleHandler( - [context](LWE::WebContainer* v) { - LOG_DEBUG("WebView - Show Keyboard()\n"); - if (!context) { - LOG_ERROR("Ecore_IMF_Context NULL\n"); - return; - } - ecore_imf_context_input_panel_show(context); - ecore_imf_context_focus_in(context); - }); + [this](LWE::WebContainer* v) { ShowPanel(); }); webViewInstance_->RegisterOnHideSoftwareKeyboardIfPossibleHandler( - [context](LWE::WebContainer*) { - LOG_INFO("WebView - Hide Keyboard()\n"); - if (!context) { - LOG_INFO("Ecore_IMF_Context NULL\n"); - return; - } - ecore_imf_context_reset(context); - ecore_imf_context_focus_out(context); - ecore_imf_context_input_panel_hide(context); - }); + [this](LWE::WebContainer*) { HidePanel(); }); } -void WebView::ClearFocus() { LOG_DEBUG("WebView::clearFocus \n"); } +void WebView::ClearFocus() { + LOG_DEBUG("WebView::clearFocus \n"); + HidePanel(); +} void WebView::SetDirection(int direction) { LOG_DEBUG("WebView::SetDirection direction: %d\n", direction); diff --git a/packages/webview_flutter/tizen/src/webview.h b/packages/webview_flutter/tizen/src/webview.h index a22380988..b75d04f23 100644 --- a/packages/webview_flutter/tizen/src/webview.h +++ b/packages/webview_flutter/tizen/src/webview.h @@ -34,11 +34,17 @@ class WebView : public PlatformView { // Key input event virtual void DispatchKeyDownEvent(Ecore_Event_Key* key) override; virtual void DispatchKeyUpEvent(Ecore_Event_Key* key) override; + virtual void DispatchCompositionUpdateEvent(const char* str, + int size) override; + virtual void DispatchCompositionEndEvent(const char* str, int size) override; virtual void SetSoftwareKeyboardContext(Ecore_IMF_Context* context) override; LWE::WebContainer* GetWebViewInstance() { return webViewInstance_; } + void HidePanel(); + void ShowPanel(); + private: void HandleMethodCall( const flutter::MethodCall& method_call, @@ -60,6 +66,7 @@ class WebView : public PlatformView { bool isMouseLButtonDown_; bool hasNavigationDelegate_; std::unique_ptr> channel_; + Ecore_IMF_Context* context_; }; #endif // FLUTTER_PLUGIN_WEBVIEW_FLUTTER_TIZEN_WEVIEW_H_