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

Error when setting SDL_VIDEO_DRIVER_WAYLAND #29

Open
michaelnew opened this issue Nov 18, 2019 · 3 comments
Open

Error when setting SDL_VIDEO_DRIVER_WAYLAND #29

michaelnew opened this issue Nov 18, 2019 · 3 comments

Comments

@michaelnew
Copy link

If I try to compile with nim c -d:SDL_VIDEO_DRIVER_WAYLAND main.nim, the compiler throws this error:

~/.nimble/pkgs/sdl2_nim-2.0.10.0/sdl2/sdl_syswm.nim(54, 5) Error: expression 'nil' is of type 'typeof(nil)' and has to be discarded

Line 54 in that file just says nil. If I replace it with discard it no longer errors there, but it then fails with
~/.nimble/pkgs/sdl2_nim-2.0.10.0/sdl2/sdl_syswm.nim(250, 23) Error: undeclared identifier: 'WlDisplay'

I'm assuming the first error is from some kind of syntax change with Nim, bu where are the WlDisplay, WlSurface, etc. symbols supposed to come from? Is there a missing import or something?

Sorry if I'm misunderstanding something here. Fairly new to Nim and SDL2.

@krux02
Copy link
Contributor

krux02 commented Nov 18, 2019

Well, I guess there is no Wayland nim wrapper around. So -d:SDL_VIDEO_DRIVER_WAYLAND can't really be implemented right now. But you should be able to compile and execute main.nim on wayland without the -d:SDL_VIDEO_DRIVER_WAYLAN flag. Did you try that?

@Vladar4
Copy link
Owner

Vladar4 commented Nov 20, 2019

Yes, SDL_VIDEO_DRIVER_* keys are intended to be used with specific external wrappers. At the moment I'm aware and can test two such libraries: oldwinapi and x11.

If you have knowledge of others and can update sdl_syswm.nim with patches for them, you are welcome to do so.

@michaelnew
Copy link
Author

michaelnew commented Nov 20, 2019

Makes sense. I thought there might be a Wayland wrapper I was missing but I don't know of any either.

I've since realized that using createWindow and vulkanCreateSurface will produce a Wayland compatible surface as long as VK_KHR_wayland_surface is set as an extension for the Vulkan instance. It might still be nice to be able to talk to the Wayland compositor directly, but getting a window and surface was all I was interested in, so it's not as big a deal as I thought.

Feel free to close if you like.

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

No branches or pull requests

3 participants