]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.2.0727: popup images not rendered correctly when unfocused v9.2.0727
authorChristoffer Aasted <dezzadk@gmail.com>
Wed, 24 Jun 2026 20:44:15 +0000 (20:44 +0000)
committerChristian Brabandt <cb@256bit.org>
Wed, 24 Jun 2026 20:44:15 +0000 (20:44 +0000)
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 <dezzadk@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
src/gui.c
src/gui.h
src/popupwin.c
src/version.c

index 0ca09d8eb1368243493c7a7cff60682e70338a3d..6e898f1c38cf2d2439763af9ba53ae260fed2ad5 100644 (file)
--- 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)
index 78ad3a09bbc3f6ca091fade66ca18d5bba7aa624..56e86d7a7f7cbc1be2ec1fd4b8b3a5fe490f6ddd 100644 (file)
--- 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
index d3d27a2e173c4b765f8d9d3c73184cdb32fb72ec..a497ea58cab9fd73f5819293d5101e360f61560c 100644 (file)
@@ -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,
index fb0e9f310b176da71e17dc5d481c4bc7699b2e42..99f4351a6089163ce370efafe2be81b1172a65e0 100644 (file)
@@ -759,6 +759,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    727,
 /**/
     726,
 /**/