From: Foxe Chen Date: Mon, 27 Jul 2026 19:13:22 +0000 (+0000) Subject: patch 9.2.0861: GTK4: bleed region updates in jumps X-Git-Tag: v9.2.0861^0 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=074e419c44620a58df88dead0c31b850241afda8;p=thirdparty%2Fvim.git 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 Signed-off-by: Christian Brabandt --- diff --git a/src/gui.c b/src/gui.c index 0c7b39be0b..d58f9f2cc8 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 486ed38a0e..6e5dbfda12 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 af55b50fcf..1541e45640 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 131299e89f..a183147a66 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, /**/