summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZenWalker <[email protected]>2016-12-20 02:26:59 +0100
committermonsta <[email protected]>2017-01-30 15:55:10 +0400
commit371be35f994378dfb61796a272061d1cb4be3d26 (patch)
tree4ffd224266ffa5e68660d57ce2f7b1a1e0ce6fd0
parentbfccb7704338f157477f2faa94d70247ea23dd48 (diff)
downloadmate-terminal-371be35f994378dfb61796a272061d1cb4be3d26.tar.bz2
mate-terminal-371be35f994378dfb61796a272061d1cb4be3d26.tar.xz
middle click on a tab: Fix active tab position after closing another tab
and now the middle click works like click on X
-rw-r--r--src/terminal-window.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/terminal-window.c b/src/terminal-window.c
index bbe82f8..d1019b1 100644
--- a/src/terminal-window.c
+++ b/src/terminal-window.c
@@ -2904,12 +2904,17 @@ notebook_button_press_cb (GtkWidget *widget,
GtkWidget *menu;
GtkAction *action;
int tab_clicked;
+ int page_num;
+ int before_pages;
+ int later_pages;
if (event->type == GDK_BUTTON_PRESS && event->button == 2)
{
tab_clicked = find_tab_num_at_pos (notebook, event->x_root, event->y_root);
if (tab_clicked >= 0)
{
+ before_pages = gtk_notebook_get_n_pages (GTK_NOTEBOOK (notebook));
+ page_num = gtk_notebook_get_current_page (notebook);
gtk_notebook_set_current_page (notebook, tab_clicked);
TerminalScreen *active_screen = priv->active_screen;
@@ -2917,7 +2922,19 @@ notebook_button_press_cb (GtkWidget *widget,
{
update_tab_visibility (window, -1);
gtk_notebook_remove_page(notebook, tab_clicked);
+
+ }
+
+ later_pages = gtk_notebook_get_n_pages (GTK_NOTEBOOK (notebook));
+
+ if (before_pages > later_pages) {
+ if (tab_clicked > page_num)
+ gtk_notebook_set_current_page (notebook, page_num);
+ else if (tab_clicked < page_num)
+ gtk_notebook_set_current_page (notebook, page_num - 1);
}
+ else
+ gtk_notebook_set_current_page (notebook, page_num);
}
}