From daed7200b33f710853e8d2f0792c3ede596754ef Mon Sep 17 00:00:00 2001 From: Ben Harris Date: Sat, 19 Apr 2025 09:13:06 +0100 Subject: [PATCH] GTK: create backing Cairo surface of similar type to window Specifically, this creates the surface using gdk_window_create_similar_surface() where that's available. --- unix/window.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/unix/window.c b/unix/window.c index 1379b6ef..bbaaa854 100644 --- a/unix/window.c +++ b/unix/window.c @@ -819,8 +819,14 @@ static void drawing_area_setup(GtkFrontend *inst, int width, int height) inst->surface = NULL; } +#if GTK_CHECK_VERSION(2,22,0) + inst->surface = gdk_window_create_similar_surface( + gtk_widget_get_window(inst->area), + CAIRO_CONTENT_COLOR, inst->backing_w, inst->backing_h); +#else inst->surface = cairo_image_surface_create( CAIRO_FORMAT_ARGB32, inst->backing_w, inst->backing_h); +#endif #endif draw_backing_rect(inst);