@@ -160,7 +160,8 @@ WebView::WebView(flutter::PluginRegistrar* registrar, int viewId,
160160 height_(height),
161161 tbmSurface_(nullptr ),
162162 isMouseLButtonDown_(false ),
163- hasNavigationDelegate_(false ) {
163+ hasNavigationDelegate_(false ),
164+ context_(nullptr ) {
164165 SetTextureId (FlutterRegisterExternalTexture (textureRegistrar_));
165166 InitWebView ();
166167
@@ -697,32 +698,51 @@ void WebView::DispatchKeyUpEvent(Ecore_Event_Key* keyEvent) {
697698 p);
698699}
699700
701+ void WebView::DispatchCompositionUpdateEvent (const char * str, int size) {
702+ LOG_DEBUG (" WebView::DispatchCompositionUpdateEvent [%s]" , str);
703+ webViewInstance_->DispatchCompositionUpdateEvent (std::string (str, size));
704+ }
705+
706+ void WebView::DispatchCompositionEndEvent (const char * str, int size) {
707+ LOG_DEBUG (" WebView::DispatchCompositionEndEvent [%s]" , str);
708+ webViewInstance_->DispatchCompositionEndEvent (std::string (str, size));
709+ }
710+
711+ void WebView::ShowPanel () {
712+ LOG_DEBUG (" WebView - Show Keyboard()\n " );
713+ if (!context_) {
714+ LOG_ERROR (" Ecore_IMF_Context NULL\n " );
715+ return ;
716+ }
717+ ecore_imf_context_input_panel_show (context_);
718+ ecore_imf_context_focus_in (context_);
719+ }
720+
721+ void WebView::HidePanel () {
722+ LOG_DEBUG (" WebView - Hide Keyboard()\n " );
723+ if (!context_) {
724+ LOG_ERROR (" Ecore_IMF_Context NULL\n " );
725+ return ;
726+ }
727+ ecore_imf_context_reset (context_);
728+ ecore_imf_context_focus_out (context_);
729+ ecore_imf_context_input_panel_hide (context_);
730+ }
731+
700732void WebView::SetSoftwareKeyboardContext (Ecore_IMF_Context* context) {
733+ context_ = context;
734+
701735 webViewInstance_->RegisterOnShowSoftwareKeyboardIfPossibleHandler (
702- [context](LWE::WebContainer* v) {
703- LOG_DEBUG (" WebView - Show Keyboard()\n " );
704- if (!context) {
705- LOG_ERROR (" Ecore_IMF_Context NULL\n " );
706- return ;
707- }
708- ecore_imf_context_input_panel_show (context);
709- ecore_imf_context_focus_in (context);
710- });
736+ [this ](LWE::WebContainer* v) { ShowPanel (); });
711737
712738 webViewInstance_->RegisterOnHideSoftwareKeyboardIfPossibleHandler (
713- [context](LWE::WebContainer*) {
714- LOG_INFO (" WebView - Hide Keyboard()\n " );
715- if (!context) {
716- LOG_INFO (" Ecore_IMF_Context NULL\n " );
717- return ;
718- }
719- ecore_imf_context_reset (context);
720- ecore_imf_context_focus_out (context);
721- ecore_imf_context_input_panel_hide (context);
722- });
739+ [this ](LWE::WebContainer*) { HidePanel (); });
723740}
724741
725- void WebView::ClearFocus () { LOG_DEBUG (" WebView::clearFocus \n " ); }
742+ void WebView::ClearFocus () {
743+ LOG_DEBUG (" WebView::clearFocus \n " );
744+ HidePanel ();
745+ }
726746
727747void WebView::SetDirection (int direction) {
728748 LOG_DEBUG (" WebView::SetDirection direction: %d\n " , direction);
0 commit comments