forked from firka/flutter
Force GTK IM context to initialize at start (flutter/engine#32118)
Fixes https://github.com/flutter/flutter/issues/100385
This commit is contained in:
@@ -708,6 +708,10 @@ static void fl_text_input_plugin_init(FlTextInputPlugin* self) {
|
||||
|
||||
priv->client_id = kClientIdUnset;
|
||||
priv->im_context = gtk_im_multicontext_new();
|
||||
// On Wayland, this call sets up the input method so it can be enabled
|
||||
// immediately when required. Without it, on-screen keyboard's don't come up
|
||||
// the first time a text field is focused.
|
||||
gtk_im_context_focus_out(priv->im_context);
|
||||
priv->input_type = FL_TEXT_INPUT_TYPE_TEXT;
|
||||
g_signal_connect_object(priv->im_context, "preedit-start",
|
||||
G_CALLBACK(im_preedit_start_cb), self,
|
||||
|
||||
@@ -9,6 +9,18 @@
|
||||
#include "flutter/shell/platform/linux/fl_engine_private.h"
|
||||
#include "flutter/shell/platform/linux/testing/mock_renderer.h"
|
||||
|
||||
namespace {
|
||||
class ImModuleEnv : public ::testing::Environment {
|
||||
public:
|
||||
void SetUp() override {
|
||||
setenv("GTK_IM_MODULE", "gtk-im-context-simple", true);
|
||||
}
|
||||
};
|
||||
|
||||
testing::Environment* const env =
|
||||
testing::AddGlobalTestEnvironment(new ImModuleEnv);
|
||||
} // namespace
|
||||
|
||||
static uint8_t hex_digit_to_int(char value) {
|
||||
if (value >= '0' && value <= '9') {
|
||||
return value - '0';
|
||||
|
||||
Reference in New Issue
Block a user