From b0329ac241609c618ce268fa5ba457eb491863f8 Mon Sep 17 00:00:00 2001 From: Tom Schuster Date: Wed, 5 Nov 2014 11:18:15 +0100 Subject: [PATCH] Support Back and forward button on mouses --- ports/glfw/window.rs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/ports/glfw/window.rs b/ports/glfw/window.rs index f748fc67e449..69f5dd1a83fe 100644 --- a/ports/glfw/window.rs +++ b/ports/glfw/window.rs @@ -225,8 +225,18 @@ impl Window { let hidpi = (backing_size as f32) / (window_size as f32); let x = x as f32 * hidpi; let y = y as f32 * hidpi; - if button == glfw::MouseButtonLeft || button == glfw::MouseButtonRight { - self.handle_mouse(button, action, x as i32, y as i32); + + match button { + glfw::MouseButton5 => { // Back button (might be different per platform) + self.event_queue.borrow_mut().push(NavigationWindowEvent(Back)); + }, + glfw::MouseButton6 => { // Forward + self.event_queue.borrow_mut().push(NavigationWindowEvent(Forward)); + }, + glfw::MouseButtonLeft | glfw::MouseButtonRight => { + self.handle_mouse(button, action, x as i32, y as i32); + } + _ => {} } }, glfw::CursorPosEvent(xpos, ypos) => {