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

Allow fetching the raw window handle of a window by it's iced::window::Id. #2194

Closed
wants to merge 1 commit into from

Conversation

dtzxporter
Copy link
Contributor

This is useful for specific platform code that the user may want to integrate with iced.

@ids1024
Copy link
Contributor

ids1024 commented Jan 12, 2024

The ecosystem is moving to raw_window_handle::WindowHandle<'a> type, which has a lifetime parameter, analogous to BorrowedFd<'a>. (This is necessary since raw window handles contain pointers in some cases, and there's a desire to offer safe APIs.)

Not sure how this would work. It could still provide a raw handle, but that would make it unsafe to work with. Or it could return Arc<winit::Window> or some wrapper around things like that. rust-windowing/raw-window-handle#158 is relevant.

(#2191 has a WIP update to the latest raw-window-handle with the safe handle types.)

@dtzxporter
Copy link
Contributor Author

Because winit is unsound anyway, either method is technically introducing unsound code, and if winit rectifies the issue you would be unlikely to be able to Arc the window since the lifetime is tied to the windows and windows outlive the event loop.

I'm open to any approach FWIW that allows me to get the native handle from the window and manipulate it as it's necessary to fill a lot of issues with winit in general.

@dtzxporter
Copy link
Contributor Author

#2200 has an approach that will be easily upgraded once other dependencies become stable.

@dtzxporter
Copy link
Contributor Author

Closing because wgpu 0.19 is out and it will be easier to use RWH 0.6.

@dtzxporter dtzxporter closed this Jan 17, 2024
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

Successfully merging this pull request may close these issues.

2 participants