patch 9.2.0556: GTK4: scrollbars not shown and do not respond to clicks

Commit: 
https://github.com/vim/vim/commit/23b4b5536480d68bdab1ee5c2a0c6a6bdcf49f74
Author: Yasuhiro Matsumoto <[email protected]>
Date:   Thu May 28 21:39:54 2026 +0000

    patch 9.2.0556: GTK4: scrollbars not shown and do not respond to clicks
    
    Problem:  GTK4: scrollbars not shown and do not respond to clicks
              (Steven A. Falco)
    Solution: Use GTK_IS_SCROLLBAR and gtk_scrollbar_get_adjustment()
              instead of the GtkRange equivalents, override GtkForm's
              contains() to return FALSE (Yasuhiro Matsumoto).
    
    fixes:  #20307
    closes: #20326
    
    Co-Authored-by: Claude <[email protected]>
    Signed-off-by: Yasuhiro Matsumoto <[email protected]>
    Signed-off-by: Christian Brabandt <[email protected]>

diff --git a/src/gui_gtk4.c b/src/gui_gtk4.c
index b8f3c53c3..dace72ae4 100644
--- a/src/gui_gtk4.c
+++ b/src/gui_gtk4.c
@@ -494,8 +494,8 @@ gui_mch_init(void)
     gui.formwin = gui_gtk_form_new();
     gtk_widget_set_name(gui.formwin, "vim-gtk-form");
     // formwin is overlaid on top of drawarea for scrollbar positioning.
-    // Disable input targeting so mouse events pass through to drawarea.
-    gtk_widget_set_can_target(gui.formwin, FALSE);
+    // GtkForm's contains() returns FALSE so empty-area clicks fall through
+    // to the drawarea, while the scrollbar children still receive events.
 
     // The drawing area for the editor content.
     // Placed in an overlay so it fills the formwin, with scrollbars on top.
@@ -4028,10 +4028,10 @@ gui_mch_set_scrollbar_thumb(scrollbar_T *sb, long val, 
long size, long max)
 
     if (sb->id == NULL)
        return;
-    if (!GTK_IS_WIDGET(sb->id) || !GTK_IS_RANGE(sb->id))
+    if (!GTK_IS_WIDGET(sb->id) || !GTK_IS_SCROLLBAR(sb->id))
        return;
 
-    adj = gtk_range_get_adjustment(GTK_RANGE(sb->id));
+    adj = gtk_scrollbar_get_adjustment(GTK_SCROLLBAR(sb->id));
     gtk_adjustment_set_lower(adj, 0.0);
     gtk_adjustment_set_upper(adj, (gdouble)max + 1);
     gtk_adjustment_set_value(adj, (gdouble)val);
@@ -4097,9 +4097,9 @@ gui_mch_create_scrollbar(scrollbar_T *sb, int orient)
     else
        sb->id = gtk_scrollbar_new(GTK_ORIENTATION_VERTICAL, NULL);
 
-    if (sb->id != NULL && GTK_IS_RANGE(sb->id))
+    if (sb->id != NULL && GTK_IS_SCROLLBAR(sb->id))
     {
-       GtkAdjustment *adj = gtk_range_get_adjustment(GTK_RANGE(sb->id));
+       GtkAdjustment *adj = 
gtk_scrollbar_get_adjustment(GTK_SCROLLBAR(sb->id));
 
        gtk_widget_set_visible(sb->id, FALSE);
        gui_gtk_form_put(GTK_FORM(gui.formwin), sb->id, 0, 0);
diff --git a/src/gui_gtk4_f.c b/src/gui_gtk4_f.c
index 759f1065b..80aa7a48d 100644
--- a/src/gui_gtk4_f.c
+++ b/src/gui_gtk4_f.c
@@ -36,6 +36,7 @@ static void form_measure(GtkWidget *widget, GtkOrientation 
orientation,
 static void form_size_allocate(GtkWidget *widget, int width, int height,
        int baseline);
 static void form_snapshot(GtkWidget *widget, GtkSnapshot *snapshot);
+static gboolean form_contains(GtkWidget *widget, double x, double y);
 static void form_dispose(GObject *object);
 static void form_position_child(GtkForm *form, GtkFormChild *child,
        gboolean force_allocate);
@@ -173,6 +174,7 @@ gui_gtk_form_class_init(GtkFormClass *klass)
     widget_class->measure = form_measure;
     widget_class->size_allocate = form_size_allocate;
     widget_class->snapshot = form_snapshot;
+    widget_class->contains = form_contains;
 }
 
     static void
@@ -265,6 +267,14 @@ form_snapshot(GtkWidget *widget, GtkSnapshot *snapshot)
     }
 }
 
+// Make the form itself input-transparent so clicks on its empty area fall
+// through to the drawarea below, while the scrollbar children stay pickable.
+    static gboolean
+form_contains(GtkWidget *widget UNUSED, double x UNUSED, double y UNUSED)
+{
+    return FALSE;
+}
+
     static void
 form_dispose(GObject *object)
 {
diff --git a/src/version.c b/src/version.c
index 2a6eb7972..d17b4d586 100644
--- a/src/version.c
+++ b/src/version.c
@@ -729,6 +729,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    556,
 /**/
     555,
 /**/

-- 
-- 
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/E1wT1Ga-00D0le-PW%40256bit.org.

Raspunde prin e-mail lui