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

Implement HasRawDisplayHandle for EventLoop #2677

Merged
merged 2 commits into from
Feb 10, 2023

Conversation

SludgePhD
Copy link
Contributor

@SludgePhD SludgePhD commented Feb 8, 2023

  • Tested on all platforms changed
  • Added an entry to CHANGELOG.md if knowledge of this change could be valuable to users
  • Updated documentation to reflect any user-facing changes, including notes of platform-specific behavior
  • Created or updated an example program if it would help users understand this functionality
  • Updated feature matrix, if new features were added or implemented

The trait is already implemented for EventLoopWindowTarget, which EventLoop derefs to, but that is not enough when using an API that takes a T: HasRawDisplayHandle + 'static (because the API takes ownership of the display handle, in an attempt to offer a safer API to the user than what crates typically do). Also implementing the trait for EventLoop itself solves this problem.

(admittedly the use cases for this are rather limited – consuming the EventLoop like this makes it impossible to actually handle events, and so makes windows useless too, but it is handy when you need a display handle without actually wanting to draw anything; in my specific use case, in order to open a connection to VA-API)

@SludgePhD SludgePhD force-pushed the raw-display-handle-eventloop branch from e1c8bfa to b6755ba Compare February 8, 2023 00:48
@SludgePhD SludgePhD force-pushed the raw-display-handle-eventloop branch from b6755ba to 869582d Compare February 8, 2023 00:48
Copy link
Member

@madsmtm madsmtm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, this makes sense - thanks for the contribution!

@madsmtm madsmtm merged commit 2651523 into rust-windowing:master Feb 10, 2023
@SludgePhD SludgePhD deleted the raw-display-handle-eventloop branch February 10, 2023 19:18
kchibisov pushed a commit to kchibisov/winit that referenced this pull request Mar 1, 2023
* Implement `HasRawDisplayHandle` for `EventLoop`

* Add changelog entry
kchibisov pushed a commit that referenced this pull request Mar 2, 2023
* Implement `HasRawDisplayHandle` for `EventLoop`

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

Successfully merging this pull request may close these issues.

2 participants