]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.2.0861: GTK4: bleed region updates in jumps v9.2.0861
authorFoxe Chen <chen.foxe@gmail.com>
Mon, 27 Jul 2026 19:13:22 +0000 (19:13 +0000)
committerChristian Brabandt <cb@256bit.org>
Mon, 27 Jul 2026 19:22:47 +0000 (19:22 +0000)
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 <chen.foxe@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
src/gui.c
src/gui_gtk4.c
src/proto/gui_gtk4.pro
src/version.c

index 0c7b39be0b3cf33c212e486969b244befaa70e61..d58f9f2cc883718a7599889dbec8e8f1f13eb9fa 100644 (file)
--- 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
 }
 
index 486ed38a0e3340a120fbc6191a7000e209055b8c..6e5dbfda12a72000f60b3a011bfe931a67e0bf47 100644 (file)
@@ -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
 
index af55b50fcfd524f15f4c7846c60fa05affcae9ea..1541e4564039eb6f0127a087279943c36b1b5815 100644 (file)
@@ -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);
index 131299e89f0c6c02060959a0c03d9223a00ba677..a183147a662f1c313f16c3b58a1e75db59be4f40 100644 (file)
@@ -758,6 +758,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    861,
 /**/
     860,
 /**/