Commit 873156cf authored by Ernestas Kulik's avatar Ernestas Kulik 🦑

window: Check if a tab was hit on right click

Since we have to handle the event in reverse order (because GtkTreeView
claims the event sequence in the capture phase, meaning that the events
won’t bubble up), the context menu for notebook tabs will open
everywhere, because the event handler is not stopped by those lower in
the hierarchy. A simple check if the cursor is on a tab will prevent
that.
parent 13a8d3ef
......@@ -222,6 +222,14 @@ nautilus_notebook_contains_slot (NautilusNotebook *notebook,
return found;
}
gboolean
nautilus_notebook_content_area_hit (NautilusNotebook *notebook,
gint x,
gint y)
{
return find_tab_num_at_pos (notebook, x, y) == -1;
}
void
nautilus_notebook_sync_loading (NautilusNotebook *notebook,
NautilusWindowSlot *slot)
......
......@@ -54,4 +54,8 @@ void nautilus_notebook_next_page (NautilusNotebook *notebook);
gboolean nautilus_notebook_contains_slot (NautilusNotebook *notebook,
NautilusWindowSlot *slot);
G_END_DECLS
\ No newline at end of file
gboolean nautilus_notebook_content_area_hit (NautilusNotebook *notebook,
gint x,
gint y);
G_END_DECLS
......@@ -2027,10 +2027,18 @@ notebook_button_press_cb (GtkGestureMultiPress *gesture,
gpointer user_data)
{
NautilusWindow *window;
NautilusWindowPrivate *priv;
GdkEventSequence *sequence;
const GdkEvent *event;
window = NAUTILUS_WINDOW (user_data);
priv = nautilus_window_get_instance_private (window);
if (nautilus_notebook_content_area_hit (NAUTILUS_NOTEBOOK (priv->notebook), x, y))
{
return;
}
sequence = gtk_gesture_single_get_current_sequence (GTK_GESTURE_SINGLE (gesture));
event = gtk_gesture_get_last_event (GTK_GESTURE (gesture), sequence);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment