From 8c4fed42b0e50f51134dca8f92558c7f4e37c4ab Mon Sep 17 00:00:00 2001 From: Matt Brubeck Date: Wed, 2 Dec 2015 11:49:37 -0800 Subject: Minor refactoring of mouse event types * Move some types into the `msg` crate so they can be shared more. * Use MouseEventType instead of duplicating it in other enums. --- components/script_traits/lib.rs | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-) (limited to 'components/script_traits') diff --git a/components/script_traits/lib.rs b/components/script_traits/lib.rs index 8a5ffcb459f..ef86ee26085 100644 --- a/components/script_traits/lib.rs +++ b/components/script_traits/lib.rs @@ -34,6 +34,7 @@ use msg::compositor_msg::{Epoch, LayerId, ScriptToCompositorMsg}; use msg::constellation_msg::ScriptMsg as ConstellationMsg; use msg::constellation_msg::{ConstellationChan, Failure, PipelineId, WindowSizeData}; use msg::constellation_msg::{Key, KeyModifiers, KeyState, LoadData, SubpageId}; +use msg::constellation_msg::{MouseButton, MouseEventType}; use msg::constellation_msg::{MozBrowserEvent, PipelineNamespaceId}; use msg::webdriver_msg::WebDriverScriptCommand; use net_traits::ResourceTask; @@ -146,17 +147,6 @@ pub enum ConstellationControlMsg { }, } -/// The mouse button involved in the event. -#[derive(Clone, Copy, Debug, Deserialize, Serialize)] -pub enum MouseButton { - /// The left mouse button. - Left, - /// The middle mouse button. - Middle, - /// The right mouse button. - Right, -} - /// The type of input represented by a multi-touch event. #[derive(Clone, Copy, Debug, Deserialize, Serialize)] pub enum TouchEventType { @@ -181,12 +171,8 @@ pub struct TouchId(pub i32); pub enum CompositorEvent { /// The window was resized. ResizeEvent(WindowSizeData), - /// A point was clicked. - ClickEvent(MouseButton, Point2D), - /// A mouse button was pressed on a point. - MouseDownEvent(MouseButton, Point2D), - /// A mouse button was released on a point. - MouseUpEvent(MouseButton, Point2D), + /// A mouse button state changed. + MouseButtonEvent(MouseEventType, MouseButton, Point2D), /// The mouse was moved over a point (or was moved out of the recognizable region). MouseMoveEvent(Option>), /// A touch event was generated with a touch ID and location. -- cgit v1.2.3