Skip to content

Commit

Permalink
Make MouseButtons Forward & Back navigate (#32283)
Browse files Browse the repository at this point in the history
  • Loading branch information
Nopey committed May 14, 2024
1 parent 1cd30c4 commit 6c3cf81
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions ports/servoshell/minibrowser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ use servo::rendering_context::RenderingContext;
use servo::servo_geometry::DeviceIndependentPixel;
use servo::servo_url::ServoUrl;
use servo::style_traits::DevicePixel;
use winit::event::{ElementState, MouseButton};

use crate::egui_glue::EguiGlow;
use crate::events_loop::EventsLoop;
Expand Down Expand Up @@ -107,6 +108,24 @@ impl Minibrowser {
self.last_mouse_position
.map_or(false, |p| self.is_in_browser_rect(p))
},
winit::event::WindowEvent::MouseInput {
state: ElementState::Pressed,
button: MouseButton::Forward,
..
} => {
self.event_queue
.borrow_mut()
.push(MinibrowserEvent::Forward);
true
},
winit::event::WindowEvent::MouseInput {
state: ElementState::Pressed,
button: MouseButton::Back,
..
} => {
self.event_queue.borrow_mut().push(MinibrowserEvent::Back);
true
},
winit::event::WindowEvent::MouseWheel { .. } |
winit::event::WindowEvent::MouseInput { .. } => self
.last_mouse_position
Expand Down

0 comments on commit 6c3cf81

Please sign in to comment.