Reduce max line length from 150 to 120 characters

Part of https://github.com/servo/servo/issues/6041
This commit is contained in:
Corey Farwell 2015-05-23 19:49:53 -04:00
parent 7561f7b83f
commit 8e3f4bba85
141 changed files with 1161 additions and 497 deletions

View file

@ -70,7 +70,9 @@ pub struct Window {
#[cfg(feature = "window")]
impl Window {
pub fn new(is_foreground: bool, window_size: TypedSize2D<DevicePixel, u32>, parent: glutin::WindowID) -> Rc<Window> {
pub fn new(is_foreground: bool,
window_size: TypedSize2D<DevicePixel, u32>,
parent: glutin::WindowID) -> Rc<Window> {
let mut glutin_window = glutin::WindowBuilder::new()
.with_title("Servo".to_string())
.with_dimensions(window_size.to_untyped().width, window_size.to_untyped().height)
@ -616,7 +618,9 @@ pub struct Window {
#[cfg(feature = "headless")]
impl Window {
pub fn new(_is_foreground: bool, window_size: TypedSize2D<DevicePixel, u32>, _parent: glutin::WindowID) -> Rc<Window> {
pub fn new(_is_foreground: bool,
window_size: TypedSize2D<DevicePixel, u32>,
_parent: glutin::WindowID) -> Rc<Window> {
let window_size = window_size.to_untyped();
let headless_builder = glutin::HeadlessRendererBuilder::new(window_size.width,
window_size.height);

View file

@ -117,7 +117,8 @@ fn read_input_device(device_path: &Path,
let touchWidth = x_info.maximum - x_info.minimum;
let touchHeight = y_info.maximum - y_info.minimum;
println!("xMin: {}, yMin: {}, touchWidth: {}, touchHeight: {}", x_info.minimum, y_info.minimum, touchWidth, touchHeight);
println!("xMin: {}, yMin: {}, touchWidth: {}, touchHeight: {}",
x_info.minimum, y_info.minimum, touchWidth, touchHeight);
// XXX: Why isn't size_of treated as constant?
// let buf: [u8; (16 * size_of::<linux_input_event>())];
@ -168,12 +169,15 @@ 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::MouseDown(MouseButton::Left, click_pt)))
.ok().unwrap();
sender.send(WindowEvent::MouseWindowEventClass(MouseWindowEvent::MouseUp(MouseButton::Left, click_pt)))
.ok().unwrap();
sender.send(WindowEvent::MouseWindowEventClass(MouseWindowEvent::Click(MouseButton::Left, click_pt)))
.ok().unwrap();
sender.send(
WindowEvent::MouseWindowEventClass(
MouseWindowEvent::MouseDown(MouseButton::Left, click_pt))).ok().unwrap();
sender.send(
WindowEvent::MouseWindowEventClass(
MouseWindowEvent::MouseUp(MouseButton::Left, click_pt))).ok().unwrap();
sender.send(
WindowEvent::MouseWindowEventClass(
MouseWindowEvent::Click(MouseButton::Left, click_pt))).ok().unwrap();
}
} else {
println!("Touch down");
@ -188,15 +192,19 @@ fn read_input_device(device_path: &Path,
}
} else {
println!("Touch move x: {}, y: {}", slotA.x, slotA.y);
sender.send(WindowEvent::Scroll(TypedPoint2D((slotA.x - last_x) as f32, (slotA.y - last_y) as f32),
TypedPoint2D(slotA.x, slotA.y))).ok().unwrap();
sender.send(
WindowEvent::Scroll(TypedPoint2D((slotA.x - last_x) as f32, (slotA.y - last_y) as f32),
TypedPoint2D(slotA.x, slotA.y))).ok().unwrap();
last_x = slotA.x;
last_y = slotA.y;
if touch_count >= 2 {
let slotB = &slots[1];
let cur_dist = dist(slotA.x, slotB.x, slotA.y, slotB.y);
println!("Zooming {} {} {} {}", cur_dist, last_dist, screen_dist, ((screen_dist + (cur_dist - last_dist))/screen_dist));
sender.send(WindowEvent::Zoom((screen_dist + (cur_dist - last_dist))/screen_dist)).ok().unwrap();
println!("Zooming {} {} {} {}",
cur_dist, last_dist, screen_dist,
((screen_dist + (cur_dist - last_dist))/screen_dist));
sender.send(
WindowEvent::Zoom((screen_dist + (cur_dist - last_dist))/screen_dist)).ok().unwrap();
last_dist = cur_dist;
}
}

View file

@ -246,18 +246,22 @@ pub struct gralloc_module {
common: hw_module,
registerBuffer: extern fn(*const gralloc_module, *const native_handle) -> c_int,
unregisterBuffer: extern fn(*const gralloc_module, *const native_handle) -> c_int,
lock: extern fn(*const gralloc_module, *const native_handle, c_int, c_int, c_int, c_int, *mut *mut c_void) -> c_int,
lock: extern fn(*const gralloc_module, *const native_handle, c_int, c_int, c_int, c_int,
*mut *mut c_void) -> c_int,
unlock: extern fn(*const gralloc_module, *const native_handle) -> c_int,
perform: extern fn(*const gralloc_module, c_int, ...) -> c_int,
lock_ycbcr: extern fn(*const gralloc_module, *const native_handle, c_int, c_int, c_int, c_int, c_int, *mut android_ycbcr) -> c_int,
lock_ycbcr: extern fn(*const gralloc_module, *const native_handle, c_int, c_int, c_int, c_int,
c_int, *mut android_ycbcr) -> c_int,
reserved: [*mut c_void; 6],
}
#[repr(C)]
pub struct alloc_device {
common: hw_device,
allocSize: extern fn(*mut alloc_device, c_int, c_int, c_int, c_int, *mut *const native_handle, *mut c_int, c_int) -> c_int,
alloc: extern fn(*mut alloc_device, c_int, c_int, c_int, c_int, *mut *const native_handle, *mut c_int) -> c_int,
allocSize: extern fn(*mut alloc_device, c_int, c_int, c_int, c_int, *mut *const native_handle,
*mut c_int, c_int) -> c_int,
alloc: extern fn(*mut alloc_device, c_int, c_int, c_int, c_int, *mut *const native_handle,
*mut c_int) -> c_int,
free: extern fn(*mut alloc_device, *const native_handle) -> c_int,
dump: Option<extern fn(*mut alloc_device, *mut c_char, c_int)>,
reserved: [*mut c_void; 7],
@ -454,7 +458,8 @@ extern fn gnw_decRef(base: *mut ANativeBase) {
}
impl GonkNativeWindow {
pub fn new(alloc_dev: *mut alloc_device, hwc_dev: *mut hwc_composer_device, width: i32, height: i32, usage: c_int) -> *mut GonkNativeWindow {
pub fn new(alloc_dev: *mut alloc_device, hwc_dev: *mut hwc_composer_device, width: i32,
height: i32, usage: c_int) -> *mut GonkNativeWindow {
let win = box GonkNativeWindow {
window: ANativeWindow {
common: ANativeBase {
@ -561,7 +566,9 @@ impl GonkNativeWindow {
};
unsafe {
let mut displays: [*mut hwc_display_contents; 3] = [ &mut list, ptr::null_mut(), ptr::null_mut(), ];
let _ = ((*self.hwc_dev).prepare)(self.hwc_dev, displays.len() as size_t, transmute(displays.as_mut_ptr()));
let _ = ((*self.hwc_dev).prepare)(self.hwc_dev,
displays.len() as size_t,
transmute(displays.as_mut_ptr()));
let _ = ((*self.hwc_dev).set)(self.hwc_dev, displays.len() as size_t, transmute(displays.as_mut_ptr()));
if list.retireFenceFd >= 0 {
close(list.retireFenceFd);
@ -585,7 +592,10 @@ extern fn gnwb_decRef(base: *mut ANativeBase) {
}
impl GonkNativeWindowBuffer {
pub fn new(dev: *mut alloc_device, width: i32, height: i32, format: c_int, usage: c_int) -> *mut GonkNativeWindowBuffer {
pub fn new(dev: *mut alloc_device,
width: i32,
height: i32,
format: c_int, usage: c_int) -> *mut GonkNativeWindowBuffer {
let mut buf = box GonkNativeWindowBuffer {
buffer: ANativeWindowBuffer {
common: ANativeBase {
@ -607,7 +617,10 @@ impl GonkNativeWindowBuffer {
count: 1,
};
let ret = unsafe { ((*dev).alloc)(dev, width, height, format, usage, &mut buf.buffer.handle, &mut buf.buffer.stride) };
let ret = unsafe {
((*dev).alloc)(dev, width, height, format, usage,
&mut buf.buffer.handle, &mut buf.buffer.stride)
};
assert!(ret == 0, "Failed to allocate gralloc buffer!");
unsafe { transmute(buf) }