Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump raw-window-handle = "0.6.2"? #193

Open
GaussianWonder opened this issue Jun 22, 2024 · 0 comments
Open

Bump raw-window-handle = "0.6.2"? #193

GaussianWonder opened this issue Jun 22, 2024 · 0 comments

Comments

@GaussianWonder
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant