mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
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.
This commit is contained in:
parent
2be60be062
commit
8c4fed42b0
13 changed files with 43 additions and 64 deletions
|
@ -30,13 +30,13 @@ use msg::compositor_msg::{Epoch, EventResult, FrameTreeId, LayerId, LayerKind};
|
|||
use msg::compositor_msg::{LayerProperties, ScrollPolicy};
|
||||
use msg::constellation_msg::CompositorMsg as ConstellationMsg;
|
||||
use msg::constellation_msg::{AnimationState, Image, PixelFormat};
|
||||
use msg::constellation_msg::{Key, KeyModifiers, KeyState, LoadData};
|
||||
use msg::constellation_msg::{Key, KeyModifiers, KeyState, LoadData, MouseButton};
|
||||
use msg::constellation_msg::{NavigationDirection, PipelineId, WindowSizeData};
|
||||
use pipeline::CompositionPipeline;
|
||||
use profile_traits::mem::{self, ReportKind, Reporter, ReporterRequest};
|
||||
use profile_traits::time::{self, ProfilerCategory, profile};
|
||||
use script_traits::CompositorEvent::{MouseMoveEvent, TouchEvent};
|
||||
use script_traits::{ConstellationControlMsg, LayoutControlMsg, MouseButton};
|
||||
use script_traits::{ConstellationControlMsg, LayoutControlMsg};
|
||||
use script_traits::{TouchEventType, TouchId};
|
||||
use scrolling::ScrollingTimerProxy;
|
||||
use std::collections::hash_map::Entry::{Occupied, Vacant};
|
||||
|
|
|
@ -12,9 +12,9 @@ use layers::color::Color;
|
|||
use layers::geometry::LayerPixel;
|
||||
use layers::layers::{Layer, LayerBufferSet};
|
||||
use msg::compositor_msg::{Epoch, LayerId, LayerProperties, ScrollPolicy};
|
||||
use msg::constellation_msg::PipelineId;
|
||||
use msg::constellation_msg::{MouseEventType, PipelineId};
|
||||
use script_traits::CompositorEvent;
|
||||
use script_traits::CompositorEvent::{ClickEvent, MouseDownEvent, MouseMoveEvent, MouseUpEvent};
|
||||
use script_traits::CompositorEvent::{MouseButtonEvent, MouseMoveEvent};
|
||||
use script_traits::ConstellationControlMsg;
|
||||
use std::rc::Rc;
|
||||
use windowing::{MouseWindowEvent, WindowMethods};
|
||||
|
@ -372,11 +372,11 @@ impl CompositorLayer for Layer<CompositorData> {
|
|||
let event_point = cursor.to_untyped();
|
||||
let message = match event {
|
||||
MouseWindowEvent::Click(button, _) =>
|
||||
ClickEvent(button, event_point),
|
||||
MouseButtonEvent(MouseEventType::Click, button, event_point),
|
||||
MouseWindowEvent::MouseDown(button, _) =>
|
||||
MouseDownEvent(button, event_point),
|
||||
MouseButtonEvent(MouseEventType::MouseDown, button, event_point),
|
||||
MouseWindowEvent::MouseUp(button, _) =>
|
||||
MouseUpEvent(button, event_point),
|
||||
MouseButtonEvent(MouseEventType::MouseUp, button, event_point),
|
||||
};
|
||||
self.send_event(compositor, message);
|
||||
}
|
||||
|
|
|
@ -11,9 +11,9 @@ use euclid::size::TypedSize2D;
|
|||
use euclid::{Point2D, Size2D};
|
||||
use layers::geometry::DevicePixel;
|
||||
use layers::platform::surface::NativeDisplay;
|
||||
use msg::constellation_msg::{Key, KeyModifiers, KeyState};
|
||||
use msg::constellation_msg::{Key, KeyModifiers, KeyState, MouseButton};
|
||||
use net_traits::net_error_list::NetError;
|
||||
use script_traits::{MouseButton, TouchEventType, TouchId};
|
||||
use script_traits::{TouchEventType, TouchId};
|
||||
use std::fmt::{Debug, Error, Formatter};
|
||||
use std::rc::Rc;
|
||||
use url::Url;
|
||||
|
@ -27,7 +27,6 @@ pub enum MouseWindowEvent {
|
|||
MouseUp(MouseButton, TypedPoint2D<DevicePixel, f32>),
|
||||
}
|
||||
|
||||
|
||||
#[derive(Clone)]
|
||||
pub enum WindowNavigateMsg {
|
||||
Forward,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue