glfwSetMouseButtonCallback

Sets the mouse button callback.

This function sets the mouse button callback of the specified window, which is called when a mouse button is pressed or released.

When a window loses input focus, it will generate synthetic mouse button release events for all pressed mouse buttons. You can tell these events from user-generated events by the fact that the synthetic ones are generated after the focus loss event has been processed, i.e. after the window focus callback has been called.

extern (C) @nogc nothrow __gshared
glfwSetMouseButtonCallback

Parameters

window GLFWwindow*

The window whose callback to set.

callback GLFWmousebuttonfun

The new callback, or null to remove the currently set callback.

Return Value

The previously set callback, or null if no callback was set or the library had not been initialized.

@callback_signature

void function_name(GLFWwindow* window, int button, int action, int mods)

For more information about the callback parameters, see the function pointer type.

Errors: Possible errors include @ref GLFW_NOT_INITIALIZED.

Thread Safety

This function must only be called from the main thread.

@sa @ref input_mouse_button

Meta

Since

Added in version 1.0. @glfw3 Added window handle parameter and return value.

Ingroup: input