Make MouseButtons Forward & Back navigate (#32283)

This commit is contained in:
Magnus Larsen 2024-05-13 23:21:34 -07:00 committed by GitHub
parent 1cd30c4c7a
commit 6c3cf81230
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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;
@ -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