Lokathor/beryllium

HasRawWindowHandle for RawWindow fails on some platforms

Closed this issue · 3 comments

This was originally reported in parasyte/pixels#53

raw_window_handle panics on some platforms (which I cannot reproduce) when SDL_GetWindowWMInfo fails. The reported error is:

Application not compiled with SDL 2.0

Which I was able to track down to an issue with the way SDL_GetWindowWMInfo is called. According to the libsdl wiki:

The info structure must be initialized with the SDL version, and is then filled in with information about the given window, as shown in the Code Example.

This suggests that beryllium needs to populate the SDL_SysWMinfo struct with the SDL version at a minimum. The default impl just zeros the struct:

let mut wm_info = fermium::SDL_SysWMinfo::default();
let b = unsafe { fermium::SDL_GetWindowWMInfo(self.win.win, &mut wm_info) };

@parasyte I've pushed the change to the master branch, but you should have folks test the change before i push out a new version to crates.io

Got confirmation that this works! 🎉

@Lokathor :shipit:

0.3.2 is out