summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Heiniger <[email protected]>2021-11-08 20:30:19 +0000
committerGitHub <[email protected]>2021-11-08 21:30:19 +0100
commit98ff5bd7c34ccf0bbd8be898f57bc69a2b458cf1 (patch)
tree0b1e4f02a2cd40180225ce52573a5b2da4436071
parent112d9cb2562ed38482db85245c930dee31123ea5 (diff)
downloadcaja-98ff5bd7c34ccf0bbd8be898f57bc69a2b458cf1.tar.bz2
caja-98ff5bd7c34ccf0bbd8be898f57bc69a2b458cf1.tar.xz
caja-places-sidebar: fix right-click menu height
* 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;