glfwSetWindowFocusCallback function

GLFWwindowfocusfun glfwSetWindowFocusCallback(
  1. Pointer<GLFWwindow> window,
  2. GLFWwindowfocusfun callback
)

! @brief Sets the focus callback for the specified window.

This function sets the focus callback of the specified window, which is called when the window gains or loses input focus.

After the focus callback is called for a window that lost input focus, synthetic key and mouse button release events will be generated for all such that had been pressed. For more information, see @ref glfwSetKeyCallback and @ref glfwSetMouseButtonCallback.

@paramin window The window whose callback to set. @paramin callback The new callback, or NULL to remove the currently set callback. @return The previously set callback, or NULL if no callback was set or the library had not been initialized(@ref intro_init).

@callback_signature @code void function_name(GLFWwindow* window, int focused) @endcode For more information about the callback parameters, see the function pointer type(@ref GLFWwindowfocusfun).

@errors Possible errors include @ref GLFW_NOT_INITIALIZED.

@thread_safety This function must only be called from the main thread.

@sa @ref window_focus

@since Added in version 3.0.

@ingroup window

GLFWAPI GLFWwindowfocusfun glfwSetWindowFocusCallback(GLFWwindow* window, GLFWwindowfocusfun callback)

Implementation

GLFWwindowfocusfun glfwSetWindowFocusCallback(
    Pointer<GLFWwindow> window, GLFWwindowfocusfun callback) {
  final glfwSetWindowFocusCallbackLookupFunction = libglfw.lookupFunction<
      GLFWwindowfocusfun Function(
          Pointer<GLFWwindow> window, GLFWwindowfocusfun callback),
      GLFWwindowfocusfun Function(Pointer<GLFWwindow> window,
          GLFWwindowfocusfun callback)>('glfwSetWindowFocusCallback');
  return glfwSetWindowFocusCallbackLookupFunction(window, callback);
}