mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Allow resolution to be configured on command line. Default to 1280x1024.
This commit is contained in:
parent
178843456f
commit
c33f18b7df
7 changed files with 31 additions and 9 deletions
|
@ -104,10 +104,13 @@ pub struct Window {
|
|||
|
||||
impl WindowMethods<Application> for Window {
|
||||
/// Creates a new window.
|
||||
fn new(app: &Application, is_foreground: bool) -> Rc<Window> {
|
||||
fn new(app: &Application, is_foreground: bool, size: TypedSize2D<DevicePixel, uint>) -> Rc<Window> {
|
||||
// Create the GLFW window.
|
||||
let window_size = size.to_untyped();
|
||||
app.glfw.window_hint(glfw::Visible(is_foreground));
|
||||
let (glfw_window, events) = app.glfw.create_window(800, 600, "Servo", glfw::Windowed)
|
||||
let (glfw_window, events) = app.glfw.create_window(window_size.width as u32,
|
||||
window_size.height as u32,
|
||||
"Servo", glfw::Windowed)
|
||||
.expect("Failed to create GLFW window");
|
||||
glfw_window.make_current();
|
||||
|
||||
|
|
|
@ -63,9 +63,10 @@ pub struct Window {
|
|||
|
||||
impl WindowMethods<Application> for Window {
|
||||
/// Creates a new window.
|
||||
fn new(_: &Application, _: bool) -> Rc<Window> {
|
||||
fn new(_: &Application, _: bool, size: TypedSize2D<DevicePixel, uint>) -> Rc<Window> {
|
||||
// Create the GLUT window.
|
||||
glut::init_window_size(800, 600);
|
||||
let window_size = size.to_untyped();
|
||||
glut::init_window_size(window_size.width, window_size.height);
|
||||
let glut_window = glut::create_window("Servo".to_string());
|
||||
|
||||
// Create our window object.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue