Function Enable
(
enable < token > )
Parameters
token
A value specifying a feature to enable or disable. Valid tokens are listed in table 3.8.
Return values
none
Description
glfwEnable is used to enable a certain feature, while glfwDisable is used to disable it. Below follows a
description of each feature.
GLFW_AUTO_POLL_EVENTS
When GLFW_AUTO_POLL_EVENTS is enabled, glfwPollEvents is automatically called each time
that glfwSwapBuffers is called.
When GLFW_AUTO_POLL_EVENTS is disabled, calling glfwSwapBuffers will not result in a call to
glfwPollEvents. This can be useful if glfwSwapBuffers needs to be called from within a callback
function, since calling glfwPollEvents from a callback function is not allowed.
GLFW_KEY_REPEAT
When GLFW_KEY_REPEAT is enabled, the key and character callback functions are called repeatedly
when a key is held down long enough (according to the system key repeat configuration).
When GLFW_KEY_REPEAT is disabled, the key and character callback functions are only called once
when a key is pressed (and once when it is released).
GLFW_MOUSE_CURSOR
When GLFW_MOUSE_CURSOR is enabled, the mouse cursor is visible, and mouse coordinates are
relative to the upper left corner of the client area of the GLFW window. The coordinates are limited to
the client area of the window.
When GLFW_MOUSE_CURSOR is disabled, the mouse cursor is invisible, and mouse coordinates are
not limited to the drawing area of the window. It is as if the mouse coordinates are recieved directly
from the mouse, without being restricted or manipulated by the windowing system.
GLFW_STICKY_KEYS
When GLFW_STICKY_KEYS is enabled, keys which are pressed will not be released until they are
physically released and checked with glfwGetKey. This behavior makes it possible to catch keys that
were pressed and then released again between two calls to glfwPollEvents, glfwWaitEvents or
glfwSwapBuffers, which would otherwise have been reported as released. Care should be taken when
using this mode, since keys that are not checked with glfwGetKey will never be released. Note also that
enabling GLFW_STICKY_KEYS does not affect the behavior of the keyboard callback functionality.
When GLFW_STICKY_KEYS is disabled, the status of a key that is reported by glfwGetKey is always
the physical state of the key. Disabling GLFW_STICKY_KEYS also clears the sticky information for
all keys.
GLFW_STICKY_MOUSE_BUTTONS
When GLFW_STICKY_MOUSE_BUTTONS is enabled, mouse buttons that are pressed will not be
released until they are physically released and checked with glfwGetMouseButton. This behavior
makes it possible to catch mouse buttons which were pressed and then released again between two calls
to glfwPollEvents, glfwWaitEvents or glfwSwapBuffers, which would otherwise have been reported
as released. Care should be taken when using this mode, since mouse buttons that are not checked with
glfwGetMouseButton will never be released. Note also that enabling
GLFW_STICKY_MOUSE_BUTTONS does not affect the behavior of the mouse button callback
functionality.
When GLFW_STICKY_MOUSE_BUTTONS is disabled, the status of a mouse button that is reported
by glfwGetMouseButton is always the physical state of the mouse button. Disabling
GLFW_STICKY_MOUSE_BUTTONS also clears the sticky information for all mouse buttons.
GLFW_SYSTEM_KEYS
When GLFW_SYSTEM_KEYS is enabled, pressing standard system key combinations, such as
ALT+TAB under Windows, will give the normal behavior. Note that when ALT+TAB is issued under
Windows in this mode so that the GLFW application is deselected when GLFW is operating in
fullscreen mode, the GLFW application window will be minimized and the video mode will be set to
the original desktop mode. When the GLFW application is re-selected, the video mode will be set to
the GLFW video mode again.
When GLFW_SYSTEM_KEYS is disabled, pressing standard system key combinations will have no
effect, since those key combinations are blocked by GLFW. This mode can be useful in situations when
the GLFW program must not be interrupted (normally for games in fullscreen mode).