5#include "flutter/shell/platform/linux/fl_renderer_gdk.h"
23G_DEFINE_TYPE(FlRendererGdk, fl_renderer_gdk, fl_renderer_get_type())
28 gdk_gl_context_make_current(
self->main_context);
34 gdk_gl_context_make_current(
self->resource_context);
39 gdk_gl_context_clear_current();
44 GdkDisplay* display = gdk_window_get_display(
self->window);
46 gdk_display_get_monitor_at_window(display,
self->window);
47 if (monitor ==
nullptr) {
51 int refresh_rate = gdk_monitor_get_refresh_rate(monitor);
52 if (refresh_rate <= 0) {
56 return static_cast<gdouble
>(refresh_rate) / 1000.0;
60 FlRendererGdk*
self = FL_RENDERER_GDK(
object);
62 g_clear_object(&
self->gdk_context);
63 g_clear_object(&
self->main_context);
64 g_clear_object(&
self->resource_context);
66 G_OBJECT_CLASS(fl_renderer_gdk_parent_class)->dispose(
object);
73 FL_RENDERER_CLASS(klass)->make_resource_current =
83 FL_RENDERER_GDK(g_object_new(fl_renderer_gdk_get_type(),
nullptr));
89 self->gdk_context = gdk_window_create_gl_context(
self->window,
error);
90 if (
self->gdk_context ==
nullptr) {
93 if (!gdk_gl_context_realize(
self->gdk_context,
error)) {
97 self->main_context = gdk_window_create_gl_context(
self->window,
error);
98 if (
self->main_context ==
nullptr) {
101 if (!gdk_gl_context_realize(
self->main_context,
error)) {
105 self->resource_context = gdk_window_create_gl_context(
self->window,
error);
106 if (
self->resource_context ==
nullptr) {
109 if (!gdk_gl_context_realize(
self->resource_context,
error)) {
117 g_return_val_if_fail(FL_IS_RENDERER_GDK(
self),
nullptr);
118 return self->gdk_context;
G_DEFINE_TYPE(FlBasicMessageChannelResponseHandle, fl_basic_message_channel_response_handle, G_TYPE_OBJECT) static void fl_basic_message_channel_response_handle_dispose(GObject *object)
const uint8_t uint32_t uint32_t GError ** error
static void fl_renderer_gdk_make_resource_current(FlRenderer *renderer)
static void fl_renderer_gdk_dispose(GObject *object)
GdkGLContext * fl_renderer_gdk_get_context(FlRendererGdk *self)
static void fl_renderer_gdk_make_current(FlRenderer *renderer)
static void fl_renderer_gdk_class_init(FlRendererGdkClass *klass)
gboolean fl_renderer_gdk_create_contexts(FlRendererGdk *self, GError **error)
static void fl_renderer_gdk_init(FlRendererGdk *self)
FlRendererGdk * fl_renderer_gdk_new(GdkWindow *window)
static gdouble fl_renderer_gdk_get_refresh_rate(FlRenderer *renderer)
static void fl_renderer_gdk_clear_current(FlRenderer *renderer)
GdkGLContext * gdk_context
FlRenderer parent_instance
GdkGLContext * resource_context
GdkGLContext * main_context