Multi-button mouse support
authorTomasz Golinski <tomaszg@math.uwb.edu.pl>
Fri, 13 Oct 2017 12:21:11 +0000 (13:21 +0100)
committerColin Clark <colin.clark@cclark.uk>
Fri, 13 Oct 2017 12:21:11 +0000 (13:21 +0100)
Initial support for multi-button mouse.
When image pane has focus, mouse buttons 8 and 9 are mapped to Forward and Back.

doc/docbook/GuideReferenceKeyboardShortcuts.xml
src/layout_image.c
src/pixbuf-renderer.c
src/typedefs.h

index de3736c..00a4159 100644 (file)
             <entry />\r
             <entry>Pan to respective edge of image.</entry>\r
           </row>\r
+          <row>\r
+            <entry />\r
+            <entry>\r
+              <code>Mouse button 8</code>\r
+              <footnote id='ref2'>\r
+                <para>Requires a multi-button mouse.</para>\r
+              </footnote>\r
+            </entry>\r
+            <entry>Forward</entry>\r
+          </row>\r
+          <row>\r
+            <entry />\r
+            <entry>\r
+              <code>Mouse button 9</code>\r
+              <footnoteref linkend='ref2' />\r
+            </entry>\r
+            <entry>Back</entry>\r
+          </row>\r
           <row>\r
             <entry />\r
             <entry>\r
index e4125a1..52f9a38 100644 (file)
@@ -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 @@ static void layout_image_button_cb(ImageWindow *imd, GdkEventButton *event, gpoi
 {
        LayoutWindow *lw = data;
        GtkWidget *menu;
+       FileData *dir_fd;
 
        switch (event->button)
                {
@@ -1711,6 +1713,16 @@ static void layout_image_button_cb(ImageWindow *imd, GdkEventButton *event, gpoi
                                }
                        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;
                }
index 2459bf4..57c2bea 100644 (file)
@@ -2127,7 +2127,7 @@ static gboolean pr_mouse_release_cb(GtkWidget *widget, GdkEventButton *bevent, g
                        {
                        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);
                        }
index 4b65b55..6549550 100644 (file)
@@ -33,7 +33,9 @@ typedef enum {
        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 {