[devhelp] Window: act on forward/back mouse buttons



commit 5dc50336d6879cd38cf19c0254fd9719fb1ba66a
Author: Lubomir Rintel <lkundrak v3 sk>
Date:   Mon Jun 19 16:17:09 2017 +0200

    Window: act on forward/back mouse buttons
    
    Some mice emit button presses when the scroll wheel is tilted to the
    side. Web browsers use them to navigate in history.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=783964

 src/dh-window.c |   19 +++++++++++++++++--
 1 files changed, 17 insertions(+), 2 deletions(-)
---
diff --git a/src/dh-window.c b/src/dh-window.c
index f29a81f..b6909bf 100644
--- a/src/dh-window.c
+++ b/src/dh-window.c
@@ -1142,8 +1142,23 @@ window_web_view_button_press_event_cb (WebKitWebView  *web_view,
                                        GdkEventButton *event,
                                        DhWindow       *window)
 {
-        if (event->button == 3)
-                return GDK_EVENT_STOP;
+        switch (event->button) {
+                case 3:
+                        return GDK_EVENT_STOP;
+
+                /* Some mice emit button presses when the scroll wheel is tilted
+                 * to the side. Web browsers use them to navigate in history.
+                 */
+                case 8:
+                        webkit_web_view_go_back (web_view);
+                        return GDK_EVENT_STOP;
+                case 9:
+                        webkit_web_view_go_forward (web_view);
+                        return GDK_EVENT_STOP;
+
+                default:
+                        break;
+        }
 
         return GDK_EVENT_PROPAGATE;
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]