summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Heiniger <[email protected]>2021-11-08 20:30:19 +0000
committerraveit65 <[email protected]>2021-11-08 21:34:54 +0100
commit9e98a57e4be91b38c4318693492ba6a529407a86 (patch)
tree6d3ed5f5aca229e587a56f5b014eab6e9b959c7f
parent41293bc8fe116617c418e0e5ecfb3ca10d6b8a24 (diff)
downloadcaja-9e98a57e4be91b38c4318693492ba6a529407a86.tar.bz2
caja-9e98a57e4be91b38c4318693492ba6a529407a86.tar.xz
caja-places-sidebar: fix right-click menu height
- prevent error and right-click menu from appearing when clicking empty area
-rw-r--r--src/caja-places-sidebar.c25
1 files changed, 18 insertions, 7 deletions
diff --git a/src/caja-places-sidebar.c b/src/caja-places-sidebar.c
index 2b8fe2e2..1120caed 100644
--- a/src/caja-places-sidebar.c
+++ b/src/caja-places-sidebar.c
@@ -2884,16 +2884,16 @@ bookmarks_button_release_event_cb (GtkWidget *widget,
}
tree_view = GTK_TREE_VIEW (widget);
- model = gtk_tree_view_get_model (tree_view);
if (event->button == 1)
{
-
if (event->window != gtk_tree_view_get_bin_window (tree_view))
{
return FALSE;
}
+ model = gtk_tree_view_get_model (tree_view);
+
gtk_tree_view_get_path_at_pos (tree_view, (int) event->x, (int) event->y,
&path, NULL, NULL, NULL);
@@ -2901,6 +2901,21 @@ bookmarks_button_release_event_cb (GtkWidget *widget,
gtk_tree_path_free (path);
}
+ else if (event->button == 3)
+ {
+ gtk_tree_view_get_path_at_pos (tree_view, (int) event->x, (int) event->y,
+ &path, NULL, NULL, NULL);
+
+ if (path != NULL)
+ {
+ gtk_tree_view_set_cursor(tree_view, path, NULL, FALSE);
+ gtk_tree_path_free (path);
+
+ bookmarks_popup_menu (sidebar, event);
+
+ return TRUE;
+ }
+ }
return FALSE;
}
@@ -3016,11 +3031,7 @@ bookmarks_button_press_event_cb (GtkWidget *widget,
return TRUE;
}
- if (event->button == 3)
- {
- bookmarks_popup_menu (sidebar, event);
- }
- else if (event->button == 2)
+ if (event->button == 2)
{
GtkTreeModel *model;
GtkTreePath *path;