blob: f3c8e1ff2474f9342e9ab4d0333319c0b2beef86 [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.
Camilla Löwyfa0b5e12017-05-16 14:54:17 +0200137 * Include it unconditionally to avoid surprising side-effects.
Camilla Berglund70423af2016-07-21 00:15:07 +0200138 */
Camilla Berglund5661d032016-03-23 10:09:07 +0100139#include <stdint.h>
Camilla Berglund3249f812010-09-07 17:34:51 +0200140
Camilla Löwyfa0b5e12017-05-16 14:54:17 +0200141/* Include the chosen OpenGL or OpenGL ES headers.
Camilla Berglundc93b1202013-09-08 16:07:34 +0200142 */
Konstantin Käfer244d6d72017-05-16 15:42:51 +0200143#if defined(GLFW_INCLUDE_ES1)
Camilla Löwyfa0b5e12017-05-16 14:54:17 +0200144
Konstantin Käfer244d6d72017-05-16 15:42:51 +0200145 #include <GLES/gl.h>
146 #if defined(GLFW_INCLUDE_GLEXT)
147 #include <GLES/glext.h>
148 #endif
Camilla Löwyfa0b5e12017-05-16 14:54:17 +0200149
Konstantin Käfer244d6d72017-05-16 15:42:51 +0200150#elif defined(GLFW_INCLUDE_ES2)
Camilla Löwyfa0b5e12017-05-16 14:54:17 +0200151
Konstantin Käfer244d6d72017-05-16 15:42:51 +0200152 #include <GLES2/gl2.h>
153 #if defined(GLFW_INCLUDE_GLEXT)
154 #include <GLES2/gl2ext.h>
155 #endif
Camilla Löwyfa0b5e12017-05-16 14:54:17 +0200156
Konstantin Käfer244d6d72017-05-16 15:42:51 +0200157#elif defined(GLFW_INCLUDE_ES3)
Camilla Löwyfa0b5e12017-05-16 14:54:17 +0200158
Konstantin Käfer244d6d72017-05-16 15:42:51 +0200159 #include <GLES3/gl3.h>
160 #if defined(GLFW_INCLUDE_GLEXT)
161 #include <GLES2/gl2ext.h>
162 #endif
Camilla Löwyfa0b5e12017-05-16 14:54:17 +0200163
Konstantin Käfer244d6d72017-05-16 15:42:51 +0200164#elif defined(GLFW_INCLUDE_ES31)
Camilla Löwyfa0b5e12017-05-16 14:54:17 +0200165
Konstantin Käfer244d6d72017-05-16 15:42:51 +0200166 #include <GLES3/gl31.h>
167 #if defined(GLFW_INCLUDE_GLEXT)
168 #include <GLES2/gl2ext.h>
169 #endif
Camilla Löwyfa0b5e12017-05-16 14:54:17 +0200170
Konstantin Käfer244d6d72017-05-16 15:42:51 +0200171#elif defined(GLFW_INCLUDE_ES32)
Camilla Löwyfa0b5e12017-05-16 14:54:17 +0200172
Konstantin Käfer244d6d72017-05-16 15:42:51 +0200173 #include <GLES3/gl32.h>
174 #if defined(GLFW_INCLUDE_GLEXT)
175 #include <GLES2/gl2ext.h>
176 #endif
Camilla Löwyfa0b5e12017-05-16 14:54:17 +0200177
178#elif defined(GLFW_INCLUDE_GLCOREARB)
179
180 #if defined(__APPLE__)
181
Camilla Berglund1591caa2015-01-08 06:56:17 +0100182 #include <OpenGL/gl3.h>
183 #if defined(GLFW_INCLUDE_GLEXT)
184 #include <OpenGL/gl3ext.h>
Camilla Löwyfa0b5e12017-05-16 14:54:17 +0200185 #endif /*GLFW_INCLUDE_GLEXT*/
186
187 #else /*__APPLE__*/
188
189 #include <GL/glcorearb.h>
190
191 #endif /*__APPLE__*/
192
193#elif !defined(GLFW_INCLUDE_NONE)
194
195 #if defined(__APPLE__)
196
Camilla Berglund1591caa2015-01-08 06:56:17 +0100197 #if !defined(GLFW_INCLUDE_GLEXT)
198 #define GL_GLEXT_LEGACY
Camilla Berglundc93b1202013-09-08 16:07:34 +0200199 #endif
Camilla Berglund1591caa2015-01-08 06:56:17 +0100200 #include <OpenGL/gl.h>
Camilla Löwyfa0b5e12017-05-16 14:54:17 +0200201 #if defined(GLFW_INCLUDE_GLU)
202 #include <OpenGL/glu.h>
203 #endif
204
205 #else /*__APPLE__*/
206
Camilla Berglund1591caa2015-01-08 06:56:17 +0100207 #include <GL/gl.h>
208 #if defined(GLFW_INCLUDE_GLEXT)
209 #include <GL/glext.h>
210 #endif
Camilla Löwyfa0b5e12017-05-16 14:54:17 +0200211 #if defined(GLFW_INCLUDE_GLU)
212 #include <GL/glu.h>
213 #endif
214
215 #endif /*__APPLE__*/
216
217#endif /* OpenGL and OpenGL ES headers */
218
Camilla Berglund433db8f2016-09-14 21:13:33 +0200219#if defined(GLFW_INCLUDE_VULKAN)
Camilla Löwyfa0b5e12017-05-16 14:54:17 +0200220
Camilla Berglunde94d1662016-10-14 01:46:56 +0200221 #if defined(__APPLE__)
222 #include <MoltenVK/vulkan/vulkan.h>
223 #else
224 #include <vulkan/vulkan.h>
225 #endif
Camilla Löwyfa0b5e12017-05-16 14:54:17 +0200226
227#endif /* Vulkan header */
Camilla Berglund3249f812010-09-07 17:34:51 +0200228
Camilla Berglundcc5d7cd2012-03-25 17:43:02 +0200229#if defined(GLFW_DLL) && defined(_GLFW_BUILD_DLL)
Camilla Berglunde8e05d42014-04-23 13:30:11 +0200230 /* GLFW_DLL must be defined by applications that are linking against the DLL
231 * version of the GLFW library. _GLFW_BUILD_DLL is defined by the GLFW
232 * configuration header when compiling the DLL version of the library.
Camilla Berglundbd2d5712013-07-23 01:59:27 +0200233 */
Camilla Berglund0df4e062015-12-13 14:07:27 +0100234 #error "You must not have both GLFW_DLL and _GLFW_BUILD_DLL defined"
Camilla Berglundcc5d7cd2012-03-25 17:43:02 +0200235#endif
236
Camilla Berglund1591caa2015-01-08 06:56:17 +0100237/* GLFWAPI is used to declare public API functions for export
238 * from the DLL / shared library / dynamic library.
239 */
Camilla Berglund2588c9b2012-03-25 17:40:30 +0200240#if defined(_WIN32) && defined(_GLFW_BUILD_DLL)
Camilla Berglund3afa8312014-10-13 14:13:08 +0200241 /* We are building GLFW as a Win32 DLL */
Camilla Berglund2955cd32010-11-17 15:42:55 +0100242 #define GLFWAPI __declspec(dllexport)
Camilla Berglund3249f812010-09-07 17:34:51 +0200243#elif defined(_WIN32) && defined(GLFW_DLL)
Camilla Berglund3afa8312014-10-13 14:13:08 +0200244 /* We are calling GLFW as a Win32 DLL */
Camilla Berglund1247fc02015-02-22 18:10:20 +0100245 #define GLFWAPI __declspec(dllimport)
John Bartholomew93f4eff2013-05-01 13:08:09 +0100246#elif defined(__GNUC__) && defined(_GLFW_BUILD_DLL)
Camilla Berglund3afa8312014-10-13 14:13:08 +0200247 /* We are building GLFW as a shared / dynamic library */
John Bartholomew93f4eff2013-05-01 13:08:09 +0100248 #define GLFWAPI __attribute__((visibility("default")))
Camilla Berglund3249f812010-09-07 17:34:51 +0200249#else
Camilla Berglund3afa8312014-10-13 14:13:08 +0200250 /* We are building or calling GLFW as a static library */
Camilla Berglund3249f812010-09-07 17:34:51 +0200251 #define GLFWAPI
Camilla Berglund3249f812010-09-07 17:34:51 +0200252#endif
253
Camilla Berglund3249f812010-09-07 17:34:51 +0200254
255/*************************************************************************
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100256 * GLFW API tokens
Camilla Berglund3249f812010-09-07 17:34:51 +0200257 *************************************************************************/
258
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100259/*! @name GLFW version macros
260 * @{ */
261/*! @brief The major version number of the GLFW library.
262 *
263 * This is incremented when the API is changed in non-compatible ways.
264 * @ingroup init
265 */
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100266#define GLFW_VERSION_MAJOR 3
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100267/*! @brief The minor version number of the GLFW library.
268 *
269 * This is incremented when features are added to the API but it remains
270 * backward-compatible.
271 * @ingroup init
272 */
Camilla Berglund53fafad2016-08-18 23:42:15 +0200273#define GLFW_VERSION_MINOR 3
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100274/*! @brief The revision number of the GLFW library.
275 *
276 * This is incremented when a bug fix release is made that does not contain any
277 * API changes.
278 * @ingroup init
279 */
Camilla Berglund53fafad2016-08-18 23:42:15 +0200280#define GLFW_VERSION_REVISION 0
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100281/*! @} */
Camilla Berglund3249f812010-09-07 17:34:51 +0200282
Camilla Berglund0eccf752015-08-23 19:30:04 +0200283/*! @name Boolean values
284 * @{ */
285/*! @brief One.
286 *
287 * One. Seriously. You don't _need_ to use this symbol in your code. It's
288 * just semantic sugar for the number 1. You can use `1` or `true` or `_True`
289 * or `GL_TRUE` or whatever you want.
290 */
291#define GLFW_TRUE 1
292/*! @brief Zero.
293 *
294 * Zero. Seriously. You don't _need_ to use this symbol in your code. It's
295 * just just semantic sugar for the number 0. You can use `0` or `false` or
296 * `_False` or `GL_FALSE` or whatever you want.
297 */
298#define GLFW_FALSE 0
299/*! @} */
300
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100301/*! @name Key and button actions
302 * @{ */
Camilla Berglund4591ad22014-09-18 15:03:29 +0200303/*! @brief The key or mouse button was released.
304 *
305 * The key or mouse button was released.
306 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100307 * @ingroup input
308 */
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100309#define GLFW_RELEASE 0
Camilla Berglund4591ad22014-09-18 15:03:29 +0200310/*! @brief The key or mouse button was pressed.
311 *
312 * The key or mouse button was pressed.
313 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100314 * @ingroup input
315 */
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100316#define GLFW_PRESS 1
Camilla Berglund253e0d62013-01-12 17:06:35 +0100317/*! @brief The key was held down until it repeated.
Camilla Berglund4591ad22014-09-18 15:03:29 +0200318 *
319 * The key was held down until it repeated.
320 *
Camilla Berglund253e0d62013-01-12 17:06:35 +0100321 * @ingroup input
322 */
323#define GLFW_REPEAT 2
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100324/*! @} */
Camilla Berglund3249f812010-09-07 17:34:51 +0200325
Camilla Löwy798d7c62017-03-01 23:27:20 +0100326/*! @defgroup hat_state Joystick hat states
IntellectualKitty368dec72016-11-25 20:56:24 -0700327 *
328 * See [joystick hat input](@ref joystick_hat) for how these are used.
329 *
330 * @ingroup input
331 * @{ */
332#define GLFW_HAT_CENTERED 0
333#define GLFW_HAT_UP 1
334#define GLFW_HAT_RIGHT 2
335#define GLFW_HAT_DOWN 4
336#define GLFW_HAT_LEFT 8
337#define GLFW_HAT_RIGHT_UP (GLFW_HAT_RIGHT | GLFW_HAT_UP)
338#define GLFW_HAT_RIGHT_DOWN (GLFW_HAT_RIGHT | GLFW_HAT_DOWN)
339#define GLFW_HAT_LEFT_UP (GLFW_HAT_LEFT | GLFW_HAT_UP)
340#define GLFW_HAT_LEFT_DOWN (GLFW_HAT_LEFT | GLFW_HAT_DOWN)
341/*! @} */
342
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200343/*! @defgroup keys Keyboard keys
Camilla Löwy21eabd32017-02-06 17:31:25 +0100344 * @brief Keyboard key IDs.
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200345 *
Camilla Berglund4188c262015-01-18 01:55:25 +0100346 * See [key input](@ref input_key) for how these are used.
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200347 *
Camilla Berglund4188c262015-01-18 01:55:25 +0100348 * These key codes are inspired by the _USB HID Usage Tables v1.12_ (p. 53-60),
349 * but re-arranged to map to 7-bit ASCII for printable keys (function keys are
350 * put in the 256+ range).
351 *
352 * The naming of the key codes follow these rules:
353 * - The US keyboard layout is used
354 * - Names of printable alpha-numeric characters are used (e.g. "A", "R",
355 * "3", etc.)
356 * - For non-alphanumeric characters, Unicode:ish names are used (e.g.
357 * "COMMA", "LEFT_SQUARE_BRACKET", etc.). Note that some names do not
358 * correspond to the Unicode standard (usually for brevity)
359 * - Keys that lack a clear US mapping are named "WORLD_x"
360 * - For non-printable keys, custom names are used (e.g. "F4",
361 * "BACKSPACE", etc.)
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200362 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100363 * @ingroup input
364 * @{
365 */
366
Camilla Berglund11615fc2013-05-30 17:19:12 +0200367/* The unknown key */
368#define GLFW_KEY_UNKNOWN -1
369
Marcusc0cb4c22011-01-02 11:18:14 +0100370/* Printable keys */
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100371#define GLFW_KEY_SPACE 32
372#define GLFW_KEY_APOSTROPHE 39 /* ' */
373#define GLFW_KEY_COMMA 44 /* , */
374#define GLFW_KEY_MINUS 45 /* - */
375#define GLFW_KEY_PERIOD 46 /* . */
376#define GLFW_KEY_SLASH 47 /* / */
377#define GLFW_KEY_0 48
378#define GLFW_KEY_1 49
379#define GLFW_KEY_2 50
380#define GLFW_KEY_3 51
381#define GLFW_KEY_4 52
382#define GLFW_KEY_5 53
383#define GLFW_KEY_6 54
384#define GLFW_KEY_7 55
385#define GLFW_KEY_8 56
386#define GLFW_KEY_9 57
387#define GLFW_KEY_SEMICOLON 59 /* ; */
388#define GLFW_KEY_EQUAL 61 /* = */
389#define GLFW_KEY_A 65
390#define GLFW_KEY_B 66
391#define GLFW_KEY_C 67
392#define GLFW_KEY_D 68
393#define GLFW_KEY_E 69
394#define GLFW_KEY_F 70
395#define GLFW_KEY_G 71
396#define GLFW_KEY_H 72
397#define GLFW_KEY_I 73
398#define GLFW_KEY_J 74
399#define GLFW_KEY_K 75
400#define GLFW_KEY_L 76
401#define GLFW_KEY_M 77
402#define GLFW_KEY_N 78
403#define GLFW_KEY_O 79
404#define GLFW_KEY_P 80
405#define GLFW_KEY_Q 81
406#define GLFW_KEY_R 82
407#define GLFW_KEY_S 83
408#define GLFW_KEY_T 84
409#define GLFW_KEY_U 85
410#define GLFW_KEY_V 86
411#define GLFW_KEY_W 87
412#define GLFW_KEY_X 88
413#define GLFW_KEY_Y 89
414#define GLFW_KEY_Z 90
415#define GLFW_KEY_LEFT_BRACKET 91 /* [ */
416#define GLFW_KEY_BACKSLASH 92 /* \ */
417#define GLFW_KEY_RIGHT_BRACKET 93 /* ] */
418#define GLFW_KEY_GRAVE_ACCENT 96 /* ` */
419#define GLFW_KEY_WORLD_1 161 /* non-US #1 */
420#define GLFW_KEY_WORLD_2 162 /* non-US #2 */
Marcusc0cb4c22011-01-02 11:18:14 +0100421
422/* Function keys */
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100423#define GLFW_KEY_ESCAPE 256
424#define GLFW_KEY_ENTER 257
425#define GLFW_KEY_TAB 258
426#define GLFW_KEY_BACKSPACE 259
427#define GLFW_KEY_INSERT 260
428#define GLFW_KEY_DELETE 261
429#define GLFW_KEY_RIGHT 262
430#define GLFW_KEY_LEFT 263
431#define GLFW_KEY_DOWN 264
432#define GLFW_KEY_UP 265
433#define GLFW_KEY_PAGE_UP 266
434#define GLFW_KEY_PAGE_DOWN 267
435#define GLFW_KEY_HOME 268
436#define GLFW_KEY_END 269
437#define GLFW_KEY_CAPS_LOCK 280
438#define GLFW_KEY_SCROLL_LOCK 281
439#define GLFW_KEY_NUM_LOCK 282
440#define GLFW_KEY_PRINT_SCREEN 283
441#define GLFW_KEY_PAUSE 284
442#define GLFW_KEY_F1 290
443#define GLFW_KEY_F2 291
444#define GLFW_KEY_F3 292
445#define GLFW_KEY_F4 293
446#define GLFW_KEY_F5 294
447#define GLFW_KEY_F6 295
448#define GLFW_KEY_F7 296
449#define GLFW_KEY_F8 297
450#define GLFW_KEY_F9 298
451#define GLFW_KEY_F10 299
452#define GLFW_KEY_F11 300
453#define GLFW_KEY_F12 301
454#define GLFW_KEY_F13 302
455#define GLFW_KEY_F14 303
456#define GLFW_KEY_F15 304
457#define GLFW_KEY_F16 305
458#define GLFW_KEY_F17 306
459#define GLFW_KEY_F18 307
460#define GLFW_KEY_F19 308
461#define GLFW_KEY_F20 309
462#define GLFW_KEY_F21 310
463#define GLFW_KEY_F22 311
464#define GLFW_KEY_F23 312
465#define GLFW_KEY_F24 313
466#define GLFW_KEY_F25 314
467#define GLFW_KEY_KP_0 320
468#define GLFW_KEY_KP_1 321
469#define GLFW_KEY_KP_2 322
470#define GLFW_KEY_KP_3 323
471#define GLFW_KEY_KP_4 324
472#define GLFW_KEY_KP_5 325
473#define GLFW_KEY_KP_6 326
474#define GLFW_KEY_KP_7 327
475#define GLFW_KEY_KP_8 328
476#define GLFW_KEY_KP_9 329
477#define GLFW_KEY_KP_DECIMAL 330
478#define GLFW_KEY_KP_DIVIDE 331
479#define GLFW_KEY_KP_MULTIPLY 332
480#define GLFW_KEY_KP_SUBTRACT 333
481#define GLFW_KEY_KP_ADD 334
482#define GLFW_KEY_KP_ENTER 335
483#define GLFW_KEY_KP_EQUAL 336
484#define GLFW_KEY_LEFT_SHIFT 340
485#define GLFW_KEY_LEFT_CONTROL 341
486#define GLFW_KEY_LEFT_ALT 342
487#define GLFW_KEY_LEFT_SUPER 343
488#define GLFW_KEY_RIGHT_SHIFT 344
489#define GLFW_KEY_RIGHT_CONTROL 345
490#define GLFW_KEY_RIGHT_ALT 346
491#define GLFW_KEY_RIGHT_SUPER 347
492#define GLFW_KEY_MENU 348
Camilla Berglund9c315412015-07-02 14:24:50 +0200493
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100494#define GLFW_KEY_LAST GLFW_KEY_MENU
Marcusc0cb4c22011-01-02 11:18:14 +0100495
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100496/*! @} */
497
Camilla Berglund98cbf6f2013-05-23 14:42:33 +0200498/*! @defgroup mods Modifier key flags
Camilla Löwy21eabd32017-02-06 17:31:25 +0100499 * @brief Modifier key flags.
Camilla Berglund4188c262015-01-18 01:55:25 +0100500 *
501 * See [key input](@ref input_key) for how these are used.
502 *
Camilla Berglund98cbf6f2013-05-23 14:42:33 +0200503 * @ingroup input
Camilla Berglund2d1b8352012-12-09 19:19:00 +0100504 * @{ */
505
Camilla Berglund98cbf6f2013-05-23 14:42:33 +0200506/*! @brief If this bit is set one or more Shift keys were held down.
Camilla Berglund2d1b8352012-12-09 19:19:00 +0100507 */
508#define GLFW_MOD_SHIFT 0x0001
Camilla Berglund98cbf6f2013-05-23 14:42:33 +0200509/*! @brief If this bit is set one or more Control keys were held down.
Camilla Berglund2d1b8352012-12-09 19:19:00 +0100510 */
Camilla Berglund3bcffba2013-05-23 14:11:05 +0200511#define GLFW_MOD_CONTROL 0x0002
Camilla Berglund98cbf6f2013-05-23 14:42:33 +0200512/*! @brief If this bit is set one or more Alt keys were held down.
Camilla Berglund2d1b8352012-12-09 19:19:00 +0100513 */
514#define GLFW_MOD_ALT 0x0004
Camilla Berglund98cbf6f2013-05-23 14:42:33 +0200515/*! @brief If this bit is set one or more Super keys were held down.
Noel Cowereff85f92013-05-23 13:22:27 +0200516 */
517#define GLFW_MOD_SUPER 0x0008
Camilla Berglund2d1b8352012-12-09 19:19:00 +0100518
519/*! @} */
520
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100521/*! @defgroup buttons Mouse buttons
Camilla Löwy21eabd32017-02-06 17:31:25 +0100522 * @brief Mouse button IDs.
Camilla Berglund4188c262015-01-18 01:55:25 +0100523 *
524 * See [mouse button input](@ref input_mouse_button) for how these are used.
525 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100526 * @ingroup input
527 * @{ */
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100528#define GLFW_MOUSE_BUTTON_1 0
529#define GLFW_MOUSE_BUTTON_2 1
530#define GLFW_MOUSE_BUTTON_3 2
531#define GLFW_MOUSE_BUTTON_4 3
532#define GLFW_MOUSE_BUTTON_5 4
533#define GLFW_MOUSE_BUTTON_6 5
534#define GLFW_MOUSE_BUTTON_7 6
535#define GLFW_MOUSE_BUTTON_8 7
536#define GLFW_MOUSE_BUTTON_LAST GLFW_MOUSE_BUTTON_8
537#define GLFW_MOUSE_BUTTON_LEFT GLFW_MOUSE_BUTTON_1
538#define GLFW_MOUSE_BUTTON_RIGHT GLFW_MOUSE_BUTTON_2
539#define GLFW_MOUSE_BUTTON_MIDDLE GLFW_MOUSE_BUTTON_3
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100540/*! @} */
Camilla Berglund3249f812010-09-07 17:34:51 +0200541
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100542/*! @defgroup joysticks Joysticks
Camilla Löwy21eabd32017-02-06 17:31:25 +0100543 * @brief Joystick IDs.
Camilla Berglund4188c262015-01-18 01:55:25 +0100544 *
545 * See [joystick input](@ref joystick) for how these are used.
546 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100547 * @ingroup input
548 * @{ */
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100549#define GLFW_JOYSTICK_1 0
550#define GLFW_JOYSTICK_2 1
551#define GLFW_JOYSTICK_3 2
552#define GLFW_JOYSTICK_4 3
553#define GLFW_JOYSTICK_5 4
554#define GLFW_JOYSTICK_6 5
555#define GLFW_JOYSTICK_7 6
556#define GLFW_JOYSTICK_8 7
557#define GLFW_JOYSTICK_9 8
558#define GLFW_JOYSTICK_10 9
559#define GLFW_JOYSTICK_11 10
560#define GLFW_JOYSTICK_12 11
561#define GLFW_JOYSTICK_13 12
562#define GLFW_JOYSTICK_14 13
563#define GLFW_JOYSTICK_15 14
564#define GLFW_JOYSTICK_16 15
565#define GLFW_JOYSTICK_LAST GLFW_JOYSTICK_16
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100566/*! @} */
Camilla Berglund3249f812010-09-07 17:34:51 +0200567
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100568/*! @defgroup errors Error codes
Camilla Löwy21eabd32017-02-06 17:31:25 +0100569 * @brief Error codes.
Camilla Berglund4188c262015-01-18 01:55:25 +0100570 *
571 * See [error handling](@ref error_handling) for how these are used.
572 *
Camilla Berglund4591ad22014-09-18 15:03:29 +0200573 * @ingroup init
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100574 * @{ */
Camilla Löwy63506412017-05-01 19:20:57 +0200575/*! @brief No error has occurred.
576 *
577 * No error has occurred.
578 *
579 * @analysis Yay.
580 */
581#define GLFW_NO_ERROR 0
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100582/*! @brief GLFW has not been initialized.
Camilla Berglund4591ad22014-09-18 15:03:29 +0200583 *
Camilla Berglund0df4e062015-12-13 14:07:27 +0100584 * This occurs if a GLFW function was called that must not be called unless the
Camilla Berglund4591ad22014-09-18 15:03:29 +0200585 * library is [initialized](@ref intro_init).
586 *
Camilla Berglund951a9582016-01-31 21:32:14 +0100587 * @analysis Application programmer error. Initialize GLFW before calling any
588 * function that requires initialization.
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100589 */
Camilla Berglund393e4392013-05-27 22:16:59 +0200590#define GLFW_NOT_INITIALIZED 0x00010001
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100591/*! @brief No context is current for this thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +0200592 *
593 * This occurs if a GLFW function was called that needs and operates on the
594 * current OpenGL or OpenGL ES context but no context is current on the calling
595 * thread. One such function is @ref glfwSwapInterval.
596 *
Camilla Berglund951a9582016-01-31 21:32:14 +0100597 * @analysis Application programmer error. Ensure a context is current before
598 * calling functions that require a current context.
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100599 */
Camilla Berglund393e4392013-05-27 22:16:59 +0200600#define GLFW_NO_CURRENT_CONTEXT 0x00010002
Camilla Berglund4591ad22014-09-18 15:03:29 +0200601/*! @brief One of the arguments to the function was an invalid enum value.
602 *
603 * One of the arguments to the function was an invalid enum value, for example
Camilla Löwyce161c22016-12-06 01:14:23 +0100604 * requesting @ref GLFW_RED_BITS with @ref glfwGetWindowAttrib.
Camilla Berglund4591ad22014-09-18 15:03:29 +0200605 *
Camilla Berglund951a9582016-01-31 21:32:14 +0100606 * @analysis Application programmer error. Fix the offending call.
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100607 */
Camilla Berglund393e4392013-05-27 22:16:59 +0200608#define GLFW_INVALID_ENUM 0x00010003
Camilla Berglund4591ad22014-09-18 15:03:29 +0200609/*! @brief One of the arguments to the function was an invalid value.
610 *
611 * One of the arguments to the function was an invalid value, for example
612 * requesting a non-existent OpenGL or OpenGL ES version like 2.7.
613 *
614 * Requesting a valid but unavailable OpenGL or OpenGL ES version will instead
615 * result in a @ref GLFW_VERSION_UNAVAILABLE error.
616 *
Camilla Berglund951a9582016-01-31 21:32:14 +0100617 * @analysis Application programmer error. Fix the offending call.
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100618 */
Camilla Berglund393e4392013-05-27 22:16:59 +0200619#define GLFW_INVALID_VALUE 0x00010004
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100620/*! @brief A memory allocation failed.
Camilla Berglund4591ad22014-09-18 15:03:29 +0200621 *
622 * A memory allocation failed.
623 *
Camilla Berglund951a9582016-01-31 21:32:14 +0100624 * @analysis A bug in GLFW or the underlying operating system. Report the bug
625 * to our [issue tracker](https://github.com/glfw/glfw/issues).
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100626 */
Camilla Berglund393e4392013-05-27 22:16:59 +0200627#define GLFW_OUT_OF_MEMORY 0x00010005
Camilla Berglund9b75bff2015-08-10 20:19:04 +0200628/*! @brief GLFW could not find support for the requested API on the system.
Camilla Berglund2d13eb02014-10-13 16:00:11 +0200629 *
Camilla Berglund9b75bff2015-08-10 20:19:04 +0200630 * GLFW could not find support for the requested API on the system.
Camilla Berglund2d13eb02014-10-13 16:00:11 +0200631 *
Camilla Berglund951a9582016-01-31 21:32:14 +0100632 * @analysis The installed graphics driver does not support the requested
Camilla Berglund9b75bff2015-08-10 20:19:04 +0200633 * API, or does not support it via the chosen context creation backend.
Camilla Berglund951a9582016-01-31 21:32:14 +0100634 * Below are a few examples.
Camilla Berglund2d13eb02014-10-13 16:00:11 +0200635 *
636 * @par
637 * Some pre-installed Windows graphics drivers do not support OpenGL. AMD only
Camilla Berglundd95b79f2015-03-30 23:20:49 +0200638 * supports OpenGL ES via EGL, while Nvidia and Intel only support it via
Camilla Berglund8d6f2652016-10-20 00:50:54 +0200639 * a WGL or GLX extension. macOS does not provide OpenGL ES at all. The Mesa
Camilla Berglund138feb82015-01-05 16:46:04 +0100640 * EGL, OpenGL and OpenGL ES libraries do not interface with the Nvidia binary
Camilla Berglund9b75bff2015-08-10 20:19:04 +0200641 * driver. Older graphics drivers do not support Vulkan.
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100642 */
Camilla Berglund393e4392013-05-27 22:16:59 +0200643#define GLFW_API_UNAVAILABLE 0x00010006
Camilla Berglund4591ad22014-09-18 15:03:29 +0200644/*! @brief The requested OpenGL or OpenGL ES version is not available.
645 *
Camilla Berglundd493a822015-03-10 19:51:14 +0100646 * The requested OpenGL or OpenGL ES version (including any requested context
647 * or framebuffer hints) is not available on this machine.
Camilla Berglund4591ad22014-09-18 15:03:29 +0200648 *
Camilla Berglund951a9582016-01-31 21:32:14 +0100649 * @analysis The machine does not support your requirements. If your
650 * application is sufficiently flexible, downgrade your requirements and try
651 * again. Otherwise, inform the user that their machine does not match your
Camilla Berglund4591ad22014-09-18 15:03:29 +0200652 * requirements.
653 *
Camilla Berglund2d13eb02014-10-13 16:00:11 +0200654 * @par
655 * Future invalid OpenGL and OpenGL ES versions, for example OpenGL 4.8 if 5.0
656 * comes out before the 4.x series gets that far, also fail with this error and
657 * not @ref GLFW_INVALID_VALUE, because GLFW cannot know what future versions
658 * will exist.
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100659 */
Camilla Berglund393e4392013-05-27 22:16:59 +0200660#define GLFW_VERSION_UNAVAILABLE 0x00010007
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100661/*! @brief A platform-specific error occurred that does not match any of the
662 * more specific categories.
Camilla Berglund4591ad22014-09-18 15:03:29 +0200663 *
664 * A platform-specific error occurred that does not match any of the more
665 * specific categories.
666 *
Camilla Berglund951a9582016-01-31 21:32:14 +0100667 * @analysis A bug or configuration error in GLFW, the underlying operating
668 * system or its drivers, or a lack of required resources. Report the issue to
669 * our [issue tracker](https://github.com/glfw/glfw/issues).
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100670 */
Camilla Berglund393e4392013-05-27 22:16:59 +0200671#define GLFW_PLATFORM_ERROR 0x00010008
Camilla Berglund2d13eb02014-10-13 16:00:11 +0200672/*! @brief The requested format is not supported or available.
673 *
674 * If emitted during window creation, the requested pixel format is not
675 * supported.
676 *
677 * If emitted when querying the clipboard, the contents of the clipboard could
678 * not be converted to the requested format.
679 *
Camilla Berglund951a9582016-01-31 21:32:14 +0100680 * @analysis If emitted during window creation, one or more
Camilla Berglund2d13eb02014-10-13 16:00:11 +0200681 * [hard constraints](@ref window_hints_hard) did not match any of the
682 * available pixel formats. If your application is sufficiently flexible,
683 * downgrade your requirements and try again. Otherwise, inform the user that
684 * their machine does not match your requirements.
685 *
686 * @par
687 * If emitted when querying the clipboard, ignore the error or report it to
688 * the user, as appropriate.
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100689 */
Camilla Berglund393e4392013-05-27 22:16:59 +0200690#define GLFW_FORMAT_UNAVAILABLE 0x00010009
Camilla Berglund496f5592015-06-18 14:03:02 +0200691/*! @brief The specified window does not have an OpenGL or OpenGL ES context.
692 *
693 * A window that does not have an OpenGL or OpenGL ES context was passed to
694 * a function that requires it to have one.
695 *
Camilla Berglund951a9582016-01-31 21:32:14 +0100696 * @analysis Application programmer error. Fix the offending call.
Camilla Berglund496f5592015-06-18 14:03:02 +0200697 */
698#define GLFW_NO_WINDOW_CONTEXT 0x0001000A
Camilla Berglundbce2cd62012-11-22 16:38:24 +0100699/*! @} */
Camilla Berglund3249f812010-09-07 17:34:51 +0200700
Camilla Löwyce161c22016-12-06 01:14:23 +0100701/*! @addtogroup window
702 * @{ */
703/*! @brief Input focus window hint and attribute
704 *
705 * Input focus [window hint](@ref GLFW_FOCUSED_hint) or
706 * [window attribute](@ref GLFW_FOCUSED_attrib).
707 */
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100708#define GLFW_FOCUSED 0x00020001
Camilla Löwyce161c22016-12-06 01:14:23 +0100709/*! @brief Window iconification window attribute
710 *
711 * Window iconification [window attribute](@ref GLFW_ICONIFIED_attrib).
712 */
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100713#define GLFW_ICONIFIED 0x00020002
Camilla Löwyce161c22016-12-06 01:14:23 +0100714/*! @brief Window resize-ability window hint and attribute
715 *
Camilla Löwy831426c2016-12-08 17:08:36 +0100716 * Window resize-ability [window hint](@ref GLFW_RESIZABLE_hint) and
Camilla Löwyce161c22016-12-06 01:14:23 +0100717 * [window attribute](@ref GLFW_RESIZABLE_attrib).
718 */
Camilla Berglund393e4392013-05-27 22:16:59 +0200719#define GLFW_RESIZABLE 0x00020003
Camilla Löwyce161c22016-12-06 01:14:23 +0100720/*! @brief Window visibility window hint and attribute
721 *
Camilla Löwy831426c2016-12-08 17:08:36 +0100722 * Window visibility [window hint](@ref GLFW_VISIBLE_hint) and
Camilla Löwyce161c22016-12-06 01:14:23 +0100723 * [window attribute](@ref GLFW_VISIBLE_attrib).
724 */
Camilla Berglund393e4392013-05-27 22:16:59 +0200725#define GLFW_VISIBLE 0x00020004
Camilla Löwyce161c22016-12-06 01:14:23 +0100726/*! @brief Window decoration window hint and attribute
727 *
Camilla Löwy831426c2016-12-08 17:08:36 +0100728 * Window decoration [window hint](@ref GLFW_DECORATED_hint) and
Camilla Löwyce161c22016-12-06 01:14:23 +0100729 * [window attribute](@ref GLFW_DECORATED_attrib).
730 */
Camilla Berglund393e4392013-05-27 22:16:59 +0200731#define GLFW_DECORATED 0x00020005
Camilla Löwy9e560992016-09-30 01:52:22 +0200732/*! @brief Window auto-iconification window hint and attribute
Camilla Löwyce161c22016-12-06 01:14:23 +0100733 *
Camilla Löwy831426c2016-12-08 17:08:36 +0100734 * Window auto-iconification [window hint](@ref GLFW_AUTO_ICONIFY_hint) and
Camilla Löwy9e560992016-09-30 01:52:22 +0200735 * [window attribute](@ref GLFW_AUTO_ICONIFY_attrib).
Camilla Löwyce161c22016-12-06 01:14:23 +0100736 */
Camilla Berglund25e7ff12014-04-08 15:32:34 +0200737#define GLFW_AUTO_ICONIFY 0x00020006
Camilla Löwyce161c22016-12-06 01:14:23 +0100738/*! @brief Window decoration window hint and attribute
739 *
Camilla Löwy831426c2016-12-08 17:08:36 +0100740 * Window decoration [window hint](@ref GLFW_FLOATING_hint) and
Camilla Löwyce161c22016-12-06 01:14:23 +0100741 * [window attribute](@ref GLFW_FLOATING_attrib).
742 */
Camilla Berglund3ce7bfe2014-05-23 14:01:02 +0200743#define GLFW_FLOATING 0x00020007
Camilla Löwyce161c22016-12-06 01:14:23 +0100744/*! @brief Window maximization window hint and attribute
745 *
Camilla Löwy831426c2016-12-08 17:08:36 +0100746 * Window maximization [window hint](@ref GLFW_MAXIMIZED_hint) and
Camilla Löwyce161c22016-12-06 01:14:23 +0100747 * [window attribute](@ref GLFW_MAXIMIZED_attrib).
748 */
Camilla Berglunda10caa42015-10-13 12:50:59 +0200749#define GLFW_MAXIMIZED 0x00020008
Camilla Löwy5a74b502017-02-06 15:03:50 +0100750/*! @brief Cursor centering window hint
751 *
752 * Cursor centering [window hint](@ref GLFW_CENTER_CURSOR_hint).
753 */
Liam Middlebrook72ac5ba2016-08-18 11:47:54 -0400754#define GLFW_CENTER_CURSOR 0x00020009
Camilla Berglund2c091572010-09-09 21:09:11 +0200755
Camilla Löwyce161c22016-12-06 01:14:23 +0100756/*! @brief Framebuffer bit depth hint.
757 *
758 * Framebuffer bit depth [hint](@ref GLFW_RED_BITS).
759 */
Camilla Berglund53b39a62013-05-30 18:55:45 +0200760#define GLFW_RED_BITS 0x00021001
Camilla Löwyce161c22016-12-06 01:14:23 +0100761/*! @brief Framebuffer bit depth hint.
762 *
763 * Framebuffer bit depth [hint](@ref GLFW_GREEN_BITS).
764 */
Camilla Berglund53b39a62013-05-30 18:55:45 +0200765#define GLFW_GREEN_BITS 0x00021002
Camilla Löwyce161c22016-12-06 01:14:23 +0100766/*! @brief Framebuffer bit depth hint.
767 *
768 * Framebuffer bit depth [hint](@ref GLFW_BLUE_BITS).
769 */
Camilla Berglund53b39a62013-05-30 18:55:45 +0200770#define GLFW_BLUE_BITS 0x00021003
Camilla Löwyce161c22016-12-06 01:14:23 +0100771/*! @brief Framebuffer bit depth hint.
772 *
773 * Framebuffer bit depth [hint](@ref GLFW_ALPHA_BITS).
774 */
Camilla Berglund53b39a62013-05-30 18:55:45 +0200775#define GLFW_ALPHA_BITS 0x00021004
Camilla Löwyce161c22016-12-06 01:14:23 +0100776/*! @brief Framebuffer bit depth hint.
777 *
778 * Framebuffer bit depth [hint](@ref GLFW_DEPTH_BITS).
779 */
Camilla Berglund53b39a62013-05-30 18:55:45 +0200780#define GLFW_DEPTH_BITS 0x00021005
Camilla Löwyce161c22016-12-06 01:14:23 +0100781/*! @brief Framebuffer bit depth hint.
782 *
783 * Framebuffer bit depth [hint](@ref GLFW_STENCIL_BITS).
784 */
Camilla Berglund53b39a62013-05-30 18:55:45 +0200785#define GLFW_STENCIL_BITS 0x00021006
Camilla Löwyce161c22016-12-06 01:14:23 +0100786/*! @brief Framebuffer bit depth hint.
787 *
788 * Framebuffer bit depth [hint](@ref GLFW_ACCUM_RED_BITS).
789 */
Camilla Berglund53b39a62013-05-30 18:55:45 +0200790#define GLFW_ACCUM_RED_BITS 0x00021007
Camilla Löwyce161c22016-12-06 01:14:23 +0100791/*! @brief Framebuffer bit depth hint.
792 *
793 * Framebuffer bit depth [hint](@ref GLFW_ACCUM_GREEN_BITS).
794 */
Camilla Berglund53b39a62013-05-30 18:55:45 +0200795#define GLFW_ACCUM_GREEN_BITS 0x00021008
Camilla Löwyce161c22016-12-06 01:14:23 +0100796/*! @brief Framebuffer bit depth hint.
797 *
798 * Framebuffer bit depth [hint](@ref GLFW_ACCUM_BLUE_BITS).
799 */
Camilla Berglund53b39a62013-05-30 18:55:45 +0200800#define GLFW_ACCUM_BLUE_BITS 0x00021009
Camilla Löwyce161c22016-12-06 01:14:23 +0100801/*! @brief Framebuffer bit depth hint.
802 *
803 * Framebuffer bit depth [hint](@ref GLFW_ACCUM_ALPHA_BITS).
804 */
Camilla Berglund53b39a62013-05-30 18:55:45 +0200805#define GLFW_ACCUM_ALPHA_BITS 0x0002100A
Camilla Löwyce161c22016-12-06 01:14:23 +0100806/*! @brief Framebuffer auxiliary buffer hint.
807 *
808 * Framebuffer auxiliary buffer [hint](@ref GLFW_AUX_BUFFERS).
809 */
Camilla Berglund53b39a62013-05-30 18:55:45 +0200810#define GLFW_AUX_BUFFERS 0x0002100B
Camilla Löwyce161c22016-12-06 01:14:23 +0100811/*! @brief OpenGL stereoscopic rendering hint.
812 *
813 * OpenGL stereoscopic rendering [hint](@ref GLFW_STEREO).
814 */
Camilla Berglund53b39a62013-05-30 18:55:45 +0200815#define GLFW_STEREO 0x0002100C
Camilla Löwyce161c22016-12-06 01:14:23 +0100816/*! @brief Framebuffer MSAA samples hint.
817 *
818 * Framebuffer MSAA samples [hint](@ref GLFW_SAMPLES).
819 */
Camilla Berglund53b39a62013-05-30 18:55:45 +0200820#define GLFW_SAMPLES 0x0002100D
Camilla Löwyce161c22016-12-06 01:14:23 +0100821/*! @brief Framebuffer sRGB hint.
822 *
823 * Framebuffer sRGB [hint](@ref GLFW_SRGB_CAPABLE).
824 */
Camilla Berglund53b39a62013-05-30 18:55:45 +0200825#define GLFW_SRGB_CAPABLE 0x0002100E
Camilla Löwyce161c22016-12-06 01:14:23 +0100826/*! @brief Monitor refresh rate hint.
827 *
828 * Monitor refresh rate [hint](@ref GLFW_REFRESH_RATE).
829 */
Camilla Berglund2cd34382013-05-30 20:42:50 +0200830#define GLFW_REFRESH_RATE 0x0002100F
Camilla Löwyce161c22016-12-06 01:14:23 +0100831/*! @brief Framebuffer double buffering hint.
832 *
833 * Framebuffer double buffering [hint](@ref GLFW_DOUBLEBUFFER).
834 */
Camilla Berglundc9808582014-04-24 19:21:10 +0200835#define GLFW_DOUBLEBUFFER 0x00021010
Camilla Löwy831426c2016-12-08 17:08:36 +0100836/*! @brief Context client API hint and attribute.
837 *
838 * Context client API [hint](@ref GLFW_CLIENT_API_hint) and
839 * [attribute](@ref GLFW_CLIENT_API_attrib).
840 */
Camilla Berglund53b39a62013-05-30 18:55:45 +0200841#define GLFW_CLIENT_API 0x00022001
Camilla Löwy831426c2016-12-08 17:08:36 +0100842/*! @brief Context client API major version hint and attribute.
843 *
844 * Context client API major version [hint](@ref GLFW_CLIENT_API_hint) and
845 * [attribute](@ref GLFW_CLIENT_API_attrib).
846 */
Camilla Berglund53b39a62013-05-30 18:55:45 +0200847#define GLFW_CONTEXT_VERSION_MAJOR 0x00022002
Camilla Löwy831426c2016-12-08 17:08:36 +0100848/*! @brief Context client API minor version hint and attribute.
849 *
850 * Context client API minor version [hint](@ref GLFW_CLIENT_API_hint) and
851 * [attribute](@ref GLFW_CLIENT_API_attrib).
852 */
Camilla Berglund53b39a62013-05-30 18:55:45 +0200853#define GLFW_CONTEXT_VERSION_MINOR 0x00022003
Camilla Löwy831426c2016-12-08 17:08:36 +0100854/*! @brief Context client API revision number hint and attribute.
855 *
856 * Context client API revision number [hint](@ref GLFW_CLIENT_API_hint) and
857 * [attribute](@ref GLFW_CLIENT_API_attrib).
858 */
Camilla Berglund53b39a62013-05-30 18:55:45 +0200859#define GLFW_CONTEXT_REVISION 0x00022004
Camilla Löwy831426c2016-12-08 17:08:36 +0100860/*! @brief Context robustness hint and attribute.
861 *
862 * Context client API revision number [hint](@ref GLFW_CLIENT_API_hint) and
863 * [attribute](@ref GLFW_CLIENT_API_attrib).
864 */
Camilla Berglund53b39a62013-05-30 18:55:45 +0200865#define GLFW_CONTEXT_ROBUSTNESS 0x00022005
Camilla Löwy831426c2016-12-08 17:08:36 +0100866/*! @brief OpenGL forward-compatibility hint and attribute.
867 *
868 * OpenGL forward-compatibility [hint](@ref GLFW_CLIENT_API_hint) and
869 * [attribute](@ref GLFW_CLIENT_API_attrib).
870 */
Camilla Berglund53b39a62013-05-30 18:55:45 +0200871#define GLFW_OPENGL_FORWARD_COMPAT 0x00022006
Camilla Löwy831426c2016-12-08 17:08:36 +0100872/*! @brief OpenGL debug context hint and attribute.
873 *
874 * OpenGL debug context [hint](@ref GLFW_CLIENT_API_hint) and
875 * [attribute](@ref GLFW_CLIENT_API_attrib).
876 */
Camilla Berglund53b39a62013-05-30 18:55:45 +0200877#define GLFW_OPENGL_DEBUG_CONTEXT 0x00022007
Camilla Löwy831426c2016-12-08 17:08:36 +0100878/*! @brief OpenGL profile hint and attribute.
879 *
880 * OpenGL profile [hint](@ref GLFW_CLIENT_API_hint) and
881 * [attribute](@ref GLFW_CLIENT_API_attrib).
882 */
Camilla Berglund53b39a62013-05-30 18:55:45 +0200883#define GLFW_OPENGL_PROFILE 0x00022008
Camilla Löwy831426c2016-12-08 17:08:36 +0100884/*! @brief Context flush-on-release hint and attribute.
885 *
886 * Context flush-on-release [hint](@ref GLFW_CLIENT_API_hint) and
887 * [attribute](@ref GLFW_CLIENT_API_attrib).
888 */
Camilla Berglund44c899c2014-08-21 19:21:45 +0200889#define GLFW_CONTEXT_RELEASE_BEHAVIOR 0x00022009
Camilla Löwy831426c2016-12-08 17:08:36 +0100890/*! @brief Context error suppression hint and attribute.
891 *
892 * Context error suppression [hint](@ref GLFW_CLIENT_API_hint) and
893 * [attribute](@ref GLFW_CLIENT_API_attrib).
894 */
Camilla Berglund7be82092015-08-10 12:46:14 +0200895#define GLFW_CONTEXT_NO_ERROR 0x0002200A
Camilla Löwy831426c2016-12-08 17:08:36 +0100896/*! @brief Context creation API hint and attribute.
897 *
898 * Context creation API [hint](@ref GLFW_CLIENT_API_hint) and
899 * [attribute](@ref GLFW_CLIENT_API_attrib).
900 */
Camilla Berglundef80bea2016-03-28 13:19:31 +0200901#define GLFW_CONTEXT_CREATION_API 0x0002200B
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100902
Camilla Löwy58ceab52016-12-07 00:41:54 +0100903#define GLFW_COCOA_RETINA_FRAMEBUFFER 0x00023001
Camilla Löwy46613152017-01-01 19:41:50 +0100904#define GLFW_COCOA_FRAME_AUTOSAVE 0x00023002
Camilla Löwy77a8f102017-01-27 12:02:09 +0100905#define GLFW_COCOA_GRAPHICS_SWITCHING 0x00023003
Camilla Löwy831426c2016-12-08 17:08:36 +0100906/*! @} */
Camilla Löwy58ceab52016-12-07 00:41:54 +0100907
Camilla Berglund496f5592015-06-18 14:03:02 +0200908#define GLFW_NO_API 0
Camilla Berglund393e4392013-05-27 22:16:59 +0200909#define GLFW_OPENGL_API 0x00030001
910#define GLFW_OPENGL_ES_API 0x00030002
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100911
Camilla Berglund393e4392013-05-27 22:16:59 +0200912#define GLFW_NO_ROBUSTNESS 0
913#define GLFW_NO_RESET_NOTIFICATION 0x00031001
914#define GLFW_LOSE_CONTEXT_ON_RESET 0x00031002
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100915
Camilla Berglund44e84012013-06-05 16:13:30 +0200916#define GLFW_OPENGL_ANY_PROFILE 0
Camilla Berglund393e4392013-05-27 22:16:59 +0200917#define GLFW_OPENGL_CORE_PROFILE 0x00032001
918#define GLFW_OPENGL_COMPAT_PROFILE 0x00032002
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100919
Camilla Berglund393e4392013-05-27 22:16:59 +0200920#define GLFW_CURSOR 0x00033001
921#define GLFW_STICKY_KEYS 0x00033002
922#define GLFW_STICKY_MOUSE_BUTTONS 0x00033003
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100923
Camilla Berglund393e4392013-05-27 22:16:59 +0200924#define GLFW_CURSOR_NORMAL 0x00034001
925#define GLFW_CURSOR_HIDDEN 0x00034002
926#define GLFW_CURSOR_DISABLED 0x00034003
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100927
Camilla Berglund44c899c2014-08-21 19:21:45 +0200928#define GLFW_ANY_RELEASE_BEHAVIOR 0
929#define GLFW_RELEASE_BEHAVIOR_FLUSH 0x00035001
930#define GLFW_RELEASE_BEHAVIOR_NONE 0x00035002
931
Camilla Berglundef80bea2016-03-28 13:19:31 +0200932#define GLFW_NATIVE_CONTEXT_API 0x00036001
933#define GLFW_EGL_CONTEXT_API 0x00036002
Camilla Löwye9560ef2017-02-28 19:23:25 +0100934#define GLFW_OSMESA_CONTEXT_API 0x00036003
Camilla Berglundef80bea2016-03-28 13:19:31 +0200935
Camilla Berglund2a1375e2014-09-02 16:52:16 +0200936/*! @defgroup shapes Standard cursor shapes
Camilla Löwy21eabd32017-02-06 17:31:25 +0100937 * @brief Standard system cursor shapes.
Camilla Berglund4188c262015-01-18 01:55:25 +0100938 *
939 * See [standard cursor creation](@ref cursor_standard) for how these are used.
940 *
Camilla Berglund2a1375e2014-09-02 16:52:16 +0200941 * @ingroup input
942 * @{ */
943
944/*! @brief The regular arrow cursor shape.
945 *
946 * The regular arrow cursor.
947 */
948#define GLFW_ARROW_CURSOR 0x00036001
949/*! @brief The text input I-beam cursor shape.
950 *
951 * The text input I-beam cursor shape.
952 */
953#define GLFW_IBEAM_CURSOR 0x00036002
954/*! @brief The crosshair shape.
955 *
956 * The crosshair shape.
957 */
958#define GLFW_CROSSHAIR_CURSOR 0x00036003
959/*! @brief The hand shape.
960 *
961 * The hand shape.
962 */
963#define GLFW_HAND_CURSOR 0x00036004
964/*! @brief The horizontal resize arrow shape.
965 *
966 * The horizontal resize arrow shape.
967 */
968#define GLFW_HRESIZE_CURSOR 0x00036005
969/*! @brief The vertical resize arrow shape.
970 *
971 * The vertical resize arrow shape.
972 */
973#define GLFW_VRESIZE_CURSOR 0x00036006
974/*! @} */
975
Camilla Berglund393e4392013-05-27 22:16:59 +0200976#define GLFW_CONNECTED 0x00040001
977#define GLFW_DISCONNECTED 0x00040002
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100978
Camilla Löwy6d9a58b2017-02-14 15:43:31 +0100979/*! @addtogroup init
980 * @{ */
Camilla Löwy798d7c62017-03-01 23:27:20 +0100981#define GLFW_JOYSTICK_HAT_BUTTONS 0x00050001
982
Camilla Löwy6d9a58b2017-02-14 15:43:31 +0100983#define GLFW_COCOA_CHDIR_RESOURCES 0x00051001
984#define GLFW_COCOA_MENUBAR 0x00051002
985/*! @} */
986
Camilla Berglund28101302014-04-08 18:57:43 +0200987#define GLFW_DONT_CARE -1
988
Camilla Berglund97387282011-10-06 23:28:56 +0200989
Camilla Berglund3249f812010-09-07 17:34:51 +0200990/*************************************************************************
Camilla Berglund2fca5c52013-01-17 21:51:39 +0100991 * GLFW API types
Camilla Berglund3249f812010-09-07 17:34:51 +0200992 *************************************************************************/
993
Camilla Berglund3f5843f2012-12-13 02:22:39 +0100994/*! @brief Client API function pointer type.
Camilla Berglund8282a8f2013-04-10 23:01:12 +0200995 *
996 * Generic function pointer used for returning client API function pointers
997 * without forcing a cast from a regular pointer.
998 *
Camilla Berglundbce20c32015-11-05 13:58:52 +0100999 * @sa @ref context_glext
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001000 * @sa @ref glfwGetProcAddress
Camilla Berglundbce20c32015-11-05 13:58:52 +01001001 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001002 * @since Added in version 3.0.
1003
Camilla Berglund3f5843f2012-12-13 02:22:39 +01001004 * @ingroup context
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001005 */
Camilla Berglundbf42c3c2012-06-05 00:16:40 +02001006typedef void (*GLFWglproc)(void);
1007
Camilla Berglund9b75bff2015-08-10 20:19:04 +02001008/*! @brief Vulkan API function pointer type.
1009 *
1010 * Generic function pointer used for returning Vulkan API function pointers
1011 * without forcing a cast from a regular pointer.
1012 *
1013 * @sa @ref vulkan_proc
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001014 * @sa @ref glfwGetInstanceProcAddress
Camilla Berglund9b75bff2015-08-10 20:19:04 +02001015 *
1016 * @since Added in version 3.2.
1017 *
1018 * @ingroup vulkan
1019 */
1020typedef void (*GLFWvkproc)(void);
1021
Camilla Berglunddba2d802013-01-17 23:06:56 +01001022/*! @brief Opaque monitor object.
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001023 *
1024 * Opaque monitor object.
1025 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +01001026 * @see @ref monitor_object
1027 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001028 * @since Added in version 3.0.
Camilla Berglund810bab72015-12-13 17:38:14 +01001029 *
Camilla Berglund41bc0d12012-11-27 16:55:04 +01001030 * @ingroup monitor
1031 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001032typedef struct GLFWmonitor GLFWmonitor;
Camilla Berglunde0ce9202012-08-29 20:39:05 +02001033
Camilla Berglunddba2d802013-01-17 23:06:56 +01001034/*! @brief Opaque window object.
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001035 *
1036 * Opaque window object.
1037 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +01001038 * @see @ref window_object
1039 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001040 * @since Added in version 3.0.
Camilla Berglund810bab72015-12-13 17:38:14 +01001041 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001042 * @ingroup window
1043 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001044typedef struct GLFWwindow GLFWwindow;
Camilla Berglund135194a2010-09-09 18:15:32 +02001045
urraka40c04a72013-12-04 10:19:22 -03001046/*! @brief Opaque cursor object.
1047 *
1048 * Opaque cursor object.
1049 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +01001050 * @see @ref cursor_object
1051 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001052 * @since Added in version 3.1.
Camilla Berglund810bab72015-12-13 17:38:14 +01001053 *
urraka40c04a72013-12-04 10:19:22 -03001054 * @ingroup cursor
1055 */
1056typedef struct GLFWcursor GLFWcursor;
1057
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001058/*! @brief The function signature for error callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001059 *
1060 * This is the function signature for error callback functions.
1061 *
Camilla Berglund71d2b572013-03-12 15:33:05 +01001062 * @param[in] error An [error code](@ref errors).
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001063 * @param[in] description A UTF-8 encoded string describing the error.
Camilla Berglunddba2d802013-01-17 23:06:56 +01001064 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +01001065 * @sa @ref error_handling
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001066 * @sa @ref glfwSetErrorCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +01001067 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001068 * @since Added in version 3.0.
Camilla Berglund810bab72015-12-13 17:38:14 +01001069 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001070 * @ingroup init
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001071 */
Camilla Berglund897558f2011-03-07 13:34:58 +01001072typedef void (* GLFWerrorfun)(int,const char*);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001073
Camilla Berglund1a3d47d2012-11-30 13:56:42 +01001074/*! @brief The function signature for window position callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001075 *
1076 * This is the function signature for window position callback functions.
1077 *
Camilla Berglunde8e05d42014-04-23 13:30:11 +02001078 * @param[in] window The window that was moved.
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001079 * @param[in] xpos The new x-coordinate, in screen coordinates, of the
1080 * upper-left corner of the client area of the window.
1081 * @param[in] ypos The new y-coordinate, in screen coordinates, of the
1082 * upper-left corner of the client area of the window.
Camilla Berglunddba2d802013-01-17 23:06:56 +01001083 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +01001084 * @sa @ref window_pos
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001085 * @sa @ref glfwSetWindowPosCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +01001086 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001087 * @since Added in version 3.0.
Camilla Berglund810bab72015-12-13 17:38:14 +01001088 *
Camilla Berglunde248fb62013-03-29 14:06:23 +01001089 * @ingroup window
Camilla Berglund1a3d47d2012-11-30 13:56:42 +01001090 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001091typedef void (* GLFWwindowposfun)(GLFWwindow*,int,int);
Camilla Berglund1a3d47d2012-11-30 13:56:42 +01001092
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001093/*! @brief The function signature for window resize callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001094 *
1095 * This is the function signature for window size callback functions.
1096 *
Camilla Berglunde8e05d42014-04-23 13:30:11 +02001097 * @param[in] window The window that was resized.
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001098 * @param[in] width The new width, in screen coordinates, of the window.
1099 * @param[in] height The new height, in screen coordinates, of the window.
Camilla Berglunddba2d802013-01-17 23:06:56 +01001100 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +01001101 * @sa @ref window_size
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001102 * @sa @ref glfwSetWindowSizeCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +01001103 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001104 * @since Added in version 1.0.
1105 * @glfw3 Added window handle parameter.
Camilla Berglund810bab72015-12-13 17:38:14 +01001106 *
Camilla Berglunde248fb62013-03-29 14:06:23 +01001107 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001108 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001109typedef void (* GLFWwindowsizefun)(GLFWwindow*,int,int);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001110
1111/*! @brief The function signature for window close callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001112 *
1113 * This is the function signature for window close callback functions.
1114 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001115 * @param[in] window The window that the user attempted to close.
Camilla Berglunddba2d802013-01-17 23:06:56 +01001116 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +01001117 * @sa @ref window_close
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001118 * @sa @ref glfwSetWindowCloseCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +01001119 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001120 * @since Added in version 2.5.
1121 * @glfw3 Added window handle parameter.
Camilla Berglund810bab72015-12-13 17:38:14 +01001122 *
Camilla Berglunde248fb62013-03-29 14:06:23 +01001123 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001124 */
Camilla Berglund64afb192013-03-06 23:29:37 +01001125typedef void (* GLFWwindowclosefun)(GLFWwindow*);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001126
1127/*! @brief The function signature for window content refresh callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001128 *
1129 * This is the function signature for window refresh callback functions.
1130 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001131 * @param[in] window The window whose content needs to be refreshed.
Camilla Berglunddba2d802013-01-17 23:06:56 +01001132 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +01001133 * @sa @ref window_refresh
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001134 * @sa @ref glfwSetWindowRefreshCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +01001135 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001136 * @since Added in version 2.5.
1137 * @glfw3 Added window handle parameter.
Camilla Berglund810bab72015-12-13 17:38:14 +01001138 *
Camilla Berglunde248fb62013-03-29 14:06:23 +01001139 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001140 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001141typedef void (* GLFWwindowrefreshfun)(GLFWwindow*);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001142
1143/*! @brief The function signature for window focus/defocus callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001144 *
1145 * This is the function signature for window focus callback functions.
1146 *
Camilla Berglund4188c262015-01-18 01:55:25 +01001147 * @param[in] window The window that gained or lost input focus.
Camilla Berglund0eccf752015-08-23 19:30:04 +02001148 * @param[in] focused `GLFW_TRUE` if the window was given input focus, or
1149 * `GLFW_FALSE` if it lost it.
Camilla Berglunddba2d802013-01-17 23:06:56 +01001150 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +01001151 * @sa @ref window_focus
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001152 * @sa @ref glfwSetWindowFocusCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +01001153 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001154 * @since Added in version 3.0.
Camilla Berglund810bab72015-12-13 17:38:14 +01001155 *
Camilla Berglunde248fb62013-03-29 14:06:23 +01001156 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001157 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001158typedef void (* GLFWwindowfocusfun)(GLFWwindow*,int);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001159
Camilla Berglund06e7a962012-11-22 19:14:27 +01001160/*! @brief The function signature for window iconify/restore callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001161 *
1162 * This is the function signature for window iconify/restore callback
1163 * functions.
1164 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001165 * @param[in] window The window that was iconified or restored.
Camilla Berglund0eccf752015-08-23 19:30:04 +02001166 * @param[in] iconified `GLFW_TRUE` if the window was iconified, or
1167 * `GLFW_FALSE` if it was restored.
Camilla Berglunddba2d802013-01-17 23:06:56 +01001168 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +01001169 * @sa @ref window_iconify
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001170 * @sa @ref glfwSetWindowIconifyCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +01001171 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001172 * @since Added in version 3.0.
Camilla Berglund810bab72015-12-13 17:38:14 +01001173 *
Camilla Berglunde248fb62013-03-29 14:06:23 +01001174 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001175 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001176typedef void (* GLFWwindowiconifyfun)(GLFWwindow*,int);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001177
Camilla Berglundc156b502016-06-16 13:09:28 +02001178/*! @brief The function signature for window maximize/restore callbacks.
1179 *
1180 * This is the function signature for window maximize/restore callback
1181 * functions.
1182 *
1183 * @param[in] window The window that was maximized or restored.
1184 * @param[in] iconified `GLFW_TRUE` if the window was maximized, or
1185 * `GLFW_FALSE` if it was restored.
1186 *
1187 * @sa @ref window_maximize
1188 * @sa glfwSetWindowMaximizeCallback
1189 *
1190 * @since Added in version 3.3.
1191 *
1192 * @ingroup window
1193 */
1194typedef void (* GLFWwindowmaximizefun)(GLFWwindow*,int);
1195
Camilla Berglund34981632013-06-03 12:51:57 +02001196/*! @brief The function signature for framebuffer resize callbacks.
1197 *
1198 * This is the function signature for framebuffer resize callback
1199 * functions.
1200 *
1201 * @param[in] window The window whose framebuffer was resized.
1202 * @param[in] width The new width, in pixels, of the framebuffer.
1203 * @param[in] height The new height, in pixels, of the framebuffer.
1204 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +01001205 * @sa @ref window_fbsize
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001206 * @sa @ref glfwSetFramebufferSizeCallback
Camilla Berglund34981632013-06-03 12:51:57 +02001207 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001208 * @since Added in version 3.0.
Camilla Berglund810bab72015-12-13 17:38:14 +01001209 *
Camilla Berglund34981632013-06-03 12:51:57 +02001210 * @ingroup window
1211 */
1212typedef void (* GLFWframebuffersizefun)(GLFWwindow*,int,int);
1213
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001214/*! @brief The function signature for mouse button callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001215 *
1216 * This is the function signature for mouse button callback functions.
1217 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001218 * @param[in] window The window that received the event.
Camilla Berglund71d2b572013-03-12 15:33:05 +01001219 * @param[in] button The [mouse button](@ref buttons) that was pressed or
1220 * released.
1221 * @param[in] action One of `GLFW_PRESS` or `GLFW_RELEASE`.
Camilla Berglund98cbf6f2013-05-23 14:42:33 +02001222 * @param[in] mods Bit field describing which [modifier keys](@ref mods) were
1223 * held down.
Camilla Berglunddba2d802013-01-17 23:06:56 +01001224 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +01001225 * @sa @ref input_mouse_button
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001226 * @sa @ref glfwSetMouseButtonCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +01001227 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001228 * @since Added in version 1.0.
1229 * @glfw3 Added window handle and modifier mask parameters.
Camilla Berglund810bab72015-12-13 17:38:14 +01001230 *
Camilla Berglunde248fb62013-03-29 14:06:23 +01001231 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001232 */
Camilla Berglund2d1b8352012-12-09 19:19:00 +01001233typedef void (* GLFWmousebuttonfun)(GLFWwindow*,int,int,int);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001234
1235/*! @brief The function signature for cursor position callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001236 *
1237 * This is the function signature for cursor position callback functions.
1238 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001239 * @param[in] window The window that received the event.
Camilla Berglund95c44ab2016-02-17 14:52:01 +01001240 * @param[in] xpos The new cursor x-coordinate, relative to the left edge of
1241 * the client area.
1242 * @param[in] ypos The new cursor y-coordinate, relative to the top edge of the
1243 * client area.
Camilla Berglunddba2d802013-01-17 23:06:56 +01001244 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +01001245 * @sa @ref cursor_pos
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001246 * @sa @ref glfwSetCursorPosCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +01001247 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001248 * @since Added in version 3.0. Replaces `GLFWmouseposfun`.
Camilla Berglund810bab72015-12-13 17:38:14 +01001249 *
Camilla Berglunde248fb62013-03-29 14:06:23 +01001250 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001251 */
Camilla Berglund129e94d2013-04-04 16:16:21 +02001252typedef void (* GLFWcursorposfun)(GLFWwindow*,double,double);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001253
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001254/*! @brief The function signature for cursor enter/leave callbacks.
1255 *
1256 * This is the function signature for cursor enter/leave callback functions.
1257 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001258 * @param[in] window The window that received the event.
Camilla Berglund0eccf752015-08-23 19:30:04 +02001259 * @param[in] entered `GLFW_TRUE` if the cursor entered the window's client
1260 * area, or `GLFW_FALSE` if it left it.
Camilla Berglunddba2d802013-01-17 23:06:56 +01001261 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +01001262 * @sa @ref cursor_enter
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001263 * @sa @ref glfwSetCursorEnterCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +01001264 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001265 * @since Added in version 3.0.
Camilla Berglund810bab72015-12-13 17:38:14 +01001266 *
Camilla Berglunde248fb62013-03-29 14:06:23 +01001267 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001268 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001269typedef void (* GLFWcursorenterfun)(GLFWwindow*,int);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001270
1271/*! @brief The function signature for scroll callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001272 *
1273 * This is the function signature for scroll callback functions.
1274 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001275 * @param[in] window The window that received the event.
mewmewcf2d2602013-06-06 19:49:23 +02001276 * @param[in] xoffset The scroll offset along the x-axis.
1277 * @param[in] yoffset The scroll offset along the y-axis.
Camilla Berglunddba2d802013-01-17 23:06:56 +01001278 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +01001279 * @sa @ref scrolling
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001280 * @sa @ref glfwSetScrollCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +01001281 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001282 * @since Added in version 3.0. Replaces `GLFWmousewheelfun`.
Camilla Berglund810bab72015-12-13 17:38:14 +01001283 *
Camilla Berglunde248fb62013-03-29 14:06:23 +01001284 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001285 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001286typedef void (* GLFWscrollfun)(GLFWwindow*,double,double);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001287
1288/*! @brief The function signature for keyboard key callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001289 *
1290 * This is the function signature for keyboard key callback functions.
1291 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001292 * @param[in] window The window that received the event.
Camilla Berglund71d2b572013-03-12 15:33:05 +01001293 * @param[in] key The [keyboard key](@ref keys) that was pressed or released.
Camilla Berglund11615fc2013-05-30 17:19:12 +02001294 * @param[in] scancode The system-specific scancode of the key.
Camilla Berglund95654cf2014-10-02 17:35:10 +02001295 * @param[in] action `GLFW_PRESS`, `GLFW_RELEASE` or `GLFW_REPEAT`.
Camilla Berglund98cbf6f2013-05-23 14:42:33 +02001296 * @param[in] mods Bit field describing which [modifier keys](@ref mods) were
1297 * held down.
Camilla Berglunddba2d802013-01-17 23:06:56 +01001298 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +01001299 * @sa @ref input_key
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001300 * @sa @ref glfwSetKeyCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +01001301 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001302 * @since Added in version 1.0.
1303 * @glfw3 Added window handle, scancode and modifier mask parameters.
Camilla Berglund810bab72015-12-13 17:38:14 +01001304 *
Camilla Berglunde248fb62013-03-29 14:06:23 +01001305 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001306 */
Camilla Berglund11615fc2013-05-30 17:19:12 +02001307typedef void (* GLFWkeyfun)(GLFWwindow*,int,int,int,int);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001308
1309/*! @brief The function signature for Unicode character callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001310 *
1311 * This is the function signature for Unicode character callback functions.
1312 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001313 * @param[in] window The window that received the event.
Camilla Berglund2c920fb2013-10-10 19:41:56 +02001314 * @param[in] codepoint The Unicode code point of the character.
Camilla Berglunddba2d802013-01-17 23:06:56 +01001315 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +01001316 * @sa @ref input_char
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001317 * @sa @ref glfwSetCharCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +01001318 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001319 * @since Added in version 2.4.
1320 * @glfw3 Added window handle parameter.
Camilla Berglund810bab72015-12-13 17:38:14 +01001321 *
Camilla Berglunde248fb62013-03-29 14:06:23 +01001322 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001323 */
Camilla Berglund182e0af2013-02-25 17:02:28 +01001324typedef void (* GLFWcharfun)(GLFWwindow*,unsigned int);
Camilla Berglund5f68e122012-11-27 17:07:28 +01001325
Camilla Berglund96b12ee2014-06-12 23:04:20 +02001326/*! @brief The function signature for Unicode character with modifiers
1327 * callbacks.
1328 *
1329 * This is the function signature for Unicode character with modifiers callback
1330 * functions. It is called for each input character, regardless of what
1331 * modifier keys are held down.
1332 *
1333 * @param[in] window The window that received the event.
1334 * @param[in] codepoint The Unicode code point of the character.
1335 * @param[in] mods Bit field describing which [modifier keys](@ref mods) were
1336 * held down.
1337 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +01001338 * @sa @ref input_char
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001339 * @sa @ref glfwSetCharModsCallback
Camilla Berglund96b12ee2014-06-12 23:04:20 +02001340 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001341 * @since Added in version 3.1.
Camilla Berglund810bab72015-12-13 17:38:14 +01001342 *
Camilla Berglund96b12ee2014-06-12 23:04:20 +02001343 * @ingroup input
1344 */
1345typedef void (* GLFWcharmodsfun)(GLFWwindow*,unsigned int,int);
1346
Camilla Berglund5c8121e2014-03-29 21:35:21 +01001347/*! @brief The function signature for file drop callbacks.
arturo89d07232013-07-10 11:42:14 +02001348 *
Camilla Berglund5c8121e2014-03-29 21:35:21 +01001349 * This is the function signature for file drop callbacks.
arturo89d07232013-07-10 11:42:14 +02001350 *
1351 * @param[in] window The window that received the event.
Camilla Berglund5c8121e2014-03-29 21:35:21 +01001352 * @param[in] count The number of dropped files.
Camilla Berglund93855ae2015-01-27 23:04:22 +01001353 * @param[in] paths The UTF-8 encoded file and/or directory path names.
arturo89d07232013-07-10 11:42:14 +02001354 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +01001355 * @sa @ref path_drop
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001356 * @sa @ref glfwSetDropCallback
arturo89d07232013-07-10 11:42:14 +02001357 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001358 * @since Added in version 3.1.
Camilla Berglund810bab72015-12-13 17:38:14 +01001359 *
arturo89d07232013-07-10 11:42:14 +02001360 * @ingroup input
1361 */
Camilla Berglund8f349e82013-12-22 19:28:46 +01001362typedef void (* GLFWdropfun)(GLFWwindow*,int,const char**);
arturo89d07232013-07-10 11:42:14 +02001363
Camilla Berglund5f68e122012-11-27 17:07:28 +01001364/*! @brief The function signature for monitor configuration callbacks.
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001365 *
1366 * This is the function signature for monitor configuration callback functions.
1367 *
Camilla Berglund5f68e122012-11-27 17:07:28 +01001368 * @param[in] monitor The monitor that was connected or disconnected.
Camilla Berglund71d2b572013-03-12 15:33:05 +01001369 * @param[in] event One of `GLFW_CONNECTED` or `GLFW_DISCONNECTED`.
Camilla Berglunddba2d802013-01-17 23:06:56 +01001370 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +01001371 * @sa @ref monitor_event
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001372 * @sa @ref glfwSetMonitorCallback
Camilla Berglunde248fb62013-03-29 14:06:23 +01001373 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001374 * @since Added in version 3.0.
Camilla Berglund810bab72015-12-13 17:38:14 +01001375 *
Camilla Berglunde248fb62013-03-29 14:06:23 +01001376 * @ingroup monitor
Camilla Berglund5f68e122012-11-27 17:07:28 +01001377 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001378typedef void (* GLFWmonitorfun)(GLFWmonitor*,int);
Camilla Berglund897558f2011-03-07 13:34:58 +01001379
Camilla Berglund8a7fa302015-12-13 17:38:50 +01001380/*! @brief The function signature for joystick configuration callbacks.
1381 *
1382 * This is the function signature for joystick configuration callback
1383 * functions.
1384 *
Camilla Berglundefc6b352016-10-10 03:24:07 +02001385 * @param[in] jid The joystick that was connected or disconnected.
Camilla Berglund8a7fa302015-12-13 17:38:50 +01001386 * @param[in] event One of `GLFW_CONNECTED` or `GLFW_DISCONNECTED`.
1387 *
1388 * @sa @ref joystick_event
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001389 * @sa @ref glfwSetJoystickCallback
Camilla Berglund8a7fa302015-12-13 17:38:50 +01001390 *
1391 * @since Added in version 3.2.
1392 *
1393 * @ingroup input
1394 */
1395typedef void (* GLFWjoystickfun)(int,int);
1396
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001397/*! @brief Video mode type.
1398 *
1399 * This describes a single video mode.
1400 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +01001401 * @sa @ref monitor_modes
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001402 * @sa @ref glfwGetVideoMode
1403 * @sa @ref glfwGetVideoModes
Camilla Berglund9d71eb42015-11-05 09:24:16 +01001404 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001405 * @since Added in version 1.0.
1406 * @glfw3 Added refresh rate member.
Camilla Berglund810bab72015-12-13 17:38:14 +01001407 *
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001408 * @ingroup monitor
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001409 */
Systemclusterd0a0e372013-08-29 06:15:55 +02001410typedef struct GLFWvidmode
Camilla Berglund5fd3fc72010-09-09 19:44:43 +02001411{
Camilla Berglund95835af2013-05-30 13:53:25 +02001412 /*! The width, in screen coordinates, of the video mode.
Camilla Berglundc1594112013-05-27 22:29:06 +02001413 */
Camilla Berglund5fd3fc72010-09-09 19:44:43 +02001414 int width;
Camilla Berglund95835af2013-05-30 13:53:25 +02001415 /*! The height, in screen coordinates, of the video mode.
Camilla Berglundc1594112013-05-27 22:29:06 +02001416 */
Camilla Berglund5fd3fc72010-09-09 19:44:43 +02001417 int height;
Camilla Berglundc1594112013-05-27 22:29:06 +02001418 /*! The bit depth of the red channel of the video mode.
1419 */
Camilla Berglund5fd3fc72010-09-09 19:44:43 +02001420 int redBits;
Camilla Berglundc1594112013-05-27 22:29:06 +02001421 /*! The bit depth of the green channel of the video mode.
1422 */
Camilla Berglund5fd3fc72010-09-09 19:44:43 +02001423 int greenBits;
Camilla Berglundc1594112013-05-27 22:29:06 +02001424 /*! The bit depth of the blue channel of the video mode.
1425 */
Camilla Berglund2e8446f2013-04-11 01:31:00 +02001426 int blueBits;
Camilla Berglund731812c2013-05-30 15:52:42 +02001427 /*! The refresh rate, in Hz, of the video mode.
1428 */
1429 int refreshRate;
Camilla Berglund3249f812010-09-07 17:34:51 +02001430} GLFWvidmode;
1431
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001432/*! @brief Gamma ramp.
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001433 *
1434 * This describes the gamma ramp for a monitor.
1435 *
Camilla Berglund9d71eb42015-11-05 09:24:16 +01001436 * @sa @ref monitor_gamma
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001437 * @sa @ref glfwGetGammaRamp
1438 * @sa @ref glfwSetGammaRamp
Camilla Berglund8282a8f2013-04-10 23:01:12 +02001439 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001440 * @since Added in version 3.0.
Camilla Berglund810bab72015-12-13 17:38:14 +01001441 *
Camilla Berglundf5f55e32013-06-17 12:56:36 +02001442 * @ingroup monitor
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001443 */
Systemclusterd0a0e372013-08-29 06:15:55 +02001444typedef struct GLFWgammaramp
Camilla Berglund2630d492010-10-13 04:04:43 +02001445{
Camilla Berglundc1594112013-05-27 22:29:06 +02001446 /*! An array of value describing the response of the red channel.
1447 */
Camilla Berglund5d308db2013-05-19 15:46:44 +02001448 unsigned short* red;
Camilla Berglundc1594112013-05-27 22:29:06 +02001449 /*! An array of value describing the response of the green channel.
1450 */
Camilla Berglund5d308db2013-05-19 15:46:44 +02001451 unsigned short* green;
Camilla Berglundc1594112013-05-27 22:29:06 +02001452 /*! An array of value describing the response of the blue channel.
1453 */
Camilla Berglund5d308db2013-05-19 15:46:44 +02001454 unsigned short* blue;
Camilla Berglundc1594112013-05-27 22:29:06 +02001455 /*! The number of elements in each array.
1456 */
Camilla Berglund5d308db2013-05-19 15:46:44 +02001457 unsigned int size;
Camilla Berglund2630d492010-10-13 04:04:43 +02001458} GLFWgammaramp;
1459
Camilla Berglund8fa9cc02014-02-23 16:43:17 +01001460/*! @brief Image data.
Camilla Berglund9d71eb42015-11-05 09:24:16 +01001461 *
1462 * @sa @ref cursor_custom
Camilla Berglundfe0317a2016-08-01 11:51:30 +02001463 * @sa @ref window_icon
Camilla Berglund810bab72015-12-13 17:38:14 +01001464 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001465 * @since Added in version 2.1.
1466 * @glfw3 Removed format and bytes-per-pixel members.
Camilla Berglund8fa9cc02014-02-23 16:43:17 +01001467 */
1468typedef struct GLFWimage
1469{
1470 /*! The width, in pixels, of this image.
1471 */
1472 int width;
1473 /*! The height, in pixels, of this image.
1474 */
1475 int height;
1476 /*! The pixel data of this image, arranged left-to-right, top-to-bottom.
1477 */
1478 unsigned char* pixels;
1479} GLFWimage;
1480
Camilla Berglund3249f812010-09-07 17:34:51 +02001481
1482/*************************************************************************
Camilla Berglund2fca5c52013-01-17 21:51:39 +01001483 * GLFW API functions
Camilla Berglund3249f812010-09-07 17:34:51 +02001484 *************************************************************************/
1485
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001486/*! @brief Initializes the GLFW library.
1487 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001488 * This function initializes the GLFW library. Before most GLFW functions can
Camilla Berglund4591ad22014-09-18 15:03:29 +02001489 * be used, GLFW must be initialized, and before an application terminates GLFW
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001490 * should be terminated in order to free any resources allocated during or
1491 * after initialization.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001492 *
Camilla Berglund23f61762013-03-12 19:53:29 +01001493 * If this function fails, it calls @ref glfwTerminate before returning. If it
Camilla Berglund4591ad22014-09-18 15:03:29 +02001494 * succeeds, you should call @ref glfwTerminate before the application exits.
Camilla Berglund23f61762013-03-12 19:53:29 +01001495 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001496 * Additional calls to this function after successful initialization but before
Camilla Berglund0eccf752015-08-23 19:30:04 +02001497 * termination will return `GLFW_TRUE` immediately.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001498 *
Camilla Berglund0eccf752015-08-23 19:30:04 +02001499 * @return `GLFW_TRUE` if successful, or `GLFW_FALSE` if an
Camilla Berglund4591ad22014-09-18 15:03:29 +02001500 * [error](@ref error_handling) occurred.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001501 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001502 * @errors Possible errors include @ref GLFW_PLATFORM_ERROR.
1503 *
Camilla Berglund8d6f2652016-10-20 00:50:54 +02001504 * @remark @macos This function will change the current directory of the
Camilla Berglund71d2b572013-03-12 15:33:05 +01001505 * application to the `Contents/Resources` subdirectory of the application's
Camilla Löwy6d9a58b2017-02-14 15:43:31 +01001506 * bundle, if present. This can be disabled with the @ref
1507 * GLFW_COCOA_CHDIR_RESOURCES init hint.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001508 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001509 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001510 *
1511 * @sa @ref intro_init
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001512 * @sa @ref glfwTerminate
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001513 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001514 * @since Added in version 1.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001515 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001516 * @ingroup init
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001517 */
1518GLFWAPI int glfwInit(void);
1519
1520/*! @brief Terminates the GLFW library.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001521 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001522 * This function destroys all remaining windows and cursors, restores any
1523 * modified gamma ramps and frees any other allocated resources. Once this
1524 * function is called, you must again call @ref glfwInit successfully before
1525 * you will be able to use most GLFW functions.
Camilla Berglund23f61762013-03-12 19:53:29 +01001526 *
1527 * If GLFW has been successfully initialized, this function should be called
Camilla Berglund4591ad22014-09-18 15:03:29 +02001528 * before the application exits. If initialization fails, there is no need to
1529 * call this function, as it is called by @ref glfwInit before it returns
1530 * failure.
Camilla Berglund23f61762013-03-12 19:53:29 +01001531 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001532 * @errors Possible errors include @ref GLFW_PLATFORM_ERROR.
1533 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001534 * @remark This function may be called before @ref glfwInit.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001535 *
Camilla Berglund0df4e062015-12-13 14:07:27 +01001536 * @warning The contexts of any remaining windows must not be current on any
1537 * other thread when this function is called.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001538 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001539 * @reentrancy This function must not be called from a callback.
Camilla Berglund20858762015-01-01 18:41:22 +01001540 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001541 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001542 *
1543 * @sa @ref intro_init
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001544 * @sa @ref glfwInit
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001545 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001546 * @since Added in version 1.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001547 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001548 * @ingroup init
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001549 */
Camilla Berglund9a716692010-09-08 16:40:43 +02001550GLFWAPI void glfwTerminate(void);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001551
Camilla Löwy6d9a58b2017-02-14 15:43:31 +01001552/*! @brief Sets the specified init hint to the desired value.
1553 *
1554 * This function sets hints for the next initialization of GLFW.
1555 *
1556 * The values you set are not affected by initialization or termination, but
1557 * they are only read during initialization. Once GLFW has been initialized,
1558 * setting new hint values will not affect behavior until the next time the
1559 * library is terminated and initialized.
1560 *
1561 * Some hints are platform specific. These are always valid to set on any
1562 * platform but they will only affect their specific platform. Other platforms
1563 * will simply ignore them. Setting these hints requires no platform specific
1564 * headers or calls.
1565 *
1566 * @param[in] hint The [init hint](@ref init_hints) to set.
1567 * @param[in] value The new value of the init hint.
1568 *
1569 * @errors Possible errors include @ref GLFW_INVALID_ENUM and @ref
1570 * GLFW_INVALID_VALUE.
1571 *
1572 * @remarks This function may be called before @ref glfwInit.
1573 *
1574 * @thread_safety This function must only be called from the main thread.
1575 *
1576 * @sa init_hints
1577 * @sa glfwInit
1578 *
1579 * @since Added in version 3.3.
1580 *
1581 * @ingroup init
1582 */
1583GLFWAPI void glfwInitHint(int hint, int value);
1584
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001585/*! @brief Retrieves the version of the GLFW library.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001586 *
1587 * This function retrieves the major, minor and revision numbers of the GLFW
1588 * library. It is intended for when you are using GLFW as a shared library and
1589 * want to ensure that you are using the minimum required version.
1590 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001591 * Any or all of the version arguments may be `NULL`.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001592 *
Camilla Berglund71d2b572013-03-12 15:33:05 +01001593 * @param[out] major Where to store the major version number, or `NULL`.
1594 * @param[out] minor Where to store the minor version number, or `NULL`.
1595 * @param[out] rev Where to store the revision number, or `NULL`.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001596 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001597 * @errors None.
1598 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001599 * @remark This function may be called before @ref glfwInit.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001600 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001601 * @thread_safety This function may be called from any thread.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001602 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001603 * @sa @ref intro_version
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001604 * @sa @ref glfwGetVersionString
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001605 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001606 * @since Added in version 1.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001607 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001608 * @ingroup init
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001609 */
Camilla Berglund9a716692010-09-08 16:40:43 +02001610GLFWAPI void glfwGetVersion(int* major, int* minor, int* rev);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001611
Camilla Berglund6f8084f2013-02-14 13:14:17 +01001612/*! @brief Returns a string describing the compile-time configuration.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001613 *
Camilla Berglunde8e05d42014-04-23 13:30:11 +02001614 * This function returns the compile-time generated
1615 * [version string](@ref intro_version_string) of the GLFW library binary. It
1616 * describes the version, platform, compiler and any platform-specific
Camilla Berglund386b6032016-02-10 13:48:49 +01001617 * compile-time options. It should not be confused with the OpenGL or OpenGL
1618 * ES version string, queried with `glGetString`.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001619 *
Camilla Berglundce8f97c2015-01-11 23:33:14 +01001620 * __Do not use the version string__ to parse the GLFW library version. The
Camilla Berglund386b6032016-02-10 13:48:49 +01001621 * @ref glfwGetVersion function provides the version of the running library
1622 * binary in numerical format.
Camilla Berglundce8f97c2015-01-11 23:33:14 +01001623 *
Camilla Berglund386b6032016-02-10 13:48:49 +01001624 * @return The ASCII encoded GLFW version string.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02001625 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001626 * @errors None.
1627 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001628 * @remark This function may be called before @ref glfwInit.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001629 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001630 * @pointer_lifetime The returned string is static and compile-time generated.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001631 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001632 * @thread_safety This function may be called from any thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001633 *
1634 * @sa @ref intro_version
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001635 * @sa @ref glfwGetVersion
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001636 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001637 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001638 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001639 * @ingroup init
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001640 */
Camilla Berglundd6fe4472010-09-13 18:05:59 +02001641GLFWAPI const char* glfwGetVersionString(void);
Camilla Berglund3249f812010-09-07 17:34:51 +02001642
Camilla Löwy63506412017-05-01 19:20:57 +02001643/*! @brief Returns and clears the last error for the calling thread.
1644 *
1645 * This function returns and clears the [error code](@ref error) of the last
1646 * error that occurred on the calling thread. If no error has occurred since
1647 * the last call, it returns @ref GLFW_NO_ERROR.
1648 *
1649 * @return The last error code for the calling thread, or @ref GLFW_NO_ERROR.
1650 *
1651 * @errors None.
1652 *
1653 * @remark This function may be called before @ref glfwInit.
1654 *
1655 * @thread_safety This function may be called from any thread.
1656 *
1657 * @sa @ref error_handling
1658 * @sa @ref glfwSetErrorCallback
1659 *
1660 * @since Added in version 3.3.
1661 *
1662 * @ingroup init
1663 */
1664GLFWAPI int glfwGetError(void);
1665
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001666/*! @brief Sets the error callback.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001667 *
1668 * This function sets the error callback, which is called with an error code
1669 * and a human-readable description each time a GLFW error occurs.
1670 *
Camilla Löwy63506412017-05-01 19:20:57 +02001671 * The error code is set before the callback is called. Calling @ref
1672 * glfwGetError from the error callback will return the same value as the error
1673 * code argument.
1674 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001675 * The error callback is called on the thread where the error occurred. If you
1676 * are using GLFW from multiple threads, your error callback needs to be
1677 * written accordingly.
1678 *
1679 * Because the description string may have been generated specifically for that
1680 * error, it is not guaranteed to be valid after the callback has returned. If
1681 * you wish to use it after the callback returns, you need to make a copy.
1682 *
Camilla Berglund20858762015-01-01 18:41:22 +01001683 * Once set, the error callback remains set even after the library has been
1684 * terminated.
1685 *
Camilla Berglund71d2b572013-03-12 15:33:05 +01001686 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001687 * callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02001688 * @return The previously set callback, or `NULL` if no callback was set.
1689 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001690 * @errors None.
1691 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001692 * @remark This function may be called before @ref glfwInit.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001693 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001694 * @thread_safety This function must only be called from the main thread.
Camilla Berglund0e205772014-03-24 11:58:35 +01001695 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001696 * @sa @ref error_handling
Camilla Löwy63506412017-05-01 19:20:57 +02001697 * @sa @ref glfwGetError
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001698 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001699 * @since Added in version 3.0.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001700 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001701 * @ingroup init
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001702 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02001703GLFWAPI GLFWerrorfun glfwSetErrorCallback(GLFWerrorfun cbfun);
Camilla Berglundf5d74c42010-09-09 21:06:59 +02001704
Camilla Berglund5f68e122012-11-27 17:07:28 +01001705/*! @brief Returns the currently connected monitors.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001706 *
1707 * This function returns an array of handles for all currently connected
Camilla Berglundf5cbdba2015-09-17 16:37:09 +02001708 * monitors. The primary monitor is always first in the returned array. If no
1709 * monitors were found, this function returns `NULL`.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001710 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001711 * @param[out] count Where to store the number of monitors in the returned
1712 * array. This is set to zero if an error occurred.
Camilla Berglundf5cbdba2015-09-17 16:37:09 +02001713 * @return An array of monitor handles, or `NULL` if no monitors were found or
1714 * if an [error](@ref error_handling) occurred.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001715 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001716 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
1717 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001718 * @pointer_lifetime The returned array is allocated and freed by GLFW. You
1719 * should not free it yourself. It is guaranteed to be valid only until the
1720 * monitor configuration changes or the library is terminated.
Camilla Berglund0e205772014-03-24 11:58:35 +01001721 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001722 * @thread_safety This function must only be called from the main thread.
Camilla Berglundc3bb5c92013-06-05 16:04:04 +02001723 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001724 * @sa @ref monitor_monitors
1725 * @sa @ref monitor_event
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001726 * @sa @ref glfwGetPrimaryMonitor
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001727 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001728 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001729 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001730 * @ingroup monitor
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001731 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001732GLFWAPI GLFWmonitor** glfwGetMonitors(int* count);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001733
Camilla Berglund5f68e122012-11-27 17:07:28 +01001734/*! @brief Returns the primary monitor.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001735 *
1736 * This function returns the primary monitor. This is usually the monitor
Camilla Berglundf5cbdba2015-09-17 16:37:09 +02001737 * where elements like the task bar or global menu bar are located.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001738 *
Camilla Berglundf5cbdba2015-09-17 16:37:09 +02001739 * @return The primary monitor, or `NULL` if no monitors were found or if an
1740 * [error](@ref error_handling) occurred.
Camilla Berglunddba2d802013-01-17 23:06:56 +01001741 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001742 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
1743 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001744 * @thread_safety This function must only be called from the main thread.
Camilla Berglund0e205772014-03-24 11:58:35 +01001745 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001746 * @remark The primary monitor is always first in the array returned by @ref
Camilla Berglundf5cbdba2015-09-17 16:37:09 +02001747 * glfwGetMonitors.
1748 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001749 * @sa @ref monitor_monitors
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001750 * @sa @ref glfwGetMonitors
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001751 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001752 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001753 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001754 * @ingroup monitor
Camilla Berglund41bc0d12012-11-27 16:55:04 +01001755 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001756GLFWAPI GLFWmonitor* glfwGetPrimaryMonitor(void);
Camilla Berglund41bc0d12012-11-27 16:55:04 +01001757
Camilla Berglundee5f30e2013-01-24 19:10:17 +01001758/*! @brief Returns the position of the monitor's viewport on the virtual screen.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001759 *
1760 * This function returns the position, in screen coordinates, of the upper-left
1761 * corner of the specified monitor.
1762 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001763 * Any or all of the position arguments may be `NULL`. If an error occurs, all
1764 * non-`NULL` position arguments will be set to zero.
1765 *
Camilla Berglunddba2d802013-01-17 23:06:56 +01001766 * @param[in] monitor The monitor to query.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02001767 * @param[out] xpos Where to store the monitor x-coordinate, or `NULL`.
1768 * @param[out] ypos Where to store the monitor y-coordinate, or `NULL`.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001769 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001770 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
1771 * GLFW_PLATFORM_ERROR.
1772 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001773 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001774 *
1775 * @sa @ref monitor_properties
1776 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001777 * @since Added in version 3.0.
Camilla Berglund0e205772014-03-24 11:58:35 +01001778 *
Camilla Berglund5f68e122012-11-27 17:07:28 +01001779 * @ingroup monitor
Camilla Berglund41bc0d12012-11-27 16:55:04 +01001780 */
Camilla Berglundee5f30e2013-01-24 19:10:17 +01001781GLFWAPI void glfwGetMonitorPos(GLFWmonitor* monitor, int* xpos, int* ypos);
1782
1783/*! @brief Returns the physical size of the monitor.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001784 *
1785 * This function returns the size, in millimetres, of the display area of the
1786 * specified monitor.
1787 *
Camilla Berglund4188c262015-01-18 01:55:25 +01001788 * Some systems do not provide accurate monitor size information, either
1789 * because the monitor
1790 * [EDID](https://en.wikipedia.org/wiki/Extended_display_identification_data)
1791 * data is incorrect or because the driver does not report it accurately.
1792 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001793 * Any or all of the size arguments may be `NULL`. If an error occurs, all
1794 * non-`NULL` size arguments will be set to zero.
1795 *
Camilla Berglundee5f30e2013-01-24 19:10:17 +01001796 * @param[in] monitor The monitor to query.
Camilla Berglundce8f97c2015-01-11 23:33:14 +01001797 * @param[out] widthMM Where to store the width, in millimetres, of the
1798 * monitor's display area, or `NULL`.
1799 * @param[out] heightMM Where to store the height, in millimetres, of the
1800 * monitor's display area, or `NULL`.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001801 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001802 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
1803 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001804 * @remark @win32 calculates the returned physical size from the
Camilla Berglund4188c262015-01-18 01:55:25 +01001805 * current resolution and system DPI instead of querying the monitor EDID data.
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 Berglund4591ad22014-09-18 15:03:29 +02001808 *
1809 * @sa @ref monitor_properties
1810 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001811 * @since Added in version 3.0.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001812 *
Camilla Berglundee5f30e2013-01-24 19:10:17 +01001813 * @ingroup monitor
1814 */
Camilla Berglundce8f97c2015-01-11 23:33:14 +01001815GLFWAPI void glfwGetMonitorPhysicalSize(GLFWmonitor* monitor, int* widthMM, int* heightMM);
Camilla Berglund41bc0d12012-11-27 16:55:04 +01001816
Camilla Berglund5f68e122012-11-27 17:07:28 +01001817/*! @brief Returns the name of the specified monitor.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001818 *
1819 * This function returns a human-readable name, encoded as UTF-8, of the
Camilla Berglund4591ad22014-09-18 15:03:29 +02001820 * specified monitor. The name typically reflects the make and model of the
1821 * monitor and is not guaranteed to be unique among the connected monitors.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001822 *
Camilla Berglund5f68e122012-11-27 17:07:28 +01001823 * @param[in] monitor The monitor to query.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001824 * @return The UTF-8 encoded name of the monitor, or `NULL` if an
1825 * [error](@ref error_handling) occurred.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001826 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001827 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
1828 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001829 * @pointer_lifetime The returned string is allocated and freed by GLFW. You
1830 * should not free it yourself. It is valid until the specified monitor is
1831 * disconnected or the library is terminated.
Camilla Berglund0e205772014-03-24 11:58:35 +01001832 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001833 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001834 *
1835 * @sa @ref monitor_properties
1836 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001837 * @since Added in version 3.0.
Camilla Berglundc3bb5c92013-06-05 16:04:04 +02001838 *
Camilla Berglund5f68e122012-11-27 17:07:28 +01001839 * @ingroup monitor
Camilla Berglund41bc0d12012-11-27 16:55:04 +01001840 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001841GLFWAPI const char* glfwGetMonitorName(GLFWmonitor* monitor);
Camilla Berglund41bc0d12012-11-27 16:55:04 +01001842
Camilla Berglund5f68e122012-11-27 17:07:28 +01001843/*! @brief Sets the monitor configuration callback.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001844 *
1845 * This function sets the monitor configuration callback, or removes the
1846 * currently set callback. This is called when a monitor is connected to or
1847 * disconnected from the system.
1848 *
Camilla Berglund71d2b572013-03-12 15:33:05 +01001849 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
Camilla Berglunddba2d802013-01-17 23:06:56 +01001850 * callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02001851 * @return The previously set callback, or `NULL` if no callback was set or the
1852 * library had not been [initialized](@ref intro_init).
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001853 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001854 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
1855 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001856 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001857 *
1858 * @sa @ref monitor_event
1859 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001860 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001861 *
Camilla Berglund5f68e122012-11-27 17:07:28 +01001862 * @ingroup monitor
Camilla Berglund41bc0d12012-11-27 16:55:04 +01001863 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02001864GLFWAPI GLFWmonitorfun glfwSetMonitorCallback(GLFWmonitorfun cbfun);
Marcel Metzbeacbb32011-05-07 10:53:50 +02001865
Camilla Berglund41bc0d12012-11-27 16:55:04 +01001866/*! @brief Returns the available video modes for the specified monitor.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001867 *
1868 * This function returns an array of all video modes supported by the specified
Camilla Berglund948cc042013-04-16 02:02:22 +02001869 * monitor. The returned array is sorted in ascending order, first by color
1870 * bit depth (the sum of all channel depths) and then by resolution area (the
1871 * product of width and height).
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001872 *
Camilla Berglund5f68e122012-11-27 17:07:28 +01001873 * @param[in] monitor The monitor to query.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02001874 * @param[out] count Where to store the number of video modes in the returned
1875 * array. This is set to zero if an error occurred.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001876 * @return An array of video modes, or `NULL` if an
1877 * [error](@ref error_handling) occurred.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001878 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001879 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
1880 * GLFW_PLATFORM_ERROR.
1881 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001882 * @pointer_lifetime The returned array is allocated and freed by GLFW. You
1883 * should not free it yourself. It is valid until the specified monitor is
1884 * disconnected, this function is called again for that monitor or the library
1885 * is terminated.
Camilla Berglund0e205772014-03-24 11:58:35 +01001886 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001887 * @thread_safety This function must only be called from the main thread.
Camilla Berglundc3bb5c92013-06-05 16:04:04 +02001888 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001889 * @sa @ref monitor_modes
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001890 * @sa @ref glfwGetVideoMode
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001891 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001892 * @since Added in version 1.0.
Camilla Berglund951a9582016-01-31 21:32:14 +01001893 * @glfw3 Changed to return an array of modes for a specific monitor.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001894 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001895 * @ingroup monitor
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001896 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01001897GLFWAPI const GLFWvidmode* glfwGetVideoModes(GLFWmonitor* monitor, int* count);
Camilla Berglund41bc0d12012-11-27 16:55:04 +01001898
Camilla Berglund5f68e122012-11-27 17:07:28 +01001899/*! @brief Returns the current mode of the specified monitor.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001900 *
Camilla Berglund948cc042013-04-16 02:02:22 +02001901 * This function returns the current video mode of the specified monitor. If
Camilla Berglund4591ad22014-09-18 15:03:29 +02001902 * you have created a full screen window for that monitor, the return value
1903 * will depend on whether that window is iconified.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001904 *
Camilla Berglund5f68e122012-11-27 17:07:28 +01001905 * @param[in] monitor The monitor to query.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001906 * @return The current mode of the monitor, or `NULL` if an
1907 * [error](@ref error_handling) occurred.
Camilla Berglunddba2d802013-01-17 23:06:56 +01001908 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001909 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
1910 * GLFW_PLATFORM_ERROR.
1911 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001912 * @pointer_lifetime The returned array is allocated and freed by GLFW. You
1913 * should not free it yourself. It is valid until the specified monitor is
1914 * disconnected or the library is terminated.
Camilla Berglund0e205772014-03-24 11:58:35 +01001915 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001916 * @thread_safety This function must only be called from the main thread.
Camilla Berglundc3bb5c92013-06-05 16:04:04 +02001917 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001918 * @sa @ref monitor_modes
Camilla Berglund7e9e3212016-09-14 20:17:26 +02001919 * @sa @ref glfwGetVideoModes
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001920 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001921 * @since Added in version 3.0. Replaces `glfwGetDesktopMode`.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001922 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001923 * @ingroup monitor
Camilla Berglund41bc0d12012-11-27 16:55:04 +01001924 */
Camilla Berglundce1e84d2013-05-22 22:16:43 +02001925GLFWAPI const GLFWvidmode* glfwGetVideoMode(GLFWmonitor* monitor);
Camilla Berglund3249f812010-09-07 17:34:51 +02001926
Camilla Berglund92a71e02013-02-12 13:50:41 +01001927/*! @brief Generates a gamma ramp and sets it for the specified monitor.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001928 *
Camilla Berglund5d308db2013-05-19 15:46:44 +02001929 * This function generates a 256-element gamma ramp from the specified exponent
Camilla Berglund5bbc2b42015-03-15 15:40:43 +01001930 * and then calls @ref glfwSetGammaRamp with it. The value must be a finite
1931 * number greater than zero.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001932 *
Camilla Löwyce161c22016-12-06 01:14:23 +01001933 * The software controlled gamma ramp is applied _in addition_ to the hardware
1934 * gamma correction, which today is usually an approximation of sRGB gamma.
1935 * This means that setting a perfectly linear ramp, or gamma 1.0, will produce
1936 * the default (usually sRGB-like) behavior.
1937 *
1938 * For gamma correct rendering with OpenGL or OpenGL ES, see the @ref
1939 * GLFW_SRGB_CAPABLE hint.
1940 *
Camilla Berglund92a71e02013-02-12 13:50:41 +01001941 * @param[in] monitor The monitor whose gamma ramp to set.
Camilla Berglunda3ff29a2012-12-02 15:47:10 +01001942 * @param[in] gamma The desired exponent.
Camilla Berglunddba2d802013-01-17 23:06:56 +01001943 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001944 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
1945 * GLFW_INVALID_VALUE and @ref GLFW_PLATFORM_ERROR.
1946 *
linkmauvebc8b0482016-10-16 15:52:39 +01001947 * @remark @wayland Gamma handling is currently unavailable, this function will
1948 * always emit @ref GLFW_PLATFORM_ERROR.
1949 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001950 * @thread_safety This function must only be called from the main thread.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02001951 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001952 * @sa @ref monitor_gamma
1953 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001954 * @since Added in version 3.0.
Camilla Berglund0e205772014-03-24 11:58:35 +01001955 *
Camilla Berglundf5f55e32013-06-17 12:56:36 +02001956 * @ingroup monitor
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001957 */
Camilla Berglund92a71e02013-02-12 13:50:41 +01001958GLFWAPI void glfwSetGamma(GLFWmonitor* monitor, float gamma);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001959
Camilla Berglund4591ad22014-09-18 15:03:29 +02001960/*! @brief Returns the current gamma ramp for the specified monitor.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001961 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001962 * This function returns the current gamma ramp of the specified monitor.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001963 *
Camilla Berglund92a71e02013-02-12 13:50:41 +01001964 * @param[in] monitor The monitor to query.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001965 * @return The current gamma ramp, or `NULL` if an
1966 * [error](@ref error_handling) occurred.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001967 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01001968 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
1969 * GLFW_PLATFORM_ERROR.
1970 *
linkmauvebc8b0482016-10-16 15:52:39 +01001971 * @remark @wayland Gamma handling is currently unavailable, this function will
1972 * always return `NULL` and emit @ref GLFW_PLATFORM_ERROR.
1973 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001974 * @pointer_lifetime The returned structure and its arrays are allocated and
1975 * freed by GLFW. You should not free them yourself. They are valid until the
1976 * specified monitor is disconnected, this function is called again for that
1977 * monitor or the library is terminated.
Camilla Berglund0e205772014-03-24 11:58:35 +01001978 *
Camilla Berglund951a9582016-01-31 21:32:14 +01001979 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02001980 *
1981 * @sa @ref monitor_gamma
1982 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01001983 * @since Added in version 3.0.
Camilla Berglundc3bb5c92013-06-05 16:04:04 +02001984 *
Camilla Berglundf5f55e32013-06-17 12:56:36 +02001985 * @ingroup monitor
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001986 */
Camilla Berglund5d308db2013-05-19 15:46:44 +02001987GLFWAPI const GLFWgammaramp* glfwGetGammaRamp(GLFWmonitor* monitor);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01001988
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001989/*! @brief Sets the current gamma ramp for the specified monitor.
1990 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02001991 * This function sets the current gamma ramp for the specified monitor. The
1992 * original gamma ramp for that monitor is saved by GLFW the first time this
1993 * function is called and is restored by @ref glfwTerminate.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01001994 *
Camilla Löwyce161c22016-12-06 01:14:23 +01001995 * The software controlled gamma ramp is applied _in addition_ to the hardware
1996 * gamma correction, which today is usually an approximation of sRGB gamma.
1997 * This means that setting a perfectly linear ramp, or gamma 1.0, will produce
1998 * the default (usually sRGB-like) behavior.
1999 *
2000 * For gamma correct rendering with OpenGL or OpenGL ES, see the @ref
2001 * GLFW_SRGB_CAPABLE hint.
2002 *
Camilla Berglund92a71e02013-02-12 13:50:41 +01002003 * @param[in] monitor The monitor whose gamma ramp to set.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002004 * @param[in] ramp The gamma ramp to use.
Camilla Berglund8954af62013-02-20 19:44:52 +01002005 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002006 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2007 * GLFW_PLATFORM_ERROR.
2008 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002009 * @remark Gamma ramp sizes other than 256 are not supported by all platforms
Camilla Berglund76fff4d2015-03-10 19:02:28 +01002010 * or graphics hardware.
2011 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002012 * @remark @win32 The gamma ramp size must be 256.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002013 *
linkmauvebc8b0482016-10-16 15:52:39 +01002014 * @remark @wayland Gamma handling is currently unavailable, this function will
2015 * always emit @ref GLFW_PLATFORM_ERROR.
2016 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002017 * @pointer_lifetime The specified gamma ramp is copied before this function
2018 * returns.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002019 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002020 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002021 *
2022 * @sa @ref monitor_gamma
2023 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002024 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002025 *
Camilla Berglundf5f55e32013-06-17 12:56:36 +02002026 * @ingroup monitor
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002027 */
Camilla Berglund92a71e02013-02-12 13:50:41 +01002028GLFWAPI void glfwSetGammaRamp(GLFWmonitor* monitor, const GLFWgammaramp* ramp);
Camilla Berglund2630d492010-10-13 04:04:43 +02002029
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002030/*! @brief Resets all window hints to their default values.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002031 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002032 * This function resets all window hints to their
Camilla Berglunde248fb62013-03-29 14:06:23 +01002033 * [default values](@ref window_hints_values).
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002034 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002035 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
2036 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002037 * @thread_safety This function must only be called from the main thread.
Camilla Berglund9ad1d972012-11-22 19:08:30 +01002038 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002039 * @sa @ref window_hints
Camilla Berglund7e9e3212016-09-14 20:17:26 +02002040 * @sa @ref glfwWindowHint
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002041 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002042 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002043 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002044 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002045 */
Camilla Berglund5df4df62012-10-22 02:59:05 +02002046GLFWAPI void glfwDefaultWindowHints(void);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002047
2048/*! @brief Sets the specified window hint to the desired value.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002049 *
Camilla Berglunded9e4032012-12-23 15:59:09 +01002050 * This function sets hints for the next call to @ref glfwCreateWindow. The
2051 * hints, once set, retain their values until changed by a call to @ref
2052 * glfwWindowHint or @ref glfwDefaultWindowHints, or until the library is
Camilla Berglund6be821c2014-10-06 23:18:33 +02002053 * terminated.
Camilla Berglunded9e4032012-12-23 15:59:09 +01002054 *
Camilla Berglundd6e0a432016-02-09 07:41:48 +01002055 * This function does not check whether the specified hint values are valid.
2056 * If you set hints to invalid values this will instead be reported by the next
2057 * call to @ref glfwCreateWindow.
2058 *
Camilla Berglundd0649e62016-01-27 03:25:21 +01002059 * @param[in] hint The [window hint](@ref window_hints) to set.
2060 * @param[in] value The new value of the window hint.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002061 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002062 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2063 * GLFW_INVALID_ENUM.
2064 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002065 * @thread_safety This function must only be called from the main thread.
Camilla Berglund401033c2013-03-12 19:17:07 +01002066 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002067 * @sa @ref window_hints
Camilla Berglund7e9e3212016-09-14 20:17:26 +02002068 * @sa @ref glfwDefaultWindowHints
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002069 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002070 * @since Added in version 3.0. Replaces `glfwOpenWindowHint`.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002071 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002072 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002073 */
Camilla Berglundd0649e62016-01-27 03:25:21 +01002074GLFWAPI void glfwWindowHint(int hint, int value);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002075
2076/*! @brief Creates a window and its associated context.
2077 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002078 * This function creates a window and its associated OpenGL or OpenGL ES
2079 * context. Most of the options controlling how the window and its context
2080 * should be created are specified with [window hints](@ref window_hints).
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002081 *
2082 * Successful creation does not change which context is current. Before you
Camilla Berglund4591ad22014-09-18 15:03:29 +02002083 * can use the newly created context, you need to
2084 * [make it current](@ref context_current). For information about the `share`
2085 * parameter, see @ref context_sharing.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002086 *
Camilla Berglunde8e05d42014-04-23 13:30:11 +02002087 * The created window, framebuffer and context may differ from what you
2088 * requested, as not all parameters and hints are
Camilla Berglundfa0cbd92013-04-11 01:07:07 +02002089 * [hard constraints](@ref window_hints_hard). This includes the size of the
Camilla Berglund4591ad22014-09-18 15:03:29 +02002090 * window, especially for full screen windows. To query the actual attributes
Camilla Berglunde8bceaa2015-04-07 14:37:42 +02002091 * of the created window, framebuffer and context, see @ref
2092 * glfwGetWindowAttrib, @ref glfwGetWindowSize and @ref glfwGetFramebufferSize.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002093 *
Camilla Berglunde8e05d42014-04-23 13:30:11 +02002094 * To create a full screen window, you need to specify the monitor the window
Camilla Berglund6570d0c2016-02-23 12:26:42 +01002095 * will cover. If no monitor is specified, the window will be windowed mode.
2096 * Unless you have a way for the user to choose a specific monitor, it is
2097 * recommended that you pick the primary monitor. For more information on how
2098 * to query connected monitors, see @ref monitor_monitors.
Camilla Berglund4b7ae492013-07-07 12:06:59 +02002099 *
Camilla Berglund95654cf2014-10-02 17:35:10 +02002100 * For full screen windows, the specified size becomes the resolution of the
Camilla Berglund6570d0c2016-02-23 12:26:42 +01002101 * window's _desired video mode_. As long as a full screen window is not
2102 * iconified, the supported video mode most closely matching the desired video
2103 * mode is set for the specified monitor. For more information about full
2104 * screen windows, including the creation of so called _windowed full screen_
2105 * or _borderless full screen_ windows, see @ref window_windowed_full_screen.
Camilla Berglund95654cf2014-10-02 17:35:10 +02002106 *
Camilla Berglund999f3552016-08-17 16:48:22 +02002107 * Once you have created the window, you can switch it between windowed and
Camilla Berglunde83be1d2016-11-08 12:19:06 +01002108 * full screen mode with @ref glfwSetWindowMonitor. This will not affect its
2109 * OpenGL or OpenGL ES context.
Camilla Berglund999f3552016-08-17 16:48:22 +02002110 *
Camilla Berglunde8e05d42014-04-23 13:30:11 +02002111 * By default, newly created windows use the placement recommended by the
2112 * window system. To create the window at a specific position, make it
Camilla Löwyce161c22016-12-06 01:14:23 +01002113 * initially invisible using the [GLFW_VISIBLE](@ref GLFW_VISIBLE_hint) window
Camilla Berglundce8f97c2015-01-11 23:33:14 +01002114 * hint, set its [position](@ref window_pos) and then [show](@ref window_hide)
2115 * it.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02002116 *
Camilla Berglund6570d0c2016-02-23 12:26:42 +01002117 * As long as at least one full screen window is not iconified, the screensaver
2118 * is prohibited from starting.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02002119 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002120 * Window systems put limits on window sizes. Very large or very small window
2121 * dimensions may be overridden by the window system on creation. Check the
Camilla Berglund95654cf2014-10-02 17:35:10 +02002122 * actual [size](@ref window_size) after creation.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002123 *
Camilla Berglund4188c262015-01-18 01:55:25 +01002124 * The [swap interval](@ref buffer_swap) is not set during window creation and
Camilla Berglund4591ad22014-09-18 15:03:29 +02002125 * the initial value may vary depending on driver settings and defaults.
2126 *
Camilla Berglund8282a8f2013-04-10 23:01:12 +02002127 * @param[in] width The desired width, in screen coordinates, of the window.
2128 * This must be greater than zero.
2129 * @param[in] height The desired height, in screen coordinates, of the window.
2130 * This must be greater than zero.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002131 * @param[in] title The initial, UTF-8 encoded window title.
Camilla Berglund6570d0c2016-02-23 12:26:42 +01002132 * @param[in] monitor The monitor to use for full screen mode, or `NULL` for
Camilla Berglund41bc0d12012-11-27 16:55:04 +01002133 * windowed mode.
Camilla Berglund71d2b572013-03-12 15:33:05 +01002134 * @param[in] share The window whose context to share resources with, or `NULL`
2135 * to not share resources.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002136 * @return The handle of the created window, or `NULL` if an
2137 * [error](@ref error_handling) occurred.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002138 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002139 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
2140 * GLFW_INVALID_ENUM, @ref GLFW_INVALID_VALUE, @ref GLFW_API_UNAVAILABLE, @ref
2141 * GLFW_VERSION_UNAVAILABLE, @ref GLFW_FORMAT_UNAVAILABLE and @ref
2142 * GLFW_PLATFORM_ERROR.
2143 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002144 * @remark @win32 Window creation will fail if the Microsoft GDI software
2145 * OpenGL implementation is the only one available.
Camilla Berglund07db5da2013-09-26 19:15:36 +02002146 *
Camilla Berglund20bce152016-05-30 16:04:37 +02002147 * @remark @win32 If the executable has an icon resource named `GLFW_ICON,` it
2148 * will be set as the initial icon for the window. If no such icon is present,
2149 * the `IDI_WINLOGO` icon will be used instead. To set a different icon, see
2150 * @ref glfwSetWindowIcon.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002151 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002152 * @remark @win32 The context to share resources with must not be current on
2153 * any other thread.
Camilla Berglundb19fb4c2014-12-27 21:14:41 +01002154 *
Camilla Löwyfd127d52016-12-03 19:32:00 +01002155 * @remark @macos The OS only supports forward-compatible core profile contexts
2156 * for OpenGL versions 3.2 and later. Before creating an OpenGL context of
2157 * version 3.2 or later you must set the
Camilla Löwyce161c22016-12-06 01:14:23 +01002158 * [GLFW_OPENGL_FORWARD_COMPAT](@ref GLFW_OPENGL_FORWARD_COMPAT_hint) and
2159 * [GLFW_OPENGL_PROFILE](@ref GLFW_OPENGL_PROFILE_hint) hints accordingly.
2160 * OpenGL 3.0 and 3.1 contexts are not supported at all on macOS.
Camilla Löwyfd127d52016-12-03 19:32:00 +01002161 *
Camilla Berglund8d6f2652016-10-20 00:50:54 +02002162 * @remark @macos The GLFW window has no icon, as it is not a document
Camilla Berglund71d2b572013-03-12 15:33:05 +01002163 * window, but the dock icon will be the same as the application bundle's icon.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002164 * For more information on bundles, see the
Camilla Berglunde8e05d42014-04-23 13:30:11 +02002165 * [Bundle Programming Guide](https://developer.apple.com/library/mac/documentation/CoreFoundation/Conceptual/CFBundles/)
2166 * in the Mac Developer Library.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002167 *
Camilla Löwyc50aba12017-03-01 04:09:51 +01002168 * @remark @macos The first time a window is created the menu bar is created.
2169 * If GLFW finds a `MainMenu.nib` it is loaded and assumed to contain a menu
2170 * bar. Otherwise a minimal menu bar is created manually with common commands
2171 * like Hide, Quit and About. The About entry opens a minimal about dialog
2172 * with information from the application's bundle. Menu bar creation can be
2173 * disabled entirely with the @ref GLFW_COCOA_MENUBAR init hint.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002174 *
Camilla Berglund8d6f2652016-10-20 00:50:54 +02002175 * @remark @macos On OS X 10.10 and later the window frame will not be rendered
Camilla Löwy58ceab52016-12-07 00:41:54 +01002176 * at full resolution on Retina displays unless the
2177 * [GLFW_COCOA_RETINA_FRAMEBUFFER](@ref GLFW_COCOA_RETINA_FRAMEBUFFER_hint)
2178 * hint is `GLFW_TRUE` and the `NSHighResolutionCapable` key is enabled in the
2179 * application bundle's `Info.plist`. For more information, see
Camilla Berglund821f3e62015-03-16 22:39:14 +01002180 * [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 +02002181 * in the Mac Developer Library. The GLFW test and example programs use
2182 * a custom `Info.plist` template for this, which can be found as
2183 * `CMake/MacOSXBundleInfo.plist.in` in the source tree.
Camilla Berglund821f3e62015-03-16 22:39:14 +01002184 *
Camilla Löwy46613152017-01-01 19:41:50 +01002185 * @remark @macos When activating frame autosaving with
2186 * [GLFW_COCOA_FRAME_AUTOSAVE](@ref GLFW_COCOA_FRAME_AUTOSAVE_hint), the
2187 * specified window size may be overriden by a previously saved size and
2188 * position.
2189 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002190 * @remark @x11 Some window managers will not respect the placement of
Camilla Berglunde8e05d42014-04-23 13:30:11 +02002191 * initially hidden windows.
Camilla Berglund3af1c412013-09-19 21:37:01 +02002192 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002193 * @remark @x11 Due to the asynchronous nature of X11, it may take a moment for
2194 * a window to reach its requested state. This means you may not be able to
2195 * query the final size, position or other attributes directly after window
2196 * creation.
Camilla Berglund20ed0a12015-08-12 21:31:54 +02002197 *
linkmauvebc8b0482016-10-16 15:52:39 +01002198 * @remark @wayland The window frame is currently unimplemented, as if
Camilla Löwyce161c22016-12-06 01:14:23 +01002199 * [GLFW_DECORATED](@ref GLFW_DECORATED_hint) was always set to `GLFW_FALSE`.
2200 * A compositor can still emit close, resize or maximize events, using for
2201 * example a keybind mechanism.
linkmauvebc8b0482016-10-16 15:52:39 +01002202 *
2203 * @remark @wayland A full screen window will not attempt to change the mode,
2204 * no matter what the requested size or refresh rate.
2205 *
2206 * @remark @wayland The wl_shell protocol does not support window
2207 * icons, the window will inherit the one defined in the application's
2208 * desktop file, so this function emits @ref GLFW_PLATFORM_ERROR.
2209 *
2210 * @remark @wayland Screensaver inhibition is currently unimplemented.
2211 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002212 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002213 *
2214 * @sa @ref window_creation
Camilla Berglund7e9e3212016-09-14 20:17:26 +02002215 * @sa @ref glfwDestroyWindow
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002216 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002217 * @since Added in version 3.0. Replaces `glfwOpenWindow`.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002218 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002219 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002220 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01002221GLFWAPI GLFWwindow* glfwCreateWindow(int width, int height, const char* title, GLFWmonitor* monitor, GLFWwindow* share);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002222
2223/*! @brief Destroys the specified window and its context.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002224 *
2225 * This function destroys the specified window and its context. On calling
2226 * this function, no further callbacks will be called for that window.
2227 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002228 * If the context of the specified window is current on the main thread, it is
2229 * detached before being destroyed.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002230 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002231 * @param[in] window The window to destroy.
Camilla Berglund9ad1d972012-11-22 19:08:30 +01002232 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002233 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2234 * GLFW_PLATFORM_ERROR.
2235 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002236 * @note The context of the specified window must not be current on any other
2237 * thread when this function is called.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002238 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002239 * @reentrancy This function must not be called from a callback.
Camilla Berglund44372b82014-12-17 01:31:36 +01002240 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002241 * @thread_safety This function must only be called from the main thread.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002242 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002243 * @sa @ref window_creation
Camilla Berglund7e9e3212016-09-14 20:17:26 +02002244 * @sa @ref glfwCreateWindow
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002245 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002246 * @since Added in version 3.0. Replaces `glfwCloseWindow`.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002247 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002248 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002249 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01002250GLFWAPI void glfwDestroyWindow(GLFWwindow* window);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002251
Camilla Berglund64afb192013-03-06 23:29:37 +01002252/*! @brief Checks the close flag of the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002253 *
2254 * This function returns the value of the close flag of the specified window.
2255 *
Camilla Berglund6fadf372013-03-01 13:45:12 +01002256 * @param[in] window The window to query.
Camilla Berglund64afb192013-03-06 23:29:37 +01002257 * @return The value of the close flag.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002258 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002259 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
2260 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002261 * @thread_safety This function may be called from any thread. Access is not
2262 * synchronized.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002263 *
2264 * @sa @ref window_close
2265 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002266 * @since Added in version 3.0.
Camilla Berglund6632cc72013-07-11 02:00:48 +02002267 *
Camilla Berglund6fadf372013-03-01 13:45:12 +01002268 * @ingroup window
2269 */
2270GLFWAPI int glfwWindowShouldClose(GLFWwindow* window);
2271
Camilla Berglund64afb192013-03-06 23:29:37 +01002272/*! @brief Sets the close flag of the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002273 *
2274 * This function sets the value of the close flag of the specified window.
2275 * This can be used to override the user's attempt to close the window, or
2276 * to signal that it should be closed.
2277 *
Camilla Berglund64afb192013-03-06 23:29:37 +01002278 * @param[in] window The window whose flag to change.
Camilla Berglund6fadf372013-03-01 13:45:12 +01002279 * @param[in] value The new value.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002280 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002281 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
2282 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002283 * @thread_safety This function may be called from any thread. Access is not
2284 * synchronized.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002285 *
2286 * @sa @ref window_close
2287 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002288 * @since Added in version 3.0.
Camilla Berglund6632cc72013-07-11 02:00:48 +02002289 *
Camilla Berglund6fadf372013-03-01 13:45:12 +01002290 * @ingroup window
Camilla Berglund6fadf372013-03-01 13:45:12 +01002291 */
2292GLFWAPI void glfwSetWindowShouldClose(GLFWwindow* window, int value);
2293
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002294/*! @brief Sets the title of the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002295 *
2296 * This function sets the window title, encoded as UTF-8, of the specified
2297 * window.
2298 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002299 * @param[in] window The window whose title to change.
2300 * @param[in] title The UTF-8 encoded window title.
Camilla Berglund9ad1d972012-11-22 19:08:30 +01002301 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002302 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2303 * GLFW_PLATFORM_ERROR.
2304 *
Camilla Berglund8d6f2652016-10-20 00:50:54 +02002305 * @remark @macos The window title will not be updated until the next time you
Camilla Berglund951a9582016-01-31 21:32:14 +01002306 * process events.
Camilla Berglund6412dcb2015-04-07 21:52:29 +02002307 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002308 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002309 *
2310 * @sa @ref window_title
2311 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002312 * @since Added in version 1.0.
Camilla Berglund951a9582016-01-31 21:32:14 +01002313 * @glfw3 Added window handle parameter.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002314 *
2315 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002316 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01002317GLFWAPI void glfwSetWindowTitle(GLFWwindow* window, const char* title);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002318
Camilla Berglundb823f712016-03-07 14:55:30 +01002319/*! @brief Sets the icon for the specified window.
2320 *
2321 * This function sets the icon of the specified window. If passed an array of
2322 * candidate images, those of or closest to the sizes desired by the system are
2323 * selected. If no images are specified, the window reverts to its default
2324 * icon.
2325 *
2326 * The desired image sizes varies depending on platform and system settings.
2327 * The selected images will be rescaled as needed. Good sizes include 16x16,
2328 * 32x32 and 48x48.
2329 *
2330 * @param[in] window The window whose icon to set.
2331 * @param[in] count The number of images in the specified array, or zero to
2332 * revert to the default window icon.
2333 * @param[in] images The images to create the icon from. This is ignored if
2334 * count is zero.
2335 *
2336 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2337 * GLFW_PLATFORM_ERROR.
2338 *
2339 * @pointer_lifetime The specified image data is copied before this function
2340 * returns.
2341 *
Camilla Berglund8d6f2652016-10-20 00:50:54 +02002342 * @remark @macos The GLFW window has no icon, as it is not a document
Camilla Berglund20bce152016-05-30 16:04:37 +02002343 * window, so this function does nothing. The dock icon will be the same as
2344 * the application bundle's icon. For more information on bundles, see the
Camilla Berglundb823f712016-03-07 14:55:30 +01002345 * [Bundle Programming Guide](https://developer.apple.com/library/mac/documentation/CoreFoundation/Conceptual/CFBundles/)
2346 * in the Mac Developer Library.
2347 *
linkmauvebc8b0482016-10-16 15:52:39 +01002348 * @remark @wayland The wl_shell protocol does not support icons, the window
2349 * will inherit the one defined in the application's desktop file, so this
2350 * function emits @ref GLFW_PLATFORM_ERROR.
2351 *
Camilla Berglundb823f712016-03-07 14:55:30 +01002352 * @thread_safety This function must only be called from the main thread.
2353 *
2354 * @sa @ref window_icon
2355 *
2356 * @since Added in version 3.2.
2357 *
2358 * @ingroup window
2359 */
2360GLFWAPI void glfwSetWindowIcon(GLFWwindow* window, int count, const GLFWimage* images);
2361
Camilla Berglund7c193232013-01-24 19:30:31 +01002362/*! @brief Retrieves the position of the client area of the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002363 *
2364 * This function retrieves the position, in screen coordinates, of the
2365 * upper-left corner of the client area of the specified window.
2366 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002367 * Any or all of the position arguments may be `NULL`. If an error occurs, all
2368 * non-`NULL` position arguments will be set to zero.
2369 *
Camilla Berglund7c193232013-01-24 19:30:31 +01002370 * @param[in] window The window to query.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02002371 * @param[out] xpos Where to store the x-coordinate of the upper-left corner of
2372 * the client area, or `NULL`.
2373 * @param[out] ypos Where to store the y-coordinate of the upper-left corner of
2374 * the client area, or `NULL`.
Camilla Berglund7c193232013-01-24 19:30:31 +01002375 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002376 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2377 * GLFW_PLATFORM_ERROR.
2378 *
linkmauvebc8b0482016-10-16 15:52:39 +01002379 * @remark @wayland There is no way for an application to retrieve the global
2380 * position of its windows, this function will always emit @ref
2381 * GLFW_PLATFORM_ERROR.
2382 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002383 * @thread_safety This function must only be called from the main thread.
Camilla Berglund0e205772014-03-24 11:58:35 +01002384 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002385 * @sa @ref window_pos
Camilla Berglund7e9e3212016-09-14 20:17:26 +02002386 * @sa @ref glfwSetWindowPos
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002387 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002388 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002389 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002390 * @ingroup window
Camilla Berglund7c193232013-01-24 19:30:31 +01002391 */
2392GLFWAPI void glfwGetWindowPos(GLFWwindow* window, int* xpos, int* ypos);
2393
2394/*! @brief Sets the position of the client area of the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002395 *
2396 * This function sets the position, in screen coordinates, of the upper-left
Camilla Berglund4591ad22014-09-18 15:03:29 +02002397 * corner of the client area of the specified windowed mode window. If the
2398 * window is a full screen window, this function does nothing.
Camilla Berglund8282a8f2013-04-10 23:01:12 +02002399 *
Camilla Berglundce8f97c2015-01-11 23:33:14 +01002400 * __Do not use this function__ to move an already visible window unless you
2401 * have very good reasons for doing so, as it will confuse and annoy the user.
2402 *
2403 * The window manager may put limits on what positions are allowed. GLFW
2404 * cannot and should not override these limits.
2405 *
Camilla Berglund7c193232013-01-24 19:30:31 +01002406 * @param[in] window The window to query.
2407 * @param[in] xpos The x-coordinate of the upper-left corner of the client area.
2408 * @param[in] ypos The y-coordinate of the upper-left corner of the client area.
Camilla Berglund7c193232013-01-24 19:30:31 +01002409 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002410 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2411 * GLFW_PLATFORM_ERROR.
2412 *
linkmauvebc8b0482016-10-16 15:52:39 +01002413 * @remark @wayland There is no way for an application to set the global
2414 * position of its windows, this function will always emit @ref
2415 * GLFW_PLATFORM_ERROR.
2416 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002417 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002418 *
2419 * @sa @ref window_pos
Camilla Berglund7e9e3212016-09-14 20:17:26 +02002420 * @sa @ref glfwGetWindowPos
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002421 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002422 * @since Added in version 1.0.
Camilla Berglund951a9582016-01-31 21:32:14 +01002423 * @glfw3 Added window handle parameter.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002424 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002425 * @ingroup window
Camilla Berglund7c193232013-01-24 19:30:31 +01002426 */
Camilla Berglund52f718d2013-02-12 12:01:12 +01002427GLFWAPI void glfwSetWindowPos(GLFWwindow* window, int xpos, int ypos);
Camilla Berglund7c193232013-01-24 19:30:31 +01002428
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002429/*! @brief Retrieves the size of the client area of the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002430 *
Camilla Berglund8282a8f2013-04-10 23:01:12 +02002431 * This function retrieves the size, in screen coordinates, of the client area
Camilla Berglund521fa7d2013-09-26 20:02:19 +02002432 * of the specified window. If you wish to retrieve the size of the
Camilla Berglundce8f97c2015-01-11 23:33:14 +01002433 * framebuffer of the window in pixels, see @ref glfwGetFramebufferSize.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002434 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002435 * Any or all of the size arguments may be `NULL`. If an error occurs, all
2436 * non-`NULL` size arguments will be set to zero.
2437 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002438 * @param[in] window The window whose size to retrieve.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02002439 * @param[out] width Where to store the width, in screen coordinates, of the
2440 * client area, or `NULL`.
2441 * @param[out] height Where to store the height, in screen coordinates, of the
2442 * client area, or `NULL`.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002443 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002444 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2445 * GLFW_PLATFORM_ERROR.
2446 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002447 * @thread_safety This function must only be called from the main thread.
Camilla Berglund0e205772014-03-24 11:58:35 +01002448 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002449 * @sa @ref window_size
Camilla Berglund7e9e3212016-09-14 20:17:26 +02002450 * @sa @ref glfwSetWindowSize
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002451 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002452 * @since Added in version 1.0.
Camilla Berglund951a9582016-01-31 21:32:14 +01002453 * @glfw3 Added window handle parameter.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002454 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002455 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002456 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01002457GLFWAPI void glfwGetWindowSize(GLFWwindow* window, int* width, int* height);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002458
Camilla Berglundd84772d2014-02-13 02:57:59 +01002459/*! @brief Sets the size limits of the specified window.
2460 *
2461 * This function sets the size limits of the client area of the specified
Emmanuel Gil Peyrotf0f5d9f2016-04-09 00:42:58 +01002462 * window. If the window is full screen, the size limits only take effect
Camilla Berglund6570d0c2016-02-23 12:26:42 +01002463 * once it is made windowed. If the window is not resizable, this function
2464 * does nothing.
Camilla Berglundd84772d2014-02-13 02:57:59 +01002465 *
Camilla Berglund6570d0c2016-02-23 12:26:42 +01002466 * The size limits are applied immediately to a windowed mode window and may
2467 * cause it to be resized.
Camilla Berglundd84772d2014-02-13 02:57:59 +01002468 *
Camilla Berglund12a69562016-05-04 16:28:08 +02002469 * The maximum dimensions must be greater than or equal to the minimum
2470 * dimensions and all must be greater than or equal to zero.
2471 *
Camilla Berglundd84772d2014-02-13 02:57:59 +01002472 * @param[in] window The window to set limits for.
2473 * @param[in] minwidth The minimum width, in screen coordinates, of the client
2474 * area, or `GLFW_DONT_CARE`.
2475 * @param[in] minheight The minimum height, in screen coordinates, of the
2476 * client area, or `GLFW_DONT_CARE`.
2477 * @param[in] maxwidth The maximum width, in screen coordinates, of the client
2478 * area, or `GLFW_DONT_CARE`.
2479 * @param[in] maxheight The maximum height, in screen coordinates, of the
2480 * client area, or `GLFW_DONT_CARE`.
2481 *
Camilla Berglund12a69562016-05-04 16:28:08 +02002482 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
2483 * GLFW_INVALID_VALUE and @ref GLFW_PLATFORM_ERROR.
Camilla Berglundf51cf812016-02-05 00:51:40 +01002484 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002485 * @remark If you set size limits and an aspect ratio that conflict, the
Camilla Berglundd84772d2014-02-13 02:57:59 +01002486 * results are undefined.
2487 *
linkmauvebc8b0482016-10-16 15:52:39 +01002488 * @remark @wayland The size limits will not be applied until the window is
2489 * actually resized, either by the user or by the compositor.
2490 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002491 * @thread_safety This function must only be called from the main thread.
Camilla Berglundd84772d2014-02-13 02:57:59 +01002492 *
2493 * @sa @ref window_sizelimits
Camilla Berglund7e9e3212016-09-14 20:17:26 +02002494 * @sa @ref glfwSetWindowAspectRatio
Camilla Berglundd84772d2014-02-13 02:57:59 +01002495 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002496 * @since Added in version 3.2.
Camilla Berglundd84772d2014-02-13 02:57:59 +01002497 *
2498 * @ingroup window
2499 */
2500GLFWAPI void glfwSetWindowSizeLimits(GLFWwindow* window, int minwidth, int minheight, int maxwidth, int maxheight);
2501
2502/*! @brief Sets the aspect ratio of the specified window.
2503 *
2504 * This function sets the required aspect ratio of the client area of the
Camilla Berglund6570d0c2016-02-23 12:26:42 +01002505 * specified window. If the window is full screen, the aspect ratio only takes
2506 * effect once it is made windowed. If the window is not resizable, this
Camilla Berglundd84772d2014-02-13 02:57:59 +01002507 * function does nothing.
2508 *
Camilla Berglundaf5b82a2015-10-19 16:01:42 +02002509 * The aspect ratio is specified as a numerator and a denominator and both
2510 * values must be greater than zero. For example, the common 16:9 aspect ratio
2511 * is specified as 16 and 9, respectively.
Camilla Berglundd84772d2014-02-13 02:57:59 +01002512 *
Camilla Berglundaf5b82a2015-10-19 16:01:42 +02002513 * If the numerator and denominator is set to `GLFW_DONT_CARE` then the aspect
2514 * ratio limit is disabled.
Camilla Berglundd84772d2014-02-13 02:57:59 +01002515 *
Camilla Berglund6570d0c2016-02-23 12:26:42 +01002516 * The aspect ratio is applied immediately to a windowed mode window and may
2517 * cause it to be resized.
Camilla Berglundd84772d2014-02-13 02:57:59 +01002518 *
2519 * @param[in] window The window to set limits for.
2520 * @param[in] numer The numerator of the desired aspect ratio, or
2521 * `GLFW_DONT_CARE`.
2522 * @param[in] denom The denominator of the desired aspect ratio, or
2523 * `GLFW_DONT_CARE`.
2524 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002525 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
2526 * GLFW_INVALID_VALUE and @ref GLFW_PLATFORM_ERROR.
2527 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002528 * @remark If you set size limits and an aspect ratio that conflict, the
Camilla Berglundd84772d2014-02-13 02:57:59 +01002529 * results are undefined.
2530 *
linkmauvebc8b0482016-10-16 15:52:39 +01002531 * @remark @wayland The aspect ratio will not be applied until the window is
2532 * actually resized, either by the user or by the compositor.
2533 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002534 * @thread_safety This function must only be called from the main thread.
Camilla Berglundd84772d2014-02-13 02:57:59 +01002535 *
2536 * @sa @ref window_sizelimits
Camilla Berglund7e9e3212016-09-14 20:17:26 +02002537 * @sa @ref glfwSetWindowSizeLimits
Camilla Berglundd84772d2014-02-13 02:57:59 +01002538 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002539 * @since Added in version 3.2.
Camilla Berglundd84772d2014-02-13 02:57:59 +01002540 *
2541 * @ingroup window
2542 */
2543GLFWAPI void glfwSetWindowAspectRatio(GLFWwindow* window, int numer, int denom);
2544
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002545/*! @brief Sets the size of the client area of the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002546 *
Camilla Berglund8282a8f2013-04-10 23:01:12 +02002547 * This function sets the size, in screen coordinates, of the client area of
2548 * the specified window.
2549 *
Camilla Berglund6570d0c2016-02-23 12:26:42 +01002550 * For full screen windows, this function updates the resolution of its desired
2551 * video mode and switches to the video mode closest to it, without affecting
2552 * the window's context. As the context is unaffected, the bit depths of the
2553 * framebuffer remain unchanged.
2554 *
2555 * If you wish to update the refresh rate of the desired video mode in addition
2556 * to its resolution, see @ref glfwSetWindowMonitor.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002557 *
Camilla Berglundce8f97c2015-01-11 23:33:14 +01002558 * The window manager may put limits on what sizes are allowed. GLFW cannot
2559 * and should not override these limits.
2560 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002561 * @param[in] window The window to resize.
Camilla Berglund6570d0c2016-02-23 12:26:42 +01002562 * @param[in] width The desired width, in screen coordinates, of the window
2563 * client area.
2564 * @param[in] height The desired height, in screen coordinates, of the window
2565 * client area.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002566 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002567 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2568 * GLFW_PLATFORM_ERROR.
2569 *
linkmauvebc8b0482016-10-16 15:52:39 +01002570 * @remark @wayland A full screen window will not attempt to change the mode,
2571 * no matter what the requested size.
2572 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002573 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002574 *
2575 * @sa @ref window_size
Camilla Berglund7e9e3212016-09-14 20:17:26 +02002576 * @sa @ref glfwGetWindowSize
2577 * @sa @ref glfwSetWindowMonitor
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002578 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002579 * @since Added in version 1.0.
Camilla Berglund951a9582016-01-31 21:32:14 +01002580 * @glfw3 Added window handle parameter.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002581 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002582 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002583 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01002584GLFWAPI void glfwSetWindowSize(GLFWwindow* window, int width, int height);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002585
Camilla Berglund34981632013-06-03 12:51:57 +02002586/*! @brief Retrieves the size of the framebuffer of the specified window.
2587 *
2588 * This function retrieves the size, in pixels, of the framebuffer of the
Camilla Berglund521fa7d2013-09-26 20:02:19 +02002589 * specified window. If you wish to retrieve the size of the window in screen
2590 * coordinates, see @ref glfwGetWindowSize.
Camilla Berglund34981632013-06-03 12:51:57 +02002591 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002592 * Any or all of the size arguments may be `NULL`. If an error occurs, all
2593 * non-`NULL` size arguments will be set to zero.
2594 *
Camilla Berglund34981632013-06-03 12:51:57 +02002595 * @param[in] window The window whose framebuffer to query.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02002596 * @param[out] width Where to store the width, in pixels, of the framebuffer,
2597 * or `NULL`.
2598 * @param[out] height Where to store the height, in pixels, of the framebuffer,
2599 * or `NULL`.
Camilla Berglund34981632013-06-03 12:51:57 +02002600 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002601 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2602 * GLFW_PLATFORM_ERROR.
2603 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002604 * @thread_safety This function must only be called from the main thread.
Camilla Berglund0e205772014-03-24 11:58:35 +01002605 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002606 * @sa @ref window_fbsize
Camilla Berglund7e9e3212016-09-14 20:17:26 +02002607 * @sa @ref glfwSetFramebufferSizeCallback
Camilla Berglund34981632013-06-03 12:51:57 +02002608 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002609 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002610 *
Camilla Berglund34981632013-06-03 12:51:57 +02002611 * @ingroup window
2612 */
2613GLFWAPI void glfwGetFramebufferSize(GLFWwindow* window, int* width, int* height);
2614
Camilla Berglundeb3f75e2014-03-25 21:30:13 +01002615/*! @brief Retrieves the size of the frame of the window.
2616 *
2617 * This function retrieves the size, in screen coordinates, of each edge of the
2618 * frame of the specified window. This size includes the title bar, if the
2619 * window has one. The size of the frame may vary depending on the
2620 * [window-related hints](@ref window_hints_wnd) used to create it.
2621 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002622 * Because this function retrieves the size of each window frame edge and not
2623 * the offset along a particular coordinate axis, the retrieved values will
2624 * always be zero or positive.
2625 *
2626 * Any or all of the size arguments may be `NULL`. If an error occurs, all
2627 * non-`NULL` size arguments will be set to zero.
2628 *
Camilla Berglundeb3f75e2014-03-25 21:30:13 +01002629 * @param[in] window The window whose frame size to query.
2630 * @param[out] left Where to store the size, in screen coordinates, of the left
Camilla Berglund4591ad22014-09-18 15:03:29 +02002631 * edge of the window frame, or `NULL`.
Camilla Berglundeaff0f72014-04-07 16:27:32 +02002632 * @param[out] top Where to store the size, in screen coordinates, of the top
Camilla Berglund4591ad22014-09-18 15:03:29 +02002633 * edge of the window frame, or `NULL`.
Camilla Berglundeaff0f72014-04-07 16:27:32 +02002634 * @param[out] right Where to store the size, in screen coordinates, of the
Camilla Berglund4591ad22014-09-18 15:03:29 +02002635 * right edge of the window frame, or `NULL`.
Camilla Berglundeaff0f72014-04-07 16:27:32 +02002636 * @param[out] bottom Where to store the size, in screen coordinates, of the
Camilla Berglund4591ad22014-09-18 15:03:29 +02002637 * bottom edge of the window frame, or `NULL`.
Camilla Berglundeb3f75e2014-03-25 21:30:13 +01002638 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002639 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2640 * GLFW_PLATFORM_ERROR.
2641 *
linkmauvebc8b0482016-10-16 15:52:39 +01002642 * @remark @wayland The window frame is currently unimplemented, as if
Camilla Löwyce161c22016-12-06 01:14:23 +01002643 * [GLFW_DECORATED](@ref GLFW_DECORATED_hint) was always set to `GLFW_FALSE`,
2644 * so the returned values will always be zero.
linkmauvebc8b0482016-10-16 15:52:39 +01002645 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002646 * @thread_safety This function must only be called from the main thread.
Camilla Berglundeb3f75e2014-03-25 21:30:13 +01002647 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002648 * @sa @ref window_size
2649 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002650 * @since Added in version 3.1.
Camilla Berglundeb3f75e2014-03-25 21:30:13 +01002651 *
2652 * @ingroup window
2653 */
2654GLFWAPI void glfwGetWindowFrameSize(GLFWwindow* window, int* left, int* top, int* right, int* bottom);
2655
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002656/*! @brief Iconifies the specified window.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002657 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002658 * This function iconifies (minimizes) the specified window if it was
2659 * previously restored. If the window is already iconified, this function does
2660 * nothing.
2661 *
2662 * If the specified window is a full screen window, the original monitor
2663 * resolution is restored until the window is restored.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002664 *
2665 * @param[in] window The window to iconify.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002666 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002667 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2668 * GLFW_PLATFORM_ERROR.
2669 *
linkmauvebc8b0482016-10-16 15:52:39 +01002670 * @remark @wayland There is no concept of iconification in wl_shell, this
2671 * function will always emit @ref GLFW_PLATFORM_ERROR.
2672 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002673 * @thread_safety This function must only be called from the main thread.
Camilla Berglund9ad1d972012-11-22 19:08:30 +01002674 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002675 * @sa @ref window_iconify
Camilla Berglund7e9e3212016-09-14 20:17:26 +02002676 * @sa @ref glfwRestoreWindow
2677 * @sa @ref glfwMaximizeWindow
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002678 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002679 * @since Added in version 2.1.
Camilla Berglund951a9582016-01-31 21:32:14 +01002680 * @glfw3 Added window handle parameter.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002681 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002682 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002683 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01002684GLFWAPI void glfwIconifyWindow(GLFWwindow* window);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002685
2686/*! @brief Restores the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002687 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002688 * This function restores the specified window if it was previously iconified
Camilla Berglunda10caa42015-10-13 12:50:59 +02002689 * (minimized) or maximized. If the window is already restored, this function
2690 * does nothing.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002691 *
2692 * If the specified window is a full screen window, the resolution chosen for
2693 * the window is restored on the selected monitor.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002694 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002695 * @param[in] window The window to restore.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002696 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002697 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2698 * GLFW_PLATFORM_ERROR.
2699 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002700 * @thread_safety This function must only be called from the main thread.
Camilla Berglund9ad1d972012-11-22 19:08:30 +01002701 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002702 * @sa @ref window_iconify
Camilla Berglund7e9e3212016-09-14 20:17:26 +02002703 * @sa @ref glfwIconifyWindow
2704 * @sa @ref glfwMaximizeWindow
Camilla Berglunde248fb62013-03-29 14:06:23 +01002705 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002706 * @since Added in version 2.1.
Camilla Berglund951a9582016-01-31 21:32:14 +01002707 * @glfw3 Added window handle parameter.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002708 *
Camilla Berglunde248fb62013-03-29 14:06:23 +01002709 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002710 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01002711GLFWAPI void glfwRestoreWindow(GLFWwindow* window);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002712
Camilla Berglunda10caa42015-10-13 12:50:59 +02002713/*! @brief Maximizes the specified window.
2714 *
2715 * This function maximizes the specified window if it was previously not
2716 * maximized. If the window is already maximized, this function does nothing.
2717 *
2718 * If the specified window is a full screen window, this function does nothing.
2719 *
2720 * @param[in] window The window to maximize.
2721 *
Camilla Berglundf5b71f52016-05-27 14:20:39 +02002722 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2723 * GLFW_PLATFORM_ERROR.
2724 *
Camilla Berglunda10caa42015-10-13 12:50:59 +02002725 * @par Thread Safety
2726 * This function may only be called from the main thread.
2727 *
2728 * @sa @ref window_iconify
Camilla Berglund7e9e3212016-09-14 20:17:26 +02002729 * @sa @ref glfwIconifyWindow
2730 * @sa @ref glfwRestoreWindow
Camilla Berglunda10caa42015-10-13 12:50:59 +02002731 *
2732 * @since Added in GLFW 3.2.
2733 *
2734 * @ingroup window
2735 */
2736GLFWAPI void glfwMaximizeWindow(GLFWwindow* window);
2737
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002738/*! @brief Makes the specified window visible.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002739 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002740 * This function makes the specified window visible if it was previously
Camilla Berglund8282a8f2013-04-10 23:01:12 +02002741 * hidden. If the window is already visible or is in full screen mode, this
Camilla Berglund1e9383d2012-11-23 11:41:53 +01002742 * function does nothing.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002743 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002744 * @param[in] window The window to make visible.
2745 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002746 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2747 * GLFW_PLATFORM_ERROR.
2748 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002749 * @thread_safety This function must only be called from the main thread.
Camilla Berglund9ad1d972012-11-22 19:08:30 +01002750 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002751 * @sa @ref window_hide
Camilla Berglund7e9e3212016-09-14 20:17:26 +02002752 * @sa @ref glfwHideWindow
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002753 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002754 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002755 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002756 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002757 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01002758GLFWAPI void glfwShowWindow(GLFWwindow* window);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002759
2760/*! @brief Hides the specified window.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002761 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002762 * This function hides the specified window if it was previously visible. If
Camilla Berglund8282a8f2013-04-10 23:01:12 +02002763 * the window is already hidden or is in full screen mode, this function does
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002764 * nothing.
2765 *
2766 * @param[in] window The window to hide.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002767 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002768 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2769 * GLFW_PLATFORM_ERROR.
2770 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002771 * @thread_safety This function must only be called from the main thread.
Camilla Berglund9ad1d972012-11-22 19:08:30 +01002772 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002773 * @sa @ref window_hide
Camilla Berglund7e9e3212016-09-14 20:17:26 +02002774 * @sa @ref glfwShowWindow
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002775 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002776 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002777 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002778 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002779 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01002780GLFWAPI void glfwHideWindow(GLFWwindow* window);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002781
Camilla Berglundbaf57442016-02-21 15:42:49 +01002782/*! @brief Brings the specified window to front and sets input focus.
2783 *
2784 * This function brings the specified window to front and sets input focus.
2785 * The window should already be visible and not iconified.
2786 *
2787 * By default, both windowed and full screen mode windows are focused when
Camilla Löwyce161c22016-12-06 01:14:23 +01002788 * initially created. Set the [GLFW_FOCUSED](@ref GLFW_FOCUSED_hint) to
2789 * disable this behavior.
Camilla Berglundbaf57442016-02-21 15:42:49 +01002790 *
2791 * __Do not use this function__ to steal focus from other applications unless
2792 * you are certain that is what the user wants. Focus stealing can be
2793 * extremely disruptive.
2794 *
Camilla Löwybaa9cd82017-05-11 14:36:56 +02002795 * For a less disruptive way of getting the user's attention, see
2796 * [attention requests](@ref window_attention).
2797 *
Camilla Berglundbaf57442016-02-21 15:42:49 +01002798 * @param[in] window The window to give input focus.
2799 *
2800 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2801 * GLFW_PLATFORM_ERROR.
2802 *
linkmauvebc8b0482016-10-16 15:52:39 +01002803 * @remark @wayland It is not possible for an application to bring its windows
2804 * to front, this function will always emit @ref GLFW_PLATFORM_ERROR.
2805 *
Camilla Berglundbaf57442016-02-21 15:42:49 +01002806 * @thread_safety This function must only be called from the main thread.
2807 *
2808 * @sa @ref window_focus
Camilla Löwybaa9cd82017-05-11 14:36:56 +02002809 * @sa @ref window_attention
Camilla Berglundbaf57442016-02-21 15:42:49 +01002810 *
2811 * @since Added in version 3.2.
2812 *
2813 * @ingroup window
2814 */
2815GLFWAPI void glfwFocusWindow(GLFWwindow* window);
2816
Camilla Löwybaa9cd82017-05-11 14:36:56 +02002817/*! @brief Requests user attention to the specified window.
Felipe Ferreira da Silva412eb6a2017-03-21 10:02:57 -03002818 *
Camilla Löwybaa9cd82017-05-11 14:36:56 +02002819 * This function requests user attention to the specified window. On
2820 * platforms where this is not supported, attention is requested to the
2821 * application as a whole.
Felipe Ferreira da Silva412eb6a2017-03-21 10:02:57 -03002822 *
Camilla Löwybaa9cd82017-05-11 14:36:56 +02002823 * Once the user has given attention, usually by focusing the window or
2824 * application, the system will end the request automatically.
2825 *
2826 * @param[in] window The window to request attention to.
Felipe Ferreira da Silva412eb6a2017-03-21 10:02:57 -03002827 *
2828 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2829 * GLFW_PLATFORM_ERROR.
2830 *
Camilla Löwybaa9cd82017-05-11 14:36:56 +02002831 * @remark @macos Attention is requested to the application as a whole, not the
2832 * specific window.
Felipe Ferreira da Silva412eb6a2017-03-21 10:02:57 -03002833 *
2834 * @thread_safety This function must only be called from the main thread.
2835 *
Camilla Löwybaa9cd82017-05-11 14:36:56 +02002836 * @sa @ref window_attention
2837 *
Felipe Ferreira da Silva412eb6a2017-03-21 10:02:57 -03002838 * @since Added in version 3.3.
2839 *
2840 * @ingroup window
2841 */
2842GLFWAPI void glfwRequestWindowAttention(GLFWwindow* window);
2843
Camilla Berglund8282a8f2013-04-10 23:01:12 +02002844/*! @brief Returns the monitor that the window uses for full screen mode.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002845 *
2846 * This function returns the handle of the monitor that the specified window is
Camilla Berglund8282a8f2013-04-10 23:01:12 +02002847 * in full screen on.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002848 *
Camilla Berglund5f68e122012-11-27 17:07:28 +01002849 * @param[in] window The window to query.
Camilla Berglund999f3552016-08-17 16:48:22 +02002850 * @return The monitor, or `NULL` if the window is in windowed mode or an
2851 * [error](@ref error_handling) occurred.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002852 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002853 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
2854 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002855 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002856 *
2857 * @sa @ref window_monitor
Camilla Berglund7e9e3212016-09-14 20:17:26 +02002858 * @sa @ref glfwSetWindowMonitor
Camilla Berglund4591ad22014-09-18 15:03:29 +02002859 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002860 * @since Added in version 3.0.
Camilla Berglund0e205772014-03-24 11:58:35 +01002861 *
Camilla Berglund5f68e122012-11-27 17:07:28 +01002862 * @ingroup window
Camilla Berglund41bc0d12012-11-27 16:55:04 +01002863 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01002864GLFWAPI GLFWmonitor* glfwGetWindowMonitor(GLFWwindow* window);
Camilla Berglund41bc0d12012-11-27 16:55:04 +01002865
Camilla Berglund6570d0c2016-02-23 12:26:42 +01002866/*! @brief Sets the mode, monitor, video mode and placement of a window.
2867 *
2868 * This function sets the monitor that the window uses for full screen mode or,
2869 * if the monitor is `NULL`, makes it windowed mode.
2870 *
2871 * When setting a monitor, this function updates the width, height and refresh
2872 * rate of the desired video mode and switches to the video mode closest to it.
2873 * The window position is ignored when setting a monitor.
2874 *
2875 * When the monitor is `NULL`, the position, width and height are used to
2876 * place the window client area. The refresh rate is ignored when no monitor
2877 * is specified.
2878 *
2879 * If you only wish to update the resolution of a full screen window or the
2880 * size of a windowed mode window, see @ref glfwSetWindowSize.
2881 *
2882 * When a window transitions from full screen to windowed mode, this function
2883 * restores any previous window settings such as whether it is decorated,
linkmauvebc8b0482016-10-16 15:52:39 +01002884 * floating, resizable, has size or aspect ratio limits, etc.
Camilla Berglund6570d0c2016-02-23 12:26:42 +01002885 *
2886 * @param[in] window The window whose monitor, size or video mode to set.
2887 * @param[in] monitor The desired monitor, or `NULL` to set windowed mode.
2888 * @param[in] xpos The desired x-coordinate of the upper-left corner of the
2889 * client area.
2890 * @param[in] ypos The desired y-coordinate of the upper-left corner of the
2891 * client area.
2892 * @param[in] width The desired with, in screen coordinates, of the client area
2893 * or video mode.
2894 * @param[in] height The desired height, in screen coordinates, of the client
2895 * area or video mode.
Camilla Berglund325729d2016-05-22 14:25:04 +02002896 * @param[in] refreshRate The desired refresh rate, in Hz, of the video mode,
2897 * or `GLFW_DONT_CARE`.
Camilla Berglund6570d0c2016-02-23 12:26:42 +01002898 *
2899 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
2900 * GLFW_PLATFORM_ERROR.
2901 *
Camilla Berglundec171612016-10-28 06:20:20 +02002902 * @remark The OpenGL or OpenGL ES context will not be destroyed or otherwise
2903 * affected by any resizing or mode switching, although you may need to update
2904 * your viewport if the framebuffer size has changed.
2905 *
linkmauvebc8b0482016-10-16 15:52:39 +01002906 * @remark @wayland The desired window position is ignored, as there is no way
2907 * for an application to set this property.
2908 *
2909 * @remark @wayland Setting the window to full screen will not attempt to
2910 * change the mode, no matter what the requested size or refresh rate.
2911 *
Camilla Berglund6570d0c2016-02-23 12:26:42 +01002912 * @thread_safety This function must only be called from the main thread.
2913 *
2914 * @sa @ref window_monitor
2915 * @sa @ref window_full_screen
Camilla Berglund7e9e3212016-09-14 20:17:26 +02002916 * @sa @ref glfwGetWindowMonitor
2917 * @sa @ref glfwSetWindowSize
Camilla Berglund6570d0c2016-02-23 12:26:42 +01002918 *
2919 * @since Added in version 3.2.
2920 *
2921 * @ingroup window
2922 */
2923GLFWAPI void glfwSetWindowMonitor(GLFWwindow* window, GLFWmonitor* monitor, int xpos, int ypos, int width, int height, int refreshRate);
2924
Camilla Berglundad1f6f02013-05-27 15:30:32 +02002925/*! @brief Returns an attribute of the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002926 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02002927 * This function returns the value of an attribute of the specified window or
2928 * its OpenGL or OpenGL ES context.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002929 *
Camilla Berglund1e9383d2012-11-23 11:41:53 +01002930 * @param[in] window The window to query.
Camilla Berglund1f5f20e2013-05-27 17:10:34 +02002931 * @param[in] attrib The [window attribute](@ref window_attribs) whose value to
2932 * return.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002933 * @return The value of the attribute, or zero if an
2934 * [error](@ref error_handling) occurred.
Camilla Berglund1e9383d2012-11-23 11:41:53 +01002935 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01002936 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
2937 * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR.
2938 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002939 * @remark Framebuffer related hints are not window attributes. See @ref
Camilla Berglund59abeeb2015-04-07 14:34:12 +02002940 * window_attribs_fb for more information.
2941 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002942 * @remark Zero is a valid value for many window and context related
Camilla Berglund59abeeb2015-04-07 14:34:12 +02002943 * attributes so you cannot use a return value of zero as an indication of
2944 * errors. However, this function should not fail as long as it is passed
2945 * valid arguments and the library has been [initialized](@ref intro_init).
2946 *
Camilla Berglund951a9582016-01-31 21:32:14 +01002947 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02002948 *
2949 * @sa @ref window_attribs
Camilla Löwy9e560992016-09-30 01:52:22 +02002950 * @sa @ref glfwSetWindowAttrib
Camilla Berglund4591ad22014-09-18 15:03:29 +02002951 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01002952 * @since Added in version 3.0. Replaces `glfwGetWindowParam` and
Camilla Berglund4188c262015-01-18 01:55:25 +01002953 * `glfwGetGLVersion`.
Camilla Berglund0e205772014-03-24 11:58:35 +01002954 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002955 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002956 */
Camilla Berglundad1f6f02013-05-27 15:30:32 +02002957GLFWAPI int glfwGetWindowAttrib(GLFWwindow* window, int attrib);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002958
Camilla Löwy9e560992016-09-30 01:52:22 +02002959/*! @brief Sets an attribute of the specified window.
2960 *
2961 * This function sets the value of an attribute of the specified window.
2962 *
2963 * The supported attributes are [GLFW_DECORATED](@ref GLFW_DECORATED_attrib),
2964 * [GLFW_RESIZABLE](@ref GLFW_RESIZABLE_attrib),
2965 * [GLFW_FLOATING](@ref GLFW_FLOATING_attrib) and
2966 * [GLFW_AUTO_ICONIFY](@ref GLFW_AUTO_ICONIFY_attrib).
2967 *
2968 * Some of these attributes are ignored for full screen windows. The new
2969 * value will take effect if the window is later made windowed.
2970 *
2971 * Some of these attributes are ignored for windowed mode windows. The new
2972 * value will take effect if the window is later made full screen.
2973 *
2974 * @param[in] window The window to set the attribute for.
2975 * @param[in] attrib A supported window attribute.
2976 * @param[in] value `GLFW_TRUE` or `GLFW_FALSE`.
2977 *
2978 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
2979 * GLFW_INVALID_ENUM, @ref GLFW_INVALID_VALUE and @ref GLFW_PLATFORM_ERROR.
2980 *
2981 * @remark Calling @ref glfwGetWindowAttrib will always return the latest
2982 * value, even if that value is ignored by the current mode of the window.
2983 *
2984 * @thread_safety This function must only be called from the main thread.
2985 *
2986 * @sa @ref window_attribs
2987 * @sa @ref glfwGetWindowAttrib
2988 *
2989 * @since Added in version 3.3.
2990 *
2991 * @ingroup window
2992 */
2993GLFWAPI void glfwSetWindowAttrib(GLFWwindow* window, int attrib, int value);
2994
Camilla Berglundbce2cd62012-11-22 16:38:24 +01002995/*! @brief Sets the user pointer of the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01002996 *
2997 * This function sets the user-defined pointer of the specified window. The
2998 * current value is retained until the window is destroyed. The initial value
2999 * is `NULL`.
3000 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003001 * @param[in] window The window whose pointer to set.
3002 * @param[in] pointer The new value.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003003 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003004 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
3005 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003006 * @thread_safety This function may be called from any thread. Access is not
3007 * synchronized.
Camilla Berglund0e205772014-03-24 11:58:35 +01003008 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003009 * @sa @ref window_userptr
Camilla Berglund7e9e3212016-09-14 20:17:26 +02003010 * @sa @ref glfwGetWindowUserPointer
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003011 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003012 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003013 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003014 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003015 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01003016GLFWAPI void glfwSetWindowUserPointer(GLFWwindow* window, void* pointer);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003017
3018/*! @brief Returns the user pointer of the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003019 *
3020 * This function returns the current value of the user-defined pointer of the
3021 * specified window. The initial value is `NULL`.
3022 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003023 * @param[in] window The window whose pointer to return.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003024 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003025 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
3026 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003027 * @thread_safety This function may be called from any thread. Access is not
3028 * synchronized.
Camilla Berglund0e205772014-03-24 11:58:35 +01003029 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003030 * @sa @ref window_userptr
Camilla Berglund7e9e3212016-09-14 20:17:26 +02003031 * @sa @ref glfwSetWindowUserPointer
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003032 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003033 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003034 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003035 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003036 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01003037GLFWAPI void* glfwGetWindowUserPointer(GLFWwindow* window);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003038
Camilla Berglund1a3d47d2012-11-30 13:56:42 +01003039/*! @brief Sets the position callback for the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003040 *
3041 * This function sets the position callback of the specified window, which is
3042 * called when the window is moved. The callback is provided with the screen
3043 * position of the upper-left corner of the client area of the window.
3044 *
Camilla Berglund1a3d47d2012-11-30 13:56:42 +01003045 * @param[in] window The window whose callback to set.
Camilla Berglund71d2b572013-03-12 15:33:05 +01003046 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
Camilla Berglund1a3d47d2012-11-30 13:56:42 +01003047 * callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02003048 * @return The previously set callback, or `NULL` if no callback was set or the
3049 * library had not been [initialized](@ref intro_init).
Camilla Berglund11a27de2013-04-08 21:21:21 +02003050 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003051 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
3052 *
linkmauvebc8b0482016-10-16 15:52:39 +01003053 * @remark @wayland This callback will never be called, as there is no way for
3054 * an application to know its global position.
3055 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003056 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003057 *
3058 * @sa @ref window_pos
3059 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003060 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003061 *
Camilla Berglund1a3d47d2012-11-30 13:56:42 +01003062 * @ingroup window
3063 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02003064GLFWAPI GLFWwindowposfun glfwSetWindowPosCallback(GLFWwindow* window, GLFWwindowposfun cbfun);
Camilla Berglund1a3d47d2012-11-30 13:56:42 +01003065
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003066/*! @brief Sets the size callback for the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003067 *
3068 * This function sets the size callback of the specified window, which is
3069 * called when the window is resized. The callback is provided with the size,
Camilla Berglund8282a8f2013-04-10 23:01:12 +02003070 * in screen coordinates, of the client area of the window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003071 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003072 * @param[in] window The window whose callback to set.
Camilla Berglund71d2b572013-03-12 15:33:05 +01003073 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003074 * callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02003075 * @return The previously set callback, or `NULL` if no callback was set or the
3076 * library had not been [initialized](@ref intro_init).
Camilla Berglund11a27de2013-04-08 21:21:21 +02003077 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003078 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
3079 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003080 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003081 *
3082 * @sa @ref window_size
3083 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003084 * @since Added in version 1.0.
3085 * @glfw3 Added window handle parameter and return value.
Camilla Berglund0e205772014-03-24 11:58:35 +01003086 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003087 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003088 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02003089GLFWAPI GLFWwindowsizefun glfwSetWindowSizeCallback(GLFWwindow* window, GLFWwindowsizefun cbfun);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003090
3091/*! @brief Sets the close callback for the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003092 *
3093 * This function sets the close callback of the specified window, which is
3094 * called when the user attempts to close the window, for example by clicking
3095 * the close widget in the title bar.
3096 *
3097 * The close flag is set before this callback is called, but you can modify it
3098 * at any time with @ref glfwSetWindowShouldClose.
3099 *
Camilla Berglund5fd409b2013-06-05 17:53:13 +02003100 * The close callback is not triggered by @ref glfwDestroyWindow.
3101 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003102 * @param[in] window The window whose callback to set.
Camilla Berglund71d2b572013-03-12 15:33:05 +01003103 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003104 * callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02003105 * @return The previously set callback, or `NULL` if no callback was set or the
3106 * library had not been [initialized](@ref intro_init).
Camilla Berglund11a27de2013-04-08 21:21:21 +02003107 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003108 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
3109 *
Camilla Berglund8d6f2652016-10-20 00:50:54 +02003110 * @remark @macos Selecting Quit from the application menu will trigger the
3111 * close callback for all windows.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003112 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003113 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003114 *
3115 * @sa @ref window_close
3116 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003117 * @since Added in version 2.5.
3118 * @glfw3 Added window handle parameter and return value.
Camilla Berglund0e205772014-03-24 11:58:35 +01003119 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003120 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003121 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02003122GLFWAPI GLFWwindowclosefun glfwSetWindowCloseCallback(GLFWwindow* window, GLFWwindowclosefun cbfun);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003123
3124/*! @brief Sets the refresh callback for the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003125 *
3126 * This function sets the refresh callback of the specified window, which is
3127 * called when the client area of the window needs to be redrawn, for example
3128 * if the window has been exposed after having been covered by another window.
3129 *
linkmauvebc8b0482016-10-16 15:52:39 +01003130 * On compositing window systems such as Aero, Compiz, Aqua or Wayland, where
3131 * the window contents are saved off-screen, this callback may be called only
3132 * very infrequently or never at all.
Camilla Berglund8282a8f2013-04-10 23:01:12 +02003133 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003134 * @param[in] window The window whose callback to set.
Camilla Berglund71d2b572013-03-12 15:33:05 +01003135 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003136 * callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02003137 * @return The previously set callback, or `NULL` if no callback was set or the
3138 * library had not been [initialized](@ref intro_init).
Camilla Berglund11a27de2013-04-08 21:21:21 +02003139 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003140 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
3141 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003142 * @thread_safety This function must only be called from the main thread.
Camilla Berglund0e205772014-03-24 11:58:35 +01003143 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003144 * @sa @ref window_refresh
3145 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003146 * @since Added in version 2.5.
3147 * @glfw3 Added window handle parameter and return value.
Camilla Berglunda3ff29a2012-12-02 15:47:10 +01003148 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003149 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003150 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02003151GLFWAPI GLFWwindowrefreshfun glfwSetWindowRefreshCallback(GLFWwindow* window, GLFWwindowrefreshfun cbfun);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003152
3153/*! @brief Sets the focus callback for the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003154 *
3155 * This function sets the focus callback of the specified window, which is
Camilla Berglund4188c262015-01-18 01:55:25 +01003156 * called when the window gains or loses input focus.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003157 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003158 * After the focus callback is called for a window that lost input focus,
3159 * synthetic key and mouse button release events will be generated for all such
3160 * that had been pressed. For more information, see @ref glfwSetKeyCallback
3161 * and @ref glfwSetMouseButtonCallback.
Camilla Berglund4538a522013-04-24 19:49:46 +02003162 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003163 * @param[in] window The window whose callback to set.
Camilla Berglund71d2b572013-03-12 15:33:05 +01003164 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003165 * callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02003166 * @return The previously set callback, or `NULL` if no callback was set or the
3167 * library had not been [initialized](@ref intro_init).
Camilla Berglund11a27de2013-04-08 21:21:21 +02003168 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003169 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
3170 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003171 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003172 *
3173 * @sa @ref window_focus
3174 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003175 * @since Added in version 3.0.
Camilla Berglund0e205772014-03-24 11:58:35 +01003176 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003177 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003178 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02003179GLFWAPI GLFWwindowfocusfun glfwSetWindowFocusCallback(GLFWwindow* window, GLFWwindowfocusfun cbfun);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003180
3181/*! @brief Sets the iconify callback for the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003182 *
3183 * This function sets the iconification callback of the specified window, which
3184 * is called when the window is iconified or restored.
3185 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003186 * @param[in] window The window whose callback to set.
Camilla Berglund71d2b572013-03-12 15:33:05 +01003187 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003188 * callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02003189 * @return The previously set callback, or `NULL` if no callback was set or the
3190 * library had not been [initialized](@ref intro_init).
Camilla Berglund11a27de2013-04-08 21:21:21 +02003191 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003192 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
3193 *
linkmauvebc8b0482016-10-16 15:52:39 +01003194 * @remark @wayland The wl_shell protocol has no concept of iconification,
3195 * this callback will never be called.
3196 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003197 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003198 *
3199 * @sa @ref window_iconify
3200 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003201 * @since Added in version 3.0.
Camilla Berglund0e205772014-03-24 11:58:35 +01003202 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003203 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003204 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02003205GLFWAPI GLFWwindowiconifyfun glfwSetWindowIconifyCallback(GLFWwindow* window, GLFWwindowiconifyfun cbfun);
Camilla Berglund135194a2010-09-09 18:15:32 +02003206
Camilla Berglundc156b502016-06-16 13:09:28 +02003207/*! @brief Sets the maximize callback for the specified window.
3208 *
3209 * This function sets the maximization callback of the specified window, which
3210 * is called when the window is maximized or restored.
3211 *
3212 * @param[in] window The window whose callback to set.
3213 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
3214 * callback.
3215 * @return The previously set callback, or `NULL` if no callback was set or the
3216 * library had not been [initialized](@ref intro_init).
3217 *
3218 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
3219 *
3220 * @thread_safety This function must only be called from the main thread.
3221 *
3222 * @sa @ref window_maximize
3223 *
3224 * @since Added in version 3.3.
3225 *
3226 * @ingroup window
3227 */
3228GLFWAPI GLFWwindowmaximizefun glfwSetWindowMaximizeCallback(GLFWwindow* window, GLFWwindowmaximizefun cbfun);
3229
Camilla Berglund34981632013-06-03 12:51:57 +02003230/*! @brief Sets the framebuffer resize callback for the specified window.
3231 *
3232 * This function sets the framebuffer resize callback of the specified window,
3233 * which is called when the framebuffer of the specified window is resized.
3234 *
3235 * @param[in] window The window whose callback to set.
3236 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
3237 * callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02003238 * @return The previously set callback, or `NULL` if no callback was set or the
3239 * library had not been [initialized](@ref intro_init).
Camilla Berglund34981632013-06-03 12:51:57 +02003240 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003241 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
3242 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003243 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003244 *
3245 * @sa @ref window_fbsize
3246 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003247 * @since Added in version 3.0.
Camilla Berglund0e205772014-03-24 11:58:35 +01003248 *
Camilla Berglund34981632013-06-03 12:51:57 +02003249 * @ingroup window
3250 */
3251GLFWAPI GLFWframebuffersizefun glfwSetFramebufferSizeCallback(GLFWwindow* window, GLFWframebuffersizefun cbfun);
3252
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003253/*! @brief Processes all pending events.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003254 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003255 * This function processes only those events that are already in the event
3256 * queue and then returns immediately. Processing events will cause the window
3257 * and input callbacks associated with those events to be called.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003258 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003259 * On some platforms, a window move, resize or menu operation will cause event
3260 * processing to block. This is due to how event processing is designed on
3261 * those platforms. You can use the
3262 * [window refresh callback](@ref window_refresh) to redraw the contents of
3263 * your window when necessary during such operations.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02003264 *
Camilla Löwy766a9dc2016-12-06 23:26:53 +01003265 * Do not assume that callbacks you set will _only_ be called in response to
3266 * event processing functions like this one. While it is necessary to poll for
3267 * events, window systems that require GLFW to register callbacks of its own
3268 * can pass events to GLFW in response to many window system function calls.
3269 * GLFW will pass those events on to the application callbacks before
3270 * returning.
Camilla Berglund401033c2013-03-12 19:17:07 +01003271 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003272 * Event processing is not required for joystick input to work.
Camilla Berglund9ad1d972012-11-22 19:08:30 +01003273 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003274 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
3275 * GLFW_PLATFORM_ERROR.
3276 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003277 * @reentrancy This function must not be called from a callback.
Camilla Berglundb48128f2013-02-14 18:49:03 +01003278 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003279 * @thread_safety This function must only be called from the main thread.
Camilla Berglund948cc042013-04-16 02:02:22 +02003280 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003281 * @sa @ref events
Camilla Berglund7e9e3212016-09-14 20:17:26 +02003282 * @sa @ref glfwWaitEvents
3283 * @sa @ref glfwWaitEventsTimeout
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003284 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003285 * @since Added in version 1.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003286 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003287 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003288 */
Camilla Berglund9a716692010-09-08 16:40:43 +02003289GLFWAPI void glfwPollEvents(void);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003290
Camilla Berglund4591ad22014-09-18 15:03:29 +02003291/*! @brief Waits until events are queued and processes them.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003292 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003293 * This function puts the calling thread to sleep until at least one event is
3294 * available in the event queue. Once one or more events are available,
3295 * it behaves exactly like @ref glfwPollEvents, i.e. the events in the queue
3296 * are processed and the function then returns immediately. Processing events
3297 * will cause the window and input callbacks associated with those events to be
3298 * called.
Camilla Berglund948cc042013-04-16 02:02:22 +02003299 *
3300 * Since not all events are associated with callbacks, this function may return
3301 * without a callback having been called even if you are monitoring all
3302 * callbacks.
3303 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003304 * On some platforms, a window move, resize or menu operation will cause event
3305 * processing to block. This is due to how event processing is designed on
3306 * those platforms. You can use the
3307 * [window refresh callback](@ref window_refresh) to redraw the contents of
3308 * your window when necessary during such operations.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003309 *
Camilla Löwy766a9dc2016-12-06 23:26:53 +01003310 * Do not assume that callbacks you set will _only_ be called in response to
3311 * event processing functions like this one. While it is necessary to poll for
3312 * events, window systems that require GLFW to register callbacks of its own
3313 * can pass events to GLFW in response to many window system function calls.
3314 * GLFW will pass those events on to the application callbacks before
3315 * returning.
Camilla Berglund4188c262015-01-18 01:55:25 +01003316 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003317 * If no windows exist, this function returns immediately. For synchronization
3318 * of threads in applications that do not create windows, use your threading
3319 * library of choice.
Camilla Berglund2ae46fa2013-12-04 19:12:24 +01003320 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003321 * Event processing is not required for joystick input to work.
Camilla Berglund9ad1d972012-11-22 19:08:30 +01003322 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003323 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
3324 * GLFW_PLATFORM_ERROR.
3325 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003326 * @reentrancy This function must not be called from a callback.
Camilla Berglund44372b82014-12-17 01:31:36 +01003327 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003328 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003329 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003330 * @sa @ref events
Camilla Berglund7e9e3212016-09-14 20:17:26 +02003331 * @sa @ref glfwPollEvents
3332 * @sa @ref glfwWaitEventsTimeout
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003333 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003334 * @since Added in version 2.5.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003335 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003336 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003337 */
Camilla Berglund9a716692010-09-08 16:40:43 +02003338GLFWAPI void glfwWaitEvents(void);
Camilla Berglund135194a2010-09-09 18:15:32 +02003339
Camilla Berglund56208952016-02-02 21:11:16 +01003340/*! @brief Waits with timeout until events are queued and processes them.
3341 *
3342 * This function puts the calling thread to sleep until at least one event is
3343 * available in the event queue, or until the specified timeout is reached. If
3344 * one or more events are available, it behaves exactly like @ref
3345 * glfwPollEvents, i.e. the events in the queue are processed and the function
3346 * then returns immediately. Processing events will cause the window and input
3347 * callbacks associated with those events to be called.
3348 *
3349 * The timeout value must be a positive finite number.
3350 *
3351 * Since not all events are associated with callbacks, this function may return
3352 * without a callback having been called even if you are monitoring all
3353 * callbacks.
3354 *
3355 * On some platforms, a window move, resize or menu operation will cause event
3356 * processing to block. This is due to how event processing is designed on
3357 * those platforms. You can use the
3358 * [window refresh callback](@ref window_refresh) to redraw the contents of
3359 * your window when necessary during such operations.
3360 *
Camilla Löwy766a9dc2016-12-06 23:26:53 +01003361 * Do not assume that callbacks you set will _only_ be called in response to
3362 * event processing functions like this one. While it is necessary to poll for
3363 * events, window systems that require GLFW to register callbacks of its own
3364 * can pass events to GLFW in response to many window system function calls.
3365 * GLFW will pass those events on to the application callbacks before
3366 * returning.
Camilla Berglund56208952016-02-02 21:11:16 +01003367 *
3368 * If no windows exist, this function returns immediately. For synchronization
3369 * of threads in applications that do not create windows, use your threading
3370 * library of choice.
3371 *
3372 * Event processing is not required for joystick input to work.
3373 *
3374 * @param[in] timeout The maximum amount of time, in seconds, to wait.
3375 *
3376 * @reentrancy This function must not be called from a callback.
3377 *
3378 * @thread_safety This function must only be called from the main thread.
3379 *
3380 * @sa @ref events
Camilla Berglund7e9e3212016-09-14 20:17:26 +02003381 * @sa @ref glfwPollEvents
3382 * @sa @ref glfwWaitEvents
Camilla Berglund56208952016-02-02 21:11:16 +01003383 *
3384 * @since Added in version 3.2.
3385 *
3386 * @ingroup window
3387 */
3388GLFWAPI void glfwWaitEventsTimeout(double timeout);
3389
Camilla Berglund1ccc2322014-02-10 18:16:58 +01003390/*! @brief Posts an empty event to the event queue.
3391 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003392 * This function posts an empty event from the current thread to the event
Camilla Berglund73abf8a2016-07-06 13:06:59 +02003393 * queue, causing @ref glfwWaitEvents or @ref glfwWaitEventsTimeout to return.
Camilla Berglund1ccc2322014-02-10 18:16:58 +01003394 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003395 * If no windows exist, this function returns immediately. For synchronization
3396 * of threads in applications that do not create windows, use your threading
3397 * library of choice.
Camilla Berglund1ccc2322014-02-10 18:16:58 +01003398 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003399 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
3400 * GLFW_PLATFORM_ERROR.
3401 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003402 * @thread_safety This function may be called from any thread.
Camilla Berglund1ccc2322014-02-10 18:16:58 +01003403 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003404 * @sa @ref events
Camilla Berglund7e9e3212016-09-14 20:17:26 +02003405 * @sa @ref glfwWaitEvents
3406 * @sa @ref glfwWaitEventsTimeout
Camilla Berglund1ccc2322014-02-10 18:16:58 +01003407 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003408 * @since Added in version 3.1.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003409 *
Camilla Berglund1ccc2322014-02-10 18:16:58 +01003410 * @ingroup window
3411 */
3412GLFWAPI void glfwPostEmptyEvent(void);
3413
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003414/*! @brief Returns the value of an input option for the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003415 *
Camilla Berglund95654cf2014-10-02 17:35:10 +02003416 * This function returns the value of an input option for the specified window.
Camilla Löwy46393072017-02-20 13:45:11 +01003417 * The mode must be one of @ref GLFW_CURSOR, @ref GLFW_STICKY_KEYS or
3418 * @ref GLFW_STICKY_MOUSE_BUTTONS.
Camilla Berglund95654cf2014-10-02 17:35:10 +02003419 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003420 * @param[in] window The window to query.
Camilla Berglund9264b5d2013-04-26 14:29:55 +02003421 * @param[in] mode One of `GLFW_CURSOR`, `GLFW_STICKY_KEYS` or
Camilla Berglund39fe1f12013-03-12 19:39:36 +01003422 * `GLFW_STICKY_MOUSE_BUTTONS`.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003423 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003424 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
3425 * GLFW_INVALID_ENUM.
3426 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003427 * @thread_safety This function must only be called from the main thread.
Camilla Berglund0e205772014-03-24 11:58:35 +01003428 *
Camilla Berglund7e9e3212016-09-14 20:17:26 +02003429 * @sa @ref glfwSetInputMode
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003430 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003431 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003432 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003433 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003434 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01003435GLFWAPI int glfwGetInputMode(GLFWwindow* window, int mode);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003436
3437/*! @brief Sets an input option for the specified window.
Camilla Berglund95654cf2014-10-02 17:35:10 +02003438 *
3439 * This function sets an input mode option for the specified window. The mode
Camilla Löwy46393072017-02-20 13:45:11 +01003440 * must be one of @ref GLFW_CURSOR, @ref GLFW_STICKY_KEYS or
3441 * @ref GLFW_STICKY_MOUSE_BUTTONS.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003442 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003443 * If the mode is `GLFW_CURSOR`, the value must be one of the following cursor
Camilla Berglund39fe1f12013-03-12 19:39:36 +01003444 * modes:
Camilla Berglund13ccf7d2013-04-07 13:46:38 +02003445 * - `GLFW_CURSOR_NORMAL` makes the cursor visible and behaving normally.
3446 * - `GLFW_CURSOR_HIDDEN` makes the cursor invisible when it is over the client
Camilla Berglund4188c262015-01-18 01:55:25 +01003447 * area of the window but does not restrict the cursor from leaving.
Camilla Berglunda18b1872013-12-05 03:27:12 +01003448 * - `GLFW_CURSOR_DISABLED` hides and grabs the cursor, providing virtual
3449 * and unlimited cursor movement. This is useful for implementing for
3450 * example 3D camera controls.
Camilla Berglund39fe1f12013-03-12 19:39:36 +01003451 *
Camilla Berglund0eccf752015-08-23 19:30:04 +02003452 * If the mode is `GLFW_STICKY_KEYS`, the value must be either `GLFW_TRUE` to
3453 * enable sticky keys, or `GLFW_FALSE` to disable it. If sticky keys are
Camilla Berglund95654cf2014-10-02 17:35:10 +02003454 * enabled, a key press will ensure that @ref glfwGetKey returns `GLFW_PRESS`
3455 * the next time it is called even if the key had been released before the
3456 * call. This is useful when you are only interested in whether keys have been
3457 * pressed but not when or in which order.
Camilla Berglund39fe1f12013-03-12 19:39:36 +01003458 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003459 * If the mode is `GLFW_STICKY_MOUSE_BUTTONS`, the value must be either
Camilla Berglund0eccf752015-08-23 19:30:04 +02003460 * `GLFW_TRUE` to enable sticky mouse buttons, or `GLFW_FALSE` to disable it.
3461 * If sticky mouse buttons are enabled, a mouse button press will ensure that
3462 * @ref glfwGetMouseButton returns `GLFW_PRESS` the next time it is called even
3463 * if the mouse button had been released before the call. This is useful when
3464 * you are only interested in whether mouse buttons have been pressed but not
3465 * when or in which order.
Camilla Berglund95654cf2014-10-02 17:35:10 +02003466 *
3467 * @param[in] window The window whose input mode to set.
3468 * @param[in] mode One of `GLFW_CURSOR`, `GLFW_STICKY_KEYS` or
3469 * `GLFW_STICKY_MOUSE_BUTTONS`.
3470 * @param[in] value The new value of the specified input mode.
Camilla Berglund39fe1f12013-03-12 19:39:36 +01003471 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003472 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
3473 * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR.
3474 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003475 * @thread_safety This function must only be called from the main thread.
Camilla Berglund0e205772014-03-24 11:58:35 +01003476 *
Camilla Berglund7e9e3212016-09-14 20:17:26 +02003477 * @sa @ref glfwGetInputMode
Camilla Berglunde248fb62013-03-29 14:06:23 +01003478 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003479 * @since Added in version 3.0. Replaces `glfwEnable` and `glfwDisable`.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003480 *
Camilla Berglunde248fb62013-03-29 14:06:23 +01003481 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003482 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01003483GLFWAPI void glfwSetInputMode(GLFWwindow* window, int mode, int value);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003484
Camilla Löwy9558b852017-04-04 18:05:36 +02003485/*! @brief Returns the layout-specific name of the specified printable key.
Camilla Berglund9c315412015-07-02 14:24:50 +02003486 *
Camilla Löwy9558b852017-04-04 18:05:36 +02003487 * This function returns the name of the specified printable key, encoded as
3488 * UTF-8. This is typically the character that key would produce without any
3489 * modifier keys, intended for displaying key bindings to the user. For dead
3490 * keys, it is typically the diacritic it would add to a character.
Camilla Berglund9c315412015-07-02 14:24:50 +02003491 *
Camilla Löwy071a0492017-02-28 22:29:10 +01003492 * __Do not use this function__ for [text input](@ref input_char). You will
3493 * break text input for many languages even if it happens to work for yours.
Camilla Berglund70ffae72016-02-22 11:54:56 +01003494 *
Camilla Löwy071a0492017-02-28 22:29:10 +01003495 * If the key is `GLFW_KEY_UNKNOWN`, the scancode is used to identify the key,
3496 * otherwise the scancode is ignored. If you specify a non-printable key, or
3497 * `GLFW_KEY_UNKNOWN` and a scancode that maps to a non-printable key, this
3498 * function returns `NULL` but does not emit an error.
3499 *
3500 * This behavior allows you to always pass in the arguments in the
Camilla Berglund70ffae72016-02-22 11:54:56 +01003501 * [key callback](@ref input_key) without modification.
3502 *
3503 * The printable keys are:
3504 * - `GLFW_KEY_APOSTROPHE`
3505 * - `GLFW_KEY_COMMA`
3506 * - `GLFW_KEY_MINUS`
3507 * - `GLFW_KEY_PERIOD`
3508 * - `GLFW_KEY_SLASH`
3509 * - `GLFW_KEY_SEMICOLON`
3510 * - `GLFW_KEY_EQUAL`
3511 * - `GLFW_KEY_LEFT_BRACKET`
3512 * - `GLFW_KEY_RIGHT_BRACKET`
3513 * - `GLFW_KEY_BACKSLASH`
3514 * - `GLFW_KEY_WORLD_1`
3515 * - `GLFW_KEY_WORLD_2`
3516 * - `GLFW_KEY_0` to `GLFW_KEY_9`
3517 * - `GLFW_KEY_A` to `GLFW_KEY_Z`
3518 * - `GLFW_KEY_KP_0` to `GLFW_KEY_KP_9`
3519 * - `GLFW_KEY_KP_DECIMAL`
3520 * - `GLFW_KEY_KP_DIVIDE`
3521 * - `GLFW_KEY_KP_MULTIPLY`
3522 * - `GLFW_KEY_KP_SUBTRACT`
3523 * - `GLFW_KEY_KP_ADD`
3524 * - `GLFW_KEY_KP_EQUAL`
Camilla Berglund9c315412015-07-02 14:24:50 +02003525 *
Camilla Löwy071a0492017-02-28 22:29:10 +01003526 * Names for printable keys depend on keyboard layout, while names for
3527 * non-printable keys are the same across layouts but depend on the application
3528 * language and should be localized along with other user interface text.
3529 *
Camilla Berglund9c315412015-07-02 14:24:50 +02003530 * @param[in] key The key to query, or `GLFW_KEY_UNKNOWN`.
3531 * @param[in] scancode The scancode of the key to query.
Camilla Löwy9558b852017-04-04 18:05:36 +02003532 * @return The UTF-8 encoded, layout-specific name of the key, or `NULL`.
Camilla Berglund9c315412015-07-02 14:24:50 +02003533 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003534 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
3535 * GLFW_PLATFORM_ERROR.
3536 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003537 * @pointer_lifetime The returned string is allocated and freed by GLFW. You
3538 * should not free it yourself. It is valid until the next call to @ref
3539 * glfwGetKeyName, or until the library is terminated.
Camilla Berglund9c315412015-07-02 14:24:50 +02003540 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003541 * @thread_safety This function must only be called from the main thread.
Camilla Berglund9c315412015-07-02 14:24:50 +02003542 *
3543 * @sa @ref input_key_name
3544 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003545 * @since Added in version 3.2.
Camilla Berglund9c315412015-07-02 14:24:50 +02003546 *
3547 * @ingroup input
3548 */
3549GLFWAPI const char* glfwGetKeyName(int key, int scancode);
3550
Camilla Löwy766a9dc2016-12-06 23:26:53 +01003551/*! @brief Returns the platform-specific scancode of the specified key.
Michael Stockere745b0d2016-08-11 19:11:40 +02003552 *
Camilla Löwy766a9dc2016-12-06 23:26:53 +01003553 * This function returns the platform-specific scancode of the specified key.
Michael Stockere745b0d2016-08-11 19:11:40 +02003554 *
3555 * If the key is `GLFW_KEY_UNKNOWN` or does not exist on the keyboard this
3556 * method will return `-1`.
3557 *
Camilla Löwy766a9dc2016-12-06 23:26:53 +01003558 * @param[in] key Any [named key](@ref keys).
3559 * @return The platform-specific scancode for the key, or `-1` if an
Camilla Berglundbb3cb8f2016-09-06 15:40:31 +02003560 * [error](@ref error_handling) occurred.
Michael Stockere745b0d2016-08-11 19:11:40 +02003561 *
Camilla Berglundbb3cb8f2016-09-06 15:40:31 +02003562 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
3563 * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR.
Michael Stockere745b0d2016-08-11 19:11:40 +02003564 *
3565 * @thread_safety This function may be called from any thread.
3566 *
Camilla Löwy766a9dc2016-12-06 23:26:53 +01003567 * @sa @ref input_key
Michael Stockere745b0d2016-08-11 19:11:40 +02003568 *
3569 * @since Added in version 3.3.
3570 *
3571 * @ingroup input
3572 */
Camilla Berglundbb3cb8f2016-09-06 15:40:31 +02003573GLFWAPI int glfwGetKeyScancode(int key);
Michael Stockere745b0d2016-08-11 19:11:40 +02003574
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003575/*! @brief Returns the last reported state of a keyboard key for the specified
3576 * window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003577 *
3578 * This function returns the last state reported for the specified key to the
3579 * specified window. The returned state is one of `GLFW_PRESS` or
Camilla Berglund4591ad22014-09-18 15:03:29 +02003580 * `GLFW_RELEASE`. The higher-level action `GLFW_REPEAT` is only reported to
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003581 * the key callback.
3582 *
Camilla Löwy46393072017-02-20 13:45:11 +01003583 * If the @ref GLFW_STICKY_KEYS input mode is enabled, this function returns
Camilla Berglund4591ad22014-09-18 15:03:29 +02003584 * `GLFW_PRESS` the first time you call it for a key that was pressed, even if
3585 * that key has already been released.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003586 *
3587 * The key functions deal with physical keys, with [key tokens](@ref keys)
3588 * named after their use on the standard US keyboard layout. If you want to
3589 * input text, use the Unicode character callback instead.
3590 *
Camilla Berglunde8e05d42014-04-23 13:30:11 +02003591 * The [modifier key bit masks](@ref mods) are not key tokens and cannot be
3592 * used with this function.
3593 *
Camilla Berglund9c315412015-07-02 14:24:50 +02003594 * __Do not use this function__ to implement [text input](@ref input_char).
3595 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003596 * @param[in] window The desired window.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003597 * @param[in] key The desired [keyboard key](@ref keys). `GLFW_KEY_UNKNOWN` is
3598 * not a valid key for this function.
Camilla Berglund71d2b572013-03-12 15:33:05 +01003599 * @return One of `GLFW_PRESS` or `GLFW_RELEASE`.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003600 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003601 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
3602 * GLFW_INVALID_ENUM.
3603 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003604 * @thread_safety This function must only be called from the main thread.
Camilla Berglund0e205772014-03-24 11:58:35 +01003605 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003606 * @sa @ref input_key
3607 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003608 * @since Added in version 1.0.
Camilla Berglund951a9582016-01-31 21:32:14 +01003609 * @glfw3 Added window handle parameter.
Camilla Berglund11615fc2013-05-30 17:19:12 +02003610 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003611 * @ingroup input
3612 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01003613GLFWAPI int glfwGetKey(GLFWwindow* window, int key);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003614
3615/*! @brief Returns the last reported state of a mouse button for the specified
3616 * window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003617 *
3618 * This function returns the last state reported for the specified mouse button
Camilla Berglund4591ad22014-09-18 15:03:29 +02003619 * to the specified window. The returned state is one of `GLFW_PRESS` or
Camilla Berglundce8f97c2015-01-11 23:33:14 +01003620 * `GLFW_RELEASE`.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003621 *
Camilla Löwy46393072017-02-20 13:45:11 +01003622 * If the @ref GLFW_STICKY_MOUSE_BUTTONS input mode is enabled, this function
Camilla Berglund4591ad22014-09-18 15:03:29 +02003623 * `GLFW_PRESS` the first time you call it for a mouse button that was pressed,
3624 * even if that mouse button has already been released.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003625 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003626 * @param[in] window The desired window.
Camilla Berglund71d2b572013-03-12 15:33:05 +01003627 * @param[in] button The desired [mouse button](@ref buttons).
3628 * @return One of `GLFW_PRESS` or `GLFW_RELEASE`.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003629 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003630 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
3631 * GLFW_INVALID_ENUM.
3632 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003633 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003634 *
3635 * @sa @ref input_mouse_button
3636 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003637 * @since Added in version 1.0.
Camilla Berglund951a9582016-01-31 21:32:14 +01003638 * @glfw3 Added window handle parameter.
Camilla Berglund0e205772014-03-24 11:58:35 +01003639 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003640 * @ingroup input
3641 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01003642GLFWAPI int glfwGetMouseButton(GLFWwindow* window, int button);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003643
Camilla Berglundd4591452014-02-11 18:24:01 +01003644/*! @brief Retrieves the position of the cursor relative to the client area of
3645 * the window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003646 *
Camilla Berglundd4591452014-02-11 18:24:01 +01003647 * This function returns the position of the cursor, in screen coordinates,
3648 * relative to the upper-left corner of the client area of the specified
3649 * window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003650 *
Camilla Berglund6df692b2013-04-26 17:20:31 +02003651 * If the cursor is disabled (with `GLFW_CURSOR_DISABLED`) then the cursor
3652 * position is unbounded and limited only by the minimum and maximum values of
3653 * a `double`.
Camilla Berglund948cc042013-04-16 02:02:22 +02003654 *
Camilla Berglund3ec29252013-04-25 18:03:15 +02003655 * The coordinate can be converted to their integer equivalents with the
3656 * `floor` function. Casting directly to an integer type works for positive
3657 * coordinates, but fails for negative ones.
3658 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003659 * Any or all of the position arguments may be `NULL`. If an error occurs, all
3660 * non-`NULL` position arguments will be set to zero.
3661 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003662 * @param[in] window The desired window.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02003663 * @param[out] xpos Where to store the cursor x-coordinate, relative to the
3664 * left edge of the client area, or `NULL`.
3665 * @param[out] ypos Where to store the cursor y-coordinate, relative to the to
3666 * top edge of the client area, or `NULL`.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003667 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003668 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
3669 * GLFW_PLATFORM_ERROR.
3670 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003671 * @thread_safety This function must only be called from the main thread.
Camilla Berglund0e205772014-03-24 11:58:35 +01003672 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003673 * @sa @ref cursor_pos
Camilla Berglund7e9e3212016-09-14 20:17:26 +02003674 * @sa @ref glfwSetCursorPos
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003675 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003676 * @since Added in version 3.0. Replaces `glfwGetMousePos`.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003677 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003678 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003679 */
Camilla Berglund129e94d2013-04-04 16:16:21 +02003680GLFWAPI void glfwGetCursorPos(GLFWwindow* window, double* xpos, double* ypos);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003681
Camilla Berglund6d9d8562013-09-28 22:12:50 +02003682/*! @brief Sets the position of the cursor, relative to the client area of the
3683 * window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003684 *
Camilla Berglund6d9d8562013-09-28 22:12:50 +02003685 * This function sets the position, in screen coordinates, of the cursor
3686 * relative to the upper-left corner of the client area of the specified
Camilla Berglund4188c262015-01-18 01:55:25 +01003687 * window. The window must have input focus. If the window does not have
3688 * input focus when this function is called, it fails silently.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003689 *
Camilla Berglund20858762015-01-01 18:41:22 +01003690 * __Do not use this function__ to implement things like camera controls. GLFW
3691 * already provides the `GLFW_CURSOR_DISABLED` cursor mode that hides the
3692 * cursor, transparently re-centers it and provides unconstrained cursor
3693 * motion. See @ref glfwSetInputMode for more information.
3694 *
3695 * If the cursor mode is `GLFW_CURSOR_DISABLED` then the cursor position is
3696 * unconstrained and limited only by the minimum and maximum values of
Camilla Berglund6df692b2013-04-26 17:20:31 +02003697 * a `double`.
Camilla Berglund948cc042013-04-16 02:02:22 +02003698 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003699 * @param[in] window The desired window.
3700 * @param[in] xpos The desired x-coordinate, relative to the left edge of the
Camilla Berglundbb558162013-09-09 23:31:59 +02003701 * client area.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003702 * @param[in] ypos The desired y-coordinate, relative to the top edge of the
Camilla Berglundbb558162013-09-09 23:31:59 +02003703 * client area.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003704 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003705 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
3706 * GLFW_PLATFORM_ERROR.
3707 *
linkmauvebc8b0482016-10-16 15:52:39 +01003708 * @remark @wayland This function will only work when the cursor mode is
3709 * `GLFW_CURSOR_DISABLED`, otherwise it will do nothing.
3710 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003711 * @thread_safety This function must only be called from the main thread.
Camilla Berglund0e205772014-03-24 11:58:35 +01003712 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003713 * @sa @ref cursor_pos
Camilla Berglund7e9e3212016-09-14 20:17:26 +02003714 * @sa @ref glfwGetCursorPos
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003715 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003716 * @since Added in version 3.0. Replaces `glfwSetMousePos`.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003717 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003718 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003719 */
Camilla Berglund129e94d2013-04-04 16:16:21 +02003720GLFWAPI void glfwSetCursorPos(GLFWwindow* window, double xpos, double ypos);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003721
Camilla Berglund2a1375e2014-09-02 16:52:16 +02003722/*! @brief Creates a custom cursor.
urraka40c04a72013-12-04 10:19:22 -03003723 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003724 * Creates a new custom cursor image that can be set for a window with @ref
3725 * glfwSetCursor. The cursor can be destroyed with @ref glfwDestroyCursor.
3726 * Any remaining cursors are destroyed by @ref glfwTerminate.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02003727 *
Camilla Berglund85a01bf2015-08-17 21:04:19 +02003728 * The pixels are 32-bit, little-endian, non-premultiplied RGBA, i.e. eight
3729 * bits per channel. They are arranged canonically as packed sequential rows,
3730 * starting from the top-left corner.
Camilla Berglund4188c262015-01-18 01:55:25 +01003731 *
3732 * The cursor hotspot is specified in pixels, relative to the upper-left corner
3733 * of the cursor image. Like all other coordinate systems in GLFW, the X-axis
3734 * points to the right and the Y-axis points down.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02003735 *
Camilla Berglund8fa9cc02014-02-23 16:43:17 +01003736 * @param[in] image The desired cursor image.
Camilla Berglund4188c262015-01-18 01:55:25 +01003737 * @param[in] xhot The desired x-coordinate, in pixels, of the cursor hotspot.
3738 * @param[in] yhot The desired y-coordinate, in pixels, of the cursor hotspot.
Camilla Berglund4188c262015-01-18 01:55:25 +01003739 * @return The handle of the created cursor, or `NULL` if an
Camilla Berglund4591ad22014-09-18 15:03:29 +02003740 * [error](@ref error_handling) occurred.
urraka40c04a72013-12-04 10:19:22 -03003741 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003742 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
3743 * GLFW_PLATFORM_ERROR.
3744 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003745 * @pointer_lifetime The specified image data is copied before this function
3746 * returns.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003747 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003748 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003749 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003750 * @sa @ref cursor_object
Camilla Berglund7e9e3212016-09-14 20:17:26 +02003751 * @sa @ref glfwDestroyCursor
3752 * @sa @ref glfwCreateStandardCursor
Camilla Berglund4591ad22014-09-18 15:03:29 +02003753 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003754 * @since Added in version 3.1.
urraka40c04a72013-12-04 10:19:22 -03003755 *
3756 * @ingroup input
3757 */
Camilla Berglund8fa9cc02014-02-23 16:43:17 +01003758GLFWAPI GLFWcursor* glfwCreateCursor(const GLFWimage* image, int xhot, int yhot);
urraka40c04a72013-12-04 10:19:22 -03003759
Camilla Berglund2a1375e2014-09-02 16:52:16 +02003760/*! @brief Creates a cursor with a standard shape.
3761 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003762 * Returns a cursor with a [standard shape](@ref shapes), that can be set for
3763 * a window with @ref glfwSetCursor.
Camilla Berglund2a1375e2014-09-02 16:52:16 +02003764 *
3765 * @param[in] shape One of the [standard shapes](@ref shapes).
Camilla Berglund2a1375e2014-09-02 16:52:16 +02003766 * @return A new cursor ready to use or `NULL` if an
3767 * [error](@ref error_handling) occurred.
3768 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003769 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
3770 * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR.
3771 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003772 * @thread_safety This function must only be called from the main thread.
Camilla Berglund2a1375e2014-09-02 16:52:16 +02003773 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003774 * @sa @ref cursor_object
Camilla Berglund7e9e3212016-09-14 20:17:26 +02003775 * @sa @ref glfwCreateCursor
Camilla Berglund2a1375e2014-09-02 16:52:16 +02003776 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003777 * @since Added in version 3.1.
Camilla Berglund2a1375e2014-09-02 16:52:16 +02003778 *
3779 * @ingroup input
3780 */
3781GLFWAPI GLFWcursor* glfwCreateStandardCursor(int shape);
3782
urraka40c04a72013-12-04 10:19:22 -03003783/*! @brief Destroys a cursor.
3784 *
Camilla Berglunde8e05d42014-04-23 13:30:11 +02003785 * This function destroys a cursor previously created with @ref
3786 * glfwCreateCursor. Any remaining cursors will be destroyed by @ref
3787 * glfwTerminate.
urraka40c04a72013-12-04 10:19:22 -03003788 *
Camilla Löwy46393072017-02-20 13:45:11 +01003789 * If the specified cursor is current for any window, that window will be
3790 * reverted to the default cursor. This does not affect the cursor mode.
3791 *
Camilla Berglunde8e05d42014-04-23 13:30:11 +02003792 * @param[in] cursor The cursor object to destroy.
urraka40c04a72013-12-04 10:19:22 -03003793 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003794 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
3795 * GLFW_PLATFORM_ERROR.
3796 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003797 * @reentrancy This function must not be called from a callback.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003798 *
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 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003801 * @sa @ref cursor_object
Camilla Berglund7e9e3212016-09-14 20:17:26 +02003802 * @sa @ref glfwCreateCursor
Camilla Berglund4591ad22014-09-18 15:03:29 +02003803 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003804 * @since Added in version 3.1.
urraka40c04a72013-12-04 10:19:22 -03003805 *
3806 * @ingroup input
3807 */
3808GLFWAPI void glfwDestroyCursor(GLFWcursor* cursor);
3809
Camilla Berglund4188c262015-01-18 01:55:25 +01003810/*! @brief Sets the cursor for the window.
urraka40c04a72013-12-04 10:19:22 -03003811 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003812 * This function sets the cursor image to be used when the cursor is over the
3813 * client area of the specified window. The set cursor will only be visible
3814 * when the [cursor mode](@ref cursor_mode) of the window is
3815 * `GLFW_CURSOR_NORMAL`.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003816 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003817 * On some platforms, the set cursor may not be visible unless the window also
3818 * has input focus.
3819 *
3820 * @param[in] window The window to set the cursor for.
3821 * @param[in] cursor The cursor to set, or `NULL` to switch back to the default
3822 * arrow cursor.
urraka40c04a72013-12-04 10:19:22 -03003823 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003824 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
3825 * GLFW_PLATFORM_ERROR.
3826 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003827 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003828 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003829 * @sa @ref cursor_object
Camilla Berglund4591ad22014-09-18 15:03:29 +02003830 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003831 * @since Added in version 3.1.
Camilla Berglund0e205772014-03-24 11:58:35 +01003832 *
urraka40c04a72013-12-04 10:19:22 -03003833 * @ingroup input
3834 */
3835GLFWAPI void glfwSetCursor(GLFWwindow* window, GLFWcursor* cursor);
3836
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003837/*! @brief Sets the key callback.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003838 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003839 * This function sets the key callback of the specified window, which is called
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003840 * when a key is pressed, repeated or released.
3841 *
Camilla Berglund948cc042013-04-16 02:02:22 +02003842 * The key functions deal with physical keys, with layout independent
3843 * [key tokens](@ref keys) named after their values in the standard US keyboard
Camilla Berglund5fd409b2013-06-05 17:53:13 +02003844 * layout. If you want to input text, use the
3845 * [character callback](@ref glfwSetCharCallback) instead.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003846 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003847 * When a window loses input focus, it will generate synthetic key release
3848 * events for all pressed keys. You can tell these events from user-generated
3849 * events by the fact that the synthetic ones are generated after the focus
3850 * loss event has been processed, i.e. after the
3851 * [window focus callback](@ref glfwSetWindowFocusCallback) has been called.
Camilla Berglund4538a522013-04-24 19:49:46 +02003852 *
Camilla Berglund11615fc2013-05-30 17:19:12 +02003853 * The scancode of a key is specific to that platform or sometimes even to that
3854 * machine. Scancodes are intended to allow users to bind keys that don't have
3855 * a GLFW key token. Such keys have `key` set to `GLFW_KEY_UNKNOWN`, their
Camilla Berglund4591ad22014-09-18 15:03:29 +02003856 * state is not saved and so it cannot be queried with @ref glfwGetKey.
Camilla Berglund11615fc2013-05-30 17:19:12 +02003857 *
3858 * Sometimes GLFW needs to generate synthetic key events, in which case the
3859 * scancode may be zero.
3860 *
Camilla Berglund9492fc52013-01-17 17:51:12 +01003861 * @param[in] window The window whose callback to set.
Camilla Berglund71d2b572013-03-12 15:33:05 +01003862 * @param[in] cbfun The new key callback, or `NULL` to remove the currently
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003863 * set callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02003864 * @return The previously set callback, or `NULL` if no callback was set or the
3865 * library had not been [initialized](@ref intro_init).
Camilla Berglund11a27de2013-04-08 21:21:21 +02003866 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003867 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
3868 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003869 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003870 *
3871 * @sa @ref input_key
3872 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003873 * @since Added in version 1.0.
3874 * @glfw3 Added window handle parameter and return value.
Camilla Berglund0e205772014-03-24 11:58:35 +01003875 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003876 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003877 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02003878GLFWAPI GLFWkeyfun glfwSetKeyCallback(GLFWwindow* window, GLFWkeyfun cbfun);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003879
3880/*! @brief Sets the Unicode character callback.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003881 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003882 * This function sets the character callback of the specified window, which is
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003883 * called when a Unicode character is input.
3884 *
Camilla Berglund96b12ee2014-06-12 23:04:20 +02003885 * The character callback is intended for Unicode text input. As it deals with
3886 * characters, it is keyboard layout dependent, whereas the
3887 * [key callback](@ref glfwSetKeyCallback) is not. Characters do not map 1:1
3888 * to physical keys, as a key may produce zero, one or more characters. If you
3889 * want to know whether a specific physical key was pressed or released, see
3890 * the key callback instead.
3891 *
3892 * The character callback behaves as system text input normally does and will
3893 * not be called if modifier keys are held down that would prevent normal text
Camilla Berglund8d6f2652016-10-20 00:50:54 +02003894 * input on that platform, for example a Super (Command) key on macOS or Alt key
Camilla Berglund96b12ee2014-06-12 23:04:20 +02003895 * on Windows. There is a
3896 * [character with modifiers callback](@ref glfwSetCharModsCallback) that
3897 * receives these events.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003898 *
Camilla Berglund9492fc52013-01-17 17:51:12 +01003899 * @param[in] window The window whose callback to set.
Camilla Berglund71d2b572013-03-12 15:33:05 +01003900 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
Camilla Berglunddba2d802013-01-17 23:06:56 +01003901 * callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02003902 * @return The previously set callback, or `NULL` if no callback was set or the
3903 * library had not been [initialized](@ref intro_init).
Camilla Berglund11a27de2013-04-08 21:21:21 +02003904 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003905 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
3906 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003907 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003908 *
3909 * @sa @ref input_char
3910 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003911 * @since Added in version 2.4.
3912 * @glfw3 Added window handle parameter and return value.
Camilla Berglund0e205772014-03-24 11:58:35 +01003913 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003914 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003915 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02003916GLFWAPI GLFWcharfun glfwSetCharCallback(GLFWwindow* window, GLFWcharfun cbfun);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003917
Camilla Berglund96b12ee2014-06-12 23:04:20 +02003918/*! @brief Sets the Unicode character with modifiers callback.
3919 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02003920 * This function sets the character with modifiers callback of the specified
Camilla Berglund96b12ee2014-06-12 23:04:20 +02003921 * window, which is called when a Unicode character is input regardless of what
3922 * modifier keys are used.
3923 *
3924 * The character with modifiers callback is intended for implementing custom
3925 * Unicode character input. For regular Unicode text input, see the
3926 * [character callback](@ref glfwSetCharCallback). Like the character
3927 * callback, the character with modifiers callback deals with characters and is
3928 * keyboard layout dependent. Characters do not map 1:1 to physical keys, as
3929 * a key may produce zero, one or more characters. If you want to know whether
3930 * a specific physical key was pressed or released, see the
3931 * [key callback](@ref glfwSetKeyCallback) instead.
3932 *
3933 * @param[in] window The window whose callback to set.
3934 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
3935 * callback.
3936 * @return The previously set callback, or `NULL` if no callback was set or an
Camilla Berglund999f3552016-08-17 16:48:22 +02003937 * [error](@ref error_handling) occurred.
Camilla Berglund96b12ee2014-06-12 23:04:20 +02003938 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003939 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
3940 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003941 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003942 *
3943 * @sa @ref input_char
3944 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003945 * @since Added in version 3.1.
Camilla Berglund96b12ee2014-06-12 23:04:20 +02003946 *
3947 * @ingroup input
3948 */
3949GLFWAPI GLFWcharmodsfun glfwSetCharModsCallback(GLFWwindow* window, GLFWcharmodsfun cbfun);
3950
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003951/*! @brief Sets the mouse button callback.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003952 *
3953 * This function sets the mouse button callback of the specified window, which
3954 * is called when a mouse button is pressed or released.
3955 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003956 * When a window loses input focus, it will generate synthetic mouse button
3957 * release events for all pressed mouse buttons. You can tell these events
3958 * from user-generated events by the fact that the synthetic ones are generated
3959 * after the focus loss event has been processed, i.e. after the
3960 * [window focus callback](@ref glfwSetWindowFocusCallback) has been called.
Camilla Berglund4538a522013-04-24 19:49:46 +02003961 *
Camilla Berglund9492fc52013-01-17 17:51:12 +01003962 * @param[in] window The window whose callback to set.
Camilla Berglund71d2b572013-03-12 15:33:05 +01003963 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
Camilla Berglunddba2d802013-01-17 23:06:56 +01003964 * callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02003965 * @return The previously set callback, or `NULL` if no callback was set or the
3966 * library had not been [initialized](@ref intro_init).
Camilla Berglund11a27de2013-04-08 21:21:21 +02003967 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003968 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
3969 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003970 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003971 *
3972 * @sa @ref input_mouse_button
3973 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01003974 * @since Added in version 1.0.
3975 * @glfw3 Added window handle parameter and return value.
Camilla Berglund0e205772014-03-24 11:58:35 +01003976 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003977 * @ingroup input
3978 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02003979GLFWAPI GLFWmousebuttonfun glfwSetMouseButtonCallback(GLFWwindow* window, GLFWmousebuttonfun cbfun);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01003980
3981/*! @brief Sets the cursor position callback.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003982 *
3983 * This function sets the cursor position callback of the specified window,
3984 * which is called when the cursor is moved. The callback is provided with the
Camilla Berglund6d9d8562013-09-28 22:12:50 +02003985 * position, in screen coordinates, relative to the upper-left corner of the
3986 * client area of the window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01003987 *
Camilla Berglund9492fc52013-01-17 17:51:12 +01003988 * @param[in] window The window whose callback to set.
Camilla Berglund71d2b572013-03-12 15:33:05 +01003989 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
Camilla Berglunddba2d802013-01-17 23:06:56 +01003990 * callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02003991 * @return The previously set callback, or `NULL` if no callback was set or the
3992 * library had not been [initialized](@ref intro_init).
Camilla Berglund11a27de2013-04-08 21:21:21 +02003993 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01003994 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
3995 *
Camilla Berglund951a9582016-01-31 21:32:14 +01003996 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02003997 *
Camilla Berglund4188c262015-01-18 01:55:25 +01003998 * @sa @ref cursor_pos
Camilla Berglund4591ad22014-09-18 15:03:29 +02003999 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01004000 * @since Added in version 3.0. Replaces `glfwSetMousePosCallback`.
Camilla Berglund0e205772014-03-24 11:58:35 +01004001 *
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004002 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004003 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02004004GLFWAPI GLFWcursorposfun glfwSetCursorPosCallback(GLFWwindow* window, GLFWcursorposfun cbfun);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004005
4006/*! @brief Sets the cursor enter/exit callback.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004007 *
4008 * This function sets the cursor boundary crossing callback of the specified
4009 * window, which is called when the cursor enters or leaves the client area of
4010 * the window.
4011 *
Camilla Berglund9492fc52013-01-17 17:51:12 +01004012 * @param[in] window The window whose callback to set.
Camilla Berglund71d2b572013-03-12 15:33:05 +01004013 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
Camilla Berglunddba2d802013-01-17 23:06:56 +01004014 * callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02004015 * @return The previously set callback, or `NULL` if no callback was set or the
4016 * library had not been [initialized](@ref intro_init).
Camilla Berglund11a27de2013-04-08 21:21:21 +02004017 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01004018 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
4019 *
Camilla Berglund951a9582016-01-31 21:32:14 +01004020 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02004021 *
Camilla Berglund4188c262015-01-18 01:55:25 +01004022 * @sa @ref cursor_enter
Camilla Berglund4591ad22014-09-18 15:03:29 +02004023 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01004024 * @since Added in version 3.0.
Camilla Berglund0e205772014-03-24 11:58:35 +01004025 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004026 * @ingroup input
4027 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02004028GLFWAPI GLFWcursorenterfun glfwSetCursorEnterCallback(GLFWwindow* window, GLFWcursorenterfun cbfun);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004029
4030/*! @brief Sets the scroll callback.
Camilla Berglunde248fb62013-03-29 14:06:23 +01004031 *
4032 * This function sets the scroll callback of the specified window, which is
4033 * called when a scrolling device is used, such as a mouse wheel or scrolling
4034 * area of a touchpad.
4035 *
Camilla Berglund5fd409b2013-06-05 17:53:13 +02004036 * The scroll callback receives all scrolling input, like that from a mouse
4037 * wheel or a touchpad scrolling area.
4038 *
Camilla Berglund9492fc52013-01-17 17:51:12 +01004039 * @param[in] window The window whose callback to set.
Camilla Berglund71d2b572013-03-12 15:33:05 +01004040 * @param[in] cbfun The new scroll callback, or `NULL` to remove the currently
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004041 * set callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02004042 * @return The previously set callback, or `NULL` if no callback was set or the
4043 * library had not been [initialized](@ref intro_init).
Camilla Berglund11a27de2013-04-08 21:21:21 +02004044 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01004045 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
4046 *
Camilla Berglund951a9582016-01-31 21:32:14 +01004047 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02004048 *
Camilla Berglund4188c262015-01-18 01:55:25 +01004049 * @sa @ref scrolling
Camilla Berglund4591ad22014-09-18 15:03:29 +02004050 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01004051 * @since Added in version 3.0. Replaces `glfwSetMouseWheelCallback`.
Camilla Berglund0e205772014-03-24 11:58:35 +01004052 *
Camilla Berglunde248fb62013-03-29 14:06:23 +01004053 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004054 */
Camilla Berglund11a27de2013-04-08 21:21:21 +02004055GLFWAPI GLFWscrollfun glfwSetScrollCallback(GLFWwindow* window, GLFWscrollfun cbfun);
Camilla Berglund3249f812010-09-07 17:34:51 +02004056
Camilla Berglund5c8121e2014-03-29 21:35:21 +01004057/*! @brief Sets the file drop callback.
arturo89d07232013-07-10 11:42:14 +02004058 *
Camilla Berglund5c8121e2014-03-29 21:35:21 +01004059 * This function sets the file drop callback of the specified window, which is
4060 * called when one or more dragged files are dropped on the window.
arturo89d07232013-07-10 11:42:14 +02004061 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02004062 * Because the path array and its strings may have been generated specifically
4063 * for that event, they are not guaranteed to be valid after the callback has
4064 * returned. If you wish to use them after the callback returns, you need to
4065 * make a deep copy.
arturo89d07232013-07-10 11:42:14 +02004066 *
4067 * @param[in] window The window whose callback to set.
Camilla Berglund5c8121e2014-03-29 21:35:21 +01004068 * @param[in] cbfun The new file drop callback, or `NULL` to remove the
4069 * currently set callback.
Camilla Berglunde8e05d42014-04-23 13:30:11 +02004070 * @return The previously set callback, or `NULL` if no callback was set or the
4071 * library had not been [initialized](@ref intro_init).
arturo89d07232013-07-10 11:42:14 +02004072 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01004073 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
4074 *
linkmauvebc8b0482016-10-16 15:52:39 +01004075 * @remark @wayland File drop is currently unimplemented.
4076 *
Camilla Berglund951a9582016-01-31 21:32:14 +01004077 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02004078 *
Camilla Berglund4188c262015-01-18 01:55:25 +01004079 * @sa @ref path_drop
Camilla Berglund4591ad22014-09-18 15:03:29 +02004080 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01004081 * @since Added in version 3.1.
Camilla Berglund0e205772014-03-24 11:58:35 +01004082 *
arturo89d07232013-07-10 11:42:14 +02004083 * @ingroup input
4084 */
4085GLFWAPI GLFWdropfun glfwSetDropCallback(GLFWwindow* window, GLFWdropfun cbfun);
4086
Camilla Berglundfdd45182013-05-27 15:13:09 +02004087/*! @brief Returns whether the specified joystick is present.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004088 *
Camilla Berglundfdd45182013-05-27 15:13:09 +02004089 * This function returns whether the specified joystick is present.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004090 *
Camilla Berglundefc6b352016-10-10 03:24:07 +02004091 * @param[in] jid The [joystick](@ref joysticks) to query.
Camilla Berglund0eccf752015-08-23 19:30:04 +02004092 * @return `GLFW_TRUE` if the joystick is present, or `GLFW_FALSE` otherwise.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004093 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01004094 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
4095 * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR.
4096 *
Camilla Berglund951a9582016-01-31 21:32:14 +01004097 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02004098 *
Camilla Berglund4188c262015-01-18 01:55:25 +01004099 * @sa @ref joystick
Camilla Berglund4591ad22014-09-18 15:03:29 +02004100 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01004101 * @since Added in version 3.0. Replaces `glfwGetJoystickParam`.
Camilla Berglund0e205772014-03-24 11:58:35 +01004102 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004103 * @ingroup input
4104 */
Camilla Berglundefc6b352016-10-10 03:24:07 +02004105GLFWAPI int glfwJoystickPresent(int jid);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004106
Camilla Berglund7f2eb7b2013-04-24 19:25:42 +02004107/*! @brief Returns the values of all axes of the specified joystick.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02004108 *
4109 * This function returns the values of all axes of the specified joystick.
Camilla Berglund4591ad22014-09-18 15:03:29 +02004110 * Each element in the array is a value between -1.0 and 1.0.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02004111 *
Camilla Löwy798d7c62017-03-01 23:27:20 +01004112 * Querying a joystick ID with no device present is not an error, but will
Camilla Berglund386b6032016-02-10 13:48:49 +01004113 * cause this function to return `NULL`. Call @ref glfwJoystickPresent to
4114 * check device presence.
4115 *
Camilla Berglundefc6b352016-10-10 03:24:07 +02004116 * @param[in] jid The [joystick](@ref joysticks) to query.
Camilla Berglund4591ad22014-09-18 15:03:29 +02004117 * @param[out] count Where to store the number of axis values in the returned
Camilla Berglund999f3552016-08-17 16:48:22 +02004118 * array. This is set to zero if the joystick is not present or an error
4119 * occurred.
4120 * @return An array of axis values, or `NULL` if the joystick is not present or
4121 * an [error](@ref error_handling) occurred.
Camilla Berglund7f2eb7b2013-04-24 19:25:42 +02004122 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01004123 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
4124 * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR.
4125 *
Camilla Berglund951a9582016-01-31 21:32:14 +01004126 * @pointer_lifetime The returned array is allocated and freed by GLFW. You
4127 * should not free it yourself. It is valid until the specified joystick is
Camilla Löwy68014782017-02-01 04:36:38 +01004128 * disconnected or the library is terminated.
Camilla Berglund0e205772014-03-24 11:58:35 +01004129 *
Camilla Berglund951a9582016-01-31 21:32:14 +01004130 * @thread_safety This function must only be called from the main thread.
Camilla Berglundc3bb5c92013-06-05 16:04:04 +02004131 *
Camilla Berglund4188c262015-01-18 01:55:25 +01004132 * @sa @ref joystick_axis
Camilla Berglund4591ad22014-09-18 15:03:29 +02004133 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01004134 * @since Added in version 3.0. Replaces `glfwGetJoystickPos`.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004135 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004136 * @ingroup input
4137 */
Camilla Berglundefc6b352016-10-10 03:24:07 +02004138GLFWAPI const float* glfwGetJoystickAxes(int jid, int* count);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004139
Camilla Berglunde93bade2013-06-16 02:33:33 +02004140/*! @brief Returns the state of all buttons of the specified joystick.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02004141 *
Camilla Berglunde93bade2013-06-16 02:33:33 +02004142 * This function returns the state of all buttons of the specified joystick.
Camilla Berglund4591ad22014-09-18 15:03:29 +02004143 * Each element in the array is either `GLFW_PRESS` or `GLFW_RELEASE`.
Camilla Berglund5fd409b2013-06-05 17:53:13 +02004144 *
Camilla Löwy798d7c62017-03-01 23:27:20 +01004145 * For backward compatibility with earlier versions that did not have @ref
4146 * glfwGetJoystickHats, the button array also includes all hats, each
4147 * represented as four buttons. The hats are in the same order as returned by
4148 * __glfwGetJoystickHats__ and are in the order _up_, _right_, _down_ and
4149 * _left_. To disable these extra buttons, set the @ref
4150 * GLFW_JOYSTICK_HAT_BUTTONS init hint before initialization.
4151 *
4152 * Querying a joystick ID with no device present is not an error, but will
Camilla Berglund386b6032016-02-10 13:48:49 +01004153 * cause this function to return `NULL`. Call @ref glfwJoystickPresent to
4154 * check device presence.
4155 *
Camilla Berglundefc6b352016-10-10 03:24:07 +02004156 * @param[in] jid The [joystick](@ref joysticks) to query.
Camilla Berglund4591ad22014-09-18 15:03:29 +02004157 * @param[out] count Where to store the number of button states in the returned
Camilla Berglund999f3552016-08-17 16:48:22 +02004158 * array. This is set to zero if the joystick is not present or an error
4159 * occurred.
4160 * @return An array of button states, or `NULL` if the joystick is not present
4161 * or an [error](@ref error_handling) occurred.
Camilla Berglund7f2eb7b2013-04-24 19:25:42 +02004162 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01004163 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
4164 * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR.
4165 *
Camilla Berglund951a9582016-01-31 21:32:14 +01004166 * @pointer_lifetime The returned array is allocated and freed by GLFW. You
4167 * should not free it yourself. It is valid until the specified joystick is
Camilla Löwy68014782017-02-01 04:36:38 +01004168 * disconnected or the library is terminated.
Camilla Berglund0e205772014-03-24 11:58:35 +01004169 *
Camilla Berglund951a9582016-01-31 21:32:14 +01004170 * @thread_safety This function must only be called from the main thread.
Camilla Berglundc3bb5c92013-06-05 16:04:04 +02004171 *
Camilla Berglund4188c262015-01-18 01:55:25 +01004172 * @sa @ref joystick_button
Camilla Berglund4591ad22014-09-18 15:03:29 +02004173 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01004174 * @since Added in version 2.2.
Camilla Berglund951a9582016-01-31 21:32:14 +01004175 * @glfw3 Changed to return a dynamic array.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004176 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004177 * @ingroup input
4178 */
Camilla Berglundefc6b352016-10-10 03:24:07 +02004179GLFWAPI const unsigned char* glfwGetJoystickButtons(int jid, int* count);
Camilla Berglund3249f812010-09-07 17:34:51 +02004180
IntellectualKitty368dec72016-11-25 20:56:24 -07004181/*! @brief Returns the state of all hats of the specified joystick.
4182 *
4183 * This function returns the state of all hats of the specified joystick.
Camilla Löwy798d7c62017-03-01 23:27:20 +01004184 * Each element in the array is one of the following values:
IntellectualKitty368dec72016-11-25 20:56:24 -07004185 *
Camilla Löwy798d7c62017-03-01 23:27:20 +01004186 * Name | Value
4187 * --------------------- | --------------------------------
4188 * `GLFW_HAT_CENTERED` | 0
4189 * `GLFW_HAT_UP` | 1
4190 * `GLFW_HAT_RIGHT` | 2
4191 * `GLFW_HAT_DOWN` | 4
4192 * `GLFW_HAT_LEFT` | 8
4193 * `GLFW_HAT_RIGHT_UP` | `GLFW_HAT_RIGHT` \| `GLFW_HAT_UP`
4194 * `GLFW_HAT_RIGHT_DOWN` | `GLFW_HAT_RIGHT` \| `GLFW_HAT_DOWN`
4195 * `GLFW_HAT_LEFT_UP` | `GLFW_HAT_LEFT` \| `GLFW_HAT_UP`
4196 * `GLFW_HAT_LEFT_DOWN` | `GLFW_HAT_LEFT` \| `GLFW_HAT_DOWN`
IntellectualKitty368dec72016-11-25 20:56:24 -07004197 *
Camilla Löwy798d7c62017-03-01 23:27:20 +01004198 * The diagonal directions are bitwise combinations of the primary (up, right,
4199 * down and left) directions and you can test for these individually by ANDing
4200 * it with the corresponding direction.
IntellectualKitty368dec72016-11-25 20:56:24 -07004201 *
Camilla Löwy798d7c62017-03-01 23:27:20 +01004202 * @code
4203 * if (hats[2] & GLFW_HAT_RIGHT)
4204 * {
4205 * // State of hat 2 could be right-up, right or right-down
4206 * }
4207 * @endcode
IntellectualKitty368dec72016-11-25 20:56:24 -07004208 *
Camilla Löwy798d7c62017-03-01 23:27:20 +01004209 * Querying a joystick ID with no device present is not an error, but will
IntellectualKitty368dec72016-11-25 20:56:24 -07004210 * cause this function to return `NULL`. Call @ref glfwJoystickPresent to
4211 * check device presence.
4212 *
4213 * @param[in] jid The [joystick](@ref joysticks) to query.
4214 * @param[out] count Where to store the number of hat states in the returned
4215 * array. This is set to zero if the joystick is not present or an error
4216 * occurred.
4217 * @return An array of hat states, or `NULL` if the joystick is not present
4218 * or an [error](@ref error_handling) occurred.
4219 *
4220 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
4221 * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR.
4222 *
Camilla Löwy798d7c62017-03-01 23:27:20 +01004223 * @bug @linux Joystick hats are currently unimplemented.
IntellectualKitty368dec72016-11-25 20:56:24 -07004224 *
4225 * @pointer_lifetime The returned array is allocated and freed by GLFW. You
4226 * should not free it yourself. It is valid until the specified joystick is
4227 * disconnected, this function is called again for that joystick or the library
4228 * is terminated.
4229 *
4230 * @thread_safety This function must only be called from the main thread.
4231 *
4232 * @sa @ref joystick_hat
4233 *
4234 * @since Added in version 3.3.
4235 *
4236 * @ingroup input
4237 */
4238GLFWAPI const unsigned char* glfwGetJoystickHats(int jid, int* count);
4239
Camilla Berglund7d9b5c02012-12-02 16:55:09 +01004240/*! @brief Returns the name of the specified joystick.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004241 *
4242 * This function returns the name, encoded as UTF-8, of the specified joystick.
Camilla Berglund4591ad22014-09-18 15:03:29 +02004243 * The returned string is allocated and freed by GLFW. You should not free it
4244 * yourself.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004245 *
Camilla Löwy798d7c62017-03-01 23:27:20 +01004246 * Querying a joystick ID with no device present is not an error, but will
Camilla Berglund386b6032016-02-10 13:48:49 +01004247 * cause this function to return `NULL`. Call @ref glfwJoystickPresent to
4248 * check device presence.
4249 *
Camilla Berglundefc6b352016-10-10 03:24:07 +02004250 * @param[in] jid The [joystick](@ref joysticks) to query.
Camilla Berglund71d2b572013-03-12 15:33:05 +01004251 * @return The UTF-8 encoded name of the joystick, or `NULL` if the joystick
Camilla Berglund999f3552016-08-17 16:48:22 +02004252 * is not present or an [error](@ref error_handling) occurred.
Camilla Berglundd4a08b12012-12-02 17:13:41 +01004253 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01004254 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
4255 * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR.
4256 *
Camilla Berglund951a9582016-01-31 21:32:14 +01004257 * @pointer_lifetime The returned string is allocated and freed by GLFW. You
4258 * should not free it yourself. It is valid until the specified joystick is
Camilla Löwy68014782017-02-01 04:36:38 +01004259 * disconnected or the library is terminated.
Camilla Berglund0e205772014-03-24 11:58:35 +01004260 *
Camilla Berglund951a9582016-01-31 21:32:14 +01004261 * @thread_safety This function must only be called from the main thread.
Camilla Berglundc3bb5c92013-06-05 16:04:04 +02004262 *
Camilla Berglund4188c262015-01-18 01:55:25 +01004263 * @sa @ref joystick_name
Camilla Berglund4591ad22014-09-18 15:03:29 +02004264 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01004265 * @since Added in version 3.0.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004266 *
4267 * @ingroup input
Camilla Berglund7d9b5c02012-12-02 16:55:09 +01004268 */
Camilla Berglundefc6b352016-10-10 03:24:07 +02004269GLFWAPI const char* glfwGetJoystickName(int jid);
Camilla Berglund3249f812010-09-07 17:34:51 +02004270
Camilla Berglund8a7fa302015-12-13 17:38:50 +01004271/*! @brief Sets the joystick configuration callback.
4272 *
4273 * This function sets the joystick configuration callback, or removes the
4274 * currently set callback. This is called when a joystick is connected to or
4275 * disconnected from the system.
4276 *
Camilla Löwya46c95c2017-02-01 04:55:46 +01004277 * For joystick connection and disconnection events to be delivered on all
4278 * platforms, you need to call one of the [event processing](@ref events)
4279 * functions. Joystick disconnection may also be detected and the callback
4280 * called by joystick functions. The function will then return whatever it
4281 * returns for a disconnected joystick.
4282 *
Camilla Berglund8a7fa302015-12-13 17:38:50 +01004283 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
4284 * callback.
4285 * @return The previously set callback, or `NULL` if no callback was set or the
4286 * library had not been [initialized](@ref intro_init).
4287 *
4288 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
4289 *
4290 * @thread_safety This function must only be called from the main thread.
4291 *
4292 * @sa @ref joystick_event
4293 *
4294 * @since Added in version 3.2.
4295 *
4296 * @ingroup input
4297 */
4298GLFWAPI GLFWjoystickfun glfwSetJoystickCallback(GLFWjoystickfun cbfun);
4299
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004300/*! @brief Sets the clipboard to the specified string.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004301 *
4302 * This function sets the system clipboard to the specified, UTF-8 encoded
Camilla Berglund4591ad22014-09-18 15:03:29 +02004303 * string.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004304 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004305 * @param[in] window The window that will own the clipboard contents.
4306 * @param[in] string A UTF-8 encoded string.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004307 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01004308 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
4309 * GLFW_PLATFORM_ERROR.
4310 *
linkmauvebc8b0482016-10-16 15:52:39 +01004311 * @remark @wayland Clipboard is currently unimplemented.
4312 *
Camilla Berglund951a9582016-01-31 21:32:14 +01004313 * @pointer_lifetime The specified string is copied before this function
4314 * returns.
Camilla Berglunda3ff29a2012-12-02 15:47:10 +01004315 *
Camilla Berglund951a9582016-01-31 21:32:14 +01004316 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02004317 *
Camilla Berglund4188c262015-01-18 01:55:25 +01004318 * @sa @ref clipboard
Camilla Berglund7e9e3212016-09-14 20:17:26 +02004319 * @sa @ref glfwGetClipboardString
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004320 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01004321 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02004322 *
Camilla Berglund8d170c72014-09-09 16:26:57 +02004323 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004324 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01004325GLFWAPI void glfwSetClipboardString(GLFWwindow* window, const char* string);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004326
Camilla Berglund4591ad22014-09-18 15:03:29 +02004327/*! @brief Returns the contents of the clipboard as a string.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004328 *
4329 * This function returns the contents of the system clipboard, if it contains
Camilla Berglundcf9079c2015-09-16 18:51:49 +02004330 * or is convertible to a UTF-8 encoded string. If the clipboard is empty or
Camilla Berglund0b650532015-09-16 16:27:28 +02004331 * if its contents cannot be converted, `NULL` is returned and a @ref
4332 * GLFW_FORMAT_UNAVAILABLE error is generated.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004333 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004334 * @param[in] window The window that will request the clipboard contents.
Camilla Berglund71d2b572013-03-12 15:33:05 +01004335 * @return The contents of the clipboard as a UTF-8 encoded string, or `NULL`
Camilla Berglund4591ad22014-09-18 15:03:29 +02004336 * if an [error](@ref error_handling) occurred.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004337 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01004338 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
4339 * GLFW_PLATFORM_ERROR.
4340 *
linkmauvebc8b0482016-10-16 15:52:39 +01004341 * @remark @wayland Clipboard is currently unimplemented.
4342 *
Camilla Berglund951a9582016-01-31 21:32:14 +01004343 * @pointer_lifetime The returned string is allocated and freed by GLFW. You
4344 * should not free it yourself. It is valid until the next call to @ref
Camilla Berglund6be821c2014-10-06 23:18:33 +02004345 * glfwGetClipboardString or @ref glfwSetClipboardString, or until the library
4346 * is terminated.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004347 *
Camilla Berglund951a9582016-01-31 21:32:14 +01004348 * @thread_safety This function must only be called from the main thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02004349 *
Camilla Berglund4188c262015-01-18 01:55:25 +01004350 * @sa @ref clipboard
Camilla Berglund7e9e3212016-09-14 20:17:26 +02004351 * @sa @ref glfwSetClipboardString
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004352 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01004353 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02004354 *
Camilla Berglund8d170c72014-09-09 16:26:57 +02004355 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004356 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01004357GLFWAPI const char* glfwGetClipboardString(GLFWwindow* window);
Ralph Eastwood31c91542011-09-21 10:09:47 +01004358
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004359/*! @brief Returns the value of the GLFW timer.
4360 *
4361 * This function returns the value of the GLFW timer. Unless the timer has
4362 * been set using @ref glfwSetTime, the timer measures time elapsed since GLFW
4363 * was initialized.
4364 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02004365 * The resolution of the timer is system dependent, but is usually on the order
4366 * of a few micro- or nanoseconds. It uses the highest-resolution monotonic
4367 * time source on each supported platform.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004368 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02004369 * @return The current value, in seconds, or zero if an
4370 * [error](@ref error_handling) occurred.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004371 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01004372 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
4373 *
Camilla Berglund20bce152016-05-30 16:04:37 +02004374 * @thread_safety This function may be called from any thread. Reading and
4375 * writing of the internal timer offset is not atomic, so it needs to be
4376 * externally synchronized with calls to @ref glfwSetTime.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004377 *
Camilla Berglund4188c262015-01-18 01:55:25 +01004378 * @sa @ref time
Camilla Berglund4591ad22014-09-18 15:03:29 +02004379 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01004380 * @since Added in version 1.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02004381 *
4382 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004383 */
Camilla Berglund9a716692010-09-08 16:40:43 +02004384GLFWAPI double glfwGetTime(void);
Camilla Berglund3249f812010-09-07 17:34:51 +02004385
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004386/*! @brief Sets the GLFW timer.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004387 *
4388 * This function sets the value of the GLFW timer. It then continues to count
Camilla Berglund6e20cda2015-03-10 12:01:38 +01004389 * up from that value. The value must be a positive finite number less than
4390 * or equal to 18446744073.0, which is approximately 584.5 years.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004391 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004392 * @param[in] time The new value, in seconds.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004393 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01004394 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
4395 * GLFW_INVALID_VALUE.
4396 *
Camilla Berglund951a9582016-01-31 21:32:14 +01004397 * @remark The upper limit of the timer is calculated as
Camilla Berglund6e20cda2015-03-10 12:01:38 +01004398 * floor((2<sup>64</sup> - 1) / 10<sup>9</sup>) and is due to implementations
4399 * storing nanoseconds in 64 bits. The limit may be increased in the future.
4400 *
Camilla Berglund20bce152016-05-30 16:04:37 +02004401 * @thread_safety This function may be called from any thread. Reading and
4402 * writing of the internal timer offset is not atomic, so it needs to be
4403 * externally synchronized with calls to @ref glfwGetTime.
Camilla Berglund0e205772014-03-24 11:58:35 +01004404 *
Camilla Berglund4188c262015-01-18 01:55:25 +01004405 * @sa @ref time
Camilla Berglunde248fb62013-03-29 14:06:23 +01004406 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01004407 * @since Added in version 2.2.
Camilla Berglund4591ad22014-09-18 15:03:29 +02004408 *
4409 * @ingroup input
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004410 */
4411GLFWAPI void glfwSetTime(double time);
4412
Camilla Berglund31f67dd2016-03-06 11:38:55 +01004413/*! @brief Returns the current value of the raw timer.
4414 *
Camilla Berglund337c77a2016-03-06 14:11:14 +01004415 * This function returns the current value of the raw timer, measured in
4416 * 1&nbsp;/&nbsp;frequency seconds. To get the frequency, call @ref
4417 * glfwGetTimerFrequency.
Camilla Berglund31f67dd2016-03-06 11:38:55 +01004418 *
4419 * @return The value of the timer, or zero if an
4420 * [error](@ref error_handling) occurred.
4421 *
Camilla Berglund46fce402016-03-07 13:35:37 +01004422 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
Camilla Berglund31f67dd2016-03-06 11:38:55 +01004423 *
4424 * @thread_safety This function may be called from any thread.
4425 *
4426 * @sa @ref time
Camilla Berglund7e9e3212016-09-14 20:17:26 +02004427 * @sa @ref glfwGetTimerFrequency
Camilla Berglund31f67dd2016-03-06 11:38:55 +01004428 *
4429 * @since Added in version 3.2.
4430 *
4431 * @ingroup input
4432 */
Camilla Berglund5661d032016-03-23 10:09:07 +01004433GLFWAPI uint64_t glfwGetTimerValue(void);
Camilla Berglund31f67dd2016-03-06 11:38:55 +01004434
4435/*! @brief Returns the frequency, in Hz, of the raw timer.
4436 *
Camilla Berglunddefaea32016-03-07 13:36:54 +01004437 * This function returns the frequency, in Hz, of the raw timer.
4438 *
Camilla Berglund31f67dd2016-03-06 11:38:55 +01004439 * @return The frequency of the timer, in Hz, or zero if an
4440 * [error](@ref error_handling) occurred.
4441 *
Camilla Berglund46fce402016-03-07 13:35:37 +01004442 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
Camilla Berglund31f67dd2016-03-06 11:38:55 +01004443 *
4444 * @thread_safety This function may be called from any thread.
4445 *
4446 * @sa @ref time
Camilla Berglund7e9e3212016-09-14 20:17:26 +02004447 * @sa @ref glfwGetTimerValue
Camilla Berglund31f67dd2016-03-06 11:38:55 +01004448 *
4449 * @since Added in version 3.2.
4450 *
4451 * @ingroup input
4452 */
Camilla Berglund5661d032016-03-23 10:09:07 +01004453GLFWAPI uint64_t glfwGetTimerFrequency(void);
Camilla Berglund31f67dd2016-03-06 11:38:55 +01004454
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004455/*! @brief Makes the context of the specified window current for the calling
4456 * thread.
4457 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02004458 * This function makes the OpenGL or OpenGL ES context of the specified window
4459 * current on the calling thread. A context can only be made current on
4460 * a single thread at a time and each thread can have only a single current
4461 * context at a time.
4462 *
4463 * By default, making a context non-current implicitly forces a pipeline flush.
4464 * On machines that support `GL_KHR_context_flush_control`, you can control
4465 * whether a context performs this flush by setting the
Camilla Löwyce161c22016-12-06 01:14:23 +01004466 * [GLFW_CONTEXT_RELEASE_BEHAVIOR](@ref GLFW_CONTEXT_RELEASE_BEHAVIOR_hint)
4467 * hint.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004468 *
Camilla Berglund98b478f2015-11-05 13:44:15 +01004469 * The specified window must have an OpenGL or OpenGL ES context. Specifying
4470 * a window without a context will generate a @ref GLFW_NO_WINDOW_CONTEXT
4471 * error.
4472 *
Camilla Berglund71d2b572013-03-12 15:33:05 +01004473 * @param[in] window The window whose context to make current, or `NULL` to
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004474 * detach the current context.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004475 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01004476 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
4477 * GLFW_NO_WINDOW_CONTEXT and @ref GLFW_PLATFORM_ERROR.
4478 *
Camilla Berglund951a9582016-01-31 21:32:14 +01004479 * @thread_safety This function may be called from any thread.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004480 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02004481 * @sa @ref context_current
Camilla Berglund7e9e3212016-09-14 20:17:26 +02004482 * @sa @ref glfwGetCurrentContext
Camilla Berglunde248fb62013-03-29 14:06:23 +01004483 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01004484 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02004485 *
Camilla Berglunde248fb62013-03-29 14:06:23 +01004486 * @ingroup context
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004487 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01004488GLFWAPI void glfwMakeContextCurrent(GLFWwindow* window);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004489
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004490/*! @brief Returns the window whose context is current on the calling thread.
4491 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02004492 * This function returns the window whose OpenGL or OpenGL ES context is
4493 * current on the calling thread.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004494 *
Camilla Berglund71d2b572013-03-12 15:33:05 +01004495 * @return The window whose context is current, or `NULL` if no window's
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004496 * context is current.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004497 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01004498 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
4499 *
Camilla Berglund951a9582016-01-31 21:32:14 +01004500 * @thread_safety This function may be called from any thread.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004501 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02004502 * @sa @ref context_current
Camilla Berglund7e9e3212016-09-14 20:17:26 +02004503 * @sa @ref glfwMakeContextCurrent
Camilla Berglunde248fb62013-03-29 14:06:23 +01004504 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01004505 * @since Added in version 3.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02004506 *
Camilla Berglunde248fb62013-03-29 14:06:23 +01004507 * @ingroup context
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004508 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01004509GLFWAPI GLFWwindow* glfwGetCurrentContext(void);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004510
4511/*! @brief Swaps the front and back buffers of the specified window.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004512 *
Camilla Berglund001c50c2016-02-19 09:13:56 +01004513 * This function swaps the front and back buffers of the specified window when
4514 * rendering with OpenGL or OpenGL ES. If the swap interval is greater than
4515 * zero, the GPU driver waits the specified number of screen updates before
4516 * swapping the buffers.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004517 *
Camilla Berglund98b478f2015-11-05 13:44:15 +01004518 * The specified window must have an OpenGL or OpenGL ES context. Specifying
4519 * a window without a context will generate a @ref GLFW_NO_WINDOW_CONTEXT
4520 * error.
4521 *
Camilla Berglund001c50c2016-02-19 09:13:56 +01004522 * This function does not apply to Vulkan. If you are rendering with Vulkan,
4523 * see `vkQueuePresentKHR` instead.
4524 *
Camilla Berglund9492fc52013-01-17 17:51:12 +01004525 * @param[in] window The window whose buffers to swap.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004526 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01004527 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
4528 * GLFW_NO_WINDOW_CONTEXT and @ref GLFW_PLATFORM_ERROR.
4529 *
Camilla Berglund951a9582016-01-31 21:32:14 +01004530 * @remark __EGL:__ The context of the specified window must be current on the
Camilla Berglund276b1bc2016-01-31 19:17:18 +01004531 * calling thread.
4532 *
Camilla Berglund951a9582016-01-31 21:32:14 +01004533 * @thread_safety This function may be called from any thread.
Camilla Berglund401033c2013-03-12 19:17:07 +01004534 *
Camilla Berglund4188c262015-01-18 01:55:25 +01004535 * @sa @ref buffer_swap
Camilla Berglund7e9e3212016-09-14 20:17:26 +02004536 * @sa @ref glfwSwapInterval
Camilla Berglunde248fb62013-03-29 14:06:23 +01004537 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01004538 * @since Added in version 1.0.
Camilla Berglund951a9582016-01-31 21:32:14 +01004539 * @glfw3 Added window handle parameter.
Camilla Berglund4591ad22014-09-18 15:03:29 +02004540 *
4541 * @ingroup window
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004542 */
Camilla Berglund9af960e2013-01-05 21:13:28 +01004543GLFWAPI void glfwSwapBuffers(GLFWwindow* window);
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004544
4545/*! @brief Sets the swap interval for the current context.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004546 *
Camilla Berglund001c50c2016-02-19 09:13:56 +01004547 * This function sets the swap interval for the current OpenGL or OpenGL ES
4548 * context, i.e. the number of screen updates to wait from the time @ref
4549 * glfwSwapBuffers was called before swapping the buffers and returning. This
4550 * is sometimes called _vertical synchronization_, _vertical retrace
4551 * synchronization_ or just _vsync_.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004552 *
Camilla Berglund5fd409b2013-06-05 17:53:13 +02004553 * Contexts that support either of the `WGL_EXT_swap_control_tear` and
Camilla Berglund8282a8f2013-04-10 23:01:12 +02004554 * `GLX_EXT_swap_control_tear` extensions also accept negative swap intervals,
4555 * which allow the driver to swap even if a frame arrives a little bit late.
4556 * You can check for the presence of these extensions using @ref
4557 * glfwExtensionSupported. For more information about swap tearing, see the
4558 * extension specifications.
4559 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02004560 * A context must be current on the calling thread. Calling this function
Camilla Berglundce8f97c2015-01-11 23:33:14 +01004561 * without a current context will cause a @ref GLFW_NO_CURRENT_CONTEXT error.
Camilla Berglund4591ad22014-09-18 15:03:29 +02004562 *
Camilla Berglund001c50c2016-02-19 09:13:56 +01004563 * This function does not apply to Vulkan. If you are rendering with Vulkan,
4564 * see the present mode of your swapchain instead.
4565 *
Camilla Berglund5fd409b2013-06-05 17:53:13 +02004566 * @param[in] interval The minimum number of screen updates to wait for
4567 * until the buffers are swapped by @ref glfwSwapBuffers.
4568 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01004569 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
4570 * GLFW_NO_CURRENT_CONTEXT and @ref GLFW_PLATFORM_ERROR.
4571 *
Camilla Berglund951a9582016-01-31 21:32:14 +01004572 * @remark This function is not called during context creation, leaving the
Camilla Berglund11c22d62015-02-19 15:33:51 +01004573 * swap interval set to whatever is the default on that platform. This is done
Camilla Berglund3af1c412013-09-19 21:37:01 +02004574 * because some swap interval extensions used by GLFW do not allow the swap
4575 * interval to be reset to zero once it has been set to a non-zero value.
4576 *
Camilla Berglund951a9582016-01-31 21:32:14 +01004577 * @remark Some GPU drivers do not honor the requested swap interval, either
Camilla Berglund11c22d62015-02-19 15:33:51 +01004578 * because of a user setting that overrides the application's request or due to
4579 * bugs in the driver.
Camilla Berglund8282a8f2013-04-10 23:01:12 +02004580 *
Camilla Berglund951a9582016-01-31 21:32:14 +01004581 * @thread_safety This function may be called from any thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02004582 *
Camilla Berglund4188c262015-01-18 01:55:25 +01004583 * @sa @ref buffer_swap
Camilla Berglund7e9e3212016-09-14 20:17:26 +02004584 * @sa @ref glfwSwapBuffers
Camilla Berglunde248fb62013-03-29 14:06:23 +01004585 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01004586 * @since Added in version 1.0.
Camilla Berglund4591ad22014-09-18 15:03:29 +02004587 *
Camilla Berglunde248fb62013-03-29 14:06:23 +01004588 * @ingroup context
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004589 */
4590GLFWAPI void glfwSwapInterval(int interval);
4591
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004592/*! @brief Returns whether the specified extension is available.
4593 *
Camilla Berglund608109c2013-04-11 20:18:46 +02004594 * This function returns whether the specified
Camilla Berglund001c50c2016-02-19 09:13:56 +01004595 * [API extension](@ref context_glext) is supported by the current OpenGL or
4596 * OpenGL ES context. It searches both for client API extension and context
4597 * creation API extensions.
Camilla Berglund4591ad22014-09-18 15:03:29 +02004598 *
4599 * A context must be current on the calling thread. Calling this function
Camilla Berglundce8f97c2015-01-11 23:33:14 +01004600 * without a current context will cause a @ref GLFW_NO_CURRENT_CONTEXT error.
Camilla Berglund4591ad22014-09-18 15:03:29 +02004601 *
4602 * As this functions retrieves and searches one or more extension strings each
4603 * call, it is recommended that you cache its results if it is going to be used
4604 * frequently. The extension strings will not change during the lifetime of
4605 * a context, so there is no danger in doing this.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004606 *
Camilla Berglund001c50c2016-02-19 09:13:56 +01004607 * This function does not apply to Vulkan. If you are using Vulkan, see @ref
4608 * glfwGetRequiredInstanceExtensions, `vkEnumerateInstanceExtensionProperties`
4609 * and `vkEnumerateDeviceExtensionProperties` instead.
4610 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004611 * @param[in] extension The ASCII encoded name of the extension.
Camilla Berglund0eccf752015-08-23 19:30:04 +02004612 * @return `GLFW_TRUE` if the extension is available, or `GLFW_FALSE`
4613 * otherwise.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004614 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01004615 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
4616 * GLFW_NO_CURRENT_CONTEXT, @ref GLFW_INVALID_VALUE and @ref
4617 * GLFW_PLATFORM_ERROR.
4618 *
Camilla Berglund951a9582016-01-31 21:32:14 +01004619 * @thread_safety This function may be called from any thread.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004620 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02004621 * @sa @ref context_glext
Camilla Berglund7e9e3212016-09-14 20:17:26 +02004622 * @sa @ref glfwGetProcAddress
Camilla Berglund4591ad22014-09-18 15:03:29 +02004623 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01004624 * @since Added in version 1.0.
Camilla Berglunde248fb62013-03-29 14:06:23 +01004625 *
4626 * @ingroup context
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004627 */
4628GLFWAPI int glfwExtensionSupported(const char* extension);
4629
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004630/*! @brief Returns the address of the specified function for the current
4631 * context.
4632 *
Camilla Berglund001c50c2016-02-19 09:13:56 +01004633 * This function returns the address of the specified OpenGL or OpenGL ES
Camilla Berglund11c22d62015-02-19 15:33:51 +01004634 * [core or extension function](@ref context_glext), if it is supported
Camilla Berglund1f5f20e2013-05-27 17:10:34 +02004635 * by the current context.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004636 *
Camilla Berglund4591ad22014-09-18 15:03:29 +02004637 * A context must be current on the calling thread. Calling this function
Camilla Berglundce8f97c2015-01-11 23:33:14 +01004638 * without a current context will cause a @ref GLFW_NO_CURRENT_CONTEXT error.
Camilla Berglund4591ad22014-09-18 15:03:29 +02004639 *
Camilla Berglund001c50c2016-02-19 09:13:56 +01004640 * This function does not apply to Vulkan. If you are rendering with Vulkan,
4641 * see @ref glfwGetInstanceProcAddress, `vkGetInstanceProcAddr` and
4642 * `vkGetDeviceProcAddr` instead.
4643 *
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004644 * @param[in] procname The ASCII encoded name of the function.
Camilla Berglunda36e3a22015-11-05 17:14:26 +01004645 * @return The address of the function, or `NULL` if an
4646 * [error](@ref error_handling) occurred.
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004647 *
Camilla Berglundf51cf812016-02-05 00:51:40 +01004648 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
4649 * GLFW_NO_CURRENT_CONTEXT and @ref GLFW_PLATFORM_ERROR.
4650 *
Camilla Berglund951a9582016-01-31 21:32:14 +01004651 * @remark The address of a given function is not guaranteed to be the same
Camilla Berglund4591ad22014-09-18 15:03:29 +02004652 * between contexts.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004653 *
Camilla Berglund951a9582016-01-31 21:32:14 +01004654 * @remark This function may return a non-`NULL` address despite the
Camilla Berglund11c22d62015-02-19 15:33:51 +01004655 * associated version or extension not being available. Always check the
Camilla Berglundc8e06872015-08-27 21:40:22 +02004656 * context version or extension string first.
Camilla Berglund11c22d62015-02-19 15:33:51 +01004657 *
Camilla Berglund951a9582016-01-31 21:32:14 +01004658 * @pointer_lifetime The returned function pointer is valid until the context
4659 * is destroyed or the library is terminated.
Camilla Berglund4591ad22014-09-18 15:03:29 +02004660 *
Camilla Berglund951a9582016-01-31 21:32:14 +01004661 * @thread_safety This function may be called from any thread.
Camilla Berglund4591ad22014-09-18 15:03:29 +02004662 *
4663 * @sa @ref context_glext
Camilla Berglund7e9e3212016-09-14 20:17:26 +02004664 * @sa @ref glfwExtensionSupported
Camilla Berglund4591ad22014-09-18 15:03:29 +02004665 *
Camilla Berglund832c2ff2016-01-31 22:35:11 +01004666 * @since Added in version 1.0.
Camilla Berglund2d5fb772013-03-18 19:11:02 +01004667 *
4668 * @ingroup context
Camilla Berglundbce2cd62012-11-22 16:38:24 +01004669 */
Camilla Berglundbf42c3c2012-06-05 00:16:40 +02004670GLFWAPI GLFWglproc glfwGetProcAddress(const char* procname);
Camilla Berglund3249f812010-09-07 17:34:51 +02004671
Camilla Löwy98bdd362017-02-07 20:56:48 +01004672/*! @brief Returns whether the Vulkan loader and an ICD have been found.
Camilla Berglund9b75bff2015-08-10 20:19:04 +02004673 *
Camilla Löwy98bdd362017-02-07 20:56:48 +01004674 * This function returns whether the Vulkan loader and any minimally functional
4675 * ICD have been found.
Camilla Berglund9b75bff2015-08-10 20:19:04 +02004676 *
Camilla Löwy98bdd362017-02-07 20:56:48 +01004677 * The availability of a Vulkan loader and even an ICD does not by itself
4678 * guarantee that surface creation or even instance creation is possible.
4679 * For example, on Fermi systems Nvidia will install an ICD that provides no
4680 * actual Vulkan support. Call @ref glfwGetRequiredInstanceExtensions to check
4681 * whether the extensions necessary for Vulkan surface creation are available
4682 * and @ref glfwGetPhysicalDevicePresentationSupport to check whether a queue
4683 * family of a physical device supports image presentation.
Camilla Berglund9b75bff2015-08-10 20:19:04 +02004684 *
Camilla Löwy98bdd362017-02-07 20:56:48 +01004685 * @return `GLFW_TRUE` if Vulkan is minimally available, or `GLFW_FALSE`
4686 * otherwise.
Camilla Berglund9b75bff2015-08-10 20:19:04 +02004687 *
4688 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
4689 *
4690 * @thread_safety This function may be called from any thread.
4691 *
4692 * @sa @ref vulkan_support
4693 *
4694 * @since Added in version 3.2.
4695 *
4696 * @ingroup vulkan
4697 */
4698GLFWAPI int glfwVulkanSupported(void);
4699
4700/*! @brief Returns the Vulkan instance extensions required by GLFW.
4701 *
4702 * This function returns an array of names of Vulkan instance extensions required
4703 * by GLFW for creating Vulkan surfaces for GLFW windows. If successful, the
4704 * list will always contains `VK_KHR_surface`, so if you don't require any
4705 * additional extensions you can pass this list directly to the
4706 * `VkInstanceCreateInfo` struct.
4707 *
4708 * If Vulkan is not available on the machine, this function returns `NULL` and
4709 * generates a @ref GLFW_API_UNAVAILABLE error. Call @ref glfwVulkanSupported
Camilla Löwy98bdd362017-02-07 20:56:48 +01004710 * to check whether Vulkan is at least minimally available.
Camilla Berglund9b75bff2015-08-10 20:19:04 +02004711 *
4712 * If Vulkan is available but no set of extensions allowing window surface
4713 * creation was found, this function returns `NULL`. You may still use Vulkan
4714 * for off-screen rendering and compute work.
4715 *
4716 * @param[out] count Where to store the number of extensions in the returned
4717 * array. This is set to zero if an error occurred.
4718 * @return An array of ASCII encoded extension names, or `NULL` if an
4719 * [error](@ref error_handling) occurred.
4720 *
4721 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
4722 * GLFW_API_UNAVAILABLE.
4723 *
Camilla Berglund67931bd2016-10-26 16:58:56 +02004724 * @remark Additional extensions may be required by future versions of GLFW.
Camilla Berglund9b75bff2015-08-10 20:19:04 +02004725 * You should check if any extensions you wish to enable are already in the
4726 * returned array, as it is an error to specify an extension more than once in
4727 * the `VkInstanceCreateInfo` struct.
4728 *
Camilla Berglunde94d1662016-10-14 01:46:56 +02004729 * @remark @macos This function currently only supports the
4730 * `VK_MVK_macos_surface` extension from MoltenVK.
4731 *
Camilla Berglund9b75bff2015-08-10 20:19:04 +02004732 * @pointer_lifetime The returned array is allocated and freed by GLFW. You
4733 * should not free it yourself. It is guaranteed to be valid only until the
4734 * library is terminated.
4735 *
4736 * @thread_safety This function may be called from any thread.
4737 *
4738 * @sa @ref vulkan_ext
Camilla Berglund7e9e3212016-09-14 20:17:26 +02004739 * @sa @ref glfwCreateWindowSurface
Camilla Berglund9b75bff2015-08-10 20:19:04 +02004740 *
4741 * @since Added in version 3.2.
4742 *
4743 * @ingroup vulkan
4744 */
Camilla Berglund7ab7d8b2016-03-23 10:24:01 +01004745GLFWAPI const char** glfwGetRequiredInstanceExtensions(uint32_t* count);
Camilla Berglund9b75bff2015-08-10 20:19:04 +02004746
4747#if defined(VK_VERSION_1_0)
4748
4749/*! @brief Returns the address of the specified Vulkan instance function.
4750 *
4751 * This function returns the address of the specified Vulkan core or extension
4752 * function for the specified instance. If instance is set to `NULL` it can
4753 * return any function exported from the Vulkan loader, including at least the
4754 * following functions:
4755 *
4756 * - `vkEnumerateInstanceExtensionProperties`
4757 * - `vkEnumerateInstanceLayerProperties`
4758 * - `vkCreateInstance`
4759 * - `vkGetInstanceProcAddr`
4760 *
4761 * If Vulkan is not available on the machine, this function returns `NULL` and
4762 * generates a @ref GLFW_API_UNAVAILABLE error. Call @ref glfwVulkanSupported
Camilla Löwy98bdd362017-02-07 20:56:48 +01004763 * to check whether Vulkan is at least minimally available.
Camilla Berglund9b75bff2015-08-10 20:19:04 +02004764 *
4765 * This function is equivalent to calling `vkGetInstanceProcAddr` with
4766 * a platform-specific query of the Vulkan loader as a fallback.
4767 *
4768 * @param[in] instance The Vulkan instance to query, or `NULL` to retrieve
4769 * functions related to instance creation.
4770 * @param[in] procname The ASCII encoded name of the function.
4771 * @return The address of the function, or `NULL` if an
4772 * [error](@ref error_handling) occurred.
4773 *
4774 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
4775 * GLFW_API_UNAVAILABLE.
4776 *
4777 * @pointer_lifetime The returned function pointer is valid until the library
4778 * is terminated.
4779 *
4780 * @thread_safety This function may be called from any thread.
4781 *
4782 * @sa @ref vulkan_proc
4783 *
4784 * @since Added in version 3.2.
4785 *
4786 * @ingroup vulkan
4787 */
4788GLFWAPI GLFWvkproc glfwGetInstanceProcAddress(VkInstance instance, const char* procname);
4789
4790/*! @brief Returns whether the specified queue family can present images.
4791 *
4792 * This function returns whether the specified queue family of the specified
4793 * physical device supports presentation to the platform GLFW was built for.
4794 *
4795 * If Vulkan or the required window surface creation instance extensions are
4796 * not available on the machine, or if the specified instance was not created
4797 * with the required extensions, this function returns `GLFW_FALSE` and
4798 * generates a @ref GLFW_API_UNAVAILABLE error. Call @ref glfwVulkanSupported
Camilla Löwy98bdd362017-02-07 20:56:48 +01004799 * to check whether Vulkan is at least minimally available and @ref
Camilla Berglund9b75bff2015-08-10 20:19:04 +02004800 * glfwGetRequiredInstanceExtensions to check what instance extensions are
4801 * required.
4802 *
4803 * @param[in] instance The instance that the physical device belongs to.
4804 * @param[in] device The physical device that the queue family belongs to.
4805 * @param[in] queuefamily The index of the queue family to query.
4806 * @return `GLFW_TRUE` if the queue family supports presentation, or
4807 * `GLFW_FALSE` otherwise.
4808 *
4809 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
4810 * GLFW_API_UNAVAILABLE and @ref GLFW_PLATFORM_ERROR.
4811 *
Camilla Berglunde94d1662016-10-14 01:46:56 +02004812 * @remark @macos This function currently always returns `GLFW_TRUE`, as the
4813 * `VK_MVK_macos_surface` extension does not provide
4814 * a `vkGetPhysicalDevice*PresentationSupport` type function.
4815 *
Camilla Berglund9b75bff2015-08-10 20:19:04 +02004816 * @thread_safety This function may be called from any thread. For
4817 * synchronization details of Vulkan objects, see the Vulkan specification.
4818 *
4819 * @sa @ref vulkan_present
4820 *
4821 * @since Added in version 3.2.
4822 *
4823 * @ingroup vulkan
4824 */
4825GLFWAPI int glfwGetPhysicalDevicePresentationSupport(VkInstance instance, VkPhysicalDevice device, uint32_t queuefamily);
4826
4827/*! @brief Creates a Vulkan surface for the specified window.
4828 *
4829 * This function creates a Vulkan surface for the specified window.
4830 *
Camilla Löwy98bdd362017-02-07 20:56:48 +01004831 * If the Vulkan loader or at least one minimally functional ICD were not found,
4832 * this function returns `VK_ERROR_INITIALIZATION_FAILED` and generates a @ref
4833 * GLFW_API_UNAVAILABLE error. Call @ref glfwVulkanSupported to check whether
4834 * Vulkan is at least minimally available.
Camilla Berglund9b75bff2015-08-10 20:19:04 +02004835 *
4836 * If the required window surface creation instance extensions are not
4837 * available or if the specified instance was not created with these extensions
4838 * enabled, this function returns `VK_ERROR_EXTENSION_NOT_PRESENT` and
4839 * generates a @ref GLFW_API_UNAVAILABLE error. Call @ref
4840 * glfwGetRequiredInstanceExtensions to check what instance extensions are
4841 * required.
4842 *
4843 * The window surface must be destroyed before the specified Vulkan instance.
4844 * It is the responsibility of the caller to destroy the window surface. GLFW
4845 * does not destroy it for you. Call `vkDestroySurfaceKHR` to destroy the
4846 * surface.
4847 *
4848 * @param[in] instance The Vulkan instance to create the surface in.
4849 * @param[in] window The window to create the surface for.
4850 * @param[in] allocator The allocator to use, or `NULL` to use the default
4851 * allocator.
4852 * @param[out] surface Where to store the handle of the surface. This is set
4853 * to `VK_NULL_HANDLE` if an error occurred.
4854 * @return `VK_SUCCESS` if successful, or a Vulkan error code if an
4855 * [error](@ref error_handling) occurred.
4856 *
4857 * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
4858 * GLFW_API_UNAVAILABLE and @ref GLFW_PLATFORM_ERROR.
4859 *
Camilla Berglund67931bd2016-10-26 16:58:56 +02004860 * @remark If an error occurs before the creation call is made, GLFW returns
Camilla Berglund9b75bff2015-08-10 20:19:04 +02004861 * the Vulkan error code most appropriate for the error. Appropriate use of
4862 * @ref glfwVulkanSupported and @ref glfwGetRequiredInstanceExtensions should
Camilla Berglundee33dcd2016-03-07 14:42:51 +01004863 * eliminate almost all occurrences of these errors.
Camilla Berglund9b75bff2015-08-10 20:19:04 +02004864 *
Camilla Berglunde94d1662016-10-14 01:46:56 +02004865 * @remark @macos This function currently only supports the
4866 * `VK_MVK_macos_surface` extension from MoltenVK.
4867 *
4868 * @remark @macos This function creates and sets a `CAMetalLayer` instance for
4869 * the window content view, which is required for MoltenVK to function.
4870 *
Camilla Berglund9b75bff2015-08-10 20:19:04 +02004871 * @thread_safety This function may be called from any thread. For
4872 * synchronization details of Vulkan objects, see the Vulkan specification.
4873 *
4874 * @sa @ref vulkan_surface
Camilla Berglund7e9e3212016-09-14 20:17:26 +02004875 * @sa @ref glfwGetRequiredInstanceExtensions
Camilla Berglund9b75bff2015-08-10 20:19:04 +02004876 *
4877 * @since Added in version 3.2.
4878 *
4879 * @ingroup vulkan
4880 */
4881GLFWAPI VkResult glfwCreateWindowSurface(VkInstance instance, GLFWwindow* window, const VkAllocationCallbacks* allocator, VkSurfaceKHR* surface);
4882
4883#endif /*VK_VERSION_1_0*/
4884
Camilla Berglund3249f812010-09-07 17:34:51 +02004885
Camilla Berglund4afc67c2011-07-27 17:09:17 +02004886/*************************************************************************
4887 * Global definition cleanup
4888 *************************************************************************/
4889
4890/* ------------------- BEGIN SYSTEM/COMPILER SPECIFIC -------------------- */
4891
Camilla Berglund4afc67c2011-07-27 17:09:17 +02004892#ifdef GLFW_WINGDIAPI_DEFINED
4893 #undef WINGDIAPI
4894 #undef GLFW_WINGDIAPI_DEFINED
4895#endif
4896
4897#ifdef GLFW_CALLBACK_DEFINED
4898 #undef CALLBACK
4899 #undef GLFW_CALLBACK_DEFINED
4900#endif
4901
4902/* -------------------- END SYSTEM/COMPILER SPECIFIC --------------------- */
4903
4904
Camilla Berglund3249f812010-09-07 17:34:51 +02004905#ifdef __cplusplus
4906}
4907#endif
4908
Camilla Berglundf8df91d2013-01-15 01:59:56 +01004909#endif /* _glfw3_h_ */
Camilla Berglund3249f812010-09-07 17:34:51 +02004910