Skip to content

Remove SurfaceExtWeb#332

Open
madsmtm wants to merge 1 commit intomasterfrom
madsmtm/remove-web-ext
Open

Remove SurfaceExtWeb#332
madsmtm wants to merge 1 commit intomasterfrom
madsmtm/remove-web-ext

Conversation

@madsmtm
Copy link
Member

@madsmtm madsmtm commented Feb 6, 2026

Remove SurfaceExtWeb and the associated NoDisplayHandle and NoWindowHandle helpers.

These were added before raw-window-handle got support for the canvas and offscreen canvas handles, so they should now be redundant - users can instead do:

#[derive(Debug, Clone)]
struct Handle(web_sys::HtmlCanvasElement);

impl HasDisplayHandle for Handle {
    fn display_handle(&self) -> Result<DisplayHandle<'_>, HandleError> {
        Ok(DisplayHandle::web())
    }
}

impl HasWindowHandle for Handle {
    fn window_handle(&self) -> Result<WindowHandle<'_>, HandleError> {
        let value: &js_sys::JsValue = &self.0; // Deref to `JsValue`
        let obj: NonNull<c_void> = NonNull::from(value).cast();
        let mut handle = WebCanvasWindowHandle::new(obj);
        Ok(unsafe { WindowHandle::borrow_raw(handle) })
    }
}

let context = Context::new(handle.clone());
let surface = Surface::new(handle, &context);

Or ideally use a library that provides them with such a type.

CC @daxpedda

This was added before raw-window-handle got support for the canvas and
offscreen canvas handles, so they should now be redundant.
@madsmtm madsmtm requested a review from daxpedda as a code owner February 6, 2026 06:44
@madsmtm madsmtm added enhancement New feature or request DS - Web WebAssembly / WASM backend labels Feb 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

DS - Web WebAssembly / WASM backend enhancement New feature or request

Development

Successfully merging this pull request may close these issues.

1 participant