diff --git a/engine/src/flutter/shell/platform/common/cpp/client_wrapper/json_method_codec.cc b/engine/src/flutter/shell/platform/common/cpp/client_wrapper/json_method_codec.cc index f576d4ebf9..6c9528ff2e 100644 --- a/engine/src/flutter/shell/platform/common/cpp/client_wrapper/json_method_codec.cc +++ b/engine/src/flutter/shell/platform/common/cpp/client_wrapper/json_method_codec.cc @@ -44,7 +44,12 @@ JsonMethodCodec::DecodeMethodCallInternal(const uint8_t* message, // Pull the arguments subtree up to the root of json_message. This is // destructive to json_message, but the full value is no longer needed, and // this avoids a subtree copy. - json_message->Swap(arguments_iter->value); + // Note: The static_cast is for compatibility with RapidJSON 1.1; master + // already allows swapping a Document with a Value directly. Once there is + // a new RapidJSON release (at which point clients can be expected to have + // that change in the version they depend on) remove the cast. + static_cast(json_message.get()) + ->Swap(arguments_iter->value); // Swap it into |arguments|. This moves the allocator ownership, so that // the data won't be deleted when json_message goes out of scope. arguments = std::make_unique(); diff --git a/engine/src/flutter/shell/platform/glfw/flutter_glfw.cc b/engine/src/flutter/shell/platform/glfw/flutter_glfw.cc index 1dd37f5f3a..20f2c8617c 100644 --- a/engine/src/flutter/shell/platform/glfw/flutter_glfw.cc +++ b/engine/src/flutter/shell/platform/glfw/flutter_glfw.cc @@ -19,7 +19,14 @@ #include "flutter/shell/platform/glfw/keyboard_hook_handler.h" #include "flutter/shell/platform/glfw/text_input_plugin.h" -#ifdef __linux__ +// For compatibility with GTK-based plugins, special message loop setup is +// required (e.g., for GTK modal windows). This can be disabled for cases where +// a GTK dependency is undesirable by defining FLUTTER_DISABLE_GTK. +#if defined(__linux__) && !defined(FLUTTER_DISABLE_GTK) +#define FLUTTER_USE_GTK 1 +#endif + +#ifdef FLUTTER_USE_GTK // For plugin-compatible event handling (e.g., modal windows). #include #include @@ -519,7 +526,7 @@ FlutterDesktopWindowControllerRef FlutterDesktopCreateWindow( const char* icu_data_path, const char** arguments, size_t argument_count) { -#ifdef __linux__ +#ifdef FLUTTER_USE_GTK gtk_init(0, nullptr); #endif @@ -659,13 +666,13 @@ double FlutterDesktopWindowGetScaleFactor( void FlutterDesktopRunWindowLoop(FlutterDesktopWindowControllerRef controller) { GLFWwindow* window = controller->window.get(); -#ifdef __linux__ +#ifdef FLUTTER_USE_GTK // Necessary for GTK thread safety. XInitThreads(); #endif while (!glfwWindowShouldClose(window)) { glfwPollEvents(); -#ifdef __linux__ +#ifdef FLUTTER_USE_GTK if (gtk_events_pending()) { gtk_main_iteration(); } diff --git a/engine/src/flutter/shell/platform/glfw/text_input_plugin.cc b/engine/src/flutter/shell/platform/glfw/text_input_plugin.cc index 87706de851..3779510e30 100644 --- a/engine/src/flutter/shell/platform/glfw/text_input_plugin.cc +++ b/engine/src/flutter/shell/platform/glfw/text_input_plugin.cc @@ -86,6 +86,7 @@ void TextInputPlugin::KeyboardHook(GLFWwindow* window, break; case GLFW_KEY_ENTER: EnterPressed(active_model_); + break; default: break; }