Fixes #1646 I'm almost sure that button values are the same on Windows, macOS or other types of mice You can view, comment on, or merge this pull request online at:
https://github.com/geany/geany/pull/1648
-- Commit Summary --
* support for fwd bkwd mouse buttons
-- File Changes --
M src/editor.c (14)
-- Patch Links --
https://github.com/geany/geany/pull/1648.patch https://github.com/geany/geany/pull/1648.diff
It would be cool if this could be tested on other OS with different models of mice. According to a quick Google search, buttons 6/7 and 8/9 can also be used for back/forward, and GDK really only supports 3 buttons (or 5 according to docs).
Another option, though perhaps overkill, would be to add a small GUI to the preferences to allow binding mouse buttons, somewhat similar to the keybindings. Or at least a "Various" setting so the can change manually.
I've inspected thunar's source it seems like 8 and 9 are enough for Unix. I don't know small and cross-platform gtk projects (i know wireshark 1.x and gimp), but you may try to search their code base for `button-press-event` and `->button\s?==\s?8`. If they use some other values too I'll commit a patch. I don't see any barriers for merging. ``` static gboolean thunar_standard_view_button_press_event (GtkWidget *view, GdkEventButton *event, ThunarStandardView *standard_view) { GtkAction *action = NULL;
if (G_LIKELY (event->type == GDK_BUTTON_PRESS)) { /* determine the appropriate action ("back" for button 8, "forward" for button 9) */ if (G_UNLIKELY (event->button == 8)) action = gtk_ui_manager_get_action (standard_view->ui_manager, "/main-menu/go-menu/placeholder-go-history-actions/back"); else if (G_UNLIKELY (event->button == 9)) action = gtk_ui_manager_get_action (standard_view->ui_manager, "/main-menu/go-menu/placeholder-go-history-actions/forward");
```
I have a little expirience in GTK and GUI. I also think we should keep settings simple. What we may do is add logging (if we run in verbose mode) of the mouse buttons which differ from 1-5. Then someone who has a problem would report it to github and provide log info
I agree with @codebrainz that it would be better not hard coding mice buttons beyond the standard 3.
Maybe keybindings should allow mouse buttons > 3 to be bound.
Maybe keybindings should allow mouse buttons > 3 to be bound.
That might be interesting to incorporate it somehow into the "key" bindings. I think something more elaborate could be looked at later and shouldn't block this PR.
@Yanpas what if you just added a single "Various" preference that is enabled by default like `mouse-back-forward-enabled` that allowed this to be disabled. My main concern is that on some device, platform or with certain X mappings, this could make Geany unusable. The "Various" preference would provide an escape hatch for this case.
@codebrainz This approach is good. I'll commit this.
@Yanpas pushed 1 commit.
f06ea91 warning and config value
LarsGit223 commented on this pull request.
@@ -352,6 +353,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)
Just a small thing: IMHO a comment in-between code is really not beautiful. Could you move that above or below the line? I guess in this case better below.
LarsGit223 commented on this pull request.
@@ -352,6 +353,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)
Same thing here.
@Yanpas pushed 1 commit.
f6edd9c removed comments since they are extra
Closed #1648.
Removed comments since it's obvious what's going on. BTW I'm somehow merging with "HEAD" branch which is strange name for branch. And it's not possible to rename it without closing PR
Reopened #1648.
HEAD is supposed to be an alias for the most recent commit on a branch, not the name of a branch, git might get confused :)
Can this PR be merged?
Needs review (by anyone competent) and testing (by someone other than the OP with many buttoned mouse).
And I'm still concerned about merging a branch called HEAD.
And it needs to be documented somewhere, there is an option added so that goes in the appropriate section, that will probably do if it explains the functionality its controlling.
I agree that it should be configurable like keybindings. However, I think we only support one binding per action, right? So if I assign "mouse 8" to back, I lose alt+left.
IMO, if we agree on that it should work like keybindings somehow, then we don't need a various pref in the first place (I don't like various prefs generally, they are becoming a bin and too crowded).
I agree that it should be configurable like keybindings. However, I think we only support one binding per action, right? So if I assigned "mouse 8" to back, I'd lose alt+left.
Correct, and ATM keybindings don't handle mouse button clicks anyway. Geany use of mouse 1, 2,and 3 is hard coded and the rest are ignored.
IMO, if we agree on that it should work like keybindings somehow, then we don't need a various pref in the first place
That would be the best solution, but changing keybindings (mousebindings?) to allow mouse clicks is possibly beyond the scope of this PR.
(I don't like various prefs generally, they are becoming a bin and too crowded).
+1
Closed #1648.
github-comments@lists.geany.org