servo: Merge #4550 - Rename MouseWindowEvent variants (from Ms2ger:MouseWindowEvent); r=jdm
authorMs2ger <ms2ger@gmail.com>
Mon, 05 Jan 2015 08:09:53 -0700
changeset 382194 e15b4e7bbe846302625f8251d65bc6dcdbb03459
parent 382193 a1e3f1c02f118d2d4be7bd6cf4da4c8c23aea458
child 382195 6e01c8710fcea79e6a92f12624fc76c241eda991
push id7198
push userjlorenzo@mozilla.com
push dateTue, 18 Apr 2017 12:07:49 +0000
treeherdermozilla-beta@d57aa49c3948 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjdm
servo: Merge #4550 - Rename MouseWindowEvent variants (from Ms2ger:MouseWindowEvent); r=jdm Source-Repo: https://github.com/servo/servo Source-Revision: ca876edc051c9b105747252155d0f11c31189646
servo/components/compositing/compositor.rs
servo/components/compositing/compositor_layer.rs
servo/components/compositing/windowing.rs
servo/ports/cef/browser_host.rs
servo/ports/glfw/window.rs
servo/ports/glutin/window.rs
servo/ports/gonk/src/input.rs
--- a/servo/components/compositing/compositor.rs
+++ b/servo/components/compositing/compositor.rs
@@ -792,19 +792,19 @@ impl<Window: WindowMethods> IOCompositor
         let msg = ConstellationMsg::LoadUrl(root_pipeline_id,
             LoadData::new(Url::parse(url_string.as_slice()).unwrap()));
         let ConstellationChan(ref chan) = self.constellation_chan;
         chan.send(msg);
     }
 
     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),
             None => {},
         }
     }
 
     fn on_mouse_window_move_event_class(&self, cursor: TypedPoint2D<DevicePixel, f32>) {
--- a/servo/components/compositing/compositor_layer.rs
+++ b/servo/components/compositing/compositor_layer.rs
@@ -313,21 +313,21 @@ impl CompositorLayer for Layer<Composito
         }
     }
 
     fn send_mouse_event(&self,
                         event: MouseWindowEvent,
                         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;
         let ScriptControlChan(ref chan) = pipeline.script_chan;
         let _ = chan.send_opt(ConstellationControlMsg::SendEvent(pipeline.id.clone(), message));
     }
 
     fn send_mouse_move_event(&self,
--- a/servo/components/compositing/windowing.rs
+++ b/servo/components/compositing/windowing.rs
@@ -14,19 +14,19 @@ use layers::platform::surface::NativeGra
 use servo_msg::compositor_msg::{PaintState, ReadyState};
 use servo_msg::constellation_msg::{Key, KeyState, KeyModifiers, LoadData};
 use servo_util::cursor::Cursor;
 use servo_util::geometry::ScreenPx;
 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 {
     Forward,
     Back,
 }
 
 /// Events that the windowing system sends to Servo.
--- a/servo/ports/cef/browser_host.rs
+++ b/servo/ports/cef/browser_host.rs
@@ -97,20 +97,20 @@ cef_class_impl! {
                                   mouse_up: c_int,
                                   _click_count: c_int)
                                   -> () {
             let event: &cef_mouse_event = event;
             let button_type = mouse_button_type as uint;
             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)))
             }
         }
 
         fn send_mouse_move_event(&_this, event: *const cef_mouse_event, _mouse_exited: c_int)
                                  -> () {
             let event: &cef_mouse_event = event;
             let point = TypedPoint2D((*event).x as f32, (*event).y as f32);
             core::send_window_event(WindowEvent::MouseWindowMoveEventClass(point))
--- a/servo/ports/glfw/window.rs
+++ b/servo/ports/glfw/window.rs
@@ -4,19 +4,19 @@
 
 //! A windowing implementation using GLFW.
 
 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};
 use geom::point::{Point2D, TypedPoint2D};
 use geom::scale_factor::ScaleFactor;
 use geom::size::TypedSize2D;
 use glfw::{mod, Context};
 use gleam::gl;
@@ -368,35 +368,34 @@ impl Window {
     /// Helper function to handle a click
     fn handle_mouse(&self, button: glfw::MouseButton, action: glfw::Action, x: c_int, y: c_int) {
         // FIXME(tkuehn): max pixel dist should be based on pixel density
         let max_pixel_dist = 10f64;
         let event = match action {
             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() {
                     None => (),
                     Some(but) if button == but => {
                         let pixel_dist = self.mouse_down_point.get() - Point2D(x, y);
                         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. :-(")
         };
         self.event_queue.borrow_mut().push(MouseWindowEventClass(event));
     }
 
     /// Returns the cursor position, properly accounting for HiDPI.
     fn cursor_position(&self) -> TypedPoint2D<DevicePixel,f32> {
--- a/servo/ports/glutin/window.rs
+++ b/servo/ports/glutin/window.rs
@@ -4,18 +4,17 @@
 
 //! A windowing implementation using glutin.
 
 use compositing::compositor_task::{mod, CompositorProxy, CompositorReceiver};
 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;
 use geom::size::TypedSize2D;
 use layers::geometry::DevicePixel;
 use layers::platform::surface::NativeGraphicsMetadata;
 use msg::constellation_msg;
 use msg::constellation_msg::{Key, CONTROL, SHIFT, ALT};
@@ -472,35 +471,34 @@ impl Window {
     /// Helper function to handle a click
     fn handle_mouse(&self, button: glutin::MouseButton, action: glutin::ElementState, x: int, y: int) {
         // FIXME(tkuehn): max pixel dist should be based on pixel density
         let max_pixel_dist = 10f64;
         let event = match action {
             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() {
                     None => (),
                     Some(but) if button == but => {
                         let pixel_dist = self.mouse_down_point.get() - Point2D(x, y);
                         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));
     }
 
     pub unsafe fn set_nested_event_loop_listener(
             &self,
             listener: *mut NestedEventLoopListener + 'static) {
--- a/servo/ports/gonk/src/input.rs
+++ b/servo/ports/gonk/src/input.rs
@@ -155,19 +155,19 @@ fn read_input_device(device_path: &Path,
                         if slotA.tracking_id == -1 {
                             println!("Touch up");
                             let delta_x = slotA.x - first_x;
                             let delta_y = slotA.y - first_y;
                             let dist = delta_x * delta_x + delta_y * delta_y;
                             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");
                             last_x = slotA.x;
                             last_y = slotA.y;
                             first_x = slotA.x;
                             first_y = slotA.y;
                             if touch_count >= 2 {