From: Christoffer Aasted Date: Sun, 21 Jun 2026 17:40:30 +0000 (+0000) Subject: patch 9.2.0692: GTK2: build failure, popup images not drawn correctly X-Git-Tag: v9.2.0692^0 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1b2b58365effdb5fd19176483c212b4ca6bdcbaa;p=thirdparty%2Fvim.git patch 9.2.0692: GTK2: build failure, popup images not drawn correctly Problem: GTK2: build failure, popup images not drawn correctly Solution: Add ifdefs for GTK2 support, redraw images on cursor movement (Christoffer Aasted) fixes: #20504 closes: #20565 Signed-off-by: Christoffer Aasted Signed-off-by: Christian Brabandt --- diff --git a/src/cairo.c b/src/cairo.c index 2bcea3141f..7543a33d9b 100644 --- a/src/cairo.c +++ b/src/cairo.c @@ -182,14 +182,21 @@ cairo_popup_image_paint( return; if (!cairo_popup_image_ensure(wp)) return; + cairo_surface_t *surface = (cairo_surface_t *)wp->w_popup_image_surface; + +# if !GTK_CHECK_VERSION(3,0,0) + cr = gdk_cairo_create((GdkDrawable *)target); +# else cr = cairo_create((cairo_surface_t *)target); +# endif cairo_set_operator(cr, CAIRO_OPERATOR_OVER); // Position the source so its (src_x, src_y) pixel lands at (x, y), // then clip to the visible (draw_w x draw_h) rectangle. cairo_set_source_surface(cr, - (cairo_surface_t *)wp->w_popup_image_surface, + surface, x - src_x, y - src_y); + cairo_rectangle(cr, x, y, draw_w, draw_h); cairo_fill(cr); cairo_destroy(cr); diff --git a/src/gui.c b/src/gui.c index 2b4deee9f6..0cd586114a 100644 --- a/src/gui.c +++ b/src/gui.c @@ -1355,6 +1355,11 @@ gui_update_cursor( if (!gui.in_focus) { gui_mch_draw_hollow_cursor(cbg); +#if defined(FEAT_GUI_GTK) && defined(FEAT_IMAGE_CAIRO) +# if !GTK_CHECK_VERSION(4,0,0) + update_popup_images(); +# endif +#endif return; } @@ -1423,6 +1428,11 @@ gui_update_cursor( #endif } gui.highlight_mask = old_hl_mask; +#if defined(FEAT_GUI_GTK) && defined(FEAT_IMAGE_CAIRO) +# if !GTK_CHECK_VERSION(4,0,0) + update_popup_images(); +# endif +#endif } #if defined(FEAT_MENU) diff --git a/src/gui_gtk_x11.c b/src/gui_gtk_x11.c index 5fe1ea730b..bf16d3e07f 100644 --- a/src/gui_gtk_x11.c +++ b/src/gui_gtk_x11.c @@ -7035,16 +7035,23 @@ gui_mch_draw_popup_image( if (wp->w_popup_image_data == NULL || wp->w_popup_image_w <= 0 || wp->w_popup_image_h <= 0 || draw_w <= 0 || draw_h <= 0 - || gui.surface == NULL) +# if GTK_CHECK_VERSION(3,0,0) + || gui.surface == NULL +# endif + ) return; x = FILL_X(col); y = FILL_Y(row); +# if GTK_CHECK_VERSION(3,0,0) cairo_popup_image_paint(wp, gui.surface, x, y, - src_x, src_y, draw_w, draw_h); - + src_x, src_y, draw_w, draw_h); if (gui.drawarea != NULL) gtk_widget_queue_draw_area(gui.drawarea, x, y, draw_w, draw_h); +# else + cairo_popup_image_paint(wp, gui.drawarea->window, x, y, + src_x, src_y, draw_w, draw_h); +# endif } #endif // FEAT_IMAGE_CAIRO diff --git a/src/version.c b/src/version.c index f4375f6e28..5b34e6a3d7 100644 --- a/src/version.c +++ b/src/version.c @@ -759,6 +759,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 692, /**/ 691, /**/