[gedit/gnome-3-28] notebook: Allow closing of tabs with middle mouse button
- From: Sébastien Lafargue <slafargue src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gedit/gnome-3-28] notebook: Allow closing of tabs with middle mouse button
- Date: Thu, 1 Nov 2018 19:16:45 +0000 (UTC)
commit 302e6d380ed01faad5de7fd4f92943b62e044a0d
Author: Corey Daley <cdaley redhat com>
Date: Thu Nov 1 19:30:00 2018 +0100
notebook: Allow closing of tabs with middle mouse button
gedit/gedit-notebook.c | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
---
diff --git a/gedit/gedit-notebook.c b/gedit/gedit-notebook.c
index fcf22c39a..d06dd4983 100644
--- a/gedit/gedit-notebook.c
+++ b/gedit/gedit-notebook.c
@@ -146,7 +146,6 @@ gedit_notebook_button_press_event (GtkWidget *widget,
GtkNotebook *notebook = GTK_NOTEBOOK (widget);
if (event->type == GDK_BUTTON_PRESS &&
- event->button == GDK_BUTTON_SECONDARY &&
(event->state & gtk_accelerator_get_default_mod_mask ()) == 0)
{
gint tab_clicked;
@@ -157,10 +156,19 @@ gedit_notebook_button_press_event (GtkWidget *widget,
GtkWidget *tab;
tab = gtk_notebook_get_nth_page (notebook, tab_clicked);
+ switch (event->button)
+ {
+ case GDK_BUTTON_SECONDARY:
+ g_signal_emit (G_OBJECT (widget), signals[SHOW_POPUP_MENU], 0, event,
tab);
+ return GDK_EVENT_STOP;
- g_signal_emit (G_OBJECT (widget), signals[SHOW_POPUP_MENU], 0, event, tab);
+ case GDK_BUTTON_MIDDLE:
+ g_signal_emit (G_OBJECT (notebook), signals[TAB_CLOSE_REQUEST], 0,
tab);
+ return GDK_EVENT_STOP;
- return GDK_EVENT_STOP;
+ default:
+ break;
+ }
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]