changeset 2629:65ddca027935

Multi-button mouse support Initial support for multi-button mouse. When image pane has focus, mouse buttons 8 and 9 are mapped to Forward and Back.
author Tomasz Golinski <tomaszg@math.uwb.edu.pl>
date Fri, 13 Oct 2017 13:21:11 +0100
parents 3685b630d2e4
children 28ebd46553b2
files doc/docbook/GuideReferenceKeyboardShortcuts.xml src/layout_image.c src/pixbuf-renderer.c src/typedefs.h
diffstat 4 files changed, 34 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/doc/docbook/GuideReferenceKeyboardShortcuts.xml	Thu Oct 12 10:39:25 2017 +0100
+++ b/doc/docbook/GuideReferenceKeyboardShortcuts.xml	Fri Oct 13 13:21:11 2017 +0100
@@ -169,6 +169,24 @@
           <row>
             <entry />
             <entry>
+              <code>Mouse button 8</code>
+              <footnote id='ref2'>
+                <para>Requires a multi-button mouse.</para>
+              </footnote>
+            </entry>
+            <entry>Forward</entry>
+          </row>
+          <row>
+            <entry />
+            <entry>
+              <code>Mouse button 9</code>
+              <footnoteref linkend='ref2' />
+            </entry>
+            <entry>Back</entry>
+          </row>
+          <row>
+            <entry />
+            <entry>
               <code>Shift + right-click</code>
             </entry>
             <entry>Smooth scroll</entry>
--- a/src/layout_image.c	Thu Oct 12 10:39:25 2017 +0100
+++ b/src/layout_image.c	Fri Oct 13 13:21:11 2017 +0100
@@ -29,6 +29,7 @@
 #include "exif.h"
 #include "filedata.h"
 #include "fullscreen.h"
+#include "history_list.h"
 #include "image.h"
 #include "image-overlay.h"
 #include "img-view.h"
@@ -1692,6 +1693,7 @@
 {
 	LayoutWindow *lw = data;
 	GtkWidget *menu;
+	FileData *dir_fd;
 
 	switch (event->button)
 		{
@@ -1711,6 +1713,16 @@
 				}
 			gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, 3, event->time);
 			break;
+		case MOUSE_BUTTON_BACK:
+			dir_fd = file_data_new_dir(history_chain_back());
+			layout_set_fd(lw, dir_fd);
+			file_data_unref(dir_fd);
+			break;
+		case MOUSE_BUTTON_FORWARD:
+			dir_fd = file_data_new_dir(history_chain_forward());
+			layout_set_fd(lw, dir_fd);
+			file_data_unref(dir_fd);
+			break;
 		default:
 			break;
 		}
--- a/src/pixbuf-renderer.c	Thu Oct 12 10:39:25 2017 +0100
+++ b/src/pixbuf-renderer.c	Fri Oct 13 13:21:11 2017 +0100
@@ -2127,7 +2127,7 @@
 			{
 			pr_scroller_start(pr, bevent->x, bevent->y);
 			}
-		else if (bevent->button == MOUSE_BUTTON_LEFT || bevent->button == MOUSE_BUTTON_MIDDLE)
+		else if (bevent->button == MOUSE_BUTTON_LEFT || bevent->button == MOUSE_BUTTON_MIDDLE || bevent->button == MOUSE_BUTTON_BACK || bevent->button == MOUSE_BUTTON_FORWARD)
 			{
 			pr_clicked_signal(pr, bevent);
 			}
--- a/src/typedefs.h	Thu Oct 12 10:39:25 2017 +0100
+++ b/src/typedefs.h	Fri Oct 13 13:21:11 2017 +0100
@@ -33,7 +33,9 @@
 	MOUSE_BUTTON_MIDDLE	= 2,
 	MOUSE_BUTTON_RIGHT	= 3,
 	MOUSE_BUTTON_WHEEL_UP	= 4,
-	MOUSE_BUTTON_WHEEL_DOWN	= 5
+	MOUSE_BUTTON_WHEEL_DOWN	= 5,
+	MOUSE_BUTTON_BACK	= 8,
+	MOUSE_BUTTON_FORWARD	= 9
 } MouseButton;
 
 typedef enum {