baseview icon indicating copy to clipboard operation
baseview copied to clipboard

Bump raw-window-handle = "0.6.2"?

Open GaussianWonder opened this issue 1 year ago • 2 comments

Is an update to raw-window-handle possible?

It would allow integration with parented webview windows via wry >=v0.36.0.

The latest I can push in this direction currently is 0.35.2, at that stage wry still accepts HasRawWindowHandle trait.

I notice that keeping support for HasRawWindowHandle in newer versions requires some work, mainly:

raw_window_handle returns Result:

window.rs

unsafe impl<'a> HasRawWindowHandle for Window<'a> {
    fn raw_window_handle(&self) -> Result<RawWindowHandle, HandleError> {
        self.window.raw_window_handle()
    }
}

---WindowHandle accepts NonZero isize:

win/window.rs

unsafe impl HasRawWindowHandle for WindowHandle {
    fn raw_window_handle(&self) -> Result<RawWindowHandle, HandleError> {
        self.hwnd
            .ok_or(HandleError::Unavailable)
            .and_then(|hwnd| NonZeroIsize::new(hwnd as isize).ok_or(HandleError::Unavailable))
            .map(|hwnd| RawWindowHandle::Win32(Win32WindowHandle::new(hwnd)))
    }
}

This is where it occurred to me that these changes might not simply be a change of internal types, it can affect library to library operations, and it can unveil some hidden complexity I might not be aware of.

I am willing to continue working on a fork and making a PR for this, but I am not quite sure if this is the right approach.

On top of keeping support for the HasRawWindowHandle, there is also a HasWindowHandle trait now.

GaussianWonder avatar Jun 22 '24 18:06 GaussianWonder

I ran into this stuff too https://github.com/httnn/nih-plug-webview/issues/16

cristianvogel avatar Jan 04 '25 15:01 cristianvogel

Would also help with wgpu support

MendyBerger avatar Jul 22 '25 15:07 MendyBerger