-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
/
lib.rs
49 lines (40 loc) · 1.42 KB
/
lib.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
//! A simple application that uses glutin to open a window for Servo to display in.
#![feature(box_syntax)]
#[macro_use] extern crate bitflags;
extern crate compositing;
#[allow(unused_extern_crates)]
#[cfg(target_os = "android")] extern crate egl;
extern crate euclid;
extern crate gleam;
extern crate glutin;
extern crate layers;
#[macro_use] extern crate log;
extern crate msg;
extern crate net_traits;
extern crate script_traits;
extern crate style_traits;
extern crate url;
extern crate util;
#[cfg(target_os = "linux")] extern crate x11;
#[cfg(target_os = "windows")] extern crate winapi;
#[cfg(target_os = "windows")] extern crate user32;
#[cfg(target_os = "windows")] extern crate gdi32;
use compositing::windowing::WindowEvent;
use std::rc::Rc;
use util::opts;
use window::Window;
pub mod window;
pub type WindowID = glutin::WindowID;
pub trait NestedEventLoopListener {
fn handle_event_from_nested_event_loop(&mut self, event: WindowEvent) -> bool;
}
pub fn create_window(parent: Option<WindowID>) -> Rc<Window> {
// Read command-line options.
let opts = opts::get();
let foreground = opts.output_file.is_none() && !opts.headless;
// Open a window.
Window::new(foreground, opts.initial_window_size, parent)
}