@@ -41,6 +41,7 @@ static constexpr char kTransform[] = "transform";
41
41
42
42
static constexpr char kTextAffinityDownstream [] = " TextAffinity.downstream" ;
43
43
static constexpr char kMultilineInputType [] = " TextInputType.multiline" ;
44
+ static constexpr char kNoneInputType [] = " TextInputType.none" ;
44
45
45
46
static constexpr int64_t kClientIdUnset = -1 ;
46
47
@@ -58,6 +59,9 @@ struct FlTextInputPluginPrivate {
58
59
// Send newline when multi-line and enter is pressed.
59
60
gboolean input_multiline;
60
61
62
+ // Whether to show the on-screen keyboard.
63
+ gboolean show_osk;
64
+
61
65
// Input method.
62
66
GtkIMContext* im_context;
63
67
@@ -265,17 +269,22 @@ static FlMethodResponse* set_client(FlTextInputPlugin* self, FlValue* args) {
265
269
priv->input_action = g_strdup (fl_value_get_string (input_action_value));
266
270
}
267
271
268
- // Clear the multiline flag , then set it only if the field is multiline .
272
+ // Reset the input type flags , then set them only if appropriate .
269
273
priv->input_multiline = FALSE ;
274
+ priv->show_osk = TRUE ;
270
275
FlValue* input_type_value =
271
276
fl_value_lookup_string (config_value, kTextInputTypeKey );
272
277
if (fl_value_get_type (input_type_value) == FL_VALUE_TYPE_MAP) {
273
278
FlValue* input_type_name =
274
279
fl_value_lookup_string (input_type_value, kTextInputTypeNameKey );
275
- if (fl_value_get_type (input_type_name) == FL_VALUE_TYPE_STRING &&
276
- g_strcmp0 (fl_value_get_string (input_type_name), kMultilineInputType ) ==
277
- 0 ) {
278
- priv->input_multiline = TRUE ;
280
+ if (fl_value_get_type (input_type_name) == FL_VALUE_TYPE_STRING) {
281
+ if (g_strcmp0 (fl_value_get_string (input_type_name),
282
+ kMultilineInputType ) == 0 ) {
283
+ priv->input_multiline = TRUE ;
284
+ } else if (g_strcmp0 (fl_value_get_string (input_type_name),
285
+ kNoneInputType ) == 0 ) {
286
+ priv->show_osk = FALSE ;
287
+ }
279
288
}
280
289
}
281
290
@@ -286,12 +295,14 @@ static FlMethodResponse* set_client(FlTextInputPlugin* self, FlValue* args) {
286
295
static FlMethodResponse* show (FlTextInputPlugin* self) {
287
296
FlTextInputPluginPrivate* priv = static_cast <FlTextInputPluginPrivate*>(
288
297
fl_text_input_plugin_get_instance_private (self));
289
- // Set the top-level window used for system input method windows.
290
- GdkWindow* window =
291
- gtk_widget_get_window (gtk_widget_get_toplevel (GTK_WIDGET (priv->view )));
292
- gtk_im_context_set_client_window (priv->im_context , window);
298
+ if (priv->show_osk == TRUE ) {
299
+ // Set the top-level window used for system input method windows.
300
+ GdkWindow* window =
301
+ gtk_widget_get_window (gtk_widget_get_toplevel (GTK_WIDGET (priv->view )));
302
+ gtk_im_context_set_client_window (priv->im_context , window);
293
303
294
- gtk_im_context_focus_in (priv->im_context );
304
+ gtk_im_context_focus_in (priv->im_context );
305
+ }
295
306
296
307
return FL_METHOD_RESPONSE (fl_method_success_response_new (nullptr ));
297
308
}
0 commit comments