7
7
#include " flutter/shell/platform/common/cpp/client_wrapper/include/flutter/standard_message_codec.h"
8
8
#include " flutter/shell/platform/common/cpp/client_wrapper/include/flutter/standard_method_codec.h"
9
9
#include " flutter/shell/platform/common/cpp/json_method_codec.h"
10
+ #include " flutter/shell/platform/tizen/channels/text_input_channel.h"
10
11
#include " flutter/shell/platform/tizen/public/flutter_platform_view.h"
12
+ #include " flutter/shell/platform/tizen/tizen_embedder_engine.h"
11
13
#include " flutter/shell/platform/tizen/tizen_log.h"
12
14
13
15
static constexpr char kChannelName [] = " flutter/platform_views" ;
@@ -63,8 +65,10 @@ flutter::EncodableList ExtractListFromMap(
63
65
return flutter::EncodableList ();
64
66
}
65
67
66
- PlatformViewChannel::PlatformViewChannel (flutter::BinaryMessenger* messenger)
67
- : channel_(
68
+ PlatformViewChannel::PlatformViewChannel (flutter::BinaryMessenger* messenger,
69
+ TizenEmbedderEngine* engine)
70
+ : engine_(engine),
71
+ channel_(
68
72
std::make_unique<flutter::MethodChannel<flutter::EncodableValue>>(
69
73
messenger, kChannelName ,
70
74
&flutter::StandardMethodCodec::GetInstance ())) {
@@ -117,6 +121,7 @@ void PlatformViewChannel::HandleMethodCall(
117
121
const auto method = call.method_name ();
118
122
const auto & arguments = *call.arguments ();
119
123
124
+ FT_LOGD (" method: %s" , method.c_str ());
120
125
if (method == " create" ) {
121
126
std::string viewType = ExtractStringFromMap (arguments, " viewType" );
122
127
int viewId = ExtractIntFromMap (arguments, " id" );
@@ -151,10 +156,28 @@ void PlatformViewChannel::HandleMethodCall(
151
156
channel_->InvokeMethod (" viewFocused" , std::move (id));
152
157
}
153
158
159
+ if (engine_ && engine_->text_input_channel ) {
160
+ Ecore_IMF_Context* context =
161
+ engine_->text_input_channel ->GetImfContext ();
162
+ viewInstance->SetSoftwareKeyboardContext (context);
163
+ }
164
+
154
165
result->Success (flutter::EncodableValue (viewInstance->GetTextureId ()));
155
166
} else {
156
167
FT_LOGE (" can't find view type = %s" , viewType.c_str ());
157
- result->Error (" 0" , " can't find view type" );
168
+ result->Error (" Can't find view type" );
169
+ }
170
+ } else if (method == " clearFocus" ) {
171
+ int viewId = -1 ;
172
+ if (std::holds_alternative<int >(arguments)) {
173
+ viewId = std::get<int >(arguments);
174
+ };
175
+ auto it = view_instances_.find (viewId);
176
+ if (viewId >= 0 && it != view_instances_.end ()) {
177
+ it->second ->ClearFocus ();
178
+ result->Success ();
179
+ } else {
180
+ result->Error (" Can't find view id" );
158
181
}
159
182
} else {
160
183
int viewId = ExtractIntFromMap (arguments, " id" );
@@ -165,7 +188,6 @@ void PlatformViewChannel::HandleMethodCall(
165
188
it->second ->Dispose ();
166
189
result->Success ();
167
190
} else if (method == " resize" ) {
168
- FT_LOGD (" PlatformViewChannel resize" );
169
191
double width = ExtractDoubleFromMap (arguments, " width" );
170
192
double height = ExtractDoubleFromMap (arguments, " height" );
171
193
it->second ->Resize (width, height);
@@ -191,17 +213,12 @@ void PlatformViewChannel::HandleMethodCall(
191
213
} else if (method == " setDirection" ) {
192
214
FT_LOGD (" PlatformViewChannel setDirection" );
193
215
result->NotImplemented ();
194
- } else if (method == " clearFocus" ) {
195
- FT_LOGD (" PlatformViewChannel clearFocus" );
196
- it->second ->ClearFocus ();
197
- result->NotImplemented ();
198
216
} else {
199
217
FT_LOGD (" Unimplemented method: %s" , method.c_str ());
200
218
result->NotImplemented ();
201
219
}
202
220
} else {
203
- FT_LOGE (" can't find view id" );
204
- result->Error (" 0" , " can't find view id" );
221
+ result->Error (" Can't find view id" );
205
222
}
206
223
}
207
224
}
0 commit comments