Take a reference to a window in GraphicsContext::new, like glutin and wgpu

This commit is contained in:
Jeremy Soller 2022-12-20 08:43:26 -07:00
parent 85b4f189bd
commit 99d63063b6
13 changed files with 40 additions and 78 deletions

View file

@ -1,4 +1,3 @@
use raw_window_handle::HasRawWindowHandle;
use raw_window_handle::WebWindowHandle;
use wasm_bindgen::Clamped;
use wasm_bindgen::JsCast;
@ -15,7 +14,7 @@ pub struct WebImpl {
}
impl WebImpl {
pub fn new<W: HasRawWindowHandle>(handle: WebWindowHandle) -> Result<Self, SwBufError<W>> {
pub fn new(handle: WebWindowHandle) -> Result<Self, SwBufError> {
let canvas: HtmlCanvasElement = web_sys::window()
.ok_or_else(|| {
SwBufError::PlatformError(