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

Allow GLFW_INVALID_VALUE at Init #325

Merged
merged 1 commit into from
Jul 14, 2021
Merged

Allow GLFW_INVALID_VALUE at Init #325

merged 1 commit into from
Jul 14, 2021

Conversation

hajimehoshi
Copy link
Member

Closes #324
Updates #292

@hajimehoshi
Copy link
Member Author

PTAL

Copy link
Member

@dmitshur dmitshur left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. There's a typo in the commit message/PR subject, s/GLFW_INVLAID_VALUE /GLFW_INVALID_VALUE/.

@hajimehoshi hajimehoshi changed the title Allow GLFW_INVLAID_VALUE at Init Allow GLFW_INVALID_VALUE at Init Jul 14, 2021
@hajimehoshi hajimehoshi merged commit ef648d7 into master Jul 14, 2021
@hajimehoshi hajimehoshi deleted the joystick branch July 14, 2021 14:50
@dmitshur
Copy link
Member

dmitshur commented Jul 14, 2021

Thinking about this more (sorry I missed it earlier), this workaround should probably not return invalidValue from Init, but rather handle it internally.

That is, most callers of glfw.Init look like this:

err := glfw.Init()
if err != nil {
    log.Fatalln("glfw.Init failed:", err)
}

This temporary workaround shouldn't require users to also temporarily update their code.

Perhaps something like:

err := acceptError(APIUnavailable, invalidValue)
if e, ok := err.(*Error); ok && e.Code == invalidValue {
    // This is an internal and non-fatal error that's being intentionally ignored.
    err = nil
}
return err

(It's also possible to handle it by logging, but given GLFW 3.3.5 outright removes it, logging doesn't seem to be needed.)

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

Successfully merging this pull request may close these issues.

Can we apply the gamepad issue fix before 3.3.5 is released?
2 participants