Skip to content

Implement HasRawDisplayHandle for EventLoop - #2677

Merged
madsmtm merged 2 commits into
rust-windowing:masterfrom
SludgePhD:raw-display-handle-eventloop
Feb 10, 2023
Merged

madsmtm merged 2 commits into
rust-windowing:masterfrom
SludgePhD:raw-display-handle-eventloop

Conversation

@SludgePhD

@SludgePhD SludgePhD commented Feb 8, 2023 •

Copy link
Copy Markdown
Contributor
  • 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

@madsmtm madsmtm left a comment •

Copy link
Copy Markdown
Member

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