Commit: patch 9.2.0861: GTK4: bleed region updates in jumps

Christian Brabandt <[email protected]> Mon, 27 Jul 2026 21:30:04 +0200
Newsgroups gmane.editors.vim.devel
Message-ID <[email protected]>
patch 9.2.0861: GTK4: bleed region updates in jumps

Commit: https://github.com/vim/vim/commit/074e419c44620a58df88dead0c31b850241afda8
Author: Foxe Chen <[email protected]>
Date:   Mon Jul 27 19:13:22 2026 +0000

    patch 9.2.0861: GTK4: bleed region updates in jumps
    
    Problem:  In the GTK4 GUI (GtkSnapshot) the bleed region is only
              repainted when the text grid changes by a whole cell,
              so during a resize it updates in jumps of several pixels
              instead of following the window edge smoothly.
    Solution: Redraw the draw area whenever the bleed values change
              (Foxe Chen).
    
    closes: #20851
    
    Signed-off-by: Foxe Chen <[email protected]>
    Signed-off-by: Christian Brabandt <[email protected]>

diff --git a/src/gui.c b/src/gui.c
index 0c7b39be0..d58f9f2cc 100644
--- a/src/gui.c
+++ b/src/gui.c
@@ -1727,7 +1727,7 @@ again:
     gui_update_scrollbars(TRUE);
     gui_update_cursor(FALSE, TRUE);
 #if defined(FEAT_GUI_GTK) && defined(USE_GTK4_SNAPSHOT)
-    gui_gtk_calculate_bleed(pixel_width, pixel_height);
+    gui_gtk4_calculate_bleed(pixel_width, pixel_height);
 #endif
 #if defined(FEAT_XIM) && !defined(FEAT_GUI_GTK)
     xim_set_status_area();
@@ -1900,7 +1900,7 @@ gui_set_shellsize(
     gui_reset_scroll_region();
 
 #if defined(FEAT_GUI_GTK) && defined(USE_GTK4_SNAPSHOT)
-    gui_gtk_calculate_bleed(width, height);
+    gui_gtk4_calculate_bleed(width, height);
 #endif
 }
 
diff --git a/src/gui_gtk4.c b/src/gui_gtk4.c
index 486ed38a0..6e5dbfda1 100644
--- a/src/gui_gtk4.c
+++ b/src/gui_gtk4.c
@@ -5018,8 +5018,11 @@ gui_mch_set_text_area_pos(int x, int y, int w, int h)
  * after all UI elements are positioned and resized.
  */
     void
-gui_gtk_calculate_bleed(int width, int height)
+gui_gtk4_calculate_bleed(int width, int height)
 {
+    int old_right = gui.bleed_right;
+    int old_bot = gui.bleed_bot;
+
     gui.bleed_right = width - last_text_area_w;
     gui.bleed_bot = height - last_text_area_h;
 
@@ -5035,6 +5038,10 @@ gui_gtk_calculate_bleed(int width, int height)
 	gui.bleed_right = 0;
     if (gui.bleed_bot < 0)
 	gui.bleed_bot = 0;
+
+    // Make sure to update draw area if changed
+    if (old_right != gui.bleed_right || old_bot != gui.bleed_bot)
+	gtk_widget_queue_draw(GTK_WIDGET(gui.drawarea));
 }
 #endif
 
diff --git a/src/proto/gui_gtk4.pro b/src/proto/gui_gtk4.pro
index af55b50fc..1541e4564 100644
--- a/src/proto/gui_gtk4.pro
+++ b/src/proto/gui_gtk4.pro
@@ -106,7 +106,7 @@ int gui_mch_get_scrollbar_ypadding(void);
 void gui_mch_create_scrollbar(scrollbar_T *sb, int orient);
 void gui_mch_destroy_scrollbar(scrollbar_T *sb);
 void gui_mch_set_text_area_pos(int x, int y, int w, int h);
-void gui_gtk_calculate_bleed(int width, int height);
+void gui_gtk4_calculate_bleed(int width, int height);
 char_u *gui_mch_browse(int saving, char_u *title, char_u *dflt, char_u *ext, char_u *initdir, char_u *filter);
 char_u *gui_mch_browsedir(char_u *title, char_u *initdir);
 int gui_mch_dialog(int type, char_u *title, char_u *message, char_u *buttons, int def_but, char_u *textfield, int ex_cmd);
diff --git a/src/version.c b/src/version.c
index 131299e89..a183147a6 100644
--- a/src/version.c
+++ b/src/version.c
@@ -758,6 +758,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    861,
 /**/
     860,
 /**/

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups "vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To view this discussion visit https://groups.google.com/d/msgid/vim_dev/E1woR1Y-00H7OP-Bq%40256bit.org.