[gtk+] notebook: Don't steal right-clicks from content
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] notebook: Don't steal right-clicks from content
- Date: Sat, 7 Oct 2017 23:55:56 +0000 (UTC)
commit 9f8f3fc7acc7bb18b51492e850b4c33c6c3114a1
Author: Matthias Clasen <mclasen redhat com>
Date: Sat Oct 7 19:26:39 2017 -0400
notebook: Don't steal right-clicks from content
We only want to pop up the context menu in the tab strip.
gtk/gtknotebook.c | 16 +++++++++++++++-
1 files changed, 15 insertions(+), 1 deletions(-)
---
diff --git a/gtk/gtknotebook.c b/gtk/gtknotebook.c
index 144a5fc..91671ad 100644
--- a/gtk/gtknotebook.c
+++ b/gtk/gtknotebook.c
@@ -2222,6 +2222,20 @@ gtk_notebook_page_tab_label_is_visible (GtkNotebookPage *page)
gtk_widget_get_child_visible (page->tab_label);
}
+static gboolean
+in_tabs (GtkNotebook *notebook,
+ gdouble x,
+ gdouble y)
+{
+ GtkNotebookPrivate *priv = notebook->priv;
+ GtkAllocation allocation;
+
+ gtk_widget_get_own_allocation (priv->tabs_widget, &allocation);
+ gtk_widget_translate_coordinates (priv->tabs_widget, GTK_WIDGET (notebook),
+ allocation.x, allocation.y, &allocation.x, &allocation.y);
+ return gdk_rectangle_contains_point (&allocation, x, y);
+}
+
static GList*
get_tab_at_pos (GtkNotebook *notebook,
gdouble x,
@@ -2281,7 +2295,7 @@ gtk_notebook_gesture_pressed (GtkGestureMultiPress *gesture,
return;
}
- if (priv->menu && gdk_event_triggers_context_menu (event))
+ if (in_tabs (notebook, x, y) && priv->menu && gdk_event_triggers_context_menu (event))
{
gtk_menu_popup_at_pointer (GTK_MENU (priv->menu), event);
return;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]