Commit: patch 9.2.0564: GTK4: tabline does not respond to mouse clicks

2 views
Skip to first unread message

Christian Brabandt

unread,
May 29, 2026, 4:00:13 PM (19 hours ago) May 29
to vim...@googlegroups.com
patch 9.2.0564: GTK4: tabline does not respond to mouse clicks

Commit: https://github.com/vim/vim/commit/2c5b3838075061dea427ef304dd89c136d198221
Author: Foxe Chen <chen...@gmail.com>
Date: Fri May 29 19:47:24 2026 +0000

patch 9.2.0564: GTK4: tabline does not respond to mouse clicks

Problem: GTK4: tabline does not respond to mouse clicks
Solution: Connect on_select_tab() to "switch-page" to fire the tabline
event, and on_tab_reordered() to "page-reordered" to call
tabpage_move() with the new index (Foxe Chen).

closes: #20362

Signed-off-by: Foxe Chen <chen...@gmail.com>
Signed-off-by: Christian Brabandt <c...@256bit.org>

diff --git a/src/gui_gtk4.c b/src/gui_gtk4.c
index dace72ae4..b5e134b8a 100644
--- a/src/gui_gtk4.c
+++ b/src/gui_gtk4.c
@@ -278,6 +278,10 @@ static void focus_out_event(GtkEventControllerFocus *controller, gpointer data);
#ifdef FEAT_DND
static gboolean drop_cb(GtkDropTarget *target, const GValue *value, double x, double y, gpointer data);
#endif
+#ifdef FEAT_GUI_TABLINE
+static void on_select_tab(GtkNotebook *notebook, gpointer *page, gint idx, gpointer data);
+static void on_tab_reordered(GtkNotebook *notebook, gpointer *page, gint idx, gpointer data);
+#endif
static void mainwin_destroy_cb(GObject *object, gpointer data);
static gboolean delete_event_cb(GtkWindow *window, gpointer data);
static void mainwin_fullscreened_cb(GObject *obj, GParamSpec *pspec, gpointer user_data);
@@ -488,6 +492,11 @@ gui_mch_init(void)
gtk_notebook_set_scrollable(GTK_NOTEBOOK(gui.tabline), TRUE);
gtk_widget_set_visible(gui.tabline, FALSE);
gtk_box_append(GTK_BOX(vbox), gui.tabline);
+
+ g_signal_connect(G_OBJECT(gui.tabline), "switch-page",
+ G_CALLBACK(on_select_tab), NULL);
+ g_signal_connect(G_OBJECT(gui.tabline), "page-reordered",
+ G_CALLBACK(on_tab_reordered), NULL);
#endif

// The form widget manages absolute positioning of scrollbars.
@@ -2550,6 +2559,39 @@ gui_mch_set_curtab(int nr)
if (gui.tabline != NULL)
gtk_notebook_set_current_page(GTK_NOTEBOOK(gui.tabline), nr - 1);
}
+
+/*
+ * Handle selecting one of the tabs.
+ */
+ static void
+on_select_tab(
+ GtkNotebook *notebook UNUSED,
+ gpointer *page UNUSED,
+ gint idx,
+ gpointer data UNUSED)
+{
+ if (!ignore_tabline_evt)
+ send_tabline_event(idx + 1);
+}
+
+/*
+ * Handle reordering the tabs (using D&D).
+ */
+ static void
+on_tab_reordered(
+ GtkNotebook *notebook UNUSED,
+ gpointer *page UNUSED,
+ gint idx,
+ gpointer data UNUSED)
+{
+ if (ignore_tabline_evt)
+ return;
+
+ if ((tabpage_index(curtab) - 1) < idx)
+ tabpage_move(idx + 1);
+ else
+ tabpage_move(idx);
+}
#endif

/*
diff --git a/src/version.c b/src/version.c
index d3977ad1f..31d5a2305 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 */
+/**/
+ 564,
/**/
563,
/**/
Reply all
Reply to author
Forward
0 new messages