Rename MouseWindowEvent variants.

This commit is contained in:
Ms2ger 2015-01-05 12:08:16 +01:00
parent 65ee8166bd
commit be683a0888
7 changed files with 25 additions and 28 deletions

View file

@ -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)))
}
}

View file

@ -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. :-(")
};

View file

@ -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));

View file

@ -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");