diff options
author | Martin Matuska <[email protected]> | 2016-08-05 14:58:37 +0200 |
---|---|---|
committer | raveit65 <[email protected]> | 2016-10-16 11:50:33 +0200 |
commit | 625a06c0a0781025693a6299b721b6bc7a065c1a (patch) | |
tree | 1252ca50706bd304cd5632d9d96e227557e6ea42 /src | |
parent | dffb0850e530855fe67a4a6e8768c4b9ecf17a62 (diff) | |
download | caja-625a06c0a0781025693a6299b721b6bc7a065c1a.tar.bz2 caja-625a06c0a0781025693a6299b721b6bc7a065c1a.tar.xz |
support back and forward mouse buttons to navigate
Fixes https://github.com/mate-desktop/caja/issues/78
Co-Authored-By: Oliver Joos <[email protected]>
Co-Authored-By: Nelson Benitez Leon <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/caja-navigation-window.c | 4 | ||||
-rw-r--r-- | src/caja-navigation-window.h | 4 | ||||
-rw-r--r-- | src/file-manager/fm-list-view.c | 30 |
3 files changed, 38 insertions, 0 deletions
diff --git a/src/caja-navigation-window.c b/src/caja-navigation-window.c index a0c75ae6..f5127b8f 100644 --- a/src/caja-navigation-window.c +++ b/src/caja-navigation-window.c @@ -570,7 +570,11 @@ caja_navigation_window_key_press_event (GtkWidget *widget, return GTK_WIDGET_CLASS (caja_navigation_window_parent_class)->key_press_event (widget, event); } +#if GTK_CHECK_VERSION(3, 0, 0) static gboolean +#else +gboolean +#endif caja_navigation_window_button_press_event (GtkWidget *widget, GdkEventButton *event) { diff --git a/src/caja-navigation-window.h b/src/caja-navigation-window.h index 18c713bd..231d140c 100644 --- a/src/caja-navigation-window.h +++ b/src/caja-navigation-window.h @@ -115,5 +115,9 @@ gboolean caja_navigation_window_is_in_temporary_navigation_bar (GtkWidget *widge CajaNavigationWindow *window); gboolean caja_navigation_window_is_in_temporary_search_bar (GtkWidget *widget, CajaNavigationWindow *window); +#if !GTK_CHECK_VERSION(3, 0, 0) +gboolean caja_window_button_press_event (GtkWidget *widget, + GdkEventButton *event); +#endif #endif diff --git a/src/file-manager/fm-list-view.c b/src/file-manager/fm-list-view.c index 46f6c143..999254d0 100644 --- a/src/file-manager/fm-list-view.c +++ b/src/file-manager/fm-list-view.c @@ -665,6 +665,9 @@ button_press_callback (GtkWidget *widget, GdkEventButton *event, gpointer callba FMListView *view; GtkTreeView *tree_view; GtkTreePath *path; +#if !GTK_CHECK_VERSION(3, 0, 0) + GtkWidget *caja_window; +#endif gboolean call_parent; GtkTreeSelection *selection; GtkWidgetClass *tree_view_class; @@ -680,6 +683,14 @@ button_press_callback (GtkWidget *widget, GdkEventButton *event, gpointer callba tree_view_class = GTK_WIDGET_GET_CLASS (tree_view); selection = gtk_tree_view_get_selection (tree_view); +#if GTK_CHECK_VERSION(3, 0, 0) + /* Don't handle extra mouse buttons here */ + if (event->button > 5) + { + return FALSE; + } +#endif + if (event->window != gtk_tree_view_get_bin_window (tree_view)) { return FALSE; @@ -849,6 +860,13 @@ button_press_callback (GtkWidget *widget, GdkEventButton *event, gpointer callba } } +#if !GTK_CHECK_VERSION(3, 0, 0) + if (event->button > 5) { + caja_window = GTK_WIDGET (fm_directory_view_get_caja_window (FM_DIRECTORY_VIEW (view))); + call_parent = !caja_navigation_window_button_press_event (caja_window, event); + } +#endif + if (call_parent) { tree_view_class->button_press_event (widget, event); @@ -887,10 +905,22 @@ button_press_callback (GtkWidget *widget, GdkEventButton *event, gpointer callba view->details->double_click_path[1] = view->details->double_click_path[0]; view->details->double_click_path[0] = NULL; } +#if GTK_CHECK_VERSION(3, 0, 0) /* Deselect if people click outside any row. It's OK to let default code run; it won't reselect anything. */ gtk_tree_selection_unselect_all (gtk_tree_view_get_selection (tree_view)); tree_view_class->button_press_event (widget, event); +#else + if (event->button > 5) { + caja_window = GTK_WIDGET (fm_directory_view_get_caja_window (FM_DIRECTORY_VIEW (view))); + call_parent = !caja_navigation_window_button_press_event (caja_window, event); + } else { + /* Deselect if people click outside any row. It's OK to + let default code run; it won't reselect anything. */ + gtk_tree_selection_unselect_all (gtk_tree_view_get_selection (tree_view)); + tree_view_class->button_press_event (widget, event); + } +#endif if (event->button == 3) { |