patch 9.2.0733: GTK3: GUI slow on X11 since dropping the alpha channel
Commit:
https://github.com/vim/vim/commit/b57390fee781a4872e70f2441709de80fb7ba8fd
Author: Hirohito Higashi <
h.eas...@gmail.com>
Date: Fri Jun 26 20:19:50 2026 +0000
patch 9.2.0733: GTK3: GUI slow on X11 since dropping the alpha channel
Problem: With the GTK3 GUI, scrolling and moving the window are slow on
X11 on setups where the accelerated drawing path expects an
ARGB surface (after v9.2.0646)
Solution: Choose the offscreen surface content per display backend: keep the
alpha-less surface on Wayland, where it avoids needless alpha
compositing, and use an ARGB surface on X11 again, which is the
accelerated path there, restoring the speed (Hirohito Higashi).
fixes: #20603
closes: #20634
Co-Authored-By: Claude Opus 4.8 (1M context) <
nor...@anthropic.com>
Signed-off-by: Hirohito Higashi <
h.eas...@gmail.com>
Signed-off-by: Christian Brabandt <
c...@256bit.org>
diff --git a/src/gui_gtk_x11.c b/src/gui_gtk_x11.c
index bf16d3e07..d28ccde86 100644
--- a/src/gui_gtk_x11.c
+++ b/src/gui_gtk_x11.c
@@ -801,6 +801,17 @@ draw_event(GtkWidget *widget UNUSED,
return FALSE;
}
+/*
+ * On Wayland an alpha-less surface avoids needless alpha compositing; on X11
+ * the ARGB (Render) path is the accelerated one, so keep the alpha there.
+ */
+# ifdef GDK_WINDOWING_WAYLAND
+# define GUI_GTK_SURFACE_CONTENT \
+ (gui.is_wayland ? CAIRO_CONTENT_COLOR : CAIRO_CONTENT_COLOR_ALPHA)
+# else
+# define GUI_GTK_SURFACE_CONTENT CAIRO_CONTENT_COLOR_ALPHA
+# endif
+
# if GTK_CHECK_VERSION(3,10,0)
static gboolean
scale_factor_event(GtkWidget *widget,
@@ -814,7 +825,7 @@ scale_factor_event(GtkWidget *widget,
gtk_window_get_size(GTK_WINDOW(gui.mainwin), &w, &h);
gui.surface = gdk_window_create_similar_surface(
gtk_widget_get_window(widget),
- CAIRO_CONTENT_COLOR,
+ GUI_GTK_SURFACE_CONTENT,
w, h);
int usable_height = h;
@@ -2900,7 +2911,7 @@ drawarea_realize_cb(GtkWidget *widget, gpointer data UNUSED)
#if GTK_CHECK_VERSION(3,0,0)
gui.surface = gdk_window_create_similar_surface(
gtk_widget_get_window(widget),
- CAIRO_CONTENT_COLOR,
+ GUI_GTK_SURFACE_CONTENT,
gtk_widget_get_allocated_width(widget),
gtk_widget_get_allocated_height(widget));
#else
@@ -3035,7 +3046,7 @@ drawarea_configure_event_cb(GtkWidget *widget,
gui.surface = gdk_window_create_similar_surface(
gtk_widget_get_window(widget),
- CAIRO_CONTENT_COLOR,
+ GUI_GTK_SURFACE_CONTENT,
event->width, event->height);
gtk_widget_queue_draw(widget);
diff --git a/src/version.c b/src/version.c
index 03be3800d..742ff9a21 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 */
+/**/
+ 733,
/**/
732,
/**/