1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-10 09:58:01 +00:00

Handle GTK 3.22's deprecation of gdk_cairo_create().

Now the whole code base compiles and links successfully against 3.22.
This commit is contained in:
Simon Tatham 2017-02-27 19:58:39 +00:00
parent 7a0a404eb8
commit 8ce2372348
2 changed files with 23 additions and 0 deletions

View File

@ -2753,8 +2753,23 @@ static void unifontsel_draw_preview_text(unifontsel_internal *fs)
#endif #endif
#ifdef DRAW_TEXT_CAIRO #ifdef DRAW_TEXT_CAIRO
if (dctx.type == DRAWTYPE_CAIRO) { if (dctx.type == DRAWTYPE_CAIRO) {
#if GTK_CHECK_VERSION(3,22,0)
cairo_region_t *region;
#endif
dctx.u.cairo.widget = GTK_WIDGET(fs->preview_area); dctx.u.cairo.widget = GTK_WIDGET(fs->preview_area);
#if GTK_CHECK_VERSION(3,22,0)
dctx.u.cairo.gdkwin = gtk_widget_get_window(dctx.u.cairo.widget);
region = gdk_window_get_clip_region(dctx.u.cairo.gdkwin);
dctx.u.cairo.drawctx = gdk_window_begin_draw_frame(
dctx.u.cairo.gdkwin, region);
dctx.u.cairo.cr = gdk_drawing_context_get_cairo_context(
dctx.u.cairo.drawctx);
cairo_region_destroy(region);
#else
dctx.u.cairo.cr = gdk_cairo_create(target); dctx.u.cairo.cr = gdk_cairo_create(target);
#endif
} }
#endif #endif
@ -2767,7 +2782,11 @@ static void unifontsel_draw_preview_text(unifontsel_internal *fs)
#endif #endif
#ifdef DRAW_TEXT_CAIRO #ifdef DRAW_TEXT_CAIRO
if (dctx.type == DRAWTYPE_CAIRO) { if (dctx.type == DRAWTYPE_CAIRO) {
#if GTK_CHECK_VERSION(3,22,0)
gdk_window_end_draw_frame(dctx.u.cairo.gdkwin, dctx.u.cairo.drawctx);
#else
cairo_destroy(dctx.u.cairo.cr); cairo_destroy(dctx.u.cairo.cr);
#endif
} }
#endif #endif

View File

@ -124,6 +124,10 @@ typedef struct unifont_drawctx {
GtkWidget *widget; GtkWidget *widget;
cairo_t *cr; cairo_t *cr;
cairo_matrix_t origmatrix; cairo_matrix_t origmatrix;
#if GTK_CHECK_VERSION(3,22,0)
GdkWindow *gdkwin;
GdkDrawingContext *drawctx;
#endif
} cairo; } cairo;
#endif #endif
} u; } u;