13 const std::string& icu_data_path)
14 : icu_data_path_(icu_data_path) {
22 if (init_succeeded_) {
29 const std::string& assets_path,
30 const std::vector<std::string>& arguments,
31 const std::string& aot_library_path) {
32 if (!init_succeeded_) {
33 std::cerr <<
"Could not create window; FlutterDesktopInit failed."
39 std::cerr <<
"Only one Flutter window can exist at a time." << std::endl;
44 c_window_properties.
title = window_properties.
title.c_str();
45 c_window_properties.
width = window_properties.
width;
50 c_engine_properties.
assets_path = assets_path.c_str();
53 std::vector<const char*> engine_switches;
55 arguments.begin(), arguments.end(), std::back_inserter(engine_switches),
56 [](
const std::string& arg) ->
const char* { return arg.c_str(); });
57 if (!engine_switches.empty()) {
58 c_engine_properties.
switches = &engine_switches[0];
65 std::cerr <<
"Failed to create window." << std::endl;
76 controller_ =
nullptr;
82 const std::string& plugin_name) {
84 std::cerr <<
"Cannot get plugin registrar without a window; call "
94 std::chrono::milliseconds
timeout) {
96 std::cerr <<
"Cannot run event loop without a window window; call "
101 uint32_t timeout_milliseconds;
104 timeout_milliseconds = 0;
105 }
else if (
timeout.count() > UINT32_MAX) {
106 timeout_milliseconds = UINT32_MAX;
108 timeout_milliseconds =
static_cast<uint32_t
>(
timeout.count());
111 controller_, timeout_milliseconds);
112 if (!still_running) {
115 return still_running;
bool RunEventLoopWithTimeout(std::chrono::milliseconds timeout=std::chrono::milliseconds::max())
virtual ~FlutterWindowController()
bool CreateWindow(const WindowProperties &window_properties, const std::string &assets_path, const std::vector< std::string > &arguments, const std::string &aot_library_path="")
FlutterDesktopPluginRegistrarRef GetRegistrarForPlugin(const std::string &plugin_name) override
FlutterWindowController(const std::string &icu_data_path)
static float max(float r, float g, float b)
def timeout(deadline, cmd)
static SkColor4f transform(SkColor4f c, SkColorSpace *src, SkColorSpace *dst)
const char * aot_library_path
const char * icu_data_path
FlutterDesktopWindowControllerRef FlutterDesktopCreateWindow(const FlutterDesktopWindowProperties &window_properties, const FlutterDesktopEngineProperties &engine_properties)
void FlutterDesktopDestroyWindow(FlutterDesktopWindowControllerRef controller)
bool FlutterDesktopInit()
FlutterDesktopWindowRef FlutterDesktopGetWindow(FlutterDesktopWindowControllerRef controller)
FlutterDesktopEngineRef FlutterDesktopGetEngine(FlutterDesktopWindowControllerRef controller)
bool FlutterDesktopRunWindowEventLoopWithTimeout(FlutterDesktopWindowControllerRef controller, uint32_t millisecond_timeout)
void FlutterDesktopTerminate()
FlutterDesktopPluginRegistrarRef FlutterDesktopGetPluginRegistrar(FlutterDesktopEngineRef engine, const char *plugin_name)