mirror of
https://gitlab.gnome.org/GNOME/nautilus
synced 2024-09-12 20:41:34 +00:00
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.
This commit is contained in:
parent
13a8d3efac
commit
873156cf85
|
@ -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
|
||||
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);
|
||||
|
||||
|
|
Loading…
Reference in a new issue