Skip to content

Remove SurfaceExtWeb#332

Merged
madsmtm merged 2 commits intomasterfrom
madsmtm/remove-web-ext
Feb 7, 2026
Merged

Remove SurfaceExtWeb#332
madsmtm merged 2 commits 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
Co-authored-by: daxpedda <daxpedda@gmail.com>
@madsmtm madsmtm merged commit bf2e769 into master Feb 7, 2026
1 check passed
@madsmtm madsmtm deleted the madsmtm/remove-web-ext branch February 7, 2026 22:43
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.

2 participants