summarylogtreecommitdiffstats
path: root/09-middle-click-closes-tab.patch
blob: 65bbb1387559cd3261390a415a4ff94e8b666da8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
diff --git a/src/ephy-notebook.c b/src/ephy-notebook.c
index 3947ff681..07c0afa7f 100644
--- a/src/ephy-notebook.c
+++ b/src/ephy-notebook.c
@@ -248,6 +248,16 @@ button_press_cb (EphyNotebook   *notebook,
 		g_action_activate (action, NULL);
 	}
 
+  /* Close the tab if it gets middle clicked */
+  if (event->type == GDK_BUTTON_PRESS &&
+      event->button == 2 &&
+      (event->state & gtk_accelerator_get_default_mod_mask ()) == 0)
+  {
+    GtkWidget *tab;
+    tab = gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook), tab_clicked);
+    g_signal_emit (notebook, signals[TAB_CLOSE_REQUEST], 0, tab);
+  }
+
   return GDK_EVENT_PROPAGATE;
 }