diff options
author | Benjamin Heiniger <[email protected]> | 2021-11-08 20:30:19 +0000 |
---|---|---|
committer | raveit65 <[email protected]> | 2022-07-21 19:33:51 +0200 |
commit | d3bd716f11873cb4c00b585cc4c66ebbf16be636 (patch) | |
tree | 1a44b9883f3abf359410914425a716f9a2f3a786 | |
parent | 3d9d219cb75ad57ca64b41196abc97e9eb623753 (diff) | |
download | caja-d3bd716f11873cb4c00b585cc4c66ebbf16be636.tar.bz2 caja-d3bd716f11873cb4c00b585cc4c66ebbf16be636.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.c | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/src/caja-places-sidebar.c b/src/caja-places-sidebar.c index e8251748..ca3b39c2 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; |