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 | |
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]>
-rw-r--r-- | eel/eel-canvas.c | 6 | ||||
-rw-r--r-- | libcaja-private/caja-icon-container.c | 10 | ||||
-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 |
5 files changed, 54 insertions, 0 deletions
diff --git a/eel/eel-canvas.c b/eel/eel-canvas.c index 74132149..162c0b44 100644 --- a/eel/eel-canvas.c +++ b/eel/eel-canvas.c @@ -3083,6 +3083,12 @@ eel_canvas_button (GtkWidget *widget, GdkEventButton *event) canvas = EEL_CANVAS (widget); +#if GTK_CHECK_VERSION(3, 0, 0) + /* Don't handle extra mouse button events */ + if (event->button > 5) + return FALSE; +#endif + /* * dispatch normally regardless of the event's window if an item has * has a pointer grab in effect diff --git a/libcaja-private/caja-icon-container.c b/libcaja-private/caja-icon-container.c index 44ccc05d..3e1f7915 100644 --- a/libcaja-private/caja-icon-container.c +++ b/libcaja-private/caja-icon-container.c @@ -4788,6 +4788,9 @@ button_press_event (GtkWidget *widget, container = CAJA_ICON_CONTAINER (widget); container->details->button_down_time = event->time; +#if !GTK_CHECK_VERSION(3, 0, 0) + clicked_on_icon = FALSE; +#endif /* Forget about the old keyboard selection now that we've started mousing. */ clear_keyboard_focus (container); @@ -4799,8 +4802,15 @@ button_press_event (GtkWidget *widget, return TRUE; } +#if GTK_CHECK_VERSION(3, 0, 0) /* Invoke the canvas event handler and see if an item picks up the event. */ clicked_on_icon = GTK_WIDGET_CLASS (caja_icon_container_parent_class)->button_press_event (widget, event); +#else + if (event->button < 6) { /* Don't let the eel canvas consume extra button events, see gnome bug 660006 */ + /* Invoke the canvas event handler and see if an item picks up the event. */ + clicked_on_icon = GTK_WIDGET_CLASS (caja_icon_container_parent_class)->button_press_event (widget, event); + } +#endif /* Move focus to icon container, unless we're still renaming (to avoid exiting * renaming mode) 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) { |