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

Add a way to retrieve the EGL display #1082

Merged
merged 2 commits into from
Jan 16, 2019

Conversation

ceyusa
Copy link
Contributor

@ceyusa ceyusa commented Nov 8, 2018

to say EGLDisplay or XDisplay

@jdm
Copy link
Contributor

jdm commented Nov 26, 2018

@francesca64 Are you the right person to review these changes?

@jdm
Copy link
Contributor

jdm commented Nov 26, 2018

Note: this is addressing #1078.

@francesca64
Copy link
Member

@jdm I'm the right person, but there are currently a few other things I need to review, so it can be hard to find time.

@ceyusa thanks for the PR!

Window::native_display follows the style of the platform_display and platform_window methods that were deprecated in glutin/winit a while ago, and were recently removed. The convention we've moved to is using WindowExt methods per-platform, each with their own documentation and descriptive name (native_display isn't really an acceptable name, simply because it's so similar to the name of a method that was recently removed).

I'm also not a fan of having external types exposed, since it means that dependency upgrades could be breaking changes. We use void pointers (*mut std::os::raw::c_void) to get around this issue (see #939 for discussion).

Having macOS and iOS return 0 isn't idiomatic, and is very surprising/dangerous. My recommendation is to just create WindowExt methods (probably get_egl_display) for the platforms that can have an EGLDisplay. You can use an Option, and document on Windows that None indicates WGL, and on X11 that None indicates GLX (in which case, the XDisplay can be retrieved via WindowExt::get_xlib_display; also including a note that Wayland always uses EGL).

@ceyusa
Copy link
Contributor Author

ceyusa commented Nov 28, 2018

Thanks a lot for the review! :)

My recommendation is to just create WindowExt methods (probably get_egl_display) for the platforms that can have an EGLDisplay.

If I understand correctly, this method should be in in winit, not int glutin. Do I understand correctly?

@ceyusa
Copy link
Contributor Author

ceyusa commented Nov 28, 2018

Do I understand correctly?

Nope. I did not :) there's no EGL code in winit...

@ceyusa
Copy link
Contributor Author

ceyusa commented Nov 28, 2018

Sorry, I'm lost. I'm staring at the code and the only way that I see is creating a GlContextExt trait with the get_egl_display() method, implemented by the platform's GlContext.

Otherwise, I should add the method in winit's trait and implement them in glutin, which looks odd to me.

@francesca64
Copy link
Member

Right, sorry. I think GlContextExt makes sense for this.

@ceyusa ceyusa force-pushed the native-display branch 4 times, most recently from bab98ec to 22d2f75 Compare December 5, 2018 13:18
@ceyusa
Copy link
Contributor Author

ceyusa commented Dec 5, 2018

\o/ all checks passed

@francesca64 whenever you can :)

@ceyusa ceyusa changed the title Add a way to retrieve the native display Add a way to retrieve the EGL display Dec 5, 2018
@francesca64
Copy link
Member

Sorry for the delay! This looks good to me, but it would be great if you could add a CHANGELOG entry. Then we'll be good to merge.

@ceyusa
Copy link
Contributor Author

ceyusa commented Jan 8, 2019

Sorry for the delay! This looks good to me, but it would be great if you could add a CHANGELOG entry. Then we'll be good to merge.

Done :)

@francesca64 francesca64 merged commit c16f997 into rust-windowing:master Jan 16, 2019
@ceyusa ceyusa deleted the native-display branch September 30, 2019 14:21
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.

3 participants