diff options
author | bors-servo <metajack+bors@gmail.com> | 2015-01-05 08:09:53 -0700 |
---|---|---|
committer | bors-servo <metajack+bors@gmail.com> | 2015-01-05 08:09:53 -0700 |
commit | ca876edc051c9b105747252155d0f11c31189646 (patch) | |
tree | d036693c94f47327d07105f71d28587bf44dc933 | |
parent | 65ee8166bd64e911502e29a050258b70d9f263aa (diff) | |
parent | be683a0888ede5aede9a10a77f71b415cd32716f (diff) | |
download | servo-ca876edc051c9b105747252155d0f11c31189646.tar.gz servo-ca876edc051c9b105747252155d0f11c31189646.zip |
auto merge of #4550 : Ms2ger/servo/MouseWindowEvent, r=jdm
-rw-r--r-- | components/compositing/compositor.rs | 6 | ||||
-rw-r--r-- | components/compositing/compositor_layer.rs | 6 | ||||
-rw-r--r-- | components/compositing/windowing.rs | 6 | ||||
-rw-r--r-- | ports/cef/browser_host.rs | 4 | ||||
-rw-r--r-- | ports/glfw/window.rs | 13 | ||||
-rw-r--r-- | ports/glutin/window.rs | 12 | ||||
-rw-r--r-- | ports/gonk/src/input.rs | 6 |
7 files changed, 25 insertions, 28 deletions
diff --git a/components/compositing/compositor.rs b/components/compositing/compositor.rs index b4dd37a2915..40d0f56dfa7 100644 --- a/components/compositing/compositor.rs +++ b/components/compositing/compositor.rs @@ -797,9 +797,9 @@ impl<Window: WindowMethods> IOCompositor<Window> { fn on_mouse_window_event_class(&self, mouse_window_event: MouseWindowEvent) { let point = match mouse_window_event { - MouseWindowEvent::MouseWindowClickEvent(_, p) => p, - MouseWindowEvent::MouseWindowMouseDownEvent(_, p) => p, - MouseWindowEvent::MouseWindowMouseUpEvent(_, p) => p, + MouseWindowEvent::Click(_, p) => p, + MouseWindowEvent::MouseDown(_, p) => p, + MouseWindowEvent::MouseUp(_, p) => p, }; match self.find_topmost_layer_at_point(point / self.scene.scale) { Some(result) => result.layer.send_mouse_event(mouse_window_event, result.point), diff --git a/components/compositing/compositor_layer.rs b/components/compositing/compositor_layer.rs index 3658172847e..665e786d262 100644 --- a/components/compositing/compositor_layer.rs +++ b/components/compositing/compositor_layer.rs @@ -318,11 +318,11 @@ impl CompositorLayer for Layer<CompositorData> { cursor: TypedPoint2D<LayerPixel, f32>) { let event_point = cursor.to_untyped(); let message = match event { - MouseWindowEvent::MouseWindowClickEvent(button, _) => + MouseWindowEvent::Click(button, _) => ClickEvent(button, event_point), - MouseWindowEvent::MouseWindowMouseDownEvent(button, _) => + MouseWindowEvent::MouseDown(button, _) => MouseDownEvent(button, event_point), - MouseWindowEvent::MouseWindowMouseUpEvent(button, _) => + MouseWindowEvent::MouseUp(button, _) => MouseUpEvent(button, event_point), }; let pipeline = &self.extra_data.borrow().pipeline; diff --git a/components/compositing/windowing.rs b/components/compositing/windowing.rs index 54fc96897d0..08a99aa2e03 100644 --- a/components/compositing/windowing.rs +++ b/components/compositing/windowing.rs @@ -19,9 +19,9 @@ use std::fmt::{FormatError, Formatter, Show}; use std::rc::Rc; pub enum MouseWindowEvent { - MouseWindowClickEvent(uint, TypedPoint2D<DevicePixel, f32>), - MouseWindowMouseDownEvent(uint, TypedPoint2D<DevicePixel, f32>), - MouseWindowMouseUpEvent(uint, TypedPoint2D<DevicePixel, f32>), + Click(uint, TypedPoint2D<DevicePixel, f32>), + MouseDown(uint, TypedPoint2D<DevicePixel, f32>), + MouseUp(uint, TypedPoint2D<DevicePixel, f32>), } pub enum WindowNavigateMsg { diff --git a/ports/cef/browser_host.rs b/ports/cef/browser_host.rs index e1248403e2f..69010e483b7 100644 --- a/ports/cef/browser_host.rs +++ b/ports/cef/browser_host.rs @@ -102,10 +102,10 @@ cef_class_impl! { let point = TypedPoint2D((*event).x as f32, (*event).y as f32); if mouse_up != 0 { core::send_window_event(WindowEvent::MouseWindowEventClass( - MouseWindowEvent::MouseWindowClickEvent(button_type, point))) + MouseWindowEvent::Click(button_type, point))) } else { core::send_window_event(WindowEvent::MouseWindowEventClass( - MouseWindowEvent::MouseWindowMouseUpEvent(button_type, point))) + MouseWindowEvent::MouseUp(button_type, point))) } } diff --git a/ports/glfw/window.rs b/ports/glfw/window.rs index 9410949ef66..b810db10a83 100644 --- a/ports/glfw/window.rs +++ b/ports/glfw/window.rs @@ -9,9 +9,9 @@ use NestedEventLoopListener; use compositing::compositor_task::{mod, CompositorProxy, CompositorReceiver}; use compositing::windowing::{Forward, Back}; use compositing::windowing::{Idle, Resize}; -use compositing::windowing::{KeyEvent, MouseWindowClickEvent, MouseWindowMouseDownEvent}; +use compositing::windowing::{KeyEvent, MouseWindowEvent}; use compositing::windowing::{MouseWindowEventClass, MouseWindowMoveEventClass}; -use compositing::windowing::{MouseWindowMouseUpEvent, Refresh}; +use compositing::windowing::Refresh; use compositing::windowing::{Navigation, Scroll, Zoom}; use compositing::windowing::{PinchZoom, Quit}; use compositing::windowing::{WindowEvent, WindowMethods}; @@ -373,7 +373,7 @@ impl Window { glfw::Press => { self.mouse_down_point.set(Point2D(x, y)); self.mouse_down_button.set(Some(button)); - MouseWindowMouseDownEvent(button as uint, TypedPoint2D(x as f32, y as f32)) + MouseWindowEvent::MouseDown(button as uint, TypedPoint2D(x as f32, y as f32)) } glfw::Release => { match self.mouse_down_button.get() { @@ -383,15 +383,14 @@ impl Window { let pixel_dist = ((pixel_dist.x * pixel_dist.x + pixel_dist.y * pixel_dist.y) as f64).sqrt(); if pixel_dist < max_pixel_dist { - let click_event = MouseWindowClickEvent(button as uint, - TypedPoint2D(x as f32, - y as f32)); + let click_event = MouseWindowEvent::Click( + button as uint, TypedPoint2D(x as f32, y as f32)); self.event_queue.borrow_mut().push(MouseWindowEventClass(click_event)); } } Some(_) => (), } - MouseWindowMouseUpEvent(button as uint, TypedPoint2D(x as f32, y as f32)) + MouseWindowEvent::MouseUp(button as uint, TypedPoint2D(x as f32, y as f32)) } _ => panic!("I cannot recognize the type of mouse action that occured. :-(") }; diff --git a/ports/glutin/window.rs b/ports/glutin/window.rs index 500be58fbfa..a5156f6d714 100644 --- a/ports/glutin/window.rs +++ b/ports/glutin/window.rs @@ -9,8 +9,7 @@ use compositing::windowing::{WindowEvent, WindowMethods, KeyEvent}; use compositing::windowing::{Idle, Resize}; use compositing::windowing::{MouseWindowEventClass, MouseWindowMoveEventClass, Scroll}; use compositing::windowing::{Zoom, PinchZoom, Navigation}; -use compositing::windowing::{Quit, MouseWindowClickEvent}; -use compositing::windowing::{MouseWindowMouseDownEvent, MouseWindowMouseUpEvent}; +use compositing::windowing::{Quit, MouseWindowEvent}; use compositing::windowing::{Forward, Back}; use geom::point::{Point2D, TypedPoint2D}; use geom::scale_factor::ScaleFactor; @@ -477,7 +476,7 @@ impl Window { ElementState::Pressed => { self.mouse_down_point.set(Point2D(x, y)); self.mouse_down_button.set(Some(button)); - MouseWindowMouseDownEvent(0, TypedPoint2D(x as f32, y as f32)) + MouseWindowEvent::MouseDown(0, TypedPoint2D(x as f32, y as f32)) } ElementState::Released => { match self.mouse_down_button.get() { @@ -487,15 +486,14 @@ impl Window { let pixel_dist = ((pixel_dist.x * pixel_dist.x + pixel_dist.y * pixel_dist.y) as f64).sqrt(); if pixel_dist < max_pixel_dist { - let click_event = MouseWindowClickEvent(0, - TypedPoint2D(x as f32, - y as f32)); + let click_event = MouseWindowEvent::Click( + 0, TypedPoint2D(x as f32, y as f32)); self.event_queue.borrow_mut().push(MouseWindowEventClass(click_event)); } } Some(_) => (), } - MouseWindowMouseUpEvent(0, TypedPoint2D(x as f32, y as f32)) + MouseWindowEvent::MouseUp(0, TypedPoint2D(x as f32, y as f32)) } }; self.event_queue.borrow_mut().push(MouseWindowEventClass(event)); diff --git a/ports/gonk/src/input.rs b/ports/gonk/src/input.rs index 7585df021c4..1e19ea30f51 100644 --- a/ports/gonk/src/input.rs +++ b/ports/gonk/src/input.rs @@ -160,9 +160,9 @@ fn read_input_device(device_path: &Path, if dist < 16 { let click_pt = TypedPoint2D(slotA.x as f32, slotA.y as f32); println!("Dispatching click!"); - sender.send(WindowEvent::MouseWindowEventClass(MouseWindowEvent::MouseWindowMouseDownEvent(0, click_pt))); - sender.send(WindowEvent::MouseWindowEventClass(MouseWindowEvent::MouseWindowMouseUpEvent(0, click_pt))); - sender.send(WindowEvent::MouseWindowEventClass(MouseWindowEvent::MouseWindowClickEvent(0, click_pt))); + sender.send(WindowEvent::MouseWindowEventClass(MouseWindowEvent::MouseDown(0, click_pt))); + sender.send(WindowEvent::MouseWindowEventClass(MouseWindowEvent::MouseUp(0, click_pt))); + sender.send(WindowEvent::MouseWindowEventClass(MouseWindowEvent::Click(0, click_pt))); } } else { println!("Touch down"); |