Skip to content

Commit

Permalink
Support Back and forward button on mouses
Browse files Browse the repository at this point in the history
  • Loading branch information
evilpie committed Nov 5, 2014
1 parent ffae110 commit b0329ac
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions ports/glfw/window.rs
Expand Up @@ -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) => {
Expand Down

5 comments on commit b0329ac

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from glennw
at evilpie@b0329ac

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging evilpie/servo/master = b0329ac into auto

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

evilpie/servo/master = b0329ac merged ok, testing candidate = e781cb4

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fast-forwarding master to auto = e781cb4

Please sign in to comment.