-
Notifications
You must be signed in to change notification settings - Fork 60
Wayland EGL surface member #61
Description
Related to gfx-rs/gfx#3545
Currently, RWH has the following information for a wayland window:
- surface: A pointer to a wl_surface.
- display: A pointer to a wl_display.
If one needs to create an EGL context for drawing on this window, they have to go through wl_egl_create_surface, which gets the surface as well as the window size, and returns a wl_egl_window pointer.
Problem is: RWH doesn't hold any information about the window size. So we are in a situation that on one side of the API we have a real window, and it has the size. And on the other side we have EGL, and it wants the window handle and the size. But in the middle, RWH loses the information about the size. It sounds like RWH isn't accomplishing its goal of abstracting the window in this case?
Note that this isn't a problem for Xlib. I suspect that's because an Xlib window knows about its size (like probably any other window in the RWH enumeration). So the Xlib window is closer to wl_egl_window than it is to wl_surface.
I want to stress that I have no experience with Wayland (or X11), and I'm just raising a concern and searching for more input about the solution here.
At first, I thought that maybe wl_egl_window field could be added to the Wayland variant of RWH. However, I realized that this isn't going to help, since winit doesn't necessarily want to create an EGL window. So if we want RWH to work, it needs to communicate the window size, at least for the Wayland variant.