[emscripten] request canvas size instead of CSS size (#370)

This commit is contained in:
Dzmitry Malyshau 2017-12-27 12:37:01 -05:00 committed by Pierre Krieger
parent f89dc9e903
commit a8d5a9e1ab
2 changed files with 16 additions and 4 deletions

View file

@ -6,7 +6,7 @@ use std::mem;
use std::os::raw::{c_char, c_void, c_double, c_ulong, c_int};
use std::ptr;
use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::{Mutex, Arc, Weak};
use std::sync::{Mutex, Arc};
use std::cell::RefCell;
use std::collections::VecDeque;
@ -424,10 +424,11 @@ impl Window {
pub fn get_inner_size(&self) -> Option<(u32, u32)> {
unsafe {
use std::{mem, ptr};
let mut width = mem::uninitialized();
let mut height = mem::uninitialized();
let mut width = 0;
let mut height = 0;
let mut fullscreen = 0;
if ffi::emscripten_get_element_css_size(ptr::null(), &mut width, &mut height)
if ffi::emscripten_get_canvas_size(&mut width, &mut height, &mut fullscreen)
!= ffi::EMSCRIPTEN_RESULT_SUCCESS
{
None