Flutter Linux Embedder
fl_wayland_display.h File Reference
#include <gtk/gtk.h>
#include "flutter/shell/platform/linux/fl_subsurface.h"

Go to the source code of this file.

Functions

G_BEGIN_DECLS G_DECLARE_FINAL_TYPE (FlWaylandDisplay, fl_wayland_display, FL, WAYLAND_DISPLAY, GObject) FlWaylandDisplay *fl_wayland_display_open(struct wl_display *wl_display)
 
FlWaylandDisplay * fl_wayland_display_get_for_display (GdkDisplay *display)
 
FlSubsurface * fl_wayland_display_create_subsurface (FlWaylandDisplay *display, struct wl_surface *parent_surface)
 

Function Documentation

◆ fl_wayland_display_create_subsurface()

FlSubsurface* fl_wayland_display_create_subsurface ( FlWaylandDisplay *  display,
struct wl_surface *  parent_surface 
)

fl_wayland_display_create_subsurface: @display: an #FlWaylandDisplay. @parent_surface: the Wayland surface to attach the subsurface to.

Creates a new Wayland subsurface on @parent_surface. @parent_surface must be on the display @display was created for, it is a programmer error to call this otherwise.

Returns: (transfer full): a new #FlSubsurface.

Definition at line 112 of file fl_wayland_display.cc.

114  {
115  g_return_val_if_fail(FL_IS_WAYLAND_DISPLAY(self), nullptr);
116 
117  return fl_subsurface_new(self->compositor, self->subcompositor,
118  parent_surface);
119 }
FlSubsurface * fl_subsurface_new(struct wl_compositor *compositor, struct wl_subcompositor *subcompositor, struct wl_surface *parent_surface)

References fl_subsurface_new().

Referenced by FlSubsurfaceTest::CreateSubsurface(), FlSubsurfaceEGLTest::SetUp(), and TEST_F().

◆ fl_wayland_display_get_for_display()

FlWaylandDisplay* fl_wayland_display_get_for_display ( GdkDisplay *  display)

fl_wayland_display_get_for_display: @display: a Wayland #GdkDisplay.

Gets the #FlWaylandDisplay for @display, creating it if required. The Wayland registry is only queried the first time this is called for a given display. @display must be a Wayland display, it is a programmer error to call this otherwise.

Returns: (transfer none): an #FlWaylandDisplay, or NULL if the required Wayland globals are not available.

Definition at line 89 of file fl_wayland_display.cc.

89  {
90  g_return_val_if_fail(GDK_IS_WAYLAND_DISPLAY(gdk_display), nullptr);
91 
92  FlWaylandDisplay* self = FL_WAYLAND_DISPLAY(
93  g_object_get_data(G_OBJECT(gdk_display), kWaylandDisplayKey));
94  if (self != nullptr) {
95  return self;
96  }
97 
98  self =
99  fl_wayland_display_open(gdk_wayland_display_get_wl_display(gdk_display));
100  if (self == nullptr) {
101  return nullptr;
102  }
103 
104  // Owned by the #GdkDisplay, so the globals are shared by everything using
105  // that display and released with it.
106  g_object_set_data_full(G_OBJECT(gdk_display), kWaylandDisplayKey, self,
107  g_object_unref);
108 
109  return self;
110 }
static const char * kWaylandDisplayKey
FlWaylandDisplay * fl_wayland_display_open(struct wl_display *wl_display)

References fl_wayland_display_open(), and kWaylandDisplayKey.

Referenced by TEST_F().

◆ G_DECLARE_FINAL_TYPE()

G_BEGIN_DECLS G_DECLARE_FINAL_TYPE ( FlWaylandDisplay  ,
fl_wayland_display  ,
FL  ,
WAYLAND_DISPLAY  ,
GObject   
)

FlWaylandDisplay:

#FlWaylandDisplay provides access to the Wayland globals used by Flutter, binding them from the Wayland registry a single time per display. fl_wayland_display_open: @wl_display: the Wayland display to use.

Binds the Wayland globals used by Flutter on @wl_display. This is not a plain constructor - it fails if the compositor doesn't provide the globals that are required.

Returns: (transfer full): an #FlWaylandDisplay, or NULL if the required Wayland globals are not available.