[evince] Bind mouse back/forward buttons to history navigation.
- From: Carlos Garcia Campos <carlosgc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evince] Bind mouse back/forward buttons to history navigation.
- Date: Mon, 27 Nov 2017 17:06:04 +0000 (UTC)
commit 1ff42625f28246d790694625065c2476aaf03f19
Author: Casey Jao <casey jao gmail com>
Date: Fri Sep 8 19:53:50 2017 -0700
Bind mouse back/forward buttons to history navigation.
shell/ev-window.c:
*Listen for mouse back/forward button presses.
https://bugzilla.gnome.org/show_bug.cgi?id=787464
shell/ev-window.c | 24 ++++++++++++++++++++++++
1 files changed, 24 insertions(+), 0 deletions(-)
---
diff --git a/shell/ev-window.c b/shell/ev-window.c
index 0edab3a..0fe49ba 100644
--- a/shell/ev-window.c
+++ b/shell/ev-window.c
@@ -100,6 +100,9 @@
#include <X11/extensions/XInput2.h>
#endif
+#define MOUSE_BACK_BUTTON 8
+#define MOUSE_FORWARD_BUTTON 9
+
typedef enum {
PAGE_MODE_DOCUMENT,
PAGE_MODE_PASSWORD
@@ -5641,6 +5644,26 @@ ev_window_key_press_event (GtkWidget *widget,
}
static gboolean
+ev_window_button_press_event (GtkWidget *widget,
+ GdkEventButton *event)
+{
+ EvWindow *window = EV_WINDOW (widget);
+
+ switch (event->button) {
+ case MOUSE_BACK_BUTTON:
+ ev_history_go_back (window->priv->history);
+ return TRUE;
+ case MOUSE_FORWARD_BUTTON:
+ ev_history_go_forward (window->priv->history);
+ return TRUE;
+ default:
+ break;
+ }
+
+ return FALSE;
+}
+
+static gboolean
ev_window_delete_event (GtkWidget *widget,
GdkEventAny *event)
{
@@ -5659,6 +5682,7 @@ ev_window_class_init (EvWindowClass *ev_window_class)
widget_class->key_press_event = ev_window_key_press_event;
widget_class->window_state_event = ev_window_state_event;
widget_class->drag_data_received = ev_window_drag_data_received;
+ widget_class->button_press_event = ev_window_button_press_event;
nautilus_sendto = g_find_program_in_path ("nautilus-sendto");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]