0
0
mirror of https://github.com/vim/vim.git synced 2025-09-23 03:43:49 -04:00

patch 8.0.1211: cannot reorder tab pages with drag & drop

Problem:    Cannot reorder tab pages with drag & drop.
Solution:   Support drag & drop for GTK and MS-Windows. (Ken Takata, Masamichi
            Abe)
This commit is contained in:
Bram Moolenaar
2017-10-22 15:36:14 +02:00
parent f8e8c0643b
commit ca05aa24af
3 changed files with 126 additions and 1 deletions

View File

@@ -3567,8 +3567,29 @@ on_select_tab(
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,
# if GTK_CHECK_VERSION(3,0,0)
gpointer *page UNUSED,
# else
GtkNotebookPage *page UNUSED,
# endif
gint idx,
gpointer data UNUSED)
{
if (!ignore_tabline_evt)
{
if ((tabpage_index(curtab) - 1) < idx)
tabpage_move(idx + 1);
else
tabpage_move(idx);
}
}
@@ -3658,6 +3679,9 @@ gui_mch_update_tabline(void)
page,
event_box,
nr++);
gtk_notebook_set_tab_reorderable(GTK_NOTEBOOK(gui.tabline),
page,
TRUE);
}
event_box = gtk_notebook_get_tab_label(GTK_NOTEBOOK(gui.tabline), page);
@@ -4093,14 +4117,19 @@ gui_mch_init(void)
# endif
gtk_container_add(GTK_CONTAINER(event_box), label);
gtk_notebook_set_tab_label(GTK_NOTEBOOK(gui.tabline), page, event_box);
gtk_notebook_set_tab_reorderable(GTK_NOTEBOOK(gui.tabline), page, TRUE);
}
# if GTK_CHECK_VERSION(3,0,0)
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);
# else
gtk_signal_connect(GTK_OBJECT(gui.tabline), "switch_page",
GTK_SIGNAL_FUNC(on_select_tab), NULL);
gtk_signal_connect(GTK_OBJECT(gui.tabline), "page-reordered",
GTK_SIGNAL_FUNC(on_tab_reordered), NULL);
# endif
/* Create a popup menu for the tab line and connect it. */