sdl2_nim icon indicating copy to clipboard operation
sdl2_nim copied to clipboard

Error when setting SDL_VIDEO_DRIVER_WAYLAND

Open michaelnew opened this issue 5 years ago • 3 comments

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.

michaelnew avatar Nov 18 '19 00:11 michaelnew

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?

krux02 avatar Nov 18 '19 12:11 krux02

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.

Vladar4 avatar Nov 20 '19 17:11 Vladar4

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.

michaelnew avatar Nov 20 '19 18:11 michaelnew