blob: 73ebedd2cb3769e30d8a7db5e1afd0592b68e5c6 [file] [log] [blame]
Camilla Berglund2955cd32010-11-17 15:42:55 +01001/*************************************************************************
Camilla Berglund53fafad2016-08-18 23:42:15 +02002 * GLFW 3.3 - www.glfw.org
Camilla Berglund3cfc4002013-07-29 20:53:17 +02003 * A library for OpenGL, window and input
Camilla Berglund3249f812010-09-07 17:34:51 +02004 *------------------------------------------------------------------------
5 * Copyright (c) 2002-2006 Marcus Geelnard
Camilla Berglund757eea22016-06-01 16:17:06 +02006 * Copyright (c) 2006-2016 Camilla Berglund <elmindreda@glfw.org>
Camilla Berglund3249f812010-09-07 17:34:51 +02007 *
8 * This software is provided 'as-is', without any express or implied
9 * warranty. In no event will the authors be held liable for any damages
10 * arising from the use of this software.
11 *
12 * Permission is granted to anyone to use this software for any purpose,
13 * including commercial applications, and to alter it and redistribute it
14 * freely, subject to the following restrictions:
15 *
16 * 1. The origin of this software must not be misrepresented; you must not
17 * claim that you wrote the original software. If you use this software
18 * in a product, an acknowledgment in the product documentation would
19 * be appreciated but is not required.
20 *
21 * 2. Altered source versions must be plainly marked as such, and must not
22 * be misrepresented as being the original software.
23 *
24 * 3. This notice may not be removed or altered from any source
25 * distribution.
26 *
27 *************************************************************************/
28
Camilla Berglundf8df91d2013-01-15 01:59:56 +010029#ifndef _glfw3_h_
30#define _glfw3_h_
Camilla Berglund3249f812010-09-07 17:34:51 +020031
32#ifdef __cplusplus
33extern "C" {
34#endif
35
36
37/*************************************************************************
Camilla Berglundbce2cd62012-11-22 16:38:24 +010038 * Doxygen documentation
39 *************************************************************************/
40
Camilla Berglund318e8ac2015-10-24 20:48:46 +020041/*! @file glfw3.h
42 * @brief The header of the GLFW 3 API.
43 *
44 * This is the header file of the GLFW 3 API. It defines all its types and
45 * declares all its functions.
46 *
47 * For more information about how to use this file, see @ref build_include.
48 */
Camilla Berglund80c203f2016-02-19 10:29:13 +010049/*! @defgroup context Context reference
Camilla Berglund4591ad22014-09-18 15:03:29 +020050 *
Camilla Berglund80c203f2016-02-19 10:29:13 +010051 * This is the reference documentation for OpenGL and OpenGL ES context related
52 * functions. For more task-oriented information, see the @ref context_guide.
Camilla Berglund3f5843f2012-12-13 02:22:39 +010053 */
Camilla Berglund80c203f2016-02-19 10:29:13 +010054/*! @defgroup vulkan Vulkan reference
Camilla Berglund9b75bff2015-08-10 20:19:04 +020055 *
Camilla Berglund80c203f2016-02-19 10:29:13 +010056 * This is the reference documentation for Vulkan related functions and types.
57 * For more task-oriented information, see the @ref vulkan_guide.
Camilla Berglund9b75bff2015-08-10 20:19:04 +020058 */
Camilla Berglund80c203f2016-02-19 10:29:13 +010059/*! @defgroup init Initialization, version and error reference
Camilla Berglund4591ad22014-09-18 15:03:29 +020060 *
61 * This is the reference documentation for initialization and termination of
Camilla Berglund80c203f2016-02-19 10:29:13 +010062 * the library, version management and error handling. For more task-oriented
63 * information, see the @ref intro_guide.
Camilla Berglundbce2cd62012-11-22 16:38:24 +010064 */
Camilla Berglund80c203f2016-02-19 10:29:13 +010065/*! @defgroup input Input reference
Camilla Berglund4591ad22014-09-18 15:03:29 +020066 *
67 * This is the reference documentation for input related functions and types.
Camilla Berglund80c203f2016-02-19 10:29:13 +010068 * For more task-oriented information, see the @ref input_guide.
Camilla Berglundbce2cd62012-11-22 16:38:24 +010069 */
Camilla Berglund80c203f2016-02-19 10:29:13 +010070/*! @defgroup monitor Monitor reference
Camilla Berglundf5f55e32013-06-17 12:56:36 +020071 *
72 * This is the reference documentation for monitor related functions and types.
Camilla Berglund80c203f2016-02-19 10:29:13 +010073 * For more task-oriented information, see the @ref monitor_guide.
Camilla Berglund5f68e122012-11-27 17:07:28 +010074 */
Camilla Berglund80c203f2016-02-19 10:29:13 +010075/*! @defgroup window Window reference
Camilla Berglundbce2cd62012-11-22 16:38:24 +010076 *
Camilla Berglundf5f55e32013-06-17 12:56:36 +020077 * This is the reference documentation for window related functions and types,
Camilla Berglund80c203f2016-02-19 10:29:13 +010078 * including creation, deletion and event polling. For more task-oriented
79 * information, see the @ref window_guide.
Camilla Berglundbce2cd62012-11-22 16:38:24 +010080 */
Camilla Berglundbce2cd62012-11-22 16:38:24 +010081
82
83/*************************************************************************
Camilla Berglund8d910d72015-02-22 18:35:10 +010084 * Compiler- and platform-specific preprocessor work
Camilla Berglund3249f812010-09-07 17:34:51 +020085 *************************************************************************/
86
Camilla Berglund8d910d72015-02-22 18:35:10 +010087/* If we are we on Windows, we want a single define for it.
Camilla Berglund3249f812010-09-07 17:34:51 +020088 */
Camilla Berglunde8ce4ab2015-02-22 18:18:43 +010089#if !defined(_WIN32) && (defined(__WIN32__) || defined(WIN32) || defined(__MINGW32__))
Camilla Berglund3249f812010-09-07 17:34:51 +020090 #define _WIN32
91#endif /* _WIN32 */
92
Camilla Berglund8d910d72015-02-22 18:35:10 +010093/* It is customary to use APIENTRY for OpenGL function pointer declarations on
94 * all platforms. Additionally, the Windows OpenGL header needs APIENTRY.
Camilla Berglund3249f812010-09-07 17:34:51 +020095 */
96#ifndef APIENTRY
97 #ifdef _WIN32
98 #define APIENTRY __stdcall
99 #else
100 #define APIENTRY
101 #endif
Camilla Berglund3249f812010-09-07 17:34:51 +0200102#endif /* APIENTRY */
103
Camilla Berglund8d910d72015-02-22 18:35:10 +0100104/* Some Windows OpenGL headers need this.
Camilla Berglund3249f812010-09-07 17:34:51 +0200105 */
Camilla Berglund3249f812010-09-07 17:34:51 +0200106#if !defined(WINGDIAPI) && defined(_WIN32)
Camilla Berglundc5353642015-02-22 18:14:30 +0100107 #define WINGDIAPI __declspec(dllimport)
Camilla Berglund4afc67c2011-07-27 17:09:17 +0200108 #define GLFW_WINGDIAPI_DEFINED
Camilla Berglund3249f812010-09-07 17:34:51 +0200109#endif /* WINGDIAPI */
110
Camilla Berglund8d910d72015-02-22 18:35:10 +0100111/* Some Windows GLU headers need this.
112 */
Camilla Berglund3249f812010-09-07 17:34:51 +0200113#if !defined(CALLBACK) && defined(_WIN32)
Camilla Berglundd586fe62015-02-22 18:17:34 +0100114 #define CALLBACK __stdcall
Camilla Berglund4afc67c2011-07-27 17:09:17 +0200115 #define GLFW_CALLBACK_DEFINED
Camilla Berglund3249f812010-09-07 17:34:51 +0200116#endif /* CALLBACK */
117
Camilla Berglund70423af2016-07-21 00:15:07 +0200118/* Include because most Windows GLU headers need wchar_t and
Camilla Berglund8d6f2652016-10-20 00:50:54 +0200119 * the macOS OpenGL header blocks the definition of ptrdiff_t by glext.h.
Camilla Berglund8221aad2016-03-06 09:40:16 +0100120 * Include it unconditionally to avoid surprising side-effects.
Camilla Berglund8d910d72015-02-22 18:35:10 +0100121 */
Camilla Berglund8221aad2016-03-06 09:40:16 +0100122#include <stddef.h>
Camilla Berglund70423af2016-07-21 00:15:07 +0200123
124/* Include because it is needed by Vulkan and related functions.
125 */
Camilla Berglund5661d032016-03-23 10:09:07 +0100126#include <stdint.h>
Camilla Berglund3249f812010-09-07 17:34:51 +0200127
Camilla Berglundc93b1202013-09-08 16:07:34 +0200128/* Include the chosen client API headers.
129 */
Camilla Berglunddb49aa62016-02-22 13:16:43 +0100130#if defined(__APPLE__)
Camilla Berglund1591caa2015-01-08 06:56:17 +0100131 #if defined(GLFW_INCLUDE_GLCOREARB)
132 #include <OpenGL/gl3.h>
133 #if defined(GLFW_INCLUDE_GLEXT)
134 #include <OpenGL/gl3ext.h>
Camilla Berglundc93b1202013-09-08 16:07:34 +0200135 #endif
Camilla Berglund1591caa2015-01-08 06:56:17 +0100136 #elif !defined(GLFW_INCLUDE_NONE)
137 #if !defined(GLFW_INCLUDE_GLEXT)
138 #define GL_GLEXT_LEGACY
Camilla Berglundc93b1202013-09-08 16:07:34 +0200139 #endif
Camilla Berglund1591caa2015-01-08 06:56:17 +0100140 #include <OpenGL/gl.h>
141 #endif
142 #if defined(GLFW_INCLUDE_GLU)
143 #include <OpenGL/glu.h>
144 #endif
Camilla Berglundc93b1202013-09-08 16:07:34 +0200145#else
Camilla Berglund1591caa2015-01-08 06:56:17 +0100146 #if defined(GLFW_INCLUDE_GLCOREARB)
147 #include <GL/glcorearb.h>
148 #elif defined(GLFW_INCLUDE_ES1)
149 #include <GLES/gl.h>
150 #if defined(GLFW_INCLUDE_GLEXT)
151 #include <GLES/glext.h>
Camilla Berglundc93b1202013-09-08 16:07:34 +0200152 #endif
Camilla Berglund1591caa2015-01-08 06:56:17 +0100153 #elif defined(GLFW_INCLUDE_ES2)
154 #include <GLES2/gl2.h>
155 #if defined(GLFW_INCLUDE_GLEXT)
156 #include <GLES2/gl2ext.h>
Camilla Berglundc93b1202013-09-08 16:07:34 +0200157 #endif
Camilla Berglund1591caa2015-01-08 06:56:17 +0100158 #elif defined(GLFW_INCLUDE_ES3)
159 #include <GLES3/gl3.h>
160 #if defined(GLFW_INCLUDE_GLEXT)
Camilla Berglundca21a5c2016-01-02 21:45:23 +0100161 #include <GLES2/gl2ext.h>
Camilla Berglund1591caa2015-01-08 06:56:17 +0100162 #endif
163 #elif defined(GLFW_INCLUDE_ES31)
164 #include <GLES3/gl31.h>
165 #if defined(GLFW_INCLUDE_GLEXT)
Camilla Berglundca21a5c2016-01-02 21:45:23 +0100166 #include <GLES2/gl2ext.h>
Camilla Berglund1591caa2015-01-08 06:56:17 +0100167 #endif
168 #elif !defined(GLFW_INCLUDE_NONE)
169 #include <GL/gl.h>
170 #if defined(GLFW_INCLUDE_GLEXT)
171 #include <GL/glext.h>
172 #endif
173 #endif
174 #if defined(GLFW_INCLUDE_GLU)
175 #include <GL/glu.h>
176 #endif
Camilla Berglundc93b1202013-09-08 16:07:34 +0200177#endif
Camilla Berglund433db8f2016-09-14 21:13:33 +0200178#if defined(GLFW_INCLUDE_VULKAN)
179 #include <vulkan/vulkan.h>
180#endif
Camilla Berglund3249f812010-09-07 17:34:51 +0200181
Camilla Berglundcc5d7cd2012-03-25 17:43:02 +0200182#if defined(GLFW_DLL) && defined(_GLFW_BUILD_DLL)
Camilla Berglunde8e05d42014-04-23 13:30:11 +0200183 /* GLFW_DLL must be defined by applications that are linking against the DLL
184 * version of the GLFW library. _GLFW_BUILD_DLL is defined by the GLFW
185 * configuration header when compiling the DLL version of the library.
Camilla Berglundbd2d5712013-07-23 01:59:27 +0200186 */
Camilla Berglund0df4e062015-12-13 14:07:27 +0100187 #error "You must not have both GLFW_DLL and _GLFW_BUILD_DLL defined"
Camilla Berglundcc5d7cd2012-03-25 17:43:02 +0200188#endif
189
Camilla Berglund1591caa2015-01-08 06:56:17 +0100190/* GLFWAPI is used to declare public API functions for export
191 * from the DLL / shared library / dynamic library.
192 */
Camilla Berglund2588c9b2012-03-25 17:40:30 +0200193#if defined(_WIN32) && defined(_GLFW_BUILD_DLL)
Camilla Berglund3afa8312014-10-13 14:13:08 +0200194 /* We are building GLFW as a Win32 DLL */
Camilla Berglund2955cd32010-11-17 15:42:55 +0100195 #define GLFWAPI __declspec(dllexport)
Camilla Berglund3249f812010-09-07 17:34:51 +0200196#elif defined(_WIN32) && defined(GLFW_DLL)
Camilla Berglund3afa8312014-10-13 14:13:08 +0200197 /* We are calling GLFW as a Win32 DLL */
Camilla Berglund1247fc02015-02-22 18:10:20 +0100198 #define GLFWAPI __declspec(dllimport)
John Bartholomew93f4eff2013-05-01 13:08:09 +0100199#elif defined(__GNUC__) && defined(_GLFW_BUILD_DLL)
Camilla Berglund3afa8312014-10-13 14:13:08 +0200200 /* We are building GLFW as a shared / dynamic library */
John Bartholomew93f4eff2013-05-01 13:08:09 +0100201 #define GLFWAPI __attribute__((visibility("default")))
Camilla Berglund3249f812010-09-07 17:34:51 +0200202#else
Camilla Berglund3afa8312014-10-13 14:13:08 +0200203 /* We are building or calling GLFW as a static library */
Camilla Berglund3249f812010-09-07 17:34:51 +0200204 #define GLFWAPI
Camilla Berglund3249f812010-09-07 17:34:51 +0200205#endif
206
Camilla Berglund3249f812010-09-07 17:34:51 +0200207
208/*************************************************************************
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100209 * GLFW API tokens
Camilla Berglund3249f812010-09-07 17:34:51 +0200210 *************************************************************************/
211
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100212/*! @name GLFW version macros
213 * @{ */
214/*! @brief The major version number of the GLFW library.
215 *
216 * This is incremented when the API is changed in non-compatible ways.
217 * @ingroup init
218 */
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100219#define GLFW_VERSION_MAJOR 3
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100220/*! @brief The minor version number of the GLFW library.
221 *
222 * This is incremented when features are added to the API but it remains
223 * backward-compatible.
224 * @ingroup init
225 */
Camilla Berglund53fafad2016-08-18 23:42:15 +0200226#define GLFW_VERSION_MINOR 3
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100227/*! @brief The revision number of the GLFW library.
228 *
229 * This is incremented when a bug fix release is made that does not contain any
230 * API changes.
231 * @ingroup init
232 */
Camilla Berglund53fafad2016-08-18 23:42:15 +0200233#define GLFW_VERSION_REVISION 0
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100234/*! @} */
Camilla Berglund3249f812010-09-07 17:34:51 +0200235
Camilla Berglund0eccf752015-08-23 19:30:04 +0200236/*! @name Boolean values
237 * @{ */
238/*! @brief One.
239 *
240 * One. Seriously. You don't _need_ to use this symbol in your code. It's
241 * just semantic sugar for the number 1. You can use `1` or `true` or `_True`
242 * or `GL_TRUE` or whatever you want.
243 */
244#define GLFW_TRUE 1
245/*! @brief Zero.
246 *
247 * Zero. Seriously. You don't _need_ to use this symbol in your code. It's
248 * just just semantic sugar for the number 0. You can use `0` or `false` or
249 * `_False` or `GL_FALSE` or whatever you want.
250 */
251#define GLFW_FALSE 0
252/*! @} */
253
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100254/*! @name Key and button actions
255 * @{ */
Camilla Berglund4591ad22014-09-18 15:03:29 +0200256/*! @brief The key or mouse button was released.
257 *
258 * The key or mouse button was released.
259 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100260 * @ingroup input
261 */
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100262#define GLFW_RELEASE 0
Camilla Berglund4591ad22014-09-18 15:03:29 +0200263/*! @brief The key or mouse button was pressed.
264 *
265 * The key or mouse button was pressed.
266 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100267 * @ingroup input
268 */
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100269#define GLFW_PRESS 1
Camilla Berglund253e0d62013-01-12 17:06:35 +0100270/*! @brief The key was held down until it repeated.
Camilla Berglund4591ad22014-09-18 15:03:29 +0200271 *
272 * The key was held down until it repeated.
273 *
Camilla Berglund253e0d62013-01-12 17:06:35 +0100274 * @ingroup input
275 */
276#define GLFW_REPEAT 2
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100277/*! @} */
Camilla Berglund3249f812010-09-07 17:34:51 +0200278
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200279/*! @defgroup keys Keyboard keys
280 *
Camilla Berglund4188c262015-01-18 01:55:25 +0100281 * See [key input](@ref input_key) for how these are used.
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200282 *
Camilla Berglund4188c262015-01-18 01:55:25 +0100283 * These key codes are inspired by the _USB HID Usage Tables v1.12_ (p. 53-60),
284 * but re-arranged to map to 7-bit ASCII for printable keys (function keys are
285 * put in the 256+ range).
286 *
287 * The naming of the key codes follow these rules:
288 * - The US keyboard layout is used
289 * - Names of printable alpha-numeric characters are used (e.g. "A", "R",
290 * "3", etc.)
291 * - For non-alphanumeric characters, Unicode:ish names are used (e.g.
292 * "COMMA", "LEFT_SQUARE_BRACKET", etc.). Note that some names do not
293 * correspond to the Unicode standard (usually for brevity)
294 * - Keys that lack a clear US mapping are named "WORLD_x"
295 * - For non-printable keys, custom names are used (e.g. "F4",
296 * "BACKSPACE", etc.)
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200297 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100298 * @ingroup input
299 * @{
300 */
301
Camilla Berglund11615fc2013-05-30 17:19:12 +0200302/* The unknown key */
303#define GLFW_KEY_UNKNOWN -1
304
Marcusc0cb4c22011-01-02 11:18:14 +0100305/* Printable keys */
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100306#define GLFW_KEY_SPACE 32
307#define GLFW_KEY_APOSTROPHE 39 /* ' */
308#define GLFW_KEY_COMMA 44 /* , */
309#define GLFW_KEY_MINUS 45 /* - */
310#define GLFW_KEY_PERIOD 46 /* . */
311#define GLFW_KEY_SLASH 47 /* / */
312#define GLFW_KEY_0 48
313#define GLFW_KEY_1 49
314#define GLFW_KEY_2 50
315#define GLFW_KEY_3 51
316#define GLFW_KEY_4 52
317#define GLFW_KEY_5 53
318#define GLFW_KEY_6 54
319#define GLFW_KEY_7 55
320#define GLFW_KEY_8 56
321#define GLFW_KEY_9 57
322#define GLFW_KEY_SEMICOLON 59 /* ; */
323#define GLFW_KEY_EQUAL 61 /* = */
324#define GLFW_KEY_A 65
325#define GLFW_KEY_B 66
326#define GLFW_KEY_C 67
327#define GLFW_KEY_D 68
328#define GLFW_KEY_E 69
329#define GLFW_KEY_F 70
330#define GLFW_KEY_G 71
331#define GLFW_KEY_H 72
332#define GLFW_KEY_I 73
333#define GLFW_KEY_J 74
334#define GLFW_KEY_K 75
335#define GLFW_KEY_L 76
336#define GLFW_KEY_M 77
337#define GLFW_KEY_N 78
338#define GLFW_KEY_O 79
339#define GLFW_KEY_P 80
340#define GLFW_KEY_Q 81
341#define GLFW_KEY_R 82
342#define GLFW_KEY_S 83
343#define GLFW_KEY_T 84
344#define GLFW_KEY_U 85
345#define GLFW_KEY_V 86
346#define GLFW_KEY_W 87
347#define GLFW_KEY_X 88
348#define GLFW_KEY_Y 89
349#define GLFW_KEY_Z 90
350#define GLFW_KEY_LEFT_BRACKET 91 /* [ */
351#define GLFW_KEY_BACKSLASH 92 /* \ */
352#define GLFW_KEY_RIGHT_BRACKET 93 /* ] */
353#define GLFW_KEY_GRAVE_ACCENT 96 /* ` */
354#define GLFW_KEY_WORLD_1 161 /* non-US #1 */
355#define GLFW_KEY_WORLD_2 162 /* non-US #2 */
Marcusc0cb4c22011-01-02 11:18:14 +0100356
357/* Function keys */
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100358#define GLFW_KEY_ESCAPE 256
359#define GLFW_KEY_ENTER 257
360#define GLFW_KEY_TAB 258
361#define GLFW_KEY_BACKSPACE 259
362#define GLFW_KEY_INSERT 260
363#define GLFW_KEY_DELETE 261
364#define GLFW_KEY_RIGHT 262
365#define GLFW_KEY_LEFT 263
366#define GLFW_KEY_DOWN 264
367#define GLFW_KEY_UP 265
368#define GLFW_KEY_PAGE_UP 266
369#define GLFW_KEY_PAGE_DOWN 267
370#define GLFW_KEY_HOME 268
371#define GLFW_KEY_END 269
372#define GLFW_KEY_CAPS_LOCK 280
373#define GLFW_KEY_SCROLL_LOCK 281
374#define GLFW_KEY_NUM_LOCK 282
375#define GLFW_KEY_PRINT_SCREEN 283
376#define GLFW_KEY_PAUSE 284
377#define GLFW_KEY_F1 290
378#define GLFW_KEY_F2 291
379#define GLFW_KEY_F3 292
380#define GLFW_KEY_F4 293
381#define GLFW_KEY_F5 294
382#define GLFW_KEY_F6 295
383#define GLFW_KEY_F7 296
384#define GLFW_KEY_F8 297
385#define GLFW_KEY_F9 298
386#define GLFW_KEY_F10 299
387#define GLFW_KEY_F11 300
388#define GLFW_KEY_F12 301
389#define GLFW_KEY_F13 302
390#define GLFW_KEY_F14 303
391#define GLFW_KEY_F15 304
392#define GLFW_KEY_F16 305
393#define GLFW_KEY_F17 306
394#define GLFW_KEY_F18 307
395#define GLFW_KEY_F19 308
396#define GLFW_KEY_F20 309
397#define GLFW_KEY_F21 310
398#define GLFW_KEY_F22 311
399#define GLFW_KEY_F23 312
400#define GLFW_KEY_F24 313
401#define GLFW_KEY_F25 314
402#define GLFW_KEY_KP_0 320
403#define GLFW_KEY_KP_1 321
404#define GLFW_KEY_KP_2 322
405#define GLFW_KEY_KP_3 323
406#define GLFW_KEY_KP_4 324
407#define GLFW_KEY_KP_5 325
408#define GLFW_KEY_KP_6 326
409#define GLFW_KEY_KP_7 327
410#define GLFW_KEY_KP_8 328
411#define GLFW_KEY_KP_9 329
412#define GLFW_KEY_KP_DECIMAL 330
413#define GLFW_KEY_KP_DIVIDE 331
414#define GLFW_KEY_KP_MULTIPLY 332
415#define GLFW_KEY_KP_SUBTRACT 333
416#define GLFW_KEY_KP_ADD 334
417#define GLFW_KEY_KP_ENTER 335
418#define GLFW_KEY_KP_EQUAL 336
419#define GLFW_KEY_LEFT_SHIFT 340
420#define GLFW_KEY_LEFT_CONTROL 341
421#define GLFW_KEY_LEFT_ALT 342
422#define GLFW_KEY_LEFT_SUPER 343
423#define GLFW_KEY_RIGHT_SHIFT 344
424#define GLFW_KEY_RIGHT_CONTROL 345
425#define GLFW_KEY_RIGHT_ALT 346
426#define GLFW_KEY_RIGHT_SUPER 347
427#define GLFW_KEY_MENU 348
Camilla Berglund9c315412015-07-02 14:24:50 +0200428
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100429#define GLFW_KEY_LAST GLFW_KEY_MENU
Marcusc0cb4c22011-01-02 11:18:14 +0100430
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100431/*! @} */
432
Camilla Berglund98cbf6f2013-05-23 14:42:33 +0200433/*! @defgroup mods Modifier key flags
Camilla Berglund4188c262015-01-18 01:55:25 +0100434 *
435 * See [key input](@ref input_key) for how these are used.
436 *
Camilla Berglund98cbf6f2013-05-23 14:42:33 +0200437 * @ingroup input
Camilla Berglund2d1b8352012-12-09 19:19:00 +0100438 * @{ */
439
Camilla Berglund98cbf6f2013-05-23 14:42:33 +0200440/*! @brief If this bit is set one or more Shift keys were held down.
Camilla Berglund2d1b8352012-12-09 19:19:00 +0100441 */
442#define GLFW_MOD_SHIFT 0x0001
Camilla Berglund98cbf6f2013-05-23 14:42:33 +0200443/*! @brief If this bit is set one or more Control keys were held down.
Camilla Berglund2d1b8352012-12-09 19:19:00 +0100444 */
Camilla Berglund3bcffba2013-05-23 14:11:05 +0200445#define GLFW_MOD_CONTROL 0x0002
Camilla Berglund98cbf6f2013-05-23 14:42:33 +0200446/*! @brief If this bit is set one or more Alt keys were held down.
Camilla Berglund2d1b8352012-12-09 19:19:00 +0100447 */
448#define GLFW_MOD_ALT 0x0004
Camilla Berglund98cbf6f2013-05-23 14:42:33 +0200449/*! @brief If this bit is set one or more Super keys were held down.
Noel Cowereff85f92013-05-23 13:22:27 +0200450 */
451#define GLFW_MOD_SUPER 0x0008
Camilla Berglund2d1b8352012-12-09 19:19:00 +0100452
453/*! @} */
454
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100455/*! @defgroup buttons Mouse buttons
Camilla Berglund4188c262015-01-18 01:55:25 +0100456 *
457 * See [mouse button input](@ref input_mouse_button) for how these are used.
458 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100459 * @ingroup input
460 * @{ */
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100461#define GLFW_MOUSE_BUTTON_1 0
462#define GLFW_MOUSE_BUTTON_2 1
463#define GLFW_MOUSE_BUTTON_3 2
464#define GLFW_MOUSE_BUTTON_4 3
465#define GLFW_MOUSE_BUTTON_5 4
466#define GLFW_MOUSE_BUTTON_6 5
467#define GLFW_MOUSE_BUTTON_7 6
468#define GLFW_MOUSE_BUTTON_8 7
469#define GLFW_MOUSE_BUTTON_LAST GLFW_MOUSE_BUTTON_8
470#define GLFW_MOUSE_BUTTON_LEFT GLFW_MOUSE_BUTTON_1
471#define GLFW_MOUSE_BUTTON_RIGHT GLFW_MOUSE_BUTTON_2
472#define GLFW_MOUSE_BUTTON_MIDDLE GLFW_MOUSE_BUTTON_3
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100473/*! @} */
Camilla Berglund3249f812010-09-07 17:34:51 +0200474
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100475/*! @defgroup joysticks Joysticks
Camilla Berglund4188c262015-01-18 01:55:25 +0100476 *
477 * See [joystick input](@ref joystick) for how these are used.
478 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100479 * @ingroup input
480 * @{ */
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100481#define GLFW_JOYSTICK_1 0
482#define GLFW_JOYSTICK_2 1
483#define GLFW_JOYSTICK_3 2
484#define GLFW_JOYSTICK_4 3
485#define GLFW_JOYSTICK_5 4
486#define GLFW_JOYSTICK_6 5
487#define GLFW_JOYSTICK_7 6
488#define GLFW_JOYSTICK_8 7
489#define GLFW_JOYSTICK_9 8
490#define GLFW_JOYSTICK_10 9
491#define GLFW_JOYSTICK_11 10
492#define GLFW_JOYSTICK_12 11
493#define GLFW_JOYSTICK_13 12
494#define GLFW_JOYSTICK_14 13
495#define GLFW_JOYSTICK_15 14
496#define GLFW_JOYSTICK_16 15
497#define GLFW_JOYSTICK_LAST GLFW_JOYSTICK_16
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100498/*! @} */
Camilla Berglund3249f812010-09-07 17:34:51 +0200499
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100500/*! @defgroup errors Error codes
Camilla Berglund4188c262015-01-18 01:55:25 +0100501 *
502 * See [error handling](@ref error_handling) for how these are used.
503 *
Camilla Berglund4591ad22014-09-18 15:03:29 +0200504 * @ingroup init
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100505 * @{ */
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100506/*! @brief GLFW has not been initialized.
Camilla Berglund4591ad22014-09-18 15:03:29 +0200507 *
Camilla Berglund0df4e062015-12-13 14:07:27 +0100508 * This occurs if a GLFW function was called that must not be called unless the
Camilla Berglund4591ad22014-09-18 15:03:29 +0200509 * library is [initialized](@ref intro_init).
510 *
Camilla Berglund951a9582016-01-31 21:32:14 +0100511 * @analysis Application programmer error. Initialize GLFW before calling any
512 * function that requires initialization.
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100513 */
Camilla Berglund393e4392013-05-27 22:16:59 +0200514#define GLFW_NOT_INITIALIZED 0x00010001
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100515/*! @brief No context is current for this thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +0200516 *
517 * This occurs if a GLFW function was called that needs and operates on the
518 * current OpenGL or OpenGL ES context but no context is current on the calling
519 * thread. One such function is @ref glfwSwapInterval.
520 *
Camilla Berglund951a9582016-01-31 21:32:14 +0100521 * @analysis Application programmer error. Ensure a context is current before
522 * calling functions that require a current context.
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100523 */
Camilla Berglund393e4392013-05-27 22:16:59 +0200524#define GLFW_NO_CURRENT_CONTEXT 0x00010002
Camilla Berglund4591ad22014-09-18 15:03:29 +0200525/*! @brief One of the arguments to the function was an invalid enum value.
526 *
527 * One of the arguments to the function was an invalid enum value, for example
Camilla Berglundce8f97c2015-01-11 23:33:14 +0100528 * requesting [GLFW_RED_BITS](@ref window_hints_fb) with @ref
529 * glfwGetWindowAttrib.
Camilla Berglund4591ad22014-09-18 15:03:29 +0200530 *
Camilla Berglund951a9582016-01-31 21:32:14 +0100531 * @analysis Application programmer error. Fix the offending call.
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100532 */
Camilla Berglund393e4392013-05-27 22:16:59 +0200533#define GLFW_INVALID_ENUM 0x00010003
Camilla Berglund4591ad22014-09-18 15:03:29 +0200534/*! @brief One of the arguments to the function was an invalid value.
535 *
536 * One of the arguments to the function was an invalid value, for example
537 * requesting a non-existent OpenGL or OpenGL ES version like 2.7.
538 *
539 * Requesting a valid but unavailable OpenGL or OpenGL ES version will instead
540 * result in a @ref GLFW_VERSION_UNAVAILABLE error.
541 *
Camilla Berglund951a9582016-01-31 21:32:14 +0100542 * @analysis Application programmer error. Fix the offending call.
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100543 */
Camilla Berglund393e4392013-05-27 22:16:59 +0200544#define GLFW_INVALID_VALUE 0x00010004
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100545/*! @brief A memory allocation failed.
Camilla Berglund4591ad22014-09-18 15:03:29 +0200546 *
547 * A memory allocation failed.
548 *
Camilla Berglund951a9582016-01-31 21:32:14 +0100549 * @analysis A bug in GLFW or the underlying operating system. Report the bug
550 * to our [issue tracker](https://github.com/glfw/glfw/issues).
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100551 */
Camilla Berglund393e4392013-05-27 22:16:59 +0200552#define GLFW_OUT_OF_MEMORY 0x00010005
Camilla Berglund9b75bff2015-08-10 20:19:04 +0200553/*! @brief GLFW could not find support for the requested API on the system.
Camilla Berglund2d13eb02014-10-13 16:00:11 +0200554 *
Camilla Berglund9b75bff2015-08-10 20:19:04 +0200555 * GLFW could not find support for the requested API on the system.
Camilla Berglund2d13eb02014-10-13 16:00:11 +0200556 *
Camilla Berglund951a9582016-01-31 21:32:14 +0100557 * @analysis The installed graphics driver does not support the requested
Camilla Berglund9b75bff2015-08-10 20:19:04 +0200558 * API, or does not support it via the chosen context creation backend.
Camilla Berglund951a9582016-01-31 21:32:14 +0100559 * Below are a few examples.
Camilla Berglund2d13eb02014-10-13 16:00:11 +0200560 *
561 * @par
562 * Some pre-installed Windows graphics drivers do not support OpenGL. AMD only
Camilla Berglundd95b79f2015-03-30 23:20:49 +0200563 * supports OpenGL ES via EGL, while Nvidia and Intel only support it via
Camilla Berglund8d6f2652016-10-20 00:50:54 +0200564 * a WGL or GLX extension. macOS does not provide OpenGL ES at all. The Mesa
Camilla Berglund138feb82015-01-05 16:46:04 +0100565 * EGL, OpenGL and OpenGL ES libraries do not interface with the Nvidia binary
Camilla Berglund9b75bff2015-08-10 20:19:04 +0200566 * driver. Older graphics drivers do not support Vulkan.
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100567 */
Camilla Berglund393e4392013-05-27 22:16:59 +0200568#define GLFW_API_UNAVAILABLE 0x00010006
Camilla Berglund4591ad22014-09-18 15:03:29 +0200569/*! @brief The requested OpenGL or OpenGL ES version is not available.
570 *
Camilla Berglundd493a822015-03-10 19:51:14 +0100571 * The requested OpenGL or OpenGL ES version (including any requested context
572 * or framebuffer hints) is not available on this machine.
Camilla Berglund4591ad22014-09-18 15:03:29 +0200573 *
Camilla Berglund951a9582016-01-31 21:32:14 +0100574 * @analysis The machine does not support your requirements. If your
575 * application is sufficiently flexible, downgrade your requirements and try
576 * again. Otherwise, inform the user that their machine does not match your
Camilla Berglund4591ad22014-09-18 15:03:29 +0200577 * requirements.
578 *
Camilla Berglund2d13eb02014-10-13 16:00:11 +0200579 * @par
580 * Future invalid OpenGL and OpenGL ES versions, for example OpenGL 4.8 if 5.0
581 * comes out before the 4.x series gets that far, also fail with this error and
582 * not @ref GLFW_INVALID_VALUE, because GLFW cannot know what future versions
583 * will exist.
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100584 */
Camilla Berglund393e4392013-05-27 22:16:59 +0200585#define GLFW_VERSION_UNAVAILABLE 0x00010007
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100586/*! @brief A platform-specific error occurred that does not match any of the
587 * more specific categories.
Camilla Berglund4591ad22014-09-18 15:03:29 +0200588 *
589 * A platform-specific error occurred that does not match any of the more
590 * specific categories.
591 *
Camilla Berglund951a9582016-01-31 21:32:14 +0100592 * @analysis A bug or configuration error in GLFW, the underlying operating
593 * system or its drivers, or a lack of required resources. Report the issue to
594 * our [issue tracker](https://github.com/glfw/glfw/issues).
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100595 */
Camilla Berglund393e4392013-05-27 22:16:59 +0200596#define GLFW_PLATFORM_ERROR 0x00010008
Camilla Berglund2d13eb02014-10-13 16:00:11 +0200597/*! @brief The requested format is not supported or available.
598 *
599 * If emitted during window creation, the requested pixel format is not
600 * supported.
601 *
602 * If emitted when querying the clipboard, the contents of the clipboard could
603 * not be converted to the requested format.
604 *
Camilla Berglund951a9582016-01-31 21:32:14 +0100605 * @analysis If emitted during window creation, one or more
Camilla Berglund2d13eb02014-10-13 16:00:11 +0200606 * [hard constraints](@ref window_hints_hard) did not match any of the
607 * available pixel formats. If your application is sufficiently flexible,
608 * downgrade your requirements and try again. Otherwise, inform the user that
609 * their machine does not match your requirements.
610 *
611 * @par
612 * If emitted when querying the clipboard, ignore the error or report it to
613 * the user, as appropriate.
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100614 */
Camilla Berglund393e4392013-05-27 22:16:59 +0200615#define GLFW_FORMAT_UNAVAILABLE 0x00010009
Camilla Berglund496f5592015-06-18 14:03:02 +0200616/*! @brief The specified window does not have an OpenGL or OpenGL ES context.
617 *
618 * A window that does not have an OpenGL or OpenGL ES context was passed to
619 * a function that requires it to have one.
620 *
Camilla Berglund951a9582016-01-31 21:32:14 +0100621 * @analysis Application programmer error. Fix the offending call.
Camilla Berglund496f5592015-06-18 14:03:02 +0200622 */
623#define GLFW_NO_WINDOW_CONTEXT 0x0001000A
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100624/*! @} */
Camilla Berglund3249f812010-09-07 17:34:51 +0200625
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100626#define GLFW_FOCUSED 0x00020001
627#define GLFW_ICONIFIED 0x00020002
Camilla Berglund393e4392013-05-27 22:16:59 +0200628#define GLFW_RESIZABLE 0x00020003
629#define GLFW_VISIBLE 0x00020004
630#define GLFW_DECORATED 0x00020005
Camilla Berglund25e7ff12014-04-08 15:32:34 +0200631#define GLFW_AUTO_ICONIFY 0x00020006
Camilla Berglund3ce7bfe2014-05-23 14:01:02 +0200632#define GLFW_FLOATING 0x00020007
Camilla Berglunda10caa42015-10-13 12:50:59 +0200633#define GLFW_MAXIMIZED 0x00020008
Camilla Berglund2c091572010-09-09 21:09:11 +0200634
Camilla Berglund53b39a62013-05-30 18:55:45 +0200635#define GLFW_RED_BITS 0x00021001
636#define GLFW_GREEN_BITS 0x00021002
637#define GLFW_BLUE_BITS 0x00021003
638#define GLFW_ALPHA_BITS 0x00021004
639#define GLFW_DEPTH_BITS 0x00021005
640#define GLFW_STENCIL_BITS 0x00021006
641#define GLFW_ACCUM_RED_BITS 0x00021007
642#define GLFW_ACCUM_GREEN_BITS 0x00021008
643#define GLFW_ACCUM_BLUE_BITS 0x00021009
644#define GLFW_ACCUM_ALPHA_BITS 0x0002100A
645#define GLFW_AUX_BUFFERS 0x0002100B
646#define GLFW_STEREO 0x0002100C
647#define GLFW_SAMPLES 0x0002100D
648#define GLFW_SRGB_CAPABLE 0x0002100E
Camilla Berglund2cd34382013-05-30 20:42:50 +0200649#define GLFW_REFRESH_RATE 0x0002100F
Camilla Berglundc9808582014-04-24 19:21:10 +0200650#define GLFW_DOUBLEBUFFER 0x00021010
Camilla Berglunddeb0b3d2012-12-02 21:00:15 +0100651
Camilla Berglund53b39a62013-05-30 18:55:45 +0200652#define GLFW_CLIENT_API 0x00022001
653#define GLFW_CONTEXT_VERSION_MAJOR 0x00022002
654#define GLFW_CONTEXT_VERSION_MINOR 0x00022003
655#define GLFW_CONTEXT_REVISION 0x00022004
656#define GLFW_CONTEXT_ROBUSTNESS 0x00022005
657#define GLFW_OPENGL_FORWARD_COMPAT 0x00022006
658#define GLFW_OPENGL_DEBUG_CONTEXT 0x00022007
659#define GLFW_OPENGL_PROFILE 0x00022008
Camilla Berglund44c899c2014-08-21 19:21:45 +0200660#define GLFW_CONTEXT_RELEASE_BEHAVIOR 0x00022009
Camilla Berglund7be82092015-08-10 12:46:14 +0200661#define GLFW_CONTEXT_NO_ERROR 0x0002200A
Camilla Berglundef80bea2016-03-28 13:19:31 +0200662#define GLFW_CONTEXT_CREATION_API 0x0002200B
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100663
Camilla Berglund496f5592015-06-18 14:03:02 +0200664#define GLFW_NO_API 0
Camilla Berglund393e4392013-05-27 22:16:59 +0200665#define GLFW_OPENGL_API 0x00030001
666#define GLFW_OPENGL_ES_API 0x00030002
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100667
Camilla Berglund393e4392013-05-27 22:16:59 +0200668#define GLFW_NO_ROBUSTNESS 0
669#define GLFW_NO_RESET_NOTIFICATION 0x00031001
670#define GLFW_LOSE_CONTEXT_ON_RESET 0x00031002
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100671
Camilla Berglund44e84012013-06-05 16:13:30 +0200672#define GLFW_OPENGL_ANY_PROFILE 0
Camilla Berglund393e4392013-05-27 22:16:59 +0200673#define GLFW_OPENGL_CORE_PROFILE 0x00032001
674#define GLFW_OPENGL_COMPAT_PROFILE 0x00032002
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100675
Camilla Berglund393e4392013-05-27 22:16:59 +0200676#define GLFW_CURSOR 0x00033001
677#define GLFW_STICKY_KEYS 0x00033002
678#define GLFW_STICKY_MOUSE_BUTTONS 0x00033003
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100679
Camilla Berglund393e4392013-05-27 22:16:59 +0200680#define GLFW_CURSOR_NORMAL 0x00034001
681#define GLFW_CURSOR_HIDDEN 0x00034002
682#define GLFW_CURSOR_DISABLED 0x00034003
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100683
Camilla Berglund44c899c2014-08-21 19:21:45 +0200684#define GLFW_ANY_RELEASE_BEHAVIOR 0
685#define GLFW_RELEASE_BEHAVIOR_FLUSH 0x00035001
686#define GLFW_RELEASE_BEHAVIOR_NONE 0x00035002
687
Camilla Berglundef80bea2016-03-28 13:19:31 +0200688#define GLFW_NATIVE_CONTEXT_API 0x00036001
689#define GLFW_EGL_CONTEXT_API 0x00036002
690
Camilla Berglund2a1375e2014-09-02 16:52:16 +0200691/*! @defgroup shapes Standard cursor shapes
Camilla Berglund4188c262015-01-18 01:55:25 +0100692 *
693 * See [standard cursor creation](@ref cursor_standard) for how these are used.
694 *
Camilla Berglund2a1375e2014-09-02 16:52:16 +0200695 * @ingroup input
696 * @{ */
697
698/*! @brief The regular arrow cursor shape.
699 *
700 * The regular arrow cursor.
701 */
702#define GLFW_ARROW_CURSOR 0x00036001
703/*! @brief The text input I-beam cursor shape.
704 *
705 * The text input I-beam cursor shape.
706 */
707#define GLFW_IBEAM_CURSOR 0x00036002
708/*! @brief The crosshair shape.
709 *
710 * The crosshair shape.
711 */
712#define GLFW_CROSSHAIR_CURSOR 0x00036003
713/*! @brief The hand shape.
714 *
715 * The hand shape.
716 */
717#define GLFW_HAND_CURSOR 0x00036004
718/*! @brief The horizontal resize arrow shape.
719 *
720 * The horizontal resize arrow shape.
721 */
722#define GLFW_HRESIZE_CURSOR 0x00036005
723/*! @brief The vertical resize arrow shape.
724 *
725 * The vertical resize arrow shape.
726 */
727#define GLFW_VRESIZE_CURSOR 0x00036006
728/*! @} */
729
Camilla Berglund393e4392013-05-27 22:16:59 +0200730#define GLFW_CONNECTED 0x00040001
731#define GLFW_DISCONNECTED 0x00040002
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100732
Camilla Berglund28101302014-04-08 18:57:43 +0200733#define GLFW_DONT_CARE -1
734
Camilla Berglund97387282011-10-06 23:28:56 +0200735
Camilla Berglund3249f812010-09-07 17:34:51 +0200736/*************************************************************************
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100737 * GLFW API types
Camilla Berglund3249f812010-09-07 17:34:51 +0200738 *************************************************************************/
739
Camilla Berglund3f5843f2012-12-13 02:22:39 +0100740/*! @brief Client API function pointer type.
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200741 *
742 * Generic function pointer used for returning client API function pointers
743 * without forcing a cast from a regular pointer.
744 *
Camilla Berglundbce20c32015-11-05 13:58:52 +0100745 * @sa @ref context_glext
Camilla Berglund7e9e3212016-09-14 20:17:26 +0200746 * @sa @ref glfwGetProcAddress
Camilla Berglundbce20c32015-11-05 13:58:52 +0100747 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +0100748 * @since Added in version 3.0.
749
Camilla Berglund3f5843f2012-12-13 02:22:39 +0100750 * @ingroup context
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100751 */
Camilla Berglundbf42c3c2012-06-05 00:16:40 +0200752typedef void (*GLFWglproc)(void);
753
Camilla Berglund9b75bff2015-08-10 20:19:04 +0200754/*! @brief Vulkan API function pointer type.
755 *
756 * Generic function pointer used for returning Vulkan API function pointers
757 * without forcing a cast from a regular pointer.
758 *
759 * @sa @ref vulkan_proc
Camilla Berglund7e9e3212016-09-14 20:17:26 +0200760 * @sa @ref glfwGetInstanceProcAddress
Camilla Berglund9b75bff2015-08-10 20:19:04 +0200761 *
762 * @since Added in version 3.2.
763 *
764 * @ingroup vulkan
765 */
766typedef void (*GLFWvkproc)(void);
767
Camilla Berglunddba2d802013-01-17 23:06:56 +0100768/*! @brief Opaque monitor object.
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200769 *
770 * Opaque monitor object.
771 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +0100772 * @see @ref monitor_object
773 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +0100774 * @since Added in version 3.0.
Camilla Berglund810bab72015-12-13 17:38:14 +0100775 *
Camilla Berglund41bc0d12012-11-27 16:55:04 +0100776 * @ingroup monitor
777 */
Camilla Berglund9af960e2013-01-05 21:13:28 +0100778typedef struct GLFWmonitor GLFWmonitor;
Camilla Berglunde0ce9202012-08-29 20:39:05 +0200779
Camilla Berglunddba2d802013-01-17 23:06:56 +0100780/*! @brief Opaque window object.
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200781 *
782 * Opaque window object.
783 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +0100784 * @see @ref window_object
785 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +0100786 * @since Added in version 3.0.
Camilla Berglund810bab72015-12-13 17:38:14 +0100787 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100788 * @ingroup window
789 */
Camilla Berglund9af960e2013-01-05 21:13:28 +0100790typedef struct GLFWwindow GLFWwindow;
Camilla Berglund135194a2010-09-09 18:15:32 +0200791
urraka40c04a72013-12-04 10:19:22 -0300792/*! @brief Opaque cursor object.
793 *
794 * Opaque cursor object.
795 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +0100796 * @see @ref cursor_object
797 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +0100798 * @since Added in version 3.1.
Camilla Berglund810bab72015-12-13 17:38:14 +0100799 *
urraka40c04a72013-12-04 10:19:22 -0300800 * @ingroup cursor
801 */
802typedef struct GLFWcursor GLFWcursor;
803
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100804/*! @brief The function signature for error callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200805 *
806 * This is the function signature for error callback functions.
807 *
Camilla Berglund71d2b572013-03-12 15:33:05 +0100808 * @param[in] error An [error code](@ref errors).
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100809 * @param[in] description A UTF-8 encoded string describing the error.
Camilla Berglunddba2d802013-01-17 23:06:56 +0100810 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +0100811 * @sa @ref error_handling
Camilla Berglund7e9e3212016-09-14 20:17:26 +0200812 * @sa @ref glfwSetErrorCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +0100813 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +0100814 * @since Added in version 3.0.
Camilla Berglund810bab72015-12-13 17:38:14 +0100815 *
Camilla Berglund4591ad22014-09-18 15:03:29 +0200816 * @ingroup init
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100817 */
Camilla Berglund897558f2011-03-07 13:34:58 +0100818typedef void (* GLFWerrorfun)(int,const char*);
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100819
Camilla Berglund1a3d47d2012-11-30 13:56:42 +0100820/*! @brief The function signature for window position callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200821 *
822 * This is the function signature for window position callback functions.
823 *
Camilla Berglunde8e05d42014-04-23 13:30:11 +0200824 * @param[in] window The window that was moved.
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200825 * @param[in] xpos The new x-coordinate, in screen coordinates, of the
826 * upper-left corner of the client area of the window.
827 * @param[in] ypos The new y-coordinate, in screen coordinates, of the
828 * upper-left corner of the client area of the window.
Camilla Berglunddba2d802013-01-17 23:06:56 +0100829 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +0100830 * @sa @ref window_pos
Camilla Berglund7e9e3212016-09-14 20:17:26 +0200831 * @sa @ref glfwSetWindowPosCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +0100832 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +0100833 * @since Added in version 3.0.
Camilla Berglund810bab72015-12-13 17:38:14 +0100834 *
Camilla Berglunde248fb62013-03-29 14:06:23 +0100835 * @ingroup window
Camilla Berglund1a3d47d2012-11-30 13:56:42 +0100836 */
Camilla Berglund9af960e2013-01-05 21:13:28 +0100837typedef void (* GLFWwindowposfun)(GLFWwindow*,int,int);
Camilla Berglund1a3d47d2012-11-30 13:56:42 +0100838
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100839/*! @brief The function signature for window resize callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200840 *
841 * This is the function signature for window size callback functions.
842 *
Camilla Berglunde8e05d42014-04-23 13:30:11 +0200843 * @param[in] window The window that was resized.
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200844 * @param[in] width The new width, in screen coordinates, of the window.
845 * @param[in] height The new height, in screen coordinates, of the window.
Camilla Berglunddba2d802013-01-17 23:06:56 +0100846 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +0100847 * @sa @ref window_size
Camilla Berglund7e9e3212016-09-14 20:17:26 +0200848 * @sa @ref glfwSetWindowSizeCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +0100849 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +0100850 * @since Added in version 1.0.
851 * @glfw3 Added window handle parameter.
Camilla Berglund810bab72015-12-13 17:38:14 +0100852 *
Camilla Berglunde248fb62013-03-29 14:06:23 +0100853 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100854 */
Camilla Berglund9af960e2013-01-05 21:13:28 +0100855typedef void (* GLFWwindowsizefun)(GLFWwindow*,int,int);
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100856
857/*! @brief The function signature for window close callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200858 *
859 * This is the function signature for window close callback functions.
860 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100861 * @param[in] window The window that the user attempted to close.
Camilla Berglunddba2d802013-01-17 23:06:56 +0100862 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +0100863 * @sa @ref window_close
Camilla Berglund7e9e3212016-09-14 20:17:26 +0200864 * @sa @ref glfwSetWindowCloseCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +0100865 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +0100866 * @since Added in version 2.5.
867 * @glfw3 Added window handle parameter.
Camilla Berglund810bab72015-12-13 17:38:14 +0100868 *
Camilla Berglunde248fb62013-03-29 14:06:23 +0100869 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100870 */
Camilla Berglund64afb192013-03-06 23:29:37 +0100871typedef void (* GLFWwindowclosefun)(GLFWwindow*);
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100872
873/*! @brief The function signature for window content refresh callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200874 *
875 * This is the function signature for window refresh callback functions.
876 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100877 * @param[in] window The window whose content needs to be refreshed.
Camilla Berglunddba2d802013-01-17 23:06:56 +0100878 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +0100879 * @sa @ref window_refresh
Camilla Berglund7e9e3212016-09-14 20:17:26 +0200880 * @sa @ref glfwSetWindowRefreshCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +0100881 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +0100882 * @since Added in version 2.5.
883 * @glfw3 Added window handle parameter.
Camilla Berglund810bab72015-12-13 17:38:14 +0100884 *
Camilla Berglunde248fb62013-03-29 14:06:23 +0100885 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100886 */
Camilla Berglund9af960e2013-01-05 21:13:28 +0100887typedef void (* GLFWwindowrefreshfun)(GLFWwindow*);
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100888
889/*! @brief The function signature for window focus/defocus callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200890 *
891 * This is the function signature for window focus callback functions.
892 *
Camilla Berglund4188c262015-01-18 01:55:25 +0100893 * @param[in] window The window that gained or lost input focus.
Camilla Berglund0eccf752015-08-23 19:30:04 +0200894 * @param[in] focused `GLFW_TRUE` if the window was given input focus, or
895 * `GLFW_FALSE` if it lost it.
Camilla Berglunddba2d802013-01-17 23:06:56 +0100896 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +0100897 * @sa @ref window_focus
Camilla Berglund7e9e3212016-09-14 20:17:26 +0200898 * @sa @ref glfwSetWindowFocusCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +0100899 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +0100900 * @since Added in version 3.0.
Camilla Berglund810bab72015-12-13 17:38:14 +0100901 *
Camilla Berglunde248fb62013-03-29 14:06:23 +0100902 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100903 */
Camilla Berglund9af960e2013-01-05 21:13:28 +0100904typedef void (* GLFWwindowfocusfun)(GLFWwindow*,int);
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100905
Camilla Berglund06e7a962012-11-22 19:14:27 +0100906/*! @brief The function signature for window iconify/restore callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200907 *
908 * This is the function signature for window iconify/restore callback
909 * functions.
910 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100911 * @param[in] window The window that was iconified or restored.
Camilla Berglund0eccf752015-08-23 19:30:04 +0200912 * @param[in] iconified `GLFW_TRUE` if the window was iconified, or
913 * `GLFW_FALSE` if it was restored.
Camilla Berglunddba2d802013-01-17 23:06:56 +0100914 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +0100915 * @sa @ref window_iconify
Camilla Berglund7e9e3212016-09-14 20:17:26 +0200916 * @sa @ref glfwSetWindowIconifyCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +0100917 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +0100918 * @since Added in version 3.0.
Camilla Berglund810bab72015-12-13 17:38:14 +0100919 *
Camilla Berglunde248fb62013-03-29 14:06:23 +0100920 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100921 */
Camilla Berglund9af960e2013-01-05 21:13:28 +0100922typedef void (* GLFWwindowiconifyfun)(GLFWwindow*,int);
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100923
Camilla Berglundc156b502016-06-16 13:09:28 +0200924/*! @brief The function signature for window maximize/restore callbacks.
925 *
926 * This is the function signature for window maximize/restore callback
927 * functions.
928 *
929 * @param[in] window The window that was maximized or restored.
930 * @param[in] iconified `GLFW_TRUE` if the window was maximized, or
931 * `GLFW_FALSE` if it was restored.
932 *
933 * @sa @ref window_maximize
934 * @sa glfwSetWindowMaximizeCallback
935 *
936 * @since Added in version 3.3.
937 *
938 * @ingroup window
939 */
940typedef void (* GLFWwindowmaximizefun)(GLFWwindow*,int);
941
Camilla Berglund34981632013-06-03 12:51:57 +0200942/*! @brief The function signature for framebuffer resize callbacks.
943 *
944 * This is the function signature for framebuffer resize callback
945 * functions.
946 *
947 * @param[in] window The window whose framebuffer was resized.
948 * @param[in] width The new width, in pixels, of the framebuffer.
949 * @param[in] height The new height, in pixels, of the framebuffer.
950 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +0100951 * @sa @ref window_fbsize
Camilla Berglund7e9e3212016-09-14 20:17:26 +0200952 * @sa @ref glfwSetFramebufferSizeCallback
Camilla Berglund34981632013-06-03 12:51:57 +0200953 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +0100954 * @since Added in version 3.0.
Camilla Berglund810bab72015-12-13 17:38:14 +0100955 *
Camilla Berglund34981632013-06-03 12:51:57 +0200956 * @ingroup window
957 */
958typedef void (* GLFWframebuffersizefun)(GLFWwindow*,int,int);
959
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100960/*! @brief The function signature for mouse button callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200961 *
962 * This is the function signature for mouse button callback functions.
963 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100964 * @param[in] window The window that received the event.
Camilla Berglund71d2b572013-03-12 15:33:05 +0100965 * @param[in] button The [mouse button](@ref buttons) that was pressed or
966 * released.
967 * @param[in] action One of `GLFW_PRESS` or `GLFW_RELEASE`.
Camilla Berglund98cbf6f2013-05-23 14:42:33 +0200968 * @param[in] mods Bit field describing which [modifier keys](@ref mods) were
969 * held down.
Camilla Berglunddba2d802013-01-17 23:06:56 +0100970 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +0100971 * @sa @ref input_mouse_button
Camilla Berglund7e9e3212016-09-14 20:17:26 +0200972 * @sa @ref glfwSetMouseButtonCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +0100973 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +0100974 * @since Added in version 1.0.
975 * @glfw3 Added window handle and modifier mask parameters.
Camilla Berglund810bab72015-12-13 17:38:14 +0100976 *
Camilla Berglunde248fb62013-03-29 14:06:23 +0100977 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100978 */
Camilla Berglund2d1b8352012-12-09 19:19:00 +0100979typedef void (* GLFWmousebuttonfun)(GLFWwindow*,int,int,int);
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100980
981/*! @brief The function signature for cursor position callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200982 *
983 * This is the function signature for cursor position callback functions.
984 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100985 * @param[in] window The window that received the event.
Camilla Berglund95c44ab2016-02-17 14:52:01 +0100986 * @param[in] xpos The new cursor x-coordinate, relative to the left edge of
987 * the client area.
988 * @param[in] ypos The new cursor y-coordinate, relative to the top edge of the
989 * client area.
Camilla Berglunddba2d802013-01-17 23:06:56 +0100990 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +0100991 * @sa @ref cursor_pos
Camilla Berglund7e9e3212016-09-14 20:17:26 +0200992 * @sa @ref glfwSetCursorPosCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +0100993 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +0100994 * @since Added in version 3.0. Replaces `GLFWmouseposfun`.
Camilla Berglund810bab72015-12-13 17:38:14 +0100995 *
Camilla Berglunde248fb62013-03-29 14:06:23 +0100996 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100997 */
Camilla Berglund129e94d2013-04-04 16:16:21 +0200998typedef void (* GLFWcursorposfun)(GLFWwindow*,double,double);
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100999
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001000/*! @brief The function signature for cursor enter/leave callbacks.
1001 *
1002 * This is the function signature for cursor enter/leave callback functions.
1003 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001004 * @param[in] window The window that received the event.
Camilla Berglund0eccf752015-08-23 19:30:04 +02001005 * @param[in] entered `GLFW_TRUE` if the cursor entered the window's client
1006 * area, or `GLFW_FALSE` if it left it.
Camilla Berglunddba2d802013-01-17 23:06:56 +01001007 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +01001008 * @sa @ref cursor_enter
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001009 * @sa @ref glfwSetCursorEnterCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +01001010 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001011 * @since Added in version 3.0.
Camilla Berglund810bab72015-12-13 17:38:14 +01001012 *
Camilla Berglunde248fb62013-03-29 14:06:23 +01001013 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001014 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001015typedef void (* GLFWcursorenterfun)(GLFWwindow*,int);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001016
1017/*! @brief The function signature for scroll callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001018 *
1019 * This is the function signature for scroll callback functions.
1020 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001021 * @param[in] window The window that received the event.
mewmewcf2d2602013-06-06 19:49:23 +02001022 * @param[in] xoffset The scroll offset along the x-axis.
1023 * @param[in] yoffset The scroll offset along the y-axis.
Camilla Berglunddba2d802013-01-17 23:06:56 +01001024 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +01001025 * @sa @ref scrolling
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001026 * @sa @ref glfwSetScrollCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +01001027 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001028 * @since Added in version 3.0. Replaces `GLFWmousewheelfun`.
Camilla Berglund810bab72015-12-13 17:38:14 +01001029 *
Camilla Berglunde248fb62013-03-29 14:06:23 +01001030 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001031 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001032typedef void (* GLFWscrollfun)(GLFWwindow*,double,double);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001033
1034/*! @brief The function signature for keyboard key callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001035 *
1036 * This is the function signature for keyboard key callback functions.
1037 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001038 * @param[in] window The window that received the event.
Camilla Berglund71d2b572013-03-12 15:33:05 +01001039 * @param[in] key The [keyboard key](@ref keys) that was pressed or released.
Camilla Berglund11615fc2013-05-30 17:19:12 +02001040 * @param[in] scancode The system-specific scancode of the key.
Camilla Berglund95654cf2014-10-02 17:35:10 +02001041 * @param[in] action `GLFW_PRESS`, `GLFW_RELEASE` or `GLFW_REPEAT`.
Camilla Berglund98cbf6f2013-05-23 14:42:33 +02001042 * @param[in] mods Bit field describing which [modifier keys](@ref mods) were
1043 * held down.
Camilla Berglunddba2d802013-01-17 23:06:56 +01001044 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +01001045 * @sa @ref input_key
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001046 * @sa @ref glfwSetKeyCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +01001047 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001048 * @since Added in version 1.0.
1049 * @glfw3 Added window handle, scancode and modifier mask parameters.
Camilla Berglund810bab72015-12-13 17:38:14 +01001050 *
Camilla Berglunde248fb62013-03-29 14:06:23 +01001051 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001052 */
Camilla Berglund11615fc2013-05-30 17:19:12 +02001053typedef void (* GLFWkeyfun)(GLFWwindow*,int,int,int,int);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001054
1055/*! @brief The function signature for Unicode character callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001056 *
1057 * This is the function signature for Unicode character callback functions.
1058 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001059 * @param[in] window The window that received the event.
Camilla Berglund2c920fb2013-10-10 19:41:56 +02001060 * @param[in] codepoint The Unicode code point of the character.
Camilla Berglunddba2d802013-01-17 23:06:56 +01001061 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +01001062 * @sa @ref input_char
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001063 * @sa @ref glfwSetCharCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +01001064 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001065 * @since Added in version 2.4.
1066 * @glfw3 Added window handle parameter.
Camilla Berglund810bab72015-12-13 17:38:14 +01001067 *
Camilla Berglunde248fb62013-03-29 14:06:23 +01001068 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001069 */
Camilla Berglund182e0af2013-02-25 17:02:28 +01001070typedef void (* GLFWcharfun)(GLFWwindow*,unsigned int);
Camilla Berglund5f68e122012-11-27 17:07:28 +01001071
Camilla Berglund96b12ee2014-06-12 23:04:20 +02001072/*! @brief The function signature for Unicode character with modifiers
1073 * callbacks.
1074 *
1075 * This is the function signature for Unicode character with modifiers callback
1076 * functions. It is called for each input character, regardless of what
1077 * modifier keys are held down.
1078 *
1079 * @param[in] window The window that received the event.
1080 * @param[in] codepoint The Unicode code point of the character.
1081 * @param[in] mods Bit field describing which [modifier keys](@ref mods) were
1082 * held down.
1083 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +01001084 * @sa @ref input_char
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001085 * @sa @ref glfwSetCharModsCallback
Camilla Berglund96b12ee2014-06-12 23:04:20 +02001086 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001087 * @since Added in version 3.1.
Camilla Berglund810bab72015-12-13 17:38:14 +01001088 *
Camilla Berglund96b12ee2014-06-12 23:04:20 +02001089 * @ingroup input
1090 */
1091typedef void (* GLFWcharmodsfun)(GLFWwindow*,unsigned int,int);
1092
Camilla Berglund5c8121e2014-03-29 21:35:21 +01001093/*! @brief The function signature for file drop callbacks.
arturo89d07232013-07-10 11:42:14 +02001094 *
Camilla Berglund5c8121e2014-03-29 21:35:21 +01001095 * This is the function signature for file drop callbacks.
arturo89d07232013-07-10 11:42:14 +02001096 *
1097 * @param[in] window The window that received the event.
Camilla Berglund5c8121e2014-03-29 21:35:21 +01001098 * @param[in] count The number of dropped files.
Camilla Berglund93855ae2015-01-27 23:04:22 +01001099 * @param[in] paths The UTF-8 encoded file and/or directory path names.
arturo89d07232013-07-10 11:42:14 +02001100 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +01001101 * @sa @ref path_drop
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001102 * @sa @ref glfwSetDropCallback
arturo89d07232013-07-10 11:42:14 +02001103 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001104 * @since Added in version 3.1.
Camilla Berglund810bab72015-12-13 17:38:14 +01001105 *
arturo89d07232013-07-10 11:42:14 +02001106 * @ingroup input
1107 */
Camilla Berglund8f349e82013-12-22 19:28:46 +01001108typedef void (* GLFWdropfun)(GLFWwindow*,int,const char**);
arturo89d07232013-07-10 11:42:14 +02001109
Camilla Berglund5f68e122012-11-27 17:07:28 +01001110/*! @brief The function signature for monitor configuration callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001111 *
1112 * This is the function signature for monitor configuration callback functions.
1113 *
Camilla Berglund5f68e122012-11-27 17:07:28 +01001114 * @param[in] monitor The monitor that was connected or disconnected.
Camilla Berglund71d2b572013-03-12 15:33:05 +01001115 * @param[in] event One of `GLFW_CONNECTED` or `GLFW_DISCONNECTED`.
Camilla Berglunddba2d802013-01-17 23:06:56 +01001116 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +01001117 * @sa @ref monitor_event
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001118 * @sa @ref glfwSetMonitorCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +01001119 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001120 * @since Added in version 3.0.
Camilla Berglund810bab72015-12-13 17:38:14 +01001121 *
Camilla Berglunde248fb62013-03-29 14:06:23 +01001122 * @ingroup monitor
Camilla Berglund5f68e122012-11-27 17:07:28 +01001123 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001124typedef void (* GLFWmonitorfun)(GLFWmonitor*,int);
Camilla Berglund897558f2011-03-07 13:34:58 +01001125
Camilla Berglund8a7fa302015-12-13 17:38:50 +01001126/*! @brief The function signature for joystick configuration callbacks.
1127 *
1128 * This is the function signature for joystick configuration callback
1129 * functions.
1130 *
Camilla Berglundefc6b352016-10-10 03:24:07 +02001131 * @param[in] jid The joystick that was connected or disconnected.
Camilla Berglund8a7fa302015-12-13 17:38:50 +01001132 * @param[in] event One of `GLFW_CONNECTED` or `GLFW_DISCONNECTED`.
1133 *
1134 * @sa @ref joystick_event
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001135 * @sa @ref glfwSetJoystickCallback
Camilla Berglund8a7fa302015-12-13 17:38:50 +01001136 *
1137 * @since Added in version 3.2.
1138 *
1139 * @ingroup input
1140 */
1141typedef void (* GLFWjoystickfun)(int,int);
1142
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001143/*! @brief Video mode type.
1144 *
1145 * This describes a single video mode.
1146 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +01001147 * @sa @ref monitor_modes
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001148 * @sa @ref glfwGetVideoMode
1149 * @sa @ref glfwGetVideoModes
Camilla Berglund9d71eb42015-11-05 09:24:16 +01001150 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001151 * @since Added in version 1.0.
1152 * @glfw3 Added refresh rate member.
Camilla Berglund810bab72015-12-13 17:38:14 +01001153 *
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001154 * @ingroup monitor
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001155 */
Systemclusterd0a0e372013-08-29 06:15:55 +02001156typedef struct GLFWvidmode
Camilla Berglund5fd3fc72010-09-09 19:44:43 +02001157{
Camilla Berglund95835af2013-05-30 13:53:25 +02001158 /*! The width, in screen coordinates, of the video mode.
Camilla Berglundc1594112013-05-27 22:29:06 +02001159 */
Camilla Berglund5fd3fc72010-09-09 19:44:43 +02001160 int width;
Camilla Berglund95835af2013-05-30 13:53:25 +02001161 /*! The height, in screen coordinates, of the video mode.
Camilla Berglundc1594112013-05-27 22:29:06 +02001162 */
Camilla Berglund5fd3fc72010-09-09 19:44:43 +02001163 int height;
Camilla Berglundc1594112013-05-27 22:29:06 +02001164 /*! The bit depth of the red channel of the video mode.
1165 */
Camilla Berglund5fd3fc72010-09-09 19:44:43 +02001166 int redBits;
Camilla Berglundc1594112013-05-27 22:29:06 +02001167 /*! The bit depth of the green channel of the video mode.
1168 */
Camilla Berglund5fd3fc72010-09-09 19:44:43 +02001169 int greenBits;
Camilla Berglundc1594112013-05-27 22:29:06 +02001170 /*! The bit depth of the blue channel of the video mode.
1171 */
Camilla Berglund2e8446f2013-04-11 01:31:00 +02001172 int blueBits;
Camilla Berglund731812c2013-05-30 15:52:42 +02001173 /*! The refresh rate, in Hz, of the video mode.
1174 */
1175 int refreshRate;
Camilla Berglund3249f812010-09-07 17:34:51 +02001176} GLFWvidmode;
1177
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001178/*! @brief Gamma ramp.
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001179 *
1180 * This describes the gamma ramp for a monitor.
1181 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +01001182 * @sa @ref monitor_gamma
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001183 * @sa @ref glfwGetGammaRamp
1184 * @sa @ref glfwSetGammaRamp
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001185 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001186 * @since Added in version 3.0.
Camilla Berglund810bab72015-12-13 17:38:14 +01001187 *
Camilla Berglundf5f55e32013-06-17 12:56:36 +02001188 * @ingroup monitor
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001189 */
Systemclusterd0a0e372013-08-29 06:15:55 +02001190typedef struct GLFWgammaramp
Camilla Berglund2630d492010-10-13 04:04:43 +02001191{
Camilla Berglundc1594112013-05-27 22:29:06 +02001192 /*! An array of value describing the response of the red channel.
1193 */
Camilla Berglund5d308db2013-05-19 15:46:44 +02001194 unsigned short* red;
Camilla Berglundc1594112013-05-27 22:29:06 +02001195 /*! An array of value describing the response of the green channel.
1196 */
Camilla Berglund5d308db2013-05-19 15:46:44 +02001197 unsigned short* green;
Camilla Berglundc1594112013-05-27 22:29:06 +02001198 /*! An array of value describing the response of the blue channel.
1199 */
Camilla Berglund5d308db2013-05-19 15:46:44 +02001200 unsigned short* blue;
Camilla Berglundc1594112013-05-27 22:29:06 +02001201 /*! The number of elements in each array.
1202 */
Camilla Berglund5d308db2013-05-19 15:46:44 +02001203 unsigned int size;
Camilla Berglund2630d492010-10-13 04:04:43 +02001204} GLFWgammaramp;
1205
Camilla Berglund8fa9cc02014-02-23 16:43:17 +01001206/*! @brief Image data.
Camilla Berglund9d71eb42015-11-05 09:24:16 +01001207 *
1208 * @sa @ref cursor_custom
Camilla Berglundfe0317a2016-08-01 11:51:30 +02001209 * @sa @ref window_icon
Camilla Berglund810bab72015-12-13 17:38:14 +01001210 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001211 * @since Added in version 2.1.
1212 * @glfw3 Removed format and bytes-per-pixel members.
Camilla Berglund8fa9cc02014-02-23 16:43:17 +01001213 */
1214typedef struct GLFWimage
1215{
1216 /*! The width, in pixels, of this image.
1217 */
1218 int width;
1219 /*! The height, in pixels, of this image.
1220 */
1221 int height;
1222 /*! The pixel data of this image, arranged left-to-right, top-to-bottom.
1223 */
1224 unsigned char* pixels;
1225} GLFWimage;
1226
Camilla Berglund3249f812010-09-07 17:34:51 +02001227
1228/*************************************************************************
Camilla Berglund2fca5c52013-01-17 21:51:39 +01001229 * GLFW API functions
Camilla Berglund3249f812010-09-07 17:34:51 +02001230 *************************************************************************/
1231
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001232/*! @brief Initializes the GLFW library.
1233 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001234 * This function initializes the GLFW library. Before most GLFW functions can
Camilla Berglund4591ad22014-09-18 15:03:29 +02001235 * be used, GLFW must be initialized, and before an application terminates GLFW
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001236 * should be terminated in order to free any resources allocated during or
1237 * after initialization.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001238 *
Camilla Berglund23f61762013-03-12 19:53:29 +01001239 * If this function fails, it calls @ref glfwTerminate before returning. If it
Camilla Berglund4591ad22014-09-18 15:03:29 +02001240 * succeeds, you should call @ref glfwTerminate before the application exits.
Camilla Berglund23f61762013-03-12 19:53:29 +01001241 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001242 * Additional calls to this function after successful initialization but before
Camilla Berglund0eccf752015-08-23 19:30:04 +02001243 * termination will return `GLFW_TRUE` immediately.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001244 *
Camilla Berglund0eccf752015-08-23 19:30:04 +02001245 * @return `GLFW_TRUE` if successful, or `GLFW_FALSE` if an
Camilla Berglund4591ad22014-09-18 15:03:29 +02001246 * [error](@ref error_handling) occurred.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001247 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001248 * @errors Possible errors include @ref GLFW_PLATFORM_ERROR.
1249 *
Camilla Berglund8d6f2652016-10-20 00:50:54 +02001250 * @remark @macos This function will change the current directory of the
Camilla Berglund71d2b572013-03-12 15:33:05 +01001251 * application to the `Contents/Resources` subdirectory of the application's
Camilla Berglund4591ad22014-09-18 15:03:29 +02001252 * bundle, if present. This can be disabled with a
1253 * [compile-time option](@ref compile_options_osx).
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001254 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001255 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001256 *
1257 * @sa @ref intro_init
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001258 * @sa @ref glfwTerminate
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001259 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001260 * @since Added in version 1.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001261 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001262 * @ingroup init
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001263 */
1264GLFWAPI int glfwInit(void);
1265
1266/*! @brief Terminates the GLFW library.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001267 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001268 * This function destroys all remaining windows and cursors, restores any
1269 * modified gamma ramps and frees any other allocated resources. Once this
1270 * function is called, you must again call @ref glfwInit successfully before
1271 * you will be able to use most GLFW functions.
Camilla Berglund23f61762013-03-12 19:53:29 +01001272 *
1273 * If GLFW has been successfully initialized, this function should be called
Camilla Berglund4591ad22014-09-18 15:03:29 +02001274 * before the application exits. If initialization fails, there is no need to
1275 * call this function, as it is called by @ref glfwInit before it returns
1276 * failure.
Camilla Berglund23f61762013-03-12 19:53:29 +01001277 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001278 * @errors Possible errors include @ref GLFW_PLATFORM_ERROR.
1279 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001280 * @remark This function may be called before @ref glfwInit.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001281 *
Camilla Berglund0df4e062015-12-13 14:07:27 +01001282 * @warning The contexts of any remaining windows must not be current on any
1283 * other thread when this function is called.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001284 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001285 * @reentrancy This function must not be called from a callback.
Camilla Berglund20858762015-01-01 18:41:22 +01001286 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001287 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001288 *
1289 * @sa @ref intro_init
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001290 * @sa @ref glfwInit
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001291 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001292 * @since Added in version 1.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001293 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001294 * @ingroup init
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001295 */
Camilla Berglund9a716692010-09-08 16:40:43 +02001296GLFWAPI void glfwTerminate(void);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001297
1298/*! @brief Retrieves the version of the GLFW library.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001299 *
1300 * This function retrieves the major, minor and revision numbers of the GLFW
1301 * library. It is intended for when you are using GLFW as a shared library and
1302 * want to ensure that you are using the minimum required version.
1303 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001304 * Any or all of the version arguments may be `NULL`.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001305 *
Camilla Berglund71d2b572013-03-12 15:33:05 +01001306 * @param[out] major Where to store the major version number, or `NULL`.
1307 * @param[out] minor Where to store the minor version number, or `NULL`.
1308 * @param[out] rev Where to store the revision number, or `NULL`.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001309 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001310 * @errors None.
1311 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001312 * @remark This function may be called before @ref glfwInit.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001313 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001314 * @thread_safety This function may be called from any thread.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001315 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001316 * @sa @ref intro_version
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001317 * @sa @ref glfwGetVersionString
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001318 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001319 * @since Added in version 1.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001320 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001321 * @ingroup init
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001322 */
Camilla Berglund9a716692010-09-08 16:40:43 +02001323GLFWAPI void glfwGetVersion(int* major, int* minor, int* rev);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001324
Camilla Berglund6f8084f2013-02-14 13:14:17 +01001325/*! @brief Returns a string describing the compile-time configuration.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001326 *
Camilla Berglunde8e05d42014-04-23 13:30:11 +02001327 * This function returns the compile-time generated
1328 * [version string](@ref intro_version_string) of the GLFW library binary. It
1329 * describes the version, platform, compiler and any platform-specific
Camilla Berglund386b6032016-02-10 13:48:49 +01001330 * compile-time options. It should not be confused with the OpenGL or OpenGL
1331 * ES version string, queried with `glGetString`.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001332 *
Camilla Berglundce8f97c2015-01-11 23:33:14 +01001333 * __Do not use the version string__ to parse the GLFW library version. The
Camilla Berglund386b6032016-02-10 13:48:49 +01001334 * @ref glfwGetVersion function provides the version of the running library
1335 * binary in numerical format.
Camilla Berglundce8f97c2015-01-11 23:33:14 +01001336 *
Camilla Berglund386b6032016-02-10 13:48:49 +01001337 * @return The ASCII encoded GLFW version string.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02001338 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001339 * @errors None.
1340 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001341 * @remark This function may be called before @ref glfwInit.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001342 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001343 * @pointer_lifetime The returned string is static and compile-time generated.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001344 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001345 * @thread_safety This function may be called from any thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001346 *
1347 * @sa @ref intro_version
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001348 * @sa @ref glfwGetVersion
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001349 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001350 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001351 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001352 * @ingroup init
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001353 */
Camilla Berglundd6fe4472010-09-13 18:05:59 +02001354GLFWAPI const char* glfwGetVersionString(void);
Camilla Berglund3249f812010-09-07 17:34:51 +02001355
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001356/*! @brief Sets the error callback.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001357 *
1358 * This function sets the error callback, which is called with an error code
1359 * and a human-readable description each time a GLFW error occurs.
1360 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001361 * The error callback is called on the thread where the error occurred. If you
1362 * are using GLFW from multiple threads, your error callback needs to be
1363 * written accordingly.
1364 *
1365 * Because the description string may have been generated specifically for that
1366 * error, it is not guaranteed to be valid after the callback has returned. If
1367 * you wish to use it after the callback returns, you need to make a copy.
1368 *
Camilla Berglund20858762015-01-01 18:41:22 +01001369 * Once set, the error callback remains set even after the library has been
1370 * terminated.
1371 *
Camilla Berglund71d2b572013-03-12 15:33:05 +01001372 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001373 * callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02001374 * @return The previously set callback, or `NULL` if no callback was set.
1375 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001376 * @errors None.
1377 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001378 * @remark This function may be called before @ref glfwInit.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001379 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001380 * @thread_safety This function must only be called from the main thread.
Camilla Berglund0e205772014-03-24 11:58:35 +01001381 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001382 * @sa @ref error_handling
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001383 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001384 * @since Added in version 3.0.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001385 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001386 * @ingroup init
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001387 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02001388GLFWAPI GLFWerrorfun glfwSetErrorCallback(GLFWerrorfun cbfun);
Camilla Berglundf5d74c42010-09-09 21:06:59 +02001389
Camilla Berglund5f68e122012-11-27 17:07:28 +01001390/*! @brief Returns the currently connected monitors.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001391 *
1392 * This function returns an array of handles for all currently connected
Camilla Berglundf5cbdba2015-09-17 16:37:09 +02001393 * monitors. The primary monitor is always first in the returned array. If no
1394 * monitors were found, this function returns `NULL`.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001395 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001396 * @param[out] count Where to store the number of monitors in the returned
1397 * array. This is set to zero if an error occurred.
Camilla Berglundf5cbdba2015-09-17 16:37:09 +02001398 * @return An array of monitor handles, or `NULL` if no monitors were found or
1399 * if an [error](@ref error_handling) occurred.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001400 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001401 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
1402 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001403 * @pointer_lifetime The returned array is allocated and freed by GLFW. You
1404 * should not free it yourself. It is guaranteed to be valid only until the
1405 * monitor configuration changes or the library is terminated.
Camilla Berglund0e205772014-03-24 11:58:35 +01001406 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001407 * @thread_safety This function must only be called from the main thread.
Camilla Berglundc3bb5c92013-06-05 16:04:04 +02001408 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001409 * @sa @ref monitor_monitors
1410 * @sa @ref monitor_event
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001411 * @sa @ref glfwGetPrimaryMonitor
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001412 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001413 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001414 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001415 * @ingroup monitor
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001416 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001417GLFWAPI GLFWmonitor** glfwGetMonitors(int* count);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001418
Camilla Berglund5f68e122012-11-27 17:07:28 +01001419/*! @brief Returns the primary monitor.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001420 *
1421 * This function returns the primary monitor. This is usually the monitor
Camilla Berglundf5cbdba2015-09-17 16:37:09 +02001422 * where elements like the task bar or global menu bar are located.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001423 *
Camilla Berglundf5cbdba2015-09-17 16:37:09 +02001424 * @return The primary monitor, or `NULL` if no monitors were found or if an
1425 * [error](@ref error_handling) occurred.
Camilla Berglunddba2d802013-01-17 23:06:56 +01001426 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001427 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
1428 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001429 * @thread_safety This function must only be called from the main thread.
Camilla Berglund0e205772014-03-24 11:58:35 +01001430 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001431 * @remark The primary monitor is always first in the array returned by @ref
Camilla Berglundf5cbdba2015-09-17 16:37:09 +02001432 * glfwGetMonitors.
1433 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001434 * @sa @ref monitor_monitors
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001435 * @sa @ref glfwGetMonitors
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001436 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001437 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001438 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001439 * @ingroup monitor
Camilla Berglund41bc0d12012-11-27 16:55:04 +01001440 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001441GLFWAPI GLFWmonitor* glfwGetPrimaryMonitor(void);
Camilla Berglund41bc0d12012-11-27 16:55:04 +01001442
Camilla Berglundee5f30e2013-01-24 19:10:17 +01001443/*! @brief Returns the position of the monitor's viewport on the virtual screen.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001444 *
1445 * This function returns the position, in screen coordinates, of the upper-left
1446 * corner of the specified monitor.
1447 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001448 * Any or all of the position arguments may be `NULL`. If an error occurs, all
1449 * non-`NULL` position arguments will be set to zero.
1450 *
Camilla Berglunddba2d802013-01-17 23:06:56 +01001451 * @param[in] monitor The monitor to query.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02001452 * @param[out] xpos Where to store the monitor x-coordinate, or `NULL`.
1453 * @param[out] ypos Where to store the monitor y-coordinate, or `NULL`.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001454 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001455 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
1456 * GLFW_PLATFORM_ERROR.
1457 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001458 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001459 *
1460 * @sa @ref monitor_properties
1461 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001462 * @since Added in version 3.0.
Camilla Berglund0e205772014-03-24 11:58:35 +01001463 *
Camilla Berglund5f68e122012-11-27 17:07:28 +01001464 * @ingroup monitor
Camilla Berglund41bc0d12012-11-27 16:55:04 +01001465 */
Camilla Berglundee5f30e2013-01-24 19:10:17 +01001466GLFWAPI void glfwGetMonitorPos(GLFWmonitor* monitor, int* xpos, int* ypos);
1467
1468/*! @brief Returns the physical size of the monitor.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001469 *
1470 * This function returns the size, in millimetres, of the display area of the
1471 * specified monitor.
1472 *
Camilla Berglund4188c262015-01-18 01:55:25 +01001473 * Some systems do not provide accurate monitor size information, either
1474 * because the monitor
1475 * [EDID](https://en.wikipedia.org/wiki/Extended_display_identification_data)
1476 * data is incorrect or because the driver does not report it accurately.
1477 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001478 * Any or all of the size arguments may be `NULL`. If an error occurs, all
1479 * non-`NULL` size arguments will be set to zero.
1480 *
Camilla Berglundee5f30e2013-01-24 19:10:17 +01001481 * @param[in] monitor The monitor to query.
Camilla Berglundce8f97c2015-01-11 23:33:14 +01001482 * @param[out] widthMM Where to store the width, in millimetres, of the
1483 * monitor's display area, or `NULL`.
1484 * @param[out] heightMM Where to store the height, in millimetres, of the
1485 * monitor's display area, or `NULL`.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001486 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001487 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
1488 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001489 * @remark @win32 calculates the returned physical size from the
Camilla Berglund4188c262015-01-18 01:55:25 +01001490 * current resolution and system DPI instead of querying the monitor EDID data.
Camilla Berglund0e205772014-03-24 11:58:35 +01001491 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001492 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001493 *
1494 * @sa @ref monitor_properties
1495 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001496 * @since Added in version 3.0.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001497 *
Camilla Berglundee5f30e2013-01-24 19:10:17 +01001498 * @ingroup monitor
1499 */
Camilla Berglundce8f97c2015-01-11 23:33:14 +01001500GLFWAPI void glfwGetMonitorPhysicalSize(GLFWmonitor* monitor, int* widthMM, int* heightMM);
Camilla Berglund41bc0d12012-11-27 16:55:04 +01001501
Camilla Berglund5f68e122012-11-27 17:07:28 +01001502/*! @brief Returns the name of the specified monitor.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001503 *
1504 * This function returns a human-readable name, encoded as UTF-8, of the
Camilla Berglund4591ad22014-09-18 15:03:29 +02001505 * specified monitor. The name typically reflects the make and model of the
1506 * monitor and is not guaranteed to be unique among the connected monitors.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001507 *
Camilla Berglund5f68e122012-11-27 17:07:28 +01001508 * @param[in] monitor The monitor to query.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001509 * @return The UTF-8 encoded name of the monitor, or `NULL` if an
1510 * [error](@ref error_handling) occurred.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001511 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001512 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
1513 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001514 * @pointer_lifetime The returned string is allocated and freed by GLFW. You
1515 * should not free it yourself. It is valid until the specified monitor is
1516 * disconnected or the library is terminated.
Camilla Berglund0e205772014-03-24 11:58:35 +01001517 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001518 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001519 *
1520 * @sa @ref monitor_properties
1521 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001522 * @since Added in version 3.0.
Camilla Berglundc3bb5c92013-06-05 16:04:04 +02001523 *
Camilla Berglund5f68e122012-11-27 17:07:28 +01001524 * @ingroup monitor
Camilla Berglund41bc0d12012-11-27 16:55:04 +01001525 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001526GLFWAPI const char* glfwGetMonitorName(GLFWmonitor* monitor);
Camilla Berglund41bc0d12012-11-27 16:55:04 +01001527
Camilla Berglund5f68e122012-11-27 17:07:28 +01001528/*! @brief Sets the monitor configuration callback.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001529 *
1530 * This function sets the monitor configuration callback, or removes the
1531 * currently set callback. This is called when a monitor is connected to or
1532 * disconnected from the system.
1533 *
Camilla Berglund71d2b572013-03-12 15:33:05 +01001534 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
Camilla Berglunddba2d802013-01-17 23:06:56 +01001535 * callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02001536 * @return The previously set callback, or `NULL` if no callback was set or the
1537 * library had not been [initialized](@ref intro_init).
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001538 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001539 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
1540 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001541 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001542 *
1543 * @sa @ref monitor_event
1544 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001545 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001546 *
Camilla Berglund5f68e122012-11-27 17:07:28 +01001547 * @ingroup monitor
Camilla Berglund41bc0d12012-11-27 16:55:04 +01001548 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02001549GLFWAPI GLFWmonitorfun glfwSetMonitorCallback(GLFWmonitorfun cbfun);
Marcel Metzbeacbb32011-05-07 10:53:50 +02001550
Camilla Berglund41bc0d12012-11-27 16:55:04 +01001551/*! @brief Returns the available video modes for the specified monitor.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001552 *
1553 * This function returns an array of all video modes supported by the specified
Camilla Berglund948cc042013-04-16 02:02:22 +02001554 * monitor. The returned array is sorted in ascending order, first by color
1555 * bit depth (the sum of all channel depths) and then by resolution area (the
1556 * product of width and height).
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001557 *
Camilla Berglund5f68e122012-11-27 17:07:28 +01001558 * @param[in] monitor The monitor to query.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02001559 * @param[out] count Where to store the number of video modes in the returned
1560 * array. This is set to zero if an error occurred.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001561 * @return An array of video modes, or `NULL` if an
1562 * [error](@ref error_handling) occurred.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001563 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001564 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
1565 * GLFW_PLATFORM_ERROR.
1566 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001567 * @pointer_lifetime The returned array is allocated and freed by GLFW. You
1568 * should not free it yourself. It is valid until the specified monitor is
1569 * disconnected, this function is called again for that monitor or the library
1570 * is terminated.
Camilla Berglund0e205772014-03-24 11:58:35 +01001571 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001572 * @thread_safety This function must only be called from the main thread.
Camilla Berglundc3bb5c92013-06-05 16:04:04 +02001573 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001574 * @sa @ref monitor_modes
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001575 * @sa @ref glfwGetVideoMode
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001576 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001577 * @since Added in version 1.0.
Camilla Berglund951a9582016-01-31 21:32:14 +01001578 * @glfw3 Changed to return an array of modes for a specific monitor.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001579 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001580 * @ingroup monitor
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001581 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001582GLFWAPI const GLFWvidmode* glfwGetVideoModes(GLFWmonitor* monitor, int* count);
Camilla Berglund41bc0d12012-11-27 16:55:04 +01001583
Camilla Berglund5f68e122012-11-27 17:07:28 +01001584/*! @brief Returns the current mode of the specified monitor.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001585 *
Camilla Berglund948cc042013-04-16 02:02:22 +02001586 * This function returns the current video mode of the specified monitor. If
Camilla Berglund4591ad22014-09-18 15:03:29 +02001587 * you have created a full screen window for that monitor, the return value
1588 * will depend on whether that window is iconified.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001589 *
Camilla Berglund5f68e122012-11-27 17:07:28 +01001590 * @param[in] monitor The monitor to query.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001591 * @return The current mode of the monitor, or `NULL` if an
1592 * [error](@ref error_handling) occurred.
Camilla Berglunddba2d802013-01-17 23:06:56 +01001593 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001594 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
1595 * GLFW_PLATFORM_ERROR.
1596 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001597 * @pointer_lifetime The returned array is allocated and freed by GLFW. You
1598 * should not free it yourself. It is valid until the specified monitor is
1599 * disconnected or the library is terminated.
Camilla Berglund0e205772014-03-24 11:58:35 +01001600 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001601 * @thread_safety This function must only be called from the main thread.
Camilla Berglundc3bb5c92013-06-05 16:04:04 +02001602 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001603 * @sa @ref monitor_modes
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001604 * @sa @ref glfwGetVideoModes
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001605 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001606 * @since Added in version 3.0. Replaces `glfwGetDesktopMode`.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001607 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001608 * @ingroup monitor
Camilla Berglund41bc0d12012-11-27 16:55:04 +01001609 */
Camilla Berglundce1e84d2013-05-22 22:16:43 +02001610GLFWAPI const GLFWvidmode* glfwGetVideoMode(GLFWmonitor* monitor);
Camilla Berglund3249f812010-09-07 17:34:51 +02001611
Camilla Berglund92a71e02013-02-12 13:50:41 +01001612/*! @brief Generates a gamma ramp and sets it for the specified monitor.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001613 *
Camilla Berglund5d308db2013-05-19 15:46:44 +02001614 * This function generates a 256-element gamma ramp from the specified exponent
Camilla Berglund5bbc2b42015-03-15 15:40:43 +01001615 * and then calls @ref glfwSetGammaRamp with it. The value must be a finite
1616 * number greater than zero.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001617 *
Camilla Berglund92a71e02013-02-12 13:50:41 +01001618 * @param[in] monitor The monitor whose gamma ramp to set.
Camilla Berglunda3ff29a2012-12-02 15:47:10 +01001619 * @param[in] gamma The desired exponent.
Camilla Berglunddba2d802013-01-17 23:06:56 +01001620 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001621 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
1622 * GLFW_INVALID_VALUE and @ref GLFW_PLATFORM_ERROR.
1623 *
linkmauvebc8b0482016-10-16 15:52:39 +01001624 * @remark @wayland Gamma handling is currently unavailable, this function will
1625 * always emit @ref GLFW_PLATFORM_ERROR.
1626 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001627 * @thread_safety This function must only be called from the main thread.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02001628 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001629 * @sa @ref monitor_gamma
1630 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001631 * @since Added in version 3.0.
Camilla Berglund0e205772014-03-24 11:58:35 +01001632 *
Camilla Berglundf5f55e32013-06-17 12:56:36 +02001633 * @ingroup monitor
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001634 */
Camilla Berglund92a71e02013-02-12 13:50:41 +01001635GLFWAPI void glfwSetGamma(GLFWmonitor* monitor, float gamma);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001636
Camilla Berglund4591ad22014-09-18 15:03:29 +02001637/*! @brief Returns the current gamma ramp for the specified monitor.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001638 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001639 * This function returns the current gamma ramp of the specified monitor.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001640 *
Camilla Berglund92a71e02013-02-12 13:50:41 +01001641 * @param[in] monitor The monitor to query.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001642 * @return The current gamma ramp, or `NULL` if an
1643 * [error](@ref error_handling) occurred.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001644 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001645 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
1646 * GLFW_PLATFORM_ERROR.
1647 *
linkmauvebc8b0482016-10-16 15:52:39 +01001648 * @remark @wayland Gamma handling is currently unavailable, this function will
1649 * always return `NULL` and emit @ref GLFW_PLATFORM_ERROR.
1650 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001651 * @pointer_lifetime The returned structure and its arrays are allocated and
1652 * freed by GLFW. You should not free them yourself. They are valid until the
1653 * specified monitor is disconnected, this function is called again for that
1654 * monitor or the library is terminated.
Camilla Berglund0e205772014-03-24 11:58:35 +01001655 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001656 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001657 *
1658 * @sa @ref monitor_gamma
1659 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001660 * @since Added in version 3.0.
Camilla Berglundc3bb5c92013-06-05 16:04:04 +02001661 *
Camilla Berglundf5f55e32013-06-17 12:56:36 +02001662 * @ingroup monitor
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001663 */
Camilla Berglund5d308db2013-05-19 15:46:44 +02001664GLFWAPI const GLFWgammaramp* glfwGetGammaRamp(GLFWmonitor* monitor);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001665
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001666/*! @brief Sets the current gamma ramp for the specified monitor.
1667 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001668 * This function sets the current gamma ramp for the specified monitor. The
1669 * original gamma ramp for that monitor is saved by GLFW the first time this
1670 * function is called and is restored by @ref glfwTerminate.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001671 *
Camilla Berglund92a71e02013-02-12 13:50:41 +01001672 * @param[in] monitor The monitor whose gamma ramp to set.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001673 * @param[in] ramp The gamma ramp to use.
Camilla Berglund8954af62013-02-20 19:44:52 +01001674 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001675 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
1676 * GLFW_PLATFORM_ERROR.
1677 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001678 * @remark Gamma ramp sizes other than 256 are not supported by all platforms
Camilla Berglund76fff4d2015-03-10 19:02:28 +01001679 * or graphics hardware.
1680 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001681 * @remark @win32 The gamma ramp size must be 256.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001682 *
linkmauvebc8b0482016-10-16 15:52:39 +01001683 * @remark @wayland Gamma handling is currently unavailable, this function will
1684 * always emit @ref GLFW_PLATFORM_ERROR.
1685 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001686 * @pointer_lifetime The specified gamma ramp is copied before this function
1687 * returns.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001688 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001689 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001690 *
1691 * @sa @ref monitor_gamma
1692 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001693 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001694 *
Camilla Berglundf5f55e32013-06-17 12:56:36 +02001695 * @ingroup monitor
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001696 */
Camilla Berglund92a71e02013-02-12 13:50:41 +01001697GLFWAPI void glfwSetGammaRamp(GLFWmonitor* monitor, const GLFWgammaramp* ramp);
Camilla Berglund2630d492010-10-13 04:04:43 +02001698
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001699/*! @brief Resets all window hints to their default values.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001700 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001701 * This function resets all window hints to their
Camilla Berglunde248fb62013-03-29 14:06:23 +01001702 * [default values](@ref window_hints_values).
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001703 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001704 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
1705 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001706 * @thread_safety This function must only be called from the main thread.
Camilla Berglund9ad1d972012-11-22 19:08:30 +01001707 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001708 * @sa @ref window_hints
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001709 * @sa @ref glfwWindowHint
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001710 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001711 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001712 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001713 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001714 */
Camilla Berglund5df4df62012-10-22 02:59:05 +02001715GLFWAPI void glfwDefaultWindowHints(void);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001716
1717/*! @brief Sets the specified window hint to the desired value.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001718 *
Camilla Berglunded9e4032012-12-23 15:59:09 +01001719 * This function sets hints for the next call to @ref glfwCreateWindow. The
1720 * hints, once set, retain their values until changed by a call to @ref
1721 * glfwWindowHint or @ref glfwDefaultWindowHints, or until the library is
Camilla Berglund6be821c2014-10-06 23:18:33 +02001722 * terminated.
Camilla Berglunded9e4032012-12-23 15:59:09 +01001723 *
Camilla Berglundd6e0a432016-02-09 07:41:48 +01001724 * This function does not check whether the specified hint values are valid.
1725 * If you set hints to invalid values this will instead be reported by the next
1726 * call to @ref glfwCreateWindow.
1727 *
Camilla Berglundd0649e62016-01-27 03:25:21 +01001728 * @param[in] hint The [window hint](@ref window_hints) to set.
1729 * @param[in] value The new value of the window hint.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001730 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001731 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
1732 * GLFW_INVALID_ENUM.
1733 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001734 * @thread_safety This function must only be called from the main thread.
Camilla Berglund401033c2013-03-12 19:17:07 +01001735 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001736 * @sa @ref window_hints
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001737 * @sa @ref glfwDefaultWindowHints
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001738 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001739 * @since Added in version 3.0. Replaces `glfwOpenWindowHint`.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001740 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001741 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001742 */
Camilla Berglundd0649e62016-01-27 03:25:21 +01001743GLFWAPI void glfwWindowHint(int hint, int value);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001744
1745/*! @brief Creates a window and its associated context.
1746 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001747 * This function creates a window and its associated OpenGL or OpenGL ES
1748 * context. Most of the options controlling how the window and its context
1749 * should be created are specified with [window hints](@ref window_hints).
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001750 *
1751 * Successful creation does not change which context is current. Before you
Camilla Berglund4591ad22014-09-18 15:03:29 +02001752 * can use the newly created context, you need to
1753 * [make it current](@ref context_current). For information about the `share`
1754 * parameter, see @ref context_sharing.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001755 *
Camilla Berglunde8e05d42014-04-23 13:30:11 +02001756 * The created window, framebuffer and context may differ from what you
1757 * requested, as not all parameters and hints are
Camilla Berglundfa0cbd92013-04-11 01:07:07 +02001758 * [hard constraints](@ref window_hints_hard). This includes the size of the
Camilla Berglund4591ad22014-09-18 15:03:29 +02001759 * window, especially for full screen windows. To query the actual attributes
Camilla Berglunde8bceaa2015-04-07 14:37:42 +02001760 * of the created window, framebuffer and context, see @ref
1761 * glfwGetWindowAttrib, @ref glfwGetWindowSize and @ref glfwGetFramebufferSize.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001762 *
Camilla Berglunde8e05d42014-04-23 13:30:11 +02001763 * To create a full screen window, you need to specify the monitor the window
Camilla Berglund6570d0c2016-02-23 12:26:42 +01001764 * will cover. If no monitor is specified, the window will be windowed mode.
1765 * Unless you have a way for the user to choose a specific monitor, it is
1766 * recommended that you pick the primary monitor. For more information on how
1767 * to query connected monitors, see @ref monitor_monitors.
Camilla Berglund4b7ae492013-07-07 12:06:59 +02001768 *
Camilla Berglund95654cf2014-10-02 17:35:10 +02001769 * For full screen windows, the specified size becomes the resolution of the
Camilla Berglund6570d0c2016-02-23 12:26:42 +01001770 * window's _desired video mode_. As long as a full screen window is not
1771 * iconified, the supported video mode most closely matching the desired video
1772 * mode is set for the specified monitor. For more information about full
1773 * screen windows, including the creation of so called _windowed full screen_
1774 * or _borderless full screen_ windows, see @ref window_windowed_full_screen.
Camilla Berglund95654cf2014-10-02 17:35:10 +02001775 *
Camilla Berglund999f3552016-08-17 16:48:22 +02001776 * Once you have created the window, you can switch it between windowed and
1777 * full screen mode with @ref glfwSetWindowMonitor. If the window has an
1778 * OpenGL or OpenGL ES context, it will be unaffected.
1779 *
Camilla Berglunde8e05d42014-04-23 13:30:11 +02001780 * By default, newly created windows use the placement recommended by the
1781 * window system. To create the window at a specific position, make it
Camilla Berglundce8f97c2015-01-11 23:33:14 +01001782 * initially invisible using the [GLFW_VISIBLE](@ref window_hints_wnd) window
1783 * hint, set its [position](@ref window_pos) and then [show](@ref window_hide)
1784 * it.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02001785 *
Camilla Berglund6570d0c2016-02-23 12:26:42 +01001786 * As long as at least one full screen window is not iconified, the screensaver
1787 * is prohibited from starting.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02001788 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001789 * Window systems put limits on window sizes. Very large or very small window
1790 * dimensions may be overridden by the window system on creation. Check the
Camilla Berglund95654cf2014-10-02 17:35:10 +02001791 * actual [size](@ref window_size) after creation.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001792 *
Camilla Berglund4188c262015-01-18 01:55:25 +01001793 * The [swap interval](@ref buffer_swap) is not set during window creation and
Camilla Berglund4591ad22014-09-18 15:03:29 +02001794 * the initial value may vary depending on driver settings and defaults.
1795 *
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001796 * @param[in] width The desired width, in screen coordinates, of the window.
1797 * This must be greater than zero.
1798 * @param[in] height The desired height, in screen coordinates, of the window.
1799 * This must be greater than zero.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001800 * @param[in] title The initial, UTF-8 encoded window title.
Camilla Berglund6570d0c2016-02-23 12:26:42 +01001801 * @param[in] monitor The monitor to use for full screen mode, or `NULL` for
Camilla Berglund41bc0d12012-11-27 16:55:04 +01001802 * windowed mode.
Camilla Berglund71d2b572013-03-12 15:33:05 +01001803 * @param[in] share The window whose context to share resources with, or `NULL`
1804 * to not share resources.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001805 * @return The handle of the created window, or `NULL` if an
1806 * [error](@ref error_handling) occurred.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001807 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001808 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
1809 * GLFW_INVALID_ENUM, @ref GLFW_INVALID_VALUE, @ref GLFW_API_UNAVAILABLE, @ref
1810 * GLFW_VERSION_UNAVAILABLE, @ref GLFW_FORMAT_UNAVAILABLE and @ref
1811 * GLFW_PLATFORM_ERROR.
1812 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001813 * @remark @win32 Window creation will fail if the Microsoft GDI software
1814 * OpenGL implementation is the only one available.
Camilla Berglund07db5da2013-09-26 19:15:36 +02001815 *
Camilla Berglund20bce152016-05-30 16:04:37 +02001816 * @remark @win32 If the executable has an icon resource named `GLFW_ICON,` it
1817 * will be set as the initial icon for the window. If no such icon is present,
1818 * the `IDI_WINLOGO` icon will be used instead. To set a different icon, see
1819 * @ref glfwSetWindowIcon.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001820 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001821 * @remark @win32 The context to share resources with must not be current on
1822 * any other thread.
Camilla Berglundb19fb4c2014-12-27 21:14:41 +01001823 *
Camilla Berglund8d6f2652016-10-20 00:50:54 +02001824 * @remark @macos The GLFW window has no icon, as it is not a document
Camilla Berglund71d2b572013-03-12 15:33:05 +01001825 * window, but the dock icon will be the same as the application bundle's icon.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001826 * For more information on bundles, see the
Camilla Berglunde8e05d42014-04-23 13:30:11 +02001827 * [Bundle Programming Guide](https://developer.apple.com/library/mac/documentation/CoreFoundation/Conceptual/CFBundles/)
1828 * in the Mac Developer Library.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001829 *
Camilla Berglund8d6f2652016-10-20 00:50:54 +02001830 * @remark @macos The first time a window is created the menu bar is populated
Camilla Berglund951a9582016-01-31 21:32:14 +01001831 * with common commands like Hide, Quit and About. The About entry opens
1832 * a minimal about dialog with information from the application's bundle. The
1833 * menu bar can be disabled with a
Camilla Berglund96d230b2014-10-07 02:15:36 +02001834 * [compile-time option](@ref compile_options_osx).
Camilla Berglund4591ad22014-09-18 15:03:29 +02001835 *
Camilla Berglund8d6f2652016-10-20 00:50:54 +02001836 * @remark @macos On OS X 10.10 and later the window frame will not be rendered
Camilla Berglund951a9582016-01-31 21:32:14 +01001837 * at full resolution on Retina displays unless the `NSHighResolutionCapable`
1838 * key is enabled in the application bundle's `Info.plist`. For more
1839 * information, see
Camilla Berglund821f3e62015-03-16 22:39:14 +01001840 * [High Resolution Guidelines for OS X](https://developer.apple.com/library/mac/documentation/GraphicsAnimation/Conceptual/HighResolutionOSX/Explained/Explained.html)
Camilla Berglundd12b3432015-07-21 17:42:01 +02001841 * in the Mac Developer Library. The GLFW test and example programs use
1842 * a custom `Info.plist` template for this, which can be found as
1843 * `CMake/MacOSXBundleInfo.plist.in` in the source tree.
Camilla Berglund821f3e62015-03-16 22:39:14 +01001844 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001845 * @remark @x11 Some window managers will not respect the placement of
Camilla Berglunde8e05d42014-04-23 13:30:11 +02001846 * initially hidden windows.
Camilla Berglund3af1c412013-09-19 21:37:01 +02001847 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001848 * @remark @x11 Due to the asynchronous nature of X11, it may take a moment for
1849 * a window to reach its requested state. This means you may not be able to
1850 * query the final size, position or other attributes directly after window
1851 * creation.
Camilla Berglund20ed0a12015-08-12 21:31:54 +02001852 *
linkmauvebc8b0482016-10-16 15:52:39 +01001853 * @remark @wayland The window frame is currently unimplemented, as if
1854 * `GLFW_DECORATED` was always set to `GLFW_FALSE`. A compositor can still
1855 * emit close, resize or maximize events, using for example a keybind
1856 * mechanism.
1857 *
1858 * @remark @wayland A full screen window will not attempt to change the mode,
1859 * no matter what the requested size or refresh rate.
1860 *
1861 * @remark @wayland The wl_shell protocol does not support window
1862 * icons, the window will inherit the one defined in the application's
1863 * desktop file, so this function emits @ref GLFW_PLATFORM_ERROR.
1864 *
1865 * @remark @wayland Screensaver inhibition is currently unimplemented.
1866 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001867 * @reentrancy This function must not be called from a callback.
Camilla Berglund9ad1d972012-11-22 19:08:30 +01001868 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001869 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001870 *
1871 * @sa @ref window_creation
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001872 * @sa @ref glfwDestroyWindow
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001873 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001874 * @since Added in version 3.0. Replaces `glfwOpenWindow`.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001875 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001876 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001877 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001878GLFWAPI GLFWwindow* glfwCreateWindow(int width, int height, const char* title, GLFWmonitor* monitor, GLFWwindow* share);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001879
1880/*! @brief Destroys the specified window and its context.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001881 *
1882 * This function destroys the specified window and its context. On calling
1883 * this function, no further callbacks will be called for that window.
1884 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001885 * If the context of the specified window is current on the main thread, it is
1886 * detached before being destroyed.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001887 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001888 * @param[in] window The window to destroy.
Camilla Berglund9ad1d972012-11-22 19:08:30 +01001889 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001890 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
1891 * GLFW_PLATFORM_ERROR.
1892 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001893 * @note The context of the specified window must not be current on any other
1894 * thread when this function is called.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001895 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001896 * @reentrancy This function must not be called from a callback.
Camilla Berglund44372b82014-12-17 01:31:36 +01001897 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001898 * @thread_safety This function must only be called from the main thread.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001899 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001900 * @sa @ref window_creation
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001901 * @sa @ref glfwCreateWindow
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001902 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001903 * @since Added in version 3.0. Replaces `glfwCloseWindow`.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001904 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001905 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001906 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001907GLFWAPI void glfwDestroyWindow(GLFWwindow* window);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001908
Camilla Berglund64afb192013-03-06 23:29:37 +01001909/*! @brief Checks the close flag of the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001910 *
1911 * This function returns the value of the close flag of the specified window.
1912 *
Camilla Berglund6fadf372013-03-01 13:45:12 +01001913 * @param[in] window The window to query.
Camilla Berglund64afb192013-03-06 23:29:37 +01001914 * @return The value of the close flag.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001915 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001916 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
1917 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001918 * @thread_safety This function may be called from any thread. Access is not
1919 * synchronized.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001920 *
1921 * @sa @ref window_close
1922 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001923 * @since Added in version 3.0.
Camilla Berglund6632cc72013-07-11 02:00:48 +02001924 *
Camilla Berglund6fadf372013-03-01 13:45:12 +01001925 * @ingroup window
1926 */
1927GLFWAPI int glfwWindowShouldClose(GLFWwindow* window);
1928
Camilla Berglund64afb192013-03-06 23:29:37 +01001929/*! @brief Sets the close flag of the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001930 *
1931 * This function sets the value of the close flag of the specified window.
1932 * This can be used to override the user's attempt to close the window, or
1933 * to signal that it should be closed.
1934 *
Camilla Berglund64afb192013-03-06 23:29:37 +01001935 * @param[in] window The window whose flag to change.
Camilla Berglund6fadf372013-03-01 13:45:12 +01001936 * @param[in] value The new value.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001937 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001938 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
1939 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001940 * @thread_safety This function may be called from any thread. Access is not
1941 * synchronized.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001942 *
1943 * @sa @ref window_close
1944 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001945 * @since Added in version 3.0.
Camilla Berglund6632cc72013-07-11 02:00:48 +02001946 *
Camilla Berglund6fadf372013-03-01 13:45:12 +01001947 * @ingroup window
Camilla Berglund6fadf372013-03-01 13:45:12 +01001948 */
1949GLFWAPI void glfwSetWindowShouldClose(GLFWwindow* window, int value);
1950
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001951/*! @brief Sets the title of the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001952 *
1953 * This function sets the window title, encoded as UTF-8, of the specified
1954 * window.
1955 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001956 * @param[in] window The window whose title to change.
1957 * @param[in] title The UTF-8 encoded window title.
Camilla Berglund9ad1d972012-11-22 19:08:30 +01001958 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001959 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
1960 * GLFW_PLATFORM_ERROR.
1961 *
Camilla Berglund8d6f2652016-10-20 00:50:54 +02001962 * @remark @macos The window title will not be updated until the next time you
Camilla Berglund951a9582016-01-31 21:32:14 +01001963 * process events.
Camilla Berglund6412dcb2015-04-07 21:52:29 +02001964 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001965 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001966 *
1967 * @sa @ref window_title
1968 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001969 * @since Added in version 1.0.
Camilla Berglund951a9582016-01-31 21:32:14 +01001970 * @glfw3 Added window handle parameter.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001971 *
1972 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001973 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001974GLFWAPI void glfwSetWindowTitle(GLFWwindow* window, const char* title);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001975
Camilla Berglundb823f712016-03-07 14:55:30 +01001976/*! @brief Sets the icon for the specified window.
1977 *
1978 * This function sets the icon of the specified window. If passed an array of
1979 * candidate images, those of or closest to the sizes desired by the system are
1980 * selected. If no images are specified, the window reverts to its default
1981 * icon.
1982 *
1983 * The desired image sizes varies depending on platform and system settings.
1984 * The selected images will be rescaled as needed. Good sizes include 16x16,
1985 * 32x32 and 48x48.
1986 *
1987 * @param[in] window The window whose icon to set.
1988 * @param[in] count The number of images in the specified array, or zero to
1989 * revert to the default window icon.
1990 * @param[in] images The images to create the icon from. This is ignored if
1991 * count is zero.
1992 *
1993 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
1994 * GLFW_PLATFORM_ERROR.
1995 *
1996 * @pointer_lifetime The specified image data is copied before this function
1997 * returns.
1998 *
Camilla Berglund8d6f2652016-10-20 00:50:54 +02001999 * @remark @macos The GLFW window has no icon, as it is not a document
Camilla Berglund20bce152016-05-30 16:04:37 +02002000 * window, so this function does nothing. The dock icon will be the same as
2001 * the application bundle's icon. For more information on bundles, see the
Camilla Berglundb823f712016-03-07 14:55:30 +01002002 * [Bundle Programming Guide](https://developer.apple.com/library/mac/documentation/CoreFoundation/Conceptual/CFBundles/)
2003 * in the Mac Developer Library.
2004 *
linkmauvebc8b0482016-10-16 15:52:39 +01002005 * @remark @wayland The wl_shell protocol does not support icons, the window
2006 * will inherit the one defined in the application's desktop file, so this
2007 * function emits @ref GLFW_PLATFORM_ERROR.
2008 *
Camilla Berglundb823f712016-03-07 14:55:30 +01002009 * @thread_safety This function must only be called from the main thread.
2010 *
2011 * @sa @ref window_icon
2012 *
2013 * @since Added in version 3.2.
2014 *
2015 * @ingroup window
2016 */
2017GLFWAPI void glfwSetWindowIcon(GLFWwindow* window, int count, const GLFWimage* images);
2018
Camilla Berglund7c193232013-01-24 19:30:31 +01002019/*! @brief Retrieves the position of the client area of the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002020 *
2021 * This function retrieves the position, in screen coordinates, of the
2022 * upper-left corner of the client area of the specified window.
2023 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002024 * Any or all of the position arguments may be `NULL`. If an error occurs, all
2025 * non-`NULL` position arguments will be set to zero.
2026 *
Camilla Berglund7c193232013-01-24 19:30:31 +01002027 * @param[in] window The window to query.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02002028 * @param[out] xpos Where to store the x-coordinate of the upper-left corner of
2029 * the client area, or `NULL`.
2030 * @param[out] ypos Where to store the y-coordinate of the upper-left corner of
2031 * the client area, or `NULL`.
Camilla Berglund7c193232013-01-24 19:30:31 +01002032 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002033 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2034 * GLFW_PLATFORM_ERROR.
2035 *
linkmauvebc8b0482016-10-16 15:52:39 +01002036 * @remark @wayland There is no way for an application to retrieve the global
2037 * position of its windows, this function will always emit @ref
2038 * GLFW_PLATFORM_ERROR.
2039 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002040 * @thread_safety This function must only be called from the main thread.
Camilla Berglund0e205772014-03-24 11:58:35 +01002041 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002042 * @sa @ref window_pos
Camilla Berglund7e9e3212016-09-14 20:17:26 +02002043 * @sa @ref glfwSetWindowPos
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002044 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002045 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002046 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002047 * @ingroup window
Camilla Berglund7c193232013-01-24 19:30:31 +01002048 */
2049GLFWAPI void glfwGetWindowPos(GLFWwindow* window, int* xpos, int* ypos);
2050
2051/*! @brief Sets the position of the client area of the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002052 *
2053 * This function sets the position, in screen coordinates, of the upper-left
Camilla Berglund4591ad22014-09-18 15:03:29 +02002054 * corner of the client area of the specified windowed mode window. If the
2055 * window is a full screen window, this function does nothing.
Camilla Berglund8282a8f2013-04-10 23:01:12 +02002056 *
Camilla Berglundce8f97c2015-01-11 23:33:14 +01002057 * __Do not use this function__ to move an already visible window unless you
2058 * have very good reasons for doing so, as it will confuse and annoy the user.
2059 *
2060 * The window manager may put limits on what positions are allowed. GLFW
2061 * cannot and should not override these limits.
2062 *
Camilla Berglund7c193232013-01-24 19:30:31 +01002063 * @param[in] window The window to query.
2064 * @param[in] xpos The x-coordinate of the upper-left corner of the client area.
2065 * @param[in] ypos The y-coordinate of the upper-left corner of the client area.
Camilla Berglund7c193232013-01-24 19:30:31 +01002066 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002067 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2068 * GLFW_PLATFORM_ERROR.
2069 *
linkmauvebc8b0482016-10-16 15:52:39 +01002070 * @remark @wayland There is no way for an application to set the global
2071 * position of its windows, this function will always emit @ref
2072 * GLFW_PLATFORM_ERROR.
2073 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002074 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002075 *
2076 * @sa @ref window_pos
Camilla Berglund7e9e3212016-09-14 20:17:26 +02002077 * @sa @ref glfwGetWindowPos
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002078 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002079 * @since Added in version 1.0.
Camilla Berglund951a9582016-01-31 21:32:14 +01002080 * @glfw3 Added window handle parameter.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002081 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002082 * @ingroup window
Camilla Berglund7c193232013-01-24 19:30:31 +01002083 */
Camilla Berglund52f718d2013-02-12 12:01:12 +01002084GLFWAPI void glfwSetWindowPos(GLFWwindow* window, int xpos, int ypos);
Camilla Berglund7c193232013-01-24 19:30:31 +01002085
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002086/*! @brief Retrieves the size of the client area of the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002087 *
Camilla Berglund8282a8f2013-04-10 23:01:12 +02002088 * This function retrieves the size, in screen coordinates, of the client area
Camilla Berglund521fa7d2013-09-26 20:02:19 +02002089 * of the specified window. If you wish to retrieve the size of the
Camilla Berglundce8f97c2015-01-11 23:33:14 +01002090 * framebuffer of the window in pixels, see @ref glfwGetFramebufferSize.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002091 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002092 * Any or all of the size arguments may be `NULL`. If an error occurs, all
2093 * non-`NULL` size arguments will be set to zero.
2094 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002095 * @param[in] window The window whose size to retrieve.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02002096 * @param[out] width Where to store the width, in screen coordinates, of the
2097 * client area, or `NULL`.
2098 * @param[out] height Where to store the height, in screen coordinates, of the
2099 * client area, or `NULL`.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002100 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002101 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2102 * GLFW_PLATFORM_ERROR.
2103 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002104 * @thread_safety This function must only be called from the main thread.
Camilla Berglund0e205772014-03-24 11:58:35 +01002105 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002106 * @sa @ref window_size
Camilla Berglund7e9e3212016-09-14 20:17:26 +02002107 * @sa @ref glfwSetWindowSize
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002108 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002109 * @since Added in version 1.0.
Camilla Berglund951a9582016-01-31 21:32:14 +01002110 * @glfw3 Added window handle parameter.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002111 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002112 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002113 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01002114GLFWAPI void glfwGetWindowSize(GLFWwindow* window, int* width, int* height);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002115
Camilla Berglundd84772d2014-02-13 02:57:59 +01002116/*! @brief Sets the size limits of the specified window.
2117 *
2118 * This function sets the size limits of the client area of the specified
Emmanuel Gil Peyrotf0f5d9f2016-04-09 00:42:58 +01002119 * window. If the window is full screen, the size limits only take effect
Camilla Berglund6570d0c2016-02-23 12:26:42 +01002120 * once it is made windowed. If the window is not resizable, this function
2121 * does nothing.
Camilla Berglundd84772d2014-02-13 02:57:59 +01002122 *
Camilla Berglund6570d0c2016-02-23 12:26:42 +01002123 * The size limits are applied immediately to a windowed mode window and may
2124 * cause it to be resized.
Camilla Berglundd84772d2014-02-13 02:57:59 +01002125 *
Camilla Berglund12a69562016-05-04 16:28:08 +02002126 * The maximum dimensions must be greater than or equal to the minimum
2127 * dimensions and all must be greater than or equal to zero.
2128 *
Camilla Berglundd84772d2014-02-13 02:57:59 +01002129 * @param[in] window The window to set limits for.
2130 * @param[in] minwidth The minimum width, in screen coordinates, of the client
2131 * area, or `GLFW_DONT_CARE`.
2132 * @param[in] minheight The minimum height, in screen coordinates, of the
2133 * client area, or `GLFW_DONT_CARE`.
2134 * @param[in] maxwidth The maximum width, in screen coordinates, of the client
2135 * area, or `GLFW_DONT_CARE`.
2136 * @param[in] maxheight The maximum height, in screen coordinates, of the
2137 * client area, or `GLFW_DONT_CARE`.
2138 *
Camilla Berglund12a69562016-05-04 16:28:08 +02002139 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
2140 * GLFW_INVALID_VALUE and @ref GLFW_PLATFORM_ERROR.
Camilla Berglundf51cf812016-02-05 00:51:40 +01002141 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002142 * @remark If you set size limits and an aspect ratio that conflict, the
Camilla Berglundd84772d2014-02-13 02:57:59 +01002143 * results are undefined.
2144 *
linkmauvebc8b0482016-10-16 15:52:39 +01002145 * @remark @wayland The size limits will not be applied until the window is
2146 * actually resized, either by the user or by the compositor.
2147 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002148 * @thread_safety This function must only be called from the main thread.
Camilla Berglundd84772d2014-02-13 02:57:59 +01002149 *
2150 * @sa @ref window_sizelimits
Camilla Berglund7e9e3212016-09-14 20:17:26 +02002151 * @sa @ref glfwSetWindowAspectRatio
Camilla Berglundd84772d2014-02-13 02:57:59 +01002152 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002153 * @since Added in version 3.2.
Camilla Berglundd84772d2014-02-13 02:57:59 +01002154 *
2155 * @ingroup window
2156 */
2157GLFWAPI void glfwSetWindowSizeLimits(GLFWwindow* window, int minwidth, int minheight, int maxwidth, int maxheight);
2158
2159/*! @brief Sets the aspect ratio of the specified window.
2160 *
2161 * This function sets the required aspect ratio of the client area of the
Camilla Berglund6570d0c2016-02-23 12:26:42 +01002162 * specified window. If the window is full screen, the aspect ratio only takes
2163 * effect once it is made windowed. If the window is not resizable, this
Camilla Berglundd84772d2014-02-13 02:57:59 +01002164 * function does nothing.
2165 *
Camilla Berglundaf5b82a2015-10-19 16:01:42 +02002166 * The aspect ratio is specified as a numerator and a denominator and both
2167 * values must be greater than zero. For example, the common 16:9 aspect ratio
2168 * is specified as 16 and 9, respectively.
Camilla Berglundd84772d2014-02-13 02:57:59 +01002169 *
Camilla Berglundaf5b82a2015-10-19 16:01:42 +02002170 * If the numerator and denominator is set to `GLFW_DONT_CARE` then the aspect
2171 * ratio limit is disabled.
Camilla Berglundd84772d2014-02-13 02:57:59 +01002172 *
Camilla Berglund6570d0c2016-02-23 12:26:42 +01002173 * The aspect ratio is applied immediately to a windowed mode window and may
2174 * cause it to be resized.
Camilla Berglundd84772d2014-02-13 02:57:59 +01002175 *
2176 * @param[in] window The window to set limits for.
2177 * @param[in] numer The numerator of the desired aspect ratio, or
2178 * `GLFW_DONT_CARE`.
2179 * @param[in] denom The denominator of the desired aspect ratio, or
2180 * `GLFW_DONT_CARE`.
2181 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002182 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
2183 * GLFW_INVALID_VALUE and @ref GLFW_PLATFORM_ERROR.
2184 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002185 * @remark If you set size limits and an aspect ratio that conflict, the
Camilla Berglundd84772d2014-02-13 02:57:59 +01002186 * results are undefined.
2187 *
linkmauvebc8b0482016-10-16 15:52:39 +01002188 * @remark @wayland The aspect ratio will not be applied until the window is
2189 * actually resized, either by the user or by the compositor.
2190 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002191 * @thread_safety This function must only be called from the main thread.
Camilla Berglundd84772d2014-02-13 02:57:59 +01002192 *
2193 * @sa @ref window_sizelimits
Camilla Berglund7e9e3212016-09-14 20:17:26 +02002194 * @sa @ref glfwSetWindowSizeLimits
Camilla Berglundd84772d2014-02-13 02:57:59 +01002195 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002196 * @since Added in version 3.2.
Camilla Berglundd84772d2014-02-13 02:57:59 +01002197 *
2198 * @ingroup window
2199 */
2200GLFWAPI void glfwSetWindowAspectRatio(GLFWwindow* window, int numer, int denom);
2201
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002202/*! @brief Sets the size of the client area of the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002203 *
Camilla Berglund8282a8f2013-04-10 23:01:12 +02002204 * This function sets the size, in screen coordinates, of the client area of
2205 * the specified window.
2206 *
Camilla Berglund6570d0c2016-02-23 12:26:42 +01002207 * For full screen windows, this function updates the resolution of its desired
2208 * video mode and switches to the video mode closest to it, without affecting
2209 * the window's context. As the context is unaffected, the bit depths of the
2210 * framebuffer remain unchanged.
2211 *
2212 * If you wish to update the refresh rate of the desired video mode in addition
2213 * to its resolution, see @ref glfwSetWindowMonitor.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002214 *
Camilla Berglundce8f97c2015-01-11 23:33:14 +01002215 * The window manager may put limits on what sizes are allowed. GLFW cannot
2216 * and should not override these limits.
2217 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002218 * @param[in] window The window to resize.
Camilla Berglund6570d0c2016-02-23 12:26:42 +01002219 * @param[in] width The desired width, in screen coordinates, of the window
2220 * client area.
2221 * @param[in] height The desired height, in screen coordinates, of the window
2222 * client area.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002223 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002224 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2225 * GLFW_PLATFORM_ERROR.
2226 *
linkmauvebc8b0482016-10-16 15:52:39 +01002227 * @remark @wayland A full screen window will not attempt to change the mode,
2228 * no matter what the requested size.
2229 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002230 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002231 *
2232 * @sa @ref window_size
Camilla Berglund7e9e3212016-09-14 20:17:26 +02002233 * @sa @ref glfwGetWindowSize
2234 * @sa @ref glfwSetWindowMonitor
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002235 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002236 * @since Added in version 1.0.
Camilla Berglund951a9582016-01-31 21:32:14 +01002237 * @glfw3 Added window handle parameter.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002238 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002239 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002240 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01002241GLFWAPI void glfwSetWindowSize(GLFWwindow* window, int width, int height);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002242
Camilla Berglund34981632013-06-03 12:51:57 +02002243/*! @brief Retrieves the size of the framebuffer of the specified window.
2244 *
2245 * This function retrieves the size, in pixels, of the framebuffer of the
Camilla Berglund521fa7d2013-09-26 20:02:19 +02002246 * specified window. If you wish to retrieve the size of the window in screen
2247 * coordinates, see @ref glfwGetWindowSize.
Camilla Berglund34981632013-06-03 12:51:57 +02002248 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002249 * Any or all of the size arguments may be `NULL`. If an error occurs, all
2250 * non-`NULL` size arguments will be set to zero.
2251 *
Camilla Berglund34981632013-06-03 12:51:57 +02002252 * @param[in] window The window whose framebuffer to query.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02002253 * @param[out] width Where to store the width, in pixels, of the framebuffer,
2254 * or `NULL`.
2255 * @param[out] height Where to store the height, in pixels, of the framebuffer,
2256 * or `NULL`.
Camilla Berglund34981632013-06-03 12:51:57 +02002257 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002258 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2259 * GLFW_PLATFORM_ERROR.
2260 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002261 * @thread_safety This function must only be called from the main thread.
Camilla Berglund0e205772014-03-24 11:58:35 +01002262 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002263 * @sa @ref window_fbsize
Camilla Berglund7e9e3212016-09-14 20:17:26 +02002264 * @sa @ref glfwSetFramebufferSizeCallback
Camilla Berglund34981632013-06-03 12:51:57 +02002265 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002266 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002267 *
Camilla Berglund34981632013-06-03 12:51:57 +02002268 * @ingroup window
2269 */
2270GLFWAPI void glfwGetFramebufferSize(GLFWwindow* window, int* width, int* height);
2271
Camilla Berglundeb3f75e2014-03-25 21:30:13 +01002272/*! @brief Retrieves the size of the frame of the window.
2273 *
2274 * This function retrieves the size, in screen coordinates, of each edge of the
2275 * frame of the specified window. This size includes the title bar, if the
2276 * window has one. The size of the frame may vary depending on the
2277 * [window-related hints](@ref window_hints_wnd) used to create it.
2278 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002279 * Because this function retrieves the size of each window frame edge and not
2280 * the offset along a particular coordinate axis, the retrieved values will
2281 * always be zero or positive.
2282 *
2283 * Any or all of the size arguments may be `NULL`. If an error occurs, all
2284 * non-`NULL` size arguments will be set to zero.
2285 *
Camilla Berglundeb3f75e2014-03-25 21:30:13 +01002286 * @param[in] window The window whose frame size to query.
2287 * @param[out] left Where to store the size, in screen coordinates, of the left
Camilla Berglund4591ad22014-09-18 15:03:29 +02002288 * edge of the window frame, or `NULL`.
Camilla Berglundeaff0f72014-04-07 16:27:32 +02002289 * @param[out] top Where to store the size, in screen coordinates, of the top
Camilla Berglund4591ad22014-09-18 15:03:29 +02002290 * edge of the window frame, or `NULL`.
Camilla Berglundeaff0f72014-04-07 16:27:32 +02002291 * @param[out] right Where to store the size, in screen coordinates, of the
Camilla Berglund4591ad22014-09-18 15:03:29 +02002292 * right edge of the window frame, or `NULL`.
Camilla Berglundeaff0f72014-04-07 16:27:32 +02002293 * @param[out] bottom Where to store the size, in screen coordinates, of the
Camilla Berglund4591ad22014-09-18 15:03:29 +02002294 * bottom edge of the window frame, or `NULL`.
Camilla Berglundeb3f75e2014-03-25 21:30:13 +01002295 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002296 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2297 * GLFW_PLATFORM_ERROR.
2298 *
linkmauvebc8b0482016-10-16 15:52:39 +01002299 * @remark @wayland The window frame is currently unimplemented, as if
2300 * `GLFW_DECORATED` was always set to `GLFW_FALSE`, so the returned values
2301 * will always be zero.
2302 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002303 * @thread_safety This function must only be called from the main thread.
Camilla Berglundeb3f75e2014-03-25 21:30:13 +01002304 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002305 * @sa @ref window_size
2306 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002307 * @since Added in version 3.1.
Camilla Berglundeb3f75e2014-03-25 21:30:13 +01002308 *
2309 * @ingroup window
2310 */
2311GLFWAPI void glfwGetWindowFrameSize(GLFWwindow* window, int* left, int* top, int* right, int* bottom);
2312
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002313/*! @brief Iconifies the specified window.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002314 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002315 * This function iconifies (minimizes) the specified window if it was
2316 * previously restored. If the window is already iconified, this function does
2317 * nothing.
2318 *
2319 * If the specified window is a full screen window, the original monitor
2320 * resolution is restored until the window is restored.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002321 *
2322 * @param[in] window The window to iconify.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002323 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002324 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2325 * GLFW_PLATFORM_ERROR.
2326 *
linkmauvebc8b0482016-10-16 15:52:39 +01002327 * @remark @wayland There is no concept of iconification in wl_shell, this
2328 * function will always emit @ref GLFW_PLATFORM_ERROR.
2329 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002330 * @thread_safety This function must only be called from the main thread.
Camilla Berglund9ad1d972012-11-22 19:08:30 +01002331 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002332 * @sa @ref window_iconify
Camilla Berglund7e9e3212016-09-14 20:17:26 +02002333 * @sa @ref glfwRestoreWindow
2334 * @sa @ref glfwMaximizeWindow
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002335 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002336 * @since Added in version 2.1.
Camilla Berglund951a9582016-01-31 21:32:14 +01002337 * @glfw3 Added window handle parameter.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002338 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002339 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002340 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01002341GLFWAPI void glfwIconifyWindow(GLFWwindow* window);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002342
2343/*! @brief Restores the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002344 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002345 * This function restores the specified window if it was previously iconified
Camilla Berglunda10caa42015-10-13 12:50:59 +02002346 * (minimized) or maximized. If the window is already restored, this function
2347 * does nothing.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002348 *
2349 * If the specified window is a full screen window, the resolution chosen for
2350 * the window is restored on the selected monitor.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002351 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002352 * @param[in] window The window to restore.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002353 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002354 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2355 * GLFW_PLATFORM_ERROR.
2356 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002357 * @thread_safety This function must only be called from the main thread.
Camilla Berglund9ad1d972012-11-22 19:08:30 +01002358 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002359 * @sa @ref window_iconify
Camilla Berglund7e9e3212016-09-14 20:17:26 +02002360 * @sa @ref glfwIconifyWindow
2361 * @sa @ref glfwMaximizeWindow
Camilla Berglunde248fb62013-03-29 14:06:23 +01002362 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002363 * @since Added in version 2.1.
Camilla Berglund951a9582016-01-31 21:32:14 +01002364 * @glfw3 Added window handle parameter.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002365 *
Camilla Berglunde248fb62013-03-29 14:06:23 +01002366 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002367 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01002368GLFWAPI void glfwRestoreWindow(GLFWwindow* window);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002369
Camilla Berglunda10caa42015-10-13 12:50:59 +02002370/*! @brief Maximizes the specified window.
2371 *
2372 * This function maximizes the specified window if it was previously not
2373 * maximized. If the window is already maximized, this function does nothing.
2374 *
2375 * If the specified window is a full screen window, this function does nothing.
2376 *
2377 * @param[in] window The window to maximize.
2378 *
Camilla Berglundf5b71f52016-05-27 14:20:39 +02002379 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2380 * GLFW_PLATFORM_ERROR.
2381 *
Camilla Berglunda10caa42015-10-13 12:50:59 +02002382 * @par Thread Safety
2383 * This function may only be called from the main thread.
2384 *
2385 * @sa @ref window_iconify
Camilla Berglund7e9e3212016-09-14 20:17:26 +02002386 * @sa @ref glfwIconifyWindow
2387 * @sa @ref glfwRestoreWindow
Camilla Berglunda10caa42015-10-13 12:50:59 +02002388 *
2389 * @since Added in GLFW 3.2.
2390 *
2391 * @ingroup window
2392 */
2393GLFWAPI void glfwMaximizeWindow(GLFWwindow* window);
2394
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002395/*! @brief Makes the specified window visible.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002396 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002397 * This function makes the specified window visible if it was previously
Camilla Berglund8282a8f2013-04-10 23:01:12 +02002398 * hidden. If the window is already visible or is in full screen mode, this
Camilla Berglund1e9383d2012-11-23 11:41:53 +01002399 * function does nothing.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002400 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002401 * @param[in] window The window to make visible.
2402 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002403 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2404 * GLFW_PLATFORM_ERROR.
2405 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002406 * @thread_safety This function must only be called from the main thread.
Camilla Berglund9ad1d972012-11-22 19:08:30 +01002407 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002408 * @sa @ref window_hide
Camilla Berglund7e9e3212016-09-14 20:17:26 +02002409 * @sa @ref glfwHideWindow
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002410 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002411 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002412 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002413 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002414 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01002415GLFWAPI void glfwShowWindow(GLFWwindow* window);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002416
2417/*! @brief Hides the specified window.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002418 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002419 * This function hides the specified window if it was previously visible. If
Camilla Berglund8282a8f2013-04-10 23:01:12 +02002420 * the window is already hidden or is in full screen mode, this function does
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002421 * nothing.
2422 *
2423 * @param[in] window The window to hide.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002424 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002425 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2426 * GLFW_PLATFORM_ERROR.
2427 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002428 * @thread_safety This function must only be called from the main thread.
Camilla Berglund9ad1d972012-11-22 19:08:30 +01002429 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002430 * @sa @ref window_hide
Camilla Berglund7e9e3212016-09-14 20:17:26 +02002431 * @sa @ref glfwShowWindow
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002432 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002433 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002434 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002435 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002436 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01002437GLFWAPI void glfwHideWindow(GLFWwindow* window);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002438
Camilla Berglundbaf57442016-02-21 15:42:49 +01002439/*! @brief Brings the specified window to front and sets input focus.
2440 *
2441 * This function brings the specified window to front and sets input focus.
2442 * The window should already be visible and not iconified.
2443 *
2444 * By default, both windowed and full screen mode windows are focused when
2445 * initially created. Set the [GLFW_FOCUSED](@ref window_hints_wnd) to disable
2446 * this behavior.
2447 *
2448 * __Do not use this function__ to steal focus from other applications unless
2449 * you are certain that is what the user wants. Focus stealing can be
2450 * extremely disruptive.
2451 *
2452 * @param[in] window The window to give input focus.
2453 *
2454 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2455 * GLFW_PLATFORM_ERROR.
2456 *
linkmauvebc8b0482016-10-16 15:52:39 +01002457 * @remark @wayland It is not possible for an application to bring its windows
2458 * to front, this function will always emit @ref GLFW_PLATFORM_ERROR.
2459 *
Camilla Berglundbaf57442016-02-21 15:42:49 +01002460 * @thread_safety This function must only be called from the main thread.
2461 *
2462 * @sa @ref window_focus
2463 *
2464 * @since Added in version 3.2.
2465 *
2466 * @ingroup window
2467 */
2468GLFWAPI void glfwFocusWindow(GLFWwindow* window);
2469
Camilla Berglund8282a8f2013-04-10 23:01:12 +02002470/*! @brief Returns the monitor that the window uses for full screen mode.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002471 *
2472 * This function returns the handle of the monitor that the specified window is
Camilla Berglund8282a8f2013-04-10 23:01:12 +02002473 * in full screen on.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002474 *
Camilla Berglund5f68e122012-11-27 17:07:28 +01002475 * @param[in] window The window to query.
Camilla Berglund999f3552016-08-17 16:48:22 +02002476 * @return The monitor, or `NULL` if the window is in windowed mode or an
2477 * [error](@ref error_handling) occurred.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002478 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002479 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
2480 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002481 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002482 *
2483 * @sa @ref window_monitor
Camilla Berglund7e9e3212016-09-14 20:17:26 +02002484 * @sa @ref glfwSetWindowMonitor
Camilla Berglund4591ad22014-09-18 15:03:29 +02002485 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002486 * @since Added in version 3.0.
Camilla Berglund0e205772014-03-24 11:58:35 +01002487 *
Camilla Berglund5f68e122012-11-27 17:07:28 +01002488 * @ingroup window
Camilla Berglund41bc0d12012-11-27 16:55:04 +01002489 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01002490GLFWAPI GLFWmonitor* glfwGetWindowMonitor(GLFWwindow* window);
Camilla Berglund41bc0d12012-11-27 16:55:04 +01002491
Camilla Berglund6570d0c2016-02-23 12:26:42 +01002492/*! @brief Sets the mode, monitor, video mode and placement of a window.
2493 *
2494 * This function sets the monitor that the window uses for full screen mode or,
2495 * if the monitor is `NULL`, makes it windowed mode.
2496 *
2497 * When setting a monitor, this function updates the width, height and refresh
2498 * rate of the desired video mode and switches to the video mode closest to it.
2499 * The window position is ignored when setting a monitor.
2500 *
2501 * When the monitor is `NULL`, the position, width and height are used to
2502 * place the window client area. The refresh rate is ignored when no monitor
2503 * is specified.
2504 *
2505 * If you only wish to update the resolution of a full screen window or the
2506 * size of a windowed mode window, see @ref glfwSetWindowSize.
2507 *
2508 * When a window transitions from full screen to windowed mode, this function
2509 * restores any previous window settings such as whether it is decorated,
linkmauvebc8b0482016-10-16 15:52:39 +01002510 * floating, resizable, has size or aspect ratio limits, etc.
Camilla Berglund6570d0c2016-02-23 12:26:42 +01002511 *
2512 * @param[in] window The window whose monitor, size or video mode to set.
2513 * @param[in] monitor The desired monitor, or `NULL` to set windowed mode.
2514 * @param[in] xpos The desired x-coordinate of the upper-left corner of the
2515 * client area.
2516 * @param[in] ypos The desired y-coordinate of the upper-left corner of the
2517 * client area.
2518 * @param[in] width The desired with, in screen coordinates, of the client area
2519 * or video mode.
2520 * @param[in] height The desired height, in screen coordinates, of the client
2521 * area or video mode.
Camilla Berglund325729d2016-05-22 14:25:04 +02002522 * @param[in] refreshRate The desired refresh rate, in Hz, of the video mode,
2523 * or `GLFW_DONT_CARE`.
Camilla Berglund6570d0c2016-02-23 12:26:42 +01002524 *
2525 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2526 * GLFW_PLATFORM_ERROR.
2527 *
linkmauvebc8b0482016-10-16 15:52:39 +01002528 * @remark @wayland The desired window position is ignored, as there is no way
2529 * for an application to set this property.
2530 *
2531 * @remark @wayland Setting the window to full screen will not attempt to
2532 * change the mode, no matter what the requested size or refresh rate.
2533 *
Camilla Berglund6570d0c2016-02-23 12:26:42 +01002534 * @thread_safety This function must only be called from the main thread.
2535 *
2536 * @sa @ref window_monitor
2537 * @sa @ref window_full_screen
Camilla Berglund7e9e3212016-09-14 20:17:26 +02002538 * @sa @ref glfwGetWindowMonitor
2539 * @sa @ref glfwSetWindowSize
Camilla Berglund6570d0c2016-02-23 12:26:42 +01002540 *
2541 * @since Added in version 3.2.
2542 *
2543 * @ingroup window
2544 */
2545GLFWAPI void glfwSetWindowMonitor(GLFWwindow* window, GLFWmonitor* monitor, int xpos, int ypos, int width, int height, int refreshRate);
2546
Camilla Berglundad1f6f02013-05-27 15:30:32 +02002547/*! @brief Returns an attribute of the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002548 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002549 * This function returns the value of an attribute of the specified window or
2550 * its OpenGL or OpenGL ES context.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002551 *
Camilla Berglund1e9383d2012-11-23 11:41:53 +01002552 * @param[in] window The window to query.
Camilla Berglund1f5f20e2013-05-27 17:10:34 +02002553 * @param[in] attrib The [window attribute](@ref window_attribs) whose value to
2554 * return.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002555 * @return The value of the attribute, or zero if an
2556 * [error](@ref error_handling) occurred.
Camilla Berglund1e9383d2012-11-23 11:41:53 +01002557 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002558 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
2559 * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR.
2560 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002561 * @remark Framebuffer related hints are not window attributes. See @ref
Camilla Berglund59abeeb2015-04-07 14:34:12 +02002562 * window_attribs_fb for more information.
2563 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002564 * @remark Zero is a valid value for many window and context related
Camilla Berglund59abeeb2015-04-07 14:34:12 +02002565 * attributes so you cannot use a return value of zero as an indication of
2566 * errors. However, this function should not fail as long as it is passed
2567 * valid arguments and the library has been [initialized](@ref intro_init).
2568 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002569 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002570 *
2571 * @sa @ref window_attribs
2572 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002573 * @since Added in version 3.0. Replaces `glfwGetWindowParam` and
Camilla Berglund4188c262015-01-18 01:55:25 +01002574 * `glfwGetGLVersion`.
Camilla Berglund0e205772014-03-24 11:58:35 +01002575 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002576 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002577 */
Camilla Berglundad1f6f02013-05-27 15:30:32 +02002578GLFWAPI int glfwGetWindowAttrib(GLFWwindow* window, int attrib);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002579
2580/*! @brief Sets the user pointer of the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002581 *
2582 * This function sets the user-defined pointer of the specified window. The
2583 * current value is retained until the window is destroyed. The initial value
2584 * is `NULL`.
2585 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002586 * @param[in] window The window whose pointer to set.
2587 * @param[in] pointer The new value.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002588 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002589 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
2590 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002591 * @thread_safety This function may be called from any thread. Access is not
2592 * synchronized.
Camilla Berglund0e205772014-03-24 11:58:35 +01002593 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002594 * @sa @ref window_userptr
Camilla Berglund7e9e3212016-09-14 20:17:26 +02002595 * @sa @ref glfwGetWindowUserPointer
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002596 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002597 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002598 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002599 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002600 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01002601GLFWAPI void glfwSetWindowUserPointer(GLFWwindow* window, void* pointer);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002602
2603/*! @brief Returns the user pointer of the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002604 *
2605 * This function returns the current value of the user-defined pointer of the
2606 * specified window. The initial value is `NULL`.
2607 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002608 * @param[in] window The window whose pointer to return.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002609 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002610 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
2611 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002612 * @thread_safety This function may be called from any thread. Access is not
2613 * synchronized.
Camilla Berglund0e205772014-03-24 11:58:35 +01002614 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002615 * @sa @ref window_userptr
Camilla Berglund7e9e3212016-09-14 20:17:26 +02002616 * @sa @ref glfwSetWindowUserPointer
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002617 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002618 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002619 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002620 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002621 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01002622GLFWAPI void* glfwGetWindowUserPointer(GLFWwindow* window);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002623
Camilla Berglund1a3d47d2012-11-30 13:56:42 +01002624/*! @brief Sets the position callback for the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002625 *
2626 * This function sets the position callback of the specified window, which is
2627 * called when the window is moved. The callback is provided with the screen
2628 * position of the upper-left corner of the client area of the window.
2629 *
Camilla Berglund1a3d47d2012-11-30 13:56:42 +01002630 * @param[in] window The window whose callback to set.
Camilla Berglund71d2b572013-03-12 15:33:05 +01002631 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
Camilla Berglund1a3d47d2012-11-30 13:56:42 +01002632 * callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02002633 * @return The previously set callback, or `NULL` if no callback was set or the
2634 * library had not been [initialized](@ref intro_init).
Camilla Berglund11a27de2013-04-08 21:21:21 +02002635 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002636 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
2637 *
linkmauvebc8b0482016-10-16 15:52:39 +01002638 * @remark @wayland This callback will never be called, as there is no way for
2639 * an application to know its global position.
2640 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002641 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002642 *
2643 * @sa @ref window_pos
2644 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002645 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002646 *
Camilla Berglund1a3d47d2012-11-30 13:56:42 +01002647 * @ingroup window
2648 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02002649GLFWAPI GLFWwindowposfun glfwSetWindowPosCallback(GLFWwindow* window, GLFWwindowposfun cbfun);
Camilla Berglund1a3d47d2012-11-30 13:56:42 +01002650
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002651/*! @brief Sets the size callback for the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002652 *
2653 * This function sets the size callback of the specified window, which is
2654 * called when the window is resized. The callback is provided with the size,
Camilla Berglund8282a8f2013-04-10 23:01:12 +02002655 * in screen coordinates, of the client area of the window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002656 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002657 * @param[in] window The window whose callback to set.
Camilla Berglund71d2b572013-03-12 15:33:05 +01002658 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002659 * callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02002660 * @return The previously set callback, or `NULL` if no callback was set or the
2661 * library had not been [initialized](@ref intro_init).
Camilla Berglund11a27de2013-04-08 21:21:21 +02002662 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002663 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
2664 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002665 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002666 *
2667 * @sa @ref window_size
2668 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002669 * @since Added in version 1.0.
2670 * @glfw3 Added window handle parameter and return value.
Camilla Berglund0e205772014-03-24 11:58:35 +01002671 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002672 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002673 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02002674GLFWAPI GLFWwindowsizefun glfwSetWindowSizeCallback(GLFWwindow* window, GLFWwindowsizefun cbfun);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002675
2676/*! @brief Sets the close callback for the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002677 *
2678 * This function sets the close callback of the specified window, which is
2679 * called when the user attempts to close the window, for example by clicking
2680 * the close widget in the title bar.
2681 *
2682 * The close flag is set before this callback is called, but you can modify it
2683 * at any time with @ref glfwSetWindowShouldClose.
2684 *
Camilla Berglund5fd409b2013-06-05 17:53:13 +02002685 * The close callback is not triggered by @ref glfwDestroyWindow.
2686 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002687 * @param[in] window The window whose callback to set.
Camilla Berglund71d2b572013-03-12 15:33:05 +01002688 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002689 * callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02002690 * @return The previously set callback, or `NULL` if no callback was set or the
2691 * library had not been [initialized](@ref intro_init).
Camilla Berglund11a27de2013-04-08 21:21:21 +02002692 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002693 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
2694 *
Camilla Berglund8d6f2652016-10-20 00:50:54 +02002695 * @remark @macos Selecting Quit from the application menu will trigger the
2696 * close callback for all windows.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002697 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002698 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002699 *
2700 * @sa @ref window_close
2701 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002702 * @since Added in version 2.5.
2703 * @glfw3 Added window handle parameter and return value.
Camilla Berglund0e205772014-03-24 11:58:35 +01002704 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002705 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002706 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02002707GLFWAPI GLFWwindowclosefun glfwSetWindowCloseCallback(GLFWwindow* window, GLFWwindowclosefun cbfun);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002708
2709/*! @brief Sets the refresh callback for the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002710 *
2711 * This function sets the refresh callback of the specified window, which is
2712 * called when the client area of the window needs to be redrawn, for example
2713 * if the window has been exposed after having been covered by another window.
2714 *
linkmauvebc8b0482016-10-16 15:52:39 +01002715 * On compositing window systems such as Aero, Compiz, Aqua or Wayland, where
2716 * the window contents are saved off-screen, this callback may be called only
2717 * very infrequently or never at all.
Camilla Berglund8282a8f2013-04-10 23:01:12 +02002718 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002719 * @param[in] window The window whose callback to set.
Camilla Berglund71d2b572013-03-12 15:33:05 +01002720 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002721 * callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02002722 * @return The previously set callback, or `NULL` if no callback was set or the
2723 * library had not been [initialized](@ref intro_init).
Camilla Berglund11a27de2013-04-08 21:21:21 +02002724 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002725 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
2726 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002727 * @thread_safety This function must only be called from the main thread.
Camilla Berglund0e205772014-03-24 11:58:35 +01002728 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002729 * @sa @ref window_refresh
2730 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002731 * @since Added in version 2.5.
2732 * @glfw3 Added window handle parameter and return value.
Camilla Berglunda3ff29a2012-12-02 15:47:10 +01002733 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002734 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002735 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02002736GLFWAPI GLFWwindowrefreshfun glfwSetWindowRefreshCallback(GLFWwindow* window, GLFWwindowrefreshfun cbfun);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002737
2738/*! @brief Sets the focus callback for the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002739 *
2740 * This function sets the focus callback of the specified window, which is
Camilla Berglund4188c262015-01-18 01:55:25 +01002741 * called when the window gains or loses input focus.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002742 *
Camilla Berglund4188c262015-01-18 01:55:25 +01002743 * After the focus callback is called for a window that lost input focus,
2744 * synthetic key and mouse button release events will be generated for all such
2745 * that had been pressed. For more information, see @ref glfwSetKeyCallback
2746 * and @ref glfwSetMouseButtonCallback.
Camilla Berglund4538a522013-04-24 19:49:46 +02002747 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002748 * @param[in] window The window whose callback to set.
Camilla Berglund71d2b572013-03-12 15:33:05 +01002749 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002750 * callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02002751 * @return The previously set callback, or `NULL` if no callback was set or the
2752 * library had not been [initialized](@ref intro_init).
Camilla Berglund11a27de2013-04-08 21:21:21 +02002753 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002754 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
2755 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002756 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002757 *
2758 * @sa @ref window_focus
2759 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002760 * @since Added in version 3.0.
Camilla Berglund0e205772014-03-24 11:58:35 +01002761 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002762 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002763 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02002764GLFWAPI GLFWwindowfocusfun glfwSetWindowFocusCallback(GLFWwindow* window, GLFWwindowfocusfun cbfun);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002765
2766/*! @brief Sets the iconify callback for the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002767 *
2768 * This function sets the iconification callback of the specified window, which
2769 * is called when the window is iconified or restored.
2770 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002771 * @param[in] window The window whose callback to set.
Camilla Berglund71d2b572013-03-12 15:33:05 +01002772 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002773 * callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02002774 * @return The previously set callback, or `NULL` if no callback was set or the
2775 * library had not been [initialized](@ref intro_init).
Camilla Berglund11a27de2013-04-08 21:21:21 +02002776 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002777 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
2778 *
linkmauvebc8b0482016-10-16 15:52:39 +01002779 * @remark @wayland The wl_shell protocol has no concept of iconification,
2780 * this callback will never be called.
2781 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002782 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002783 *
2784 * @sa @ref window_iconify
2785 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002786 * @since Added in version 3.0.
Camilla Berglund0e205772014-03-24 11:58:35 +01002787 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002788 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002789 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02002790GLFWAPI GLFWwindowiconifyfun glfwSetWindowIconifyCallback(GLFWwindow* window, GLFWwindowiconifyfun cbfun);
Camilla Berglund135194a2010-09-09 18:15:32 +02002791
Camilla Berglundc156b502016-06-16 13:09:28 +02002792/*! @brief Sets the maximize callback for the specified window.
2793 *
2794 * This function sets the maximization callback of the specified window, which
2795 * is called when the window is maximized or restored.
2796 *
2797 * @param[in] window The window whose callback to set.
2798 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
2799 * callback.
2800 * @return The previously set callback, or `NULL` if no callback was set or the
2801 * library had not been [initialized](@ref intro_init).
2802 *
2803 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
2804 *
2805 * @thread_safety This function must only be called from the main thread.
2806 *
2807 * @sa @ref window_maximize
2808 *
2809 * @since Added in version 3.3.
2810 *
2811 * @ingroup window
2812 */
2813GLFWAPI GLFWwindowmaximizefun glfwSetWindowMaximizeCallback(GLFWwindow* window, GLFWwindowmaximizefun cbfun);
2814
Camilla Berglund34981632013-06-03 12:51:57 +02002815/*! @brief Sets the framebuffer resize callback for the specified window.
2816 *
2817 * This function sets the framebuffer resize callback of the specified window,
2818 * which is called when the framebuffer of the specified window is resized.
2819 *
2820 * @param[in] window The window whose callback to set.
2821 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
2822 * callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02002823 * @return The previously set callback, or `NULL` if no callback was set or the
2824 * library had not been [initialized](@ref intro_init).
Camilla Berglund34981632013-06-03 12:51:57 +02002825 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002826 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
2827 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002828 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002829 *
2830 * @sa @ref window_fbsize
2831 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002832 * @since Added in version 3.0.
Camilla Berglund0e205772014-03-24 11:58:35 +01002833 *
Camilla Berglund34981632013-06-03 12:51:57 +02002834 * @ingroup window
2835 */
2836GLFWAPI GLFWframebuffersizefun glfwSetFramebufferSizeCallback(GLFWwindow* window, GLFWframebuffersizefun cbfun);
2837
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002838/*! @brief Processes all pending events.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002839 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002840 * This function processes only those events that are already in the event
2841 * queue and then returns immediately. Processing events will cause the window
2842 * and input callbacks associated with those events to be called.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002843 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002844 * On some platforms, a window move, resize or menu operation will cause event
2845 * processing to block. This is due to how event processing is designed on
2846 * those platforms. You can use the
2847 * [window refresh callback](@ref window_refresh) to redraw the contents of
2848 * your window when necessary during such operations.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02002849 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002850 * On some platforms, certain events are sent directly to the application
2851 * without going through the event queue, causing callbacks to be called
2852 * outside of a call to one of the event processing functions.
Camilla Berglund401033c2013-03-12 19:17:07 +01002853 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002854 * Event processing is not required for joystick input to work.
Camilla Berglund9ad1d972012-11-22 19:08:30 +01002855 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002856 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2857 * GLFW_PLATFORM_ERROR.
2858 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002859 * @reentrancy This function must not be called from a callback.
Camilla Berglundb48128f2013-02-14 18:49:03 +01002860 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002861 * @thread_safety This function must only be called from the main thread.
Camilla Berglund948cc042013-04-16 02:02:22 +02002862 *
Camilla Berglund4188c262015-01-18 01:55:25 +01002863 * @sa @ref events
Camilla Berglund7e9e3212016-09-14 20:17:26 +02002864 * @sa @ref glfwWaitEvents
2865 * @sa @ref glfwWaitEventsTimeout
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002866 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002867 * @since Added in version 1.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002868 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002869 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002870 */
Camilla Berglund9a716692010-09-08 16:40:43 +02002871GLFWAPI void glfwPollEvents(void);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002872
Camilla Berglund4591ad22014-09-18 15:03:29 +02002873/*! @brief Waits until events are queued and processes them.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002874 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002875 * This function puts the calling thread to sleep until at least one event is
2876 * available in the event queue. Once one or more events are available,
2877 * it behaves exactly like @ref glfwPollEvents, i.e. the events in the queue
2878 * are processed and the function then returns immediately. Processing events
2879 * will cause the window and input callbacks associated with those events to be
2880 * called.
Camilla Berglund948cc042013-04-16 02:02:22 +02002881 *
2882 * Since not all events are associated with callbacks, this function may return
2883 * without a callback having been called even if you are monitoring all
2884 * callbacks.
2885 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002886 * On some platforms, a window move, resize or menu operation will cause event
2887 * processing to block. This is due to how event processing is designed on
2888 * those platforms. You can use the
2889 * [window refresh callback](@ref window_refresh) to redraw the contents of
2890 * your window when necessary during such operations.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002891 *
Camilla Berglund4188c262015-01-18 01:55:25 +01002892 * On some platforms, certain callbacks may be called outside of a call to one
2893 * of the event processing functions.
2894 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002895 * If no windows exist, this function returns immediately. For synchronization
2896 * of threads in applications that do not create windows, use your threading
2897 * library of choice.
Camilla Berglund2ae46fa2013-12-04 19:12:24 +01002898 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002899 * Event processing is not required for joystick input to work.
Camilla Berglund9ad1d972012-11-22 19:08:30 +01002900 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002901 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2902 * GLFW_PLATFORM_ERROR.
2903 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002904 * @reentrancy This function must not be called from a callback.
Camilla Berglund44372b82014-12-17 01:31:36 +01002905 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002906 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002907 *
Camilla Berglund4188c262015-01-18 01:55:25 +01002908 * @sa @ref events
Camilla Berglund7e9e3212016-09-14 20:17:26 +02002909 * @sa @ref glfwPollEvents
2910 * @sa @ref glfwWaitEventsTimeout
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002911 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002912 * @since Added in version 2.5.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002913 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002914 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002915 */
Camilla Berglund9a716692010-09-08 16:40:43 +02002916GLFWAPI void glfwWaitEvents(void);
Camilla Berglund135194a2010-09-09 18:15:32 +02002917
Camilla Berglund56208952016-02-02 21:11:16 +01002918/*! @brief Waits with timeout until events are queued and processes them.
2919 *
2920 * This function puts the calling thread to sleep until at least one event is
2921 * available in the event queue, or until the specified timeout is reached. If
2922 * one or more events are available, it behaves exactly like @ref
2923 * glfwPollEvents, i.e. the events in the queue are processed and the function
2924 * then returns immediately. Processing events will cause the window and input
2925 * callbacks associated with those events to be called.
2926 *
2927 * The timeout value must be a positive finite number.
2928 *
2929 * Since not all events are associated with callbacks, this function may return
2930 * without a callback having been called even if you are monitoring all
2931 * callbacks.
2932 *
2933 * On some platforms, a window move, resize or menu operation will cause event
2934 * processing to block. This is due to how event processing is designed on
2935 * those platforms. You can use the
2936 * [window refresh callback](@ref window_refresh) to redraw the contents of
2937 * your window when necessary during such operations.
2938 *
2939 * On some platforms, certain callbacks may be called outside of a call to one
2940 * of the event processing functions.
2941 *
2942 * If no windows exist, this function returns immediately. For synchronization
2943 * of threads in applications that do not create windows, use your threading
2944 * library of choice.
2945 *
2946 * Event processing is not required for joystick input to work.
2947 *
2948 * @param[in] timeout The maximum amount of time, in seconds, to wait.
2949 *
2950 * @reentrancy This function must not be called from a callback.
2951 *
2952 * @thread_safety This function must only be called from the main thread.
2953 *
2954 * @sa @ref events
Camilla Berglund7e9e3212016-09-14 20:17:26 +02002955 * @sa @ref glfwPollEvents
2956 * @sa @ref glfwWaitEvents
Camilla Berglund56208952016-02-02 21:11:16 +01002957 *
2958 * @since Added in version 3.2.
2959 *
2960 * @ingroup window
2961 */
2962GLFWAPI void glfwWaitEventsTimeout(double timeout);
2963
Camilla Berglund1ccc2322014-02-10 18:16:58 +01002964/*! @brief Posts an empty event to the event queue.
2965 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002966 * This function posts an empty event from the current thread to the event
Camilla Berglund73abf8a2016-07-06 13:06:59 +02002967 * queue, causing @ref glfwWaitEvents or @ref glfwWaitEventsTimeout to return.
Camilla Berglund1ccc2322014-02-10 18:16:58 +01002968 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002969 * If no windows exist, this function returns immediately. For synchronization
2970 * of threads in applications that do not create windows, use your threading
2971 * library of choice.
Camilla Berglund1ccc2322014-02-10 18:16:58 +01002972 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002973 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2974 * GLFW_PLATFORM_ERROR.
2975 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002976 * @thread_safety This function may be called from any thread.
Camilla Berglund1ccc2322014-02-10 18:16:58 +01002977 *
Camilla Berglund4188c262015-01-18 01:55:25 +01002978 * @sa @ref events
Camilla Berglund7e9e3212016-09-14 20:17:26 +02002979 * @sa @ref glfwWaitEvents
2980 * @sa @ref glfwWaitEventsTimeout
Camilla Berglund1ccc2322014-02-10 18:16:58 +01002981 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002982 * @since Added in version 3.1.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002983 *
Camilla Berglund1ccc2322014-02-10 18:16:58 +01002984 * @ingroup window
2985 */
2986GLFWAPI void glfwPostEmptyEvent(void);
2987
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002988/*! @brief Returns the value of an input option for the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002989 *
Camilla Berglund95654cf2014-10-02 17:35:10 +02002990 * This function returns the value of an input option for the specified window.
2991 * The mode must be one of `GLFW_CURSOR`, `GLFW_STICKY_KEYS` or
2992 * `GLFW_STICKY_MOUSE_BUTTONS`.
2993 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002994 * @param[in] window The window to query.
Camilla Berglund9264b5d2013-04-26 14:29:55 +02002995 * @param[in] mode One of `GLFW_CURSOR`, `GLFW_STICKY_KEYS` or
Camilla Berglund39fe1f12013-03-12 19:39:36 +01002996 * `GLFW_STICKY_MOUSE_BUTTONS`.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002997 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002998 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2999 * GLFW_INVALID_ENUM.
3000 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003001 * @thread_safety This function must only be called from the main thread.
Camilla Berglund0e205772014-03-24 11:58:35 +01003002 *
Camilla Berglund7e9e3212016-09-14 20:17:26 +02003003 * @sa @ref glfwSetInputMode
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003004 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003005 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003006 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003007 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003008 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01003009GLFWAPI int glfwGetInputMode(GLFWwindow* window, int mode);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003010
3011/*! @brief Sets an input option for the specified window.
Camilla Berglund95654cf2014-10-02 17:35:10 +02003012 *
3013 * This function sets an input mode option for the specified window. The mode
3014 * must be one of `GLFW_CURSOR`, `GLFW_STICKY_KEYS` or
Camilla Berglund71d2b572013-03-12 15:33:05 +01003015 * `GLFW_STICKY_MOUSE_BUTTONS`.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003016 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003017 * If the mode is `GLFW_CURSOR`, the value must be one of the following cursor
Camilla Berglund39fe1f12013-03-12 19:39:36 +01003018 * modes:
Camilla Berglund13ccf7d2013-04-07 13:46:38 +02003019 * - `GLFW_CURSOR_NORMAL` makes the cursor visible and behaving normally.
3020 * - `GLFW_CURSOR_HIDDEN` makes the cursor invisible when it is over the client
Camilla Berglund4188c262015-01-18 01:55:25 +01003021 * area of the window but does not restrict the cursor from leaving.
Camilla Berglunda18b1872013-12-05 03:27:12 +01003022 * - `GLFW_CURSOR_DISABLED` hides and grabs the cursor, providing virtual
3023 * and unlimited cursor movement. This is useful for implementing for
3024 * example 3D camera controls.
Camilla Berglund39fe1f12013-03-12 19:39:36 +01003025 *
Camilla Berglund0eccf752015-08-23 19:30:04 +02003026 * If the mode is `GLFW_STICKY_KEYS`, the value must be either `GLFW_TRUE` to
3027 * enable sticky keys, or `GLFW_FALSE` to disable it. If sticky keys are
Camilla Berglund95654cf2014-10-02 17:35:10 +02003028 * enabled, a key press will ensure that @ref glfwGetKey returns `GLFW_PRESS`
3029 * the next time it is called even if the key had been released before the
3030 * call. This is useful when you are only interested in whether keys have been
3031 * pressed but not when or in which order.
Camilla Berglund39fe1f12013-03-12 19:39:36 +01003032 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003033 * If the mode is `GLFW_STICKY_MOUSE_BUTTONS`, the value must be either
Camilla Berglund0eccf752015-08-23 19:30:04 +02003034 * `GLFW_TRUE` to enable sticky mouse buttons, or `GLFW_FALSE` to disable it.
3035 * If sticky mouse buttons are enabled, a mouse button press will ensure that
3036 * @ref glfwGetMouseButton returns `GLFW_PRESS` the next time it is called even
3037 * if the mouse button had been released before the call. This is useful when
3038 * you are only interested in whether mouse buttons have been pressed but not
3039 * when or in which order.
Camilla Berglund95654cf2014-10-02 17:35:10 +02003040 *
3041 * @param[in] window The window whose input mode to set.
3042 * @param[in] mode One of `GLFW_CURSOR`, `GLFW_STICKY_KEYS` or
3043 * `GLFW_STICKY_MOUSE_BUTTONS`.
3044 * @param[in] value The new value of the specified input mode.
Camilla Berglund39fe1f12013-03-12 19:39:36 +01003045 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003046 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
3047 * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR.
3048 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003049 * @thread_safety This function must only be called from the main thread.
Camilla Berglund0e205772014-03-24 11:58:35 +01003050 *
Camilla Berglund7e9e3212016-09-14 20:17:26 +02003051 * @sa @ref glfwGetInputMode
Camilla Berglunde248fb62013-03-29 14:06:23 +01003052 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003053 * @since Added in version 3.0. Replaces `glfwEnable` and `glfwDisable`.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003054 *
Camilla Berglunde248fb62013-03-29 14:06:23 +01003055 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003056 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01003057GLFWAPI void glfwSetInputMode(GLFWwindow* window, int mode, int value);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003058
Camilla Berglund9c315412015-07-02 14:24:50 +02003059/*! @brief Returns the localized name of the specified printable key.
3060 *
3061 * This function returns the localized name of the specified printable key.
Camilla Berglund70ffae72016-02-22 11:54:56 +01003062 * This is intended for displaying key bindings to the user.
Camilla Berglund9c315412015-07-02 14:24:50 +02003063 *
Camilla Berglund70ffae72016-02-22 11:54:56 +01003064 * If the key is `GLFW_KEY_UNKNOWN`, the scancode is used instead, otherwise
3065 * the scancode is ignored. If a non-printable key or (if the key is
3066 * `GLFW_KEY_UNKNOWN`) a scancode that maps to a non-printable key is
3067 * specified, this function returns `NULL`.
3068 *
3069 * This behavior allows you to pass in the arguments passed to the
3070 * [key callback](@ref input_key) without modification.
3071 *
3072 * The printable keys are:
3073 * - `GLFW_KEY_APOSTROPHE`
3074 * - `GLFW_KEY_COMMA`
3075 * - `GLFW_KEY_MINUS`
3076 * - `GLFW_KEY_PERIOD`
3077 * - `GLFW_KEY_SLASH`
3078 * - `GLFW_KEY_SEMICOLON`
3079 * - `GLFW_KEY_EQUAL`
3080 * - `GLFW_KEY_LEFT_BRACKET`
3081 * - `GLFW_KEY_RIGHT_BRACKET`
3082 * - `GLFW_KEY_BACKSLASH`
3083 * - `GLFW_KEY_WORLD_1`
3084 * - `GLFW_KEY_WORLD_2`
3085 * - `GLFW_KEY_0` to `GLFW_KEY_9`
3086 * - `GLFW_KEY_A` to `GLFW_KEY_Z`
3087 * - `GLFW_KEY_KP_0` to `GLFW_KEY_KP_9`
3088 * - `GLFW_KEY_KP_DECIMAL`
3089 * - `GLFW_KEY_KP_DIVIDE`
3090 * - `GLFW_KEY_KP_MULTIPLY`
3091 * - `GLFW_KEY_KP_SUBTRACT`
3092 * - `GLFW_KEY_KP_ADD`
3093 * - `GLFW_KEY_KP_EQUAL`
Camilla Berglund9c315412015-07-02 14:24:50 +02003094 *
3095 * @param[in] key The key to query, or `GLFW_KEY_UNKNOWN`.
3096 * @param[in] scancode The scancode of the key to query.
Camilla Berglund70ffae72016-02-22 11:54:56 +01003097 * @return The localized name of the key, or `NULL`.
Camilla Berglund9c315412015-07-02 14:24:50 +02003098 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003099 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
3100 * GLFW_PLATFORM_ERROR.
3101 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003102 * @pointer_lifetime The returned string is allocated and freed by GLFW. You
3103 * should not free it yourself. It is valid until the next call to @ref
3104 * glfwGetKeyName, or until the library is terminated.
Camilla Berglund9c315412015-07-02 14:24:50 +02003105 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003106 * @thread_safety This function must only be called from the main thread.
Camilla Berglund9c315412015-07-02 14:24:50 +02003107 *
3108 * @sa @ref input_key_name
3109 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003110 * @since Added in version 3.2.
Camilla Berglund9c315412015-07-02 14:24:50 +02003111 *
3112 * @ingroup input
3113 */
3114GLFWAPI const char* glfwGetKeyName(int key, int scancode);
3115
Michael Stockere745b0d2016-08-11 19:11:40 +02003116/*! @brief Returns the platform dependent scancode of the specified key.
3117 *
3118 * This function returns the platform dependent scancode of the specified key.
3119 * This is intended for platform specific default keybindings.
3120 *
3121 * If the key is `GLFW_KEY_UNKNOWN` or does not exist on the keyboard this
3122 * method will return `-1`.
3123 *
3124 * @param[in] key The key to query.
Camilla Berglundbb3cb8f2016-09-06 15:40:31 +02003125 * @return The platform dependent scancode for the key, or `-1` if an
3126 * [error](@ref error_handling) occurred.
Michael Stockere745b0d2016-08-11 19:11:40 +02003127 *
Camilla Berglundbb3cb8f2016-09-06 15:40:31 +02003128 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
3129 * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR.
Michael Stockere745b0d2016-08-11 19:11:40 +02003130 *
3131 * @thread_safety This function may be called from any thread.
3132 *
3133 * @sa @ref input_key_scancode
3134 *
3135 * @since Added in version 3.3.
3136 *
3137 * @ingroup input
3138 */
Camilla Berglundbb3cb8f2016-09-06 15:40:31 +02003139GLFWAPI int glfwGetKeyScancode(int key);
Michael Stockere745b0d2016-08-11 19:11:40 +02003140
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003141/*! @brief Returns the last reported state of a keyboard key for the specified
3142 * window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003143 *
3144 * This function returns the last state reported for the specified key to the
3145 * specified window. The returned state is one of `GLFW_PRESS` or
Camilla Berglund4591ad22014-09-18 15:03:29 +02003146 * `GLFW_RELEASE`. The higher-level action `GLFW_REPEAT` is only reported to
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003147 * the key callback.
3148 *
3149 * If the `GLFW_STICKY_KEYS` input mode is enabled, this function returns
Camilla Berglund4591ad22014-09-18 15:03:29 +02003150 * `GLFW_PRESS` the first time you call it for a key that was pressed, even if
3151 * that key has already been released.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003152 *
3153 * The key functions deal with physical keys, with [key tokens](@ref keys)
3154 * named after their use on the standard US keyboard layout. If you want to
3155 * input text, use the Unicode character callback instead.
3156 *
Camilla Berglunde8e05d42014-04-23 13:30:11 +02003157 * The [modifier key bit masks](@ref mods) are not key tokens and cannot be
3158 * used with this function.
3159 *
Camilla Berglund9c315412015-07-02 14:24:50 +02003160 * __Do not use this function__ to implement [text input](@ref input_char).
3161 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003162 * @param[in] window The desired window.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003163 * @param[in] key The desired [keyboard key](@ref keys). `GLFW_KEY_UNKNOWN` is
3164 * not a valid key for this function.
Camilla Berglund71d2b572013-03-12 15:33:05 +01003165 * @return One of `GLFW_PRESS` or `GLFW_RELEASE`.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003166 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003167 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
3168 * GLFW_INVALID_ENUM.
3169 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003170 * @thread_safety This function must only be called from the main thread.
Camilla Berglund0e205772014-03-24 11:58:35 +01003171 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003172 * @sa @ref input_key
3173 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003174 * @since Added in version 1.0.
Camilla Berglund951a9582016-01-31 21:32:14 +01003175 * @glfw3 Added window handle parameter.
Camilla Berglund11615fc2013-05-30 17:19:12 +02003176 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003177 * @ingroup input
3178 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01003179GLFWAPI int glfwGetKey(GLFWwindow* window, int key);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003180
3181/*! @brief Returns the last reported state of a mouse button for the specified
3182 * window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003183 *
3184 * This function returns the last state reported for the specified mouse button
Camilla Berglund4591ad22014-09-18 15:03:29 +02003185 * to the specified window. The returned state is one of `GLFW_PRESS` or
Camilla Berglundce8f97c2015-01-11 23:33:14 +01003186 * `GLFW_RELEASE`.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003187 *
3188 * If the `GLFW_STICKY_MOUSE_BUTTONS` input mode is enabled, this function
Camilla Berglund4591ad22014-09-18 15:03:29 +02003189 * `GLFW_PRESS` the first time you call it for a mouse button that was pressed,
3190 * even if that mouse button has already been released.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003191 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003192 * @param[in] window The desired window.
Camilla Berglund71d2b572013-03-12 15:33:05 +01003193 * @param[in] button The desired [mouse button](@ref buttons).
3194 * @return One of `GLFW_PRESS` or `GLFW_RELEASE`.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003195 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003196 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
3197 * GLFW_INVALID_ENUM.
3198 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003199 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003200 *
3201 * @sa @ref input_mouse_button
3202 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003203 * @since Added in version 1.0.
Camilla Berglund951a9582016-01-31 21:32:14 +01003204 * @glfw3 Added window handle parameter.
Camilla Berglund0e205772014-03-24 11:58:35 +01003205 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003206 * @ingroup input
3207 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01003208GLFWAPI int glfwGetMouseButton(GLFWwindow* window, int button);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003209
Camilla Berglundd4591452014-02-11 18:24:01 +01003210/*! @brief Retrieves the position of the cursor relative to the client area of
3211 * the window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003212 *
Camilla Berglundd4591452014-02-11 18:24:01 +01003213 * This function returns the position of the cursor, in screen coordinates,
3214 * relative to the upper-left corner of the client area of the specified
3215 * window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003216 *
Camilla Berglund6df692b2013-04-26 17:20:31 +02003217 * If the cursor is disabled (with `GLFW_CURSOR_DISABLED`) then the cursor
3218 * position is unbounded and limited only by the minimum and maximum values of
3219 * a `double`.
Camilla Berglund948cc042013-04-16 02:02:22 +02003220 *
Camilla Berglund3ec29252013-04-25 18:03:15 +02003221 * The coordinate can be converted to their integer equivalents with the
3222 * `floor` function. Casting directly to an integer type works for positive
3223 * coordinates, but fails for negative ones.
3224 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003225 * Any or all of the position arguments may be `NULL`. If an error occurs, all
3226 * non-`NULL` position arguments will be set to zero.
3227 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003228 * @param[in] window The desired window.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02003229 * @param[out] xpos Where to store the cursor x-coordinate, relative to the
3230 * left edge of the client area, or `NULL`.
3231 * @param[out] ypos Where to store the cursor y-coordinate, relative to the to
3232 * top edge of the client area, or `NULL`.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003233 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003234 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
3235 * GLFW_PLATFORM_ERROR.
3236 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003237 * @thread_safety This function must only be called from the main thread.
Camilla Berglund0e205772014-03-24 11:58:35 +01003238 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003239 * @sa @ref cursor_pos
Camilla Berglund7e9e3212016-09-14 20:17:26 +02003240 * @sa @ref glfwSetCursorPos
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003241 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003242 * @since Added in version 3.0. Replaces `glfwGetMousePos`.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003243 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003244 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003245 */
Camilla Berglund129e94d2013-04-04 16:16:21 +02003246GLFWAPI void glfwGetCursorPos(GLFWwindow* window, double* xpos, double* ypos);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003247
Camilla Berglund6d9d8562013-09-28 22:12:50 +02003248/*! @brief Sets the position of the cursor, relative to the client area of the
3249 * window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003250 *
Camilla Berglund6d9d8562013-09-28 22:12:50 +02003251 * This function sets the position, in screen coordinates, of the cursor
3252 * relative to the upper-left corner of the client area of the specified
Camilla Berglund4188c262015-01-18 01:55:25 +01003253 * window. The window must have input focus. If the window does not have
3254 * input focus when this function is called, it fails silently.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003255 *
Camilla Berglund20858762015-01-01 18:41:22 +01003256 * __Do not use this function__ to implement things like camera controls. GLFW
3257 * already provides the `GLFW_CURSOR_DISABLED` cursor mode that hides the
3258 * cursor, transparently re-centers it and provides unconstrained cursor
3259 * motion. See @ref glfwSetInputMode for more information.
3260 *
3261 * If the cursor mode is `GLFW_CURSOR_DISABLED` then the cursor position is
3262 * unconstrained and limited only by the minimum and maximum values of
Camilla Berglund6df692b2013-04-26 17:20:31 +02003263 * a `double`.
Camilla Berglund948cc042013-04-16 02:02:22 +02003264 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003265 * @param[in] window The desired window.
3266 * @param[in] xpos The desired x-coordinate, relative to the left edge of the
Camilla Berglundbb558162013-09-09 23:31:59 +02003267 * client area.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003268 * @param[in] ypos The desired y-coordinate, relative to the top edge of the
Camilla Berglundbb558162013-09-09 23:31:59 +02003269 * client area.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003270 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003271 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
3272 * GLFW_PLATFORM_ERROR.
3273 *
linkmauvebc8b0482016-10-16 15:52:39 +01003274 * @remark @wayland This function will only work when the cursor mode is
3275 * `GLFW_CURSOR_DISABLED`, otherwise it will do nothing.
3276 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003277 * @thread_safety This function must only be called from the main thread.
Camilla Berglund0e205772014-03-24 11:58:35 +01003278 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003279 * @sa @ref cursor_pos
Camilla Berglund7e9e3212016-09-14 20:17:26 +02003280 * @sa @ref glfwGetCursorPos
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003281 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003282 * @since Added in version 3.0. Replaces `glfwSetMousePos`.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003283 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003284 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003285 */
Camilla Berglund129e94d2013-04-04 16:16:21 +02003286GLFWAPI void glfwSetCursorPos(GLFWwindow* window, double xpos, double ypos);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003287
Camilla Berglund2a1375e2014-09-02 16:52:16 +02003288/*! @brief Creates a custom cursor.
urraka40c04a72013-12-04 10:19:22 -03003289 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003290 * Creates a new custom cursor image that can be set for a window with @ref
3291 * glfwSetCursor. The cursor can be destroyed with @ref glfwDestroyCursor.
3292 * Any remaining cursors are destroyed by @ref glfwTerminate.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02003293 *
Camilla Berglund85a01bf2015-08-17 21:04:19 +02003294 * The pixels are 32-bit, little-endian, non-premultiplied RGBA, i.e. eight
3295 * bits per channel. They are arranged canonically as packed sequential rows,
3296 * starting from the top-left corner.
Camilla Berglund4188c262015-01-18 01:55:25 +01003297 *
3298 * The cursor hotspot is specified in pixels, relative to the upper-left corner
3299 * of the cursor image. Like all other coordinate systems in GLFW, the X-axis
3300 * points to the right and the Y-axis points down.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02003301 *
Camilla Berglund8fa9cc02014-02-23 16:43:17 +01003302 * @param[in] image The desired cursor image.
Camilla Berglund4188c262015-01-18 01:55:25 +01003303 * @param[in] xhot The desired x-coordinate, in pixels, of the cursor hotspot.
3304 * @param[in] yhot The desired y-coordinate, in pixels, of the cursor hotspot.
Camilla Berglund4188c262015-01-18 01:55:25 +01003305 * @return The handle of the created cursor, or `NULL` if an
Camilla Berglund4591ad22014-09-18 15:03:29 +02003306 * [error](@ref error_handling) occurred.
urraka40c04a72013-12-04 10:19:22 -03003307 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003308 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
3309 * GLFW_PLATFORM_ERROR.
3310 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003311 * @pointer_lifetime The specified image data is copied before this function
3312 * returns.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003313 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003314 * @reentrancy This function must not be called from a callback.
Camilla Berglund44372b82014-12-17 01:31:36 +01003315 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003316 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003317 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003318 * @sa @ref cursor_object
Camilla Berglund7e9e3212016-09-14 20:17:26 +02003319 * @sa @ref glfwDestroyCursor
3320 * @sa @ref glfwCreateStandardCursor
Camilla Berglund4591ad22014-09-18 15:03:29 +02003321 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003322 * @since Added in version 3.1.
urraka40c04a72013-12-04 10:19:22 -03003323 *
3324 * @ingroup input
3325 */
Camilla Berglund8fa9cc02014-02-23 16:43:17 +01003326GLFWAPI GLFWcursor* glfwCreateCursor(const GLFWimage* image, int xhot, int yhot);
urraka40c04a72013-12-04 10:19:22 -03003327
Camilla Berglund2a1375e2014-09-02 16:52:16 +02003328/*! @brief Creates a cursor with a standard shape.
3329 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003330 * Returns a cursor with a [standard shape](@ref shapes), that can be set for
3331 * a window with @ref glfwSetCursor.
Camilla Berglund2a1375e2014-09-02 16:52:16 +02003332 *
3333 * @param[in] shape One of the [standard shapes](@ref shapes).
Camilla Berglund2a1375e2014-09-02 16:52:16 +02003334 * @return A new cursor ready to use or `NULL` if an
3335 * [error](@ref error_handling) occurred.
3336 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003337 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
3338 * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR.
3339 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003340 * @reentrancy This function must not be called from a callback.
Camilla Berglund2a1375e2014-09-02 16:52:16 +02003341 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003342 * @thread_safety This function must only be called from the main thread.
Camilla Berglund2a1375e2014-09-02 16:52:16 +02003343 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003344 * @sa @ref cursor_object
Camilla Berglund7e9e3212016-09-14 20:17:26 +02003345 * @sa @ref glfwCreateCursor
Camilla Berglund2a1375e2014-09-02 16:52:16 +02003346 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003347 * @since Added in version 3.1.
Camilla Berglund2a1375e2014-09-02 16:52:16 +02003348 *
3349 * @ingroup input
3350 */
3351GLFWAPI GLFWcursor* glfwCreateStandardCursor(int shape);
3352
urraka40c04a72013-12-04 10:19:22 -03003353/*! @brief Destroys a cursor.
3354 *
Camilla Berglunde8e05d42014-04-23 13:30:11 +02003355 * This function destroys a cursor previously created with @ref
3356 * glfwCreateCursor. Any remaining cursors will be destroyed by @ref
3357 * glfwTerminate.
urraka40c04a72013-12-04 10:19:22 -03003358 *
Camilla Berglunde8e05d42014-04-23 13:30:11 +02003359 * @param[in] cursor The cursor object to destroy.
urraka40c04a72013-12-04 10:19:22 -03003360 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003361 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
3362 * GLFW_PLATFORM_ERROR.
3363 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003364 * @reentrancy This function must not be called from a callback.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003365 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003366 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003367 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003368 * @sa @ref cursor_object
Camilla Berglund7e9e3212016-09-14 20:17:26 +02003369 * @sa @ref glfwCreateCursor
Camilla Berglund4591ad22014-09-18 15:03:29 +02003370 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003371 * @since Added in version 3.1.
urraka40c04a72013-12-04 10:19:22 -03003372 *
3373 * @ingroup input
3374 */
3375GLFWAPI void glfwDestroyCursor(GLFWcursor* cursor);
3376
Camilla Berglund4188c262015-01-18 01:55:25 +01003377/*! @brief Sets the cursor for the window.
urraka40c04a72013-12-04 10:19:22 -03003378 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003379 * This function sets the cursor image to be used when the cursor is over the
3380 * client area of the specified window. The set cursor will only be visible
3381 * when the [cursor mode](@ref cursor_mode) of the window is
3382 * `GLFW_CURSOR_NORMAL`.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003383 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003384 * On some platforms, the set cursor may not be visible unless the window also
3385 * has input focus.
3386 *
3387 * @param[in] window The window to set the cursor for.
3388 * @param[in] cursor The cursor to set, or `NULL` to switch back to the default
3389 * arrow cursor.
urraka40c04a72013-12-04 10:19:22 -03003390 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003391 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
3392 * GLFW_PLATFORM_ERROR.
3393 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003394 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003395 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003396 * @sa @ref cursor_object
Camilla Berglund4591ad22014-09-18 15:03:29 +02003397 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003398 * @since Added in version 3.1.
Camilla Berglund0e205772014-03-24 11:58:35 +01003399 *
urraka40c04a72013-12-04 10:19:22 -03003400 * @ingroup input
3401 */
3402GLFWAPI void glfwSetCursor(GLFWwindow* window, GLFWcursor* cursor);
3403
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003404/*! @brief Sets the key callback.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003405 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003406 * This function sets the key callback of the specified window, which is called
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003407 * when a key is pressed, repeated or released.
3408 *
Camilla Berglund948cc042013-04-16 02:02:22 +02003409 * The key functions deal with physical keys, with layout independent
3410 * [key tokens](@ref keys) named after their values in the standard US keyboard
Camilla Berglund5fd409b2013-06-05 17:53:13 +02003411 * layout. If you want to input text, use the
3412 * [character callback](@ref glfwSetCharCallback) instead.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003413 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003414 * When a window loses input focus, it will generate synthetic key release
3415 * events for all pressed keys. You can tell these events from user-generated
3416 * events by the fact that the synthetic ones are generated after the focus
3417 * loss event has been processed, i.e. after the
3418 * [window focus callback](@ref glfwSetWindowFocusCallback) has been called.
Camilla Berglund4538a522013-04-24 19:49:46 +02003419 *
Camilla Berglund11615fc2013-05-30 17:19:12 +02003420 * The scancode of a key is specific to that platform or sometimes even to that
3421 * machine. Scancodes are intended to allow users to bind keys that don't have
3422 * a GLFW key token. Such keys have `key` set to `GLFW_KEY_UNKNOWN`, their
Camilla Berglund4591ad22014-09-18 15:03:29 +02003423 * state is not saved and so it cannot be queried with @ref glfwGetKey.
Camilla Berglund11615fc2013-05-30 17:19:12 +02003424 *
3425 * Sometimes GLFW needs to generate synthetic key events, in which case the
3426 * scancode may be zero.
3427 *
Camilla Berglund9492fc52013-01-17 17:51:12 +01003428 * @param[in] window The window whose callback to set.
Camilla Berglund71d2b572013-03-12 15:33:05 +01003429 * @param[in] cbfun The new key callback, or `NULL` to remove the currently
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003430 * set callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02003431 * @return The previously set callback, or `NULL` if no callback was set or the
3432 * library had not been [initialized](@ref intro_init).
Camilla Berglund11a27de2013-04-08 21:21:21 +02003433 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003434 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
3435 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003436 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003437 *
3438 * @sa @ref input_key
3439 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003440 * @since Added in version 1.0.
3441 * @glfw3 Added window handle parameter and return value.
Camilla Berglund0e205772014-03-24 11:58:35 +01003442 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003443 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003444 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02003445GLFWAPI GLFWkeyfun glfwSetKeyCallback(GLFWwindow* window, GLFWkeyfun cbfun);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003446
3447/*! @brief Sets the Unicode character callback.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003448 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003449 * This function sets the character callback of the specified window, which is
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003450 * called when a Unicode character is input.
3451 *
Camilla Berglund96b12ee2014-06-12 23:04:20 +02003452 * The character callback is intended for Unicode text input. As it deals with
3453 * characters, it is keyboard layout dependent, whereas the
3454 * [key callback](@ref glfwSetKeyCallback) is not. Characters do not map 1:1
3455 * to physical keys, as a key may produce zero, one or more characters. If you
3456 * want to know whether a specific physical key was pressed or released, see
3457 * the key callback instead.
3458 *
3459 * The character callback behaves as system text input normally does and will
3460 * not be called if modifier keys are held down that would prevent normal text
Camilla Berglund8d6f2652016-10-20 00:50:54 +02003461 * input on that platform, for example a Super (Command) key on macOS or Alt key
Camilla Berglund96b12ee2014-06-12 23:04:20 +02003462 * on Windows. There is a
3463 * [character with modifiers callback](@ref glfwSetCharModsCallback) that
3464 * receives these events.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003465 *
Camilla Berglund9492fc52013-01-17 17:51:12 +01003466 * @param[in] window The window whose callback to set.
Camilla Berglund71d2b572013-03-12 15:33:05 +01003467 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
Camilla Berglunddba2d802013-01-17 23:06:56 +01003468 * callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02003469 * @return The previously set callback, or `NULL` if no callback was set or the
3470 * library had not been [initialized](@ref intro_init).
Camilla Berglund11a27de2013-04-08 21:21:21 +02003471 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003472 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
3473 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003474 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003475 *
3476 * @sa @ref input_char
3477 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003478 * @since Added in version 2.4.
3479 * @glfw3 Added window handle parameter and return value.
Camilla Berglund0e205772014-03-24 11:58:35 +01003480 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003481 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003482 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02003483GLFWAPI GLFWcharfun glfwSetCharCallback(GLFWwindow* window, GLFWcharfun cbfun);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003484
Camilla Berglund96b12ee2014-06-12 23:04:20 +02003485/*! @brief Sets the Unicode character with modifiers callback.
3486 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003487 * This function sets the character with modifiers callback of the specified
Camilla Berglund96b12ee2014-06-12 23:04:20 +02003488 * window, which is called when a Unicode character is input regardless of what
3489 * modifier keys are used.
3490 *
3491 * The character with modifiers callback is intended for implementing custom
3492 * Unicode character input. For regular Unicode text input, see the
3493 * [character callback](@ref glfwSetCharCallback). Like the character
3494 * callback, the character with modifiers callback deals with characters and is
3495 * keyboard layout dependent. Characters do not map 1:1 to physical keys, as
3496 * a key may produce zero, one or more characters. If you want to know whether
3497 * a specific physical key was pressed or released, see the
3498 * [key callback](@ref glfwSetKeyCallback) instead.
3499 *
3500 * @param[in] window The window whose callback to set.
3501 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
3502 * callback.
3503 * @return The previously set callback, or `NULL` if no callback was set or an
Camilla Berglund999f3552016-08-17 16:48:22 +02003504 * [error](@ref error_handling) occurred.
Camilla Berglund96b12ee2014-06-12 23:04:20 +02003505 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003506 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
3507 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003508 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003509 *
3510 * @sa @ref input_char
3511 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003512 * @since Added in version 3.1.
Camilla Berglund96b12ee2014-06-12 23:04:20 +02003513 *
3514 * @ingroup input
3515 */
3516GLFWAPI GLFWcharmodsfun glfwSetCharModsCallback(GLFWwindow* window, GLFWcharmodsfun cbfun);
3517
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003518/*! @brief Sets the mouse button callback.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003519 *
3520 * This function sets the mouse button callback of the specified window, which
3521 * is called when a mouse button is pressed or released.
3522 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003523 * When a window loses input focus, it will generate synthetic mouse button
3524 * release events for all pressed mouse buttons. You can tell these events
3525 * from user-generated events by the fact that the synthetic ones are generated
3526 * after the focus loss event has been processed, i.e. after the
3527 * [window focus callback](@ref glfwSetWindowFocusCallback) has been called.
Camilla Berglund4538a522013-04-24 19:49:46 +02003528 *
Camilla Berglund9492fc52013-01-17 17:51:12 +01003529 * @param[in] window The window whose callback to set.
Camilla Berglund71d2b572013-03-12 15:33:05 +01003530 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
Camilla Berglunddba2d802013-01-17 23:06:56 +01003531 * callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02003532 * @return The previously set callback, or `NULL` if no callback was set or the
3533 * library had not been [initialized](@ref intro_init).
Camilla Berglund11a27de2013-04-08 21:21:21 +02003534 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003535 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
3536 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003537 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003538 *
3539 * @sa @ref input_mouse_button
3540 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003541 * @since Added in version 1.0.
3542 * @glfw3 Added window handle parameter and return value.
Camilla Berglund0e205772014-03-24 11:58:35 +01003543 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003544 * @ingroup input
3545 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02003546GLFWAPI GLFWmousebuttonfun glfwSetMouseButtonCallback(GLFWwindow* window, GLFWmousebuttonfun cbfun);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003547
3548/*! @brief Sets the cursor position callback.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003549 *
3550 * This function sets the cursor position callback of the specified window,
3551 * which is called when the cursor is moved. The callback is provided with the
Camilla Berglund6d9d8562013-09-28 22:12:50 +02003552 * position, in screen coordinates, relative to the upper-left corner of the
3553 * client area of the window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003554 *
Camilla Berglund9492fc52013-01-17 17:51:12 +01003555 * @param[in] window The window whose callback to set.
Camilla Berglund71d2b572013-03-12 15:33:05 +01003556 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
Camilla Berglunddba2d802013-01-17 23:06:56 +01003557 * callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02003558 * @return The previously set callback, or `NULL` if no callback was set or the
3559 * library had not been [initialized](@ref intro_init).
Camilla Berglund11a27de2013-04-08 21:21:21 +02003560 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003561 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
3562 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003563 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003564 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003565 * @sa @ref cursor_pos
Camilla Berglund4591ad22014-09-18 15:03:29 +02003566 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003567 * @since Added in version 3.0. Replaces `glfwSetMousePosCallback`.
Camilla Berglund0e205772014-03-24 11:58:35 +01003568 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003569 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003570 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02003571GLFWAPI GLFWcursorposfun glfwSetCursorPosCallback(GLFWwindow* window, GLFWcursorposfun cbfun);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003572
3573/*! @brief Sets the cursor enter/exit callback.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003574 *
3575 * This function sets the cursor boundary crossing callback of the specified
3576 * window, which is called when the cursor enters or leaves the client area of
3577 * the window.
3578 *
Camilla Berglund9492fc52013-01-17 17:51:12 +01003579 * @param[in] window The window whose callback to set.
Camilla Berglund71d2b572013-03-12 15:33:05 +01003580 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
Camilla Berglunddba2d802013-01-17 23:06:56 +01003581 * callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02003582 * @return The previously set callback, or `NULL` if no callback was set or the
3583 * library had not been [initialized](@ref intro_init).
Camilla Berglund11a27de2013-04-08 21:21:21 +02003584 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003585 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
3586 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003587 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003588 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003589 * @sa @ref cursor_enter
Camilla Berglund4591ad22014-09-18 15:03:29 +02003590 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003591 * @since Added in version 3.0.
Camilla Berglund0e205772014-03-24 11:58:35 +01003592 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003593 * @ingroup input
3594 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02003595GLFWAPI GLFWcursorenterfun glfwSetCursorEnterCallback(GLFWwindow* window, GLFWcursorenterfun cbfun);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003596
3597/*! @brief Sets the scroll callback.
Camilla Berglunde248fb62013-03-29 14:06:23 +01003598 *
3599 * This function sets the scroll callback of the specified window, which is
3600 * called when a scrolling device is used, such as a mouse wheel or scrolling
3601 * area of a touchpad.
3602 *
Camilla Berglund5fd409b2013-06-05 17:53:13 +02003603 * The scroll callback receives all scrolling input, like that from a mouse
3604 * wheel or a touchpad scrolling area.
3605 *
Camilla Berglund9492fc52013-01-17 17:51:12 +01003606 * @param[in] window The window whose callback to set.
Camilla Berglund71d2b572013-03-12 15:33:05 +01003607 * @param[in] cbfun The new scroll callback, or `NULL` to remove the currently
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003608 * set callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02003609 * @return The previously set callback, or `NULL` if no callback was set or the
3610 * library had not been [initialized](@ref intro_init).
Camilla Berglund11a27de2013-04-08 21:21:21 +02003611 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003612 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
3613 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003614 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003615 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003616 * @sa @ref scrolling
Camilla Berglund4591ad22014-09-18 15:03:29 +02003617 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003618 * @since Added in version 3.0. Replaces `glfwSetMouseWheelCallback`.
Camilla Berglund0e205772014-03-24 11:58:35 +01003619 *
Camilla Berglunde248fb62013-03-29 14:06:23 +01003620 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003621 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02003622GLFWAPI GLFWscrollfun glfwSetScrollCallback(GLFWwindow* window, GLFWscrollfun cbfun);
Camilla Berglund3249f812010-09-07 17:34:51 +02003623
Camilla Berglund5c8121e2014-03-29 21:35:21 +01003624/*! @brief Sets the file drop callback.
arturo89d07232013-07-10 11:42:14 +02003625 *
Camilla Berglund5c8121e2014-03-29 21:35:21 +01003626 * This function sets the file drop callback of the specified window, which is
3627 * called when one or more dragged files are dropped on the window.
arturo89d07232013-07-10 11:42:14 +02003628 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003629 * Because the path array and its strings may have been generated specifically
3630 * for that event, they are not guaranteed to be valid after the callback has
3631 * returned. If you wish to use them after the callback returns, you need to
3632 * make a deep copy.
arturo89d07232013-07-10 11:42:14 +02003633 *
3634 * @param[in] window The window whose callback to set.
Camilla Berglund5c8121e2014-03-29 21:35:21 +01003635 * @param[in] cbfun The new file drop callback, or `NULL` to remove the
3636 * currently set callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02003637 * @return The previously set callback, or `NULL` if no callback was set or the
3638 * library had not been [initialized](@ref intro_init).
arturo89d07232013-07-10 11:42:14 +02003639 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003640 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
3641 *
linkmauvebc8b0482016-10-16 15:52:39 +01003642 * @remark @wayland File drop is currently unimplemented.
3643 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003644 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003645 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003646 * @sa @ref path_drop
Camilla Berglund4591ad22014-09-18 15:03:29 +02003647 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003648 * @since Added in version 3.1.
Camilla Berglund0e205772014-03-24 11:58:35 +01003649 *
arturo89d07232013-07-10 11:42:14 +02003650 * @ingroup input
3651 */
3652GLFWAPI GLFWdropfun glfwSetDropCallback(GLFWwindow* window, GLFWdropfun cbfun);
3653
Camilla Berglundfdd45182013-05-27 15:13:09 +02003654/*! @brief Returns whether the specified joystick is present.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003655 *
Camilla Berglundfdd45182013-05-27 15:13:09 +02003656 * This function returns whether the specified joystick is present.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003657 *
Camilla Berglundefc6b352016-10-10 03:24:07 +02003658 * @param[in] jid The [joystick](@ref joysticks) to query.
Camilla Berglund0eccf752015-08-23 19:30:04 +02003659 * @return `GLFW_TRUE` if the joystick is present, or `GLFW_FALSE` otherwise.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003660 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003661 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
3662 * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR.
3663 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003664 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003665 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003666 * @sa @ref joystick
Camilla Berglund4591ad22014-09-18 15:03:29 +02003667 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003668 * @since Added in version 3.0. Replaces `glfwGetJoystickParam`.
Camilla Berglund0e205772014-03-24 11:58:35 +01003669 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003670 * @ingroup input
3671 */
Camilla Berglundefc6b352016-10-10 03:24:07 +02003672GLFWAPI int glfwJoystickPresent(int jid);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003673
Camilla Berglund7f2eb7b2013-04-24 19:25:42 +02003674/*! @brief Returns the values of all axes of the specified joystick.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02003675 *
3676 * This function returns the values of all axes of the specified joystick.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003677 * Each element in the array is a value between -1.0 and 1.0.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02003678 *
Camilla Berglund386b6032016-02-10 13:48:49 +01003679 * Querying a joystick slot with no device present is not an error, but will
3680 * cause this function to return `NULL`. Call @ref glfwJoystickPresent to
3681 * check device presence.
3682 *
Camilla Berglundefc6b352016-10-10 03:24:07 +02003683 * @param[in] jid The [joystick](@ref joysticks) to query.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003684 * @param[out] count Where to store the number of axis values in the returned
Camilla Berglund999f3552016-08-17 16:48:22 +02003685 * array. This is set to zero if the joystick is not present or an error
3686 * occurred.
3687 * @return An array of axis values, or `NULL` if the joystick is not present or
3688 * an [error](@ref error_handling) occurred.
Camilla Berglund7f2eb7b2013-04-24 19:25:42 +02003689 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003690 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
3691 * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR.
3692 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003693 * @pointer_lifetime The returned array is allocated and freed by GLFW. You
3694 * should not free it yourself. It is valid until the specified joystick is
3695 * disconnected, this function is called again for that joystick or the library
3696 * is terminated.
Camilla Berglund0e205772014-03-24 11:58:35 +01003697 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003698 * @thread_safety This function must only be called from the main thread.
Camilla Berglundc3bb5c92013-06-05 16:04:04 +02003699 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003700 * @sa @ref joystick_axis
Camilla Berglund4591ad22014-09-18 15:03:29 +02003701 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003702 * @since Added in version 3.0. Replaces `glfwGetJoystickPos`.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003703 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003704 * @ingroup input
3705 */
Camilla Berglundefc6b352016-10-10 03:24:07 +02003706GLFWAPI const float* glfwGetJoystickAxes(int jid, int* count);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003707
Camilla Berglunde93bade2013-06-16 02:33:33 +02003708/*! @brief Returns the state of all buttons of the specified joystick.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02003709 *
Camilla Berglunde93bade2013-06-16 02:33:33 +02003710 * This function returns the state of all buttons of the specified joystick.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003711 * Each element in the array is either `GLFW_PRESS` or `GLFW_RELEASE`.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02003712 *
Camilla Berglund386b6032016-02-10 13:48:49 +01003713 * Querying a joystick slot with no device present is not an error, but will
3714 * cause this function to return `NULL`. Call @ref glfwJoystickPresent to
3715 * check device presence.
3716 *
Camilla Berglundefc6b352016-10-10 03:24:07 +02003717 * @param[in] jid The [joystick](@ref joysticks) to query.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003718 * @param[out] count Where to store the number of button states in the returned
Camilla Berglund999f3552016-08-17 16:48:22 +02003719 * array. This is set to zero if the joystick is not present or an error
3720 * occurred.
3721 * @return An array of button states, or `NULL` if the joystick is not present
3722 * or an [error](@ref error_handling) occurred.
Camilla Berglund7f2eb7b2013-04-24 19:25:42 +02003723 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003724 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
3725 * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR.
3726 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003727 * @pointer_lifetime The returned array is allocated and freed by GLFW. You
3728 * should not free it yourself. It is valid until the specified joystick is
3729 * disconnected, this function is called again for that joystick or the library
3730 * is terminated.
Camilla Berglund0e205772014-03-24 11:58:35 +01003731 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003732 * @thread_safety This function must only be called from the main thread.
Camilla Berglundc3bb5c92013-06-05 16:04:04 +02003733 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003734 * @sa @ref joystick_button
Camilla Berglund4591ad22014-09-18 15:03:29 +02003735 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003736 * @since Added in version 2.2.
Camilla Berglund951a9582016-01-31 21:32:14 +01003737 * @glfw3 Changed to return a dynamic array.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003738 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003739 * @ingroup input
3740 */
Camilla Berglundefc6b352016-10-10 03:24:07 +02003741GLFWAPI const unsigned char* glfwGetJoystickButtons(int jid, int* count);
Camilla Berglund3249f812010-09-07 17:34:51 +02003742
Camilla Berglund7d9b5c02012-12-02 16:55:09 +01003743/*! @brief Returns the name of the specified joystick.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003744 *
3745 * This function returns the name, encoded as UTF-8, of the specified joystick.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003746 * The returned string is allocated and freed by GLFW. You should not free it
3747 * yourself.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003748 *
Camilla Berglund386b6032016-02-10 13:48:49 +01003749 * Querying a joystick slot with no device present is not an error, but will
3750 * cause this function to return `NULL`. Call @ref glfwJoystickPresent to
3751 * check device presence.
3752 *
Camilla Berglundefc6b352016-10-10 03:24:07 +02003753 * @param[in] jid The [joystick](@ref joysticks) to query.
Camilla Berglund71d2b572013-03-12 15:33:05 +01003754 * @return The UTF-8 encoded name of the joystick, or `NULL` if the joystick
Camilla Berglund999f3552016-08-17 16:48:22 +02003755 * is not present or an [error](@ref error_handling) occurred.
Camilla Berglundd4a08b12012-12-02 17:13:41 +01003756 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003757 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
3758 * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR.
3759 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003760 * @pointer_lifetime The returned string is allocated and freed by GLFW. You
3761 * should not free it yourself. It is valid until the specified joystick is
3762 * disconnected, this function is called again for that joystick or the library
3763 * is terminated.
Camilla Berglund0e205772014-03-24 11:58:35 +01003764 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003765 * @thread_safety This function must only be called from the main thread.
Camilla Berglundc3bb5c92013-06-05 16:04:04 +02003766 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003767 * @sa @ref joystick_name
Camilla Berglund4591ad22014-09-18 15:03:29 +02003768 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003769 * @since Added in version 3.0.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003770 *
3771 * @ingroup input
Camilla Berglund7d9b5c02012-12-02 16:55:09 +01003772 */
Camilla Berglundefc6b352016-10-10 03:24:07 +02003773GLFWAPI const char* glfwGetJoystickName(int jid);
Camilla Berglund3249f812010-09-07 17:34:51 +02003774
Camilla Berglund8a7fa302015-12-13 17:38:50 +01003775/*! @brief Sets the joystick configuration callback.
3776 *
3777 * This function sets the joystick configuration callback, or removes the
3778 * currently set callback. This is called when a joystick is connected to or
3779 * disconnected from the system.
3780 *
3781 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
3782 * callback.
3783 * @return The previously set callback, or `NULL` if no callback was set or the
3784 * library had not been [initialized](@ref intro_init).
3785 *
3786 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
3787 *
3788 * @thread_safety This function must only be called from the main thread.
3789 *
3790 * @sa @ref joystick_event
3791 *
3792 * @since Added in version 3.2.
3793 *
3794 * @ingroup input
3795 */
3796GLFWAPI GLFWjoystickfun glfwSetJoystickCallback(GLFWjoystickfun cbfun);
3797
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003798/*! @brief Sets the clipboard to the specified string.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003799 *
3800 * This function sets the system clipboard to the specified, UTF-8 encoded
Camilla Berglund4591ad22014-09-18 15:03:29 +02003801 * string.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003802 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003803 * @param[in] window The window that will own the clipboard contents.
3804 * @param[in] string A UTF-8 encoded string.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003805 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003806 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
3807 * GLFW_PLATFORM_ERROR.
3808 *
linkmauvebc8b0482016-10-16 15:52:39 +01003809 * @remark @wayland Clipboard is currently unimplemented.
3810 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003811 * @pointer_lifetime The specified string is copied before this function
3812 * returns.
Camilla Berglunda3ff29a2012-12-02 15:47:10 +01003813 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003814 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003815 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003816 * @sa @ref clipboard
Camilla Berglund7e9e3212016-09-14 20:17:26 +02003817 * @sa @ref glfwGetClipboardString
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003818 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003819 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003820 *
Camilla Berglund8d170c72014-09-09 16:26:57 +02003821 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003822 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01003823GLFWAPI void glfwSetClipboardString(GLFWwindow* window, const char* string);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003824
Camilla Berglund4591ad22014-09-18 15:03:29 +02003825/*! @brief Returns the contents of the clipboard as a string.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003826 *
3827 * This function returns the contents of the system clipboard, if it contains
Camilla Berglundcf9079c2015-09-16 18:51:49 +02003828 * or is convertible to a UTF-8 encoded string. If the clipboard is empty or
Camilla Berglund0b650532015-09-16 16:27:28 +02003829 * if its contents cannot be converted, `NULL` is returned and a @ref
3830 * GLFW_FORMAT_UNAVAILABLE error is generated.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003831 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003832 * @param[in] window The window that will request the clipboard contents.
Camilla Berglund71d2b572013-03-12 15:33:05 +01003833 * @return The contents of the clipboard as a UTF-8 encoded string, or `NULL`
Camilla Berglund4591ad22014-09-18 15:03:29 +02003834 * if an [error](@ref error_handling) occurred.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003835 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003836 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
3837 * GLFW_PLATFORM_ERROR.
3838 *
linkmauvebc8b0482016-10-16 15:52:39 +01003839 * @remark @wayland Clipboard is currently unimplemented.
3840 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003841 * @pointer_lifetime The returned string is allocated and freed by GLFW. You
3842 * should not free it yourself. It is valid until the next call to @ref
Camilla Berglund6be821c2014-10-06 23:18:33 +02003843 * glfwGetClipboardString or @ref glfwSetClipboardString, or until the library
3844 * is terminated.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003845 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003846 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003847 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003848 * @sa @ref clipboard
Camilla Berglund7e9e3212016-09-14 20:17:26 +02003849 * @sa @ref glfwSetClipboardString
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003850 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003851 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003852 *
Camilla Berglund8d170c72014-09-09 16:26:57 +02003853 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003854 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01003855GLFWAPI const char* glfwGetClipboardString(GLFWwindow* window);
Ralph Eastwood31c91542011-09-21 10:09:47 +01003856
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003857/*! @brief Returns the value of the GLFW timer.
3858 *
3859 * This function returns the value of the GLFW timer. Unless the timer has
3860 * been set using @ref glfwSetTime, the timer measures time elapsed since GLFW
3861 * was initialized.
3862 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003863 * The resolution of the timer is system dependent, but is usually on the order
3864 * of a few micro- or nanoseconds. It uses the highest-resolution monotonic
3865 * time source on each supported platform.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003866 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003867 * @return The current value, in seconds, or zero if an
3868 * [error](@ref error_handling) occurred.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003869 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003870 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
3871 *
Camilla Berglund20bce152016-05-30 16:04:37 +02003872 * @thread_safety This function may be called from any thread. Reading and
3873 * writing of the internal timer offset is not atomic, so it needs to be
3874 * externally synchronized with calls to @ref glfwSetTime.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003875 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003876 * @sa @ref time
Camilla Berglund4591ad22014-09-18 15:03:29 +02003877 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003878 * @since Added in version 1.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003879 *
3880 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003881 */
Camilla Berglund9a716692010-09-08 16:40:43 +02003882GLFWAPI double glfwGetTime(void);
Camilla Berglund3249f812010-09-07 17:34:51 +02003883
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003884/*! @brief Sets the GLFW timer.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003885 *
3886 * This function sets the value of the GLFW timer. It then continues to count
Camilla Berglund6e20cda2015-03-10 12:01:38 +01003887 * up from that value. The value must be a positive finite number less than
3888 * or equal to 18446744073.0, which is approximately 584.5 years.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003889 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003890 * @param[in] time The new value, in seconds.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003891 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003892 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
3893 * GLFW_INVALID_VALUE.
3894 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003895 * @remark The upper limit of the timer is calculated as
Camilla Berglund6e20cda2015-03-10 12:01:38 +01003896 * floor((2<sup>64</sup> - 1) / 10<sup>9</sup>) and is due to implementations
3897 * storing nanoseconds in 64 bits. The limit may be increased in the future.
3898 *
Camilla Berglund20bce152016-05-30 16:04:37 +02003899 * @thread_safety This function may be called from any thread. Reading and
3900 * writing of the internal timer offset is not atomic, so it needs to be
3901 * externally synchronized with calls to @ref glfwGetTime.
Camilla Berglund0e205772014-03-24 11:58:35 +01003902 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003903 * @sa @ref time
Camilla Berglunde248fb62013-03-29 14:06:23 +01003904 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003905 * @since Added in version 2.2.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003906 *
3907 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003908 */
3909GLFWAPI void glfwSetTime(double time);
3910
Camilla Berglund31f67dd2016-03-06 11:38:55 +01003911/*! @brief Returns the current value of the raw timer.
3912 *
Camilla Berglund337c77a2016-03-06 14:11:14 +01003913 * This function returns the current value of the raw timer, measured in
3914 * 1&nbsp;/&nbsp;frequency seconds. To get the frequency, call @ref
3915 * glfwGetTimerFrequency.
Camilla Berglund31f67dd2016-03-06 11:38:55 +01003916 *
3917 * @return The value of the timer, or zero if an
3918 * [error](@ref error_handling) occurred.
3919 *
Camilla Berglund46fce402016-03-07 13:35:37 +01003920 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
Camilla Berglund31f67dd2016-03-06 11:38:55 +01003921 *
3922 * @thread_safety This function may be called from any thread.
3923 *
3924 * @sa @ref time
Camilla Berglund7e9e3212016-09-14 20:17:26 +02003925 * @sa @ref glfwGetTimerFrequency
Camilla Berglund31f67dd2016-03-06 11:38:55 +01003926 *
3927 * @since Added in version 3.2.
3928 *
3929 * @ingroup input
3930 */
Camilla Berglund5661d032016-03-23 10:09:07 +01003931GLFWAPI uint64_t glfwGetTimerValue(void);
Camilla Berglund31f67dd2016-03-06 11:38:55 +01003932
3933/*! @brief Returns the frequency, in Hz, of the raw timer.
3934 *
Camilla Berglunddefaea32016-03-07 13:36:54 +01003935 * This function returns the frequency, in Hz, of the raw timer.
3936 *
Camilla Berglund31f67dd2016-03-06 11:38:55 +01003937 * @return The frequency of the timer, in Hz, or zero if an
3938 * [error](@ref error_handling) occurred.
3939 *
Camilla Berglund46fce402016-03-07 13:35:37 +01003940 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
Camilla Berglund31f67dd2016-03-06 11:38:55 +01003941 *
3942 * @thread_safety This function may be called from any thread.
3943 *
3944 * @sa @ref time
Camilla Berglund7e9e3212016-09-14 20:17:26 +02003945 * @sa @ref glfwGetTimerValue
Camilla Berglund31f67dd2016-03-06 11:38:55 +01003946 *
3947 * @since Added in version 3.2.
3948 *
3949 * @ingroup input
3950 */
Camilla Berglund5661d032016-03-23 10:09:07 +01003951GLFWAPI uint64_t glfwGetTimerFrequency(void);
Camilla Berglund31f67dd2016-03-06 11:38:55 +01003952
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003953/*! @brief Makes the context of the specified window current for the calling
3954 * thread.
3955 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003956 * This function makes the OpenGL or OpenGL ES context of the specified window
3957 * current on the calling thread. A context can only be made current on
3958 * a single thread at a time and each thread can have only a single current
3959 * context at a time.
3960 *
3961 * By default, making a context non-current implicitly forces a pipeline flush.
3962 * On machines that support `GL_KHR_context_flush_control`, you can control
3963 * whether a context performs this flush by setting the
Camilla Berglundce8f97c2015-01-11 23:33:14 +01003964 * [GLFW_CONTEXT_RELEASE_BEHAVIOR](@ref window_hints_ctx) window hint.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003965 *
Camilla Berglund98b478f2015-11-05 13:44:15 +01003966 * The specified window must have an OpenGL or OpenGL ES context. Specifying
3967 * a window without a context will generate a @ref GLFW_NO_WINDOW_CONTEXT
3968 * error.
3969 *
Camilla Berglund71d2b572013-03-12 15:33:05 +01003970 * @param[in] window The window whose context to make current, or `NULL` to
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003971 * detach the current context.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003972 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003973 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
3974 * GLFW_NO_WINDOW_CONTEXT and @ref GLFW_PLATFORM_ERROR.
3975 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003976 * @thread_safety This function may be called from any thread.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003977 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003978 * @sa @ref context_current
Camilla Berglund7e9e3212016-09-14 20:17:26 +02003979 * @sa @ref glfwGetCurrentContext
Camilla Berglunde248fb62013-03-29 14:06:23 +01003980 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003981 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003982 *
Camilla Berglunde248fb62013-03-29 14:06:23 +01003983 * @ingroup context
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003984 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01003985GLFWAPI void glfwMakeContextCurrent(GLFWwindow* window);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003986
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003987/*! @brief Returns the window whose context is current on the calling thread.
3988 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003989 * This function returns the window whose OpenGL or OpenGL ES context is
3990 * current on the calling thread.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003991 *
Camilla Berglund71d2b572013-03-12 15:33:05 +01003992 * @return The window whose context is current, or `NULL` if no window's
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003993 * context is current.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003994 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003995 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
3996 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003997 * @thread_safety This function may be called from any thread.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003998 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003999 * @sa @ref context_current
Camilla Berglund7e9e3212016-09-14 20:17:26 +02004000 * @sa @ref glfwMakeContextCurrent
Camilla Berglunde248fb62013-03-29 14:06:23 +01004001 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01004002 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02004003 *
Camilla Berglunde248fb62013-03-29 14:06:23 +01004004 * @ingroup context
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004005 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01004006GLFWAPI GLFWwindow* glfwGetCurrentContext(void);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004007
4008/*! @brief Swaps the front and back buffers of the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004009 *
Camilla Berglund001c50c2016-02-19 09:13:56 +01004010 * This function swaps the front and back buffers of the specified window when
4011 * rendering with OpenGL or OpenGL ES. If the swap interval is greater than
4012 * zero, the GPU driver waits the specified number of screen updates before
4013 * swapping the buffers.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004014 *
Camilla Berglund98b478f2015-11-05 13:44:15 +01004015 * The specified window must have an OpenGL or OpenGL ES context. Specifying
4016 * a window without a context will generate a @ref GLFW_NO_WINDOW_CONTEXT
4017 * error.
4018 *
Camilla Berglund001c50c2016-02-19 09:13:56 +01004019 * This function does not apply to Vulkan. If you are rendering with Vulkan,
4020 * see `vkQueuePresentKHR` instead.
4021 *
Camilla Berglund9492fc52013-01-17 17:51:12 +01004022 * @param[in] window The window whose buffers to swap.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004023 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01004024 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
4025 * GLFW_NO_WINDOW_CONTEXT and @ref GLFW_PLATFORM_ERROR.
4026 *
Camilla Berglund951a9582016-01-31 21:32:14 +01004027 * @remark __EGL:__ The context of the specified window must be current on the
Camilla Berglund276b1bc2016-01-31 19:17:18 +01004028 * calling thread.
4029 *
Camilla Berglund951a9582016-01-31 21:32:14 +01004030 * @thread_safety This function may be called from any thread.
Camilla Berglund401033c2013-03-12 19:17:07 +01004031 *
Camilla Berglund4188c262015-01-18 01:55:25 +01004032 * @sa @ref buffer_swap
Camilla Berglund7e9e3212016-09-14 20:17:26 +02004033 * @sa @ref glfwSwapInterval
Camilla Berglunde248fb62013-03-29 14:06:23 +01004034 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01004035 * @since Added in version 1.0.
Camilla Berglund951a9582016-01-31 21:32:14 +01004036 * @glfw3 Added window handle parameter.
Camilla Berglund4591ad22014-09-18 15:03:29 +02004037 *
4038 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004039 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01004040GLFWAPI void glfwSwapBuffers(GLFWwindow* window);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004041
4042/*! @brief Sets the swap interval for the current context.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004043 *
Camilla Berglund001c50c2016-02-19 09:13:56 +01004044 * This function sets the swap interval for the current OpenGL or OpenGL ES
4045 * context, i.e. the number of screen updates to wait from the time @ref
4046 * glfwSwapBuffers was called before swapping the buffers and returning. This
4047 * is sometimes called _vertical synchronization_, _vertical retrace
4048 * synchronization_ or just _vsync_.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004049 *
Camilla Berglund5fd409b2013-06-05 17:53:13 +02004050 * Contexts that support either of the `WGL_EXT_swap_control_tear` and
Camilla Berglund8282a8f2013-04-10 23:01:12 +02004051 * `GLX_EXT_swap_control_tear` extensions also accept negative swap intervals,
4052 * which allow the driver to swap even if a frame arrives a little bit late.
4053 * You can check for the presence of these extensions using @ref
4054 * glfwExtensionSupported. For more information about swap tearing, see the
4055 * extension specifications.
4056 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02004057 * A context must be current on the calling thread. Calling this function
Camilla Berglundce8f97c2015-01-11 23:33:14 +01004058 * without a current context will cause a @ref GLFW_NO_CURRENT_CONTEXT error.
Camilla Berglund4591ad22014-09-18 15:03:29 +02004059 *
Camilla Berglund001c50c2016-02-19 09:13:56 +01004060 * This function does not apply to Vulkan. If you are rendering with Vulkan,
4061 * see the present mode of your swapchain instead.
4062 *
Camilla Berglund5fd409b2013-06-05 17:53:13 +02004063 * @param[in] interval The minimum number of screen updates to wait for
4064 * until the buffers are swapped by @ref glfwSwapBuffers.
4065 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01004066 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
4067 * GLFW_NO_CURRENT_CONTEXT and @ref GLFW_PLATFORM_ERROR.
4068 *
Camilla Berglund951a9582016-01-31 21:32:14 +01004069 * @remark This function is not called during context creation, leaving the
Camilla Berglund11c22d62015-02-19 15:33:51 +01004070 * swap interval set to whatever is the default on that platform. This is done
Camilla Berglund3af1c412013-09-19 21:37:01 +02004071 * because some swap interval extensions used by GLFW do not allow the swap
4072 * interval to be reset to zero once it has been set to a non-zero value.
4073 *
Camilla Berglund951a9582016-01-31 21:32:14 +01004074 * @remark Some GPU drivers do not honor the requested swap interval, either
Camilla Berglund11c22d62015-02-19 15:33:51 +01004075 * because of a user setting that overrides the application's request or due to
4076 * bugs in the driver.
Camilla Berglund8282a8f2013-04-10 23:01:12 +02004077 *
Camilla Berglund951a9582016-01-31 21:32:14 +01004078 * @thread_safety This function may be called from any thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02004079 *
Camilla Berglund4188c262015-01-18 01:55:25 +01004080 * @sa @ref buffer_swap
Camilla Berglund7e9e3212016-09-14 20:17:26 +02004081 * @sa @ref glfwSwapBuffers
Camilla Berglunde248fb62013-03-29 14:06:23 +01004082 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01004083 * @since Added in version 1.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02004084 *
Camilla Berglunde248fb62013-03-29 14:06:23 +01004085 * @ingroup context
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004086 */
4087GLFWAPI void glfwSwapInterval(int interval);
4088
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004089/*! @brief Returns whether the specified extension is available.
4090 *
Camilla Berglund608109c2013-04-11 20:18:46 +02004091 * This function returns whether the specified
Camilla Berglund001c50c2016-02-19 09:13:56 +01004092 * [API extension](@ref context_glext) is supported by the current OpenGL or
4093 * OpenGL ES context. It searches both for client API extension and context
4094 * creation API extensions.
Camilla Berglund4591ad22014-09-18 15:03:29 +02004095 *
4096 * A context must be current on the calling thread. Calling this function
Camilla Berglundce8f97c2015-01-11 23:33:14 +01004097 * without a current context will cause a @ref GLFW_NO_CURRENT_CONTEXT error.
Camilla Berglund4591ad22014-09-18 15:03:29 +02004098 *
4099 * As this functions retrieves and searches one or more extension strings each
4100 * call, it is recommended that you cache its results if it is going to be used
4101 * frequently. The extension strings will not change during the lifetime of
4102 * a context, so there is no danger in doing this.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004103 *
Camilla Berglund001c50c2016-02-19 09:13:56 +01004104 * This function does not apply to Vulkan. If you are using Vulkan, see @ref
4105 * glfwGetRequiredInstanceExtensions, `vkEnumerateInstanceExtensionProperties`
4106 * and `vkEnumerateDeviceExtensionProperties` instead.
4107 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004108 * @param[in] extension The ASCII encoded name of the extension.
Camilla Berglund0eccf752015-08-23 19:30:04 +02004109 * @return `GLFW_TRUE` if the extension is available, or `GLFW_FALSE`
4110 * otherwise.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004111 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01004112 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
4113 * GLFW_NO_CURRENT_CONTEXT, @ref GLFW_INVALID_VALUE and @ref
4114 * GLFW_PLATFORM_ERROR.
4115 *
Camilla Berglund951a9582016-01-31 21:32:14 +01004116 * @thread_safety This function may be called from any thread.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004117 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02004118 * @sa @ref context_glext
Camilla Berglund7e9e3212016-09-14 20:17:26 +02004119 * @sa @ref glfwGetProcAddress
Camilla Berglund4591ad22014-09-18 15:03:29 +02004120 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01004121 * @since Added in version 1.0.
Camilla Berglunde248fb62013-03-29 14:06:23 +01004122 *
4123 * @ingroup context
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004124 */
4125GLFWAPI int glfwExtensionSupported(const char* extension);
4126
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004127/*! @brief Returns the address of the specified function for the current
4128 * context.
4129 *
Camilla Berglund001c50c2016-02-19 09:13:56 +01004130 * This function returns the address of the specified OpenGL or OpenGL ES
Camilla Berglund11c22d62015-02-19 15:33:51 +01004131 * [core or extension function](@ref context_glext), if it is supported
Camilla Berglund1f5f20e2013-05-27 17:10:34 +02004132 * by the current context.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004133 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02004134 * A context must be current on the calling thread. Calling this function
Camilla Berglundce8f97c2015-01-11 23:33:14 +01004135 * without a current context will cause a @ref GLFW_NO_CURRENT_CONTEXT error.
Camilla Berglund4591ad22014-09-18 15:03:29 +02004136 *
Camilla Berglund001c50c2016-02-19 09:13:56 +01004137 * This function does not apply to Vulkan. If you are rendering with Vulkan,
4138 * see @ref glfwGetInstanceProcAddress, `vkGetInstanceProcAddr` and
4139 * `vkGetDeviceProcAddr` instead.
4140 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004141 * @param[in] procname The ASCII encoded name of the function.
Camilla Berglunda36e3a22015-11-05 17:14:26 +01004142 * @return The address of the function, or `NULL` if an
4143 * [error](@ref error_handling) occurred.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004144 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01004145 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
4146 * GLFW_NO_CURRENT_CONTEXT and @ref GLFW_PLATFORM_ERROR.
4147 *
Camilla Berglund951a9582016-01-31 21:32:14 +01004148 * @remark The address of a given function is not guaranteed to be the same
Camilla Berglund4591ad22014-09-18 15:03:29 +02004149 * between contexts.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004150 *
Camilla Berglund951a9582016-01-31 21:32:14 +01004151 * @remark This function may return a non-`NULL` address despite the
Camilla Berglund11c22d62015-02-19 15:33:51 +01004152 * associated version or extension not being available. Always check the
Camilla Berglundc8e06872015-08-27 21:40:22 +02004153 * context version or extension string first.
Camilla Berglund11c22d62015-02-19 15:33:51 +01004154 *
Camilla Berglund951a9582016-01-31 21:32:14 +01004155 * @pointer_lifetime The returned function pointer is valid until the context
4156 * is destroyed or the library is terminated.
Camilla Berglund4591ad22014-09-18 15:03:29 +02004157 *
Camilla Berglund951a9582016-01-31 21:32:14 +01004158 * @thread_safety This function may be called from any thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02004159 *
4160 * @sa @ref context_glext
Camilla Berglund7e9e3212016-09-14 20:17:26 +02004161 * @sa @ref glfwExtensionSupported
Camilla Berglund4591ad22014-09-18 15:03:29 +02004162 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01004163 * @since Added in version 1.0.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004164 *
4165 * @ingroup context
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004166 */
Camilla Berglundbf42c3c2012-06-05 00:16:40 +02004167GLFWAPI GLFWglproc glfwGetProcAddress(const char* procname);
Camilla Berglund3249f812010-09-07 17:34:51 +02004168
Camilla Berglund9b75bff2015-08-10 20:19:04 +02004169/*! @brief Returns whether the Vulkan loader has been found.
4170 *
4171 * This function returns whether the Vulkan loader has been found. This check
4172 * is performed by @ref glfwInit.
4173 *
4174 * The availability of a Vulkan loader does not by itself guarantee that window
4175 * surface creation or even device creation is possible. Call @ref
4176 * glfwGetRequiredInstanceExtensions to check whether the extensions necessary
4177 * for Vulkan surface creation are available and @ref
4178 * glfwGetPhysicalDevicePresentationSupport to check whether a queue family of
4179 * a physical device supports image presentation.
4180 *
4181 * @return `GLFW_TRUE` if Vulkan is available, or `GLFW_FALSE` otherwise.
4182 *
4183 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
4184 *
4185 * @thread_safety This function may be called from any thread.
4186 *
4187 * @sa @ref vulkan_support
4188 *
4189 * @since Added in version 3.2.
4190 *
4191 * @ingroup vulkan
4192 */
4193GLFWAPI int glfwVulkanSupported(void);
4194
4195/*! @brief Returns the Vulkan instance extensions required by GLFW.
4196 *
4197 * This function returns an array of names of Vulkan instance extensions required
4198 * by GLFW for creating Vulkan surfaces for GLFW windows. If successful, the
4199 * list will always contains `VK_KHR_surface`, so if you don't require any
4200 * additional extensions you can pass this list directly to the
4201 * `VkInstanceCreateInfo` struct.
4202 *
4203 * If Vulkan is not available on the machine, this function returns `NULL` and
4204 * generates a @ref GLFW_API_UNAVAILABLE error. Call @ref glfwVulkanSupported
4205 * to check whether Vulkan is available.
4206 *
4207 * If Vulkan is available but no set of extensions allowing window surface
4208 * creation was found, this function returns `NULL`. You may still use Vulkan
4209 * for off-screen rendering and compute work.
4210 *
4211 * @param[out] count Where to store the number of extensions in the returned
4212 * array. This is set to zero if an error occurred.
4213 * @return An array of ASCII encoded extension names, or `NULL` if an
4214 * [error](@ref error_handling) occurred.
4215 *
4216 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
4217 * GLFW_API_UNAVAILABLE.
4218 *
4219 * @remarks Additional extensions may be required by future versions of GLFW.
4220 * You should check if any extensions you wish to enable are already in the
4221 * returned array, as it is an error to specify an extension more than once in
4222 * the `VkInstanceCreateInfo` struct.
4223 *
4224 * @pointer_lifetime The returned array is allocated and freed by GLFW. You
4225 * should not free it yourself. It is guaranteed to be valid only until the
4226 * library is terminated.
4227 *
4228 * @thread_safety This function may be called from any thread.
4229 *
4230 * @sa @ref vulkan_ext
Camilla Berglund7e9e3212016-09-14 20:17:26 +02004231 * @sa @ref glfwCreateWindowSurface
Camilla Berglund9b75bff2015-08-10 20:19:04 +02004232 *
4233 * @since Added in version 3.2.
4234 *
4235 * @ingroup vulkan
4236 */
Camilla Berglund7ab7d8b2016-03-23 10:24:01 +01004237GLFWAPI const char** glfwGetRequiredInstanceExtensions(uint32_t* count);
Camilla Berglund9b75bff2015-08-10 20:19:04 +02004238
4239#if defined(VK_VERSION_1_0)
4240
4241/*! @brief Returns the address of the specified Vulkan instance function.
4242 *
4243 * This function returns the address of the specified Vulkan core or extension
4244 * function for the specified instance. If instance is set to `NULL` it can
4245 * return any function exported from the Vulkan loader, including at least the
4246 * following functions:
4247 *
4248 * - `vkEnumerateInstanceExtensionProperties`
4249 * - `vkEnumerateInstanceLayerProperties`
4250 * - `vkCreateInstance`
4251 * - `vkGetInstanceProcAddr`
4252 *
4253 * If Vulkan is not available on the machine, this function returns `NULL` and
4254 * generates a @ref GLFW_API_UNAVAILABLE error. Call @ref glfwVulkanSupported
4255 * to check whether Vulkan is available.
4256 *
4257 * This function is equivalent to calling `vkGetInstanceProcAddr` with
4258 * a platform-specific query of the Vulkan loader as a fallback.
4259 *
4260 * @param[in] instance The Vulkan instance to query, or `NULL` to retrieve
4261 * functions related to instance creation.
4262 * @param[in] procname The ASCII encoded name of the function.
4263 * @return The address of the function, or `NULL` if an
4264 * [error](@ref error_handling) occurred.
4265 *
4266 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
4267 * GLFW_API_UNAVAILABLE.
4268 *
4269 * @pointer_lifetime The returned function pointer is valid until the library
4270 * is terminated.
4271 *
4272 * @thread_safety This function may be called from any thread.
4273 *
4274 * @sa @ref vulkan_proc
4275 *
4276 * @since Added in version 3.2.
4277 *
4278 * @ingroup vulkan
4279 */
4280GLFWAPI GLFWvkproc glfwGetInstanceProcAddress(VkInstance instance, const char* procname);
4281
4282/*! @brief Returns whether the specified queue family can present images.
4283 *
4284 * This function returns whether the specified queue family of the specified
4285 * physical device supports presentation to the platform GLFW was built for.
4286 *
4287 * If Vulkan or the required window surface creation instance extensions are
4288 * not available on the machine, or if the specified instance was not created
4289 * with the required extensions, this function returns `GLFW_FALSE` and
4290 * generates a @ref GLFW_API_UNAVAILABLE error. Call @ref glfwVulkanSupported
4291 * to check whether Vulkan is available and @ref
4292 * glfwGetRequiredInstanceExtensions to check what instance extensions are
4293 * required.
4294 *
4295 * @param[in] instance The instance that the physical device belongs to.
4296 * @param[in] device The physical device that the queue family belongs to.
4297 * @param[in] queuefamily The index of the queue family to query.
4298 * @return `GLFW_TRUE` if the queue family supports presentation, or
4299 * `GLFW_FALSE` otherwise.
4300 *
4301 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
4302 * GLFW_API_UNAVAILABLE and @ref GLFW_PLATFORM_ERROR.
4303 *
4304 * @thread_safety This function may be called from any thread. For
4305 * synchronization details of Vulkan objects, see the Vulkan specification.
4306 *
4307 * @sa @ref vulkan_present
4308 *
4309 * @since Added in version 3.2.
4310 *
4311 * @ingroup vulkan
4312 */
4313GLFWAPI int glfwGetPhysicalDevicePresentationSupport(VkInstance instance, VkPhysicalDevice device, uint32_t queuefamily);
4314
4315/*! @brief Creates a Vulkan surface for the specified window.
4316 *
4317 * This function creates a Vulkan surface for the specified window.
4318 *
4319 * If the Vulkan loader was not found at initialization, this function returns
4320 * `VK_ERROR_INITIALIZATION_FAILED` and generates a @ref GLFW_API_UNAVAILABLE
4321 * error. Call @ref glfwVulkanSupported to check whether the Vulkan loader was
4322 * found.
4323 *
4324 * If the required window surface creation instance extensions are not
4325 * available or if the specified instance was not created with these extensions
4326 * enabled, this function returns `VK_ERROR_EXTENSION_NOT_PRESENT` and
4327 * generates a @ref GLFW_API_UNAVAILABLE error. Call @ref
4328 * glfwGetRequiredInstanceExtensions to check what instance extensions are
4329 * required.
4330 *
4331 * The window surface must be destroyed before the specified Vulkan instance.
4332 * It is the responsibility of the caller to destroy the window surface. GLFW
4333 * does not destroy it for you. Call `vkDestroySurfaceKHR` to destroy the
4334 * surface.
4335 *
4336 * @param[in] instance The Vulkan instance to create the surface in.
4337 * @param[in] window The window to create the surface for.
4338 * @param[in] allocator The allocator to use, or `NULL` to use the default
4339 * allocator.
4340 * @param[out] surface Where to store the handle of the surface. This is set
4341 * to `VK_NULL_HANDLE` if an error occurred.
4342 * @return `VK_SUCCESS` if successful, or a Vulkan error code if an
4343 * [error](@ref error_handling) occurred.
4344 *
4345 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
4346 * GLFW_API_UNAVAILABLE and @ref GLFW_PLATFORM_ERROR.
4347 *
4348 * @remarks If an error occurs before the creation call is made, GLFW returns
4349 * the Vulkan error code most appropriate for the error. Appropriate use of
4350 * @ref glfwVulkanSupported and @ref glfwGetRequiredInstanceExtensions should
Camilla Berglundee33dcd2016-03-07 14:42:51 +01004351 * eliminate almost all occurrences of these errors.
Camilla Berglund9b75bff2015-08-10 20:19:04 +02004352 *
4353 * @thread_safety This function may be called from any thread. For
4354 * synchronization details of Vulkan objects, see the Vulkan specification.
4355 *
4356 * @sa @ref vulkan_surface
Camilla Berglund7e9e3212016-09-14 20:17:26 +02004357 * @sa @ref glfwGetRequiredInstanceExtensions
Camilla Berglund9b75bff2015-08-10 20:19:04 +02004358 *
4359 * @since Added in version 3.2.
4360 *
4361 * @ingroup vulkan
4362 */
4363GLFWAPI VkResult glfwCreateWindowSurface(VkInstance instance, GLFWwindow* window, const VkAllocationCallbacks* allocator, VkSurfaceKHR* surface);
4364
4365#endif /*VK_VERSION_1_0*/
4366
Camilla Berglund3249f812010-09-07 17:34:51 +02004367
Camilla Berglund4afc67c2011-07-27 17:09:17 +02004368/*************************************************************************
4369 * Global definition cleanup
4370 *************************************************************************/
4371
4372/* ------------------- BEGIN SYSTEM/COMPILER SPECIFIC -------------------- */
4373
Camilla Berglund4afc67c2011-07-27 17:09:17 +02004374#ifdef GLFW_WINGDIAPI_DEFINED
4375 #undef WINGDIAPI
4376 #undef GLFW_WINGDIAPI_DEFINED
4377#endif
4378
4379#ifdef GLFW_CALLBACK_DEFINED
4380 #undef CALLBACK
4381 #undef GLFW_CALLBACK_DEFINED
4382#endif
4383
4384/* -------------------- END SYSTEM/COMPILER SPECIFIC --------------------- */
4385
4386
Camilla Berglund3249f812010-09-07 17:34:51 +02004387#ifdef __cplusplus
4388}
4389#endif
4390
Camilla Berglundf8df91d2013-01-15 01:59:56 +01004391#endif /* _glfw3_h_ */
Camilla Berglund3249f812010-09-07 17:34:51 +02004392