Logo

index : raylib-jai

---

  • summary
  • about
  • tree
  • log
  • branches
<< path: root/public/raylib-jai.git/html/Raylib/raylib/src/external/glfw/include/GLFW/glfw3.h blob: 9c55ac9d94df55d1891d533654f465f47053e6bf [raw] [clear marker]

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