From 456ba9346d5ea0417b5c94f55ea8b4047dc1fd66 Mon Sep 17 00:00:00 2001 From: Yan Pashkovsky Date: Sun, 15 Oct 2017 20:26:56 +0300 Subject: [PATCH] support for fwd bkwd mouse buttons --- src/editor.c | 17 ++++++++++++++++- src/editor.h | 1 + src/keyfile.c | 2 ++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/editor.c b/src/editor.c index c60a897e1e..7adbd8e7c0 100644 --- a/src/editor.c +++ b/src/editor.c @@ -45,6 +45,7 @@ #include "geanyobject.h" #include "highlighting.h" #include "keybindings.h" +#include "navqueue.h" #include "main.h" #include "prefs.h" #include "projectprivate.h" @@ -326,7 +327,7 @@ static gboolean on_editor_button_press_event(GtkWidget *widget, GdkEventButton * } /* calls the edit popup menu in the editor */ - if (event->button == 3) + else if (event->button == 3) { gboolean can_goto; @@ -349,6 +350,20 @@ static gboolean on_editor_button_press_event(GtkWidget *widget, GdkEventButton * return TRUE; } + + else if (event->button == 8 /*backwards*/ && editor_prefs.mouse_back_forward_enabled) + { + navqueue_go_back(); + } + + else if (event->button == 9 /*forwards*/ && editor_prefs.mouse_back_forward_enabled) + { + navqueue_go_forward(); + } + + else if (event->button > 5 && app->debug_mode) + g_warning("Unknown mouse button was pressed %i", event->button); + return FALSE; } diff --git a/src/editor.h b/src/editor.h index 347f6d0f2a..d9e11bbace 100644 --- a/src/editor.h +++ b/src/editor.h @@ -138,6 +138,7 @@ typedef struct GeanyEditorPrefs gint autocompletion_update_freq; gint scroll_lines_around_cursor; gint ime_interaction; /* input method editor's candidate window behaviour */ + gboolean mouse_back_forward_enabled; } GeanyEditorPrefs; diff --git a/src/keyfile.c b/src/keyfile.c index 90ad79a86e..7cf85862bf 100644 --- a/src/keyfile.c +++ b/src/keyfile.c @@ -220,6 +220,8 @@ static void init_pref_groups(void) "color_scheme", NULL); stash_group_add_spin_button_integer(group, &editor_prefs.scroll_lines_around_cursor, "scroll_lines_around_cursor", 0, "spin_scroll_lines_around_cursor"); + stash_group_add_boolean(group, &editor_prefs.mouse_back_forward_enabled, + "mouse_back_forward_enabled", TRUE); /* files */ stash_group_add_spin_button_integer(group, (gint*)&file_prefs.mru_length,