]> git.sesse.net Git - pistorm/blob - raylib_pi4_test/external/glfw/include/GLFW/glfw3.h
Update raylib files and Makefile for Pi 4 testing
[pistorm] / raylib_pi4_test / external / glfw / include / GLFW / glfw3.h
1 /*************************************************************************
2  * GLFW 3.4 - www.glfw.org
3  * A library for OpenGL, window and input
4  *------------------------------------------------------------------------
5  * Copyright (c) 2002-2006 Marcus Geelnard
6  * Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.org>
7  *
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
29 #ifndef _glfw3_h_
30 #define _glfw3_h_
31
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35
36
37 /*************************************************************************
38  * Doxygen documentation
39  *************************************************************************/
40
41 /*! @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  */
49 /*! @defgroup context Context reference
50  *  @brief Functions and types related to OpenGL and OpenGL ES contexts.
51  *
52  *  This is the reference documentation for OpenGL and OpenGL ES context related
53  *  functions.  For more task-oriented information, see the @ref context_guide.
54  */
55 /*! @defgroup vulkan Vulkan support reference
56  *  @brief Functions and types related to Vulkan.
57  *
58  *  This is the reference documentation for Vulkan related functions and types.
59  *  For more task-oriented information, see the @ref vulkan_guide.
60  */
61 /*! @defgroup init Initialization, version and error reference
62  *  @brief Functions and types related to initialization and error handling.
63  *
64  *  This is the reference documentation for initialization and termination of
65  *  the library, version management and error handling.  For more task-oriented
66  *  information, see the @ref intro_guide.
67  */
68 /*! @defgroup input Input reference
69  *  @brief Functions and types related to input handling.
70  *
71  *  This is the reference documentation for input related functions and types.
72  *  For more task-oriented information, see the @ref input_guide.
73  */
74 /*! @defgroup monitor Monitor reference
75  *  @brief Functions and types related to monitors.
76  *
77  *  This is the reference documentation for monitor related functions and types.
78  *  For more task-oriented information, see the @ref monitor_guide.
79  */
80 /*! @defgroup window Window reference
81  *  @brief Functions and types related to windows.
82  *
83  *  This is the reference documentation for window related functions and types,
84  *  including creation, deletion and event polling.  For more task-oriented
85  *  information, see the @ref window_guide.
86  */
87
88
89 /*************************************************************************
90  * Compiler- and platform-specific preprocessor work
91  *************************************************************************/
92
93 /* If we are we on Windows, we want a single define for it.
94  */
95 #if !defined(_WIN32) && (defined(__WIN32__) || defined(WIN32) || defined(__MINGW32__))
96  #define _WIN32
97 #endif /* _WIN32 */
98
99 /* Include because most Windows GLU headers need wchar_t and
100  * the macOS OpenGL header blocks the definition of ptrdiff_t by glext.h.
101  * Include it unconditionally to avoid surprising side-effects.
102  */
103 #include <stddef.h>
104
105 /* Include because it is needed by Vulkan and related functions.
106  * Include it unconditionally to avoid surprising side-effects.
107  */
108 #include <stdint.h>
109
110 #if defined(GLFW_INCLUDE_VULKAN)
111   #include <vulkan/vulkan.h>
112 #endif /* Vulkan header */
113
114 /* The Vulkan header may have indirectly included windows.h (because of
115  * VK_USE_PLATFORM_WIN32_KHR) so we offer our replacement symbols after it.
116  */
117
118 /* It is customary to use APIENTRY for OpenGL function pointer declarations on
119  * all platforms.  Additionally, the Windows OpenGL header needs APIENTRY.
120  */
121 #if !defined(APIENTRY)
122  #if defined(_WIN32)
123   #define APIENTRY __stdcall
124  #else
125   #define APIENTRY
126  #endif
127  #define GLFW_APIENTRY_DEFINED
128 #endif /* APIENTRY */
129
130 /* Some Windows OpenGL headers need this.
131  */
132 #if !defined(WINGDIAPI) && defined(_WIN32)
133  #define WINGDIAPI __declspec(dllimport)
134  #define GLFW_WINGDIAPI_DEFINED
135 #endif /* WINGDIAPI */
136
137 /* Some Windows GLU headers need this.
138  */
139 #if !defined(CALLBACK) && defined(_WIN32)
140  #define CALLBACK __stdcall
141  #define GLFW_CALLBACK_DEFINED
142 #endif /* CALLBACK */
143
144 /* Include the chosen OpenGL or OpenGL ES headers.
145  */
146 #if defined(GLFW_INCLUDE_ES1)
147
148  #include <GLES/gl.h>
149  #if defined(GLFW_INCLUDE_GLEXT)
150   #include <GLES/glext.h>
151  #endif
152
153 #elif defined(GLFW_INCLUDE_ES2)
154
155  #include <GLES2/gl2.h>
156  #if defined(GLFW_INCLUDE_GLEXT)
157   #include <GLES2/gl2ext.h>
158  #endif
159
160 #elif defined(GLFW_INCLUDE_ES3)
161
162  #include <GLES3/gl3.h>
163  #if defined(GLFW_INCLUDE_GLEXT)
164   #include <GLES2/gl2ext.h>
165  #endif
166
167 #elif defined(GLFW_INCLUDE_ES31)
168
169  #include <GLES3/gl31.h>
170  #if defined(GLFW_INCLUDE_GLEXT)
171   #include <GLES2/gl2ext.h>
172  #endif
173
174 #elif defined(GLFW_INCLUDE_ES32)
175
176  #include <GLES3/gl32.h>
177  #if defined(GLFW_INCLUDE_GLEXT)
178   #include <GLES2/gl2ext.h>
179  #endif
180
181 #elif defined(GLFW_INCLUDE_GLCOREARB)
182
183  #if defined(__APPLE__)
184
185   #include <OpenGL/gl3.h>
186   #if defined(GLFW_INCLUDE_GLEXT)
187    #include <OpenGL/gl3ext.h>
188   #endif /*GLFW_INCLUDE_GLEXT*/
189
190  #else /*__APPLE__*/
191
192   #include <GL/glcorearb.h>
193
194  #endif /*__APPLE__*/
195
196 #elif defined(GLFW_INCLUDE_GLU)
197
198  #if defined(__APPLE__)
199
200   #if defined(GLFW_INCLUDE_GLU)
201    #include <OpenGL/glu.h>
202   #endif
203
204  #else /*__APPLE__*/
205
206   #if defined(GLFW_INCLUDE_GLU)
207    #include <GL/glu.h>
208   #endif
209
210  #endif /*__APPLE__*/
211
212 #elif !defined(GLFW_INCLUDE_NONE) && \
213       !defined(__gl_h_) && \
214       !defined(__gles1_gl_h_) && \
215       !defined(__gles2_gl2_h_) && \
216       !defined(__gles2_gl3_h_) && \
217       !defined(__gles2_gl31_h_) && \
218       !defined(__gles2_gl32_h_) && \
219       !defined(__gl_glcorearb_h_) && \
220       !defined(__gl2_h_) /*legacy*/ && \
221       !defined(__gl3_h_) /*legacy*/ && \
222       !defined(__gl31_h_) /*legacy*/ && \
223       !defined(__gl32_h_) /*legacy*/ && \
224       !defined(__glcorearb_h_) /*legacy*/ && \
225       !defined(__GL_H__) /*non-standard*/ && \
226       !defined(__gltypes_h_) /*non-standard*/ && \
227       !defined(__glee_h_) /*non-standard*/
228
229  #if defined(__APPLE__)
230
231   #if !defined(GLFW_INCLUDE_GLEXT)
232    #define GL_GLEXT_LEGACY
233   #endif
234   #include <OpenGL/gl.h>
235
236  #else /*__APPLE__*/
237
238   #include <GL/gl.h>
239   #if defined(GLFW_INCLUDE_GLEXT)
240    #include <GL/glext.h>
241   #endif
242
243  #endif /*__APPLE__*/
244
245 #endif /* OpenGL and OpenGL ES headers */
246
247 #if defined(GLFW_DLL) && defined(_GLFW_BUILD_DLL)
248  /* GLFW_DLL must be defined by applications that are linking against the DLL
249   * version of the GLFW library.  _GLFW_BUILD_DLL is defined by the GLFW
250   * configuration header when compiling the DLL version of the library.
251   */
252  #error "You must not have both GLFW_DLL and _GLFW_BUILD_DLL defined"
253 #endif
254
255 /* GLFWAPI is used to declare public API functions for export
256  * from the DLL / shared library / dynamic library.
257  */
258 #if defined(_WIN32) && defined(_GLFW_BUILD_DLL)
259  /* We are building GLFW as a Win32 DLL */
260  #define GLFWAPI __declspec(dllexport)
261 #elif defined(_WIN32) && defined(GLFW_DLL)
262  /* We are calling GLFW as a Win32 DLL */
263  #define GLFWAPI __declspec(dllimport)
264 #elif defined(__GNUC__) && defined(_GLFW_BUILD_DLL)
265  /* We are building GLFW as a shared / dynamic library */
266  #define GLFWAPI __attribute__((visibility("default")))
267 #else
268  /* We are building or calling GLFW as a static library */
269  #define GLFWAPI
270 #endif
271
272
273 /*************************************************************************
274  * GLFW API tokens
275  *************************************************************************/
276
277 /*! @name GLFW version macros
278  *  @{ */
279 /*! @brief The major version number of the GLFW library.
280  *
281  *  This is incremented when the API is changed in non-compatible ways.
282  *  @ingroup init
283  */
284 #define GLFW_VERSION_MAJOR          3
285 /*! @brief The minor version number of the GLFW library.
286  *
287  *  This is incremented when features are added to the API but it remains
288  *  backward-compatible.
289  *  @ingroup init
290  */
291 #define GLFW_VERSION_MINOR          4
292 /*! @brief The revision number of the GLFW library.
293  *
294  *  This is incremented when a bug fix release is made that does not contain any
295  *  API changes.
296  *  @ingroup init
297  */
298 #define GLFW_VERSION_REVISION       0
299 /*! @} */
300
301 /*! @brief One.
302  *
303  *  This is only semantic sugar for the number 1.  You can instead use `1` or
304  *  `true` or `_True` or `GL_TRUE` or `VK_TRUE` or anything else that is equal
305  *  to one.
306  *
307  *  @ingroup init
308  */
309 #define GLFW_TRUE                   1
310 /*! @brief Zero.
311  *
312  *  This is only semantic sugar for the number 0.  You can instead use `0` or
313  *  `false` or `_False` or `GL_FALSE` or `VK_FALSE` or anything else that is
314  *  equal to zero.
315  *
316  *  @ingroup init
317  */
318 #define GLFW_FALSE                  0
319
320 /*! @name Key and button actions
321  *  @{ */
322 /*! @brief The key or mouse button was released.
323  *
324  *  The key or mouse button was released.
325  *
326  *  @ingroup input
327  */
328 #define GLFW_RELEASE                0
329 /*! @brief The key or mouse button was pressed.
330  *
331  *  The key or mouse button was pressed.
332  *
333  *  @ingroup input
334  */
335 #define GLFW_PRESS                  1
336 /*! @brief The key was held down until it repeated.
337  *
338  *  The key was held down until it repeated.
339  *
340  *  @ingroup input
341  */
342 #define GLFW_REPEAT                 2
343 /*! @} */
344
345 /*! @defgroup hat_state Joystick hat states
346  *  @brief Joystick hat states.
347  *
348  *  See [joystick hat input](@ref joystick_hat) for how these are used.
349  *
350  *  @ingroup input
351  *  @{ */
352 #define GLFW_HAT_CENTERED           0
353 #define GLFW_HAT_UP                 1
354 #define GLFW_HAT_RIGHT              2
355 #define GLFW_HAT_DOWN               4
356 #define GLFW_HAT_LEFT               8
357 #define GLFW_HAT_RIGHT_UP           (GLFW_HAT_RIGHT | GLFW_HAT_UP)
358 #define GLFW_HAT_RIGHT_DOWN         (GLFW_HAT_RIGHT | GLFW_HAT_DOWN)
359 #define GLFW_HAT_LEFT_UP            (GLFW_HAT_LEFT  | GLFW_HAT_UP)
360 #define GLFW_HAT_LEFT_DOWN          (GLFW_HAT_LEFT  | GLFW_HAT_DOWN)
361 /*! @} */
362
363 /*! @defgroup keys Keyboard keys
364  *  @brief Keyboard key IDs.
365  *
366  *  See [key input](@ref input_key) for how these are used.
367  *
368  *  These key codes are inspired by the _USB HID Usage Tables v1.12_ (p. 53-60),
369  *  but re-arranged to map to 7-bit ASCII for printable keys (function keys are
370  *  put in the 256+ range).
371  *
372  *  The naming of the key codes follow these rules:
373  *   - The US keyboard layout is used
374  *   - Names of printable alpha-numeric characters are used (e.g. "A", "R",
375  *     "3", etc.)
376  *   - For non-alphanumeric characters, Unicode:ish names are used (e.g.
377  *     "COMMA", "LEFT_SQUARE_BRACKET", etc.). Note that some names do not
378  *     correspond to the Unicode standard (usually for brevity)
379  *   - Keys that lack a clear US mapping are named "WORLD_x"
380  *   - For non-printable keys, custom names are used (e.g. "F4",
381  *     "BACKSPACE", etc.)
382  *
383  *  @ingroup input
384  *  @{
385  */
386
387 /* The unknown key */
388 #define GLFW_KEY_UNKNOWN            -1
389
390 /* Printable keys */
391 #define GLFW_KEY_SPACE              32
392 #define GLFW_KEY_APOSTROPHE         39  /* ' */
393 #define GLFW_KEY_COMMA              44  /* , */
394 #define GLFW_KEY_MINUS              45  /* - */
395 #define GLFW_KEY_PERIOD             46  /* . */
396 #define GLFW_KEY_SLASH              47  /* / */
397 #define GLFW_KEY_0                  48
398 #define GLFW_KEY_1                  49
399 #define GLFW_KEY_2                  50
400 #define GLFW_KEY_3                  51
401 #define GLFW_KEY_4                  52
402 #define GLFW_KEY_5                  53
403 #define GLFW_KEY_6                  54
404 #define GLFW_KEY_7                  55
405 #define GLFW_KEY_8                  56
406 #define GLFW_KEY_9                  57
407 #define GLFW_KEY_SEMICOLON          59  /* ; */
408 #define GLFW_KEY_EQUAL              61  /* = */
409 #define GLFW_KEY_A                  65
410 #define GLFW_KEY_B                  66
411 #define GLFW_KEY_C                  67
412 #define GLFW_KEY_D                  68
413 #define GLFW_KEY_E                  69
414 #define GLFW_KEY_F                  70
415 #define GLFW_KEY_G                  71
416 #define GLFW_KEY_H                  72
417 #define GLFW_KEY_I                  73
418 #define GLFW_KEY_J                  74
419 #define GLFW_KEY_K                  75
420 #define GLFW_KEY_L                  76
421 #define GLFW_KEY_M                  77
422 #define GLFW_KEY_N                  78
423 #define GLFW_KEY_O                  79
424 #define GLFW_KEY_P                  80
425 #define GLFW_KEY_Q                  81
426 #define GLFW_KEY_R                  82
427 #define GLFW_KEY_S                  83
428 #define GLFW_KEY_T                  84
429 #define GLFW_KEY_U                  85
430 #define GLFW_KEY_V                  86
431 #define GLFW_KEY_W                  87
432 #define GLFW_KEY_X                  88
433 #define GLFW_KEY_Y                  89
434 #define GLFW_KEY_Z                  90
435 #define GLFW_KEY_LEFT_BRACKET       91  /* [ */
436 #define GLFW_KEY_BACKSLASH          92  /* \ */
437 #define GLFW_KEY_RIGHT_BRACKET      93  /* ] */
438 #define GLFW_KEY_GRAVE_ACCENT       96  /* ` */
439 #define GLFW_KEY_WORLD_1            161 /* non-US #1 */
440 #define GLFW_KEY_WORLD_2            162 /* non-US #2 */
441
442 /* Function keys */
443 #define GLFW_KEY_ESCAPE             256
444 #define GLFW_KEY_ENTER              257
445 #define GLFW_KEY_TAB                258
446 #define GLFW_KEY_BACKSPACE          259
447 #define GLFW_KEY_INSERT             260
448 #define GLFW_KEY_DELETE             261
449 #define GLFW_KEY_RIGHT              262
450 #define GLFW_KEY_LEFT               263
451 #define GLFW_KEY_DOWN               264
452 #define GLFW_KEY_UP                 265
453 #define GLFW_KEY_PAGE_UP            266
454 #define GLFW_KEY_PAGE_DOWN          267
455 #define GLFW_KEY_HOME               268
456 #define GLFW_KEY_END                269
457 #define GLFW_KEY_CAPS_LOCK          280
458 #define GLFW_KEY_SCROLL_LOCK        281
459 #define GLFW_KEY_NUM_LOCK           282
460 #define GLFW_KEY_PRINT_SCREEN       283
461 #define GLFW_KEY_PAUSE              284
462 #define GLFW_KEY_F1                 290
463 #define GLFW_KEY_F2                 291
464 #define GLFW_KEY_F3                 292
465 #define GLFW_KEY_F4                 293
466 #define GLFW_KEY_F5                 294
467 #define GLFW_KEY_F6                 295
468 #define GLFW_KEY_F7                 296
469 #define GLFW_KEY_F8                 297
470 #define GLFW_KEY_F9                 298
471 #define GLFW_KEY_F10                299
472 #define GLFW_KEY_F11                300
473 #define GLFW_KEY_F12                301
474 #define GLFW_KEY_F13                302
475 #define GLFW_KEY_F14                303
476 #define GLFW_KEY_F15                304
477 #define GLFW_KEY_F16                305
478 #define GLFW_KEY_F17                306
479 #define GLFW_KEY_F18                307
480 #define GLFW_KEY_F19                308
481 #define GLFW_KEY_F20                309
482 #define GLFW_KEY_F21                310
483 #define GLFW_KEY_F22                311
484 #define GLFW_KEY_F23                312
485 #define GLFW_KEY_F24                313
486 #define GLFW_KEY_F25                314
487 #define GLFW_KEY_KP_0               320
488 #define GLFW_KEY_KP_1               321
489 #define GLFW_KEY_KP_2               322
490 #define GLFW_KEY_KP_3               323
491 #define GLFW_KEY_KP_4               324
492 #define GLFW_KEY_KP_5               325
493 #define GLFW_KEY_KP_6               326
494 #define GLFW_KEY_KP_7               327
495 #define GLFW_KEY_KP_8               328
496 #define GLFW_KEY_KP_9               329
497 #define GLFW_KEY_KP_DECIMAL         330
498 #define GLFW_KEY_KP_DIVIDE          331
499 #define GLFW_KEY_KP_MULTIPLY        332
500 #define GLFW_KEY_KP_SUBTRACT        333
501 #define GLFW_KEY_KP_ADD             334
502 #define GLFW_KEY_KP_ENTER           335
503 #define GLFW_KEY_KP_EQUAL           336
504 #define GLFW_KEY_LEFT_SHIFT         340
505 #define GLFW_KEY_LEFT_CONTROL       341
506 #define GLFW_KEY_LEFT_ALT           342
507 #define GLFW_KEY_LEFT_SUPER         343
508 #define GLFW_KEY_RIGHT_SHIFT        344
509 #define GLFW_KEY_RIGHT_CONTROL      345
510 #define GLFW_KEY_RIGHT_ALT          346
511 #define GLFW_KEY_RIGHT_SUPER        347
512 #define GLFW_KEY_MENU               348
513
514 #define GLFW_KEY_LAST               GLFW_KEY_MENU
515
516 /*! @} */
517
518 /*! @defgroup mods Modifier key flags
519  *  @brief Modifier key flags.
520  *
521  *  See [key input](@ref input_key) for how these are used.
522  *
523  *  @ingroup input
524  *  @{ */
525
526 /*! @brief If this bit is set one or more Shift keys were held down.
527  *
528  *  If this bit is set one or more Shift keys were held down.
529  */
530 #define GLFW_MOD_SHIFT           0x0001
531 /*! @brief If this bit is set one or more Control keys were held down.
532  *
533  *  If this bit is set one or more Control keys were held down.
534  */
535 #define GLFW_MOD_CONTROL         0x0002
536 /*! @brief If this bit is set one or more Alt keys were held down.
537  *
538  *  If this bit is set one or more Alt keys were held down.
539  */
540 #define GLFW_MOD_ALT             0x0004
541 /*! @brief If this bit is set one or more Super keys were held down.
542  *
543  *  If this bit is set one or more Super keys were held down.
544  */
545 #define GLFW_MOD_SUPER           0x0008
546 /*! @brief If this bit is set the Caps Lock key is enabled.
547  *
548  *  If this bit is set the Caps Lock key is enabled and the @ref
549  *  GLFW_LOCK_KEY_MODS input mode is set.
550  */
551 #define GLFW_MOD_CAPS_LOCK       0x0010
552 /*! @brief If this bit is set the Num Lock key is enabled.
553  *
554  *  If this bit is set the Num Lock key is enabled and the @ref
555  *  GLFW_LOCK_KEY_MODS input mode is set.
556  */
557 #define GLFW_MOD_NUM_LOCK        0x0020
558
559 /*! @} */
560
561 /*! @defgroup buttons Mouse buttons
562  *  @brief Mouse button IDs.
563  *
564  *  See [mouse button input](@ref input_mouse_button) for how these are used.
565  *
566  *  @ingroup input
567  *  @{ */
568 #define GLFW_MOUSE_BUTTON_1         0
569 #define GLFW_MOUSE_BUTTON_2         1
570 #define GLFW_MOUSE_BUTTON_3         2
571 #define GLFW_MOUSE_BUTTON_4         3
572 #define GLFW_MOUSE_BUTTON_5         4
573 #define GLFW_MOUSE_BUTTON_6         5
574 #define GLFW_MOUSE_BUTTON_7         6
575 #define GLFW_MOUSE_BUTTON_8         7
576 #define GLFW_MOUSE_BUTTON_LAST      GLFW_MOUSE_BUTTON_8
577 #define GLFW_MOUSE_BUTTON_LEFT      GLFW_MOUSE_BUTTON_1
578 #define GLFW_MOUSE_BUTTON_RIGHT     GLFW_MOUSE_BUTTON_2
579 #define GLFW_MOUSE_BUTTON_MIDDLE    GLFW_MOUSE_BUTTON_3
580 /*! @} */
581
582 /*! @defgroup joysticks Joysticks
583  *  @brief Joystick IDs.
584  *
585  *  See [joystick input](@ref joystick) for how these are used.
586  *
587  *  @ingroup input
588  *  @{ */
589 #define GLFW_JOYSTICK_1             0
590 #define GLFW_JOYSTICK_2             1
591 #define GLFW_JOYSTICK_3             2
592 #define GLFW_JOYSTICK_4             3
593 #define GLFW_JOYSTICK_5             4
594 #define GLFW_JOYSTICK_6             5
595 #define GLFW_JOYSTICK_7             6
596 #define GLFW_JOYSTICK_8             7
597 #define GLFW_JOYSTICK_9             8
598 #define GLFW_JOYSTICK_10            9
599 #define GLFW_JOYSTICK_11            10
600 #define GLFW_JOYSTICK_12            11
601 #define GLFW_JOYSTICK_13            12
602 #define GLFW_JOYSTICK_14            13
603 #define GLFW_JOYSTICK_15            14
604 #define GLFW_JOYSTICK_16            15
605 #define GLFW_JOYSTICK_LAST          GLFW_JOYSTICK_16
606 /*! @} */
607
608 /*! @defgroup gamepad_buttons Gamepad buttons
609  *  @brief Gamepad buttons.
610  *
611  *  See @ref gamepad for how these are used.
612  *
613  *  @ingroup input
614  *  @{ */
615 #define GLFW_GAMEPAD_BUTTON_A               0
616 #define GLFW_GAMEPAD_BUTTON_B               1
617 #define GLFW_GAMEPAD_BUTTON_X               2
618 #define GLFW_GAMEPAD_BUTTON_Y               3
619 #define GLFW_GAMEPAD_BUTTON_LEFT_BUMPER     4
620 #define GLFW_GAMEPAD_BUTTON_RIGHT_BUMPER    5
621 #define GLFW_GAMEPAD_BUTTON_BACK            6
622 #define GLFW_GAMEPAD_BUTTON_START           7
623 #define GLFW_GAMEPAD_BUTTON_GUIDE           8
624 #define GLFW_GAMEPAD_BUTTON_LEFT_THUMB      9
625 #define GLFW_GAMEPAD_BUTTON_RIGHT_THUMB     10
626 #define GLFW_GAMEPAD_BUTTON_DPAD_UP         11
627 #define GLFW_GAMEPAD_BUTTON_DPAD_RIGHT      12
628 #define GLFW_GAMEPAD_BUTTON_DPAD_DOWN       13
629 #define GLFW_GAMEPAD_BUTTON_DPAD_LEFT       14
630 #define GLFW_GAMEPAD_BUTTON_LAST            GLFW_GAMEPAD_BUTTON_DPAD_LEFT
631
632 #define GLFW_GAMEPAD_BUTTON_CROSS       GLFW_GAMEPAD_BUTTON_A
633 #define GLFW_GAMEPAD_BUTTON_CIRCLE      GLFW_GAMEPAD_BUTTON_B
634 #define GLFW_GAMEPAD_BUTTON_SQUARE      GLFW_GAMEPAD_BUTTON_X
635 #define GLFW_GAMEPAD_BUTTON_TRIANGLE    GLFW_GAMEPAD_BUTTON_Y
636 /*! @} */
637
638 /*! @defgroup gamepad_axes Gamepad axes
639  *  @brief Gamepad axes.
640  *
641  *  See @ref gamepad for how these are used.
642  *
643  *  @ingroup input
644  *  @{ */
645 #define GLFW_GAMEPAD_AXIS_LEFT_X        0
646 #define GLFW_GAMEPAD_AXIS_LEFT_Y        1
647 #define GLFW_GAMEPAD_AXIS_RIGHT_X       2
648 #define GLFW_GAMEPAD_AXIS_RIGHT_Y       3
649 #define GLFW_GAMEPAD_AXIS_LEFT_TRIGGER  4
650 #define GLFW_GAMEPAD_AXIS_RIGHT_TRIGGER 5
651 #define GLFW_GAMEPAD_AXIS_LAST          GLFW_GAMEPAD_AXIS_RIGHT_TRIGGER
652 /*! @} */
653
654 /*! @defgroup errors Error codes
655  *  @brief Error codes.
656  *
657  *  See [error handling](@ref error_handling) for how these are used.
658  *
659  *  @ingroup init
660  *  @{ */
661 /*! @brief No error has occurred.
662  *
663  *  No error has occurred.
664  *
665  *  @analysis Yay.
666  */
667 #define GLFW_NO_ERROR               0
668 /*! @brief GLFW has not been initialized.
669  *
670  *  This occurs if a GLFW function was called that must not be called unless the
671  *  library is [initialized](@ref intro_init).
672  *
673  *  @analysis Application programmer error.  Initialize GLFW before calling any
674  *  function that requires initialization.
675  */
676 #define GLFW_NOT_INITIALIZED        0x00010001
677 /*! @brief No context is current for this thread.
678  *
679  *  This occurs if a GLFW function was called that needs and operates on the
680  *  current OpenGL or OpenGL ES context but no context is current on the calling
681  *  thread.  One such function is @ref glfwSwapInterval.
682  *
683  *  @analysis Application programmer error.  Ensure a context is current before
684  *  calling functions that require a current context.
685  */
686 #define GLFW_NO_CURRENT_CONTEXT     0x00010002
687 /*! @brief One of the arguments to the function was an invalid enum value.
688  *
689  *  One of the arguments to the function was an invalid enum value, for example
690  *  requesting @ref GLFW_RED_BITS with @ref glfwGetWindowAttrib.
691  *
692  *  @analysis Application programmer error.  Fix the offending call.
693  */
694 #define GLFW_INVALID_ENUM           0x00010003
695 /*! @brief One of the arguments to the function was an invalid value.
696  *
697  *  One of the arguments to the function was an invalid value, for example
698  *  requesting a non-existent OpenGL or OpenGL ES version like 2.7.
699  *
700  *  Requesting a valid but unavailable OpenGL or OpenGL ES version will instead
701  *  result in a @ref GLFW_VERSION_UNAVAILABLE error.
702  *
703  *  @analysis Application programmer error.  Fix the offending call.
704  */
705 #define GLFW_INVALID_VALUE          0x00010004
706 /*! @brief A memory allocation failed.
707  *
708  *  A memory allocation failed.
709  *
710  *  @analysis A bug in GLFW or the underlying operating system.  Report the bug
711  *  to our [issue tracker](https://github.com/glfw/glfw/issues).
712  */
713 #define GLFW_OUT_OF_MEMORY          0x00010005
714 /*! @brief GLFW could not find support for the requested API on the system.
715  *
716  *  GLFW could not find support for the requested API on the system.
717  *
718  *  @analysis The installed graphics driver does not support the requested
719  *  API, or does not support it via the chosen context creation backend.
720  *  Below are a few examples.
721  *
722  *  @par
723  *  Some pre-installed Windows graphics drivers do not support OpenGL.  AMD only
724  *  supports OpenGL ES via EGL, while Nvidia and Intel only support it via
725  *  a WGL or GLX extension.  macOS does not provide OpenGL ES at all.  The Mesa
726  *  EGL, OpenGL and OpenGL ES libraries do not interface with the Nvidia binary
727  *  driver.  Older graphics drivers do not support Vulkan.
728  */
729 #define GLFW_API_UNAVAILABLE        0x00010006
730 /*! @brief The requested OpenGL or OpenGL ES version is not available.
731  *
732  *  The requested OpenGL or OpenGL ES version (including any requested context
733  *  or framebuffer hints) is not available on this machine.
734  *
735  *  @analysis The machine does not support your requirements.  If your
736  *  application is sufficiently flexible, downgrade your requirements and try
737  *  again.  Otherwise, inform the user that their machine does not match your
738  *  requirements.
739  *
740  *  @par
741  *  Future invalid OpenGL and OpenGL ES versions, for example OpenGL 4.8 if 5.0
742  *  comes out before the 4.x series gets that far, also fail with this error and
743  *  not @ref GLFW_INVALID_VALUE, because GLFW cannot know what future versions
744  *  will exist.
745  */
746 #define GLFW_VERSION_UNAVAILABLE    0x00010007
747 /*! @brief A platform-specific error occurred that does not match any of the
748  *  more specific categories.
749  *
750  *  A platform-specific error occurred that does not match any of the more
751  *  specific categories.
752  *
753  *  @analysis A bug or configuration error in GLFW, the underlying operating
754  *  system or its drivers, or a lack of required resources.  Report the issue to
755  *  our [issue tracker](https://github.com/glfw/glfw/issues).
756  */
757 #define GLFW_PLATFORM_ERROR         0x00010008
758 /*! @brief The requested format is not supported or available.
759  *
760  *  If emitted during window creation, the requested pixel format is not
761  *  supported.
762  *
763  *  If emitted when querying the clipboard, the contents of the clipboard could
764  *  not be converted to the requested format.
765  *
766  *  @analysis If emitted during window creation, one or more
767  *  [hard constraints](@ref window_hints_hard) did not match any of the
768  *  available pixel formats.  If your application is sufficiently flexible,
769  *  downgrade your requirements and try again.  Otherwise, inform the user that
770  *  their machine does not match your requirements.
771  *
772  *  @par
773  *  If emitted when querying the clipboard, ignore the error or report it to
774  *  the user, as appropriate.
775  */
776 #define GLFW_FORMAT_UNAVAILABLE     0x00010009
777 /*! @brief The specified window does not have an OpenGL or OpenGL ES context.
778  *
779  *  A window that does not have an OpenGL or OpenGL ES context was passed to
780  *  a function that requires it to have one.
781  *
782  *  @analysis Application programmer error.  Fix the offending call.
783  */
784 #define GLFW_NO_WINDOW_CONTEXT      0x0001000A
785 /*! @brief The specified cursor shape is not available.
786  *
787  *  The specified standard cursor shape is not available, either because the
788  *  current system cursor theme does not provide it or because it is not
789  *  available on the platform.
790  *
791  *  @analysis Platform or system settings limitation.  Pick another
792  *  [standard cursor shape](@ref shapes) or create a
793  *  [custom cursor](@ref cursor_custom).
794  */
795 #define GLFW_CURSOR_UNAVAILABLE     0x0001000B
796 /*! @brief The requested feature is not provided by the platform.
797  *
798  *  The requested feature is not provided by the platform, so GLFW is unable to
799  *  implement it.  The documentation for each function notes if it could emit
800  *  this error.
801  *
802  *  @analysis Platform or platform version limitation.  The error can be ignored
803  *  unless the feature is critical to the application.
804  *
805  *  @par
806  *  A function call that emits this error has no effect other than the error and
807  *  updating any existing out parameters.
808  */
809 #define GLFW_FEATURE_UNAVAILABLE    0x0001000C
810 /*! @brief The requested feature is not implemented for the platform.
811  *
812  *  The requested feature has not yet been implemented in GLFW for this platform.
813  *
814  *  @analysis An incomplete implementation of GLFW for this platform, hopefully
815  *  fixed in a future release.  The error can be ignored unless the feature is
816  *  critical to the application.
817  *
818  *  @par
819  *  A function call that emits this error has no effect other than the error and
820  *  updating any existing out parameters.
821  */
822 #define GLFW_FEATURE_UNIMPLEMENTED  0x0001000D
823 /*! @} */
824
825 /*! @addtogroup window
826  *  @{ */
827 /*! @brief Input focus window hint and attribute
828  *
829  *  Input focus [window hint](@ref GLFW_FOCUSED_hint) or
830  *  [window attribute](@ref GLFW_FOCUSED_attrib).
831  */
832 #define GLFW_FOCUSED                0x00020001
833 /*! @brief Window iconification window attribute
834  *
835  *  Window iconification [window attribute](@ref GLFW_ICONIFIED_attrib).
836  */
837 #define GLFW_ICONIFIED              0x00020002
838 /*! @brief Window resize-ability window hint and attribute
839  *
840  *  Window resize-ability [window hint](@ref GLFW_RESIZABLE_hint) and
841  *  [window attribute](@ref GLFW_RESIZABLE_attrib).
842  */
843 #define GLFW_RESIZABLE              0x00020003
844 /*! @brief Window visibility window hint and attribute
845  *
846  *  Window visibility [window hint](@ref GLFW_VISIBLE_hint) and
847  *  [window attribute](@ref GLFW_VISIBLE_attrib).
848  */
849 #define GLFW_VISIBLE                0x00020004
850 /*! @brief Window decoration window hint and attribute
851  *
852  *  Window decoration [window hint](@ref GLFW_DECORATED_hint) and
853  *  [window attribute](@ref GLFW_DECORATED_attrib).
854  */
855 #define GLFW_DECORATED              0x00020005
856 /*! @brief Window auto-iconification window hint and attribute
857  *
858  *  Window auto-iconification [window hint](@ref GLFW_AUTO_ICONIFY_hint) and
859  *  [window attribute](@ref GLFW_AUTO_ICONIFY_attrib).
860  */
861 #define GLFW_AUTO_ICONIFY           0x00020006
862 /*! @brief Window decoration window hint and attribute
863  *
864  *  Window decoration [window hint](@ref GLFW_FLOATING_hint) and
865  *  [window attribute](@ref GLFW_FLOATING_attrib).
866  */
867 #define GLFW_FLOATING               0x00020007
868 /*! @brief Window maximization window hint and attribute
869  *
870  *  Window maximization [window hint](@ref GLFW_MAXIMIZED_hint) and
871  *  [window attribute](@ref GLFW_MAXIMIZED_attrib).
872  */
873 #define GLFW_MAXIMIZED              0x00020008
874 /*! @brief Cursor centering window hint
875  *
876  *  Cursor centering [window hint](@ref GLFW_CENTER_CURSOR_hint).
877  */
878 #define GLFW_CENTER_CURSOR          0x00020009
879 /*! @brief Window framebuffer transparency hint and attribute
880  *
881  *  Window framebuffer transparency
882  *  [window hint](@ref GLFW_TRANSPARENT_FRAMEBUFFER_hint) and
883  *  [window attribute](@ref GLFW_TRANSPARENT_FRAMEBUFFER_attrib).
884  */
885 #define GLFW_TRANSPARENT_FRAMEBUFFER 0x0002000A
886 /*! @brief Mouse cursor hover window attribute.
887  *
888  *  Mouse cursor hover [window attribute](@ref GLFW_HOVERED_attrib).
889  */
890 #define GLFW_HOVERED                0x0002000B
891 /*! @brief Input focus on calling show window hint and attribute
892  *
893  *  Input focus [window hint](@ref GLFW_FOCUS_ON_SHOW_hint) or
894  *  [window attribute](@ref GLFW_FOCUS_ON_SHOW_attrib).
895  */
896 #define GLFW_FOCUS_ON_SHOW          0x0002000C
897
898 /*! @brief Mouse input transparency window hint and attribute
899  *
900  *  Mouse input transparency [window hint](@ref GLFW_MOUSE_PASSTHROUGH_hint) or
901  *  [window attribute](@ref GLFW_MOUSE_PASSTHROUGH_attrib).
902  */
903 #define GLFW_MOUSE_PASSTHROUGH      0x0002000D
904
905 /*! @brief Framebuffer bit depth hint.
906  *
907  *  Framebuffer bit depth [hint](@ref GLFW_RED_BITS).
908  */
909 #define GLFW_RED_BITS               0x00021001
910 /*! @brief Framebuffer bit depth hint.
911  *
912  *  Framebuffer bit depth [hint](@ref GLFW_GREEN_BITS).
913  */
914 #define GLFW_GREEN_BITS             0x00021002
915 /*! @brief Framebuffer bit depth hint.
916  *
917  *  Framebuffer bit depth [hint](@ref GLFW_BLUE_BITS).
918  */
919 #define GLFW_BLUE_BITS              0x00021003
920 /*! @brief Framebuffer bit depth hint.
921  *
922  *  Framebuffer bit depth [hint](@ref GLFW_ALPHA_BITS).
923  */
924 #define GLFW_ALPHA_BITS             0x00021004
925 /*! @brief Framebuffer bit depth hint.
926  *
927  *  Framebuffer bit depth [hint](@ref GLFW_DEPTH_BITS).
928  */
929 #define GLFW_DEPTH_BITS             0x00021005
930 /*! @brief Framebuffer bit depth hint.
931  *
932  *  Framebuffer bit depth [hint](@ref GLFW_STENCIL_BITS).
933  */
934 #define GLFW_STENCIL_BITS           0x00021006
935 /*! @brief Framebuffer bit depth hint.
936  *
937  *  Framebuffer bit depth [hint](@ref GLFW_ACCUM_RED_BITS).
938  */
939 #define GLFW_ACCUM_RED_BITS         0x00021007
940 /*! @brief Framebuffer bit depth hint.
941  *
942  *  Framebuffer bit depth [hint](@ref GLFW_ACCUM_GREEN_BITS).
943  */
944 #define GLFW_ACCUM_GREEN_BITS       0x00021008
945 /*! @brief Framebuffer bit depth hint.
946  *
947  *  Framebuffer bit depth [hint](@ref GLFW_ACCUM_BLUE_BITS).
948  */
949 #define GLFW_ACCUM_BLUE_BITS        0x00021009
950 /*! @brief Framebuffer bit depth hint.
951  *
952  *  Framebuffer bit depth [hint](@ref GLFW_ACCUM_ALPHA_BITS).
953  */
954 #define GLFW_ACCUM_ALPHA_BITS       0x0002100A
955 /*! @brief Framebuffer auxiliary buffer hint.
956  *
957  *  Framebuffer auxiliary buffer [hint](@ref GLFW_AUX_BUFFERS).
958  */
959 #define GLFW_AUX_BUFFERS            0x0002100B
960 /*! @brief OpenGL stereoscopic rendering hint.
961  *
962  *  OpenGL stereoscopic rendering [hint](@ref GLFW_STEREO).
963  */
964 #define GLFW_STEREO                 0x0002100C
965 /*! @brief Framebuffer MSAA samples hint.
966  *
967  *  Framebuffer MSAA samples [hint](@ref GLFW_SAMPLES).
968  */
969 #define GLFW_SAMPLES                0x0002100D
970 /*! @brief Framebuffer sRGB hint.
971  *
972  *  Framebuffer sRGB [hint](@ref GLFW_SRGB_CAPABLE).
973  */
974 #define GLFW_SRGB_CAPABLE           0x0002100E
975 /*! @brief Monitor refresh rate hint.
976  *
977  *  Monitor refresh rate [hint](@ref GLFW_REFRESH_RATE).
978  */
979 #define GLFW_REFRESH_RATE           0x0002100F
980 /*! @brief Framebuffer double buffering hint.
981  *
982  *  Framebuffer double buffering [hint](@ref GLFW_DOUBLEBUFFER).
983  */
984 #define GLFW_DOUBLEBUFFER           0x00021010
985
986 /*! @brief Context client API hint and attribute.
987  *
988  *  Context client API [hint](@ref GLFW_CLIENT_API_hint) and
989  *  [attribute](@ref GLFW_CLIENT_API_attrib).
990  */
991 #define GLFW_CLIENT_API             0x00022001
992 /*! @brief Context client API major version hint and attribute.
993  *
994  *  Context client API major version [hint](@ref GLFW_CONTEXT_VERSION_MAJOR_hint)
995  *  and [attribute](@ref GLFW_CONTEXT_VERSION_MAJOR_attrib).
996  */
997 #define GLFW_CONTEXT_VERSION_MAJOR  0x00022002
998 /*! @brief Context client API minor version hint and attribute.
999  *
1000  *  Context client API minor version [hint](@ref GLFW_CONTEXT_VERSION_MINOR_hint)
1001  *  and [attribute](@ref GLFW_CONTEXT_VERSION_MINOR_attrib).
1002  */
1003 #define GLFW_CONTEXT_VERSION_MINOR  0x00022003
1004 /*! @brief Context client API revision number hint and attribute.
1005  *
1006  *  Context client API revision number
1007  *  [attribute](@ref GLFW_CONTEXT_REVISION_attrib).
1008  */
1009 #define GLFW_CONTEXT_REVISION       0x00022004
1010 /*! @brief Context robustness hint and attribute.
1011  *
1012  *  Context client API revision number [hint](@ref GLFW_CONTEXT_ROBUSTNESS_hint)
1013  *  and [attribute](@ref GLFW_CONTEXT_ROBUSTNESS_attrib).
1014  */
1015 #define GLFW_CONTEXT_ROBUSTNESS     0x00022005
1016 /*! @brief OpenGL forward-compatibility hint and attribute.
1017  *
1018  *  OpenGL forward-compatibility [hint](@ref GLFW_OPENGL_FORWARD_COMPAT_hint)
1019  *  and [attribute](@ref GLFW_OPENGL_FORWARD_COMPAT_attrib).
1020  */
1021 #define GLFW_OPENGL_FORWARD_COMPAT  0x00022006
1022 /*! @brief Debug mode context hint and attribute.
1023  *
1024  *  Debug mode context [hint](@ref GLFW_CONTEXT_DEBUG_hint) and
1025  *  [attribute](@ref GLFW_CONTEXT_DEBUG_attrib).
1026  */
1027 #define GLFW_CONTEXT_DEBUG          0x00022007
1028 /*! @brief Legacy name for compatibility.
1029  *
1030  *  This is an alias for compatibility with earlier versions.
1031  */
1032 #define GLFW_OPENGL_DEBUG_CONTEXT   GLFW_CONTEXT_DEBUG
1033 /*! @brief OpenGL profile hint and attribute.
1034  *
1035  *  OpenGL profile [hint](@ref GLFW_OPENGL_PROFILE_hint) and
1036  *  [attribute](@ref GLFW_OPENGL_PROFILE_attrib).
1037  */
1038 #define GLFW_OPENGL_PROFILE         0x00022008
1039 /*! @brief Context flush-on-release hint and attribute.
1040  *
1041  *  Context flush-on-release [hint](@ref GLFW_CONTEXT_RELEASE_BEHAVIOR_hint) and
1042  *  [attribute](@ref GLFW_CONTEXT_RELEASE_BEHAVIOR_attrib).
1043  */
1044 #define GLFW_CONTEXT_RELEASE_BEHAVIOR 0x00022009
1045 /*! @brief Context error suppression hint and attribute.
1046  *
1047  *  Context error suppression [hint](@ref GLFW_CONTEXT_NO_ERROR_hint) and
1048  *  [attribute](@ref GLFW_CONTEXT_NO_ERROR_attrib).
1049  */
1050 #define GLFW_CONTEXT_NO_ERROR       0x0002200A
1051 /*! @brief Context creation API hint and attribute.
1052  *
1053  *  Context creation API [hint](@ref GLFW_CONTEXT_CREATION_API_hint) and
1054  *  [attribute](@ref GLFW_CONTEXT_CREATION_API_attrib).
1055  */
1056 #define GLFW_CONTEXT_CREATION_API   0x0002200B
1057 /*! @brief Window content area scaling window
1058  *  [window hint](@ref GLFW_SCALE_TO_MONITOR).
1059  */
1060 #define GLFW_SCALE_TO_MONITOR       0x0002200C
1061 /*! @brief macOS specific
1062  *  [window hint](@ref GLFW_COCOA_RETINA_FRAMEBUFFER_hint).
1063  */
1064 #define GLFW_COCOA_RETINA_FRAMEBUFFER 0x00023001
1065 /*! @brief macOS specific
1066  *  [window hint](@ref GLFW_COCOA_FRAME_NAME_hint).
1067  */
1068 #define GLFW_COCOA_FRAME_NAME         0x00023002
1069 /*! @brief macOS specific
1070  *  [window hint](@ref GLFW_COCOA_GRAPHICS_SWITCHING_hint).
1071  */
1072 #define GLFW_COCOA_GRAPHICS_SWITCHING 0x00023003
1073 /*! @brief X11 specific
1074  *  [window hint](@ref GLFW_X11_CLASS_NAME_hint).
1075  */
1076 #define GLFW_X11_CLASS_NAME         0x00024001
1077 /*! @brief X11 specific
1078  *  [window hint](@ref GLFW_X11_CLASS_NAME_hint).
1079  */
1080 #define GLFW_X11_INSTANCE_NAME      0x00024002
1081 #define GLFW_WIN32_KEYBOARD_MENU    0x00025001
1082 /*! @} */
1083
1084 #define GLFW_NO_API                          0
1085 #define GLFW_OPENGL_API             0x00030001
1086 #define GLFW_OPENGL_ES_API          0x00030002
1087
1088 #define GLFW_NO_ROBUSTNESS                   0
1089 #define GLFW_NO_RESET_NOTIFICATION  0x00031001
1090 #define GLFW_LOSE_CONTEXT_ON_RESET  0x00031002
1091
1092 #define GLFW_OPENGL_ANY_PROFILE              0
1093 #define GLFW_OPENGL_CORE_PROFILE    0x00032001
1094 #define GLFW_OPENGL_COMPAT_PROFILE  0x00032002
1095
1096 #define GLFW_CURSOR                 0x00033001
1097 #define GLFW_STICKY_KEYS            0x00033002
1098 #define GLFW_STICKY_MOUSE_BUTTONS   0x00033003
1099 #define GLFW_LOCK_KEY_MODS          0x00033004
1100 #define GLFW_RAW_MOUSE_MOTION       0x00033005
1101
1102 #define GLFW_CURSOR_NORMAL          0x00034001
1103 #define GLFW_CURSOR_HIDDEN          0x00034002
1104 #define GLFW_CURSOR_DISABLED        0x00034003
1105
1106 #define GLFW_ANY_RELEASE_BEHAVIOR            0
1107 #define GLFW_RELEASE_BEHAVIOR_FLUSH 0x00035001
1108 #define GLFW_RELEASE_BEHAVIOR_NONE  0x00035002
1109
1110 #define GLFW_NATIVE_CONTEXT_API     0x00036001
1111 #define GLFW_EGL_CONTEXT_API        0x00036002
1112 #define GLFW_OSMESA_CONTEXT_API     0x00036003
1113
1114 #define GLFW_ANGLE_PLATFORM_TYPE_NONE    0x00037001
1115 #define GLFW_ANGLE_PLATFORM_TYPE_OPENGL  0x00037002
1116 #define GLFW_ANGLE_PLATFORM_TYPE_OPENGLES 0x00037003
1117 #define GLFW_ANGLE_PLATFORM_TYPE_D3D9    0x00037004
1118 #define GLFW_ANGLE_PLATFORM_TYPE_D3D11   0x00037005
1119 #define GLFW_ANGLE_PLATFORM_TYPE_VULKAN  0x00037007
1120 #define GLFW_ANGLE_PLATFORM_TYPE_METAL   0x00037008
1121
1122 /*! @defgroup shapes Standard cursor shapes
1123  *  @brief Standard system cursor shapes.
1124  *
1125  *  These are the [standard cursor shapes](@ref cursor_standard) that can be
1126  *  requested from the window system.
1127  *
1128  *  @ingroup input
1129  *  @{ */
1130
1131 /*! @brief The regular arrow cursor shape.
1132  *
1133  *  The regular arrow cursor shape.
1134  */
1135 #define GLFW_ARROW_CURSOR           0x00036001
1136 /*! @brief The text input I-beam cursor shape.
1137  *
1138  *  The text input I-beam cursor shape.
1139  */
1140 #define GLFW_IBEAM_CURSOR           0x00036002
1141 /*! @brief The crosshair cursor shape.
1142  *
1143  *  The crosshair cursor shape.
1144  */
1145 #define GLFW_CROSSHAIR_CURSOR       0x00036003
1146 /*! @brief The pointing hand cursor shape.
1147  *
1148  *  The pointing hand cursor shape.
1149  */
1150 #define GLFW_POINTING_HAND_CURSOR   0x00036004
1151 /*! @brief The horizontal resize/move arrow shape.
1152  *
1153  *  The horizontal resize/move arrow shape.  This is usually a horizontal
1154  *  double-headed arrow.
1155  */
1156 #define GLFW_RESIZE_EW_CURSOR       0x00036005
1157 /*! @brief The vertical resize/move arrow shape.
1158  *
1159  *  The vertical resize/move shape.  This is usually a vertical double-headed
1160  *  arrow.
1161  */
1162 #define GLFW_RESIZE_NS_CURSOR       0x00036006
1163 /*! @brief The top-left to bottom-right diagonal resize/move arrow shape.
1164  *
1165  *  The top-left to bottom-right diagonal resize/move shape.  This is usually
1166  *  a diagonal double-headed arrow.
1167  *
1168  *  @note @macos This shape is provided by a private system API and may fail
1169  *  with @ref GLFW_CURSOR_UNAVAILABLE in the future.
1170  *
1171  *  @note @x11 This shape is provided by a newer standard not supported by all
1172  *  cursor themes.
1173  *
1174  *  @note @wayland This shape is provided by a newer standard not supported by
1175  *  all cursor themes.
1176  */
1177 #define GLFW_RESIZE_NWSE_CURSOR     0x00036007
1178 /*! @brief The top-right to bottom-left diagonal resize/move arrow shape.
1179  *
1180  *  The top-right to bottom-left diagonal resize/move shape.  This is usually
1181  *  a diagonal double-headed arrow.
1182  *
1183  *  @note @macos This shape is provided by a private system API and may fail
1184  *  with @ref GLFW_CURSOR_UNAVAILABLE in the future.
1185  *
1186  *  @note @x11 This shape is provided by a newer standard not supported by all
1187  *  cursor themes.
1188  *
1189  *  @note @wayland This shape is provided by a newer standard not supported by
1190  *  all cursor themes.
1191  */
1192 #define GLFW_RESIZE_NESW_CURSOR     0x00036008
1193 /*! @brief The omni-directional resize/move cursor shape.
1194  *
1195  *  The omni-directional resize cursor/move shape.  This is usually either
1196  *  a combined horizontal and vertical double-headed arrow or a grabbing hand.
1197  */
1198 #define GLFW_RESIZE_ALL_CURSOR      0x00036009
1199 /*! @brief The operation-not-allowed shape.
1200  *
1201  *  The operation-not-allowed shape.  This is usually a circle with a diagonal
1202  *  line through it.
1203  *
1204  *  @note @x11 This shape is provided by a newer standard not supported by all
1205  *  cursor themes.
1206  *
1207  *  @note @wayland This shape is provided by a newer standard not supported by
1208  *  all cursor themes.
1209  */
1210 #define GLFW_NOT_ALLOWED_CURSOR     0x0003600A
1211 /*! @brief Legacy name for compatibility.
1212  *
1213  *  This is an alias for compatibility with earlier versions.
1214  */
1215 #define GLFW_HRESIZE_CURSOR         GLFW_RESIZE_EW_CURSOR
1216 /*! @brief Legacy name for compatibility.
1217  *
1218  *  This is an alias for compatibility with earlier versions.
1219  */
1220 #define GLFW_VRESIZE_CURSOR         GLFW_RESIZE_NS_CURSOR
1221 /*! @brief Legacy name for compatibility.
1222  *
1223  *  This is an alias for compatibility with earlier versions.
1224  */
1225 #define GLFW_HAND_CURSOR            GLFW_POINTING_HAND_CURSOR
1226 /*! @} */
1227
1228 #define GLFW_CONNECTED              0x00040001
1229 #define GLFW_DISCONNECTED           0x00040002
1230
1231 /*! @addtogroup init
1232  *  @{ */
1233 /*! @brief Joystick hat buttons init hint.
1234  *
1235  *  Joystick hat buttons [init hint](@ref GLFW_JOYSTICK_HAT_BUTTONS).
1236  */
1237 #define GLFW_JOYSTICK_HAT_BUTTONS   0x00050001
1238 /*! @brief ANGLE rendering backend init hint.
1239  *
1240  *  ANGLE rendering backend [init hint](@ref GLFW_ANGLE_PLATFORM_TYPE_hint).
1241  */
1242 #define GLFW_ANGLE_PLATFORM_TYPE    0x00050002
1243 /*! @brief macOS specific init hint.
1244  *
1245  *  macOS specific [init hint](@ref GLFW_COCOA_CHDIR_RESOURCES_hint).
1246  */
1247 #define GLFW_COCOA_CHDIR_RESOURCES  0x00051001
1248 /*! @brief macOS specific init hint.
1249  *
1250  *  macOS specific [init hint](@ref GLFW_COCOA_MENUBAR_hint).
1251  */
1252 #define GLFW_COCOA_MENUBAR          0x00051002
1253 /*! @} */
1254
1255 #define GLFW_DONT_CARE              -1
1256
1257
1258 /*************************************************************************
1259  * GLFW API types
1260  *************************************************************************/
1261
1262 /*! @brief Client API function pointer type.
1263  *
1264  *  Generic function pointer used for returning client API function pointers
1265  *  without forcing a cast from a regular pointer.
1266  *
1267  *  @sa @ref context_glext
1268  *  @sa @ref glfwGetProcAddress
1269  *
1270  *  @since Added in version 3.0.
1271  *
1272  *  @ingroup context
1273  */
1274 typedef void (*GLFWglproc)(void);
1275
1276 /*! @brief Vulkan API function pointer type.
1277  *
1278  *  Generic function pointer used for returning Vulkan API function pointers
1279  *  without forcing a cast from a regular pointer.
1280  *
1281  *  @sa @ref vulkan_proc
1282  *  @sa @ref glfwGetInstanceProcAddress
1283  *
1284  *  @since Added in version 3.2.
1285  *
1286  *  @ingroup vulkan
1287  */
1288 typedef void (*GLFWvkproc)(void);
1289
1290 /*! @brief Opaque monitor object.
1291  *
1292  *  Opaque monitor object.
1293  *
1294  *  @see @ref monitor_object
1295  *
1296  *  @since Added in version 3.0.
1297  *
1298  *  @ingroup monitor
1299  */
1300 typedef struct GLFWmonitor GLFWmonitor;
1301
1302 /*! @brief Opaque window object.
1303  *
1304  *  Opaque window object.
1305  *
1306  *  @see @ref window_object
1307  *
1308  *  @since Added in version 3.0.
1309  *
1310  *  @ingroup window
1311  */
1312 typedef struct GLFWwindow GLFWwindow;
1313
1314 /*! @brief Opaque cursor object.
1315  *
1316  *  Opaque cursor object.
1317  *
1318  *  @see @ref cursor_object
1319  *
1320  *  @since Added in version 3.1.
1321  *
1322  *  @ingroup input
1323  */
1324 typedef struct GLFWcursor GLFWcursor;
1325
1326 /*! @brief The function pointer type for error callbacks.
1327  *
1328  *  This is the function pointer type for error callbacks.  An error callback
1329  *  function has the following signature:
1330  *  @code
1331  *  void callback_name(int error_code, const char* description)
1332  *  @endcode
1333  *
1334  *  @param[in] error_code An [error code](@ref errors).  Future releases may add
1335  *  more error codes.
1336  *  @param[in] description A UTF-8 encoded string describing the error.
1337  *
1338  *  @pointer_lifetime The error description string is valid until the callback
1339  *  function returns.
1340  *
1341  *  @sa @ref error_handling
1342  *  @sa @ref glfwSetErrorCallback
1343  *
1344  *  @since Added in version 3.0.
1345  *
1346  *  @ingroup init
1347  */
1348 typedef void (* GLFWerrorfun)(int,const char*);
1349
1350 /*! @brief The function pointer type for window position callbacks.
1351  *
1352  *  This is the function pointer type for window position callbacks.  A window
1353  *  position callback function has the following signature:
1354  *  @code
1355  *  void callback_name(GLFWwindow* window, int xpos, int ypos)
1356  *  @endcode
1357  *
1358  *  @param[in] window The window that was moved.
1359  *  @param[in] xpos The new x-coordinate, in screen coordinates, of the
1360  *  upper-left corner of the content area of the window.
1361  *  @param[in] ypos The new y-coordinate, in screen coordinates, of the
1362  *  upper-left corner of the content area of the window.
1363  *
1364  *  @sa @ref window_pos
1365  *  @sa @ref glfwSetWindowPosCallback
1366  *
1367  *  @since Added in version 3.0.
1368  *
1369  *  @ingroup window
1370  */
1371 typedef void (* GLFWwindowposfun)(GLFWwindow*,int,int);
1372
1373 /*! @brief The function pointer type for window size callbacks.
1374  *
1375  *  This is the function pointer type for window size callbacks.  A window size
1376  *  callback function has the following signature:
1377  *  @code
1378  *  void callback_name(GLFWwindow* window, int width, int height)
1379  *  @endcode
1380  *
1381  *  @param[in] window The window that was resized.
1382  *  @param[in] width The new width, in screen coordinates, of the window.
1383  *  @param[in] height The new height, in screen coordinates, of the window.
1384  *
1385  *  @sa @ref window_size
1386  *  @sa @ref glfwSetWindowSizeCallback
1387  *
1388  *  @since Added in version 1.0.
1389  *  @glfw3 Added window handle parameter.
1390  *
1391  *  @ingroup window
1392  */
1393 typedef void (* GLFWwindowsizefun)(GLFWwindow*,int,int);
1394
1395 /*! @brief The function pointer type for window close callbacks.
1396  *
1397  *  This is the function pointer type for window close callbacks.  A window
1398  *  close callback function has the following signature:
1399  *  @code
1400  *  void function_name(GLFWwindow* window)
1401  *  @endcode
1402  *
1403  *  @param[in] window The window that the user attempted to close.
1404  *
1405  *  @sa @ref window_close
1406  *  @sa @ref glfwSetWindowCloseCallback
1407  *
1408  *  @since Added in version 2.5.
1409  *  @glfw3 Added window handle parameter.
1410  *
1411  *  @ingroup window
1412  */
1413 typedef void (* GLFWwindowclosefun)(GLFWwindow*);
1414
1415 /*! @brief The function pointer type for window content refresh callbacks.
1416  *
1417  *  This is the function pointer type for window content refresh callbacks.
1418  *  A window content refresh callback function has the following signature:
1419  *  @code
1420  *  void function_name(GLFWwindow* window);
1421  *  @endcode
1422  *
1423  *  @param[in] window The window whose content needs to be refreshed.
1424  *
1425  *  @sa @ref window_refresh
1426  *  @sa @ref glfwSetWindowRefreshCallback
1427  *
1428  *  @since Added in version 2.5.
1429  *  @glfw3 Added window handle parameter.
1430  *
1431  *  @ingroup window
1432  */
1433 typedef void (* GLFWwindowrefreshfun)(GLFWwindow*);
1434
1435 /*! @brief The function pointer type for window focus callbacks.
1436  *
1437  *  This is the function pointer type for window focus callbacks.  A window
1438  *  focus callback function has the following signature:
1439  *  @code
1440  *  void function_name(GLFWwindow* window, int focused)
1441  *  @endcode
1442  *
1443  *  @param[in] window The window that gained or lost input focus.
1444  *  @param[in] focused `GLFW_TRUE` if the window was given input focus, or
1445  *  `GLFW_FALSE` if it lost it.
1446  *
1447  *  @sa @ref window_focus
1448  *  @sa @ref glfwSetWindowFocusCallback
1449  *
1450  *  @since Added in version 3.0.
1451  *
1452  *  @ingroup window
1453  */
1454 typedef void (* GLFWwindowfocusfun)(GLFWwindow*,int);
1455
1456 /*! @brief The function pointer type for window iconify callbacks.
1457  *
1458  *  This is the function pointer type for window iconify callbacks.  A window
1459  *  iconify callback function has the following signature:
1460  *  @code
1461  *  void function_name(GLFWwindow* window, int iconified)
1462  *  @endcode
1463  *
1464  *  @param[in] window The window that was iconified or restored.
1465  *  @param[in] iconified `GLFW_TRUE` if the window was iconified, or
1466  *  `GLFW_FALSE` if it was restored.
1467  *
1468  *  @sa @ref window_iconify
1469  *  @sa @ref glfwSetWindowIconifyCallback
1470  *
1471  *  @since Added in version 3.0.
1472  *
1473  *  @ingroup window
1474  */
1475 typedef void (* GLFWwindowiconifyfun)(GLFWwindow*,int);
1476
1477 /*! @brief The function pointer type for window maximize callbacks.
1478  *
1479  *  This is the function pointer type for window maximize callbacks.  A window
1480  *  maximize callback function has the following signature:
1481  *  @code
1482  *  void function_name(GLFWwindow* window, int maximized)
1483  *  @endcode
1484  *
1485  *  @param[in] window The window that was maximized or restored.
1486  *  @param[in] maximized `GLFW_TRUE` if the window was maximized, or
1487  *  `GLFW_FALSE` if it was restored.
1488  *
1489  *  @sa @ref window_maximize
1490  *  @sa glfwSetWindowMaximizeCallback
1491  *
1492  *  @since Added in version 3.3.
1493  *
1494  *  @ingroup window
1495  */
1496 typedef void (* GLFWwindowmaximizefun)(GLFWwindow*,int);
1497
1498 /*! @brief The function pointer type for framebuffer size callbacks.
1499  *
1500  *  This is the function pointer type for framebuffer size callbacks.
1501  *  A framebuffer size callback function has the following signature:
1502  *  @code
1503  *  void function_name(GLFWwindow* window, int width, int height)
1504  *  @endcode
1505  *
1506  *  @param[in] window The window whose framebuffer was resized.
1507  *  @param[in] width The new width, in pixels, of the framebuffer.
1508  *  @param[in] height The new height, in pixels, of the framebuffer.
1509  *
1510  *  @sa @ref window_fbsize
1511  *  @sa @ref glfwSetFramebufferSizeCallback
1512  *
1513  *  @since Added in version 3.0.
1514  *
1515  *  @ingroup window
1516  */
1517 typedef void (* GLFWframebuffersizefun)(GLFWwindow*,int,int);
1518
1519 /*! @brief The function pointer type for window content scale callbacks.
1520  *
1521  *  This is the function pointer type for window content scale callbacks.
1522  *  A window content scale callback function has the following signature:
1523  *  @code
1524  *  void function_name(GLFWwindow* window, float xscale, float yscale)
1525  *  @endcode
1526  *
1527  *  @param[in] window The window whose content scale changed.
1528  *  @param[in] xscale The new x-axis content scale of the window.
1529  *  @param[in] yscale The new y-axis content scale of the window.
1530  *
1531  *  @sa @ref window_scale
1532  *  @sa @ref glfwSetWindowContentScaleCallback
1533  *
1534  *  @since Added in version 3.3.
1535  *
1536  *  @ingroup window
1537  */
1538 typedef void (* GLFWwindowcontentscalefun)(GLFWwindow*,float,float);
1539
1540 /*! @brief The function pointer type for mouse button callbacks.
1541  *
1542  *  This is the function pointer type for mouse button callback functions.
1543  *  A mouse button callback function has the following signature:
1544  *  @code
1545  *  void function_name(GLFWwindow* window, int button, int action, int mods)
1546  *  @endcode
1547  *
1548  *  @param[in] window The window that received the event.
1549  *  @param[in] button The [mouse button](@ref buttons) that was pressed or
1550  *  released.
1551  *  @param[in] action One of `GLFW_PRESS` or `GLFW_RELEASE`.  Future releases
1552  *  may add more actions.
1553  *  @param[in] mods Bit field describing which [modifier keys](@ref mods) were
1554  *  held down.
1555  *
1556  *  @sa @ref input_mouse_button
1557  *  @sa @ref glfwSetMouseButtonCallback
1558  *
1559  *  @since Added in version 1.0.
1560  *  @glfw3 Added window handle and modifier mask parameters.
1561  *
1562  *  @ingroup input
1563  */
1564 typedef void (* GLFWmousebuttonfun)(GLFWwindow*,int,int,int);
1565
1566 /*! @brief The function pointer type for cursor position callbacks.
1567  *
1568  *  This is the function pointer type for cursor position callbacks.  A cursor
1569  *  position callback function has the following signature:
1570  *  @code
1571  *  void function_name(GLFWwindow* window, double xpos, double ypos);
1572  *  @endcode
1573  *
1574  *  @param[in] window The window that received the event.
1575  *  @param[in] xpos The new cursor x-coordinate, relative to the left edge of
1576  *  the content area.
1577  *  @param[in] ypos The new cursor y-coordinate, relative to the top edge of the
1578  *  content area.
1579  *
1580  *  @sa @ref cursor_pos
1581  *  @sa @ref glfwSetCursorPosCallback
1582  *
1583  *  @since Added in version 3.0.  Replaces `GLFWmouseposfun`.
1584  *
1585  *  @ingroup input
1586  */
1587 typedef void (* GLFWcursorposfun)(GLFWwindow*,double,double);
1588
1589 /*! @brief The function pointer type for cursor enter/leave callbacks.
1590  *
1591  *  This is the function pointer type for cursor enter/leave callbacks.
1592  *  A cursor enter/leave callback function has the following signature:
1593  *  @code
1594  *  void function_name(GLFWwindow* window, int entered)
1595  *  @endcode
1596  *
1597  *  @param[in] window The window that received the event.
1598  *  @param[in] entered `GLFW_TRUE` if the cursor entered the window's content
1599  *  area, or `GLFW_FALSE` if it left it.
1600  *
1601  *  @sa @ref cursor_enter
1602  *  @sa @ref glfwSetCursorEnterCallback
1603  *
1604  *  @since Added in version 3.0.
1605  *
1606  *  @ingroup input
1607  */
1608 typedef void (* GLFWcursorenterfun)(GLFWwindow*,int);
1609
1610 /*! @brief The function pointer type for scroll callbacks.
1611  *
1612  *  This is the function pointer type for scroll callbacks.  A scroll callback
1613  *  function has the following signature:
1614  *  @code
1615  *  void function_name(GLFWwindow* window, double xoffset, double yoffset)
1616  *  @endcode
1617  *
1618  *  @param[in] window The window that received the event.
1619  *  @param[in] xoffset The scroll offset along the x-axis.
1620  *  @param[in] yoffset The scroll offset along the y-axis.
1621  *
1622  *  @sa @ref scrolling
1623  *  @sa @ref glfwSetScrollCallback
1624  *
1625  *  @since Added in version 3.0.  Replaces `GLFWmousewheelfun`.
1626  *
1627  *  @ingroup input
1628  */
1629 typedef void (* GLFWscrollfun)(GLFWwindow*,double,double);
1630
1631 /*! @brief The function pointer type for keyboard key callbacks.
1632  *
1633  *  This is the function pointer type for keyboard key callbacks.  A keyboard
1634  *  key callback function has the following signature:
1635  *  @code
1636  *  void function_name(GLFWwindow* window, int key, int scancode, int action, int mods)
1637  *  @endcode
1638  *
1639  *  @param[in] window The window that received the event.
1640  *  @param[in] key The [keyboard key](@ref keys) that was pressed or released.
1641  *  @param[in] scancode The system-specific scancode of the key.
1642  *  @param[in] action `GLFW_PRESS`, `GLFW_RELEASE` or `GLFW_REPEAT`.  Future
1643  *  releases may add more actions.
1644  *  @param[in] mods Bit field describing which [modifier keys](@ref mods) were
1645  *  held down.
1646  *
1647  *  @sa @ref input_key
1648  *  @sa @ref glfwSetKeyCallback
1649  *
1650  *  @since Added in version 1.0.
1651  *  @glfw3 Added window handle, scancode and modifier mask parameters.
1652  *
1653  *  @ingroup input
1654  */
1655 typedef void (* GLFWkeyfun)(GLFWwindow*,int,int,int,int);
1656
1657 /*! @brief The function pointer type for Unicode character callbacks.
1658  *
1659  *  This is the function pointer type for Unicode character callbacks.
1660  *  A Unicode character callback function has the following signature:
1661  *  @code
1662  *  void function_name(GLFWwindow* window, unsigned int codepoint)
1663  *  @endcode
1664  *
1665  *  @param[in] window The window that received the event.
1666  *  @param[in] codepoint The Unicode code point of the character.
1667  *
1668  *  @sa @ref input_char
1669  *  @sa @ref glfwSetCharCallback
1670  *
1671  *  @since Added in version 2.4.
1672  *  @glfw3 Added window handle parameter.
1673  *
1674  *  @ingroup input
1675  */
1676 typedef void (* GLFWcharfun)(GLFWwindow*,unsigned int);
1677
1678 /*! @brief The function pointer type for Unicode character with modifiers
1679  *  callbacks.
1680  *
1681  *  This is the function pointer type for Unicode character with modifiers
1682  *  callbacks.  It is called for each input character, regardless of what
1683  *  modifier keys are held down.  A Unicode character with modifiers callback
1684  *  function has the following signature:
1685  *  @code
1686  *  void function_name(GLFWwindow* window, unsigned int codepoint, int mods)
1687  *  @endcode
1688  *
1689  *  @param[in] window The window that received the event.
1690  *  @param[in] codepoint The Unicode code point of the character.
1691  *  @param[in] mods Bit field describing which [modifier keys](@ref mods) were
1692  *  held down.
1693  *
1694  *  @sa @ref input_char
1695  *  @sa @ref glfwSetCharModsCallback
1696  *
1697  *  @deprecated Scheduled for removal in version 4.0.
1698  *
1699  *  @since Added in version 3.1.
1700  *
1701  *  @ingroup input
1702  */
1703 typedef void (* GLFWcharmodsfun)(GLFWwindow*,unsigned int,int);
1704
1705 /*! @brief The function pointer type for path drop callbacks.
1706  *
1707  *  This is the function pointer type for path drop callbacks.  A path drop
1708  *  callback function has the following signature:
1709  *  @code
1710  *  void function_name(GLFWwindow* window, int path_count, const char* paths[])
1711  *  @endcode
1712  *
1713  *  @param[in] window The window that received the event.
1714  *  @param[in] path_count The number of dropped paths.
1715  *  @param[in] paths The UTF-8 encoded file and/or directory path names.
1716  *
1717  *  @pointer_lifetime The path array and its strings are valid until the
1718  *  callback function returns.
1719  *
1720  *  @sa @ref path_drop
1721  *  @sa @ref glfwSetDropCallback
1722  *
1723  *  @since Added in version 3.1.
1724  *
1725  *  @ingroup input
1726  */
1727 typedef void (* GLFWdropfun)(GLFWwindow*,int,const char*[]);
1728
1729 /*! @brief The function pointer type for monitor configuration callbacks.
1730  *
1731  *  This is the function pointer type for monitor configuration callbacks.
1732  *  A monitor callback function has the following signature:
1733  *  @code
1734  *  void function_name(GLFWmonitor* monitor, int event)
1735  *  @endcode
1736  *
1737  *  @param[in] monitor The monitor that was connected or disconnected.
1738  *  @param[in] event One of `GLFW_CONNECTED` or `GLFW_DISCONNECTED`.  Future
1739  *  releases may add more events.
1740  *
1741  *  @sa @ref monitor_event
1742  *  @sa @ref glfwSetMonitorCallback
1743  *
1744  *  @since Added in version 3.0.
1745  *
1746  *  @ingroup monitor
1747  */
1748 typedef void (* GLFWmonitorfun)(GLFWmonitor*,int);
1749
1750 /*! @brief The function pointer type for joystick configuration callbacks.
1751  *
1752  *  This is the function pointer type for joystick configuration callbacks.
1753  *  A joystick configuration callback function has the following signature:
1754  *  @code
1755  *  void function_name(int jid, int event)
1756  *  @endcode
1757  *
1758  *  @param[in] jid The joystick that was connected or disconnected.
1759  *  @param[in] event One of `GLFW_CONNECTED` or `GLFW_DISCONNECTED`.  Future
1760  *  releases may add more events.
1761  *
1762  *  @sa @ref joystick_event
1763  *  @sa @ref glfwSetJoystickCallback
1764  *
1765  *  @since Added in version 3.2.
1766  *
1767  *  @ingroup input
1768  */
1769 typedef void (* GLFWjoystickfun)(int,int);
1770
1771 /*! @brief Video mode type.
1772  *
1773  *  This describes a single video mode.
1774  *
1775  *  @sa @ref monitor_modes
1776  *  @sa @ref glfwGetVideoMode
1777  *  @sa @ref glfwGetVideoModes
1778  *
1779  *  @since Added in version 1.0.
1780  *  @glfw3 Added refresh rate member.
1781  *
1782  *  @ingroup monitor
1783  */
1784 typedef struct GLFWvidmode
1785 {
1786     /*! The width, in screen coordinates, of the video mode.
1787      */
1788     int width;
1789     /*! The height, in screen coordinates, of the video mode.
1790      */
1791     int height;
1792     /*! The bit depth of the red channel of the video mode.
1793      */
1794     int redBits;
1795     /*! The bit depth of the green channel of the video mode.
1796      */
1797     int greenBits;
1798     /*! The bit depth of the blue channel of the video mode.
1799      */
1800     int blueBits;
1801     /*! The refresh rate, in Hz, of the video mode.
1802      */
1803     int refreshRate;
1804 } GLFWvidmode;
1805
1806 /*! @brief Gamma ramp.
1807  *
1808  *  This describes the gamma ramp for a monitor.
1809  *
1810  *  @sa @ref monitor_gamma
1811  *  @sa @ref glfwGetGammaRamp
1812  *  @sa @ref glfwSetGammaRamp
1813  *
1814  *  @since Added in version 3.0.
1815  *
1816  *  @ingroup monitor
1817  */
1818 typedef struct GLFWgammaramp
1819 {
1820     /*! An array of value describing the response of the red channel.
1821      */
1822     unsigned short* red;
1823     /*! An array of value describing the response of the green channel.
1824      */
1825     unsigned short* green;
1826     /*! An array of value describing the response of the blue channel.
1827      */
1828     unsigned short* blue;
1829     /*! The number of elements in each array.
1830      */
1831     unsigned int size;
1832 } GLFWgammaramp;
1833
1834 /*! @brief Image data.
1835  *
1836  *  This describes a single 2D image.  See the documentation for each related
1837  *  function what the expected pixel format is.
1838  *
1839  *  @sa @ref cursor_custom
1840  *  @sa @ref window_icon
1841  *
1842  *  @since Added in version 2.1.
1843  *  @glfw3 Removed format and bytes-per-pixel members.
1844  *
1845  *  @ingroup window
1846  */
1847 typedef struct GLFWimage
1848 {
1849     /*! The width, in pixels, of this image.
1850      */
1851     int width;
1852     /*! The height, in pixels, of this image.
1853      */
1854     int height;
1855     /*! The pixel data of this image, arranged left-to-right, top-to-bottom.
1856      */
1857     unsigned char* pixels;
1858 } GLFWimage;
1859
1860 /*! @brief Gamepad input state
1861  *
1862  *  This describes the input state of a gamepad.
1863  *
1864  *  @sa @ref gamepad
1865  *  @sa @ref glfwGetGamepadState
1866  *
1867  *  @since Added in version 3.3.
1868  *
1869  *  @ingroup input
1870  */
1871 typedef struct GLFWgamepadstate
1872 {
1873     /*! The states of each [gamepad button](@ref gamepad_buttons), `GLFW_PRESS`
1874      *  or `GLFW_RELEASE`.
1875      */
1876     unsigned char buttons[15];
1877     /*! The states of each [gamepad axis](@ref gamepad_axes), in the range -1.0
1878      *  to 1.0 inclusive.
1879      */
1880     float axes[6];
1881 } GLFWgamepadstate;
1882
1883
1884 /*************************************************************************
1885  * GLFW API functions
1886  *************************************************************************/
1887
1888 /*! @brief Initializes the GLFW library.
1889  *
1890  *  This function initializes the GLFW library.  Before most GLFW functions can
1891  *  be used, GLFW must be initialized, and before an application terminates GLFW
1892  *  should be terminated in order to free any resources allocated during or
1893  *  after initialization.
1894  *
1895  *  If this function fails, it calls @ref glfwTerminate before returning.  If it
1896  *  succeeds, you should call @ref glfwTerminate before the application exits.
1897  *
1898  *  Additional calls to this function after successful initialization but before
1899  *  termination will return `GLFW_TRUE` immediately.
1900  *
1901  *  @return `GLFW_TRUE` if successful, or `GLFW_FALSE` if an
1902  *  [error](@ref error_handling) occurred.
1903  *
1904  *  @errors Possible errors include @ref GLFW_PLATFORM_ERROR.
1905  *
1906  *  @remark @macos This function will change the current directory of the
1907  *  application to the `Contents/Resources` subdirectory of the application's
1908  *  bundle, if present.  This can be disabled with the @ref
1909  *  GLFW_COCOA_CHDIR_RESOURCES init hint.
1910  *
1911  *  @remark @macos This function will create the main menu and dock icon for the
1912  *  application.  If GLFW finds a `MainMenu.nib` it is loaded and assumed to
1913  *  contain a menu bar.  Otherwise a minimal menu bar is created manually with
1914  *  common commands like Hide, Quit and About.  The About entry opens a minimal
1915  *  about dialog with information from the application's bundle.  The menu bar
1916  *  and dock icon can be disabled entirely with the @ref GLFW_COCOA_MENUBAR init
1917  *  hint.
1918  *
1919  *  @remark @x11 This function will set the `LC_CTYPE` category of the
1920  *  application locale according to the current environment if that category is
1921  *  still "C".  This is because the "C" locale breaks Unicode text input.
1922  *
1923  *  @thread_safety This function must only be called from the main thread.
1924  *
1925  *  @sa @ref intro_init
1926  *  @sa @ref glfwTerminate
1927  *
1928  *  @since Added in version 1.0.
1929  *
1930  *  @ingroup init
1931  */
1932 GLFWAPI int glfwInit(void);
1933
1934 /*! @brief Terminates the GLFW library.
1935  *
1936  *  This function destroys all remaining windows and cursors, restores any
1937  *  modified gamma ramps and frees any other allocated resources.  Once this
1938  *  function is called, you must again call @ref glfwInit successfully before
1939  *  you will be able to use most GLFW functions.
1940  *
1941  *  If GLFW has been successfully initialized, this function should be called
1942  *  before the application exits.  If initialization fails, there is no need to
1943  *  call this function, as it is called by @ref glfwInit before it returns
1944  *  failure.
1945  *
1946  *  This function has no effect if GLFW is not initialized.
1947  *
1948  *  @errors Possible errors include @ref GLFW_PLATFORM_ERROR.
1949  *
1950  *  @remark This function may be called before @ref glfwInit.
1951  *
1952  *  @warning The contexts of any remaining windows must not be current on any
1953  *  other thread when this function is called.
1954  *
1955  *  @reentrancy This function must not be called from a callback.
1956  *
1957  *  @thread_safety This function must only be called from the main thread.
1958  *
1959  *  @sa @ref intro_init
1960  *  @sa @ref glfwInit
1961  *
1962  *  @since Added in version 1.0.
1963  *
1964  *  @ingroup init
1965  */
1966 GLFWAPI void glfwTerminate(void);
1967
1968 /*! @brief Sets the specified init hint to the desired value.
1969  *
1970  *  This function sets hints for the next initialization of GLFW.
1971  *
1972  *  The values you set hints to are never reset by GLFW, but they only take
1973  *  effect during initialization.  Once GLFW has been initialized, any values
1974  *  you set will be ignored until the library is terminated and initialized
1975  *  again.
1976  *
1977  *  Some hints are platform specific.  These may be set on any platform but they
1978  *  will only affect their specific platform.  Other platforms will ignore them.
1979  *  Setting these hints requires no platform specific headers or functions.
1980  *
1981  *  @param[in] hint The [init hint](@ref init_hints) to set.
1982  *  @param[in] value The new value of the init hint.
1983  *
1984  *  @errors Possible errors include @ref GLFW_INVALID_ENUM and @ref
1985  *  GLFW_INVALID_VALUE.
1986  *
1987  *  @remarks This function may be called before @ref glfwInit.
1988  *
1989  *  @thread_safety This function must only be called from the main thread.
1990  *
1991  *  @sa init_hints
1992  *  @sa glfwInit
1993  *
1994  *  @since Added in version 3.3.
1995  *
1996  *  @ingroup init
1997  */
1998 GLFWAPI void glfwInitHint(int hint, int value);
1999
2000 /*! @brief Retrieves the version of the GLFW library.
2001  *
2002  *  This function retrieves the major, minor and revision numbers of the GLFW
2003  *  library.  It is intended for when you are using GLFW as a shared library and
2004  *  want to ensure that you are using the minimum required version.
2005  *
2006  *  Any or all of the version arguments may be `NULL`.
2007  *
2008  *  @param[out] major Where to store the major version number, or `NULL`.
2009  *  @param[out] minor Where to store the minor version number, or `NULL`.
2010  *  @param[out] rev Where to store the revision number, or `NULL`.
2011  *
2012  *  @errors None.
2013  *
2014  *  @remark This function may be called before @ref glfwInit.
2015  *
2016  *  @thread_safety This function may be called from any thread.
2017  *
2018  *  @sa @ref intro_version
2019  *  @sa @ref glfwGetVersionString
2020  *
2021  *  @since Added in version 1.0.
2022  *
2023  *  @ingroup init
2024  */
2025 GLFWAPI void glfwGetVersion(int* major, int* minor, int* rev);
2026
2027 /*! @brief Returns a string describing the compile-time configuration.
2028  *
2029  *  This function returns the compile-time generated
2030  *  [version string](@ref intro_version_string) of the GLFW library binary.  It
2031  *  describes the version, platform, compiler and any platform-specific
2032  *  compile-time options.  It should not be confused with the OpenGL or OpenGL
2033  *  ES version string, queried with `glGetString`.
2034  *
2035  *  __Do not use the version string__ to parse the GLFW library version.  The
2036  *  @ref glfwGetVersion function provides the version of the running library
2037  *  binary in numerical format.
2038  *
2039  *  @return The ASCII encoded GLFW version string.
2040  *
2041  *  @errors None.
2042  *
2043  *  @remark This function may be called before @ref glfwInit.
2044  *
2045  *  @pointer_lifetime The returned string is static and compile-time generated.
2046  *
2047  *  @thread_safety This function may be called from any thread.
2048  *
2049  *  @sa @ref intro_version
2050  *  @sa @ref glfwGetVersion
2051  *
2052  *  @since Added in version 3.0.
2053  *
2054  *  @ingroup init
2055  */
2056 GLFWAPI const char* glfwGetVersionString(void);
2057
2058 /*! @brief Returns and clears the last error for the calling thread.
2059  *
2060  *  This function returns and clears the [error code](@ref errors) of the last
2061  *  error that occurred on the calling thread, and optionally a UTF-8 encoded
2062  *  human-readable description of it.  If no error has occurred since the last
2063  *  call, it returns @ref GLFW_NO_ERROR (zero) and the description pointer is
2064  *  set to `NULL`.
2065  *
2066  *  @param[in] description Where to store the error description pointer, or `NULL`.
2067  *  @return The last error code for the calling thread, or @ref GLFW_NO_ERROR
2068  *  (zero).
2069  *
2070  *  @errors None.
2071  *
2072  *  @pointer_lifetime The returned string is allocated and freed by GLFW.  You
2073  *  should not free it yourself.  It is guaranteed to be valid only until the
2074  *  next error occurs or the library is terminated.
2075  *
2076  *  @remark This function may be called before @ref glfwInit.
2077  *
2078  *  @thread_safety This function may be called from any thread.
2079  *
2080  *  @sa @ref error_handling
2081  *  @sa @ref glfwSetErrorCallback
2082  *
2083  *  @since Added in version 3.3.
2084  *
2085  *  @ingroup init
2086  */
2087 GLFWAPI int glfwGetError(const char** description);
2088
2089 /*! @brief Sets the error callback.
2090  *
2091  *  This function sets the error callback, which is called with an error code
2092  *  and a human-readable description each time a GLFW error occurs.
2093  *
2094  *  The error code is set before the callback is called.  Calling @ref
2095  *  glfwGetError from the error callback will return the same value as the error
2096  *  code argument.
2097  *
2098  *  The error callback is called on the thread where the error occurred.  If you
2099  *  are using GLFW from multiple threads, your error callback needs to be
2100  *  written accordingly.
2101  *
2102  *  Because the description string may have been generated specifically for that
2103  *  error, it is not guaranteed to be valid after the callback has returned.  If
2104  *  you wish to use it after the callback returns, you need to make a copy.
2105  *
2106  *  Once set, the error callback remains set even after the library has been
2107  *  terminated.
2108  *
2109  *  @param[in] callback The new callback, or `NULL` to remove the currently set
2110  *  callback.
2111  *  @return The previously set callback, or `NULL` if no callback was set.
2112  *
2113  *  @callback_signature
2114  *  @code
2115  *  void callback_name(int error_code, const char* description)
2116  *  @endcode
2117  *  For more information about the callback parameters, see the
2118  *  [callback pointer type](@ref GLFWerrorfun).
2119  *
2120  *  @errors None.
2121  *
2122  *  @remark This function may be called before @ref glfwInit.
2123  *
2124  *  @thread_safety This function must only be called from the main thread.
2125  *
2126  *  @sa @ref error_handling
2127  *  @sa @ref glfwGetError
2128  *
2129  *  @since Added in version 3.0.
2130  *
2131  *  @ingroup init
2132  */
2133 GLFWAPI GLFWerrorfun glfwSetErrorCallback(GLFWerrorfun callback);
2134
2135 /*! @brief Returns the currently connected monitors.
2136  *
2137  *  This function returns an array of handles for all currently connected
2138  *  monitors.  The primary monitor is always first in the returned array.  If no
2139  *  monitors were found, this function returns `NULL`.
2140  *
2141  *  @param[out] count Where to store the number of monitors in the returned
2142  *  array.  This is set to zero if an error occurred.
2143  *  @return An array of monitor handles, or `NULL` if no monitors were found or
2144  *  if an [error](@ref error_handling) occurred.
2145  *
2146  *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
2147  *
2148  *  @pointer_lifetime The returned array is allocated and freed by GLFW.  You
2149  *  should not free it yourself.  It is guaranteed to be valid only until the
2150  *  monitor configuration changes or the library is terminated.
2151  *
2152  *  @thread_safety This function must only be called from the main thread.
2153  *
2154  *  @sa @ref monitor_monitors
2155  *  @sa @ref monitor_event
2156  *  @sa @ref glfwGetPrimaryMonitor
2157  *
2158  *  @since Added in version 3.0.
2159  *
2160  *  @ingroup monitor
2161  */
2162 GLFWAPI GLFWmonitor** glfwGetMonitors(int* count);
2163
2164 /*! @brief Returns the primary monitor.
2165  *
2166  *  This function returns the primary monitor.  This is usually the monitor
2167  *  where elements like the task bar or global menu bar are located.
2168  *
2169  *  @return The primary monitor, or `NULL` if no monitors were found or if an
2170  *  [error](@ref error_handling) occurred.
2171  *
2172  *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
2173  *
2174  *  @thread_safety This function must only be called from the main thread.
2175  *
2176  *  @remark The primary monitor is always first in the array returned by @ref
2177  *  glfwGetMonitors.
2178  *
2179  *  @sa @ref monitor_monitors
2180  *  @sa @ref glfwGetMonitors
2181  *
2182  *  @since Added in version 3.0.
2183  *
2184  *  @ingroup monitor
2185  */
2186 GLFWAPI GLFWmonitor* glfwGetPrimaryMonitor(void);
2187
2188 /*! @brief Returns the position of the monitor's viewport on the virtual screen.
2189  *
2190  *  This function returns the position, in screen coordinates, of the upper-left
2191  *  corner of the specified monitor.
2192  *
2193  *  Any or all of the position arguments may be `NULL`.  If an error occurs, all
2194  *  non-`NULL` position arguments will be set to zero.
2195  *
2196  *  @param[in] monitor The monitor to query.
2197  *  @param[out] xpos Where to store the monitor x-coordinate, or `NULL`.
2198  *  @param[out] ypos Where to store the monitor y-coordinate, or `NULL`.
2199  *
2200  *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2201  *  GLFW_PLATFORM_ERROR.
2202  *
2203  *  @thread_safety This function must only be called from the main thread.
2204  *
2205  *  @sa @ref monitor_properties
2206  *
2207  *  @since Added in version 3.0.
2208  *
2209  *  @ingroup monitor
2210  */
2211 GLFWAPI void glfwGetMonitorPos(GLFWmonitor* monitor, int* xpos, int* ypos);
2212
2213 /*! @brief Retrieves the work area of the monitor.
2214  *
2215  *  This function returns the position, in screen coordinates, of the upper-left
2216  *  corner of the work area of the specified monitor along with the work area
2217  *  size in screen coordinates. The work area is defined as the area of the
2218  *  monitor not occluded by the operating system task bar where present. If no
2219  *  task bar exists then the work area is the monitor resolution in screen
2220  *  coordinates.
2221  *
2222  *  Any or all of the position and size arguments may be `NULL`.  If an error
2223  *  occurs, all non-`NULL` position and size arguments will be set to zero.
2224  *
2225  *  @param[in] monitor The monitor to query.
2226  *  @param[out] xpos Where to store the monitor x-coordinate, or `NULL`.
2227  *  @param[out] ypos Where to store the monitor y-coordinate, or `NULL`.
2228  *  @param[out] width Where to store the monitor width, or `NULL`.
2229  *  @param[out] height Where to store the monitor height, or `NULL`.
2230  *
2231  *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2232  *  GLFW_PLATFORM_ERROR.
2233  *
2234  *  @thread_safety This function must only be called from the main thread.
2235  *
2236  *  @sa @ref monitor_workarea
2237  *
2238  *  @since Added in version 3.3.
2239  *
2240  *  @ingroup monitor
2241  */
2242 GLFWAPI void glfwGetMonitorWorkarea(GLFWmonitor* monitor, int* xpos, int* ypos, int* width, int* height);
2243
2244 /*! @brief Returns the physical size of the monitor.
2245  *
2246  *  This function returns the size, in millimetres, of the display area of the
2247  *  specified monitor.
2248  *
2249  *  Some systems do not provide accurate monitor size information, either
2250  *  because the monitor
2251  *  [EDID](https://en.wikipedia.org/wiki/Extended_display_identification_data)
2252  *  data is incorrect or because the driver does not report it accurately.
2253  *
2254  *  Any or all of the size arguments may be `NULL`.  If an error occurs, all
2255  *  non-`NULL` size arguments will be set to zero.
2256  *
2257  *  @param[in] monitor The monitor to query.
2258  *  @param[out] widthMM Where to store the width, in millimetres, of the
2259  *  monitor's display area, or `NULL`.
2260  *  @param[out] heightMM Where to store the height, in millimetres, of the
2261  *  monitor's display area, or `NULL`.
2262  *
2263  *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
2264  *
2265  *  @remark @win32 calculates the returned physical size from the
2266  *  current resolution and system DPI instead of querying the monitor EDID data.
2267  *
2268  *  @thread_safety This function must only be called from the main thread.
2269  *
2270  *  @sa @ref monitor_properties
2271  *
2272  *  @since Added in version 3.0.
2273  *
2274  *  @ingroup monitor
2275  */
2276 GLFWAPI void glfwGetMonitorPhysicalSize(GLFWmonitor* monitor, int* widthMM, int* heightMM);
2277
2278 /*! @brief Retrieves the content scale for the specified monitor.
2279  *
2280  *  This function retrieves the content scale for the specified monitor.  The
2281  *  content scale is the ratio between the current DPI and the platform's
2282  *  default DPI.  This is especially important for text and any UI elements.  If
2283  *  the pixel dimensions of your UI scaled by this look appropriate on your
2284  *  machine then it should appear at a reasonable size on other machines
2285  *  regardless of their DPI and scaling settings.  This relies on the system DPI
2286  *  and scaling settings being somewhat correct.
2287  *
2288  *  The content scale may depend on both the monitor resolution and pixel
2289  *  density and on user settings.  It may be very different from the raw DPI
2290  *  calculated from the physical size and current resolution.
2291  *
2292  *  @param[in] monitor The monitor to query.
2293  *  @param[out] xscale Where to store the x-axis content scale, or `NULL`.
2294  *  @param[out] yscale Where to store the y-axis content scale, or `NULL`.
2295  *
2296  *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2297  *  GLFW_PLATFORM_ERROR.
2298  *
2299  *  @thread_safety This function must only be called from the main thread.
2300  *
2301  *  @sa @ref monitor_scale
2302  *  @sa @ref glfwGetWindowContentScale
2303  *
2304  *  @since Added in version 3.3.
2305  *
2306  *  @ingroup monitor
2307  */
2308 GLFWAPI void glfwGetMonitorContentScale(GLFWmonitor* monitor, float* xscale, float* yscale);
2309
2310 /*! @brief Returns the name of the specified monitor.
2311  *
2312  *  This function returns a human-readable name, encoded as UTF-8, of the
2313  *  specified monitor.  The name typically reflects the make and model of the
2314  *  monitor and is not guaranteed to be unique among the connected monitors.
2315  *
2316  *  @param[in] monitor The monitor to query.
2317  *  @return The UTF-8 encoded name of the monitor, or `NULL` if an
2318  *  [error](@ref error_handling) occurred.
2319  *
2320  *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
2321  *
2322  *  @pointer_lifetime The returned string is allocated and freed by GLFW.  You
2323  *  should not free it yourself.  It is valid until the specified monitor is
2324  *  disconnected or the library is terminated.
2325  *
2326  *  @thread_safety This function must only be called from the main thread.
2327  *
2328  *  @sa @ref monitor_properties
2329  *
2330  *  @since Added in version 3.0.
2331  *
2332  *  @ingroup monitor
2333  */
2334 GLFWAPI const char* glfwGetMonitorName(GLFWmonitor* monitor);
2335
2336 /*! @brief Sets the user pointer of the specified monitor.
2337  *
2338  *  This function sets the user-defined pointer of the specified monitor.  The
2339  *  current value is retained until the monitor is disconnected.  The initial
2340  *  value is `NULL`.
2341  *
2342  *  This function may be called from the monitor callback, even for a monitor
2343  *  that is being disconnected.
2344  *
2345  *  @param[in] monitor The monitor whose pointer to set.
2346  *  @param[in] pointer The new value.
2347  *
2348  *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
2349  *
2350  *  @thread_safety This function may be called from any thread.  Access is not
2351  *  synchronized.
2352  *
2353  *  @sa @ref monitor_userptr
2354  *  @sa @ref glfwGetMonitorUserPointer
2355  *
2356  *  @since Added in version 3.3.
2357  *
2358  *  @ingroup monitor
2359  */
2360 GLFWAPI void glfwSetMonitorUserPointer(GLFWmonitor* monitor, void* pointer);
2361
2362 /*! @brief Returns the user pointer of the specified monitor.
2363  *
2364  *  This function returns the current value of the user-defined pointer of the
2365  *  specified monitor.  The initial value is `NULL`.
2366  *
2367  *  This function may be called from the monitor callback, even for a monitor
2368  *  that is being disconnected.
2369  *
2370  *  @param[in] monitor The monitor whose pointer to return.
2371  *
2372  *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
2373  *
2374  *  @thread_safety This function may be called from any thread.  Access is not
2375  *  synchronized.
2376  *
2377  *  @sa @ref monitor_userptr
2378  *  @sa @ref glfwSetMonitorUserPointer
2379  *
2380  *  @since Added in version 3.3.
2381  *
2382  *  @ingroup monitor
2383  */
2384 GLFWAPI void* glfwGetMonitorUserPointer(GLFWmonitor* monitor);
2385
2386 /*! @brief Sets the monitor configuration callback.
2387  *
2388  *  This function sets the monitor configuration callback, or removes the
2389  *  currently set callback.  This is called when a monitor is connected to or
2390  *  disconnected from the system.
2391  *
2392  *  @param[in] callback The new callback, or `NULL` to remove the currently set
2393  *  callback.
2394  *  @return The previously set callback, or `NULL` if no callback was set or the
2395  *  library had not been [initialized](@ref intro_init).
2396  *
2397  *  @callback_signature
2398  *  @code
2399  *  void function_name(GLFWmonitor* monitor, int event)
2400  *  @endcode
2401  *  For more information about the callback parameters, see the
2402  *  [function pointer type](@ref GLFWmonitorfun).
2403  *
2404  *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
2405  *
2406  *  @thread_safety This function must only be called from the main thread.
2407  *
2408  *  @sa @ref monitor_event
2409  *
2410  *  @since Added in version 3.0.
2411  *
2412  *  @ingroup monitor
2413  */
2414 GLFWAPI GLFWmonitorfun glfwSetMonitorCallback(GLFWmonitorfun callback);
2415
2416 /*! @brief Returns the available video modes for the specified monitor.
2417  *
2418  *  This function returns an array of all video modes supported by the specified
2419  *  monitor.  The returned array is sorted in ascending order, first by color
2420  *  bit depth (the sum of all channel depths) and then by resolution area (the
2421  *  product of width and height).
2422  *
2423  *  @param[in] monitor The monitor to query.
2424  *  @param[out] count Where to store the number of video modes in the returned
2425  *  array.  This is set to zero if an error occurred.
2426  *  @return An array of video modes, or `NULL` if an
2427  *  [error](@ref error_handling) occurred.
2428  *
2429  *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2430  *  GLFW_PLATFORM_ERROR.
2431  *
2432  *  @pointer_lifetime The returned array is allocated and freed by GLFW.  You
2433  *  should not free it yourself.  It is valid until the specified monitor is
2434  *  disconnected, this function is called again for that monitor or the library
2435  *  is terminated.
2436  *
2437  *  @thread_safety This function must only be called from the main thread.
2438  *
2439  *  @sa @ref monitor_modes
2440  *  @sa @ref glfwGetVideoMode
2441  *
2442  *  @since Added in version 1.0.
2443  *  @glfw3 Changed to return an array of modes for a specific monitor.
2444  *
2445  *  @ingroup monitor
2446  */
2447 GLFWAPI const GLFWvidmode* glfwGetVideoModes(GLFWmonitor* monitor, int* count);
2448
2449 /*! @brief Returns the current mode of the specified monitor.
2450  *
2451  *  This function returns the current video mode of the specified monitor.  If
2452  *  you have created a full screen window for that monitor, the return value
2453  *  will depend on whether that window is iconified.
2454  *
2455  *  @param[in] monitor The monitor to query.
2456  *  @return The current mode of the monitor, or `NULL` if an
2457  *  [error](@ref error_handling) occurred.
2458  *
2459  *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2460  *  GLFW_PLATFORM_ERROR.
2461  *
2462  *  @pointer_lifetime The returned array is allocated and freed by GLFW.  You
2463  *  should not free it yourself.  It is valid until the specified monitor is
2464  *  disconnected or the library is terminated.
2465  *
2466  *  @thread_safety This function must only be called from the main thread.
2467  *
2468  *  @sa @ref monitor_modes
2469  *  @sa @ref glfwGetVideoModes
2470  *
2471  *  @since Added in version 3.0.  Replaces `glfwGetDesktopMode`.
2472  *
2473  *  @ingroup monitor
2474  */
2475 GLFWAPI const GLFWvidmode* glfwGetVideoMode(GLFWmonitor* monitor);
2476
2477 /*! @brief Generates a gamma ramp and sets it for the specified monitor.
2478  *
2479  *  This function generates an appropriately sized gamma ramp from the specified
2480  *  exponent and then calls @ref glfwSetGammaRamp with it.  The value must be
2481  *  a finite number greater than zero.
2482  *
2483  *  The software controlled gamma ramp is applied _in addition_ to the hardware
2484  *  gamma correction, which today is usually an approximation of sRGB gamma.
2485  *  This means that setting a perfectly linear ramp, or gamma 1.0, will produce
2486  *  the default (usually sRGB-like) behavior.
2487  *
2488  *  For gamma correct rendering with OpenGL or OpenGL ES, see the @ref
2489  *  GLFW_SRGB_CAPABLE hint.
2490  *
2491  *  @param[in] monitor The monitor whose gamma ramp to set.
2492  *  @param[in] gamma The desired exponent.
2493  *
2494  *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
2495  *  GLFW_INVALID_VALUE and @ref GLFW_PLATFORM_ERROR.
2496  *
2497  *  @remark @wayland Gamma handling is a privileged protocol, this function
2498  *  will thus never be implemented and emits @ref GLFW_PLATFORM_ERROR.
2499  *
2500  *  @thread_safety This function must only be called from the main thread.
2501  *
2502  *  @sa @ref monitor_gamma
2503  *
2504  *  @since Added in version 3.0.
2505  *
2506  *  @ingroup monitor
2507  */
2508 GLFWAPI void glfwSetGamma(GLFWmonitor* monitor, float gamma);
2509
2510 /*! @brief Returns the current gamma ramp for the specified monitor.
2511  *
2512  *  This function returns the current gamma ramp of the specified monitor.
2513  *
2514  *  @param[in] monitor The monitor to query.
2515  *  @return The current gamma ramp, or `NULL` if an
2516  *  [error](@ref error_handling) occurred.
2517  *
2518  *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2519  *  GLFW_PLATFORM_ERROR.
2520  *
2521  *  @remark @wayland Gamma handling is a privileged protocol, this function
2522  *  will thus never be implemented and emits @ref GLFW_PLATFORM_ERROR while
2523  *  returning `NULL`.
2524  *
2525  *  @pointer_lifetime The returned structure and its arrays are allocated and
2526  *  freed by GLFW.  You should not free them yourself.  They are valid until the
2527  *  specified monitor is disconnected, this function is called again for that
2528  *  monitor or the library is terminated.
2529  *
2530  *  @thread_safety This function must only be called from the main thread.
2531  *
2532  *  @sa @ref monitor_gamma
2533  *
2534  *  @since Added in version 3.0.
2535  *
2536  *  @ingroup monitor
2537  */
2538 GLFWAPI const GLFWgammaramp* glfwGetGammaRamp(GLFWmonitor* monitor);
2539
2540 /*! @brief Sets the current gamma ramp for the specified monitor.
2541  *
2542  *  This function sets the current gamma ramp for the specified monitor.  The
2543  *  original gamma ramp for that monitor is saved by GLFW the first time this
2544  *  function is called and is restored by @ref glfwTerminate.
2545  *
2546  *  The software controlled gamma ramp is applied _in addition_ to the hardware
2547  *  gamma correction, which today is usually an approximation of sRGB gamma.
2548  *  This means that setting a perfectly linear ramp, or gamma 1.0, will produce
2549  *  the default (usually sRGB-like) behavior.
2550  *
2551  *  For gamma correct rendering with OpenGL or OpenGL ES, see the @ref
2552  *  GLFW_SRGB_CAPABLE hint.
2553  *
2554  *  @param[in] monitor The monitor whose gamma ramp to set.
2555  *  @param[in] ramp The gamma ramp to use.
2556  *
2557  *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2558  *  GLFW_PLATFORM_ERROR.
2559  *
2560  *  @remark The size of the specified gamma ramp should match the size of the
2561  *  current ramp for that monitor.
2562  *
2563  *  @remark @win32 The gamma ramp size must be 256.
2564  *
2565  *  @remark @wayland Gamma handling is a privileged protocol, this function
2566  *  will thus never be implemented and emits @ref GLFW_PLATFORM_ERROR.
2567  *
2568  *  @pointer_lifetime The specified gamma ramp is copied before this function
2569  *  returns.
2570  *
2571  *  @thread_safety This function must only be called from the main thread.
2572  *
2573  *  @sa @ref monitor_gamma
2574  *
2575  *  @since Added in version 3.0.
2576  *
2577  *  @ingroup monitor
2578  */
2579 GLFWAPI void glfwSetGammaRamp(GLFWmonitor* monitor, const GLFWgammaramp* ramp);
2580
2581 /*! @brief Resets all window hints to their default values.
2582  *
2583  *  This function resets all window hints to their
2584  *  [default values](@ref window_hints_values).
2585  *
2586  *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
2587  *
2588  *  @thread_safety This function must only be called from the main thread.
2589  *
2590  *  @sa @ref window_hints
2591  *  @sa @ref glfwWindowHint
2592  *  @sa @ref glfwWindowHintString
2593  *
2594  *  @since Added in version 3.0.
2595  *
2596  *  @ingroup window
2597  */
2598 GLFWAPI void glfwDefaultWindowHints(void);
2599
2600 /*! @brief Sets the specified window hint to the desired value.
2601  *
2602  *  This function sets hints for the next call to @ref glfwCreateWindow.  The
2603  *  hints, once set, retain their values until changed by a call to this
2604  *  function or @ref glfwDefaultWindowHints, or until the library is terminated.
2605  *
2606  *  Only integer value hints can be set with this function.  String value hints
2607  *  are set with @ref glfwWindowHintString.
2608  *
2609  *  This function does not check whether the specified hint values are valid.
2610  *  If you set hints to invalid values this will instead be reported by the next
2611  *  call to @ref glfwCreateWindow.
2612  *
2613  *  Some hints are platform specific.  These may be set on any platform but they
2614  *  will only affect their specific platform.  Other platforms will ignore them.
2615  *  Setting these hints requires no platform specific headers or functions.
2616  *
2617  *  @param[in] hint The [window hint](@ref window_hints) to set.
2618  *  @param[in] value The new value of the window hint.
2619  *
2620  *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2621  *  GLFW_INVALID_ENUM.
2622  *
2623  *  @thread_safety This function must only be called from the main thread.
2624  *
2625  *  @sa @ref window_hints
2626  *  @sa @ref glfwWindowHintString
2627  *  @sa @ref glfwDefaultWindowHints
2628  *
2629  *  @since Added in version 3.0.  Replaces `glfwOpenWindowHint`.
2630  *
2631  *  @ingroup window
2632  */
2633 GLFWAPI void glfwWindowHint(int hint, int value);
2634
2635 /*! @brief Sets the specified window hint to the desired value.
2636  *
2637  *  This function sets hints for the next call to @ref glfwCreateWindow.  The
2638  *  hints, once set, retain their values until changed by a call to this
2639  *  function or @ref glfwDefaultWindowHints, or until the library is terminated.
2640  *
2641  *  Only string type hints can be set with this function.  Integer value hints
2642  *  are set with @ref glfwWindowHint.
2643  *
2644  *  This function does not check whether the specified hint values are valid.
2645  *  If you set hints to invalid values this will instead be reported by the next
2646  *  call to @ref glfwCreateWindow.
2647  *
2648  *  Some hints are platform specific.  These may be set on any platform but they
2649  *  will only affect their specific platform.  Other platforms will ignore them.
2650  *  Setting these hints requires no platform specific headers or functions.
2651  *
2652  *  @param[in] hint The [window hint](@ref window_hints) to set.
2653  *  @param[in] value The new value of the window hint.
2654  *
2655  *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2656  *  GLFW_INVALID_ENUM.
2657  *
2658  *  @pointer_lifetime The specified string is copied before this function
2659  *  returns.
2660  *
2661  *  @thread_safety This function must only be called from the main thread.
2662  *
2663  *  @sa @ref window_hints
2664  *  @sa @ref glfwWindowHint
2665  *  @sa @ref glfwDefaultWindowHints
2666  *
2667  *  @since Added in version 3.3.
2668  *
2669  *  @ingroup window
2670  */
2671 GLFWAPI void glfwWindowHintString(int hint, const char* value);
2672
2673 /*! @brief Creates a window and its associated context.
2674  *
2675  *  This function creates a window and its associated OpenGL or OpenGL ES
2676  *  context.  Most of the options controlling how the window and its context
2677  *  should be created are specified with [window hints](@ref window_hints).
2678  *
2679  *  Successful creation does not change which context is current.  Before you
2680  *  can use the newly created context, you need to
2681  *  [make it current](@ref context_current).  For information about the `share`
2682  *  parameter, see @ref context_sharing.
2683  *
2684  *  The created window, framebuffer and context may differ from what you
2685  *  requested, as not all parameters and hints are
2686  *  [hard constraints](@ref window_hints_hard).  This includes the size of the
2687  *  window, especially for full screen windows.  To query the actual attributes
2688  *  of the created window, framebuffer and context, see @ref
2689  *  glfwGetWindowAttrib, @ref glfwGetWindowSize and @ref glfwGetFramebufferSize.
2690  *
2691  *  To create a full screen window, you need to specify the monitor the window
2692  *  will cover.  If no monitor is specified, the window will be windowed mode.
2693  *  Unless you have a way for the user to choose a specific monitor, it is
2694  *  recommended that you pick the primary monitor.  For more information on how
2695  *  to query connected monitors, see @ref monitor_monitors.
2696  *
2697  *  For full screen windows, the specified size becomes the resolution of the
2698  *  window's _desired video mode_.  As long as a full screen window is not
2699  *  iconified, the supported video mode most closely matching the desired video
2700  *  mode is set for the specified monitor.  For more information about full
2701  *  screen windows, including the creation of so called _windowed full screen_
2702  *  or _borderless full screen_ windows, see @ref window_windowed_full_screen.
2703  *
2704  *  Once you have created the window, you can switch it between windowed and
2705  *  full screen mode with @ref glfwSetWindowMonitor.  This will not affect its
2706  *  OpenGL or OpenGL ES context.
2707  *
2708  *  By default, newly created windows use the placement recommended by the
2709  *  window system.  To create the window at a specific position, make it
2710  *  initially invisible using the [GLFW_VISIBLE](@ref GLFW_VISIBLE_hint) window
2711  *  hint, set its [position](@ref window_pos) and then [show](@ref window_hide)
2712  *  it.
2713  *
2714  *  As long as at least one full screen window is not iconified, the screensaver
2715  *  is prohibited from starting.
2716  *
2717  *  Window systems put limits on window sizes.  Very large or very small window
2718  *  dimensions may be overridden by the window system on creation.  Check the
2719  *  actual [size](@ref window_size) after creation.
2720  *
2721  *  The [swap interval](@ref buffer_swap) is not set during window creation and
2722  *  the initial value may vary depending on driver settings and defaults.
2723  *
2724  *  @param[in] width The desired width, in screen coordinates, of the window.
2725  *  This must be greater than zero.
2726  *  @param[in] height The desired height, in screen coordinates, of the window.
2727  *  This must be greater than zero.
2728  *  @param[in] title The initial, UTF-8 encoded window title.
2729  *  @param[in] monitor The monitor to use for full screen mode, or `NULL` for
2730  *  windowed mode.
2731  *  @param[in] share The window whose context to share resources with, or `NULL`
2732  *  to not share resources.
2733  *  @return The handle of the created window, or `NULL` if an
2734  *  [error](@ref error_handling) occurred.
2735  *
2736  *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
2737  *  GLFW_INVALID_ENUM, @ref GLFW_INVALID_VALUE, @ref GLFW_API_UNAVAILABLE, @ref
2738  *  GLFW_VERSION_UNAVAILABLE, @ref GLFW_FORMAT_UNAVAILABLE and @ref
2739  *  GLFW_PLATFORM_ERROR.
2740  *
2741  *  @remark @win32 Window creation will fail if the Microsoft GDI software
2742  *  OpenGL implementation is the only one available.
2743  *
2744  *  @remark @win32 If the executable has an icon resource named `GLFW_ICON,` it
2745  *  will be set as the initial icon for the window.  If no such icon is present,
2746  *  the `IDI_APPLICATION` icon will be used instead.  To set a different icon,
2747  *  see @ref glfwSetWindowIcon.
2748  *
2749  *  @remark @win32 The context to share resources with must not be current on
2750  *  any other thread.
2751  *
2752  *  @remark @macos The OS only supports core profile contexts for OpenGL
2753  *  versions 3.2 and later.  Before creating an OpenGL context of version 3.2 or
2754  *  later you must set the [GLFW_OPENGL_PROFILE](@ref GLFW_OPENGL_PROFILE_hint)
2755  *  hint accordingly.  OpenGL 3.0 and 3.1 contexts are not supported at all
2756  *  on macOS.
2757  *
2758  *  @remark @macos The GLFW window has no icon, as it is not a document
2759  *  window, but the dock icon will be the same as the application bundle's icon.
2760  *  For more information on bundles, see the
2761  *  [Bundle Programming Guide](https://developer.apple.com/library/mac/documentation/CoreFoundation/Conceptual/CFBundles/)
2762  *  in the Mac Developer Library.
2763  *
2764  *  @remark @macos On OS X 10.10 and later the window frame will not be rendered
2765  *  at full resolution on Retina displays unless the
2766  *  [GLFW_COCOA_RETINA_FRAMEBUFFER](@ref GLFW_COCOA_RETINA_FRAMEBUFFER_hint)
2767  *  hint is `GLFW_TRUE` and the `NSHighResolutionCapable` key is enabled in the
2768  *  application bundle's `Info.plist`.  For more information, see
2769  *  [High Resolution Guidelines for OS X](https://developer.apple.com/library/mac/documentation/GraphicsAnimation/Conceptual/HighResolutionOSX/Explained/Explained.html)
2770  *  in the Mac Developer Library.  The GLFW test and example programs use
2771  *  a custom `Info.plist` template for this, which can be found as
2772  *  `CMake/Info.plist.in` in the source tree.
2773  *
2774  *  @remark @macos When activating frame autosaving with
2775  *  [GLFW_COCOA_FRAME_NAME](@ref GLFW_COCOA_FRAME_NAME_hint), the specified
2776  *  window size and position may be overridden by previously saved values.
2777  *
2778  *  @remark @x11 Some window managers will not respect the placement of
2779  *  initially hidden windows.
2780  *
2781  *  @remark @x11 Due to the asynchronous nature of X11, it may take a moment for
2782  *  a window to reach its requested state.  This means you may not be able to
2783  *  query the final size, position or other attributes directly after window
2784  *  creation.
2785  *
2786  *  @remark @x11 The class part of the `WM_CLASS` window property will by
2787  *  default be set to the window title passed to this function.  The instance
2788  *  part will use the contents of the `RESOURCE_NAME` environment variable, if
2789  *  present and not empty, or fall back to the window title.  Set the
2790  *  [GLFW_X11_CLASS_NAME](@ref GLFW_X11_CLASS_NAME_hint) and
2791  *  [GLFW_X11_INSTANCE_NAME](@ref GLFW_X11_INSTANCE_NAME_hint) window hints to
2792  *  override this.
2793  *
2794  *  @remark @wayland Compositors should implement the xdg-decoration protocol
2795  *  for GLFW to decorate the window properly.  If this protocol isn't
2796  *  supported, or if the compositor prefers client-side decorations, a very
2797  *  simple fallback frame will be drawn using the wp_viewporter protocol.  A
2798  *  compositor can still emit close, maximize or fullscreen events, using for
2799  *  instance a keybind mechanism.  If neither of these protocols is supported,
2800  *  the window won't be decorated.
2801  *
2802  *  @remark @wayland A full screen window will not attempt to change the mode,
2803  *  no matter what the requested size or refresh rate.
2804  *
2805  *  @remark @wayland Screensaver inhibition requires the idle-inhibit protocol
2806  *  to be implemented in the user's compositor.
2807  *
2808  *  @thread_safety This function must only be called from the main thread.
2809  *
2810  *  @sa @ref window_creation
2811  *  @sa @ref glfwDestroyWindow
2812  *
2813  *  @since Added in version 3.0.  Replaces `glfwOpenWindow`.
2814  *
2815  *  @ingroup window
2816  */
2817 GLFWAPI GLFWwindow* glfwCreateWindow(int width, int height, const char* title, GLFWmonitor* monitor, GLFWwindow* share);
2818
2819 /*! @brief Destroys the specified window and its context.
2820  *
2821  *  This function destroys the specified window and its context.  On calling
2822  *  this function, no further callbacks will be called for that window.
2823  *
2824  *  If the context of the specified window is current on the main thread, it is
2825  *  detached before being destroyed.
2826  *
2827  *  @param[in] window The window to destroy.
2828  *
2829  *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2830  *  GLFW_PLATFORM_ERROR.
2831  *
2832  *  @note The context of the specified window must not be current on any other
2833  *  thread when this function is called.
2834  *
2835  *  @reentrancy This function must not be called from a callback.
2836  *
2837  *  @thread_safety This function must only be called from the main thread.
2838  *
2839  *  @sa @ref window_creation
2840  *  @sa @ref glfwCreateWindow
2841  *
2842  *  @since Added in version 3.0.  Replaces `glfwCloseWindow`.
2843  *
2844  *  @ingroup window
2845  */
2846 GLFWAPI void glfwDestroyWindow(GLFWwindow* window);
2847
2848 /*! @brief Checks the close flag of the specified window.
2849  *
2850  *  This function returns the value of the close flag of the specified window.
2851  *
2852  *  @param[in] window The window to query.
2853  *  @return The value of the close flag.
2854  *
2855  *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
2856  *
2857  *  @thread_safety This function may be called from any thread.  Access is not
2858  *  synchronized.
2859  *
2860  *  @sa @ref window_close
2861  *
2862  *  @since Added in version 3.0.
2863  *
2864  *  @ingroup window
2865  */
2866 GLFWAPI int glfwWindowShouldClose(GLFWwindow* window);
2867
2868 /*! @brief Sets the close flag of the specified window.
2869  *
2870  *  This function sets the value of the close flag of the specified window.
2871  *  This can be used to override the user's attempt to close the window, or
2872  *  to signal that it should be closed.
2873  *
2874  *  @param[in] window The window whose flag to change.
2875  *  @param[in] value The new value.
2876  *
2877  *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
2878  *
2879  *  @thread_safety This function may be called from any thread.  Access is not
2880  *  synchronized.
2881  *
2882  *  @sa @ref window_close
2883  *
2884  *  @since Added in version 3.0.
2885  *
2886  *  @ingroup window
2887  */
2888 GLFWAPI void glfwSetWindowShouldClose(GLFWwindow* window, int value);
2889
2890 /*! @brief Sets the title of the specified window.
2891  *
2892  *  This function sets the window title, encoded as UTF-8, of the specified
2893  *  window.
2894  *
2895  *  @param[in] window The window whose title to change.
2896  *  @param[in] title The UTF-8 encoded window title.
2897  *
2898  *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2899  *  GLFW_PLATFORM_ERROR.
2900  *
2901  *  @remark @macos The window title will not be updated until the next time you
2902  *  process events.
2903  *
2904  *  @thread_safety This function must only be called from the main thread.
2905  *
2906  *  @sa @ref window_title
2907  *
2908  *  @since Added in version 1.0.
2909  *  @glfw3 Added window handle parameter.
2910  *
2911  *  @ingroup window
2912  */
2913 GLFWAPI void glfwSetWindowTitle(GLFWwindow* window, const char* title);
2914
2915 /*! @brief Sets the icon for the specified window.
2916  *
2917  *  This function sets the icon of the specified window.  If passed an array of
2918  *  candidate images, those of or closest to the sizes desired by the system are
2919  *  selected.  If no images are specified, the window reverts to its default
2920  *  icon.
2921  *
2922  *  The pixels are 32-bit, little-endian, non-premultiplied RGBA, i.e. eight
2923  *  bits per channel with the red channel first.  They are arranged canonically
2924  *  as packed sequential rows, starting from the top-left corner.
2925  *
2926  *  The desired image sizes varies depending on platform and system settings.
2927  *  The selected images will be rescaled as needed.  Good sizes include 16x16,
2928  *  32x32 and 48x48.
2929  *
2930  *  @param[in] window The window whose icon to set.
2931  *  @param[in] count The number of images in the specified array, or zero to
2932  *  revert to the default window icon.
2933  *  @param[in] images The images to create the icon from.  This is ignored if
2934  *  count is zero.
2935  *
2936  *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
2937  *  GLFW_PLATFORM_ERROR and @ref GLFW_FEATURE_UNAVAILABLE (see remarks).
2938  *
2939  *  @pointer_lifetime The specified image data is copied before this function
2940  *  returns.
2941  *
2942  *  @remark @macos Regular windows do not have icons on macOS.  This function
2943  *  will emit @ref GLFW_FEATURE_UNAVAILABLE.  The dock icon will be the same as
2944  *  the application bundle's icon.  For more information on bundles, see the
2945  *  [Bundle Programming Guide](https://developer.apple.com/library/mac/documentation/CoreFoundation/Conceptual/CFBundles/)
2946  *  in the Mac Developer Library.
2947  *
2948  *  @remark @wayland There is no existing protocol to change an icon, the
2949  *  window will thus inherit the one defined in the application's desktop file.
2950  *  This function will emit @ref GLFW_FEATURE_UNAVAILABLE.
2951  *
2952  *  @thread_safety This function must only be called from the main thread.
2953  *
2954  *  @sa @ref window_icon
2955  *
2956  *  @since Added in version 3.2.
2957  *
2958  *  @ingroup window
2959  */
2960 GLFWAPI void glfwSetWindowIcon(GLFWwindow* window, int count, const GLFWimage* images);
2961
2962 /*! @brief Retrieves the position of the content area of the specified window.
2963  *
2964  *  This function retrieves the position, in screen coordinates, of the
2965  *  upper-left corner of the content area of the specified window.
2966  *
2967  *  Any or all of the position arguments may be `NULL`.  If an error occurs, all
2968  *  non-`NULL` position arguments will be set to zero.
2969  *
2970  *  @param[in] window The window to query.
2971  *  @param[out] xpos Where to store the x-coordinate of the upper-left corner of
2972  *  the content area, or `NULL`.
2973  *  @param[out] ypos Where to store the y-coordinate of the upper-left corner of
2974  *  the content area, or `NULL`.
2975  *
2976  *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
2977  *  GLFW_PLATFORM_ERROR and @ref GLFW_FEATURE_UNAVAILABLE (see remarks).
2978  *
2979  *  @remark @wayland There is no way for an application to retrieve the global
2980  *  position of its windows.  This function will emit @ref
2981  *  GLFW_FEATURE_UNAVAILABLE.
2982  *
2983  *  @thread_safety This function must only be called from the main thread.
2984  *
2985  *  @sa @ref window_pos
2986  *  @sa @ref glfwSetWindowPos
2987  *
2988  *  @since Added in version 3.0.
2989  *
2990  *  @ingroup window
2991  */
2992 GLFWAPI void glfwGetWindowPos(GLFWwindow* window, int* xpos, int* ypos);
2993
2994 /*! @brief Sets the position of the content area of the specified window.
2995  *
2996  *  This function sets the position, in screen coordinates, of the upper-left
2997  *  corner of the content area of the specified windowed mode window.  If the
2998  *  window is a full screen window, this function does nothing.
2999  *
3000  *  __Do not use this function__ to move an already visible window unless you
3001  *  have very good reasons for doing so, as it will confuse and annoy the user.
3002  *
3003  *  The window manager may put limits on what positions are allowed.  GLFW
3004  *  cannot and should not override these limits.
3005  *
3006  *  @param[in] window The window to query.
3007  *  @param[in] xpos The x-coordinate of the upper-left corner of the content area.
3008  *  @param[in] ypos The y-coordinate of the upper-left corner of the content area.
3009  *
3010  *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
3011  *  GLFW_PLATFORM_ERROR and @ref GLFW_FEATURE_UNAVAILABLE (see remarks).
3012  *
3013  *  @remark @wayland There is no way for an application to set the global
3014  *  position of its windows.  This function will emit @ref
3015  *  GLFW_FEATURE_UNAVAILABLE.
3016  *
3017  *  @thread_safety This function must only be called from the main thread.
3018  *
3019  *  @sa @ref window_pos
3020  *  @sa @ref glfwGetWindowPos
3021  *
3022  *  @since Added in version 1.0.
3023  *  @glfw3 Added window handle parameter.
3024  *
3025  *  @ingroup window
3026  */
3027 GLFWAPI void glfwSetWindowPos(GLFWwindow* window, int xpos, int ypos);
3028
3029 /*! @brief Retrieves the size of the content area of the specified window.
3030  *
3031  *  This function retrieves the size, in screen coordinates, of the content area
3032  *  of the specified window.  If you wish to retrieve the size of the
3033  *  framebuffer of the window in pixels, see @ref glfwGetFramebufferSize.
3034  *
3035  *  Any or all of the size arguments may be `NULL`.  If an error occurs, all
3036  *  non-`NULL` size arguments will be set to zero.
3037  *
3038  *  @param[in] window The window whose size to retrieve.
3039  *  @param[out] width Where to store the width, in screen coordinates, of the
3040  *  content area, or `NULL`.
3041  *  @param[out] height Where to store the height, in screen coordinates, of the
3042  *  content area, or `NULL`.
3043  *
3044  *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
3045  *  GLFW_PLATFORM_ERROR.
3046  *
3047  *  @thread_safety This function must only be called from the main thread.
3048  *
3049  *  @sa @ref window_size
3050  *  @sa @ref glfwSetWindowSize
3051  *
3052  *  @since Added in version 1.0.
3053  *  @glfw3 Added window handle parameter.
3054  *
3055  *  @ingroup window
3056  */
3057 GLFWAPI void glfwGetWindowSize(GLFWwindow* window, int* width, int* height);
3058
3059 /*! @brief Sets the size limits of the specified window.
3060  *
3061  *  This function sets the size limits of the content area of the specified
3062  *  window.  If the window is full screen, the size limits only take effect
3063  *  once it is made windowed.  If the window is not resizable, this function
3064  *  does nothing.
3065  *
3066  *  The size limits are applied immediately to a windowed mode window and may
3067  *  cause it to be resized.
3068  *
3069  *  The maximum dimensions must be greater than or equal to the minimum
3070  *  dimensions and all must be greater than or equal to zero.
3071  *
3072  *  @param[in] window The window to set limits for.
3073  *  @param[in] minwidth The minimum width, in screen coordinates, of the content
3074  *  area, or `GLFW_DONT_CARE`.
3075  *  @param[in] minheight The minimum height, in screen coordinates, of the
3076  *  content area, or `GLFW_DONT_CARE`.
3077  *  @param[in] maxwidth The maximum width, in screen coordinates, of the content
3078  *  area, or `GLFW_DONT_CARE`.
3079  *  @param[in] maxheight The maximum height, in screen coordinates, of the
3080  *  content area, or `GLFW_DONT_CARE`.
3081  *
3082  *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
3083  *  GLFW_INVALID_VALUE and @ref GLFW_PLATFORM_ERROR.
3084  *
3085  *  @remark If you set size limits and an aspect ratio that conflict, the
3086  *  results are undefined.
3087  *
3088  *  @remark @wayland The size limits will not be applied until the window is
3089  *  actually resized, either by the user or by the compositor.
3090  *
3091  *  @thread_safety This function must only be called from the main thread.
3092  *
3093  *  @sa @ref window_sizelimits
3094  *  @sa @ref glfwSetWindowAspectRatio
3095  *
3096  *  @since Added in version 3.2.
3097  *
3098  *  @ingroup window
3099  */
3100 GLFWAPI void glfwSetWindowSizeLimits(GLFWwindow* window, int minwidth, int minheight, int maxwidth, int maxheight);
3101
3102 /*! @brief Sets the aspect ratio of the specified window.
3103  *
3104  *  This function sets the required aspect ratio of the content area of the
3105  *  specified window.  If the window is full screen, the aspect ratio only takes
3106  *  effect once it is made windowed.  If the window is not resizable, this
3107  *  function does nothing.
3108  *
3109  *  The aspect ratio is specified as a numerator and a denominator and both
3110  *  values must be greater than zero.  For example, the common 16:9 aspect ratio
3111  *  is specified as 16 and 9, respectively.
3112  *
3113  *  If the numerator and denominator is set to `GLFW_DONT_CARE` then the aspect
3114  *  ratio limit is disabled.
3115  *
3116  *  The aspect ratio is applied immediately to a windowed mode window and may
3117  *  cause it to be resized.
3118  *
3119  *  @param[in] window The window to set limits for.
3120  *  @param[in] numer The numerator of the desired aspect ratio, or
3121  *  `GLFW_DONT_CARE`.
3122  *  @param[in] denom The denominator of the desired aspect ratio, or
3123  *  `GLFW_DONT_CARE`.
3124  *
3125  *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
3126  *  GLFW_INVALID_VALUE and @ref GLFW_PLATFORM_ERROR.
3127  *
3128  *  @remark If you set size limits and an aspect ratio that conflict, the
3129  *  results are undefined.
3130  *
3131  *  @remark @wayland The aspect ratio will not be applied until the window is
3132  *  actually resized, either by the user or by the compositor.
3133  *
3134  *  @thread_safety This function must only be called from the main thread.
3135  *
3136  *  @sa @ref window_sizelimits
3137  *  @sa @ref glfwSetWindowSizeLimits
3138  *
3139  *  @since Added in version 3.2.
3140  *
3141  *  @ingroup window
3142  */
3143 GLFWAPI void glfwSetWindowAspectRatio(GLFWwindow* window, int numer, int denom);
3144
3145 /*! @brief Sets the size of the content area of the specified window.
3146  *
3147  *  This function sets the size, in screen coordinates, of the content area of
3148  *  the specified window.
3149  *
3150  *  For full screen windows, this function updates the resolution of its desired
3151  *  video mode and switches to the video mode closest to it, without affecting
3152  *  the window's context.  As the context is unaffected, the bit depths of the
3153  *  framebuffer remain unchanged.
3154  *
3155  *  If you wish to update the refresh rate of the desired video mode in addition
3156  *  to its resolution, see @ref glfwSetWindowMonitor.
3157  *
3158  *  The window manager may put limits on what sizes are allowed.  GLFW cannot
3159  *  and should not override these limits.
3160  *
3161  *  @param[in] window The window to resize.
3162  *  @param[in] width The desired width, in screen coordinates, of the window
3163  *  content area.
3164  *  @param[in] height The desired height, in screen coordinates, of the window
3165  *  content area.
3166  *
3167  *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
3168  *  GLFW_PLATFORM_ERROR.
3169  *
3170  *  @remark @wayland A full screen window will not attempt to change the mode,
3171  *  no matter what the requested size.
3172  *
3173  *  @thread_safety This function must only be called from the main thread.
3174  *
3175  *  @sa @ref window_size
3176  *  @sa @ref glfwGetWindowSize
3177  *  @sa @ref glfwSetWindowMonitor
3178  *
3179  *  @since Added in version 1.0.
3180  *  @glfw3 Added window handle parameter.
3181  *
3182  *  @ingroup window
3183  */
3184 GLFWAPI void glfwSetWindowSize(GLFWwindow* window, int width, int height);
3185
3186 /*! @brief Retrieves the size of the framebuffer of the specified window.
3187  *
3188  *  This function retrieves the size, in pixels, of the framebuffer of the
3189  *  specified window.  If you wish to retrieve the size of the window in screen
3190  *  coordinates, see @ref glfwGetWindowSize.
3191  *
3192  *  Any or all of the size arguments may be `NULL`.  If an error occurs, all
3193  *  non-`NULL` size arguments will be set to zero.
3194  *
3195  *  @param[in] window The window whose framebuffer to query.
3196  *  @param[out] width Where to store the width, in pixels, of the framebuffer,
3197  *  or `NULL`.
3198  *  @param[out] height Where to store the height, in pixels, of the framebuffer,
3199  *  or `NULL`.
3200  *
3201  *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
3202  *  GLFW_PLATFORM_ERROR.
3203  *
3204  *  @thread_safety This function must only be called from the main thread.
3205  *
3206  *  @sa @ref window_fbsize
3207  *  @sa @ref glfwSetFramebufferSizeCallback
3208  *
3209  *  @since Added in version 3.0.
3210  *
3211  *  @ingroup window
3212  */
3213 GLFWAPI void glfwGetFramebufferSize(GLFWwindow* window, int* width, int* height);
3214
3215 /*! @brief Retrieves the size of the frame of the window.
3216  *
3217  *  This function retrieves the size, in screen coordinates, of each edge of the
3218  *  frame of the specified window.  This size includes the title bar, if the
3219  *  window has one.  The size of the frame may vary depending on the
3220  *  [window-related hints](@ref window_hints_wnd) used to create it.
3221  *
3222  *  Because this function retrieves the size of each window frame edge and not
3223  *  the offset along a particular coordinate axis, the retrieved values will
3224  *  always be zero or positive.
3225  *
3226  *  Any or all of the size arguments may be `NULL`.  If an error occurs, all
3227  *  non-`NULL` size arguments will be set to zero.
3228  *
3229  *  @param[in] window The window whose frame size to query.
3230  *  @param[out] left Where to store the size, in screen coordinates, of the left
3231  *  edge of the window frame, or `NULL`.
3232  *  @param[out] top Where to store the size, in screen coordinates, of the top
3233  *  edge of the window frame, or `NULL`.
3234  *  @param[out] right Where to store the size, in screen coordinates, of the
3235  *  right edge of the window frame, or `NULL`.
3236  *  @param[out] bottom Where to store the size, in screen coordinates, of the
3237  *  bottom edge of the window frame, or `NULL`.
3238  *
3239  *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
3240  *  GLFW_PLATFORM_ERROR.
3241  *
3242  *  @thread_safety This function must only be called from the main thread.
3243  *
3244  *  @sa @ref window_size
3245  *
3246  *  @since Added in version 3.1.
3247  *
3248  *  @ingroup window
3249  */
3250 GLFWAPI void glfwGetWindowFrameSize(GLFWwindow* window, int* left, int* top, int* right, int* bottom);
3251
3252 /*! @brief Retrieves the content scale for the specified window.
3253  *
3254  *  This function retrieves the content scale for the specified window.  The
3255  *  content scale is the ratio between the current DPI and the platform's
3256  *  default DPI.  This is especially important for text and any UI elements.  If
3257  *  the pixel dimensions of your UI scaled by this look appropriate on your
3258  *  machine then it should appear at a reasonable size on other machines
3259  *  regardless of their DPI and scaling settings.  This relies on the system DPI
3260  *  and scaling settings being somewhat correct.
3261  *
3262  *  On systems where each monitors can have its own content scale, the window
3263  *  content scale will depend on which monitor the system considers the window
3264  *  to be on.
3265  *
3266  *  @param[in] window The window to query.
3267  *  @param[out] xscale Where to store the x-axis content scale, or `NULL`.
3268  *  @param[out] yscale Where to store the y-axis content scale, or `NULL`.
3269  *
3270  *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
3271  *  GLFW_PLATFORM_ERROR.
3272  *
3273  *  @thread_safety This function must only be called from the main thread.
3274  *
3275  *  @sa @ref window_scale
3276  *  @sa @ref glfwSetWindowContentScaleCallback
3277  *  @sa @ref glfwGetMonitorContentScale
3278  *
3279  *  @since Added in version 3.3.
3280  *
3281  *  @ingroup window
3282  */
3283 GLFWAPI void glfwGetWindowContentScale(GLFWwindow* window, float* xscale, float* yscale);
3284
3285 /*! @brief Returns the opacity of the whole window.
3286  *
3287  *  This function returns the opacity of the window, including any decorations.
3288  *
3289  *  The opacity (or alpha) value is a positive finite number between zero and
3290  *  one, where zero is fully transparent and one is fully opaque.  If the system
3291  *  does not support whole window transparency, this function always returns one.
3292  *
3293  *  The initial opacity value for newly created windows is one.
3294  *
3295  *  @param[in] window The window to query.
3296  *  @return The opacity value of the specified window.
3297  *
3298  *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
3299  *  GLFW_PLATFORM_ERROR.
3300  *
3301  *  @thread_safety This function must only be called from the main thread.
3302  *
3303  *  @sa @ref window_transparency
3304  *  @sa @ref glfwSetWindowOpacity
3305  *
3306  *  @since Added in version 3.3.
3307  *
3308  *  @ingroup window
3309  */
3310 GLFWAPI float glfwGetWindowOpacity(GLFWwindow* window);
3311
3312 /*! @brief Sets the opacity of the whole window.
3313  *
3314  *  This function sets the opacity of the window, including any decorations.
3315  *
3316  *  The opacity (or alpha) value is a positive finite number between zero and
3317  *  one, where zero is fully transparent and one is fully opaque.
3318  *
3319  *  The initial opacity value for newly created windows is one.
3320  *
3321  *  A window created with framebuffer transparency may not use whole window
3322  *  transparency.  The results of doing this are undefined.
3323  *
3324  *  @param[in] window The window to set the opacity for.
3325  *  @param[in] opacity The desired opacity of the specified window.
3326  *
3327  *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
3328  *  GLFW_PLATFORM_ERROR and @ref GLFW_FEATURE_UNAVAILABLE (see remarks).
3329  *
3330  *  @remark @wayland There is no way to set an opacity factor for a window.
3331  *  This function will emit @ref GLFW_FEATURE_UNAVAILABLE.
3332  *
3333  *  @thread_safety This function must only be called from the main thread.
3334  *
3335  *  @sa @ref window_transparency
3336  *  @sa @ref glfwGetWindowOpacity
3337  *
3338  *  @since Added in version 3.3.
3339  *
3340  *  @ingroup window
3341  */
3342 GLFWAPI void glfwSetWindowOpacity(GLFWwindow* window, float opacity);
3343
3344 /*! @brief Iconifies the specified window.
3345  *
3346  *  This function iconifies (minimizes) the specified window if it was
3347  *  previously restored.  If the window is already iconified, this function does
3348  *  nothing.
3349  *
3350  *  If the specified window is a full screen window, the original monitor
3351  *  resolution is restored until the window is restored.
3352  *
3353  *  @param[in] window The window to iconify.
3354  *
3355  *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
3356  *  GLFW_PLATFORM_ERROR.
3357  *
3358  *  @remark @wayland Once a window is iconified, @ref glfwRestoreWindow won’t
3359  *  be able to restore it.  This is a design decision of the xdg-shell
3360  *  protocol.
3361  *
3362  *  @thread_safety This function must only be called from the main thread.
3363  *
3364  *  @sa @ref window_iconify
3365  *  @sa @ref glfwRestoreWindow
3366  *  @sa @ref glfwMaximizeWindow
3367  *
3368  *  @since Added in version 2.1.
3369  *  @glfw3 Added window handle parameter.
3370  *
3371  *  @ingroup window
3372  */
3373 GLFWAPI void glfwIconifyWindow(GLFWwindow* window);
3374
3375 /*! @brief Restores the specified window.
3376  *
3377  *  This function restores the specified window if it was previously iconified
3378  *  (minimized) or maximized.  If the window is already restored, this function
3379  *  does nothing.
3380  *
3381  *  If the specified window is a full screen window, the resolution chosen for
3382  *  the window is restored on the selected monitor.
3383  *
3384  *  @param[in] window The window to restore.
3385  *
3386  *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
3387  *  GLFW_PLATFORM_ERROR.
3388  *
3389  *  @thread_safety This function must only be called from the main thread.
3390  *
3391  *  @sa @ref window_iconify
3392  *  @sa @ref glfwIconifyWindow
3393  *  @sa @ref glfwMaximizeWindow
3394  *
3395  *  @since Added in version 2.1.
3396  *  @glfw3 Added window handle parameter.
3397  *
3398  *  @ingroup window
3399  */
3400 GLFWAPI void glfwRestoreWindow(GLFWwindow* window);
3401
3402 /*! @brief Maximizes the specified window.
3403  *
3404  *  This function maximizes the specified window if it was previously not
3405  *  maximized.  If the window is already maximized, this function does nothing.
3406  *
3407  *  If the specified window is a full screen window, this function does nothing.
3408  *
3409  *  @param[in] window The window to maximize.
3410  *
3411  *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
3412  *  GLFW_PLATFORM_ERROR.
3413  *
3414  *  @par Thread Safety
3415  *  This function may only be called from the main thread.
3416  *
3417  *  @sa @ref window_iconify
3418  *  @sa @ref glfwIconifyWindow
3419  *  @sa @ref glfwRestoreWindow
3420  *
3421  *  @since Added in GLFW 3.2.
3422  *
3423  *  @ingroup window
3424  */
3425 GLFWAPI void glfwMaximizeWindow(GLFWwindow* window);
3426
3427 /*! @brief Makes the specified window visible.
3428  *
3429  *  This function makes the specified window visible if it was previously
3430  *  hidden.  If the window is already visible or is in full screen mode, this
3431  *  function does nothing.
3432  *
3433  *  By default, windowed mode windows are focused when shown
3434  *  Set the [GLFW_FOCUS_ON_SHOW](@ref GLFW_FOCUS_ON_SHOW_hint) window hint
3435  *  to change this behavior for all newly created windows, or change the
3436  *  behavior for an existing window with @ref glfwSetWindowAttrib.
3437  *
3438  *  @param[in] window The window to make visible.
3439  *
3440  *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
3441  *  GLFW_PLATFORM_ERROR.
3442  *
3443  *  @thread_safety This function must only be called from the main thread.
3444  *
3445  *  @sa @ref window_hide
3446  *  @sa @ref glfwHideWindow
3447  *
3448  *  @since Added in version 3.0.
3449  *
3450  *  @ingroup window
3451  */
3452 GLFWAPI void glfwShowWindow(GLFWwindow* window);
3453
3454 /*! @brief Hides the specified window.
3455  *
3456  *  This function hides the specified window if it was previously visible.  If
3457  *  the window is already hidden or is in full screen mode, this function does
3458  *  nothing.
3459  *
3460  *  @param[in] window The window to hide.
3461  *
3462  *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
3463  *  GLFW_PLATFORM_ERROR.
3464  *
3465  *  @thread_safety This function must only be called from the main thread.
3466  *
3467  *  @sa @ref window_hide
3468  *  @sa @ref glfwShowWindow
3469  *
3470  *  @since Added in version 3.0.
3471  *
3472  *  @ingroup window
3473  */
3474 GLFWAPI void glfwHideWindow(GLFWwindow* window);
3475
3476 /*! @brief Brings the specified window to front and sets input focus.
3477  *
3478  *  This function brings the specified window to front and sets input focus.
3479  *  The window should already be visible and not iconified.
3480  *
3481  *  By default, both windowed and full screen mode windows are focused when
3482  *  initially created.  Set the [GLFW_FOCUSED](@ref GLFW_FOCUSED_hint) to
3483  *  disable this behavior.
3484  *
3485  *  Also by default, windowed mode windows are focused when shown
3486  *  with @ref glfwShowWindow. Set the
3487  *  [GLFW_FOCUS_ON_SHOW](@ref GLFW_FOCUS_ON_SHOW_hint) to disable this behavior.
3488  *
3489  *  __Do not use this function__ to steal focus from other applications unless
3490  *  you are certain that is what the user wants.  Focus stealing can be
3491  *  extremely disruptive.
3492  *
3493  *  For a less disruptive way of getting the user's attention, see
3494  *  [attention requests](@ref window_attention).
3495  *
3496  *  @param[in] window The window to give input focus.
3497  *
3498  *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
3499  *  GLFW_PLATFORM_ERROR and @ref GLFW_FEATURE_UNAVAILABLE (see remarks).
3500  *
3501  *  @remark @wayland It is not possible for an application to set the input
3502  *  focus.  This function will emit @ref GLFW_FEATURE_UNAVAILABLE.
3503  *
3504  *  @thread_safety This function must only be called from the main thread.
3505  *
3506  *  @sa @ref window_focus
3507  *  @sa @ref window_attention
3508  *
3509  *  @since Added in version 3.2.
3510  *
3511  *  @ingroup window
3512  */
3513 GLFWAPI void glfwFocusWindow(GLFWwindow* window);
3514
3515 /*! @brief Requests user attention to the specified window.
3516  *
3517  *  This function requests user attention to the specified window.  On
3518  *  platforms where this is not supported, attention is requested to the
3519  *  application as a whole.
3520  *
3521  *  Once the user has given attention, usually by focusing the window or
3522  *  application, the system will end the request automatically.
3523  *
3524  *  @param[in] window The window to request attention to.
3525  *
3526  *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
3527  *  GLFW_PLATFORM_ERROR.
3528  *
3529  *  @remark @macos Attention is requested to the application as a whole, not the
3530  *  specific window.
3531  *
3532  *  @thread_safety This function must only be called from the main thread.
3533  *
3534  *  @sa @ref window_attention
3535  *
3536  *  @since Added in version 3.3.
3537  *
3538  *  @ingroup window
3539  */
3540 GLFWAPI void glfwRequestWindowAttention(GLFWwindow* window);
3541
3542 /*! @brief Returns the monitor that the window uses for full screen mode.
3543  *
3544  *  This function returns the handle of the monitor that the specified window is
3545  *  in full screen on.
3546  *
3547  *  @param[in] window The window to query.
3548  *  @return The monitor, or `NULL` if the window is in windowed mode or an
3549  *  [error](@ref error_handling) occurred.
3550  *
3551  *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
3552  *
3553  *  @thread_safety This function must only be called from the main thread.
3554  *
3555  *  @sa @ref window_monitor
3556  *  @sa @ref glfwSetWindowMonitor
3557  *
3558  *  @since Added in version 3.0.
3559  *
3560  *  @ingroup window
3561  */
3562 GLFWAPI GLFWmonitor* glfwGetWindowMonitor(GLFWwindow* window);
3563
3564 /*! @brief Sets the mode, monitor, video mode and placement of a window.
3565  *
3566  *  This function sets the monitor that the window uses for full screen mode or,
3567  *  if the monitor is `NULL`, makes it windowed mode.
3568  *
3569  *  When setting a monitor, this function updates the width, height and refresh
3570  *  rate of the desired video mode and switches to the video mode closest to it.
3571  *  The window position is ignored when setting a monitor.
3572  *
3573  *  When the monitor is `NULL`, the position, width and height are used to
3574  *  place the window content area.  The refresh rate is ignored when no monitor
3575  *  is specified.
3576  *
3577  *  If you only wish to update the resolution of a full screen window or the
3578  *  size of a windowed mode window, see @ref glfwSetWindowSize.
3579  *
3580  *  When a window transitions from full screen to windowed mode, this function
3581  *  restores any previous window settings such as whether it is decorated,
3582  *  floating, resizable, has size or aspect ratio limits, etc.
3583  *
3584  *  @param[in] window The window whose monitor, size or video mode to set.
3585  *  @param[in] monitor The desired monitor, or `NULL` to set windowed mode.
3586  *  @param[in] xpos The desired x-coordinate of the upper-left corner of the
3587  *  content area.
3588  *  @param[in] ypos The desired y-coordinate of the upper-left corner of the
3589  *  content area.
3590  *  @param[in] width The desired with, in screen coordinates, of the content
3591  *  area or video mode.
3592  *  @param[in] height The desired height, in screen coordinates, of the content
3593  *  area or video mode.
3594  *  @param[in] refreshRate The desired refresh rate, in Hz, of the video mode,
3595  *  or `GLFW_DONT_CARE`.
3596  *
3597  *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
3598  *  GLFW_PLATFORM_ERROR.
3599  *
3600  *  @remark The OpenGL or OpenGL ES context will not be destroyed or otherwise
3601  *  affected by any resizing or mode switching, although you may need to update
3602  *  your viewport if the framebuffer size has changed.
3603  *
3604  *  @remark @wayland The desired window position is ignored, as there is no way
3605  *  for an application to set this property.
3606  *
3607  *  @remark @wayland Setting the window to full screen will not attempt to
3608  *  change the mode, no matter what the requested size or refresh rate.
3609  *
3610  *  @thread_safety This function must only be called from the main thread.
3611  *
3612  *  @sa @ref window_monitor
3613  *  @sa @ref window_full_screen
3614  *  @sa @ref glfwGetWindowMonitor
3615  *  @sa @ref glfwSetWindowSize
3616  *
3617  *  @since Added in version 3.2.
3618  *
3619  *  @ingroup window
3620  */
3621 GLFWAPI void glfwSetWindowMonitor(GLFWwindow* window, GLFWmonitor* monitor, int xpos, int ypos, int width, int height, int refreshRate);
3622
3623 /*! @brief Returns an attribute of the specified window.
3624  *
3625  *  This function returns the value of an attribute of the specified window or
3626  *  its OpenGL or OpenGL ES context.
3627  *
3628  *  @param[in] window The window to query.
3629  *  @param[in] attrib The [window attribute](@ref window_attribs) whose value to
3630  *  return.
3631  *  @return The value of the attribute, or zero if an
3632  *  [error](@ref error_handling) occurred.
3633  *
3634  *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
3635  *  GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR.
3636  *
3637  *  @remark Framebuffer related hints are not window attributes.  See @ref
3638  *  window_attribs_fb for more information.
3639  *
3640  *  @remark Zero is a valid value for many window and context related
3641  *  attributes so you cannot use a return value of zero as an indication of
3642  *  errors.  However, this function should not fail as long as it is passed
3643  *  valid arguments and the library has been [initialized](@ref intro_init).
3644  *
3645  *  @thread_safety This function must only be called from the main thread.
3646  *
3647  *  @sa @ref window_attribs
3648  *  @sa @ref glfwSetWindowAttrib
3649  *
3650  *  @since Added in version 3.0.  Replaces `glfwGetWindowParam` and
3651  *  `glfwGetGLVersion`.
3652  *
3653  *  @ingroup window
3654  */
3655 GLFWAPI int glfwGetWindowAttrib(GLFWwindow* window, int attrib);
3656
3657 /*! @brief Sets an attribute of the specified window.
3658  *
3659  *  This function sets the value of an attribute of the specified window.
3660  *
3661  *  The supported attributes are [GLFW_DECORATED](@ref GLFW_DECORATED_attrib),
3662  *  [GLFW_RESIZABLE](@ref GLFW_RESIZABLE_attrib),
3663  *  [GLFW_FLOATING](@ref GLFW_FLOATING_attrib),
3664  *  [GLFW_AUTO_ICONIFY](@ref GLFW_AUTO_ICONIFY_attrib) and
3665  *  [GLFW_FOCUS_ON_SHOW](@ref GLFW_FOCUS_ON_SHOW_attrib).
3666  *  [GLFW_MOUSE_PASSTHROUGH](@ref GLFW_MOUSE_PASSTHROUGH_attrib)
3667  *
3668  *  Some of these attributes are ignored for full screen windows.  The new
3669  *  value will take effect if the window is later made windowed.
3670  *
3671  *  Some of these attributes are ignored for windowed mode windows.  The new
3672  *  value will take effect if the window is later made full screen.
3673  *
3674  *  @param[in] window The window to set the attribute for.
3675  *  @param[in] attrib A supported window attribute.
3676  *  @param[in] value `GLFW_TRUE` or `GLFW_FALSE`.
3677  *
3678  *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
3679  *  GLFW_INVALID_ENUM, @ref GLFW_INVALID_VALUE and @ref GLFW_PLATFORM_ERROR.
3680  *
3681  *  @remark Calling @ref glfwGetWindowAttrib will always return the latest
3682  *  value, even if that value is ignored by the current mode of the window.
3683  *
3684  *  @thread_safety This function must only be called from the main thread.
3685  *
3686  *  @sa @ref window_attribs
3687  *  @sa @ref glfwGetWindowAttrib
3688  *
3689  *  @since Added in version 3.3.
3690  *
3691  *  @ingroup window
3692  */
3693 GLFWAPI void glfwSetWindowAttrib(GLFWwindow* window, int attrib, int value);
3694
3695 /*! @brief Sets the user pointer of the specified window.
3696  *
3697  *  This function sets the user-defined pointer of the specified window.  The
3698  *  current value is retained until the window is destroyed.  The initial value
3699  *  is `NULL`.
3700  *
3701  *  @param[in] window The window whose pointer to set.
3702  *  @param[in] pointer The new value.
3703  *
3704  *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
3705  *
3706  *  @thread_safety This function may be called from any thread.  Access is not
3707  *  synchronized.
3708  *
3709  *  @sa @ref window_userptr
3710  *  @sa @ref glfwGetWindowUserPointer
3711  *
3712  *  @since Added in version 3.0.
3713  *
3714  *  @ingroup window
3715  */
3716 GLFWAPI void glfwSetWindowUserPointer(GLFWwindow* window, void* pointer);
3717
3718 /*! @brief Returns the user pointer of the specified window.
3719  *
3720  *  This function returns the current value of the user-defined pointer of the
3721  *  specified window.  The initial value is `NULL`.
3722  *
3723  *  @param[in] window The window whose pointer to return.
3724  *
3725  *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
3726  *
3727  *  @thread_safety This function may be called from any thread.  Access is not
3728  *  synchronized.
3729  *
3730  *  @sa @ref window_userptr
3731  *  @sa @ref glfwSetWindowUserPointer
3732  *
3733  *  @since Added in version 3.0.
3734  *
3735  *  @ingroup window
3736  */
3737 GLFWAPI void* glfwGetWindowUserPointer(GLFWwindow* window);
3738
3739 /*! @brief Sets the position callback for the specified window.
3740  *
3741  *  This function sets the position callback of the specified window, which is
3742  *  called when the window is moved.  The callback is provided with the
3743  *  position, in screen coordinates, of the upper-left corner of the content
3744  *  area of the window.
3745  *
3746  *  @param[in] window The window whose callback to set.
3747  *  @param[in] callback The new callback, or `NULL` to remove the currently set
3748  *  callback.
3749  *  @return The previously set callback, or `NULL` if no callback was set or the
3750  *  library had not been [initialized](@ref intro_init).
3751  *
3752  *  @callback_signature
3753  *  @code
3754  *  void function_name(GLFWwindow* window, int xpos, int ypos)
3755  *  @endcode
3756  *  For more information about the callback parameters, see the
3757  *  [function pointer type](@ref GLFWwindowposfun).
3758  *
3759  *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
3760  *
3761  *  @remark @wayland This callback will never be called, as there is no way for
3762  *  an application to know its global position.
3763  *
3764  *  @thread_safety This function must only be called from the main thread.
3765  *
3766  *  @sa @ref window_pos
3767  *
3768  *  @since Added in version 3.0.
3769  *
3770  *  @ingroup window
3771  */
3772 GLFWAPI GLFWwindowposfun glfwSetWindowPosCallback(GLFWwindow* window, GLFWwindowposfun callback);
3773
3774 /*! @brief Sets the size callback for the specified window.
3775  *
3776  *  This function sets the size callback of the specified window, which is
3777  *  called when the window is resized.  The callback is provided with the size,
3778  *  in screen coordinates, of the content area of the window.
3779  *
3780  *  @param[in] window The window whose callback to set.
3781  *  @param[in] callback The new callback, or `NULL` to remove the currently set
3782  *  callback.
3783  *  @return The previously set callback, or `NULL` if no callback was set or the
3784  *  library had not been [initialized](@ref intro_init).
3785  *
3786  *  @callback_signature
3787  *  @code
3788  *  void function_name(GLFWwindow* window, int width, int height)
3789  *  @endcode
3790  *  For more information about the callback parameters, see the
3791  *  [function pointer type](@ref GLFWwindowsizefun).
3792  *
3793  *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
3794  *
3795  *  @thread_safety This function must only be called from the main thread.
3796  *
3797  *  @sa @ref window_size
3798  *
3799  *  @since Added in version 1.0.
3800  *  @glfw3 Added window handle parameter and return value.
3801  *
3802  *  @ingroup window
3803  */
3804 GLFWAPI GLFWwindowsizefun glfwSetWindowSizeCallback(GLFWwindow* window, GLFWwindowsizefun callback);
3805
3806 /*! @brief Sets the close callback for the specified window.
3807  *
3808  *  This function sets the close callback of the specified window, which is
3809  *  called when the user attempts to close the window, for example by clicking
3810  *  the close widget in the title bar.
3811  *
3812  *  The close flag is set before this callback is called, but you can modify it
3813  *  at any time with @ref glfwSetWindowShouldClose.
3814  *
3815  *  The close callback is not triggered by @ref glfwDestroyWindow.
3816  *
3817  *  @param[in] window The window whose callback to set.
3818  *  @param[in] callback The new callback, or `NULL` to remove the currently set
3819  *  callback.
3820  *  @return The previously set callback, or `NULL` if no callback was set or the
3821  *  library had not been [initialized](@ref intro_init).
3822  *
3823  *  @callback_signature
3824  *  @code
3825  *  void function_name(GLFWwindow* window)
3826  *  @endcode
3827  *  For more information about the callback parameters, see the
3828  *  [function pointer type](@ref GLFWwindowclosefun).
3829  *
3830  *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
3831  *
3832  *  @remark @macos Selecting Quit from the application menu will trigger the
3833  *  close callback for all windows.
3834  *
3835  *  @thread_safety This function must only be called from the main thread.
3836  *
3837  *  @sa @ref window_close
3838  *
3839  *  @since Added in version 2.5.
3840  *  @glfw3 Added window handle parameter and return value.
3841  *
3842  *  @ingroup window
3843  */
3844 GLFWAPI GLFWwindowclosefun glfwSetWindowCloseCallback(GLFWwindow* window, GLFWwindowclosefun callback);
3845
3846 /*! @brief Sets the refresh callback for the specified window.
3847  *
3848  *  This function sets the refresh callback of the specified window, which is
3849  *  called when the content area of the window needs to be redrawn, for example
3850  *  if the window has been exposed after having been covered by another window.
3851  *
3852  *  On compositing window systems such as Aero, Compiz, Aqua or Wayland, where
3853  *  the window contents are saved off-screen, this callback may be called only
3854  *  very infrequently or never at all.
3855  *
3856  *  @param[in] window The window whose callback to set.
3857  *  @param[in] callback The new callback, or `NULL` to remove the currently set
3858  *  callback.
3859  *  @return The previously set callback, or `NULL` if no callback was set or the
3860  *  library had not been [initialized](@ref intro_init).
3861  *
3862  *  @callback_signature
3863  *  @code
3864  *  void function_name(GLFWwindow* window);
3865  *  @endcode
3866  *  For more information about the callback parameters, see the
3867  *  [function pointer type](@ref GLFWwindowrefreshfun).
3868  *
3869  *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
3870  *
3871  *  @thread_safety This function must only be called from the main thread.
3872  *
3873  *  @sa @ref window_refresh
3874  *
3875  *  @since Added in version 2.5.
3876  *  @glfw3 Added window handle parameter and return value.
3877  *
3878  *  @ingroup window
3879  */
3880 GLFWAPI GLFWwindowrefreshfun glfwSetWindowRefreshCallback(GLFWwindow* window, GLFWwindowrefreshfun callback);
3881
3882 /*! @brief Sets the focus callback for the specified window.
3883  *
3884  *  This function sets the focus callback of the specified window, which is
3885  *  called when the window gains or loses input focus.
3886  *
3887  *  After the focus callback is called for a window that lost input focus,
3888  *  synthetic key and mouse button release events will be generated for all such
3889  *  that had been pressed.  For more information, see @ref glfwSetKeyCallback
3890  *  and @ref glfwSetMouseButtonCallback.
3891  *
3892  *  @param[in] window The window whose callback to set.
3893  *  @param[in] callback The new callback, or `NULL` to remove the currently set
3894  *  callback.
3895  *  @return The previously set callback, or `NULL` if no callback was set or the
3896  *  library had not been [initialized](@ref intro_init).
3897  *
3898  *  @callback_signature
3899  *  @code
3900  *  void function_name(GLFWwindow* window, int focused)
3901  *  @endcode
3902  *  For more information about the callback parameters, see the
3903  *  [function pointer type](@ref GLFWwindowfocusfun).
3904  *
3905  *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
3906  *
3907  *  @thread_safety This function must only be called from the main thread.
3908  *
3909  *  @sa @ref window_focus
3910  *
3911  *  @since Added in version 3.0.
3912  *
3913  *  @ingroup window
3914  */
3915 GLFWAPI GLFWwindowfocusfun glfwSetWindowFocusCallback(GLFWwindow* window, GLFWwindowfocusfun callback);
3916
3917 /*! @brief Sets the iconify callback for the specified window.
3918  *
3919  *  This function sets the iconification callback of the specified window, which
3920  *  is called when the window is iconified or restored.
3921  *
3922  *  @param[in] window The window whose callback to set.
3923  *  @param[in] callback The new callback, or `NULL` to remove the currently set
3924  *  callback.
3925  *  @return The previously set callback, or `NULL` if no callback was set or the
3926  *  library had not been [initialized](@ref intro_init).
3927  *
3928  *  @callback_signature
3929  *  @code
3930  *  void function_name(GLFWwindow* window, int iconified)
3931  *  @endcode
3932  *  For more information about the callback parameters, see the
3933  *  [function pointer type](@ref GLFWwindowiconifyfun).
3934  *
3935  *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
3936  *
3937  *  @thread_safety This function must only be called from the main thread.
3938  *
3939  *  @sa @ref window_iconify
3940  *
3941  *  @since Added in version 3.0.
3942  *
3943  *  @ingroup window
3944  */
3945 GLFWAPI GLFWwindowiconifyfun glfwSetWindowIconifyCallback(GLFWwindow* window, GLFWwindowiconifyfun callback);
3946
3947 /*! @brief Sets the maximize callback for the specified window.
3948  *
3949  *  This function sets the maximization callback of the specified window, which
3950  *  is called when the window is maximized or restored.
3951  *
3952  *  @param[in] window The window whose callback to set.
3953  *  @param[in] callback The new callback, or `NULL` to remove the currently set
3954  *  callback.
3955  *  @return The previously set callback, or `NULL` if no callback was set or the
3956  *  library had not been [initialized](@ref intro_init).
3957  *
3958  *  @callback_signature
3959  *  @code
3960  *  void function_name(GLFWwindow* window, int maximized)
3961  *  @endcode
3962  *  For more information about the callback parameters, see the
3963  *  [function pointer type](@ref GLFWwindowmaximizefun).
3964  *
3965  *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
3966  *
3967  *  @thread_safety This function must only be called from the main thread.
3968  *
3969  *  @sa @ref window_maximize
3970  *
3971  *  @since Added in version 3.3.
3972  *
3973  *  @ingroup window
3974  */
3975 GLFWAPI GLFWwindowmaximizefun glfwSetWindowMaximizeCallback(GLFWwindow* window, GLFWwindowmaximizefun callback);
3976
3977 /*! @brief Sets the framebuffer resize callback for the specified window.
3978  *
3979  *  This function sets the framebuffer resize callback of the specified window,
3980  *  which is called when the framebuffer of the specified window is resized.
3981  *
3982  *  @param[in] window The window whose callback to set.
3983  *  @param[in] callback The new callback, or `NULL` to remove the currently set
3984  *  callback.
3985  *  @return The previously set callback, or `NULL` if no callback was set or the
3986  *  library had not been [initialized](@ref intro_init).
3987  *
3988  *  @callback_signature
3989  *  @code
3990  *  void function_name(GLFWwindow* window, int width, int height)
3991  *  @endcode
3992  *  For more information about the callback parameters, see the
3993  *  [function pointer type](@ref GLFWframebuffersizefun).
3994  *
3995  *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
3996  *
3997  *  @thread_safety This function must only be called from the main thread.
3998  *
3999  *  @sa @ref window_fbsize
4000  *
4001  *  @since Added in version 3.0.
4002  *
4003  *  @ingroup window
4004  */
4005 GLFWAPI GLFWframebuffersizefun glfwSetFramebufferSizeCallback(GLFWwindow* window, GLFWframebuffersizefun callback);
4006
4007 /*! @brief Sets the window content scale callback for the specified window.
4008  *
4009  *  This function sets the window content scale callback of the specified window,
4010  *  which is called when the content scale of the specified window changes.
4011  *
4012  *  @param[in] window The window whose callback to set.
4013  *  @param[in] callback The new callback, or `NULL` to remove the currently set
4014  *  callback.
4015  *  @return The previously set callback, or `NULL` if no callback was set or the
4016  *  library had not been [initialized](@ref intro_init).
4017  *
4018  *  @callback_signature
4019  *  @code
4020  *  void function_name(GLFWwindow* window, float xscale, float yscale)
4021  *  @endcode
4022  *  For more information about the callback parameters, see the
4023  *  [function pointer type](@ref GLFWwindowcontentscalefun).
4024  *
4025  *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
4026  *
4027  *  @thread_safety This function must only be called from the main thread.
4028  *
4029  *  @sa @ref window_scale
4030  *  @sa @ref glfwGetWindowContentScale
4031  *
4032  *  @since Added in version 3.3.
4033  *
4034  *  @ingroup window
4035  */
4036 GLFWAPI GLFWwindowcontentscalefun glfwSetWindowContentScaleCallback(GLFWwindow* window, GLFWwindowcontentscalefun callback);
4037
4038 /*! @brief Processes all pending events.
4039  *
4040  *  This function processes only those events that are already in the event
4041  *  queue and then returns immediately.  Processing events will cause the window
4042  *  and input callbacks associated with those events to be called.
4043  *
4044  *  On some platforms, a window move, resize or menu operation will cause event
4045  *  processing to block.  This is due to how event processing is designed on
4046  *  those platforms.  You can use the
4047  *  [window refresh callback](@ref window_refresh) to redraw the contents of
4048  *  your window when necessary during such operations.
4049  *
4050  *  Do not assume that callbacks you set will _only_ be called in response to
4051  *  event processing functions like this one.  While it is necessary to poll for
4052  *  events, window systems that require GLFW to register callbacks of its own
4053  *  can pass events to GLFW in response to many window system function calls.
4054  *  GLFW will pass those events on to the application callbacks before
4055  *  returning.
4056  *
4057  *  Event processing is not required for joystick input to work.
4058  *
4059  *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
4060  *  GLFW_PLATFORM_ERROR.
4061  *
4062  *  @reentrancy This function must not be called from a callback.
4063  *
4064  *  @thread_safety This function must only be called from the main thread.
4065  *
4066  *  @sa @ref events
4067  *  @sa @ref glfwWaitEvents
4068  *  @sa @ref glfwWaitEventsTimeout
4069  *
4070  *  @since Added in version 1.0.
4071  *
4072  *  @ingroup window
4073  */
4074 GLFWAPI void glfwPollEvents(void);
4075
4076 /*! @brief Waits until events are queued and processes them.
4077  *
4078  *  This function puts the calling thread to sleep until at least one event is
4079  *  available in the event queue.  Once one or more events are available,
4080  *  it behaves exactly like @ref glfwPollEvents, i.e. the events in the queue
4081  *  are processed and the function then returns immediately.  Processing events
4082  *  will cause the window and input callbacks associated with those events to be
4083  *  called.
4084  *
4085  *  Since not all events are associated with callbacks, this function may return
4086  *  without a callback having been called even if you are monitoring all
4087  *  callbacks.
4088  *
4089  *  On some platforms, a window move, resize or menu operation will cause event
4090  *  processing to block.  This is due to how event processing is designed on
4091  *  those platforms.  You can use the
4092  *  [window refresh callback](@ref window_refresh) to redraw the contents of
4093  *  your window when necessary during such operations.
4094  *
4095  *  Do not assume that callbacks you set will _only_ be called in response to
4096  *  event processing functions like this one.  While it is necessary to poll for
4097  *  events, window systems that require GLFW to register callbacks of its own
4098  *  can pass events to GLFW in response to many window system function calls.
4099  *  GLFW will pass those events on to the application callbacks before
4100  *  returning.
4101  *
4102  *  Event processing is not required for joystick input to work.
4103  *
4104  *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
4105  *  GLFW_PLATFORM_ERROR.
4106  *
4107  *  @reentrancy This function must not be called from a callback.
4108  *
4109  *  @thread_safety This function must only be called from the main thread.
4110  *
4111  *  @sa @ref events
4112  *  @sa @ref glfwPollEvents
4113  *  @sa @ref glfwWaitEventsTimeout
4114  *
4115  *  @since Added in version 2.5.
4116  *
4117  *  @ingroup window
4118  */
4119 GLFWAPI void glfwWaitEvents(void);
4120
4121 /*! @brief Waits with timeout until events are queued and processes them.
4122  *
4123  *  This function puts the calling thread to sleep until at least one event is
4124  *  available in the event queue, or until the specified timeout is reached.  If
4125  *  one or more events are available, it behaves exactly like @ref
4126  *  glfwPollEvents, i.e. the events in the queue are processed and the function
4127  *  then returns immediately.  Processing events will cause the window and input
4128  *  callbacks associated with those events to be called.
4129  *
4130  *  The timeout value must be a positive finite number.
4131  *
4132  *  Since not all events are associated with callbacks, this function may return
4133  *  without a callback having been called even if you are monitoring all
4134  *  callbacks.
4135  *
4136  *  On some platforms, a window move, resize or menu operation will cause event
4137  *  processing to block.  This is due to how event processing is designed on
4138  *  those platforms.  You can use the
4139  *  [window refresh callback](@ref window_refresh) to redraw the contents of
4140  *  your window when necessary during such operations.
4141  *
4142  *  Do not assume that callbacks you set will _only_ be called in response to
4143  *  event processing functions like this one.  While it is necessary to poll for
4144  *  events, window systems that require GLFW to register callbacks of its own
4145  *  can pass events to GLFW in response to many window system function calls.
4146  *  GLFW will pass those events on to the application callbacks before
4147  *  returning.
4148  *
4149  *  Event processing is not required for joystick input to work.
4150  *
4151  *  @param[in] timeout The maximum amount of time, in seconds, to wait.
4152  *
4153  *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
4154  *  GLFW_INVALID_VALUE and @ref GLFW_PLATFORM_ERROR.
4155  *
4156  *  @reentrancy This function must not be called from a callback.
4157  *
4158  *  @thread_safety This function must only be called from the main thread.
4159  *
4160  *  @sa @ref events
4161  *  @sa @ref glfwPollEvents
4162  *  @sa @ref glfwWaitEvents
4163  *
4164  *  @since Added in version 3.2.
4165  *
4166  *  @ingroup window
4167  */
4168 GLFWAPI void glfwWaitEventsTimeout(double timeout);
4169
4170 /*! @brief Posts an empty event to the event queue.
4171  *
4172  *  This function posts an empty event from the current thread to the event
4173  *  queue, causing @ref glfwWaitEvents or @ref glfwWaitEventsTimeout to return.
4174  *
4175  *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
4176  *  GLFW_PLATFORM_ERROR.
4177  *
4178  *  @thread_safety This function may be called from any thread.
4179  *
4180  *  @sa @ref events
4181  *  @sa @ref glfwWaitEvents
4182  *  @sa @ref glfwWaitEventsTimeout
4183  *
4184  *  @since Added in version 3.1.
4185  *
4186  *  @ingroup window
4187  */
4188 GLFWAPI void glfwPostEmptyEvent(void);
4189
4190 /*! @brief Returns the value of an input option for the specified window.
4191  *
4192  *  This function returns the value of an input option for the specified window.
4193  *  The mode must be one of @ref GLFW_CURSOR, @ref GLFW_STICKY_KEYS,
4194  *  @ref GLFW_STICKY_MOUSE_BUTTONS, @ref GLFW_LOCK_KEY_MODS or
4195  *  @ref GLFW_RAW_MOUSE_MOTION.
4196  *
4197  *  @param[in] window The window to query.
4198  *  @param[in] mode One of `GLFW_CURSOR`, `GLFW_STICKY_KEYS`,
4199  *  `GLFW_STICKY_MOUSE_BUTTONS`, `GLFW_LOCK_KEY_MODS` or
4200  *  `GLFW_RAW_MOUSE_MOTION`.
4201  *
4202  *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
4203  *  GLFW_INVALID_ENUM.
4204  *
4205  *  @thread_safety This function must only be called from the main thread.
4206  *
4207  *  @sa @ref glfwSetInputMode
4208  *
4209  *  @since Added in version 3.0.
4210  *
4211  *  @ingroup input
4212  */
4213 GLFWAPI int glfwGetInputMode(GLFWwindow* window, int mode);
4214
4215 /*! @brief Sets an input option for the specified window.
4216  *
4217  *  This function sets an input mode option for the specified window.  The mode
4218  *  must be one of @ref GLFW_CURSOR, @ref GLFW_STICKY_KEYS,
4219  *  @ref GLFW_STICKY_MOUSE_BUTTONS, @ref GLFW_LOCK_KEY_MODS or
4220  *  @ref GLFW_RAW_MOUSE_MOTION.
4221  *
4222  *  If the mode is `GLFW_CURSOR`, the value must be one of the following cursor
4223  *  modes:
4224  *  - `GLFW_CURSOR_NORMAL` makes the cursor visible and behaving normally.
4225  *  - `GLFW_CURSOR_HIDDEN` makes the cursor invisible when it is over the
4226  *    content area of the window but does not restrict the cursor from leaving.
4227  *  - `GLFW_CURSOR_DISABLED` hides and grabs the cursor, providing virtual
4228  *    and unlimited cursor movement.  This is useful for implementing for
4229  *    example 3D camera controls.
4230  *
4231  *  If the mode is `GLFW_STICKY_KEYS`, the value must be either `GLFW_TRUE` to
4232  *  enable sticky keys, or `GLFW_FALSE` to disable it.  If sticky keys are
4233  *  enabled, a key press will ensure that @ref glfwGetKey returns `GLFW_PRESS`
4234  *  the next time it is called even if the key had been released before the
4235  *  call.  This is useful when you are only interested in whether keys have been
4236  *  pressed but not when or in which order.
4237  *
4238  *  If the mode is `GLFW_STICKY_MOUSE_BUTTONS`, the value must be either
4239  *  `GLFW_TRUE` to enable sticky mouse buttons, or `GLFW_FALSE` to disable it.
4240  *  If sticky mouse buttons are enabled, a mouse button press will ensure that
4241  *  @ref glfwGetMouseButton returns `GLFW_PRESS` the next time it is called even
4242  *  if the mouse button had been released before the call.  This is useful when
4243  *  you are only interested in whether mouse buttons have been pressed but not
4244  *  when or in which order.
4245  *
4246  *  If the mode is `GLFW_LOCK_KEY_MODS`, the value must be either `GLFW_TRUE` to
4247  *  enable lock key modifier bits, or `GLFW_FALSE` to disable them.  If enabled,
4248  *  callbacks that receive modifier bits will also have the @ref
4249  *  GLFW_MOD_CAPS_LOCK bit set when the event was generated with Caps Lock on,
4250  *  and the @ref GLFW_MOD_NUM_LOCK bit when Num Lock was on.
4251  *
4252  *  If the mode is `GLFW_RAW_MOUSE_MOTION`, the value must be either `GLFW_TRUE`
4253  *  to enable raw (unscaled and unaccelerated) mouse motion when the cursor is
4254  *  disabled, or `GLFW_FALSE` to disable it.  If raw motion is not supported,
4255  *  attempting to set this will emit @ref GLFW_FEATURE_UNAVAILABLE.  Call @ref
4256  *  glfwRawMouseMotionSupported to check for support.
4257  *
4258  *  @param[in] window The window whose input mode to set.
4259  *  @param[in] mode One of `GLFW_CURSOR`, `GLFW_STICKY_KEYS`,
4260  *  `GLFW_STICKY_MOUSE_BUTTONS`, `GLFW_LOCK_KEY_MODS` or
4261  *  `GLFW_RAW_MOUSE_MOTION`.
4262  *  @param[in] value The new value of the specified input mode.
4263  *
4264  *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
4265  *  GLFW_INVALID_ENUM, @ref GLFW_PLATFORM_ERROR and @ref
4266  *  GLFW_FEATURE_UNAVAILABLE (see above).
4267  *
4268  *  @thread_safety This function must only be called from the main thread.
4269  *
4270  *  @sa @ref glfwGetInputMode
4271  *
4272  *  @since Added in version 3.0.  Replaces `glfwEnable` and `glfwDisable`.
4273  *
4274  *  @ingroup input
4275  */
4276 GLFWAPI void glfwSetInputMode(GLFWwindow* window, int mode, int value);
4277
4278 /*! @brief Returns whether raw mouse motion is supported.
4279  *
4280  *  This function returns whether raw mouse motion is supported on the current
4281  *  system.  This status does not change after GLFW has been initialized so you
4282  *  only need to check this once.  If you attempt to enable raw motion on
4283  *  a system that does not support it, @ref GLFW_PLATFORM_ERROR will be emitted.
4284  *
4285  *  Raw mouse motion is closer to the actual motion of the mouse across
4286  *  a surface.  It is not affected by the scaling and acceleration applied to
4287  *  the motion of the desktop cursor.  That processing is suitable for a cursor
4288  *  while raw motion is better for controlling for example a 3D camera.  Because
4289  *  of this, raw mouse motion is only provided when the cursor is disabled.
4290  *
4291  *  @return `GLFW_TRUE` if raw mouse motion is supported on the current machine,
4292  *  or `GLFW_FALSE` otherwise.
4293  *
4294  *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
4295  *
4296  *  @thread_safety This function must only be called from the main thread.
4297  *
4298  *  @sa @ref raw_mouse_motion
4299  *  @sa @ref glfwSetInputMode
4300  *
4301  *  @since Added in version 3.3.
4302  *
4303  *  @ingroup input
4304  */
4305 GLFWAPI int glfwRawMouseMotionSupported(void);
4306
4307 /*! @brief Returns the layout-specific name of the specified printable key.
4308  *
4309  *  This function returns the name of the specified printable key, encoded as
4310  *  UTF-8.  This is typically the character that key would produce without any
4311  *  modifier keys, intended for displaying key bindings to the user.  For dead
4312  *  keys, it is typically the diacritic it would add to a character.
4313  *
4314  *  __Do not use this function__ for [text input](@ref input_char).  You will
4315  *  break text input for many languages even if it happens to work for yours.
4316  *
4317  *  If the key is `GLFW_KEY_UNKNOWN`, the scancode is used to identify the key,
4318  *  otherwise the scancode is ignored.  If you specify a non-printable key, or
4319  *  `GLFW_KEY_UNKNOWN` and a scancode that maps to a non-printable key, this
4320  *  function returns `NULL` but does not emit an error.
4321  *
4322  *  This behavior allows you to always pass in the arguments in the
4323  *  [key callback](@ref input_key) without modification.
4324  *
4325  *  The printable keys are:
4326  *  - `GLFW_KEY_APOSTROPHE`
4327  *  - `GLFW_KEY_COMMA`
4328  *  - `GLFW_KEY_MINUS`
4329  *  - `GLFW_KEY_PERIOD`
4330  *  - `GLFW_KEY_SLASH`
4331  *  - `GLFW_KEY_SEMICOLON`
4332  *  - `GLFW_KEY_EQUAL`
4333  *  - `GLFW_KEY_LEFT_BRACKET`
4334  *  - `GLFW_KEY_RIGHT_BRACKET`
4335  *  - `GLFW_KEY_BACKSLASH`
4336  *  - `GLFW_KEY_WORLD_1`
4337  *  - `GLFW_KEY_WORLD_2`
4338  *  - `GLFW_KEY_0` to `GLFW_KEY_9`
4339  *  - `GLFW_KEY_A` to `GLFW_KEY_Z`
4340  *  - `GLFW_KEY_KP_0` to `GLFW_KEY_KP_9`
4341  *  - `GLFW_KEY_KP_DECIMAL`
4342  *  - `GLFW_KEY_KP_DIVIDE`
4343  *  - `GLFW_KEY_KP_MULTIPLY`
4344  *  - `GLFW_KEY_KP_SUBTRACT`
4345  *  - `GLFW_KEY_KP_ADD`
4346  *  - `GLFW_KEY_KP_EQUAL`
4347  *
4348  *  Names for printable keys depend on keyboard layout, while names for
4349  *  non-printable keys are the same across layouts but depend on the application
4350  *  language and should be localized along with other user interface text.
4351  *
4352  *  @param[in] key The key to query, or `GLFW_KEY_UNKNOWN`.
4353  *  @param[in] scancode The scancode of the key to query.
4354  *  @return The UTF-8 encoded, layout-specific name of the key, or `NULL`.
4355  *
4356  *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
4357  *  GLFW_PLATFORM_ERROR.
4358  *
4359  *  @remark The contents of the returned string may change when a keyboard
4360  *  layout change event is received.
4361  *
4362  *  @pointer_lifetime The returned string is allocated and freed by GLFW.  You
4363  *  should not free it yourself.  It is valid until the library is terminated.
4364  *
4365  *  @thread_safety This function must only be called from the main thread.
4366  *
4367  *  @sa @ref input_key_name
4368  *
4369  *  @since Added in version 3.2.
4370  *
4371  *  @ingroup input
4372  */
4373 GLFWAPI const char* glfwGetKeyName(int key, int scancode);
4374
4375 /*! @brief Returns the platform-specific scancode of the specified key.
4376  *
4377  *  This function returns the platform-specific scancode of the specified key.
4378  *
4379  *  If the key is `GLFW_KEY_UNKNOWN` or does not exist on the keyboard this
4380  *  method will return `-1`.
4381  *
4382  *  @param[in] key Any [named key](@ref keys).
4383  *  @return The platform-specific scancode for the key, or `-1` if an
4384  *  [error](@ref error_handling) occurred.
4385  *
4386  *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
4387  *  GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR.
4388  *
4389  *  @thread_safety This function may be called from any thread.
4390  *
4391  *  @sa @ref input_key
4392  *
4393  *  @since Added in version 3.3.
4394  *
4395  *  @ingroup input
4396  */
4397 GLFWAPI int glfwGetKeyScancode(int key);
4398
4399 /*! @brief Returns the last reported state of a keyboard key for the specified
4400  *  window.
4401  *
4402  *  This function returns the last state reported for the specified key to the
4403  *  specified window.  The returned state is one of `GLFW_PRESS` or
4404  *  `GLFW_RELEASE`.  The higher-level action `GLFW_REPEAT` is only reported to
4405  *  the key callback.
4406  *
4407  *  If the @ref GLFW_STICKY_KEYS input mode is enabled, this function returns
4408  *  `GLFW_PRESS` the first time you call it for a key that was pressed, even if
4409  *  that key has already been released.
4410  *
4411  *  The key functions deal with physical keys, with [key tokens](@ref keys)
4412  *  named after their use on the standard US keyboard layout.  If you want to
4413  *  input text, use the Unicode character callback instead.
4414  *
4415  *  The [modifier key bit masks](@ref mods) are not key tokens and cannot be
4416  *  used with this function.
4417  *
4418  *  __Do not use this function__ to implement [text input](@ref input_char).
4419  *
4420  *  @param[in] window The desired window.
4421  *  @param[in] key The desired [keyboard key](@ref keys).  `GLFW_KEY_UNKNOWN` is
4422  *  not a valid key for this function.
4423  *  @return One of `GLFW_PRESS` or `GLFW_RELEASE`.
4424  *
4425  *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
4426  *  GLFW_INVALID_ENUM.
4427  *
4428  *  @thread_safety This function must only be called from the main thread.
4429  *
4430  *  @sa @ref input_key
4431  *
4432  *  @since Added in version 1.0.
4433  *  @glfw3 Added window handle parameter.
4434  *
4435  *  @ingroup input
4436  */
4437 GLFWAPI int glfwGetKey(GLFWwindow* window, int key);
4438
4439 /*! @brief Returns the last reported state of a mouse button for the specified
4440  *  window.
4441  *
4442  *  This function returns the last state reported for the specified mouse button
4443  *  to the specified window.  The returned state is one of `GLFW_PRESS` or
4444  *  `GLFW_RELEASE`.
4445  *
4446  *  If the @ref GLFW_STICKY_MOUSE_BUTTONS input mode is enabled, this function
4447  *  returns `GLFW_PRESS` the first time you call it for a mouse button that was
4448  *  pressed, even if that mouse button has already been released.
4449  *
4450  *  @param[in] window The desired window.
4451  *  @param[in] button The desired [mouse button](@ref buttons).
4452  *  @return One of `GLFW_PRESS` or `GLFW_RELEASE`.
4453  *
4454  *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
4455  *  GLFW_INVALID_ENUM.
4456  *
4457  *  @thread_safety This function must only be called from the main thread.
4458  *
4459  *  @sa @ref input_mouse_button
4460  *
4461  *  @since Added in version 1.0.
4462  *  @glfw3 Added window handle parameter.
4463  *
4464  *  @ingroup input
4465  */
4466 GLFWAPI int glfwGetMouseButton(GLFWwindow* window, int button);
4467
4468 /*! @brief Retrieves the position of the cursor relative to the content area of
4469  *  the window.
4470  *
4471  *  This function returns the position of the cursor, in screen coordinates,
4472  *  relative to the upper-left corner of the content area of the specified
4473  *  window.
4474  *
4475  *  If the cursor is disabled (with `GLFW_CURSOR_DISABLED`) then the cursor
4476  *  position is unbounded and limited only by the minimum and maximum values of
4477  *  a `double`.
4478  *
4479  *  The coordinate can be converted to their integer equivalents with the
4480  *  `floor` function.  Casting directly to an integer type works for positive
4481  *  coordinates, but fails for negative ones.
4482  *
4483  *  Any or all of the position arguments may be `NULL`.  If an error occurs, all
4484  *  non-`NULL` position arguments will be set to zero.
4485  *
4486  *  @param[in] window The desired window.
4487  *  @param[out] xpos Where to store the cursor x-coordinate, relative to the
4488  *  left edge of the content area, or `NULL`.
4489  *  @param[out] ypos Where to store the cursor y-coordinate, relative to the to
4490  *  top edge of the content area, or `NULL`.
4491  *
4492  *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
4493  *  GLFW_PLATFORM_ERROR.
4494  *
4495  *  @thread_safety This function must only be called from the main thread.
4496  *
4497  *  @sa @ref cursor_pos
4498  *  @sa @ref glfwSetCursorPos
4499  *
4500  *  @since Added in version 3.0.  Replaces `glfwGetMousePos`.
4501  *
4502  *  @ingroup input
4503  */
4504 GLFWAPI void glfwGetCursorPos(GLFWwindow* window, double* xpos, double* ypos);
4505
4506 /*! @brief Sets the position of the cursor, relative to the content area of the
4507  *  window.
4508  *
4509  *  This function sets the position, in screen coordinates, of the cursor
4510  *  relative to the upper-left corner of the content area of the specified
4511  *  window.  The window must have input focus.  If the window does not have
4512  *  input focus when this function is called, it fails silently.
4513  *
4514  *  __Do not use this function__ to implement things like camera controls.  GLFW
4515  *  already provides the `GLFW_CURSOR_DISABLED` cursor mode that hides the
4516  *  cursor, transparently re-centers it and provides unconstrained cursor
4517  *  motion.  See @ref glfwSetInputMode for more information.
4518  *
4519  *  If the cursor mode is `GLFW_CURSOR_DISABLED` then the cursor position is
4520  *  unconstrained and limited only by the minimum and maximum values of
4521  *  a `double`.
4522  *
4523  *  @param[in] window The desired window.
4524  *  @param[in] xpos The desired x-coordinate, relative to the left edge of the
4525  *  content area.
4526  *  @param[in] ypos The desired y-coordinate, relative to the top edge of the
4527  *  content area.
4528  *
4529  *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
4530  *  GLFW_PLATFORM_ERROR.
4531  *
4532  *  @remark @wayland This function will only work when the cursor mode is
4533  *  `GLFW_CURSOR_DISABLED`, otherwise it will do nothing.
4534  *
4535  *  @thread_safety This function must only be called from the main thread.
4536  *
4537  *  @sa @ref cursor_pos
4538  *  @sa @ref glfwGetCursorPos
4539  *
4540  *  @since Added in version 3.0.  Replaces `glfwSetMousePos`.
4541  *
4542  *  @ingroup input
4543  */
4544 GLFWAPI void glfwSetCursorPos(GLFWwindow* window, double xpos, double ypos);
4545
4546 /*! @brief Creates a custom cursor.
4547  *
4548  *  Creates a new custom cursor image that can be set for a window with @ref
4549  *  glfwSetCursor.  The cursor can be destroyed with @ref glfwDestroyCursor.
4550  *  Any remaining cursors are destroyed by @ref glfwTerminate.
4551  *
4552  *  The pixels are 32-bit, little-endian, non-premultiplied RGBA, i.e. eight
4553  *  bits per channel with the red channel first.  They are arranged canonically
4554  *  as packed sequential rows, starting from the top-left corner.
4555  *
4556  *  The cursor hotspot is specified in pixels, relative to the upper-left corner
4557  *  of the cursor image.  Like all other coordinate systems in GLFW, the X-axis
4558  *  points to the right and the Y-axis points down.
4559  *
4560  *  @param[in] image The desired cursor image.
4561  *  @param[in] xhot The desired x-coordinate, in pixels, of the cursor hotspot.
4562  *  @param[in] yhot The desired y-coordinate, in pixels, of the cursor hotspot.
4563  *  @return The handle of the created cursor, or `NULL` if an
4564  *  [error](@ref error_handling) occurred.
4565  *
4566  *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
4567  *  GLFW_PLATFORM_ERROR.
4568  *
4569  *  @pointer_lifetime The specified image data is copied before this function
4570  *  returns.
4571  *
4572  *  @thread_safety This function must only be called from the main thread.
4573  *
4574  *  @sa @ref cursor_object
4575  *  @sa @ref glfwDestroyCursor
4576  *  @sa @ref glfwCreateStandardCursor
4577  *
4578  *  @since Added in version 3.1.
4579  *
4580  *  @ingroup input
4581  */
4582 GLFWAPI GLFWcursor* glfwCreateCursor(const GLFWimage* image, int xhot, int yhot);
4583
4584 /*! @brief Creates a cursor with a standard shape.
4585  *
4586  *  Returns a cursor with a standard shape, that can be set for a window with
4587  *  @ref glfwSetCursor.  The images for these cursors come from the system
4588  *  cursor theme and their exact appearance will vary between platforms.
4589  *
4590  *  Most of these shapes are guaranteed to exist on every supported platform but
4591  *  a few may not be present.  See the table below for details.
4592  *
4593  *  Cursor shape                   | Windows | macOS | X11    | Wayland
4594  *  ------------------------------ | ------- | ----- | ------ | -------
4595  *  @ref GLFW_ARROW_CURSOR         | Yes     | Yes   | Yes    | Yes
4596  *  @ref GLFW_IBEAM_CURSOR         | Yes     | Yes   | Yes    | Yes
4597  *  @ref GLFW_CROSSHAIR_CURSOR     | Yes     | Yes   | Yes    | Yes
4598  *  @ref GLFW_POINTING_HAND_CURSOR | Yes     | Yes   | Yes    | Yes
4599  *  @ref GLFW_RESIZE_EW_CURSOR     | Yes     | Yes   | Yes    | Yes
4600  *  @ref GLFW_RESIZE_NS_CURSOR     | Yes     | Yes   | Yes    | Yes
4601  *  @ref GLFW_RESIZE_NWSE_CURSOR   | Yes     | Yes<sup>1</sup> | Maybe<sup>2</sup> | Maybe<sup>2</sup>
4602  *  @ref GLFW_RESIZE_NESW_CURSOR   | Yes     | Yes<sup>1</sup> | Maybe<sup>2</sup> | Maybe<sup>2</sup>
4603  *  @ref GLFW_RESIZE_ALL_CURSOR    | Yes     | Yes   | Yes    | Yes
4604  *  @ref GLFW_NOT_ALLOWED_CURSOR   | Yes     | Yes   | Maybe<sup>2</sup> | Maybe<sup>2</sup>
4605  *
4606  *  1) This uses a private system API and may fail in the future.
4607  *
4608  *  2) This uses a newer standard that not all cursor themes support.
4609  *
4610  *  If the requested shape is not available, this function emits a @ref
4611  *  GLFW_CURSOR_UNAVAILABLE error and returns `NULL`.
4612  *
4613  *  @param[in] shape One of the [standard shapes](@ref shapes).
4614  *  @return A new cursor ready to use or `NULL` if an
4615  *  [error](@ref error_handling) occurred.
4616  *
4617  *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
4618  *  GLFW_INVALID_ENUM, @ref GLFW_CURSOR_UNAVAILABLE and @ref
4619  *  GLFW_PLATFORM_ERROR.
4620  *
4621  *  @thread_safety This function must only be called from the main thread.
4622  *
4623  *  @sa @ref cursor_standard
4624  *  @sa @ref glfwCreateCursor
4625  *
4626  *  @since Added in version 3.1.
4627  *
4628  *  @ingroup input
4629  */
4630 GLFWAPI GLFWcursor* glfwCreateStandardCursor(int shape);
4631
4632 /*! @brief Destroys a cursor.
4633  *
4634  *  This function destroys a cursor previously created with @ref
4635  *  glfwCreateCursor.  Any remaining cursors will be destroyed by @ref
4636  *  glfwTerminate.
4637  *
4638  *  If the specified cursor is current for any window, that window will be
4639  *  reverted to the default cursor.  This does not affect the cursor mode.
4640  *
4641  *  @param[in] cursor The cursor object to destroy.
4642  *
4643  *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
4644  *  GLFW_PLATFORM_ERROR.
4645  *
4646  *  @reentrancy This function must not be called from a callback.
4647  *
4648  *  @thread_safety This function must only be called from the main thread.
4649  *
4650  *  @sa @ref cursor_object
4651  *  @sa @ref glfwCreateCursor
4652  *
4653  *  @since Added in version 3.1.
4654  *
4655  *  @ingroup input
4656  */
4657 GLFWAPI void glfwDestroyCursor(GLFWcursor* cursor);
4658
4659 /*! @brief Sets the cursor for the window.
4660  *
4661  *  This function sets the cursor image to be used when the cursor is over the
4662  *  content area of the specified window.  The set cursor will only be visible
4663  *  when the [cursor mode](@ref cursor_mode) of the window is
4664  *  `GLFW_CURSOR_NORMAL`.
4665  *
4666  *  On some platforms, the set cursor may not be visible unless the window also
4667  *  has input focus.
4668  *
4669  *  @param[in] window The window to set the cursor for.
4670  *  @param[in] cursor The cursor to set, or `NULL` to switch back to the default
4671  *  arrow cursor.
4672  *
4673  *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
4674  *  GLFW_PLATFORM_ERROR.
4675  *
4676  *  @thread_safety This function must only be called from the main thread.
4677  *
4678  *  @sa @ref cursor_object
4679  *
4680  *  @since Added in version 3.1.
4681  *
4682  *  @ingroup input
4683  */
4684 GLFWAPI void glfwSetCursor(GLFWwindow* window, GLFWcursor* cursor);
4685
4686 /*! @brief Sets the key callback.
4687  *
4688  *  This function sets the key callback of the specified window, which is called
4689  *  when a key is pressed, repeated or released.
4690  *
4691  *  The key functions deal with physical keys, with layout independent
4692  *  [key tokens](@ref keys) named after their values in the standard US keyboard
4693  *  layout.  If you want to input text, use the
4694  *  [character callback](@ref glfwSetCharCallback) instead.
4695  *
4696  *  When a window loses input focus, it will generate synthetic key release
4697  *  events for all pressed keys.  You can tell these events from user-generated
4698  *  events by the fact that the synthetic ones are generated after the focus
4699  *  loss event has been processed, i.e. after the
4700  *  [window focus callback](@ref glfwSetWindowFocusCallback) has been called.
4701  *
4702  *  The scancode of a key is specific to that platform or sometimes even to that
4703  *  machine.  Scancodes are intended to allow users to bind keys that don't have
4704  *  a GLFW key token.  Such keys have `key` set to `GLFW_KEY_UNKNOWN`, their
4705  *  state is not saved and so it cannot be queried with @ref glfwGetKey.
4706  *
4707  *  Sometimes GLFW needs to generate synthetic key events, in which case the
4708  *  scancode may be zero.
4709  *
4710  *  @param[in] window The window whose callback to set.
4711  *  @param[in] callback The new key callback, or `NULL` to remove the currently
4712  *  set callback.
4713  *  @return The previously set callback, or `NULL` if no callback was set or the
4714  *  library had not been [initialized](@ref intro_init).
4715  *
4716  *  @callback_signature
4717  *  @code
4718  *  void function_name(GLFWwindow* window, int key, int scancode, int action, int mods)
4719  *  @endcode
4720  *  For more information about the callback parameters, see the
4721  *  [function pointer type](@ref GLFWkeyfun).
4722  *
4723  *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
4724  *
4725  *  @thread_safety This function must only be called from the main thread.
4726  *
4727  *  @sa @ref input_key
4728  *
4729  *  @since Added in version 1.0.
4730  *  @glfw3 Added window handle parameter and return value.
4731  *
4732  *  @ingroup input
4733  */
4734 GLFWAPI GLFWkeyfun glfwSetKeyCallback(GLFWwindow* window, GLFWkeyfun callback);
4735
4736 /*! @brief Sets the Unicode character callback.
4737  *
4738  *  This function sets the character callback of the specified window, which is
4739  *  called when a Unicode character is input.
4740  *
4741  *  The character callback is intended for Unicode text input.  As it deals with
4742  *  characters, it is keyboard layout dependent, whereas the
4743  *  [key callback](@ref glfwSetKeyCallback) is not.  Characters do not map 1:1
4744  *  to physical keys, as a key may produce zero, one or more characters.  If you
4745  *  want to know whether a specific physical key was pressed or released, see
4746  *  the key callback instead.
4747  *
4748  *  The character callback behaves as system text input normally does and will
4749  *  not be called if modifier keys are held down that would prevent normal text
4750  *  input on that platform, for example a Super (Command) key on macOS or Alt key
4751  *  on Windows.
4752  *
4753  *  @param[in] window The window whose callback to set.
4754  *  @param[in] callback The new callback, or `NULL` to remove the currently set
4755  *  callback.
4756  *  @return The previously set callback, or `NULL` if no callback was set or the
4757  *  library had not been [initialized](@ref intro_init).
4758  *
4759  *  @callback_signature
4760  *  @code
4761  *  void function_name(GLFWwindow* window, unsigned int codepoint)
4762  *  @endcode
4763  *  For more information about the callback parameters, see the
4764  *  [function pointer type](@ref GLFWcharfun).
4765  *
4766  *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
4767  *
4768  *  @thread_safety This function must only be called from the main thread.
4769  *
4770  *  @sa @ref input_char
4771  *
4772  *  @since Added in version 2.4.
4773  *  @glfw3 Added window handle parameter and return value.
4774  *
4775  *  @ingroup input
4776  */
4777 GLFWAPI GLFWcharfun glfwSetCharCallback(GLFWwindow* window, GLFWcharfun callback);
4778
4779 /*! @brief Sets the Unicode character with modifiers callback.
4780  *
4781  *  This function sets the character with modifiers callback of the specified
4782  *  window, which is called when a Unicode character is input regardless of what
4783  *  modifier keys are used.
4784  *
4785  *  The character with modifiers callback is intended for implementing custom
4786  *  Unicode character input.  For regular Unicode text input, see the
4787  *  [character callback](@ref glfwSetCharCallback).  Like the character
4788  *  callback, the character with modifiers callback deals with characters and is
4789  *  keyboard layout dependent.  Characters do not map 1:1 to physical keys, as
4790  *  a key may produce zero, one or more characters.  If you want to know whether
4791  *  a specific physical key was pressed or released, see the
4792  *  [key callback](@ref glfwSetKeyCallback) instead.
4793  *
4794  *  @param[in] window The window whose callback to set.
4795  *  @param[in] callback The new callback, or `NULL` to remove the currently set
4796  *  callback.
4797  *  @return The previously set callback, or `NULL` if no callback was set or an
4798  *  [error](@ref error_handling) occurred.
4799  *
4800  *  @callback_signature
4801  *  @code
4802  *  void function_name(GLFWwindow* window, unsigned int codepoint, int mods)
4803  *  @endcode
4804  *  For more information about the callback parameters, see the
4805  *  [function pointer type](@ref GLFWcharmodsfun).
4806  *
4807  *  @deprecated Scheduled for removal in version 4.0.
4808  *
4809  *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
4810  *
4811  *  @thread_safety This function must only be called from the main thread.
4812  *
4813  *  @sa @ref input_char
4814  *
4815  *  @since Added in version 3.1.
4816  *
4817  *  @ingroup input
4818  */
4819 GLFWAPI GLFWcharmodsfun glfwSetCharModsCallback(GLFWwindow* window, GLFWcharmodsfun callback);
4820
4821 /*! @brief Sets the mouse button callback.
4822  *
4823  *  This function sets the mouse button callback of the specified window, which
4824  *  is called when a mouse button is pressed or released.
4825  *
4826  *  When a window loses input focus, it will generate synthetic mouse button
4827  *  release events for all pressed mouse buttons.  You can tell these events
4828  *  from user-generated events by the fact that the synthetic ones are generated
4829  *  after the focus loss event has been processed, i.e. after the
4830  *  [window focus callback](@ref glfwSetWindowFocusCallback) has been called.
4831  *
4832  *  @param[in] window The window whose callback to set.
4833  *  @param[in] callback The new callback, or `NULL` to remove the currently set
4834  *  callback.
4835  *  @return The previously set callback, or `NULL` if no callback was set or the
4836  *  library had not been [initialized](@ref intro_init).
4837  *
4838  *  @callback_signature
4839  *  @code
4840  *  void function_name(GLFWwindow* window, int button, int action, int mods)
4841  *  @endcode
4842  *  For more information about the callback parameters, see the
4843  *  [function pointer type](@ref GLFWmousebuttonfun).
4844  *
4845  *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
4846  *
4847  *  @thread_safety This function must only be called from the main thread.
4848  *
4849  *  @sa @ref input_mouse_button
4850  *
4851  *  @since Added in version 1.0.
4852  *  @glfw3 Added window handle parameter and return value.
4853  *
4854  *  @ingroup input
4855  */
4856 GLFWAPI GLFWmousebuttonfun glfwSetMouseButtonCallback(GLFWwindow* window, GLFWmousebuttonfun callback);
4857
4858 /*! @brief Sets the cursor position callback.
4859  *
4860  *  This function sets the cursor position callback of the specified window,
4861  *  which is called when the cursor is moved.  The callback is provided with the
4862  *  position, in screen coordinates, relative to the upper-left corner of the
4863  *  content area of the window.
4864  *
4865  *  @param[in] window The window whose callback to set.
4866  *  @param[in] callback The new callback, or `NULL` to remove the currently set
4867  *  callback.
4868  *  @return The previously set callback, or `NULL` if no callback was set or the
4869  *  library had not been [initialized](@ref intro_init).
4870  *
4871  *  @callback_signature
4872  *  @code
4873  *  void function_name(GLFWwindow* window, double xpos, double ypos);
4874  *  @endcode
4875  *  For more information about the callback parameters, see the
4876  *  [function pointer type](@ref GLFWcursorposfun).
4877  *
4878  *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
4879  *
4880  *  @thread_safety This function must only be called from the main thread.
4881  *
4882  *  @sa @ref cursor_pos
4883  *
4884  *  @since Added in version 3.0.  Replaces `glfwSetMousePosCallback`.
4885  *
4886  *  @ingroup input
4887  */
4888 GLFWAPI GLFWcursorposfun glfwSetCursorPosCallback(GLFWwindow* window, GLFWcursorposfun callback);
4889
4890 /*! @brief Sets the cursor enter/leave callback.
4891  *
4892  *  This function sets the cursor boundary crossing callback of the specified
4893  *  window, which is called when the cursor enters or leaves the content area of
4894  *  the window.
4895  *
4896  *  @param[in] window The window whose callback to set.
4897  *  @param[in] callback The new callback, or `NULL` to remove the currently set
4898  *  callback.
4899  *  @return The previously set callback, or `NULL` if no callback was set or the
4900  *  library had not been [initialized](@ref intro_init).
4901  *
4902  *  @callback_signature
4903  *  @code
4904  *  void function_name(GLFWwindow* window, int entered)
4905  *  @endcode
4906  *  For more information about the callback parameters, see the
4907  *  [function pointer type](@ref GLFWcursorenterfun).
4908  *
4909  *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
4910  *
4911  *  @thread_safety This function must only be called from the main thread.
4912  *
4913  *  @sa @ref cursor_enter
4914  *
4915  *  @since Added in version 3.0.
4916  *
4917  *  @ingroup input
4918  */
4919 GLFWAPI GLFWcursorenterfun glfwSetCursorEnterCallback(GLFWwindow* window, GLFWcursorenterfun callback);
4920
4921 /*! @brief Sets the scroll callback.
4922  *
4923  *  This function sets the scroll callback of the specified window, which is
4924  *  called when a scrolling device is used, such as a mouse wheel or scrolling
4925  *  area of a touchpad.
4926  *
4927  *  The scroll callback receives all scrolling input, like that from a mouse
4928  *  wheel or a touchpad scrolling area.
4929  *
4930  *  @param[in] window The window whose callback to set.
4931  *  @param[in] callback The new scroll callback, or `NULL` to remove the
4932  *  currently set callback.
4933  *  @return The previously set callback, or `NULL` if no callback was set or the
4934  *  library had not been [initialized](@ref intro_init).
4935  *
4936  *  @callback_signature
4937  *  @code
4938  *  void function_name(GLFWwindow* window, double xoffset, double yoffset)
4939  *  @endcode
4940  *  For more information about the callback parameters, see the
4941  *  [function pointer type](@ref GLFWscrollfun).
4942  *
4943  *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
4944  *
4945  *  @thread_safety This function must only be called from the main thread.
4946  *
4947  *  @sa @ref scrolling
4948  *
4949  *  @since Added in version 3.0.  Replaces `glfwSetMouseWheelCallback`.
4950  *
4951  *  @ingroup input
4952  */
4953 GLFWAPI GLFWscrollfun glfwSetScrollCallback(GLFWwindow* window, GLFWscrollfun callback);
4954
4955 /*! @brief Sets the path drop callback.
4956  *
4957  *  This function sets the path drop callback of the specified window, which is
4958  *  called when one or more dragged paths are dropped on the window.
4959  *
4960  *  Because the path array and its strings may have been generated specifically
4961  *  for that event, they are not guaranteed to be valid after the callback has
4962  *  returned.  If you wish to use them after the callback returns, you need to
4963  *  make a deep copy.
4964  *
4965  *  @param[in] window The window whose callback to set.
4966  *  @param[in] callback The new file drop callback, or `NULL` to remove the
4967  *  currently set callback.
4968  *  @return The previously set callback, or `NULL` if no callback was set or the
4969  *  library had not been [initialized](@ref intro_init).
4970  *
4971  *  @callback_signature
4972  *  @code
4973  *  void function_name(GLFWwindow* window, int path_count, const char* paths[])
4974  *  @endcode
4975  *  For more information about the callback parameters, see the
4976  *  [function pointer type](@ref GLFWdropfun).
4977  *
4978  *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
4979  *
4980  *  @remark @wayland File drop is currently unimplemented.
4981  *
4982  *  @thread_safety This function must only be called from the main thread.
4983  *
4984  *  @sa @ref path_drop
4985  *
4986  *  @since Added in version 3.1.
4987  *
4988  *  @ingroup input
4989  */
4990 GLFWAPI GLFWdropfun glfwSetDropCallback(GLFWwindow* window, GLFWdropfun callback);
4991
4992 /*! @brief Returns whether the specified joystick is present.
4993  *
4994  *  This function returns whether the specified joystick is present.
4995  *
4996  *  There is no need to call this function before other functions that accept
4997  *  a joystick ID, as they all check for presence before performing any other
4998  *  work.
4999  *
5000  *  @param[in] jid The [joystick](@ref joysticks) to query.
5001  *  @return `GLFW_TRUE` if the joystick is present, or `GLFW_FALSE` otherwise.
5002  *
5003  *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
5004  *  GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR.
5005  *
5006  *  @thread_safety This function must only be called from the main thread.
5007  *
5008  *  @sa @ref joystick
5009  *
5010  *  @since Added in version 3.0.  Replaces `glfwGetJoystickParam`.
5011  *
5012  *  @ingroup input
5013  */
5014 GLFWAPI int glfwJoystickPresent(int jid);
5015
5016 /*! @brief Returns the values of all axes of the specified joystick.
5017  *
5018  *  This function returns the values of all axes of the specified joystick.
5019  *  Each element in the array is a value between -1.0 and 1.0.
5020  *
5021  *  If the specified joystick is not present this function will return `NULL`
5022  *  but will not generate an error.  This can be used instead of first calling
5023  *  @ref glfwJoystickPresent.
5024  *
5025  *  @param[in] jid The [joystick](@ref joysticks) to query.
5026  *  @param[out] count Where to store the number of axis values in the returned
5027  *  array.  This is set to zero if the joystick is not present or an error
5028  *  occurred.
5029  *  @return An array of axis values, or `NULL` if the joystick is not present or
5030  *  an [error](@ref error_handling) occurred.
5031  *
5032  *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
5033  *  GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR.
5034  *
5035  *  @pointer_lifetime The returned array is allocated and freed by GLFW.  You
5036  *  should not free it yourself.  It is valid until the specified joystick is
5037  *  disconnected or the library is terminated.
5038  *
5039  *  @thread_safety This function must only be called from the main thread.
5040  *
5041  *  @sa @ref joystick_axis
5042  *
5043  *  @since Added in version 3.0.  Replaces `glfwGetJoystickPos`.
5044  *
5045  *  @ingroup input
5046  */
5047 GLFWAPI const float* glfwGetJoystickAxes(int jid, int* count);
5048
5049 /*! @brief Returns the state of all buttons of the specified joystick.
5050  *
5051  *  This function returns the state of all buttons of the specified joystick.
5052  *  Each element in the array is either `GLFW_PRESS` or `GLFW_RELEASE`.
5053  *
5054  *  For backward compatibility with earlier versions that did not have @ref
5055  *  glfwGetJoystickHats, the button array also includes all hats, each
5056  *  represented as four buttons.  The hats are in the same order as returned by
5057  *  __glfwGetJoystickHats__ and are in the order _up_, _right_, _down_ and
5058  *  _left_.  To disable these extra buttons, set the @ref
5059  *  GLFW_JOYSTICK_HAT_BUTTONS init hint before initialization.
5060  *
5061  *  If the specified joystick is not present this function will return `NULL`
5062  *  but will not generate an error.  This can be used instead of first calling
5063  *  @ref glfwJoystickPresent.
5064  *
5065  *  @param[in] jid The [joystick](@ref joysticks) to query.
5066  *  @param[out] count Where to store the number of button states in the returned
5067  *  array.  This is set to zero if the joystick is not present or an error
5068  *  occurred.
5069  *  @return An array of button states, or `NULL` if the joystick is not present
5070  *  or an [error](@ref error_handling) occurred.
5071  *
5072  *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
5073  *  GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR.
5074  *
5075  *  @pointer_lifetime The returned array is allocated and freed by GLFW.  You
5076  *  should not free it yourself.  It is valid until the specified joystick is
5077  *  disconnected or the library is terminated.
5078  *
5079  *  @thread_safety This function must only be called from the main thread.
5080  *
5081  *  @sa @ref joystick_button
5082  *
5083  *  @since Added in version 2.2.
5084  *  @glfw3 Changed to return a dynamic array.
5085  *
5086  *  @ingroup input
5087  */
5088 GLFWAPI const unsigned char* glfwGetJoystickButtons(int jid, int* count);
5089
5090 /*! @brief Returns the state of all hats of the specified joystick.
5091  *
5092  *  This function returns the state of all hats of the specified joystick.
5093  *  Each element in the array is one of the following values:
5094  *
5095  *  Name                  | Value
5096  *  ----                  | -----
5097  *  `GLFW_HAT_CENTERED`   | 0
5098  *  `GLFW_HAT_UP`         | 1
5099  *  `GLFW_HAT_RIGHT`      | 2
5100  *  `GLFW_HAT_DOWN`       | 4
5101  *  `GLFW_HAT_LEFT`       | 8
5102  *  `GLFW_HAT_RIGHT_UP`   | `GLFW_HAT_RIGHT` \| `GLFW_HAT_UP`
5103  *  `GLFW_HAT_RIGHT_DOWN` | `GLFW_HAT_RIGHT` \| `GLFW_HAT_DOWN`
5104  *  `GLFW_HAT_LEFT_UP`    | `GLFW_HAT_LEFT` \| `GLFW_HAT_UP`
5105  *  `GLFW_HAT_LEFT_DOWN`  | `GLFW_HAT_LEFT` \| `GLFW_HAT_DOWN`
5106  *
5107  *  The diagonal directions are bitwise combinations of the primary (up, right,
5108  *  down and left) directions and you can test for these individually by ANDing
5109  *  it with the corresponding direction.
5110  *
5111  *  @code
5112  *  if (hats[2] & GLFW_HAT_RIGHT)
5113  *  {
5114  *      // State of hat 2 could be right-up, right or right-down
5115  *  }
5116  *  @endcode
5117  *
5118  *  If the specified joystick is not present this function will return `NULL`
5119  *  but will not generate an error.  This can be used instead of first calling
5120  *  @ref glfwJoystickPresent.
5121  *
5122  *  @param[in] jid The [joystick](@ref joysticks) to query.
5123  *  @param[out] count Where to store the number of hat states in the returned
5124  *  array.  This is set to zero if the joystick is not present or an error
5125  *  occurred.
5126  *  @return An array of hat states, or `NULL` if the joystick is not present
5127  *  or an [error](@ref error_handling) occurred.
5128  *
5129  *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
5130  *  GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR.
5131  *
5132  *  @pointer_lifetime The returned array is allocated and freed by GLFW.  You
5133  *  should not free it yourself.  It is valid until the specified joystick is
5134  *  disconnected, this function is called again for that joystick or the library
5135  *  is terminated.
5136  *
5137  *  @thread_safety This function must only be called from the main thread.
5138  *
5139  *  @sa @ref joystick_hat
5140  *
5141  *  @since Added in version 3.3.
5142  *
5143  *  @ingroup input
5144  */
5145 GLFWAPI const unsigned char* glfwGetJoystickHats(int jid, int* count);
5146
5147 /*! @brief Returns the name of the specified joystick.
5148  *
5149  *  This function returns the name, encoded as UTF-8, of the specified joystick.
5150  *  The returned string is allocated and freed by GLFW.  You should not free it
5151  *  yourself.
5152  *
5153  *  If the specified joystick is not present this function will return `NULL`
5154  *  but will not generate an error.  This can be used instead of first calling
5155  *  @ref glfwJoystickPresent.
5156  *
5157  *  @param[in] jid The [joystick](@ref joysticks) to query.
5158  *  @return The UTF-8 encoded name of the joystick, or `NULL` if the joystick
5159  *  is not present or an [error](@ref error_handling) occurred.
5160  *
5161  *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
5162  *  GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR.
5163  *
5164  *  @pointer_lifetime The returned string is allocated and freed by GLFW.  You
5165  *  should not free it yourself.  It is valid until the specified joystick is
5166  *  disconnected or the library is terminated.
5167  *
5168  *  @thread_safety This function must only be called from the main thread.
5169  *
5170  *  @sa @ref joystick_name
5171  *
5172  *  @since Added in version 3.0.
5173  *
5174  *  @ingroup input
5175  */
5176 GLFWAPI const char* glfwGetJoystickName(int jid);
5177
5178 /*! @brief Returns the SDL compatible GUID of the specified joystick.
5179  *
5180  *  This function returns the SDL compatible GUID, as a UTF-8 encoded
5181  *  hexadecimal string, of the specified joystick.  The returned string is
5182  *  allocated and freed by GLFW.  You should not free it yourself.
5183  *
5184  *  The GUID is what connects a joystick to a gamepad mapping.  A connected
5185  *  joystick will always have a GUID even if there is no gamepad mapping
5186  *  assigned to it.
5187  *
5188  *  If the specified joystick is not present this function will return `NULL`
5189  *  but will not generate an error.  This can be used instead of first calling
5190  *  @ref glfwJoystickPresent.
5191  *
5192  *  The GUID uses the format introduced in SDL 2.0.5.  This GUID tries to
5193  *  uniquely identify the make and model of a joystick but does not identify
5194  *  a specific unit, e.g. all wired Xbox 360 controllers will have the same
5195  *  GUID on that platform.  The GUID for a unit may vary between platforms
5196  *  depending on what hardware information the platform specific APIs provide.
5197  *
5198  *  @param[in] jid The [joystick](@ref joysticks) to query.
5199  *  @return The UTF-8 encoded GUID of the joystick, or `NULL` if the joystick
5200  *  is not present or an [error](@ref error_handling) occurred.
5201  *
5202  *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
5203  *  GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR.
5204  *
5205  *  @pointer_lifetime The returned string is allocated and freed by GLFW.  You
5206  *  should not free it yourself.  It is valid until the specified joystick is
5207  *  disconnected or the library is terminated.
5208  *
5209  *  @thread_safety This function must only be called from the main thread.
5210  *
5211  *  @sa @ref gamepad
5212  *
5213  *  @since Added in version 3.3.
5214  *
5215  *  @ingroup input
5216  */
5217 GLFWAPI const char* glfwGetJoystickGUID(int jid);
5218
5219 /*! @brief Sets the user pointer of the specified joystick.
5220  *
5221  *  This function sets the user-defined pointer of the specified joystick.  The
5222  *  current value is retained until the joystick is disconnected.  The initial
5223  *  value is `NULL`.
5224  *
5225  *  This function may be called from the joystick callback, even for a joystick
5226  *  that is being disconnected.
5227  *
5228  *  @param[in] jid The joystick whose pointer to set.
5229  *  @param[in] pointer The new value.
5230  *
5231  *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
5232  *
5233  *  @thread_safety This function may be called from any thread.  Access is not
5234  *  synchronized.
5235  *
5236  *  @sa @ref joystick_userptr
5237  *  @sa @ref glfwGetJoystickUserPointer
5238  *
5239  *  @since Added in version 3.3.
5240  *
5241  *  @ingroup input
5242  */
5243 GLFWAPI void glfwSetJoystickUserPointer(int jid, void* pointer);
5244
5245 /*! @brief Returns the user pointer of the specified joystick.
5246  *
5247  *  This function returns the current value of the user-defined pointer of the
5248  *  specified joystick.  The initial value is `NULL`.
5249  *
5250  *  This function may be called from the joystick callback, even for a joystick
5251  *  that is being disconnected.
5252  *
5253  *  @param[in] jid The joystick whose pointer to return.
5254  *
5255  *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
5256  *
5257  *  @thread_safety This function may be called from any thread.  Access is not
5258  *  synchronized.
5259  *
5260  *  @sa @ref joystick_userptr
5261  *  @sa @ref glfwSetJoystickUserPointer
5262  *
5263  *  @since Added in version 3.3.
5264  *
5265  *  @ingroup input
5266  */
5267 GLFWAPI void* glfwGetJoystickUserPointer(int jid);
5268
5269 /*! @brief Returns whether the specified joystick has a gamepad mapping.
5270  *
5271  *  This function returns whether the specified joystick is both present and has
5272  *  a gamepad mapping.
5273  *
5274  *  If the specified joystick is present but does not have a gamepad mapping
5275  *  this function will return `GLFW_FALSE` but will not generate an error.  Call
5276  *  @ref glfwJoystickPresent to check if a joystick is present regardless of
5277  *  whether it has a mapping.
5278  *
5279  *  @param[in] jid The [joystick](@ref joysticks) to query.
5280  *  @return `GLFW_TRUE` if a joystick is both present and has a gamepad mapping,
5281  *  or `GLFW_FALSE` otherwise.
5282  *
5283  *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
5284  *  GLFW_INVALID_ENUM.
5285  *
5286  *  @thread_safety This function must only be called from the main thread.
5287  *
5288  *  @sa @ref gamepad
5289  *  @sa @ref glfwGetGamepadState
5290  *
5291  *  @since Added in version 3.3.
5292  *
5293  *  @ingroup input
5294  */
5295 GLFWAPI int glfwJoystickIsGamepad(int jid);
5296
5297 /*! @brief Sets the joystick configuration callback.
5298  *
5299  *  This function sets the joystick configuration callback, or removes the
5300  *  currently set callback.  This is called when a joystick is connected to or
5301  *  disconnected from the system.
5302  *
5303  *  For joystick connection and disconnection events to be delivered on all
5304  *  platforms, you need to call one of the [event processing](@ref events)
5305  *  functions.  Joystick disconnection may also be detected and the callback
5306  *  called by joystick functions.  The function will then return whatever it
5307  *  returns if the joystick is not present.
5308  *
5309  *  @param[in] callback The new callback, or `NULL` to remove the currently set
5310  *  callback.
5311  *  @return The previously set callback, or `NULL` if no callback was set or the
5312  *  library had not been [initialized](@ref intro_init).
5313  *
5314  *  @callback_signature
5315  *  @code
5316  *  void function_name(int jid, int event)
5317  *  @endcode
5318  *  For more information about the callback parameters, see the
5319  *  [function pointer type](@ref GLFWjoystickfun).
5320  *
5321  *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
5322  *
5323  *  @thread_safety This function must only be called from the main thread.
5324  *
5325  *  @sa @ref joystick_event
5326  *
5327  *  @since Added in version 3.2.
5328  *
5329  *  @ingroup input
5330  */
5331 GLFWAPI GLFWjoystickfun glfwSetJoystickCallback(GLFWjoystickfun callback);
5332
5333 /*! @brief Adds the specified SDL_GameControllerDB gamepad mappings.
5334  *
5335  *  This function parses the specified ASCII encoded string and updates the
5336  *  internal list with any gamepad mappings it finds.  This string may
5337  *  contain either a single gamepad mapping or many mappings separated by
5338  *  newlines.  The parser supports the full format of the `gamecontrollerdb.txt`
5339  *  source file including empty lines and comments.
5340  *
5341  *  See @ref gamepad_mapping for a description of the format.
5342  *
5343  *  If there is already a gamepad mapping for a given GUID in the internal list,
5344  *  it will be replaced by the one passed to this function.  If the library is
5345  *  terminated and re-initialized the internal list will revert to the built-in
5346  *  default.
5347  *
5348  *  @param[in] string The string containing the gamepad mappings.
5349  *  @return `GLFW_TRUE` if successful, or `GLFW_FALSE` if an
5350  *  [error](@ref error_handling) occurred.
5351  *
5352  *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
5353  *  GLFW_INVALID_VALUE.
5354  *
5355  *  @thread_safety This function must only be called from the main thread.
5356  *
5357  *  @sa @ref gamepad
5358  *  @sa @ref glfwJoystickIsGamepad
5359  *  @sa @ref glfwGetGamepadName
5360  *
5361  *  @since Added in version 3.3.
5362  *
5363  *  @ingroup input
5364  */
5365 GLFWAPI int glfwUpdateGamepadMappings(const char* string);
5366
5367 /*! @brief Returns the human-readable gamepad name for the specified joystick.
5368  *
5369  *  This function returns the human-readable name of the gamepad from the
5370  *  gamepad mapping assigned to the specified joystick.
5371  *
5372  *  If the specified joystick is not present or does not have a gamepad mapping
5373  *  this function will return `NULL` but will not generate an error.  Call
5374  *  @ref glfwJoystickPresent to check whether it is present regardless of
5375  *  whether it has a mapping.
5376  *
5377  *  @param[in] jid The [joystick](@ref joysticks) to query.
5378  *  @return The UTF-8 encoded name of the gamepad, or `NULL` if the
5379  *  joystick is not present, does not have a mapping or an
5380  *  [error](@ref error_handling) occurred.
5381  *
5382  *  @pointer_lifetime The returned string is allocated and freed by GLFW.  You
5383  *  should not free it yourself.  It is valid until the specified joystick is
5384  *  disconnected, the gamepad mappings are updated or the library is terminated.
5385  *
5386  *  @thread_safety This function must only be called from the main thread.
5387  *
5388  *  @sa @ref gamepad
5389  *  @sa @ref glfwJoystickIsGamepad
5390  *
5391  *  @since Added in version 3.3.
5392  *
5393  *  @ingroup input
5394  */
5395 GLFWAPI const char* glfwGetGamepadName(int jid);
5396
5397 /*! @brief Retrieves the state of the specified joystick remapped as a gamepad.
5398  *
5399  *  This function retrieves the state of the specified joystick remapped to
5400  *  an Xbox-like gamepad.
5401  *
5402  *  If the specified joystick is not present or does not have a gamepad mapping
5403  *  this function will return `GLFW_FALSE` but will not generate an error.  Call
5404  *  @ref glfwJoystickPresent to check whether it is present regardless of
5405  *  whether it has a mapping.
5406  *
5407  *  The Guide button may not be available for input as it is often hooked by the
5408  *  system or the Steam client.
5409  *
5410  *  Not all devices have all the buttons or axes provided by @ref
5411  *  GLFWgamepadstate.  Unavailable buttons and axes will always report
5412  *  `GLFW_RELEASE` and 0.0 respectively.
5413  *
5414  *  @param[in] jid The [joystick](@ref joysticks) to query.
5415  *  @param[out] state The gamepad input state of the joystick.
5416  *  @return `GLFW_TRUE` if successful, or `GLFW_FALSE` if no joystick is
5417  *  connected, it has no gamepad mapping or an [error](@ref error_handling)
5418  *  occurred.
5419  *
5420  *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
5421  *  GLFW_INVALID_ENUM.
5422  *
5423  *  @thread_safety This function must only be called from the main thread.
5424  *
5425  *  @sa @ref gamepad
5426  *  @sa @ref glfwUpdateGamepadMappings
5427  *  @sa @ref glfwJoystickIsGamepad
5428  *
5429  *  @since Added in version 3.3.
5430  *
5431  *  @ingroup input
5432  */
5433 GLFWAPI int glfwGetGamepadState(int jid, GLFWgamepadstate* state);
5434
5435 /*! @brief Sets the clipboard to the specified string.
5436  *
5437  *  This function sets the system clipboard to the specified, UTF-8 encoded
5438  *  string.
5439  *
5440  *  @param[in] window Deprecated.  Any valid window or `NULL`.
5441  *  @param[in] string A UTF-8 encoded string.
5442  *
5443  *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
5444  *  GLFW_PLATFORM_ERROR.
5445  *
5446  *  @pointer_lifetime The specified string is copied before this function
5447  *  returns.
5448  *
5449  *  @thread_safety This function must only be called from the main thread.
5450  *
5451  *  @sa @ref clipboard
5452  *  @sa @ref glfwGetClipboardString
5453  *
5454  *  @since Added in version 3.0.
5455  *
5456  *  @ingroup input
5457  */
5458 GLFWAPI void glfwSetClipboardString(GLFWwindow* window, const char* string);
5459
5460 /*! @brief Returns the contents of the clipboard as a string.
5461  *
5462  *  This function returns the contents of the system clipboard, if it contains
5463  *  or is convertible to a UTF-8 encoded string.  If the clipboard is empty or
5464  *  if its contents cannot be converted, `NULL` is returned and a @ref
5465  *  GLFW_FORMAT_UNAVAILABLE error is generated.
5466  *
5467  *  @param[in] window Deprecated.  Any valid window or `NULL`.
5468  *  @return The contents of the clipboard as a UTF-8 encoded string, or `NULL`
5469  *  if an [error](@ref error_handling) occurred.
5470  *
5471  *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
5472  *  GLFW_PLATFORM_ERROR.
5473  *
5474  *  @pointer_lifetime The returned string is allocated and freed by GLFW.  You
5475  *  should not free it yourself.  It is valid until the next call to @ref
5476  *  glfwGetClipboardString or @ref glfwSetClipboardString, or until the library
5477  *  is terminated.
5478  *
5479  *  @thread_safety This function must only be called from the main thread.
5480  *
5481  *  @sa @ref clipboard
5482  *  @sa @ref glfwSetClipboardString
5483  *
5484  *  @since Added in version 3.0.
5485  *
5486  *  @ingroup input
5487  */
5488 GLFWAPI const char* glfwGetClipboardString(GLFWwindow* window);
5489
5490 /*! @brief Returns the GLFW time.
5491  *
5492  *  This function returns the current GLFW time, in seconds.  Unless the time
5493  *  has been set using @ref glfwSetTime it measures time elapsed since GLFW was
5494  *  initialized.
5495  *
5496  *  This function and @ref glfwSetTime are helper functions on top of @ref
5497  *  glfwGetTimerFrequency and @ref glfwGetTimerValue.
5498  *
5499  *  The resolution of the timer is system dependent, but is usually on the order
5500  *  of a few micro- or nanoseconds.  It uses the highest-resolution monotonic
5501  *  time source on each supported platform.
5502  *
5503  *  @return The current time, in seconds, or zero if an
5504  *  [error](@ref error_handling) occurred.
5505  *
5506  *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
5507  *
5508  *  @thread_safety This function may be called from any thread.  Reading and
5509  *  writing of the internal base time is not atomic, so it needs to be
5510  *  externally synchronized with calls to @ref glfwSetTime.
5511  *
5512  *  @sa @ref time
5513  *
5514  *  @since Added in version 1.0.
5515  *
5516  *  @ingroup input
5517  */
5518 GLFWAPI double glfwGetTime(void);
5519
5520 /*! @brief Sets the GLFW time.
5521  *
5522  *  This function sets the current GLFW time, in seconds.  The value must be
5523  *  a positive finite number less than or equal to 18446744073.0, which is
5524  *  approximately 584.5 years.
5525  *
5526  *  This function and @ref glfwGetTime are helper functions on top of @ref
5527  *  glfwGetTimerFrequency and @ref glfwGetTimerValue.
5528  *
5529  *  @param[in] time The new value, in seconds.
5530  *
5531  *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
5532  *  GLFW_INVALID_VALUE.
5533  *
5534  *  @remark The upper limit of GLFW time is calculated as
5535  *  floor((2<sup>64</sup> - 1) / 10<sup>9</sup>) and is due to implementations
5536  *  storing nanoseconds in 64 bits.  The limit may be increased in the future.
5537  *
5538  *  @thread_safety This function may be called from any thread.  Reading and
5539  *  writing of the internal base time is not atomic, so it needs to be
5540  *  externally synchronized with calls to @ref glfwGetTime.
5541  *
5542  *  @sa @ref time
5543  *
5544  *  @since Added in version 2.2.
5545  *
5546  *  @ingroup input
5547  */
5548 GLFWAPI void glfwSetTime(double time);
5549
5550 /*! @brief Returns the current value of the raw timer.
5551  *
5552  *  This function returns the current value of the raw timer, measured in
5553  *  1&nbsp;/&nbsp;frequency seconds.  To get the frequency, call @ref
5554  *  glfwGetTimerFrequency.
5555  *
5556  *  @return The value of the timer, or zero if an
5557  *  [error](@ref error_handling) occurred.
5558  *
5559  *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
5560  *
5561  *  @thread_safety This function may be called from any thread.
5562  *
5563  *  @sa @ref time
5564  *  @sa @ref glfwGetTimerFrequency
5565  *
5566  *  @since Added in version 3.2.
5567  *
5568  *  @ingroup input
5569  */
5570 GLFWAPI uint64_t glfwGetTimerValue(void);
5571
5572 /*! @brief Returns the frequency, in Hz, of the raw timer.
5573  *
5574  *  This function returns the frequency, in Hz, of the raw timer.
5575  *
5576  *  @return The frequency of the timer, in Hz, or zero if an
5577  *  [error](@ref error_handling) occurred.
5578  *
5579  *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
5580  *
5581  *  @thread_safety This function may be called from any thread.
5582  *
5583  *  @sa @ref time
5584  *  @sa @ref glfwGetTimerValue
5585  *
5586  *  @since Added in version 3.2.
5587  *
5588  *  @ingroup input
5589  */
5590 GLFWAPI uint64_t glfwGetTimerFrequency(void);
5591
5592 /*! @brief Makes the context of the specified window current for the calling
5593  *  thread.
5594  *
5595  *  This function makes the OpenGL or OpenGL ES context of the specified window
5596  *  current on the calling thread.  A context must only be made current on
5597  *  a single thread at a time and each thread can have only a single current
5598  *  context at a time.
5599  *
5600  *  When moving a context between threads, you must make it non-current on the
5601  *  old thread before making it current on the new one.
5602  *
5603  *  By default, making a context non-current implicitly forces a pipeline flush.
5604  *  On machines that support `GL_KHR_context_flush_control`, you can control
5605  *  whether a context performs this flush by setting the
5606  *  [GLFW_CONTEXT_RELEASE_BEHAVIOR](@ref GLFW_CONTEXT_RELEASE_BEHAVIOR_hint)
5607  *  hint.
5608  *
5609  *  The specified window must have an OpenGL or OpenGL ES context.  Specifying
5610  *  a window without a context will generate a @ref GLFW_NO_WINDOW_CONTEXT
5611  *  error.
5612  *
5613  *  @param[in] window The window whose context to make current, or `NULL` to
5614  *  detach the current context.
5615  *
5616  *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
5617  *  GLFW_NO_WINDOW_CONTEXT and @ref GLFW_PLATFORM_ERROR.
5618  *
5619  *  @thread_safety This function may be called from any thread.
5620  *
5621  *  @sa @ref context_current
5622  *  @sa @ref glfwGetCurrentContext
5623  *
5624  *  @since Added in version 3.0.
5625  *
5626  *  @ingroup context
5627  */
5628 GLFWAPI void glfwMakeContextCurrent(GLFWwindow* window);
5629
5630 /*! @brief Returns the window whose context is current on the calling thread.
5631  *
5632  *  This function returns the window whose OpenGL or OpenGL ES context is
5633  *  current on the calling thread.
5634  *
5635  *  @return The window whose context is current, or `NULL` if no window's
5636  *  context is current.
5637  *
5638  *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
5639  *
5640  *  @thread_safety This function may be called from any thread.
5641  *
5642  *  @sa @ref context_current
5643  *  @sa @ref glfwMakeContextCurrent
5644  *
5645  *  @since Added in version 3.0.
5646  *
5647  *  @ingroup context
5648  */
5649 GLFWAPI GLFWwindow* glfwGetCurrentContext(void);
5650
5651 /*! @brief Swaps the front and back buffers of the specified window.
5652  *
5653  *  This function swaps the front and back buffers of the specified window when
5654  *  rendering with OpenGL or OpenGL ES.  If the swap interval is greater than
5655  *  zero, the GPU driver waits the specified number of screen updates before
5656  *  swapping the buffers.
5657  *
5658  *  The specified window must have an OpenGL or OpenGL ES context.  Specifying
5659  *  a window without a context will generate a @ref GLFW_NO_WINDOW_CONTEXT
5660  *  error.
5661  *
5662  *  This function does not apply to Vulkan.  If you are rendering with Vulkan,
5663  *  see `vkQueuePresentKHR` instead.
5664  *
5665  *  @param[in] window The window whose buffers to swap.
5666  *
5667  *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
5668  *  GLFW_NO_WINDOW_CONTEXT and @ref GLFW_PLATFORM_ERROR.
5669  *
5670  *  @remark __EGL:__ The context of the specified window must be current on the
5671  *  calling thread.
5672  *
5673  *  @thread_safety This function may be called from any thread.
5674  *
5675  *  @sa @ref buffer_swap
5676  *  @sa @ref glfwSwapInterval
5677  *
5678  *  @since Added in version 1.0.
5679  *  @glfw3 Added window handle parameter.
5680  *
5681  *  @ingroup window
5682  */
5683 GLFWAPI void glfwSwapBuffers(GLFWwindow* window);
5684
5685 /*! @brief Sets the swap interval for the current context.
5686  *
5687  *  This function sets the swap interval for the current OpenGL or OpenGL ES
5688  *  context, i.e. the number of screen updates to wait from the time @ref
5689  *  glfwSwapBuffers was called before swapping the buffers and returning.  This
5690  *  is sometimes called _vertical synchronization_, _vertical retrace
5691  *  synchronization_ or just _vsync_.
5692  *
5693  *  A context that supports either of the `WGL_EXT_swap_control_tear` and
5694  *  `GLX_EXT_swap_control_tear` extensions also accepts _negative_ swap
5695  *  intervals, which allows the driver to swap immediately even if a frame
5696  *  arrives a little bit late.  You can check for these extensions with @ref
5697  *  glfwExtensionSupported.
5698  *
5699  *  A context must be current on the calling thread.  Calling this function
5700  *  without a current context will cause a @ref GLFW_NO_CURRENT_CONTEXT error.
5701  *
5702  *  This function does not apply to Vulkan.  If you are rendering with Vulkan,
5703  *  see the present mode of your swapchain instead.
5704  *
5705  *  @param[in] interval The minimum number of screen updates to wait for
5706  *  until the buffers are swapped by @ref glfwSwapBuffers.
5707  *
5708  *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
5709  *  GLFW_NO_CURRENT_CONTEXT and @ref GLFW_PLATFORM_ERROR.
5710  *
5711  *  @remark This function is not called during context creation, leaving the
5712  *  swap interval set to whatever is the default on that platform.  This is done
5713  *  because some swap interval extensions used by GLFW do not allow the swap
5714  *  interval to be reset to zero once it has been set to a non-zero value.
5715  *
5716  *  @remark Some GPU drivers do not honor the requested swap interval, either
5717  *  because of a user setting that overrides the application's request or due to
5718  *  bugs in the driver.
5719  *
5720  *  @thread_safety This function may be called from any thread.
5721  *
5722  *  @sa @ref buffer_swap
5723  *  @sa @ref glfwSwapBuffers
5724  *
5725  *  @since Added in version 1.0.
5726  *
5727  *  @ingroup context
5728  */
5729 GLFWAPI void glfwSwapInterval(int interval);
5730
5731 /*! @brief Returns whether the specified extension is available.
5732  *
5733  *  This function returns whether the specified
5734  *  [API extension](@ref context_glext) is supported by the current OpenGL or
5735  *  OpenGL ES context.  It searches both for client API extension and context
5736  *  creation API extensions.
5737  *
5738  *  A context must be current on the calling thread.  Calling this function
5739  *  without a current context will cause a @ref GLFW_NO_CURRENT_CONTEXT error.
5740  *
5741  *  As this functions retrieves and searches one or more extension strings each
5742  *  call, it is recommended that you cache its results if it is going to be used
5743  *  frequently.  The extension strings will not change during the lifetime of
5744  *  a context, so there is no danger in doing this.
5745  *
5746  *  This function does not apply to Vulkan.  If you are using Vulkan, see @ref
5747  *  glfwGetRequiredInstanceExtensions, `vkEnumerateInstanceExtensionProperties`
5748  *  and `vkEnumerateDeviceExtensionProperties` instead.
5749  *
5750  *  @param[in] extension The ASCII encoded name of the extension.
5751  *  @return `GLFW_TRUE` if the extension is available, or `GLFW_FALSE`
5752  *  otherwise.
5753  *
5754  *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
5755  *  GLFW_NO_CURRENT_CONTEXT, @ref GLFW_INVALID_VALUE and @ref
5756  *  GLFW_PLATFORM_ERROR.
5757  *
5758  *  @thread_safety This function may be called from any thread.
5759  *
5760  *  @sa @ref context_glext
5761  *  @sa @ref glfwGetProcAddress
5762  *
5763  *  @since Added in version 1.0.
5764  *
5765  *  @ingroup context
5766  */
5767 GLFWAPI int glfwExtensionSupported(const char* extension);
5768
5769 /*! @brief Returns the address of the specified function for the current
5770  *  context.
5771  *
5772  *  This function returns the address of the specified OpenGL or OpenGL ES
5773  *  [core or extension function](@ref context_glext), if it is supported
5774  *  by the current context.
5775  *
5776  *  A context must be current on the calling thread.  Calling this function
5777  *  without a current context will cause a @ref GLFW_NO_CURRENT_CONTEXT error.
5778  *
5779  *  This function does not apply to Vulkan.  If you are rendering with Vulkan,
5780  *  see @ref glfwGetInstanceProcAddress, `vkGetInstanceProcAddr` and
5781  *  `vkGetDeviceProcAddr` instead.
5782  *
5783  *  @param[in] procname The ASCII encoded name of the function.
5784  *  @return The address of the function, or `NULL` if an
5785  *  [error](@ref error_handling) occurred.
5786  *
5787  *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
5788  *  GLFW_NO_CURRENT_CONTEXT and @ref GLFW_PLATFORM_ERROR.
5789  *
5790  *  @remark The address of a given function is not guaranteed to be the same
5791  *  between contexts.
5792  *
5793  *  @remark This function may return a non-`NULL` address despite the
5794  *  associated version or extension not being available.  Always check the
5795  *  context version or extension string first.
5796  *
5797  *  @pointer_lifetime The returned function pointer is valid until the context
5798  *  is destroyed or the library is terminated.
5799  *
5800  *  @thread_safety This function may be called from any thread.
5801  *
5802  *  @sa @ref context_glext
5803  *  @sa @ref glfwExtensionSupported
5804  *
5805  *  @since Added in version 1.0.
5806  *
5807  *  @ingroup context
5808  */
5809 GLFWAPI GLFWglproc glfwGetProcAddress(const char* procname);
5810
5811 /*! @brief Returns whether the Vulkan loader and an ICD have been found.
5812  *
5813  *  This function returns whether the Vulkan loader and any minimally functional
5814  *  ICD have been found.
5815  *
5816  *  The availability of a Vulkan loader and even an ICD does not by itself
5817  *  guarantee that surface creation or even instance creation is possible.
5818  *  For example, on Fermi systems Nvidia will install an ICD that provides no
5819  *  actual Vulkan support.  Call @ref glfwGetRequiredInstanceExtensions to check
5820  *  whether the extensions necessary for Vulkan surface creation are available
5821  *  and @ref glfwGetPhysicalDevicePresentationSupport to check whether a queue
5822  *  family of a physical device supports image presentation.
5823  *
5824  *  @return `GLFW_TRUE` if Vulkan is minimally available, or `GLFW_FALSE`
5825  *  otherwise.
5826  *
5827  *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
5828  *
5829  *  @thread_safety This function may be called from any thread.
5830  *
5831  *  @sa @ref vulkan_support
5832  *
5833  *  @since Added in version 3.2.
5834  *
5835  *  @ingroup vulkan
5836  */
5837 GLFWAPI int glfwVulkanSupported(void);
5838
5839 /*! @brief Returns the Vulkan instance extensions required by GLFW.
5840  *
5841  *  This function returns an array of names of Vulkan instance extensions required
5842  *  by GLFW for creating Vulkan surfaces for GLFW windows.  If successful, the
5843  *  list will always contain `VK_KHR_surface`, so if you don't require any
5844  *  additional extensions you can pass this list directly to the
5845  *  `VkInstanceCreateInfo` struct.
5846  *
5847  *  If Vulkan is not available on the machine, this function returns `NULL` and
5848  *  generates a @ref GLFW_API_UNAVAILABLE error.  Call @ref glfwVulkanSupported
5849  *  to check whether Vulkan is at least minimally available.
5850  *
5851  *  If Vulkan is available but no set of extensions allowing window surface
5852  *  creation was found, this function returns `NULL`.  You may still use Vulkan
5853  *  for off-screen rendering and compute work.
5854  *
5855  *  @param[out] count Where to store the number of extensions in the returned
5856  *  array.  This is set to zero if an error occurred.
5857  *  @return An array of ASCII encoded extension names, or `NULL` if an
5858  *  [error](@ref error_handling) occurred.
5859  *
5860  *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
5861  *  GLFW_API_UNAVAILABLE.
5862  *
5863  *  @remark Additional extensions may be required by future versions of GLFW.
5864  *  You should check if any extensions you wish to enable are already in the
5865  *  returned array, as it is an error to specify an extension more than once in
5866  *  the `VkInstanceCreateInfo` struct.
5867  *
5868  *  @remark @macos This function currently supports either the
5869  *  `VK_MVK_macos_surface` extension from MoltenVK or `VK_EXT_metal_surface`
5870  *  extension.
5871  *
5872  *  @pointer_lifetime The returned array is allocated and freed by GLFW.  You
5873  *  should not free it yourself.  It is guaranteed to be valid only until the
5874  *  library is terminated.
5875  *
5876  *  @thread_safety This function may be called from any thread.
5877  *
5878  *  @sa @ref vulkan_ext
5879  *  @sa @ref glfwCreateWindowSurface
5880  *
5881  *  @since Added in version 3.2.
5882  *
5883  *  @ingroup vulkan
5884  */
5885 GLFWAPI const char** glfwGetRequiredInstanceExtensions(uint32_t* count);
5886
5887 #if defined(VK_VERSION_1_0)
5888
5889 /*! @brief Returns the address of the specified Vulkan instance function.
5890  *
5891  *  This function returns the address of the specified Vulkan core or extension
5892  *  function for the specified instance.  If instance is set to `NULL` it can
5893  *  return any function exported from the Vulkan loader, including at least the
5894  *  following functions:
5895  *
5896  *  - `vkEnumerateInstanceExtensionProperties`
5897  *  - `vkEnumerateInstanceLayerProperties`
5898  *  - `vkCreateInstance`
5899  *  - `vkGetInstanceProcAddr`
5900  *
5901  *  If Vulkan is not available on the machine, this function returns `NULL` and
5902  *  generates a @ref GLFW_API_UNAVAILABLE error.  Call @ref glfwVulkanSupported
5903  *  to check whether Vulkan is at least minimally available.
5904  *
5905  *  This function is equivalent to calling `vkGetInstanceProcAddr` with
5906  *  a platform-specific query of the Vulkan loader as a fallback.
5907  *
5908  *  @param[in] instance The Vulkan instance to query, or `NULL` to retrieve
5909  *  functions related to instance creation.
5910  *  @param[in] procname The ASCII encoded name of the function.
5911  *  @return The address of the function, or `NULL` if an
5912  *  [error](@ref error_handling) occurred.
5913  *
5914  *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
5915  *  GLFW_API_UNAVAILABLE.
5916  *
5917  *  @pointer_lifetime The returned function pointer is valid until the library
5918  *  is terminated.
5919  *
5920  *  @thread_safety This function may be called from any thread.
5921  *
5922  *  @sa @ref vulkan_proc
5923  *
5924  *  @since Added in version 3.2.
5925  *
5926  *  @ingroup vulkan
5927  */
5928 GLFWAPI GLFWvkproc glfwGetInstanceProcAddress(VkInstance instance, const char* procname);
5929
5930 /*! @brief Returns whether the specified queue family can present images.
5931  *
5932  *  This function returns whether the specified queue family of the specified
5933  *  physical device supports presentation to the platform GLFW was built for.
5934  *
5935  *  If Vulkan or the required window surface creation instance extensions are
5936  *  not available on the machine, or if the specified instance was not created
5937  *  with the required extensions, this function returns `GLFW_FALSE` and
5938  *  generates a @ref GLFW_API_UNAVAILABLE error.  Call @ref glfwVulkanSupported
5939  *  to check whether Vulkan is at least minimally available and @ref
5940  *  glfwGetRequiredInstanceExtensions to check what instance extensions are
5941  *  required.
5942  *
5943  *  @param[in] instance The instance that the physical device belongs to.
5944  *  @param[in] device The physical device that the queue family belongs to.
5945  *  @param[in] queuefamily The index of the queue family to query.
5946  *  @return `GLFW_TRUE` if the queue family supports presentation, or
5947  *  `GLFW_FALSE` otherwise.
5948  *
5949  *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
5950  *  GLFW_API_UNAVAILABLE and @ref GLFW_PLATFORM_ERROR.
5951  *
5952  *  @remark @macos This function currently always returns `GLFW_TRUE`, as the
5953  *  `VK_MVK_macos_surface` extension does not provide
5954  *  a `vkGetPhysicalDevice*PresentationSupport` type function.
5955  *
5956  *  @thread_safety This function may be called from any thread.  For
5957  *  synchronization details of Vulkan objects, see the Vulkan specification.
5958  *
5959  *  @sa @ref vulkan_present
5960  *
5961  *  @since Added in version 3.2.
5962  *
5963  *  @ingroup vulkan
5964  */
5965 GLFWAPI int glfwGetPhysicalDevicePresentationSupport(VkInstance instance, VkPhysicalDevice device, uint32_t queuefamily);
5966
5967 /*! @brief Creates a Vulkan surface for the specified window.
5968  *
5969  *  This function creates a Vulkan surface for the specified window.
5970  *
5971  *  If the Vulkan loader or at least one minimally functional ICD were not found,
5972  *  this function returns `VK_ERROR_INITIALIZATION_FAILED` and generates a @ref
5973  *  GLFW_API_UNAVAILABLE error.  Call @ref glfwVulkanSupported to check whether
5974  *  Vulkan is at least minimally available.
5975  *
5976  *  If the required window surface creation instance extensions are not
5977  *  available or if the specified instance was not created with these extensions
5978  *  enabled, this function returns `VK_ERROR_EXTENSION_NOT_PRESENT` and
5979  *  generates a @ref GLFW_API_UNAVAILABLE error.  Call @ref
5980  *  glfwGetRequiredInstanceExtensions to check what instance extensions are
5981  *  required.
5982  *
5983  *  The window surface cannot be shared with another API so the window must
5984  *  have been created with the [client api hint](@ref GLFW_CLIENT_API_attrib)
5985  *  set to `GLFW_NO_API` otherwise it generates a @ref GLFW_INVALID_VALUE error
5986  *  and returns `VK_ERROR_NATIVE_WINDOW_IN_USE_KHR`.
5987  *
5988  *  The window surface must be destroyed before the specified Vulkan instance.
5989  *  It is the responsibility of the caller to destroy the window surface.  GLFW
5990  *  does not destroy it for you.  Call `vkDestroySurfaceKHR` to destroy the
5991  *  surface.
5992  *
5993  *  @param[in] instance The Vulkan instance to create the surface in.
5994  *  @param[in] window The window to create the surface for.
5995  *  @param[in] allocator The allocator to use, or `NULL` to use the default
5996  *  allocator.
5997  *  @param[out] surface Where to store the handle of the surface.  This is set
5998  *  to `VK_NULL_HANDLE` if an error occurred.
5999  *  @return `VK_SUCCESS` if successful, or a Vulkan error code if an
6000  *  [error](@ref error_handling) occurred.
6001  *
6002  *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
6003  *  GLFW_API_UNAVAILABLE, @ref GLFW_PLATFORM_ERROR and @ref GLFW_INVALID_VALUE
6004  *
6005  *  @remark If an error occurs before the creation call is made, GLFW returns
6006  *  the Vulkan error code most appropriate for the error.  Appropriate use of
6007  *  @ref glfwVulkanSupported and @ref glfwGetRequiredInstanceExtensions should
6008  *  eliminate almost all occurrences of these errors.
6009  *
6010  *  @remark @macos This function currently only supports the
6011  *  `VK_MVK_macos_surface` extension from MoltenVK.
6012  *
6013  *  @remark @macos This function creates and sets a `CAMetalLayer` instance for
6014  *  the window content view, which is required for MoltenVK to function.
6015  *
6016  *  @thread_safety This function may be called from any thread.  For
6017  *  synchronization details of Vulkan objects, see the Vulkan specification.
6018  *
6019  *  @sa @ref vulkan_surface
6020  *  @sa @ref glfwGetRequiredInstanceExtensions
6021  *
6022  *  @since Added in version 3.2.
6023  *
6024  *  @ingroup vulkan
6025  */
6026 GLFWAPI VkResult glfwCreateWindowSurface(VkInstance instance, GLFWwindow* window, const VkAllocationCallbacks* allocator, VkSurfaceKHR* surface);
6027
6028 #endif /*VK_VERSION_1_0*/
6029
6030
6031 /*************************************************************************
6032  * Global definition cleanup
6033  *************************************************************************/
6034
6035 /* ------------------- BEGIN SYSTEM/COMPILER SPECIFIC -------------------- */
6036
6037 #ifdef GLFW_WINGDIAPI_DEFINED
6038  #undef WINGDIAPI
6039  #undef GLFW_WINGDIAPI_DEFINED
6040 #endif
6041
6042 #ifdef GLFW_CALLBACK_DEFINED
6043  #undef CALLBACK
6044  #undef GLFW_CALLBACK_DEFINED
6045 #endif
6046
6047 /* Some OpenGL related headers need GLAPIENTRY, but it is unconditionally
6048  * defined by some gl.h variants (OpenBSD) so define it after if needed.
6049  */
6050 #ifndef GLAPIENTRY
6051  #define GLAPIENTRY APIENTRY
6052 #endif
6053
6054 /* -------------------- END SYSTEM/COMPILER SPECIFIC --------------------- */
6055
6056
6057 #ifdef __cplusplus
6058 }
6059 #endif
6060
6061 #endif /* _glfw3_h_ */
6062