glfw: dont call getError unless we need to

This commit is contained in:
Lee Cannon 2022-02-08 01:49:22 +00:00 committed by Stephen Gutekanst
parent 746b0dd1f0
commit 3e79a12f3d
11 changed files with 111 additions and 92 deletions

View file

@ -414,7 +414,7 @@ pub inline fn setCallback(callback: ?fn (joystick: Joystick, event: Event) void)
/// @ingroup input
pub inline fn updateGamepadMappings(gamepad_mappings: [*:0]const u8) error{InvalidValue}!void {
internal_debug.assertInitialized();
_ = c.glfwUpdateGamepadMappings(gamepad_mappings);
if (c.glfwUpdateGamepadMappings(gamepad_mappings) == c.GLFW_TRUE) return;
getError() catch |err| return switch (err) {
Error.NotInitialized => unreachable,
// TODO: Maybe return as 'ParseError' here?