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

getWMInfo always fails on Windows - SDL_SysWMInfo is not properly initialized #186

Open
adihodos opened this issue Jun 24, 2024 · 1 comment

Comments

@adihodos
Copy link
Contributor

adihodos commented Jun 24, 2024

In the SDL wiki SDL_GetWindowWMInfo it is specified that:

The caller must initialize the info structure's version by using SDL_VERSION(&info.version), and then this function will fill in the rest of the structure with information about the given window.

Also the return value of SDL_GetWindowWMInfo() to check against should be SDL_TRUE which is defined as 1, but the code tests against 0. The following changes are necessary:

    pub fn getWMInfo(w: Window) !c.SDL_SysWMInfo {
        var info: c.SDL_SysWMInfo = undefined;
        info.version = c.SDL_VERSION;
        if (c.SDL_GetWindowWMInfo(w.ptr, &info) != c.SDL_TRUE) {
            return makeError();
        }
        return info;
    }

@ikskuh
Copy link
Owner

ikskuh commented Jun 24, 2024

Can you make a pull request with this?

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

2 participants