]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.2.0733: GTK3: GUI slow on X11 since dropping the alpha channel v9.2.0733
authorHirohito Higashi <h.east.727@gmail.com>
Fri, 26 Jun 2026 20:19:50 +0000 (20:19 +0000)
committerChristian Brabandt <cb@256bit.org>
Fri, 26 Jun 2026 20:19:50 +0000 (20:19 +0000)
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) <noreply@anthropic.com>
Signed-off-by: Hirohito Higashi <h.east.727@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
src/gui_gtk_x11.c
src/version.c

index bf16d3e07f65379e6ca837170b9c595848ca215b..d28ccde863b5e6257924faffeaadf1d7b16eb6eb 100644 (file)
@@ -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);
index 03be3800d5a1b861e8d0203e6890375fd4b920c4..742ff9a216407e70a93910c0431964d5d3c233b1 100644 (file)
@@ -759,6 +759,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    733,
 /**/
     732,
 /**/