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

Window example on wayland creates 0x0 pixels window #17

Closed
Vinatorul opened this issue Oct 6, 2016 · 8 comments
Closed

Window example on wayland creates 0x0 pixels window #17

Vinatorul opened this issue Oct 6, 2016 · 8 comments

Comments

@Vinatorul
Copy link

Vinatorul commented Oct 6, 2016

It looks like winit doesn't resize wayland window after start (resize_callback function have not been called).
I've checked glutin example on wayland and it works well. Then I checked the difference beetween api/wayland/window.rs in winit and glutin and found out that there is no resize calls in winit. For example: glutin and winit. It seems to me that there should be some code to resize surface, but I haven't find any API in wayland-client to do so.

@tomaka
Copy link
Contributor

tomaka commented Oct 6, 2016

cc @vberger

@tomaka
Copy link
Contributor

tomaka commented Oct 6, 2016

From my knowledge of wayland, the size of the surface of a wayland window is actually determined by the OpenGL or Vulkan context that uses it. Since winit doesn't create an OpenGL/Vulkan context, it has no way to set the size.

Maybe that should be more explicit in winit.

@elinorbgr
Copy link
Contributor

Yes, on wayland, the size of a surface is defined by the size of the buffer associated to it.

In case of glutin, the resize method is a method provided by the EGL layer, to define the size of the OpenGL surface (I expect vulkan should provide some similar API).

In an opengl-less wayland case, the size of a surface is defined by the size of the wl_buffer associated to it. If no buffer is associated, the surface is 0 by 0.

@Vinatorul
Copy link
Author

@tomaka, @vberger thanks for the explanations.
So for wayland I will need to override most of the methods only to add EGL calls where necessary?

@elinorbgr
Copy link
Contributor

Regarding wayland, if you want to do EGL stuff without glutin, you'll need to use the egl module (and feature) of wayland-client. The WlEglSurface provides a method to be resized, and you need to then provide it to EGL initialization routines.

However, I've just recently completely rewrote the API of wayland-client, and not yet upgraded winit and glutin to it (but I'm working on it), so you might want to wait until it's done. I'll probably rethink details of wayland on winit on the process.

@Vinatorul
Copy link
Author

I forget to mention - I faced with it while working on rust-windowing/glutin#813
I am using egl, and create window via winit, but it seems I should wrap some winit::wayland::Window methods to add egl calls, for example set_inner_size or next_event

@tomaka
Copy link
Contributor

tomaka commented Oct 7, 2016

@Vinatorul You need to wrap everything anyway, not only for wayland.

@Vinatorul
Copy link
Author

Thanks for answers. I'll close this issue as it works as intended.

madsmtm pushed a commit to madsmtm/winit that referenced this issue Jun 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants