glarea: Stop using gtk_snapshot_render api

The gtk_snapshot_render api is deprecated, stop using it.
This commit is contained in:
Matthias Clasen 2022-10-08 14:28:41 -04:00
parent dd3c371c08
commit 484cff2182

View File

@ -29,7 +29,9 @@
#include "gtksnapshot.h"
#include "gtknative.h"
#include "gtkwidgetprivate.h"
#include "deprecated/gtkrender.h"
#include "gtksnapshot.h"
#include "gtkrenderlayoutprivate.h"
#include "gtkcssnodeprivate.h"
#include <epoxy/gl.h>
@ -653,19 +655,15 @@ gtk_gl_area_draw_error_screen (GtkGLArea *area,
GtkGLAreaPrivate *priv = gtk_gl_area_get_instance_private (area);
PangoLayout *layout;
int layout_height;
GtkCssBoxes boxes;
layout = gtk_widget_create_pango_layout (GTK_WIDGET (area),
priv->error->message);
layout = gtk_widget_create_pango_layout (GTK_WIDGET (area), priv->error->message);
pango_layout_set_width (layout, width * PANGO_SCALE);
pango_layout_set_alignment (layout, PANGO_ALIGN_CENTER);
pango_layout_get_pixel_size (layout, NULL, &layout_height);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
gtk_snapshot_render_layout (snapshot,
gtk_widget_get_style_context (GTK_WIDGET (area)),
0, (height - layout_height) / 2,
layout);
G_GNUC_END_IGNORE_DEPRECATIONS
gtk_css_boxes_init (&boxes, GTK_WIDGET (area));
gtk_css_style_snapshot_layout (&boxes, snapshot, 0, (height - layout_height) / 2, layout);
g_object_unref (layout);
}