WARNING: UPDATED GLFW to latest master branch!

WARNING: This could be a BREAKING CHANGE for some platforms! I'm afraid something could be wrong on `rglfw.c` module.

To be able to compile on Windows I had to modify `glfw/src/platform.c` line 74. I couldn't manage to compile without that change, help is welcome!
This commit is contained in:
Ray
2022-08-28 14:16:51 +02:00
parent 8508ae3d15
commit 9e0e08cba4
85 changed files with 16869 additions and 10272 deletions

View File

@ -190,6 +190,9 @@ extern "C" {
#else /*__APPLE__*/
#include <GL/glcorearb.h>
#if defined(GLFW_INCLUDE_GLEXT)
#include <GL/glext.h>
#endif
#endif /*__APPLE__*/
@ -259,13 +262,12 @@ extern "C" {
/* We are building GLFW as a Win32 DLL */
#define GLFWAPI __declspec(dllexport)
#elif defined(_WIN32) && defined(GLFW_DLL)
/* We are calling GLFW as a Win32 DLL */
/* We are calling a GLFW Win32 DLL */
#define GLFWAPI __declspec(dllimport)
#elif defined(__GNUC__) && defined(_GLFW_BUILD_DLL)
/* We are building GLFW as a shared / dynamic library */
/* We are building GLFW as a Unix shared library */
#define GLFWAPI __attribute__((visibility("default")))
#else
/* We are building or calling GLFW as a static library */
#define GLFWAPI
#endif
@ -372,7 +374,7 @@ extern "C" {
*
* The naming of the key codes follow these rules:
* - The US keyboard layout is used
* - Names of printable alpha-numeric characters are used (e.g. "A", "R",
* - Names of printable alphanumeric characters are used (e.g. "A", "R",
* "3", etc.)
* - For non-alphanumeric characters, Unicode:ish names are used (e.g.
* "COMMA", "LEFT_SQUARE_BRACKET", etc.). Note that some names do not
@ -717,7 +719,7 @@ extern "C" {
* GLFW could not find support for the requested API on the system.
*
* @analysis The installed graphics driver does not support the requested
* API, or does not support it via the chosen context creation backend.
* API, or does not support it via the chosen context creation API.
* Below are a few examples.
*
* @par
@ -786,7 +788,7 @@ extern "C" {
/*! @brief The specified cursor shape is not available.
*
* The specified standard cursor shape is not available, either because the
* current system cursor theme does not provide it or because it is not
* current platform cursor theme does not provide it or because it is not
* available on the platform.
*
* @analysis Platform or system settings limitation. Pick another
@ -821,6 +823,28 @@ extern "C" {
* updating any existing out parameters.
*/
#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 by a native access function, GLFW was initialized for a different platform
* than the function is for.
*
* @analysis Failure to detect any platform usually only happens on non-macOS Unix
* systems, either when no window system is running or the program was run from
* a terminal that does not have the necessary environment variables. Fall back to
* a different platform if possible or notify the user that no usable platform was
* detected.
*
* Failure to detect a specific platform may have the same cause as above or be because
* support for that platform was not compiled in. Call @ref glfwPlatformSupported to
* check whether a specific platform is supported by a library binary.
*/
#define GLFW_PLATFORM_UNAVAILABLE 0x0001000E
/*! @} */
/*! @addtogroup window
@ -903,6 +927,18 @@ extern "C" {
*/
#define GLFW_MOUSE_PASSTHROUGH 0x0002000D
/*! @brief Initial position x-coordinate window hint.
*
* Initial position x-coordinate [window hint](@ref GLFW_POSITION_X).
*/
#define GLFW_POSITION_X 0x0002000E
/*! @brief Initial position y-coordinate window hint.
*
* Initial position y-coordinate [window hint](@ref GLFW_POSITION_Y).
*/
#define GLFW_POSITION_Y 0x0002000F
/*! @brief Framebuffer bit depth hint.
*
* Framebuffer bit depth [hint](@ref GLFW_RED_BITS).
@ -1003,7 +1039,7 @@ extern "C" {
* and [attribute](@ref GLFW_CONTEXT_VERSION_MINOR_attrib).
*/
#define GLFW_CONTEXT_VERSION_MINOR 0x00022003
/*! @brief Context client API revision number hint and attribute.
/*! @brief Context client API revision number attribute.
*
* Context client API revision number
* [attribute](@ref GLFW_CONTEXT_REVISION_attrib).
@ -1081,6 +1117,12 @@ extern "C" {
*/
#define GLFW_X11_INSTANCE_NAME 0x00024002
#define GLFW_WIN32_KEYBOARD_MENU 0x00025001
/*! @brief Wayland specific
* [window hint](@ref GLFW_WAYLAND_APP_ID_hint).
*
* Allows specification of the Wayland app_id.
*/
#define GLFW_WAYLAND_APP_ID 0x00026001
/*! @} */
#define GLFW_NO_API 0
@ -1104,6 +1146,7 @@ extern "C" {
#define GLFW_CURSOR_NORMAL 0x00034001
#define GLFW_CURSOR_HIDDEN 0x00034002
#define GLFW_CURSOR_DISABLED 0x00034003
#define GLFW_CURSOR_CAPTURED 0x00034004
#define GLFW_ANY_RELEASE_BEHAVIOR 0
#define GLFW_RELEASE_BEHAVIOR_FLUSH 0x00035001
@ -1121,11 +1164,13 @@ extern "C" {
#define GLFW_ANGLE_PLATFORM_TYPE_VULKAN 0x00037007
#define GLFW_ANGLE_PLATFORM_TYPE_METAL 0x00037008
#define GLFW_ANY_POSITION 0x80000000
/*! @defgroup shapes Standard cursor shapes
* @brief Standard system cursor shapes.
*
* These are the [standard cursor shapes](@ref cursor_standard) that can be
* requested from the window system.
* requested from the platform (window system).
*
* @ingroup input
* @{ */
@ -1242,6 +1287,11 @@ extern "C" {
* ANGLE rendering backend [init hint](@ref GLFW_ANGLE_PLATFORM_TYPE_hint).
*/
#define GLFW_ANGLE_PLATFORM_TYPE 0x00050002
/*! @brief Platform selection init hint.
*
* Platform selection [init hint](@ref GLFW_PLATFORM).
*/
#define GLFW_PLATFORM 0x00050003
/*! @brief macOS specific init hint.
*
* macOS specific [init hint](@ref GLFW_COCOA_CHDIR_RESOURCES_hint).
@ -1259,6 +1309,20 @@ extern "C" {
#define GLFW_X11_XCB_VULKAN_SURFACE 0x00052001
/*! @} */
/*! @addtogroup init
* @{ */
/*! @brief Hint value that enables automatic platform selection.
*
* Hint value for @ref GLFW_PLATFORM that enables automatic platform selection.
*/
#define GLFW_ANY_PLATFORM 0x00060000
#define GLFW_PLATFORM_WIN32 0x00060001
#define GLFW_PLATFORM_COCOA 0x00060002
#define GLFW_PLATFORM_WAYLAND 0x00060003
#define GLFW_PLATFORM_X11 0x00060004
#define GLFW_PLATFORM_NULL 0x00060005
/*! @} */
#define GLFW_DONT_CARE -1
@ -1330,6 +1394,131 @@ typedef struct GLFWwindow GLFWwindow;
*/
typedef struct GLFWcursor GLFWcursor;
/*! @brief The function pointer type for memory allocation callbacks.
*
* This is the function pointer type for memory allocation callbacks. A memory
* allocation callback function has the following signature:
* @code
* void* function_name(size_t size, void* user)
* @endcode
*
* This function must return either a memory block at least `size` bytes long,
* 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.
*
* Any memory allocated by this function will be deallocated during library
* termination or earlier.
*
* The size will always be greater than zero. Allocations of size zero are filtered out
* before reaching the custom allocator.
*
* @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
* error occurred.
*
* @pointer_lifetime The returned memory block must be valid at least until it
* is deallocated.
*
* @reentrancy This function should not call any GLFW function.
*
* @thread_safety This function may be called from any thread that calls GLFW functions.
*
* @sa @ref init_allocator
* @sa @ref GLFWallocator
*
* @since Added in version 3.4.
*
* @ingroup init
*/
typedef void* (* GLFWallocatefun)(size_t size, void* user);
/*! @brief The function pointer type for memory reallocation callbacks.
*
* This is the function pointer type for memory reallocation callbacks.
* A memory reallocation callback function has the following signature:
* @code
* void* function_name(void* block, size_t size, void* user)
* @endcode
*
* This function must return a memory block at least `size` bytes long, 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.
*
* Any memory allocated by this function will be deallocated during library
* termination or earlier.
*
* 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.
*
* @param[in] block The address of the memory block to reallocate.
* @param[in] size The new 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 or resized memory block, or
* `NULL` if an error occurred.
*
* @pointer_lifetime The returned memory block must be valid at least until it
* is deallocated.
*
* @reentrancy This function should not call any GLFW function.
*
* @thread_safety This function may be called from any thread that calls GLFW functions.
*
* @sa @ref init_allocator
* @sa @ref GLFWallocator
*
* @since Added in version 3.4.
*
* @ingroup init
*/
typedef void* (* GLFWreallocatefun)(void* block, size_t size, void* user);
/*! @brief The function pointer type for memory deallocation callbacks.
*
* This is the function pointer type for memory deallocation callbacks.
* A memory deallocation callback function has the following signature:
* @code
* void function_name(void* block, void* user)
* @endcode
*
* 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.
*
* The block address will never be `NULL`. Deallocations of `NULL` are filtered out
* before reaching the custom allocator.
*
* @param[in] block The address of the memory block to deallocate.
* @param[in] user The user-defined pointer from the allocator.
*
* @pointer_lifetime The specified memory block will not be accessed by GLFW
* after this function is called.
*
* @reentrancy This function should not call any GLFW function.
*
* @thread_safety This function may be called from any thread that calls GLFW functions.
*
* @sa @ref init_allocator
* @sa @ref GLFWallocator
*
* @since Added in version 3.4.
*
* @ingroup init
*/
typedef void (* GLFWdeallocatefun)(void* block, void* user);
/*! @brief The function pointer type for error callbacks.
*
* This is the function pointer type for error callbacks. An error callback
@ -1352,7 +1541,7 @@ typedef struct GLFWcursor GLFWcursor;
*
* @ingroup init
*/
typedef void (* GLFWerrorfun)(int,const char*);
typedef void (* GLFWerrorfun)(int error_code, const char* description);
/*! @brief The function pointer type for window position callbacks.
*
@ -1375,7 +1564,7 @@ typedef void (* GLFWerrorfun)(int,const char*);
*
* @ingroup window
*/
typedef void (* GLFWwindowposfun)(GLFWwindow*,int,int);
typedef void (* GLFWwindowposfun)(GLFWwindow* window, int xpos, int ypos);
/*! @brief The function pointer type for window size callbacks.
*
@ -1397,7 +1586,7 @@ typedef void (* GLFWwindowposfun)(GLFWwindow*,int,int);
*
* @ingroup window
*/
typedef void (* GLFWwindowsizefun)(GLFWwindow*,int,int);
typedef void (* GLFWwindowsizefun)(GLFWwindow* window, int width, int height);
/*! @brief The function pointer type for window close callbacks.
*
@ -1417,7 +1606,7 @@ typedef void (* GLFWwindowsizefun)(GLFWwindow*,int,int);
*
* @ingroup window
*/
typedef void (* GLFWwindowclosefun)(GLFWwindow*);
typedef void (* GLFWwindowclosefun)(GLFWwindow* window);
/*! @brief The function pointer type for window content refresh callbacks.
*
@ -1437,7 +1626,7 @@ typedef void (* GLFWwindowclosefun)(GLFWwindow*);
*
* @ingroup window
*/
typedef void (* GLFWwindowrefreshfun)(GLFWwindow*);
typedef void (* GLFWwindowrefreshfun)(GLFWwindow* window);
/*! @brief The function pointer type for window focus callbacks.
*
@ -1458,7 +1647,7 @@ typedef void (* GLFWwindowrefreshfun)(GLFWwindow*);
*
* @ingroup window
*/
typedef void (* GLFWwindowfocusfun)(GLFWwindow*,int);
typedef void (* GLFWwindowfocusfun)(GLFWwindow* window, int focused);
/*! @brief The function pointer type for window iconify callbacks.
*
@ -1479,7 +1668,7 @@ typedef void (* GLFWwindowfocusfun)(GLFWwindow*,int);
*
* @ingroup window
*/
typedef void (* GLFWwindowiconifyfun)(GLFWwindow*,int);
typedef void (* GLFWwindowiconifyfun)(GLFWwindow* window, int iconified);
/*! @brief The function pointer type for window maximize callbacks.
*
@ -1500,7 +1689,7 @@ typedef void (* GLFWwindowiconifyfun)(GLFWwindow*,int);
*
* @ingroup window
*/
typedef void (* GLFWwindowmaximizefun)(GLFWwindow*,int);
typedef void (* GLFWwindowmaximizefun)(GLFWwindow* window, int maximized);
/*! @brief The function pointer type for framebuffer size callbacks.
*
@ -1521,7 +1710,7 @@ typedef void (* GLFWwindowmaximizefun)(GLFWwindow*,int);
*
* @ingroup window
*/
typedef void (* GLFWframebuffersizefun)(GLFWwindow*,int,int);
typedef void (* GLFWframebuffersizefun)(GLFWwindow* window, int width, int height);
/*! @brief The function pointer type for window content scale callbacks.
*
@ -1542,7 +1731,7 @@ typedef void (* GLFWframebuffersizefun)(GLFWwindow*,int,int);
*
* @ingroup window
*/
typedef void (* GLFWwindowcontentscalefun)(GLFWwindow*,float,float);
typedef void (* GLFWwindowcontentscalefun)(GLFWwindow* window, float xscale, float yscale);
/*! @brief The function pointer type for mouse button callbacks.
*
@ -1568,7 +1757,7 @@ typedef void (* GLFWwindowcontentscalefun)(GLFWwindow*,float,float);
*
* @ingroup input
*/
typedef void (* GLFWmousebuttonfun)(GLFWwindow*,int,int,int);
typedef void (* GLFWmousebuttonfun)(GLFWwindow* window, int button, int action, int mods);
/*! @brief The function pointer type for cursor position callbacks.
*
@ -1591,7 +1780,7 @@ typedef void (* GLFWmousebuttonfun)(GLFWwindow*,int,int,int);
*
* @ingroup input
*/
typedef void (* GLFWcursorposfun)(GLFWwindow*,double,double);
typedef void (* GLFWcursorposfun)(GLFWwindow* window, double xpos, double ypos);
/*! @brief The function pointer type for cursor enter/leave callbacks.
*
@ -1612,7 +1801,7 @@ typedef void (* GLFWcursorposfun)(GLFWwindow*,double,double);
*
* @ingroup input
*/
typedef void (* GLFWcursorenterfun)(GLFWwindow*,int);
typedef void (* GLFWcursorenterfun)(GLFWwindow* window, int entered);
/*! @brief The function pointer type for scroll callbacks.
*
@ -1633,7 +1822,7 @@ typedef void (* GLFWcursorenterfun)(GLFWwindow*,int);
*
* @ingroup input
*/
typedef void (* GLFWscrollfun)(GLFWwindow*,double,double);
typedef void (* GLFWscrollfun)(GLFWwindow* window, double xoffset, double yoffset);
/*! @brief The function pointer type for keyboard key callbacks.
*
@ -1645,7 +1834,7 @@ typedef void (* GLFWscrollfun)(GLFWwindow*,double,double);
*
* @param[in] window The window that received the event.
* @param[in] key The [keyboard key](@ref keys) that was pressed or released.
* @param[in] scancode The system-specific scancode of the key.
* @param[in] scancode The platform-specific scancode of the key.
* @param[in] action `GLFW_PRESS`, `GLFW_RELEASE` or `GLFW_REPEAT`. Future
* releases may add more actions.
* @param[in] mods Bit field describing which [modifier keys](@ref mods) were
@ -1659,7 +1848,7 @@ typedef void (* GLFWscrollfun)(GLFWwindow*,double,double);
*
* @ingroup input
*/
typedef void (* GLFWkeyfun)(GLFWwindow*,int,int,int,int);
typedef void (* GLFWkeyfun)(GLFWwindow* window, int key, int scancode, int action, int mods);
/*! @brief The function pointer type for Unicode character callbacks.
*
@ -1680,7 +1869,7 @@ typedef void (* GLFWkeyfun)(GLFWwindow*,int,int,int,int);
*
* @ingroup input
*/
typedef void (* GLFWcharfun)(GLFWwindow*,unsigned int);
typedef void (* GLFWcharfun)(GLFWwindow* window, unsigned int codepoint);
/*! @brief The function pointer type for Unicode character with modifiers
* callbacks.
@ -1707,7 +1896,7 @@ typedef void (* GLFWcharfun)(GLFWwindow*,unsigned int);
*
* @ingroup input
*/
typedef void (* GLFWcharmodsfun)(GLFWwindow*,unsigned int,int);
typedef void (* GLFWcharmodsfun)(GLFWwindow* window, unsigned int codepoint, int mods);
/*! @brief The function pointer type for path drop callbacks.
*
@ -1731,7 +1920,7 @@ typedef void (* GLFWcharmodsfun)(GLFWwindow*,unsigned int,int);
*
* @ingroup input
*/
typedef void (* GLFWdropfun)(GLFWwindow*,int,const char*[]);
typedef void (* GLFWdropfun)(GLFWwindow* window, int path_count, const char* paths[]);
/*! @brief The function pointer type for monitor configuration callbacks.
*
@ -1752,7 +1941,7 @@ typedef void (* GLFWdropfun)(GLFWwindow*,int,const char*[]);
*
* @ingroup monitor
*/
typedef void (* GLFWmonitorfun)(GLFWmonitor*,int);
typedef void (* GLFWmonitorfun)(GLFWmonitor* monitor, int event);
/*! @brief The function pointer type for joystick configuration callbacks.
*
@ -1773,7 +1962,7 @@ typedef void (* GLFWmonitorfun)(GLFWmonitor*,int);
*
* @ingroup input
*/
typedef void (* GLFWjoystickfun)(int,int);
typedef void (* GLFWjoystickfun)(int jid, int event);
/*! @brief Video mode type.
*
@ -1887,6 +2076,23 @@ typedef struct GLFWgamepadstate
float axes[6];
} GLFWgamepadstate;
/*! @brief
*
* @sa @ref init_allocator
* @sa @ref glfwInitAllocator
*
* @since Added in version 3.4.
*
* @ingroup init
*/
typedef struct GLFWallocator
{
GLFWallocatefun allocate;
GLFWreallocatefun reallocate;
GLFWdeallocatefun deallocate;
void* user;
} GLFWallocator;
/*************************************************************************
* GLFW API functions
@ -1905,10 +2111,15 @@ typedef struct GLFWgamepadstate
* Additional calls to this function after successful initialization but before
* termination will return `GLFW_TRUE` immediately.
*
* The @ref GLFW_PLATFORM init hint controls which platforms are considered during
* initialization. This also depends on which platforms the library was compiled to
* support.
*
* @return `GLFW_TRUE` if successful, or `GLFW_FALSE` if an
* [error](@ref error_handling) occurred.
*
* @errors Possible errors include @ref GLFW_PLATFORM_ERROR.
* @errors Possible errors include @ref GLFW_PLATFORM_UNAVAILABLE and @ref
* GLFW_PLATFORM_ERROR.
*
* @remark @macos This function will change the current directory of the
* application to the `Contents/Resources` subdirectory of the application's
@ -1930,6 +2141,8 @@ typedef struct GLFWgamepadstate
* @thread_safety This function must only be called from the main thread.
*
* @sa @ref intro_init
* @sa @ref glfwInitHint
* @sa @ref glfwInitAllocator
* @sa @ref glfwTerminate
*
* @since Added in version 1.0.
@ -2004,6 +2217,81 @@ GLFWAPI void glfwTerminate(void);
*/
GLFWAPI void glfwInitHint(int hint, int value);
/*! @brief Sets the init allocator to the desired 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.
*
* @param[in] allocator The allocator to use at the next initialization, or
* `NULL` to use the default one.
*
* @errors Possible errors include @ref GLFW_INVALID_VALUE.
*
* @pointer_lifetime The specified allocator is copied before this function
* returns.
*
* @thread_safety This function must only be called from the main thread.
*
* @sa @ref init_allocator
* @sa @ref glfwInit
*
* @since Added in version 3.4.
*
* @ingroup init
*/
GLFWAPI void glfwInitAllocator(const GLFWallocator* allocator);
#if defined(VK_VERSION_1_0)
/*! @brief Sets the desired Vulkan `vkGetInstanceProcAddr` function.
*
* This function sets the `vkGetInstanceProcAddr` function that GLFW will use for all
* Vulkan related entry point queries.
*
* This feature is mostly useful on macOS, if your copy of the Vulkan loader is in
* a location where GLFW cannot find it through dynamic loading, or if you are still
* using the static library version of the loader.
*
* If set to `NULL`, GLFW will try to load the Vulkan loader dynamically by its standard
* name and get this function from there. This is the default behavior.
*
* The standard name of the loader is `vulkan-1.dll` on Windows, `libvulkan.so.1` on
* Linux and other Unix-like systems and `libvulkan.1.dylib` on macOS. If your code is
* also loading it via these names then you probably don't need to use this function.
*
* The function address you set is never reset by GLFW, but it only takes effect during
* initialization. Once GLFW has been initialized, any updates will be ignored until the
* library is terminated and initialized again.
*
* @param[in] loader The address of the function to use, or `NULL`.
*
* @par Loader function signature
* @code
* PFN_vkVoidFunction vkGetInstanceProcAddr(VkInstance instance, const char* name)
* @endcode
* For more information about this function, see the
* [Vulkan Registry](https://www.khronos.org/registry/vulkan/).
*
* @errors None.
*
* @remark This function may be called before @ref glfwInit.
*
* @thread_safety This function must only be called from the main thread.
*
* @sa @ref vulkan_loader
* @sa @ref glfwInit
*
* @since Added in version 3.4.
*
* @ingroup init
*/
GLFWAPI void glfwInitVulkanLoader(PFN_vkGetInstanceProcAddr loader);
#endif /*VK_VERSION_1_0*/
/*! @brief Retrieves the version of the GLFW library.
*
* This function retrieves the major, minor and revision numbers of the GLFW
@ -2034,15 +2322,18 @@ GLFWAPI void glfwGetVersion(int* major, int* minor, int* rev);
/*! @brief Returns a string describing the compile-time configuration.
*
* This function returns the compile-time generated
* [version string](@ref intro_version_string) of the GLFW library binary. It
* describes the version, platform, compiler and any platform-specific
* compile-time options. It should not be confused with the OpenGL or OpenGL
* ES version string, queried with `glGetString`.
* [version string](@ref intro_version_string) of the GLFW library binary. It describes
* the version, platforms, compiler and any platform or operating system specific
* compile-time options. It should not be confused with the OpenGL or OpenGL ES version
* string, queried with `glGetString`.
*
* __Do not use the version string__ to parse the GLFW library version. The
* @ref glfwGetVersion function provides the version of the running library
* binary in numerical format.
*
* __Do not use the version string__ to parse what platforms are supported. The @ref
* glfwPlatformSupported function lets you query platform support.
*
* @return The ASCII encoded GLFW version string.
*
* @errors None.
@ -2139,6 +2430,51 @@ GLFWAPI int glfwGetError(const char** description);
*/
GLFWAPI GLFWerrorfun glfwSetErrorCallback(GLFWerrorfun callback);
/*! @brief Returns the currently selected platform.
*
* This function returns the platform that was selected during initialization. The
* returned value will be one of `GLFW_PLATFORM_WIN32`, `GLFW_PLATFORM_COCOA`,
* `GLFW_PLATFORM_WAYLAND`, `GLFW_PLATFORM_X11` or `GLFW_PLATFORM_NULL`.
*
* @return The currently selected platform, or zero if an error occurred.
*
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
*
* @thread_safety This function may be called from any thread.
*
* @sa @ref platform
* @sa @ref glfwPlatformSupported
*
* @since Added in version 3.4.
*
* @ingroup init
*/
GLFWAPI int glfwGetPlatform(void);
/*! @brief Returns whether the library includes support for the specified platform.
*
* This function returns whether the library was compiled with support for the specified
* platform. The platform must be one of `GLFW_PLATFORM_WIN32`, `GLFW_PLATFORM_COCOA`,
* `GLFW_PLATFORM_WAYLAND`, `GLFW_PLATFORM_X11` or `GLFW_PLATFORM_NULL`.
*
* @param[in] platform The platform to query.
* @return `GLFW_TRUE` if the platform is supported, or `GLFW_FALSE` otherwise.
*
* @errors Possible errors include @ref GLFW_INVALID_ENUM.
*
* @remark This function may be called before @ref glfwInit.
*
* @thread_safety This function may be called from any thread.
*
* @sa @ref platform
* @sa @ref glfwGetPlatform
*
* @since Added in version 3.4.
*
* @ingroup init
*/
GLFWAPI int glfwPlatformSupported(int platform);
/*! @brief Returns the currently connected monitors.
*
* This function returns an array of handles for all currently connected
@ -2222,7 +2558,7 @@ GLFWAPI void glfwGetMonitorPos(GLFWmonitor* monitor, int* xpos, int* ypos);
* This function returns the position, in screen coordinates, of the upper-left
* corner of the work area of the specified monitor along with the work area
* size in screen coordinates. The work area is defined as the area of the
* monitor not occluded by the operating system task bar where present. If no
* monitor not occluded by the window system task bar where present. If no
* task bar exists then the work area is the monitor resolution in screen
* coordinates.
*
@ -2253,7 +2589,7 @@ GLFWAPI void glfwGetMonitorWorkarea(GLFWmonitor* monitor, int* xpos, int* ypos,
* This function returns the size, in millimetres, of the display area of the
* specified monitor.
*
* Some systems do not provide accurate monitor size information, either
* 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.
@ -2269,8 +2605,8 @@ GLFWAPI void glfwGetMonitorWorkarea(GLFWmonitor* monitor, int* xpos, int* ypos,
*
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
*
* @remark @win32 calculates the returned physical size from the
* current resolution and system DPI instead of querying the monitor EDID data.
* @remark @win32 On Windows 8 and earlier the physical size is calculated from
* the current resolution and system DPI instead of querying the monitor EDID data.
*
* @thread_safety This function must only be called from the main thread.
*
@ -2714,10 +3050,10 @@ GLFWAPI void glfwWindowHintString(int hint, const char* value);
* OpenGL or OpenGL ES context.
*
* By default, newly created windows use the placement recommended by the
* window system. To create the window at a specific position, make it
* initially invisible using the [GLFW_VISIBLE](@ref GLFW_VISIBLE_hint) window
* hint, set its [position](@ref window_pos) and then [show](@ref window_hide)
* it.
* window system. To create the window at a specific position, set the @ref
* GLFW_POSITION_X and @ref GLFW_POSITION_Y window hints before creation. To
* restore the default behavior, set either or both hints back to
* `GLFW_ANY_POSITION`.
*
* As long as at least one full screen window is not iconified, the screensaver
* is prohibited from starting.
@ -2942,7 +3278,8 @@ GLFWAPI void glfwSetWindowTitle(GLFWwindow* window, const char* title);
* count is zero.
*
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
* GLFW_PLATFORM_ERROR and @ref GLFW_FEATURE_UNAVAILABLE (see remarks).
* GLFW_INVALID_VALUE, @ref GLFW_PLATFORM_ERROR and @ref
* GLFW_FEATURE_UNAVAILABLE (see remarks).
*
* @pointer_lifetime The specified image data is copied before this function
* returns.
@ -3267,7 +3604,7 @@ GLFWAPI void glfwGetWindowFrameSize(GLFWwindow* window, int* left, int* top, int
* regardless of their DPI and scaling settings. This relies on the system DPI
* and scaling settings being somewhat correct.
*
* On systems where each monitors can have its own content scale, the window
* On platforms where each monitors can have its own content scale, the window
* content scale will depend on which monitor the system considers the window
* to be on.
*
@ -3355,8 +3692,9 @@ GLFWAPI void glfwSetWindowOpacity(GLFWwindow* window, float opacity);
* previously restored. If the window is already iconified, this function does
* nothing.
*
* If the specified window is a full screen window, the original monitor
* resolution is restored until the window is restored.
* If the specified window is a full screen window, GLFW restores the original
* video mode of the monitor. The window's desired video mode is set again
* when the window is restored.
*
* @param[in] window The window to iconify.
*
@ -3386,8 +3724,8 @@ GLFWAPI void glfwIconifyWindow(GLFWwindow* window);
* (minimized) or maximized. If the window is already restored, this function
* does nothing.
*
* If the specified window is a full screen window, the resolution chosen for
* the window is restored on the selected monitor.
* If the specified window is an iconified full screen window, its desired
* video mode is set again for its monitor when the window is restored.
*
* @param[in] window The window to restore.
*
@ -3448,6 +3786,11 @@ GLFWAPI void glfwMaximizeWindow(GLFWwindow* window);
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
* GLFW_PLATFORM_ERROR.
*
* @remark @wayland Because Wayland wants every frame of the desktop to be
* complete, this function does not immediately make the window visible.
* Instead it will become visible the next time the window framebuffer is
* updated after this call.
*
* @thread_safety This function must only be called from the main thread.
*
* @sa @ref window_hide
@ -3650,6 +3993,9 @@ GLFWAPI void glfwSetWindowMonitor(GLFWwindow* window, GLFWmonitor* monitor, int
* errors. However, this function should not fail as long as it is passed
* valid arguments and the library has been [initialized](@ref intro_init).
*
* @remark @wayland The Wayland protocol provides no way to check whether a
* window is iconfied, so @ref GLFW_ICONIFIED always returns `GLFW_FALSE`.
*
* @thread_safety This function must only be called from the main thread.
*
* @sa @ref window_attribs
@ -4235,6 +4581,8 @@ GLFWAPI int glfwGetInputMode(GLFWwindow* window, int mode);
* - `GLFW_CURSOR_DISABLED` hides and grabs the cursor, providing virtual
* and unlimited cursor movement. This is useful for implementing for
* example 3D camera controls.
* - `GLFW_CURSOR_CAPTURED` makes the cursor visible and confines it to the
* content area of the window.
*
* If the mode is `GLFW_STICKY_KEYS`, the value must be either `GLFW_TRUE` to
* enable sticky keys, or `GLFW_FALSE` to disable it. If sticky keys are
@ -4409,8 +4757,7 @@ GLFWAPI int glfwGetKeyScancode(int key);
*
* This function returns the last state reported for the specified key to the
* specified window. The returned state is one of `GLFW_PRESS` or
* `GLFW_RELEASE`. The higher-level action `GLFW_REPEAT` is only reported to
* the key callback.
* `GLFW_RELEASE`. The action `GLFW_REPEAT` is only reported to the key callback.
*
* If the @ref GLFW_STICKY_KEYS input mode is enabled, this function returns
* `GLFW_PRESS` the first time you call it for a key that was pressed, even if
@ -4571,8 +4918,8 @@ GLFWAPI void glfwSetCursorPos(GLFWwindow* window, double xpos, double ypos);
* @return The handle of the created cursor, 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_INVALID_VALUE and @ref GLFW_PLATFORM_ERROR.
*
* @pointer_lifetime The specified image data is copied before this function
* returns.
@ -5387,6 +5734,8 @@ GLFWAPI int glfwUpdateGamepadMappings(const char* string);
* joystick is not present, does not have a mapping or an
* [error](@ref error_handling) occurred.
*
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref GLFW_INVALID_ENUM.
*
* @pointer_lifetime The returned string is allocated and freed by GLFW. You
* should not free it yourself. It is valid until the specified joystick is
* disconnected, the gamepad mappings are updated or the library is terminated.
@ -5476,8 +5825,8 @@ GLFWAPI void glfwSetClipboardString(GLFWwindow* window, const char* string);
* @return The contents of the clipboard as a UTF-8 encoded string, 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_FORMAT_UNAVAILABLE and @ref GLFW_PLATFORM_ERROR.
*
* @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
@ -5506,7 +5855,7 @@ GLFWAPI const char* glfwGetClipboardString(GLFWwindow* window);
*
* The resolution of the timer is system dependent, but is usually on the order
* of a few micro- or nanoseconds. It uses the highest-resolution monotonic
* time source on each supported platform.
* time source on each operating system.
*
* @return The current time, in seconds, or zero if an
* [error](@ref error_handling) occurred.
@ -5717,7 +6066,7 @@ GLFWAPI void glfwSwapBuffers(GLFWwindow* window);
* GLFW_NO_CURRENT_CONTEXT and @ref GLFW_PLATFORM_ERROR.
*
* @remark This function is not called during context creation, leaving the
* swap interval set to whatever is the default on that platform. This is done
* swap interval set to whatever is the default for that API. This is done
* because some swap interval extensions used by GLFW do not allow the swap
* interval to be reset to zero once it has been set to a non-zero value.
*
@ -5821,13 +6170,11 @@ GLFWAPI GLFWglproc glfwGetProcAddress(const char* procname);
* This function returns whether the Vulkan loader and any minimally functional
* ICD have been found.
*
* The availability of a Vulkan loader and even an ICD does not by itself
* guarantee that surface creation or even instance creation is possible.
* For example, on Fermi systems Nvidia will install an ICD that provides no
* actual Vulkan support. Call @ref glfwGetRequiredInstanceExtensions to check
* whether the extensions necessary for Vulkan surface creation are available
* and @ref glfwGetPhysicalDevicePresentationSupport to check whether a queue
* family of a physical device supports image presentation.
* The availability of a Vulkan loader and even an ICD does not by itself guarantee that
* surface creation or even instance creation is possible. Call @ref
* glfwGetRequiredInstanceExtensions to check whether the extensions necessary for Vulkan
* surface creation are available and @ref glfwGetPhysicalDevicePresentationSupport to
* check whether a queue family of a physical device supports image presentation.
*
* @return `GLFW_TRUE` if Vulkan is minimally available, or `GLFW_FALSE`
* otherwise.
@ -5873,9 +6220,6 @@ GLFWAPI int glfwVulkanSupported(void);
* returned array, as it is an error to specify an extension more than once in
* the `VkInstanceCreateInfo` struct.
*
* @remark @macos GLFW currently supports both the `VK_MVK_macos_surface` and
* the newer `VK_EXT_metal_surface` extensions.
*
* @pointer_lifetime The returned array is allocated and freed by GLFW. You
* should not free it yourself. It is guaranteed to be valid only until the
* library is terminated.
@ -6014,17 +6358,20 @@ GLFWAPI int glfwGetPhysicalDevicePresentationSupport(VkInstance instance, VkPhys
* @ref glfwVulkanSupported and @ref glfwGetRequiredInstanceExtensions should
* eliminate almost all occurrences of these errors.
*
* @remark @macos This function currently only supports the
* `VK_MVK_macos_surface` extension from MoltenVK.
* @remark @macos GLFW prefers the `VK_EXT_metal_surface` extension, with the
* `VK_MVK_macos_surface` extension as a fallback. The name of the selected
* extension, if any, is included in the array returned by @ref
* glfwGetRequiredInstanceExtensions.
*
* @remark @macos This function creates and sets a `CAMetalLayer` instance for
* the window content view, which is required for MoltenVK to function.
*
* @remark @x11 GLFW by default attempts to use the `VK_KHR_xcb_surface`
* extension, if available. You can make it prefer the `VK_KHR_xlib_surface`
* extension by setting the
* @remark @x11 By default GLFW prefers the `VK_KHR_xcb_surface` extension,
* with the `VK_KHR_xlib_surface` extension as a fallback. You can make
* `VK_KHR_xlib_surface` the preferred extension by setting the
* [GLFW_X11_XCB_VULKAN_SURFACE](@ref GLFW_X11_XCB_VULKAN_SURFACE_hint) init
* hint.
* hint. The name of the selected extension, if any, is included in the array
* returned by @ref glfwGetRequiredInstanceExtensions.
*
* @thread_safety This function may be called from any thread. For
* synchronization details of Vulkan objects, see the Vulkan specification.
@ -6062,6 +6409,7 @@ GLFWAPI VkResult glfwCreateWindowSurface(VkInstance instance, GLFWwindow* window
*/
#ifndef GLAPIENTRY
#define GLAPIENTRY APIENTRY
#define GLFW_GLAPIENTRY_DEFINED
#endif
/* -------------------- END SYSTEM/COMPILER SPECIFIC --------------------- */