mirror of
https://github.com/servo/servo.git
synced 2025-06-24 17:14:33 +01:00
fix android for rust update
This commit is contained in:
parent
ccb522a465
commit
aa636218e1
10 changed files with 37 additions and 33 deletions
|
@ -30,7 +30,7 @@ B := $(CFG_BUILD_DIR)
|
|||
MKFILE_DEPS := config.stamp $(call rwildcard,$(S)mk/,*)
|
||||
|
||||
CFG_GCCISH_CFLAGS += -DRUST_DEBUG
|
||||
CFG_RUSTC_FLAGS = -D unused-imports
|
||||
CFG_RUSTC_FLAGS += -D unused-imports
|
||||
|
||||
ifdef CFG_DISABLE_OPTIMIZE
|
||||
$(info cfg: disabling rustc optimization (CFG_DISABLE_OPTIMIZE))
|
||||
|
|
|
@ -76,7 +76,7 @@ impl FontHandleMethods for FontHandle {
|
|||
buf: ~[u8],
|
||||
style: &SpecifiedFontStyle)
|
||||
-> Result<FontHandle, ()> {
|
||||
let ft_ctx: FT_Library = fctx.ctx.borrow().ctx;
|
||||
let ft_ctx: FT_Library = fctx.ctx.ctx;
|
||||
if ft_ctx.is_null() { return Err(()); }
|
||||
|
||||
let face_result = create_face_from_buffer(ft_ctx, buf.as_ptr(), buf.len(), style.pt_size);
|
||||
|
@ -279,7 +279,7 @@ impl<'a> FontHandle {
|
|||
pub fn new_from_file(fctx: &FontContextHandle, file: &str,
|
||||
style: &SpecifiedFontStyle) -> Result<FontHandle, ()> {
|
||||
unsafe {
|
||||
let ft_ctx: FT_Library = fctx.ctx.borrow().ctx;
|
||||
let ft_ctx: FT_Library = fctx.ctx.ctx;
|
||||
if ft_ctx.is_null() { return Err(()); }
|
||||
|
||||
let mut face: FT_Face = ptr::null();
|
||||
|
@ -306,7 +306,7 @@ impl<'a> FontHandle {
|
|||
pub fn new_from_file_unstyled(fctx: &FontContextHandle, file: ~str)
|
||||
-> Result<FontHandle, ()> {
|
||||
unsafe {
|
||||
let ft_ctx: FT_Library = fctx.ctx.borrow().ctx;
|
||||
let ft_ctx: FT_Library = fctx.ctx.ctx;
|
||||
if ft_ctx.is_null() { return Err(()); }
|
||||
|
||||
let mut face: FT_Face = ptr::null();
|
||||
|
|
|
@ -25,7 +25,7 @@ use font_list::{FontEntry, FontFamily, FontFamilyMap};
|
|||
use platform::font::FontHandle;
|
||||
use platform::font_context::FontContextHandle;
|
||||
|
||||
use collections::hashmap::HashMap;
|
||||
use collections::HashMap;
|
||||
use std::libc;
|
||||
use std::libc::{c_int, c_char};
|
||||
use std::ptr;
|
||||
|
|
|
@ -9,6 +9,7 @@ use css::matching::{ApplicableDeclarationsCache, StyleSharingCandidateCache};
|
|||
use geom::size::Size2D;
|
||||
use gfx::display_list::OpaqueNode;
|
||||
use gfx::font_context::{FontContext, FontContextInfo};
|
||||
#[cfg(not(target_os="android"))]
|
||||
use green::task::GreenTask;
|
||||
use script::layout_interface::LayoutChan;
|
||||
use servo_msg::constellation_msg::ConstellationChan;
|
||||
|
@ -16,9 +17,13 @@ use servo_net::local_image_cache::LocalImageCache;
|
|||
use servo_util::geometry::Au;
|
||||
use servo_util::opts::Opts;
|
||||
use std::cast;
|
||||
#[cfg(not(target_os="android"))]
|
||||
use std::ptr;
|
||||
#[cfg(not(target_os="android"))]
|
||||
use std::rt::Runtime;
|
||||
#[cfg(not(target_os="android"))]
|
||||
use std::rt::local::Local;
|
||||
#[cfg(not(target_os="android"))]
|
||||
use std::rt::task::Task;
|
||||
use style::{ComputedValues, Stylist};
|
||||
use sync::{Arc, MutexArc};
|
||||
|
|
|
@ -97,7 +97,7 @@ impl WindowMethods<Application> for Window {
|
|||
impl glut::ReshapeCallback for ReshapeCallbackState {
|
||||
fn call(&self, width: c_int, height: c_int) {
|
||||
let tmp = local_window();
|
||||
tmp.borrow().event_queue.with_mut(|queue| queue.push(ResizeWindowEvent(width as uint, height as uint)))
|
||||
tmp.event_queue.borrow_mut().push(ResizeWindowEvent(width as uint, height as uint))
|
||||
}
|
||||
}
|
||||
glut::reshape_func(glut_window, ~ReshapeCallbackState);
|
||||
|
@ -105,7 +105,7 @@ impl WindowMethods<Application> for Window {
|
|||
impl glut::KeyboardCallback for KeyboardCallbackState {
|
||||
fn call(&self, key: c_uchar, _x: c_int, _y: c_int) {
|
||||
let tmp = local_window();
|
||||
tmp.borrow().handle_key(key)
|
||||
tmp.handle_key(key)
|
||||
}
|
||||
}
|
||||
glut::keyboard_func(~KeyboardCallbackState);
|
||||
|
@ -114,16 +114,16 @@ impl WindowMethods<Application> for Window {
|
|||
fn call(&self, button: c_int, state: c_int, x: c_int, y: c_int) {
|
||||
if button < 3 {
|
||||
let tmp = local_window();
|
||||
tmp.borrow().handle_mouse(button, state, x, y);
|
||||
tmp.handle_mouse(button, state, x, y);
|
||||
} else {
|
||||
match button {
|
||||
3 => {
|
||||
let tmp = local_window();
|
||||
tmp.borrow().event_queue.with_mut(|queue| queue.push(ScrollWindowEvent(Point2D(0.0, 5.0 as f32), Point2D(0.0 as i32, 5.0 as i32))));
|
||||
tmp.event_queue.borrow_mut().push(ScrollWindowEvent(Point2D(0.0, 5.0 as f32), Point2D(0.0 as i32, 5.0 as i32)));
|
||||
},
|
||||
4 => {
|
||||
let tmp = local_window();
|
||||
tmp.borrow().event_queue.with_mut(|queue| queue.push(ScrollWindowEvent(Point2D(0.0, -5.0 as f32), Point2D(0.0 as i32, -5.0 as i32))));
|
||||
tmp.event_queue.borrow_mut().push(ScrollWindowEvent(Point2D(0.0, -5.0 as f32), Point2D(0.0 as i32, -5.0 as i32)));
|
||||
},
|
||||
_ => {}
|
||||
}
|
||||
|
@ -150,15 +150,13 @@ impl WindowMethods<Application> for Window {
|
|||
}
|
||||
|
||||
fn recv(&self) -> WindowEvent {
|
||||
if !self.event_queue.with_mut(|queue| queue.is_empty()) {
|
||||
return self.event_queue.with_mut(|queue| queue.shift().unwrap())
|
||||
if !self.event_queue.borrow_mut().is_empty() {
|
||||
return self.event_queue.borrow_mut().shift().unwrap();
|
||||
}
|
||||
|
||||
glut::check_loop();
|
||||
if !self.event_queue.with_mut(|queue| queue.is_empty()) {
|
||||
self.event_queue.with_mut(|queue| queue.shift().unwrap())
|
||||
} else {
|
||||
IdleWindowEvent
|
||||
}
|
||||
|
||||
self.event_queue.borrow_mut().shift().unwrap_or(IdleWindowEvent)
|
||||
}
|
||||
|
||||
/// Sets the ready state.
|
||||
|
@ -174,7 +172,7 @@ impl WindowMethods<Application> for Window {
|
|||
self.render_state.get() == RenderingRenderState &&
|
||||
render_state == IdleRenderState {
|
||||
// page loaded
|
||||
self.event_queue.with_mut(|queue| queue.push(FinishedWindowEvent));
|
||||
self.event_queue.borrow_mut().push(FinishedWindowEvent);
|
||||
}
|
||||
|
||||
self.render_state.set(render_state);
|
||||
|
@ -219,16 +217,16 @@ impl Window {
|
|||
let modifiers = glut::get_modifiers();
|
||||
match key {
|
||||
42 => self.load_url(),
|
||||
43 => self.event_queue.with_mut(|queue| queue.push(ZoomWindowEvent(1.1))),
|
||||
45 => self.event_queue.with_mut(|queue| queue.push(ZoomWindowEvent(0.909090909))),
|
||||
56 => self.event_queue.with_mut(|queue| queue.push(ScrollWindowEvent(Point2D(0.0, 5.0 as f32), Point2D(0.0 as i32, 5.0 as i32)))),
|
||||
50 => self.event_queue.with_mut(|queue| queue.push(ScrollWindowEvent(Point2D(0.0, -5.0 as f32), Point2D(0.0 as i32, -5.0 as i32)))),
|
||||
43 => self.event_queue.borrow_mut().push(ZoomWindowEvent(1.1)),
|
||||
45 => self.event_queue.borrow_mut().push(ZoomWindowEvent(0.909090909)),
|
||||
56 => self.event_queue.borrow_mut().push(ScrollWindowEvent(Point2D(0.0, 5.0 as f32), Point2D(0.0 as i32, 5.0 as i32))),
|
||||
50 => self.event_queue.borrow_mut().push(ScrollWindowEvent(Point2D(0.0, -5.0 as f32), Point2D(0.0 as i32, -5.0 as i32))),
|
||||
127 => {
|
||||
if (modifiers & ACTIVE_SHIFT) != 0 {
|
||||
self.event_queue.with_mut(|queue| queue.push(NavigationWindowEvent(Forward)));
|
||||
self.event_queue.borrow_mut().push(NavigationWindowEvent(Forward));
|
||||
}
|
||||
else {
|
||||
self.event_queue.with_mut(|queue| queue.push(NavigationWindowEvent(Back)));
|
||||
self.event_queue.borrow_mut().push(NavigationWindowEvent(Back));
|
||||
}
|
||||
}
|
||||
_ => {}
|
||||
|
@ -253,14 +251,14 @@ impl Window {
|
|||
if pixel_dist < max_pixel_dist {
|
||||
let click_event = MouseWindowClickEvent(button as uint,
|
||||
Point2D(x as f32, y as f32));
|
||||
self.event_queue.with_mut(|queue| queue.push(MouseWindowEventClass(click_event)));
|
||||
self.event_queue.borrow_mut().push(MouseWindowEventClass(click_event));
|
||||
}
|
||||
}
|
||||
MouseWindowMouseUpEvent(button as uint, Point2D(x as f32, y as f32))
|
||||
}
|
||||
_ => fail!("I cannot recognize the type of mouse action that occured. :-(")
|
||||
};
|
||||
self.event_queue.with_mut(|queue| queue.push(MouseWindowEventClass(event)));
|
||||
self.event_queue.borrow_mut().push(MouseWindowEventClass(event));
|
||||
}
|
||||
|
||||
/// Helper function to pop up an alert box prompting the user to load a URL.
|
||||
|
@ -270,9 +268,9 @@ impl Window {
|
|||
alert.run();
|
||||
let value = alert.prompt_value();
|
||||
if "" == value { // To avoid crashing on Linux.
|
||||
self.event_queue.with_mut(|queue| queue.push(LoadUrlWindowEvent(~"http://purple.com/")))
|
||||
self.event_queue.borrow_mut().push(LoadUrlWindowEvent(~"http://purple.com/"))
|
||||
} else {
|
||||
self.event_queue.with_mut(|queue| queue.push(LoadUrlWindowEvent(value.clone())))
|
||||
self.event_queue.borrow_mut().push(LoadUrlWindowEvent(value.clone()))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -67,7 +67,8 @@ use servo_util::opts;
|
|||
#[cfg(not(test))]
|
||||
use servo_util::url::parse_url;
|
||||
|
||||
#[cfg(not(test))]
|
||||
#[cfg(not(test), target_os="linux")]
|
||||
#[cfg(not(test), target_os="macos")]
|
||||
use std::os;
|
||||
#[cfg(not(test), target_os="android")]
|
||||
use std::str;
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 5196a2a58249ac5cfb0a24418dc628551883c807
|
||||
Subproject commit 89757a91ba1b012cb003ceb60a121226f5646c02
|
|
@ -1 +1 @@
|
|||
Subproject commit 700b07bd663c6559326ef7126886e200aa3b0ab1
|
||||
Subproject commit c2b23d8aa8dc857536b1b68cf6646a1e11517161
|
|
@ -1 +1 @@
|
|||
Subproject commit 493a4311f1202907208aecdaf3fc4a4c192608eb
|
||||
Subproject commit 42f6584fff271939f9eb7af031710ff4b65df464
|
|
@ -1 +1 @@
|
|||
Subproject commit b00422e963694f7e46fe551a089b198badea5e1f
|
||||
Subproject commit a2671a7aec350a85f5de5b4838cbc500ecb03720
|
Loading…
Add table
Add a link
Reference in a new issue