mirror of
https://github.com/servo/servo.git
synced 2025-07-30 10:40:27 +01:00
Add a "-Z convert-mouse-to-touch" debug argument.
This is enabled by default on Android, because Glutin currently sends mouse events instead of touch events on Android. It's also useful for testing on non-touch platforms.
This commit is contained in:
parent
fe7460f34d
commit
817eed22d1
2 changed files with 32 additions and 2 deletions
|
@ -1123,7 +1123,16 @@ impl<Window: WindowMethods> IOCompositor<Window> {
|
|||
chan.send(msg).unwrap()
|
||||
}
|
||||
|
||||
fn on_mouse_window_event_class(&self, mouse_window_event: MouseWindowEvent) {
|
||||
fn on_mouse_window_event_class(&mut self, mouse_window_event: MouseWindowEvent) {
|
||||
if opts::get().convert_mouse_to_touch {
|
||||
match mouse_window_event {
|
||||
MouseWindowEvent::Click(_, _) => {}
|
||||
MouseWindowEvent::MouseDown(_, p) => self.on_touch_down(0, p),
|
||||
MouseWindowEvent::MouseUp(_, p) => self.on_touch_up(0, p),
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
let point = match mouse_window_event {
|
||||
MouseWindowEvent::Click(_, p) => p,
|
||||
MouseWindowEvent::MouseDown(_, p) => p,
|
||||
|
@ -1135,7 +1144,12 @@ impl<Window: WindowMethods> IOCompositor<Window> {
|
|||
}
|
||||
}
|
||||
|
||||
fn on_mouse_window_move_event_class(&self, cursor: TypedPoint2D<DevicePixel, f32>) {
|
||||
fn on_mouse_window_move_event_class(&mut self, cursor: TypedPoint2D<DevicePixel, f32>) {
|
||||
if opts::get().convert_mouse_to_touch {
|
||||
self.on_touch_move(0, cursor);
|
||||
return
|
||||
}
|
||||
|
||||
match self.find_topmost_layer_at_point(cursor / self.scene.scale) {
|
||||
Some(result) => result.layer.send_mouse_move_event(self, result.point),
|
||||
None => {},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue