patch 9.2.0727: popup images not rendered correctly when unfocused
Commit:
https://github.com/vim/vim/commit/a25aaa0336b717932e44d1e6c415f468daf3d09b
Author: Christoffer Aasted <
dez...@gmail.com>
Date: Wed Jun 24 20:44:15 2026 +0000
patch 9.2.0727: popup images not rendered correctly when unfocused
Problem: popup images not rendered correctly when unfocused
Solution: Avoid refreshing on update_cursor() calls, silence GTK2
deprecation warnings (Christoffer Aasted)
closes: #20610
Signed-off-by: Christoffer Aasted <
dez...@gmail.com>
Signed-off-by: Christian Brabandt <
c...@256bit.org>
diff --git a/src/gui.c b/src/gui.c
index 0ca09d8eb..6e898f1c3 100644
--- a/src/gui.c
+++ b/src/gui.c
@@ -1355,11 +1355,6 @@ 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;
}
@@ -1428,11 +1423,6 @@ 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.h b/src/gui.h
index 78ad3a09b..56e86d7a7 100644
--- a/src/gui.h
+++ b/src/gui.h
@@ -28,6 +28,9 @@ typedef GdkEvent GdkEventKey; // GTK4: GdkEventKey merged into GdkEvent
# endif
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wstrict-prototypes"
+# if !defined(USE_GTK3) && !defined(USE_GTK4)
+# pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+# endif
# include <gtk/gtk.h>
# pragma GCC diagnostic pop
#endif
diff --git a/src/popupwin.c b/src/popupwin.c
index d3d27a2e1..a497ea58c 100644
--- a/src/popupwin.c
+++ b/src/popupwin.c
@@ -120,6 +120,11 @@ static void redraw_overlapped_opacity_popups(int winrow, int wincol,
#ifdef FEAT_IMAGE_KITTY
static void popup_image_clear_kitty(win_T *wp);
#endif
+#if defined(FEAT_GUI_GTK) && defined(FEAT_IMAGE_CAIRO)
+# if !GTK_CHECK_VERSION(4,0,0)
+static void popup_image_clear_cairo(win_T *wp);
+# endif
+#endif
#ifdef FEAT_IMAGE
static bool popup_image_composites_frames(void);
#endif
@@ -4293,7 +4298,15 @@ popup_hide(win_T *wp)
// rendered until they are removed.
gui_gtk4_remove_image(wp);
#endif
+
wp->w_popup_flags |= POPF_HIDDEN;
+
+#if defined(FEAT_GUI_GTK) && defined(FEAT_IMAGE_CAIRO)
+# if !GTK_CHECK_VERSION(4,0,0)
+ popup_image_clear_cairo(wp);
+# endif
+#endif
+
// Do not decrement b_nwindows, we still reference the buffer.
if (wp->w_winrow + popup_height(wp) >= cmdline_row)
clear_cmdline = TRUE;
@@ -4496,6 +4509,11 @@ popup_free(win_T *wp)
#ifdef FEAT_IMAGE_GDK
if (gui.in_use)
gui_gtk4_remove_image(wp);
+#endif
+#if defined(FEAT_GUI_GTK) && defined(FEAT_IMAGE_CAIRO)
+# if !GTK_CHECK_VERSION(4,0,0)
+ popup_image_clear_cairo(wp);
+# endif
#endif
sign_undefine_by_name(popup_get_sign_name(wp), FALSE);
wp->w_buffer->b_locked = FALSE;
@@ -7100,6 +7118,28 @@ popup_image_clear_kitty(win_T *wp)
}
# endif
+# if defined(FEAT_GUI_GTK) && defined(FEAT_IMAGE_CAIRO)
+# if !GTK_CHECK_VERSION(4,0,0)
+ static void
+popup_image_clear_cairo(win_T *wp)
+{
+ if (!gui.in_use
+ || wp->w_popup_image_emit_cells_w <= 0
+ || wp->w_popup_image_emit_cells_h <= 0)
+ return;
+
+ gui_redraw_block(wp->w_popup_image_emit_row,
+ wp->w_popup_image_emit_col,
+ wp->w_popup_image_emit_row + wp->w_popup_image_emit_cells_h - 1,
+ wp->w_popup_image_emit_col + wp->w_popup_image_emit_cells_w - 1,
+ GUI_MON_NOCLEAR);
+
+ wp->w_popup_image_emit_cells_w = 0;
+ wp->w_popup_image_emit_cells_h = 0;
+}
+# endif
+# endif
+
# if defined(FEAT_IMAGE_SIXEL) || defined(FEAT_IMAGE_KITTY)
/*
* Called after the terminal screen has been cleared: kitty deletes
@@ -7148,7 +7188,7 @@ update_popup_images(void)
}
# endif
-# ifdef FEAT_IMAGE_GDI
+# if defined(FEAT_IMAGE_GDI) || defined(FEAT_IMAGE_CAIRO)
static void
popup_maybe_emit_image_rect(
win_T *wp,
diff --git a/src/version.c b/src/version.c
index fb0e9f310..99f4351a6 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 */
+/**/
+ 727,
/**/
726,
/**/