]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.2.0692: GTK2: build failure, popup images not drawn correctly v9.2.0692
authorChristoffer Aasted <dezzadk@gmail.com>
Sun, 21 Jun 2026 17:40:30 +0000 (17:40 +0000)
committerChristian Brabandt <cb@256bit.org>
Sun, 21 Jun 2026 17:44:13 +0000 (17:44 +0000)
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 <dezzadk@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
src/cairo.c
src/gui.c
src/gui_gtk_x11.c
src/version.c

index 2bcea3141f9e093a24911eb1c65449e44944f638..7543a33d9b4015e704a4b0ff2c6a887c29c10174 100644 (file)
@@ -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);
index 2b4deee9f6e88d87903992613d9faff54f11afc0..0cd586114a92777fada8060702062eb5a64acb44 100644 (file)
--- 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)
index 5fe1ea730bc2e9987dce12f64cd81a7e9dde15d9..bf16d3e07f65379e6ca837170b9c595848ca215b 100644 (file)
@@ -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
 
index f4375f6e28b74c302de8ab47e9962fb706ced3d5..5b34e6a3d7becf15bb34c5ed4e6c65b71b353202 100644 (file)
@@ -759,6 +759,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    692,
 /**/
     691,
 /**/