blob: a61ec83fde1f5c624583630a462b02c30dccef04 [file] [log] [blame]
Camilla Berglund2955cd32010-11-17 15:42:55 +01001/*************************************************************************
Camilla Löwya337c562019-04-16 14:43:29 +02002 * GLFW 3.4 - www.glfw.org
Camilla Berglund3cfc4002013-07-29 20:53:17 +02003 * A library for OpenGL, window and input
Camilla Berglund3249f812010-09-07 17:34:51 +02004 *------------------------------------------------------------------------
5 * Copyright (c) 2002-2006 Marcus Geelnard
Camilla Löwyab118b22019-04-15 20:50:00 +02006 * Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.org>
Camilla Berglund3249f812010-09-07 17:34:51 +02007 *
8 * This software is provided 'as-is', without any express or implied
9 * warranty. In no event will the authors be held liable for any damages
10 * arising from the use of this software.
11 *
12 * Permission is granted to anyone to use this software for any purpose,
13 * including commercial applications, and to alter it and redistribute it
14 * freely, subject to the following restrictions:
15 *
16 * 1. The origin of this software must not be misrepresented; you must not
17 * claim that you wrote the original software. If you use this software
18 * in a product, an acknowledgment in the product documentation would
19 * be appreciated but is not required.
20 *
21 * 2. Altered source versions must be plainly marked as such, and must not
22 * be misrepresented as being the original software.
23 *
24 * 3. This notice may not be removed or altered from any source
25 * distribution.
26 *
27 *************************************************************************/
28
Camilla Berglundf8df91d2013-01-15 01:59:56 +010029#ifndef _glfw3_h_
30#define _glfw3_h_
Camilla Berglund3249f812010-09-07 17:34:51 +020031
32#ifdef __cplusplus
33extern "C" {
34#endif
35
36
37/*************************************************************************
Camilla Berglundbce2cd62012-11-22 16:38:24 +010038 * Doxygen documentation
39 *************************************************************************/
40
Camilla Berglund318e8ac2015-10-24 20:48:46 +020041/*! @file glfw3.h
42 * @brief The header of the GLFW 3 API.
43 *
44 * This is the header file of the GLFW 3 API. It defines all its types and
45 * declares all its functions.
46 *
47 * For more information about how to use this file, see @ref build_include.
48 */
Camilla Berglund80c203f2016-02-19 10:29:13 +010049/*! @defgroup context Context reference
Camilla Löwy21eabd32017-02-06 17:31:25 +010050 * @brief Functions and types related to OpenGL and OpenGL ES contexts.
Camilla Berglund4591ad22014-09-18 15:03:29 +020051 *
Camilla Berglund80c203f2016-02-19 10:29:13 +010052 * This is the reference documentation for OpenGL and OpenGL ES context related
53 * functions. For more task-oriented information, see the @ref context_guide.
Camilla Berglund3f5843f2012-12-13 02:22:39 +010054 */
Camilla Berglund80c203f2016-02-19 10:29:13 +010055/*! @defgroup vulkan Vulkan reference
Camilla Löwy21eabd32017-02-06 17:31:25 +010056 * @brief Functions and types related to Vulkan.
Camilla Berglund9b75bff2015-08-10 20:19:04 +020057 *
Camilla Berglund80c203f2016-02-19 10:29:13 +010058 * This is the reference documentation for Vulkan related functions and types.
59 * For more task-oriented information, see the @ref vulkan_guide.
Camilla Berglund9b75bff2015-08-10 20:19:04 +020060 */
Camilla Berglund80c203f2016-02-19 10:29:13 +010061/*! @defgroup init Initialization, version and error reference
Camilla Löwy21eabd32017-02-06 17:31:25 +010062 * @brief Functions and types related to initialization and error handling.
Camilla Berglund4591ad22014-09-18 15:03:29 +020063 *
64 * This is the reference documentation for initialization and termination of
Camilla Berglund80c203f2016-02-19 10:29:13 +010065 * the library, version management and error handling. For more task-oriented
66 * information, see the @ref intro_guide.
Camilla Berglundbce2cd62012-11-22 16:38:24 +010067 */
Camilla Berglund80c203f2016-02-19 10:29:13 +010068/*! @defgroup input Input reference
Camilla Löwy21eabd32017-02-06 17:31:25 +010069 * @brief Functions and types related to input handling.
Camilla Berglund4591ad22014-09-18 15:03:29 +020070 *
71 * This is the reference documentation for input related functions and types.
Camilla Berglund80c203f2016-02-19 10:29:13 +010072 * For more task-oriented information, see the @ref input_guide.
Camilla Berglundbce2cd62012-11-22 16:38:24 +010073 */
Camilla Berglund80c203f2016-02-19 10:29:13 +010074/*! @defgroup monitor Monitor reference
Camilla Löwy21eabd32017-02-06 17:31:25 +010075 * @brief Functions and types related to monitors.
Camilla Berglundf5f55e32013-06-17 12:56:36 +020076 *
77 * This is the reference documentation for monitor related functions and types.
Camilla Berglund80c203f2016-02-19 10:29:13 +010078 * For more task-oriented information, see the @ref monitor_guide.
Camilla Berglund5f68e122012-11-27 17:07:28 +010079 */
Camilla Berglund80c203f2016-02-19 10:29:13 +010080/*! @defgroup window Window reference
Camilla Löwy21eabd32017-02-06 17:31:25 +010081 * @brief Functions and types related to windows.
Camilla Berglundbce2cd62012-11-22 16:38:24 +010082 *
Camilla Berglundf5f55e32013-06-17 12:56:36 +020083 * This is the reference documentation for window related functions and types,
Camilla Berglund80c203f2016-02-19 10:29:13 +010084 * including creation, deletion and event polling. For more task-oriented
85 * information, see the @ref window_guide.
Camilla Berglundbce2cd62012-11-22 16:38:24 +010086 */
Camilla Berglundbce2cd62012-11-22 16:38:24 +010087
88
89/*************************************************************************
Camilla Berglund8d910d72015-02-22 18:35:10 +010090 * Compiler- and platform-specific preprocessor work
Camilla Berglund3249f812010-09-07 17:34:51 +020091 *************************************************************************/
92
Camilla Berglund8d910d72015-02-22 18:35:10 +010093/* If we are we on Windows, we want a single define for it.
Camilla Berglund3249f812010-09-07 17:34:51 +020094 */
Camilla Berglunde8ce4ab2015-02-22 18:18:43 +010095#if !defined(_WIN32) && (defined(__WIN32__) || defined(WIN32) || defined(__MINGW32__))
Camilla Berglund3249f812010-09-07 17:34:51 +020096 #define _WIN32
97#endif /* _WIN32 */
98
Camilla Berglund8d910d72015-02-22 18:35:10 +010099/* It is customary to use APIENTRY for OpenGL function pointer declarations on
100 * all platforms. Additionally, the Windows OpenGL header needs APIENTRY.
Camilla Berglund3249f812010-09-07 17:34:51 +0200101 */
102#ifndef APIENTRY
103 #ifdef _WIN32
104 #define APIENTRY __stdcall
105 #else
106 #define APIENTRY
107 #endif
Camilla Löwyc23fca62017-08-21 14:37:38 +0200108 #define GLFW_APIENTRY_DEFINED
Camilla Berglund3249f812010-09-07 17:34:51 +0200109#endif /* APIENTRY */
110
Camilla Berglund8d910d72015-02-22 18:35:10 +0100111/* Some Windows OpenGL headers need this.
Camilla Berglund3249f812010-09-07 17:34:51 +0200112 */
Camilla Berglund3249f812010-09-07 17:34:51 +0200113#if !defined(WINGDIAPI) && defined(_WIN32)
Camilla Berglundc5353642015-02-22 18:14:30 +0100114 #define WINGDIAPI __declspec(dllimport)
Camilla Berglund4afc67c2011-07-27 17:09:17 +0200115 #define GLFW_WINGDIAPI_DEFINED
Camilla Berglund3249f812010-09-07 17:34:51 +0200116#endif /* WINGDIAPI */
117
Camilla Berglund8d910d72015-02-22 18:35:10 +0100118/* Some Windows GLU headers need this.
119 */
Camilla Berglund3249f812010-09-07 17:34:51 +0200120#if !defined(CALLBACK) && defined(_WIN32)
Camilla Berglundd586fe62015-02-22 18:17:34 +0100121 #define CALLBACK __stdcall
Camilla Berglund4afc67c2011-07-27 17:09:17 +0200122 #define GLFW_CALLBACK_DEFINED
Camilla Berglund3249f812010-09-07 17:34:51 +0200123#endif /* CALLBACK */
124
Camilla Berglund70423af2016-07-21 00:15:07 +0200125/* Include because most Windows GLU headers need wchar_t and
Camilla Berglund8d6f2652016-10-20 00:50:54 +0200126 * the macOS OpenGL header blocks the definition of ptrdiff_t by glext.h.
Camilla Berglund8221aad2016-03-06 09:40:16 +0100127 * Include it unconditionally to avoid surprising side-effects.
Camilla Berglund8d910d72015-02-22 18:35:10 +0100128 */
Camilla Berglund8221aad2016-03-06 09:40:16 +0100129#include <stddef.h>
Camilla Berglund70423af2016-07-21 00:15:07 +0200130
131/* Include because it is needed by Vulkan and related functions.
Camilla Löwyfa0b5e12017-05-16 14:54:17 +0200132 * Include it unconditionally to avoid surprising side-effects.
Camilla Berglund70423af2016-07-21 00:15:07 +0200133 */
Camilla Berglund5661d032016-03-23 10:09:07 +0100134#include <stdint.h>
Camilla Berglund3249f812010-09-07 17:34:51 +0200135
Camilla Löwyfa0b5e12017-05-16 14:54:17 +0200136/* Include the chosen OpenGL or OpenGL ES headers.
Camilla Berglundc93b1202013-09-08 16:07:34 +0200137 */
Konstantin Käfer244d6d72017-05-16 15:42:51 +0200138#if defined(GLFW_INCLUDE_ES1)
Camilla Löwyfa0b5e12017-05-16 14:54:17 +0200139
Konstantin Käfer244d6d72017-05-16 15:42:51 +0200140 #include <GLES/gl.h>
141 #if defined(GLFW_INCLUDE_GLEXT)
142 #include <GLES/glext.h>
143 #endif
Camilla Löwyfa0b5e12017-05-16 14:54:17 +0200144
Konstantin Käfer244d6d72017-05-16 15:42:51 +0200145#elif defined(GLFW_INCLUDE_ES2)
Camilla Löwyfa0b5e12017-05-16 14:54:17 +0200146
Konstantin Käfer244d6d72017-05-16 15:42:51 +0200147 #include <GLES2/gl2.h>
148 #if defined(GLFW_INCLUDE_GLEXT)
149 #include <GLES2/gl2ext.h>
150 #endif
Camilla Löwyfa0b5e12017-05-16 14:54:17 +0200151
Konstantin Käfer244d6d72017-05-16 15:42:51 +0200152#elif defined(GLFW_INCLUDE_ES3)
Camilla Löwyfa0b5e12017-05-16 14:54:17 +0200153
Konstantin Käfer244d6d72017-05-16 15:42:51 +0200154 #include <GLES3/gl3.h>
155 #if defined(GLFW_INCLUDE_GLEXT)
156 #include <GLES2/gl2ext.h>
157 #endif
Camilla Löwyfa0b5e12017-05-16 14:54:17 +0200158
Konstantin Käfer244d6d72017-05-16 15:42:51 +0200159#elif defined(GLFW_INCLUDE_ES31)
Camilla Löwyfa0b5e12017-05-16 14:54:17 +0200160
Konstantin Käfer244d6d72017-05-16 15:42:51 +0200161 #include <GLES3/gl31.h>
162 #if defined(GLFW_INCLUDE_GLEXT)
163 #include <GLES2/gl2ext.h>
164 #endif
Camilla Löwyfa0b5e12017-05-16 14:54:17 +0200165
Konstantin Käfer244d6d72017-05-16 15:42:51 +0200166#elif defined(GLFW_INCLUDE_ES32)
Camilla Löwyfa0b5e12017-05-16 14:54:17 +0200167
Konstantin Käfer244d6d72017-05-16 15:42:51 +0200168 #include <GLES3/gl32.h>
169 #if defined(GLFW_INCLUDE_GLEXT)
170 #include <GLES2/gl2ext.h>
171 #endif
Camilla Löwyfa0b5e12017-05-16 14:54:17 +0200172
173#elif defined(GLFW_INCLUDE_GLCOREARB)
174
175 #if defined(__APPLE__)
176
Camilla Berglund1591caa2015-01-08 06:56:17 +0100177 #include <OpenGL/gl3.h>
178 #if defined(GLFW_INCLUDE_GLEXT)
179 #include <OpenGL/gl3ext.h>
Camilla Löwyfa0b5e12017-05-16 14:54:17 +0200180 #endif /*GLFW_INCLUDE_GLEXT*/
181
182 #else /*__APPLE__*/
183
184 #include <GL/glcorearb.h>
185
186 #endif /*__APPLE__*/
187
188#elif !defined(GLFW_INCLUDE_NONE)
189
190 #if defined(__APPLE__)
191
Camilla Berglund1591caa2015-01-08 06:56:17 +0100192 #if !defined(GLFW_INCLUDE_GLEXT)
193 #define GL_GLEXT_LEGACY
Camilla Berglundc93b1202013-09-08 16:07:34 +0200194 #endif
Camilla Berglund1591caa2015-01-08 06:56:17 +0100195 #include <OpenGL/gl.h>
Camilla Löwyfa0b5e12017-05-16 14:54:17 +0200196 #if defined(GLFW_INCLUDE_GLU)
197 #include <OpenGL/glu.h>
198 #endif
199
200 #else /*__APPLE__*/
201
Camilla Berglund1591caa2015-01-08 06:56:17 +0100202 #include <GL/gl.h>
203 #if defined(GLFW_INCLUDE_GLEXT)
204 #include <GL/glext.h>
205 #endif
Camilla Löwyfa0b5e12017-05-16 14:54:17 +0200206 #if defined(GLFW_INCLUDE_GLU)
207 #include <GL/glu.h>
208 #endif
209
210 #endif /*__APPLE__*/
211
212#endif /* OpenGL and OpenGL ES headers */
213
Camilla Berglund433db8f2016-09-14 21:13:33 +0200214#if defined(GLFW_INCLUDE_VULKAN)
Camilla Berglunde94d1662016-10-14 01:46:56 +0200215 #include <vulkan/vulkan.h>
Camilla Löwyfa0b5e12017-05-16 14:54:17 +0200216#endif /* Vulkan header */
Camilla Berglund3249f812010-09-07 17:34:51 +0200217
Camilla Berglundcc5d7cd2012-03-25 17:43:02 +0200218#if defined(GLFW_DLL) && defined(_GLFW_BUILD_DLL)
Camilla Berglunde8e05d42014-04-23 13:30:11 +0200219 /* GLFW_DLL must be defined by applications that are linking against the DLL
220 * version of the GLFW library. _GLFW_BUILD_DLL is defined by the GLFW
221 * configuration header when compiling the DLL version of the library.
Camilla Berglundbd2d5712013-07-23 01:59:27 +0200222 */
Camilla Berglund0df4e062015-12-13 14:07:27 +0100223 #error "You must not have both GLFW_DLL and _GLFW_BUILD_DLL defined"
Camilla Berglundcc5d7cd2012-03-25 17:43:02 +0200224#endif
225
Camilla Berglund1591caa2015-01-08 06:56:17 +0100226/* GLFWAPI is used to declare public API functions for export
227 * from the DLL / shared library / dynamic library.
228 */
Camilla Berglund2588c9b2012-03-25 17:40:30 +0200229#if defined(_WIN32) && defined(_GLFW_BUILD_DLL)
Camilla Berglund3afa8312014-10-13 14:13:08 +0200230 /* We are building GLFW as a Win32 DLL */
Camilla Berglund2955cd32010-11-17 15:42:55 +0100231 #define GLFWAPI __declspec(dllexport)
Camilla Berglund3249f812010-09-07 17:34:51 +0200232#elif defined(_WIN32) && defined(GLFW_DLL)
Camilla Berglund3afa8312014-10-13 14:13:08 +0200233 /* We are calling GLFW as a Win32 DLL */
Camilla Berglund1247fc02015-02-22 18:10:20 +0100234 #define GLFWAPI __declspec(dllimport)
John Bartholomew93f4eff2013-05-01 13:08:09 +0100235#elif defined(__GNUC__) && defined(_GLFW_BUILD_DLL)
Camilla Berglund3afa8312014-10-13 14:13:08 +0200236 /* We are building GLFW as a shared / dynamic library */
John Bartholomew93f4eff2013-05-01 13:08:09 +0100237 #define GLFWAPI __attribute__((visibility("default")))
Camilla Berglund3249f812010-09-07 17:34:51 +0200238#else
Camilla Berglund3afa8312014-10-13 14:13:08 +0200239 /* We are building or calling GLFW as a static library */
Camilla Berglund3249f812010-09-07 17:34:51 +0200240 #define GLFWAPI
Camilla Berglund3249f812010-09-07 17:34:51 +0200241#endif
242
Camilla Berglund3249f812010-09-07 17:34:51 +0200243
244/*************************************************************************
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100245 * GLFW API tokens
Camilla Berglund3249f812010-09-07 17:34:51 +0200246 *************************************************************************/
247
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100248/*! @name GLFW version macros
249 * @{ */
250/*! @brief The major version number of the GLFW library.
251 *
252 * This is incremented when the API is changed in non-compatible ways.
253 * @ingroup init
254 */
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100255#define GLFW_VERSION_MAJOR 3
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100256/*! @brief The minor version number of the GLFW library.
257 *
258 * This is incremented when features are added to the API but it remains
259 * backward-compatible.
260 * @ingroup init
261 */
Camilla Löwya337c562019-04-16 14:43:29 +0200262#define GLFW_VERSION_MINOR 4
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100263/*! @brief The revision number of the GLFW library.
264 *
265 * This is incremented when a bug fix release is made that does not contain any
266 * API changes.
267 * @ingroup init
268 */
Camilla Berglund53fafad2016-08-18 23:42:15 +0200269#define GLFW_VERSION_REVISION 0
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100270/*! @} */
Camilla Berglund3249f812010-09-07 17:34:51 +0200271
Camilla Berglund0eccf752015-08-23 19:30:04 +0200272/*! @brief One.
273 *
Camilla Löwy04116782018-11-05 17:37:49 +0100274 * This is only semantic sugar for the number 1. You can instead use `1` or
Camilla Löwy422bf792019-04-01 18:36:30 +0200275 * `true` or `_True` or `GL_TRUE` or `VK_TRUE` or anything else that is equal
276 * to one.
Camilla Löwy04116782018-11-05 17:37:49 +0100277 *
278 * @ingroup init
Camilla Berglund0eccf752015-08-23 19:30:04 +0200279 */
280#define GLFW_TRUE 1
281/*! @brief Zero.
282 *
Camilla Löwy04116782018-11-05 17:37:49 +0100283 * This is only semantic sugar for the number 0. You can instead use `0` or
Camilla Löwy422bf792019-04-01 18:36:30 +0200284 * `false` or `_False` or `GL_FALSE` or `VK_FALSE` or anything else that is
285 * equal to zero.
Camilla Löwy04116782018-11-05 17:37:49 +0100286 *
287 * @ingroup init
Camilla Berglund0eccf752015-08-23 19:30:04 +0200288 */
289#define GLFW_FALSE 0
Camilla Berglund0eccf752015-08-23 19:30:04 +0200290
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100291/*! @name Key and button actions
292 * @{ */
Camilla Berglund4591ad22014-09-18 15:03:29 +0200293/*! @brief The key or mouse button was released.
294 *
295 * The key or mouse button was released.
296 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100297 * @ingroup input
298 */
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100299#define GLFW_RELEASE 0
Camilla Berglund4591ad22014-09-18 15:03:29 +0200300/*! @brief The key or mouse button was pressed.
301 *
302 * The key or mouse button was pressed.
303 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100304 * @ingroup input
305 */
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100306#define GLFW_PRESS 1
Camilla Berglund253e0d62013-01-12 17:06:35 +0100307/*! @brief The key was held down until it repeated.
Camilla Berglund4591ad22014-09-18 15:03:29 +0200308 *
309 * The key was held down until it repeated.
310 *
Camilla Berglund253e0d62013-01-12 17:06:35 +0100311 * @ingroup input
312 */
313#define GLFW_REPEAT 2
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100314/*! @} */
Camilla Berglund3249f812010-09-07 17:34:51 +0200315
Camilla Löwy798d7c62017-03-01 23:27:20 +0100316/*! @defgroup hat_state Joystick hat states
Camilla Löwy04116782018-11-05 17:37:49 +0100317 * @brief Joystick hat states.
IntellectualKitty368dec72016-11-25 20:56:24 -0700318 *
319 * See [joystick hat input](@ref joystick_hat) for how these are used.
320 *
321 * @ingroup input
322 * @{ */
323#define GLFW_HAT_CENTERED 0
324#define GLFW_HAT_UP 1
325#define GLFW_HAT_RIGHT 2
326#define GLFW_HAT_DOWN 4
327#define GLFW_HAT_LEFT 8
328#define GLFW_HAT_RIGHT_UP (GLFW_HAT_RIGHT | GLFW_HAT_UP)
329#define GLFW_HAT_RIGHT_DOWN (GLFW_HAT_RIGHT | GLFW_HAT_DOWN)
330#define GLFW_HAT_LEFT_UP (GLFW_HAT_LEFT | GLFW_HAT_UP)
331#define GLFW_HAT_LEFT_DOWN (GLFW_HAT_LEFT | GLFW_HAT_DOWN)
332/*! @} */
333
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200334/*! @defgroup keys Keyboard keys
Camilla Löwy21eabd32017-02-06 17:31:25 +0100335 * @brief Keyboard key IDs.
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200336 *
Camilla Berglund4188c262015-01-18 01:55:25 +0100337 * See [key input](@ref input_key) for how these are used.
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200338 *
Camilla Berglund4188c262015-01-18 01:55:25 +0100339 * These key codes are inspired by the _USB HID Usage Tables v1.12_ (p. 53-60),
340 * but re-arranged to map to 7-bit ASCII for printable keys (function keys are
341 * put in the 256+ range).
342 *
343 * The naming of the key codes follow these rules:
344 * - The US keyboard layout is used
345 * - Names of printable alpha-numeric characters are used (e.g. "A", "R",
346 * "3", etc.)
347 * - For non-alphanumeric characters, Unicode:ish names are used (e.g.
348 * "COMMA", "LEFT_SQUARE_BRACKET", etc.). Note that some names do not
349 * correspond to the Unicode standard (usually for brevity)
350 * - Keys that lack a clear US mapping are named "WORLD_x"
351 * - For non-printable keys, custom names are used (e.g. "F4",
352 * "BACKSPACE", etc.)
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200353 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100354 * @ingroup input
355 * @{
356 */
357
Camilla Berglund11615fc2013-05-30 17:19:12 +0200358/* The unknown key */
359#define GLFW_KEY_UNKNOWN -1
360
Marcusc0cb4c22011-01-02 11:18:14 +0100361/* Printable keys */
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100362#define GLFW_KEY_SPACE 32
363#define GLFW_KEY_APOSTROPHE 39 /* ' */
364#define GLFW_KEY_COMMA 44 /* , */
365#define GLFW_KEY_MINUS 45 /* - */
366#define GLFW_KEY_PERIOD 46 /* . */
367#define GLFW_KEY_SLASH 47 /* / */
368#define GLFW_KEY_0 48
369#define GLFW_KEY_1 49
370#define GLFW_KEY_2 50
371#define GLFW_KEY_3 51
372#define GLFW_KEY_4 52
373#define GLFW_KEY_5 53
374#define GLFW_KEY_6 54
375#define GLFW_KEY_7 55
376#define GLFW_KEY_8 56
377#define GLFW_KEY_9 57
378#define GLFW_KEY_SEMICOLON 59 /* ; */
379#define GLFW_KEY_EQUAL 61 /* = */
380#define GLFW_KEY_A 65
381#define GLFW_KEY_B 66
382#define GLFW_KEY_C 67
383#define GLFW_KEY_D 68
384#define GLFW_KEY_E 69
385#define GLFW_KEY_F 70
386#define GLFW_KEY_G 71
387#define GLFW_KEY_H 72
388#define GLFW_KEY_I 73
389#define GLFW_KEY_J 74
390#define GLFW_KEY_K 75
391#define GLFW_KEY_L 76
392#define GLFW_KEY_M 77
393#define GLFW_KEY_N 78
394#define GLFW_KEY_O 79
395#define GLFW_KEY_P 80
396#define GLFW_KEY_Q 81
397#define GLFW_KEY_R 82
398#define GLFW_KEY_S 83
399#define GLFW_KEY_T 84
400#define GLFW_KEY_U 85
401#define GLFW_KEY_V 86
402#define GLFW_KEY_W 87
403#define GLFW_KEY_X 88
404#define GLFW_KEY_Y 89
405#define GLFW_KEY_Z 90
406#define GLFW_KEY_LEFT_BRACKET 91 /* [ */
407#define GLFW_KEY_BACKSLASH 92 /* \ */
408#define GLFW_KEY_RIGHT_BRACKET 93 /* ] */
409#define GLFW_KEY_GRAVE_ACCENT 96 /* ` */
410#define GLFW_KEY_WORLD_1 161 /* non-US #1 */
411#define GLFW_KEY_WORLD_2 162 /* non-US #2 */
Marcusc0cb4c22011-01-02 11:18:14 +0100412
413/* Function keys */
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100414#define GLFW_KEY_ESCAPE 256
415#define GLFW_KEY_ENTER 257
416#define GLFW_KEY_TAB 258
417#define GLFW_KEY_BACKSPACE 259
418#define GLFW_KEY_INSERT 260
419#define GLFW_KEY_DELETE 261
420#define GLFW_KEY_RIGHT 262
421#define GLFW_KEY_LEFT 263
422#define GLFW_KEY_DOWN 264
423#define GLFW_KEY_UP 265
424#define GLFW_KEY_PAGE_UP 266
425#define GLFW_KEY_PAGE_DOWN 267
426#define GLFW_KEY_HOME 268
427#define GLFW_KEY_END 269
428#define GLFW_KEY_CAPS_LOCK 280
429#define GLFW_KEY_SCROLL_LOCK 281
430#define GLFW_KEY_NUM_LOCK 282
431#define GLFW_KEY_PRINT_SCREEN 283
432#define GLFW_KEY_PAUSE 284
433#define GLFW_KEY_F1 290
434#define GLFW_KEY_F2 291
435#define GLFW_KEY_F3 292
436#define GLFW_KEY_F4 293
437#define GLFW_KEY_F5 294
438#define GLFW_KEY_F6 295
439#define GLFW_KEY_F7 296
440#define GLFW_KEY_F8 297
441#define GLFW_KEY_F9 298
442#define GLFW_KEY_F10 299
443#define GLFW_KEY_F11 300
444#define GLFW_KEY_F12 301
445#define GLFW_KEY_F13 302
446#define GLFW_KEY_F14 303
447#define GLFW_KEY_F15 304
448#define GLFW_KEY_F16 305
449#define GLFW_KEY_F17 306
450#define GLFW_KEY_F18 307
451#define GLFW_KEY_F19 308
452#define GLFW_KEY_F20 309
453#define GLFW_KEY_F21 310
454#define GLFW_KEY_F22 311
455#define GLFW_KEY_F23 312
456#define GLFW_KEY_F24 313
457#define GLFW_KEY_F25 314
458#define GLFW_KEY_KP_0 320
459#define GLFW_KEY_KP_1 321
460#define GLFW_KEY_KP_2 322
461#define GLFW_KEY_KP_3 323
462#define GLFW_KEY_KP_4 324
463#define GLFW_KEY_KP_5 325
464#define GLFW_KEY_KP_6 326
465#define GLFW_KEY_KP_7 327
466#define GLFW_KEY_KP_8 328
467#define GLFW_KEY_KP_9 329
468#define GLFW_KEY_KP_DECIMAL 330
469#define GLFW_KEY_KP_DIVIDE 331
470#define GLFW_KEY_KP_MULTIPLY 332
471#define GLFW_KEY_KP_SUBTRACT 333
472#define GLFW_KEY_KP_ADD 334
473#define GLFW_KEY_KP_ENTER 335
474#define GLFW_KEY_KP_EQUAL 336
475#define GLFW_KEY_LEFT_SHIFT 340
476#define GLFW_KEY_LEFT_CONTROL 341
477#define GLFW_KEY_LEFT_ALT 342
478#define GLFW_KEY_LEFT_SUPER 343
479#define GLFW_KEY_RIGHT_SHIFT 344
480#define GLFW_KEY_RIGHT_CONTROL 345
481#define GLFW_KEY_RIGHT_ALT 346
482#define GLFW_KEY_RIGHT_SUPER 347
483#define GLFW_KEY_MENU 348
Camilla Berglund9c315412015-07-02 14:24:50 +0200484
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100485#define GLFW_KEY_LAST GLFW_KEY_MENU
Marcusc0cb4c22011-01-02 11:18:14 +0100486
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100487/*! @} */
488
Camilla Berglund98cbf6f2013-05-23 14:42:33 +0200489/*! @defgroup mods Modifier key flags
Camilla Löwy21eabd32017-02-06 17:31:25 +0100490 * @brief Modifier key flags.
Camilla Berglund4188c262015-01-18 01:55:25 +0100491 *
492 * See [key input](@ref input_key) for how these are used.
493 *
Camilla Berglund98cbf6f2013-05-23 14:42:33 +0200494 * @ingroup input
Camilla Berglund2d1b8352012-12-09 19:19:00 +0100495 * @{ */
496
Camilla Berglund98cbf6f2013-05-23 14:42:33 +0200497/*! @brief If this bit is set one or more Shift keys were held down.
Camilla Löwy0e8c4ea2017-11-29 20:42:37 +0100498 *
499 * If this bit is set one or more Shift keys were held down.
Camilla Berglund2d1b8352012-12-09 19:19:00 +0100500 */
501#define GLFW_MOD_SHIFT 0x0001
Camilla Berglund98cbf6f2013-05-23 14:42:33 +0200502/*! @brief If this bit is set one or more Control keys were held down.
Camilla Löwy0e8c4ea2017-11-29 20:42:37 +0100503 *
504 * If this bit is set one or more Control keys were held down.
Camilla Berglund2d1b8352012-12-09 19:19:00 +0100505 */
Camilla Berglund3bcffba2013-05-23 14:11:05 +0200506#define GLFW_MOD_CONTROL 0x0002
Camilla Berglund98cbf6f2013-05-23 14:42:33 +0200507/*! @brief If this bit is set one or more Alt keys were held down.
Camilla Löwy0e8c4ea2017-11-29 20:42:37 +0100508 *
509 * If this bit is set one or more Alt keys were held down.
Camilla Berglund2d1b8352012-12-09 19:19:00 +0100510 */
511#define GLFW_MOD_ALT 0x0004
Camilla Berglund98cbf6f2013-05-23 14:42:33 +0200512/*! @brief If this bit is set one or more Super keys were held down.
Camilla Löwy0e8c4ea2017-11-29 20:42:37 +0100513 *
514 * If this bit is set one or more Super keys were held down.
Noel Cowereff85f92013-05-23 13:22:27 +0200515 */
516#define GLFW_MOD_SUPER 0x0008
Camilla Löwy0e8c4ea2017-11-29 20:42:37 +0100517/*! @brief If this bit is set the Caps Lock key is enabled.
518 *
519 * If this bit is set the Caps Lock key is enabled and the @ref
520 * GLFW_LOCK_KEY_MODS input mode is set.
521 */
522#define GLFW_MOD_CAPS_LOCK 0x0010
523/*! @brief If this bit is set the Num Lock key is enabled.
524 *
525 * If this bit is set the Num Lock key is enabled and the @ref
526 * GLFW_LOCK_KEY_MODS input mode is set.
527 */
528#define GLFW_MOD_NUM_LOCK 0x0020
Camilla Berglund2d1b8352012-12-09 19:19:00 +0100529
530/*! @} */
531
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100532/*! @defgroup buttons Mouse buttons
Camilla Löwy21eabd32017-02-06 17:31:25 +0100533 * @brief Mouse button IDs.
Camilla Berglund4188c262015-01-18 01:55:25 +0100534 *
535 * See [mouse button input](@ref input_mouse_button) for how these are used.
536 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100537 * @ingroup input
538 * @{ */
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100539#define GLFW_MOUSE_BUTTON_1 0
540#define GLFW_MOUSE_BUTTON_2 1
541#define GLFW_MOUSE_BUTTON_3 2
542#define GLFW_MOUSE_BUTTON_4 3
543#define GLFW_MOUSE_BUTTON_5 4
544#define GLFW_MOUSE_BUTTON_6 5
545#define GLFW_MOUSE_BUTTON_7 6
546#define GLFW_MOUSE_BUTTON_8 7
547#define GLFW_MOUSE_BUTTON_LAST GLFW_MOUSE_BUTTON_8
548#define GLFW_MOUSE_BUTTON_LEFT GLFW_MOUSE_BUTTON_1
549#define GLFW_MOUSE_BUTTON_RIGHT GLFW_MOUSE_BUTTON_2
550#define GLFW_MOUSE_BUTTON_MIDDLE GLFW_MOUSE_BUTTON_3
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100551/*! @} */
Camilla Berglund3249f812010-09-07 17:34:51 +0200552
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100553/*! @defgroup joysticks Joysticks
Camilla Löwy21eabd32017-02-06 17:31:25 +0100554 * @brief Joystick IDs.
Camilla Berglund4188c262015-01-18 01:55:25 +0100555 *
556 * See [joystick input](@ref joystick) for how these are used.
557 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100558 * @ingroup input
559 * @{ */
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100560#define GLFW_JOYSTICK_1 0
561#define GLFW_JOYSTICK_2 1
562#define GLFW_JOYSTICK_3 2
563#define GLFW_JOYSTICK_4 3
564#define GLFW_JOYSTICK_5 4
565#define GLFW_JOYSTICK_6 5
566#define GLFW_JOYSTICK_7 6
567#define GLFW_JOYSTICK_8 7
568#define GLFW_JOYSTICK_9 8
569#define GLFW_JOYSTICK_10 9
570#define GLFW_JOYSTICK_11 10
571#define GLFW_JOYSTICK_12 11
572#define GLFW_JOYSTICK_13 12
573#define GLFW_JOYSTICK_14 13
574#define GLFW_JOYSTICK_15 14
575#define GLFW_JOYSTICK_16 15
576#define GLFW_JOYSTICK_LAST GLFW_JOYSTICK_16
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100577/*! @} */
Camilla Berglund3249f812010-09-07 17:34:51 +0200578
Camilla Löwy953106e2017-06-18 15:13:25 +0200579/*! @defgroup gamepad_buttons Gamepad buttons
580 * @brief Gamepad buttons.
581 *
582 * See @ref gamepad for how these are used.
583 *
584 * @ingroup input
585 * @{ */
586#define GLFW_GAMEPAD_BUTTON_A 0
587#define GLFW_GAMEPAD_BUTTON_B 1
588#define GLFW_GAMEPAD_BUTTON_X 2
589#define GLFW_GAMEPAD_BUTTON_Y 3
590#define GLFW_GAMEPAD_BUTTON_LEFT_BUMPER 4
591#define GLFW_GAMEPAD_BUTTON_RIGHT_BUMPER 5
592#define GLFW_GAMEPAD_BUTTON_BACK 6
593#define GLFW_GAMEPAD_BUTTON_START 7
594#define GLFW_GAMEPAD_BUTTON_GUIDE 8
595#define GLFW_GAMEPAD_BUTTON_LEFT_THUMB 9
596#define GLFW_GAMEPAD_BUTTON_RIGHT_THUMB 10
597#define GLFW_GAMEPAD_BUTTON_DPAD_UP 11
598#define GLFW_GAMEPAD_BUTTON_DPAD_RIGHT 12
599#define GLFW_GAMEPAD_BUTTON_DPAD_DOWN 13
600#define GLFW_GAMEPAD_BUTTON_DPAD_LEFT 14
601#define GLFW_GAMEPAD_BUTTON_LAST GLFW_GAMEPAD_BUTTON_DPAD_LEFT
602
603#define GLFW_GAMEPAD_BUTTON_CROSS GLFW_GAMEPAD_BUTTON_A
604#define GLFW_GAMEPAD_BUTTON_CIRCLE GLFW_GAMEPAD_BUTTON_B
605#define GLFW_GAMEPAD_BUTTON_SQUARE GLFW_GAMEPAD_BUTTON_X
606#define GLFW_GAMEPAD_BUTTON_TRIANGLE GLFW_GAMEPAD_BUTTON_Y
607/*! @} */
608
609/*! @defgroup gamepad_axes Gamepad axes
610 * @brief Gamepad axes.
611 *
612 * See @ref gamepad for how these are used.
613 *
614 * @ingroup input
615 * @{ */
616#define GLFW_GAMEPAD_AXIS_LEFT_X 0
617#define GLFW_GAMEPAD_AXIS_LEFT_Y 1
618#define GLFW_GAMEPAD_AXIS_RIGHT_X 2
619#define GLFW_GAMEPAD_AXIS_RIGHT_Y 3
620#define GLFW_GAMEPAD_AXIS_LEFT_TRIGGER 4
621#define GLFW_GAMEPAD_AXIS_RIGHT_TRIGGER 5
622#define GLFW_GAMEPAD_AXIS_LAST GLFW_GAMEPAD_AXIS_RIGHT_TRIGGER
623/*! @} */
624
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100625/*! @defgroup errors Error codes
Camilla Löwy21eabd32017-02-06 17:31:25 +0100626 * @brief Error codes.
Camilla Berglund4188c262015-01-18 01:55:25 +0100627 *
628 * See [error handling](@ref error_handling) for how these are used.
629 *
Camilla Berglund4591ad22014-09-18 15:03:29 +0200630 * @ingroup init
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100631 * @{ */
Camilla Löwy63506412017-05-01 19:20:57 +0200632/*! @brief No error has occurred.
633 *
634 * No error has occurred.
635 *
636 * @analysis Yay.
637 */
638#define GLFW_NO_ERROR 0
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100639/*! @brief GLFW has not been initialized.
Camilla Berglund4591ad22014-09-18 15:03:29 +0200640 *
Camilla Berglund0df4e062015-12-13 14:07:27 +0100641 * This occurs if a GLFW function was called that must not be called unless the
Camilla Berglund4591ad22014-09-18 15:03:29 +0200642 * library is [initialized](@ref intro_init).
643 *
Camilla Berglund951a9582016-01-31 21:32:14 +0100644 * @analysis Application programmer error. Initialize GLFW before calling any
645 * function that requires initialization.
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100646 */
Camilla Berglund393e4392013-05-27 22:16:59 +0200647#define GLFW_NOT_INITIALIZED 0x00010001
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100648/*! @brief No context is current for this thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +0200649 *
650 * This occurs if a GLFW function was called that needs and operates on the
651 * current OpenGL or OpenGL ES context but no context is current on the calling
652 * thread. One such function is @ref glfwSwapInterval.
653 *
Camilla Berglund951a9582016-01-31 21:32:14 +0100654 * @analysis Application programmer error. Ensure a context is current before
655 * calling functions that require a current context.
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100656 */
Camilla Berglund393e4392013-05-27 22:16:59 +0200657#define GLFW_NO_CURRENT_CONTEXT 0x00010002
Camilla Berglund4591ad22014-09-18 15:03:29 +0200658/*! @brief One of the arguments to the function was an invalid enum value.
659 *
660 * One of the arguments to the function was an invalid enum value, for example
Camilla Löwyce161c22016-12-06 01:14:23 +0100661 * requesting @ref GLFW_RED_BITS with @ref glfwGetWindowAttrib.
Camilla Berglund4591ad22014-09-18 15:03:29 +0200662 *
Camilla Berglund951a9582016-01-31 21:32:14 +0100663 * @analysis Application programmer error. Fix the offending call.
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100664 */
Camilla Berglund393e4392013-05-27 22:16:59 +0200665#define GLFW_INVALID_ENUM 0x00010003
Camilla Berglund4591ad22014-09-18 15:03:29 +0200666/*! @brief One of the arguments to the function was an invalid value.
667 *
668 * One of the arguments to the function was an invalid value, for example
669 * requesting a non-existent OpenGL or OpenGL ES version like 2.7.
670 *
671 * Requesting a valid but unavailable OpenGL or OpenGL ES version will instead
672 * result in a @ref GLFW_VERSION_UNAVAILABLE error.
673 *
Camilla Berglund951a9582016-01-31 21:32:14 +0100674 * @analysis Application programmer error. Fix the offending call.
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100675 */
Camilla Berglund393e4392013-05-27 22:16:59 +0200676#define GLFW_INVALID_VALUE 0x00010004
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100677/*! @brief A memory allocation failed.
Camilla Berglund4591ad22014-09-18 15:03:29 +0200678 *
679 * A memory allocation failed.
680 *
Camilla Berglund951a9582016-01-31 21:32:14 +0100681 * @analysis A bug in GLFW or the underlying operating system. Report the bug
682 * to our [issue tracker](https://github.com/glfw/glfw/issues).
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100683 */
Camilla Berglund393e4392013-05-27 22:16:59 +0200684#define GLFW_OUT_OF_MEMORY 0x00010005
Camilla Berglund9b75bff2015-08-10 20:19:04 +0200685/*! @brief GLFW could not find support for the requested API on the system.
Camilla Berglund2d13eb02014-10-13 16:00:11 +0200686 *
Camilla Berglund9b75bff2015-08-10 20:19:04 +0200687 * GLFW could not find support for the requested API on the system.
Camilla Berglund2d13eb02014-10-13 16:00:11 +0200688 *
Camilla Berglund951a9582016-01-31 21:32:14 +0100689 * @analysis The installed graphics driver does not support the requested
Camilla Berglund9b75bff2015-08-10 20:19:04 +0200690 * API, or does not support it via the chosen context creation backend.
Camilla Berglund951a9582016-01-31 21:32:14 +0100691 * Below are a few examples.
Camilla Berglund2d13eb02014-10-13 16:00:11 +0200692 *
693 * @par
694 * Some pre-installed Windows graphics drivers do not support OpenGL. AMD only
Camilla Berglundd95b79f2015-03-30 23:20:49 +0200695 * supports OpenGL ES via EGL, while Nvidia and Intel only support it via
Camilla Berglund8d6f2652016-10-20 00:50:54 +0200696 * a WGL or GLX extension. macOS does not provide OpenGL ES at all. The Mesa
Camilla Berglund138feb82015-01-05 16:46:04 +0100697 * EGL, OpenGL and OpenGL ES libraries do not interface with the Nvidia binary
Camilla Berglund9b75bff2015-08-10 20:19:04 +0200698 * driver. Older graphics drivers do not support Vulkan.
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100699 */
Camilla Berglund393e4392013-05-27 22:16:59 +0200700#define GLFW_API_UNAVAILABLE 0x00010006
Camilla Berglund4591ad22014-09-18 15:03:29 +0200701/*! @brief The requested OpenGL or OpenGL ES version is not available.
702 *
Camilla Berglundd493a822015-03-10 19:51:14 +0100703 * The requested OpenGL or OpenGL ES version (including any requested context
704 * or framebuffer hints) is not available on this machine.
Camilla Berglund4591ad22014-09-18 15:03:29 +0200705 *
Camilla Berglund951a9582016-01-31 21:32:14 +0100706 * @analysis The machine does not support your requirements. If your
707 * application is sufficiently flexible, downgrade your requirements and try
708 * again. Otherwise, inform the user that their machine does not match your
Camilla Berglund4591ad22014-09-18 15:03:29 +0200709 * requirements.
710 *
Camilla Berglund2d13eb02014-10-13 16:00:11 +0200711 * @par
712 * Future invalid OpenGL and OpenGL ES versions, for example OpenGL 4.8 if 5.0
713 * comes out before the 4.x series gets that far, also fail with this error and
714 * not @ref GLFW_INVALID_VALUE, because GLFW cannot know what future versions
715 * will exist.
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100716 */
Camilla Berglund393e4392013-05-27 22:16:59 +0200717#define GLFW_VERSION_UNAVAILABLE 0x00010007
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100718/*! @brief A platform-specific error occurred that does not match any of the
719 * more specific categories.
Camilla Berglund4591ad22014-09-18 15:03:29 +0200720 *
721 * A platform-specific error occurred that does not match any of the more
722 * specific categories.
723 *
Camilla Berglund951a9582016-01-31 21:32:14 +0100724 * @analysis A bug or configuration error in GLFW, the underlying operating
725 * system or its drivers, or a lack of required resources. Report the issue to
726 * our [issue tracker](https://github.com/glfw/glfw/issues).
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100727 */
Camilla Berglund393e4392013-05-27 22:16:59 +0200728#define GLFW_PLATFORM_ERROR 0x00010008
Camilla Berglund2d13eb02014-10-13 16:00:11 +0200729/*! @brief The requested format is not supported or available.
730 *
731 * If emitted during window creation, the requested pixel format is not
732 * supported.
733 *
734 * If emitted when querying the clipboard, the contents of the clipboard could
735 * not be converted to the requested format.
736 *
Camilla Berglund951a9582016-01-31 21:32:14 +0100737 * @analysis If emitted during window creation, one or more
Camilla Berglund2d13eb02014-10-13 16:00:11 +0200738 * [hard constraints](@ref window_hints_hard) did not match any of the
739 * available pixel formats. If your application is sufficiently flexible,
740 * downgrade your requirements and try again. Otherwise, inform the user that
741 * their machine does not match your requirements.
742 *
743 * @par
744 * If emitted when querying the clipboard, ignore the error or report it to
745 * the user, as appropriate.
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100746 */
Camilla Berglund393e4392013-05-27 22:16:59 +0200747#define GLFW_FORMAT_UNAVAILABLE 0x00010009
Camilla Berglund496f5592015-06-18 14:03:02 +0200748/*! @brief The specified window does not have an OpenGL or OpenGL ES context.
749 *
750 * A window that does not have an OpenGL or OpenGL ES context was passed to
751 * a function that requires it to have one.
752 *
Camilla Berglund951a9582016-01-31 21:32:14 +0100753 * @analysis Application programmer error. Fix the offending call.
Camilla Berglund496f5592015-06-18 14:03:02 +0200754 */
755#define GLFW_NO_WINDOW_CONTEXT 0x0001000A
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100756/*! @} */
Camilla Berglund3249f812010-09-07 17:34:51 +0200757
Camilla Löwyce161c22016-12-06 01:14:23 +0100758/*! @addtogroup window
759 * @{ */
760/*! @brief Input focus window hint and attribute
761 *
762 * Input focus [window hint](@ref GLFW_FOCUSED_hint) or
763 * [window attribute](@ref GLFW_FOCUSED_attrib).
764 */
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100765#define GLFW_FOCUSED 0x00020001
Camilla Löwyce161c22016-12-06 01:14:23 +0100766/*! @brief Window iconification window attribute
767 *
768 * Window iconification [window attribute](@ref GLFW_ICONIFIED_attrib).
769 */
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100770#define GLFW_ICONIFIED 0x00020002
Camilla Löwyce161c22016-12-06 01:14:23 +0100771/*! @brief Window resize-ability window hint and attribute
772 *
Camilla Löwy831426c2016-12-08 17:08:36 +0100773 * Window resize-ability [window hint](@ref GLFW_RESIZABLE_hint) and
Camilla Löwyce161c22016-12-06 01:14:23 +0100774 * [window attribute](@ref GLFW_RESIZABLE_attrib).
775 */
Camilla Berglund393e4392013-05-27 22:16:59 +0200776#define GLFW_RESIZABLE 0x00020003
Camilla Löwyce161c22016-12-06 01:14:23 +0100777/*! @brief Window visibility window hint and attribute
778 *
Camilla Löwy831426c2016-12-08 17:08:36 +0100779 * Window visibility [window hint](@ref GLFW_VISIBLE_hint) and
Camilla Löwyce161c22016-12-06 01:14:23 +0100780 * [window attribute](@ref GLFW_VISIBLE_attrib).
781 */
Camilla Berglund393e4392013-05-27 22:16:59 +0200782#define GLFW_VISIBLE 0x00020004
Camilla Löwyce161c22016-12-06 01:14:23 +0100783/*! @brief Window decoration window hint and attribute
784 *
Camilla Löwy831426c2016-12-08 17:08:36 +0100785 * Window decoration [window hint](@ref GLFW_DECORATED_hint) and
Camilla Löwyce161c22016-12-06 01:14:23 +0100786 * [window attribute](@ref GLFW_DECORATED_attrib).
787 */
Camilla Berglund393e4392013-05-27 22:16:59 +0200788#define GLFW_DECORATED 0x00020005
Camilla Löwy9e560992016-09-30 01:52:22 +0200789/*! @brief Window auto-iconification window hint and attribute
Camilla Löwyce161c22016-12-06 01:14:23 +0100790 *
Camilla Löwy831426c2016-12-08 17:08:36 +0100791 * Window auto-iconification [window hint](@ref GLFW_AUTO_ICONIFY_hint) and
Camilla Löwy9e560992016-09-30 01:52:22 +0200792 * [window attribute](@ref GLFW_AUTO_ICONIFY_attrib).
Camilla Löwyce161c22016-12-06 01:14:23 +0100793 */
Camilla Berglund25e7ff12014-04-08 15:32:34 +0200794#define GLFW_AUTO_ICONIFY 0x00020006
Camilla Löwyce161c22016-12-06 01:14:23 +0100795/*! @brief Window decoration window hint and attribute
796 *
Camilla Löwy831426c2016-12-08 17:08:36 +0100797 * Window decoration [window hint](@ref GLFW_FLOATING_hint) and
Camilla Löwyce161c22016-12-06 01:14:23 +0100798 * [window attribute](@ref GLFW_FLOATING_attrib).
799 */
Camilla Berglund3ce7bfe2014-05-23 14:01:02 +0200800#define GLFW_FLOATING 0x00020007
Camilla Löwyce161c22016-12-06 01:14:23 +0100801/*! @brief Window maximization window hint and attribute
802 *
Camilla Löwy831426c2016-12-08 17:08:36 +0100803 * Window maximization [window hint](@ref GLFW_MAXIMIZED_hint) and
Camilla Löwyce161c22016-12-06 01:14:23 +0100804 * [window attribute](@ref GLFW_MAXIMIZED_attrib).
805 */
Camilla Berglunda10caa42015-10-13 12:50:59 +0200806#define GLFW_MAXIMIZED 0x00020008
Camilla Löwy5a74b502017-02-06 15:03:50 +0100807/*! @brief Cursor centering window hint
808 *
809 * Cursor centering [window hint](@ref GLFW_CENTER_CURSOR_hint).
810 */
Liam Middlebrook72ac5ba2016-08-18 11:47:54 -0400811#define GLFW_CENTER_CURSOR 0x00020009
Camilla Löwy32e78ae2017-09-18 18:10:57 +0200812/*! @brief Window framebuffer transparency hint and attribute
813 *
Camilla Löwy49130ab2017-11-07 22:50:01 +0100814 * Window framebuffer transparency
815 * [window hint](@ref GLFW_TRANSPARENT_FRAMEBUFFER_hint) and
816 * [window attribute](@ref GLFW_TRANSPARENT_FRAMEBUFFER_attrib).
Camilla Löwy32e78ae2017-09-18 18:10:57 +0200817 */
Camilla Löwy49130ab2017-11-07 22:50:01 +0100818#define GLFW_TRANSPARENT_FRAMEBUFFER 0x0002000A
Camilla Löwyd6b3a602018-01-11 14:13:54 +0100819/*! @brief Mouse cursor hover window attribute.
820 *
821 * Mouse cursor hover [window attribute](@ref GLFW_HOVERED_attrib).
822 */
Camilla Löwyee9dffc2018-01-04 13:50:58 +0100823#define GLFW_HOVERED 0x0002000B
Doug Binks0be4f3f2018-05-29 14:51:36 +0100824/*! @brief Input focus on calling show window hint and attribute
825 *
826 * Input focus [window hint](@ref GLFW_FOCUS_ON_SHOW_hint) or
827 * [window attribute](@ref GLFW_FOCUS_ON_SHOW_attrib).
828 */
829#define GLFW_FOCUS_ON_SHOW 0x0002000C
Camilla Berglund2c091572010-09-09 21:09:11 +0200830
Camilla Löwyce161c22016-12-06 01:14:23 +0100831/*! @brief Framebuffer bit depth hint.
832 *
833 * Framebuffer bit depth [hint](@ref GLFW_RED_BITS).
834 */
Camilla Berglund53b39a62013-05-30 18:55:45 +0200835#define GLFW_RED_BITS 0x00021001
Camilla Löwyce161c22016-12-06 01:14:23 +0100836/*! @brief Framebuffer bit depth hint.
837 *
838 * Framebuffer bit depth [hint](@ref GLFW_GREEN_BITS).
839 */
Camilla Berglund53b39a62013-05-30 18:55:45 +0200840#define GLFW_GREEN_BITS 0x00021002
Camilla Löwyce161c22016-12-06 01:14:23 +0100841/*! @brief Framebuffer bit depth hint.
842 *
843 * Framebuffer bit depth [hint](@ref GLFW_BLUE_BITS).
844 */
Camilla Berglund53b39a62013-05-30 18:55:45 +0200845#define GLFW_BLUE_BITS 0x00021003
Camilla Löwyce161c22016-12-06 01:14:23 +0100846/*! @brief Framebuffer bit depth hint.
847 *
848 * Framebuffer bit depth [hint](@ref GLFW_ALPHA_BITS).
849 */
Camilla Berglund53b39a62013-05-30 18:55:45 +0200850#define GLFW_ALPHA_BITS 0x00021004
Camilla Löwyce161c22016-12-06 01:14:23 +0100851/*! @brief Framebuffer bit depth hint.
852 *
853 * Framebuffer bit depth [hint](@ref GLFW_DEPTH_BITS).
854 */
Camilla Berglund53b39a62013-05-30 18:55:45 +0200855#define GLFW_DEPTH_BITS 0x00021005
Camilla Löwyce161c22016-12-06 01:14:23 +0100856/*! @brief Framebuffer bit depth hint.
857 *
858 * Framebuffer bit depth [hint](@ref GLFW_STENCIL_BITS).
859 */
Camilla Berglund53b39a62013-05-30 18:55:45 +0200860#define GLFW_STENCIL_BITS 0x00021006
Camilla Löwyce161c22016-12-06 01:14:23 +0100861/*! @brief Framebuffer bit depth hint.
862 *
863 * Framebuffer bit depth [hint](@ref GLFW_ACCUM_RED_BITS).
864 */
Camilla Berglund53b39a62013-05-30 18:55:45 +0200865#define GLFW_ACCUM_RED_BITS 0x00021007
Camilla Löwyce161c22016-12-06 01:14:23 +0100866/*! @brief Framebuffer bit depth hint.
867 *
868 * Framebuffer bit depth [hint](@ref GLFW_ACCUM_GREEN_BITS).
869 */
Camilla Berglund53b39a62013-05-30 18:55:45 +0200870#define GLFW_ACCUM_GREEN_BITS 0x00021008
Camilla Löwyce161c22016-12-06 01:14:23 +0100871/*! @brief Framebuffer bit depth hint.
872 *
873 * Framebuffer bit depth [hint](@ref GLFW_ACCUM_BLUE_BITS).
874 */
Camilla Berglund53b39a62013-05-30 18:55:45 +0200875#define GLFW_ACCUM_BLUE_BITS 0x00021009
Camilla Löwyce161c22016-12-06 01:14:23 +0100876/*! @brief Framebuffer bit depth hint.
877 *
878 * Framebuffer bit depth [hint](@ref GLFW_ACCUM_ALPHA_BITS).
879 */
Camilla Berglund53b39a62013-05-30 18:55:45 +0200880#define GLFW_ACCUM_ALPHA_BITS 0x0002100A
Camilla Löwyce161c22016-12-06 01:14:23 +0100881/*! @brief Framebuffer auxiliary buffer hint.
882 *
883 * Framebuffer auxiliary buffer [hint](@ref GLFW_AUX_BUFFERS).
884 */
Camilla Berglund53b39a62013-05-30 18:55:45 +0200885#define GLFW_AUX_BUFFERS 0x0002100B
Camilla Löwyce161c22016-12-06 01:14:23 +0100886/*! @brief OpenGL stereoscopic rendering hint.
887 *
888 * OpenGL stereoscopic rendering [hint](@ref GLFW_STEREO).
889 */
Camilla Berglund53b39a62013-05-30 18:55:45 +0200890#define GLFW_STEREO 0x0002100C
Camilla Löwyce161c22016-12-06 01:14:23 +0100891/*! @brief Framebuffer MSAA samples hint.
892 *
893 * Framebuffer MSAA samples [hint](@ref GLFW_SAMPLES).
894 */
Camilla Berglund53b39a62013-05-30 18:55:45 +0200895#define GLFW_SAMPLES 0x0002100D
Camilla Löwyce161c22016-12-06 01:14:23 +0100896/*! @brief Framebuffer sRGB hint.
897 *
898 * Framebuffer sRGB [hint](@ref GLFW_SRGB_CAPABLE).
899 */
Camilla Berglund53b39a62013-05-30 18:55:45 +0200900#define GLFW_SRGB_CAPABLE 0x0002100E
Camilla Löwyce161c22016-12-06 01:14:23 +0100901/*! @brief Monitor refresh rate hint.
902 *
903 * Monitor refresh rate [hint](@ref GLFW_REFRESH_RATE).
904 */
Camilla Berglund2cd34382013-05-30 20:42:50 +0200905#define GLFW_REFRESH_RATE 0x0002100F
Camilla Löwyce161c22016-12-06 01:14:23 +0100906/*! @brief Framebuffer double buffering hint.
907 *
908 * Framebuffer double buffering [hint](@ref GLFW_DOUBLEBUFFER).
909 */
Camilla Berglundc9808582014-04-24 19:21:10 +0200910#define GLFW_DOUBLEBUFFER 0x00021010
Bailey Cosier93e66662017-09-19 18:27:45 +0200911
Camilla Löwy831426c2016-12-08 17:08:36 +0100912/*! @brief Context client API hint and attribute.
913 *
914 * Context client API [hint](@ref GLFW_CLIENT_API_hint) and
915 * [attribute](@ref GLFW_CLIENT_API_attrib).
916 */
Camilla Berglund53b39a62013-05-30 18:55:45 +0200917#define GLFW_CLIENT_API 0x00022001
Camilla Löwy831426c2016-12-08 17:08:36 +0100918/*! @brief Context client API major version hint and attribute.
919 *
920 * Context client API major version [hint](@ref GLFW_CLIENT_API_hint) and
921 * [attribute](@ref GLFW_CLIENT_API_attrib).
922 */
Camilla Berglund53b39a62013-05-30 18:55:45 +0200923#define GLFW_CONTEXT_VERSION_MAJOR 0x00022002
Camilla Löwy831426c2016-12-08 17:08:36 +0100924/*! @brief Context client API minor version hint and attribute.
925 *
926 * Context client API minor version [hint](@ref GLFW_CLIENT_API_hint) and
927 * [attribute](@ref GLFW_CLIENT_API_attrib).
928 */
Camilla Berglund53b39a62013-05-30 18:55:45 +0200929#define GLFW_CONTEXT_VERSION_MINOR 0x00022003
Camilla Löwy831426c2016-12-08 17:08:36 +0100930/*! @brief Context client API revision number hint and attribute.
931 *
932 * Context client API revision number [hint](@ref GLFW_CLIENT_API_hint) and
933 * [attribute](@ref GLFW_CLIENT_API_attrib).
934 */
Camilla Berglund53b39a62013-05-30 18:55:45 +0200935#define GLFW_CONTEXT_REVISION 0x00022004
Camilla Löwy831426c2016-12-08 17:08:36 +0100936/*! @brief Context robustness hint and attribute.
937 *
938 * Context client API revision number [hint](@ref GLFW_CLIENT_API_hint) and
939 * [attribute](@ref GLFW_CLIENT_API_attrib).
940 */
Camilla Berglund53b39a62013-05-30 18:55:45 +0200941#define GLFW_CONTEXT_ROBUSTNESS 0x00022005
Camilla Löwy831426c2016-12-08 17:08:36 +0100942/*! @brief OpenGL forward-compatibility hint and attribute.
943 *
944 * OpenGL forward-compatibility [hint](@ref GLFW_CLIENT_API_hint) and
945 * [attribute](@ref GLFW_CLIENT_API_attrib).
946 */
Camilla Berglund53b39a62013-05-30 18:55:45 +0200947#define GLFW_OPENGL_FORWARD_COMPAT 0x00022006
Camilla Löwy831426c2016-12-08 17:08:36 +0100948/*! @brief OpenGL debug context hint and attribute.
949 *
950 * OpenGL debug context [hint](@ref GLFW_CLIENT_API_hint) and
951 * [attribute](@ref GLFW_CLIENT_API_attrib).
952 */
Camilla Berglund53b39a62013-05-30 18:55:45 +0200953#define GLFW_OPENGL_DEBUG_CONTEXT 0x00022007
Camilla Löwy831426c2016-12-08 17:08:36 +0100954/*! @brief OpenGL profile hint and attribute.
955 *
956 * OpenGL profile [hint](@ref GLFW_CLIENT_API_hint) and
957 * [attribute](@ref GLFW_CLIENT_API_attrib).
958 */
Camilla Berglund53b39a62013-05-30 18:55:45 +0200959#define GLFW_OPENGL_PROFILE 0x00022008
Camilla Löwy831426c2016-12-08 17:08:36 +0100960/*! @brief Context flush-on-release hint and attribute.
961 *
962 * Context flush-on-release [hint](@ref GLFW_CLIENT_API_hint) and
963 * [attribute](@ref GLFW_CLIENT_API_attrib).
964 */
Camilla Berglund44c899c2014-08-21 19:21:45 +0200965#define GLFW_CONTEXT_RELEASE_BEHAVIOR 0x00022009
Camilla Löwy831426c2016-12-08 17:08:36 +0100966/*! @brief Context error suppression hint and attribute.
967 *
968 * Context error suppression [hint](@ref GLFW_CLIENT_API_hint) and
969 * [attribute](@ref GLFW_CLIENT_API_attrib).
970 */
Camilla Berglund7be82092015-08-10 12:46:14 +0200971#define GLFW_CONTEXT_NO_ERROR 0x0002200A
Camilla Löwy831426c2016-12-08 17:08:36 +0100972/*! @brief Context creation API hint and attribute.
973 *
974 * Context creation API [hint](@ref GLFW_CLIENT_API_hint) and
975 * [attribute](@ref GLFW_CLIENT_API_attrib).
976 */
Camilla Berglundef80bea2016-03-28 13:19:31 +0200977#define GLFW_CONTEXT_CREATION_API 0x0002200B
Camilla Löwy089ea9a2018-08-31 13:33:48 +0200978/*! @brief Window content area scaling window
979 * [window hint](@ref GLFW_SCALE_TO_MONITOR).
980 */
981#define GLFW_SCALE_TO_MONITOR 0x0002200C
Camilla Löwy422bf792019-04-01 18:36:30 +0200982/*! @brief macOS specific
983 * [window hint](@ref GLFW_COCOA_RETINA_FRAMEBUFFER_hint).
984 */
Camilla Löwy58ceab52016-12-07 00:41:54 +0100985#define GLFW_COCOA_RETINA_FRAMEBUFFER 0x00023001
Camilla Löwy422bf792019-04-01 18:36:30 +0200986/*! @brief macOS specific
987 * [window hint](@ref GLFW_COCOA_FRAME_NAME_hint).
988 */
Camilla Löwy9da22852017-12-12 16:45:38 +0100989#define GLFW_COCOA_FRAME_NAME 0x00023002
Camilla Löwy422bf792019-04-01 18:36:30 +0200990/*! @brief macOS specific
991 * [window hint](@ref GLFW_COCOA_GRAPHICS_SWITCHING_hint).
992 */
Camilla Löwy77a8f102017-01-27 12:02:09 +0100993#define GLFW_COCOA_GRAPHICS_SWITCHING 0x00023003
Camilla Löwy422bf792019-04-01 18:36:30 +0200994/*! @brief X11 specific
995 * [window hint](@ref GLFW_X11_CLASS_NAME_hint).
996 */
Camilla Löwy61588012017-12-12 10:54:18 +0100997#define GLFW_X11_CLASS_NAME 0x00024001
Camilla Löwy422bf792019-04-01 18:36:30 +0200998/*! @brief X11 specific
999 * [window hint](@ref GLFW_X11_CLASS_NAME_hint).
1000 */
Camilla Löwy61588012017-12-12 10:54:18 +01001001#define GLFW_X11_INSTANCE_NAME 0x00024002
Camilla Löwy831426c2016-12-08 17:08:36 +01001002/*! @} */
Camilla Löwy58ceab52016-12-07 00:41:54 +01001003
Camilla Berglund496f5592015-06-18 14:03:02 +02001004#define GLFW_NO_API 0
Camilla Berglund393e4392013-05-27 22:16:59 +02001005#define GLFW_OPENGL_API 0x00030001
1006#define GLFW_OPENGL_ES_API 0x00030002
Camilla Berglund2fca5c52013-01-17 21:51:39 +01001007
Camilla Berglund393e4392013-05-27 22:16:59 +02001008#define GLFW_NO_ROBUSTNESS 0
1009#define GLFW_NO_RESET_NOTIFICATION 0x00031001
1010#define GLFW_LOSE_CONTEXT_ON_RESET 0x00031002
Camilla Berglund2fca5c52013-01-17 21:51:39 +01001011
Camilla Berglund44e84012013-06-05 16:13:30 +02001012#define GLFW_OPENGL_ANY_PROFILE 0
Camilla Berglund393e4392013-05-27 22:16:59 +02001013#define GLFW_OPENGL_CORE_PROFILE 0x00032001
1014#define GLFW_OPENGL_COMPAT_PROFILE 0x00032002
Camilla Berglund2fca5c52013-01-17 21:51:39 +01001015
Camilla Berglund393e4392013-05-27 22:16:59 +02001016#define GLFW_CURSOR 0x00033001
1017#define GLFW_STICKY_KEYS 0x00033002
1018#define GLFW_STICKY_MOUSE_BUTTONS 0x00033003
Camilla Löwy0e8c4ea2017-11-29 20:42:37 +01001019#define GLFW_LOCK_KEY_MODS 0x00033004
Camilla Löwy1155c832019-02-11 19:10:20 +01001020#define GLFW_RAW_MOUSE_MOTION 0x00033005
Camilla Berglund2fca5c52013-01-17 21:51:39 +01001021
Camilla Berglund393e4392013-05-27 22:16:59 +02001022#define GLFW_CURSOR_NORMAL 0x00034001
1023#define GLFW_CURSOR_HIDDEN 0x00034002
1024#define GLFW_CURSOR_DISABLED 0x00034003
Camilla Berglund2fca5c52013-01-17 21:51:39 +01001025
Camilla Berglund44c899c2014-08-21 19:21:45 +02001026#define GLFW_ANY_RELEASE_BEHAVIOR 0
1027#define GLFW_RELEASE_BEHAVIOR_FLUSH 0x00035001
1028#define GLFW_RELEASE_BEHAVIOR_NONE 0x00035002
1029
Camilla Berglundef80bea2016-03-28 13:19:31 +02001030#define GLFW_NATIVE_CONTEXT_API 0x00036001
1031#define GLFW_EGL_CONTEXT_API 0x00036002
Camilla Löwye9560ef2017-02-28 19:23:25 +01001032#define GLFW_OSMESA_CONTEXT_API 0x00036003
Camilla Berglundef80bea2016-03-28 13:19:31 +02001033
Camilla Berglund2a1375e2014-09-02 16:52:16 +02001034/*! @defgroup shapes Standard cursor shapes
Camilla Löwy21eabd32017-02-06 17:31:25 +01001035 * @brief Standard system cursor shapes.
Camilla Berglund4188c262015-01-18 01:55:25 +01001036 *
1037 * See [standard cursor creation](@ref cursor_standard) for how these are used.
1038 *
Camilla Berglund2a1375e2014-09-02 16:52:16 +02001039 * @ingroup input
1040 * @{ */
1041
1042/*! @brief The regular arrow cursor shape.
1043 *
1044 * The regular arrow cursor.
1045 */
1046#define GLFW_ARROW_CURSOR 0x00036001
1047/*! @brief The text input I-beam cursor shape.
1048 *
1049 * The text input I-beam cursor shape.
1050 */
1051#define GLFW_IBEAM_CURSOR 0x00036002
1052/*! @brief The crosshair shape.
1053 *
1054 * The crosshair shape.
1055 */
1056#define GLFW_CROSSHAIR_CURSOR 0x00036003
1057/*! @brief The hand shape.
1058 *
1059 * The hand shape.
1060 */
1061#define GLFW_HAND_CURSOR 0x00036004
1062/*! @brief The horizontal resize arrow shape.
1063 *
1064 * The horizontal resize arrow shape.
1065 */
1066#define GLFW_HRESIZE_CURSOR 0x00036005
1067/*! @brief The vertical resize arrow shape.
1068 *
1069 * The vertical resize arrow shape.
1070 */
1071#define GLFW_VRESIZE_CURSOR 0x00036006
1072/*! @} */
1073
Camilla Berglund393e4392013-05-27 22:16:59 +02001074#define GLFW_CONNECTED 0x00040001
1075#define GLFW_DISCONNECTED 0x00040002
Camilla Berglund2fca5c52013-01-17 21:51:39 +01001076
Camilla Löwy6d9a58b2017-02-14 15:43:31 +01001077/*! @addtogroup init
1078 * @{ */
Camilla Löwy04116782018-11-05 17:37:49 +01001079/*! @brief Joystick hat buttons init hint.
1080 *
Camilla Löwy422bf792019-04-01 18:36:30 +02001081 * Joystick hat buttons [init hint](@ref GLFW_JOYSTICK_HAT_BUTTONS).
Camilla Löwy04116782018-11-05 17:37:49 +01001082 */
Camilla Löwy798d7c62017-03-01 23:27:20 +01001083#define GLFW_JOYSTICK_HAT_BUTTONS 0x00050001
Camilla Löwy04116782018-11-05 17:37:49 +01001084/*! @brief macOS specific init hint.
1085 *
Camilla Löwy422bf792019-04-01 18:36:30 +02001086 * macOS specific [init hint](@ref GLFW_COCOA_CHDIR_RESOURCES_hint).
Camilla Löwy04116782018-11-05 17:37:49 +01001087 */
Camilla Löwy6d9a58b2017-02-14 15:43:31 +01001088#define GLFW_COCOA_CHDIR_RESOURCES 0x00051001
Camilla Löwy04116782018-11-05 17:37:49 +01001089/*! @brief macOS specific init hint.
1090 *
Camilla Löwy422bf792019-04-01 18:36:30 +02001091 * macOS specific [init hint](@ref GLFW_COCOA_MENUBAR_hint).
Camilla Löwy04116782018-11-05 17:37:49 +01001092 */
Camilla Löwy6d9a58b2017-02-14 15:43:31 +01001093#define GLFW_COCOA_MENUBAR 0x00051002
1094/*! @} */
1095
Camilla Berglund28101302014-04-08 18:57:43 +02001096#define GLFW_DONT_CARE -1
1097
Camilla Berglund97387282011-10-06 23:28:56 +02001098
Camilla Berglund3249f812010-09-07 17:34:51 +02001099/*************************************************************************
Camilla Berglund2fca5c52013-01-17 21:51:39 +01001100 * GLFW API types
Camilla Berglund3249f812010-09-07 17:34:51 +02001101 *************************************************************************/
1102
Camilla Berglund3f5843f2012-12-13 02:22:39 +01001103/*! @brief Client API function pointer type.
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001104 *
1105 * Generic function pointer used for returning client API function pointers
1106 * without forcing a cast from a regular pointer.
1107 *
Camilla Berglundbce20c32015-11-05 13:58:52 +01001108 * @sa @ref context_glext
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001109 * @sa @ref glfwGetProcAddress
Camilla Berglundbce20c32015-11-05 13:58:52 +01001110 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001111 * @since Added in version 3.0.
Emmanuel Gil Peyrotc3cba582017-11-17 03:34:18 +00001112 *
Camilla Berglund3f5843f2012-12-13 02:22:39 +01001113 * @ingroup context
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001114 */
Camilla Berglundbf42c3c2012-06-05 00:16:40 +02001115typedef void (*GLFWglproc)(void);
1116
Camilla Berglund9b75bff2015-08-10 20:19:04 +02001117/*! @brief Vulkan API function pointer type.
1118 *
1119 * Generic function pointer used for returning Vulkan API function pointers
1120 * without forcing a cast from a regular pointer.
1121 *
1122 * @sa @ref vulkan_proc
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001123 * @sa @ref glfwGetInstanceProcAddress
Camilla Berglund9b75bff2015-08-10 20:19:04 +02001124 *
1125 * @since Added in version 3.2.
1126 *
1127 * @ingroup vulkan
1128 */
1129typedef void (*GLFWvkproc)(void);
1130
Camilla Berglunddba2d802013-01-17 23:06:56 +01001131/*! @brief Opaque monitor object.
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001132 *
1133 * Opaque monitor object.
1134 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +01001135 * @see @ref monitor_object
1136 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001137 * @since Added in version 3.0.
Camilla Berglund810bab72015-12-13 17:38:14 +01001138 *
Camilla Berglund41bc0d12012-11-27 16:55:04 +01001139 * @ingroup monitor
1140 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001141typedef struct GLFWmonitor GLFWmonitor;
Camilla Berglunde0ce9202012-08-29 20:39:05 +02001142
Camilla Berglunddba2d802013-01-17 23:06:56 +01001143/*! @brief Opaque window object.
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001144 *
1145 * Opaque window object.
1146 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +01001147 * @see @ref window_object
1148 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001149 * @since Added in version 3.0.
Camilla Berglund810bab72015-12-13 17:38:14 +01001150 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001151 * @ingroup window
1152 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001153typedef struct GLFWwindow GLFWwindow;
Camilla Berglund135194a2010-09-09 18:15:32 +02001154
urraka40c04a72013-12-04 10:19:22 -03001155/*! @brief Opaque cursor object.
1156 *
1157 * Opaque cursor object.
1158 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +01001159 * @see @ref cursor_object
1160 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001161 * @since Added in version 3.1.
Camilla Berglund810bab72015-12-13 17:38:14 +01001162 *
Camilla Löwy04116782018-11-05 17:37:49 +01001163 * @ingroup input
urraka40c04a72013-12-04 10:19:22 -03001164 */
1165typedef struct GLFWcursor GLFWcursor;
1166
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001167/*! @brief The function signature for error callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001168 *
1169 * This is the function signature for error callback functions.
1170 *
Camilla Berglund71d2b572013-03-12 15:33:05 +01001171 * @param[in] error An [error code](@ref errors).
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001172 * @param[in] description A UTF-8 encoded string describing the error.
Camilla Berglunddba2d802013-01-17 23:06:56 +01001173 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +01001174 * @sa @ref error_handling
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001175 * @sa @ref glfwSetErrorCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +01001176 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001177 * @since Added in version 3.0.
Camilla Berglund810bab72015-12-13 17:38:14 +01001178 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001179 * @ingroup init
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001180 */
Camilla Berglund897558f2011-03-07 13:34:58 +01001181typedef void (* GLFWerrorfun)(int,const char*);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001182
Camilla Berglund1a3d47d2012-11-30 13:56:42 +01001183/*! @brief The function signature for window position callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001184 *
1185 * This is the function signature for window position callback functions.
1186 *
Camilla Berglunde8e05d42014-04-23 13:30:11 +02001187 * @param[in] window The window that was moved.
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001188 * @param[in] xpos The new x-coordinate, in screen coordinates, of the
Camilla Löwyd5ab3e92019-01-22 20:54:16 +01001189 * upper-left corner of the content area of the window.
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001190 * @param[in] ypos The new y-coordinate, in screen coordinates, of the
Camilla Löwyd5ab3e92019-01-22 20:54:16 +01001191 * upper-left corner of the content area of the window.
Camilla Berglunddba2d802013-01-17 23:06:56 +01001192 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +01001193 * @sa @ref window_pos
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001194 * @sa @ref glfwSetWindowPosCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +01001195 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001196 * @since Added in version 3.0.
Camilla Berglund810bab72015-12-13 17:38:14 +01001197 *
Camilla Berglunde248fb62013-03-29 14:06:23 +01001198 * @ingroup window
Camilla Berglund1a3d47d2012-11-30 13:56:42 +01001199 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001200typedef void (* GLFWwindowposfun)(GLFWwindow*,int,int);
Camilla Berglund1a3d47d2012-11-30 13:56:42 +01001201
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001202/*! @brief The function signature for window resize callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001203 *
1204 * This is the function signature for window size callback functions.
1205 *
Camilla Berglunde8e05d42014-04-23 13:30:11 +02001206 * @param[in] window The window that was resized.
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001207 * @param[in] width The new width, in screen coordinates, of the window.
1208 * @param[in] height The new height, in screen coordinates, of the window.
Camilla Berglunddba2d802013-01-17 23:06:56 +01001209 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +01001210 * @sa @ref window_size
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001211 * @sa @ref glfwSetWindowSizeCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +01001212 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001213 * @since Added in version 1.0.
1214 * @glfw3 Added window handle parameter.
Camilla Berglund810bab72015-12-13 17:38:14 +01001215 *
Camilla Berglunde248fb62013-03-29 14:06:23 +01001216 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001217 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001218typedef void (* GLFWwindowsizefun)(GLFWwindow*,int,int);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001219
1220/*! @brief The function signature for window close callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001221 *
1222 * This is the function signature for window close callback functions.
1223 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001224 * @param[in] window The window that the user attempted to close.
Camilla Berglunddba2d802013-01-17 23:06:56 +01001225 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +01001226 * @sa @ref window_close
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001227 * @sa @ref glfwSetWindowCloseCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +01001228 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001229 * @since Added in version 2.5.
1230 * @glfw3 Added window handle parameter.
Camilla Berglund810bab72015-12-13 17:38:14 +01001231 *
Camilla Berglunde248fb62013-03-29 14:06:23 +01001232 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001233 */
Camilla Berglund64afb192013-03-06 23:29:37 +01001234typedef void (* GLFWwindowclosefun)(GLFWwindow*);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001235
1236/*! @brief The function signature for window content refresh callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001237 *
1238 * This is the function signature for window refresh callback functions.
1239 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001240 * @param[in] window The window whose content needs to be refreshed.
Camilla Berglunddba2d802013-01-17 23:06:56 +01001241 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +01001242 * @sa @ref window_refresh
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001243 * @sa @ref glfwSetWindowRefreshCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +01001244 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001245 * @since Added in version 2.5.
1246 * @glfw3 Added window handle parameter.
Camilla Berglund810bab72015-12-13 17:38:14 +01001247 *
Camilla Berglunde248fb62013-03-29 14:06:23 +01001248 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001249 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001250typedef void (* GLFWwindowrefreshfun)(GLFWwindow*);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001251
1252/*! @brief The function signature for window focus/defocus callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001253 *
1254 * This is the function signature for window focus callback functions.
1255 *
Camilla Berglund4188c262015-01-18 01:55:25 +01001256 * @param[in] window The window that gained or lost input focus.
Camilla Berglund0eccf752015-08-23 19:30:04 +02001257 * @param[in] focused `GLFW_TRUE` if the window was given input focus, or
1258 * `GLFW_FALSE` if it lost it.
Camilla Berglunddba2d802013-01-17 23:06:56 +01001259 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +01001260 * @sa @ref window_focus
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001261 * @sa @ref glfwSetWindowFocusCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +01001262 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001263 * @since Added in version 3.0.
Camilla Berglund810bab72015-12-13 17:38:14 +01001264 *
Camilla Berglunde248fb62013-03-29 14:06:23 +01001265 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001266 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001267typedef void (* GLFWwindowfocusfun)(GLFWwindow*,int);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001268
Camilla Berglund06e7a962012-11-22 19:14:27 +01001269/*! @brief The function signature for window iconify/restore callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001270 *
1271 * This is the function signature for window iconify/restore callback
1272 * functions.
1273 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001274 * @param[in] window The window that was iconified or restored.
Camilla Berglund0eccf752015-08-23 19:30:04 +02001275 * @param[in] iconified `GLFW_TRUE` if the window was iconified, or
1276 * `GLFW_FALSE` if it was restored.
Camilla Berglunddba2d802013-01-17 23:06:56 +01001277 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +01001278 * @sa @ref window_iconify
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001279 * @sa @ref glfwSetWindowIconifyCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +01001280 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001281 * @since Added in version 3.0.
Camilla Berglund810bab72015-12-13 17:38:14 +01001282 *
Camilla Berglunde248fb62013-03-29 14:06:23 +01001283 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001284 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001285typedef void (* GLFWwindowiconifyfun)(GLFWwindow*,int);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001286
Camilla Berglundc156b502016-06-16 13:09:28 +02001287/*! @brief The function signature for window maximize/restore callbacks.
1288 *
1289 * This is the function signature for window maximize/restore callback
1290 * functions.
1291 *
1292 * @param[in] window The window that was maximized or restored.
1293 * @param[in] iconified `GLFW_TRUE` if the window was maximized, or
1294 * `GLFW_FALSE` if it was restored.
1295 *
1296 * @sa @ref window_maximize
1297 * @sa glfwSetWindowMaximizeCallback
1298 *
1299 * @since Added in version 3.3.
1300 *
1301 * @ingroup window
1302 */
1303typedef void (* GLFWwindowmaximizefun)(GLFWwindow*,int);
1304
Camilla Berglund34981632013-06-03 12:51:57 +02001305/*! @brief The function signature for framebuffer resize callbacks.
1306 *
1307 * This is the function signature for framebuffer resize callback
1308 * functions.
1309 *
1310 * @param[in] window The window whose framebuffer was resized.
1311 * @param[in] width The new width, in pixels, of the framebuffer.
1312 * @param[in] height The new height, in pixels, of the framebuffer.
1313 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +01001314 * @sa @ref window_fbsize
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001315 * @sa @ref glfwSetFramebufferSizeCallback
Camilla Berglund34981632013-06-03 12:51:57 +02001316 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001317 * @since Added in version 3.0.
Camilla Berglund810bab72015-12-13 17:38:14 +01001318 *
Camilla Berglund34981632013-06-03 12:51:57 +02001319 * @ingroup window
1320 */
1321typedef void (* GLFWframebuffersizefun)(GLFWwindow*,int,int);
1322
Camilla Löwy370eac32017-12-11 21:26:40 +01001323/*! @brief The function signature for window content scale callbacks.
1324 *
1325 * This is the function signature for window content scale callback
1326 * functions.
1327 *
1328 * @param[in] window The window whose content scale changed.
1329 * @param[in] xscale The new x-axis content scale of the window.
1330 * @param[in] yscale The new y-axis content scale of the window.
1331 *
1332 * @sa @ref window_scale
1333 * @sa @ref glfwSetWindowContentScaleCallback
1334 *
1335 * @since Added in version 3.3.
1336 *
1337 * @ingroup window
1338 */
1339typedef void (* GLFWwindowcontentscalefun)(GLFWwindow*,float,float);
1340
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001341/*! @brief The function signature for mouse button callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001342 *
1343 * This is the function signature for mouse button callback functions.
1344 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001345 * @param[in] window The window that received the event.
Camilla Berglund71d2b572013-03-12 15:33:05 +01001346 * @param[in] button The [mouse button](@ref buttons) that was pressed or
1347 * released.
1348 * @param[in] action One of `GLFW_PRESS` or `GLFW_RELEASE`.
Camilla Berglund98cbf6f2013-05-23 14:42:33 +02001349 * @param[in] mods Bit field describing which [modifier keys](@ref mods) were
1350 * held down.
Camilla Berglunddba2d802013-01-17 23:06:56 +01001351 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +01001352 * @sa @ref input_mouse_button
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001353 * @sa @ref glfwSetMouseButtonCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +01001354 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001355 * @since Added in version 1.0.
1356 * @glfw3 Added window handle and modifier mask parameters.
Camilla Berglund810bab72015-12-13 17:38:14 +01001357 *
Camilla Berglunde248fb62013-03-29 14:06:23 +01001358 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001359 */
Camilla Berglund2d1b8352012-12-09 19:19:00 +01001360typedef void (* GLFWmousebuttonfun)(GLFWwindow*,int,int,int);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001361
1362/*! @brief The function signature for cursor position callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001363 *
1364 * This is the function signature for cursor position callback functions.
1365 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001366 * @param[in] window The window that received the event.
Camilla Berglund95c44ab2016-02-17 14:52:01 +01001367 * @param[in] xpos The new cursor x-coordinate, relative to the left edge of
Camilla Löwyd5ab3e92019-01-22 20:54:16 +01001368 * the content area.
Camilla Berglund95c44ab2016-02-17 14:52:01 +01001369 * @param[in] ypos The new cursor y-coordinate, relative to the top edge of the
Camilla Löwyd5ab3e92019-01-22 20:54:16 +01001370 * content area.
Camilla Berglunddba2d802013-01-17 23:06:56 +01001371 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +01001372 * @sa @ref cursor_pos
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001373 * @sa @ref glfwSetCursorPosCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +01001374 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001375 * @since Added in version 3.0. Replaces `GLFWmouseposfun`.
Camilla Berglund810bab72015-12-13 17:38:14 +01001376 *
Camilla Berglunde248fb62013-03-29 14:06:23 +01001377 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001378 */
Camilla Berglund129e94d2013-04-04 16:16:21 +02001379typedef void (* GLFWcursorposfun)(GLFWwindow*,double,double);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001380
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001381/*! @brief The function signature for cursor enter/leave callbacks.
1382 *
1383 * This is the function signature for cursor enter/leave callback functions.
1384 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001385 * @param[in] window The window that received the event.
Camilla Löwyd5ab3e92019-01-22 20:54:16 +01001386 * @param[in] entered `GLFW_TRUE` if the cursor entered the window's content
Camilla Berglund0eccf752015-08-23 19:30:04 +02001387 * area, or `GLFW_FALSE` if it left it.
Camilla Berglunddba2d802013-01-17 23:06:56 +01001388 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +01001389 * @sa @ref cursor_enter
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001390 * @sa @ref glfwSetCursorEnterCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +01001391 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001392 * @since Added in version 3.0.
Camilla Berglund810bab72015-12-13 17:38:14 +01001393 *
Camilla Berglunde248fb62013-03-29 14:06:23 +01001394 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001395 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001396typedef void (* GLFWcursorenterfun)(GLFWwindow*,int);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001397
1398/*! @brief The function signature for scroll callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001399 *
1400 * This is the function signature for scroll callback functions.
1401 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001402 * @param[in] window The window that received the event.
mewmewcf2d2602013-06-06 19:49:23 +02001403 * @param[in] xoffset The scroll offset along the x-axis.
1404 * @param[in] yoffset The scroll offset along the y-axis.
Camilla Berglunddba2d802013-01-17 23:06:56 +01001405 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +01001406 * @sa @ref scrolling
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001407 * @sa @ref glfwSetScrollCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +01001408 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001409 * @since Added in version 3.0. Replaces `GLFWmousewheelfun`.
Camilla Berglund810bab72015-12-13 17:38:14 +01001410 *
Camilla Berglunde248fb62013-03-29 14:06:23 +01001411 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001412 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001413typedef void (* GLFWscrollfun)(GLFWwindow*,double,double);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001414
1415/*! @brief The function signature for keyboard key callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001416 *
1417 * This is the function signature for keyboard key callback functions.
1418 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001419 * @param[in] window The window that received the event.
Camilla Berglund71d2b572013-03-12 15:33:05 +01001420 * @param[in] key The [keyboard key](@ref keys) that was pressed or released.
Camilla Berglund11615fc2013-05-30 17:19:12 +02001421 * @param[in] scancode The system-specific scancode of the key.
Camilla Berglund95654cf2014-10-02 17:35:10 +02001422 * @param[in] action `GLFW_PRESS`, `GLFW_RELEASE` or `GLFW_REPEAT`.
Camilla Berglund98cbf6f2013-05-23 14:42:33 +02001423 * @param[in] mods Bit field describing which [modifier keys](@ref mods) were
1424 * held down.
Camilla Berglunddba2d802013-01-17 23:06:56 +01001425 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +01001426 * @sa @ref input_key
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001427 * @sa @ref glfwSetKeyCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +01001428 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001429 * @since Added in version 1.0.
1430 * @glfw3 Added window handle, scancode and modifier mask parameters.
Camilla Berglund810bab72015-12-13 17:38:14 +01001431 *
Camilla Berglunde248fb62013-03-29 14:06:23 +01001432 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001433 */
Camilla Berglund11615fc2013-05-30 17:19:12 +02001434typedef void (* GLFWkeyfun)(GLFWwindow*,int,int,int,int);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001435
1436/*! @brief The function signature for Unicode character callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001437 *
1438 * This is the function signature for Unicode character callback functions.
1439 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001440 * @param[in] window The window that received the event.
Camilla Berglund2c920fb2013-10-10 19:41:56 +02001441 * @param[in] codepoint The Unicode code point of the character.
Camilla Berglunddba2d802013-01-17 23:06:56 +01001442 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +01001443 * @sa @ref input_char
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001444 * @sa @ref glfwSetCharCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +01001445 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001446 * @since Added in version 2.4.
1447 * @glfw3 Added window handle parameter.
Camilla Berglund810bab72015-12-13 17:38:14 +01001448 *
Camilla Berglunde248fb62013-03-29 14:06:23 +01001449 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001450 */
Camilla Berglund182e0af2013-02-25 17:02:28 +01001451typedef void (* GLFWcharfun)(GLFWwindow*,unsigned int);
Camilla Berglund5f68e122012-11-27 17:07:28 +01001452
Camilla Berglund96b12ee2014-06-12 23:04:20 +02001453/*! @brief The function signature for Unicode character with modifiers
1454 * callbacks.
1455 *
1456 * This is the function signature for Unicode character with modifiers callback
1457 * functions. It is called for each input character, regardless of what
1458 * modifier keys are held down.
1459 *
1460 * @param[in] window The window that received the event.
1461 * @param[in] codepoint The Unicode code point of the character.
1462 * @param[in] mods Bit field describing which [modifier keys](@ref mods) were
1463 * held down.
1464 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +01001465 * @sa @ref input_char
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001466 * @sa @ref glfwSetCharModsCallback
Camilla Berglund96b12ee2014-06-12 23:04:20 +02001467 *
Camilla Löwyadebcc72017-11-14 23:28:12 +01001468 * @deprecated Scheduled for removal in version 4.0.
1469 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001470 * @since Added in version 3.1.
Camilla Berglund810bab72015-12-13 17:38:14 +01001471 *
Camilla Berglund96b12ee2014-06-12 23:04:20 +02001472 * @ingroup input
1473 */
1474typedef void (* GLFWcharmodsfun)(GLFWwindow*,unsigned int,int);
1475
Camilla Berglund5c8121e2014-03-29 21:35:21 +01001476/*! @brief The function signature for file drop callbacks.
arturo89d07232013-07-10 11:42:14 +02001477 *
Camilla Berglund5c8121e2014-03-29 21:35:21 +01001478 * This is the function signature for file drop callbacks.
arturo89d07232013-07-10 11:42:14 +02001479 *
1480 * @param[in] window The window that received the event.
Camilla Berglund5c8121e2014-03-29 21:35:21 +01001481 * @param[in] count The number of dropped files.
Camilla Berglund93855ae2015-01-27 23:04:22 +01001482 * @param[in] paths The UTF-8 encoded file and/or directory path names.
arturo89d07232013-07-10 11:42:14 +02001483 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +01001484 * @sa @ref path_drop
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001485 * @sa @ref glfwSetDropCallback
arturo89d07232013-07-10 11:42:14 +02001486 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001487 * @since Added in version 3.1.
Camilla Berglund810bab72015-12-13 17:38:14 +01001488 *
arturo89d07232013-07-10 11:42:14 +02001489 * @ingroup input
1490 */
Camilla Berglund8f349e82013-12-22 19:28:46 +01001491typedef void (* GLFWdropfun)(GLFWwindow*,int,const char**);
arturo89d07232013-07-10 11:42:14 +02001492
Camilla Berglund5f68e122012-11-27 17:07:28 +01001493/*! @brief The function signature for monitor configuration callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001494 *
1495 * This is the function signature for monitor configuration callback functions.
1496 *
Camilla Berglund5f68e122012-11-27 17:07:28 +01001497 * @param[in] monitor The monitor that was connected or disconnected.
Camilla Löwyb0204672018-02-06 13:10:08 +01001498 * @param[in] event One of `GLFW_CONNECTED` or `GLFW_DISCONNECTED`. Remaining
1499 * values reserved for future use.
Camilla Berglunddba2d802013-01-17 23:06:56 +01001500 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +01001501 * @sa @ref monitor_event
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001502 * @sa @ref glfwSetMonitorCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +01001503 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001504 * @since Added in version 3.0.
Camilla Berglund810bab72015-12-13 17:38:14 +01001505 *
Camilla Berglunde248fb62013-03-29 14:06:23 +01001506 * @ingroup monitor
Camilla Berglund5f68e122012-11-27 17:07:28 +01001507 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001508typedef void (* GLFWmonitorfun)(GLFWmonitor*,int);
Camilla Berglund897558f2011-03-07 13:34:58 +01001509
Camilla Berglund8a7fa302015-12-13 17:38:50 +01001510/*! @brief The function signature for joystick configuration callbacks.
1511 *
1512 * This is the function signature for joystick configuration callback
1513 * functions.
1514 *
Camilla Berglundefc6b352016-10-10 03:24:07 +02001515 * @param[in] jid The joystick that was connected or disconnected.
Camilla Löwyb0204672018-02-06 13:10:08 +01001516 * @param[in] event One of `GLFW_CONNECTED` or `GLFW_DISCONNECTED`. Remaining
1517 * values reserved for future use.
Camilla Berglund8a7fa302015-12-13 17:38:50 +01001518 *
1519 * @sa @ref joystick_event
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001520 * @sa @ref glfwSetJoystickCallback
Camilla Berglund8a7fa302015-12-13 17:38:50 +01001521 *
1522 * @since Added in version 3.2.
1523 *
1524 * @ingroup input
1525 */
1526typedef void (* GLFWjoystickfun)(int,int);
1527
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001528/*! @brief Video mode type.
1529 *
1530 * This describes a single video mode.
1531 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +01001532 * @sa @ref monitor_modes
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001533 * @sa @ref glfwGetVideoMode
1534 * @sa @ref glfwGetVideoModes
Camilla Berglund9d71eb42015-11-05 09:24:16 +01001535 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001536 * @since Added in version 1.0.
1537 * @glfw3 Added refresh rate member.
Camilla Berglund810bab72015-12-13 17:38:14 +01001538 *
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001539 * @ingroup monitor
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001540 */
Systemclusterd0a0e372013-08-29 06:15:55 +02001541typedef struct GLFWvidmode
Camilla Berglund5fd3fc72010-09-09 19:44:43 +02001542{
Camilla Berglund95835af2013-05-30 13:53:25 +02001543 /*! The width, in screen coordinates, of the video mode.
Camilla Berglundc1594112013-05-27 22:29:06 +02001544 */
Camilla Berglund5fd3fc72010-09-09 19:44:43 +02001545 int width;
Camilla Berglund95835af2013-05-30 13:53:25 +02001546 /*! The height, in screen coordinates, of the video mode.
Camilla Berglundc1594112013-05-27 22:29:06 +02001547 */
Camilla Berglund5fd3fc72010-09-09 19:44:43 +02001548 int height;
Camilla Berglundc1594112013-05-27 22:29:06 +02001549 /*! The bit depth of the red channel of the video mode.
1550 */
Camilla Berglund5fd3fc72010-09-09 19:44:43 +02001551 int redBits;
Camilla Berglundc1594112013-05-27 22:29:06 +02001552 /*! The bit depth of the green channel of the video mode.
1553 */
Camilla Berglund5fd3fc72010-09-09 19:44:43 +02001554 int greenBits;
Camilla Berglundc1594112013-05-27 22:29:06 +02001555 /*! The bit depth of the blue channel of the video mode.
1556 */
Camilla Berglund2e8446f2013-04-11 01:31:00 +02001557 int blueBits;
Camilla Berglund731812c2013-05-30 15:52:42 +02001558 /*! The refresh rate, in Hz, of the video mode.
1559 */
1560 int refreshRate;
Camilla Berglund3249f812010-09-07 17:34:51 +02001561} GLFWvidmode;
1562
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001563/*! @brief Gamma ramp.
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001564 *
1565 * This describes the gamma ramp for a monitor.
1566 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +01001567 * @sa @ref monitor_gamma
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001568 * @sa @ref glfwGetGammaRamp
1569 * @sa @ref glfwSetGammaRamp
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001570 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001571 * @since Added in version 3.0.
Camilla Berglund810bab72015-12-13 17:38:14 +01001572 *
Camilla Berglundf5f55e32013-06-17 12:56:36 +02001573 * @ingroup monitor
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001574 */
Systemclusterd0a0e372013-08-29 06:15:55 +02001575typedef struct GLFWgammaramp
Camilla Berglund2630d492010-10-13 04:04:43 +02001576{
Camilla Berglundc1594112013-05-27 22:29:06 +02001577 /*! An array of value describing the response of the red channel.
1578 */
Camilla Berglund5d308db2013-05-19 15:46:44 +02001579 unsigned short* red;
Camilla Berglundc1594112013-05-27 22:29:06 +02001580 /*! An array of value describing the response of the green channel.
1581 */
Camilla Berglund5d308db2013-05-19 15:46:44 +02001582 unsigned short* green;
Camilla Berglundc1594112013-05-27 22:29:06 +02001583 /*! An array of value describing the response of the blue channel.
1584 */
Camilla Berglund5d308db2013-05-19 15:46:44 +02001585 unsigned short* blue;
Camilla Berglundc1594112013-05-27 22:29:06 +02001586 /*! The number of elements in each array.
1587 */
Camilla Berglund5d308db2013-05-19 15:46:44 +02001588 unsigned int size;
Camilla Berglund2630d492010-10-13 04:04:43 +02001589} GLFWgammaramp;
1590
Camilla Berglund8fa9cc02014-02-23 16:43:17 +01001591/*! @brief Image data.
Camilla Berglund9d71eb42015-11-05 09:24:16 +01001592 *
Camilla Löwybeaeb0d2017-06-06 18:17:58 +02001593 * This describes a single 2D image. See the documentation for each related
1594 * function what the expected pixel format is.
1595 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +01001596 * @sa @ref cursor_custom
Camilla Berglundfe0317a2016-08-01 11:51:30 +02001597 * @sa @ref window_icon
Camilla Berglund810bab72015-12-13 17:38:14 +01001598 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001599 * @since Added in version 2.1.
1600 * @glfw3 Removed format and bytes-per-pixel members.
Camilla Löwy04116782018-11-05 17:37:49 +01001601 *
1602 * @ingroup window
Camilla Berglund8fa9cc02014-02-23 16:43:17 +01001603 */
1604typedef struct GLFWimage
1605{
1606 /*! The width, in pixels, of this image.
1607 */
1608 int width;
1609 /*! The height, in pixels, of this image.
1610 */
1611 int height;
1612 /*! The pixel data of this image, arranged left-to-right, top-to-bottom.
1613 */
1614 unsigned char* pixels;
1615} GLFWimage;
1616
Camilla Löwy953106e2017-06-18 15:13:25 +02001617/*! @brief Gamepad input state
1618 *
1619 * This describes the input state of a gamepad.
1620 *
1621 * @sa @ref gamepad
1622 * @sa @ref glfwGetGamepadState
1623 *
1624 * @since Added in version 3.3.
Camilla Löwy04116782018-11-05 17:37:49 +01001625 *
1626 * @ingroup input
Camilla Löwy953106e2017-06-18 15:13:25 +02001627 */
1628typedef struct GLFWgamepadstate
1629{
1630 /*! The states of each [gamepad button](@ref gamepad_buttons), `GLFW_PRESS`
1631 * or `GLFW_RELEASE`.
1632 */
Camilla Löwy2d8d8f52017-07-17 21:18:15 +02001633 unsigned char buttons[15];
Camilla Löwy953106e2017-06-18 15:13:25 +02001634 /*! The states of each [gamepad axis](@ref gamepad_axes), in the range -1.0
1635 * to 1.0 inclusive.
1636 */
1637 float axes[6];
1638} GLFWgamepadstate;
1639
Camilla Berglund3249f812010-09-07 17:34:51 +02001640
1641/*************************************************************************
Camilla Berglund2fca5c52013-01-17 21:51:39 +01001642 * GLFW API functions
Camilla Berglund3249f812010-09-07 17:34:51 +02001643 *************************************************************************/
1644
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001645/*! @brief Initializes the GLFW library.
1646 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001647 * This function initializes the GLFW library. Before most GLFW functions can
Camilla Berglund4591ad22014-09-18 15:03:29 +02001648 * be used, GLFW must be initialized, and before an application terminates GLFW
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001649 * should be terminated in order to free any resources allocated during or
1650 * after initialization.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001651 *
Camilla Berglund23f61762013-03-12 19:53:29 +01001652 * If this function fails, it calls @ref glfwTerminate before returning. If it
Camilla Berglund4591ad22014-09-18 15:03:29 +02001653 * succeeds, you should call @ref glfwTerminate before the application exits.
Camilla Berglund23f61762013-03-12 19:53:29 +01001654 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001655 * Additional calls to this function after successful initialization but before
Camilla Berglund0eccf752015-08-23 19:30:04 +02001656 * termination will return `GLFW_TRUE` immediately.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001657 *
Camilla Berglund0eccf752015-08-23 19:30:04 +02001658 * @return `GLFW_TRUE` if successful, or `GLFW_FALSE` if an
Camilla Berglund4591ad22014-09-18 15:03:29 +02001659 * [error](@ref error_handling) occurred.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001660 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001661 * @errors Possible errors include @ref GLFW_PLATFORM_ERROR.
1662 *
Camilla Berglund8d6f2652016-10-20 00:50:54 +02001663 * @remark @macos This function will change the current directory of the
Camilla Berglund71d2b572013-03-12 15:33:05 +01001664 * application to the `Contents/Resources` subdirectory of the application's
Camilla Löwy6d9a58b2017-02-14 15:43:31 +01001665 * bundle, if present. This can be disabled with the @ref
1666 * GLFW_COCOA_CHDIR_RESOURCES init hint.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001667 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001668 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001669 *
1670 * @sa @ref intro_init
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001671 * @sa @ref glfwTerminate
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001672 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001673 * @since Added in version 1.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001674 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001675 * @ingroup init
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001676 */
1677GLFWAPI int glfwInit(void);
1678
1679/*! @brief Terminates the GLFW library.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001680 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001681 * This function destroys all remaining windows and cursors, restores any
1682 * modified gamma ramps and frees any other allocated resources. Once this
1683 * function is called, you must again call @ref glfwInit successfully before
1684 * you will be able to use most GLFW functions.
Camilla Berglund23f61762013-03-12 19:53:29 +01001685 *
1686 * If GLFW has been successfully initialized, this function should be called
Camilla Berglund4591ad22014-09-18 15:03:29 +02001687 * before the application exits. If initialization fails, there is no need to
1688 * call this function, as it is called by @ref glfwInit before it returns
1689 * failure.
Camilla Berglund23f61762013-03-12 19:53:29 +01001690 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001691 * @errors Possible errors include @ref GLFW_PLATFORM_ERROR.
1692 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001693 * @remark This function may be called before @ref glfwInit.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001694 *
Camilla Berglund0df4e062015-12-13 14:07:27 +01001695 * @warning The contexts of any remaining windows must not be current on any
1696 * other thread when this function is called.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001697 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001698 * @reentrancy This function must not be called from a callback.
Camilla Berglund20858762015-01-01 18:41:22 +01001699 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001700 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001701 *
1702 * @sa @ref intro_init
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001703 * @sa @ref glfwInit
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001704 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001705 * @since Added in version 1.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001706 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001707 * @ingroup init
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001708 */
Camilla Berglund9a716692010-09-08 16:40:43 +02001709GLFWAPI void glfwTerminate(void);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001710
Camilla Löwy6d9a58b2017-02-14 15:43:31 +01001711/*! @brief Sets the specified init hint to the desired value.
1712 *
Camilla Löwy61588012017-12-12 10:54:18 +01001713 * This function sets hints for the next initialization of GLFW.
Camilla Löwy6d9a58b2017-02-14 15:43:31 +01001714 *
Camilla Löwy213dd2d2017-07-25 01:55:08 +02001715 * The values you set hints to are never reset by GLFW, but they only take
1716 * effect during initialization. Once GLFW has been initialized, any values
1717 * you set will be ignored until the library is terminated and initialized
1718 * again.
Camilla Löwy6d9a58b2017-02-14 15:43:31 +01001719 *
Camilla Löwy213dd2d2017-07-25 01:55:08 +02001720 * Some hints are platform specific. These may be set on any platform but they
Camilla Löwy1be81a12017-10-22 16:27:17 +02001721 * will only affect their specific platform. Other platforms will ignore them.
Emmanuel Gil Peyrotc3cba582017-11-17 03:34:18 +00001722 * Setting these hints requires no platform specific headers or functions.
Camilla Löwy6d9a58b2017-02-14 15:43:31 +01001723 *
1724 * @param[in] hint The [init hint](@ref init_hints) to set.
1725 * @param[in] value The new value of the init hint.
1726 *
1727 * @errors Possible errors include @ref GLFW_INVALID_ENUM and @ref
1728 * GLFW_INVALID_VALUE.
1729 *
1730 * @remarks This function may be called before @ref glfwInit.
1731 *
1732 * @thread_safety This function must only be called from the main thread.
1733 *
1734 * @sa init_hints
1735 * @sa glfwInit
1736 *
1737 * @since Added in version 3.3.
1738 *
1739 * @ingroup init
1740 */
1741GLFWAPI void glfwInitHint(int hint, int value);
1742
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001743/*! @brief Retrieves the version of the GLFW library.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001744 *
1745 * This function retrieves the major, minor and revision numbers of the GLFW
1746 * library. It is intended for when you are using GLFW as a shared library and
1747 * want to ensure that you are using the minimum required version.
1748 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001749 * Any or all of the version arguments may be `NULL`.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001750 *
Camilla Berglund71d2b572013-03-12 15:33:05 +01001751 * @param[out] major Where to store the major version number, or `NULL`.
1752 * @param[out] minor Where to store the minor version number, or `NULL`.
1753 * @param[out] rev Where to store the revision number, or `NULL`.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001754 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001755 * @errors None.
1756 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001757 * @remark This function may be called before @ref glfwInit.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001758 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001759 * @thread_safety This function may be called from any thread.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001760 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001761 * @sa @ref intro_version
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001762 * @sa @ref glfwGetVersionString
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001763 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001764 * @since Added in version 1.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001765 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001766 * @ingroup init
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001767 */
Camilla Berglund9a716692010-09-08 16:40:43 +02001768GLFWAPI void glfwGetVersion(int* major, int* minor, int* rev);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001769
Camilla Berglund6f8084f2013-02-14 13:14:17 +01001770/*! @brief Returns a string describing the compile-time configuration.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001771 *
Camilla Berglunde8e05d42014-04-23 13:30:11 +02001772 * This function returns the compile-time generated
1773 * [version string](@ref intro_version_string) of the GLFW library binary. It
1774 * describes the version, platform, compiler and any platform-specific
Camilla Berglund386b6032016-02-10 13:48:49 +01001775 * compile-time options. It should not be confused with the OpenGL or OpenGL
1776 * ES version string, queried with `glGetString`.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001777 *
Camilla Berglundce8f97c2015-01-11 23:33:14 +01001778 * __Do not use the version string__ to parse the GLFW library version. The
Camilla Berglund386b6032016-02-10 13:48:49 +01001779 * @ref glfwGetVersion function provides the version of the running library
1780 * binary in numerical format.
Camilla Berglundce8f97c2015-01-11 23:33:14 +01001781 *
Camilla Berglund386b6032016-02-10 13:48:49 +01001782 * @return The ASCII encoded GLFW version string.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02001783 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001784 * @errors None.
1785 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001786 * @remark This function may be called before @ref glfwInit.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001787 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001788 * @pointer_lifetime The returned string is static and compile-time generated.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001789 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001790 * @thread_safety This function may be called from any thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001791 *
1792 * @sa @ref intro_version
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001793 * @sa @ref glfwGetVersion
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001794 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001795 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001796 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001797 * @ingroup init
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001798 */
Camilla Berglundd6fe4472010-09-13 18:05:59 +02001799GLFWAPI const char* glfwGetVersionString(void);
Camilla Berglund3249f812010-09-07 17:34:51 +02001800
Camilla Löwy63506412017-05-01 19:20:57 +02001801/*! @brief Returns and clears the last error for the calling thread.
1802 *
Camilla Löwy2e9aff72017-07-09 14:46:39 +02001803 * This function returns and clears the [error code](@ref errors) of the last
Camilla Löwy14a3fe02017-05-25 18:23:09 +02001804 * error that occurred on the calling thread, and optionally a UTF-8 encoded
1805 * human-readable description of it. If no error has occurred since the last
Camilla Löwy539a7282017-06-11 18:04:17 +02001806 * call, it returns @ref GLFW_NO_ERROR (zero) and the description pointer is
1807 * set to `NULL`.
Camilla Löwy63506412017-05-01 19:20:57 +02001808 *
Camilla Löwy14a3fe02017-05-25 18:23:09 +02001809 * @param[in] description Where to store the error description pointer, or `NULL`.
Camilla Löwy539a7282017-06-11 18:04:17 +02001810 * @return The last error code for the calling thread, or @ref GLFW_NO_ERROR
1811 * (zero).
Camilla Löwy63506412017-05-01 19:20:57 +02001812 *
1813 * @errors None.
1814 *
Camilla Löwy14a3fe02017-05-25 18:23:09 +02001815 * @pointer_lifetime The returned string is allocated and freed by GLFW. You
1816 * should not free it yourself. It is guaranteed to be valid only until the
1817 * next error occurs or the library is terminated.
1818 *
Camilla Löwy63506412017-05-01 19:20:57 +02001819 * @remark This function may be called before @ref glfwInit.
1820 *
1821 * @thread_safety This function may be called from any thread.
1822 *
1823 * @sa @ref error_handling
1824 * @sa @ref glfwSetErrorCallback
1825 *
1826 * @since Added in version 3.3.
1827 *
1828 * @ingroup init
1829 */
Camilla Löwy14a3fe02017-05-25 18:23:09 +02001830GLFWAPI int glfwGetError(const char** description);
Camilla Löwy63506412017-05-01 19:20:57 +02001831
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001832/*! @brief Sets the error callback.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001833 *
1834 * This function sets the error callback, which is called with an error code
1835 * and a human-readable description each time a GLFW error occurs.
1836 *
Camilla Löwy63506412017-05-01 19:20:57 +02001837 * The error code is set before the callback is called. Calling @ref
1838 * glfwGetError from the error callback will return the same value as the error
1839 * code argument.
1840 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001841 * The error callback is called on the thread where the error occurred. If you
1842 * are using GLFW from multiple threads, your error callback needs to be
1843 * written accordingly.
1844 *
1845 * Because the description string may have been generated specifically for that
1846 * error, it is not guaranteed to be valid after the callback has returned. If
1847 * you wish to use it after the callback returns, you need to make a copy.
1848 *
Camilla Berglund20858762015-01-01 18:41:22 +01001849 * Once set, the error callback remains set even after the library has been
1850 * terminated.
1851 *
Camilla Berglund71d2b572013-03-12 15:33:05 +01001852 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001853 * callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02001854 * @return The previously set callback, or `NULL` if no callback was set.
1855 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001856 * @errors None.
1857 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001858 * @remark This function may be called before @ref glfwInit.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001859 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001860 * @thread_safety This function must only be called from the main thread.
Camilla Berglund0e205772014-03-24 11:58:35 +01001861 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001862 * @sa @ref error_handling
Camilla Löwy63506412017-05-01 19:20:57 +02001863 * @sa @ref glfwGetError
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001864 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001865 * @since Added in version 3.0.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001866 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001867 * @ingroup init
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001868 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02001869GLFWAPI GLFWerrorfun glfwSetErrorCallback(GLFWerrorfun cbfun);
Camilla Berglundf5d74c42010-09-09 21:06:59 +02001870
Camilla Berglund5f68e122012-11-27 17:07:28 +01001871/*! @brief Returns the currently connected monitors.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001872 *
1873 * This function returns an array of handles for all currently connected
Camilla Berglundf5cbdba2015-09-17 16:37:09 +02001874 * monitors. The primary monitor is always first in the returned array. If no
1875 * monitors were found, this function returns `NULL`.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001876 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001877 * @param[out] count Where to store the number of monitors in the returned
1878 * array. This is set to zero if an error occurred.
Camilla Berglundf5cbdba2015-09-17 16:37:09 +02001879 * @return An array of monitor handles, or `NULL` if no monitors were found or
1880 * if an [error](@ref error_handling) occurred.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001881 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001882 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
1883 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001884 * @pointer_lifetime The returned array is allocated and freed by GLFW. You
1885 * should not free it yourself. It is guaranteed to be valid only until the
1886 * monitor configuration changes or the library is terminated.
Camilla Berglund0e205772014-03-24 11:58:35 +01001887 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001888 * @thread_safety This function must only be called from the main thread.
Camilla Berglundc3bb5c92013-06-05 16:04:04 +02001889 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001890 * @sa @ref monitor_monitors
1891 * @sa @ref monitor_event
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001892 * @sa @ref glfwGetPrimaryMonitor
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001893 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001894 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001895 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001896 * @ingroup monitor
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001897 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001898GLFWAPI GLFWmonitor** glfwGetMonitors(int* count);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001899
Camilla Berglund5f68e122012-11-27 17:07:28 +01001900/*! @brief Returns the primary monitor.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001901 *
1902 * This function returns the primary monitor. This is usually the monitor
Camilla Berglundf5cbdba2015-09-17 16:37:09 +02001903 * where elements like the task bar or global menu bar are located.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001904 *
Camilla Berglundf5cbdba2015-09-17 16:37:09 +02001905 * @return The primary monitor, or `NULL` if no monitors were found or if an
1906 * [error](@ref error_handling) occurred.
Camilla Berglunddba2d802013-01-17 23:06:56 +01001907 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001908 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
1909 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001910 * @thread_safety This function must only be called from the main thread.
Camilla Berglund0e205772014-03-24 11:58:35 +01001911 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001912 * @remark The primary monitor is always first in the array returned by @ref
Camilla Berglundf5cbdba2015-09-17 16:37:09 +02001913 * glfwGetMonitors.
1914 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001915 * @sa @ref monitor_monitors
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001916 * @sa @ref glfwGetMonitors
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001917 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001918 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001919 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001920 * @ingroup monitor
Camilla Berglund41bc0d12012-11-27 16:55:04 +01001921 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001922GLFWAPI GLFWmonitor* glfwGetPrimaryMonitor(void);
Camilla Berglund41bc0d12012-11-27 16:55:04 +01001923
Camilla Berglundee5f30e2013-01-24 19:10:17 +01001924/*! @brief Returns the position of the monitor's viewport on the virtual screen.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001925 *
1926 * This function returns the position, in screen coordinates, of the upper-left
1927 * corner of the specified monitor.
1928 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001929 * Any or all of the position arguments may be `NULL`. If an error occurs, all
1930 * non-`NULL` position arguments will be set to zero.
1931 *
Camilla Berglunddba2d802013-01-17 23:06:56 +01001932 * @param[in] monitor The monitor to query.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02001933 * @param[out] xpos Where to store the monitor x-coordinate, or `NULL`.
1934 * @param[out] ypos Where to store the monitor y-coordinate, or `NULL`.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001935 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001936 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
1937 * GLFW_PLATFORM_ERROR.
1938 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001939 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001940 *
1941 * @sa @ref monitor_properties
1942 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001943 * @since Added in version 3.0.
Camilla Berglund0e205772014-03-24 11:58:35 +01001944 *
Camilla Berglund5f68e122012-11-27 17:07:28 +01001945 * @ingroup monitor
Camilla Berglund41bc0d12012-11-27 16:55:04 +01001946 */
Camilla Berglundee5f30e2013-01-24 19:10:17 +01001947GLFWAPI void glfwGetMonitorPos(GLFWmonitor* monitor, int* xpos, int* ypos);
1948
Camilla Löwya43d1a42019-02-25 14:46:48 +01001949/*! @brief Retrives the work area of the monitor.
Felipe Ferreira da Silvabe295cc2017-04-06 16:48:08 -03001950 *
1951 * This function returns the position, in screen coordinates, of the upper-left
Camilla Löwy01187432019-02-25 14:01:08 +01001952 * corner of the work area of the specified monitor along with the work area
1953 * size in screen coordinates. The work area is defined as the area of the
1954 * monitor not occluded by the operating system task bar where present. If no
1955 * task bar exists then the work area is the monitor resolution in screen
1956 * coordinates.
Felipe Ferreira da Silvabe295cc2017-04-06 16:48:08 -03001957 *
Camilla Löwy01187432019-02-25 14:01:08 +01001958 * Any or all of the position and size arguments may be `NULL`. If an error
1959 * occurs, all non-`NULL` position and size arguments will be set to zero.
Felipe Ferreira da Silvabe295cc2017-04-06 16:48:08 -03001960 *
1961 * @param[in] monitor The monitor to query.
1962 * @param[out] xpos Where to store the monitor x-coordinate, or `NULL`.
1963 * @param[out] ypos Where to store the monitor y-coordinate, or `NULL`.
Doug Binks3fd70cc2018-09-08 17:16:07 +02001964 * @param[out] width Where to store the monitor width, or `NULL`.
1965 * @param[out] height Where to store the monitor height, or `NULL`.
Felipe Ferreira da Silvabe295cc2017-04-06 16:48:08 -03001966 *
1967 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
1968 * GLFW_PLATFORM_ERROR.
1969 *
1970 * @thread_safety This function must only be called from the main thread.
1971 *
Camilla Löwya43d1a42019-02-25 14:46:48 +01001972 * @sa @ref monitor_workarea
Felipe Ferreira da Silvabe295cc2017-04-06 16:48:08 -03001973 *
Doug Binks69076292018-09-08 17:24:20 +02001974 * @since Added in version 3.3.
Felipe Ferreira da Silvabe295cc2017-04-06 16:48:08 -03001975 *
1976 * @ingroup monitor
1977 */
Camilla Löwy01187432019-02-25 14:01:08 +01001978GLFWAPI void glfwGetMonitorWorkarea(GLFWmonitor* monitor, int* xpos, int* ypos, int* width, int* height);
Felipe Ferreira da Silvabe295cc2017-04-06 16:48:08 -03001979
Camilla Berglundee5f30e2013-01-24 19:10:17 +01001980/*! @brief Returns the physical size of the monitor.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001981 *
1982 * This function returns the size, in millimetres, of the display area of the
1983 * specified monitor.
1984 *
Camilla Berglund4188c262015-01-18 01:55:25 +01001985 * Some systems do not provide accurate monitor size information, either
1986 * because the monitor
1987 * [EDID](https://en.wikipedia.org/wiki/Extended_display_identification_data)
1988 * data is incorrect or because the driver does not report it accurately.
1989 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001990 * Any or all of the size arguments may be `NULL`. If an error occurs, all
1991 * non-`NULL` size arguments will be set to zero.
1992 *
Camilla Berglundee5f30e2013-01-24 19:10:17 +01001993 * @param[in] monitor The monitor to query.
Camilla Berglundce8f97c2015-01-11 23:33:14 +01001994 * @param[out] widthMM Where to store the width, in millimetres, of the
1995 * monitor's display area, or `NULL`.
1996 * @param[out] heightMM Where to store the height, in millimetres, of the
1997 * monitor's display area, or `NULL`.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001998 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001999 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
2000 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002001 * @remark @win32 calculates the returned physical size from the
Camilla Berglund4188c262015-01-18 01:55:25 +01002002 * current resolution and system DPI instead of querying the monitor EDID data.
Camilla Berglund0e205772014-03-24 11:58:35 +01002003 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002004 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002005 *
2006 * @sa @ref monitor_properties
2007 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002008 * @since Added in version 3.0.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002009 *
Camilla Berglundee5f30e2013-01-24 19:10:17 +01002010 * @ingroup monitor
2011 */
Camilla Berglundce8f97c2015-01-11 23:33:14 +01002012GLFWAPI void glfwGetMonitorPhysicalSize(GLFWmonitor* monitor, int* widthMM, int* heightMM);
Camilla Berglund41bc0d12012-11-27 16:55:04 +01002013
Camilla Löwy16bf8722017-08-29 19:19:00 +02002014/*! @brief Retrieves the content scale for the specified monitor.
2015 *
2016 * This function retrieves the content scale for the specified monitor. The
2017 * content scale is the ratio between the current DPI and the platform's
Camilla Löwy422bf792019-04-01 18:36:30 +02002018 * default DPI. This is especially important for text and any UI elements. If
2019 * the pixel dimensions of your UI scaled by this look appropriate on your
2020 * machine then it should appear at a reasonable size on other machines
2021 * regardless of their DPI and scaling settings. This relies on the system DPI
2022 * and scaling settings being somewhat correct.
Camilla Löwy16bf8722017-08-29 19:19:00 +02002023 *
2024 * The content scale may depend on both the monitor resolution and pixel
2025 * density and on user settings. It may be very different from the raw DPI
2026 * calculated from the physical size and current resolution.
2027 *
2028 * @param[in] monitor The monitor to query.
2029 * @param[out] xscale Where to store the x-axis content scale, or `NULL`.
2030 * @param[out] yscale Where to store the y-axis content scale, or `NULL`.
2031 *
2032 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2033 * GLFW_PLATFORM_ERROR.
2034 *
2035 * @thread_safety This function must only be called from the main thread.
2036 *
2037 * @sa @ref monitor_scale
2038 * @sa @ref glfwGetWindowContentScale
2039 *
2040 * @since Added in version 3.3.
2041 *
2042 * @ingroup monitor
2043 */
2044GLFWAPI void glfwGetMonitorContentScale(GLFWmonitor* monitor, float* xscale, float* yscale);
2045
Camilla Berglund5f68e122012-11-27 17:07:28 +01002046/*! @brief Returns the name of the specified monitor.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002047 *
2048 * This function returns a human-readable name, encoded as UTF-8, of the
Camilla Berglund4591ad22014-09-18 15:03:29 +02002049 * specified monitor. The name typically reflects the make and model of the
2050 * monitor and is not guaranteed to be unique among the connected monitors.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002051 *
Camilla Berglund5f68e122012-11-27 17:07:28 +01002052 * @param[in] monitor The monitor to query.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002053 * @return The UTF-8 encoded name of the monitor, or `NULL` if an
2054 * [error](@ref error_handling) occurred.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002055 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002056 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
2057 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002058 * @pointer_lifetime The returned string is allocated and freed by GLFW. You
2059 * should not free it yourself. It is valid until the specified monitor is
2060 * disconnected or the library is terminated.
Camilla Berglund0e205772014-03-24 11:58:35 +01002061 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002062 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002063 *
2064 * @sa @ref monitor_properties
2065 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002066 * @since Added in version 3.0.
Camilla Berglundc3bb5c92013-06-05 16:04:04 +02002067 *
Camilla Berglund5f68e122012-11-27 17:07:28 +01002068 * @ingroup monitor
Camilla Berglund41bc0d12012-11-27 16:55:04 +01002069 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01002070GLFWAPI const char* glfwGetMonitorName(GLFWmonitor* monitor);
Camilla Berglund41bc0d12012-11-27 16:55:04 +01002071
Camilla Löwy7c2c7852017-12-07 16:19:57 +01002072/*! @brief Sets the user pointer of the specified monitor.
2073 *
2074 * This function sets the user-defined pointer of the specified monitor. The
2075 * current value is retained until the monitor is disconnected. The initial
2076 * value is `NULL`.
2077 *
2078 * This function may be called from the monitor callback, even for a monitor
2079 * that is being disconnected.
2080 *
2081 * @param[in] monitor The monitor whose pointer to set.
2082 * @param[in] pointer The new value.
2083 *
2084 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
2085 *
2086 * @thread_safety This function may be called from any thread. Access is not
2087 * synchronized.
2088 *
2089 * @sa @ref monitor_userptr
2090 * @sa @ref glfwGetMonitorUserPointer
2091 *
2092 * @since Added in version 3.3.
2093 *
2094 * @ingroup monitor
2095 */
2096GLFWAPI void glfwSetMonitorUserPointer(GLFWmonitor* monitor, void* pointer);
2097
2098/*! @brief Returns the user pointer of the specified monitor.
2099 *
2100 * This function returns the current value of the user-defined pointer of the
2101 * specified monitor. The initial value is `NULL`.
2102 *
2103 * This function may be called from the monitor callback, even for a monitor
2104 * that is being disconnected.
2105 *
2106 * @param[in] monitor The monitor whose pointer to return.
2107 *
2108 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
2109 *
2110 * @thread_safety This function may be called from any thread. Access is not
2111 * synchronized.
2112 *
2113 * @sa @ref monitor_userptr
2114 * @sa @ref glfwSetMonitorUserPointer
2115 *
2116 * @since Added in version 3.3.
2117 *
2118 * @ingroup monitor
2119 */
2120GLFWAPI void* glfwGetMonitorUserPointer(GLFWmonitor* monitor);
2121
Camilla Berglund5f68e122012-11-27 17:07:28 +01002122/*! @brief Sets the monitor configuration callback.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002123 *
2124 * This function sets the monitor configuration callback, or removes the
2125 * currently set callback. This is called when a monitor is connected to or
2126 * disconnected from the system.
2127 *
Camilla Berglund71d2b572013-03-12 15:33:05 +01002128 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
Camilla Berglunddba2d802013-01-17 23:06:56 +01002129 * callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02002130 * @return The previously set callback, or `NULL` if no callback was set or the
2131 * library had not been [initialized](@ref intro_init).
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002132 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002133 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
2134 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002135 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002136 *
2137 * @sa @ref monitor_event
2138 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002139 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002140 *
Camilla Berglund5f68e122012-11-27 17:07:28 +01002141 * @ingroup monitor
Camilla Berglund41bc0d12012-11-27 16:55:04 +01002142 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02002143GLFWAPI GLFWmonitorfun glfwSetMonitorCallback(GLFWmonitorfun cbfun);
Marcel Metzbeacbb32011-05-07 10:53:50 +02002144
Camilla Berglund41bc0d12012-11-27 16:55:04 +01002145/*! @brief Returns the available video modes for the specified monitor.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002146 *
2147 * This function returns an array of all video modes supported by the specified
Camilla Berglund948cc042013-04-16 02:02:22 +02002148 * monitor. The returned array is sorted in ascending order, first by color
2149 * bit depth (the sum of all channel depths) and then by resolution area (the
2150 * product of width and height).
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002151 *
Camilla Berglund5f68e122012-11-27 17:07:28 +01002152 * @param[in] monitor The monitor to query.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02002153 * @param[out] count Where to store the number of video modes in the returned
2154 * array. This is set to zero if an error occurred.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002155 * @return An array of video modes, or `NULL` if an
2156 * [error](@ref error_handling) occurred.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002157 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002158 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2159 * GLFW_PLATFORM_ERROR.
2160 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002161 * @pointer_lifetime The returned array is allocated and freed by GLFW. You
2162 * should not free it yourself. It is valid until the specified monitor is
2163 * disconnected, this function is called again for that monitor or the library
2164 * is terminated.
Camilla Berglund0e205772014-03-24 11:58:35 +01002165 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002166 * @thread_safety This function must only be called from the main thread.
Camilla Berglundc3bb5c92013-06-05 16:04:04 +02002167 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002168 * @sa @ref monitor_modes
Camilla Berglund7e9e3212016-09-14 20:17:26 +02002169 * @sa @ref glfwGetVideoMode
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002170 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002171 * @since Added in version 1.0.
Camilla Berglund951a9582016-01-31 21:32:14 +01002172 * @glfw3 Changed to return an array of modes for a specific monitor.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002173 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002174 * @ingroup monitor
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002175 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01002176GLFWAPI const GLFWvidmode* glfwGetVideoModes(GLFWmonitor* monitor, int* count);
Camilla Berglund41bc0d12012-11-27 16:55:04 +01002177
Camilla Berglund5f68e122012-11-27 17:07:28 +01002178/*! @brief Returns the current mode of the specified monitor.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002179 *
Camilla Berglund948cc042013-04-16 02:02:22 +02002180 * This function returns the current video mode of the specified monitor. If
Camilla Berglund4591ad22014-09-18 15:03:29 +02002181 * you have created a full screen window for that monitor, the return value
2182 * will depend on whether that window is iconified.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002183 *
Camilla Berglund5f68e122012-11-27 17:07:28 +01002184 * @param[in] monitor The monitor to query.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002185 * @return The current mode of the monitor, or `NULL` if an
2186 * [error](@ref error_handling) occurred.
Camilla Berglunddba2d802013-01-17 23:06:56 +01002187 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002188 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2189 * GLFW_PLATFORM_ERROR.
2190 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002191 * @pointer_lifetime The returned array is allocated and freed by GLFW. You
2192 * should not free it yourself. It is valid until the specified monitor is
2193 * disconnected or the library is terminated.
Camilla Berglund0e205772014-03-24 11:58:35 +01002194 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002195 * @thread_safety This function must only be called from the main thread.
Camilla Berglundc3bb5c92013-06-05 16:04:04 +02002196 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002197 * @sa @ref monitor_modes
Camilla Berglund7e9e3212016-09-14 20:17:26 +02002198 * @sa @ref glfwGetVideoModes
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002199 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002200 * @since Added in version 3.0. Replaces `glfwGetDesktopMode`.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002201 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002202 * @ingroup monitor
Camilla Berglund41bc0d12012-11-27 16:55:04 +01002203 */
Camilla Berglundce1e84d2013-05-22 22:16:43 +02002204GLFWAPI const GLFWvidmode* glfwGetVideoMode(GLFWmonitor* monitor);
Camilla Berglund3249f812010-09-07 17:34:51 +02002205
Camilla Berglund92a71e02013-02-12 13:50:41 +01002206/*! @brief Generates a gamma ramp and sets it for the specified monitor.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002207 *
Camilla Löwy3531c322018-12-17 17:40:18 +01002208 * This function generates an appropriately sized gamma ramp from the specified
2209 * exponent and then calls @ref glfwSetGammaRamp with it. The value must be
2210 * a finite number greater than zero.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002211 *
Camilla Löwyce161c22016-12-06 01:14:23 +01002212 * The software controlled gamma ramp is applied _in addition_ to the hardware
2213 * gamma correction, which today is usually an approximation of sRGB gamma.
2214 * This means that setting a perfectly linear ramp, or gamma 1.0, will produce
2215 * the default (usually sRGB-like) behavior.
2216 *
2217 * For gamma correct rendering with OpenGL or OpenGL ES, see the @ref
2218 * GLFW_SRGB_CAPABLE hint.
2219 *
Camilla Berglund92a71e02013-02-12 13:50:41 +01002220 * @param[in] monitor The monitor whose gamma ramp to set.
Camilla Berglunda3ff29a2012-12-02 15:47:10 +01002221 * @param[in] gamma The desired exponent.
Camilla Berglunddba2d802013-01-17 23:06:56 +01002222 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002223 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
2224 * GLFW_INVALID_VALUE and @ref GLFW_PLATFORM_ERROR.
2225 *
Emmanuel Gil Peyrot9c513342017-11-17 12:17:43 +00002226 * @remark @wayland Gamma handling is a priviledged protocol, this function
2227 * will thus never be implemented and emits @ref GLFW_PLATFORM_ERROR.
linkmauvebc8b0482016-10-16 15:52:39 +01002228 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002229 * @thread_safety This function must only be called from the main thread.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02002230 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002231 * @sa @ref monitor_gamma
2232 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002233 * @since Added in version 3.0.
Camilla Berglund0e205772014-03-24 11:58:35 +01002234 *
Camilla Berglundf5f55e32013-06-17 12:56:36 +02002235 * @ingroup monitor
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002236 */
Camilla Berglund92a71e02013-02-12 13:50:41 +01002237GLFWAPI void glfwSetGamma(GLFWmonitor* monitor, float gamma);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002238
Camilla Berglund4591ad22014-09-18 15:03:29 +02002239/*! @brief Returns the current gamma ramp for the specified monitor.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002240 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002241 * This function returns the current gamma ramp of the specified monitor.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002242 *
Camilla Berglund92a71e02013-02-12 13:50:41 +01002243 * @param[in] monitor The monitor to query.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002244 * @return The current gamma ramp, or `NULL` if an
2245 * [error](@ref error_handling) occurred.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002246 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002247 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2248 * GLFW_PLATFORM_ERROR.
2249 *
Emmanuel Gil Peyrot9c513342017-11-17 12:17:43 +00002250 * @remark @wayland Gamma handling is a priviledged protocol, this function
2251 * will thus never be implemented and emits @ref GLFW_PLATFORM_ERROR while
2252 * returning `NULL`.
linkmauvebc8b0482016-10-16 15:52:39 +01002253 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002254 * @pointer_lifetime The returned structure and its arrays are allocated and
2255 * freed by GLFW. You should not free them yourself. They are valid until the
2256 * specified monitor is disconnected, this function is called again for that
2257 * monitor or the library is terminated.
Camilla Berglund0e205772014-03-24 11:58:35 +01002258 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002259 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002260 *
2261 * @sa @ref monitor_gamma
2262 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002263 * @since Added in version 3.0.
Camilla Berglundc3bb5c92013-06-05 16:04:04 +02002264 *
Camilla Berglundf5f55e32013-06-17 12:56:36 +02002265 * @ingroup monitor
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002266 */
Camilla Berglund5d308db2013-05-19 15:46:44 +02002267GLFWAPI const GLFWgammaramp* glfwGetGammaRamp(GLFWmonitor* monitor);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002268
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002269/*! @brief Sets the current gamma ramp for the specified monitor.
2270 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002271 * This function sets the current gamma ramp for the specified monitor. The
2272 * original gamma ramp for that monitor is saved by GLFW the first time this
2273 * function is called and is restored by @ref glfwTerminate.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002274 *
Camilla Löwyce161c22016-12-06 01:14:23 +01002275 * The software controlled gamma ramp is applied _in addition_ to the hardware
2276 * gamma correction, which today is usually an approximation of sRGB gamma.
2277 * This means that setting a perfectly linear ramp, or gamma 1.0, will produce
2278 * the default (usually sRGB-like) behavior.
2279 *
2280 * For gamma correct rendering with OpenGL or OpenGL ES, see the @ref
2281 * GLFW_SRGB_CAPABLE hint.
2282 *
Camilla Berglund92a71e02013-02-12 13:50:41 +01002283 * @param[in] monitor The monitor whose gamma ramp to set.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002284 * @param[in] ramp The gamma ramp to use.
Camilla Berglund8954af62013-02-20 19:44:52 +01002285 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002286 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2287 * GLFW_PLATFORM_ERROR.
2288 *
Camilla Löwy3531c322018-12-17 17:40:18 +01002289 * @remark The size of the specified gamma ramp should match the size of the
2290 * current ramp for that monitor.
Camilla Berglund76fff4d2015-03-10 19:02:28 +01002291 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002292 * @remark @win32 The gamma ramp size must be 256.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002293 *
Emmanuel Gil Peyrot9c513342017-11-17 12:17:43 +00002294 * @remark @wayland Gamma handling is a priviledged protocol, this function
2295 * will thus never be implemented and emits @ref GLFW_PLATFORM_ERROR.
linkmauvebc8b0482016-10-16 15:52:39 +01002296 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002297 * @pointer_lifetime The specified gamma ramp is copied before this function
2298 * returns.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002299 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002300 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002301 *
2302 * @sa @ref monitor_gamma
2303 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002304 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002305 *
Camilla Berglundf5f55e32013-06-17 12:56:36 +02002306 * @ingroup monitor
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002307 */
Camilla Berglund92a71e02013-02-12 13:50:41 +01002308GLFWAPI void glfwSetGammaRamp(GLFWmonitor* monitor, const GLFWgammaramp* ramp);
Camilla Berglund2630d492010-10-13 04:04:43 +02002309
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002310/*! @brief Resets all window hints to their default values.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002311 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002312 * This function resets all window hints to their
Camilla Berglunde248fb62013-03-29 14:06:23 +01002313 * [default values](@ref window_hints_values).
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002314 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002315 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
2316 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002317 * @thread_safety This function must only be called from the main thread.
Camilla Berglund9ad1d972012-11-22 19:08:30 +01002318 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002319 * @sa @ref window_hints
Camilla Berglund7e9e3212016-09-14 20:17:26 +02002320 * @sa @ref glfwWindowHint
Camilla Löwy61588012017-12-12 10:54:18 +01002321 * @sa @ref glfwWindowHintString
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002322 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002323 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002324 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002325 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002326 */
Camilla Berglund5df4df62012-10-22 02:59:05 +02002327GLFWAPI void glfwDefaultWindowHints(void);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002328
2329/*! @brief Sets the specified window hint to the desired value.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002330 *
Camilla Berglunded9e4032012-12-23 15:59:09 +01002331 * This function sets hints for the next call to @ref glfwCreateWindow. The
Camilla Löwy61588012017-12-12 10:54:18 +01002332 * hints, once set, retain their values until changed by a call to this
2333 * function or @ref glfwDefaultWindowHints, or until the library is terminated.
2334 *
2335 * Only integer value hints can be set with this function. String value hints
2336 * are set with @ref glfwWindowHintString.
Camilla Berglunded9e4032012-12-23 15:59:09 +01002337 *
Camilla Berglundd6e0a432016-02-09 07:41:48 +01002338 * This function does not check whether the specified hint values are valid.
2339 * If you set hints to invalid values this will instead be reported by the next
2340 * call to @ref glfwCreateWindow.
2341 *
Camilla Löwy61588012017-12-12 10:54:18 +01002342 * Some hints are platform specific. These may be set on any platform but they
2343 * will only affect their specific platform. Other platforms will ignore them.
2344 * Setting these hints requires no platform specific headers or functions.
2345 *
Camilla Berglundd0649e62016-01-27 03:25:21 +01002346 * @param[in] hint The [window hint](@ref window_hints) to set.
2347 * @param[in] value The new value of the window hint.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002348 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002349 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2350 * GLFW_INVALID_ENUM.
2351 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002352 * @thread_safety This function must only be called from the main thread.
Camilla Berglund401033c2013-03-12 19:17:07 +01002353 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002354 * @sa @ref window_hints
Camilla Löwy61588012017-12-12 10:54:18 +01002355 * @sa @ref glfwWindowHintString
Camilla Berglund7e9e3212016-09-14 20:17:26 +02002356 * @sa @ref glfwDefaultWindowHints
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002357 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002358 * @since Added in version 3.0. Replaces `glfwOpenWindowHint`.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002359 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002360 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002361 */
Camilla Berglundd0649e62016-01-27 03:25:21 +01002362GLFWAPI void glfwWindowHint(int hint, int value);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002363
Camilla Löwy61588012017-12-12 10:54:18 +01002364/*! @brief Sets the specified window hint to the desired value.
2365 *
2366 * This function sets hints for the next call to @ref glfwCreateWindow. The
2367 * hints, once set, retain their values until changed by a call to this
2368 * function or @ref glfwDefaultWindowHints, or until the library is terminated.
2369 *
2370 * Only string type hints can be set with this function. Integer value hints
2371 * are set with @ref glfwWindowHint.
2372 *
2373 * This function does not check whether the specified hint values are valid.
2374 * If you set hints to invalid values this will instead be reported by the next
2375 * call to @ref glfwCreateWindow.
2376 *
2377 * Some hints are platform specific. These may be set on any platform but they
2378 * will only affect their specific platform. Other platforms will ignore them.
2379 * Setting these hints requires no platform specific headers or functions.
2380 *
2381 * @param[in] hint The [window hint](@ref window_hints) to set.
2382 * @param[in] value The new value of the window hint.
2383 *
2384 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2385 * GLFW_INVALID_ENUM.
2386 *
2387 * @pointer_lifetime The specified string is copied before this function
2388 * returns.
2389 *
2390 * @thread_safety This function must only be called from the main thread.
2391 *
2392 * @sa @ref window_hints
2393 * @sa @ref glfwWindowHint
2394 * @sa @ref glfwDefaultWindowHints
2395 *
2396 * @since Added in version 3.3.
2397 *
2398 * @ingroup window
2399 */
2400GLFWAPI void glfwWindowHintString(int hint, const char* value);
2401
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002402/*! @brief Creates a window and its associated context.
2403 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002404 * This function creates a window and its associated OpenGL or OpenGL ES
2405 * context. Most of the options controlling how the window and its context
2406 * should be created are specified with [window hints](@ref window_hints).
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002407 *
2408 * Successful creation does not change which context is current. Before you
Camilla Berglund4591ad22014-09-18 15:03:29 +02002409 * can use the newly created context, you need to
2410 * [make it current](@ref context_current). For information about the `share`
2411 * parameter, see @ref context_sharing.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002412 *
Camilla Berglunde8e05d42014-04-23 13:30:11 +02002413 * The created window, framebuffer and context may differ from what you
2414 * requested, as not all parameters and hints are
Camilla Berglundfa0cbd92013-04-11 01:07:07 +02002415 * [hard constraints](@ref window_hints_hard). This includes the size of the
Camilla Berglund4591ad22014-09-18 15:03:29 +02002416 * window, especially for full screen windows. To query the actual attributes
Camilla Berglunde8bceaa2015-04-07 14:37:42 +02002417 * of the created window, framebuffer and context, see @ref
2418 * glfwGetWindowAttrib, @ref glfwGetWindowSize and @ref glfwGetFramebufferSize.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002419 *
Camilla Berglunde8e05d42014-04-23 13:30:11 +02002420 * To create a full screen window, you need to specify the monitor the window
Camilla Berglund6570d0c2016-02-23 12:26:42 +01002421 * will cover. If no monitor is specified, the window will be windowed mode.
2422 * Unless you have a way for the user to choose a specific monitor, it is
2423 * recommended that you pick the primary monitor. For more information on how
2424 * to query connected monitors, see @ref monitor_monitors.
Camilla Berglund4b7ae492013-07-07 12:06:59 +02002425 *
Camilla Berglund95654cf2014-10-02 17:35:10 +02002426 * For full screen windows, the specified size becomes the resolution of the
Camilla Berglund6570d0c2016-02-23 12:26:42 +01002427 * window's _desired video mode_. As long as a full screen window is not
2428 * iconified, the supported video mode most closely matching the desired video
2429 * mode is set for the specified monitor. For more information about full
2430 * screen windows, including the creation of so called _windowed full screen_
2431 * or _borderless full screen_ windows, see @ref window_windowed_full_screen.
Camilla Berglund95654cf2014-10-02 17:35:10 +02002432 *
Camilla Berglund999f3552016-08-17 16:48:22 +02002433 * Once you have created the window, you can switch it between windowed and
Camilla Berglunde83be1d2016-11-08 12:19:06 +01002434 * full screen mode with @ref glfwSetWindowMonitor. This will not affect its
2435 * OpenGL or OpenGL ES context.
Camilla Berglund999f3552016-08-17 16:48:22 +02002436 *
Camilla Berglunde8e05d42014-04-23 13:30:11 +02002437 * By default, newly created windows use the placement recommended by the
2438 * window system. To create the window at a specific position, make it
Camilla Löwyce161c22016-12-06 01:14:23 +01002439 * initially invisible using the [GLFW_VISIBLE](@ref GLFW_VISIBLE_hint) window
Camilla Berglundce8f97c2015-01-11 23:33:14 +01002440 * hint, set its [position](@ref window_pos) and then [show](@ref window_hide)
2441 * it.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02002442 *
Camilla Berglund6570d0c2016-02-23 12:26:42 +01002443 * As long as at least one full screen window is not iconified, the screensaver
2444 * is prohibited from starting.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02002445 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002446 * Window systems put limits on window sizes. Very large or very small window
2447 * dimensions may be overridden by the window system on creation. Check the
Camilla Berglund95654cf2014-10-02 17:35:10 +02002448 * actual [size](@ref window_size) after creation.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002449 *
Camilla Berglund4188c262015-01-18 01:55:25 +01002450 * The [swap interval](@ref buffer_swap) is not set during window creation and
Camilla Berglund4591ad22014-09-18 15:03:29 +02002451 * the initial value may vary depending on driver settings and defaults.
2452 *
Camilla Berglund8282a8f2013-04-10 23:01:12 +02002453 * @param[in] width The desired width, in screen coordinates, of the window.
2454 * This must be greater than zero.
2455 * @param[in] height The desired height, in screen coordinates, of the window.
2456 * This must be greater than zero.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002457 * @param[in] title The initial, UTF-8 encoded window title.
Camilla Berglund6570d0c2016-02-23 12:26:42 +01002458 * @param[in] monitor The monitor to use for full screen mode, or `NULL` for
Camilla Berglund41bc0d12012-11-27 16:55:04 +01002459 * windowed mode.
Camilla Berglund71d2b572013-03-12 15:33:05 +01002460 * @param[in] share The window whose context to share resources with, or `NULL`
2461 * to not share resources.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002462 * @return The handle of the created window, or `NULL` if an
2463 * [error](@ref error_handling) occurred.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002464 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002465 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
2466 * GLFW_INVALID_ENUM, @ref GLFW_INVALID_VALUE, @ref GLFW_API_UNAVAILABLE, @ref
2467 * GLFW_VERSION_UNAVAILABLE, @ref GLFW_FORMAT_UNAVAILABLE and @ref
2468 * GLFW_PLATFORM_ERROR.
2469 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002470 * @remark @win32 Window creation will fail if the Microsoft GDI software
2471 * OpenGL implementation is the only one available.
Camilla Berglund07db5da2013-09-26 19:15:36 +02002472 *
Camilla Berglund20bce152016-05-30 16:04:37 +02002473 * @remark @win32 If the executable has an icon resource named `GLFW_ICON,` it
2474 * will be set as the initial icon for the window. If no such icon is present,
Camilla Löwyd73ab0b2017-11-16 10:08:38 +01002475 * the `IDI_APPLICATION` icon will be used instead. To set a different icon,
2476 * see @ref glfwSetWindowIcon.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002477 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002478 * @remark @win32 The context to share resources with must not be current on
2479 * any other thread.
Camilla Berglundb19fb4c2014-12-27 21:14:41 +01002480 *
Camilla Löwyfd127d52016-12-03 19:32:00 +01002481 * @remark @macos The OS only supports forward-compatible core profile contexts
2482 * for OpenGL versions 3.2 and later. Before creating an OpenGL context of
2483 * version 3.2 or later you must set the
Camilla Löwyce161c22016-12-06 01:14:23 +01002484 * [GLFW_OPENGL_FORWARD_COMPAT](@ref GLFW_OPENGL_FORWARD_COMPAT_hint) and
2485 * [GLFW_OPENGL_PROFILE](@ref GLFW_OPENGL_PROFILE_hint) hints accordingly.
2486 * OpenGL 3.0 and 3.1 contexts are not supported at all on macOS.
Camilla Löwyfd127d52016-12-03 19:32:00 +01002487 *
Camilla Berglund8d6f2652016-10-20 00:50:54 +02002488 * @remark @macos The GLFW window has no icon, as it is not a document
Camilla Berglund71d2b572013-03-12 15:33:05 +01002489 * window, but the dock icon will be the same as the application bundle's icon.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002490 * For more information on bundles, see the
Camilla Berglunde8e05d42014-04-23 13:30:11 +02002491 * [Bundle Programming Guide](https://developer.apple.com/library/mac/documentation/CoreFoundation/Conceptual/CFBundles/)
2492 * in the Mac Developer Library.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002493 *
Camilla Löwyc50aba12017-03-01 04:09:51 +01002494 * @remark @macos The first time a window is created the menu bar is created.
2495 * If GLFW finds a `MainMenu.nib` it is loaded and assumed to contain a menu
2496 * bar. Otherwise a minimal menu bar is created manually with common commands
2497 * like Hide, Quit and About. The About entry opens a minimal about dialog
2498 * with information from the application's bundle. Menu bar creation can be
2499 * disabled entirely with the @ref GLFW_COCOA_MENUBAR init hint.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002500 *
Camilla Berglund8d6f2652016-10-20 00:50:54 +02002501 * @remark @macos On OS X 10.10 and later the window frame will not be rendered
Camilla Löwy58ceab52016-12-07 00:41:54 +01002502 * at full resolution on Retina displays unless the
2503 * [GLFW_COCOA_RETINA_FRAMEBUFFER](@ref GLFW_COCOA_RETINA_FRAMEBUFFER_hint)
2504 * hint is `GLFW_TRUE` and the `NSHighResolutionCapable` key is enabled in the
2505 * application bundle's `Info.plist`. For more information, see
Camilla Berglund821f3e62015-03-16 22:39:14 +01002506 * [High Resolution Guidelines for OS X](https://developer.apple.com/library/mac/documentation/GraphicsAnimation/Conceptual/HighResolutionOSX/Explained/Explained.html)
Camilla Berglundd12b3432015-07-21 17:42:01 +02002507 * in the Mac Developer Library. The GLFW test and example programs use
2508 * a custom `Info.plist` template for this, which can be found as
2509 * `CMake/MacOSXBundleInfo.plist.in` in the source tree.
Camilla Berglund821f3e62015-03-16 22:39:14 +01002510 *
Camilla Löwy46613152017-01-01 19:41:50 +01002511 * @remark @macos When activating frame autosaving with
Camilla Löwy9da22852017-12-12 16:45:38 +01002512 * [GLFW_COCOA_FRAME_NAME](@ref GLFW_COCOA_FRAME_NAME_hint), the specified
2513 * window size and position may be overriden by previously saved values.
Camilla Löwy46613152017-01-01 19:41:50 +01002514 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002515 * @remark @x11 Some window managers will not respect the placement of
Camilla Berglunde8e05d42014-04-23 13:30:11 +02002516 * initially hidden windows.
Camilla Berglund3af1c412013-09-19 21:37:01 +02002517 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002518 * @remark @x11 Due to the asynchronous nature of X11, it may take a moment for
2519 * a window to reach its requested state. This means you may not be able to
2520 * query the final size, position or other attributes directly after window
2521 * creation.
Camilla Berglund20ed0a12015-08-12 21:31:54 +02002522 *
Camilla Löwy61588012017-12-12 10:54:18 +01002523 * @remark @x11 The class part of the `WM_CLASS` window property will by
2524 * default be set to the window title passed to this function. The instance
2525 * part will use the contents of the `RESOURCE_NAME` environment variable, if
Camilla Löwy422bf792019-04-01 18:36:30 +02002526 * present and not empty, or fall back to the window title. Set the
2527 * [GLFW_X11_CLASS_NAME](@ref GLFW_X11_CLASS_NAME_hint) and
2528 * [GLFW_X11_INSTANCE_NAME](@ref GLFW_X11_INSTANCE_NAME_hint) window hints to
2529 * override this.
Camilla Löwy213dd2d2017-07-25 01:55:08 +02002530 *
Emmanuel Gil Peyrotbcd8f9a2019-02-15 19:02:32 +01002531 * @remark @wayland Compositors should implement the xdg-decoration protocol
2532 * for GLFW to decorate the window properly. If this protocol isn't
2533 * supported, or if the compositor prefers client-side decorations, a very
2534 * simple fallback frame will be drawn using the wp_viewporter protocol. A
2535 * compositor can still emit close, maximize or fullscreen events, using for
2536 * instance a keybind mechanism. If neither of these protocols is supported,
2537 * the window won't be decorated.
linkmauvebc8b0482016-10-16 15:52:39 +01002538 *
2539 * @remark @wayland A full screen window will not attempt to change the mode,
2540 * no matter what the requested size or refresh rate.
2541 *
Emmanuel Gil Peyrot65166852017-02-17 15:52:50 +00002542 * @remark @wayland Screensaver inhibition requires the idle-inhibit protocol
2543 * to be implemented in the user's compositor.
linkmauvebc8b0482016-10-16 15:52:39 +01002544 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002545 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002546 *
2547 * @sa @ref window_creation
Camilla Berglund7e9e3212016-09-14 20:17:26 +02002548 * @sa @ref glfwDestroyWindow
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002549 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002550 * @since Added in version 3.0. Replaces `glfwOpenWindow`.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002551 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002552 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002553 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01002554GLFWAPI GLFWwindow* glfwCreateWindow(int width, int height, const char* title, GLFWmonitor* monitor, GLFWwindow* share);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002555
2556/*! @brief Destroys the specified window and its context.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002557 *
2558 * This function destroys the specified window and its context. On calling
2559 * this function, no further callbacks will be called for that window.
2560 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002561 * If the context of the specified window is current on the main thread, it is
2562 * detached before being destroyed.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002563 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002564 * @param[in] window The window to destroy.
Camilla Berglund9ad1d972012-11-22 19:08:30 +01002565 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002566 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2567 * GLFW_PLATFORM_ERROR.
2568 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002569 * @note The context of the specified window must not be current on any other
2570 * thread when this function is called.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002571 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002572 * @reentrancy This function must not be called from a callback.
Camilla Berglund44372b82014-12-17 01:31:36 +01002573 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002574 * @thread_safety This function must only be called from the main thread.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002575 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002576 * @sa @ref window_creation
Camilla Berglund7e9e3212016-09-14 20:17:26 +02002577 * @sa @ref glfwCreateWindow
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002578 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002579 * @since Added in version 3.0. Replaces `glfwCloseWindow`.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002580 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002581 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002582 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01002583GLFWAPI void glfwDestroyWindow(GLFWwindow* window);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002584
Camilla Berglund64afb192013-03-06 23:29:37 +01002585/*! @brief Checks the close flag of the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002586 *
2587 * This function returns the value of the close flag of the specified window.
2588 *
Camilla Berglund6fadf372013-03-01 13:45:12 +01002589 * @param[in] window The window to query.
Camilla Berglund64afb192013-03-06 23:29:37 +01002590 * @return The value of the close flag.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002591 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002592 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
2593 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002594 * @thread_safety This function may be called from any thread. Access is not
2595 * synchronized.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002596 *
2597 * @sa @ref window_close
2598 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002599 * @since Added in version 3.0.
Camilla Berglund6632cc72013-07-11 02:00:48 +02002600 *
Camilla Berglund6fadf372013-03-01 13:45:12 +01002601 * @ingroup window
2602 */
2603GLFWAPI int glfwWindowShouldClose(GLFWwindow* window);
2604
Camilla Berglund64afb192013-03-06 23:29:37 +01002605/*! @brief Sets the close flag of the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002606 *
2607 * This function sets the value of the close flag of the specified window.
2608 * This can be used to override the user's attempt to close the window, or
2609 * to signal that it should be closed.
2610 *
Camilla Berglund64afb192013-03-06 23:29:37 +01002611 * @param[in] window The window whose flag to change.
Camilla Berglund6fadf372013-03-01 13:45:12 +01002612 * @param[in] value The new value.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002613 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002614 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
2615 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002616 * @thread_safety This function may be called from any thread. Access is not
2617 * synchronized.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002618 *
2619 * @sa @ref window_close
2620 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002621 * @since Added in version 3.0.
Camilla Berglund6632cc72013-07-11 02:00:48 +02002622 *
Camilla Berglund6fadf372013-03-01 13:45:12 +01002623 * @ingroup window
Camilla Berglund6fadf372013-03-01 13:45:12 +01002624 */
2625GLFWAPI void glfwSetWindowShouldClose(GLFWwindow* window, int value);
2626
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002627/*! @brief Sets the title of the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002628 *
2629 * This function sets the window title, encoded as UTF-8, of the specified
2630 * window.
2631 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002632 * @param[in] window The window whose title to change.
2633 * @param[in] title The UTF-8 encoded window title.
Camilla Berglund9ad1d972012-11-22 19:08:30 +01002634 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002635 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2636 * GLFW_PLATFORM_ERROR.
2637 *
Camilla Berglund8d6f2652016-10-20 00:50:54 +02002638 * @remark @macos The window title will not be updated until the next time you
Camilla Berglund951a9582016-01-31 21:32:14 +01002639 * process events.
Camilla Berglund6412dcb2015-04-07 21:52:29 +02002640 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002641 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002642 *
2643 * @sa @ref window_title
2644 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002645 * @since Added in version 1.0.
Camilla Berglund951a9582016-01-31 21:32:14 +01002646 * @glfw3 Added window handle parameter.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002647 *
2648 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002649 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01002650GLFWAPI void glfwSetWindowTitle(GLFWwindow* window, const char* title);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002651
Camilla Berglundb823f712016-03-07 14:55:30 +01002652/*! @brief Sets the icon for the specified window.
2653 *
2654 * This function sets the icon of the specified window. If passed an array of
2655 * candidate images, those of or closest to the sizes desired by the system are
2656 * selected. If no images are specified, the window reverts to its default
2657 * icon.
2658 *
Camilla Löwybeaeb0d2017-06-06 18:17:58 +02002659 * The pixels are 32-bit, little-endian, non-premultiplied RGBA, i.e. eight
2660 * bits per channel with the red channel first. They are arranged canonically
2661 * as packed sequential rows, starting from the top-left corner.
2662 *
Camilla Berglundb823f712016-03-07 14:55:30 +01002663 * The desired image sizes varies depending on platform and system settings.
2664 * The selected images will be rescaled as needed. Good sizes include 16x16,
2665 * 32x32 and 48x48.
2666 *
2667 * @param[in] window The window whose icon to set.
2668 * @param[in] count The number of images in the specified array, or zero to
2669 * revert to the default window icon.
2670 * @param[in] images The images to create the icon from. This is ignored if
2671 * count is zero.
2672 *
2673 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2674 * GLFW_PLATFORM_ERROR.
2675 *
2676 * @pointer_lifetime The specified image data is copied before this function
2677 * returns.
2678 *
Camilla Berglund8d6f2652016-10-20 00:50:54 +02002679 * @remark @macos The GLFW window has no icon, as it is not a document
Camilla Berglund20bce152016-05-30 16:04:37 +02002680 * window, so this function does nothing. The dock icon will be the same as
2681 * the application bundle's icon. For more information on bundles, see the
Camilla Berglundb823f712016-03-07 14:55:30 +01002682 * [Bundle Programming Guide](https://developer.apple.com/library/mac/documentation/CoreFoundation/Conceptual/CFBundles/)
2683 * in the Mac Developer Library.
2684 *
Emmanuel Gil Peyrota1620042017-12-03 04:19:15 +01002685 * @remark @wayland There is no existing protocol to change an icon, the
2686 * window will thus inherit the one defined in the application's desktop file.
2687 * This function always emits @ref GLFW_PLATFORM_ERROR.
linkmauvebc8b0482016-10-16 15:52:39 +01002688 *
Camilla Berglundb823f712016-03-07 14:55:30 +01002689 * @thread_safety This function must only be called from the main thread.
2690 *
2691 * @sa @ref window_icon
2692 *
2693 * @since Added in version 3.2.
2694 *
2695 * @ingroup window
2696 */
2697GLFWAPI void glfwSetWindowIcon(GLFWwindow* window, int count, const GLFWimage* images);
2698
Camilla Löwyd5ab3e92019-01-22 20:54:16 +01002699/*! @brief Retrieves the position of the content area of the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002700 *
2701 * This function retrieves the position, in screen coordinates, of the
Camilla Löwyd5ab3e92019-01-22 20:54:16 +01002702 * upper-left corner of the content area of the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002703 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002704 * Any or all of the position arguments may be `NULL`. If an error occurs, all
2705 * non-`NULL` position arguments will be set to zero.
2706 *
Camilla Berglund7c193232013-01-24 19:30:31 +01002707 * @param[in] window The window to query.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02002708 * @param[out] xpos Where to store the x-coordinate of the upper-left corner of
Camilla Löwyd5ab3e92019-01-22 20:54:16 +01002709 * the content area, or `NULL`.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02002710 * @param[out] ypos Where to store the y-coordinate of the upper-left corner of
Camilla Löwyd5ab3e92019-01-22 20:54:16 +01002711 * the content area, or `NULL`.
Camilla Berglund7c193232013-01-24 19:30:31 +01002712 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002713 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2714 * GLFW_PLATFORM_ERROR.
2715 *
linkmauvebc8b0482016-10-16 15:52:39 +01002716 * @remark @wayland There is no way for an application to retrieve the global
2717 * position of its windows, this function will always emit @ref
2718 * GLFW_PLATFORM_ERROR.
2719 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002720 * @thread_safety This function must only be called from the main thread.
Camilla Berglund0e205772014-03-24 11:58:35 +01002721 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002722 * @sa @ref window_pos
Camilla Berglund7e9e3212016-09-14 20:17:26 +02002723 * @sa @ref glfwSetWindowPos
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002724 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002725 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002726 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002727 * @ingroup window
Camilla Berglund7c193232013-01-24 19:30:31 +01002728 */
2729GLFWAPI void glfwGetWindowPos(GLFWwindow* window, int* xpos, int* ypos);
2730
Camilla Löwyd5ab3e92019-01-22 20:54:16 +01002731/*! @brief Sets the position of the content area of the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002732 *
2733 * This function sets the position, in screen coordinates, of the upper-left
Camilla Löwyd5ab3e92019-01-22 20:54:16 +01002734 * corner of the content area of the specified windowed mode window. If the
Camilla Berglund4591ad22014-09-18 15:03:29 +02002735 * window is a full screen window, this function does nothing.
Camilla Berglund8282a8f2013-04-10 23:01:12 +02002736 *
Camilla Berglundce8f97c2015-01-11 23:33:14 +01002737 * __Do not use this function__ to move an already visible window unless you
2738 * have very good reasons for doing so, as it will confuse and annoy the user.
2739 *
2740 * The window manager may put limits on what positions are allowed. GLFW
2741 * cannot and should not override these limits.
2742 *
Camilla Berglund7c193232013-01-24 19:30:31 +01002743 * @param[in] window The window to query.
Camilla Löwyd5ab3e92019-01-22 20:54:16 +01002744 * @param[in] xpos The x-coordinate of the upper-left corner of the content area.
2745 * @param[in] ypos The y-coordinate of the upper-left corner of the content area.
Camilla Berglund7c193232013-01-24 19:30:31 +01002746 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002747 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2748 * GLFW_PLATFORM_ERROR.
2749 *
linkmauvebc8b0482016-10-16 15:52:39 +01002750 * @remark @wayland There is no way for an application to set the global
2751 * position of its windows, this function will always emit @ref
2752 * GLFW_PLATFORM_ERROR.
2753 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002754 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002755 *
2756 * @sa @ref window_pos
Camilla Berglund7e9e3212016-09-14 20:17:26 +02002757 * @sa @ref glfwGetWindowPos
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002758 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002759 * @since Added in version 1.0.
Camilla Berglund951a9582016-01-31 21:32:14 +01002760 * @glfw3 Added window handle parameter.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002761 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002762 * @ingroup window
Camilla Berglund7c193232013-01-24 19:30:31 +01002763 */
Camilla Berglund52f718d2013-02-12 12:01:12 +01002764GLFWAPI void glfwSetWindowPos(GLFWwindow* window, int xpos, int ypos);
Camilla Berglund7c193232013-01-24 19:30:31 +01002765
Camilla Löwyd5ab3e92019-01-22 20:54:16 +01002766/*! @brief Retrieves the size of the content area of the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002767 *
Camilla Löwyd5ab3e92019-01-22 20:54:16 +01002768 * This function retrieves the size, in screen coordinates, of the content area
Camilla Berglund521fa7d2013-09-26 20:02:19 +02002769 * of the specified window. If you wish to retrieve the size of the
Camilla Berglundce8f97c2015-01-11 23:33:14 +01002770 * framebuffer of the window in pixels, see @ref glfwGetFramebufferSize.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002771 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002772 * Any or all of the size arguments may be `NULL`. If an error occurs, all
2773 * non-`NULL` size arguments will be set to zero.
2774 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002775 * @param[in] window The window whose size to retrieve.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02002776 * @param[out] width Where to store the width, in screen coordinates, of the
Camilla Löwyd5ab3e92019-01-22 20:54:16 +01002777 * content area, or `NULL`.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02002778 * @param[out] height Where to store the height, in screen coordinates, of the
Camilla Löwyd5ab3e92019-01-22 20:54:16 +01002779 * content area, or `NULL`.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002780 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002781 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2782 * GLFW_PLATFORM_ERROR.
2783 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002784 * @thread_safety This function must only be called from the main thread.
Camilla Berglund0e205772014-03-24 11:58:35 +01002785 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002786 * @sa @ref window_size
Camilla Berglund7e9e3212016-09-14 20:17:26 +02002787 * @sa @ref glfwSetWindowSize
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002788 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002789 * @since Added in version 1.0.
Camilla Berglund951a9582016-01-31 21:32:14 +01002790 * @glfw3 Added window handle parameter.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002791 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002792 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002793 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01002794GLFWAPI void glfwGetWindowSize(GLFWwindow* window, int* width, int* height);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002795
Camilla Berglundd84772d2014-02-13 02:57:59 +01002796/*! @brief Sets the size limits of the specified window.
2797 *
Camilla Löwyd5ab3e92019-01-22 20:54:16 +01002798 * This function sets the size limits of the content area of the specified
Emmanuel Gil Peyrotf0f5d9f2016-04-09 00:42:58 +01002799 * window. If the window is full screen, the size limits only take effect
Camilla Berglund6570d0c2016-02-23 12:26:42 +01002800 * once it is made windowed. If the window is not resizable, this function
2801 * does nothing.
Camilla Berglundd84772d2014-02-13 02:57:59 +01002802 *
Camilla Berglund6570d0c2016-02-23 12:26:42 +01002803 * The size limits are applied immediately to a windowed mode window and may
2804 * cause it to be resized.
Camilla Berglundd84772d2014-02-13 02:57:59 +01002805 *
Camilla Berglund12a69562016-05-04 16:28:08 +02002806 * The maximum dimensions must be greater than or equal to the minimum
2807 * dimensions and all must be greater than or equal to zero.
2808 *
Camilla Berglundd84772d2014-02-13 02:57:59 +01002809 * @param[in] window The window to set limits for.
Camilla Löwyd5ab3e92019-01-22 20:54:16 +01002810 * @param[in] minwidth The minimum width, in screen coordinates, of the content
Camilla Berglundd84772d2014-02-13 02:57:59 +01002811 * area, or `GLFW_DONT_CARE`.
2812 * @param[in] minheight The minimum height, in screen coordinates, of the
Camilla Löwyd5ab3e92019-01-22 20:54:16 +01002813 * content area, or `GLFW_DONT_CARE`.
2814 * @param[in] maxwidth The maximum width, in screen coordinates, of the content
Camilla Berglundd84772d2014-02-13 02:57:59 +01002815 * area, or `GLFW_DONT_CARE`.
2816 * @param[in] maxheight The maximum height, in screen coordinates, of the
Camilla Löwyd5ab3e92019-01-22 20:54:16 +01002817 * content area, or `GLFW_DONT_CARE`.
Camilla Berglundd84772d2014-02-13 02:57:59 +01002818 *
Camilla Berglund12a69562016-05-04 16:28:08 +02002819 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
2820 * GLFW_INVALID_VALUE and @ref GLFW_PLATFORM_ERROR.
Camilla Berglundf51cf812016-02-05 00:51:40 +01002821 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002822 * @remark If you set size limits and an aspect ratio that conflict, the
Camilla Berglundd84772d2014-02-13 02:57:59 +01002823 * results are undefined.
2824 *
linkmauvebc8b0482016-10-16 15:52:39 +01002825 * @remark @wayland The size limits will not be applied until the window is
2826 * actually resized, either by the user or by the compositor.
2827 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002828 * @thread_safety This function must only be called from the main thread.
Camilla Berglundd84772d2014-02-13 02:57:59 +01002829 *
2830 * @sa @ref window_sizelimits
Camilla Berglund7e9e3212016-09-14 20:17:26 +02002831 * @sa @ref glfwSetWindowAspectRatio
Camilla Berglundd84772d2014-02-13 02:57:59 +01002832 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002833 * @since Added in version 3.2.
Camilla Berglundd84772d2014-02-13 02:57:59 +01002834 *
2835 * @ingroup window
2836 */
2837GLFWAPI void glfwSetWindowSizeLimits(GLFWwindow* window, int minwidth, int minheight, int maxwidth, int maxheight);
2838
2839/*! @brief Sets the aspect ratio of the specified window.
2840 *
Camilla Löwyd5ab3e92019-01-22 20:54:16 +01002841 * This function sets the required aspect ratio of the content area of the
Camilla Berglund6570d0c2016-02-23 12:26:42 +01002842 * specified window. If the window is full screen, the aspect ratio only takes
2843 * effect once it is made windowed. If the window is not resizable, this
Camilla Berglundd84772d2014-02-13 02:57:59 +01002844 * function does nothing.
2845 *
Camilla Berglundaf5b82a2015-10-19 16:01:42 +02002846 * The aspect ratio is specified as a numerator and a denominator and both
2847 * values must be greater than zero. For example, the common 16:9 aspect ratio
2848 * is specified as 16 and 9, respectively.
Camilla Berglundd84772d2014-02-13 02:57:59 +01002849 *
Camilla Berglundaf5b82a2015-10-19 16:01:42 +02002850 * If the numerator and denominator is set to `GLFW_DONT_CARE` then the aspect
2851 * ratio limit is disabled.
Camilla Berglundd84772d2014-02-13 02:57:59 +01002852 *
Camilla Berglund6570d0c2016-02-23 12:26:42 +01002853 * The aspect ratio is applied immediately to a windowed mode window and may
2854 * cause it to be resized.
Camilla Berglundd84772d2014-02-13 02:57:59 +01002855 *
2856 * @param[in] window The window to set limits for.
2857 * @param[in] numer The numerator of the desired aspect ratio, or
2858 * `GLFW_DONT_CARE`.
2859 * @param[in] denom The denominator of the desired aspect ratio, or
2860 * `GLFW_DONT_CARE`.
2861 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002862 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
2863 * GLFW_INVALID_VALUE and @ref GLFW_PLATFORM_ERROR.
2864 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002865 * @remark If you set size limits and an aspect ratio that conflict, the
Camilla Berglundd84772d2014-02-13 02:57:59 +01002866 * results are undefined.
2867 *
linkmauvebc8b0482016-10-16 15:52:39 +01002868 * @remark @wayland The aspect ratio will not be applied until the window is
2869 * actually resized, either by the user or by the compositor.
2870 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002871 * @thread_safety This function must only be called from the main thread.
Camilla Berglundd84772d2014-02-13 02:57:59 +01002872 *
2873 * @sa @ref window_sizelimits
Camilla Berglund7e9e3212016-09-14 20:17:26 +02002874 * @sa @ref glfwSetWindowSizeLimits
Camilla Berglundd84772d2014-02-13 02:57:59 +01002875 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002876 * @since Added in version 3.2.
Camilla Berglundd84772d2014-02-13 02:57:59 +01002877 *
2878 * @ingroup window
2879 */
2880GLFWAPI void glfwSetWindowAspectRatio(GLFWwindow* window, int numer, int denom);
2881
Camilla Löwyd5ab3e92019-01-22 20:54:16 +01002882/*! @brief Sets the size of the content area of the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002883 *
Camilla Löwyd5ab3e92019-01-22 20:54:16 +01002884 * This function sets the size, in screen coordinates, of the content area of
Camilla Berglund8282a8f2013-04-10 23:01:12 +02002885 * the specified window.
2886 *
Camilla Berglund6570d0c2016-02-23 12:26:42 +01002887 * For full screen windows, this function updates the resolution of its desired
2888 * video mode and switches to the video mode closest to it, without affecting
2889 * the window's context. As the context is unaffected, the bit depths of the
2890 * framebuffer remain unchanged.
2891 *
2892 * If you wish to update the refresh rate of the desired video mode in addition
2893 * to its resolution, see @ref glfwSetWindowMonitor.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002894 *
Camilla Berglundce8f97c2015-01-11 23:33:14 +01002895 * The window manager may put limits on what sizes are allowed. GLFW cannot
2896 * and should not override these limits.
2897 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002898 * @param[in] window The window to resize.
Camilla Berglund6570d0c2016-02-23 12:26:42 +01002899 * @param[in] width The desired width, in screen coordinates, of the window
Camilla Löwyd5ab3e92019-01-22 20:54:16 +01002900 * content area.
Camilla Berglund6570d0c2016-02-23 12:26:42 +01002901 * @param[in] height The desired height, in screen coordinates, of the window
Camilla Löwyd5ab3e92019-01-22 20:54:16 +01002902 * content area.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002903 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002904 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2905 * GLFW_PLATFORM_ERROR.
2906 *
linkmauvebc8b0482016-10-16 15:52:39 +01002907 * @remark @wayland A full screen window will not attempt to change the mode,
2908 * no matter what the requested size.
2909 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002910 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002911 *
2912 * @sa @ref window_size
Camilla Berglund7e9e3212016-09-14 20:17:26 +02002913 * @sa @ref glfwGetWindowSize
2914 * @sa @ref glfwSetWindowMonitor
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002915 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002916 * @since Added in version 1.0.
Camilla Berglund951a9582016-01-31 21:32:14 +01002917 * @glfw3 Added window handle parameter.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002918 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002919 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002920 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01002921GLFWAPI void glfwSetWindowSize(GLFWwindow* window, int width, int height);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002922
Camilla Berglund34981632013-06-03 12:51:57 +02002923/*! @brief Retrieves the size of the framebuffer of the specified window.
2924 *
2925 * This function retrieves the size, in pixels, of the framebuffer of the
Camilla Berglund521fa7d2013-09-26 20:02:19 +02002926 * specified window. If you wish to retrieve the size of the window in screen
2927 * coordinates, see @ref glfwGetWindowSize.
Camilla Berglund34981632013-06-03 12:51:57 +02002928 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002929 * Any or all of the size arguments may be `NULL`. If an error occurs, all
2930 * non-`NULL` size arguments will be set to zero.
2931 *
Camilla Berglund34981632013-06-03 12:51:57 +02002932 * @param[in] window The window whose framebuffer to query.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02002933 * @param[out] width Where to store the width, in pixels, of the framebuffer,
2934 * or `NULL`.
2935 * @param[out] height Where to store the height, in pixels, of the framebuffer,
2936 * or `NULL`.
Camilla Berglund34981632013-06-03 12:51:57 +02002937 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002938 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2939 * GLFW_PLATFORM_ERROR.
2940 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002941 * @thread_safety This function must only be called from the main thread.
Camilla Berglund0e205772014-03-24 11:58:35 +01002942 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002943 * @sa @ref window_fbsize
Camilla Berglund7e9e3212016-09-14 20:17:26 +02002944 * @sa @ref glfwSetFramebufferSizeCallback
Camilla Berglund34981632013-06-03 12:51:57 +02002945 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002946 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002947 *
Camilla Berglund34981632013-06-03 12:51:57 +02002948 * @ingroup window
2949 */
2950GLFWAPI void glfwGetFramebufferSize(GLFWwindow* window, int* width, int* height);
2951
Camilla Berglundeb3f75e2014-03-25 21:30:13 +01002952/*! @brief Retrieves the size of the frame of the window.
2953 *
2954 * This function retrieves the size, in screen coordinates, of each edge of the
2955 * frame of the specified window. This size includes the title bar, if the
2956 * window has one. The size of the frame may vary depending on the
2957 * [window-related hints](@ref window_hints_wnd) used to create it.
2958 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002959 * Because this function retrieves the size of each window frame edge and not
2960 * the offset along a particular coordinate axis, the retrieved values will
2961 * always be zero or positive.
2962 *
2963 * Any or all of the size arguments may be `NULL`. If an error occurs, all
2964 * non-`NULL` size arguments will be set to zero.
2965 *
Camilla Berglundeb3f75e2014-03-25 21:30:13 +01002966 * @param[in] window The window whose frame size to query.
2967 * @param[out] left Where to store the size, in screen coordinates, of the left
Camilla Berglund4591ad22014-09-18 15:03:29 +02002968 * edge of the window frame, or `NULL`.
Camilla Berglundeaff0f72014-04-07 16:27:32 +02002969 * @param[out] top Where to store the size, in screen coordinates, of the top
Camilla Berglund4591ad22014-09-18 15:03:29 +02002970 * edge of the window frame, or `NULL`.
Camilla Berglundeaff0f72014-04-07 16:27:32 +02002971 * @param[out] right Where to store the size, in screen coordinates, of the
Camilla Berglund4591ad22014-09-18 15:03:29 +02002972 * right edge of the window frame, or `NULL`.
Camilla Berglundeaff0f72014-04-07 16:27:32 +02002973 * @param[out] bottom Where to store the size, in screen coordinates, of the
Camilla Berglund4591ad22014-09-18 15:03:29 +02002974 * bottom edge of the window frame, or `NULL`.
Camilla Berglundeb3f75e2014-03-25 21:30:13 +01002975 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002976 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2977 * GLFW_PLATFORM_ERROR.
2978 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002979 * @thread_safety This function must only be called from the main thread.
Camilla Berglundeb3f75e2014-03-25 21:30:13 +01002980 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002981 * @sa @ref window_size
2982 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002983 * @since Added in version 3.1.
Camilla Berglundeb3f75e2014-03-25 21:30:13 +01002984 *
2985 * @ingroup window
2986 */
2987GLFWAPI void glfwGetWindowFrameSize(GLFWwindow* window, int* left, int* top, int* right, int* bottom);
2988
Camilla Löwy16bf8722017-08-29 19:19:00 +02002989/*! @brief Retrieves the content scale for the specified window.
2990 *
2991 * This function retrieves the content scale for the specified window. The
2992 * content scale is the ratio between the current DPI and the platform's
Camilla Löwy422bf792019-04-01 18:36:30 +02002993 * default DPI. This is especially important for text and any UI elements. If
2994 * the pixel dimensions of your UI scaled by this look appropriate on your
2995 * machine then it should appear at a reasonable size on other machines
2996 * regardless of their DPI and scaling settings. This relies on the system DPI
2997 * and scaling settings being somewhat correct.
Camilla Löwy16bf8722017-08-29 19:19:00 +02002998 *
2999 * On systems where each monitors can have its own content scale, the window
3000 * content scale will depend on which monitor the system considers the window
3001 * to be on.
3002 *
3003 * @param[in] window The window to query.
3004 * @param[out] xscale Where to store the x-axis content scale, or `NULL`.
3005 * @param[out] yscale Where to store the y-axis content scale, or `NULL`.
3006 *
3007 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
3008 * GLFW_PLATFORM_ERROR.
3009 *
3010 * @thread_safety This function must only be called from the main thread.
3011 *
3012 * @sa @ref window_scale
Camilla Löwy370eac32017-12-11 21:26:40 +01003013 * @sa @ref glfwSetWindowContentScaleCallback
Camilla Löwy16bf8722017-08-29 19:19:00 +02003014 * @sa @ref glfwGetMonitorContentScale
3015 *
3016 * @since Added in version 3.3.
3017 *
3018 * @ingroup window
3019 */
3020GLFWAPI void glfwGetWindowContentScale(GLFWwindow* window, float* xscale, float* yscale);
3021
Camilla Löwy11e47f02017-09-25 23:14:45 +02003022/*! @brief Returns the opacity of the whole window.
3023 *
3024 * This function returns the opacity of the window, including any decorations.
3025 *
3026 * The opacity (or alpha) value is a positive finite number between zero and
3027 * one, where zero is fully transparent and one is fully opaque. If the system
3028 * does not support whole window transparency, this function always returns one.
3029 *
3030 * The initial opacity value for newly created windows is one.
3031 *
3032 * @param[in] window The window to query.
3033 * @return The opacity value of the specified window.
3034 *
3035 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
3036 * GLFW_PLATFORM_ERROR.
3037 *
3038 * @thread_safety This function must only be called from the main thread.
3039 *
3040 * @sa @ref window_transparency
3041 * @sa @ref glfwSetWindowOpacity
3042 *
3043 * @since Added in version 3.3.
3044 *
3045 * @ingroup window
3046 */
3047GLFWAPI float glfwGetWindowOpacity(GLFWwindow* window);
3048
3049/*! @brief Sets the opacity of the whole window.
3050 *
3051 * This function sets the opacity of the window, including any decorations.
3052 *
3053 * The opacity (or alpha) value is a positive finite number between zero and
3054 * one, where zero is fully transparent and one is fully opaque.
3055 *
3056 * The initial opacity value for newly created windows is one.
3057 *
3058 * A window created with framebuffer transparency may not use whole window
3059 * transparency. The results of doing this are undefined.
3060 *
3061 * @param[in] window The window to set the opacity for.
3062 * @param[in] opacity The desired opacity of the specified window.
3063 *
3064 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
3065 * GLFW_PLATFORM_ERROR.
3066 *
3067 * @thread_safety This function must only be called from the main thread.
3068 *
3069 * @sa @ref window_transparency
3070 * @sa @ref glfwGetWindowOpacity
3071 *
3072 * @since Added in version 3.3.
3073 *
3074 * @ingroup window
3075 */
3076GLFWAPI void glfwSetWindowOpacity(GLFWwindow* window, float opacity);
3077
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003078/*! @brief Iconifies the specified window.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003079 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003080 * This function iconifies (minimizes) the specified window if it was
3081 * previously restored. If the window is already iconified, this function does
3082 * nothing.
3083 *
3084 * If the specified window is a full screen window, the original monitor
3085 * resolution is restored until the window is restored.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003086 *
3087 * @param[in] window The window to iconify.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003088 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003089 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
3090 * GLFW_PLATFORM_ERROR.
3091 *
Emmanuel Gil Peyrot599fb3d2019-03-01 18:46:06 +01003092 * @remark @wayland Once a window is iconified, @ref glfwRestoreWindow won’t
3093 * be able to restore it. This is a design decision of the xdg-shell
Emmanuel Gil Peyrota1620042017-12-03 04:19:15 +01003094 * protocol.
linkmauvebc8b0482016-10-16 15:52:39 +01003095 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003096 * @thread_safety This function must only be called from the main thread.
Camilla Berglund9ad1d972012-11-22 19:08:30 +01003097 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003098 * @sa @ref window_iconify
Camilla Berglund7e9e3212016-09-14 20:17:26 +02003099 * @sa @ref glfwRestoreWindow
3100 * @sa @ref glfwMaximizeWindow
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003101 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003102 * @since Added in version 2.1.
Camilla Berglund951a9582016-01-31 21:32:14 +01003103 * @glfw3 Added window handle parameter.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003104 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003105 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003106 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01003107GLFWAPI void glfwIconifyWindow(GLFWwindow* window);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003108
3109/*! @brief Restores the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003110 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003111 * This function restores the specified window if it was previously iconified
Camilla Berglunda10caa42015-10-13 12:50:59 +02003112 * (minimized) or maximized. If the window is already restored, this function
3113 * does nothing.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003114 *
3115 * If the specified window is a full screen window, the resolution chosen for
3116 * the window is restored on the selected monitor.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003117 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003118 * @param[in] window The window to restore.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003119 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003120 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
3121 * GLFW_PLATFORM_ERROR.
3122 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003123 * @thread_safety This function must only be called from the main thread.
Camilla Berglund9ad1d972012-11-22 19:08:30 +01003124 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003125 * @sa @ref window_iconify
Camilla Berglund7e9e3212016-09-14 20:17:26 +02003126 * @sa @ref glfwIconifyWindow
3127 * @sa @ref glfwMaximizeWindow
Camilla Berglunde248fb62013-03-29 14:06:23 +01003128 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003129 * @since Added in version 2.1.
Camilla Berglund951a9582016-01-31 21:32:14 +01003130 * @glfw3 Added window handle parameter.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003131 *
Camilla Berglunde248fb62013-03-29 14:06:23 +01003132 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003133 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01003134GLFWAPI void glfwRestoreWindow(GLFWwindow* window);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003135
Camilla Berglunda10caa42015-10-13 12:50:59 +02003136/*! @brief Maximizes the specified window.
3137 *
3138 * This function maximizes the specified window if it was previously not
3139 * maximized. If the window is already maximized, this function does nothing.
3140 *
3141 * If the specified window is a full screen window, this function does nothing.
3142 *
3143 * @param[in] window The window to maximize.
3144 *
Camilla Berglundf5b71f52016-05-27 14:20:39 +02003145 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
3146 * GLFW_PLATFORM_ERROR.
3147 *
Camilla Berglunda10caa42015-10-13 12:50:59 +02003148 * @par Thread Safety
3149 * This function may only be called from the main thread.
3150 *
3151 * @sa @ref window_iconify
Camilla Berglund7e9e3212016-09-14 20:17:26 +02003152 * @sa @ref glfwIconifyWindow
3153 * @sa @ref glfwRestoreWindow
Camilla Berglunda10caa42015-10-13 12:50:59 +02003154 *
3155 * @since Added in GLFW 3.2.
3156 *
3157 * @ingroup window
3158 */
3159GLFWAPI void glfwMaximizeWindow(GLFWwindow* window);
3160
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003161/*! @brief Makes the specified window visible.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003162 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003163 * This function makes the specified window visible if it was previously
Camilla Berglund8282a8f2013-04-10 23:01:12 +02003164 * hidden. If the window is already visible or is in full screen mode, this
Camilla Berglund1e9383d2012-11-23 11:41:53 +01003165 * function does nothing.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003166 *
Doug Binks0be4f3f2018-05-29 14:51:36 +01003167 * By default, windowed mode windows are focused when shown
3168 * Set the [GLFW_FOCUS_ON_SHOW](@ref GLFW_FOCUS_ON_SHOW_hint) window hint
3169 * to change this behavior for all newly created windows, or change the
3170 * behavior for an existing window with @ref glfwSetWindowAttrib.
3171 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003172 * @param[in] window The window to make visible.
3173 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003174 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
3175 * GLFW_PLATFORM_ERROR.
3176 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003177 * @thread_safety This function must only be called from the main thread.
Camilla Berglund9ad1d972012-11-22 19:08:30 +01003178 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003179 * @sa @ref window_hide
Camilla Berglund7e9e3212016-09-14 20:17:26 +02003180 * @sa @ref glfwHideWindow
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003181 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003182 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003183 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003184 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003185 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01003186GLFWAPI void glfwShowWindow(GLFWwindow* window);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003187
3188/*! @brief Hides the specified window.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003189 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003190 * This function hides the specified window if it was previously visible. If
Camilla Berglund8282a8f2013-04-10 23:01:12 +02003191 * the window is already hidden or is in full screen mode, this function does
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003192 * nothing.
3193 *
3194 * @param[in] window The window to hide.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003195 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003196 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
3197 * GLFW_PLATFORM_ERROR.
3198 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003199 * @thread_safety This function must only be called from the main thread.
Camilla Berglund9ad1d972012-11-22 19:08:30 +01003200 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003201 * @sa @ref window_hide
Camilla Berglund7e9e3212016-09-14 20:17:26 +02003202 * @sa @ref glfwShowWindow
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003203 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003204 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003205 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003206 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003207 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01003208GLFWAPI void glfwHideWindow(GLFWwindow* window);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003209
Camilla Berglundbaf57442016-02-21 15:42:49 +01003210/*! @brief Brings the specified window to front and sets input focus.
3211 *
3212 * This function brings the specified window to front and sets input focus.
3213 * The window should already be visible and not iconified.
3214 *
3215 * By default, both windowed and full screen mode windows are focused when
Camilla Löwyce161c22016-12-06 01:14:23 +01003216 * initially created. Set the [GLFW_FOCUSED](@ref GLFW_FOCUSED_hint) to
3217 * disable this behavior.
Camilla Berglundbaf57442016-02-21 15:42:49 +01003218 *
Doug Binks0be4f3f2018-05-29 14:51:36 +01003219 * Also by default, windowed mode windows are focused when shown
3220 * with @ref glfwShowWindow. Set the
3221 * [GLFW_FOCUS_ON_SHOW](@ref GLFW_FOCUS_ON_SHOW_hint) to disable this behavior.
3222 *
Camilla Berglundbaf57442016-02-21 15:42:49 +01003223 * __Do not use this function__ to steal focus from other applications unless
3224 * you are certain that is what the user wants. Focus stealing can be
3225 * extremely disruptive.
3226 *
Camilla Löwybaa9cd82017-05-11 14:36:56 +02003227 * For a less disruptive way of getting the user's attention, see
3228 * [attention requests](@ref window_attention).
3229 *
Camilla Berglundbaf57442016-02-21 15:42:49 +01003230 * @param[in] window The window to give input focus.
3231 *
3232 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
3233 * GLFW_PLATFORM_ERROR.
3234 *
linkmauvebc8b0482016-10-16 15:52:39 +01003235 * @remark @wayland It is not possible for an application to bring its windows
3236 * to front, this function will always emit @ref GLFW_PLATFORM_ERROR.
3237 *
Camilla Berglundbaf57442016-02-21 15:42:49 +01003238 * @thread_safety This function must only be called from the main thread.
3239 *
3240 * @sa @ref window_focus
Camilla Löwybaa9cd82017-05-11 14:36:56 +02003241 * @sa @ref window_attention
Camilla Berglundbaf57442016-02-21 15:42:49 +01003242 *
3243 * @since Added in version 3.2.
3244 *
3245 * @ingroup window
3246 */
3247GLFWAPI void glfwFocusWindow(GLFWwindow* window);
3248
Camilla Löwybaa9cd82017-05-11 14:36:56 +02003249/*! @brief Requests user attention to the specified window.
Felipe Ferreira da Silva412eb6a2017-03-21 10:02:57 -03003250 *
Camilla Löwybaa9cd82017-05-11 14:36:56 +02003251 * This function requests user attention to the specified window. On
3252 * platforms where this is not supported, attention is requested to the
3253 * application as a whole.
Felipe Ferreira da Silva412eb6a2017-03-21 10:02:57 -03003254 *
Camilla Löwybaa9cd82017-05-11 14:36:56 +02003255 * Once the user has given attention, usually by focusing the window or
3256 * application, the system will end the request automatically.
3257 *
3258 * @param[in] window The window to request attention to.
Felipe Ferreira da Silva412eb6a2017-03-21 10:02:57 -03003259 *
3260 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
3261 * GLFW_PLATFORM_ERROR.
3262 *
Camilla Löwybaa9cd82017-05-11 14:36:56 +02003263 * @remark @macos Attention is requested to the application as a whole, not the
3264 * specific window.
Felipe Ferreira da Silva412eb6a2017-03-21 10:02:57 -03003265 *
3266 * @thread_safety This function must only be called from the main thread.
3267 *
Camilla Löwybaa9cd82017-05-11 14:36:56 +02003268 * @sa @ref window_attention
3269 *
Felipe Ferreira da Silva412eb6a2017-03-21 10:02:57 -03003270 * @since Added in version 3.3.
3271 *
3272 * @ingroup window
3273 */
3274GLFWAPI void glfwRequestWindowAttention(GLFWwindow* window);
3275
Camilla Berglund8282a8f2013-04-10 23:01:12 +02003276/*! @brief Returns the monitor that the window uses for full screen mode.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003277 *
3278 * This function returns the handle of the monitor that the specified window is
Camilla Berglund8282a8f2013-04-10 23:01:12 +02003279 * in full screen on.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003280 *
Camilla Berglund5f68e122012-11-27 17:07:28 +01003281 * @param[in] window The window to query.
Camilla Berglund999f3552016-08-17 16:48:22 +02003282 * @return The monitor, or `NULL` if the window is in windowed mode or an
3283 * [error](@ref error_handling) occurred.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003284 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003285 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
3286 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003287 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003288 *
3289 * @sa @ref window_monitor
Camilla Berglund7e9e3212016-09-14 20:17:26 +02003290 * @sa @ref glfwSetWindowMonitor
Camilla Berglund4591ad22014-09-18 15:03:29 +02003291 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003292 * @since Added in version 3.0.
Camilla Berglund0e205772014-03-24 11:58:35 +01003293 *
Camilla Berglund5f68e122012-11-27 17:07:28 +01003294 * @ingroup window
Camilla Berglund41bc0d12012-11-27 16:55:04 +01003295 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01003296GLFWAPI GLFWmonitor* glfwGetWindowMonitor(GLFWwindow* window);
Camilla Berglund41bc0d12012-11-27 16:55:04 +01003297
Camilla Berglund6570d0c2016-02-23 12:26:42 +01003298/*! @brief Sets the mode, monitor, video mode and placement of a window.
3299 *
3300 * This function sets the monitor that the window uses for full screen mode or,
3301 * if the monitor is `NULL`, makes it windowed mode.
3302 *
3303 * When setting a monitor, this function updates the width, height and refresh
3304 * rate of the desired video mode and switches to the video mode closest to it.
3305 * The window position is ignored when setting a monitor.
3306 *
3307 * When the monitor is `NULL`, the position, width and height are used to
Camilla Löwyd5ab3e92019-01-22 20:54:16 +01003308 * place the window content area. The refresh rate is ignored when no monitor
Camilla Berglund6570d0c2016-02-23 12:26:42 +01003309 * is specified.
3310 *
3311 * If you only wish to update the resolution of a full screen window or the
3312 * size of a windowed mode window, see @ref glfwSetWindowSize.
3313 *
3314 * When a window transitions from full screen to windowed mode, this function
3315 * restores any previous window settings such as whether it is decorated,
linkmauvebc8b0482016-10-16 15:52:39 +01003316 * floating, resizable, has size or aspect ratio limits, etc.
Camilla Berglund6570d0c2016-02-23 12:26:42 +01003317 *
3318 * @param[in] window The window whose monitor, size or video mode to set.
3319 * @param[in] monitor The desired monitor, or `NULL` to set windowed mode.
3320 * @param[in] xpos The desired x-coordinate of the upper-left corner of the
Camilla Löwyd5ab3e92019-01-22 20:54:16 +01003321 * content area.
Camilla Berglund6570d0c2016-02-23 12:26:42 +01003322 * @param[in] ypos The desired y-coordinate of the upper-left corner of the
Camilla Löwyd5ab3e92019-01-22 20:54:16 +01003323 * content area.
3324 * @param[in] width The desired with, in screen coordinates, of the content
3325 * area or video mode.
3326 * @param[in] height The desired height, in screen coordinates, of the content
Camilla Berglund6570d0c2016-02-23 12:26:42 +01003327 * area or video mode.
Camilla Berglund325729d2016-05-22 14:25:04 +02003328 * @param[in] refreshRate The desired refresh rate, in Hz, of the video mode,
3329 * or `GLFW_DONT_CARE`.
Camilla Berglund6570d0c2016-02-23 12:26:42 +01003330 *
3331 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
3332 * GLFW_PLATFORM_ERROR.
3333 *
Camilla Berglundec171612016-10-28 06:20:20 +02003334 * @remark The OpenGL or OpenGL ES context will not be destroyed or otherwise
3335 * affected by any resizing or mode switching, although you may need to update
3336 * your viewport if the framebuffer size has changed.
3337 *
linkmauvebc8b0482016-10-16 15:52:39 +01003338 * @remark @wayland The desired window position is ignored, as there is no way
3339 * for an application to set this property.
3340 *
3341 * @remark @wayland Setting the window to full screen will not attempt to
3342 * change the mode, no matter what the requested size or refresh rate.
3343 *
Camilla Berglund6570d0c2016-02-23 12:26:42 +01003344 * @thread_safety This function must only be called from the main thread.
3345 *
3346 * @sa @ref window_monitor
3347 * @sa @ref window_full_screen
Camilla Berglund7e9e3212016-09-14 20:17:26 +02003348 * @sa @ref glfwGetWindowMonitor
3349 * @sa @ref glfwSetWindowSize
Camilla Berglund6570d0c2016-02-23 12:26:42 +01003350 *
3351 * @since Added in version 3.2.
3352 *
3353 * @ingroup window
3354 */
3355GLFWAPI void glfwSetWindowMonitor(GLFWwindow* window, GLFWmonitor* monitor, int xpos, int ypos, int width, int height, int refreshRate);
3356
Camilla Berglundad1f6f02013-05-27 15:30:32 +02003357/*! @brief Returns an attribute of the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003358 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003359 * This function returns the value of an attribute of the specified window or
3360 * its OpenGL or OpenGL ES context.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003361 *
Camilla Berglund1e9383d2012-11-23 11:41:53 +01003362 * @param[in] window The window to query.
Camilla Berglund1f5f20e2013-05-27 17:10:34 +02003363 * @param[in] attrib The [window attribute](@ref window_attribs) whose value to
3364 * return.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003365 * @return The value of the attribute, or zero if an
3366 * [error](@ref error_handling) occurred.
Camilla Berglund1e9383d2012-11-23 11:41:53 +01003367 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003368 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
3369 * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR.
3370 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003371 * @remark Framebuffer related hints are not window attributes. See @ref
Camilla Berglund59abeeb2015-04-07 14:34:12 +02003372 * window_attribs_fb for more information.
3373 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003374 * @remark Zero is a valid value for many window and context related
Camilla Berglund59abeeb2015-04-07 14:34:12 +02003375 * attributes so you cannot use a return value of zero as an indication of
3376 * errors. However, this function should not fail as long as it is passed
3377 * valid arguments and the library has been [initialized](@ref intro_init).
3378 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003379 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003380 *
3381 * @sa @ref window_attribs
Camilla Löwy9e560992016-09-30 01:52:22 +02003382 * @sa @ref glfwSetWindowAttrib
Camilla Berglund4591ad22014-09-18 15:03:29 +02003383 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003384 * @since Added in version 3.0. Replaces `glfwGetWindowParam` and
Camilla Berglund4188c262015-01-18 01:55:25 +01003385 * `glfwGetGLVersion`.
Camilla Berglund0e205772014-03-24 11:58:35 +01003386 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003387 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003388 */
Camilla Berglundad1f6f02013-05-27 15:30:32 +02003389GLFWAPI int glfwGetWindowAttrib(GLFWwindow* window, int attrib);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003390
Camilla Löwy9e560992016-09-30 01:52:22 +02003391/*! @brief Sets an attribute of the specified window.
3392 *
3393 * This function sets the value of an attribute of the specified window.
3394 *
3395 * The supported attributes are [GLFW_DECORATED](@ref GLFW_DECORATED_attrib),
3396 * [GLFW_RESIZABLE](@ref GLFW_RESIZABLE_attrib),
Doug Binks0be4f3f2018-05-29 14:51:36 +01003397 * [GLFW_FLOATING](@ref GLFW_FLOATING_attrib),
3398 * [GLFW_AUTO_ICONIFY](@ref GLFW_AUTO_ICONIFY_attrib) and
3399 * [GLFW_FOCUS_ON_SHOW](@ref GLFW_FOCUS_ON_SHOW_attrib).
Camilla Löwy9e560992016-09-30 01:52:22 +02003400 *
3401 * Some of these attributes are ignored for full screen windows. The new
3402 * value will take effect if the window is later made windowed.
3403 *
3404 * Some of these attributes are ignored for windowed mode windows. The new
3405 * value will take effect if the window is later made full screen.
3406 *
3407 * @param[in] window The window to set the attribute for.
3408 * @param[in] attrib A supported window attribute.
3409 * @param[in] value `GLFW_TRUE` or `GLFW_FALSE`.
3410 *
3411 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
3412 * GLFW_INVALID_ENUM, @ref GLFW_INVALID_VALUE and @ref GLFW_PLATFORM_ERROR.
3413 *
3414 * @remark Calling @ref glfwGetWindowAttrib will always return the latest
3415 * value, even if that value is ignored by the current mode of the window.
3416 *
3417 * @thread_safety This function must only be called from the main thread.
3418 *
3419 * @sa @ref window_attribs
3420 * @sa @ref glfwGetWindowAttrib
3421 *
3422 * @since Added in version 3.3.
3423 *
3424 * @ingroup window
3425 */
3426GLFWAPI void glfwSetWindowAttrib(GLFWwindow* window, int attrib, int value);
3427
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003428/*! @brief Sets the user pointer of the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003429 *
3430 * This function sets the user-defined pointer of the specified window. The
3431 * current value is retained until the window is destroyed. The initial value
3432 * is `NULL`.
3433 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003434 * @param[in] window The window whose pointer to set.
3435 * @param[in] pointer The new value.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003436 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003437 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
3438 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003439 * @thread_safety This function may be called from any thread. Access is not
3440 * synchronized.
Camilla Berglund0e205772014-03-24 11:58:35 +01003441 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003442 * @sa @ref window_userptr
Camilla Berglund7e9e3212016-09-14 20:17:26 +02003443 * @sa @ref glfwGetWindowUserPointer
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003444 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003445 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003446 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003447 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003448 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01003449GLFWAPI void glfwSetWindowUserPointer(GLFWwindow* window, void* pointer);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003450
3451/*! @brief Returns the user pointer of the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003452 *
3453 * This function returns the current value of the user-defined pointer of the
3454 * specified window. The initial value is `NULL`.
3455 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003456 * @param[in] window The window whose pointer to return.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003457 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003458 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
3459 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003460 * @thread_safety This function may be called from any thread. Access is not
3461 * synchronized.
Camilla Berglund0e205772014-03-24 11:58:35 +01003462 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003463 * @sa @ref window_userptr
Camilla Berglund7e9e3212016-09-14 20:17:26 +02003464 * @sa @ref glfwSetWindowUserPointer
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003465 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003466 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003467 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003468 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003469 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01003470GLFWAPI void* glfwGetWindowUserPointer(GLFWwindow* window);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003471
Camilla Berglund1a3d47d2012-11-30 13:56:42 +01003472/*! @brief Sets the position callback for the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003473 *
3474 * This function sets the position callback of the specified window, which is
Camilla Löwy2867ca12017-10-29 16:27:15 +01003475 * called when the window is moved. The callback is provided with the
Camilla Löwyd5ab3e92019-01-22 20:54:16 +01003476 * position, in screen coordinates, of the upper-left corner of the content
3477 * area of the window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003478 *
Camilla Berglund1a3d47d2012-11-30 13:56:42 +01003479 * @param[in] window The window whose callback to set.
Camilla Berglund71d2b572013-03-12 15:33:05 +01003480 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
Camilla Berglund1a3d47d2012-11-30 13:56:42 +01003481 * callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02003482 * @return The previously set callback, or `NULL` if no callback was set or the
3483 * library had not been [initialized](@ref intro_init).
Camilla Berglund11a27de2013-04-08 21:21:21 +02003484 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003485 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
3486 *
linkmauvebc8b0482016-10-16 15:52:39 +01003487 * @remark @wayland This callback will never be called, as there is no way for
3488 * an application to know its global position.
3489 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003490 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003491 *
3492 * @sa @ref window_pos
3493 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003494 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003495 *
Camilla Berglund1a3d47d2012-11-30 13:56:42 +01003496 * @ingroup window
3497 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02003498GLFWAPI GLFWwindowposfun glfwSetWindowPosCallback(GLFWwindow* window, GLFWwindowposfun cbfun);
Camilla Berglund1a3d47d2012-11-30 13:56:42 +01003499
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003500/*! @brief Sets the size callback for the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003501 *
3502 * This function sets the size callback of the specified window, which is
3503 * called when the window is resized. The callback is provided with the size,
Camilla Löwyd5ab3e92019-01-22 20:54:16 +01003504 * in screen coordinates, of the content area of the window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003505 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003506 * @param[in] window The window whose callback to set.
Camilla Berglund71d2b572013-03-12 15:33:05 +01003507 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003508 * callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02003509 * @return The previously set callback, or `NULL` if no callback was set or the
3510 * library had not been [initialized](@ref intro_init).
Camilla Berglund11a27de2013-04-08 21:21:21 +02003511 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003512 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
3513 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003514 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003515 *
3516 * @sa @ref window_size
3517 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003518 * @since Added in version 1.0.
3519 * @glfw3 Added window handle parameter and return value.
Camilla Berglund0e205772014-03-24 11:58:35 +01003520 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003521 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003522 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02003523GLFWAPI GLFWwindowsizefun glfwSetWindowSizeCallback(GLFWwindow* window, GLFWwindowsizefun cbfun);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003524
3525/*! @brief Sets the close callback for the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003526 *
3527 * This function sets the close callback of the specified window, which is
3528 * called when the user attempts to close the window, for example by clicking
3529 * the close widget in the title bar.
3530 *
3531 * The close flag is set before this callback is called, but you can modify it
3532 * at any time with @ref glfwSetWindowShouldClose.
3533 *
Camilla Berglund5fd409b2013-06-05 17:53:13 +02003534 * The close callback is not triggered by @ref glfwDestroyWindow.
3535 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003536 * @param[in] window The window whose callback to set.
Camilla Berglund71d2b572013-03-12 15:33:05 +01003537 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003538 * callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02003539 * @return The previously set callback, or `NULL` if no callback was set or the
3540 * library had not been [initialized](@ref intro_init).
Camilla Berglund11a27de2013-04-08 21:21:21 +02003541 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003542 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
3543 *
Camilla Berglund8d6f2652016-10-20 00:50:54 +02003544 * @remark @macos Selecting Quit from the application menu will trigger the
3545 * close callback for all windows.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003546 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003547 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003548 *
3549 * @sa @ref window_close
3550 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003551 * @since Added in version 2.5.
3552 * @glfw3 Added window handle parameter and return value.
Camilla Berglund0e205772014-03-24 11:58:35 +01003553 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003554 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003555 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02003556GLFWAPI GLFWwindowclosefun glfwSetWindowCloseCallback(GLFWwindow* window, GLFWwindowclosefun cbfun);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003557
3558/*! @brief Sets the refresh callback for the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003559 *
3560 * This function sets the refresh callback of the specified window, which is
Camilla Löwyd5ab3e92019-01-22 20:54:16 +01003561 * called when the content area of the window needs to be redrawn, for example
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003562 * if the window has been exposed after having been covered by another window.
3563 *
linkmauvebc8b0482016-10-16 15:52:39 +01003564 * On compositing window systems such as Aero, Compiz, Aqua or Wayland, where
3565 * the window contents are saved off-screen, this callback may be called only
3566 * very infrequently or never at all.
Camilla Berglund8282a8f2013-04-10 23:01:12 +02003567 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003568 * @param[in] window The window whose callback to set.
Camilla Berglund71d2b572013-03-12 15:33:05 +01003569 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003570 * callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02003571 * @return The previously set callback, or `NULL` if no callback was set or the
3572 * library had not been [initialized](@ref intro_init).
Camilla Berglund11a27de2013-04-08 21:21:21 +02003573 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003574 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
3575 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003576 * @thread_safety This function must only be called from the main thread.
Camilla Berglund0e205772014-03-24 11:58:35 +01003577 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003578 * @sa @ref window_refresh
3579 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003580 * @since Added in version 2.5.
3581 * @glfw3 Added window handle parameter and return value.
Camilla Berglunda3ff29a2012-12-02 15:47:10 +01003582 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003583 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003584 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02003585GLFWAPI GLFWwindowrefreshfun glfwSetWindowRefreshCallback(GLFWwindow* window, GLFWwindowrefreshfun cbfun);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003586
3587/*! @brief Sets the focus callback for the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003588 *
3589 * This function sets the focus callback of the specified window, which is
Camilla Berglund4188c262015-01-18 01:55:25 +01003590 * called when the window gains or loses input focus.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003591 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003592 * After the focus callback is called for a window that lost input focus,
3593 * synthetic key and mouse button release events will be generated for all such
3594 * that had been pressed. For more information, see @ref glfwSetKeyCallback
3595 * and @ref glfwSetMouseButtonCallback.
Camilla Berglund4538a522013-04-24 19:49:46 +02003596 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003597 * @param[in] window The window whose callback to set.
Camilla Berglund71d2b572013-03-12 15:33:05 +01003598 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003599 * callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02003600 * @return The previously set callback, or `NULL` if no callback was set or the
3601 * library had not been [initialized](@ref intro_init).
Camilla Berglund11a27de2013-04-08 21:21:21 +02003602 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003603 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
3604 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003605 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003606 *
3607 * @sa @ref window_focus
3608 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003609 * @since Added in version 3.0.
Camilla Berglund0e205772014-03-24 11:58:35 +01003610 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003611 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003612 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02003613GLFWAPI GLFWwindowfocusfun glfwSetWindowFocusCallback(GLFWwindow* window, GLFWwindowfocusfun cbfun);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003614
3615/*! @brief Sets the iconify callback for the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003616 *
3617 * This function sets the iconification callback of the specified window, which
3618 * is called when the window is iconified or restored.
3619 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003620 * @param[in] window The window whose callback to set.
Camilla Berglund71d2b572013-03-12 15:33:05 +01003621 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003622 * callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02003623 * @return The previously set callback, or `NULL` if no callback was set or the
3624 * library had not been [initialized](@ref intro_init).
Camilla Berglund11a27de2013-04-08 21:21:21 +02003625 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003626 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
3627 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003628 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003629 *
3630 * @sa @ref window_iconify
3631 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003632 * @since Added in version 3.0.
Camilla Berglund0e205772014-03-24 11:58:35 +01003633 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003634 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003635 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02003636GLFWAPI GLFWwindowiconifyfun glfwSetWindowIconifyCallback(GLFWwindow* window, GLFWwindowiconifyfun cbfun);
Camilla Berglund135194a2010-09-09 18:15:32 +02003637
Camilla Berglundc156b502016-06-16 13:09:28 +02003638/*! @brief Sets the maximize callback for the specified window.
3639 *
3640 * This function sets the maximization callback of the specified window, which
3641 * is called when the window is maximized or restored.
3642 *
3643 * @param[in] window The window whose callback to set.
3644 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
3645 * callback.
3646 * @return The previously set callback, or `NULL` if no callback was set or the
3647 * library had not been [initialized](@ref intro_init).
3648 *
3649 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
3650 *
3651 * @thread_safety This function must only be called from the main thread.
3652 *
3653 * @sa @ref window_maximize
3654 *
3655 * @since Added in version 3.3.
3656 *
3657 * @ingroup window
3658 */
3659GLFWAPI GLFWwindowmaximizefun glfwSetWindowMaximizeCallback(GLFWwindow* window, GLFWwindowmaximizefun cbfun);
3660
Camilla Berglund34981632013-06-03 12:51:57 +02003661/*! @brief Sets the framebuffer resize callback for the specified window.
3662 *
3663 * This function sets the framebuffer resize callback of the specified window,
3664 * which is called when the framebuffer of the specified window is resized.
3665 *
3666 * @param[in] window The window whose callback to set.
3667 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
3668 * callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02003669 * @return The previously set callback, or `NULL` if no callback was set or the
3670 * library had not been [initialized](@ref intro_init).
Camilla Berglund34981632013-06-03 12:51:57 +02003671 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003672 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
3673 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003674 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003675 *
3676 * @sa @ref window_fbsize
3677 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003678 * @since Added in version 3.0.
Camilla Berglund0e205772014-03-24 11:58:35 +01003679 *
Camilla Berglund34981632013-06-03 12:51:57 +02003680 * @ingroup window
3681 */
3682GLFWAPI GLFWframebuffersizefun glfwSetFramebufferSizeCallback(GLFWwindow* window, GLFWframebuffersizefun cbfun);
3683
Camilla Löwy370eac32017-12-11 21:26:40 +01003684/*! @brief Sets the window content scale callback for the specified window.
3685 *
3686 * This function sets the window content scale callback of the specified window,
3687 * which is called when the content scale of the specified window changes.
3688 *
3689 * @param[in] window The window whose callback to set.
3690 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
3691 * callback.
3692 * @return The previously set callback, or `NULL` if no callback was set or the
3693 * library had not been [initialized](@ref intro_init).
3694 *
3695 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
3696 *
3697 * @thread_safety This function must only be called from the main thread.
3698 *
3699 * @sa @ref window_scale
3700 * @sa @ref glfwGetWindowContentScale
3701 *
3702 * @since Added in version 3.3.
3703 *
3704 * @ingroup window
3705 */
3706GLFWAPI GLFWwindowcontentscalefun glfwSetWindowContentScaleCallback(GLFWwindow* window, GLFWwindowcontentscalefun cbfun);
3707
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003708/*! @brief Processes all pending events.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003709 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003710 * This function processes only those events that are already in the event
3711 * queue and then returns immediately. Processing events will cause the window
3712 * and input callbacks associated with those events to be called.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003713 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003714 * On some platforms, a window move, resize or menu operation will cause event
3715 * processing to block. This is due to how event processing is designed on
3716 * those platforms. You can use the
3717 * [window refresh callback](@ref window_refresh) to redraw the contents of
3718 * your window when necessary during such operations.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02003719 *
Camilla Löwy766a9dc2016-12-06 23:26:53 +01003720 * Do not assume that callbacks you set will _only_ be called in response to
3721 * event processing functions like this one. While it is necessary to poll for
3722 * events, window systems that require GLFW to register callbacks of its own
3723 * can pass events to GLFW in response to many window system function calls.
3724 * GLFW will pass those events on to the application callbacks before
3725 * returning.
Camilla Berglund401033c2013-03-12 19:17:07 +01003726 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003727 * Event processing is not required for joystick input to work.
Camilla Berglund9ad1d972012-11-22 19:08:30 +01003728 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003729 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
3730 * GLFW_PLATFORM_ERROR.
3731 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003732 * @reentrancy This function must not be called from a callback.
Camilla Berglundb48128f2013-02-14 18:49:03 +01003733 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003734 * @thread_safety This function must only be called from the main thread.
Camilla Berglund948cc042013-04-16 02:02:22 +02003735 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003736 * @sa @ref events
Camilla Berglund7e9e3212016-09-14 20:17:26 +02003737 * @sa @ref glfwWaitEvents
3738 * @sa @ref glfwWaitEventsTimeout
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003739 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003740 * @since Added in version 1.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003741 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003742 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003743 */
Camilla Berglund9a716692010-09-08 16:40:43 +02003744GLFWAPI void glfwPollEvents(void);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003745
Camilla Berglund4591ad22014-09-18 15:03:29 +02003746/*! @brief Waits until events are queued and processes them.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003747 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003748 * This function puts the calling thread to sleep until at least one event is
3749 * available in the event queue. Once one or more events are available,
3750 * it behaves exactly like @ref glfwPollEvents, i.e. the events in the queue
3751 * are processed and the function then returns immediately. Processing events
3752 * will cause the window and input callbacks associated with those events to be
3753 * called.
Camilla Berglund948cc042013-04-16 02:02:22 +02003754 *
3755 * Since not all events are associated with callbacks, this function may return
3756 * without a callback having been called even if you are monitoring all
3757 * callbacks.
3758 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003759 * On some platforms, a window move, resize or menu operation will cause event
3760 * processing to block. This is due to how event processing is designed on
3761 * those platforms. You can use the
3762 * [window refresh callback](@ref window_refresh) to redraw the contents of
3763 * your window when necessary during such operations.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003764 *
Camilla Löwy766a9dc2016-12-06 23:26:53 +01003765 * Do not assume that callbacks you set will _only_ be called in response to
3766 * event processing functions like this one. While it is necessary to poll for
3767 * events, window systems that require GLFW to register callbacks of its own
3768 * can pass events to GLFW in response to many window system function calls.
3769 * GLFW will pass those events on to the application callbacks before
3770 * returning.
Camilla Berglund4188c262015-01-18 01:55:25 +01003771 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003772 * Event processing is not required for joystick input to work.
Camilla Berglund9ad1d972012-11-22 19:08:30 +01003773 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003774 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
3775 * GLFW_PLATFORM_ERROR.
3776 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003777 * @reentrancy This function must not be called from a callback.
Camilla Berglund44372b82014-12-17 01:31:36 +01003778 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003779 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003780 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003781 * @sa @ref events
Camilla Berglund7e9e3212016-09-14 20:17:26 +02003782 * @sa @ref glfwPollEvents
3783 * @sa @ref glfwWaitEventsTimeout
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003784 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003785 * @since Added in version 2.5.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003786 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003787 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003788 */
Camilla Berglund9a716692010-09-08 16:40:43 +02003789GLFWAPI void glfwWaitEvents(void);
Camilla Berglund135194a2010-09-09 18:15:32 +02003790
Camilla Berglund56208952016-02-02 21:11:16 +01003791/*! @brief Waits with timeout until events are queued and processes them.
3792 *
3793 * This function puts the calling thread to sleep until at least one event is
3794 * available in the event queue, or until the specified timeout is reached. If
3795 * one or more events are available, it behaves exactly like @ref
3796 * glfwPollEvents, i.e. the events in the queue are processed and the function
3797 * then returns immediately. Processing events will cause the window and input
3798 * callbacks associated with those events to be called.
3799 *
3800 * The timeout value must be a positive finite number.
3801 *
3802 * Since not all events are associated with callbacks, this function may return
3803 * without a callback having been called even if you are monitoring all
3804 * callbacks.
3805 *
3806 * On some platforms, a window move, resize or menu operation will cause event
3807 * processing to block. This is due to how event processing is designed on
3808 * those platforms. You can use the
3809 * [window refresh callback](@ref window_refresh) to redraw the contents of
3810 * your window when necessary during such operations.
3811 *
Camilla Löwy766a9dc2016-12-06 23:26:53 +01003812 * Do not assume that callbacks you set will _only_ be called in response to
3813 * event processing functions like this one. While it is necessary to poll for
3814 * events, window systems that require GLFW to register callbacks of its own
3815 * can pass events to GLFW in response to many window system function calls.
3816 * GLFW will pass those events on to the application callbacks before
3817 * returning.
Camilla Berglund56208952016-02-02 21:11:16 +01003818 *
Camilla Berglund56208952016-02-02 21:11:16 +01003819 * Event processing is not required for joystick input to work.
3820 *
3821 * @param[in] timeout The maximum amount of time, in seconds, to wait.
3822 *
Sylvain Boilard3b255af2018-09-13 16:23:44 +02003823 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
Camilla Löwy8e313d92018-12-13 20:33:17 +01003824 * GLFW_INVALID_VALUE and @ref GLFW_PLATFORM_ERROR.
Sylvain Boilard3b255af2018-09-13 16:23:44 +02003825 *
Camilla Berglund56208952016-02-02 21:11:16 +01003826 * @reentrancy This function must not be called from a callback.
3827 *
3828 * @thread_safety This function must only be called from the main thread.
3829 *
3830 * @sa @ref events
Camilla Berglund7e9e3212016-09-14 20:17:26 +02003831 * @sa @ref glfwPollEvents
3832 * @sa @ref glfwWaitEvents
Camilla Berglund56208952016-02-02 21:11:16 +01003833 *
3834 * @since Added in version 3.2.
3835 *
3836 * @ingroup window
3837 */
3838GLFWAPI void glfwWaitEventsTimeout(double timeout);
3839
Camilla Berglund1ccc2322014-02-10 18:16:58 +01003840/*! @brief Posts an empty event to the event queue.
3841 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003842 * This function posts an empty event from the current thread to the event
Camilla Berglund73abf8a2016-07-06 13:06:59 +02003843 * queue, causing @ref glfwWaitEvents or @ref glfwWaitEventsTimeout to return.
Camilla Berglund1ccc2322014-02-10 18:16:58 +01003844 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003845 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
3846 * GLFW_PLATFORM_ERROR.
3847 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003848 * @thread_safety This function may be called from any thread.
Camilla Berglund1ccc2322014-02-10 18:16:58 +01003849 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003850 * @sa @ref events
Camilla Berglund7e9e3212016-09-14 20:17:26 +02003851 * @sa @ref glfwWaitEvents
3852 * @sa @ref glfwWaitEventsTimeout
Camilla Berglund1ccc2322014-02-10 18:16:58 +01003853 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003854 * @since Added in version 3.1.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003855 *
Camilla Berglund1ccc2322014-02-10 18:16:58 +01003856 * @ingroup window
3857 */
3858GLFWAPI void glfwPostEmptyEvent(void);
3859
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003860/*! @brief Returns the value of an input option for the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003861 *
Camilla Berglund95654cf2014-10-02 17:35:10 +02003862 * This function returns the value of an input option for the specified window.
Camilla Löwy0e8c4ea2017-11-29 20:42:37 +01003863 * The mode must be one of @ref GLFW_CURSOR, @ref GLFW_STICKY_KEYS,
Nathan Poirier9e29f552018-12-14 03:08:25 +01003864 * @ref GLFW_STICKY_MOUSE_BUTTONS, @ref GLFW_LOCK_KEY_MODS or
Camilla Löwy1155c832019-02-11 19:10:20 +01003865 * @ref GLFW_RAW_MOUSE_MOTION.
Camilla Berglund95654cf2014-10-02 17:35:10 +02003866 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003867 * @param[in] window The window to query.
Camilla Löwy0e8c4ea2017-11-29 20:42:37 +01003868 * @param[in] mode One of `GLFW_CURSOR`, `GLFW_STICKY_KEYS`,
Camilla Löwy1155c832019-02-11 19:10:20 +01003869 * `GLFW_STICKY_MOUSE_BUTTONS`, `GLFW_LOCK_KEY_MODS` or
3870 * `GLFW_RAW_MOUSE_MOTION`.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003871 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003872 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
3873 * GLFW_INVALID_ENUM.
3874 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003875 * @thread_safety This function must only be called from the main thread.
Camilla Berglund0e205772014-03-24 11:58:35 +01003876 *
Camilla Berglund7e9e3212016-09-14 20:17:26 +02003877 * @sa @ref glfwSetInputMode
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003878 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003879 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003880 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003881 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003882 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01003883GLFWAPI int glfwGetInputMode(GLFWwindow* window, int mode);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003884
3885/*! @brief Sets an input option for the specified window.
Camilla Berglund95654cf2014-10-02 17:35:10 +02003886 *
3887 * This function sets an input mode option for the specified window. The mode
Camilla Löwy0e8c4ea2017-11-29 20:42:37 +01003888 * must be one of @ref GLFW_CURSOR, @ref GLFW_STICKY_KEYS,
Nathan Poirier9e29f552018-12-14 03:08:25 +01003889 * @ref GLFW_STICKY_MOUSE_BUTTONS, @ref GLFW_LOCK_KEY_MODS or
Camilla Löwy1155c832019-02-11 19:10:20 +01003890 * @ref GLFW_RAW_MOUSE_MOTION.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003891 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003892 * If the mode is `GLFW_CURSOR`, the value must be one of the following cursor
Camilla Berglund39fe1f12013-03-12 19:39:36 +01003893 * modes:
Camilla Berglund13ccf7d2013-04-07 13:46:38 +02003894 * - `GLFW_CURSOR_NORMAL` makes the cursor visible and behaving normally.
Camilla Löwyd5ab3e92019-01-22 20:54:16 +01003895 * - `GLFW_CURSOR_HIDDEN` makes the cursor invisible when it is over the
3896 * content area of the window but does not restrict the cursor from leaving.
Camilla Berglunda18b1872013-12-05 03:27:12 +01003897 * - `GLFW_CURSOR_DISABLED` hides and grabs the cursor, providing virtual
3898 * and unlimited cursor movement. This is useful for implementing for
3899 * example 3D camera controls.
Camilla Berglund39fe1f12013-03-12 19:39:36 +01003900 *
Camilla Berglund0eccf752015-08-23 19:30:04 +02003901 * If the mode is `GLFW_STICKY_KEYS`, the value must be either `GLFW_TRUE` to
3902 * enable sticky keys, or `GLFW_FALSE` to disable it. If sticky keys are
Camilla Berglund95654cf2014-10-02 17:35:10 +02003903 * enabled, a key press will ensure that @ref glfwGetKey returns `GLFW_PRESS`
3904 * the next time it is called even if the key had been released before the
3905 * call. This is useful when you are only interested in whether keys have been
3906 * pressed but not when or in which order.
Camilla Berglund39fe1f12013-03-12 19:39:36 +01003907 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003908 * If the mode is `GLFW_STICKY_MOUSE_BUTTONS`, the value must be either
Camilla Berglund0eccf752015-08-23 19:30:04 +02003909 * `GLFW_TRUE` to enable sticky mouse buttons, or `GLFW_FALSE` to disable it.
3910 * If sticky mouse buttons are enabled, a mouse button press will ensure that
3911 * @ref glfwGetMouseButton returns `GLFW_PRESS` the next time it is called even
3912 * if the mouse button had been released before the call. This is useful when
3913 * you are only interested in whether mouse buttons have been pressed but not
3914 * when or in which order.
Camilla Berglund95654cf2014-10-02 17:35:10 +02003915 *
Camilla Löwy0e8c4ea2017-11-29 20:42:37 +01003916 * If the mode is `GLFW_LOCK_KEY_MODS`, the value must be either `GLFW_TRUE` to
3917 * enable lock key modifier bits, or `GLFW_FALSE` to disable them. If enabled,
3918 * callbacks that receive modifier bits will also have the @ref
3919 * GLFW_MOD_CAPS_LOCK bit set when the event was generated with Caps Lock on,
3920 * and the @ref GLFW_MOD_NUM_LOCK bit when Num Lock was on.
3921 *
Camilla Löwy1155c832019-02-11 19:10:20 +01003922 * If the mode is `GLFW_RAW_MOUSE_MOTION`, the value must be either `GLFW_TRUE`
3923 * to enable raw (unscaled and unaccelerated) mouse motion when the cursor is
3924 * disabled, or `GLFW_FALSE` to disable it. If raw motion is not supported,
3925 * attempting to set this will emit @ref GLFW_PLATFORM_ERROR. Call @ref
3926 * glfwRawMouseMotionSupported to check for support.
Nathan Poirier9e29f552018-12-14 03:08:25 +01003927 *
Camilla Berglund95654cf2014-10-02 17:35:10 +02003928 * @param[in] window The window whose input mode to set.
Camilla Löwy0e8c4ea2017-11-29 20:42:37 +01003929 * @param[in] mode One of `GLFW_CURSOR`, `GLFW_STICKY_KEYS`,
Camilla Löwy1155c832019-02-11 19:10:20 +01003930 * `GLFW_STICKY_MOUSE_BUTTONS`, `GLFW_LOCK_KEY_MODS` or
3931 * `GLFW_RAW_MOUSE_MOTION`.
Camilla Berglund95654cf2014-10-02 17:35:10 +02003932 * @param[in] value The new value of the specified input mode.
Camilla Berglund39fe1f12013-03-12 19:39:36 +01003933 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003934 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
3935 * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR.
3936 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003937 * @thread_safety This function must only be called from the main thread.
Camilla Berglund0e205772014-03-24 11:58:35 +01003938 *
Camilla Berglund7e9e3212016-09-14 20:17:26 +02003939 * @sa @ref glfwGetInputMode
Camilla Berglunde248fb62013-03-29 14:06:23 +01003940 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003941 * @since Added in version 3.0. Replaces `glfwEnable` and `glfwDisable`.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003942 *
Camilla Berglunde248fb62013-03-29 14:06:23 +01003943 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003944 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01003945GLFWAPI void glfwSetInputMode(GLFWwindow* window, int mode, int value);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003946
Camilla Löwy1155c832019-02-11 19:10:20 +01003947/*! @brief Returns whether raw mouse motion is supported.
Nathan Poirier9e29f552018-12-14 03:08:25 +01003948 *
Camilla Löwy1155c832019-02-11 19:10:20 +01003949 * This function returns whether raw mouse motion is supported on the current
3950 * system. This status does not change after GLFW has been initialized so you
3951 * only need to check this once. If you attempt to enable raw motion on
3952 * a system that does not support it, @ref GLFW_PLATFORM_ERROR will be emitted.
Nathan Poirier9e29f552018-12-14 03:08:25 +01003953 *
Camilla Löwy1155c832019-02-11 19:10:20 +01003954 * Raw mouse motion is closer to the actual motion of the mouse across
3955 * a surface. It is not affected by the scaling and acceleration applied to
3956 * the motion of the desktop cursor. That processing is suitable for a cursor
3957 * while raw motion is better for controlling for example a 3D camera. Because
3958 * of this, raw mouse motion is only provided when the cursor is disabled.
Nathan Poirier9e29f552018-12-14 03:08:25 +01003959 *
Camilla Löwy1155c832019-02-11 19:10:20 +01003960 * @return `GLFW_TRUE` if raw mouse motion is supported on the current machine,
3961 * or `GLFW_FALSE` otherwise.
Nathan Poirier9e29f552018-12-14 03:08:25 +01003962 *
3963 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
3964 *
Camilla Löwy1155c832019-02-11 19:10:20 +01003965 * @thread_safety This function must only be called from the main thread.
Nathan Poirier9e29f552018-12-14 03:08:25 +01003966 *
Camilla Löwy1155c832019-02-11 19:10:20 +01003967 * @sa @ref raw_mouse_motion
Nathan Poirier9e29f552018-12-14 03:08:25 +01003968 * @sa @ref glfwSetInputMode
3969 *
3970 * @since Added in version 3.3.
3971 *
3972 * @ingroup input
3973 */
Camilla Löwy1155c832019-02-11 19:10:20 +01003974GLFWAPI int glfwRawMouseMotionSupported(void);
Nathan Poirier9e29f552018-12-14 03:08:25 +01003975
Camilla Löwy9558b852017-04-04 18:05:36 +02003976/*! @brief Returns the layout-specific name of the specified printable key.
Camilla Berglund9c315412015-07-02 14:24:50 +02003977 *
Camilla Löwy9558b852017-04-04 18:05:36 +02003978 * This function returns the name of the specified printable key, encoded as
3979 * UTF-8. This is typically the character that key would produce without any
3980 * modifier keys, intended for displaying key bindings to the user. For dead
3981 * keys, it is typically the diacritic it would add to a character.
Camilla Berglund9c315412015-07-02 14:24:50 +02003982 *
Camilla Löwy071a0492017-02-28 22:29:10 +01003983 * __Do not use this function__ for [text input](@ref input_char). You will
3984 * break text input for many languages even if it happens to work for yours.
Camilla Berglund70ffae72016-02-22 11:54:56 +01003985 *
Camilla Löwy071a0492017-02-28 22:29:10 +01003986 * If the key is `GLFW_KEY_UNKNOWN`, the scancode is used to identify the key,
3987 * otherwise the scancode is ignored. If you specify a non-printable key, or
3988 * `GLFW_KEY_UNKNOWN` and a scancode that maps to a non-printable key, this
3989 * function returns `NULL` but does not emit an error.
3990 *
3991 * This behavior allows you to always pass in the arguments in the
Camilla Berglund70ffae72016-02-22 11:54:56 +01003992 * [key callback](@ref input_key) without modification.
3993 *
3994 * The printable keys are:
3995 * - `GLFW_KEY_APOSTROPHE`
3996 * - `GLFW_KEY_COMMA`
3997 * - `GLFW_KEY_MINUS`
3998 * - `GLFW_KEY_PERIOD`
3999 * - `GLFW_KEY_SLASH`
4000 * - `GLFW_KEY_SEMICOLON`
4001 * - `GLFW_KEY_EQUAL`
4002 * - `GLFW_KEY_LEFT_BRACKET`
4003 * - `GLFW_KEY_RIGHT_BRACKET`
4004 * - `GLFW_KEY_BACKSLASH`
4005 * - `GLFW_KEY_WORLD_1`
4006 * - `GLFW_KEY_WORLD_2`
4007 * - `GLFW_KEY_0` to `GLFW_KEY_9`
4008 * - `GLFW_KEY_A` to `GLFW_KEY_Z`
4009 * - `GLFW_KEY_KP_0` to `GLFW_KEY_KP_9`
4010 * - `GLFW_KEY_KP_DECIMAL`
4011 * - `GLFW_KEY_KP_DIVIDE`
4012 * - `GLFW_KEY_KP_MULTIPLY`
4013 * - `GLFW_KEY_KP_SUBTRACT`
4014 * - `GLFW_KEY_KP_ADD`
4015 * - `GLFW_KEY_KP_EQUAL`
Camilla Berglund9c315412015-07-02 14:24:50 +02004016 *
Camilla Löwy071a0492017-02-28 22:29:10 +01004017 * Names for printable keys depend on keyboard layout, while names for
4018 * non-printable keys are the same across layouts but depend on the application
4019 * language and should be localized along with other user interface text.
4020 *
Camilla Berglund9c315412015-07-02 14:24:50 +02004021 * @param[in] key The key to query, or `GLFW_KEY_UNKNOWN`.
4022 * @param[in] scancode The scancode of the key to query.
Camilla Löwy9558b852017-04-04 18:05:36 +02004023 * @return The UTF-8 encoded, layout-specific name of the key, or `NULL`.
Camilla Berglund9c315412015-07-02 14:24:50 +02004024 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01004025 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
4026 * GLFW_PLATFORM_ERROR.
4027 *
Camilla Berglund951a9582016-01-31 21:32:14 +01004028 * @pointer_lifetime The returned string is allocated and freed by GLFW. You
4029 * should not free it yourself. It is valid until the next call to @ref
4030 * glfwGetKeyName, or until the library is terminated.
Camilla Berglund9c315412015-07-02 14:24:50 +02004031 *
Camilla Berglund951a9582016-01-31 21:32:14 +01004032 * @thread_safety This function must only be called from the main thread.
Camilla Berglund9c315412015-07-02 14:24:50 +02004033 *
4034 * @sa @ref input_key_name
4035 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01004036 * @since Added in version 3.2.
Camilla Berglund9c315412015-07-02 14:24:50 +02004037 *
4038 * @ingroup input
4039 */
4040GLFWAPI const char* glfwGetKeyName(int key, int scancode);
4041
Camilla Löwy766a9dc2016-12-06 23:26:53 +01004042/*! @brief Returns the platform-specific scancode of the specified key.
Michael Stockere745b0d2016-08-11 19:11:40 +02004043 *
Camilla Löwy766a9dc2016-12-06 23:26:53 +01004044 * This function returns the platform-specific scancode of the specified key.
Michael Stockere745b0d2016-08-11 19:11:40 +02004045 *
4046 * If the key is `GLFW_KEY_UNKNOWN` or does not exist on the keyboard this
4047 * method will return `-1`.
4048 *
Camilla Löwy766a9dc2016-12-06 23:26:53 +01004049 * @param[in] key Any [named key](@ref keys).
4050 * @return The platform-specific scancode for the key, or `-1` if an
Camilla Berglundbb3cb8f2016-09-06 15:40:31 +02004051 * [error](@ref error_handling) occurred.
Michael Stockere745b0d2016-08-11 19:11:40 +02004052 *
Camilla Berglundbb3cb8f2016-09-06 15:40:31 +02004053 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
4054 * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR.
Michael Stockere745b0d2016-08-11 19:11:40 +02004055 *
4056 * @thread_safety This function may be called from any thread.
4057 *
Camilla Löwy766a9dc2016-12-06 23:26:53 +01004058 * @sa @ref input_key
Michael Stockere745b0d2016-08-11 19:11:40 +02004059 *
4060 * @since Added in version 3.3.
4061 *
4062 * @ingroup input
4063 */
Camilla Berglundbb3cb8f2016-09-06 15:40:31 +02004064GLFWAPI int glfwGetKeyScancode(int key);
Michael Stockere745b0d2016-08-11 19:11:40 +02004065
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004066/*! @brief Returns the last reported state of a keyboard key for the specified
4067 * window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004068 *
4069 * This function returns the last state reported for the specified key to the
4070 * specified window. The returned state is one of `GLFW_PRESS` or
Camilla Berglund4591ad22014-09-18 15:03:29 +02004071 * `GLFW_RELEASE`. The higher-level action `GLFW_REPEAT` is only reported to
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004072 * the key callback.
4073 *
Camilla Löwy46393072017-02-20 13:45:11 +01004074 * If the @ref GLFW_STICKY_KEYS input mode is enabled, this function returns
Camilla Berglund4591ad22014-09-18 15:03:29 +02004075 * `GLFW_PRESS` the first time you call it for a key that was pressed, even if
4076 * that key has already been released.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004077 *
4078 * The key functions deal with physical keys, with [key tokens](@ref keys)
4079 * named after their use on the standard US keyboard layout. If you want to
4080 * input text, use the Unicode character callback instead.
4081 *
Camilla Berglunde8e05d42014-04-23 13:30:11 +02004082 * The [modifier key bit masks](@ref mods) are not key tokens and cannot be
4083 * used with this function.
4084 *
Camilla Berglund9c315412015-07-02 14:24:50 +02004085 * __Do not use this function__ to implement [text input](@ref input_char).
4086 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004087 * @param[in] window The desired window.
Camilla Berglund4591ad22014-09-18 15:03:29 +02004088 * @param[in] key The desired [keyboard key](@ref keys). `GLFW_KEY_UNKNOWN` is
4089 * not a valid key for this function.
Camilla Berglund71d2b572013-03-12 15:33:05 +01004090 * @return One of `GLFW_PRESS` or `GLFW_RELEASE`.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004091 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01004092 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
4093 * GLFW_INVALID_ENUM.
4094 *
Camilla Berglund951a9582016-01-31 21:32:14 +01004095 * @thread_safety This function must only be called from the main thread.
Camilla Berglund0e205772014-03-24 11:58:35 +01004096 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02004097 * @sa @ref input_key
4098 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01004099 * @since Added in version 1.0.
Camilla Berglund951a9582016-01-31 21:32:14 +01004100 * @glfw3 Added window handle parameter.
Camilla Berglund11615fc2013-05-30 17:19:12 +02004101 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004102 * @ingroup input
4103 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01004104GLFWAPI int glfwGetKey(GLFWwindow* window, int key);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004105
4106/*! @brief Returns the last reported state of a mouse button for the specified
4107 * window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004108 *
4109 * This function returns the last state reported for the specified mouse button
Camilla Berglund4591ad22014-09-18 15:03:29 +02004110 * to the specified window. The returned state is one of `GLFW_PRESS` or
Camilla Berglundce8f97c2015-01-11 23:33:14 +01004111 * `GLFW_RELEASE`.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004112 *
Camilla Löwy46393072017-02-20 13:45:11 +01004113 * If the @ref GLFW_STICKY_MOUSE_BUTTONS input mode is enabled, this function
Coşku Başf4764f72018-08-06 18:13:24 +03004114 * returns `GLFW_PRESS` the first time you call it for a mouse button that was
4115 * pressed, even if that mouse button has already been released.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004116 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004117 * @param[in] window The desired window.
Camilla Berglund71d2b572013-03-12 15:33:05 +01004118 * @param[in] button The desired [mouse button](@ref buttons).
4119 * @return One of `GLFW_PRESS` or `GLFW_RELEASE`.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004120 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01004121 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
4122 * GLFW_INVALID_ENUM.
4123 *
Camilla Berglund951a9582016-01-31 21:32:14 +01004124 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02004125 *
4126 * @sa @ref input_mouse_button
4127 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01004128 * @since Added in version 1.0.
Camilla Berglund951a9582016-01-31 21:32:14 +01004129 * @glfw3 Added window handle parameter.
Camilla Berglund0e205772014-03-24 11:58:35 +01004130 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004131 * @ingroup input
4132 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01004133GLFWAPI int glfwGetMouseButton(GLFWwindow* window, int button);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004134
Camilla Löwyd5ab3e92019-01-22 20:54:16 +01004135/*! @brief Retrieves the position of the cursor relative to the content area of
Camilla Berglundd4591452014-02-11 18:24:01 +01004136 * the window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004137 *
Camilla Berglundd4591452014-02-11 18:24:01 +01004138 * This function returns the position of the cursor, in screen coordinates,
Camilla Löwyd5ab3e92019-01-22 20:54:16 +01004139 * relative to the upper-left corner of the content area of the specified
Camilla Berglundd4591452014-02-11 18:24:01 +01004140 * window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004141 *
Camilla Berglund6df692b2013-04-26 17:20:31 +02004142 * If the cursor is disabled (with `GLFW_CURSOR_DISABLED`) then the cursor
4143 * position is unbounded and limited only by the minimum and maximum values of
4144 * a `double`.
Camilla Berglund948cc042013-04-16 02:02:22 +02004145 *
Camilla Berglund3ec29252013-04-25 18:03:15 +02004146 * The coordinate can be converted to their integer equivalents with the
4147 * `floor` function. Casting directly to an integer type works for positive
4148 * coordinates, but fails for negative ones.
4149 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02004150 * Any or all of the position arguments may be `NULL`. If an error occurs, all
4151 * non-`NULL` position arguments will be set to zero.
4152 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004153 * @param[in] window The desired window.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02004154 * @param[out] xpos Where to store the cursor x-coordinate, relative to the
Camilla Löwyd5ab3e92019-01-22 20:54:16 +01004155 * left edge of the content area, or `NULL`.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02004156 * @param[out] ypos Where to store the cursor y-coordinate, relative to the to
Camilla Löwyd5ab3e92019-01-22 20:54:16 +01004157 * top edge of the content area, or `NULL`.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004158 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01004159 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
4160 * GLFW_PLATFORM_ERROR.
4161 *
Camilla Berglund951a9582016-01-31 21:32:14 +01004162 * @thread_safety This function must only be called from the main thread.
Camilla Berglund0e205772014-03-24 11:58:35 +01004163 *
Camilla Berglund4188c262015-01-18 01:55:25 +01004164 * @sa @ref cursor_pos
Camilla Berglund7e9e3212016-09-14 20:17:26 +02004165 * @sa @ref glfwSetCursorPos
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004166 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01004167 * @since Added in version 3.0. Replaces `glfwGetMousePos`.
Camilla Berglund4591ad22014-09-18 15:03:29 +02004168 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004169 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004170 */
Camilla Berglund129e94d2013-04-04 16:16:21 +02004171GLFWAPI void glfwGetCursorPos(GLFWwindow* window, double* xpos, double* ypos);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004172
Camilla Löwyd5ab3e92019-01-22 20:54:16 +01004173/*! @brief Sets the position of the cursor, relative to the content area of the
Camilla Berglund6d9d8562013-09-28 22:12:50 +02004174 * window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004175 *
Camilla Berglund6d9d8562013-09-28 22:12:50 +02004176 * This function sets the position, in screen coordinates, of the cursor
Camilla Löwyd5ab3e92019-01-22 20:54:16 +01004177 * relative to the upper-left corner of the content area of the specified
Camilla Berglund4188c262015-01-18 01:55:25 +01004178 * window. The window must have input focus. If the window does not have
4179 * input focus when this function is called, it fails silently.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004180 *
Camilla Berglund20858762015-01-01 18:41:22 +01004181 * __Do not use this function__ to implement things like camera controls. GLFW
4182 * already provides the `GLFW_CURSOR_DISABLED` cursor mode that hides the
4183 * cursor, transparently re-centers it and provides unconstrained cursor
4184 * motion. See @ref glfwSetInputMode for more information.
4185 *
4186 * If the cursor mode is `GLFW_CURSOR_DISABLED` then the cursor position is
4187 * unconstrained and limited only by the minimum and maximum values of
Camilla Berglund6df692b2013-04-26 17:20:31 +02004188 * a `double`.
Camilla Berglund948cc042013-04-16 02:02:22 +02004189 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004190 * @param[in] window The desired window.
4191 * @param[in] xpos The desired x-coordinate, relative to the left edge of the
Camilla Löwyd5ab3e92019-01-22 20:54:16 +01004192 * content area.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004193 * @param[in] ypos The desired y-coordinate, relative to the top edge of the
Camilla Löwyd5ab3e92019-01-22 20:54:16 +01004194 * content area.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004195 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01004196 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
4197 * GLFW_PLATFORM_ERROR.
4198 *
linkmauvebc8b0482016-10-16 15:52:39 +01004199 * @remark @wayland This function will only work when the cursor mode is
4200 * `GLFW_CURSOR_DISABLED`, otherwise it will do nothing.
4201 *
Camilla Berglund951a9582016-01-31 21:32:14 +01004202 * @thread_safety This function must only be called from the main thread.
Camilla Berglund0e205772014-03-24 11:58:35 +01004203 *
Camilla Berglund4188c262015-01-18 01:55:25 +01004204 * @sa @ref cursor_pos
Camilla Berglund7e9e3212016-09-14 20:17:26 +02004205 * @sa @ref glfwGetCursorPos
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004206 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01004207 * @since Added in version 3.0. Replaces `glfwSetMousePos`.
Camilla Berglund4591ad22014-09-18 15:03:29 +02004208 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004209 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004210 */
Camilla Berglund129e94d2013-04-04 16:16:21 +02004211GLFWAPI void glfwSetCursorPos(GLFWwindow* window, double xpos, double ypos);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004212
Camilla Berglund2a1375e2014-09-02 16:52:16 +02004213/*! @brief Creates a custom cursor.
urraka40c04a72013-12-04 10:19:22 -03004214 *
Camilla Berglund4188c262015-01-18 01:55:25 +01004215 * Creates a new custom cursor image that can be set for a window with @ref
4216 * glfwSetCursor. The cursor can be destroyed with @ref glfwDestroyCursor.
4217 * Any remaining cursors are destroyed by @ref glfwTerminate.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02004218 *
Camilla Berglund85a01bf2015-08-17 21:04:19 +02004219 * The pixels are 32-bit, little-endian, non-premultiplied RGBA, i.e. eight
Camilla Löwybeaeb0d2017-06-06 18:17:58 +02004220 * bits per channel with the red channel first. They are arranged canonically
4221 * as packed sequential rows, starting from the top-left corner.
Camilla Berglund4188c262015-01-18 01:55:25 +01004222 *
4223 * The cursor hotspot is specified in pixels, relative to the upper-left corner
4224 * of the cursor image. Like all other coordinate systems in GLFW, the X-axis
4225 * points to the right and the Y-axis points down.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02004226 *
Camilla Berglund8fa9cc02014-02-23 16:43:17 +01004227 * @param[in] image The desired cursor image.
Camilla Berglund4188c262015-01-18 01:55:25 +01004228 * @param[in] xhot The desired x-coordinate, in pixels, of the cursor hotspot.
4229 * @param[in] yhot The desired y-coordinate, in pixels, of the cursor hotspot.
Camilla Berglund4188c262015-01-18 01:55:25 +01004230 * @return The handle of the created cursor, or `NULL` if an
Camilla Berglund4591ad22014-09-18 15:03:29 +02004231 * [error](@ref error_handling) occurred.
urraka40c04a72013-12-04 10:19:22 -03004232 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01004233 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
4234 * GLFW_PLATFORM_ERROR.
4235 *
Camilla Berglund951a9582016-01-31 21:32:14 +01004236 * @pointer_lifetime The specified image data is copied before this function
4237 * returns.
Camilla Berglund4591ad22014-09-18 15:03:29 +02004238 *
Camilla Berglund951a9582016-01-31 21:32:14 +01004239 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02004240 *
Camilla Berglund4188c262015-01-18 01:55:25 +01004241 * @sa @ref cursor_object
Camilla Berglund7e9e3212016-09-14 20:17:26 +02004242 * @sa @ref glfwDestroyCursor
4243 * @sa @ref glfwCreateStandardCursor
Camilla Berglund4591ad22014-09-18 15:03:29 +02004244 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01004245 * @since Added in version 3.1.
urraka40c04a72013-12-04 10:19:22 -03004246 *
4247 * @ingroup input
4248 */
Camilla Berglund8fa9cc02014-02-23 16:43:17 +01004249GLFWAPI GLFWcursor* glfwCreateCursor(const GLFWimage* image, int xhot, int yhot);
urraka40c04a72013-12-04 10:19:22 -03004250
Camilla Berglund2a1375e2014-09-02 16:52:16 +02004251/*! @brief Creates a cursor with a standard shape.
4252 *
Camilla Berglund4188c262015-01-18 01:55:25 +01004253 * Returns a cursor with a [standard shape](@ref shapes), that can be set for
4254 * a window with @ref glfwSetCursor.
Camilla Berglund2a1375e2014-09-02 16:52:16 +02004255 *
4256 * @param[in] shape One of the [standard shapes](@ref shapes).
Camilla Berglund2a1375e2014-09-02 16:52:16 +02004257 * @return A new cursor ready to use or `NULL` if an
4258 * [error](@ref error_handling) occurred.
4259 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01004260 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
4261 * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR.
4262 *
Camilla Berglund951a9582016-01-31 21:32:14 +01004263 * @thread_safety This function must only be called from the main thread.
Camilla Berglund2a1375e2014-09-02 16:52:16 +02004264 *
Camilla Berglund4188c262015-01-18 01:55:25 +01004265 * @sa @ref cursor_object
Camilla Berglund7e9e3212016-09-14 20:17:26 +02004266 * @sa @ref glfwCreateCursor
Camilla Berglund2a1375e2014-09-02 16:52:16 +02004267 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01004268 * @since Added in version 3.1.
Camilla Berglund2a1375e2014-09-02 16:52:16 +02004269 *
4270 * @ingroup input
4271 */
4272GLFWAPI GLFWcursor* glfwCreateStandardCursor(int shape);
4273
urraka40c04a72013-12-04 10:19:22 -03004274/*! @brief Destroys a cursor.
4275 *
Camilla Berglunde8e05d42014-04-23 13:30:11 +02004276 * This function destroys a cursor previously created with @ref
4277 * glfwCreateCursor. Any remaining cursors will be destroyed by @ref
4278 * glfwTerminate.
urraka40c04a72013-12-04 10:19:22 -03004279 *
Camilla Löwy46393072017-02-20 13:45:11 +01004280 * If the specified cursor is current for any window, that window will be
4281 * reverted to the default cursor. This does not affect the cursor mode.
4282 *
Camilla Berglunde8e05d42014-04-23 13:30:11 +02004283 * @param[in] cursor The cursor object to destroy.
urraka40c04a72013-12-04 10:19:22 -03004284 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01004285 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
4286 * GLFW_PLATFORM_ERROR.
4287 *
Camilla Berglund951a9582016-01-31 21:32:14 +01004288 * @reentrancy This function must not be called from a callback.
Camilla Berglund4591ad22014-09-18 15:03:29 +02004289 *
Camilla Berglund951a9582016-01-31 21:32:14 +01004290 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02004291 *
Camilla Berglund4188c262015-01-18 01:55:25 +01004292 * @sa @ref cursor_object
Camilla Berglund7e9e3212016-09-14 20:17:26 +02004293 * @sa @ref glfwCreateCursor
Camilla Berglund4591ad22014-09-18 15:03:29 +02004294 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01004295 * @since Added in version 3.1.
urraka40c04a72013-12-04 10:19:22 -03004296 *
4297 * @ingroup input
4298 */
4299GLFWAPI void glfwDestroyCursor(GLFWcursor* cursor);
4300
Camilla Berglund4188c262015-01-18 01:55:25 +01004301/*! @brief Sets the cursor for the window.
urraka40c04a72013-12-04 10:19:22 -03004302 *
Camilla Berglund4188c262015-01-18 01:55:25 +01004303 * This function sets the cursor image to be used when the cursor is over the
Camilla Löwyd5ab3e92019-01-22 20:54:16 +01004304 * content area of the specified window. The set cursor will only be visible
Camilla Berglund4188c262015-01-18 01:55:25 +01004305 * when the [cursor mode](@ref cursor_mode) of the window is
4306 * `GLFW_CURSOR_NORMAL`.
Camilla Berglund4591ad22014-09-18 15:03:29 +02004307 *
Camilla Berglund4188c262015-01-18 01:55:25 +01004308 * On some platforms, the set cursor may not be visible unless the window also
4309 * has input focus.
4310 *
4311 * @param[in] window The window to set the cursor for.
4312 * @param[in] cursor The cursor to set, or `NULL` to switch back to the default
4313 * arrow cursor.
urraka40c04a72013-12-04 10:19:22 -03004314 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01004315 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
4316 * GLFW_PLATFORM_ERROR.
4317 *
Camilla Berglund951a9582016-01-31 21:32:14 +01004318 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02004319 *
Camilla Berglund4188c262015-01-18 01:55:25 +01004320 * @sa @ref cursor_object
Camilla Berglund4591ad22014-09-18 15:03:29 +02004321 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01004322 * @since Added in version 3.1.
Camilla Berglund0e205772014-03-24 11:58:35 +01004323 *
urraka40c04a72013-12-04 10:19:22 -03004324 * @ingroup input
4325 */
4326GLFWAPI void glfwSetCursor(GLFWwindow* window, GLFWcursor* cursor);
4327
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004328/*! @brief Sets the key callback.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004329 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02004330 * This function sets the key callback of the specified window, which is called
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004331 * when a key is pressed, repeated or released.
4332 *
Camilla Berglund948cc042013-04-16 02:02:22 +02004333 * The key functions deal with physical keys, with layout independent
4334 * [key tokens](@ref keys) named after their values in the standard US keyboard
Camilla Berglund5fd409b2013-06-05 17:53:13 +02004335 * layout. If you want to input text, use the
4336 * [character callback](@ref glfwSetCharCallback) instead.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004337 *
Camilla Berglund4188c262015-01-18 01:55:25 +01004338 * When a window loses input focus, it will generate synthetic key release
4339 * events for all pressed keys. You can tell these events from user-generated
4340 * events by the fact that the synthetic ones are generated after the focus
4341 * loss event has been processed, i.e. after the
4342 * [window focus callback](@ref glfwSetWindowFocusCallback) has been called.
Camilla Berglund4538a522013-04-24 19:49:46 +02004343 *
Camilla Berglund11615fc2013-05-30 17:19:12 +02004344 * The scancode of a key is specific to that platform or sometimes even to that
4345 * machine. Scancodes are intended to allow users to bind keys that don't have
4346 * a GLFW key token. Such keys have `key` set to `GLFW_KEY_UNKNOWN`, their
Camilla Berglund4591ad22014-09-18 15:03:29 +02004347 * state is not saved and so it cannot be queried with @ref glfwGetKey.
Camilla Berglund11615fc2013-05-30 17:19:12 +02004348 *
4349 * Sometimes GLFW needs to generate synthetic key events, in which case the
4350 * scancode may be zero.
4351 *
Camilla Berglund9492fc52013-01-17 17:51:12 +01004352 * @param[in] window The window whose callback to set.
Camilla Berglund71d2b572013-03-12 15:33:05 +01004353 * @param[in] cbfun The new key callback, or `NULL` to remove the currently
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004354 * set callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02004355 * @return The previously set callback, or `NULL` if no callback was set or the
4356 * library had not been [initialized](@ref intro_init).
Camilla Berglund11a27de2013-04-08 21:21:21 +02004357 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01004358 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
4359 *
Camilla Berglund951a9582016-01-31 21:32:14 +01004360 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02004361 *
4362 * @sa @ref input_key
4363 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01004364 * @since Added in version 1.0.
4365 * @glfw3 Added window handle parameter and return value.
Camilla Berglund0e205772014-03-24 11:58:35 +01004366 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004367 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004368 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02004369GLFWAPI GLFWkeyfun glfwSetKeyCallback(GLFWwindow* window, GLFWkeyfun cbfun);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004370
4371/*! @brief Sets the Unicode character callback.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004372 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02004373 * This function sets the character callback of the specified window, which is
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004374 * called when a Unicode character is input.
4375 *
Camilla Berglund96b12ee2014-06-12 23:04:20 +02004376 * The character callback is intended for Unicode text input. As it deals with
4377 * characters, it is keyboard layout dependent, whereas the
4378 * [key callback](@ref glfwSetKeyCallback) is not. Characters do not map 1:1
4379 * to physical keys, as a key may produce zero, one or more characters. If you
4380 * want to know whether a specific physical key was pressed or released, see
4381 * the key callback instead.
4382 *
4383 * The character callback behaves as system text input normally does and will
4384 * not be called if modifier keys are held down that would prevent normal text
Camilla Berglund8d6f2652016-10-20 00:50:54 +02004385 * input on that platform, for example a Super (Command) key on macOS or Alt key
Camilla Löwy86e7bf42018-12-25 22:11:23 +01004386 * on Windows.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004387 *
Camilla Berglund9492fc52013-01-17 17:51:12 +01004388 * @param[in] window The window whose callback to set.
Camilla Berglund71d2b572013-03-12 15:33:05 +01004389 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
Camilla Berglunddba2d802013-01-17 23:06:56 +01004390 * callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02004391 * @return The previously set callback, or `NULL` if no callback was set or the
4392 * library had not been [initialized](@ref intro_init).
Camilla Berglund11a27de2013-04-08 21:21:21 +02004393 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01004394 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
4395 *
Camilla Berglund951a9582016-01-31 21:32:14 +01004396 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02004397 *
4398 * @sa @ref input_char
4399 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01004400 * @since Added in version 2.4.
4401 * @glfw3 Added window handle parameter and return value.
Camilla Berglund0e205772014-03-24 11:58:35 +01004402 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004403 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004404 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02004405GLFWAPI GLFWcharfun glfwSetCharCallback(GLFWwindow* window, GLFWcharfun cbfun);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004406
Camilla Berglund96b12ee2014-06-12 23:04:20 +02004407/*! @brief Sets the Unicode character with modifiers callback.
4408 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02004409 * This function sets the character with modifiers callback of the specified
Camilla Berglund96b12ee2014-06-12 23:04:20 +02004410 * window, which is called when a Unicode character is input regardless of what
4411 * modifier keys are used.
4412 *
4413 * The character with modifiers callback is intended for implementing custom
4414 * Unicode character input. For regular Unicode text input, see the
4415 * [character callback](@ref glfwSetCharCallback). Like the character
4416 * callback, the character with modifiers callback deals with characters and is
4417 * keyboard layout dependent. Characters do not map 1:1 to physical keys, as
4418 * a key may produce zero, one or more characters. If you want to know whether
4419 * a specific physical key was pressed or released, see the
4420 * [key callback](@ref glfwSetKeyCallback) instead.
4421 *
4422 * @param[in] window The window whose callback to set.
4423 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
4424 * callback.
4425 * @return The previously set callback, or `NULL` if no callback was set or an
Camilla Berglund999f3552016-08-17 16:48:22 +02004426 * [error](@ref error_handling) occurred.
Camilla Berglund96b12ee2014-06-12 23:04:20 +02004427 *
Camilla Löwyadebcc72017-11-14 23:28:12 +01004428 * @deprecated Scheduled for removal in version 4.0.
4429 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01004430 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
4431 *
Camilla Berglund951a9582016-01-31 21:32:14 +01004432 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02004433 *
4434 * @sa @ref input_char
4435 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01004436 * @since Added in version 3.1.
Camilla Berglund96b12ee2014-06-12 23:04:20 +02004437 *
4438 * @ingroup input
4439 */
4440GLFWAPI GLFWcharmodsfun glfwSetCharModsCallback(GLFWwindow* window, GLFWcharmodsfun cbfun);
4441
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004442/*! @brief Sets the mouse button callback.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004443 *
4444 * This function sets the mouse button callback of the specified window, which
4445 * is called when a mouse button is pressed or released.
4446 *
Camilla Berglund4188c262015-01-18 01:55:25 +01004447 * When a window loses input focus, it will generate synthetic mouse button
4448 * release events for all pressed mouse buttons. You can tell these events
4449 * from user-generated events by the fact that the synthetic ones are generated
4450 * after the focus loss event has been processed, i.e. after the
4451 * [window focus callback](@ref glfwSetWindowFocusCallback) has been called.
Camilla Berglund4538a522013-04-24 19:49:46 +02004452 *
Camilla Berglund9492fc52013-01-17 17:51:12 +01004453 * @param[in] window The window whose callback to set.
Camilla Berglund71d2b572013-03-12 15:33:05 +01004454 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
Camilla Berglunddba2d802013-01-17 23:06:56 +01004455 * callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02004456 * @return The previously set callback, or `NULL` if no callback was set or the
4457 * library had not been [initialized](@ref intro_init).
Camilla Berglund11a27de2013-04-08 21:21:21 +02004458 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01004459 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
4460 *
Camilla Berglund951a9582016-01-31 21:32:14 +01004461 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02004462 *
4463 * @sa @ref input_mouse_button
4464 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01004465 * @since Added in version 1.0.
4466 * @glfw3 Added window handle parameter and return value.
Camilla Berglund0e205772014-03-24 11:58:35 +01004467 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004468 * @ingroup input
4469 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02004470GLFWAPI GLFWmousebuttonfun glfwSetMouseButtonCallback(GLFWwindow* window, GLFWmousebuttonfun cbfun);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004471
4472/*! @brief Sets the cursor position callback.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004473 *
4474 * This function sets the cursor position callback of the specified window,
4475 * which is called when the cursor is moved. The callback is provided with the
Camilla Berglund6d9d8562013-09-28 22:12:50 +02004476 * position, in screen coordinates, relative to the upper-left corner of the
Camilla Löwyd5ab3e92019-01-22 20:54:16 +01004477 * content area of the window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004478 *
Camilla Berglund9492fc52013-01-17 17:51:12 +01004479 * @param[in] window The window whose callback to set.
Camilla Berglund71d2b572013-03-12 15:33:05 +01004480 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
Camilla Berglunddba2d802013-01-17 23:06:56 +01004481 * callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02004482 * @return The previously set callback, or `NULL` if no callback was set or the
4483 * library had not been [initialized](@ref intro_init).
Camilla Berglund11a27de2013-04-08 21:21:21 +02004484 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01004485 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
4486 *
Camilla Berglund951a9582016-01-31 21:32:14 +01004487 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02004488 *
Camilla Berglund4188c262015-01-18 01:55:25 +01004489 * @sa @ref cursor_pos
Camilla Berglund4591ad22014-09-18 15:03:29 +02004490 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01004491 * @since Added in version 3.0. Replaces `glfwSetMousePosCallback`.
Camilla Berglund0e205772014-03-24 11:58:35 +01004492 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004493 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004494 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02004495GLFWAPI GLFWcursorposfun glfwSetCursorPosCallback(GLFWwindow* window, GLFWcursorposfun cbfun);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004496
4497/*! @brief Sets the cursor enter/exit callback.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004498 *
4499 * This function sets the cursor boundary crossing callback of the specified
Camilla Löwyd5ab3e92019-01-22 20:54:16 +01004500 * window, which is called when the cursor enters or leaves the content area of
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004501 * the window.
4502 *
Camilla Berglund9492fc52013-01-17 17:51:12 +01004503 * @param[in] window The window whose callback to set.
Camilla Berglund71d2b572013-03-12 15:33:05 +01004504 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
Camilla Berglunddba2d802013-01-17 23:06:56 +01004505 * callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02004506 * @return The previously set callback, or `NULL` if no callback was set or the
4507 * library had not been [initialized](@ref intro_init).
Camilla Berglund11a27de2013-04-08 21:21:21 +02004508 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01004509 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
4510 *
Camilla Berglund951a9582016-01-31 21:32:14 +01004511 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02004512 *
Camilla Berglund4188c262015-01-18 01:55:25 +01004513 * @sa @ref cursor_enter
Camilla Berglund4591ad22014-09-18 15:03:29 +02004514 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01004515 * @since Added in version 3.0.
Camilla Berglund0e205772014-03-24 11:58:35 +01004516 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004517 * @ingroup input
4518 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02004519GLFWAPI GLFWcursorenterfun glfwSetCursorEnterCallback(GLFWwindow* window, GLFWcursorenterfun cbfun);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004520
4521/*! @brief Sets the scroll callback.
Camilla Berglunde248fb62013-03-29 14:06:23 +01004522 *
4523 * This function sets the scroll callback of the specified window, which is
4524 * called when a scrolling device is used, such as a mouse wheel or scrolling
4525 * area of a touchpad.
4526 *
Camilla Berglund5fd409b2013-06-05 17:53:13 +02004527 * The scroll callback receives all scrolling input, like that from a mouse
4528 * wheel or a touchpad scrolling area.
4529 *
Camilla Berglund9492fc52013-01-17 17:51:12 +01004530 * @param[in] window The window whose callback to set.
Camilla Berglund71d2b572013-03-12 15:33:05 +01004531 * @param[in] cbfun The new scroll callback, or `NULL` to remove the currently
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004532 * set callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02004533 * @return The previously set callback, or `NULL` if no callback was set or the
4534 * library had not been [initialized](@ref intro_init).
Camilla Berglund11a27de2013-04-08 21:21:21 +02004535 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01004536 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
4537 *
Camilla Berglund951a9582016-01-31 21:32:14 +01004538 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02004539 *
Camilla Berglund4188c262015-01-18 01:55:25 +01004540 * @sa @ref scrolling
Camilla Berglund4591ad22014-09-18 15:03:29 +02004541 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01004542 * @since Added in version 3.0. Replaces `glfwSetMouseWheelCallback`.
Camilla Berglund0e205772014-03-24 11:58:35 +01004543 *
Camilla Berglunde248fb62013-03-29 14:06:23 +01004544 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004545 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02004546GLFWAPI GLFWscrollfun glfwSetScrollCallback(GLFWwindow* window, GLFWscrollfun cbfun);
Camilla Berglund3249f812010-09-07 17:34:51 +02004547
Camilla Berglund5c8121e2014-03-29 21:35:21 +01004548/*! @brief Sets the file drop callback.
arturo89d07232013-07-10 11:42:14 +02004549 *
Camilla Berglund5c8121e2014-03-29 21:35:21 +01004550 * This function sets the file drop callback of the specified window, which is
4551 * called when one or more dragged files are dropped on the window.
arturo89d07232013-07-10 11:42:14 +02004552 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02004553 * Because the path array and its strings may have been generated specifically
4554 * for that event, they are not guaranteed to be valid after the callback has
4555 * returned. If you wish to use them after the callback returns, you need to
4556 * make a deep copy.
arturo89d07232013-07-10 11:42:14 +02004557 *
4558 * @param[in] window The window whose callback to set.
Camilla Berglund5c8121e2014-03-29 21:35:21 +01004559 * @param[in] cbfun The new file drop callback, or `NULL` to remove the
4560 * currently set callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02004561 * @return The previously set callback, or `NULL` if no callback was set or the
4562 * library had not been [initialized](@ref intro_init).
arturo89d07232013-07-10 11:42:14 +02004563 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01004564 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
4565 *
linkmauvebc8b0482016-10-16 15:52:39 +01004566 * @remark @wayland File drop is currently unimplemented.
4567 *
Camilla Berglund951a9582016-01-31 21:32:14 +01004568 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02004569 *
Camilla Berglund4188c262015-01-18 01:55:25 +01004570 * @sa @ref path_drop
Camilla Berglund4591ad22014-09-18 15:03:29 +02004571 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01004572 * @since Added in version 3.1.
Camilla Berglund0e205772014-03-24 11:58:35 +01004573 *
arturo89d07232013-07-10 11:42:14 +02004574 * @ingroup input
4575 */
4576GLFWAPI GLFWdropfun glfwSetDropCallback(GLFWwindow* window, GLFWdropfun cbfun);
4577
Camilla Berglundfdd45182013-05-27 15:13:09 +02004578/*! @brief Returns whether the specified joystick is present.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004579 *
Camilla Berglundfdd45182013-05-27 15:13:09 +02004580 * This function returns whether the specified joystick is present.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004581 *
Camilla Löwy5bc1c382017-08-04 01:00:36 +02004582 * There is no need to call this function before other functions that accept
4583 * a joystick ID, as they all check for presence before performing any other
4584 * work.
4585 *
Camilla Berglundefc6b352016-10-10 03:24:07 +02004586 * @param[in] jid The [joystick](@ref joysticks) to query.
Camilla Berglund0eccf752015-08-23 19:30:04 +02004587 * @return `GLFW_TRUE` if the joystick is present, or `GLFW_FALSE` otherwise.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004588 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01004589 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
4590 * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR.
4591 *
Camilla Berglund951a9582016-01-31 21:32:14 +01004592 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02004593 *
Camilla Berglund4188c262015-01-18 01:55:25 +01004594 * @sa @ref joystick
Camilla Berglund4591ad22014-09-18 15:03:29 +02004595 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01004596 * @since Added in version 3.0. Replaces `glfwGetJoystickParam`.
Camilla Berglund0e205772014-03-24 11:58:35 +01004597 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004598 * @ingroup input
4599 */
Camilla Berglundefc6b352016-10-10 03:24:07 +02004600GLFWAPI int glfwJoystickPresent(int jid);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004601
Camilla Berglund7f2eb7b2013-04-24 19:25:42 +02004602/*! @brief Returns the values of all axes of the specified joystick.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02004603 *
4604 * This function returns the values of all axes of the specified joystick.
Camilla Berglund4591ad22014-09-18 15:03:29 +02004605 * Each element in the array is a value between -1.0 and 1.0.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02004606 *
Camilla Löwy953106e2017-06-18 15:13:25 +02004607 * If the specified joystick is not present this function will return `NULL`
Camilla Löwy5bc1c382017-08-04 01:00:36 +02004608 * but will not generate an error. This can be used instead of first calling
4609 * @ref glfwJoystickPresent.
Camilla Berglund386b6032016-02-10 13:48:49 +01004610 *
Camilla Berglundefc6b352016-10-10 03:24:07 +02004611 * @param[in] jid The [joystick](@ref joysticks) to query.
Camilla Berglund4591ad22014-09-18 15:03:29 +02004612 * @param[out] count Where to store the number of axis values in the returned
Camilla Berglund999f3552016-08-17 16:48:22 +02004613 * array. This is set to zero if the joystick is not present or an error
4614 * occurred.
4615 * @return An array of axis values, or `NULL` if the joystick is not present or
4616 * an [error](@ref error_handling) occurred.
Camilla Berglund7f2eb7b2013-04-24 19:25:42 +02004617 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01004618 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
4619 * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR.
4620 *
Camilla Berglund951a9582016-01-31 21:32:14 +01004621 * @pointer_lifetime The returned array is allocated and freed by GLFW. You
4622 * should not free it yourself. It is valid until the specified joystick is
Camilla Löwy68014782017-02-01 04:36:38 +01004623 * disconnected or the library is terminated.
Camilla Berglund0e205772014-03-24 11:58:35 +01004624 *
Camilla Berglund951a9582016-01-31 21:32:14 +01004625 * @thread_safety This function must only be called from the main thread.
Camilla Berglundc3bb5c92013-06-05 16:04:04 +02004626 *
Camilla Berglund4188c262015-01-18 01:55:25 +01004627 * @sa @ref joystick_axis
Camilla Berglund4591ad22014-09-18 15:03:29 +02004628 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01004629 * @since Added in version 3.0. Replaces `glfwGetJoystickPos`.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004630 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004631 * @ingroup input
4632 */
Camilla Berglundefc6b352016-10-10 03:24:07 +02004633GLFWAPI const float* glfwGetJoystickAxes(int jid, int* count);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004634
Camilla Berglunde93bade2013-06-16 02:33:33 +02004635/*! @brief Returns the state of all buttons of the specified joystick.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02004636 *
Camilla Berglunde93bade2013-06-16 02:33:33 +02004637 * This function returns the state of all buttons of the specified joystick.
Camilla Berglund4591ad22014-09-18 15:03:29 +02004638 * Each element in the array is either `GLFW_PRESS` or `GLFW_RELEASE`.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02004639 *
Camilla Löwy798d7c62017-03-01 23:27:20 +01004640 * For backward compatibility with earlier versions that did not have @ref
4641 * glfwGetJoystickHats, the button array also includes all hats, each
4642 * represented as four buttons. The hats are in the same order as returned by
4643 * __glfwGetJoystickHats__ and are in the order _up_, _right_, _down_ and
4644 * _left_. To disable these extra buttons, set the @ref
4645 * GLFW_JOYSTICK_HAT_BUTTONS init hint before initialization.
4646 *
Camilla Löwy953106e2017-06-18 15:13:25 +02004647 * If the specified joystick is not present this function will return `NULL`
Camilla Löwy5bc1c382017-08-04 01:00:36 +02004648 * but will not generate an error. This can be used instead of first calling
4649 * @ref glfwJoystickPresent.
Camilla Berglund386b6032016-02-10 13:48:49 +01004650 *
Camilla Berglundefc6b352016-10-10 03:24:07 +02004651 * @param[in] jid The [joystick](@ref joysticks) to query.
Camilla Berglund4591ad22014-09-18 15:03:29 +02004652 * @param[out] count Where to store the number of button states in the returned
Camilla Berglund999f3552016-08-17 16:48:22 +02004653 * array. This is set to zero if the joystick is not present or an error
4654 * occurred.
4655 * @return An array of button states, or `NULL` if the joystick is not present
4656 * or an [error](@ref error_handling) occurred.
Camilla Berglund7f2eb7b2013-04-24 19:25:42 +02004657 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01004658 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
4659 * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR.
4660 *
Camilla Berglund951a9582016-01-31 21:32:14 +01004661 * @pointer_lifetime The returned array is allocated and freed by GLFW. You
4662 * should not free it yourself. It is valid until the specified joystick is
Camilla Löwy68014782017-02-01 04:36:38 +01004663 * disconnected or the library is terminated.
Camilla Berglund0e205772014-03-24 11:58:35 +01004664 *
Camilla Berglund951a9582016-01-31 21:32:14 +01004665 * @thread_safety This function must only be called from the main thread.
Camilla Berglundc3bb5c92013-06-05 16:04:04 +02004666 *
Camilla Berglund4188c262015-01-18 01:55:25 +01004667 * @sa @ref joystick_button
Camilla Berglund4591ad22014-09-18 15:03:29 +02004668 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01004669 * @since Added in version 2.2.
Camilla Berglund951a9582016-01-31 21:32:14 +01004670 * @glfw3 Changed to return a dynamic array.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004671 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004672 * @ingroup input
4673 */
Camilla Berglundefc6b352016-10-10 03:24:07 +02004674GLFWAPI const unsigned char* glfwGetJoystickButtons(int jid, int* count);
Camilla Berglund3249f812010-09-07 17:34:51 +02004675
IntellectualKitty368dec72016-11-25 20:56:24 -07004676/*! @brief Returns the state of all hats of the specified joystick.
4677 *
4678 * This function returns the state of all hats of the specified joystick.
Camilla Löwy798d7c62017-03-01 23:27:20 +01004679 * Each element in the array is one of the following values:
IntellectualKitty368dec72016-11-25 20:56:24 -07004680 *
Camilla Löwy798d7c62017-03-01 23:27:20 +01004681 * Name | Value
Camilla Löwybb2ca1d2018-11-27 21:49:19 +01004682 * ---- | -----
Camilla Löwy798d7c62017-03-01 23:27:20 +01004683 * `GLFW_HAT_CENTERED` | 0
4684 * `GLFW_HAT_UP` | 1
4685 * `GLFW_HAT_RIGHT` | 2
4686 * `GLFW_HAT_DOWN` | 4
4687 * `GLFW_HAT_LEFT` | 8
4688 * `GLFW_HAT_RIGHT_UP` | `GLFW_HAT_RIGHT` \| `GLFW_HAT_UP`
4689 * `GLFW_HAT_RIGHT_DOWN` | `GLFW_HAT_RIGHT` \| `GLFW_HAT_DOWN`
4690 * `GLFW_HAT_LEFT_UP` | `GLFW_HAT_LEFT` \| `GLFW_HAT_UP`
4691 * `GLFW_HAT_LEFT_DOWN` | `GLFW_HAT_LEFT` \| `GLFW_HAT_DOWN`
IntellectualKitty368dec72016-11-25 20:56:24 -07004692 *
Camilla Löwy798d7c62017-03-01 23:27:20 +01004693 * The diagonal directions are bitwise combinations of the primary (up, right,
4694 * down and left) directions and you can test for these individually by ANDing
4695 * it with the corresponding direction.
IntellectualKitty368dec72016-11-25 20:56:24 -07004696 *
Camilla Löwy798d7c62017-03-01 23:27:20 +01004697 * @code
Emmanuel Gil Peyrotc3cba582017-11-17 03:34:18 +00004698 * if (hats[2] & GLFW_HAT_RIGHT)
4699 * {
4700 * // State of hat 2 could be right-up, right or right-down
4701 * }
Camilla Löwy798d7c62017-03-01 23:27:20 +01004702 * @endcode
IntellectualKitty368dec72016-11-25 20:56:24 -07004703 *
Camilla Löwy953106e2017-06-18 15:13:25 +02004704 * If the specified joystick is not present this function will return `NULL`
Camilla Löwy5bc1c382017-08-04 01:00:36 +02004705 * but will not generate an error. This can be used instead of first calling
4706 * @ref glfwJoystickPresent.
IntellectualKitty368dec72016-11-25 20:56:24 -07004707 *
4708 * @param[in] jid The [joystick](@ref joysticks) to query.
4709 * @param[out] count Where to store the number of hat states in the returned
4710 * array. This is set to zero if the joystick is not present or an error
4711 * occurred.
4712 * @return An array of hat states, or `NULL` if the joystick is not present
4713 * or an [error](@ref error_handling) occurred.
4714 *
4715 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
4716 * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR.
4717 *
IntellectualKitty368dec72016-11-25 20:56:24 -07004718 * @pointer_lifetime The returned array is allocated and freed by GLFW. You
4719 * should not free it yourself. It is valid until the specified joystick is
4720 * disconnected, this function is called again for that joystick or the library
4721 * is terminated.
4722 *
4723 * @thread_safety This function must only be called from the main thread.
4724 *
4725 * @sa @ref joystick_hat
4726 *
4727 * @since Added in version 3.3.
4728 *
4729 * @ingroup input
4730 */
4731GLFWAPI const unsigned char* glfwGetJoystickHats(int jid, int* count);
4732
Camilla Berglund7d9b5c02012-12-02 16:55:09 +01004733/*! @brief Returns the name of the specified joystick.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004734 *
4735 * This function returns the name, encoded as UTF-8, of the specified joystick.
Camilla Berglund4591ad22014-09-18 15:03:29 +02004736 * The returned string is allocated and freed by GLFW. You should not free it
4737 * yourself.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004738 *
Camilla Löwy953106e2017-06-18 15:13:25 +02004739 * If the specified joystick is not present this function will return `NULL`
Camilla Löwy5bc1c382017-08-04 01:00:36 +02004740 * but will not generate an error. This can be used instead of first calling
4741 * @ref glfwJoystickPresent.
Camilla Berglund386b6032016-02-10 13:48:49 +01004742 *
Camilla Berglundefc6b352016-10-10 03:24:07 +02004743 * @param[in] jid The [joystick](@ref joysticks) to query.
Camilla Berglund71d2b572013-03-12 15:33:05 +01004744 * @return The UTF-8 encoded name of the joystick, or `NULL` if the joystick
Camilla Berglund999f3552016-08-17 16:48:22 +02004745 * is not present or an [error](@ref error_handling) occurred.
Camilla Berglundd4a08b12012-12-02 17:13:41 +01004746 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01004747 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
4748 * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR.
4749 *
Camilla Berglund951a9582016-01-31 21:32:14 +01004750 * @pointer_lifetime The returned string is allocated and freed by GLFW. You
4751 * should not free it yourself. It is valid until the specified joystick is
Camilla Löwy68014782017-02-01 04:36:38 +01004752 * disconnected or the library is terminated.
Camilla Berglund0e205772014-03-24 11:58:35 +01004753 *
Camilla Berglund951a9582016-01-31 21:32:14 +01004754 * @thread_safety This function must only be called from the main thread.
Camilla Berglundc3bb5c92013-06-05 16:04:04 +02004755 *
Camilla Berglund4188c262015-01-18 01:55:25 +01004756 * @sa @ref joystick_name
Camilla Berglund4591ad22014-09-18 15:03:29 +02004757 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01004758 * @since Added in version 3.0.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004759 *
4760 * @ingroup input
Camilla Berglund7d9b5c02012-12-02 16:55:09 +01004761 */
Camilla Berglundefc6b352016-10-10 03:24:07 +02004762GLFWAPI const char* glfwGetJoystickName(int jid);
Camilla Berglund3249f812010-09-07 17:34:51 +02004763
Camilla Löwy5b7281b2017-07-23 16:34:11 +02004764/*! @brief Returns the SDL comaptible GUID of the specified joystick.
4765 *
4766 * This function returns the SDL compatible GUID, as a UTF-8 encoded
4767 * hexadecimal string, of the specified joystick. The returned string is
4768 * allocated and freed by GLFW. You should not free it yourself.
4769 *
Camilla Löwy5bc1c382017-08-04 01:00:36 +02004770 * The GUID is what connects a joystick to a gamepad mapping. A connected
4771 * joystick will always have a GUID even if there is no gamepad mapping
4772 * assigned to it.
4773 *
Camilla Löwy5b7281b2017-07-23 16:34:11 +02004774 * If the specified joystick is not present this function will return `NULL`
Camilla Löwy5bc1c382017-08-04 01:00:36 +02004775 * but will not generate an error. This can be used instead of first calling
4776 * @ref glfwJoystickPresent.
Camilla Löwy5b7281b2017-07-23 16:34:11 +02004777 *
4778 * The GUID uses the format introduced in SDL 2.0.5. This GUID tries to
4779 * uniquely identify the make and model of a joystick but does not identify
4780 * a specific unit, e.g. all wired Xbox 360 controllers will have the same
4781 * GUID on that platform. The GUID for a unit may vary between platforms
4782 * depending on what hardware information the platform specific APIs provide.
4783 *
4784 * @param[in] jid The [joystick](@ref joysticks) to query.
4785 * @return The UTF-8 encoded GUID of the joystick, or `NULL` if the joystick
4786 * is not present or an [error](@ref error_handling) occurred.
4787 *
4788 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
4789 * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR.
4790 *
4791 * @pointer_lifetime The returned string is allocated and freed by GLFW. You
4792 * should not free it yourself. It is valid until the specified joystick is
4793 * disconnected or the library is terminated.
4794 *
4795 * @thread_safety This function must only be called from the main thread.
4796 *
4797 * @sa @ref gamepad
4798 *
4799 * @since Added in version 3.3.
4800 *
4801 * @ingroup input
4802 */
4803GLFWAPI const char* glfwGetJoystickGUID(int jid);
4804
Camilla Löwy7c2c7852017-12-07 16:19:57 +01004805/*! @brief Sets the user pointer of the specified joystick.
4806 *
4807 * This function sets the user-defined pointer of the specified joystick. The
4808 * current value is retained until the joystick is disconnected. The initial
4809 * value is `NULL`.
4810 *
4811 * This function may be called from the joystick callback, even for a joystick
4812 * that is being disconnected.
4813 *
Camilla Löwyd222a402018-02-25 20:37:31 +01004814 * @param[in] jid The joystick whose pointer to set.
Camilla Löwy7c2c7852017-12-07 16:19:57 +01004815 * @param[in] pointer The new value.
4816 *
4817 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
4818 *
4819 * @thread_safety This function may be called from any thread. Access is not
4820 * synchronized.
4821 *
4822 * @sa @ref joystick_userptr
4823 * @sa @ref glfwGetJoystickUserPointer
4824 *
4825 * @since Added in version 3.3.
4826 *
4827 * @ingroup input
4828 */
4829GLFWAPI void glfwSetJoystickUserPointer(int jid, void* pointer);
4830
4831/*! @brief Returns the user pointer of the specified joystick.
4832 *
4833 * This function returns the current value of the user-defined pointer of the
4834 * specified joystick. The initial value is `NULL`.
4835 *
4836 * This function may be called from the joystick callback, even for a joystick
4837 * that is being disconnected.
4838 *
Camilla Löwyd222a402018-02-25 20:37:31 +01004839 * @param[in] jid The joystick whose pointer to return.
Camilla Löwy7c2c7852017-12-07 16:19:57 +01004840 *
4841 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
4842 *
4843 * @thread_safety This function may be called from any thread. Access is not
4844 * synchronized.
4845 *
4846 * @sa @ref joystick_userptr
4847 * @sa @ref glfwSetJoystickUserPointer
4848 *
4849 * @since Added in version 3.3.
4850 *
4851 * @ingroup input
4852 */
4853GLFWAPI void* glfwGetJoystickUserPointer(int jid);
4854
Camilla Löwy953106e2017-06-18 15:13:25 +02004855/*! @brief Returns whether the specified joystick has a gamepad mapping.
4856 *
4857 * This function returns whether the specified joystick is both present and has
4858 * a gamepad mapping.
4859 *
4860 * If the specified joystick is present but does not have a gamepad mapping
4861 * this function will return `GLFW_FALSE` but will not generate an error. Call
Camilla Löwy5bc1c382017-08-04 01:00:36 +02004862 * @ref glfwJoystickPresent to check if a joystick is present regardless of
4863 * whether it has a mapping.
Camilla Löwy953106e2017-06-18 15:13:25 +02004864 *
4865 * @param[in] jid The [joystick](@ref joysticks) to query.
4866 * @return `GLFW_TRUE` if a joystick is both present and has a gamepad mapping,
4867 * or `GLFW_FALSE` otherwise.
4868 *
4869 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
4870 * GLFW_INVALID_ENUM.
4871 *
4872 * @thread_safety This function must only be called from the main thread.
4873 *
4874 * @sa @ref gamepad
4875 * @sa @ref glfwGetGamepadState
4876 *
4877 * @since Added in version 3.3.
4878 *
4879 * @ingroup input
4880 */
4881GLFWAPI int glfwJoystickIsGamepad(int jid);
4882
Camilla Berglund8a7fa302015-12-13 17:38:50 +01004883/*! @brief Sets the joystick configuration callback.
4884 *
4885 * This function sets the joystick configuration callback, or removes the
4886 * currently set callback. This is called when a joystick is connected to or
4887 * disconnected from the system.
4888 *
Camilla Löwya46c95c2017-02-01 04:55:46 +01004889 * For joystick connection and disconnection events to be delivered on all
4890 * platforms, you need to call one of the [event processing](@ref events)
4891 * functions. Joystick disconnection may also be detected and the callback
4892 * called by joystick functions. The function will then return whatever it
Camilla Löwy953106e2017-06-18 15:13:25 +02004893 * returns if the joystick is not present.
Camilla Löwya46c95c2017-02-01 04:55:46 +01004894 *
Camilla Berglund8a7fa302015-12-13 17:38:50 +01004895 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
4896 * callback.
4897 * @return The previously set callback, or `NULL` if no callback was set or the
4898 * library had not been [initialized](@ref intro_init).
4899 *
4900 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
4901 *
4902 * @thread_safety This function must only be called from the main thread.
4903 *
4904 * @sa @ref joystick_event
4905 *
4906 * @since Added in version 3.2.
4907 *
4908 * @ingroup input
4909 */
4910GLFWAPI GLFWjoystickfun glfwSetJoystickCallback(GLFWjoystickfun cbfun);
4911
Camilla Löwy953106e2017-06-18 15:13:25 +02004912/*! @brief Adds the specified SDL_GameControllerDB gamepad mappings.
4913 *
4914 * This function parses the specified ASCII encoded string and updates the
4915 * internal list with any gamepad mappings it finds. This string may
4916 * contain either a single gamepad mapping or many mappings separated by
4917 * newlines. The parser supports the full format of the `gamecontrollerdb.txt`
4918 * source file including empty lines and comments.
4919 *
4920 * See @ref gamepad_mapping for a description of the format.
4921 *
4922 * If there is already a gamepad mapping for a given GUID in the internal list,
4923 * it will be replaced by the one passed to this function. If the library is
4924 * terminated and re-initialized the internal list will revert to the built-in
4925 * default.
4926 *
4927 * @param[in] string The string containing the gamepad mappings.
4928 * @return `GLFW_TRUE` if successful, or `GLFW_FALSE` if an
4929 * [error](@ref error_handling) occurred.
4930 *
4931 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
4932 * GLFW_INVALID_VALUE.
4933 *
4934 * @thread_safety This function must only be called from the main thread.
4935 *
4936 * @sa @ref gamepad
4937 * @sa @ref glfwJoystickIsGamepad
4938 * @sa @ref glfwGetGamepadName
4939 *
4940 * @since Added in version 3.3.
4941 *
4942 * @ingroup input
4943 */
4944GLFWAPI int glfwUpdateGamepadMappings(const char* string);
4945
4946/*! @brief Returns the human-readable gamepad name for the specified joystick.
4947 *
4948 * This function returns the human-readable name of the gamepad from the
4949 * gamepad mapping assigned to the specified joystick.
4950 *
4951 * If the specified joystick is not present or does not have a gamepad mapping
Camilla Löwy5bc1c382017-08-04 01:00:36 +02004952 * this function will return `NULL` but will not generate an error. Call
4953 * @ref glfwJoystickPresent to check whether it is present regardless of
4954 * whether it has a mapping.
Camilla Löwy953106e2017-06-18 15:13:25 +02004955 *
4956 * @param[in] jid The [joystick](@ref joysticks) to query.
4957 * @return The UTF-8 encoded name of the gamepad, or `NULL` if the
4958 * joystick is not present, does not have a mapping or an
4959 * [error](@ref error_handling) occurred.
4960 *
4961 * @pointer_lifetime The returned string is allocated and freed by GLFW. You
4962 * should not free it yourself. It is valid until the specified joystick is
4963 * disconnected, the gamepad mappings are updated or the library is terminated.
4964 *
4965 * @thread_safety This function must only be called from the main thread.
4966 *
4967 * @sa @ref gamepad
4968 * @sa @ref glfwJoystickIsGamepad
4969 *
4970 * @since Added in version 3.3.
4971 *
4972 * @ingroup input
4973 */
4974GLFWAPI const char* glfwGetGamepadName(int jid);
4975
4976/*! @brief Retrieves the state of the specified joystick remapped as a gamepad.
4977 *
4978 * This function retrives the state of the specified joystick remapped to
4979 * an Xbox-like gamepad.
4980 *
Camilla Löwy5bc1c382017-08-04 01:00:36 +02004981 * If the specified joystick is not present or does not have a gamepad mapping
4982 * this function will return `GLFW_FALSE` but will not generate an error. Call
4983 * @ref glfwJoystickPresent to check whether it is present regardless of
4984 * whether it has a mapping.
Camilla Löwy953106e2017-06-18 15:13:25 +02004985 *
4986 * The Guide button may not be available for input as it is often hooked by the
4987 * system or the Steam client.
4988 *
4989 * Not all devices have all the buttons or axes provided by @ref
4990 * GLFWgamepadstate. Unavailable buttons and axes will always report
Camilla Löwy34d20b02018-03-03 22:24:26 +01004991 * `GLFW_RELEASE` and 0.0 respectively.
Camilla Löwy953106e2017-06-18 15:13:25 +02004992 *
4993 * @param[in] jid The [joystick](@ref joysticks) to query.
4994 * @param[out] state The gamepad input state of the joystick.
4995 * @return `GLFW_TRUE` if successful, or `GLFW_FALSE` if no joystick is
4996 * connected, it has no gamepad mapping or an [error](@ref error_handling)
4997 * occurred.
4998 *
4999 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
5000 * GLFW_INVALID_ENUM.
5001 *
Camilla Löwye1495c02018-08-09 13:57:10 +02005002 * @thread_safety This function must only be called from the main thread.
5003 *
Camilla Löwy953106e2017-06-18 15:13:25 +02005004 * @sa @ref gamepad
5005 * @sa @ref glfwUpdateGamepadMappings
5006 * @sa @ref glfwJoystickIsGamepad
5007 *
5008 * @since Added in version 3.3.
5009 *
5010 * @ingroup input
5011 */
5012GLFWAPI int glfwGetGamepadState(int jid, GLFWgamepadstate* state);
5013
Camilla Berglundbce2cd62012-11-22 16:38:24 +01005014/*! @brief Sets the clipboard to the specified string.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01005015 *
5016 * This function sets the system clipboard to the specified, UTF-8 encoded
Camilla Berglund4591ad22014-09-18 15:03:29 +02005017 * string.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01005018 *
Camilla Löwy31cbb202017-11-04 21:11:58 +01005019 * @param[in] window Deprecated. Any valid window or `NULL`.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01005020 * @param[in] string A UTF-8 encoded string.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01005021 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01005022 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
5023 * GLFW_PLATFORM_ERROR.
5024 *
Camilla Berglund951a9582016-01-31 21:32:14 +01005025 * @pointer_lifetime The specified string is copied before this function
5026 * returns.
Camilla Berglunda3ff29a2012-12-02 15:47:10 +01005027 *
Camilla Berglund951a9582016-01-31 21:32:14 +01005028 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02005029 *
Camilla Berglund4188c262015-01-18 01:55:25 +01005030 * @sa @ref clipboard
Camilla Berglund7e9e3212016-09-14 20:17:26 +02005031 * @sa @ref glfwGetClipboardString
Camilla Berglund2d5fb772013-03-18 19:11:02 +01005032 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01005033 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02005034 *
Camilla Berglund8d170c72014-09-09 16:26:57 +02005035 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01005036 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01005037GLFWAPI void glfwSetClipboardString(GLFWwindow* window, const char* string);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01005038
Camilla Berglund4591ad22014-09-18 15:03:29 +02005039/*! @brief Returns the contents of the clipboard as a string.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01005040 *
5041 * This function returns the contents of the system clipboard, if it contains
Camilla Berglundcf9079c2015-09-16 18:51:49 +02005042 * or is convertible to a UTF-8 encoded string. If the clipboard is empty or
Camilla Berglund0b650532015-09-16 16:27:28 +02005043 * if its contents cannot be converted, `NULL` is returned and a @ref
5044 * GLFW_FORMAT_UNAVAILABLE error is generated.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01005045 *
Camilla Löwy31cbb202017-11-04 21:11:58 +01005046 * @param[in] window Deprecated. Any valid window or `NULL`.
Camilla Berglund71d2b572013-03-12 15:33:05 +01005047 * @return The contents of the clipboard as a UTF-8 encoded string, or `NULL`
Camilla Berglund4591ad22014-09-18 15:03:29 +02005048 * if an [error](@ref error_handling) occurred.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01005049 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01005050 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
5051 * GLFW_PLATFORM_ERROR.
5052 *
Camilla Berglund951a9582016-01-31 21:32:14 +01005053 * @pointer_lifetime The returned string is allocated and freed by GLFW. You
5054 * should not free it yourself. It is valid until the next call to @ref
Camilla Berglund6be821c2014-10-06 23:18:33 +02005055 * glfwGetClipboardString or @ref glfwSetClipboardString, or until the library
5056 * is terminated.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01005057 *
Camilla Berglund951a9582016-01-31 21:32:14 +01005058 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02005059 *
Camilla Berglund4188c262015-01-18 01:55:25 +01005060 * @sa @ref clipboard
Camilla Berglund7e9e3212016-09-14 20:17:26 +02005061 * @sa @ref glfwSetClipboardString
Camilla Berglund2d5fb772013-03-18 19:11:02 +01005062 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01005063 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02005064 *
Camilla Berglund8d170c72014-09-09 16:26:57 +02005065 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01005066 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01005067GLFWAPI const char* glfwGetClipboardString(GLFWwindow* window);
Ralph Eastwood31c91542011-09-21 10:09:47 +01005068
Camilla Berglund2d5fb772013-03-18 19:11:02 +01005069/*! @brief Returns the value of the GLFW timer.
5070 *
5071 * This function returns the value of the GLFW timer. Unless the timer has
5072 * been set using @ref glfwSetTime, the timer measures time elapsed since GLFW
5073 * was initialized.
5074 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02005075 * The resolution of the timer is system dependent, but is usually on the order
5076 * of a few micro- or nanoseconds. It uses the highest-resolution monotonic
5077 * time source on each supported platform.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01005078 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02005079 * @return The current value, in seconds, or zero if an
5080 * [error](@ref error_handling) occurred.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01005081 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01005082 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
5083 *
Camilla Berglund20bce152016-05-30 16:04:37 +02005084 * @thread_safety This function may be called from any thread. Reading and
5085 * writing of the internal timer offset is not atomic, so it needs to be
5086 * externally synchronized with calls to @ref glfwSetTime.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01005087 *
Camilla Berglund4188c262015-01-18 01:55:25 +01005088 * @sa @ref time
Camilla Berglund4591ad22014-09-18 15:03:29 +02005089 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01005090 * @since Added in version 1.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02005091 *
5092 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01005093 */
Camilla Berglund9a716692010-09-08 16:40:43 +02005094GLFWAPI double glfwGetTime(void);
Camilla Berglund3249f812010-09-07 17:34:51 +02005095
Camilla Berglundbce2cd62012-11-22 16:38:24 +01005096/*! @brief Sets the GLFW timer.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01005097 *
5098 * This function sets the value of the GLFW timer. It then continues to count
Camilla Berglund6e20cda2015-03-10 12:01:38 +01005099 * up from that value. The value must be a positive finite number less than
5100 * or equal to 18446744073.0, which is approximately 584.5 years.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01005101 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01005102 * @param[in] time The new value, in seconds.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01005103 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01005104 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
5105 * GLFW_INVALID_VALUE.
5106 *
Camilla Berglund951a9582016-01-31 21:32:14 +01005107 * @remark The upper limit of the timer is calculated as
Camilla Berglund6e20cda2015-03-10 12:01:38 +01005108 * floor((2<sup>64</sup> - 1) / 10<sup>9</sup>) and is due to implementations
5109 * storing nanoseconds in 64 bits. The limit may be increased in the future.
5110 *
Camilla Berglund20bce152016-05-30 16:04:37 +02005111 * @thread_safety This function may be called from any thread. Reading and
5112 * writing of the internal timer offset is not atomic, so it needs to be
5113 * externally synchronized with calls to @ref glfwGetTime.
Camilla Berglund0e205772014-03-24 11:58:35 +01005114 *
Camilla Berglund4188c262015-01-18 01:55:25 +01005115 * @sa @ref time
Camilla Berglunde248fb62013-03-29 14:06:23 +01005116 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01005117 * @since Added in version 2.2.
Camilla Berglund4591ad22014-09-18 15:03:29 +02005118 *
5119 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01005120 */
5121GLFWAPI void glfwSetTime(double time);
5122
Camilla Berglund31f67dd2016-03-06 11:38:55 +01005123/*! @brief Returns the current value of the raw timer.
5124 *
Camilla Berglund337c77a2016-03-06 14:11:14 +01005125 * This function returns the current value of the raw timer, measured in
5126 * 1&nbsp;/&nbsp;frequency seconds. To get the frequency, call @ref
5127 * glfwGetTimerFrequency.
Camilla Berglund31f67dd2016-03-06 11:38:55 +01005128 *
Emmanuel Gil Peyrotc3cba582017-11-17 03:34:18 +00005129 * @return The value of the timer, or zero if an
Camilla Berglund31f67dd2016-03-06 11:38:55 +01005130 * [error](@ref error_handling) occurred.
5131 *
Camilla Berglund46fce402016-03-07 13:35:37 +01005132 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
Camilla Berglund31f67dd2016-03-06 11:38:55 +01005133 *
5134 * @thread_safety This function may be called from any thread.
5135 *
5136 * @sa @ref time
Camilla Berglund7e9e3212016-09-14 20:17:26 +02005137 * @sa @ref glfwGetTimerFrequency
Camilla Berglund31f67dd2016-03-06 11:38:55 +01005138 *
5139 * @since Added in version 3.2.
5140 *
5141 * @ingroup input
5142 */
Camilla Berglund5661d032016-03-23 10:09:07 +01005143GLFWAPI uint64_t glfwGetTimerValue(void);
Camilla Berglund31f67dd2016-03-06 11:38:55 +01005144
5145/*! @brief Returns the frequency, in Hz, of the raw timer.
5146 *
Camilla Berglunddefaea32016-03-07 13:36:54 +01005147 * This function returns the frequency, in Hz, of the raw timer.
5148 *
Camilla Berglund31f67dd2016-03-06 11:38:55 +01005149 * @return The frequency of the timer, in Hz, or zero if an
5150 * [error](@ref error_handling) occurred.
5151 *
Camilla Berglund46fce402016-03-07 13:35:37 +01005152 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
Camilla Berglund31f67dd2016-03-06 11:38:55 +01005153 *
5154 * @thread_safety This function may be called from any thread.
5155 *
5156 * @sa @ref time
Camilla Berglund7e9e3212016-09-14 20:17:26 +02005157 * @sa @ref glfwGetTimerValue
Camilla Berglund31f67dd2016-03-06 11:38:55 +01005158 *
5159 * @since Added in version 3.2.
5160 *
5161 * @ingroup input
5162 */
Camilla Berglund5661d032016-03-23 10:09:07 +01005163GLFWAPI uint64_t glfwGetTimerFrequency(void);
Camilla Berglund31f67dd2016-03-06 11:38:55 +01005164
Camilla Berglund2d5fb772013-03-18 19:11:02 +01005165/*! @brief Makes the context of the specified window current for the calling
5166 * thread.
5167 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02005168 * This function makes the OpenGL or OpenGL ES context of the specified window
Camilla Löwyf2756d02017-11-02 19:30:12 +01005169 * current on the calling thread. A context must only be made current on
Camilla Berglund4591ad22014-09-18 15:03:29 +02005170 * a single thread at a time and each thread can have only a single current
5171 * context at a time.
5172 *
Camilla Löwyf2756d02017-11-02 19:30:12 +01005173 * When moving a context between threads, you must make it non-current on the
5174 * old thread before making it current on the new one.
5175 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02005176 * By default, making a context non-current implicitly forces a pipeline flush.
5177 * On machines that support `GL_KHR_context_flush_control`, you can control
5178 * whether a context performs this flush by setting the
Camilla Löwyce161c22016-12-06 01:14:23 +01005179 * [GLFW_CONTEXT_RELEASE_BEHAVIOR](@ref GLFW_CONTEXT_RELEASE_BEHAVIOR_hint)
5180 * hint.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01005181 *
Camilla Berglund98b478f2015-11-05 13:44:15 +01005182 * The specified window must have an OpenGL or OpenGL ES context. Specifying
5183 * a window without a context will generate a @ref GLFW_NO_WINDOW_CONTEXT
5184 * error.
5185 *
Camilla Berglund71d2b572013-03-12 15:33:05 +01005186 * @param[in] window The window whose context to make current, or `NULL` to
Camilla Berglundbce2cd62012-11-22 16:38:24 +01005187 * detach the current context.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01005188 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01005189 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
5190 * GLFW_NO_WINDOW_CONTEXT and @ref GLFW_PLATFORM_ERROR.
5191 *
Camilla Berglund951a9582016-01-31 21:32:14 +01005192 * @thread_safety This function may be called from any thread.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01005193 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02005194 * @sa @ref context_current
Camilla Berglund7e9e3212016-09-14 20:17:26 +02005195 * @sa @ref glfwGetCurrentContext
Camilla Berglunde248fb62013-03-29 14:06:23 +01005196 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01005197 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02005198 *
Camilla Berglunde248fb62013-03-29 14:06:23 +01005199 * @ingroup context
Camilla Berglundbce2cd62012-11-22 16:38:24 +01005200 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01005201GLFWAPI void glfwMakeContextCurrent(GLFWwindow* window);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01005202
Camilla Berglund2d5fb772013-03-18 19:11:02 +01005203/*! @brief Returns the window whose context is current on the calling thread.
5204 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02005205 * This function returns the window whose OpenGL or OpenGL ES context is
5206 * current on the calling thread.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01005207 *
Camilla Berglund71d2b572013-03-12 15:33:05 +01005208 * @return The window whose context is current, or `NULL` if no window's
Camilla Berglundbce2cd62012-11-22 16:38:24 +01005209 * context is current.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01005210 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01005211 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
5212 *
Camilla Berglund951a9582016-01-31 21:32:14 +01005213 * @thread_safety This function may be called from any thread.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01005214 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02005215 * @sa @ref context_current
Camilla Berglund7e9e3212016-09-14 20:17:26 +02005216 * @sa @ref glfwMakeContextCurrent
Camilla Berglunde248fb62013-03-29 14:06:23 +01005217 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01005218 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02005219 *
Camilla Berglunde248fb62013-03-29 14:06:23 +01005220 * @ingroup context
Camilla Berglundbce2cd62012-11-22 16:38:24 +01005221 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01005222GLFWAPI GLFWwindow* glfwGetCurrentContext(void);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01005223
5224/*! @brief Swaps the front and back buffers of the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01005225 *
Camilla Berglund001c50c2016-02-19 09:13:56 +01005226 * This function swaps the front and back buffers of the specified window when
5227 * rendering with OpenGL or OpenGL ES. If the swap interval is greater than
5228 * zero, the GPU driver waits the specified number of screen updates before
5229 * swapping the buffers.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01005230 *
Camilla Berglund98b478f2015-11-05 13:44:15 +01005231 * The specified window must have an OpenGL or OpenGL ES context. Specifying
5232 * a window without a context will generate a @ref GLFW_NO_WINDOW_CONTEXT
5233 * error.
5234 *
Camilla Berglund001c50c2016-02-19 09:13:56 +01005235 * This function does not apply to Vulkan. If you are rendering with Vulkan,
5236 * see `vkQueuePresentKHR` instead.
5237 *
Camilla Berglund9492fc52013-01-17 17:51:12 +01005238 * @param[in] window The window whose buffers to swap.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01005239 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01005240 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
5241 * GLFW_NO_WINDOW_CONTEXT and @ref GLFW_PLATFORM_ERROR.
5242 *
Camilla Berglund951a9582016-01-31 21:32:14 +01005243 * @remark __EGL:__ The context of the specified window must be current on the
Camilla Berglund276b1bc2016-01-31 19:17:18 +01005244 * calling thread.
5245 *
Camilla Berglund951a9582016-01-31 21:32:14 +01005246 * @thread_safety This function may be called from any thread.
Camilla Berglund401033c2013-03-12 19:17:07 +01005247 *
Camilla Berglund4188c262015-01-18 01:55:25 +01005248 * @sa @ref buffer_swap
Camilla Berglund7e9e3212016-09-14 20:17:26 +02005249 * @sa @ref glfwSwapInterval
Camilla Berglunde248fb62013-03-29 14:06:23 +01005250 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01005251 * @since Added in version 1.0.
Camilla Berglund951a9582016-01-31 21:32:14 +01005252 * @glfw3 Added window handle parameter.
Camilla Berglund4591ad22014-09-18 15:03:29 +02005253 *
5254 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01005255 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01005256GLFWAPI void glfwSwapBuffers(GLFWwindow* window);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01005257
5258/*! @brief Sets the swap interval for the current context.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01005259 *
Camilla Berglund001c50c2016-02-19 09:13:56 +01005260 * This function sets the swap interval for the current OpenGL or OpenGL ES
5261 * context, i.e. the number of screen updates to wait from the time @ref
5262 * glfwSwapBuffers was called before swapping the buffers and returning. This
5263 * is sometimes called _vertical synchronization_, _vertical retrace
5264 * synchronization_ or just _vsync_.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01005265 *
Camilla Löwy8094a1c2017-11-27 15:53:59 +01005266 * A context that supports either of the `WGL_EXT_swap_control_tear` and
Camilla Löwybfe2d422017-11-27 01:18:51 +01005267 * `GLX_EXT_swap_control_tear` extensions also accepts _negative_ swap
5268 * intervals, which allows the driver to swap immediately even if a frame
5269 * arrives a little bit late. You can check for these extensions with @ref
5270 * glfwExtensionSupported.
Camilla Berglund8282a8f2013-04-10 23:01:12 +02005271 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02005272 * A context must be current on the calling thread. Calling this function
Camilla Berglundce8f97c2015-01-11 23:33:14 +01005273 * without a current context will cause a @ref GLFW_NO_CURRENT_CONTEXT error.
Camilla Berglund4591ad22014-09-18 15:03:29 +02005274 *
Camilla Berglund001c50c2016-02-19 09:13:56 +01005275 * This function does not apply to Vulkan. If you are rendering with Vulkan,
5276 * see the present mode of your swapchain instead.
5277 *
Camilla Berglund5fd409b2013-06-05 17:53:13 +02005278 * @param[in] interval The minimum number of screen updates to wait for
5279 * until the buffers are swapped by @ref glfwSwapBuffers.
5280 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01005281 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
5282 * GLFW_NO_CURRENT_CONTEXT and @ref GLFW_PLATFORM_ERROR.
5283 *
Camilla Berglund951a9582016-01-31 21:32:14 +01005284 * @remark This function is not called during context creation, leaving the
Camilla Berglund11c22d62015-02-19 15:33:51 +01005285 * swap interval set to whatever is the default on that platform. This is done
Camilla Berglund3af1c412013-09-19 21:37:01 +02005286 * because some swap interval extensions used by GLFW do not allow the swap
5287 * interval to be reset to zero once it has been set to a non-zero value.
5288 *
Camilla Berglund951a9582016-01-31 21:32:14 +01005289 * @remark Some GPU drivers do not honor the requested swap interval, either
Camilla Berglund11c22d62015-02-19 15:33:51 +01005290 * because of a user setting that overrides the application's request or due to
5291 * bugs in the driver.
Camilla Berglund8282a8f2013-04-10 23:01:12 +02005292 *
Camilla Berglund951a9582016-01-31 21:32:14 +01005293 * @thread_safety This function may be called from any thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02005294 *
Camilla Berglund4188c262015-01-18 01:55:25 +01005295 * @sa @ref buffer_swap
Camilla Berglund7e9e3212016-09-14 20:17:26 +02005296 * @sa @ref glfwSwapBuffers
Camilla Berglunde248fb62013-03-29 14:06:23 +01005297 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01005298 * @since Added in version 1.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02005299 *
Camilla Berglunde248fb62013-03-29 14:06:23 +01005300 * @ingroup context
Camilla Berglundbce2cd62012-11-22 16:38:24 +01005301 */
5302GLFWAPI void glfwSwapInterval(int interval);
5303
Camilla Berglund2d5fb772013-03-18 19:11:02 +01005304/*! @brief Returns whether the specified extension is available.
5305 *
Camilla Berglund608109c2013-04-11 20:18:46 +02005306 * This function returns whether the specified
Camilla Berglund001c50c2016-02-19 09:13:56 +01005307 * [API extension](@ref context_glext) is supported by the current OpenGL or
5308 * OpenGL ES context. It searches both for client API extension and context
5309 * creation API extensions.
Camilla Berglund4591ad22014-09-18 15:03:29 +02005310 *
5311 * A context must be current on the calling thread. Calling this function
Camilla Berglundce8f97c2015-01-11 23:33:14 +01005312 * without a current context will cause a @ref GLFW_NO_CURRENT_CONTEXT error.
Camilla Berglund4591ad22014-09-18 15:03:29 +02005313 *
5314 * As this functions retrieves and searches one or more extension strings each
5315 * call, it is recommended that you cache its results if it is going to be used
5316 * frequently. The extension strings will not change during the lifetime of
5317 * a context, so there is no danger in doing this.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01005318 *
Camilla Berglund001c50c2016-02-19 09:13:56 +01005319 * This function does not apply to Vulkan. If you are using Vulkan, see @ref
5320 * glfwGetRequiredInstanceExtensions, `vkEnumerateInstanceExtensionProperties`
5321 * and `vkEnumerateDeviceExtensionProperties` instead.
5322 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01005323 * @param[in] extension The ASCII encoded name of the extension.
Camilla Berglund0eccf752015-08-23 19:30:04 +02005324 * @return `GLFW_TRUE` if the extension is available, or `GLFW_FALSE`
5325 * otherwise.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01005326 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01005327 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
5328 * GLFW_NO_CURRENT_CONTEXT, @ref GLFW_INVALID_VALUE and @ref
5329 * GLFW_PLATFORM_ERROR.
5330 *
Camilla Berglund951a9582016-01-31 21:32:14 +01005331 * @thread_safety This function may be called from any thread.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01005332 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02005333 * @sa @ref context_glext
Camilla Berglund7e9e3212016-09-14 20:17:26 +02005334 * @sa @ref glfwGetProcAddress
Camilla Berglund4591ad22014-09-18 15:03:29 +02005335 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01005336 * @since Added in version 1.0.
Camilla Berglunde248fb62013-03-29 14:06:23 +01005337 *
5338 * @ingroup context
Camilla Berglundbce2cd62012-11-22 16:38:24 +01005339 */
5340GLFWAPI int glfwExtensionSupported(const char* extension);
5341
Camilla Berglund2d5fb772013-03-18 19:11:02 +01005342/*! @brief Returns the address of the specified function for the current
5343 * context.
5344 *
Camilla Berglund001c50c2016-02-19 09:13:56 +01005345 * This function returns the address of the specified OpenGL or OpenGL ES
Camilla Berglund11c22d62015-02-19 15:33:51 +01005346 * [core or extension function](@ref context_glext), if it is supported
Camilla Berglund1f5f20e2013-05-27 17:10:34 +02005347 * by the current context.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01005348 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02005349 * A context must be current on the calling thread. Calling this function
Camilla Berglundce8f97c2015-01-11 23:33:14 +01005350 * without a current context will cause a @ref GLFW_NO_CURRENT_CONTEXT error.
Camilla Berglund4591ad22014-09-18 15:03:29 +02005351 *
Camilla Berglund001c50c2016-02-19 09:13:56 +01005352 * This function does not apply to Vulkan. If you are rendering with Vulkan,
5353 * see @ref glfwGetInstanceProcAddress, `vkGetInstanceProcAddr` and
5354 * `vkGetDeviceProcAddr` instead.
5355 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01005356 * @param[in] procname The ASCII encoded name of the function.
Camilla Berglunda36e3a22015-11-05 17:14:26 +01005357 * @return The address of the function, or `NULL` if an
5358 * [error](@ref error_handling) occurred.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01005359 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01005360 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
5361 * GLFW_NO_CURRENT_CONTEXT and @ref GLFW_PLATFORM_ERROR.
5362 *
Camilla Berglund951a9582016-01-31 21:32:14 +01005363 * @remark The address of a given function is not guaranteed to be the same
Camilla Berglund4591ad22014-09-18 15:03:29 +02005364 * between contexts.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01005365 *
Camilla Berglund951a9582016-01-31 21:32:14 +01005366 * @remark This function may return a non-`NULL` address despite the
Camilla Berglund11c22d62015-02-19 15:33:51 +01005367 * associated version or extension not being available. Always check the
Camilla Berglundc8e06872015-08-27 21:40:22 +02005368 * context version or extension string first.
Camilla Berglund11c22d62015-02-19 15:33:51 +01005369 *
Camilla Berglund951a9582016-01-31 21:32:14 +01005370 * @pointer_lifetime The returned function pointer is valid until the context
5371 * is destroyed or the library is terminated.
Camilla Berglund4591ad22014-09-18 15:03:29 +02005372 *
Camilla Berglund951a9582016-01-31 21:32:14 +01005373 * @thread_safety This function may be called from any thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02005374 *
5375 * @sa @ref context_glext
Camilla Berglund7e9e3212016-09-14 20:17:26 +02005376 * @sa @ref glfwExtensionSupported
Camilla Berglund4591ad22014-09-18 15:03:29 +02005377 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01005378 * @since Added in version 1.0.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01005379 *
5380 * @ingroup context
Camilla Berglundbce2cd62012-11-22 16:38:24 +01005381 */
Camilla Berglundbf42c3c2012-06-05 00:16:40 +02005382GLFWAPI GLFWglproc glfwGetProcAddress(const char* procname);
Camilla Berglund3249f812010-09-07 17:34:51 +02005383
Camilla Löwy98bdd362017-02-07 20:56:48 +01005384/*! @brief Returns whether the Vulkan loader and an ICD have been found.
Camilla Berglund9b75bff2015-08-10 20:19:04 +02005385 *
Camilla Löwy98bdd362017-02-07 20:56:48 +01005386 * This function returns whether the Vulkan loader and any minimally functional
5387 * ICD have been found.
Camilla Berglund9b75bff2015-08-10 20:19:04 +02005388 *
Camilla Löwy98bdd362017-02-07 20:56:48 +01005389 * The availability of a Vulkan loader and even an ICD does not by itself
5390 * guarantee that surface creation or even instance creation is possible.
5391 * For example, on Fermi systems Nvidia will install an ICD that provides no
5392 * actual Vulkan support. Call @ref glfwGetRequiredInstanceExtensions to check
5393 * whether the extensions necessary for Vulkan surface creation are available
5394 * and @ref glfwGetPhysicalDevicePresentationSupport to check whether a queue
5395 * family of a physical device supports image presentation.
Camilla Berglund9b75bff2015-08-10 20:19:04 +02005396 *
Camilla Löwy98bdd362017-02-07 20:56:48 +01005397 * @return `GLFW_TRUE` if Vulkan is minimally available, or `GLFW_FALSE`
5398 * otherwise.
Camilla Berglund9b75bff2015-08-10 20:19:04 +02005399 *
5400 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
5401 *
5402 * @thread_safety This function may be called from any thread.
5403 *
5404 * @sa @ref vulkan_support
5405 *
5406 * @since Added in version 3.2.
5407 *
5408 * @ingroup vulkan
5409 */
5410GLFWAPI int glfwVulkanSupported(void);
5411
5412/*! @brief Returns the Vulkan instance extensions required by GLFW.
5413 *
5414 * This function returns an array of names of Vulkan instance extensions required
5415 * by GLFW for creating Vulkan surfaces for GLFW windows. If successful, the
5416 * list will always contains `VK_KHR_surface`, so if you don't require any
5417 * additional extensions you can pass this list directly to the
5418 * `VkInstanceCreateInfo` struct.
5419 *
5420 * If Vulkan is not available on the machine, this function returns `NULL` and
5421 * generates a @ref GLFW_API_UNAVAILABLE error. Call @ref glfwVulkanSupported
Camilla Löwy98bdd362017-02-07 20:56:48 +01005422 * to check whether Vulkan is at least minimally available.
Camilla Berglund9b75bff2015-08-10 20:19:04 +02005423 *
5424 * If Vulkan is available but no set of extensions allowing window surface
5425 * creation was found, this function returns `NULL`. You may still use Vulkan
5426 * for off-screen rendering and compute work.
5427 *
5428 * @param[out] count Where to store the number of extensions in the returned
5429 * array. This is set to zero if an error occurred.
5430 * @return An array of ASCII encoded extension names, or `NULL` if an
5431 * [error](@ref error_handling) occurred.
5432 *
5433 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
5434 * GLFW_API_UNAVAILABLE.
5435 *
Camilla Berglund67931bd2016-10-26 16:58:56 +02005436 * @remark Additional extensions may be required by future versions of GLFW.
Camilla Berglund9b75bff2015-08-10 20:19:04 +02005437 * You should check if any extensions you wish to enable are already in the
5438 * returned array, as it is an error to specify an extension more than once in
5439 * the `VkInstanceCreateInfo` struct.
5440 *
Camilla Berglunde94d1662016-10-14 01:46:56 +02005441 * @remark @macos This function currently only supports the
5442 * `VK_MVK_macos_surface` extension from MoltenVK.
5443 *
Camilla Berglund9b75bff2015-08-10 20:19:04 +02005444 * @pointer_lifetime The returned array is allocated and freed by GLFW. You
5445 * should not free it yourself. It is guaranteed to be valid only until the
5446 * library is terminated.
5447 *
5448 * @thread_safety This function may be called from any thread.
5449 *
5450 * @sa @ref vulkan_ext
Camilla Berglund7e9e3212016-09-14 20:17:26 +02005451 * @sa @ref glfwCreateWindowSurface
Camilla Berglund9b75bff2015-08-10 20:19:04 +02005452 *
5453 * @since Added in version 3.2.
5454 *
5455 * @ingroup vulkan
5456 */
Camilla Berglund7ab7d8b2016-03-23 10:24:01 +01005457GLFWAPI const char** glfwGetRequiredInstanceExtensions(uint32_t* count);
Camilla Berglund9b75bff2015-08-10 20:19:04 +02005458
5459#if defined(VK_VERSION_1_0)
5460
5461/*! @brief Returns the address of the specified Vulkan instance function.
5462 *
5463 * This function returns the address of the specified Vulkan core or extension
5464 * function for the specified instance. If instance is set to `NULL` it can
5465 * return any function exported from the Vulkan loader, including at least the
5466 * following functions:
5467 *
5468 * - `vkEnumerateInstanceExtensionProperties`
5469 * - `vkEnumerateInstanceLayerProperties`
5470 * - `vkCreateInstance`
5471 * - `vkGetInstanceProcAddr`
5472 *
5473 * If Vulkan is not available on the machine, this function returns `NULL` and
5474 * generates a @ref GLFW_API_UNAVAILABLE error. Call @ref glfwVulkanSupported
Camilla Löwy98bdd362017-02-07 20:56:48 +01005475 * to check whether Vulkan is at least minimally available.
Camilla Berglund9b75bff2015-08-10 20:19:04 +02005476 *
5477 * This function is equivalent to calling `vkGetInstanceProcAddr` with
5478 * a platform-specific query of the Vulkan loader as a fallback.
5479 *
5480 * @param[in] instance The Vulkan instance to query, or `NULL` to retrieve
5481 * functions related to instance creation.
5482 * @param[in] procname The ASCII encoded name of the function.
5483 * @return The address of the function, or `NULL` if an
5484 * [error](@ref error_handling) occurred.
5485 *
5486 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
5487 * GLFW_API_UNAVAILABLE.
5488 *
5489 * @pointer_lifetime The returned function pointer is valid until the library
5490 * is terminated.
5491 *
5492 * @thread_safety This function may be called from any thread.
5493 *
5494 * @sa @ref vulkan_proc
5495 *
5496 * @since Added in version 3.2.
5497 *
5498 * @ingroup vulkan
5499 */
5500GLFWAPI GLFWvkproc glfwGetInstanceProcAddress(VkInstance instance, const char* procname);
5501
5502/*! @brief Returns whether the specified queue family can present images.
5503 *
5504 * This function returns whether the specified queue family of the specified
5505 * physical device supports presentation to the platform GLFW was built for.
5506 *
5507 * If Vulkan or the required window surface creation instance extensions are
5508 * not available on the machine, or if the specified instance was not created
5509 * with the required extensions, this function returns `GLFW_FALSE` and
5510 * generates a @ref GLFW_API_UNAVAILABLE error. Call @ref glfwVulkanSupported
Camilla Löwy98bdd362017-02-07 20:56:48 +01005511 * to check whether Vulkan is at least minimally available and @ref
Camilla Berglund9b75bff2015-08-10 20:19:04 +02005512 * glfwGetRequiredInstanceExtensions to check what instance extensions are
5513 * required.
5514 *
5515 * @param[in] instance The instance that the physical device belongs to.
5516 * @param[in] device The physical device that the queue family belongs to.
5517 * @param[in] queuefamily The index of the queue family to query.
5518 * @return `GLFW_TRUE` if the queue family supports presentation, or
5519 * `GLFW_FALSE` otherwise.
5520 *
5521 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
5522 * GLFW_API_UNAVAILABLE and @ref GLFW_PLATFORM_ERROR.
5523 *
Camilla Berglunde94d1662016-10-14 01:46:56 +02005524 * @remark @macos This function currently always returns `GLFW_TRUE`, as the
5525 * `VK_MVK_macos_surface` extension does not provide
5526 * a `vkGetPhysicalDevice*PresentationSupport` type function.
5527 *
Camilla Berglund9b75bff2015-08-10 20:19:04 +02005528 * @thread_safety This function may be called from any thread. For
5529 * synchronization details of Vulkan objects, see the Vulkan specification.
5530 *
5531 * @sa @ref vulkan_present
5532 *
5533 * @since Added in version 3.2.
5534 *
5535 * @ingroup vulkan
5536 */
5537GLFWAPI int glfwGetPhysicalDevicePresentationSupport(VkInstance instance, VkPhysicalDevice device, uint32_t queuefamily);
5538
5539/*! @brief Creates a Vulkan surface for the specified window.
5540 *
5541 * This function creates a Vulkan surface for the specified window.
5542 *
Camilla Löwy98bdd362017-02-07 20:56:48 +01005543 * If the Vulkan loader or at least one minimally functional ICD were not found,
5544 * this function returns `VK_ERROR_INITIALIZATION_FAILED` and generates a @ref
5545 * GLFW_API_UNAVAILABLE error. Call @ref glfwVulkanSupported to check whether
5546 * Vulkan is at least minimally available.
Camilla Berglund9b75bff2015-08-10 20:19:04 +02005547 *
5548 * If the required window surface creation instance extensions are not
5549 * available or if the specified instance was not created with these extensions
5550 * enabled, this function returns `VK_ERROR_EXTENSION_NOT_PRESENT` and
5551 * generates a @ref GLFW_API_UNAVAILABLE error. Call @ref
5552 * glfwGetRequiredInstanceExtensions to check what instance extensions are
5553 * required.
5554 *
Corentin Wallez8a8eefa2018-01-30 13:25:17 -05005555 * The window surface cannot be shared with another API so the window must
5556 * have been created with the [client api hint](@ref GLFW_CLIENT_API_attrib)
5557 * set to `GLFW_NO_API` otherwise it generates a @ref GLFW_INVALID_VALUE error
5558 * and returns `VK_ERROR_NATIVE_WINDOW_IN_USE_KHR`.
5559 *
Camilla Berglund9b75bff2015-08-10 20:19:04 +02005560 * The window surface must be destroyed before the specified Vulkan instance.
5561 * It is the responsibility of the caller to destroy the window surface. GLFW
5562 * does not destroy it for you. Call `vkDestroySurfaceKHR` to destroy the
5563 * surface.
5564 *
5565 * @param[in] instance The Vulkan instance to create the surface in.
5566 * @param[in] window The window to create the surface for.
5567 * @param[in] allocator The allocator to use, or `NULL` to use the default
5568 * allocator.
5569 * @param[out] surface Where to store the handle of the surface. This is set
5570 * to `VK_NULL_HANDLE` if an error occurred.
5571 * @return `VK_SUCCESS` if successful, or a Vulkan error code if an
5572 * [error](@ref error_handling) occurred.
5573 *
5574 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
Corentin Wallez8a8eefa2018-01-30 13:25:17 -05005575 * GLFW_API_UNAVAILABLE, @ref GLFW_PLATFORM_ERROR and @ref GLFW_INVALID_VALUE
Camilla Berglund9b75bff2015-08-10 20:19:04 +02005576 *
Camilla Berglund67931bd2016-10-26 16:58:56 +02005577 * @remark If an error occurs before the creation call is made, GLFW returns
Camilla Berglund9b75bff2015-08-10 20:19:04 +02005578 * the Vulkan error code most appropriate for the error. Appropriate use of
5579 * @ref glfwVulkanSupported and @ref glfwGetRequiredInstanceExtensions should
Camilla Berglundee33dcd2016-03-07 14:42:51 +01005580 * eliminate almost all occurrences of these errors.
Camilla Berglund9b75bff2015-08-10 20:19:04 +02005581 *
Camilla Berglunde94d1662016-10-14 01:46:56 +02005582 * @remark @macos This function currently only supports the
5583 * `VK_MVK_macos_surface` extension from MoltenVK.
5584 *
5585 * @remark @macos This function creates and sets a `CAMetalLayer` instance for
5586 * the window content view, which is required for MoltenVK to function.
5587 *
Camilla Berglund9b75bff2015-08-10 20:19:04 +02005588 * @thread_safety This function may be called from any thread. For
5589 * synchronization details of Vulkan objects, see the Vulkan specification.
5590 *
5591 * @sa @ref vulkan_surface
Camilla Berglund7e9e3212016-09-14 20:17:26 +02005592 * @sa @ref glfwGetRequiredInstanceExtensions
Camilla Berglund9b75bff2015-08-10 20:19:04 +02005593 *
5594 * @since Added in version 3.2.
5595 *
5596 * @ingroup vulkan
5597 */
5598GLFWAPI VkResult glfwCreateWindowSurface(VkInstance instance, GLFWwindow* window, const VkAllocationCallbacks* allocator, VkSurfaceKHR* surface);
5599
5600#endif /*VK_VERSION_1_0*/
5601
Camilla Berglund3249f812010-09-07 17:34:51 +02005602
Camilla Berglund4afc67c2011-07-27 17:09:17 +02005603/*************************************************************************
5604 * Global definition cleanup
5605 *************************************************************************/
5606
5607/* ------------------- BEGIN SYSTEM/COMPILER SPECIFIC -------------------- */
5608
Camilla Berglund4afc67c2011-07-27 17:09:17 +02005609#ifdef GLFW_WINGDIAPI_DEFINED
5610 #undef WINGDIAPI
5611 #undef GLFW_WINGDIAPI_DEFINED
5612#endif
5613
5614#ifdef GLFW_CALLBACK_DEFINED
5615 #undef CALLBACK
5616 #undef GLFW_CALLBACK_DEFINED
5617#endif
5618
Camilla Löwybe51c202017-07-03 14:25:47 +02005619/* Some OpenGL related headers need GLAPIENTRY, but it is unconditionally
5620 * defined by some gl.h variants (OpenBSD) so define it after if needed.
5621 */
5622#ifndef GLAPIENTRY
5623 #define GLAPIENTRY APIENTRY
5624#endif
5625
Camilla Berglund4afc67c2011-07-27 17:09:17 +02005626/* -------------------- END SYSTEM/COMPILER SPECIFIC --------------------- */
5627
5628
Camilla Berglund3249f812010-09-07 17:34:51 +02005629#ifdef __cplusplus
5630}
5631#endif
5632
Camilla Berglundf8df91d2013-01-15 01:59:56 +01005633#endif /* _glfw3_h_ */
Camilla Berglund3249f812010-09-07 17:34:51 +02005634