blob: d6983bcf8a3c0e99a47ed908350027b9df3add22 [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 Löwyf4d0c832016-11-21 16:23:59 +01006 * Copyright (c) 2006-2016 Camilla Löwy <elmindreda@glfw.org>
Camilla Berglund3249f812010-09-07 17:34:51 +02007 *
8 * This software is provided 'as-is', without any express or implied
9 * warranty. In no event will the authors be held liable for any damages
10 * arising from the use of this software.
11 *
12 * Permission is granted to anyone to use this software for any purpose,
13 * including commercial applications, and to alter it and redistribute it
14 * freely, subject to the following restrictions:
15 *
16 * 1. The origin of this software must not be misrepresented; you must not
17 * claim that you wrote the original software. If you use this software
18 * in a product, an acknowledgment in the product documentation would
19 * be appreciated but is not required.
20 *
21 * 2. Altered source versions must be plainly marked as such, and must not
22 * be misrepresented as being the original software.
23 *
24 * 3. This notice may not be removed or altered from any source
25 * distribution.
26 *
27 *************************************************************************/
28
Camilla Berglundf8df91d2013-01-15 01:59:56 +010029#ifndef _glfw3_h_
30#define _glfw3_h_
Camilla Berglund3249f812010-09-07 17:34:51 +020031
32#ifdef __cplusplus
33extern "C" {
34#endif
35
36
37/*************************************************************************
Camilla Berglundbce2cd62012-11-22 16:38:24 +010038 * Doxygen documentation
39 *************************************************************************/
40
Camilla Berglund318e8ac2015-10-24 20:48:46 +020041/*! @file glfw3.h
42 * @brief The header of the GLFW 3 API.
43 *
44 * This is the header file of the GLFW 3 API. It defines all its types and
45 * declares all its functions.
46 *
47 * For more information about how to use this file, see @ref build_include.
48 */
Camilla Berglund80c203f2016-02-19 10:29:13 +010049/*! @defgroup context Context reference
Camilla Löwy21eabd32017-02-06 17:31:25 +010050 * @brief Functions and types related to OpenGL and OpenGL ES contexts.
Camilla Berglund4591ad22014-09-18 15:03:29 +020051 *
Camilla Berglund80c203f2016-02-19 10:29:13 +010052 * This is the reference documentation for OpenGL and OpenGL ES context related
53 * functions. For more task-oriented information, see the @ref context_guide.
Camilla Berglund3f5843f2012-12-13 02:22:39 +010054 */
Camilla Berglund80c203f2016-02-19 10:29:13 +010055/*! @defgroup vulkan Vulkan reference
Camilla Löwy21eabd32017-02-06 17:31:25 +010056 * @brief Functions and types related to Vulkan.
Camilla Berglund9b75bff2015-08-10 20:19:04 +020057 *
Camilla Berglund80c203f2016-02-19 10:29:13 +010058 * This is the reference documentation for Vulkan related functions and types.
59 * For more task-oriented information, see the @ref vulkan_guide.
Camilla Berglund9b75bff2015-08-10 20:19:04 +020060 */
Camilla Berglund80c203f2016-02-19 10:29:13 +010061/*! @defgroup init Initialization, version and error reference
Camilla Löwy21eabd32017-02-06 17:31:25 +010062 * @brief Functions and types related to initialization and error handling.
Camilla Berglund4591ad22014-09-18 15:03:29 +020063 *
64 * This is the reference documentation for initialization and termination of
Camilla Berglund80c203f2016-02-19 10:29:13 +010065 * the library, version management and error handling. For more task-oriented
66 * information, see the @ref intro_guide.
Camilla Berglundbce2cd62012-11-22 16:38:24 +010067 */
Camilla Berglund80c203f2016-02-19 10:29:13 +010068/*! @defgroup input Input reference
Camilla Löwy21eabd32017-02-06 17:31:25 +010069 * @brief Functions and types related to input handling.
Camilla Berglund4591ad22014-09-18 15:03:29 +020070 *
71 * This is the reference documentation for input related functions and types.
Camilla Berglund80c203f2016-02-19 10:29:13 +010072 * For more task-oriented information, see the @ref input_guide.
Camilla Berglundbce2cd62012-11-22 16:38:24 +010073 */
Camilla Berglund80c203f2016-02-19 10:29:13 +010074/*! @defgroup monitor Monitor reference
Camilla Löwy21eabd32017-02-06 17:31:25 +010075 * @brief Functions and types related to monitors.
Camilla Berglundf5f55e32013-06-17 12:56:36 +020076 *
77 * This is the reference documentation for monitor related functions and types.
Camilla Berglund80c203f2016-02-19 10:29:13 +010078 * For more task-oriented information, see the @ref monitor_guide.
Camilla Berglund5f68e122012-11-27 17:07:28 +010079 */
Camilla Berglund80c203f2016-02-19 10:29:13 +010080/*! @defgroup window Window reference
Camilla Löwy21eabd32017-02-06 17:31:25 +010081 * @brief Functions and types related to windows.
Camilla Berglundbce2cd62012-11-22 16:38:24 +010082 *
Camilla Berglundf5f55e32013-06-17 12:56:36 +020083 * This is the reference documentation for window related functions and types,
Camilla Berglund80c203f2016-02-19 10:29:13 +010084 * including creation, deletion and event polling. For more task-oriented
85 * information, see the @ref window_guide.
Camilla Berglundbce2cd62012-11-22 16:38:24 +010086 */
Camilla Berglundbce2cd62012-11-22 16:38:24 +010087
88
89/*************************************************************************
Camilla Berglund8d910d72015-02-22 18:35:10 +010090 * Compiler- and platform-specific preprocessor work
Camilla Berglund3249f812010-09-07 17:34:51 +020091 *************************************************************************/
92
Camilla Berglund8d910d72015-02-22 18:35:10 +010093/* If we are we on Windows, we want a single define for it.
Camilla Berglund3249f812010-09-07 17:34:51 +020094 */
Camilla Berglunde8ce4ab2015-02-22 18:18:43 +010095#if !defined(_WIN32) && (defined(__WIN32__) || defined(WIN32) || defined(__MINGW32__))
Camilla Berglund3249f812010-09-07 17:34:51 +020096 #define _WIN32
97#endif /* _WIN32 */
98
Camilla Berglund8d910d72015-02-22 18:35:10 +010099/* It is customary to use APIENTRY for OpenGL function pointer declarations on
100 * all platforms. Additionally, the Windows OpenGL header needs APIENTRY.
Camilla Berglund3249f812010-09-07 17:34:51 +0200101 */
102#ifndef APIENTRY
103 #ifdef _WIN32
104 #define APIENTRY __stdcall
105 #else
106 #define APIENTRY
107 #endif
Camilla Berglund3249f812010-09-07 17:34:51 +0200108#endif /* APIENTRY */
109
Camilla Berglunda90ee652016-11-08 12:39:18 +0100110/* Some OpenGL related headers use GLAPIENTRY instead.
111 */
112#ifndef GLAPIENTRY
113 #define GLAPIENTRY APIENTRY
114#endif /* GLAPIENTRY */
115
Camilla Berglund8d910d72015-02-22 18:35:10 +0100116/* Some Windows OpenGL headers need this.
Camilla Berglund3249f812010-09-07 17:34:51 +0200117 */
Camilla Berglund3249f812010-09-07 17:34:51 +0200118#if !defined(WINGDIAPI) && defined(_WIN32)
Camilla Berglundc5353642015-02-22 18:14:30 +0100119 #define WINGDIAPI __declspec(dllimport)
Camilla Berglund4afc67c2011-07-27 17:09:17 +0200120 #define GLFW_WINGDIAPI_DEFINED
Camilla Berglund3249f812010-09-07 17:34:51 +0200121#endif /* WINGDIAPI */
122
Camilla Berglund8d910d72015-02-22 18:35:10 +0100123/* Some Windows GLU headers need this.
124 */
Camilla Berglund3249f812010-09-07 17:34:51 +0200125#if !defined(CALLBACK) && defined(_WIN32)
Camilla Berglundd586fe62015-02-22 18:17:34 +0100126 #define CALLBACK __stdcall
Camilla Berglund4afc67c2011-07-27 17:09:17 +0200127 #define GLFW_CALLBACK_DEFINED
Camilla Berglund3249f812010-09-07 17:34:51 +0200128#endif /* CALLBACK */
129
Camilla Berglund70423af2016-07-21 00:15:07 +0200130/* Include because most Windows GLU headers need wchar_t and
Camilla Berglund8d6f2652016-10-20 00:50:54 +0200131 * the macOS OpenGL header blocks the definition of ptrdiff_t by glext.h.
Camilla Berglund8221aad2016-03-06 09:40:16 +0100132 * Include it unconditionally to avoid surprising side-effects.
Camilla Berglund8d910d72015-02-22 18:35:10 +0100133 */
Camilla Berglund8221aad2016-03-06 09:40:16 +0100134#include <stddef.h>
Camilla Berglund70423af2016-07-21 00:15:07 +0200135
136/* Include because it is needed by Vulkan and related functions.
137 */
Camilla Berglund5661d032016-03-23 10:09:07 +0100138#include <stdint.h>
Camilla Berglund3249f812010-09-07 17:34:51 +0200139
Camilla Berglundc93b1202013-09-08 16:07:34 +0200140/* Include the chosen client API headers.
141 */
Camilla Berglunddb49aa62016-02-22 13:16:43 +0100142#if defined(__APPLE__)
Camilla Berglund1591caa2015-01-08 06:56:17 +0100143 #if defined(GLFW_INCLUDE_GLCOREARB)
144 #include <OpenGL/gl3.h>
145 #if defined(GLFW_INCLUDE_GLEXT)
146 #include <OpenGL/gl3ext.h>
Camilla Berglundc93b1202013-09-08 16:07:34 +0200147 #endif
Camilla Berglund1591caa2015-01-08 06:56:17 +0100148 #elif !defined(GLFW_INCLUDE_NONE)
149 #if !defined(GLFW_INCLUDE_GLEXT)
150 #define GL_GLEXT_LEGACY
Camilla Berglundc93b1202013-09-08 16:07:34 +0200151 #endif
Camilla Berglund1591caa2015-01-08 06:56:17 +0100152 #include <OpenGL/gl.h>
153 #endif
154 #if defined(GLFW_INCLUDE_GLU)
155 #include <OpenGL/glu.h>
156 #endif
Camilla Berglundc93b1202013-09-08 16:07:34 +0200157#else
Camilla Berglund1591caa2015-01-08 06:56:17 +0100158 #if defined(GLFW_INCLUDE_GLCOREARB)
159 #include <GL/glcorearb.h>
160 #elif defined(GLFW_INCLUDE_ES1)
161 #include <GLES/gl.h>
162 #if defined(GLFW_INCLUDE_GLEXT)
163 #include <GLES/glext.h>
Camilla Berglundc93b1202013-09-08 16:07:34 +0200164 #endif
Camilla Berglund1591caa2015-01-08 06:56:17 +0100165 #elif defined(GLFW_INCLUDE_ES2)
166 #include <GLES2/gl2.h>
167 #if defined(GLFW_INCLUDE_GLEXT)
168 #include <GLES2/gl2ext.h>
Camilla Berglundc93b1202013-09-08 16:07:34 +0200169 #endif
Camilla Berglund1591caa2015-01-08 06:56:17 +0100170 #elif defined(GLFW_INCLUDE_ES3)
171 #include <GLES3/gl3.h>
172 #if defined(GLFW_INCLUDE_GLEXT)
Camilla Berglundca21a5c2016-01-02 21:45:23 +0100173 #include <GLES2/gl2ext.h>
Camilla Berglund1591caa2015-01-08 06:56:17 +0100174 #endif
175 #elif defined(GLFW_INCLUDE_ES31)
176 #include <GLES3/gl31.h>
177 #if defined(GLFW_INCLUDE_GLEXT)
Camilla Berglundca21a5c2016-01-02 21:45:23 +0100178 #include <GLES2/gl2ext.h>
Camilla Berglund1591caa2015-01-08 06:56:17 +0100179 #endif
Camilla Löwy3edaa522017-01-02 05:58:41 +0100180 #elif defined(GLFW_INCLUDE_ES32)
181 #include <GLES3/gl32.h>
182 #if defined(GLFW_INCLUDE_GLEXT)
183 #include <GLES2/gl2ext.h>
184 #endif
Camilla Berglund1591caa2015-01-08 06:56:17 +0100185 #elif !defined(GLFW_INCLUDE_NONE)
186 #include <GL/gl.h>
187 #if defined(GLFW_INCLUDE_GLEXT)
188 #include <GL/glext.h>
189 #endif
190 #endif
191 #if defined(GLFW_INCLUDE_GLU)
192 #include <GL/glu.h>
193 #endif
Camilla Berglundc93b1202013-09-08 16:07:34 +0200194#endif
Camilla Berglund433db8f2016-09-14 21:13:33 +0200195#if defined(GLFW_INCLUDE_VULKAN)
Camilla Berglunde94d1662016-10-14 01:46:56 +0200196 #if defined(__APPLE__)
197 #include <MoltenVK/vulkan/vulkan.h>
198 #else
199 #include <vulkan/vulkan.h>
200 #endif
Camilla Berglund433db8f2016-09-14 21:13:33 +0200201#endif
Camilla Berglund3249f812010-09-07 17:34:51 +0200202
Camilla Berglundcc5d7cd2012-03-25 17:43:02 +0200203#if defined(GLFW_DLL) && defined(_GLFW_BUILD_DLL)
Camilla Berglunde8e05d42014-04-23 13:30:11 +0200204 /* GLFW_DLL must be defined by applications that are linking against the DLL
205 * version of the GLFW library. _GLFW_BUILD_DLL is defined by the GLFW
206 * configuration header when compiling the DLL version of the library.
Camilla Berglundbd2d5712013-07-23 01:59:27 +0200207 */
Camilla Berglund0df4e062015-12-13 14:07:27 +0100208 #error "You must not have both GLFW_DLL and _GLFW_BUILD_DLL defined"
Camilla Berglundcc5d7cd2012-03-25 17:43:02 +0200209#endif
210
Camilla Berglund1591caa2015-01-08 06:56:17 +0100211/* GLFWAPI is used to declare public API functions for export
212 * from the DLL / shared library / dynamic library.
213 */
Camilla Berglund2588c9b2012-03-25 17:40:30 +0200214#if defined(_WIN32) && defined(_GLFW_BUILD_DLL)
Camilla Berglund3afa8312014-10-13 14:13:08 +0200215 /* We are building GLFW as a Win32 DLL */
Camilla Berglund2955cd32010-11-17 15:42:55 +0100216 #define GLFWAPI __declspec(dllexport)
Camilla Berglund3249f812010-09-07 17:34:51 +0200217#elif defined(_WIN32) && defined(GLFW_DLL)
Camilla Berglund3afa8312014-10-13 14:13:08 +0200218 /* We are calling GLFW as a Win32 DLL */
Camilla Berglund1247fc02015-02-22 18:10:20 +0100219 #define GLFWAPI __declspec(dllimport)
John Bartholomew93f4eff2013-05-01 13:08:09 +0100220#elif defined(__GNUC__) && defined(_GLFW_BUILD_DLL)
Camilla Berglund3afa8312014-10-13 14:13:08 +0200221 /* We are building GLFW as a shared / dynamic library */
John Bartholomew93f4eff2013-05-01 13:08:09 +0100222 #define GLFWAPI __attribute__((visibility("default")))
Camilla Berglund3249f812010-09-07 17:34:51 +0200223#else
Camilla Berglund3afa8312014-10-13 14:13:08 +0200224 /* We are building or calling GLFW as a static library */
Camilla Berglund3249f812010-09-07 17:34:51 +0200225 #define GLFWAPI
Camilla Berglund3249f812010-09-07 17:34:51 +0200226#endif
227
Camilla Berglund3249f812010-09-07 17:34:51 +0200228
229/*************************************************************************
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100230 * GLFW API tokens
Camilla Berglund3249f812010-09-07 17:34:51 +0200231 *************************************************************************/
232
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100233/*! @name GLFW version macros
234 * @{ */
235/*! @brief The major version number of the GLFW library.
236 *
237 * This is incremented when the API is changed in non-compatible ways.
238 * @ingroup init
239 */
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100240#define GLFW_VERSION_MAJOR 3
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100241/*! @brief The minor version number of the GLFW library.
242 *
243 * This is incremented when features are added to the API but it remains
244 * backward-compatible.
245 * @ingroup init
246 */
Camilla Berglund53fafad2016-08-18 23:42:15 +0200247#define GLFW_VERSION_MINOR 3
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100248/*! @brief The revision number of the GLFW library.
249 *
250 * This is incremented when a bug fix release is made that does not contain any
251 * API changes.
252 * @ingroup init
253 */
Camilla Berglund53fafad2016-08-18 23:42:15 +0200254#define GLFW_VERSION_REVISION 0
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100255/*! @} */
Camilla Berglund3249f812010-09-07 17:34:51 +0200256
Camilla Berglund0eccf752015-08-23 19:30:04 +0200257/*! @name Boolean values
258 * @{ */
259/*! @brief One.
260 *
261 * One. Seriously. You don't _need_ to use this symbol in your code. It's
262 * just semantic sugar for the number 1. You can use `1` or `true` or `_True`
263 * or `GL_TRUE` or whatever you want.
264 */
265#define GLFW_TRUE 1
266/*! @brief Zero.
267 *
268 * Zero. Seriously. You don't _need_ to use this symbol in your code. It's
269 * just just semantic sugar for the number 0. You can use `0` or `false` or
270 * `_False` or `GL_FALSE` or whatever you want.
271 */
272#define GLFW_FALSE 0
273/*! @} */
274
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100275/*! @name Key and button actions
276 * @{ */
Camilla Berglund4591ad22014-09-18 15:03:29 +0200277/*! @brief The key or mouse button was released.
278 *
279 * The key or mouse button was released.
280 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100281 * @ingroup input
282 */
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100283#define GLFW_RELEASE 0
Camilla Berglund4591ad22014-09-18 15:03:29 +0200284/*! @brief The key or mouse button was pressed.
285 *
286 * The key or mouse button was pressed.
287 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100288 * @ingroup input
289 */
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100290#define GLFW_PRESS 1
Camilla Berglund253e0d62013-01-12 17:06:35 +0100291/*! @brief The key was held down until it repeated.
Camilla Berglund4591ad22014-09-18 15:03:29 +0200292 *
293 * The key was held down until it repeated.
294 *
Camilla Berglund253e0d62013-01-12 17:06:35 +0100295 * @ingroup input
296 */
297#define GLFW_REPEAT 2
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100298/*! @} */
Camilla Berglund3249f812010-09-07 17:34:51 +0200299
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200300/*! @defgroup keys Keyboard keys
Camilla Löwy21eabd32017-02-06 17:31:25 +0100301 * @brief Keyboard key IDs.
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200302 *
Camilla Berglund4188c262015-01-18 01:55:25 +0100303 * See [key input](@ref input_key) for how these are used.
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200304 *
Camilla Berglund4188c262015-01-18 01:55:25 +0100305 * These key codes are inspired by the _USB HID Usage Tables v1.12_ (p. 53-60),
306 * but re-arranged to map to 7-bit ASCII for printable keys (function keys are
307 * put in the 256+ range).
308 *
309 * The naming of the key codes follow these rules:
310 * - The US keyboard layout is used
311 * - Names of printable alpha-numeric characters are used (e.g. "A", "R",
312 * "3", etc.)
313 * - For non-alphanumeric characters, Unicode:ish names are used (e.g.
314 * "COMMA", "LEFT_SQUARE_BRACKET", etc.). Note that some names do not
315 * correspond to the Unicode standard (usually for brevity)
316 * - Keys that lack a clear US mapping are named "WORLD_x"
317 * - For non-printable keys, custom names are used (e.g. "F4",
318 * "BACKSPACE", etc.)
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200319 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100320 * @ingroup input
321 * @{
322 */
323
Camilla Berglund11615fc2013-05-30 17:19:12 +0200324/* The unknown key */
325#define GLFW_KEY_UNKNOWN -1
326
Marcusc0cb4c22011-01-02 11:18:14 +0100327/* Printable keys */
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100328#define GLFW_KEY_SPACE 32
329#define GLFW_KEY_APOSTROPHE 39 /* ' */
330#define GLFW_KEY_COMMA 44 /* , */
331#define GLFW_KEY_MINUS 45 /* - */
332#define GLFW_KEY_PERIOD 46 /* . */
333#define GLFW_KEY_SLASH 47 /* / */
334#define GLFW_KEY_0 48
335#define GLFW_KEY_1 49
336#define GLFW_KEY_2 50
337#define GLFW_KEY_3 51
338#define GLFW_KEY_4 52
339#define GLFW_KEY_5 53
340#define GLFW_KEY_6 54
341#define GLFW_KEY_7 55
342#define GLFW_KEY_8 56
343#define GLFW_KEY_9 57
344#define GLFW_KEY_SEMICOLON 59 /* ; */
345#define GLFW_KEY_EQUAL 61 /* = */
346#define GLFW_KEY_A 65
347#define GLFW_KEY_B 66
348#define GLFW_KEY_C 67
349#define GLFW_KEY_D 68
350#define GLFW_KEY_E 69
351#define GLFW_KEY_F 70
352#define GLFW_KEY_G 71
353#define GLFW_KEY_H 72
354#define GLFW_KEY_I 73
355#define GLFW_KEY_J 74
356#define GLFW_KEY_K 75
357#define GLFW_KEY_L 76
358#define GLFW_KEY_M 77
359#define GLFW_KEY_N 78
360#define GLFW_KEY_O 79
361#define GLFW_KEY_P 80
362#define GLFW_KEY_Q 81
363#define GLFW_KEY_R 82
364#define GLFW_KEY_S 83
365#define GLFW_KEY_T 84
366#define GLFW_KEY_U 85
367#define GLFW_KEY_V 86
368#define GLFW_KEY_W 87
369#define GLFW_KEY_X 88
370#define GLFW_KEY_Y 89
371#define GLFW_KEY_Z 90
372#define GLFW_KEY_LEFT_BRACKET 91 /* [ */
373#define GLFW_KEY_BACKSLASH 92 /* \ */
374#define GLFW_KEY_RIGHT_BRACKET 93 /* ] */
375#define GLFW_KEY_GRAVE_ACCENT 96 /* ` */
376#define GLFW_KEY_WORLD_1 161 /* non-US #1 */
377#define GLFW_KEY_WORLD_2 162 /* non-US #2 */
Marcusc0cb4c22011-01-02 11:18:14 +0100378
379/* Function keys */
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100380#define GLFW_KEY_ESCAPE 256
381#define GLFW_KEY_ENTER 257
382#define GLFW_KEY_TAB 258
383#define GLFW_KEY_BACKSPACE 259
384#define GLFW_KEY_INSERT 260
385#define GLFW_KEY_DELETE 261
386#define GLFW_KEY_RIGHT 262
387#define GLFW_KEY_LEFT 263
388#define GLFW_KEY_DOWN 264
389#define GLFW_KEY_UP 265
390#define GLFW_KEY_PAGE_UP 266
391#define GLFW_KEY_PAGE_DOWN 267
392#define GLFW_KEY_HOME 268
393#define GLFW_KEY_END 269
394#define GLFW_KEY_CAPS_LOCK 280
395#define GLFW_KEY_SCROLL_LOCK 281
396#define GLFW_KEY_NUM_LOCK 282
397#define GLFW_KEY_PRINT_SCREEN 283
398#define GLFW_KEY_PAUSE 284
399#define GLFW_KEY_F1 290
400#define GLFW_KEY_F2 291
401#define GLFW_KEY_F3 292
402#define GLFW_KEY_F4 293
403#define GLFW_KEY_F5 294
404#define GLFW_KEY_F6 295
405#define GLFW_KEY_F7 296
406#define GLFW_KEY_F8 297
407#define GLFW_KEY_F9 298
408#define GLFW_KEY_F10 299
409#define GLFW_KEY_F11 300
410#define GLFW_KEY_F12 301
411#define GLFW_KEY_F13 302
412#define GLFW_KEY_F14 303
413#define GLFW_KEY_F15 304
414#define GLFW_KEY_F16 305
415#define GLFW_KEY_F17 306
416#define GLFW_KEY_F18 307
417#define GLFW_KEY_F19 308
418#define GLFW_KEY_F20 309
419#define GLFW_KEY_F21 310
420#define GLFW_KEY_F22 311
421#define GLFW_KEY_F23 312
422#define GLFW_KEY_F24 313
423#define GLFW_KEY_F25 314
424#define GLFW_KEY_KP_0 320
425#define GLFW_KEY_KP_1 321
426#define GLFW_KEY_KP_2 322
427#define GLFW_KEY_KP_3 323
428#define GLFW_KEY_KP_4 324
429#define GLFW_KEY_KP_5 325
430#define GLFW_KEY_KP_6 326
431#define GLFW_KEY_KP_7 327
432#define GLFW_KEY_KP_8 328
433#define GLFW_KEY_KP_9 329
434#define GLFW_KEY_KP_DECIMAL 330
435#define GLFW_KEY_KP_DIVIDE 331
436#define GLFW_KEY_KP_MULTIPLY 332
437#define GLFW_KEY_KP_SUBTRACT 333
438#define GLFW_KEY_KP_ADD 334
439#define GLFW_KEY_KP_ENTER 335
440#define GLFW_KEY_KP_EQUAL 336
441#define GLFW_KEY_LEFT_SHIFT 340
442#define GLFW_KEY_LEFT_CONTROL 341
443#define GLFW_KEY_LEFT_ALT 342
444#define GLFW_KEY_LEFT_SUPER 343
445#define GLFW_KEY_RIGHT_SHIFT 344
446#define GLFW_KEY_RIGHT_CONTROL 345
447#define GLFW_KEY_RIGHT_ALT 346
448#define GLFW_KEY_RIGHT_SUPER 347
449#define GLFW_KEY_MENU 348
Camilla Berglund9c315412015-07-02 14:24:50 +0200450
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100451#define GLFW_KEY_LAST GLFW_KEY_MENU
Marcusc0cb4c22011-01-02 11:18:14 +0100452
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100453/*! @} */
454
Camilla Berglund98cbf6f2013-05-23 14:42:33 +0200455/*! @defgroup mods Modifier key flags
Camilla Löwy21eabd32017-02-06 17:31:25 +0100456 * @brief Modifier key flags.
Camilla Berglund4188c262015-01-18 01:55:25 +0100457 *
458 * See [key input](@ref input_key) for how these are used.
459 *
Camilla Berglund98cbf6f2013-05-23 14:42:33 +0200460 * @ingroup input
Camilla Berglund2d1b8352012-12-09 19:19:00 +0100461 * @{ */
462
Camilla Berglund98cbf6f2013-05-23 14:42:33 +0200463/*! @brief If this bit is set one or more Shift keys were held down.
Camilla Berglund2d1b8352012-12-09 19:19:00 +0100464 */
465#define GLFW_MOD_SHIFT 0x0001
Camilla Berglund98cbf6f2013-05-23 14:42:33 +0200466/*! @brief If this bit is set one or more Control keys were held down.
Camilla Berglund2d1b8352012-12-09 19:19:00 +0100467 */
Camilla Berglund3bcffba2013-05-23 14:11:05 +0200468#define GLFW_MOD_CONTROL 0x0002
Camilla Berglund98cbf6f2013-05-23 14:42:33 +0200469/*! @brief If this bit is set one or more Alt keys were held down.
Camilla Berglund2d1b8352012-12-09 19:19:00 +0100470 */
471#define GLFW_MOD_ALT 0x0004
Camilla Berglund98cbf6f2013-05-23 14:42:33 +0200472/*! @brief If this bit is set one or more Super keys were held down.
Noel Cowereff85f92013-05-23 13:22:27 +0200473 */
474#define GLFW_MOD_SUPER 0x0008
Camilla Berglund2d1b8352012-12-09 19:19:00 +0100475
476/*! @} */
477
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100478/*! @defgroup buttons Mouse buttons
Camilla Löwy21eabd32017-02-06 17:31:25 +0100479 * @brief Mouse button IDs.
Camilla Berglund4188c262015-01-18 01:55:25 +0100480 *
481 * See [mouse button input](@ref input_mouse_button) for how these are used.
482 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100483 * @ingroup input
484 * @{ */
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100485#define GLFW_MOUSE_BUTTON_1 0
486#define GLFW_MOUSE_BUTTON_2 1
487#define GLFW_MOUSE_BUTTON_3 2
488#define GLFW_MOUSE_BUTTON_4 3
489#define GLFW_MOUSE_BUTTON_5 4
490#define GLFW_MOUSE_BUTTON_6 5
491#define GLFW_MOUSE_BUTTON_7 6
492#define GLFW_MOUSE_BUTTON_8 7
493#define GLFW_MOUSE_BUTTON_LAST GLFW_MOUSE_BUTTON_8
494#define GLFW_MOUSE_BUTTON_LEFT GLFW_MOUSE_BUTTON_1
495#define GLFW_MOUSE_BUTTON_RIGHT GLFW_MOUSE_BUTTON_2
496#define GLFW_MOUSE_BUTTON_MIDDLE GLFW_MOUSE_BUTTON_3
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100497/*! @} */
Camilla Berglund3249f812010-09-07 17:34:51 +0200498
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100499/*! @defgroup joysticks Joysticks
Camilla Löwy21eabd32017-02-06 17:31:25 +0100500 * @brief Joystick IDs.
Camilla Berglund4188c262015-01-18 01:55:25 +0100501 *
502 * See [joystick input](@ref joystick) for how these are used.
503 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100504 * @ingroup input
505 * @{ */
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100506#define GLFW_JOYSTICK_1 0
507#define GLFW_JOYSTICK_2 1
508#define GLFW_JOYSTICK_3 2
509#define GLFW_JOYSTICK_4 3
510#define GLFW_JOYSTICK_5 4
511#define GLFW_JOYSTICK_6 5
512#define GLFW_JOYSTICK_7 6
513#define GLFW_JOYSTICK_8 7
514#define GLFW_JOYSTICK_9 8
515#define GLFW_JOYSTICK_10 9
516#define GLFW_JOYSTICK_11 10
517#define GLFW_JOYSTICK_12 11
518#define GLFW_JOYSTICK_13 12
519#define GLFW_JOYSTICK_14 13
520#define GLFW_JOYSTICK_15 14
521#define GLFW_JOYSTICK_16 15
522#define GLFW_JOYSTICK_LAST GLFW_JOYSTICK_16
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100523/*! @} */
Camilla Berglund3249f812010-09-07 17:34:51 +0200524
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100525/*! @defgroup errors Error codes
Camilla Löwy21eabd32017-02-06 17:31:25 +0100526 * @brief Error codes.
Camilla Berglund4188c262015-01-18 01:55:25 +0100527 *
528 * See [error handling](@ref error_handling) for how these are used.
529 *
Camilla Berglund4591ad22014-09-18 15:03:29 +0200530 * @ingroup init
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100531 * @{ */
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100532/*! @brief GLFW has not been initialized.
Camilla Berglund4591ad22014-09-18 15:03:29 +0200533 *
Camilla Berglund0df4e062015-12-13 14:07:27 +0100534 * This occurs if a GLFW function was called that must not be called unless the
Camilla Berglund4591ad22014-09-18 15:03:29 +0200535 * library is [initialized](@ref intro_init).
536 *
Camilla Berglund951a9582016-01-31 21:32:14 +0100537 * @analysis Application programmer error. Initialize GLFW before calling any
538 * function that requires initialization.
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100539 */
Camilla Berglund393e4392013-05-27 22:16:59 +0200540#define GLFW_NOT_INITIALIZED 0x00010001
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100541/*! @brief No context is current for this thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +0200542 *
543 * This occurs if a GLFW function was called that needs and operates on the
544 * current OpenGL or OpenGL ES context but no context is current on the calling
545 * thread. One such function is @ref glfwSwapInterval.
546 *
Camilla Berglund951a9582016-01-31 21:32:14 +0100547 * @analysis Application programmer error. Ensure a context is current before
548 * calling functions that require a current context.
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100549 */
Camilla Berglund393e4392013-05-27 22:16:59 +0200550#define GLFW_NO_CURRENT_CONTEXT 0x00010002
Camilla Berglund4591ad22014-09-18 15:03:29 +0200551/*! @brief One of the arguments to the function was an invalid enum value.
552 *
553 * One of the arguments to the function was an invalid enum value, for example
Camilla Löwyce161c22016-12-06 01:14:23 +0100554 * requesting @ref GLFW_RED_BITS with @ref glfwGetWindowAttrib.
Camilla Berglund4591ad22014-09-18 15:03:29 +0200555 *
Camilla Berglund951a9582016-01-31 21:32:14 +0100556 * @analysis Application programmer error. Fix the offending call.
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100557 */
Camilla Berglund393e4392013-05-27 22:16:59 +0200558#define GLFW_INVALID_ENUM 0x00010003
Camilla Berglund4591ad22014-09-18 15:03:29 +0200559/*! @brief One of the arguments to the function was an invalid value.
560 *
561 * One of the arguments to the function was an invalid value, for example
562 * requesting a non-existent OpenGL or OpenGL ES version like 2.7.
563 *
564 * Requesting a valid but unavailable OpenGL or OpenGL ES version will instead
565 * result in a @ref GLFW_VERSION_UNAVAILABLE error.
566 *
Camilla Berglund951a9582016-01-31 21:32:14 +0100567 * @analysis Application programmer error. Fix the offending call.
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100568 */
Camilla Berglund393e4392013-05-27 22:16:59 +0200569#define GLFW_INVALID_VALUE 0x00010004
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100570/*! @brief A memory allocation failed.
Camilla Berglund4591ad22014-09-18 15:03:29 +0200571 *
572 * A memory allocation failed.
573 *
Camilla Berglund951a9582016-01-31 21:32:14 +0100574 * @analysis A bug in GLFW or the underlying operating system. Report the bug
575 * to our [issue tracker](https://github.com/glfw/glfw/issues).
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100576 */
Camilla Berglund393e4392013-05-27 22:16:59 +0200577#define GLFW_OUT_OF_MEMORY 0x00010005
Camilla Berglund9b75bff2015-08-10 20:19:04 +0200578/*! @brief GLFW could not find support for the requested API on the system.
Camilla Berglund2d13eb02014-10-13 16:00:11 +0200579 *
Camilla Berglund9b75bff2015-08-10 20:19:04 +0200580 * GLFW could not find support for the requested API on the system.
Camilla Berglund2d13eb02014-10-13 16:00:11 +0200581 *
Camilla Berglund951a9582016-01-31 21:32:14 +0100582 * @analysis The installed graphics driver does not support the requested
Camilla Berglund9b75bff2015-08-10 20:19:04 +0200583 * API, or does not support it via the chosen context creation backend.
Camilla Berglund951a9582016-01-31 21:32:14 +0100584 * Below are a few examples.
Camilla Berglund2d13eb02014-10-13 16:00:11 +0200585 *
586 * @par
587 * Some pre-installed Windows graphics drivers do not support OpenGL. AMD only
Camilla Berglundd95b79f2015-03-30 23:20:49 +0200588 * supports OpenGL ES via EGL, while Nvidia and Intel only support it via
Camilla Berglund8d6f2652016-10-20 00:50:54 +0200589 * a WGL or GLX extension. macOS does not provide OpenGL ES at all. The Mesa
Camilla Berglund138feb82015-01-05 16:46:04 +0100590 * EGL, OpenGL and OpenGL ES libraries do not interface with the Nvidia binary
Camilla Berglund9b75bff2015-08-10 20:19:04 +0200591 * driver. Older graphics drivers do not support Vulkan.
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100592 */
Camilla Berglund393e4392013-05-27 22:16:59 +0200593#define GLFW_API_UNAVAILABLE 0x00010006
Camilla Berglund4591ad22014-09-18 15:03:29 +0200594/*! @brief The requested OpenGL or OpenGL ES version is not available.
595 *
Camilla Berglundd493a822015-03-10 19:51:14 +0100596 * The requested OpenGL or OpenGL ES version (including any requested context
597 * or framebuffer hints) is not available on this machine.
Camilla Berglund4591ad22014-09-18 15:03:29 +0200598 *
Camilla Berglund951a9582016-01-31 21:32:14 +0100599 * @analysis The machine does not support your requirements. If your
600 * application is sufficiently flexible, downgrade your requirements and try
601 * again. Otherwise, inform the user that their machine does not match your
Camilla Berglund4591ad22014-09-18 15:03:29 +0200602 * requirements.
603 *
Camilla Berglund2d13eb02014-10-13 16:00:11 +0200604 * @par
605 * Future invalid OpenGL and OpenGL ES versions, for example OpenGL 4.8 if 5.0
606 * comes out before the 4.x series gets that far, also fail with this error and
607 * not @ref GLFW_INVALID_VALUE, because GLFW cannot know what future versions
608 * will exist.
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100609 */
Camilla Berglund393e4392013-05-27 22:16:59 +0200610#define GLFW_VERSION_UNAVAILABLE 0x00010007
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100611/*! @brief A platform-specific error occurred that does not match any of the
612 * more specific categories.
Camilla Berglund4591ad22014-09-18 15:03:29 +0200613 *
614 * A platform-specific error occurred that does not match any of the more
615 * specific categories.
616 *
Camilla Berglund951a9582016-01-31 21:32:14 +0100617 * @analysis A bug or configuration error in GLFW, the underlying operating
618 * system or its drivers, or a lack of required resources. Report the issue to
619 * our [issue tracker](https://github.com/glfw/glfw/issues).
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100620 */
Camilla Berglund393e4392013-05-27 22:16:59 +0200621#define GLFW_PLATFORM_ERROR 0x00010008
Camilla Berglund2d13eb02014-10-13 16:00:11 +0200622/*! @brief The requested format is not supported or available.
623 *
624 * If emitted during window creation, the requested pixel format is not
625 * supported.
626 *
627 * If emitted when querying the clipboard, the contents of the clipboard could
628 * not be converted to the requested format.
629 *
Camilla Berglund951a9582016-01-31 21:32:14 +0100630 * @analysis If emitted during window creation, one or more
Camilla Berglund2d13eb02014-10-13 16:00:11 +0200631 * [hard constraints](@ref window_hints_hard) did not match any of the
632 * available pixel formats. If your application is sufficiently flexible,
633 * downgrade your requirements and try again. Otherwise, inform the user that
634 * their machine does not match your requirements.
635 *
636 * @par
637 * If emitted when querying the clipboard, ignore the error or report it to
638 * the user, as appropriate.
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100639 */
Camilla Berglund393e4392013-05-27 22:16:59 +0200640#define GLFW_FORMAT_UNAVAILABLE 0x00010009
Camilla Berglund496f5592015-06-18 14:03:02 +0200641/*! @brief The specified window does not have an OpenGL or OpenGL ES context.
642 *
643 * A window that does not have an OpenGL or OpenGL ES context was passed to
644 * a function that requires it to have one.
645 *
Camilla Berglund951a9582016-01-31 21:32:14 +0100646 * @analysis Application programmer error. Fix the offending call.
Camilla Berglund496f5592015-06-18 14:03:02 +0200647 */
648#define GLFW_NO_WINDOW_CONTEXT 0x0001000A
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100649/*! @} */
Camilla Berglund3249f812010-09-07 17:34:51 +0200650
Camilla Löwyce161c22016-12-06 01:14:23 +0100651/*! @addtogroup window
652 * @{ */
653/*! @brief Input focus window hint and attribute
654 *
655 * Input focus [window hint](@ref GLFW_FOCUSED_hint) or
656 * [window attribute](@ref GLFW_FOCUSED_attrib).
657 */
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100658#define GLFW_FOCUSED 0x00020001
Camilla Löwyce161c22016-12-06 01:14:23 +0100659/*! @brief Window iconification window attribute
660 *
661 * Window iconification [window attribute](@ref GLFW_ICONIFIED_attrib).
662 */
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100663#define GLFW_ICONIFIED 0x00020002
Camilla Löwyce161c22016-12-06 01:14:23 +0100664/*! @brief Window resize-ability window hint and attribute
665 *
Camilla Löwy831426c2016-12-08 17:08:36 +0100666 * Window resize-ability [window hint](@ref GLFW_RESIZABLE_hint) and
Camilla Löwyce161c22016-12-06 01:14:23 +0100667 * [window attribute](@ref GLFW_RESIZABLE_attrib).
668 */
Camilla Berglund393e4392013-05-27 22:16:59 +0200669#define GLFW_RESIZABLE 0x00020003
Camilla Löwyce161c22016-12-06 01:14:23 +0100670/*! @brief Window visibility window hint and attribute
671 *
Camilla Löwy831426c2016-12-08 17:08:36 +0100672 * Window visibility [window hint](@ref GLFW_VISIBLE_hint) and
Camilla Löwyce161c22016-12-06 01:14:23 +0100673 * [window attribute](@ref GLFW_VISIBLE_attrib).
674 */
Camilla Berglund393e4392013-05-27 22:16:59 +0200675#define GLFW_VISIBLE 0x00020004
Camilla Löwyce161c22016-12-06 01:14:23 +0100676/*! @brief Window decoration window hint and attribute
677 *
Camilla Löwy831426c2016-12-08 17:08:36 +0100678 * Window decoration [window hint](@ref GLFW_DECORATED_hint) and
Camilla Löwyce161c22016-12-06 01:14:23 +0100679 * [window attribute](@ref GLFW_DECORATED_attrib).
680 */
Camilla Berglund393e4392013-05-27 22:16:59 +0200681#define GLFW_DECORATED 0x00020005
Camilla Löwy9e560992016-09-30 01:52:22 +0200682/*! @brief Window auto-iconification window hint and attribute
Camilla Löwyce161c22016-12-06 01:14:23 +0100683 *
Camilla Löwy831426c2016-12-08 17:08:36 +0100684 * Window auto-iconification [window hint](@ref GLFW_AUTO_ICONIFY_hint) and
Camilla Löwy9e560992016-09-30 01:52:22 +0200685 * [window attribute](@ref GLFW_AUTO_ICONIFY_attrib).
Camilla Löwyce161c22016-12-06 01:14:23 +0100686 */
Camilla Berglund25e7ff12014-04-08 15:32:34 +0200687#define GLFW_AUTO_ICONIFY 0x00020006
Camilla Löwyce161c22016-12-06 01:14:23 +0100688/*! @brief Window decoration window hint and attribute
689 *
Camilla Löwy831426c2016-12-08 17:08:36 +0100690 * Window decoration [window hint](@ref GLFW_FLOATING_hint) and
Camilla Löwyce161c22016-12-06 01:14:23 +0100691 * [window attribute](@ref GLFW_FLOATING_attrib).
692 */
Camilla Berglund3ce7bfe2014-05-23 14:01:02 +0200693#define GLFW_FLOATING 0x00020007
Camilla Löwyce161c22016-12-06 01:14:23 +0100694/*! @brief Window maximization window hint and attribute
695 *
Camilla Löwy831426c2016-12-08 17:08:36 +0100696 * Window maximization [window hint](@ref GLFW_MAXIMIZED_hint) and
Camilla Löwyce161c22016-12-06 01:14:23 +0100697 * [window attribute](@ref GLFW_MAXIMIZED_attrib).
698 */
Camilla Berglunda10caa42015-10-13 12:50:59 +0200699#define GLFW_MAXIMIZED 0x00020008
Camilla Löwy5a74b502017-02-06 15:03:50 +0100700/*! @brief Cursor centering window hint
701 *
702 * Cursor centering [window hint](@ref GLFW_CENTER_CURSOR_hint).
703 */
Liam Middlebrook72ac5ba2016-08-18 11:47:54 -0400704#define GLFW_CENTER_CURSOR 0x00020009
Camilla Berglund2c091572010-09-09 21:09:11 +0200705
Camilla Löwyce161c22016-12-06 01:14:23 +0100706/*! @brief Framebuffer bit depth hint.
707 *
708 * Framebuffer bit depth [hint](@ref GLFW_RED_BITS).
709 */
Camilla Berglund53b39a62013-05-30 18:55:45 +0200710#define GLFW_RED_BITS 0x00021001
Camilla Löwyce161c22016-12-06 01:14:23 +0100711/*! @brief Framebuffer bit depth hint.
712 *
713 * Framebuffer bit depth [hint](@ref GLFW_GREEN_BITS).
714 */
Camilla Berglund53b39a62013-05-30 18:55:45 +0200715#define GLFW_GREEN_BITS 0x00021002
Camilla Löwyce161c22016-12-06 01:14:23 +0100716/*! @brief Framebuffer bit depth hint.
717 *
718 * Framebuffer bit depth [hint](@ref GLFW_BLUE_BITS).
719 */
Camilla Berglund53b39a62013-05-30 18:55:45 +0200720#define GLFW_BLUE_BITS 0x00021003
Camilla Löwyce161c22016-12-06 01:14:23 +0100721/*! @brief Framebuffer bit depth hint.
722 *
723 * Framebuffer bit depth [hint](@ref GLFW_ALPHA_BITS).
724 */
Camilla Berglund53b39a62013-05-30 18:55:45 +0200725#define GLFW_ALPHA_BITS 0x00021004
Camilla Löwyce161c22016-12-06 01:14:23 +0100726/*! @brief Framebuffer bit depth hint.
727 *
728 * Framebuffer bit depth [hint](@ref GLFW_DEPTH_BITS).
729 */
Camilla Berglund53b39a62013-05-30 18:55:45 +0200730#define GLFW_DEPTH_BITS 0x00021005
Camilla Löwyce161c22016-12-06 01:14:23 +0100731/*! @brief Framebuffer bit depth hint.
732 *
733 * Framebuffer bit depth [hint](@ref GLFW_STENCIL_BITS).
734 */
Camilla Berglund53b39a62013-05-30 18:55:45 +0200735#define GLFW_STENCIL_BITS 0x00021006
Camilla Löwyce161c22016-12-06 01:14:23 +0100736/*! @brief Framebuffer bit depth hint.
737 *
738 * Framebuffer bit depth [hint](@ref GLFW_ACCUM_RED_BITS).
739 */
Camilla Berglund53b39a62013-05-30 18:55:45 +0200740#define GLFW_ACCUM_RED_BITS 0x00021007
Camilla Löwyce161c22016-12-06 01:14:23 +0100741/*! @brief Framebuffer bit depth hint.
742 *
743 * Framebuffer bit depth [hint](@ref GLFW_ACCUM_GREEN_BITS).
744 */
Camilla Berglund53b39a62013-05-30 18:55:45 +0200745#define GLFW_ACCUM_GREEN_BITS 0x00021008
Camilla Löwyce161c22016-12-06 01:14:23 +0100746/*! @brief Framebuffer bit depth hint.
747 *
748 * Framebuffer bit depth [hint](@ref GLFW_ACCUM_BLUE_BITS).
749 */
Camilla Berglund53b39a62013-05-30 18:55:45 +0200750#define GLFW_ACCUM_BLUE_BITS 0x00021009
Camilla Löwyce161c22016-12-06 01:14:23 +0100751/*! @brief Framebuffer bit depth hint.
752 *
753 * Framebuffer bit depth [hint](@ref GLFW_ACCUM_ALPHA_BITS).
754 */
Camilla Berglund53b39a62013-05-30 18:55:45 +0200755#define GLFW_ACCUM_ALPHA_BITS 0x0002100A
Camilla Löwyce161c22016-12-06 01:14:23 +0100756/*! @brief Framebuffer auxiliary buffer hint.
757 *
758 * Framebuffer auxiliary buffer [hint](@ref GLFW_AUX_BUFFERS).
759 */
Camilla Berglund53b39a62013-05-30 18:55:45 +0200760#define GLFW_AUX_BUFFERS 0x0002100B
Camilla Löwyce161c22016-12-06 01:14:23 +0100761/*! @brief OpenGL stereoscopic rendering hint.
762 *
763 * OpenGL stereoscopic rendering [hint](@ref GLFW_STEREO).
764 */
Camilla Berglund53b39a62013-05-30 18:55:45 +0200765#define GLFW_STEREO 0x0002100C
Camilla Löwyce161c22016-12-06 01:14:23 +0100766/*! @brief Framebuffer MSAA samples hint.
767 *
768 * Framebuffer MSAA samples [hint](@ref GLFW_SAMPLES).
769 */
Camilla Berglund53b39a62013-05-30 18:55:45 +0200770#define GLFW_SAMPLES 0x0002100D
Camilla Löwyce161c22016-12-06 01:14:23 +0100771/*! @brief Framebuffer sRGB hint.
772 *
773 * Framebuffer sRGB [hint](@ref GLFW_SRGB_CAPABLE).
774 */
Camilla Berglund53b39a62013-05-30 18:55:45 +0200775#define GLFW_SRGB_CAPABLE 0x0002100E
Camilla Löwyce161c22016-12-06 01:14:23 +0100776/*! @brief Monitor refresh rate hint.
777 *
778 * Monitor refresh rate [hint](@ref GLFW_REFRESH_RATE).
779 */
Camilla Berglund2cd34382013-05-30 20:42:50 +0200780#define GLFW_REFRESH_RATE 0x0002100F
Camilla Löwyce161c22016-12-06 01:14:23 +0100781/*! @brief Framebuffer double buffering hint.
782 *
783 * Framebuffer double buffering [hint](@ref GLFW_DOUBLEBUFFER).
784 */
Camilla Berglundc9808582014-04-24 19:21:10 +0200785#define GLFW_DOUBLEBUFFER 0x00021010
Camilla Löwy831426c2016-12-08 17:08:36 +0100786/*! @brief Context client API hint and attribute.
787 *
788 * Context client API [hint](@ref GLFW_CLIENT_API_hint) and
789 * [attribute](@ref GLFW_CLIENT_API_attrib).
790 */
Camilla Berglund53b39a62013-05-30 18:55:45 +0200791#define GLFW_CLIENT_API 0x00022001
Camilla Löwy831426c2016-12-08 17:08:36 +0100792/*! @brief Context client API major version hint and attribute.
793 *
794 * Context client API major version [hint](@ref GLFW_CLIENT_API_hint) and
795 * [attribute](@ref GLFW_CLIENT_API_attrib).
796 */
Camilla Berglund53b39a62013-05-30 18:55:45 +0200797#define GLFW_CONTEXT_VERSION_MAJOR 0x00022002
Camilla Löwy831426c2016-12-08 17:08:36 +0100798/*! @brief Context client API minor version hint and attribute.
799 *
800 * Context client API minor version [hint](@ref GLFW_CLIENT_API_hint) and
801 * [attribute](@ref GLFW_CLIENT_API_attrib).
802 */
Camilla Berglund53b39a62013-05-30 18:55:45 +0200803#define GLFW_CONTEXT_VERSION_MINOR 0x00022003
Camilla Löwy831426c2016-12-08 17:08:36 +0100804/*! @brief Context client API revision number hint and attribute.
805 *
806 * Context client API revision number [hint](@ref GLFW_CLIENT_API_hint) and
807 * [attribute](@ref GLFW_CLIENT_API_attrib).
808 */
Camilla Berglund53b39a62013-05-30 18:55:45 +0200809#define GLFW_CONTEXT_REVISION 0x00022004
Camilla Löwy831426c2016-12-08 17:08:36 +0100810/*! @brief Context robustness hint and attribute.
811 *
812 * Context client API revision number [hint](@ref GLFW_CLIENT_API_hint) and
813 * [attribute](@ref GLFW_CLIENT_API_attrib).
814 */
Camilla Berglund53b39a62013-05-30 18:55:45 +0200815#define GLFW_CONTEXT_ROBUSTNESS 0x00022005
Camilla Löwy831426c2016-12-08 17:08:36 +0100816/*! @brief OpenGL forward-compatibility hint and attribute.
817 *
818 * OpenGL forward-compatibility [hint](@ref GLFW_CLIENT_API_hint) and
819 * [attribute](@ref GLFW_CLIENT_API_attrib).
820 */
Camilla Berglund53b39a62013-05-30 18:55:45 +0200821#define GLFW_OPENGL_FORWARD_COMPAT 0x00022006
Camilla Löwy831426c2016-12-08 17:08:36 +0100822/*! @brief OpenGL debug context hint and attribute.
823 *
824 * OpenGL debug context [hint](@ref GLFW_CLIENT_API_hint) and
825 * [attribute](@ref GLFW_CLIENT_API_attrib).
826 */
Camilla Berglund53b39a62013-05-30 18:55:45 +0200827#define GLFW_OPENGL_DEBUG_CONTEXT 0x00022007
Camilla Löwy831426c2016-12-08 17:08:36 +0100828/*! @brief OpenGL profile hint and attribute.
829 *
830 * OpenGL profile [hint](@ref GLFW_CLIENT_API_hint) and
831 * [attribute](@ref GLFW_CLIENT_API_attrib).
832 */
Camilla Berglund53b39a62013-05-30 18:55:45 +0200833#define GLFW_OPENGL_PROFILE 0x00022008
Camilla Löwy831426c2016-12-08 17:08:36 +0100834/*! @brief Context flush-on-release hint and attribute.
835 *
836 * Context flush-on-release [hint](@ref GLFW_CLIENT_API_hint) and
837 * [attribute](@ref GLFW_CLIENT_API_attrib).
838 */
Camilla Berglund44c899c2014-08-21 19:21:45 +0200839#define GLFW_CONTEXT_RELEASE_BEHAVIOR 0x00022009
Camilla Löwy831426c2016-12-08 17:08:36 +0100840/*! @brief Context error suppression hint and attribute.
841 *
842 * Context error suppression [hint](@ref GLFW_CLIENT_API_hint) and
843 * [attribute](@ref GLFW_CLIENT_API_attrib).
844 */
Camilla Berglund7be82092015-08-10 12:46:14 +0200845#define GLFW_CONTEXT_NO_ERROR 0x0002200A
Camilla Löwy831426c2016-12-08 17:08:36 +0100846/*! @brief Context creation API hint and attribute.
847 *
848 * Context creation API [hint](@ref GLFW_CLIENT_API_hint) and
849 * [attribute](@ref GLFW_CLIENT_API_attrib).
850 */
Camilla Berglundef80bea2016-03-28 13:19:31 +0200851#define GLFW_CONTEXT_CREATION_API 0x0002200B
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100852
Camilla Löwy58ceab52016-12-07 00:41:54 +0100853#define GLFW_COCOA_RETINA_FRAMEBUFFER 0x00023001
Camilla Löwy46613152017-01-01 19:41:50 +0100854#define GLFW_COCOA_FRAME_AUTOSAVE 0x00023002
Camilla Löwy77a8f102017-01-27 12:02:09 +0100855#define GLFW_COCOA_GRAPHICS_SWITCHING 0x00023003
Camilla Löwy831426c2016-12-08 17:08:36 +0100856/*! @} */
Camilla Löwy58ceab52016-12-07 00:41:54 +0100857
Camilla Berglund496f5592015-06-18 14:03:02 +0200858#define GLFW_NO_API 0
Camilla Berglund393e4392013-05-27 22:16:59 +0200859#define GLFW_OPENGL_API 0x00030001
860#define GLFW_OPENGL_ES_API 0x00030002
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100861
Camilla Berglund393e4392013-05-27 22:16:59 +0200862#define GLFW_NO_ROBUSTNESS 0
863#define GLFW_NO_RESET_NOTIFICATION 0x00031001
864#define GLFW_LOSE_CONTEXT_ON_RESET 0x00031002
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100865
Camilla Berglund44e84012013-06-05 16:13:30 +0200866#define GLFW_OPENGL_ANY_PROFILE 0
Camilla Berglund393e4392013-05-27 22:16:59 +0200867#define GLFW_OPENGL_CORE_PROFILE 0x00032001
868#define GLFW_OPENGL_COMPAT_PROFILE 0x00032002
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100869
Camilla Berglund393e4392013-05-27 22:16:59 +0200870#define GLFW_CURSOR 0x00033001
871#define GLFW_STICKY_KEYS 0x00033002
872#define GLFW_STICKY_MOUSE_BUTTONS 0x00033003
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100873
Camilla Berglund393e4392013-05-27 22:16:59 +0200874#define GLFW_CURSOR_NORMAL 0x00034001
875#define GLFW_CURSOR_HIDDEN 0x00034002
876#define GLFW_CURSOR_DISABLED 0x00034003
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100877
Camilla Berglund44c899c2014-08-21 19:21:45 +0200878#define GLFW_ANY_RELEASE_BEHAVIOR 0
879#define GLFW_RELEASE_BEHAVIOR_FLUSH 0x00035001
880#define GLFW_RELEASE_BEHAVIOR_NONE 0x00035002
881
Camilla Berglundef80bea2016-03-28 13:19:31 +0200882#define GLFW_NATIVE_CONTEXT_API 0x00036001
883#define GLFW_EGL_CONTEXT_API 0x00036002
Camilla Löwye9560ef2017-02-28 19:23:25 +0100884#define GLFW_OSMESA_CONTEXT_API 0x00036003
Camilla Berglundef80bea2016-03-28 13:19:31 +0200885
Camilla Berglund2a1375e2014-09-02 16:52:16 +0200886/*! @defgroup shapes Standard cursor shapes
Camilla Löwy21eabd32017-02-06 17:31:25 +0100887 * @brief Standard system cursor shapes.
Camilla Berglund4188c262015-01-18 01:55:25 +0100888 *
889 * See [standard cursor creation](@ref cursor_standard) for how these are used.
890 *
Camilla Berglund2a1375e2014-09-02 16:52:16 +0200891 * @ingroup input
892 * @{ */
893
894/*! @brief The regular arrow cursor shape.
895 *
896 * The regular arrow cursor.
897 */
898#define GLFW_ARROW_CURSOR 0x00036001
899/*! @brief The text input I-beam cursor shape.
900 *
901 * The text input I-beam cursor shape.
902 */
903#define GLFW_IBEAM_CURSOR 0x00036002
904/*! @brief The crosshair shape.
905 *
906 * The crosshair shape.
907 */
908#define GLFW_CROSSHAIR_CURSOR 0x00036003
909/*! @brief The hand shape.
910 *
911 * The hand shape.
912 */
913#define GLFW_HAND_CURSOR 0x00036004
914/*! @brief The horizontal resize arrow shape.
915 *
916 * The horizontal resize arrow shape.
917 */
918#define GLFW_HRESIZE_CURSOR 0x00036005
919/*! @brief The vertical resize arrow shape.
920 *
921 * The vertical resize arrow shape.
922 */
923#define GLFW_VRESIZE_CURSOR 0x00036006
924/*! @} */
925
Camilla Berglund393e4392013-05-27 22:16:59 +0200926#define GLFW_CONNECTED 0x00040001
927#define GLFW_DISCONNECTED 0x00040002
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100928
Camilla Löwy6d9a58b2017-02-14 15:43:31 +0100929/*! @addtogroup init
930 * @{ */
931#define GLFW_COCOA_CHDIR_RESOURCES 0x00051001
932#define GLFW_COCOA_MENUBAR 0x00051002
933/*! @} */
934
Camilla Berglund28101302014-04-08 18:57:43 +0200935#define GLFW_DONT_CARE -1
936
Camilla Berglund97387282011-10-06 23:28:56 +0200937
Camilla Berglund3249f812010-09-07 17:34:51 +0200938/*************************************************************************
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100939 * GLFW API types
Camilla Berglund3249f812010-09-07 17:34:51 +0200940 *************************************************************************/
941
Camilla Berglund3f5843f2012-12-13 02:22:39 +0100942/*! @brief Client API function pointer type.
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200943 *
944 * Generic function pointer used for returning client API function pointers
945 * without forcing a cast from a regular pointer.
946 *
Camilla Berglundbce20c32015-11-05 13:58:52 +0100947 * @sa @ref context_glext
Camilla Berglund7e9e3212016-09-14 20:17:26 +0200948 * @sa @ref glfwGetProcAddress
Camilla Berglundbce20c32015-11-05 13:58:52 +0100949 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +0100950 * @since Added in version 3.0.
951
Camilla Berglund3f5843f2012-12-13 02:22:39 +0100952 * @ingroup context
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100953 */
Camilla Berglundbf42c3c2012-06-05 00:16:40 +0200954typedef void (*GLFWglproc)(void);
955
Camilla Berglund9b75bff2015-08-10 20:19:04 +0200956/*! @brief Vulkan API function pointer type.
957 *
958 * Generic function pointer used for returning Vulkan API function pointers
959 * without forcing a cast from a regular pointer.
960 *
961 * @sa @ref vulkan_proc
Camilla Berglund7e9e3212016-09-14 20:17:26 +0200962 * @sa @ref glfwGetInstanceProcAddress
Camilla Berglund9b75bff2015-08-10 20:19:04 +0200963 *
964 * @since Added in version 3.2.
965 *
966 * @ingroup vulkan
967 */
968typedef void (*GLFWvkproc)(void);
969
Camilla Berglunddba2d802013-01-17 23:06:56 +0100970/*! @brief Opaque monitor object.
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200971 *
972 * Opaque monitor object.
973 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +0100974 * @see @ref monitor_object
975 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +0100976 * @since Added in version 3.0.
Camilla Berglund810bab72015-12-13 17:38:14 +0100977 *
Camilla Berglund41bc0d12012-11-27 16:55:04 +0100978 * @ingroup monitor
979 */
Camilla Berglund9af960e2013-01-05 21:13:28 +0100980typedef struct GLFWmonitor GLFWmonitor;
Camilla Berglunde0ce9202012-08-29 20:39:05 +0200981
Camilla Berglunddba2d802013-01-17 23:06:56 +0100982/*! @brief Opaque window object.
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200983 *
984 * Opaque window object.
985 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +0100986 * @see @ref window_object
987 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +0100988 * @since Added in version 3.0.
Camilla Berglund810bab72015-12-13 17:38:14 +0100989 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100990 * @ingroup window
991 */
Camilla Berglund9af960e2013-01-05 21:13:28 +0100992typedef struct GLFWwindow GLFWwindow;
Camilla Berglund135194a2010-09-09 18:15:32 +0200993
urraka40c04a72013-12-04 10:19:22 -0300994/*! @brief Opaque cursor object.
995 *
996 * Opaque cursor object.
997 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +0100998 * @see @ref cursor_object
999 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001000 * @since Added in version 3.1.
Camilla Berglund810bab72015-12-13 17:38:14 +01001001 *
urraka40c04a72013-12-04 10:19:22 -03001002 * @ingroup cursor
1003 */
1004typedef struct GLFWcursor GLFWcursor;
1005
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001006/*! @brief The function signature for error callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001007 *
1008 * This is the function signature for error callback functions.
1009 *
Camilla Berglund71d2b572013-03-12 15:33:05 +01001010 * @param[in] error An [error code](@ref errors).
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001011 * @param[in] description A UTF-8 encoded string describing the error.
Camilla Berglunddba2d802013-01-17 23:06:56 +01001012 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +01001013 * @sa @ref error_handling
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001014 * @sa @ref glfwSetErrorCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +01001015 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001016 * @since Added in version 3.0.
Camilla Berglund810bab72015-12-13 17:38:14 +01001017 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001018 * @ingroup init
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001019 */
Camilla Berglund897558f2011-03-07 13:34:58 +01001020typedef void (* GLFWerrorfun)(int,const char*);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001021
Camilla Berglund1a3d47d2012-11-30 13:56:42 +01001022/*! @brief The function signature for window position callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001023 *
1024 * This is the function signature for window position callback functions.
1025 *
Camilla Berglunde8e05d42014-04-23 13:30:11 +02001026 * @param[in] window The window that was moved.
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001027 * @param[in] xpos The new x-coordinate, in screen coordinates, of the
1028 * upper-left corner of the client area of the window.
1029 * @param[in] ypos The new y-coordinate, in screen coordinates, of the
1030 * upper-left corner of the client area of the window.
Camilla Berglunddba2d802013-01-17 23:06:56 +01001031 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +01001032 * @sa @ref window_pos
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001033 * @sa @ref glfwSetWindowPosCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +01001034 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001035 * @since Added in version 3.0.
Camilla Berglund810bab72015-12-13 17:38:14 +01001036 *
Camilla Berglunde248fb62013-03-29 14:06:23 +01001037 * @ingroup window
Camilla Berglund1a3d47d2012-11-30 13:56:42 +01001038 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001039typedef void (* GLFWwindowposfun)(GLFWwindow*,int,int);
Camilla Berglund1a3d47d2012-11-30 13:56:42 +01001040
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001041/*! @brief The function signature for window resize callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001042 *
1043 * This is the function signature for window size callback functions.
1044 *
Camilla Berglunde8e05d42014-04-23 13:30:11 +02001045 * @param[in] window The window that was resized.
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001046 * @param[in] width The new width, in screen coordinates, of the window.
1047 * @param[in] height The new height, in screen coordinates, of the window.
Camilla Berglunddba2d802013-01-17 23:06:56 +01001048 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +01001049 * @sa @ref window_size
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001050 * @sa @ref glfwSetWindowSizeCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +01001051 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001052 * @since Added in version 1.0.
1053 * @glfw3 Added window handle parameter.
Camilla Berglund810bab72015-12-13 17:38:14 +01001054 *
Camilla Berglunde248fb62013-03-29 14:06:23 +01001055 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001056 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001057typedef void (* GLFWwindowsizefun)(GLFWwindow*,int,int);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001058
1059/*! @brief The function signature for window close callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001060 *
1061 * This is the function signature for window close callback functions.
1062 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001063 * @param[in] window The window that the user attempted to close.
Camilla Berglunddba2d802013-01-17 23:06:56 +01001064 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +01001065 * @sa @ref window_close
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001066 * @sa @ref glfwSetWindowCloseCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +01001067 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001068 * @since Added in version 2.5.
1069 * @glfw3 Added window handle parameter.
Camilla Berglund810bab72015-12-13 17:38:14 +01001070 *
Camilla Berglunde248fb62013-03-29 14:06:23 +01001071 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001072 */
Camilla Berglund64afb192013-03-06 23:29:37 +01001073typedef void (* GLFWwindowclosefun)(GLFWwindow*);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001074
1075/*! @brief The function signature for window content refresh callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001076 *
1077 * This is the function signature for window refresh callback functions.
1078 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001079 * @param[in] window The window whose content needs to be refreshed.
Camilla Berglunddba2d802013-01-17 23:06:56 +01001080 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +01001081 * @sa @ref window_refresh
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001082 * @sa @ref glfwSetWindowRefreshCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +01001083 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001084 * @since Added in version 2.5.
1085 * @glfw3 Added window handle parameter.
Camilla Berglund810bab72015-12-13 17:38:14 +01001086 *
Camilla Berglunde248fb62013-03-29 14:06:23 +01001087 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001088 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001089typedef void (* GLFWwindowrefreshfun)(GLFWwindow*);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001090
1091/*! @brief The function signature for window focus/defocus callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001092 *
1093 * This is the function signature for window focus callback functions.
1094 *
Camilla Berglund4188c262015-01-18 01:55:25 +01001095 * @param[in] window The window that gained or lost input focus.
Camilla Berglund0eccf752015-08-23 19:30:04 +02001096 * @param[in] focused `GLFW_TRUE` if the window was given input focus, or
1097 * `GLFW_FALSE` if it lost it.
Camilla Berglunddba2d802013-01-17 23:06:56 +01001098 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +01001099 * @sa @ref window_focus
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001100 * @sa @ref glfwSetWindowFocusCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +01001101 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001102 * @since Added in version 3.0.
Camilla Berglund810bab72015-12-13 17:38:14 +01001103 *
Camilla Berglunde248fb62013-03-29 14:06:23 +01001104 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001105 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001106typedef void (* GLFWwindowfocusfun)(GLFWwindow*,int);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001107
Camilla Berglund06e7a962012-11-22 19:14:27 +01001108/*! @brief The function signature for window iconify/restore callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001109 *
1110 * This is the function signature for window iconify/restore callback
1111 * functions.
1112 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001113 * @param[in] window The window that was iconified or restored.
Camilla Berglund0eccf752015-08-23 19:30:04 +02001114 * @param[in] iconified `GLFW_TRUE` if the window was iconified, or
1115 * `GLFW_FALSE` if it was restored.
Camilla Berglunddba2d802013-01-17 23:06:56 +01001116 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +01001117 * @sa @ref window_iconify
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001118 * @sa @ref glfwSetWindowIconifyCallback
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 window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001123 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001124typedef void (* GLFWwindowiconifyfun)(GLFWwindow*,int);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001125
Camilla Berglundc156b502016-06-16 13:09:28 +02001126/*! @brief The function signature for window maximize/restore callbacks.
1127 *
1128 * This is the function signature for window maximize/restore callback
1129 * functions.
1130 *
1131 * @param[in] window The window that was maximized or restored.
1132 * @param[in] iconified `GLFW_TRUE` if the window was maximized, or
1133 * `GLFW_FALSE` if it was restored.
1134 *
1135 * @sa @ref window_maximize
1136 * @sa glfwSetWindowMaximizeCallback
1137 *
1138 * @since Added in version 3.3.
1139 *
1140 * @ingroup window
1141 */
1142typedef void (* GLFWwindowmaximizefun)(GLFWwindow*,int);
1143
Camilla Berglund34981632013-06-03 12:51:57 +02001144/*! @brief The function signature for framebuffer resize callbacks.
1145 *
1146 * This is the function signature for framebuffer resize callback
1147 * functions.
1148 *
1149 * @param[in] window The window whose framebuffer was resized.
1150 * @param[in] width The new width, in pixels, of the framebuffer.
1151 * @param[in] height The new height, in pixels, of the framebuffer.
1152 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +01001153 * @sa @ref window_fbsize
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001154 * @sa @ref glfwSetFramebufferSizeCallback
Camilla Berglund34981632013-06-03 12:51:57 +02001155 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001156 * @since Added in version 3.0.
Camilla Berglund810bab72015-12-13 17:38:14 +01001157 *
Camilla Berglund34981632013-06-03 12:51:57 +02001158 * @ingroup window
1159 */
1160typedef void (* GLFWframebuffersizefun)(GLFWwindow*,int,int);
1161
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001162/*! @brief The function signature for mouse button callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001163 *
1164 * This is the function signature for mouse button callback functions.
1165 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001166 * @param[in] window The window that received the event.
Camilla Berglund71d2b572013-03-12 15:33:05 +01001167 * @param[in] button The [mouse button](@ref buttons) that was pressed or
1168 * released.
1169 * @param[in] action One of `GLFW_PRESS` or `GLFW_RELEASE`.
Camilla Berglund98cbf6f2013-05-23 14:42:33 +02001170 * @param[in] mods Bit field describing which [modifier keys](@ref mods) were
1171 * held down.
Camilla Berglunddba2d802013-01-17 23:06:56 +01001172 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +01001173 * @sa @ref input_mouse_button
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001174 * @sa @ref glfwSetMouseButtonCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +01001175 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001176 * @since Added in version 1.0.
1177 * @glfw3 Added window handle and modifier mask parameters.
Camilla Berglund810bab72015-12-13 17:38:14 +01001178 *
Camilla Berglunde248fb62013-03-29 14:06:23 +01001179 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001180 */
Camilla Berglund2d1b8352012-12-09 19:19:00 +01001181typedef void (* GLFWmousebuttonfun)(GLFWwindow*,int,int,int);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001182
1183/*! @brief The function signature for cursor position callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001184 *
1185 * This is the function signature for cursor position callback functions.
1186 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001187 * @param[in] window The window that received the event.
Camilla Berglund95c44ab2016-02-17 14:52:01 +01001188 * @param[in] xpos The new cursor x-coordinate, relative to the left edge of
1189 * the client area.
1190 * @param[in] ypos The new cursor y-coordinate, relative to the top edge of the
1191 * client area.
Camilla Berglunddba2d802013-01-17 23:06:56 +01001192 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +01001193 * @sa @ref cursor_pos
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001194 * @sa @ref glfwSetCursorPosCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +01001195 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001196 * @since Added in version 3.0. Replaces `GLFWmouseposfun`.
Camilla Berglund810bab72015-12-13 17:38:14 +01001197 *
Camilla Berglunde248fb62013-03-29 14:06:23 +01001198 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001199 */
Camilla Berglund129e94d2013-04-04 16:16:21 +02001200typedef void (* GLFWcursorposfun)(GLFWwindow*,double,double);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001201
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001202/*! @brief The function signature for cursor enter/leave callbacks.
1203 *
1204 * This is the function signature for cursor enter/leave callback functions.
1205 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001206 * @param[in] window The window that received the event.
Camilla Berglund0eccf752015-08-23 19:30:04 +02001207 * @param[in] entered `GLFW_TRUE` if the cursor entered the window's client
1208 * area, or `GLFW_FALSE` if it left it.
Camilla Berglunddba2d802013-01-17 23:06:56 +01001209 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +01001210 * @sa @ref cursor_enter
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001211 * @sa @ref glfwSetCursorEnterCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +01001212 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001213 * @since Added in version 3.0.
Camilla Berglund810bab72015-12-13 17:38:14 +01001214 *
Camilla Berglunde248fb62013-03-29 14:06:23 +01001215 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001216 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001217typedef void (* GLFWcursorenterfun)(GLFWwindow*,int);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001218
1219/*! @brief The function signature for scroll callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001220 *
1221 * This is the function signature for scroll callback functions.
1222 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001223 * @param[in] window The window that received the event.
mewmewcf2d2602013-06-06 19:49:23 +02001224 * @param[in] xoffset The scroll offset along the x-axis.
1225 * @param[in] yoffset The scroll offset along the y-axis.
Camilla Berglunddba2d802013-01-17 23:06:56 +01001226 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +01001227 * @sa @ref scrolling
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001228 * @sa @ref glfwSetScrollCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +01001229 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001230 * @since Added in version 3.0. Replaces `GLFWmousewheelfun`.
Camilla Berglund810bab72015-12-13 17:38:14 +01001231 *
Camilla Berglunde248fb62013-03-29 14:06:23 +01001232 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001233 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001234typedef void (* GLFWscrollfun)(GLFWwindow*,double,double);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001235
1236/*! @brief The function signature for keyboard key callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001237 *
1238 * This is the function signature for keyboard key callback functions.
1239 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001240 * @param[in] window The window that received the event.
Camilla Berglund71d2b572013-03-12 15:33:05 +01001241 * @param[in] key The [keyboard key](@ref keys) that was pressed or released.
Camilla Berglund11615fc2013-05-30 17:19:12 +02001242 * @param[in] scancode The system-specific scancode of the key.
Camilla Berglund95654cf2014-10-02 17:35:10 +02001243 * @param[in] action `GLFW_PRESS`, `GLFW_RELEASE` or `GLFW_REPEAT`.
Camilla Berglund98cbf6f2013-05-23 14:42:33 +02001244 * @param[in] mods Bit field describing which [modifier keys](@ref mods) were
1245 * held down.
Camilla Berglunddba2d802013-01-17 23:06:56 +01001246 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +01001247 * @sa @ref input_key
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001248 * @sa @ref glfwSetKeyCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +01001249 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001250 * @since Added in version 1.0.
1251 * @glfw3 Added window handle, scancode and modifier mask parameters.
Camilla Berglund810bab72015-12-13 17:38:14 +01001252 *
Camilla Berglunde248fb62013-03-29 14:06:23 +01001253 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001254 */
Camilla Berglund11615fc2013-05-30 17:19:12 +02001255typedef void (* GLFWkeyfun)(GLFWwindow*,int,int,int,int);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001256
1257/*! @brief The function signature for Unicode character callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001258 *
1259 * This is the function signature for Unicode character callback functions.
1260 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001261 * @param[in] window The window that received the event.
Camilla Berglund2c920fb2013-10-10 19:41:56 +02001262 * @param[in] codepoint The Unicode code point of the character.
Camilla Berglunddba2d802013-01-17 23:06:56 +01001263 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +01001264 * @sa @ref input_char
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001265 * @sa @ref glfwSetCharCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +01001266 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001267 * @since Added in version 2.4.
1268 * @glfw3 Added window handle parameter.
Camilla Berglund810bab72015-12-13 17:38:14 +01001269 *
Camilla Berglunde248fb62013-03-29 14:06:23 +01001270 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001271 */
Camilla Berglund182e0af2013-02-25 17:02:28 +01001272typedef void (* GLFWcharfun)(GLFWwindow*,unsigned int);
Camilla Berglund5f68e122012-11-27 17:07:28 +01001273
Camilla Berglund96b12ee2014-06-12 23:04:20 +02001274/*! @brief The function signature for Unicode character with modifiers
1275 * callbacks.
1276 *
1277 * This is the function signature for Unicode character with modifiers callback
1278 * functions. It is called for each input character, regardless of what
1279 * modifier keys are held down.
1280 *
1281 * @param[in] window The window that received the event.
1282 * @param[in] codepoint The Unicode code point of the character.
1283 * @param[in] mods Bit field describing which [modifier keys](@ref mods) were
1284 * held down.
1285 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +01001286 * @sa @ref input_char
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001287 * @sa @ref glfwSetCharModsCallback
Camilla Berglund96b12ee2014-06-12 23:04:20 +02001288 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001289 * @since Added in version 3.1.
Camilla Berglund810bab72015-12-13 17:38:14 +01001290 *
Camilla Berglund96b12ee2014-06-12 23:04:20 +02001291 * @ingroup input
1292 */
1293typedef void (* GLFWcharmodsfun)(GLFWwindow*,unsigned int,int);
1294
Camilla Berglund5c8121e2014-03-29 21:35:21 +01001295/*! @brief The function signature for file drop callbacks.
arturo89d07232013-07-10 11:42:14 +02001296 *
Camilla Berglund5c8121e2014-03-29 21:35:21 +01001297 * This is the function signature for file drop callbacks.
arturo89d07232013-07-10 11:42:14 +02001298 *
1299 * @param[in] window The window that received the event.
Camilla Berglund5c8121e2014-03-29 21:35:21 +01001300 * @param[in] count The number of dropped files.
Camilla Berglund93855ae2015-01-27 23:04:22 +01001301 * @param[in] paths The UTF-8 encoded file and/or directory path names.
arturo89d07232013-07-10 11:42:14 +02001302 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +01001303 * @sa @ref path_drop
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001304 * @sa @ref glfwSetDropCallback
arturo89d07232013-07-10 11:42:14 +02001305 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001306 * @since Added in version 3.1.
Camilla Berglund810bab72015-12-13 17:38:14 +01001307 *
arturo89d07232013-07-10 11:42:14 +02001308 * @ingroup input
1309 */
Camilla Berglund8f349e82013-12-22 19:28:46 +01001310typedef void (* GLFWdropfun)(GLFWwindow*,int,const char**);
arturo89d07232013-07-10 11:42:14 +02001311
Camilla Berglund5f68e122012-11-27 17:07:28 +01001312/*! @brief The function signature for monitor configuration callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001313 *
1314 * This is the function signature for monitor configuration callback functions.
1315 *
Camilla Berglund5f68e122012-11-27 17:07:28 +01001316 * @param[in] monitor The monitor that was connected or disconnected.
Camilla Berglund71d2b572013-03-12 15:33:05 +01001317 * @param[in] event One of `GLFW_CONNECTED` or `GLFW_DISCONNECTED`.
Camilla Berglunddba2d802013-01-17 23:06:56 +01001318 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +01001319 * @sa @ref monitor_event
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001320 * @sa @ref glfwSetMonitorCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +01001321 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001322 * @since Added in version 3.0.
Camilla Berglund810bab72015-12-13 17:38:14 +01001323 *
Camilla Berglunde248fb62013-03-29 14:06:23 +01001324 * @ingroup monitor
Camilla Berglund5f68e122012-11-27 17:07:28 +01001325 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001326typedef void (* GLFWmonitorfun)(GLFWmonitor*,int);
Camilla Berglund897558f2011-03-07 13:34:58 +01001327
Camilla Berglund8a7fa302015-12-13 17:38:50 +01001328/*! @brief The function signature for joystick configuration callbacks.
1329 *
1330 * This is the function signature for joystick configuration callback
1331 * functions.
1332 *
Camilla Berglundefc6b352016-10-10 03:24:07 +02001333 * @param[in] jid The joystick that was connected or disconnected.
Camilla Berglund8a7fa302015-12-13 17:38:50 +01001334 * @param[in] event One of `GLFW_CONNECTED` or `GLFW_DISCONNECTED`.
1335 *
1336 * @sa @ref joystick_event
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001337 * @sa @ref glfwSetJoystickCallback
Camilla Berglund8a7fa302015-12-13 17:38:50 +01001338 *
1339 * @since Added in version 3.2.
1340 *
1341 * @ingroup input
1342 */
1343typedef void (* GLFWjoystickfun)(int,int);
1344
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001345/*! @brief Video mode type.
1346 *
1347 * This describes a single video mode.
1348 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +01001349 * @sa @ref monitor_modes
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001350 * @sa @ref glfwGetVideoMode
1351 * @sa @ref glfwGetVideoModes
Camilla Berglund9d71eb42015-11-05 09:24:16 +01001352 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001353 * @since Added in version 1.0.
1354 * @glfw3 Added refresh rate member.
Camilla Berglund810bab72015-12-13 17:38:14 +01001355 *
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001356 * @ingroup monitor
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001357 */
Systemclusterd0a0e372013-08-29 06:15:55 +02001358typedef struct GLFWvidmode
Camilla Berglund5fd3fc72010-09-09 19:44:43 +02001359{
Camilla Berglund95835af2013-05-30 13:53:25 +02001360 /*! The width, in screen coordinates, of the video mode.
Camilla Berglundc1594112013-05-27 22:29:06 +02001361 */
Camilla Berglund5fd3fc72010-09-09 19:44:43 +02001362 int width;
Camilla Berglund95835af2013-05-30 13:53:25 +02001363 /*! The height, in screen coordinates, of the video mode.
Camilla Berglundc1594112013-05-27 22:29:06 +02001364 */
Camilla Berglund5fd3fc72010-09-09 19:44:43 +02001365 int height;
Camilla Berglundc1594112013-05-27 22:29:06 +02001366 /*! The bit depth of the red channel of the video mode.
1367 */
Camilla Berglund5fd3fc72010-09-09 19:44:43 +02001368 int redBits;
Camilla Berglundc1594112013-05-27 22:29:06 +02001369 /*! The bit depth of the green channel of the video mode.
1370 */
Camilla Berglund5fd3fc72010-09-09 19:44:43 +02001371 int greenBits;
Camilla Berglundc1594112013-05-27 22:29:06 +02001372 /*! The bit depth of the blue channel of the video mode.
1373 */
Camilla Berglund2e8446f2013-04-11 01:31:00 +02001374 int blueBits;
Camilla Berglund731812c2013-05-30 15:52:42 +02001375 /*! The refresh rate, in Hz, of the video mode.
1376 */
1377 int refreshRate;
Camilla Berglund3249f812010-09-07 17:34:51 +02001378} GLFWvidmode;
1379
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001380/*! @brief Gamma ramp.
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001381 *
1382 * This describes the gamma ramp for a monitor.
1383 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +01001384 * @sa @ref monitor_gamma
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001385 * @sa @ref glfwGetGammaRamp
1386 * @sa @ref glfwSetGammaRamp
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001387 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001388 * @since Added in version 3.0.
Camilla Berglund810bab72015-12-13 17:38:14 +01001389 *
Camilla Berglundf5f55e32013-06-17 12:56:36 +02001390 * @ingroup monitor
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001391 */
Systemclusterd0a0e372013-08-29 06:15:55 +02001392typedef struct GLFWgammaramp
Camilla Berglund2630d492010-10-13 04:04:43 +02001393{
Camilla Berglundc1594112013-05-27 22:29:06 +02001394 /*! An array of value describing the response of the red channel.
1395 */
Camilla Berglund5d308db2013-05-19 15:46:44 +02001396 unsigned short* red;
Camilla Berglundc1594112013-05-27 22:29:06 +02001397 /*! An array of value describing the response of the green channel.
1398 */
Camilla Berglund5d308db2013-05-19 15:46:44 +02001399 unsigned short* green;
Camilla Berglundc1594112013-05-27 22:29:06 +02001400 /*! An array of value describing the response of the blue channel.
1401 */
Camilla Berglund5d308db2013-05-19 15:46:44 +02001402 unsigned short* blue;
Camilla Berglundc1594112013-05-27 22:29:06 +02001403 /*! The number of elements in each array.
1404 */
Camilla Berglund5d308db2013-05-19 15:46:44 +02001405 unsigned int size;
Camilla Berglund2630d492010-10-13 04:04:43 +02001406} GLFWgammaramp;
1407
Camilla Berglund8fa9cc02014-02-23 16:43:17 +01001408/*! @brief Image data.
Camilla Berglund9d71eb42015-11-05 09:24:16 +01001409 *
1410 * @sa @ref cursor_custom
Camilla Berglundfe0317a2016-08-01 11:51:30 +02001411 * @sa @ref window_icon
Camilla Berglund810bab72015-12-13 17:38:14 +01001412 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001413 * @since Added in version 2.1.
1414 * @glfw3 Removed format and bytes-per-pixel members.
Camilla Berglund8fa9cc02014-02-23 16:43:17 +01001415 */
1416typedef struct GLFWimage
1417{
1418 /*! The width, in pixels, of this image.
1419 */
1420 int width;
1421 /*! The height, in pixels, of this image.
1422 */
1423 int height;
1424 /*! The pixel data of this image, arranged left-to-right, top-to-bottom.
1425 */
1426 unsigned char* pixels;
1427} GLFWimage;
1428
Camilla Berglund3249f812010-09-07 17:34:51 +02001429
1430/*************************************************************************
Camilla Berglund2fca5c52013-01-17 21:51:39 +01001431 * GLFW API functions
Camilla Berglund3249f812010-09-07 17:34:51 +02001432 *************************************************************************/
1433
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001434/*! @brief Initializes the GLFW library.
1435 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001436 * This function initializes the GLFW library. Before most GLFW functions can
Camilla Berglund4591ad22014-09-18 15:03:29 +02001437 * be used, GLFW must be initialized, and before an application terminates GLFW
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001438 * should be terminated in order to free any resources allocated during or
1439 * after initialization.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001440 *
Camilla Berglund23f61762013-03-12 19:53:29 +01001441 * If this function fails, it calls @ref glfwTerminate before returning. If it
Camilla Berglund4591ad22014-09-18 15:03:29 +02001442 * succeeds, you should call @ref glfwTerminate before the application exits.
Camilla Berglund23f61762013-03-12 19:53:29 +01001443 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001444 * Additional calls to this function after successful initialization but before
Camilla Berglund0eccf752015-08-23 19:30:04 +02001445 * termination will return `GLFW_TRUE` immediately.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001446 *
Camilla Berglund0eccf752015-08-23 19:30:04 +02001447 * @return `GLFW_TRUE` if successful, or `GLFW_FALSE` if an
Camilla Berglund4591ad22014-09-18 15:03:29 +02001448 * [error](@ref error_handling) occurred.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001449 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001450 * @errors Possible errors include @ref GLFW_PLATFORM_ERROR.
1451 *
Camilla Berglund8d6f2652016-10-20 00:50:54 +02001452 * @remark @macos This function will change the current directory of the
Camilla Berglund71d2b572013-03-12 15:33:05 +01001453 * application to the `Contents/Resources` subdirectory of the application's
Camilla Löwy6d9a58b2017-02-14 15:43:31 +01001454 * bundle, if present. This can be disabled with the @ref
1455 * GLFW_COCOA_CHDIR_RESOURCES init hint.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001456 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001457 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001458 *
1459 * @sa @ref intro_init
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001460 * @sa @ref glfwTerminate
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001461 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001462 * @since Added in version 1.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001463 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001464 * @ingroup init
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001465 */
1466GLFWAPI int glfwInit(void);
1467
1468/*! @brief Terminates the GLFW library.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001469 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001470 * This function destroys all remaining windows and cursors, restores any
1471 * modified gamma ramps and frees any other allocated resources. Once this
1472 * function is called, you must again call @ref glfwInit successfully before
1473 * you will be able to use most GLFW functions.
Camilla Berglund23f61762013-03-12 19:53:29 +01001474 *
1475 * If GLFW has been successfully initialized, this function should be called
Camilla Berglund4591ad22014-09-18 15:03:29 +02001476 * before the application exits. If initialization fails, there is no need to
1477 * call this function, as it is called by @ref glfwInit before it returns
1478 * failure.
Camilla Berglund23f61762013-03-12 19:53:29 +01001479 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001480 * @errors Possible errors include @ref GLFW_PLATFORM_ERROR.
1481 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001482 * @remark This function may be called before @ref glfwInit.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001483 *
Camilla Berglund0df4e062015-12-13 14:07:27 +01001484 * @warning The contexts of any remaining windows must not be current on any
1485 * other thread when this function is called.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001486 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001487 * @reentrancy This function must not be called from a callback.
Camilla Berglund20858762015-01-01 18:41:22 +01001488 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001489 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001490 *
1491 * @sa @ref intro_init
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001492 * @sa @ref glfwInit
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001493 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001494 * @since Added in version 1.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001495 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001496 * @ingroup init
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001497 */
Camilla Berglund9a716692010-09-08 16:40:43 +02001498GLFWAPI void glfwTerminate(void);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001499
Camilla Löwy6d9a58b2017-02-14 15:43:31 +01001500/*! @brief Sets the specified init hint to the desired value.
1501 *
1502 * This function sets hints for the next initialization of GLFW.
1503 *
1504 * The values you set are not affected by initialization or termination, but
1505 * they are only read during initialization. Once GLFW has been initialized,
1506 * setting new hint values will not affect behavior until the next time the
1507 * library is terminated and initialized.
1508 *
1509 * Some hints are platform specific. These are always valid to set on any
1510 * platform but they will only affect their specific platform. Other platforms
1511 * will simply ignore them. Setting these hints requires no platform specific
1512 * headers or calls.
1513 *
1514 * @param[in] hint The [init hint](@ref init_hints) to set.
1515 * @param[in] value The new value of the init hint.
1516 *
1517 * @errors Possible errors include @ref GLFW_INVALID_ENUM and @ref
1518 * GLFW_INVALID_VALUE.
1519 *
1520 * @remarks This function may be called before @ref glfwInit.
1521 *
1522 * @thread_safety This function must only be called from the main thread.
1523 *
1524 * @sa init_hints
1525 * @sa glfwInit
1526 *
1527 * @since Added in version 3.3.
1528 *
1529 * @ingroup init
1530 */
1531GLFWAPI void glfwInitHint(int hint, int value);
1532
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001533/*! @brief Retrieves the version of the GLFW library.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001534 *
1535 * This function retrieves the major, minor and revision numbers of the GLFW
1536 * library. It is intended for when you are using GLFW as a shared library and
1537 * want to ensure that you are using the minimum required version.
1538 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001539 * Any or all of the version arguments may be `NULL`.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001540 *
Camilla Berglund71d2b572013-03-12 15:33:05 +01001541 * @param[out] major Where to store the major version number, or `NULL`.
1542 * @param[out] minor Where to store the minor version number, or `NULL`.
1543 * @param[out] rev Where to store the revision number, or `NULL`.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001544 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001545 * @errors None.
1546 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001547 * @remark This function may be called before @ref glfwInit.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001548 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001549 * @thread_safety This function may be called from any thread.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001550 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001551 * @sa @ref intro_version
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001552 * @sa @ref glfwGetVersionString
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001553 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001554 * @since Added in version 1.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001555 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001556 * @ingroup init
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001557 */
Camilla Berglund9a716692010-09-08 16:40:43 +02001558GLFWAPI void glfwGetVersion(int* major, int* minor, int* rev);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001559
Camilla Berglund6f8084f2013-02-14 13:14:17 +01001560/*! @brief Returns a string describing the compile-time configuration.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001561 *
Camilla Berglunde8e05d42014-04-23 13:30:11 +02001562 * This function returns the compile-time generated
1563 * [version string](@ref intro_version_string) of the GLFW library binary. It
1564 * describes the version, platform, compiler and any platform-specific
Camilla Berglund386b6032016-02-10 13:48:49 +01001565 * compile-time options. It should not be confused with the OpenGL or OpenGL
1566 * ES version string, queried with `glGetString`.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001567 *
Camilla Berglundce8f97c2015-01-11 23:33:14 +01001568 * __Do not use the version string__ to parse the GLFW library version. The
Camilla Berglund386b6032016-02-10 13:48:49 +01001569 * @ref glfwGetVersion function provides the version of the running library
1570 * binary in numerical format.
Camilla Berglundce8f97c2015-01-11 23:33:14 +01001571 *
Camilla Berglund386b6032016-02-10 13:48:49 +01001572 * @return The ASCII encoded GLFW version string.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02001573 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001574 * @errors None.
1575 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001576 * @remark This function may be called before @ref glfwInit.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001577 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001578 * @pointer_lifetime The returned string is static and compile-time generated.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001579 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001580 * @thread_safety This function may be called from any thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001581 *
1582 * @sa @ref intro_version
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001583 * @sa @ref glfwGetVersion
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001584 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001585 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001586 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001587 * @ingroup init
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001588 */
Camilla Berglundd6fe4472010-09-13 18:05:59 +02001589GLFWAPI const char* glfwGetVersionString(void);
Camilla Berglund3249f812010-09-07 17:34:51 +02001590
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001591/*! @brief Sets the error callback.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001592 *
1593 * This function sets the error callback, which is called with an error code
1594 * and a human-readable description each time a GLFW error occurs.
1595 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001596 * The error callback is called on the thread where the error occurred. If you
1597 * are using GLFW from multiple threads, your error callback needs to be
1598 * written accordingly.
1599 *
1600 * Because the description string may have been generated specifically for that
1601 * error, it is not guaranteed to be valid after the callback has returned. If
1602 * you wish to use it after the callback returns, you need to make a copy.
1603 *
Camilla Berglund20858762015-01-01 18:41:22 +01001604 * Once set, the error callback remains set even after the library has been
1605 * terminated.
1606 *
Camilla Berglund71d2b572013-03-12 15:33:05 +01001607 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001608 * callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02001609 * @return The previously set callback, or `NULL` if no callback was set.
1610 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001611 * @errors None.
1612 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001613 * @remark This function may be called before @ref glfwInit.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001614 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001615 * @thread_safety This function must only be called from the main thread.
Camilla Berglund0e205772014-03-24 11:58:35 +01001616 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001617 * @sa @ref error_handling
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001618 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001619 * @since Added in version 3.0.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001620 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001621 * @ingroup init
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001622 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02001623GLFWAPI GLFWerrorfun glfwSetErrorCallback(GLFWerrorfun cbfun);
Camilla Berglundf5d74c42010-09-09 21:06:59 +02001624
Camilla Berglund5f68e122012-11-27 17:07:28 +01001625/*! @brief Returns the currently connected monitors.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001626 *
1627 * This function returns an array of handles for all currently connected
Camilla Berglundf5cbdba2015-09-17 16:37:09 +02001628 * monitors. The primary monitor is always first in the returned array. If no
1629 * monitors were found, this function returns `NULL`.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001630 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001631 * @param[out] count Where to store the number of monitors in the returned
1632 * array. This is set to zero if an error occurred.
Camilla Berglundf5cbdba2015-09-17 16:37:09 +02001633 * @return An array of monitor handles, or `NULL` if no monitors were found or
1634 * if an [error](@ref error_handling) occurred.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001635 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001636 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
1637 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001638 * @pointer_lifetime The returned array is allocated and freed by GLFW. You
1639 * should not free it yourself. It is guaranteed to be valid only until the
1640 * monitor configuration changes or the library is terminated.
Camilla Berglund0e205772014-03-24 11:58:35 +01001641 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001642 * @thread_safety This function must only be called from the main thread.
Camilla Berglundc3bb5c92013-06-05 16:04:04 +02001643 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001644 * @sa @ref monitor_monitors
1645 * @sa @ref monitor_event
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001646 * @sa @ref glfwGetPrimaryMonitor
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001647 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001648 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001649 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001650 * @ingroup monitor
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001651 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001652GLFWAPI GLFWmonitor** glfwGetMonitors(int* count);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001653
Camilla Berglund5f68e122012-11-27 17:07:28 +01001654/*! @brief Returns the primary monitor.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001655 *
1656 * This function returns the primary monitor. This is usually the monitor
Camilla Berglundf5cbdba2015-09-17 16:37:09 +02001657 * where elements like the task bar or global menu bar are located.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001658 *
Camilla Berglundf5cbdba2015-09-17 16:37:09 +02001659 * @return The primary monitor, or `NULL` if no monitors were found or if an
1660 * [error](@ref error_handling) occurred.
Camilla Berglunddba2d802013-01-17 23:06:56 +01001661 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001662 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
1663 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001664 * @thread_safety This function must only be called from the main thread.
Camilla Berglund0e205772014-03-24 11:58:35 +01001665 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001666 * @remark The primary monitor is always first in the array returned by @ref
Camilla Berglundf5cbdba2015-09-17 16:37:09 +02001667 * glfwGetMonitors.
1668 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001669 * @sa @ref monitor_monitors
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001670 * @sa @ref glfwGetMonitors
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001671 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001672 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001673 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001674 * @ingroup monitor
Camilla Berglund41bc0d12012-11-27 16:55:04 +01001675 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001676GLFWAPI GLFWmonitor* glfwGetPrimaryMonitor(void);
Camilla Berglund41bc0d12012-11-27 16:55:04 +01001677
Camilla Berglundee5f30e2013-01-24 19:10:17 +01001678/*! @brief Returns the position of the monitor's viewport on the virtual screen.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001679 *
1680 * This function returns the position, in screen coordinates, of the upper-left
1681 * corner of the specified monitor.
1682 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001683 * Any or all of the position arguments may be `NULL`. If an error occurs, all
1684 * non-`NULL` position arguments will be set to zero.
1685 *
Camilla Berglunddba2d802013-01-17 23:06:56 +01001686 * @param[in] monitor The monitor to query.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02001687 * @param[out] xpos Where to store the monitor x-coordinate, or `NULL`.
1688 * @param[out] ypos Where to store the monitor y-coordinate, or `NULL`.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001689 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001690 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
1691 * GLFW_PLATFORM_ERROR.
1692 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001693 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001694 *
1695 * @sa @ref monitor_properties
1696 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001697 * @since Added in version 3.0.
Camilla Berglund0e205772014-03-24 11:58:35 +01001698 *
Camilla Berglund5f68e122012-11-27 17:07:28 +01001699 * @ingroup monitor
Camilla Berglund41bc0d12012-11-27 16:55:04 +01001700 */
Camilla Berglundee5f30e2013-01-24 19:10:17 +01001701GLFWAPI void glfwGetMonitorPos(GLFWmonitor* monitor, int* xpos, int* ypos);
1702
1703/*! @brief Returns the physical size of the monitor.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001704 *
1705 * This function returns the size, in millimetres, of the display area of the
1706 * specified monitor.
1707 *
Camilla Berglund4188c262015-01-18 01:55:25 +01001708 * Some systems do not provide accurate monitor size information, either
1709 * because the monitor
1710 * [EDID](https://en.wikipedia.org/wiki/Extended_display_identification_data)
1711 * data is incorrect or because the driver does not report it accurately.
1712 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001713 * Any or all of the size arguments may be `NULL`. If an error occurs, all
1714 * non-`NULL` size arguments will be set to zero.
1715 *
Camilla Berglundee5f30e2013-01-24 19:10:17 +01001716 * @param[in] monitor The monitor to query.
Camilla Berglundce8f97c2015-01-11 23:33:14 +01001717 * @param[out] widthMM Where to store the width, in millimetres, of the
1718 * monitor's display area, or `NULL`.
1719 * @param[out] heightMM Where to store the height, in millimetres, of the
1720 * monitor's display area, or `NULL`.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001721 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001722 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
1723 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001724 * @remark @win32 calculates the returned physical size from the
Camilla Berglund4188c262015-01-18 01:55:25 +01001725 * current resolution and system DPI instead of querying the monitor EDID data.
Camilla Berglund0e205772014-03-24 11:58:35 +01001726 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001727 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001728 *
1729 * @sa @ref monitor_properties
1730 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001731 * @since Added in version 3.0.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001732 *
Camilla Berglundee5f30e2013-01-24 19:10:17 +01001733 * @ingroup monitor
1734 */
Camilla Berglundce8f97c2015-01-11 23:33:14 +01001735GLFWAPI void glfwGetMonitorPhysicalSize(GLFWmonitor* monitor, int* widthMM, int* heightMM);
Camilla Berglund41bc0d12012-11-27 16:55:04 +01001736
Camilla Berglund5f68e122012-11-27 17:07:28 +01001737/*! @brief Returns the name of the specified monitor.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001738 *
1739 * This function returns a human-readable name, encoded as UTF-8, of the
Camilla Berglund4591ad22014-09-18 15:03:29 +02001740 * specified monitor. The name typically reflects the make and model of the
1741 * monitor and is not guaranteed to be unique among the connected monitors.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001742 *
Camilla Berglund5f68e122012-11-27 17:07:28 +01001743 * @param[in] monitor The monitor to query.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001744 * @return The UTF-8 encoded name of the monitor, or `NULL` if an
1745 * [error](@ref error_handling) occurred.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001746 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001747 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
1748 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001749 * @pointer_lifetime The returned string is allocated and freed by GLFW. You
1750 * should not free it yourself. It is valid until the specified monitor is
1751 * disconnected or the library is terminated.
Camilla Berglund0e205772014-03-24 11:58:35 +01001752 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001753 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001754 *
1755 * @sa @ref monitor_properties
1756 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001757 * @since Added in version 3.0.
Camilla Berglundc3bb5c92013-06-05 16:04:04 +02001758 *
Camilla Berglund5f68e122012-11-27 17:07:28 +01001759 * @ingroup monitor
Camilla Berglund41bc0d12012-11-27 16:55:04 +01001760 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001761GLFWAPI const char* glfwGetMonitorName(GLFWmonitor* monitor);
Camilla Berglund41bc0d12012-11-27 16:55:04 +01001762
Camilla Berglund5f68e122012-11-27 17:07:28 +01001763/*! @brief Sets the monitor configuration callback.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001764 *
1765 * This function sets the monitor configuration callback, or removes the
1766 * currently set callback. This is called when a monitor is connected to or
1767 * disconnected from the system.
1768 *
Camilla Berglund71d2b572013-03-12 15:33:05 +01001769 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
Camilla Berglunddba2d802013-01-17 23:06:56 +01001770 * callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02001771 * @return The previously set callback, or `NULL` if no callback was set or the
1772 * library had not been [initialized](@ref intro_init).
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001773 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001774 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
1775 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001776 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001777 *
1778 * @sa @ref monitor_event
1779 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001780 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001781 *
Camilla Berglund5f68e122012-11-27 17:07:28 +01001782 * @ingroup monitor
Camilla Berglund41bc0d12012-11-27 16:55:04 +01001783 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02001784GLFWAPI GLFWmonitorfun glfwSetMonitorCallback(GLFWmonitorfun cbfun);
Marcel Metzbeacbb32011-05-07 10:53:50 +02001785
Camilla Berglund41bc0d12012-11-27 16:55:04 +01001786/*! @brief Returns the available video modes for the specified monitor.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001787 *
1788 * This function returns an array of all video modes supported by the specified
Camilla Berglund948cc042013-04-16 02:02:22 +02001789 * monitor. The returned array is sorted in ascending order, first by color
1790 * bit depth (the sum of all channel depths) and then by resolution area (the
1791 * product of width and height).
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001792 *
Camilla Berglund5f68e122012-11-27 17:07:28 +01001793 * @param[in] monitor The monitor to query.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02001794 * @param[out] count Where to store the number of video modes in the returned
1795 * array. This is set to zero if an error occurred.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001796 * @return An array of video modes, or `NULL` if an
1797 * [error](@ref error_handling) occurred.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001798 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001799 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
1800 * GLFW_PLATFORM_ERROR.
1801 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001802 * @pointer_lifetime The returned array is allocated and freed by GLFW. You
1803 * should not free it yourself. It is valid until the specified monitor is
1804 * disconnected, this function is called again for that monitor or the library
1805 * is terminated.
Camilla Berglund0e205772014-03-24 11:58:35 +01001806 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001807 * @thread_safety This function must only be called from the main thread.
Camilla Berglundc3bb5c92013-06-05 16:04:04 +02001808 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001809 * @sa @ref monitor_modes
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001810 * @sa @ref glfwGetVideoMode
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001811 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001812 * @since Added in version 1.0.
Camilla Berglund951a9582016-01-31 21:32:14 +01001813 * @glfw3 Changed to return an array of modes for a specific monitor.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001814 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001815 * @ingroup monitor
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001816 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001817GLFWAPI const GLFWvidmode* glfwGetVideoModes(GLFWmonitor* monitor, int* count);
Camilla Berglund41bc0d12012-11-27 16:55:04 +01001818
Camilla Berglund5f68e122012-11-27 17:07:28 +01001819/*! @brief Returns the current mode of the specified monitor.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001820 *
Camilla Berglund948cc042013-04-16 02:02:22 +02001821 * This function returns the current video mode of the specified monitor. If
Camilla Berglund4591ad22014-09-18 15:03:29 +02001822 * you have created a full screen window for that monitor, the return value
1823 * will depend on whether that window is iconified.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001824 *
Camilla Berglund5f68e122012-11-27 17:07:28 +01001825 * @param[in] monitor The monitor to query.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001826 * @return The current mode of the monitor, or `NULL` if an
1827 * [error](@ref error_handling) occurred.
Camilla Berglunddba2d802013-01-17 23:06:56 +01001828 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001829 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
1830 * GLFW_PLATFORM_ERROR.
1831 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001832 * @pointer_lifetime The returned array is allocated and freed by GLFW. You
1833 * should not free it yourself. It is valid until the specified monitor is
1834 * disconnected or the library is terminated.
Camilla Berglund0e205772014-03-24 11:58:35 +01001835 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001836 * @thread_safety This function must only be called from the main thread.
Camilla Berglundc3bb5c92013-06-05 16:04:04 +02001837 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001838 * @sa @ref monitor_modes
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001839 * @sa @ref glfwGetVideoModes
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001840 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001841 * @since Added in version 3.0. Replaces `glfwGetDesktopMode`.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001842 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001843 * @ingroup monitor
Camilla Berglund41bc0d12012-11-27 16:55:04 +01001844 */
Camilla Berglundce1e84d2013-05-22 22:16:43 +02001845GLFWAPI const GLFWvidmode* glfwGetVideoMode(GLFWmonitor* monitor);
Camilla Berglund3249f812010-09-07 17:34:51 +02001846
Camilla Berglund92a71e02013-02-12 13:50:41 +01001847/*! @brief Generates a gamma ramp and sets it for the specified monitor.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001848 *
Camilla Berglund5d308db2013-05-19 15:46:44 +02001849 * This function generates a 256-element gamma ramp from the specified exponent
Camilla Berglund5bbc2b42015-03-15 15:40:43 +01001850 * and then calls @ref glfwSetGammaRamp with it. The value must be a finite
1851 * number greater than zero.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001852 *
Camilla Löwyce161c22016-12-06 01:14:23 +01001853 * The software controlled gamma ramp is applied _in addition_ to the hardware
1854 * gamma correction, which today is usually an approximation of sRGB gamma.
1855 * This means that setting a perfectly linear ramp, or gamma 1.0, will produce
1856 * the default (usually sRGB-like) behavior.
1857 *
1858 * For gamma correct rendering with OpenGL or OpenGL ES, see the @ref
1859 * GLFW_SRGB_CAPABLE hint.
1860 *
Camilla Berglund92a71e02013-02-12 13:50:41 +01001861 * @param[in] monitor The monitor whose gamma ramp to set.
Camilla Berglunda3ff29a2012-12-02 15:47:10 +01001862 * @param[in] gamma The desired exponent.
Camilla Berglunddba2d802013-01-17 23:06:56 +01001863 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001864 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
1865 * GLFW_INVALID_VALUE and @ref GLFW_PLATFORM_ERROR.
1866 *
linkmauvebc8b0482016-10-16 15:52:39 +01001867 * @remark @wayland Gamma handling is currently unavailable, this function will
1868 * always emit @ref GLFW_PLATFORM_ERROR.
1869 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001870 * @thread_safety This function must only be called from the main thread.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02001871 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001872 * @sa @ref monitor_gamma
1873 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001874 * @since Added in version 3.0.
Camilla Berglund0e205772014-03-24 11:58:35 +01001875 *
Camilla Berglundf5f55e32013-06-17 12:56:36 +02001876 * @ingroup monitor
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001877 */
Camilla Berglund92a71e02013-02-12 13:50:41 +01001878GLFWAPI void glfwSetGamma(GLFWmonitor* monitor, float gamma);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001879
Camilla Berglund4591ad22014-09-18 15:03:29 +02001880/*! @brief Returns the current gamma ramp for the specified monitor.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001881 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001882 * This function returns the current gamma ramp of the specified monitor.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001883 *
Camilla Berglund92a71e02013-02-12 13:50:41 +01001884 * @param[in] monitor The monitor to query.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001885 * @return The current gamma ramp, or `NULL` if an
1886 * [error](@ref error_handling) occurred.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001887 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001888 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
1889 * GLFW_PLATFORM_ERROR.
1890 *
linkmauvebc8b0482016-10-16 15:52:39 +01001891 * @remark @wayland Gamma handling is currently unavailable, this function will
1892 * always return `NULL` and emit @ref GLFW_PLATFORM_ERROR.
1893 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001894 * @pointer_lifetime The returned structure and its arrays are allocated and
1895 * freed by GLFW. You should not free them yourself. They are valid until the
1896 * specified monitor is disconnected, this function is called again for that
1897 * monitor or the library is terminated.
Camilla Berglund0e205772014-03-24 11:58:35 +01001898 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001899 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001900 *
1901 * @sa @ref monitor_gamma
1902 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001903 * @since Added in version 3.0.
Camilla Berglundc3bb5c92013-06-05 16:04:04 +02001904 *
Camilla Berglundf5f55e32013-06-17 12:56:36 +02001905 * @ingroup monitor
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001906 */
Camilla Berglund5d308db2013-05-19 15:46:44 +02001907GLFWAPI const GLFWgammaramp* glfwGetGammaRamp(GLFWmonitor* monitor);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001908
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001909/*! @brief Sets the current gamma ramp for the specified monitor.
1910 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001911 * This function sets the current gamma ramp for the specified monitor. The
1912 * original gamma ramp for that monitor is saved by GLFW the first time this
1913 * function is called and is restored by @ref glfwTerminate.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001914 *
Camilla Löwyce161c22016-12-06 01:14:23 +01001915 * The software controlled gamma ramp is applied _in addition_ to the hardware
1916 * gamma correction, which today is usually an approximation of sRGB gamma.
1917 * This means that setting a perfectly linear ramp, or gamma 1.0, will produce
1918 * the default (usually sRGB-like) behavior.
1919 *
1920 * For gamma correct rendering with OpenGL or OpenGL ES, see the @ref
1921 * GLFW_SRGB_CAPABLE hint.
1922 *
Camilla Berglund92a71e02013-02-12 13:50:41 +01001923 * @param[in] monitor The monitor whose gamma ramp to set.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001924 * @param[in] ramp The gamma ramp to use.
Camilla Berglund8954af62013-02-20 19:44:52 +01001925 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001926 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
1927 * GLFW_PLATFORM_ERROR.
1928 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001929 * @remark Gamma ramp sizes other than 256 are not supported by all platforms
Camilla Berglund76fff4d2015-03-10 19:02:28 +01001930 * or graphics hardware.
1931 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001932 * @remark @win32 The gamma ramp size must be 256.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001933 *
linkmauvebc8b0482016-10-16 15:52:39 +01001934 * @remark @wayland Gamma handling is currently unavailable, this function will
1935 * always emit @ref GLFW_PLATFORM_ERROR.
1936 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001937 * @pointer_lifetime The specified gamma ramp is copied before this function
1938 * returns.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001939 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001940 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001941 *
1942 * @sa @ref monitor_gamma
1943 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001944 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001945 *
Camilla Berglundf5f55e32013-06-17 12:56:36 +02001946 * @ingroup monitor
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001947 */
Camilla Berglund92a71e02013-02-12 13:50:41 +01001948GLFWAPI void glfwSetGammaRamp(GLFWmonitor* monitor, const GLFWgammaramp* ramp);
Camilla Berglund2630d492010-10-13 04:04:43 +02001949
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001950/*! @brief Resets all window hints to their default values.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001951 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001952 * This function resets all window hints to their
Camilla Berglunde248fb62013-03-29 14:06:23 +01001953 * [default values](@ref window_hints_values).
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001954 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001955 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
1956 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001957 * @thread_safety This function must only be called from the main thread.
Camilla Berglund9ad1d972012-11-22 19:08:30 +01001958 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001959 * @sa @ref window_hints
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001960 * @sa @ref glfwWindowHint
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001961 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001962 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001963 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001964 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001965 */
Camilla Berglund5df4df62012-10-22 02:59:05 +02001966GLFWAPI void glfwDefaultWindowHints(void);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001967
1968/*! @brief Sets the specified window hint to the desired value.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001969 *
Camilla Berglunded9e4032012-12-23 15:59:09 +01001970 * This function sets hints for the next call to @ref glfwCreateWindow. The
1971 * hints, once set, retain their values until changed by a call to @ref
1972 * glfwWindowHint or @ref glfwDefaultWindowHints, or until the library is
Camilla Berglund6be821c2014-10-06 23:18:33 +02001973 * terminated.
Camilla Berglunded9e4032012-12-23 15:59:09 +01001974 *
Camilla Berglundd6e0a432016-02-09 07:41:48 +01001975 * This function does not check whether the specified hint values are valid.
1976 * If you set hints to invalid values this will instead be reported by the next
1977 * call to @ref glfwCreateWindow.
1978 *
Camilla Berglundd0649e62016-01-27 03:25:21 +01001979 * @param[in] hint The [window hint](@ref window_hints) to set.
1980 * @param[in] value The new value of the window hint.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001981 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001982 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
1983 * GLFW_INVALID_ENUM.
1984 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001985 * @thread_safety This function must only be called from the main thread.
Camilla Berglund401033c2013-03-12 19:17:07 +01001986 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001987 * @sa @ref window_hints
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001988 * @sa @ref glfwDefaultWindowHints
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001989 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001990 * @since Added in version 3.0. Replaces `glfwOpenWindowHint`.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001991 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001992 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001993 */
Camilla Berglundd0649e62016-01-27 03:25:21 +01001994GLFWAPI void glfwWindowHint(int hint, int value);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001995
1996/*! @brief Creates a window and its associated context.
1997 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001998 * This function creates a window and its associated OpenGL or OpenGL ES
1999 * context. Most of the options controlling how the window and its context
2000 * should be created are specified with [window hints](@ref window_hints).
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002001 *
2002 * Successful creation does not change which context is current. Before you
Camilla Berglund4591ad22014-09-18 15:03:29 +02002003 * can use the newly created context, you need to
2004 * [make it current](@ref context_current). For information about the `share`
2005 * parameter, see @ref context_sharing.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002006 *
Camilla Berglunde8e05d42014-04-23 13:30:11 +02002007 * The created window, framebuffer and context may differ from what you
2008 * requested, as not all parameters and hints are
Camilla Berglundfa0cbd92013-04-11 01:07:07 +02002009 * [hard constraints](@ref window_hints_hard). This includes the size of the
Camilla Berglund4591ad22014-09-18 15:03:29 +02002010 * window, especially for full screen windows. To query the actual attributes
Camilla Berglunde8bceaa2015-04-07 14:37:42 +02002011 * of the created window, framebuffer and context, see @ref
2012 * glfwGetWindowAttrib, @ref glfwGetWindowSize and @ref glfwGetFramebufferSize.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002013 *
Camilla Berglunde8e05d42014-04-23 13:30:11 +02002014 * To create a full screen window, you need to specify the monitor the window
Camilla Berglund6570d0c2016-02-23 12:26:42 +01002015 * will cover. If no monitor is specified, the window will be windowed mode.
2016 * Unless you have a way for the user to choose a specific monitor, it is
2017 * recommended that you pick the primary monitor. For more information on how
2018 * to query connected monitors, see @ref monitor_monitors.
Camilla Berglund4b7ae492013-07-07 12:06:59 +02002019 *
Camilla Berglund95654cf2014-10-02 17:35:10 +02002020 * For full screen windows, the specified size becomes the resolution of the
Camilla Berglund6570d0c2016-02-23 12:26:42 +01002021 * window's _desired video mode_. As long as a full screen window is not
2022 * iconified, the supported video mode most closely matching the desired video
2023 * mode is set for the specified monitor. For more information about full
2024 * screen windows, including the creation of so called _windowed full screen_
2025 * or _borderless full screen_ windows, see @ref window_windowed_full_screen.
Camilla Berglund95654cf2014-10-02 17:35:10 +02002026 *
Camilla Berglund999f3552016-08-17 16:48:22 +02002027 * Once you have created the window, you can switch it between windowed and
Camilla Berglunde83be1d2016-11-08 12:19:06 +01002028 * full screen mode with @ref glfwSetWindowMonitor. This will not affect its
2029 * OpenGL or OpenGL ES context.
Camilla Berglund999f3552016-08-17 16:48:22 +02002030 *
Camilla Berglunde8e05d42014-04-23 13:30:11 +02002031 * By default, newly created windows use the placement recommended by the
2032 * window system. To create the window at a specific position, make it
Camilla Löwyce161c22016-12-06 01:14:23 +01002033 * initially invisible using the [GLFW_VISIBLE](@ref GLFW_VISIBLE_hint) window
Camilla Berglundce8f97c2015-01-11 23:33:14 +01002034 * hint, set its [position](@ref window_pos) and then [show](@ref window_hide)
2035 * it.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02002036 *
Camilla Berglund6570d0c2016-02-23 12:26:42 +01002037 * As long as at least one full screen window is not iconified, the screensaver
2038 * is prohibited from starting.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02002039 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002040 * Window systems put limits on window sizes. Very large or very small window
2041 * dimensions may be overridden by the window system on creation. Check the
Camilla Berglund95654cf2014-10-02 17:35:10 +02002042 * actual [size](@ref window_size) after creation.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002043 *
Camilla Berglund4188c262015-01-18 01:55:25 +01002044 * The [swap interval](@ref buffer_swap) is not set during window creation and
Camilla Berglund4591ad22014-09-18 15:03:29 +02002045 * the initial value may vary depending on driver settings and defaults.
2046 *
Camilla Berglund8282a8f2013-04-10 23:01:12 +02002047 * @param[in] width The desired width, in screen coordinates, of the window.
2048 * This must be greater than zero.
2049 * @param[in] height The desired height, in screen coordinates, of the window.
2050 * This must be greater than zero.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002051 * @param[in] title The initial, UTF-8 encoded window title.
Camilla Berglund6570d0c2016-02-23 12:26:42 +01002052 * @param[in] monitor The monitor to use for full screen mode, or `NULL` for
Camilla Berglund41bc0d12012-11-27 16:55:04 +01002053 * windowed mode.
Camilla Berglund71d2b572013-03-12 15:33:05 +01002054 * @param[in] share The window whose context to share resources with, or `NULL`
2055 * to not share resources.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002056 * @return The handle of the created window, or `NULL` if an
2057 * [error](@ref error_handling) occurred.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002058 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002059 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
2060 * GLFW_INVALID_ENUM, @ref GLFW_INVALID_VALUE, @ref GLFW_API_UNAVAILABLE, @ref
2061 * GLFW_VERSION_UNAVAILABLE, @ref GLFW_FORMAT_UNAVAILABLE and @ref
2062 * GLFW_PLATFORM_ERROR.
2063 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002064 * @remark @win32 Window creation will fail if the Microsoft GDI software
2065 * OpenGL implementation is the only one available.
Camilla Berglund07db5da2013-09-26 19:15:36 +02002066 *
Camilla Berglund20bce152016-05-30 16:04:37 +02002067 * @remark @win32 If the executable has an icon resource named `GLFW_ICON,` it
2068 * will be set as the initial icon for the window. If no such icon is present,
2069 * the `IDI_WINLOGO` icon will be used instead. To set a different icon, see
2070 * @ref glfwSetWindowIcon.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002071 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002072 * @remark @win32 The context to share resources with must not be current on
2073 * any other thread.
Camilla Berglundb19fb4c2014-12-27 21:14:41 +01002074 *
Camilla Löwyfd127d52016-12-03 19:32:00 +01002075 * @remark @macos The OS only supports forward-compatible core profile contexts
2076 * for OpenGL versions 3.2 and later. Before creating an OpenGL context of
2077 * version 3.2 or later you must set the
Camilla Löwyce161c22016-12-06 01:14:23 +01002078 * [GLFW_OPENGL_FORWARD_COMPAT](@ref GLFW_OPENGL_FORWARD_COMPAT_hint) and
2079 * [GLFW_OPENGL_PROFILE](@ref GLFW_OPENGL_PROFILE_hint) hints accordingly.
2080 * OpenGL 3.0 and 3.1 contexts are not supported at all on macOS.
Camilla Löwyfd127d52016-12-03 19:32:00 +01002081 *
Camilla Berglund8d6f2652016-10-20 00:50:54 +02002082 * @remark @macos The GLFW window has no icon, as it is not a document
Camilla Berglund71d2b572013-03-12 15:33:05 +01002083 * window, but the dock icon will be the same as the application bundle's icon.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002084 * For more information on bundles, see the
Camilla Berglunde8e05d42014-04-23 13:30:11 +02002085 * [Bundle Programming Guide](https://developer.apple.com/library/mac/documentation/CoreFoundation/Conceptual/CFBundles/)
2086 * in the Mac Developer Library.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002087 *
Camilla Berglund8d6f2652016-10-20 00:50:54 +02002088 * @remark @macos The first time a window is created the menu bar is populated
Camilla Berglund951a9582016-01-31 21:32:14 +01002089 * with common commands like Hide, Quit and About. The About entry opens
2090 * a minimal about dialog with information from the application's bundle. The
Camilla Löwy6d9a58b2017-02-14 15:43:31 +01002091 * menu bar can be disabled with the @ref GLFW_COCOA_MENUBAR init hint.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002092 *
Camilla Berglund8d6f2652016-10-20 00:50:54 +02002093 * @remark @macos On OS X 10.10 and later the window frame will not be rendered
Camilla Löwy58ceab52016-12-07 00:41:54 +01002094 * at full resolution on Retina displays unless the
2095 * [GLFW_COCOA_RETINA_FRAMEBUFFER](@ref GLFW_COCOA_RETINA_FRAMEBUFFER_hint)
2096 * hint is `GLFW_TRUE` and the `NSHighResolutionCapable` key is enabled in the
2097 * application bundle's `Info.plist`. For more information, see
Camilla Berglund821f3e62015-03-16 22:39:14 +01002098 * [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 +02002099 * in the Mac Developer Library. The GLFW test and example programs use
2100 * a custom `Info.plist` template for this, which can be found as
2101 * `CMake/MacOSXBundleInfo.plist.in` in the source tree.
Camilla Berglund821f3e62015-03-16 22:39:14 +01002102 *
Camilla Löwy46613152017-01-01 19:41:50 +01002103 * @remark @macos When activating frame autosaving with
2104 * [GLFW_COCOA_FRAME_AUTOSAVE](@ref GLFW_COCOA_FRAME_AUTOSAVE_hint), the
2105 * specified window size may be overriden by a previously saved size and
2106 * position.
2107 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002108 * @remark @x11 Some window managers will not respect the placement of
Camilla Berglunde8e05d42014-04-23 13:30:11 +02002109 * initially hidden windows.
Camilla Berglund3af1c412013-09-19 21:37:01 +02002110 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002111 * @remark @x11 Due to the asynchronous nature of X11, it may take a moment for
2112 * a window to reach its requested state. This means you may not be able to
2113 * query the final size, position or other attributes directly after window
2114 * creation.
Camilla Berglund20ed0a12015-08-12 21:31:54 +02002115 *
linkmauvebc8b0482016-10-16 15:52:39 +01002116 * @remark @wayland The window frame is currently unimplemented, as if
Camilla Löwyce161c22016-12-06 01:14:23 +01002117 * [GLFW_DECORATED](@ref GLFW_DECORATED_hint) was always set to `GLFW_FALSE`.
2118 * A compositor can still emit close, resize or maximize events, using for
2119 * example a keybind mechanism.
linkmauvebc8b0482016-10-16 15:52:39 +01002120 *
2121 * @remark @wayland A full screen window will not attempt to change the mode,
2122 * no matter what the requested size or refresh rate.
2123 *
2124 * @remark @wayland The wl_shell protocol does not support window
2125 * icons, the window will inherit the one defined in the application's
2126 * desktop file, so this function emits @ref GLFW_PLATFORM_ERROR.
2127 *
2128 * @remark @wayland Screensaver inhibition is currently unimplemented.
2129 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002130 * @reentrancy This function must not be called from a callback.
Camilla Berglund9ad1d972012-11-22 19:08:30 +01002131 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002132 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002133 *
2134 * @sa @ref window_creation
Camilla Berglund7e9e3212016-09-14 20:17:26 +02002135 * @sa @ref glfwDestroyWindow
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002136 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002137 * @since Added in version 3.0. Replaces `glfwOpenWindow`.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002138 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002139 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002140 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01002141GLFWAPI GLFWwindow* glfwCreateWindow(int width, int height, const char* title, GLFWmonitor* monitor, GLFWwindow* share);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002142
2143/*! @brief Destroys the specified window and its context.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002144 *
2145 * This function destroys the specified window and its context. On calling
2146 * this function, no further callbacks will be called for that window.
2147 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002148 * If the context of the specified window is current on the main thread, it is
2149 * detached before being destroyed.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002150 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002151 * @param[in] window The window to destroy.
Camilla Berglund9ad1d972012-11-22 19:08:30 +01002152 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002153 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2154 * GLFW_PLATFORM_ERROR.
2155 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002156 * @note The context of the specified window must not be current on any other
2157 * thread when this function is called.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002158 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002159 * @reentrancy This function must not be called from a callback.
Camilla Berglund44372b82014-12-17 01:31:36 +01002160 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002161 * @thread_safety This function must only be called from the main thread.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002162 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002163 * @sa @ref window_creation
Camilla Berglund7e9e3212016-09-14 20:17:26 +02002164 * @sa @ref glfwCreateWindow
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002165 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002166 * @since Added in version 3.0. Replaces `glfwCloseWindow`.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002167 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002168 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002169 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01002170GLFWAPI void glfwDestroyWindow(GLFWwindow* window);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002171
Camilla Berglund64afb192013-03-06 23:29:37 +01002172/*! @brief Checks the close flag of the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002173 *
2174 * This function returns the value of the close flag of the specified window.
2175 *
Camilla Berglund6fadf372013-03-01 13:45:12 +01002176 * @param[in] window The window to query.
Camilla Berglund64afb192013-03-06 23:29:37 +01002177 * @return The value of the close flag.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002178 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002179 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
2180 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002181 * @thread_safety This function may be called from any thread. Access is not
2182 * synchronized.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002183 *
2184 * @sa @ref window_close
2185 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002186 * @since Added in version 3.0.
Camilla Berglund6632cc72013-07-11 02:00:48 +02002187 *
Camilla Berglund6fadf372013-03-01 13:45:12 +01002188 * @ingroup window
2189 */
2190GLFWAPI int glfwWindowShouldClose(GLFWwindow* window);
2191
Camilla Berglund64afb192013-03-06 23:29:37 +01002192/*! @brief Sets the close flag of the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002193 *
2194 * This function sets the value of the close flag of the specified window.
2195 * This can be used to override the user's attempt to close the window, or
2196 * to signal that it should be closed.
2197 *
Camilla Berglund64afb192013-03-06 23:29:37 +01002198 * @param[in] window The window whose flag to change.
Camilla Berglund6fadf372013-03-01 13:45:12 +01002199 * @param[in] value The new value.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002200 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002201 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
2202 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002203 * @thread_safety This function may be called from any thread. Access is not
2204 * synchronized.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002205 *
2206 * @sa @ref window_close
2207 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002208 * @since Added in version 3.0.
Camilla Berglund6632cc72013-07-11 02:00:48 +02002209 *
Camilla Berglund6fadf372013-03-01 13:45:12 +01002210 * @ingroup window
Camilla Berglund6fadf372013-03-01 13:45:12 +01002211 */
2212GLFWAPI void glfwSetWindowShouldClose(GLFWwindow* window, int value);
2213
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002214/*! @brief Sets the title of the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002215 *
2216 * This function sets the window title, encoded as UTF-8, of the specified
2217 * window.
2218 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002219 * @param[in] window The window whose title to change.
2220 * @param[in] title The UTF-8 encoded window title.
Camilla Berglund9ad1d972012-11-22 19:08:30 +01002221 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002222 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2223 * GLFW_PLATFORM_ERROR.
2224 *
Camilla Berglund8d6f2652016-10-20 00:50:54 +02002225 * @remark @macos The window title will not be updated until the next time you
Camilla Berglund951a9582016-01-31 21:32:14 +01002226 * process events.
Camilla Berglund6412dcb2015-04-07 21:52:29 +02002227 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002228 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002229 *
2230 * @sa @ref window_title
2231 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002232 * @since Added in version 1.0.
Camilla Berglund951a9582016-01-31 21:32:14 +01002233 * @glfw3 Added window handle parameter.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002234 *
2235 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002236 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01002237GLFWAPI void glfwSetWindowTitle(GLFWwindow* window, const char* title);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002238
Camilla Berglundb823f712016-03-07 14:55:30 +01002239/*! @brief Sets the icon for the specified window.
2240 *
2241 * This function sets the icon of the specified window. If passed an array of
2242 * candidate images, those of or closest to the sizes desired by the system are
2243 * selected. If no images are specified, the window reverts to its default
2244 * icon.
2245 *
2246 * The desired image sizes varies depending on platform and system settings.
2247 * The selected images will be rescaled as needed. Good sizes include 16x16,
2248 * 32x32 and 48x48.
2249 *
2250 * @param[in] window The window whose icon to set.
2251 * @param[in] count The number of images in the specified array, or zero to
2252 * revert to the default window icon.
2253 * @param[in] images The images to create the icon from. This is ignored if
2254 * count is zero.
2255 *
2256 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2257 * GLFW_PLATFORM_ERROR.
2258 *
2259 * @pointer_lifetime The specified image data is copied before this function
2260 * returns.
2261 *
Camilla Berglund8d6f2652016-10-20 00:50:54 +02002262 * @remark @macos The GLFW window has no icon, as it is not a document
Camilla Berglund20bce152016-05-30 16:04:37 +02002263 * window, so this function does nothing. The dock icon will be the same as
2264 * the application bundle's icon. For more information on bundles, see the
Camilla Berglundb823f712016-03-07 14:55:30 +01002265 * [Bundle Programming Guide](https://developer.apple.com/library/mac/documentation/CoreFoundation/Conceptual/CFBundles/)
2266 * in the Mac Developer Library.
2267 *
linkmauvebc8b0482016-10-16 15:52:39 +01002268 * @remark @wayland The wl_shell protocol does not support icons, the window
2269 * will inherit the one defined in the application's desktop file, so this
2270 * function emits @ref GLFW_PLATFORM_ERROR.
2271 *
Camilla Berglundb823f712016-03-07 14:55:30 +01002272 * @thread_safety This function must only be called from the main thread.
2273 *
2274 * @sa @ref window_icon
2275 *
2276 * @since Added in version 3.2.
2277 *
2278 * @ingroup window
2279 */
2280GLFWAPI void glfwSetWindowIcon(GLFWwindow* window, int count, const GLFWimage* images);
2281
Camilla Berglund7c193232013-01-24 19:30:31 +01002282/*! @brief Retrieves the position of the client area of the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002283 *
2284 * This function retrieves the position, in screen coordinates, of the
2285 * upper-left corner of the client area of the specified window.
2286 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002287 * Any or all of the position arguments may be `NULL`. If an error occurs, all
2288 * non-`NULL` position arguments will be set to zero.
2289 *
Camilla Berglund7c193232013-01-24 19:30:31 +01002290 * @param[in] window The window to query.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02002291 * @param[out] xpos Where to store the x-coordinate of the upper-left corner of
2292 * the client area, or `NULL`.
2293 * @param[out] ypos Where to store the y-coordinate of the upper-left corner of
2294 * the client area, or `NULL`.
Camilla Berglund7c193232013-01-24 19:30:31 +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 There is no way for an application to retrieve the global
2300 * position of its windows, this function will always emit @ref
2301 * GLFW_PLATFORM_ERROR.
2302 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002303 * @thread_safety This function must only be called from the main thread.
Camilla Berglund0e205772014-03-24 11:58:35 +01002304 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002305 * @sa @ref window_pos
Camilla Berglund7e9e3212016-09-14 20:17:26 +02002306 * @sa @ref glfwSetWindowPos
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002307 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002308 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002309 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002310 * @ingroup window
Camilla Berglund7c193232013-01-24 19:30:31 +01002311 */
2312GLFWAPI void glfwGetWindowPos(GLFWwindow* window, int* xpos, int* ypos);
2313
2314/*! @brief Sets the position of the client area of the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002315 *
2316 * This function sets the position, in screen coordinates, of the upper-left
Camilla Berglund4591ad22014-09-18 15:03:29 +02002317 * corner of the client area of the specified windowed mode window. If the
2318 * window is a full screen window, this function does nothing.
Camilla Berglund8282a8f2013-04-10 23:01:12 +02002319 *
Camilla Berglundce8f97c2015-01-11 23:33:14 +01002320 * __Do not use this function__ to move an already visible window unless you
2321 * have very good reasons for doing so, as it will confuse and annoy the user.
2322 *
2323 * The window manager may put limits on what positions are allowed. GLFW
2324 * cannot and should not override these limits.
2325 *
Camilla Berglund7c193232013-01-24 19:30:31 +01002326 * @param[in] window The window to query.
2327 * @param[in] xpos The x-coordinate of the upper-left corner of the client area.
2328 * @param[in] ypos The y-coordinate of the upper-left corner of the client area.
Camilla Berglund7c193232013-01-24 19:30:31 +01002329 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002330 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2331 * GLFW_PLATFORM_ERROR.
2332 *
linkmauvebc8b0482016-10-16 15:52:39 +01002333 * @remark @wayland There is no way for an application to set the global
2334 * position of its windows, this function will always emit @ref
2335 * GLFW_PLATFORM_ERROR.
2336 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002337 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002338 *
2339 * @sa @ref window_pos
Camilla Berglund7e9e3212016-09-14 20:17:26 +02002340 * @sa @ref glfwGetWindowPos
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002341 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002342 * @since Added in version 1.0.
Camilla Berglund951a9582016-01-31 21:32:14 +01002343 * @glfw3 Added window handle parameter.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002344 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002345 * @ingroup window
Camilla Berglund7c193232013-01-24 19:30:31 +01002346 */
Camilla Berglund52f718d2013-02-12 12:01:12 +01002347GLFWAPI void glfwSetWindowPos(GLFWwindow* window, int xpos, int ypos);
Camilla Berglund7c193232013-01-24 19:30:31 +01002348
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002349/*! @brief Retrieves the size of the client area of the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002350 *
Camilla Berglund8282a8f2013-04-10 23:01:12 +02002351 * This function retrieves the size, in screen coordinates, of the client area
Camilla Berglund521fa7d2013-09-26 20:02:19 +02002352 * of the specified window. If you wish to retrieve the size of the
Camilla Berglundce8f97c2015-01-11 23:33:14 +01002353 * framebuffer of the window in pixels, see @ref glfwGetFramebufferSize.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002354 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002355 * Any or all of the size arguments may be `NULL`. If an error occurs, all
2356 * non-`NULL` size arguments will be set to zero.
2357 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002358 * @param[in] window The window whose size to retrieve.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02002359 * @param[out] width Where to store the width, in screen coordinates, of the
2360 * client area, or `NULL`.
2361 * @param[out] height Where to store the height, in screen coordinates, of the
2362 * client area, or `NULL`.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002363 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002364 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2365 * GLFW_PLATFORM_ERROR.
2366 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002367 * @thread_safety This function must only be called from the main thread.
Camilla Berglund0e205772014-03-24 11:58:35 +01002368 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002369 * @sa @ref window_size
Camilla Berglund7e9e3212016-09-14 20:17:26 +02002370 * @sa @ref glfwSetWindowSize
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002371 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002372 * @since Added in version 1.0.
Camilla Berglund951a9582016-01-31 21:32:14 +01002373 * @glfw3 Added window handle parameter.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002374 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002375 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002376 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01002377GLFWAPI void glfwGetWindowSize(GLFWwindow* window, int* width, int* height);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002378
Camilla Berglundd84772d2014-02-13 02:57:59 +01002379/*! @brief Sets the size limits of the specified window.
2380 *
2381 * This function sets the size limits of the client area of the specified
Emmanuel Gil Peyrotf0f5d9f2016-04-09 00:42:58 +01002382 * window. If the window is full screen, the size limits only take effect
Camilla Berglund6570d0c2016-02-23 12:26:42 +01002383 * once it is made windowed. If the window is not resizable, this function
2384 * does nothing.
Camilla Berglundd84772d2014-02-13 02:57:59 +01002385 *
Camilla Berglund6570d0c2016-02-23 12:26:42 +01002386 * The size limits are applied immediately to a windowed mode window and may
2387 * cause it to be resized.
Camilla Berglundd84772d2014-02-13 02:57:59 +01002388 *
Camilla Berglund12a69562016-05-04 16:28:08 +02002389 * The maximum dimensions must be greater than or equal to the minimum
2390 * dimensions and all must be greater than or equal to zero.
2391 *
Camilla Berglundd84772d2014-02-13 02:57:59 +01002392 * @param[in] window The window to set limits for.
2393 * @param[in] minwidth The minimum width, in screen coordinates, of the client
2394 * area, or `GLFW_DONT_CARE`.
2395 * @param[in] minheight The minimum height, in screen coordinates, of the
2396 * client area, or `GLFW_DONT_CARE`.
2397 * @param[in] maxwidth The maximum width, in screen coordinates, of the client
2398 * area, or `GLFW_DONT_CARE`.
2399 * @param[in] maxheight The maximum height, in screen coordinates, of the
2400 * client area, or `GLFW_DONT_CARE`.
2401 *
Camilla Berglund12a69562016-05-04 16:28:08 +02002402 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
2403 * GLFW_INVALID_VALUE and @ref GLFW_PLATFORM_ERROR.
Camilla Berglundf51cf812016-02-05 00:51:40 +01002404 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002405 * @remark If you set size limits and an aspect ratio that conflict, the
Camilla Berglundd84772d2014-02-13 02:57:59 +01002406 * results are undefined.
2407 *
linkmauvebc8b0482016-10-16 15:52:39 +01002408 * @remark @wayland The size limits will not be applied until the window is
2409 * actually resized, either by the user or by the compositor.
2410 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002411 * @thread_safety This function must only be called from the main thread.
Camilla Berglundd84772d2014-02-13 02:57:59 +01002412 *
2413 * @sa @ref window_sizelimits
Camilla Berglund7e9e3212016-09-14 20:17:26 +02002414 * @sa @ref glfwSetWindowAspectRatio
Camilla Berglundd84772d2014-02-13 02:57:59 +01002415 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002416 * @since Added in version 3.2.
Camilla Berglundd84772d2014-02-13 02:57:59 +01002417 *
2418 * @ingroup window
2419 */
2420GLFWAPI void glfwSetWindowSizeLimits(GLFWwindow* window, int minwidth, int minheight, int maxwidth, int maxheight);
2421
2422/*! @brief Sets the aspect ratio of the specified window.
2423 *
2424 * This function sets the required aspect ratio of the client area of the
Camilla Berglund6570d0c2016-02-23 12:26:42 +01002425 * specified window. If the window is full screen, the aspect ratio only takes
2426 * effect once it is made windowed. If the window is not resizable, this
Camilla Berglundd84772d2014-02-13 02:57:59 +01002427 * function does nothing.
2428 *
Camilla Berglundaf5b82a2015-10-19 16:01:42 +02002429 * The aspect ratio is specified as a numerator and a denominator and both
2430 * values must be greater than zero. For example, the common 16:9 aspect ratio
2431 * is specified as 16 and 9, respectively.
Camilla Berglundd84772d2014-02-13 02:57:59 +01002432 *
Camilla Berglundaf5b82a2015-10-19 16:01:42 +02002433 * If the numerator and denominator is set to `GLFW_DONT_CARE` then the aspect
2434 * ratio limit is disabled.
Camilla Berglundd84772d2014-02-13 02:57:59 +01002435 *
Camilla Berglund6570d0c2016-02-23 12:26:42 +01002436 * The aspect ratio is applied immediately to a windowed mode window and may
2437 * cause it to be resized.
Camilla Berglundd84772d2014-02-13 02:57:59 +01002438 *
2439 * @param[in] window The window to set limits for.
2440 * @param[in] numer The numerator of the desired aspect ratio, or
2441 * `GLFW_DONT_CARE`.
2442 * @param[in] denom The denominator of the desired aspect ratio, or
2443 * `GLFW_DONT_CARE`.
2444 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002445 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
2446 * GLFW_INVALID_VALUE and @ref GLFW_PLATFORM_ERROR.
2447 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002448 * @remark If you set size limits and an aspect ratio that conflict, the
Camilla Berglundd84772d2014-02-13 02:57:59 +01002449 * results are undefined.
2450 *
linkmauvebc8b0482016-10-16 15:52:39 +01002451 * @remark @wayland The aspect ratio will not be applied until the window is
2452 * actually resized, either by the user or by the compositor.
2453 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002454 * @thread_safety This function must only be called from the main thread.
Camilla Berglundd84772d2014-02-13 02:57:59 +01002455 *
2456 * @sa @ref window_sizelimits
Camilla Berglund7e9e3212016-09-14 20:17:26 +02002457 * @sa @ref glfwSetWindowSizeLimits
Camilla Berglundd84772d2014-02-13 02:57:59 +01002458 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002459 * @since Added in version 3.2.
Camilla Berglundd84772d2014-02-13 02:57:59 +01002460 *
2461 * @ingroup window
2462 */
2463GLFWAPI void glfwSetWindowAspectRatio(GLFWwindow* window, int numer, int denom);
2464
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002465/*! @brief Sets the size of the client area of the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002466 *
Camilla Berglund8282a8f2013-04-10 23:01:12 +02002467 * This function sets the size, in screen coordinates, of the client area of
2468 * the specified window.
2469 *
Camilla Berglund6570d0c2016-02-23 12:26:42 +01002470 * For full screen windows, this function updates the resolution of its desired
2471 * video mode and switches to the video mode closest to it, without affecting
2472 * the window's context. As the context is unaffected, the bit depths of the
2473 * framebuffer remain unchanged.
2474 *
2475 * If you wish to update the refresh rate of the desired video mode in addition
2476 * to its resolution, see @ref glfwSetWindowMonitor.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002477 *
Camilla Berglundce8f97c2015-01-11 23:33:14 +01002478 * The window manager may put limits on what sizes are allowed. GLFW cannot
2479 * and should not override these limits.
2480 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002481 * @param[in] window The window to resize.
Camilla Berglund6570d0c2016-02-23 12:26:42 +01002482 * @param[in] width The desired width, in screen coordinates, of the window
2483 * client area.
2484 * @param[in] height The desired height, in screen coordinates, of the window
2485 * client area.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002486 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002487 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2488 * GLFW_PLATFORM_ERROR.
2489 *
linkmauvebc8b0482016-10-16 15:52:39 +01002490 * @remark @wayland A full screen window will not attempt to change the mode,
2491 * no matter what the requested size.
2492 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002493 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002494 *
2495 * @sa @ref window_size
Camilla Berglund7e9e3212016-09-14 20:17:26 +02002496 * @sa @ref glfwGetWindowSize
2497 * @sa @ref glfwSetWindowMonitor
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002498 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002499 * @since Added in version 1.0.
Camilla Berglund951a9582016-01-31 21:32:14 +01002500 * @glfw3 Added window handle parameter.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002501 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002502 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002503 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01002504GLFWAPI void glfwSetWindowSize(GLFWwindow* window, int width, int height);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002505
Camilla Berglund34981632013-06-03 12:51:57 +02002506/*! @brief Retrieves the size of the framebuffer of the specified window.
2507 *
2508 * This function retrieves the size, in pixels, of the framebuffer of the
Camilla Berglund521fa7d2013-09-26 20:02:19 +02002509 * specified window. If you wish to retrieve the size of the window in screen
2510 * coordinates, see @ref glfwGetWindowSize.
Camilla Berglund34981632013-06-03 12:51:57 +02002511 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002512 * Any or all of the size arguments may be `NULL`. If an error occurs, all
2513 * non-`NULL` size arguments will be set to zero.
2514 *
Camilla Berglund34981632013-06-03 12:51:57 +02002515 * @param[in] window The window whose framebuffer to query.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02002516 * @param[out] width Where to store the width, in pixels, of the framebuffer,
2517 * or `NULL`.
2518 * @param[out] height Where to store the height, in pixels, of the framebuffer,
2519 * or `NULL`.
Camilla Berglund34981632013-06-03 12:51:57 +02002520 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002521 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2522 * GLFW_PLATFORM_ERROR.
2523 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002524 * @thread_safety This function must only be called from the main thread.
Camilla Berglund0e205772014-03-24 11:58:35 +01002525 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002526 * @sa @ref window_fbsize
Camilla Berglund7e9e3212016-09-14 20:17:26 +02002527 * @sa @ref glfwSetFramebufferSizeCallback
Camilla Berglund34981632013-06-03 12:51:57 +02002528 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002529 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002530 *
Camilla Berglund34981632013-06-03 12:51:57 +02002531 * @ingroup window
2532 */
2533GLFWAPI void glfwGetFramebufferSize(GLFWwindow* window, int* width, int* height);
2534
Camilla Berglundeb3f75e2014-03-25 21:30:13 +01002535/*! @brief Retrieves the size of the frame of the window.
2536 *
2537 * This function retrieves the size, in screen coordinates, of each edge of the
2538 * frame of the specified window. This size includes the title bar, if the
2539 * window has one. The size of the frame may vary depending on the
2540 * [window-related hints](@ref window_hints_wnd) used to create it.
2541 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002542 * Because this function retrieves the size of each window frame edge and not
2543 * the offset along a particular coordinate axis, the retrieved values will
2544 * always be zero or positive.
2545 *
2546 * Any or all of the size arguments may be `NULL`. If an error occurs, all
2547 * non-`NULL` size arguments will be set to zero.
2548 *
Camilla Berglundeb3f75e2014-03-25 21:30:13 +01002549 * @param[in] window The window whose frame size to query.
2550 * @param[out] left Where to store the size, in screen coordinates, of the left
Camilla Berglund4591ad22014-09-18 15:03:29 +02002551 * edge of the window frame, or `NULL`.
Camilla Berglundeaff0f72014-04-07 16:27:32 +02002552 * @param[out] top Where to store the size, in screen coordinates, of the top
Camilla Berglund4591ad22014-09-18 15:03:29 +02002553 * edge of the window frame, or `NULL`.
Camilla Berglundeaff0f72014-04-07 16:27:32 +02002554 * @param[out] right Where to store the size, in screen coordinates, of the
Camilla Berglund4591ad22014-09-18 15:03:29 +02002555 * right edge of the window frame, or `NULL`.
Camilla Berglundeaff0f72014-04-07 16:27:32 +02002556 * @param[out] bottom Where to store the size, in screen coordinates, of the
Camilla Berglund4591ad22014-09-18 15:03:29 +02002557 * bottom edge of the window frame, or `NULL`.
Camilla Berglundeb3f75e2014-03-25 21:30:13 +01002558 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002559 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2560 * GLFW_PLATFORM_ERROR.
2561 *
linkmauvebc8b0482016-10-16 15:52:39 +01002562 * @remark @wayland The window frame is currently unimplemented, as if
Camilla Löwyce161c22016-12-06 01:14:23 +01002563 * [GLFW_DECORATED](@ref GLFW_DECORATED_hint) was always set to `GLFW_FALSE`,
2564 * so the returned values will always be zero.
linkmauvebc8b0482016-10-16 15:52:39 +01002565 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002566 * @thread_safety This function must only be called from the main thread.
Camilla Berglundeb3f75e2014-03-25 21:30:13 +01002567 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002568 * @sa @ref window_size
2569 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002570 * @since Added in version 3.1.
Camilla Berglundeb3f75e2014-03-25 21:30:13 +01002571 *
2572 * @ingroup window
2573 */
2574GLFWAPI void glfwGetWindowFrameSize(GLFWwindow* window, int* left, int* top, int* right, int* bottom);
2575
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002576/*! @brief Iconifies the specified window.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002577 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002578 * This function iconifies (minimizes) the specified window if it was
2579 * previously restored. If the window is already iconified, this function does
2580 * nothing.
2581 *
2582 * If the specified window is a full screen window, the original monitor
2583 * resolution is restored until the window is restored.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002584 *
2585 * @param[in] window The window to iconify.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002586 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002587 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2588 * GLFW_PLATFORM_ERROR.
2589 *
linkmauvebc8b0482016-10-16 15:52:39 +01002590 * @remark @wayland There is no concept of iconification in wl_shell, this
2591 * function will always emit @ref GLFW_PLATFORM_ERROR.
2592 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002593 * @thread_safety This function must only be called from the main thread.
Camilla Berglund9ad1d972012-11-22 19:08:30 +01002594 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002595 * @sa @ref window_iconify
Camilla Berglund7e9e3212016-09-14 20:17:26 +02002596 * @sa @ref glfwRestoreWindow
2597 * @sa @ref glfwMaximizeWindow
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002598 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002599 * @since Added in version 2.1.
Camilla Berglund951a9582016-01-31 21:32:14 +01002600 * @glfw3 Added window handle parameter.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002601 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002602 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002603 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01002604GLFWAPI void glfwIconifyWindow(GLFWwindow* window);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002605
2606/*! @brief Restores the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002607 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002608 * This function restores the specified window if it was previously iconified
Camilla Berglunda10caa42015-10-13 12:50:59 +02002609 * (minimized) or maximized. If the window is already restored, this function
2610 * does nothing.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002611 *
2612 * If the specified window is a full screen window, the resolution chosen for
2613 * the window is restored on the selected monitor.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002614 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002615 * @param[in] window The window to restore.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002616 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002617 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2618 * GLFW_PLATFORM_ERROR.
2619 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002620 * @thread_safety This function must only be called from the main thread.
Camilla Berglund9ad1d972012-11-22 19:08:30 +01002621 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002622 * @sa @ref window_iconify
Camilla Berglund7e9e3212016-09-14 20:17:26 +02002623 * @sa @ref glfwIconifyWindow
2624 * @sa @ref glfwMaximizeWindow
Camilla Berglunde248fb62013-03-29 14:06:23 +01002625 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002626 * @since Added in version 2.1.
Camilla Berglund951a9582016-01-31 21:32:14 +01002627 * @glfw3 Added window handle parameter.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002628 *
Camilla Berglunde248fb62013-03-29 14:06:23 +01002629 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002630 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01002631GLFWAPI void glfwRestoreWindow(GLFWwindow* window);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002632
Camilla Berglunda10caa42015-10-13 12:50:59 +02002633/*! @brief Maximizes the specified window.
2634 *
2635 * This function maximizes the specified window if it was previously not
2636 * maximized. If the window is already maximized, this function does nothing.
2637 *
2638 * If the specified window is a full screen window, this function does nothing.
2639 *
2640 * @param[in] window The window to maximize.
2641 *
Camilla Berglundf5b71f52016-05-27 14:20:39 +02002642 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2643 * GLFW_PLATFORM_ERROR.
2644 *
Camilla Berglunda10caa42015-10-13 12:50:59 +02002645 * @par Thread Safety
2646 * This function may only be called from the main thread.
2647 *
2648 * @sa @ref window_iconify
Camilla Berglund7e9e3212016-09-14 20:17:26 +02002649 * @sa @ref glfwIconifyWindow
2650 * @sa @ref glfwRestoreWindow
Camilla Berglunda10caa42015-10-13 12:50:59 +02002651 *
2652 * @since Added in GLFW 3.2.
2653 *
2654 * @ingroup window
2655 */
2656GLFWAPI void glfwMaximizeWindow(GLFWwindow* window);
2657
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002658/*! @brief Makes the specified window visible.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002659 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002660 * This function makes the specified window visible if it was previously
Camilla Berglund8282a8f2013-04-10 23:01:12 +02002661 * hidden. If the window is already visible or is in full screen mode, this
Camilla Berglund1e9383d2012-11-23 11:41:53 +01002662 * function does nothing.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002663 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002664 * @param[in] window The window to make visible.
2665 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002666 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2667 * GLFW_PLATFORM_ERROR.
2668 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002669 * @thread_safety This function must only be called from the main thread.
Camilla Berglund9ad1d972012-11-22 19:08:30 +01002670 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002671 * @sa @ref window_hide
Camilla Berglund7e9e3212016-09-14 20:17:26 +02002672 * @sa @ref glfwHideWindow
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002673 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002674 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002675 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002676 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002677 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01002678GLFWAPI void glfwShowWindow(GLFWwindow* window);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002679
2680/*! @brief Hides the specified window.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002681 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002682 * This function hides the specified window if it was previously visible. If
Camilla Berglund8282a8f2013-04-10 23:01:12 +02002683 * the window is already hidden or is in full screen mode, this function does
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002684 * nothing.
2685 *
2686 * @param[in] window The window to hide.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002687 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002688 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2689 * GLFW_PLATFORM_ERROR.
2690 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002691 * @thread_safety This function must only be called from the main thread.
Camilla Berglund9ad1d972012-11-22 19:08:30 +01002692 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002693 * @sa @ref window_hide
Camilla Berglund7e9e3212016-09-14 20:17:26 +02002694 * @sa @ref glfwShowWindow
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002695 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002696 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002697 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002698 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002699 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01002700GLFWAPI void glfwHideWindow(GLFWwindow* window);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002701
Camilla Berglundbaf57442016-02-21 15:42:49 +01002702/*! @brief Brings the specified window to front and sets input focus.
2703 *
2704 * This function brings the specified window to front and sets input focus.
2705 * The window should already be visible and not iconified.
2706 *
2707 * By default, both windowed and full screen mode windows are focused when
Camilla Löwyce161c22016-12-06 01:14:23 +01002708 * initially created. Set the [GLFW_FOCUSED](@ref GLFW_FOCUSED_hint) to
2709 * disable this behavior.
Camilla Berglundbaf57442016-02-21 15:42:49 +01002710 *
2711 * __Do not use this function__ to steal focus from other applications unless
2712 * you are certain that is what the user wants. Focus stealing can be
2713 * extremely disruptive.
2714 *
2715 * @param[in] window The window to give input focus.
2716 *
2717 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2718 * GLFW_PLATFORM_ERROR.
2719 *
linkmauvebc8b0482016-10-16 15:52:39 +01002720 * @remark @wayland It is not possible for an application to bring its windows
2721 * to front, this function will always emit @ref GLFW_PLATFORM_ERROR.
2722 *
Camilla Berglundbaf57442016-02-21 15:42:49 +01002723 * @thread_safety This function must only be called from the main thread.
2724 *
2725 * @sa @ref window_focus
2726 *
2727 * @since Added in version 3.2.
2728 *
2729 * @ingroup window
2730 */
2731GLFWAPI void glfwFocusWindow(GLFWwindow* window);
2732
Camilla Berglund8282a8f2013-04-10 23:01:12 +02002733/*! @brief Returns the monitor that the window uses for full screen mode.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002734 *
2735 * This function returns the handle of the monitor that the specified window is
Camilla Berglund8282a8f2013-04-10 23:01:12 +02002736 * in full screen on.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002737 *
Camilla Berglund5f68e122012-11-27 17:07:28 +01002738 * @param[in] window The window to query.
Camilla Berglund999f3552016-08-17 16:48:22 +02002739 * @return The monitor, or `NULL` if the window is in windowed mode or an
2740 * [error](@ref error_handling) occurred.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002741 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002742 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
2743 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002744 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002745 *
2746 * @sa @ref window_monitor
Camilla Berglund7e9e3212016-09-14 20:17:26 +02002747 * @sa @ref glfwSetWindowMonitor
Camilla Berglund4591ad22014-09-18 15:03:29 +02002748 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002749 * @since Added in version 3.0.
Camilla Berglund0e205772014-03-24 11:58:35 +01002750 *
Camilla Berglund5f68e122012-11-27 17:07:28 +01002751 * @ingroup window
Camilla Berglund41bc0d12012-11-27 16:55:04 +01002752 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01002753GLFWAPI GLFWmonitor* glfwGetWindowMonitor(GLFWwindow* window);
Camilla Berglund41bc0d12012-11-27 16:55:04 +01002754
Camilla Berglund6570d0c2016-02-23 12:26:42 +01002755/*! @brief Sets the mode, monitor, video mode and placement of a window.
2756 *
2757 * This function sets the monitor that the window uses for full screen mode or,
2758 * if the monitor is `NULL`, makes it windowed mode.
2759 *
2760 * When setting a monitor, this function updates the width, height and refresh
2761 * rate of the desired video mode and switches to the video mode closest to it.
2762 * The window position is ignored when setting a monitor.
2763 *
2764 * When the monitor is `NULL`, the position, width and height are used to
2765 * place the window client area. The refresh rate is ignored when no monitor
2766 * is specified.
2767 *
2768 * If you only wish to update the resolution of a full screen window or the
2769 * size of a windowed mode window, see @ref glfwSetWindowSize.
2770 *
2771 * When a window transitions from full screen to windowed mode, this function
2772 * restores any previous window settings such as whether it is decorated,
linkmauvebc8b0482016-10-16 15:52:39 +01002773 * floating, resizable, has size or aspect ratio limits, etc.
Camilla Berglund6570d0c2016-02-23 12:26:42 +01002774 *
2775 * @param[in] window The window whose monitor, size or video mode to set.
2776 * @param[in] monitor The desired monitor, or `NULL` to set windowed mode.
2777 * @param[in] xpos The desired x-coordinate of the upper-left corner of the
2778 * client area.
2779 * @param[in] ypos The desired y-coordinate of the upper-left corner of the
2780 * client area.
2781 * @param[in] width The desired with, in screen coordinates, of the client area
2782 * or video mode.
2783 * @param[in] height The desired height, in screen coordinates, of the client
2784 * area or video mode.
Camilla Berglund325729d2016-05-22 14:25:04 +02002785 * @param[in] refreshRate The desired refresh rate, in Hz, of the video mode,
2786 * or `GLFW_DONT_CARE`.
Camilla Berglund6570d0c2016-02-23 12:26:42 +01002787 *
2788 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2789 * GLFW_PLATFORM_ERROR.
2790 *
Camilla Berglundec171612016-10-28 06:20:20 +02002791 * @remark The OpenGL or OpenGL ES context will not be destroyed or otherwise
2792 * affected by any resizing or mode switching, although you may need to update
2793 * your viewport if the framebuffer size has changed.
2794 *
linkmauvebc8b0482016-10-16 15:52:39 +01002795 * @remark @wayland The desired window position is ignored, as there is no way
2796 * for an application to set this property.
2797 *
2798 * @remark @wayland Setting the window to full screen will not attempt to
2799 * change the mode, no matter what the requested size or refresh rate.
2800 *
Camilla Berglund6570d0c2016-02-23 12:26:42 +01002801 * @thread_safety This function must only be called from the main thread.
2802 *
2803 * @sa @ref window_monitor
2804 * @sa @ref window_full_screen
Camilla Berglund7e9e3212016-09-14 20:17:26 +02002805 * @sa @ref glfwGetWindowMonitor
2806 * @sa @ref glfwSetWindowSize
Camilla Berglund6570d0c2016-02-23 12:26:42 +01002807 *
2808 * @since Added in version 3.2.
2809 *
2810 * @ingroup window
2811 */
2812GLFWAPI void glfwSetWindowMonitor(GLFWwindow* window, GLFWmonitor* monitor, int xpos, int ypos, int width, int height, int refreshRate);
2813
Camilla Berglundad1f6f02013-05-27 15:30:32 +02002814/*! @brief Returns an attribute of the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002815 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002816 * This function returns the value of an attribute of the specified window or
2817 * its OpenGL or OpenGL ES context.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002818 *
Camilla Berglund1e9383d2012-11-23 11:41:53 +01002819 * @param[in] window The window to query.
Camilla Berglund1f5f20e2013-05-27 17:10:34 +02002820 * @param[in] attrib The [window attribute](@ref window_attribs) whose value to
2821 * return.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002822 * @return The value of the attribute, or zero if an
2823 * [error](@ref error_handling) occurred.
Camilla Berglund1e9383d2012-11-23 11:41:53 +01002824 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002825 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
2826 * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR.
2827 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002828 * @remark Framebuffer related hints are not window attributes. See @ref
Camilla Berglund59abeeb2015-04-07 14:34:12 +02002829 * window_attribs_fb for more information.
2830 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002831 * @remark Zero is a valid value for many window and context related
Camilla Berglund59abeeb2015-04-07 14:34:12 +02002832 * attributes so you cannot use a return value of zero as an indication of
2833 * errors. However, this function should not fail as long as it is passed
2834 * valid arguments and the library has been [initialized](@ref intro_init).
2835 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002836 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002837 *
2838 * @sa @ref window_attribs
Camilla Löwy9e560992016-09-30 01:52:22 +02002839 * @sa @ref glfwSetWindowAttrib
Camilla Berglund4591ad22014-09-18 15:03:29 +02002840 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002841 * @since Added in version 3.0. Replaces `glfwGetWindowParam` and
Camilla Berglund4188c262015-01-18 01:55:25 +01002842 * `glfwGetGLVersion`.
Camilla Berglund0e205772014-03-24 11:58:35 +01002843 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002844 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002845 */
Camilla Berglundad1f6f02013-05-27 15:30:32 +02002846GLFWAPI int glfwGetWindowAttrib(GLFWwindow* window, int attrib);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002847
Camilla Löwy9e560992016-09-30 01:52:22 +02002848/*! @brief Sets an attribute of the specified window.
2849 *
2850 * This function sets the value of an attribute of the specified window.
2851 *
2852 * The supported attributes are [GLFW_DECORATED](@ref GLFW_DECORATED_attrib),
2853 * [GLFW_RESIZABLE](@ref GLFW_RESIZABLE_attrib),
2854 * [GLFW_FLOATING](@ref GLFW_FLOATING_attrib) and
2855 * [GLFW_AUTO_ICONIFY](@ref GLFW_AUTO_ICONIFY_attrib).
2856 *
2857 * Some of these attributes are ignored for full screen windows. The new
2858 * value will take effect if the window is later made windowed.
2859 *
2860 * Some of these attributes are ignored for windowed mode windows. The new
2861 * value will take effect if the window is later made full screen.
2862 *
2863 * @param[in] window The window to set the attribute for.
2864 * @param[in] attrib A supported window attribute.
2865 * @param[in] value `GLFW_TRUE` or `GLFW_FALSE`.
2866 *
2867 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
2868 * GLFW_INVALID_ENUM, @ref GLFW_INVALID_VALUE and @ref GLFW_PLATFORM_ERROR.
2869 *
2870 * @remark Calling @ref glfwGetWindowAttrib will always return the latest
2871 * value, even if that value is ignored by the current mode of the window.
2872 *
2873 * @thread_safety This function must only be called from the main thread.
2874 *
2875 * @sa @ref window_attribs
2876 * @sa @ref glfwGetWindowAttrib
2877 *
2878 * @since Added in version 3.3.
2879 *
2880 * @ingroup window
2881 */
2882GLFWAPI void glfwSetWindowAttrib(GLFWwindow* window, int attrib, int value);
2883
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002884/*! @brief Sets the user pointer of the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002885 *
2886 * This function sets the user-defined pointer of the specified window. The
2887 * current value is retained until the window is destroyed. The initial value
2888 * is `NULL`.
2889 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002890 * @param[in] window The window whose pointer to set.
2891 * @param[in] pointer The new value.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002892 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002893 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
2894 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002895 * @thread_safety This function may be called from any thread. Access is not
2896 * synchronized.
Camilla Berglund0e205772014-03-24 11:58:35 +01002897 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002898 * @sa @ref window_userptr
Camilla Berglund7e9e3212016-09-14 20:17:26 +02002899 * @sa @ref glfwGetWindowUserPointer
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002900 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002901 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002902 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002903 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002904 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01002905GLFWAPI void glfwSetWindowUserPointer(GLFWwindow* window, void* pointer);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002906
2907/*! @brief Returns the user pointer of the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002908 *
2909 * This function returns the current value of the user-defined pointer of the
2910 * specified window. The initial value is `NULL`.
2911 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002912 * @param[in] window The window whose pointer to return.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002913 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002914 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
2915 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002916 * @thread_safety This function may be called from any thread. Access is not
2917 * synchronized.
Camilla Berglund0e205772014-03-24 11:58:35 +01002918 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002919 * @sa @ref window_userptr
Camilla Berglund7e9e3212016-09-14 20:17:26 +02002920 * @sa @ref glfwSetWindowUserPointer
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002921 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002922 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002923 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002924 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002925 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01002926GLFWAPI void* glfwGetWindowUserPointer(GLFWwindow* window);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002927
Camilla Berglund1a3d47d2012-11-30 13:56:42 +01002928/*! @brief Sets the position callback for the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002929 *
2930 * This function sets the position callback of the specified window, which is
2931 * called when the window is moved. The callback is provided with the screen
2932 * position of the upper-left corner of the client area of the window.
2933 *
Camilla Berglund1a3d47d2012-11-30 13:56:42 +01002934 * @param[in] window The window whose callback to set.
Camilla Berglund71d2b572013-03-12 15:33:05 +01002935 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
Camilla Berglund1a3d47d2012-11-30 13:56:42 +01002936 * callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02002937 * @return The previously set callback, or `NULL` if no callback was set or the
2938 * library had not been [initialized](@ref intro_init).
Camilla Berglund11a27de2013-04-08 21:21:21 +02002939 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002940 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
2941 *
linkmauvebc8b0482016-10-16 15:52:39 +01002942 * @remark @wayland This callback will never be called, as there is no way for
2943 * an application to know its global position.
2944 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002945 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002946 *
2947 * @sa @ref window_pos
2948 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002949 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002950 *
Camilla Berglund1a3d47d2012-11-30 13:56:42 +01002951 * @ingroup window
2952 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02002953GLFWAPI GLFWwindowposfun glfwSetWindowPosCallback(GLFWwindow* window, GLFWwindowposfun cbfun);
Camilla Berglund1a3d47d2012-11-30 13:56:42 +01002954
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002955/*! @brief Sets the size callback for the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002956 *
2957 * This function sets the size callback of the specified window, which is
2958 * called when the window is resized. The callback is provided with the size,
Camilla Berglund8282a8f2013-04-10 23:01:12 +02002959 * in screen coordinates, of the client area of the window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002960 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002961 * @param[in] window The window whose callback to set.
Camilla Berglund71d2b572013-03-12 15:33:05 +01002962 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002963 * callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02002964 * @return The previously set callback, or `NULL` if no callback was set or the
2965 * library had not been [initialized](@ref intro_init).
Camilla Berglund11a27de2013-04-08 21:21:21 +02002966 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002967 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
2968 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002969 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002970 *
2971 * @sa @ref window_size
2972 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002973 * @since Added in version 1.0.
2974 * @glfw3 Added window handle parameter and return value.
Camilla Berglund0e205772014-03-24 11:58:35 +01002975 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002976 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002977 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02002978GLFWAPI GLFWwindowsizefun glfwSetWindowSizeCallback(GLFWwindow* window, GLFWwindowsizefun cbfun);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002979
2980/*! @brief Sets the close callback for the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002981 *
2982 * This function sets the close callback of the specified window, which is
2983 * called when the user attempts to close the window, for example by clicking
2984 * the close widget in the title bar.
2985 *
2986 * The close flag is set before this callback is called, but you can modify it
2987 * at any time with @ref glfwSetWindowShouldClose.
2988 *
Camilla Berglund5fd409b2013-06-05 17:53:13 +02002989 * The close callback is not triggered by @ref glfwDestroyWindow.
2990 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002991 * @param[in] window The window whose callback to set.
Camilla Berglund71d2b572013-03-12 15:33:05 +01002992 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002993 * callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02002994 * @return The previously set callback, or `NULL` if no callback was set or the
2995 * library had not been [initialized](@ref intro_init).
Camilla Berglund11a27de2013-04-08 21:21:21 +02002996 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002997 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
2998 *
Camilla Berglund8d6f2652016-10-20 00:50:54 +02002999 * @remark @macos Selecting Quit from the application menu will trigger the
3000 * close callback for all windows.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003001 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003002 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003003 *
3004 * @sa @ref window_close
3005 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003006 * @since Added in version 2.5.
3007 * @glfw3 Added window handle parameter and return value.
Camilla Berglund0e205772014-03-24 11:58:35 +01003008 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003009 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003010 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02003011GLFWAPI GLFWwindowclosefun glfwSetWindowCloseCallback(GLFWwindow* window, GLFWwindowclosefun cbfun);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003012
3013/*! @brief Sets the refresh callback for the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003014 *
3015 * This function sets the refresh callback of the specified window, which is
3016 * called when the client area of the window needs to be redrawn, for example
3017 * if the window has been exposed after having been covered by another window.
3018 *
linkmauvebc8b0482016-10-16 15:52:39 +01003019 * On compositing window systems such as Aero, Compiz, Aqua or Wayland, where
3020 * the window contents are saved off-screen, this callback may be called only
3021 * very infrequently or never at all.
Camilla Berglund8282a8f2013-04-10 23:01:12 +02003022 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003023 * @param[in] window The window whose callback to set.
Camilla Berglund71d2b572013-03-12 15:33:05 +01003024 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003025 * callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02003026 * @return The previously set callback, or `NULL` if no callback was set or the
3027 * library had not been [initialized](@ref intro_init).
Camilla Berglund11a27de2013-04-08 21:21:21 +02003028 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003029 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
3030 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003031 * @thread_safety This function must only be called from the main thread.
Camilla Berglund0e205772014-03-24 11:58:35 +01003032 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003033 * @sa @ref window_refresh
3034 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003035 * @since Added in version 2.5.
3036 * @glfw3 Added window handle parameter and return value.
Camilla Berglunda3ff29a2012-12-02 15:47:10 +01003037 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003038 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003039 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02003040GLFWAPI GLFWwindowrefreshfun glfwSetWindowRefreshCallback(GLFWwindow* window, GLFWwindowrefreshfun cbfun);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003041
3042/*! @brief Sets the focus callback for the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003043 *
3044 * This function sets the focus callback of the specified window, which is
Camilla Berglund4188c262015-01-18 01:55:25 +01003045 * called when the window gains or loses input focus.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003046 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003047 * After the focus callback is called for a window that lost input focus,
3048 * synthetic key and mouse button release events will be generated for all such
3049 * that had been pressed. For more information, see @ref glfwSetKeyCallback
3050 * and @ref glfwSetMouseButtonCallback.
Camilla Berglund4538a522013-04-24 19:49:46 +02003051 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003052 * @param[in] window The window whose callback to set.
Camilla Berglund71d2b572013-03-12 15:33:05 +01003053 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003054 * callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02003055 * @return The previously set callback, or `NULL` if no callback was set or the
3056 * library had not been [initialized](@ref intro_init).
Camilla Berglund11a27de2013-04-08 21:21:21 +02003057 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003058 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
3059 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003060 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003061 *
3062 * @sa @ref window_focus
3063 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003064 * @since Added in version 3.0.
Camilla Berglund0e205772014-03-24 11:58:35 +01003065 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003066 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003067 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02003068GLFWAPI GLFWwindowfocusfun glfwSetWindowFocusCallback(GLFWwindow* window, GLFWwindowfocusfun cbfun);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003069
3070/*! @brief Sets the iconify callback for the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003071 *
3072 * This function sets the iconification callback of the specified window, which
3073 * is called when the window is iconified or restored.
3074 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003075 * @param[in] window The window whose callback to set.
Camilla Berglund71d2b572013-03-12 15:33:05 +01003076 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003077 * callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02003078 * @return The previously set callback, or `NULL` if no callback was set or the
3079 * library had not been [initialized](@ref intro_init).
Camilla Berglund11a27de2013-04-08 21:21:21 +02003080 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003081 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
3082 *
linkmauvebc8b0482016-10-16 15:52:39 +01003083 * @remark @wayland The wl_shell protocol has no concept of iconification,
3084 * this callback will never be called.
3085 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003086 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003087 *
3088 * @sa @ref window_iconify
3089 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003090 * @since Added in version 3.0.
Camilla Berglund0e205772014-03-24 11:58:35 +01003091 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003092 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003093 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02003094GLFWAPI GLFWwindowiconifyfun glfwSetWindowIconifyCallback(GLFWwindow* window, GLFWwindowiconifyfun cbfun);
Camilla Berglund135194a2010-09-09 18:15:32 +02003095
Camilla Berglundc156b502016-06-16 13:09:28 +02003096/*! @brief Sets the maximize callback for the specified window.
3097 *
3098 * This function sets the maximization callback of the specified window, which
3099 * is called when the window is maximized or restored.
3100 *
3101 * @param[in] window The window whose callback to set.
3102 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
3103 * callback.
3104 * @return The previously set callback, or `NULL` if no callback was set or the
3105 * library had not been [initialized](@ref intro_init).
3106 *
3107 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
3108 *
3109 * @thread_safety This function must only be called from the main thread.
3110 *
3111 * @sa @ref window_maximize
3112 *
3113 * @since Added in version 3.3.
3114 *
3115 * @ingroup window
3116 */
3117GLFWAPI GLFWwindowmaximizefun glfwSetWindowMaximizeCallback(GLFWwindow* window, GLFWwindowmaximizefun cbfun);
3118
Camilla Berglund34981632013-06-03 12:51:57 +02003119/*! @brief Sets the framebuffer resize callback for the specified window.
3120 *
3121 * This function sets the framebuffer resize callback of the specified window,
3122 * which is called when the framebuffer of the specified window is resized.
3123 *
3124 * @param[in] window The window whose callback to set.
3125 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
3126 * callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02003127 * @return The previously set callback, or `NULL` if no callback was set or the
3128 * library had not been [initialized](@ref intro_init).
Camilla Berglund34981632013-06-03 12:51:57 +02003129 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003130 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
3131 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003132 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003133 *
3134 * @sa @ref window_fbsize
3135 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003136 * @since Added in version 3.0.
Camilla Berglund0e205772014-03-24 11:58:35 +01003137 *
Camilla Berglund34981632013-06-03 12:51:57 +02003138 * @ingroup window
3139 */
3140GLFWAPI GLFWframebuffersizefun glfwSetFramebufferSizeCallback(GLFWwindow* window, GLFWframebuffersizefun cbfun);
3141
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003142/*! @brief Processes all pending events.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003143 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003144 * This function processes only those events that are already in the event
3145 * queue and then returns immediately. Processing events will cause the window
3146 * and input callbacks associated with those events to be called.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003147 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003148 * On some platforms, a window move, resize or menu operation will cause event
3149 * processing to block. This is due to how event processing is designed on
3150 * those platforms. You can use the
3151 * [window refresh callback](@ref window_refresh) to redraw the contents of
3152 * your window when necessary during such operations.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02003153 *
Camilla Löwy766a9dc2016-12-06 23:26:53 +01003154 * Do not assume that callbacks you set will _only_ be called in response to
3155 * event processing functions like this one. While it is necessary to poll for
3156 * events, window systems that require GLFW to register callbacks of its own
3157 * can pass events to GLFW in response to many window system function calls.
3158 * GLFW will pass those events on to the application callbacks before
3159 * returning.
Camilla Berglund401033c2013-03-12 19:17:07 +01003160 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003161 * Event processing is not required for joystick input to work.
Camilla Berglund9ad1d972012-11-22 19:08:30 +01003162 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003163 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
3164 * GLFW_PLATFORM_ERROR.
3165 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003166 * @reentrancy This function must not be called from a callback.
Camilla Berglundb48128f2013-02-14 18:49:03 +01003167 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003168 * @thread_safety This function must only be called from the main thread.
Camilla Berglund948cc042013-04-16 02:02:22 +02003169 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003170 * @sa @ref events
Camilla Berglund7e9e3212016-09-14 20:17:26 +02003171 * @sa @ref glfwWaitEvents
3172 * @sa @ref glfwWaitEventsTimeout
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003173 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003174 * @since Added in version 1.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003175 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003176 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003177 */
Camilla Berglund9a716692010-09-08 16:40:43 +02003178GLFWAPI void glfwPollEvents(void);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003179
Camilla Berglund4591ad22014-09-18 15:03:29 +02003180/*! @brief Waits until events are queued and processes them.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003181 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003182 * This function puts the calling thread to sleep until at least one event is
3183 * available in the event queue. Once one or more events are available,
3184 * it behaves exactly like @ref glfwPollEvents, i.e. the events in the queue
3185 * are processed and the function then returns immediately. Processing events
3186 * will cause the window and input callbacks associated with those events to be
3187 * called.
Camilla Berglund948cc042013-04-16 02:02:22 +02003188 *
3189 * Since not all events are associated with callbacks, this function may return
3190 * without a callback having been called even if you are monitoring all
3191 * callbacks.
3192 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003193 * On some platforms, a window move, resize or menu operation will cause event
3194 * processing to block. This is due to how event processing is designed on
3195 * those platforms. You can use the
3196 * [window refresh callback](@ref window_refresh) to redraw the contents of
3197 * your window when necessary during such operations.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003198 *
Camilla Löwy766a9dc2016-12-06 23:26:53 +01003199 * Do not assume that callbacks you set will _only_ be called in response to
3200 * event processing functions like this one. While it is necessary to poll for
3201 * events, window systems that require GLFW to register callbacks of its own
3202 * can pass events to GLFW in response to many window system function calls.
3203 * GLFW will pass those events on to the application callbacks before
3204 * returning.
Camilla Berglund4188c262015-01-18 01:55:25 +01003205 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003206 * If no windows exist, this function returns immediately. For synchronization
3207 * of threads in applications that do not create windows, use your threading
3208 * library of choice.
Camilla Berglund2ae46fa2013-12-04 19:12:24 +01003209 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003210 * Event processing is not required for joystick input to work.
Camilla Berglund9ad1d972012-11-22 19:08:30 +01003211 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003212 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
3213 * GLFW_PLATFORM_ERROR.
3214 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003215 * @reentrancy This function must not be called from a callback.
Camilla Berglund44372b82014-12-17 01:31:36 +01003216 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003217 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003218 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003219 * @sa @ref events
Camilla Berglund7e9e3212016-09-14 20:17:26 +02003220 * @sa @ref glfwPollEvents
3221 * @sa @ref glfwWaitEventsTimeout
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003222 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003223 * @since Added in version 2.5.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003224 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003225 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003226 */
Camilla Berglund9a716692010-09-08 16:40:43 +02003227GLFWAPI void glfwWaitEvents(void);
Camilla Berglund135194a2010-09-09 18:15:32 +02003228
Camilla Berglund56208952016-02-02 21:11:16 +01003229/*! @brief Waits with timeout until events are queued and processes them.
3230 *
3231 * This function puts the calling thread to sleep until at least one event is
3232 * available in the event queue, or until the specified timeout is reached. If
3233 * one or more events are available, it behaves exactly like @ref
3234 * glfwPollEvents, i.e. the events in the queue are processed and the function
3235 * then returns immediately. Processing events will cause the window and input
3236 * callbacks associated with those events to be called.
3237 *
3238 * The timeout value must be a positive finite number.
3239 *
3240 * Since not all events are associated with callbacks, this function may return
3241 * without a callback having been called even if you are monitoring all
3242 * callbacks.
3243 *
3244 * On some platforms, a window move, resize or menu operation will cause event
3245 * processing to block. This is due to how event processing is designed on
3246 * those platforms. You can use the
3247 * [window refresh callback](@ref window_refresh) to redraw the contents of
3248 * your window when necessary during such operations.
3249 *
Camilla Löwy766a9dc2016-12-06 23:26:53 +01003250 * Do not assume that callbacks you set will _only_ be called in response to
3251 * event processing functions like this one. While it is necessary to poll for
3252 * events, window systems that require GLFW to register callbacks of its own
3253 * can pass events to GLFW in response to many window system function calls.
3254 * GLFW will pass those events on to the application callbacks before
3255 * returning.
Camilla Berglund56208952016-02-02 21:11:16 +01003256 *
3257 * If no windows exist, this function returns immediately. For synchronization
3258 * of threads in applications that do not create windows, use your threading
3259 * library of choice.
3260 *
3261 * Event processing is not required for joystick input to work.
3262 *
3263 * @param[in] timeout The maximum amount of time, in seconds, to wait.
3264 *
3265 * @reentrancy This function must not be called from a callback.
3266 *
3267 * @thread_safety This function must only be called from the main thread.
3268 *
3269 * @sa @ref events
Camilla Berglund7e9e3212016-09-14 20:17:26 +02003270 * @sa @ref glfwPollEvents
3271 * @sa @ref glfwWaitEvents
Camilla Berglund56208952016-02-02 21:11:16 +01003272 *
3273 * @since Added in version 3.2.
3274 *
3275 * @ingroup window
3276 */
3277GLFWAPI void glfwWaitEventsTimeout(double timeout);
3278
Camilla Berglund1ccc2322014-02-10 18:16:58 +01003279/*! @brief Posts an empty event to the event queue.
3280 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003281 * This function posts an empty event from the current thread to the event
Camilla Berglund73abf8a2016-07-06 13:06:59 +02003282 * queue, causing @ref glfwWaitEvents or @ref glfwWaitEventsTimeout to return.
Camilla Berglund1ccc2322014-02-10 18:16:58 +01003283 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003284 * If no windows exist, this function returns immediately. For synchronization
3285 * of threads in applications that do not create windows, use your threading
3286 * library of choice.
Camilla Berglund1ccc2322014-02-10 18:16:58 +01003287 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003288 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
3289 * GLFW_PLATFORM_ERROR.
3290 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003291 * @thread_safety This function may be called from any thread.
Camilla Berglund1ccc2322014-02-10 18:16:58 +01003292 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003293 * @sa @ref events
Camilla Berglund7e9e3212016-09-14 20:17:26 +02003294 * @sa @ref glfwWaitEvents
3295 * @sa @ref glfwWaitEventsTimeout
Camilla Berglund1ccc2322014-02-10 18:16:58 +01003296 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003297 * @since Added in version 3.1.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003298 *
Camilla Berglund1ccc2322014-02-10 18:16:58 +01003299 * @ingroup window
3300 */
3301GLFWAPI void glfwPostEmptyEvent(void);
3302
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003303/*! @brief Returns the value of an input option for the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003304 *
Camilla Berglund95654cf2014-10-02 17:35:10 +02003305 * This function returns the value of an input option for the specified window.
Camilla Löwy46393072017-02-20 13:45:11 +01003306 * The mode must be one of @ref GLFW_CURSOR, @ref GLFW_STICKY_KEYS or
3307 * @ref GLFW_STICKY_MOUSE_BUTTONS.
Camilla Berglund95654cf2014-10-02 17:35:10 +02003308 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003309 * @param[in] window The window to query.
Camilla Berglund9264b5d2013-04-26 14:29:55 +02003310 * @param[in] mode One of `GLFW_CURSOR`, `GLFW_STICKY_KEYS` or
Camilla Berglund39fe1f12013-03-12 19:39:36 +01003311 * `GLFW_STICKY_MOUSE_BUTTONS`.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003312 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003313 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
3314 * GLFW_INVALID_ENUM.
3315 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003316 * @thread_safety This function must only be called from the main thread.
Camilla Berglund0e205772014-03-24 11:58:35 +01003317 *
Camilla Berglund7e9e3212016-09-14 20:17:26 +02003318 * @sa @ref glfwSetInputMode
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003319 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003320 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003321 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003322 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003323 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01003324GLFWAPI int glfwGetInputMode(GLFWwindow* window, int mode);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003325
3326/*! @brief Sets an input option for the specified window.
Camilla Berglund95654cf2014-10-02 17:35:10 +02003327 *
3328 * This function sets an input mode option for the specified window. The mode
Camilla Löwy46393072017-02-20 13:45:11 +01003329 * must be one of @ref GLFW_CURSOR, @ref GLFW_STICKY_KEYS or
3330 * @ref GLFW_STICKY_MOUSE_BUTTONS.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003331 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003332 * If the mode is `GLFW_CURSOR`, the value must be one of the following cursor
Camilla Berglund39fe1f12013-03-12 19:39:36 +01003333 * modes:
Camilla Berglund13ccf7d2013-04-07 13:46:38 +02003334 * - `GLFW_CURSOR_NORMAL` makes the cursor visible and behaving normally.
3335 * - `GLFW_CURSOR_HIDDEN` makes the cursor invisible when it is over the client
Camilla Berglund4188c262015-01-18 01:55:25 +01003336 * area of the window but does not restrict the cursor from leaving.
Camilla Berglunda18b1872013-12-05 03:27:12 +01003337 * - `GLFW_CURSOR_DISABLED` hides and grabs the cursor, providing virtual
3338 * and unlimited cursor movement. This is useful for implementing for
3339 * example 3D camera controls.
Camilla Berglund39fe1f12013-03-12 19:39:36 +01003340 *
Camilla Berglund0eccf752015-08-23 19:30:04 +02003341 * If the mode is `GLFW_STICKY_KEYS`, the value must be either `GLFW_TRUE` to
3342 * enable sticky keys, or `GLFW_FALSE` to disable it. If sticky keys are
Camilla Berglund95654cf2014-10-02 17:35:10 +02003343 * enabled, a key press will ensure that @ref glfwGetKey returns `GLFW_PRESS`
3344 * the next time it is called even if the key had been released before the
3345 * call. This is useful when you are only interested in whether keys have been
3346 * pressed but not when or in which order.
Camilla Berglund39fe1f12013-03-12 19:39:36 +01003347 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003348 * If the mode is `GLFW_STICKY_MOUSE_BUTTONS`, the value must be either
Camilla Berglund0eccf752015-08-23 19:30:04 +02003349 * `GLFW_TRUE` to enable sticky mouse buttons, or `GLFW_FALSE` to disable it.
3350 * If sticky mouse buttons are enabled, a mouse button press will ensure that
3351 * @ref glfwGetMouseButton returns `GLFW_PRESS` the next time it is called even
3352 * if the mouse button had been released before the call. This is useful when
3353 * you are only interested in whether mouse buttons have been pressed but not
3354 * when or in which order.
Camilla Berglund95654cf2014-10-02 17:35:10 +02003355 *
3356 * @param[in] window The window whose input mode to set.
3357 * @param[in] mode One of `GLFW_CURSOR`, `GLFW_STICKY_KEYS` or
3358 * `GLFW_STICKY_MOUSE_BUTTONS`.
3359 * @param[in] value The new value of the specified input mode.
Camilla Berglund39fe1f12013-03-12 19:39:36 +01003360 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003361 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
3362 * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR.
3363 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003364 * @thread_safety This function must only be called from the main thread.
Camilla Berglund0e205772014-03-24 11:58:35 +01003365 *
Camilla Berglund7e9e3212016-09-14 20:17:26 +02003366 * @sa @ref glfwGetInputMode
Camilla Berglunde248fb62013-03-29 14:06:23 +01003367 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003368 * @since Added in version 3.0. Replaces `glfwEnable` and `glfwDisable`.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003369 *
Camilla Berglunde248fb62013-03-29 14:06:23 +01003370 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003371 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01003372GLFWAPI void glfwSetInputMode(GLFWwindow* window, int mode, int value);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003373
Camilla Berglund9c315412015-07-02 14:24:50 +02003374/*! @brief Returns the localized name of the specified printable key.
3375 *
Camilla Löwy071a0492017-02-28 22:29:10 +01003376 * This function returns the name of the specified printable key. This is
3377 * typically the character that key would produce without any modifier keys,
3378 * intended for displaying key bindings to the user.
Camilla Berglund9c315412015-07-02 14:24:50 +02003379 *
Camilla Löwy071a0492017-02-28 22:29:10 +01003380 * __Do not use this function__ for [text input](@ref input_char). You will
3381 * break text input for many languages even if it happens to work for yours.
Camilla Berglund70ffae72016-02-22 11:54:56 +01003382 *
Camilla Löwy071a0492017-02-28 22:29:10 +01003383 * If the key is `GLFW_KEY_UNKNOWN`, the scancode is used to identify the key,
3384 * otherwise the scancode is ignored. If you specify a non-printable key, or
3385 * `GLFW_KEY_UNKNOWN` and a scancode that maps to a non-printable key, this
3386 * function returns `NULL` but does not emit an error.
3387 *
3388 * This behavior allows you to always pass in the arguments in the
Camilla Berglund70ffae72016-02-22 11:54:56 +01003389 * [key callback](@ref input_key) without modification.
3390 *
3391 * The printable keys are:
3392 * - `GLFW_KEY_APOSTROPHE`
3393 * - `GLFW_KEY_COMMA`
3394 * - `GLFW_KEY_MINUS`
3395 * - `GLFW_KEY_PERIOD`
3396 * - `GLFW_KEY_SLASH`
3397 * - `GLFW_KEY_SEMICOLON`
3398 * - `GLFW_KEY_EQUAL`
3399 * - `GLFW_KEY_LEFT_BRACKET`
3400 * - `GLFW_KEY_RIGHT_BRACKET`
3401 * - `GLFW_KEY_BACKSLASH`
3402 * - `GLFW_KEY_WORLD_1`
3403 * - `GLFW_KEY_WORLD_2`
3404 * - `GLFW_KEY_0` to `GLFW_KEY_9`
3405 * - `GLFW_KEY_A` to `GLFW_KEY_Z`
3406 * - `GLFW_KEY_KP_0` to `GLFW_KEY_KP_9`
3407 * - `GLFW_KEY_KP_DECIMAL`
3408 * - `GLFW_KEY_KP_DIVIDE`
3409 * - `GLFW_KEY_KP_MULTIPLY`
3410 * - `GLFW_KEY_KP_SUBTRACT`
3411 * - `GLFW_KEY_KP_ADD`
3412 * - `GLFW_KEY_KP_EQUAL`
Camilla Berglund9c315412015-07-02 14:24:50 +02003413 *
Camilla Löwy071a0492017-02-28 22:29:10 +01003414 * Names for printable keys depend on keyboard layout, while names for
3415 * non-printable keys are the same across layouts but depend on the application
3416 * language and should be localized along with other user interface text.
3417 *
Camilla Berglund9c315412015-07-02 14:24:50 +02003418 * @param[in] key The key to query, or `GLFW_KEY_UNKNOWN`.
3419 * @param[in] scancode The scancode of the key to query.
Camilla Berglund70ffae72016-02-22 11:54:56 +01003420 * @return The localized name of the key, or `NULL`.
Camilla Berglund9c315412015-07-02 14:24:50 +02003421 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003422 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
3423 * GLFW_PLATFORM_ERROR.
3424 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003425 * @pointer_lifetime The returned string is allocated and freed by GLFW. You
3426 * should not free it yourself. It is valid until the next call to @ref
3427 * glfwGetKeyName, or until the library is terminated.
Camilla Berglund9c315412015-07-02 14:24:50 +02003428 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003429 * @thread_safety This function must only be called from the main thread.
Camilla Berglund9c315412015-07-02 14:24:50 +02003430 *
3431 * @sa @ref input_key_name
3432 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003433 * @since Added in version 3.2.
Camilla Berglund9c315412015-07-02 14:24:50 +02003434 *
3435 * @ingroup input
3436 */
3437GLFWAPI const char* glfwGetKeyName(int key, int scancode);
3438
Camilla Löwy766a9dc2016-12-06 23:26:53 +01003439/*! @brief Returns the platform-specific scancode of the specified key.
Michael Stockere745b0d2016-08-11 19:11:40 +02003440 *
Camilla Löwy766a9dc2016-12-06 23:26:53 +01003441 * This function returns the platform-specific scancode of the specified key.
Michael Stockere745b0d2016-08-11 19:11:40 +02003442 *
3443 * If the key is `GLFW_KEY_UNKNOWN` or does not exist on the keyboard this
3444 * method will return `-1`.
3445 *
Camilla Löwy766a9dc2016-12-06 23:26:53 +01003446 * @param[in] key Any [named key](@ref keys).
3447 * @return The platform-specific scancode for the key, or `-1` if an
Camilla Berglundbb3cb8f2016-09-06 15:40:31 +02003448 * [error](@ref error_handling) occurred.
Michael Stockere745b0d2016-08-11 19:11:40 +02003449 *
Camilla Berglundbb3cb8f2016-09-06 15:40:31 +02003450 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
3451 * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR.
Michael Stockere745b0d2016-08-11 19:11:40 +02003452 *
3453 * @thread_safety This function may be called from any thread.
3454 *
Camilla Löwy766a9dc2016-12-06 23:26:53 +01003455 * @sa @ref input_key
Michael Stockere745b0d2016-08-11 19:11:40 +02003456 *
3457 * @since Added in version 3.3.
3458 *
3459 * @ingroup input
3460 */
Camilla Berglundbb3cb8f2016-09-06 15:40:31 +02003461GLFWAPI int glfwGetKeyScancode(int key);
Michael Stockere745b0d2016-08-11 19:11:40 +02003462
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003463/*! @brief Returns the last reported state of a keyboard key for the specified
3464 * window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003465 *
3466 * This function returns the last state reported for the specified key to the
3467 * specified window. The returned state is one of `GLFW_PRESS` or
Camilla Berglund4591ad22014-09-18 15:03:29 +02003468 * `GLFW_RELEASE`. The higher-level action `GLFW_REPEAT` is only reported to
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003469 * the key callback.
3470 *
Camilla Löwy46393072017-02-20 13:45:11 +01003471 * If the @ref GLFW_STICKY_KEYS input mode is enabled, this function returns
Camilla Berglund4591ad22014-09-18 15:03:29 +02003472 * `GLFW_PRESS` the first time you call it for a key that was pressed, even if
3473 * that key has already been released.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003474 *
3475 * The key functions deal with physical keys, with [key tokens](@ref keys)
3476 * named after their use on the standard US keyboard layout. If you want to
3477 * input text, use the Unicode character callback instead.
3478 *
Camilla Berglunde8e05d42014-04-23 13:30:11 +02003479 * The [modifier key bit masks](@ref mods) are not key tokens and cannot be
3480 * used with this function.
3481 *
Camilla Berglund9c315412015-07-02 14:24:50 +02003482 * __Do not use this function__ to implement [text input](@ref input_char).
3483 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003484 * @param[in] window The desired window.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003485 * @param[in] key The desired [keyboard key](@ref keys). `GLFW_KEY_UNKNOWN` is
3486 * not a valid key for this function.
Camilla Berglund71d2b572013-03-12 15:33:05 +01003487 * @return One of `GLFW_PRESS` or `GLFW_RELEASE`.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003488 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003489 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
3490 * GLFW_INVALID_ENUM.
3491 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003492 * @thread_safety This function must only be called from the main thread.
Camilla Berglund0e205772014-03-24 11:58:35 +01003493 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003494 * @sa @ref input_key
3495 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003496 * @since Added in version 1.0.
Camilla Berglund951a9582016-01-31 21:32:14 +01003497 * @glfw3 Added window handle parameter.
Camilla Berglund11615fc2013-05-30 17:19:12 +02003498 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003499 * @ingroup input
3500 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01003501GLFWAPI int glfwGetKey(GLFWwindow* window, int key);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003502
3503/*! @brief Returns the last reported state of a mouse button for the specified
3504 * window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003505 *
3506 * This function returns the last state reported for the specified mouse button
Camilla Berglund4591ad22014-09-18 15:03:29 +02003507 * to the specified window. The returned state is one of `GLFW_PRESS` or
Camilla Berglundce8f97c2015-01-11 23:33:14 +01003508 * `GLFW_RELEASE`.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003509 *
Camilla Löwy46393072017-02-20 13:45:11 +01003510 * If the @ref GLFW_STICKY_MOUSE_BUTTONS input mode is enabled, this function
Camilla Berglund4591ad22014-09-18 15:03:29 +02003511 * `GLFW_PRESS` the first time you call it for a mouse button that was pressed,
3512 * even if that mouse button has already been released.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003513 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003514 * @param[in] window The desired window.
Camilla Berglund71d2b572013-03-12 15:33:05 +01003515 * @param[in] button The desired [mouse button](@ref buttons).
3516 * @return One of `GLFW_PRESS` or `GLFW_RELEASE`.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003517 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003518 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
3519 * GLFW_INVALID_ENUM.
3520 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003521 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003522 *
3523 * @sa @ref input_mouse_button
3524 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003525 * @since Added in version 1.0.
Camilla Berglund951a9582016-01-31 21:32:14 +01003526 * @glfw3 Added window handle parameter.
Camilla Berglund0e205772014-03-24 11:58:35 +01003527 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003528 * @ingroup input
3529 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01003530GLFWAPI int glfwGetMouseButton(GLFWwindow* window, int button);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003531
Camilla Berglundd4591452014-02-11 18:24:01 +01003532/*! @brief Retrieves the position of the cursor relative to the client area of
3533 * the window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003534 *
Camilla Berglundd4591452014-02-11 18:24:01 +01003535 * This function returns the position of the cursor, in screen coordinates,
3536 * relative to the upper-left corner of the client area of the specified
3537 * window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003538 *
Camilla Berglund6df692b2013-04-26 17:20:31 +02003539 * If the cursor is disabled (with `GLFW_CURSOR_DISABLED`) then the cursor
3540 * position is unbounded and limited only by the minimum and maximum values of
3541 * a `double`.
Camilla Berglund948cc042013-04-16 02:02:22 +02003542 *
Camilla Berglund3ec29252013-04-25 18:03:15 +02003543 * The coordinate can be converted to their integer equivalents with the
3544 * `floor` function. Casting directly to an integer type works for positive
3545 * coordinates, but fails for negative ones.
3546 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003547 * Any or all of the position arguments may be `NULL`. If an error occurs, all
3548 * non-`NULL` position arguments will be set to zero.
3549 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003550 * @param[in] window The desired window.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02003551 * @param[out] xpos Where to store the cursor x-coordinate, relative to the
3552 * left edge of the client area, or `NULL`.
3553 * @param[out] ypos Where to store the cursor y-coordinate, relative to the to
3554 * top edge of the client area, or `NULL`.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003555 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003556 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
3557 * GLFW_PLATFORM_ERROR.
3558 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003559 * @thread_safety This function must only be called from the main thread.
Camilla Berglund0e205772014-03-24 11:58:35 +01003560 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003561 * @sa @ref cursor_pos
Camilla Berglund7e9e3212016-09-14 20:17:26 +02003562 * @sa @ref glfwSetCursorPos
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003563 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003564 * @since Added in version 3.0. Replaces `glfwGetMousePos`.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003565 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003566 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003567 */
Camilla Berglund129e94d2013-04-04 16:16:21 +02003568GLFWAPI void glfwGetCursorPos(GLFWwindow* window, double* xpos, double* ypos);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003569
Camilla Berglund6d9d8562013-09-28 22:12:50 +02003570/*! @brief Sets the position of the cursor, relative to the client area of the
3571 * window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003572 *
Camilla Berglund6d9d8562013-09-28 22:12:50 +02003573 * This function sets the position, in screen coordinates, of the cursor
3574 * relative to the upper-left corner of the client area of the specified
Camilla Berglund4188c262015-01-18 01:55:25 +01003575 * window. The window must have input focus. If the window does not have
3576 * input focus when this function is called, it fails silently.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003577 *
Camilla Berglund20858762015-01-01 18:41:22 +01003578 * __Do not use this function__ to implement things like camera controls. GLFW
3579 * already provides the `GLFW_CURSOR_DISABLED` cursor mode that hides the
3580 * cursor, transparently re-centers it and provides unconstrained cursor
3581 * motion. See @ref glfwSetInputMode for more information.
3582 *
3583 * If the cursor mode is `GLFW_CURSOR_DISABLED` then the cursor position is
3584 * unconstrained and limited only by the minimum and maximum values of
Camilla Berglund6df692b2013-04-26 17:20:31 +02003585 * a `double`.
Camilla Berglund948cc042013-04-16 02:02:22 +02003586 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003587 * @param[in] window The desired window.
3588 * @param[in] xpos The desired x-coordinate, relative to the left edge of the
Camilla Berglundbb558162013-09-09 23:31:59 +02003589 * client area.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003590 * @param[in] ypos The desired y-coordinate, relative to the top edge of the
Camilla Berglundbb558162013-09-09 23:31:59 +02003591 * client area.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003592 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003593 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
3594 * GLFW_PLATFORM_ERROR.
3595 *
linkmauvebc8b0482016-10-16 15:52:39 +01003596 * @remark @wayland This function will only work when the cursor mode is
3597 * `GLFW_CURSOR_DISABLED`, otherwise it will do nothing.
3598 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003599 * @thread_safety This function must only be called from the main thread.
Camilla Berglund0e205772014-03-24 11:58:35 +01003600 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003601 * @sa @ref cursor_pos
Camilla Berglund7e9e3212016-09-14 20:17:26 +02003602 * @sa @ref glfwGetCursorPos
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003603 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003604 * @since Added in version 3.0. Replaces `glfwSetMousePos`.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003605 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003606 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003607 */
Camilla Berglund129e94d2013-04-04 16:16:21 +02003608GLFWAPI void glfwSetCursorPos(GLFWwindow* window, double xpos, double ypos);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003609
Camilla Berglund2a1375e2014-09-02 16:52:16 +02003610/*! @brief Creates a custom cursor.
urraka40c04a72013-12-04 10:19:22 -03003611 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003612 * Creates a new custom cursor image that can be set for a window with @ref
3613 * glfwSetCursor. The cursor can be destroyed with @ref glfwDestroyCursor.
3614 * Any remaining cursors are destroyed by @ref glfwTerminate.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02003615 *
Camilla Berglund85a01bf2015-08-17 21:04:19 +02003616 * The pixels are 32-bit, little-endian, non-premultiplied RGBA, i.e. eight
3617 * bits per channel. They are arranged canonically as packed sequential rows,
3618 * starting from the top-left corner.
Camilla Berglund4188c262015-01-18 01:55:25 +01003619 *
3620 * The cursor hotspot is specified in pixels, relative to the upper-left corner
3621 * of the cursor image. Like all other coordinate systems in GLFW, the X-axis
3622 * points to the right and the Y-axis points down.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02003623 *
Camilla Berglund8fa9cc02014-02-23 16:43:17 +01003624 * @param[in] image The desired cursor image.
Camilla Berglund4188c262015-01-18 01:55:25 +01003625 * @param[in] xhot The desired x-coordinate, in pixels, of the cursor hotspot.
3626 * @param[in] yhot The desired y-coordinate, in pixels, of the cursor hotspot.
Camilla Berglund4188c262015-01-18 01:55:25 +01003627 * @return The handle of the created cursor, or `NULL` if an
Camilla Berglund4591ad22014-09-18 15:03:29 +02003628 * [error](@ref error_handling) occurred.
urraka40c04a72013-12-04 10:19:22 -03003629 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003630 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
3631 * GLFW_PLATFORM_ERROR.
3632 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003633 * @pointer_lifetime The specified image data is copied before this function
3634 * returns.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003635 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003636 * @reentrancy This function must not be called from a callback.
Camilla Berglund44372b82014-12-17 01:31:36 +01003637 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003638 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003639 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003640 * @sa @ref cursor_object
Camilla Berglund7e9e3212016-09-14 20:17:26 +02003641 * @sa @ref glfwDestroyCursor
3642 * @sa @ref glfwCreateStandardCursor
Camilla Berglund4591ad22014-09-18 15:03:29 +02003643 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003644 * @since Added in version 3.1.
urraka40c04a72013-12-04 10:19:22 -03003645 *
3646 * @ingroup input
3647 */
Camilla Berglund8fa9cc02014-02-23 16:43:17 +01003648GLFWAPI GLFWcursor* glfwCreateCursor(const GLFWimage* image, int xhot, int yhot);
urraka40c04a72013-12-04 10:19:22 -03003649
Camilla Berglund2a1375e2014-09-02 16:52:16 +02003650/*! @brief Creates a cursor with a standard shape.
3651 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003652 * Returns a cursor with a [standard shape](@ref shapes), that can be set for
3653 * a window with @ref glfwSetCursor.
Camilla Berglund2a1375e2014-09-02 16:52:16 +02003654 *
3655 * @param[in] shape One of the [standard shapes](@ref shapes).
Camilla Berglund2a1375e2014-09-02 16:52:16 +02003656 * @return A new cursor ready to use or `NULL` if an
3657 * [error](@ref error_handling) occurred.
3658 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003659 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
3660 * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR.
3661 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003662 * @reentrancy This function must not be called from a callback.
Camilla Berglund2a1375e2014-09-02 16:52:16 +02003663 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003664 * @thread_safety This function must only be called from the main thread.
Camilla Berglund2a1375e2014-09-02 16:52:16 +02003665 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003666 * @sa @ref cursor_object
Camilla Berglund7e9e3212016-09-14 20:17:26 +02003667 * @sa @ref glfwCreateCursor
Camilla Berglund2a1375e2014-09-02 16:52:16 +02003668 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003669 * @since Added in version 3.1.
Camilla Berglund2a1375e2014-09-02 16:52:16 +02003670 *
3671 * @ingroup input
3672 */
3673GLFWAPI GLFWcursor* glfwCreateStandardCursor(int shape);
3674
urraka40c04a72013-12-04 10:19:22 -03003675/*! @brief Destroys a cursor.
3676 *
Camilla Berglunde8e05d42014-04-23 13:30:11 +02003677 * This function destroys a cursor previously created with @ref
3678 * glfwCreateCursor. Any remaining cursors will be destroyed by @ref
3679 * glfwTerminate.
urraka40c04a72013-12-04 10:19:22 -03003680 *
Camilla Löwy46393072017-02-20 13:45:11 +01003681 * If the specified cursor is current for any window, that window will be
3682 * reverted to the default cursor. This does not affect the cursor mode.
3683 *
Camilla Berglunde8e05d42014-04-23 13:30:11 +02003684 * @param[in] cursor The cursor object to destroy.
urraka40c04a72013-12-04 10:19:22 -03003685 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003686 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
3687 * GLFW_PLATFORM_ERROR.
3688 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003689 * @reentrancy This function must not be called from a callback.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003690 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003691 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003692 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003693 * @sa @ref cursor_object
Camilla Berglund7e9e3212016-09-14 20:17:26 +02003694 * @sa @ref glfwCreateCursor
Camilla Berglund4591ad22014-09-18 15:03:29 +02003695 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003696 * @since Added in version 3.1.
urraka40c04a72013-12-04 10:19:22 -03003697 *
3698 * @ingroup input
3699 */
3700GLFWAPI void glfwDestroyCursor(GLFWcursor* cursor);
3701
Camilla Berglund4188c262015-01-18 01:55:25 +01003702/*! @brief Sets the cursor for the window.
urraka40c04a72013-12-04 10:19:22 -03003703 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003704 * This function sets the cursor image to be used when the cursor is over the
3705 * client area of the specified window. The set cursor will only be visible
3706 * when the [cursor mode](@ref cursor_mode) of the window is
3707 * `GLFW_CURSOR_NORMAL`.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003708 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003709 * On some platforms, the set cursor may not be visible unless the window also
3710 * has input focus.
3711 *
3712 * @param[in] window The window to set the cursor for.
3713 * @param[in] cursor The cursor to set, or `NULL` to switch back to the default
3714 * arrow cursor.
urraka40c04a72013-12-04 10:19:22 -03003715 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003716 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
3717 * GLFW_PLATFORM_ERROR.
3718 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003719 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003720 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003721 * @sa @ref cursor_object
Camilla Berglund4591ad22014-09-18 15:03:29 +02003722 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003723 * @since Added in version 3.1.
Camilla Berglund0e205772014-03-24 11:58:35 +01003724 *
urraka40c04a72013-12-04 10:19:22 -03003725 * @ingroup input
3726 */
3727GLFWAPI void glfwSetCursor(GLFWwindow* window, GLFWcursor* cursor);
3728
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003729/*! @brief Sets the key callback.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003730 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003731 * This function sets the key callback of the specified window, which is called
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003732 * when a key is pressed, repeated or released.
3733 *
Camilla Berglund948cc042013-04-16 02:02:22 +02003734 * The key functions deal with physical keys, with layout independent
3735 * [key tokens](@ref keys) named after their values in the standard US keyboard
Camilla Berglund5fd409b2013-06-05 17:53:13 +02003736 * layout. If you want to input text, use the
3737 * [character callback](@ref glfwSetCharCallback) instead.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003738 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003739 * When a window loses input focus, it will generate synthetic key release
3740 * events for all pressed keys. You can tell these events from user-generated
3741 * events by the fact that the synthetic ones are generated after the focus
3742 * loss event has been processed, i.e. after the
3743 * [window focus callback](@ref glfwSetWindowFocusCallback) has been called.
Camilla Berglund4538a522013-04-24 19:49:46 +02003744 *
Camilla Berglund11615fc2013-05-30 17:19:12 +02003745 * The scancode of a key is specific to that platform or sometimes even to that
3746 * machine. Scancodes are intended to allow users to bind keys that don't have
3747 * a GLFW key token. Such keys have `key` set to `GLFW_KEY_UNKNOWN`, their
Camilla Berglund4591ad22014-09-18 15:03:29 +02003748 * state is not saved and so it cannot be queried with @ref glfwGetKey.
Camilla Berglund11615fc2013-05-30 17:19:12 +02003749 *
3750 * Sometimes GLFW needs to generate synthetic key events, in which case the
3751 * scancode may be zero.
3752 *
Camilla Berglund9492fc52013-01-17 17:51:12 +01003753 * @param[in] window The window whose callback to set.
Camilla Berglund71d2b572013-03-12 15:33:05 +01003754 * @param[in] cbfun The new key callback, or `NULL` to remove the currently
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003755 * set callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02003756 * @return The previously set callback, or `NULL` if no callback was set or the
3757 * library had not been [initialized](@ref intro_init).
Camilla Berglund11a27de2013-04-08 21:21:21 +02003758 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003759 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
3760 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003761 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003762 *
3763 * @sa @ref input_key
3764 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003765 * @since Added in version 1.0.
3766 * @glfw3 Added window handle parameter and return value.
Camilla Berglund0e205772014-03-24 11:58:35 +01003767 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003768 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003769 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02003770GLFWAPI GLFWkeyfun glfwSetKeyCallback(GLFWwindow* window, GLFWkeyfun cbfun);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003771
3772/*! @brief Sets the Unicode character callback.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003773 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003774 * This function sets the character callback of the specified window, which is
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003775 * called when a Unicode character is input.
3776 *
Camilla Berglund96b12ee2014-06-12 23:04:20 +02003777 * The character callback is intended for Unicode text input. As it deals with
3778 * characters, it is keyboard layout dependent, whereas the
3779 * [key callback](@ref glfwSetKeyCallback) is not. Characters do not map 1:1
3780 * to physical keys, as a key may produce zero, one or more characters. If you
3781 * want to know whether a specific physical key was pressed or released, see
3782 * the key callback instead.
3783 *
3784 * The character callback behaves as system text input normally does and will
3785 * not be called if modifier keys are held down that would prevent normal text
Camilla Berglund8d6f2652016-10-20 00:50:54 +02003786 * input on that platform, for example a Super (Command) key on macOS or Alt key
Camilla Berglund96b12ee2014-06-12 23:04:20 +02003787 * on Windows. There is a
3788 * [character with modifiers callback](@ref glfwSetCharModsCallback) that
3789 * receives these events.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003790 *
Camilla Berglund9492fc52013-01-17 17:51:12 +01003791 * @param[in] window The window whose callback to set.
Camilla Berglund71d2b572013-03-12 15:33:05 +01003792 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
Camilla Berglunddba2d802013-01-17 23:06:56 +01003793 * callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02003794 * @return The previously set callback, or `NULL` if no callback was set or the
3795 * library had not been [initialized](@ref intro_init).
Camilla Berglund11a27de2013-04-08 21:21:21 +02003796 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003797 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
3798 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003799 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003800 *
3801 * @sa @ref input_char
3802 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003803 * @since Added in version 2.4.
3804 * @glfw3 Added window handle parameter and return value.
Camilla Berglund0e205772014-03-24 11:58:35 +01003805 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003806 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003807 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02003808GLFWAPI GLFWcharfun glfwSetCharCallback(GLFWwindow* window, GLFWcharfun cbfun);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003809
Camilla Berglund96b12ee2014-06-12 23:04:20 +02003810/*! @brief Sets the Unicode character with modifiers callback.
3811 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003812 * This function sets the character with modifiers callback of the specified
Camilla Berglund96b12ee2014-06-12 23:04:20 +02003813 * window, which is called when a Unicode character is input regardless of what
3814 * modifier keys are used.
3815 *
3816 * The character with modifiers callback is intended for implementing custom
3817 * Unicode character input. For regular Unicode text input, see the
3818 * [character callback](@ref glfwSetCharCallback). Like the character
3819 * callback, the character with modifiers callback deals with characters and is
3820 * keyboard layout dependent. Characters do not map 1:1 to physical keys, as
3821 * a key may produce zero, one or more characters. If you want to know whether
3822 * a specific physical key was pressed or released, see the
3823 * [key callback](@ref glfwSetKeyCallback) instead.
3824 *
3825 * @param[in] window The window whose callback to set.
3826 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
3827 * callback.
3828 * @return The previously set callback, or `NULL` if no callback was set or an
Camilla Berglund999f3552016-08-17 16:48:22 +02003829 * [error](@ref error_handling) occurred.
Camilla Berglund96b12ee2014-06-12 23:04:20 +02003830 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003831 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
3832 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003833 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003834 *
3835 * @sa @ref input_char
3836 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003837 * @since Added in version 3.1.
Camilla Berglund96b12ee2014-06-12 23:04:20 +02003838 *
3839 * @ingroup input
3840 */
3841GLFWAPI GLFWcharmodsfun glfwSetCharModsCallback(GLFWwindow* window, GLFWcharmodsfun cbfun);
3842
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003843/*! @brief Sets the mouse button callback.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003844 *
3845 * This function sets the mouse button callback of the specified window, which
3846 * is called when a mouse button is pressed or released.
3847 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003848 * When a window loses input focus, it will generate synthetic mouse button
3849 * release events for all pressed mouse buttons. You can tell these events
3850 * from user-generated events by the fact that the synthetic ones are generated
3851 * after the focus loss event has been processed, i.e. after the
3852 * [window focus callback](@ref glfwSetWindowFocusCallback) has been called.
Camilla Berglund4538a522013-04-24 19:49:46 +02003853 *
Camilla Berglund9492fc52013-01-17 17:51:12 +01003854 * @param[in] window The window whose callback to set.
Camilla Berglund71d2b572013-03-12 15:33:05 +01003855 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
Camilla Berglunddba2d802013-01-17 23:06:56 +01003856 * callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02003857 * @return The previously set callback, or `NULL` if no callback was set or the
3858 * library had not been [initialized](@ref intro_init).
Camilla Berglund11a27de2013-04-08 21:21:21 +02003859 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003860 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
3861 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003862 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003863 *
3864 * @sa @ref input_mouse_button
3865 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003866 * @since Added in version 1.0.
3867 * @glfw3 Added window handle parameter and return value.
Camilla Berglund0e205772014-03-24 11:58:35 +01003868 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003869 * @ingroup input
3870 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02003871GLFWAPI GLFWmousebuttonfun glfwSetMouseButtonCallback(GLFWwindow* window, GLFWmousebuttonfun cbfun);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003872
3873/*! @brief Sets the cursor position callback.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003874 *
3875 * This function sets the cursor position callback of the specified window,
3876 * which is called when the cursor is moved. The callback is provided with the
Camilla Berglund6d9d8562013-09-28 22:12:50 +02003877 * position, in screen coordinates, relative to the upper-left corner of the
3878 * client area of the window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003879 *
Camilla Berglund9492fc52013-01-17 17:51:12 +01003880 * @param[in] window The window whose callback to set.
Camilla Berglund71d2b572013-03-12 15:33:05 +01003881 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
Camilla Berglunddba2d802013-01-17 23:06:56 +01003882 * callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02003883 * @return The previously set callback, or `NULL` if no callback was set or the
3884 * library had not been [initialized](@ref intro_init).
Camilla Berglund11a27de2013-04-08 21:21:21 +02003885 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003886 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
3887 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003888 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003889 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003890 * @sa @ref cursor_pos
Camilla Berglund4591ad22014-09-18 15:03:29 +02003891 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003892 * @since Added in version 3.0. Replaces `glfwSetMousePosCallback`.
Camilla Berglund0e205772014-03-24 11:58:35 +01003893 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003894 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003895 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02003896GLFWAPI GLFWcursorposfun glfwSetCursorPosCallback(GLFWwindow* window, GLFWcursorposfun cbfun);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003897
3898/*! @brief Sets the cursor enter/exit callback.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003899 *
3900 * This function sets the cursor boundary crossing callback of the specified
3901 * window, which is called when the cursor enters or leaves the client area of
3902 * the window.
3903 *
Camilla Berglund9492fc52013-01-17 17:51:12 +01003904 * @param[in] window The window whose callback to set.
Camilla Berglund71d2b572013-03-12 15:33:05 +01003905 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
Camilla Berglunddba2d802013-01-17 23:06:56 +01003906 * callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02003907 * @return The previously set callback, or `NULL` if no callback was set or the
3908 * library had not been [initialized](@ref intro_init).
Camilla Berglund11a27de2013-04-08 21:21:21 +02003909 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003910 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
3911 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003912 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003913 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003914 * @sa @ref cursor_enter
Camilla Berglund4591ad22014-09-18 15:03:29 +02003915 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003916 * @since Added in version 3.0.
Camilla Berglund0e205772014-03-24 11:58:35 +01003917 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003918 * @ingroup input
3919 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02003920GLFWAPI GLFWcursorenterfun glfwSetCursorEnterCallback(GLFWwindow* window, GLFWcursorenterfun cbfun);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003921
3922/*! @brief Sets the scroll callback.
Camilla Berglunde248fb62013-03-29 14:06:23 +01003923 *
3924 * This function sets the scroll callback of the specified window, which is
3925 * called when a scrolling device is used, such as a mouse wheel or scrolling
3926 * area of a touchpad.
3927 *
Camilla Berglund5fd409b2013-06-05 17:53:13 +02003928 * The scroll callback receives all scrolling input, like that from a mouse
3929 * wheel or a touchpad scrolling area.
3930 *
Camilla Berglund9492fc52013-01-17 17:51:12 +01003931 * @param[in] window The window whose callback to set.
Camilla Berglund71d2b572013-03-12 15:33:05 +01003932 * @param[in] cbfun The new scroll callback, or `NULL` to remove the currently
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003933 * set callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02003934 * @return The previously set callback, or `NULL` if no callback was set or the
3935 * library had not been [initialized](@ref intro_init).
Camilla Berglund11a27de2013-04-08 21:21:21 +02003936 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003937 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
3938 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003939 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003940 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003941 * @sa @ref scrolling
Camilla Berglund4591ad22014-09-18 15:03:29 +02003942 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003943 * @since Added in version 3.0. Replaces `glfwSetMouseWheelCallback`.
Camilla Berglund0e205772014-03-24 11:58:35 +01003944 *
Camilla Berglunde248fb62013-03-29 14:06:23 +01003945 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003946 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02003947GLFWAPI GLFWscrollfun glfwSetScrollCallback(GLFWwindow* window, GLFWscrollfun cbfun);
Camilla Berglund3249f812010-09-07 17:34:51 +02003948
Camilla Berglund5c8121e2014-03-29 21:35:21 +01003949/*! @brief Sets the file drop callback.
arturo89d07232013-07-10 11:42:14 +02003950 *
Camilla Berglund5c8121e2014-03-29 21:35:21 +01003951 * This function sets the file drop callback of the specified window, which is
3952 * called when one or more dragged files are dropped on the window.
arturo89d07232013-07-10 11:42:14 +02003953 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003954 * Because the path array and its strings may have been generated specifically
3955 * for that event, they are not guaranteed to be valid after the callback has
3956 * returned. If you wish to use them after the callback returns, you need to
3957 * make a deep copy.
arturo89d07232013-07-10 11:42:14 +02003958 *
3959 * @param[in] window The window whose callback to set.
Camilla Berglund5c8121e2014-03-29 21:35:21 +01003960 * @param[in] cbfun The new file drop callback, or `NULL` to remove the
3961 * currently set callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02003962 * @return The previously set callback, or `NULL` if no callback was set or the
3963 * library had not been [initialized](@ref intro_init).
arturo89d07232013-07-10 11:42:14 +02003964 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003965 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
3966 *
linkmauvebc8b0482016-10-16 15:52:39 +01003967 * @remark @wayland File drop is currently unimplemented.
3968 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003969 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003970 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003971 * @sa @ref path_drop
Camilla Berglund4591ad22014-09-18 15:03:29 +02003972 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003973 * @since Added in version 3.1.
Camilla Berglund0e205772014-03-24 11:58:35 +01003974 *
arturo89d07232013-07-10 11:42:14 +02003975 * @ingroup input
3976 */
3977GLFWAPI GLFWdropfun glfwSetDropCallback(GLFWwindow* window, GLFWdropfun cbfun);
3978
Camilla Berglundfdd45182013-05-27 15:13:09 +02003979/*! @brief Returns whether the specified joystick is present.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003980 *
Camilla Berglundfdd45182013-05-27 15:13:09 +02003981 * This function returns whether the specified joystick is present.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003982 *
Camilla Berglundefc6b352016-10-10 03:24:07 +02003983 * @param[in] jid The [joystick](@ref joysticks) to query.
Camilla Berglund0eccf752015-08-23 19:30:04 +02003984 * @return `GLFW_TRUE` if the joystick is present, or `GLFW_FALSE` otherwise.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003985 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003986 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
3987 * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR.
3988 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003989 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003990 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003991 * @sa @ref joystick
Camilla Berglund4591ad22014-09-18 15:03:29 +02003992 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003993 * @since Added in version 3.0. Replaces `glfwGetJoystickParam`.
Camilla Berglund0e205772014-03-24 11:58:35 +01003994 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003995 * @ingroup input
3996 */
Camilla Berglundefc6b352016-10-10 03:24:07 +02003997GLFWAPI int glfwJoystickPresent(int jid);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003998
Camilla Berglund7f2eb7b2013-04-24 19:25:42 +02003999/*! @brief Returns the values of all axes of the specified joystick.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02004000 *
4001 * This function returns the values of all axes of the specified joystick.
Camilla Berglund4591ad22014-09-18 15:03:29 +02004002 * Each element in the array is a value between -1.0 and 1.0.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02004003 *
Camilla Berglund386b6032016-02-10 13:48:49 +01004004 * Querying a joystick slot with no device present is not an error, but will
4005 * cause this function to return `NULL`. Call @ref glfwJoystickPresent to
4006 * check device presence.
4007 *
Camilla Berglundefc6b352016-10-10 03:24:07 +02004008 * @param[in] jid The [joystick](@ref joysticks) to query.
Camilla Berglund4591ad22014-09-18 15:03:29 +02004009 * @param[out] count Where to store the number of axis values in the returned
Camilla Berglund999f3552016-08-17 16:48:22 +02004010 * array. This is set to zero if the joystick is not present or an error
4011 * occurred.
4012 * @return An array of axis values, or `NULL` if the joystick is not present or
4013 * an [error](@ref error_handling) occurred.
Camilla Berglund7f2eb7b2013-04-24 19:25:42 +02004014 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01004015 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
4016 * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR.
4017 *
Camilla Berglund951a9582016-01-31 21:32:14 +01004018 * @pointer_lifetime The returned array is allocated and freed by GLFW. You
4019 * should not free it yourself. It is valid until the specified joystick is
Camilla Löwy68014782017-02-01 04:36:38 +01004020 * disconnected or the library is terminated.
Camilla Berglund0e205772014-03-24 11:58:35 +01004021 *
Camilla Berglund951a9582016-01-31 21:32:14 +01004022 * @thread_safety This function must only be called from the main thread.
Camilla Berglundc3bb5c92013-06-05 16:04:04 +02004023 *
Camilla Berglund4188c262015-01-18 01:55:25 +01004024 * @sa @ref joystick_axis
Camilla Berglund4591ad22014-09-18 15:03:29 +02004025 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01004026 * @since Added in version 3.0. Replaces `glfwGetJoystickPos`.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004027 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004028 * @ingroup input
4029 */
Camilla Berglundefc6b352016-10-10 03:24:07 +02004030GLFWAPI const float* glfwGetJoystickAxes(int jid, int* count);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004031
Camilla Berglunde93bade2013-06-16 02:33:33 +02004032/*! @brief Returns the state of all buttons of the specified joystick.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02004033 *
Camilla Berglunde93bade2013-06-16 02:33:33 +02004034 * This function returns the state of all buttons of the specified joystick.
Camilla Berglund4591ad22014-09-18 15:03:29 +02004035 * Each element in the array is either `GLFW_PRESS` or `GLFW_RELEASE`.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02004036 *
Camilla Berglund386b6032016-02-10 13:48:49 +01004037 * Querying a joystick slot with no device present is not an error, but will
4038 * cause this function to return `NULL`. Call @ref glfwJoystickPresent to
4039 * check device presence.
4040 *
Camilla Berglundefc6b352016-10-10 03:24:07 +02004041 * @param[in] jid The [joystick](@ref joysticks) to query.
Camilla Berglund4591ad22014-09-18 15:03:29 +02004042 * @param[out] count Where to store the number of button states in the returned
Camilla Berglund999f3552016-08-17 16:48:22 +02004043 * array. This is set to zero if the joystick is not present or an error
4044 * occurred.
4045 * @return An array of button states, or `NULL` if the joystick is not present
4046 * or an [error](@ref error_handling) occurred.
Camilla Berglund7f2eb7b2013-04-24 19:25:42 +02004047 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01004048 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
4049 * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR.
4050 *
Camilla Berglund951a9582016-01-31 21:32:14 +01004051 * @pointer_lifetime The returned array is allocated and freed by GLFW. You
4052 * should not free it yourself. It is valid until the specified joystick is
Camilla Löwy68014782017-02-01 04:36:38 +01004053 * disconnected or the library is terminated.
Camilla Berglund0e205772014-03-24 11:58:35 +01004054 *
Camilla Berglund951a9582016-01-31 21:32:14 +01004055 * @thread_safety This function must only be called from the main thread.
Camilla Berglundc3bb5c92013-06-05 16:04:04 +02004056 *
Camilla Berglund4188c262015-01-18 01:55:25 +01004057 * @sa @ref joystick_button
Camilla Berglund4591ad22014-09-18 15:03:29 +02004058 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01004059 * @since Added in version 2.2.
Camilla Berglund951a9582016-01-31 21:32:14 +01004060 * @glfw3 Changed to return a dynamic array.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004061 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004062 * @ingroup input
4063 */
Camilla Berglundefc6b352016-10-10 03:24:07 +02004064GLFWAPI const unsigned char* glfwGetJoystickButtons(int jid, int* count);
Camilla Berglund3249f812010-09-07 17:34:51 +02004065
Camilla Berglund7d9b5c02012-12-02 16:55:09 +01004066/*! @brief Returns the name of the specified joystick.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004067 *
4068 * This function returns the name, encoded as UTF-8, of the specified joystick.
Camilla Berglund4591ad22014-09-18 15:03:29 +02004069 * The returned string is allocated and freed by GLFW. You should not free it
4070 * yourself.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004071 *
Camilla Berglund386b6032016-02-10 13:48:49 +01004072 * Querying a joystick slot with no device present is not an error, but will
4073 * cause this function to return `NULL`. Call @ref glfwJoystickPresent to
4074 * check device presence.
4075 *
Camilla Berglundefc6b352016-10-10 03:24:07 +02004076 * @param[in] jid The [joystick](@ref joysticks) to query.
Camilla Berglund71d2b572013-03-12 15:33:05 +01004077 * @return The UTF-8 encoded name of the joystick, or `NULL` if the joystick
Camilla Berglund999f3552016-08-17 16:48:22 +02004078 * is not present or an [error](@ref error_handling) occurred.
Camilla Berglundd4a08b12012-12-02 17:13:41 +01004079 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01004080 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
4081 * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR.
4082 *
Camilla Berglund951a9582016-01-31 21:32:14 +01004083 * @pointer_lifetime The returned string is allocated and freed by GLFW. You
4084 * should not free it yourself. It is valid until the specified joystick is
Camilla Löwy68014782017-02-01 04:36:38 +01004085 * disconnected or the library is terminated.
Camilla Berglund0e205772014-03-24 11:58:35 +01004086 *
Camilla Berglund951a9582016-01-31 21:32:14 +01004087 * @thread_safety This function must only be called from the main thread.
Camilla Berglundc3bb5c92013-06-05 16:04:04 +02004088 *
Camilla Berglund4188c262015-01-18 01:55:25 +01004089 * @sa @ref joystick_name
Camilla Berglund4591ad22014-09-18 15:03:29 +02004090 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01004091 * @since Added in version 3.0.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004092 *
4093 * @ingroup input
Camilla Berglund7d9b5c02012-12-02 16:55:09 +01004094 */
Camilla Berglundefc6b352016-10-10 03:24:07 +02004095GLFWAPI const char* glfwGetJoystickName(int jid);
Camilla Berglund3249f812010-09-07 17:34:51 +02004096
Camilla Berglund8a7fa302015-12-13 17:38:50 +01004097/*! @brief Sets the joystick configuration callback.
4098 *
4099 * This function sets the joystick configuration callback, or removes the
4100 * currently set callback. This is called when a joystick is connected to or
4101 * disconnected from the system.
4102 *
Camilla Löwya46c95c2017-02-01 04:55:46 +01004103 * For joystick connection and disconnection events to be delivered on all
4104 * platforms, you need to call one of the [event processing](@ref events)
4105 * functions. Joystick disconnection may also be detected and the callback
4106 * called by joystick functions. The function will then return whatever it
4107 * returns for a disconnected joystick.
4108 *
Camilla Berglund8a7fa302015-12-13 17:38:50 +01004109 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
4110 * callback.
4111 * @return The previously set callback, or `NULL` if no callback was set or the
4112 * library had not been [initialized](@ref intro_init).
4113 *
4114 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
4115 *
4116 * @thread_safety This function must only be called from the main thread.
4117 *
4118 * @sa @ref joystick_event
4119 *
4120 * @since Added in version 3.2.
4121 *
4122 * @ingroup input
4123 */
4124GLFWAPI GLFWjoystickfun glfwSetJoystickCallback(GLFWjoystickfun cbfun);
4125
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004126/*! @brief Sets the clipboard to the specified string.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004127 *
4128 * This function sets the system clipboard to the specified, UTF-8 encoded
Camilla Berglund4591ad22014-09-18 15:03:29 +02004129 * string.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004130 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004131 * @param[in] window The window that will own the clipboard contents.
4132 * @param[in] string A UTF-8 encoded string.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004133 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01004134 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
4135 * GLFW_PLATFORM_ERROR.
4136 *
linkmauvebc8b0482016-10-16 15:52:39 +01004137 * @remark @wayland Clipboard is currently unimplemented.
4138 *
Camilla Berglund951a9582016-01-31 21:32:14 +01004139 * @pointer_lifetime The specified string is copied before this function
4140 * returns.
Camilla Berglunda3ff29a2012-12-02 15:47:10 +01004141 *
Camilla Berglund951a9582016-01-31 21:32:14 +01004142 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02004143 *
Camilla Berglund4188c262015-01-18 01:55:25 +01004144 * @sa @ref clipboard
Camilla Berglund7e9e3212016-09-14 20:17:26 +02004145 * @sa @ref glfwGetClipboardString
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004146 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01004147 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02004148 *
Camilla Berglund8d170c72014-09-09 16:26:57 +02004149 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004150 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01004151GLFWAPI void glfwSetClipboardString(GLFWwindow* window, const char* string);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004152
Camilla Berglund4591ad22014-09-18 15:03:29 +02004153/*! @brief Returns the contents of the clipboard as a string.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004154 *
4155 * This function returns the contents of the system clipboard, if it contains
Camilla Berglundcf9079c2015-09-16 18:51:49 +02004156 * or is convertible to a UTF-8 encoded string. If the clipboard is empty or
Camilla Berglund0b650532015-09-16 16:27:28 +02004157 * if its contents cannot be converted, `NULL` is returned and a @ref
4158 * GLFW_FORMAT_UNAVAILABLE error is generated.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004159 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004160 * @param[in] window The window that will request the clipboard contents.
Camilla Berglund71d2b572013-03-12 15:33:05 +01004161 * @return The contents of the clipboard as a UTF-8 encoded string, or `NULL`
Camilla Berglund4591ad22014-09-18 15:03:29 +02004162 * if an [error](@ref error_handling) occurred.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004163 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01004164 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
4165 * GLFW_PLATFORM_ERROR.
4166 *
linkmauvebc8b0482016-10-16 15:52:39 +01004167 * @remark @wayland Clipboard is currently unimplemented.
4168 *
Camilla Berglund951a9582016-01-31 21:32:14 +01004169 * @pointer_lifetime The returned string is allocated and freed by GLFW. You
4170 * should not free it yourself. It is valid until the next call to @ref
Camilla Berglund6be821c2014-10-06 23:18:33 +02004171 * glfwGetClipboardString or @ref glfwSetClipboardString, or until the library
4172 * is terminated.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004173 *
Camilla Berglund951a9582016-01-31 21:32:14 +01004174 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02004175 *
Camilla Berglund4188c262015-01-18 01:55:25 +01004176 * @sa @ref clipboard
Camilla Berglund7e9e3212016-09-14 20:17:26 +02004177 * @sa @ref glfwSetClipboardString
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004178 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01004179 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02004180 *
Camilla Berglund8d170c72014-09-09 16:26:57 +02004181 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004182 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01004183GLFWAPI const char* glfwGetClipboardString(GLFWwindow* window);
Ralph Eastwood31c91542011-09-21 10:09:47 +01004184
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004185/*! @brief Returns the value of the GLFW timer.
4186 *
4187 * This function returns the value of the GLFW timer. Unless the timer has
4188 * been set using @ref glfwSetTime, the timer measures time elapsed since GLFW
4189 * was initialized.
4190 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02004191 * The resolution of the timer is system dependent, but is usually on the order
4192 * of a few micro- or nanoseconds. It uses the highest-resolution monotonic
4193 * time source on each supported platform.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004194 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02004195 * @return The current value, in seconds, or zero if an
4196 * [error](@ref error_handling) occurred.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004197 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01004198 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
4199 *
Camilla Berglund20bce152016-05-30 16:04:37 +02004200 * @thread_safety This function may be called from any thread. Reading and
4201 * writing of the internal timer offset is not atomic, so it needs to be
4202 * externally synchronized with calls to @ref glfwSetTime.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004203 *
Camilla Berglund4188c262015-01-18 01:55:25 +01004204 * @sa @ref time
Camilla Berglund4591ad22014-09-18 15:03:29 +02004205 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01004206 * @since Added in version 1.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02004207 *
4208 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004209 */
Camilla Berglund9a716692010-09-08 16:40:43 +02004210GLFWAPI double glfwGetTime(void);
Camilla Berglund3249f812010-09-07 17:34:51 +02004211
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004212/*! @brief Sets the GLFW timer.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004213 *
4214 * This function sets the value of the GLFW timer. It then continues to count
Camilla Berglund6e20cda2015-03-10 12:01:38 +01004215 * up from that value. The value must be a positive finite number less than
4216 * or equal to 18446744073.0, which is approximately 584.5 years.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004217 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004218 * @param[in] time The new value, in seconds.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004219 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01004220 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
4221 * GLFW_INVALID_VALUE.
4222 *
Camilla Berglund951a9582016-01-31 21:32:14 +01004223 * @remark The upper limit of the timer is calculated as
Camilla Berglund6e20cda2015-03-10 12:01:38 +01004224 * floor((2<sup>64</sup> - 1) / 10<sup>9</sup>) and is due to implementations
4225 * storing nanoseconds in 64 bits. The limit may be increased in the future.
4226 *
Camilla Berglund20bce152016-05-30 16:04:37 +02004227 * @thread_safety This function may be called from any thread. Reading and
4228 * writing of the internal timer offset is not atomic, so it needs to be
4229 * externally synchronized with calls to @ref glfwGetTime.
Camilla Berglund0e205772014-03-24 11:58:35 +01004230 *
Camilla Berglund4188c262015-01-18 01:55:25 +01004231 * @sa @ref time
Camilla Berglunde248fb62013-03-29 14:06:23 +01004232 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01004233 * @since Added in version 2.2.
Camilla Berglund4591ad22014-09-18 15:03:29 +02004234 *
4235 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004236 */
4237GLFWAPI void glfwSetTime(double time);
4238
Camilla Berglund31f67dd2016-03-06 11:38:55 +01004239/*! @brief Returns the current value of the raw timer.
4240 *
Camilla Berglund337c77a2016-03-06 14:11:14 +01004241 * This function returns the current value of the raw timer, measured in
4242 * 1&nbsp;/&nbsp;frequency seconds. To get the frequency, call @ref
4243 * glfwGetTimerFrequency.
Camilla Berglund31f67dd2016-03-06 11:38:55 +01004244 *
4245 * @return The value of the timer, or zero if an
4246 * [error](@ref error_handling) occurred.
4247 *
Camilla Berglund46fce402016-03-07 13:35:37 +01004248 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
Camilla Berglund31f67dd2016-03-06 11:38:55 +01004249 *
4250 * @thread_safety This function may be called from any thread.
4251 *
4252 * @sa @ref time
Camilla Berglund7e9e3212016-09-14 20:17:26 +02004253 * @sa @ref glfwGetTimerFrequency
Camilla Berglund31f67dd2016-03-06 11:38:55 +01004254 *
4255 * @since Added in version 3.2.
4256 *
4257 * @ingroup input
4258 */
Camilla Berglund5661d032016-03-23 10:09:07 +01004259GLFWAPI uint64_t glfwGetTimerValue(void);
Camilla Berglund31f67dd2016-03-06 11:38:55 +01004260
4261/*! @brief Returns the frequency, in Hz, of the raw timer.
4262 *
Camilla Berglunddefaea32016-03-07 13:36:54 +01004263 * This function returns the frequency, in Hz, of the raw timer.
4264 *
Camilla Berglund31f67dd2016-03-06 11:38:55 +01004265 * @return The frequency of the timer, in Hz, or zero if an
4266 * [error](@ref error_handling) occurred.
4267 *
Camilla Berglund46fce402016-03-07 13:35:37 +01004268 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
Camilla Berglund31f67dd2016-03-06 11:38:55 +01004269 *
4270 * @thread_safety This function may be called from any thread.
4271 *
4272 * @sa @ref time
Camilla Berglund7e9e3212016-09-14 20:17:26 +02004273 * @sa @ref glfwGetTimerValue
Camilla Berglund31f67dd2016-03-06 11:38:55 +01004274 *
4275 * @since Added in version 3.2.
4276 *
4277 * @ingroup input
4278 */
Camilla Berglund5661d032016-03-23 10:09:07 +01004279GLFWAPI uint64_t glfwGetTimerFrequency(void);
Camilla Berglund31f67dd2016-03-06 11:38:55 +01004280
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004281/*! @brief Makes the context of the specified window current for the calling
4282 * thread.
4283 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02004284 * This function makes the OpenGL or OpenGL ES context of the specified window
4285 * current on the calling thread. A context can only be made current on
4286 * a single thread at a time and each thread can have only a single current
4287 * context at a time.
4288 *
4289 * By default, making a context non-current implicitly forces a pipeline flush.
4290 * On machines that support `GL_KHR_context_flush_control`, you can control
4291 * whether a context performs this flush by setting the
Camilla Löwyce161c22016-12-06 01:14:23 +01004292 * [GLFW_CONTEXT_RELEASE_BEHAVIOR](@ref GLFW_CONTEXT_RELEASE_BEHAVIOR_hint)
4293 * hint.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004294 *
Camilla Berglund98b478f2015-11-05 13:44:15 +01004295 * The specified window must have an OpenGL or OpenGL ES context. Specifying
4296 * a window without a context will generate a @ref GLFW_NO_WINDOW_CONTEXT
4297 * error.
4298 *
Camilla Berglund71d2b572013-03-12 15:33:05 +01004299 * @param[in] window The window whose context to make current, or `NULL` to
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004300 * detach the current context.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004301 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01004302 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
4303 * GLFW_NO_WINDOW_CONTEXT and @ref GLFW_PLATFORM_ERROR.
4304 *
Camilla Berglund951a9582016-01-31 21:32:14 +01004305 * @thread_safety This function may be called from any thread.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004306 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02004307 * @sa @ref context_current
Camilla Berglund7e9e3212016-09-14 20:17:26 +02004308 * @sa @ref glfwGetCurrentContext
Camilla Berglunde248fb62013-03-29 14:06:23 +01004309 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01004310 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02004311 *
Camilla Berglunde248fb62013-03-29 14:06:23 +01004312 * @ingroup context
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004313 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01004314GLFWAPI void glfwMakeContextCurrent(GLFWwindow* window);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004315
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004316/*! @brief Returns the window whose context is current on the calling thread.
4317 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02004318 * This function returns the window whose OpenGL or OpenGL ES context is
4319 * current on the calling thread.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004320 *
Camilla Berglund71d2b572013-03-12 15:33:05 +01004321 * @return The window whose context is current, or `NULL` if no window's
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004322 * context is current.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004323 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01004324 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
4325 *
Camilla Berglund951a9582016-01-31 21:32:14 +01004326 * @thread_safety This function may be called from any thread.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004327 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02004328 * @sa @ref context_current
Camilla Berglund7e9e3212016-09-14 20:17:26 +02004329 * @sa @ref glfwMakeContextCurrent
Camilla Berglunde248fb62013-03-29 14:06:23 +01004330 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01004331 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02004332 *
Camilla Berglunde248fb62013-03-29 14:06:23 +01004333 * @ingroup context
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004334 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01004335GLFWAPI GLFWwindow* glfwGetCurrentContext(void);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004336
4337/*! @brief Swaps the front and back buffers of the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004338 *
Camilla Berglund001c50c2016-02-19 09:13:56 +01004339 * This function swaps the front and back buffers of the specified window when
4340 * rendering with OpenGL or OpenGL ES. If the swap interval is greater than
4341 * zero, the GPU driver waits the specified number of screen updates before
4342 * swapping the buffers.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004343 *
Camilla Berglund98b478f2015-11-05 13:44:15 +01004344 * The specified window must have an OpenGL or OpenGL ES context. Specifying
4345 * a window without a context will generate a @ref GLFW_NO_WINDOW_CONTEXT
4346 * error.
4347 *
Camilla Berglund001c50c2016-02-19 09:13:56 +01004348 * This function does not apply to Vulkan. If you are rendering with Vulkan,
4349 * see `vkQueuePresentKHR` instead.
4350 *
Camilla Berglund9492fc52013-01-17 17:51:12 +01004351 * @param[in] window The window whose buffers to swap.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004352 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01004353 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
4354 * GLFW_NO_WINDOW_CONTEXT and @ref GLFW_PLATFORM_ERROR.
4355 *
Camilla Berglund951a9582016-01-31 21:32:14 +01004356 * @remark __EGL:__ The context of the specified window must be current on the
Camilla Berglund276b1bc2016-01-31 19:17:18 +01004357 * calling thread.
4358 *
Camilla Berglund951a9582016-01-31 21:32:14 +01004359 * @thread_safety This function may be called from any thread.
Camilla Berglund401033c2013-03-12 19:17:07 +01004360 *
Camilla Berglund4188c262015-01-18 01:55:25 +01004361 * @sa @ref buffer_swap
Camilla Berglund7e9e3212016-09-14 20:17:26 +02004362 * @sa @ref glfwSwapInterval
Camilla Berglunde248fb62013-03-29 14:06:23 +01004363 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01004364 * @since Added in version 1.0.
Camilla Berglund951a9582016-01-31 21:32:14 +01004365 * @glfw3 Added window handle parameter.
Camilla Berglund4591ad22014-09-18 15:03:29 +02004366 *
4367 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004368 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01004369GLFWAPI void glfwSwapBuffers(GLFWwindow* window);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004370
4371/*! @brief Sets the swap interval for the current context.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004372 *
Camilla Berglund001c50c2016-02-19 09:13:56 +01004373 * This function sets the swap interval for the current OpenGL or OpenGL ES
4374 * context, i.e. the number of screen updates to wait from the time @ref
4375 * glfwSwapBuffers was called before swapping the buffers and returning. This
4376 * is sometimes called _vertical synchronization_, _vertical retrace
4377 * synchronization_ or just _vsync_.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004378 *
Camilla Berglund5fd409b2013-06-05 17:53:13 +02004379 * Contexts that support either of the `WGL_EXT_swap_control_tear` and
Camilla Berglund8282a8f2013-04-10 23:01:12 +02004380 * `GLX_EXT_swap_control_tear` extensions also accept negative swap intervals,
4381 * which allow the driver to swap even if a frame arrives a little bit late.
4382 * You can check for the presence of these extensions using @ref
4383 * glfwExtensionSupported. For more information about swap tearing, see the
4384 * extension specifications.
4385 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02004386 * A context must be current on the calling thread. Calling this function
Camilla Berglundce8f97c2015-01-11 23:33:14 +01004387 * without a current context will cause a @ref GLFW_NO_CURRENT_CONTEXT error.
Camilla Berglund4591ad22014-09-18 15:03:29 +02004388 *
Camilla Berglund001c50c2016-02-19 09:13:56 +01004389 * This function does not apply to Vulkan. If you are rendering with Vulkan,
4390 * see the present mode of your swapchain instead.
4391 *
Camilla Berglund5fd409b2013-06-05 17:53:13 +02004392 * @param[in] interval The minimum number of screen updates to wait for
4393 * until the buffers are swapped by @ref glfwSwapBuffers.
4394 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01004395 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
4396 * GLFW_NO_CURRENT_CONTEXT and @ref GLFW_PLATFORM_ERROR.
4397 *
Camilla Berglund951a9582016-01-31 21:32:14 +01004398 * @remark This function is not called during context creation, leaving the
Camilla Berglund11c22d62015-02-19 15:33:51 +01004399 * swap interval set to whatever is the default on that platform. This is done
Camilla Berglund3af1c412013-09-19 21:37:01 +02004400 * because some swap interval extensions used by GLFW do not allow the swap
4401 * interval to be reset to zero once it has been set to a non-zero value.
4402 *
Camilla Berglund951a9582016-01-31 21:32:14 +01004403 * @remark Some GPU drivers do not honor the requested swap interval, either
Camilla Berglund11c22d62015-02-19 15:33:51 +01004404 * because of a user setting that overrides the application's request or due to
4405 * bugs in the driver.
Camilla Berglund8282a8f2013-04-10 23:01:12 +02004406 *
Camilla Berglund951a9582016-01-31 21:32:14 +01004407 * @thread_safety This function may be called from any thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02004408 *
Camilla Berglund4188c262015-01-18 01:55:25 +01004409 * @sa @ref buffer_swap
Camilla Berglund7e9e3212016-09-14 20:17:26 +02004410 * @sa @ref glfwSwapBuffers
Camilla Berglunde248fb62013-03-29 14:06:23 +01004411 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01004412 * @since Added in version 1.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02004413 *
Camilla Berglunde248fb62013-03-29 14:06:23 +01004414 * @ingroup context
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004415 */
4416GLFWAPI void glfwSwapInterval(int interval);
4417
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004418/*! @brief Returns whether the specified extension is available.
4419 *
Camilla Berglund608109c2013-04-11 20:18:46 +02004420 * This function returns whether the specified
Camilla Berglund001c50c2016-02-19 09:13:56 +01004421 * [API extension](@ref context_glext) is supported by the current OpenGL or
4422 * OpenGL ES context. It searches both for client API extension and context
4423 * creation API extensions.
Camilla Berglund4591ad22014-09-18 15:03:29 +02004424 *
4425 * A context must be current on the calling thread. Calling this function
Camilla Berglundce8f97c2015-01-11 23:33:14 +01004426 * without a current context will cause a @ref GLFW_NO_CURRENT_CONTEXT error.
Camilla Berglund4591ad22014-09-18 15:03:29 +02004427 *
4428 * As this functions retrieves and searches one or more extension strings each
4429 * call, it is recommended that you cache its results if it is going to be used
4430 * frequently. The extension strings will not change during the lifetime of
4431 * a context, so there is no danger in doing this.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004432 *
Camilla Berglund001c50c2016-02-19 09:13:56 +01004433 * This function does not apply to Vulkan. If you are using Vulkan, see @ref
4434 * glfwGetRequiredInstanceExtensions, `vkEnumerateInstanceExtensionProperties`
4435 * and `vkEnumerateDeviceExtensionProperties` instead.
4436 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004437 * @param[in] extension The ASCII encoded name of the extension.
Camilla Berglund0eccf752015-08-23 19:30:04 +02004438 * @return `GLFW_TRUE` if the extension is available, or `GLFW_FALSE`
4439 * otherwise.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004440 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01004441 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
4442 * GLFW_NO_CURRENT_CONTEXT, @ref GLFW_INVALID_VALUE and @ref
4443 * GLFW_PLATFORM_ERROR.
4444 *
Camilla Berglund951a9582016-01-31 21:32:14 +01004445 * @thread_safety This function may be called from any thread.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004446 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02004447 * @sa @ref context_glext
Camilla Berglund7e9e3212016-09-14 20:17:26 +02004448 * @sa @ref glfwGetProcAddress
Camilla Berglund4591ad22014-09-18 15:03:29 +02004449 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01004450 * @since Added in version 1.0.
Camilla Berglunde248fb62013-03-29 14:06:23 +01004451 *
4452 * @ingroup context
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004453 */
4454GLFWAPI int glfwExtensionSupported(const char* extension);
4455
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004456/*! @brief Returns the address of the specified function for the current
4457 * context.
4458 *
Camilla Berglund001c50c2016-02-19 09:13:56 +01004459 * This function returns the address of the specified OpenGL or OpenGL ES
Camilla Berglund11c22d62015-02-19 15:33:51 +01004460 * [core or extension function](@ref context_glext), if it is supported
Camilla Berglund1f5f20e2013-05-27 17:10:34 +02004461 * by the current context.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004462 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02004463 * A context must be current on the calling thread. Calling this function
Camilla Berglundce8f97c2015-01-11 23:33:14 +01004464 * without a current context will cause a @ref GLFW_NO_CURRENT_CONTEXT error.
Camilla Berglund4591ad22014-09-18 15:03:29 +02004465 *
Camilla Berglund001c50c2016-02-19 09:13:56 +01004466 * This function does not apply to Vulkan. If you are rendering with Vulkan,
4467 * see @ref glfwGetInstanceProcAddress, `vkGetInstanceProcAddr` and
4468 * `vkGetDeviceProcAddr` instead.
4469 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004470 * @param[in] procname The ASCII encoded name of the function.
Camilla Berglunda36e3a22015-11-05 17:14:26 +01004471 * @return The address of the function, or `NULL` if an
4472 * [error](@ref error_handling) occurred.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004473 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01004474 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
4475 * GLFW_NO_CURRENT_CONTEXT and @ref GLFW_PLATFORM_ERROR.
4476 *
Camilla Berglund951a9582016-01-31 21:32:14 +01004477 * @remark The address of a given function is not guaranteed to be the same
Camilla Berglund4591ad22014-09-18 15:03:29 +02004478 * between contexts.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004479 *
Camilla Berglund951a9582016-01-31 21:32:14 +01004480 * @remark This function may return a non-`NULL` address despite the
Camilla Berglund11c22d62015-02-19 15:33:51 +01004481 * associated version or extension not being available. Always check the
Camilla Berglundc8e06872015-08-27 21:40:22 +02004482 * context version or extension string first.
Camilla Berglund11c22d62015-02-19 15:33:51 +01004483 *
Camilla Berglund951a9582016-01-31 21:32:14 +01004484 * @pointer_lifetime The returned function pointer is valid until the context
4485 * is destroyed or the library is terminated.
Camilla Berglund4591ad22014-09-18 15:03:29 +02004486 *
Camilla Berglund951a9582016-01-31 21:32:14 +01004487 * @thread_safety This function may be called from any thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02004488 *
4489 * @sa @ref context_glext
Camilla Berglund7e9e3212016-09-14 20:17:26 +02004490 * @sa @ref glfwExtensionSupported
Camilla Berglund4591ad22014-09-18 15:03:29 +02004491 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01004492 * @since Added in version 1.0.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004493 *
4494 * @ingroup context
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004495 */
Camilla Berglundbf42c3c2012-06-05 00:16:40 +02004496GLFWAPI GLFWglproc glfwGetProcAddress(const char* procname);
Camilla Berglund3249f812010-09-07 17:34:51 +02004497
Camilla Löwy98bdd362017-02-07 20:56:48 +01004498/*! @brief Returns whether the Vulkan loader and an ICD have been found.
Camilla Berglund9b75bff2015-08-10 20:19:04 +02004499 *
Camilla Löwy98bdd362017-02-07 20:56:48 +01004500 * This function returns whether the Vulkan loader and any minimally functional
4501 * ICD have been found.
Camilla Berglund9b75bff2015-08-10 20:19:04 +02004502 *
Camilla Löwy98bdd362017-02-07 20:56:48 +01004503 * The availability of a Vulkan loader and even an ICD does not by itself
4504 * guarantee that surface creation or even instance creation is possible.
4505 * For example, on Fermi systems Nvidia will install an ICD that provides no
4506 * actual Vulkan support. Call @ref glfwGetRequiredInstanceExtensions to check
4507 * whether the extensions necessary for Vulkan surface creation are available
4508 * and @ref glfwGetPhysicalDevicePresentationSupport to check whether a queue
4509 * family of a physical device supports image presentation.
Camilla Berglund9b75bff2015-08-10 20:19:04 +02004510 *
Camilla Löwy98bdd362017-02-07 20:56:48 +01004511 * @return `GLFW_TRUE` if Vulkan is minimally available, or `GLFW_FALSE`
4512 * otherwise.
Camilla Berglund9b75bff2015-08-10 20:19:04 +02004513 *
4514 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
4515 *
4516 * @thread_safety This function may be called from any thread.
4517 *
4518 * @sa @ref vulkan_support
4519 *
4520 * @since Added in version 3.2.
4521 *
4522 * @ingroup vulkan
4523 */
4524GLFWAPI int glfwVulkanSupported(void);
4525
4526/*! @brief Returns the Vulkan instance extensions required by GLFW.
4527 *
4528 * This function returns an array of names of Vulkan instance extensions required
4529 * by GLFW for creating Vulkan surfaces for GLFW windows. If successful, the
4530 * list will always contains `VK_KHR_surface`, so if you don't require any
4531 * additional extensions you can pass this list directly to the
4532 * `VkInstanceCreateInfo` struct.
4533 *
4534 * If Vulkan is not available on the machine, this function returns `NULL` and
4535 * generates a @ref GLFW_API_UNAVAILABLE error. Call @ref glfwVulkanSupported
Camilla Löwy98bdd362017-02-07 20:56:48 +01004536 * to check whether Vulkan is at least minimally available.
Camilla Berglund9b75bff2015-08-10 20:19:04 +02004537 *
4538 * If Vulkan is available but no set of extensions allowing window surface
4539 * creation was found, this function returns `NULL`. You may still use Vulkan
4540 * for off-screen rendering and compute work.
4541 *
4542 * @param[out] count Where to store the number of extensions in the returned
4543 * array. This is set to zero if an error occurred.
4544 * @return An array of ASCII encoded extension names, or `NULL` if an
4545 * [error](@ref error_handling) occurred.
4546 *
4547 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
4548 * GLFW_API_UNAVAILABLE.
4549 *
Camilla Berglund67931bd2016-10-26 16:58:56 +02004550 * @remark Additional extensions may be required by future versions of GLFW.
Camilla Berglund9b75bff2015-08-10 20:19:04 +02004551 * You should check if any extensions you wish to enable are already in the
4552 * returned array, as it is an error to specify an extension more than once in
4553 * the `VkInstanceCreateInfo` struct.
4554 *
Camilla Berglunde94d1662016-10-14 01:46:56 +02004555 * @remark @macos This function currently only supports the
4556 * `VK_MVK_macos_surface` extension from MoltenVK.
4557 *
Camilla Berglund9b75bff2015-08-10 20:19:04 +02004558 * @pointer_lifetime The returned array is allocated and freed by GLFW. You
4559 * should not free it yourself. It is guaranteed to be valid only until the
4560 * library is terminated.
4561 *
4562 * @thread_safety This function may be called from any thread.
4563 *
4564 * @sa @ref vulkan_ext
Camilla Berglund7e9e3212016-09-14 20:17:26 +02004565 * @sa @ref glfwCreateWindowSurface
Camilla Berglund9b75bff2015-08-10 20:19:04 +02004566 *
4567 * @since Added in version 3.2.
4568 *
4569 * @ingroup vulkan
4570 */
Camilla Berglund7ab7d8b2016-03-23 10:24:01 +01004571GLFWAPI const char** glfwGetRequiredInstanceExtensions(uint32_t* count);
Camilla Berglund9b75bff2015-08-10 20:19:04 +02004572
4573#if defined(VK_VERSION_1_0)
4574
4575/*! @brief Returns the address of the specified Vulkan instance function.
4576 *
4577 * This function returns the address of the specified Vulkan core or extension
4578 * function for the specified instance. If instance is set to `NULL` it can
4579 * return any function exported from the Vulkan loader, including at least the
4580 * following functions:
4581 *
4582 * - `vkEnumerateInstanceExtensionProperties`
4583 * - `vkEnumerateInstanceLayerProperties`
4584 * - `vkCreateInstance`
4585 * - `vkGetInstanceProcAddr`
4586 *
4587 * If Vulkan is not available on the machine, this function returns `NULL` and
4588 * generates a @ref GLFW_API_UNAVAILABLE error. Call @ref glfwVulkanSupported
Camilla Löwy98bdd362017-02-07 20:56:48 +01004589 * to check whether Vulkan is at least minimally available.
Camilla Berglund9b75bff2015-08-10 20:19:04 +02004590 *
4591 * This function is equivalent to calling `vkGetInstanceProcAddr` with
4592 * a platform-specific query of the Vulkan loader as a fallback.
4593 *
4594 * @param[in] instance The Vulkan instance to query, or `NULL` to retrieve
4595 * functions related to instance creation.
4596 * @param[in] procname The ASCII encoded name of the function.
4597 * @return The address of the function, or `NULL` if an
4598 * [error](@ref error_handling) occurred.
4599 *
4600 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
4601 * GLFW_API_UNAVAILABLE.
4602 *
4603 * @pointer_lifetime The returned function pointer is valid until the library
4604 * is terminated.
4605 *
4606 * @thread_safety This function may be called from any thread.
4607 *
4608 * @sa @ref vulkan_proc
4609 *
4610 * @since Added in version 3.2.
4611 *
4612 * @ingroup vulkan
4613 */
4614GLFWAPI GLFWvkproc glfwGetInstanceProcAddress(VkInstance instance, const char* procname);
4615
4616/*! @brief Returns whether the specified queue family can present images.
4617 *
4618 * This function returns whether the specified queue family of the specified
4619 * physical device supports presentation to the platform GLFW was built for.
4620 *
4621 * If Vulkan or the required window surface creation instance extensions are
4622 * not available on the machine, or if the specified instance was not created
4623 * with the required extensions, this function returns `GLFW_FALSE` and
4624 * generates a @ref GLFW_API_UNAVAILABLE error. Call @ref glfwVulkanSupported
Camilla Löwy98bdd362017-02-07 20:56:48 +01004625 * to check whether Vulkan is at least minimally available and @ref
Camilla Berglund9b75bff2015-08-10 20:19:04 +02004626 * glfwGetRequiredInstanceExtensions to check what instance extensions are
4627 * required.
4628 *
4629 * @param[in] instance The instance that the physical device belongs to.
4630 * @param[in] device The physical device that the queue family belongs to.
4631 * @param[in] queuefamily The index of the queue family to query.
4632 * @return `GLFW_TRUE` if the queue family supports presentation, or
4633 * `GLFW_FALSE` otherwise.
4634 *
4635 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
4636 * GLFW_API_UNAVAILABLE and @ref GLFW_PLATFORM_ERROR.
4637 *
Camilla Berglunde94d1662016-10-14 01:46:56 +02004638 * @remark @macos This function currently always returns `GLFW_TRUE`, as the
4639 * `VK_MVK_macos_surface` extension does not provide
4640 * a `vkGetPhysicalDevice*PresentationSupport` type function.
4641 *
Camilla Berglund9b75bff2015-08-10 20:19:04 +02004642 * @thread_safety This function may be called from any thread. For
4643 * synchronization details of Vulkan objects, see the Vulkan specification.
4644 *
4645 * @sa @ref vulkan_present
4646 *
4647 * @since Added in version 3.2.
4648 *
4649 * @ingroup vulkan
4650 */
4651GLFWAPI int glfwGetPhysicalDevicePresentationSupport(VkInstance instance, VkPhysicalDevice device, uint32_t queuefamily);
4652
4653/*! @brief Creates a Vulkan surface for the specified window.
4654 *
4655 * This function creates a Vulkan surface for the specified window.
4656 *
Camilla Löwy98bdd362017-02-07 20:56:48 +01004657 * If the Vulkan loader or at least one minimally functional ICD were not found,
4658 * this function returns `VK_ERROR_INITIALIZATION_FAILED` and generates a @ref
4659 * GLFW_API_UNAVAILABLE error. Call @ref glfwVulkanSupported to check whether
4660 * Vulkan is at least minimally available.
Camilla Berglund9b75bff2015-08-10 20:19:04 +02004661 *
4662 * If the required window surface creation instance extensions are not
4663 * available or if the specified instance was not created with these extensions
4664 * enabled, this function returns `VK_ERROR_EXTENSION_NOT_PRESENT` and
4665 * generates a @ref GLFW_API_UNAVAILABLE error. Call @ref
4666 * glfwGetRequiredInstanceExtensions to check what instance extensions are
4667 * required.
4668 *
4669 * The window surface must be destroyed before the specified Vulkan instance.
4670 * It is the responsibility of the caller to destroy the window surface. GLFW
4671 * does not destroy it for you. Call `vkDestroySurfaceKHR` to destroy the
4672 * surface.
4673 *
4674 * @param[in] instance The Vulkan instance to create the surface in.
4675 * @param[in] window The window to create the surface for.
4676 * @param[in] allocator The allocator to use, or `NULL` to use the default
4677 * allocator.
4678 * @param[out] surface Where to store the handle of the surface. This is set
4679 * to `VK_NULL_HANDLE` if an error occurred.
4680 * @return `VK_SUCCESS` if successful, or a Vulkan error code if an
4681 * [error](@ref error_handling) occurred.
4682 *
4683 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
4684 * GLFW_API_UNAVAILABLE and @ref GLFW_PLATFORM_ERROR.
4685 *
Camilla Berglund67931bd2016-10-26 16:58:56 +02004686 * @remark If an error occurs before the creation call is made, GLFW returns
Camilla Berglund9b75bff2015-08-10 20:19:04 +02004687 * the Vulkan error code most appropriate for the error. Appropriate use of
4688 * @ref glfwVulkanSupported and @ref glfwGetRequiredInstanceExtensions should
Camilla Berglundee33dcd2016-03-07 14:42:51 +01004689 * eliminate almost all occurrences of these errors.
Camilla Berglund9b75bff2015-08-10 20:19:04 +02004690 *
Camilla Berglunde94d1662016-10-14 01:46:56 +02004691 * @remark @macos This function currently only supports the
4692 * `VK_MVK_macos_surface` extension from MoltenVK.
4693 *
4694 * @remark @macos This function creates and sets a `CAMetalLayer` instance for
4695 * the window content view, which is required for MoltenVK to function.
4696 *
Camilla Berglund9b75bff2015-08-10 20:19:04 +02004697 * @thread_safety This function may be called from any thread. For
4698 * synchronization details of Vulkan objects, see the Vulkan specification.
4699 *
4700 * @sa @ref vulkan_surface
Camilla Berglund7e9e3212016-09-14 20:17:26 +02004701 * @sa @ref glfwGetRequiredInstanceExtensions
Camilla Berglund9b75bff2015-08-10 20:19:04 +02004702 *
4703 * @since Added in version 3.2.
4704 *
4705 * @ingroup vulkan
4706 */
4707GLFWAPI VkResult glfwCreateWindowSurface(VkInstance instance, GLFWwindow* window, const VkAllocationCallbacks* allocator, VkSurfaceKHR* surface);
4708
4709#endif /*VK_VERSION_1_0*/
4710
Camilla Berglund3249f812010-09-07 17:34:51 +02004711
Camilla Berglund4afc67c2011-07-27 17:09:17 +02004712/*************************************************************************
4713 * Global definition cleanup
4714 *************************************************************************/
4715
4716/* ------------------- BEGIN SYSTEM/COMPILER SPECIFIC -------------------- */
4717
Camilla Berglund4afc67c2011-07-27 17:09:17 +02004718#ifdef GLFW_WINGDIAPI_DEFINED
4719 #undef WINGDIAPI
4720 #undef GLFW_WINGDIAPI_DEFINED
4721#endif
4722
4723#ifdef GLFW_CALLBACK_DEFINED
4724 #undef CALLBACK
4725 #undef GLFW_CALLBACK_DEFINED
4726#endif
4727
4728/* -------------------- END SYSTEM/COMPILER SPECIFIC --------------------- */
4729
4730
Camilla Berglund3249f812010-09-07 17:34:51 +02004731#ifdef __cplusplus
4732}
4733#endif
4734
Camilla Berglundf8df91d2013-01-15 01:59:56 +01004735#endif /* _glfw3_h_ */
Camilla Berglund3249f812010-09-07 17:34:51 +02004736