Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions ci/licenses_golden/licenses_flutter
Original file line number Diff line number Diff line change
Expand Up @@ -1304,6 +1304,8 @@ FILE: ../../../flutter/shell/platform/linux/fl_renderer.cc
FILE: ../../../flutter/shell/platform/linux/fl_renderer.h
FILE: ../../../flutter/shell/platform/linux/fl_renderer_headless.cc
FILE: ../../../flutter/shell/platform/linux/fl_renderer_headless.h
FILE: ../../../flutter/shell/platform/linux/fl_renderer_wayland.cc
FILE: ../../../flutter/shell/platform/linux/fl_renderer_wayland.h
FILE: ../../../flutter/shell/platform/linux/fl_renderer_x11.cc
FILE: ../../../flutter/shell/platform/linux/fl_renderer_x11.h
FILE: ../../../flutter/shell/platform/linux/fl_standard_message_codec.cc
Expand Down
7 changes: 6 additions & 1 deletion shell/platform/linux/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ source_set("flutter_linux_sources") {
"fl_plugin_registry.cc",
"fl_renderer.cc",
"fl_renderer_headless.cc",
"fl_renderer_wayland.cc",
"fl_renderer_x11.cc",
"fl_standard_message_codec.cc",
"fl_standard_method_codec.cc",
Expand All @@ -117,6 +118,7 @@ source_set("flutter_linux") {
configs += [
"//flutter/shell/platform/linux/config:gtk",
"//flutter/shell/platform/linux/config:egl",
"//flutter/shell/platform/linux/config:wayland-egl",
"//third_party/khronos:khronos_headers",
]

Expand Down Expand Up @@ -157,7 +159,10 @@ executable("flutter_linux_unittests") {

public_configs = [ "//flutter:config" ]

configs += [ "//flutter/shell/platform/linux/config:gtk" ]
configs += [
"//flutter/shell/platform/linux/config:gtk",
"//flutter/shell/platform/linux/config:wayland-egl",
]

# Set flag to allow public headers to be directly included (library users should not do this)
defines = [ "FLUTTER_LINUX_COMPILATION" ]
Expand Down
4 changes: 4 additions & 0 deletions shell/platform/linux/config/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,7 @@ pkg_config("gtk") {
pkg_config("egl") {
packages = [ "egl" ]
}

pkg_config("wayland-egl") {
packages = [ "wayland-egl" ]
}
14 changes: 7 additions & 7 deletions shell/platform/linux/fl_renderer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -135,15 +135,13 @@ static gboolean setup_gdk_window(FlRenderer* self,
gtk_widget_register_window(widget, window);
gtk_widget_set_window(widget, window);

if (FL_RENDERER_GET_CLASS(self)->set_window) {
FL_RENDERER_GET_CLASS(self)->set_window(self, window);
}

return TRUE;
}

// Creates the EGL surfaces that Flutter will render to.
static gboolean setup_egl_surfaces(FlRenderer* self, GError** error) {
static gboolean setup_egl_surfaces(FlRenderer* self,
GtkWidget* widget,
GError** error) {
FlRendererPrivate* priv =
static_cast<FlRendererPrivate*>(fl_renderer_get_instance_private(self));

Expand All @@ -155,7 +153,7 @@ static gboolean setup_egl_surfaces(FlRenderer* self, GError** error) {
}

if (!FL_RENDERER_GET_CLASS(self)->create_surfaces(
self, priv->egl_display, priv->egl_config, &priv->egl_surface,
self, widget, priv->egl_display, priv->egl_config, &priv->egl_surface,
&priv->resource_surface, error)) {
return FALSE;
}
Expand Down Expand Up @@ -184,6 +182,8 @@ static gboolean setup_egl_surfaces(FlRenderer* self, GError** error) {
gboolean fl_renderer_start(FlRenderer* self,
GtkWidget* widget,
GError** error) {
g_return_val_if_fail(FL_IS_RENDERER(self), FALSE);

if (!setup_egl_display(self, error)) {
return FALSE;
}
Expand All @@ -192,7 +192,7 @@ gboolean fl_renderer_start(FlRenderer* self,
return FALSE;
}

if (!setup_egl_surfaces(self, error)) {
if (!setup_egl_surfaces(self, widget, error)) {
return FALSE;
}

Expand Down
24 changes: 16 additions & 8 deletions shell/platform/linux/fl_renderer.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <gtk/gtk.h>

#include "flutter/shell/platform/linux/public/flutter_linux/fl_dart_project.h"
#include "flutter/shell/platform/linux/public/flutter_linux/fl_view.h"

G_BEGIN_DECLS

Expand Down Expand Up @@ -37,21 +38,25 @@ struct _FlRendererClass {
/**
* Virtual method called before creating a GdkWindow for the widget.
* Does not need to be implemented.
* @renderer: an #FlRenderer.
* @widget: the widget being rendered on.
* @display: display to create surfaces on.
* @config: EGL configuration.
* @window_attributes: window attributes to modify.
* @mask: (out): the window mask to use.
* @error: (allow-none): #GError location to store the error occurring, or
* %NULL to ignore.
*
* Returns: %TRUE if the window is successfully set up.
*/
gboolean (*setup_window_attr)(FlRenderer* renderer,
GtkWidget* widget,
EGLDisplay egl_display,
EGLConfig egl_config,
EGLDisplay display,
EGLConfig config,
GdkWindowAttr* window_attributes,
gint* mask,
GError** error);

/**
* Virtual method called after a GDK window has been created.
* This is called once. Does not need to be implemented.
*/
void (*set_window)(FlRenderer* renderer, GdkWindow* window);

/**
* Virtual method to create a new EGL display.
*/
Expand All @@ -60,7 +65,9 @@ struct _FlRendererClass {
/**
* Virtual method called when Flutter needs surfaces to render to.
* @renderer: an #FlRenderer.
* @widget: the widget being rendered on.
* @display: display to create surfaces on.
* @config: EGL configuration.
* @visible: (out): the visible surface that is created.
* @resource: (out): the resource surface that is created.
* @error: (allow-none): #GError location to store the error occurring, or
Expand All @@ -69,6 +76,7 @@ struct _FlRendererClass {
* Returns: %TRUE if both surfaces were created, %FALSE if there was an error.
*/
gboolean (*create_surfaces)(FlRenderer* renderer,
GtkWidget* widget,
EGLDisplay display,
EGLConfig config,
EGLSurface* visible,
Expand Down
1 change: 1 addition & 0 deletions shell/platform/linux/fl_renderer_headless.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ struct _FlRendererHeadless {
G_DEFINE_TYPE(FlRendererHeadless, fl_renderer_headless, fl_renderer_get_type())

static gboolean fl_renderer_headless_create_surfaces(FlRenderer* renderer,
GtkWidget* widget,
EGLDisplay display,
EGLConfig config,
EGLSurface* visible,
Expand Down
Loading