Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions shell/platform/linux/fl_view.cc
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,17 @@ static void handle_geometry_changed(FlView* self) {
self->engine, allocation.width * scale_factor,
allocation.height * scale_factor, scale_factor);

fl_renderer_wait_for_frame(self->renderer, allocation.width * scale_factor,
allocation.height * scale_factor);
// Make sure the view has been realized and its size has been allocated before
// waiting for a frame. `fl_view_realize()` and `fl_view_size_allocate()` may
// be called in either order depending on the order in which the window is
// shown and the view is added to a container in the app runner.
//
// Note: `gtk_widget_init()` initializes the size allocation to 1x1.
if (allocation.width > 1 && allocation.height > 1 &&
gtk_widget_get_realized(GTK_WIDGET(self))) {
fl_renderer_wait_for_frame(self->renderer, allocation.width * scale_factor,
allocation.height * scale_factor);
}
}

// Adds a widget to render in this view.
Expand Down Expand Up @@ -661,6 +670,8 @@ static void fl_view_realize(GtkWidget* widget) {
g_warning("Failed to start Flutter engine: %s", error->message);
return;
}

handle_geometry_changed(self);
}

// Implements GtkWidget::get-preferred-width
Expand Down