summaryrefslogtreecommitdiffhomepage
path: root/src/external/glfw/include/GLFW/glfw3.h
diff options
context:
space:
mode:
authorAlexandre Almeida <[email protected]>2024-02-29 14:29:32 -0300
committerGitHub <[email protected]>2024-02-29 18:29:32 +0100
commit6589311a0b7a217ec270000eb3ab2a5172992efa (patch)
tree177f6354455ab2338801e36bf11790622e74e12a /src/external/glfw/include/GLFW/glfw3.h
parent53221eb799de037eaaae4accbfc5ef6f6c2fe1bb (diff)
downloadraylib-6589311a0b7a217ec270000eb3ab2a5172992efa.tar.gz
raylib-6589311a0b7a217ec270000eb3ab2a5172992efa.zip
Update GLFW to 3.4 (#3827)
* Update GLFW to 3.4 (draft) * Add _glfwConnectNull() function to rglfw.c * Update rglfw.c * Update Makefile * Makefile: Replace USE_WAYLAND_DISPLAY with DISABLE_WAYLAND * Revert "Makefile: Replace USE_WAYLAND_DISPLAY with DISABLE_WAYLAND" This reverts commit 9e79abde786bf797d8133fd95e8a475cf6e2b066. * GlfwImport.cmake: Replace GLFW_USE_WAYLAND with GLFW_BUILD_WAYLAND * Update rglfw.c * Output platform selected by GLFW to TRACELOG * GLFW has removed Mir support
Diffstat (limited to 'src/external/glfw/include/GLFW/glfw3.h')
-rw-r--r--src/external/glfw/include/GLFW/glfw3.h348
1 files changed, 236 insertions, 112 deletions
diff --git a/src/external/glfw/include/GLFW/glfw3.h b/src/external/glfw/include/GLFW/glfw3.h
index 26875465..9c55ac9d 100644
--- a/src/external/glfw/include/GLFW/glfw3.h
+++ b/src/external/glfw/include/GLFW/glfw3.h
@@ -361,10 +361,15 @@ extern "C" {
#define GLFW_HAT_RIGHT_DOWN (GLFW_HAT_RIGHT | GLFW_HAT_DOWN)
#define GLFW_HAT_LEFT_UP (GLFW_HAT_LEFT | GLFW_HAT_UP)
#define GLFW_HAT_LEFT_DOWN (GLFW_HAT_LEFT | GLFW_HAT_DOWN)
+
+/*! @ingroup input
+ */
+#define GLFW_KEY_UNKNOWN -1
+
/*! @} */
-/*! @defgroup keys Keyboard keys
- * @brief Keyboard key IDs.
+/*! @defgroup keys Keyboard key tokens
+ * @brief Keyboard key tokens.
*
* See [key input](@ref input_key) for how these are used.
*
@@ -387,9 +392,6 @@ extern "C" {
* @{
*/
-/* The unknown key */
-#define GLFW_KEY_UNKNOWN -1
-
/* Printable keys */
#define GLFW_KEY_SPACE 32
#define GLFW_KEY_APOSTROPHE 39 /* ' */
@@ -825,11 +827,11 @@ extern "C" {
#define GLFW_FEATURE_UNIMPLEMENTED 0x0001000D
/*! @brief Platform unavailable or no matching platform was found.
*
- * If emitted during initialization, no matching platform was found. If @ref
- * GLFW_PLATFORM is set to `GLFW_ANY_PLATFORM`, GLFW could not detect any of the
- * platforms supported by this library binary, except for the Null platform. If set to
- * a specific platform, it is either not supported by this library binary or GLFW was not
- * able to detect it.
+ * If emitted during initialization, no matching platform was found. If the @ref
+ * GLFW_PLATFORM init hint was set to `GLFW_ANY_PLATFORM`, GLFW could not detect any of
+ * the platforms supported by this library binary, except for the Null platform. If the
+ * init hint was set to a specific platform, it is either not supported by this library
+ * binary or GLFW was not able to detect it.
*
* If emitted by a native access function, GLFW was initialized for a different platform
* than the function is for.
@@ -1096,8 +1098,15 @@ extern "C" {
* [window hint](@ref GLFW_SCALE_TO_MONITOR).
*/
#define GLFW_SCALE_TO_MONITOR 0x0002200C
-/*! @brief macOS specific
- * [window hint](@ref GLFW_COCOA_RETINA_FRAMEBUFFER_hint).
+/*! @brief Window framebuffer scaling
+ * [window hint](@ref GLFW_SCALE_FRAMEBUFFER_hint).
+ */
+#define GLFW_SCALE_FRAMEBUFFER 0x0002200D
+/*! @brief Legacy name for compatibility.
+ *
+ * This is an alias for the
+ * [GLFW_SCALE_FRAMEBUFFER](@ref GLFW_SCALE_FRAMEBUFFER_hint) window hint for
+ * compatibility with earlier versions.
*/
#define GLFW_COCOA_RETINA_FRAMEBUFFER 0x00023001
/*! @brief macOS specific
@@ -1117,6 +1126,9 @@ extern "C" {
*/
#define GLFW_X11_INSTANCE_NAME 0x00024002
#define GLFW_WIN32_KEYBOARD_MENU 0x00025001
+/*! @brief Win32 specific [window hint](@ref GLFW_WIN32_SHOWDEFAULT_hint).
+ */
+#define GLFW_WIN32_SHOWDEFAULT 0x00025002
/*! @brief Wayland specific
* [window hint](@ref GLFW_WAYLAND_APP_ID_hint).
*
@@ -1164,6 +1176,9 @@ extern "C" {
#define GLFW_ANGLE_PLATFORM_TYPE_VULKAN 0x00037007
#define GLFW_ANGLE_PLATFORM_TYPE_METAL 0x00037008
+#define GLFW_WAYLAND_PREFER_LIBDECOR 0x00038001
+#define GLFW_WAYLAND_DISABLE_LIBDECOR 0x00038002
+
#define GLFW_ANY_POSITION 0x80000000
/*! @defgroup shapes Standard cursor shapes
@@ -1215,11 +1230,11 @@ extern "C" {
* @note @macos This shape is provided by a private system API and may fail
* with @ref GLFW_CURSOR_UNAVAILABLE in the future.
*
- * @note @x11 This shape is provided by a newer standard not supported by all
- * cursor themes.
- *
* @note @wayland This shape is provided by a newer standard not supported by
* all cursor themes.
+ *
+ * @note @x11 This shape is provided by a newer standard not supported by all
+ * cursor themes.
*/
#define GLFW_RESIZE_NWSE_CURSOR 0x00036007
/*! @brief The top-right to bottom-left diagonal resize/move arrow shape.
@@ -1230,11 +1245,11 @@ extern "C" {
* @note @macos This shape is provided by a private system API and may fail
* with @ref GLFW_CURSOR_UNAVAILABLE in the future.
*
- * @note @x11 This shape is provided by a newer standard not supported by all
- * cursor themes.
- *
* @note @wayland This shape is provided by a newer standard not supported by
* all cursor themes.
+ *
+ * @note @x11 This shape is provided by a newer standard not supported by all
+ * cursor themes.
*/
#define GLFW_RESIZE_NESW_CURSOR 0x00036008
/*! @brief The omni-directional resize/move cursor shape.
@@ -1248,11 +1263,11 @@ extern "C" {
* The operation-not-allowed shape. This is usually a circle with a diagonal
* line through it.
*
- * @note @x11 This shape is provided by a newer standard not supported by all
- * cursor themes.
- *
* @note @wayland This shape is provided by a newer standard not supported by
* all cursor themes.
+ *
+ * @note @x11 This shape is provided by a newer standard not supported by all
+ * cursor themes.
*/
#define GLFW_NOT_ALLOWED_CURSOR 0x0003600A
/*! @brief Legacy name for compatibility.
@@ -1307,6 +1322,11 @@ extern "C" {
* X11 specific [init hint](@ref GLFW_X11_XCB_VULKAN_SURFACE_hint).
*/
#define GLFW_X11_XCB_VULKAN_SURFACE 0x00052001
+/*! @brief Wayland specific init hint.
+ *
+ * Wayland specific [init hint](@ref GLFW_WAYLAND_LIBDECOR_hint).
+ */
+#define GLFW_WAYLAND_LIBDECOR 0x00053001
/*! @} */
/*! @addtogroup init
@@ -1406,16 +1426,25 @@ typedef struct GLFWcursor GLFWcursor;
* or `NULL` if allocation failed. Note that not all parts of GLFW handle allocation
* failures gracefully yet.
*
- * This function may be called during @ref glfwInit but before the library is
- * flagged as initialized, as well as during @ref glfwTerminate after the
- * library is no longer flagged as initialized.
+ * This function must support being called during @ref glfwInit but before the library is
+ * flagged as initialized, as well as during @ref glfwTerminate after the library is no
+ * longer flagged as initialized.
*
- * Any memory allocated by this function will be deallocated during library
- * termination or earlier.
+ * Any memory allocated via this function will be deallocated via the same allocator
+ * during library termination or earlier.
+ *
+ * Any memory allocated via this function must be suitably aligned for any object type.
+ * If you are using C99 or earlier, this alignment is platform-dependent but will be the
+ * same as what `malloc` provides. If you are using C11 or later, this is the value of
+ * `alignof(max_align_t)`.
*
* The size will always be greater than zero. Allocations of size zero are filtered out
* before reaching the custom allocator.
*
+ * If this function returns `NULL`, GLFW will emit @ref GLFW_OUT_OF_MEMORY.
+ *
+ * This function must not call any GLFW function.
+ *
* @param[in] size The minimum size, in bytes, of the memory block.
* @param[in] user The user-defined pointer from the allocator.
* @return The address of the newly allocated memory block, or `NULL` if an
@@ -1426,7 +1455,8 @@ typedef struct GLFWcursor GLFWcursor;
*
* @reentrancy This function should not call any GLFW function.
*
- * @thread_safety This function may be called from any thread that calls GLFW functions.
+ * @thread_safety This function must support being called from any thread that calls GLFW
+ * functions.
*
* @sa @ref init_allocator
* @sa @ref GLFWallocator
@@ -1449,16 +1479,26 @@ typedef void* (* GLFWallocatefun)(size_t size, void* user);
* `NULL` if allocation failed. Note that not all parts of GLFW handle allocation
* failures gracefully yet.
*
- * This function may be called during @ref glfwInit but before the library is
- * flagged as initialized, as well as during @ref glfwTerminate after the
- * library is no longer flagged as initialized.
+ * This function must support being called during @ref glfwInit but before the library is
+ * flagged as initialized, as well as during @ref glfwTerminate after the library is no
+ * longer flagged as initialized.
*
- * Any memory allocated by this function will be deallocated during library
- * termination or earlier.
+ * Any memory allocated via this function will be deallocated via the same allocator
+ * during library termination or earlier.
+ *
+ * Any memory allocated via this function must be suitably aligned for any object type.
+ * If you are using C99 or earlier, this alignment is platform-dependent but will be the
+ * same as what `realloc` provides. If you are using C11 or later, this is the value of
+ * `alignof(max_align_t)`.
*
* The block address will never be `NULL` and the size will always be greater than zero.
- * Reallocations of a block to size zero are converted into deallocations. Reallocations
- * of `NULL` to a non-zero size are converted into regular allocations.
+ * Reallocations of a block to size zero are converted into deallocations before reaching
+ * the custom allocator. Reallocations of `NULL` to a non-zero size are converted into
+ * regular allocations before reaching the custom allocator.
+ *
+ * If this function returns `NULL`, GLFW will emit @ref GLFW_OUT_OF_MEMORY.
+ *
+ * This function must not call any GLFW function.
*
* @param[in] block The address of the memory block to reallocate.
* @param[in] size The new minimum size, in bytes, of the memory block.
@@ -1471,7 +1511,8 @@ typedef void* (* GLFWallocatefun)(size_t size, void* user);
*
* @reentrancy This function should not call any GLFW function.
*
- * @thread_safety This function may be called from any thread that calls GLFW functions.
+ * @thread_safety This function must support being called from any thread that calls GLFW
+ * functions.
*
* @sa @ref init_allocator
* @sa @ref GLFWallocator
@@ -1493,13 +1534,17 @@ typedef void* (* GLFWreallocatefun)(void* block, size_t size, void* user);
* This function may deallocate the specified memory block. This memory block
* will have been allocated with the same allocator.
*
- * This function may be called during @ref glfwInit but before the library is
- * flagged as initialized, as well as during @ref glfwTerminate after the
- * library is no longer flagged as initialized.
+ * This function must support being called during @ref glfwInit but before the library is
+ * flagged as initialized, as well as during @ref glfwTerminate after the library is no
+ * longer flagged as initialized.
*
* The block address will never be `NULL`. Deallocations of `NULL` are filtered out
* before reaching the custom allocator.
*
+ * If this function returns `NULL`, GLFW will emit @ref GLFW_OUT_OF_MEMORY.
+ *
+ * This function must not call any GLFW function.
+ *
* @param[in] block The address of the memory block to deallocate.
* @param[in] user The user-defined pointer from the allocator.
*
@@ -1508,7 +1553,8 @@ typedef void* (* GLFWreallocatefun)(void* block, size_t size, void* user);
*
* @reentrancy This function should not call any GLFW function.
*
- * @thread_safety This function may be called from any thread that calls GLFW functions.
+ * @thread_safety This function must support being called from any thread that calls GLFW
+ * functions.
*
* @sa @ref init_allocator
* @sa @ref GLFWallocator
@@ -2076,7 +2122,10 @@ typedef struct GLFWgamepadstate
float axes[6];
} GLFWgamepadstate;
-/*! @brief
+/*! @brief Custom heap memory allocator.
+ *
+ * This describes a custom heap memory allocator for GLFW. To set an allocator, pass it
+ * to @ref glfwInitAllocator before initializing the library.
*
* @sa @ref init_allocator
* @sa @ref glfwInitAllocator
@@ -2087,9 +2136,21 @@ typedef struct GLFWgamepadstate
*/
typedef struct GLFWallocator
{
+ /*! The memory allocation function. See @ref GLFWallocatefun for details about
+ * allocation function.
+ */
GLFWallocatefun allocate;
+ /*! The memory reallocation function. See @ref GLFWreallocatefun for details about
+ * reallocation function.
+ */
GLFWreallocatefun reallocate;
+ /*! The memory deallocation function. See @ref GLFWdeallocatefun for details about
+ * deallocation function.
+ */
GLFWdeallocatefun deallocate;
+ /*! The user pointer for this custom allocator. This value will be passed to the
+ * allocator functions.
+ */
void* user;
} GLFWallocator;
@@ -2134,6 +2195,13 @@ typedef struct GLFWallocator
* and dock icon can be disabled entirely with the @ref GLFW_COCOA_MENUBAR init
* hint.
*
+ * @remark __Wayland, X11:__ If the library was compiled with support for both
+ * Wayland and X11, and the @ref GLFW_PLATFORM init hint is set to
+ * `GLFW_ANY_PLATFORM`, the `XDG_SESSION_TYPE` environment variable affects
+ * which platform is picked. If the environment variable is not set, or is set
+ * to something other than `wayland` or `x11`, the regular detection mechanism
+ * will be used instead.
+ *
* @remark @x11 This function will set the `LC_CTYPE` category of the
* application locale according to the current environment if that category is
* still "C". This is because the "C" locale breaks Unicode text input.
@@ -2222,8 +2290,12 @@ GLFWAPI void glfwInitHint(int hint, int value);
* To use the default allocator, call this function with a `NULL` argument.
*
* If you specify an allocator struct, every member must be a valid function
- * pointer. If any member is `NULL`, this function emits @ref
- * GLFW_INVALID_VALUE and the init allocator is unchanged.
+ * pointer. If any member is `NULL`, this function will emit @ref
+ * GLFW_INVALID_VALUE and the init allocator will be unchanged.
+ *
+ * The functions in the allocator must fulfil a number of requirements. See the
+ * documentation for @ref GLFWallocatefun, @ref GLFWreallocatefun and @ref
+ * GLFWdeallocatefun for details.
*
* @param[in] allocator The allocator to use at the next initialization, or
* `NULL` to use the default one.
@@ -2590,9 +2662,10 @@ GLFWAPI void glfwGetMonitorWorkarea(GLFWmonitor* monitor, int* xpos, int* ypos,
* specified monitor.
*
* Some platforms do not provide accurate monitor size information, either
- * because the monitor
- * [EDID](https://en.wikipedia.org/wiki/Extended_display_identification_data)
- * data is incorrect or because the driver does not report it accurately.
+ * because the monitor [EDID][] data is incorrect or because the driver does
+ * not report it accurately.
+ *
+ * [EDID]: https://en.wikipedia.org/wiki/Extended_display_identification_data
*
* Any or all of the size arguments may be `NULL`. If an error occurs, all
* non-`NULL` size arguments will be set to zero.
@@ -2639,6 +2712,9 @@ GLFWAPI void glfwGetMonitorPhysicalSize(GLFWmonitor* monitor, int* widthMM, int*
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
* GLFW_PLATFORM_ERROR.
*
+ * @remark @wayland Fractional scaling information is not yet available for
+ * monitors, so this function only returns integer content scales.
+ *
* @thread_safety This function must only be called from the main thread.
*
* @sa @ref monitor_scale
@@ -2835,11 +2911,11 @@ GLFWAPI const GLFWvidmode* glfwGetVideoMode(GLFWmonitor* monitor);
* @param[in] monitor The monitor whose gamma ramp to set.
* @param[in] gamma The desired exponent.
*
- * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
- * GLFW_INVALID_VALUE and @ref GLFW_PLATFORM_ERROR.
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref GLFW_INVALID_VALUE,
+ * @ref GLFW_PLATFORM_ERROR and @ref GLFW_FEATURE_UNAVAILABLE (see remarks).
*
* @remark @wayland Gamma handling is a privileged protocol, this function
- * will thus never be implemented and emits @ref GLFW_PLATFORM_ERROR.
+ * will thus never be implemented and emits @ref GLFW_FEATURE_UNAVAILABLE.
*
* @thread_safety This function must only be called from the main thread.
*
@@ -2859,11 +2935,11 @@ GLFWAPI void glfwSetGamma(GLFWmonitor* monitor, float gamma);
* @return The current gamma ramp, or `NULL` if an
* [error](@ref error_handling) occurred.
*
- * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
- * GLFW_PLATFORM_ERROR.
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref GLFW_PLATFORM_ERROR
+ * and @ref GLFW_FEATURE_UNAVAILABLE (see remarks).
*
* @remark @wayland Gamma handling is a privileged protocol, this function
- * will thus never be implemented and emits @ref GLFW_PLATFORM_ERROR while
+ * will thus never be implemented and emits @ref GLFW_FEATURE_UNAVAILABLE while
* returning `NULL`.
*
* @pointer_lifetime The returned structure and its arrays are allocated and
@@ -2898,8 +2974,8 @@ GLFWAPI const GLFWgammaramp* glfwGetGammaRamp(GLFWmonitor* monitor);
* @param[in] monitor The monitor whose gamma ramp to set.
* @param[in] ramp The gamma ramp to use.
*
- * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
- * GLFW_PLATFORM_ERROR.
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref GLFW_PLATFORM_ERROR
+ * and @ref GLFW_FEATURE_UNAVAILABLE (see remarks).
*
* @remark The size of the specified gamma ramp should match the size of the
* current ramp for that monitor.
@@ -2907,7 +2983,7 @@ GLFWAPI const GLFWgammaramp* glfwGetGammaRamp(GLFWmonitor* monitor);
* @remark @win32 The gamma ramp size must be 256.
*
* @remark @wayland Gamma handling is a privileged protocol, this function
- * will thus never be implemented and emits @ref GLFW_PLATFORM_ERROR.
+ * will thus never be implemented and emits @ref GLFW_FEATURE_UNAVAILABLE.
*
* @pointer_lifetime The specified gamma ramp is copied before this function
* returns.
@@ -3079,8 +3155,8 @@ GLFWAPI void glfwWindowHintString(int hint, const char* value);
*
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
* GLFW_INVALID_ENUM, @ref GLFW_INVALID_VALUE, @ref GLFW_API_UNAVAILABLE, @ref
- * GLFW_VERSION_UNAVAILABLE, @ref GLFW_FORMAT_UNAVAILABLE and @ref
- * GLFW_PLATFORM_ERROR.
+ * GLFW_VERSION_UNAVAILABLE, @ref GLFW_FORMAT_UNAVAILABLE, @ref
+ * GLFW_NO_WINDOW_CONTEXT and @ref GLFW_PLATFORM_ERROR.
*
* @remark @win32 Window creation will fail if the Microsoft GDI software
* OpenGL implementation is the only one available.
@@ -3102,23 +3178,35 @@ GLFWAPI void glfwWindowHintString(int hint, const char* value);
* @remark @macos The GLFW window has no icon, as it is not a document
* window, but the dock icon will be the same as the application bundle's icon.
* For more information on bundles, see the
- * [Bundle Programming Guide](https://developer.apple.com/library/mac/documentation/CoreFoundation/Conceptual/CFBundles/)
- * in the Mac Developer Library.
+ * [Bundle Programming Guide][bundle-guide] in the Mac Developer Library.
+ *
+ * [bundle-guide]: https://developer.apple.com/library/mac/documentation/CoreFoundation/Conceptual/CFBundles/
*
* @remark @macos On OS X 10.10 and later the window frame will not be rendered
* at full resolution on Retina displays unless the
- * [GLFW_COCOA_RETINA_FRAMEBUFFER](@ref GLFW_COCOA_RETINA_FRAMEBUFFER_hint)
+ * [GLFW_SCALE_FRAMEBUFFER](@ref GLFW_SCALE_FRAMEBUFFER_hint)
* hint is `GLFW_TRUE` and the `NSHighResolutionCapable` key is enabled in the
* application bundle's `Info.plist`. For more information, see
- * [High Resolution Guidelines for OS X](https://developer.apple.com/library/mac/documentation/GraphicsAnimation/Conceptual/HighResolutionOSX/Explained/Explained.html)
- * in the Mac Developer Library. The GLFW test and example programs use
- * a custom `Info.plist` template for this, which can be found as
- * `CMake/Info.plist.in` in the source tree.
+ * [High Resolution Guidelines for OS X][hidpi-guide] in the Mac Developer
+ * Library. The GLFW test and example programs use a custom `Info.plist`
+ * template for this, which can be found as `CMake/Info.plist.in` in the source
+ * tree.
+ *
+ * [hidpi-guide]: https://developer.apple.com/library/mac/documentation/GraphicsAnimation/Conceptual/HighResolutionOSX/Explained/Explained.html
*
* @remark @macos When activating frame autosaving with
* [GLFW_COCOA_FRAME_NAME](@ref GLFW_COCOA_FRAME_NAME_hint), the specified
* window size and position may be overridden by previously saved values.
*
+ * @remark @wayland GLFW uses [libdecor][] where available to create its window
+ * decorations. This in turn uses server-side XDG decorations where available
+ * and provides high quality client-side decorations on compositors like GNOME.
+ * If both XDG decorations and libdecor are unavailable, GLFW falls back to
+ * a very simple set of window decorations that only support moving, resizing
+ * and the window manager's right-click menu.
+ *
+ * [libdecor]: https://gitlab.freedesktop.org/libdecor/libdecor
+ *
* @remark @x11 Some window managers will not respect the placement of
* initially hidden windows.
*
@@ -3135,20 +3223,6 @@ GLFWAPI void glfwWindowHintString(int hint, const char* value);
* [GLFW_X11_INSTANCE_NAME](@ref GLFW_X11_INSTANCE_NAME_hint) window hints to
* override this.
*
- * @remark @wayland Compositors should implement the xdg-decoration protocol
- * for GLFW to decorate the window properly. If this protocol isn't
- * supported, or if the compositor prefers client-side decorations, a very
- * simple fallback frame will be drawn using the wp_viewporter protocol. A
- * compositor can still emit close, maximize or fullscreen events, using for
- * instance a keybind mechanism. If neither of these protocols is supported,
- * the window won't be decorated.
- *
- * @remark @wayland A full screen window will not attempt to change the mode,
- * no matter what the requested size or refresh rate.
- *
- * @remark @wayland Screensaver inhibition requires the idle-inhibit protocol
- * to be implemented in the user's compositor.
- *
* @thread_safety This function must only be called from the main thread.
*
* @sa @ref window_creation
@@ -3231,6 +3305,38 @@ GLFWAPI int glfwWindowShouldClose(GLFWwindow* window);
*/
GLFWAPI void glfwSetWindowShouldClose(GLFWwindow* window, int value);
+/*! @brief Returns the title of the specified window.
+ *
+ * This function returns the window title, encoded as UTF-8, of the specified
+ * window. This is the title set previously by @ref glfwCreateWindow
+ * or @ref glfwSetWindowTitle.
+ *
+ * @param[in] window The window to query.
+ * @return The UTF-8 encoded window title, or `NULL` if an
+ * [error](@ref error_handling) occurred.
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
+ *
+ * @remark The returned title is currently a copy of the title last set by @ref
+ * glfwCreateWindow or @ref glfwSetWindowTitle. It does not include any
+ * additional text which may be appended by the platform or another program.
+ *
+ * @pointer_lifetime The returned string is allocated and freed by GLFW. You
+ * should not free it yourself. It is valid until the next call to @ref
+ * glfwGetWindowTitle or @ref glfwSetWindowTitle, or until the library is
+ * terminated.
+ *
+ * @thread_safety This function must only be called from the main thread.
+ *
+ * @sa @ref window_title
+ * @sa @ref glfwSetWindowTitle
+ *
+ * @since Added in version 3.4.
+ *
+ * @ingroup window
+ */
+GLFWAPI const char* glfwGetWindowTitle(GLFWwindow* window);
+
/*! @brief Sets the title of the specified window.
*
* This function sets the window title, encoded as UTF-8, of the specified
@@ -3248,6 +3354,7 @@ GLFWAPI void glfwSetWindowShouldClose(GLFWwindow* window, int value);
* @thread_safety This function must only be called from the main thread.
*
* @sa @ref window_title
+ * @sa @ref glfwGetWindowTitle
*
* @since Added in version 1.0.
* @glfw3 Added window handle parameter.
@@ -3287,8 +3394,9 @@ GLFWAPI void glfwSetWindowTitle(GLFWwindow* window, const char* title);
* @remark @macos Regular windows do not have icons on macOS. This function
* will emit @ref GLFW_FEATURE_UNAVAILABLE. The dock icon will be the same as
* the application bundle's icon. For more information on bundles, see the
- * [Bundle Programming Guide](https://developer.apple.com/library/mac/documentation/CoreFoundation/Conceptual/CFBundles/)
- * in the Mac Developer Library.
+ * [Bundle Programming Guide][bundle-guide] in the Mac Developer Library.
+ *
+ * [bundle-guide]: https://developer.apple.com/library/mac/documentation/CoreFoundation/Conceptual/CFBundles/
*
* @remark @wayland There is no existing protocol to change an icon, the
* window will thus inherit the one defined in the application's desktop file.
@@ -3512,9 +3620,6 @@ GLFWAPI void glfwSetWindowAspectRatio(GLFWwindow* window, int numer, int denom);
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
* GLFW_PLATFORM_ERROR.
*
- * @remark @wayland A full screen window will not attempt to change the mode,
- * no matter what the requested size.
- *
* @thread_safety This function must only be called from the main thread.
*
* @sa @ref window_size
@@ -3846,11 +3951,11 @@ GLFWAPI void glfwHideWindow(GLFWwindow* window);
*
* @param[in] window The window to give input focus.
*
- * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
- * GLFW_PLATFORM_ERROR and @ref GLFW_FEATURE_UNAVAILABLE (see remarks).
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
+ * GLFW_PLATFORM_ERROR.
*
- * @remark @wayland It is not possible for an application to set the input
- * focus. This function will emit @ref GLFW_FEATURE_UNAVAILABLE.
+ * @remark @wayland The compositor will likely ignore focus requests unless
+ * another window created by the same application already has input focus.
*
* @thread_safety This function must only be called from the main thread.
*
@@ -3955,9 +4060,6 @@ GLFWAPI GLFWmonitor* glfwGetWindowMonitor(GLFWwindow* window);
* @remark @wayland The desired window position is ignored, as there is no way
* for an application to set this property.
*
- * @remark @wayland Setting the window to full screen will not attempt to
- * change the mode, no matter what the requested size or refresh rate.
- *
* @thread_safety This function must only be called from the main thread.
*
* @sa @ref window_monitor
@@ -4030,11 +4132,15 @@ GLFWAPI int glfwGetWindowAttrib(GLFWwindow* window, int attrib);
* @param[in] value `GLFW_TRUE` or `GLFW_FALSE`.
*
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
- * GLFW_INVALID_ENUM, @ref GLFW_INVALID_VALUE and @ref GLFW_PLATFORM_ERROR.
+ * GLFW_INVALID_ENUM, @ref GLFW_INVALID_VALUE, @ref GLFW_PLATFORM_ERROR and @ref
+ * GLFW_FEATURE_UNAVAILABLE (see remarks).
*
* @remark Calling @ref glfwGetWindowAttrib will always return the latest
* value, even if that value is ignored by the current mode of the window.
*
+ * @remark @wayland The [GLFW_FLOATING](@ref GLFW_FLOATING_attrib) window attribute is
+ * not supported. Setting this will emit @ref GLFW_FEATURE_UNAVAILABLE.
+ *
* @thread_safety This function must only be called from the main thread.
*
* @sa @ref window_attribs
@@ -4709,8 +4815,8 @@ GLFWAPI int glfwRawMouseMotionSupported(void);
* @param[in] scancode The scancode of the key to query.
* @return The UTF-8 encoded, layout-specific name of the key, or `NULL`.
*
- * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
- * GLFW_PLATFORM_ERROR.
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
+ * GLFW_INVALID_VALUE, @ref GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR.
*
* @remark The contents of the returned string may change when a keyboard
* layout change event is received.
@@ -4732,15 +4838,18 @@ GLFWAPI const char* glfwGetKeyName(int key, int scancode);
*
* This function returns the platform-specific scancode of the specified key.
*
- * If the key is `GLFW_KEY_UNKNOWN` or does not exist on the keyboard this
- * method will return `-1`.
+ * If the specified [key token](@ref keys) corresponds to a physical key not
+ * supported on the current platform then this method will return `-1`.
+ * Calling this function with anything other than a key token will return `-1`
+ * and generate a @ref GLFW_INVALID_ENUM error.
*
- * @param[in] key Any [named key](@ref keys).
- * @return The platform-specific scancode for the key, or `-1` if an
- * [error](@ref error_handling) occurred.
+ * @param[in] key Any [key token](@ref keys).
+ * @return The platform-specific scancode for the key, or `-1` if the key is
+ * not supported on the current platform or an [error](@ref error_handling)
+ * occurred.
*
- * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
- * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR.
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
+ * GLFW_INVALID_ENUM.
*
* @thread_safety This function may be called from any thread.
*
@@ -4881,11 +4990,11 @@ GLFWAPI void glfwGetCursorPos(GLFWwindow* window, double* xpos, double* ypos);
* @param[in] ypos The desired y-coordinate, relative to the top edge of the
* content area.
*
- * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
- * GLFW_PLATFORM_ERROR.
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
+ * GLFW_PLATFORM_ERROR and @ref GLFW_FEATURE_UNAVAILABLE (see remarks).
*
* @remark @wayland This function will only work when the cursor mode is
- * `GLFW_CURSOR_DISABLED`, otherwise it will do nothing.
+ * `GLFW_CURSOR_DISABLED`, otherwise it will emit @ref GLFW_FEATURE_UNAVAILABLE.
*
* @thread_safety This function must only be called from the main thread.
*
@@ -5049,9 +5158,9 @@ GLFWAPI void glfwSetCursor(GLFWwindow* window, GLFWcursor* cursor);
* [character callback](@ref glfwSetCharCallback) instead.
*
* When a window loses input focus, it will generate synthetic key release
- * events for all pressed keys. 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
+ * events for all pressed keys with associated key tokens. 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](@ref glfwSetWindowFocusCallback) has been called.
*
* The scancode of a key is specific to that platform or sometimes even to that
@@ -5332,8 +5441,6 @@ GLFWAPI GLFWscrollfun glfwSetScrollCallback(GLFWwindow* window, GLFWscrollfun ca
*
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
*
- * @remark @wayland File drop is currently unimplemented.
- *
* @thread_safety This function must only be called from the main thread.
*
* @sa @ref path_drop
@@ -5800,6 +5907,11 @@ GLFWAPI int glfwGetGamepadState(int jid, GLFWgamepadstate* state);
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
* GLFW_PLATFORM_ERROR.
*
+ * @remark @win32 The clipboard on Windows has a single global lock for reading and
+ * writing. GLFW tries to acquire it a few times, which is almost always enough. If it
+ * cannot acquire the lock then this function emits @ref GLFW_PLATFORM_ERROR and returns.
+ * It is safe to try this multiple times.
+ *
* @pointer_lifetime The specified string is copied before this function
* returns.
*
@@ -5828,6 +5940,11 @@ GLFWAPI void glfwSetClipboardString(GLFWwindow* window, const char* string);
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
* GLFW_FORMAT_UNAVAILABLE and @ref GLFW_PLATFORM_ERROR.
*
+ * @remark @win32 The clipboard on Windows has a single global lock for reading and
+ * writing. GLFW tries to acquire it a few times, which is almost always enough. If it
+ * cannot acquire the lock then this function emits @ref GLFW_PLATFORM_ERROR and returns.
+ * It is safe to try this multiple times.
+ *
* @pointer_lifetime The returned string is allocated and freed by GLFW. You
* should not free it yourself. It is valid until the next call to @ref
* glfwGetClipboardString or @ref glfwSetClipboardString, or until the library
@@ -5950,12 +6067,15 @@ GLFWAPI uint64_t glfwGetTimerFrequency(void);
* thread.
*
* This function makes the OpenGL or OpenGL ES context of the specified window
- * current on the calling thread. A context must only be made current on
- * a single thread at a time and each thread can have only a single current
- * context at a time.
+ * current on the calling thread. It can also detach the current context from
+ * the calling thread without making a new one current by passing in `NULL`.
+ *
+ * A context must only be made current on a single thread at a time and each
+ * thread can have only a single current context at a time. Making a context
+ * current detaches any previously current context on the calling thread.
*
- * When moving a context between threads, you must make it non-current on the
- * old thread before making it current on the new one.
+ * When moving a context between threads, you must detach it (make it
+ * non-current) on the old thread before making it current on the new one.
*
* By default, making a context non-current implicitly forces a pipeline flush.
* On machines that support `GL_KHR_context_flush_control`, you can control
@@ -5970,6 +6090,10 @@ GLFWAPI uint64_t glfwGetTimerFrequency(void);
* @param[in] window The window whose context to make current, or `NULL` to
* detach the current context.
*
+ * @remarks If the previously current context was created via a different
+ * context creation API than the one passed to this function, GLFW will still
+ * detach the previous one from its API before making the new one current.
+ *
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
* GLFW_NO_WINDOW_CONTEXT and @ref GLFW_PLATFORM_ERROR.
*