From 16e23d8228496343bf040cc9f17469757fffa1b4 Mon Sep 17 00:00:00 2001 From: Michael Wu Date: Sat, 20 Dec 2014 01:04:50 -0500 Subject: [PATCH] Make gonk port build again after the last rustup --- ports/gonk/Cargo.lock | 143 +++++++++++++++++++++------------------ ports/gonk/Cargo.toml | 2 - ports/gonk/src/input.rs | 22 +++--- ports/gonk/src/lib.rs | 10 ++- ports/gonk/src/main.rs | 83 ++++++++++------------- ports/gonk/src/window.rs | 14 ++-- 6 files changed, 140 insertions(+), 134 deletions(-) diff --git a/ports/gonk/Cargo.lock b/ports/gonk/Cargo.lock index fa5559a143b..ef041bfc22d 100644 --- a/ports/gonk/Cargo.lock +++ b/ports/gonk/Cargo.lock @@ -9,14 +9,13 @@ dependencies = [ "msg 0.0.1", "script 0.0.1", "servo 0.0.1", - "time 0.1.0 (git+https://github.com/rust-lang/time)", "util 0.0.1", ] [[package]] name = "azure" version = "0.1.0" -source = "git+https://github.com/servo/rust-azure#bfae54620eaca34df0ae43d2c1082298131c1aad" +source = "git+https://github.com/servo/rust-azure#fe95551ca22f2a75b0dd690a72841df39b33885d" dependencies = [ "core_foundation 0.1.0 (git+https://github.com/servo/rust-core-foundation)", "core_graphics 0.1.0 (git+https://github.com/servo/rust-core-graphics)", @@ -74,7 +73,7 @@ name = "cookie" version = "0.0.1" source = "git+https://github.com/servo/cookie-rs#f82090b19c2738b90528167ef873d8eac0353294" dependencies = [ - "openssl 0.0.1 (git+https://github.com/servo/rust-openssl)", + "openssl 0.0.2 (git+https://github.com/servo/rust-openssl)", "time 0.1.0 (git+https://github.com/rust-lang/time)", "url 0.1.0 (git+https://github.com/servo/rust-url)", ] @@ -82,7 +81,7 @@ dependencies = [ [[package]] name = "core_foundation" version = "0.1.0" -source = "git+https://github.com/servo/rust-core-foundation#6fa0b908f3912e20d081193e83bf5a9aa958fb83" +source = "git+https://github.com/servo/rust-core-foundation#d2dbe4fb6f6892521a37735cd7a97098d1b64808" [[package]] name = "core_graphics" @@ -106,7 +105,7 @@ name = "cssparser" version = "0.1.0" source = "git+https://github.com/servo/rust-cssparser#97d8c3b20a240881573748d4eadcda610bfb888c" dependencies = [ - "encoding 0.2.0 (git+https://github.com/lifthrasiir/rust-encoding)", + "encoding 0.2.3 (git+https://github.com/lifthrasiir/rust-encoding)", ] [[package]] @@ -132,8 +131,8 @@ source = "git+https://github.com/servo/rust-egl#88f2a13812ddbce2bf2317221663a61c [[package]] name = "encoding" -version = "0.2.0" -source = "git+https://github.com/lifthrasiir/rust-encoding#a06637cc6d0da37c12c68661e2ee9ca1999764a4" +version = "0.2.3" +source = "git+https://github.com/lifthrasiir/rust-encoding#15ac0ded3ca592c31ded5b9ff6f9fe2fa4b73fc4" dependencies = [ "encoding-index-japanese 1.0.20140915 (git+https://github.com/lifthrasiir/rust-encoding)", "encoding-index-korean 1.0.20140915 (git+https://github.com/lifthrasiir/rust-encoding)", @@ -145,27 +144,47 @@ dependencies = [ [[package]] name = "encoding-index-japanese" version = "1.0.20140915" -source = "git+https://github.com/lifthrasiir/rust-encoding#a06637cc6d0da37c12c68661e2ee9ca1999764a4" +source = "git+https://github.com/lifthrasiir/rust-encoding#15ac0ded3ca592c31ded5b9ff6f9fe2fa4b73fc4" +dependencies = [ + "encoding_index_tests 0.1.0 (git+https://github.com/lifthrasiir/rust-encoding)", +] [[package]] name = "encoding-index-korean" version = "1.0.20140915" -source = "git+https://github.com/lifthrasiir/rust-encoding#a06637cc6d0da37c12c68661e2ee9ca1999764a4" +source = "git+https://github.com/lifthrasiir/rust-encoding#15ac0ded3ca592c31ded5b9ff6f9fe2fa4b73fc4" +dependencies = [ + "encoding_index_tests 0.1.0 (git+https://github.com/lifthrasiir/rust-encoding)", +] [[package]] name = "encoding-index-simpchinese" version = "1.0.20140915" -source = "git+https://github.com/lifthrasiir/rust-encoding#a06637cc6d0da37c12c68661e2ee9ca1999764a4" +source = "git+https://github.com/lifthrasiir/rust-encoding#15ac0ded3ca592c31ded5b9ff6f9fe2fa4b73fc4" +dependencies = [ + "encoding_index_tests 0.1.0 (git+https://github.com/lifthrasiir/rust-encoding)", +] [[package]] name = "encoding-index-singlebyte" version = "1.0.20140915" -source = "git+https://github.com/lifthrasiir/rust-encoding#a06637cc6d0da37c12c68661e2ee9ca1999764a4" +source = "git+https://github.com/lifthrasiir/rust-encoding#15ac0ded3ca592c31ded5b9ff6f9fe2fa4b73fc4" +dependencies = [ + "encoding_index_tests 0.1.0 (git+https://github.com/lifthrasiir/rust-encoding)", +] [[package]] name = "encoding-index-tradchinese" version = "1.0.20140915" -source = "git+https://github.com/lifthrasiir/rust-encoding#a06637cc6d0da37c12c68661e2ee9ca1999764a4" +source = "git+https://github.com/lifthrasiir/rust-encoding#15ac0ded3ca592c31ded5b9ff6f9fe2fa4b73fc4" +dependencies = [ + "encoding_index_tests 0.1.0 (git+https://github.com/lifthrasiir/rust-encoding)", +] + +[[package]] +name = "encoding_index_tests" +version = "0.1.0" +source = "git+https://github.com/lifthrasiir/rust-encoding#15ac0ded3ca592c31ded5b9ff6f9fe2fa4b73fc4" [[package]] name = "expat-sys" @@ -197,12 +216,12 @@ source = "git+https://github.com/servo/rust-freetype#e55b06110fb2d74a2db68ead740 [[package]] name = "freetype-sys" version = "2.4.11" -source = "git+https://github.com/servo/libfreetype2#5b6499164106f094937565595c7b96d07de55521" +source = "git+https://github.com/servo/libfreetype2#f5c49c0da1d5bc6b206c4176344012ac37524243" [[package]] name = "gcc" -version = "0.1.1" -source = "git+https://github.com/alexcrichton/gcc-rs#d35c34c871dd75f97fadf04cb0ed85d997a9bc0c" +version = "0.0.2" +source = "git+https://github.com/alexcrichton/gcc-rs#903e8f8a2e3766ad3d514404d452dbaa1d3b2d79" [[package]] name = "geom" @@ -237,16 +256,16 @@ dependencies = [ [[package]] name = "gl_common" version = "0.0.1" -source = "git+https://github.com/bjz/gl-rs.git#79cd3b3f9f19aa0e39f6af572fc8673a6d9760bc" +source = "git+https://github.com/bjz/gl-rs.git#c76c23fc9a0dae824b45550d4b823cdb726f242d" [[package]] name = "gl_generator" version = "0.0.1" -source = "git+https://github.com/bjz/gl-rs.git#79cd3b3f9f19aa0e39f6af572fc8673a6d9760bc" +source = "git+https://github.com/bjz/gl-rs.git#c76c23fc9a0dae824b45550d4b823cdb726f242d" dependencies = [ "gl_common 0.0.1 (git+https://github.com/bjz/gl-rs.git)", - "khronos_api 0.0.1 (git+https://github.com/bjz/gl-rs.git)", - "rust-xml 0.1.0 (git+https://github.com/netvl/rust-xml)", + "khronos_api 0.0.2 (git+https://github.com/bjz/gl-rs.git)", + "rust-xml 0.1.2-pre (git+https://github.com/netvl/rust-xml)", ] [[package]] @@ -291,14 +310,13 @@ source = "git+https://github.com/servo/html5ever#e6f8d83de9fffe63a825d95d957ba6b [[package]] name = "hyper" version = "0.0.1" -source = "git+https://github.com/servo/hyper?ref=servo#dd9d1830f35f7a8371b1b3bcb2d3e9cf2763f33f" +source = "git+https://github.com/servo/hyper?ref=servo#9c70c58e65ec80446fdb6e338f1060589b562f8c" dependencies = [ "cookie 0.0.1 (git+https://github.com/servo/cookie-rs)", "mime 0.0.1 (git+https://github.com/hyperium/mime.rs)", - "move-acceptor 0.0.1 (git+https://github.com/reem/rust-move-acceptor)", - "openssl 0.0.1 (git+https://github.com/servo/rust-openssl)", - "typeable 0.0.3 (git+https://github.com/reem/rust-typeable)", - "unsafe-any 0.1.1 (git+https://github.com/reem/rust-unsafe-any)", + "openssl 0.0.2 (git+https://github.com/servo/rust-openssl)", + "time 0.1.0 (git+https://github.com/rust-lang/time)", + "unsafe-any 0.1.0 (git+https://github.com/reem/rust-unsafe-any)", "url 0.1.0 (git+https://github.com/servo/rust-url)", ] @@ -316,15 +334,15 @@ dependencies = [ [[package]] name = "js" version = "0.1.0" -source = "git+https://github.com/servo/rust-mozjs#7563bbd5abf12a1f0d01661c525b1f2491f783a9" +source = "git+https://github.com/servo/rust-mozjs#e04e7307a3e52f46bc9ba3d5682188285110bc67" dependencies = [ "mozjs-sys 0.0.0 (git+https://github.com/servo/mozjs)", ] [[package]] name = "khronos_api" -version = "0.0.1" -source = "git+https://github.com/bjz/gl-rs.git#79cd3b3f9f19aa0e39f6af572fc8673a6d9760bc" +version = "0.0.2" +source = "git+https://github.com/bjz/gl-rs.git#c76c23fc9a0dae824b45550d4b823cdb726f242d" [[package]] name = "layers" @@ -346,7 +364,7 @@ name = "layout" version = "0.0.1" dependencies = [ "cssparser 0.1.0 (git+https://github.com/servo/rust-cssparser)", - "encoding 0.2.0 (git+https://github.com/lifthrasiir/rust-encoding)", + "encoding 0.2.3 (git+https://github.com/lifthrasiir/rust-encoding)", "geom 0.1.0 (git+https://github.com/servo/rust-geom)", "gfx 0.0.1", "layout_traits 0.0.1", @@ -379,8 +397,8 @@ source = "git+https://github.com/Kimundi/lazy-static.rs#62976cb611c5396e11315ae6 [[package]] name = "libressl-pnacl-sys" -version = "2.0.2" -source = "git+https://github.com/DiamondLovesYou/libressl-pnacl-sys.git#8e9349e0280b069bfab247a2202cd10b8beae154" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "pnacl-build-helper 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -388,12 +406,7 @@ dependencies = [ [[package]] name = "mime" version = "0.0.1" -source = "git+https://github.com/hyperium/mime.rs#5264e04655974f85c8d6581395cc24597266c653" - -[[package]] -name = "move-acceptor" -version = "0.0.1" -source = "git+https://github.com/reem/rust-move-acceptor#25c5c33a83f605fdd0f3d37d2589e2b0b4e6cbd1" +source = "git+https://github.com/hyperium/mime.rs#7898f1c29c7f5d35d0c3c7aed37ebcfc95a40873" [[package]] name = "mozjs-sys" @@ -430,25 +443,25 @@ dependencies = [ [[package]] name = "openssl" -version = "0.0.1" -source = "git+https://github.com/servo/rust-openssl#0a3cace0265fe286b505508aa6e5096fc94a6896" +version = "0.0.2" +source = "git+https://github.com/servo/rust-openssl#19d9b53a86d602e16ab2274813a517cfaa4a2512" dependencies = [ - "libressl-pnacl-sys 2.0.2 (git+https://github.com/DiamondLovesYou/libressl-pnacl-sys.git)", - "openssl-sys 0.0.1 (git+https://github.com/servo/rust-openssl)", + "libressl-pnacl-sys 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl-sys 0.0.2 (git+https://github.com/servo/rust-openssl)", ] [[package]] name = "openssl-sys" -version = "0.0.1" -source = "git+https://github.com/servo/rust-openssl#0a3cace0265fe286b505508aa6e5096fc94a6896" +version = "0.0.2" +source = "git+https://github.com/servo/rust-openssl#19d9b53a86d602e16ab2274813a517cfaa4a2512" dependencies = [ - "pkg-config 0.1.0 (git+https://github.com/alexcrichton/pkg-config-rs)", + "pkg-config 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "phf" version = "0.0.0" -source = "git+https://github.com/sfackler/rust-phf#18a5ecc028055c3dbd650cc5a064b6fb033d82ef" +source = "git+https://github.com/sfackler/rust-phf#aa3e2d0aedea4d55c2e4cea1bdf6e89418dc1206" dependencies = [ "xxhash 0.0.1 (git+https://github.com/Jurily/rust-xxhash)", ] @@ -456,15 +469,16 @@ dependencies = [ [[package]] name = "phf_mac" version = "0.0.0" -source = "git+https://github.com/sfackler/rust-phf#18a5ecc028055c3dbd650cc5a064b6fb033d82ef" +source = "git+https://github.com/sfackler/rust-phf#aa3e2d0aedea4d55c2e4cea1bdf6e89418dc1206" dependencies = [ + "time 0.1.0 (git+https://github.com/rust-lang/time)", "xxhash 0.0.1 (git+https://github.com/Jurily/rust-xxhash)", ] [[package]] name = "pkg-config" -version = "0.1.0" -source = "git+https://github.com/alexcrichton/pkg-config-rs#9b3b44a2e1a8ccc70c3f701aeb5154ad79e665e9" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "plugins" @@ -478,7 +492,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "png" version = "0.1.0" -source = "git+https://github.com/servo/rust-png#b0b4acde0080dd475dee93615276bfc19207a21e" +source = "git+https://github.com/servo/rust-png#f060a2d9484a150de286f930eb80f9f3bff3ea38" dependencies = [ "png-sys 1.6.3 (git+https://github.com/servo/libpng?ref=servo)", ] @@ -490,8 +504,8 @@ source = "git+https://github.com/servo/libpng?ref=servo#d01f32b4eb86904695efe7fc [[package]] name = "rust-xml" -version = "0.1.0" -source = "git+https://github.com/netvl/rust-xml#d6c57380a300b94f7e7881979dbe5459dbe4ca06" +version = "0.1.2-pre" +source = "git+https://github.com/netvl/rust-xml#2d9df3267aeaa4d442e1e19a4dfed733cb1397ed" [[package]] name = "script" @@ -500,7 +514,7 @@ dependencies = [ "canvas 0.0.1", "cssparser 0.1.0 (git+https://github.com/servo/rust-cssparser)", "devtools_traits 0.0.1", - "encoding 0.2.0 (git+https://github.com/lifthrasiir/rust-encoding)", + "encoding 0.2.3 (git+https://github.com/lifthrasiir/rust-encoding)", "geom 0.1.0 (git+https://github.com/servo/rust-geom)", "gfx 0.0.1", "html5ever 0.0.0 (git+https://github.com/servo/html5ever)", @@ -516,7 +530,7 @@ dependencies = [ "time 0.1.0 (git+https://github.com/rust-lang/time)", "url 0.1.0 (git+https://github.com/servo/rust-url)", "util 0.0.1", - "uuid 0.0.1 (git+https://github.com/rust-lang/uuid)", + "uuid 0.0.2 (git+https://github.com/rust-lang/uuid)", ] [[package]] @@ -558,12 +572,12 @@ dependencies = [ [[package]] name = "stb_image" version = "0.1.0" -source = "git+https://github.com/servo/rust-stb-image#74488fef4740acf287ff5dc248d65cc74033467a" +source = "git+https://github.com/servo/rust-stb-image#97d7e440e80e41a304647363c322eab68e3700aa" [[package]] name = "string_cache" version = "0.0.0" -source = "git+https://github.com/servo/string-cache#ae950525434b642eff5f4904f5e0c76cd6ea99b9" +source = "git+https://github.com/servo/string-cache#a18a432fd274e816fc41876536f70e5380abb677" dependencies = [ "lazy_static 0.1.0 (git+https://github.com/Kimundi/lazy-static.rs)", "phf 0.0.0 (git+https://github.com/sfackler/rust-phf)", @@ -575,7 +589,7 @@ dependencies = [ [[package]] name = "string_cache_macros" version = "0.0.0" -source = "git+https://github.com/servo/string-cache#ae950525434b642eff5f4904f5e0c76cd6ea99b9" +source = "git+https://github.com/servo/string-cache#a18a432fd274e816fc41876536f70e5380abb677" dependencies = [ "lazy_static 0.1.0 (git+https://github.com/Kimundi/lazy-static.rs)", ] @@ -585,7 +599,7 @@ name = "style" version = "0.0.1" dependencies = [ "cssparser 0.1.0 (git+https://github.com/servo/rust-cssparser)", - "encoding 0.2.0 (git+https://github.com/lifthrasiir/rust-encoding)", + "encoding 0.2.3 (git+https://github.com/lifthrasiir/rust-encoding)", "geom 0.1.0 (git+https://github.com/servo/rust-geom)", "lazy_static 0.1.0 (git+https://github.com/Kimundi/lazy-static.rs)", "plugins 0.0.1", @@ -604,18 +618,13 @@ name = "time" version = "0.1.0" source = "git+https://github.com/rust-lang/time#afab521f3b91658a3ba2d3e877b7e01699733bef" dependencies = [ - "gcc 0.1.1 (git+https://github.com/alexcrichton/gcc-rs)", + "gcc 0.0.2 (git+https://github.com/alexcrichton/gcc-rs)", ] -[[package]] -name = "typeable" -version = "0.0.3" -source = "git+https://github.com/reem/rust-typeable#db8975daaa3889871f67eea11baeaefd8e706eaf" - [[package]] name = "unsafe-any" -version = "0.1.1" -source = "git+https://github.com/reem/rust-unsafe-any#eb3fe87bea85f375b8fcefa0cdecfd131fae9624" +version = "0.1.0" +source = "git+https://github.com/reem/rust-unsafe-any#2863af363bbd83079b6773920bba5b736408db33" [[package]] name = "url" @@ -638,8 +647,8 @@ dependencies = [ [[package]] name = "uuid" -version = "0.0.1" -source = "git+https://github.com/rust-lang/uuid#7c5af48d4f9074717199e05a1895f42b9fb1c1f0" +version = "0.0.2" +source = "git+https://github.com/rust-lang/uuid#f5d94d0043a615756edefaf9c6041f11e52b8370" [[package]] name = "xlib" @@ -649,5 +658,5 @@ source = "git+https://github.com/servo/rust-xlib#58ec3847b592aeabdcfeb6a2d02033d [[package]] name = "xxhash" version = "0.0.1" -source = "git+https://github.com/Jurily/rust-xxhash#7e4174e780af0cfb29a5e53ede0b987adca16396" +source = "git+https://github.com/Jurily/rust-xxhash#64f8d02314735f511cb4272563d0f703d575c159" diff --git a/ports/gonk/Cargo.toml b/ports/gonk/Cargo.toml index ac0740b1ba9..c2a0a9bfc9f 100644 --- a/ports/gonk/Cargo.toml +++ b/ports/gonk/Cargo.toml @@ -30,5 +30,3 @@ path = "../../components/util" [dependencies.egl] git = "https://github.com/servo/rust-egl" -[dependencies.time] -git = "https://github.com/rust-lang/time" diff --git a/ports/gonk/src/input.rs b/ports/gonk/src/input.rs index 067d655ac40..7585df021c4 100644 --- a/ports/gonk/src/input.rs +++ b/ports/gonk/src/input.rs @@ -7,6 +7,7 @@ use std::mem::size_of; use std::mem::transmute; use std::mem::zeroed; use std::os::errno; +use std::num::Float; use geom::point::TypedPoint2D; @@ -18,12 +19,7 @@ use libc::read; use libc::O_RDONLY; use compositing::windowing::WindowEvent; -use compositing::windowing::ScrollWindowEvent; -use compositing::windowing::ZoomWindowEvent; -use compositing::windowing::MouseWindowMouseDownEvent; -use compositing::windowing::MouseWindowMouseUpEvent; -use compositing::windowing::MouseWindowClickEvent; -use compositing::windowing::MouseWindowEventClass; +use compositing::windowing::MouseWindowEvent; extern { @@ -90,7 +86,7 @@ fn dist(x1: i32, x2: i32, y1: i32, y2: i32) -> f32 { } fn read_input_device(device_path: &Path, - sender: &Sender>) { + sender: &Sender) { // XXX we really want to use std::io:File but it currently doesn't expose // the raw FD which is necessary for ioctl. let device = unsafe { device_path.as_str().unwrap().with_c_str(|s| open(s, O_RDONLY, 0)) }; @@ -164,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(Some(MouseWindowEventClass(MouseWindowMouseDownEvent(0, click_pt)))); - sender.send(Some(MouseWindowEventClass(MouseWindowMouseUpEvent(0, click_pt)))); - sender.send(Some(MouseWindowEventClass(MouseWindowClickEvent(0, click_pt)))); + 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))); } } else { println!("Touch down"); @@ -181,14 +177,14 @@ fn read_input_device(device_path: &Path, } } else { println!("Touch move x: {}, y: {}", slotA.x, slotA.y); - sender.send(Some(ScrollWindowEvent(TypedPoint2D((slotA.x - last_x) as f32, (slotA.y - last_y) as f32), TypedPoint2D(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))); 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(Some(ZoomWindowEvent((screen_dist + (cur_dist - last_dist))/screen_dist))); + sender.send(WindowEvent::Zoom((screen_dist + (cur_dist - last_dist))/screen_dist)); last_dist = cur_dist; } } @@ -232,7 +228,7 @@ fn read_input_device(device_path: &Path, } } -pub fn run_input_loop(event_sender: &Sender>) { +pub fn run_input_loop(event_sender: &Sender) { let sender = event_sender.clone(); spawn(proc () { // XXX need to scan all devices and read every one. diff --git a/ports/gonk/src/lib.rs b/ports/gonk/src/lib.rs index 602da1bf9d6..1fc84d8baa4 100644 --- a/ports/gonk/src/lib.rs +++ b/ports/gonk/src/lib.rs @@ -117,7 +117,7 @@ impl Browser where Window: WindowMethods + 'static { for url in opts.urls.iter() { let url = match url::Url::parse(url.as_slice()) { Ok(url) => url, - Err(url::RelativeUrlWithoutBase) + Err(url::ParseError::RelativeUrlWithoutBase) => url::Url::from_file_path(&cwd.join(url.as_slice())).unwrap(), Err(_) => panic!("URL parsing failed"), }; @@ -153,6 +153,14 @@ impl Browser where Window: WindowMethods + 'static { self.compositor.repaint_synchronously() } + pub fn pinch_zoom_level(&self) -> f32 { + self.compositor.pinch_zoom_level() + } + + pub fn get_title_for_main_frame(&self) { + self.compositor.get_title_for_main_frame() + } + pub fn shutdown(mut self) { self.compositor.shutdown(); } diff --git a/ports/gonk/src/main.rs b/ports/gonk/src/main.rs index 356fed244eb..368c392aa9e 100644 --- a/ports/gonk/src/main.rs +++ b/ports/gonk/src/main.rs @@ -8,8 +8,6 @@ #![deny(unused_imports)] #![deny(unused_variables)] -#![allow(non_snake_case)] - extern crate servo; extern crate native; extern crate time; @@ -27,8 +25,7 @@ extern crate egl; use servo_util::opts; use servo_util::rtinstrument; use servo::Browser; -use compositing::windowing::IdleWindowEvent; -use compositing::windowing::InitializeCompositingWindowEvent; +use compositing::windowing::WindowEvent; use std::os; @@ -39,50 +36,44 @@ struct BrowserWrapper { browser: Browser, } -#[start] -#[allow(dead_code)] -fn start(argc: int, argv: *const *const u8) -> int { - native::start(argc, argv, proc() { - if opts::from_cmdline_args(os::args().as_slice()) { - let window = if opts::get().headless { - None - } else { - Some(window::Window::new()) - }; +fn main() { + if opts::from_cmdline_args(os::args().as_slice()) { + let window = if opts::get().headless { + None + } else { + Some(window::Window::new()) + }; - let mut browser = BrowserWrapper { - browser: Browser::new(window.clone()), - }; + let mut browser = BrowserWrapper { + browser: Browser::new(window.clone()), + }; - match window { - None => (), - Some(ref window) => input::run_input_loop(&window.event_send) - } - - browser.browser.handle_event(InitializeCompositingWindowEvent); - - loop { - let should_continue = match window { - None => browser.browser.handle_event(IdleWindowEvent), - Some(ref window) => { - match window.wait_events() { - Some(evt) => browser.browser.handle_event(evt), - None => browser.browser.handle_event(IdleWindowEvent), - } - } - }; - if !should_continue { - break - } - } - - let BrowserWrapper { - browser - } = browser; - browser.shutdown(); - - rtinstrument::teardown(); + match window { + None => (), + Some(ref window) => input::run_input_loop(&window.event_send) } - }) + + browser.browser.handle_event(WindowEvent::InitializeCompositing); + + loop { + let should_continue = match window { + None => browser.browser.handle_event(WindowEvent::Idle), + Some(ref window) => { + let event = window.wait_events(); + browser.browser.handle_event(event) + } + }; + if !should_continue { + break + } + } + + let BrowserWrapper { + browser + } = browser; + browser.shutdown(); + + rtinstrument::teardown(); + } } diff --git a/ports/gonk/src/window.rs b/ports/gonk/src/window.rs index d4795f30cee..141cd409843 100644 --- a/ports/gonk/src/window.rs +++ b/ports/gonk/src/window.rs @@ -22,6 +22,7 @@ use std::mem::transmute; use std::mem::size_of; use std::mem::zeroed; use std::ptr; +use servo_util::cursor::Cursor; use servo_util::geometry::ScreenPx; use gleam::gl; @@ -612,8 +613,8 @@ impl GonkNativeWindowBuffer { /// The type of a window. pub struct Window { - event_recv: Receiver>, - pub event_send: Sender>, + event_recv: Receiver, + pub event_send: Sender, width: i32, height: i32, native_window: *mut GonkNativeWindow, @@ -753,7 +754,7 @@ impl Window { Rc::new(window) } - pub fn wait_events(&self) -> Option { + pub fn wait_events(&self) -> WindowEvent { self.event_recv.recv() } } @@ -824,6 +825,9 @@ impl WindowMethods for Window { box receiver as Box) } + fn set_cursor(&self, _: Cursor) { + } + fn prepare_for_composite(&self) -> bool { true } @@ -831,14 +835,14 @@ impl WindowMethods for Window { struct GonkCompositorProxy { sender: Sender, - event_sender: Sender>, + event_sender: Sender, } impl CompositorProxy for GonkCompositorProxy { fn send(&mut self, msg: compositor_task::Msg) { // Send a message and kick the OS event loop awake. self.sender.send(msg); - self.event_sender.send(None); + self.event_sender.send(WindowEvent::Idle); } fn clone_compositor_proxy(&self) -> Box { box GonkCompositorProxy {