mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Add glutin port (supported on Linux only currently).
Default build uses glfw, but glutin can be enabled via: ./mach cargo build --no-default-features --features=glutin
This commit is contained in:
parent
64cc9ec688
commit
0278920343
12 changed files with 659 additions and 14 deletions
|
@ -19,6 +19,12 @@ use std::os;
|
|||
use std::ptr;
|
||||
use std::rt;
|
||||
|
||||
#[deriving(Clone)]
|
||||
pub enum RenderApi {
|
||||
OpenGL,
|
||||
Mesa,
|
||||
}
|
||||
|
||||
/// Global flags for Servo, currently set on the command line.
|
||||
#[deriving(Clone)]
|
||||
pub struct Opts {
|
||||
|
@ -108,6 +114,8 @@ pub struct Opts {
|
|||
|
||||
/// Whether to show an error when display list geometry escapes flow overflow regions.
|
||||
pub validate_display_list_geometry: bool,
|
||||
|
||||
pub render_api: RenderApi,
|
||||
}
|
||||
|
||||
fn print_usage(app: &str, opts: &[getopts::OptGroup]) {
|
||||
|
@ -175,6 +183,7 @@ fn default_opts() -> Opts {
|
|||
dump_flow_tree: false,
|
||||
validate_display_list_geometry: false,
|
||||
profile_tasks: false,
|
||||
render_api: OpenGL,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -201,7 +210,8 @@ pub fn from_cmdline_args(args: &[String]) -> bool {
|
|||
getopts::optopt("", "resolution", "Set window resolution.", "800x600"),
|
||||
getopts::optopt("u", "user-agent", "Set custom user agent string", "NCSA Mosaic/1.0 (X11;SunOS 4.1.4 sun4m)"),
|
||||
getopts::optopt("Z", "debug", "A comma-separated string of debug options. Pass help to show available options.", ""),
|
||||
getopts::optflag("h", "help", "Print this message")
|
||||
getopts::optflag("h", "help", "Print this message"),
|
||||
getopts::optopt("r", "render-api", "Set the rendering API to use", "gl|mesa"),
|
||||
);
|
||||
|
||||
let opt_match = match getopts::getopts(args, opts.as_slice()) {
|
||||
|
@ -291,6 +301,15 @@ pub fn from_cmdline_args(args: &[String]) -> bool {
|
|||
}
|
||||
};
|
||||
|
||||
let render_api = match opt_match.opt_str("r").unwrap_or("gl".to_string()).as_slice() {
|
||||
"mesa" => Mesa,
|
||||
"gl" => OpenGL,
|
||||
_ => {
|
||||
args_fail("Unknown render api specified");
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
let opts = Opts {
|
||||
urls: urls,
|
||||
n_render_threads: n_render_threads,
|
||||
|
@ -317,6 +336,7 @@ pub fn from_cmdline_args(args: &[String]) -> bool {
|
|||
enable_text_antialiasing: !debug_options.contains(&"disable-text-aa"),
|
||||
dump_flow_tree: debug_options.contains(&"dump-flow-tree"),
|
||||
validate_display_list_geometry: debug_options.contains(&"validate-display-list-geometry"),
|
||||
render_api: render_api,
|
||||
};
|
||||
|
||||
set_opts(opts);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue