From 7518093537c2f57bbcc5466cc4bf2b1b154bde4d Mon Sep 17 00:00:00 2001 From: Yan Pashkovsky Date: Sun, 15 Oct 2017 20:26:56 +0300 Subject: [PATCH 1/3] support for fwd bkwd mouse buttons --- src/editor.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/editor.c b/src/editor.c index 460c832a31..71248053de 100644 --- a/src/editor.c +++ b/src/editor.c @@ -47,6 +47,7 @@ #include "geanyobject.h" #include "highlighting.h" #include "keybindings.h" +#include "navqueue.h" #include "main.h" #include "prefs.h" #include "projectprivate.h" @@ -329,7 +330,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; @@ -352,6 +353,17 @@ static gboolean on_editor_button_press_event(GtkWidget *widget, GdkEventButton * return TRUE; } + + else if (event->button == 8 /*backwards*/) + { + navqueue_go_back(); + } + + else if (event->button == 9 /*forwards*/) + { + navqueue_go_forward(); + } + return FALSE; } From f06ea91e93e877d7f165e47b8e010a19d1235109 Mon Sep 17 00:00:00 2001 From: Yan Pashkovsky Date: Mon, 16 Oct 2017 23:01:49 +0300 Subject: [PATCH 2/3] warning and config value --- src/editor.c | 7 +++++-- src/editor.h | 1 + src/keyfile.c | 2 ++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/editor.c b/src/editor.c index 71248053de..4656454d14 100644 --- a/src/editor.c +++ b/src/editor.c @@ -354,16 +354,19 @@ static gboolean on_editor_button_press_event(GtkWidget *widget, GdkEventButton * return TRUE; } - else if (event->button == 8 /*backwards*/) + else if (event->button == 8 /*backwards*/ && editor_prefs.mouse_back_forward_enabled) { navqueue_go_back(); } - else if (event->button == 9 /*forwards*/) + 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 110e59abf1..fa3006c006 100644 --- a/src/editor.h +++ b/src/editor.h @@ -139,6 +139,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 67fa10185e..8c1208838d 100644 --- a/src/keyfile.c +++ b/src/keyfile.c @@ -259,6 +259,8 @@ static void init_pref_groups(void) "replace_and_find_by_default", TRUE); stash_group_add_integer(group, &editor_prefs.ime_interaction, "editor_ime_interaction", SC_IME_WINDOWED); + stash_group_add_boolean(group, &editor_prefs.mouse_back_forward_enabled, + "mouse_back_forward_enabled", TRUE); /* Note: Interface-related various prefs are in ui_init_prefs() */ From f6edd9c768020d9faa0bb82839f16b1c2f1384e1 Mon Sep 17 00:00:00 2001 From: Yan Pashkovsky Date: Mon, 16 Oct 2017 23:19:20 +0300 Subject: [PATCH 3/3] removed comments since they are extra --- src/editor.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/editor.c b/src/editor.c index 4656454d14..be2eba080f 100644 --- a/src/editor.c +++ b/src/editor.c @@ -354,12 +354,12 @@ static gboolean on_editor_button_press_event(GtkWidget *widget, GdkEventButton * return TRUE; } - else if (event->button == 8 /*backwards*/ && editor_prefs.mouse_back_forward_enabled) + else if (event->button == 8 && editor_prefs.mouse_back_forward_enabled) { navqueue_go_back(); } - else if (event->button == 9 /*forwards*/ && editor_prefs.mouse_back_forward_enabled) + else if (event->button == 9 && editor_prefs.mouse_back_forward_enabled) { navqueue_go_forward(); }