summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt2
-rw-r--r--externals/glfw-3.0.4.bin/include/GLFW/glfw3native.h180
-rw-r--r--externals/glfw-3.0.4.bin/lib-mingw-i686/glfw3.dllbin172569 -> 0 bytes
-rw-r--r--externals/glfw-3.0.4.bin/lib-mingw-i686/libglfw3.abin83006 -> 0 bytes
-rw-r--r--externals/glfw-3.0.4.bin/lib-mingw-x86_64/glfw3.dllbin199843 -> 0 bytes
-rw-r--r--externals/glfw-3.0.4.bin/lib-mingw-x86_64/libglfw3.abin89300 -> 0 bytes
-rw-r--r--externals/glfw-3.0.4.bin/lib-msvc_v110-Win32/glfw3.dllbin43520 -> 0 bytes
-rw-r--r--externals/glfw-3.0.4.bin/lib-msvc_v110-Win32/glfw3.libbin123024 -> 0 bytes
-rw-r--r--externals/glfw-3.0.4.bin/lib-msvc_v110-Win32/glfw3dll.libbin17748 -> 0 bytes
-rw-r--r--externals/glfw-3.0.4.bin/lib-msvc_v110-x64/glfw3.dllbin48640 -> 0 bytes
-rw-r--r--externals/glfw-3.0.4.bin/lib-msvc_v110-x64/glfw3.libbin180886 -> 0 bytes
-rw-r--r--externals/glfw-3.0.4.bin/lib-msvc_v110-x64/glfw3dll.libbin17418 -> 0 bytes
-rw-r--r--externals/glfw-3.0.4.bin/lib-msvc_v120-Win32/glfw3.dllbin43520 -> 0 bytes
-rw-r--r--externals/glfw-3.0.4.bin/lib-msvc_v120-Win32/glfw3.libbin123566 -> 0 bytes
-rw-r--r--externals/glfw-3.0.4.bin/lib-msvc_v120-Win32/glfw3dll.libbin17748 -> 0 bytes
-rw-r--r--externals/glfw-3.0.4.bin/lib-msvc_v120-x64/glfw3.dllbin48640 -> 0 bytes
-rw-r--r--externals/glfw-3.0.4.bin/lib-msvc_v120-x64/glfw3.libbin180408 -> 0 bytes
-rw-r--r--externals/glfw-3.0.4.bin/lib-msvc_v120-x64/glfw3dll.libbin17418 -> 0 bytes
-rw-r--r--externals/glfw-3.1.1.bin/COPYING.txt (renamed from externals/glfw-3.0.4.bin/COPYING.txt)0
-rw-r--r--externals/glfw-3.1.1.bin/include/GLFW/glfw3.h (renamed from externals/glfw-3.0.4.bin/include/GLFW/glfw3.h)2014
-rw-r--r--externals/glfw-3.1.1.bin/include/GLFW/glfw3native.h356
-rw-r--r--externals/glfw-3.1.1.bin/lib-mingw-i686/glfw3.dllbin0 -> 196839 bytes
-rw-r--r--externals/glfw-3.1.1.bin/lib-mingw-i686/glfw3dll.a (renamed from externals/glfw-3.0.4.bin/lib-mingw-i686/glfw3dll.a)bin48318 -> 54834 bytes
-rw-r--r--externals/glfw-3.1.1.bin/lib-mingw-i686/libglfw3.abin0 -> 89732 bytes
-rw-r--r--externals/glfw-3.1.1.bin/lib-mingw-x86_64/glfw3.dllbin0 -> 235754 bytes
-rw-r--r--externals/glfw-3.1.1.bin/lib-mingw-x86_64/glfw3dll.a (renamed from externals/glfw-3.0.4.bin/lib-mingw-x86_64/glfw3dll.a)bin47144 -> 53500 bytes
-rw-r--r--externals/glfw-3.1.1.bin/lib-mingw-x86_64/libglfw3.abin0 -> 97354 bytes
-rw-r--r--externals/glfw-3.1.1.bin/lib-msvc_v120-Win32/glfw3.dllbin0 -> 47104 bytes
-rw-r--r--externals/glfw-3.1.1.bin/lib-msvc_v120-Win32/glfw3.libbin0 -> 150616 bytes
-rw-r--r--externals/glfw-3.1.1.bin/lib-msvc_v120-Win32/glfw3dll.libbin0 -> 19984 bytes
-rw-r--r--externals/glfw-3.1.1.bin/lib-msvc_v120-x64/glfw3.dllbin0 -> 53248 bytes
-rw-r--r--externals/glfw-3.1.1.bin/lib-msvc_v120-x64/glfw3.libbin0 -> 196774 bytes
-rw-r--r--externals/glfw-3.1.1.bin/lib-msvc_v120-x64/glfw3dll.libbin0 -> 19602 bytes
-rw-r--r--src/core/arm/dyncom/arm_dyncom_interpreter.cpp7
-rw-r--r--src/core/hle/service/gsp_gpu.cpp48
-rw-r--r--src/core/hle/svc.cpp2
36 files changed, 1928 insertions, 681 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index fc742317c..9fb311b11 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -107,7 +107,7 @@ if (ENABLE_GLFW)
107 set(TMP_TOOLSET "mingw-${TMP_ARCH}") 107 set(TMP_TOOLSET "mingw-${TMP_ARCH}")
108 endif() 108 endif()
109 109
110 set(GLFW_PREFIX "${CMAKE_CURRENT_SOURCE_DIR}/externals/glfw-3.0.4.bin") 110 set(GLFW_PREFIX "${CMAKE_CURRENT_SOURCE_DIR}/externals/glfw-3.1.1.bin")
111 set(GLFW_INCLUDE_DIRS "${GLFW_PREFIX}/include" CACHE PATH "Path to GLFW3 headers") 111 set(GLFW_INCLUDE_DIRS "${GLFW_PREFIX}/include" CACHE PATH "Path to GLFW3 headers")
112 set(GLFW_LIBRARY_DIRS "${GLFW_PREFIX}/lib-${TMP_TOOLSET}" CACHE PATH "Path to GLFW3 libraries") 112 set(GLFW_LIBRARY_DIRS "${GLFW_PREFIX}/lib-${TMP_TOOLSET}" CACHE PATH "Path to GLFW3 libraries")
113 113
diff --git a/externals/glfw-3.0.4.bin/include/GLFW/glfw3native.h b/externals/glfw-3.0.4.bin/include/GLFW/glfw3native.h
deleted file mode 100644
index d570f5876..000000000
--- a/externals/glfw-3.0.4.bin/include/GLFW/glfw3native.h
+++ /dev/null
@@ -1,180 +0,0 @@
1/*************************************************************************
2 * GLFW 3.0 - www.glfw.org
3 * A library for OpenGL, window and input
4 *------------------------------------------------------------------------
5 * Copyright (c) 2002-2006 Marcus Geelnard
6 * Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
7 *
8 * This software is provided 'as-is', without any express or implied
9 * warranty. In no event will the authors be held liable for any damages
10 * arising from the use of this software.
11 *
12 * Permission is granted to anyone to use this software for any purpose,
13 * including commercial applications, and to alter it and redistribute it
14 * freely, subject to the following restrictions:
15 *
16 * 1. The origin of this software must not be misrepresented; you must not
17 * claim that you wrote the original software. If you use this software
18 * in a product, an acknowledgment in the product documentation would
19 * be appreciated but is not required.
20 *
21 * 2. Altered source versions must be plainly marked as such, and must not
22 * be misrepresented as being the original software.
23 *
24 * 3. This notice may not be removed or altered from any source
25 * distribution.
26 *
27 *************************************************************************/
28
29#ifndef _glfw3_native_h_
30#define _glfw3_native_h_
31
32#ifdef __cplusplus
33extern "C" {
34#endif
35
36
37/*************************************************************************
38 * Doxygen documentation
39 *************************************************************************/
40
41/*! @defgroup native Native access
42 *
43 * **By using the native API, you assert that you know what you're doing and
44 * how to fix problems caused by using it. If you don't, you shouldn't be
45 * using it.**
46 *
47 * Before the inclusion of @ref glfw3native.h, you must define exactly one
48 * window API macro and exactly one context API macro. Failure to do this
49 * will cause a compile-time error.
50 *
51 * The available window API macros are:
52 * * `GLFW_EXPOSE_NATIVE_WIN32`
53 * * `GLFW_EXPOSE_NATIVE_COCOA`
54 * * `GLFW_EXPOSE_NATIVE_X11`
55 *
56 * The available context API macros are:
57 * * `GLFW_EXPOSE_NATIVE_WGL`
58 * * `GLFW_EXPOSE_NATIVE_NSGL`
59 * * `GLFW_EXPOSE_NATIVE_GLX`
60 * * `GLFW_EXPOSE_NATIVE_EGL`
61 *
62 * These macros select which of the native access functions that are declared
63 * and which platform-specific headers to include. It is then up your (by
64 * definition platform-specific) code to handle which of these should be
65 * defined.
66 */
67
68
69/*************************************************************************
70 * System headers and types
71 *************************************************************************/
72
73#if defined(GLFW_EXPOSE_NATIVE_WIN32)
74 #include <windows.h>
75#elif defined(GLFW_EXPOSE_NATIVE_COCOA)
76 #if defined(__OBJC__)
77 #import <Cocoa/Cocoa.h>
78 #else
79 typedef void* id;
80 #endif
81#elif defined(GLFW_EXPOSE_NATIVE_X11)
82 #include <X11/Xlib.h>
83#else
84 #error "No window API specified"
85#endif
86
87#if defined(GLFW_EXPOSE_NATIVE_WGL)
88 /* WGL is declared by windows.h */
89#elif defined(GLFW_EXPOSE_NATIVE_NSGL)
90 /* NSGL is declared by Cocoa.h */
91#elif defined(GLFW_EXPOSE_NATIVE_GLX)
92 #include <GL/glx.h>
93#elif defined(GLFW_EXPOSE_NATIVE_EGL)
94 #include <EGL/egl.h>
95#else
96 #error "No context API specified"
97#endif
98
99
100/*************************************************************************
101 * Functions
102 *************************************************************************/
103
104#if defined(GLFW_EXPOSE_NATIVE_WIN32)
105/*! @brief Returns the `HWND` of the specified window.
106 * @return The `HWND` of the specified window.
107 * @ingroup native
108 */
109GLFWAPI HWND glfwGetWin32Window(GLFWwindow* window);
110#endif
111
112#if defined(GLFW_EXPOSE_NATIVE_WGL)
113/*! @brief Returns the `HGLRC` of the specified window.
114 * @return The `HGLRC` of the specified window.
115 * @ingroup native
116 */
117GLFWAPI HGLRC glfwGetWGLContext(GLFWwindow* window);
118#endif
119
120#if defined(GLFW_EXPOSE_NATIVE_COCOA)
121/*! @brief Returns the `NSWindow` of the specified window.
122 * @return The `NSWindow` of the specified window.
123 * @ingroup native
124 */
125GLFWAPI id glfwGetCocoaWindow(GLFWwindow* window);
126#endif
127
128#if defined(GLFW_EXPOSE_NATIVE_NSGL)
129/*! @brief Returns the `NSOpenGLContext` of the specified window.
130 * @return The `NSOpenGLContext` of the specified window.
131 * @ingroup native
132 */
133GLFWAPI id glfwGetNSGLContext(GLFWwindow* window);
134#endif
135
136#if defined(GLFW_EXPOSE_NATIVE_X11)
137/*! @brief Returns the `Display` used by GLFW.
138 * @return The `Display` used by GLFW.
139 * @ingroup native
140 */
141GLFWAPI Display* glfwGetX11Display(void);
142/*! @brief Returns the `Window` of the specified window.
143 * @return The `Window` of the specified window.
144 * @ingroup native
145 */
146GLFWAPI Window glfwGetX11Window(GLFWwindow* window);
147#endif
148
149#if defined(GLFW_EXPOSE_NATIVE_GLX)
150/*! @brief Returns the `GLXContext` of the specified window.
151 * @return The `GLXContext` of the specified window.
152 * @ingroup native
153 */
154GLFWAPI GLXContext glfwGetGLXContext(GLFWwindow* window);
155#endif
156
157#if defined(GLFW_EXPOSE_NATIVE_EGL)
158/*! @brief Returns the `EGLDisplay` used by GLFW.
159 * @return The `EGLDisplay` used by GLFW.
160 * @ingroup native
161 */
162GLFWAPI EGLDisplay glfwGetEGLDisplay(void);
163/*! @brief Returns the `EGLContext` of the specified window.
164 * @return The `EGLContext` of the specified window.
165 * @ingroup native
166 */
167GLFWAPI EGLContext glfwGetEGLContext(GLFWwindow* window);
168/*! @brief Returns the `EGLSurface` of the specified window.
169 * @return The `EGLSurface` of the specified window.
170 * @ingroup native
171 */
172GLFWAPI EGLSurface glfwGetEGLSurface(GLFWwindow* window);
173#endif
174
175#ifdef __cplusplus
176}
177#endif
178
179#endif /* _glfw3_native_h_ */
180
diff --git a/externals/glfw-3.0.4.bin/lib-mingw-i686/glfw3.dll b/externals/glfw-3.0.4.bin/lib-mingw-i686/glfw3.dll
deleted file mode 100644
index 5941d1a0a..000000000
--- a/externals/glfw-3.0.4.bin/lib-mingw-i686/glfw3.dll
+++ /dev/null
Binary files differ
diff --git a/externals/glfw-3.0.4.bin/lib-mingw-i686/libglfw3.a b/externals/glfw-3.0.4.bin/lib-mingw-i686/libglfw3.a
deleted file mode 100644
index 7138ee9b5..000000000
--- a/externals/glfw-3.0.4.bin/lib-mingw-i686/libglfw3.a
+++ /dev/null
Binary files differ
diff --git a/externals/glfw-3.0.4.bin/lib-mingw-x86_64/glfw3.dll b/externals/glfw-3.0.4.bin/lib-mingw-x86_64/glfw3.dll
deleted file mode 100644
index 49cf94a80..000000000
--- a/externals/glfw-3.0.4.bin/lib-mingw-x86_64/glfw3.dll
+++ /dev/null
Binary files differ
diff --git a/externals/glfw-3.0.4.bin/lib-mingw-x86_64/libglfw3.a b/externals/glfw-3.0.4.bin/lib-mingw-x86_64/libglfw3.a
deleted file mode 100644
index d1ca9a42a..000000000
--- a/externals/glfw-3.0.4.bin/lib-mingw-x86_64/libglfw3.a
+++ /dev/null
Binary files differ
diff --git a/externals/glfw-3.0.4.bin/lib-msvc_v110-Win32/glfw3.dll b/externals/glfw-3.0.4.bin/lib-msvc_v110-Win32/glfw3.dll
deleted file mode 100644
index d66c5dd89..000000000
--- a/externals/glfw-3.0.4.bin/lib-msvc_v110-Win32/glfw3.dll
+++ /dev/null
Binary files differ
diff --git a/externals/glfw-3.0.4.bin/lib-msvc_v110-Win32/glfw3.lib b/externals/glfw-3.0.4.bin/lib-msvc_v110-Win32/glfw3.lib
deleted file mode 100644
index 2f972ab1a..000000000
--- a/externals/glfw-3.0.4.bin/lib-msvc_v110-Win32/glfw3.lib
+++ /dev/null
Binary files differ
diff --git a/externals/glfw-3.0.4.bin/lib-msvc_v110-Win32/glfw3dll.lib b/externals/glfw-3.0.4.bin/lib-msvc_v110-Win32/glfw3dll.lib
deleted file mode 100644
index 365cdbafb..000000000
--- a/externals/glfw-3.0.4.bin/lib-msvc_v110-Win32/glfw3dll.lib
+++ /dev/null
Binary files differ
diff --git a/externals/glfw-3.0.4.bin/lib-msvc_v110-x64/glfw3.dll b/externals/glfw-3.0.4.bin/lib-msvc_v110-x64/glfw3.dll
deleted file mode 100644
index 44e6d49e4..000000000
--- a/externals/glfw-3.0.4.bin/lib-msvc_v110-x64/glfw3.dll
+++ /dev/null
Binary files differ
diff --git a/externals/glfw-3.0.4.bin/lib-msvc_v110-x64/glfw3.lib b/externals/glfw-3.0.4.bin/lib-msvc_v110-x64/glfw3.lib
deleted file mode 100644
index 77757999e..000000000
--- a/externals/glfw-3.0.4.bin/lib-msvc_v110-x64/glfw3.lib
+++ /dev/null
Binary files differ
diff --git a/externals/glfw-3.0.4.bin/lib-msvc_v110-x64/glfw3dll.lib b/externals/glfw-3.0.4.bin/lib-msvc_v110-x64/glfw3dll.lib
deleted file mode 100644
index 20b548406..000000000
--- a/externals/glfw-3.0.4.bin/lib-msvc_v110-x64/glfw3dll.lib
+++ /dev/null
Binary files differ
diff --git a/externals/glfw-3.0.4.bin/lib-msvc_v120-Win32/glfw3.dll b/externals/glfw-3.0.4.bin/lib-msvc_v120-Win32/glfw3.dll
deleted file mode 100644
index e15fc43b4..000000000
--- a/externals/glfw-3.0.4.bin/lib-msvc_v120-Win32/glfw3.dll
+++ /dev/null
Binary files differ
diff --git a/externals/glfw-3.0.4.bin/lib-msvc_v120-Win32/glfw3.lib b/externals/glfw-3.0.4.bin/lib-msvc_v120-Win32/glfw3.lib
deleted file mode 100644
index 071a0ab84..000000000
--- a/externals/glfw-3.0.4.bin/lib-msvc_v120-Win32/glfw3.lib
+++ /dev/null
Binary files differ
diff --git a/externals/glfw-3.0.4.bin/lib-msvc_v120-Win32/glfw3dll.lib b/externals/glfw-3.0.4.bin/lib-msvc_v120-Win32/glfw3dll.lib
deleted file mode 100644
index d0c5ff5e1..000000000
--- a/externals/glfw-3.0.4.bin/lib-msvc_v120-Win32/glfw3dll.lib
+++ /dev/null
Binary files differ
diff --git a/externals/glfw-3.0.4.bin/lib-msvc_v120-x64/glfw3.dll b/externals/glfw-3.0.4.bin/lib-msvc_v120-x64/glfw3.dll
deleted file mode 100644
index 9da042a6b..000000000
--- a/externals/glfw-3.0.4.bin/lib-msvc_v120-x64/glfw3.dll
+++ /dev/null
Binary files differ
diff --git a/externals/glfw-3.0.4.bin/lib-msvc_v120-x64/glfw3.lib b/externals/glfw-3.0.4.bin/lib-msvc_v120-x64/glfw3.lib
deleted file mode 100644
index e2b495ff5..000000000
--- a/externals/glfw-3.0.4.bin/lib-msvc_v120-x64/glfw3.lib
+++ /dev/null
Binary files differ
diff --git a/externals/glfw-3.0.4.bin/lib-msvc_v120-x64/glfw3dll.lib b/externals/glfw-3.0.4.bin/lib-msvc_v120-x64/glfw3dll.lib
deleted file mode 100644
index 3d6e86418..000000000
--- a/externals/glfw-3.0.4.bin/lib-msvc_v120-x64/glfw3dll.lib
+++ /dev/null
Binary files differ
diff --git a/externals/glfw-3.0.4.bin/COPYING.txt b/externals/glfw-3.1.1.bin/COPYING.txt
index b30c70158..b30c70158 100644
--- a/externals/glfw-3.0.4.bin/COPYING.txt
+++ b/externals/glfw-3.1.1.bin/COPYING.txt
diff --git a/externals/glfw-3.0.4.bin/include/GLFW/glfw3.h b/externals/glfw-3.1.1.bin/include/GLFW/glfw3.h
index 0f97738c7..009fa755f 100644
--- a/externals/glfw-3.0.4.bin/include/GLFW/glfw3.h
+++ b/externals/glfw-3.1.1.bin/include/GLFW/glfw3.h
@@ -1,5 +1,5 @@
1/************************************************************************* 1/*************************************************************************
2 * GLFW 3.0 - www.glfw.org 2 * GLFW 3.1 - www.glfw.org
3 * A library for OpenGL, window and input 3 * A library for OpenGL, window and input
4 *------------------------------------------------------------------------ 4 *------------------------------------------------------------------------
5 * Copyright (c) 2002-2006 Marcus Geelnard 5 * Copyright (c) 2002-2006 Marcus Geelnard
@@ -38,23 +38,27 @@ extern "C" {
38 * Doxygen documentation 38 * Doxygen documentation
39 *************************************************************************/ 39 *************************************************************************/
40 40
41/*! @defgroup clipboard Clipboard support
42 */
43/*! @defgroup context Context handling 41/*! @defgroup context Context handling
42 *
43 * This is the reference documentation for context related functions. For more
44 * information, see the @ref context.
44 */ 45 */
45/*! @defgroup error Error handling 46/*! @defgroup init Initialization, version and errors
46 */ 47 *
47/*! @defgroup init Initialization and version information 48 * This is the reference documentation for initialization and termination of
49 * the library, version management and error handling. For more information,
50 * see the @ref intro.
48 */ 51 */
49/*! @defgroup input Input handling 52/*! @defgroup input Input handling
53 *
54 * This is the reference documentation for input related functions and types.
55 * For more information, see the @ref input.
50 */ 56 */
51/*! @defgroup monitor Monitor handling 57/*! @defgroup monitor Monitor handling
52 * 58 *
53 * This is the reference documentation for monitor related functions and types. 59 * This is the reference documentation for monitor related functions and types.
54 * For more information, see the @ref monitor. 60 * For more information, see the @ref monitor.
55 */ 61 */
56/*! @defgroup time Time input
57 */
58/*! @defgroup window Window handling 62/*! @defgroup window Window handling
59 * 63 *
60 * This is the reference documentation for window related functions and types, 64 * This is the reference documentation for window related functions and types,
@@ -64,28 +68,17 @@ extern "C" {
64 68
65 69
66/************************************************************************* 70/*************************************************************************
67 * Global definitions 71 * Compiler- and platform-specific preprocessor work
68 *************************************************************************/ 72 *************************************************************************/
69 73
70/* ------------------- BEGIN SYSTEM/COMPILER SPECIFIC -------------------- */ 74/* If we are we on Windows, we want a single define for it.
71
72/* Please report any problems that you find with your compiler, which may
73 * be solved in this section! There are several compilers that I have not
74 * been able to test this file with yet.
75 *
76 * First: If we are we on Windows, we want a single define for it (_WIN32)
77 * (Note: For Cygwin the compiler flag -mwin32 should be used, but to
78 * make sure that things run smoothly for Cygwin users, we add __CYGWIN__
79 * to the list of "valid Win32 identifiers", which removes the need for
80 * -mwin32)
81 */ 75 */
82#if !defined(_WIN32) && (defined(__WIN32__) || defined(WIN32) || defined(__CYGWIN__)) 76#if !defined(_WIN32) && (defined(__WIN32__) || defined(WIN32) || defined(__MINGW32__))
83 #define _WIN32 77 #define _WIN32
84#endif /* _WIN32 */ 78#endif /* _WIN32 */
85 79
86/* In order for extension support to be portable, we need to define an 80/* It is customary to use APIENTRY for OpenGL function pointer declarations on
87 * OpenGL function call method. We use the keyword APIENTRY, which is 81 * all platforms. Additionally, the Windows OpenGL header needs APIENTRY.
88 * defined for Win32. (Note: Windows also needs this for <GL/gl.h>)
89 */ 82 */
90#ifndef APIENTRY 83#ifndef APIENTRY
91 #ifdef _WIN32 84 #ifdef _WIN32
@@ -95,44 +88,23 @@ extern "C" {
95 #endif 88 #endif
96#endif /* APIENTRY */ 89#endif /* APIENTRY */
97 90
98/* The following three defines are here solely to make some Windows-based 91/* Some Windows OpenGL headers need this.
99 * <GL/gl.h> files happy. Theoretically we could include <windows.h>, but
100 * it has the major drawback of severely polluting our namespace.
101 */ 92 */
102
103/* Under Windows, we need WINGDIAPI defined */
104#if !defined(WINGDIAPI) && defined(_WIN32) 93#if !defined(WINGDIAPI) && defined(_WIN32)
105 #if defined(_MSC_VER) || defined(__BORLANDC__) || defined(__POCC__) 94 #define WINGDIAPI __declspec(dllimport)
106 /* Microsoft Visual C++, Borland C++ Builder and Pelles C */
107 #define WINGDIAPI __declspec(dllimport)
108 #elif defined(__LCC__)
109 /* LCC-Win32 */
110 #define WINGDIAPI __stdcall
111 #else
112 /* Others (e.g. MinGW, Cygwin) */
113 #define WINGDIAPI extern
114 #endif
115 #define GLFW_WINGDIAPI_DEFINED 95 #define GLFW_WINGDIAPI_DEFINED
116#endif /* WINGDIAPI */ 96#endif /* WINGDIAPI */
117 97
118/* Some <GL/glu.h> files also need CALLBACK defined */ 98/* Some Windows GLU headers need this.
99 */
119#if !defined(CALLBACK) && defined(_WIN32) 100#if !defined(CALLBACK) && defined(_WIN32)
120 #if defined(_MSC_VER) 101 #define CALLBACK __stdcall
121 /* Microsoft Visual C++ */
122 #if (defined(_M_MRX000) || defined(_M_IX86) || defined(_M_ALPHA) || defined(_M_PPC)) && !defined(MIDL_PASS)
123 #define CALLBACK __stdcall
124 #else
125 #define CALLBACK
126 #endif
127 #else
128 /* Other Windows compilers */
129 #define CALLBACK __stdcall
130 #endif
131 #define GLFW_CALLBACK_DEFINED 102 #define GLFW_CALLBACK_DEFINED
132#endif /* CALLBACK */ 103#endif /* CALLBACK */
133 104
134/* Most GL/glu.h variants on Windows need wchar_t 105/* Most Windows GLU headers need wchar_t.
135 * OpenGL/gl.h blocks the definition of ptrdiff_t by glext.h on OS X */ 106 * The OS X OpenGL header blocks the definition of ptrdiff_t by glext.h.
107 */
136#if !defined(GLFW_INCLUDE_NONE) 108#if !defined(GLFW_INCLUDE_NONE)
137 #include <stddef.h> 109 #include <stddef.h>
138#endif 110#endif
@@ -140,67 +112,79 @@ extern "C" {
140/* Include the chosen client API headers. 112/* Include the chosen client API headers.
141 */ 113 */
142#if defined(__APPLE_CC__) 114#if defined(__APPLE_CC__)
143 #if defined(GLFW_INCLUDE_GLCOREARB) 115 #if defined(GLFW_INCLUDE_GLCOREARB)
144 #include <OpenGL/gl3.h> 116 #include <OpenGL/gl3.h>
145 #elif !defined(GLFW_INCLUDE_NONE) 117 #if defined(GLFW_INCLUDE_GLEXT)
146 #define GL_GLEXT_LEGACY 118 #include <OpenGL/gl3ext.h>
147 #include <OpenGL/gl.h>
148 #endif 119 #endif
149 #if defined(GLFW_INCLUDE_GLU) 120 #elif !defined(GLFW_INCLUDE_NONE)
150 #include <OpenGL/glu.h> 121 #if !defined(GLFW_INCLUDE_GLEXT)
122 #define GL_GLEXT_LEGACY
151 #endif 123 #endif
124 #include <OpenGL/gl.h>
125 #endif
126 #if defined(GLFW_INCLUDE_GLU)
127 #include <OpenGL/glu.h>
128 #endif
152#else 129#else
153 #if defined(GLFW_INCLUDE_GLCOREARB) 130 #if defined(GLFW_INCLUDE_GLCOREARB)
154 #include <GL/glcorearb.h> 131 #include <GL/glcorearb.h>
155 #elif defined(GLFW_INCLUDE_ES1) 132 #elif defined(GLFW_INCLUDE_ES1)
156 #include <GLES/gl.h> 133 #include <GLES/gl.h>
157 #elif defined(GLFW_INCLUDE_ES2) 134 #if defined(GLFW_INCLUDE_GLEXT)
158 #include <GLES2/gl2.h> 135 #include <GLES/glext.h>
159 #elif defined(GLFW_INCLUDE_ES3) 136 #endif
160 #include <GLES3/gl3.h> 137 #elif defined(GLFW_INCLUDE_ES2)
161 #elif !defined(GLFW_INCLUDE_NONE) 138 #include <GLES2/gl2.h>
162 #include <GL/gl.h> 139 #if defined(GLFW_INCLUDE_GLEXT)
140 #include <GLES2/gl2ext.h>
163 #endif 141 #endif
164 #if defined(GLFW_INCLUDE_GLU) 142 #elif defined(GLFW_INCLUDE_ES3)
165 #include <GL/glu.h> 143 #include <GLES3/gl3.h>
144 #if defined(GLFW_INCLUDE_GLEXT)
145 #include <GLES3/gl2ext.h>
166 #endif 146 #endif
147 #elif defined(GLFW_INCLUDE_ES31)
148 #include <GLES3/gl31.h>
149 #if defined(GLFW_INCLUDE_GLEXT)
150 #include <GLES3/gl2ext.h>
151 #endif
152 #elif !defined(GLFW_INCLUDE_NONE)
153 #include <GL/gl.h>
154 #if defined(GLFW_INCLUDE_GLEXT)
155 #include <GL/glext.h>
156 #endif
157 #endif
158 #if defined(GLFW_INCLUDE_GLU)
159 #include <GL/glu.h>
160 #endif
167#endif 161#endif
168 162
169#if defined(GLFW_DLL) && defined(_GLFW_BUILD_DLL) 163#if defined(GLFW_DLL) && defined(_GLFW_BUILD_DLL)
170 /* GLFW_DLL is defined by users of GLFW when compiling programs that will link 164 /* GLFW_DLL must be defined by applications that are linking against the DLL
171 * to the DLL version of the GLFW library. _GLFW_BUILD_DLL is defined by the 165 * version of the GLFW library. _GLFW_BUILD_DLL is defined by the GLFW
172 * GLFW configuration header when compiling the DLL version of the library. 166 * configuration header when compiling the DLL version of the library.
173 */ 167 */
174 #error "You must not have both GLFW_DLL and _GLFW_BUILD_DLL defined" 168 #error "You may not have both GLFW_DLL and _GLFW_BUILD_DLL defined"
175#endif 169#endif
176 170
171/* GLFWAPI is used to declare public API functions for export
172 * from the DLL / shared library / dynamic library.
173 */
177#if defined(_WIN32) && defined(_GLFW_BUILD_DLL) 174#if defined(_WIN32) && defined(_GLFW_BUILD_DLL)
178 175 /* We are building GLFW as a Win32 DLL */
179 /* We are building a Win32 DLL */
180 #define GLFWAPI __declspec(dllexport) 176 #define GLFWAPI __declspec(dllexport)
181
182#elif defined(_WIN32) && defined(GLFW_DLL) 177#elif defined(_WIN32) && defined(GLFW_DLL)
183 178 /* We are calling GLFW as a Win32 DLL */
184 /* We are calling a Win32 DLL */ 179 #define GLFWAPI __declspec(dllimport)
185 #if defined(__LCC__)
186 #define GLFWAPI extern
187 #else
188 #define GLFWAPI __declspec(dllimport)
189 #endif
190
191#elif defined(__GNUC__) && defined(_GLFW_BUILD_DLL) 180#elif defined(__GNUC__) && defined(_GLFW_BUILD_DLL)
192 181 /* We are building GLFW as a shared / dynamic library */
193 #define GLFWAPI __attribute__((visibility("default"))) 182 #define GLFWAPI __attribute__((visibility("default")))
194
195#else 183#else
196 184 /* We are building or calling GLFW as a static library */
197 /* We are either building/calling a static lib or we are non-win32 */
198 #define GLFWAPI 185 #define GLFWAPI
199
200#endif 186#endif
201 187
202/* -------------------- END SYSTEM/COMPILER SPECIFIC --------------------- */
203
204 188
205/************************************************************************* 189/*************************************************************************
206 * GLFW API tokens 190 * GLFW API tokens
@@ -220,27 +204,36 @@ extern "C" {
220 * backward-compatible. 204 * backward-compatible.
221 * @ingroup init 205 * @ingroup init
222 */ 206 */
223#define GLFW_VERSION_MINOR 0 207#define GLFW_VERSION_MINOR 1
224/*! @brief The revision number of the GLFW library. 208/*! @brief The revision number of the GLFW library.
225 * 209 *
226 * This is incremented when a bug fix release is made that does not contain any 210 * This is incremented when a bug fix release is made that does not contain any
227 * API changes. 211 * API changes.
228 * @ingroup init 212 * @ingroup init
229 */ 213 */
230#define GLFW_VERSION_REVISION 4 214#define GLFW_VERSION_REVISION 1
231/*! @} */ 215/*! @} */
232 216
233/*! @name Key and button actions 217/*! @name Key and button actions
234 * @{ */ 218 * @{ */
235/*! @brief The key or button was released. 219/*! @brief The key or mouse button was released.
220 *
221 * The key or mouse button was released.
222 *
236 * @ingroup input 223 * @ingroup input
237 */ 224 */
238#define GLFW_RELEASE 0 225#define GLFW_RELEASE 0
239/*! @brief The key or button was pressed. 226/*! @brief The key or mouse button was pressed.
227 *
228 * The key or mouse button was pressed.
229 *
240 * @ingroup input 230 * @ingroup input
241 */ 231 */
242#define GLFW_PRESS 1 232#define GLFW_PRESS 1
243/*! @brief The key was held down until it repeated. 233/*! @brief The key was held down until it repeated.
234 *
235 * The key was held down until it repeated.
236 *
244 * @ingroup input 237 * @ingroup input
245 */ 238 */
246#define GLFW_REPEAT 2 239#define GLFW_REPEAT 2
@@ -248,20 +241,22 @@ extern "C" {
248 241
249/*! @defgroup keys Keyboard keys 242/*! @defgroup keys Keyboard keys
250 * 243 *
251 * These key codes are inspired by the *USB HID Usage Tables v1.12* (p. 53-60), 244 * See [key input](@ref input_key) for how these are used.
252 * but re-arranged to map to 7-bit ASCII for printable keys (function keys are 245 *
253 * put in the 256+ range). 246 * These key codes are inspired by the _USB HID Usage Tables v1.12_ (p. 53-60),
254 * 247 * but re-arranged to map to 7-bit ASCII for printable keys (function keys are
255 * The naming of the key codes follow these rules: 248 * put in the 256+ range).
256 * - The US keyboard layout is used 249 *
257 * - Names of printable alpha-numeric characters are used (e.g. "A", "R", 250 * The naming of the key codes follow these rules:
258 * "3", etc.) 251 * - The US keyboard layout is used
259 * - For non-alphanumeric characters, Unicode:ish names are used (e.g. 252 * - Names of printable alpha-numeric characters are used (e.g. "A", "R",
260 * "COMMA", "LEFT_SQUARE_BRACKET", etc.). Note that some names do not 253 * "3", etc.)
261 * correspond to the Unicode standard (usually for brevity) 254 * - For non-alphanumeric characters, Unicode:ish names are used (e.g.
262 * - Keys that lack a clear US mapping are named "WORLD_x" 255 * "COMMA", "LEFT_SQUARE_BRACKET", etc.). Note that some names do not
263 * - For non-printable keys, custom names are used (e.g. "F4", 256 * correspond to the Unicode standard (usually for brevity)
264 * "BACKSPACE", etc.) 257 * - Keys that lack a clear US mapping are named "WORLD_x"
258 * - For non-printable keys, custom names are used (e.g. "F4",
259 * "BACKSPACE", etc.)
265 * 260 *
266 * @ingroup input 261 * @ingroup input
267 * @{ 262 * @{
@@ -398,6 +393,9 @@ extern "C" {
398/*! @} */ 393/*! @} */
399 394
400/*! @defgroup mods Modifier key flags 395/*! @defgroup mods Modifier key flags
396 *
397 * See [key input](@ref input_key) for how these are used.
398 *
401 * @ingroup input 399 * @ingroup input
402 * @{ */ 400 * @{ */
403 401
@@ -417,6 +415,9 @@ extern "C" {
417/*! @} */ 415/*! @} */
418 416
419/*! @defgroup buttons Mouse buttons 417/*! @defgroup buttons Mouse buttons
418 *
419 * See [mouse button input](@ref input_mouse_button) for how these are used.
420 *
420 * @ingroup input 421 * @ingroup input
421 * @{ */ 422 * @{ */
422#define GLFW_MOUSE_BUTTON_1 0 423#define GLFW_MOUSE_BUTTON_1 0
@@ -434,6 +435,9 @@ extern "C" {
434/*! @} */ 435/*! @} */
435 436
436/*! @defgroup joysticks Joysticks 437/*! @defgroup joysticks Joysticks
438 *
439 * See [joystick input](@ref joystick) for how these are used.
440 *
437 * @ingroup input 441 * @ingroup input
438 * @{ */ 442 * @{ */
439#define GLFW_JOYSTICK_1 0 443#define GLFW_JOYSTICK_1 0
@@ -456,36 +460,131 @@ extern "C" {
456/*! @} */ 460/*! @} */
457 461
458/*! @defgroup errors Error codes 462/*! @defgroup errors Error codes
459 * @ingroup error 463 *
464 * See [error handling](@ref error_handling) for how these are used.
465 *
466 * @ingroup init
460 * @{ */ 467 * @{ */
461/*! @brief GLFW has not been initialized. 468/*! @brief GLFW has not been initialized.
469 *
470 * This occurs if a GLFW function was called that may not be called unless the
471 * library is [initialized](@ref intro_init).
472 *
473 * @par Analysis
474 * Application programmer error. Initialize GLFW before calling any function
475 * that requires initialization.
462 */ 476 */
463#define GLFW_NOT_INITIALIZED 0x00010001 477#define GLFW_NOT_INITIALIZED 0x00010001
464/*! @brief No context is current for this thread. 478/*! @brief No context is current for this thread.
479 *
480 * This occurs if a GLFW function was called that needs and operates on the
481 * current OpenGL or OpenGL ES context but no context is current on the calling
482 * thread. One such function is @ref glfwSwapInterval.
483 *
484 * @par Analysis
485 * Application programmer error. Ensure a context is current before calling
486 * functions that require a current context.
465 */ 487 */
466#define GLFW_NO_CURRENT_CONTEXT 0x00010002 488#define GLFW_NO_CURRENT_CONTEXT 0x00010002
467/*! @brief One of the enum parameters for the function was given an invalid 489/*! @brief One of the arguments to the function was an invalid enum value.
468 * enum. 490 *
491 * One of the arguments to the function was an invalid enum value, for example
492 * requesting [GLFW_RED_BITS](@ref window_hints_fb) with @ref
493 * glfwGetWindowAttrib.
494 *
495 * @par Analysis
496 * Application programmer error. Fix the offending call.
469 */ 497 */
470#define GLFW_INVALID_ENUM 0x00010003 498#define GLFW_INVALID_ENUM 0x00010003
471/*! @brief One of the parameters for the function was given an invalid value. 499/*! @brief One of the arguments to the function was an invalid value.
500 *
501 * One of the arguments to the function was an invalid value, for example
502 * requesting a non-existent OpenGL or OpenGL ES version like 2.7.
503 *
504 * Requesting a valid but unavailable OpenGL or OpenGL ES version will instead
505 * result in a @ref GLFW_VERSION_UNAVAILABLE error.
506 *
507 * @par Analysis
508 * Application programmer error. Fix the offending call.
472 */ 509 */
473#define GLFW_INVALID_VALUE 0x00010004 510#define GLFW_INVALID_VALUE 0x00010004
474/*! @brief A memory allocation failed. 511/*! @brief A memory allocation failed.
512 *
513 * A memory allocation failed.
514 *
515 * @par Analysis
516 * A bug in GLFW or the underlying operating system. Report the bug to our
517 * [issue tracker](https://github.com/glfw/glfw/issues).
475 */ 518 */
476#define GLFW_OUT_OF_MEMORY 0x00010005 519#define GLFW_OUT_OF_MEMORY 0x00010005
477/*! @brief GLFW could not find support for the requested client API on the 520/*! @brief GLFW could not find support for the requested client API on the
478 * system. 521 * system.
522 *
523 * GLFW could not find support for the requested client API on the system. If
524 * emitted by functions other than @ref glfwCreateWindow, no supported client
525 * API was found.
526 *
527 * @par Analysis
528 * The installed graphics driver does not support the requested client API, or
529 * does not support it via the chosen context creation backend. Below are
530 * a few examples.
531 *
532 * @par
533 * Some pre-installed Windows graphics drivers do not support OpenGL. AMD only
534 * supports OpenGL ES via EGL, while Nvidia and Intel only supports it via
535 * a WGL or GLX extension. OS X does not provide OpenGL ES at all. The Mesa
536 * EGL, OpenGL and OpenGL ES libraries do not interface with the Nvidia binary
537 * driver.
479 */ 538 */
480#define GLFW_API_UNAVAILABLE 0x00010006 539#define GLFW_API_UNAVAILABLE 0x00010006
481/*! @brief The requested client API version is not available. 540/*! @brief The requested OpenGL or OpenGL ES version is not available.
541 *
542 * The requested OpenGL or OpenGL ES version (including any requested context
543 * or framebuffer hints) is not available on this machine.
544 *
545 * @par Analysis
546 * The machine does not support your requirements. If your application is
547 * sufficiently flexible, downgrade your requirements and try again.
548 * Otherwise, inform the user that their machine does not match your
549 * requirements.
550 *
551 * @par
552 * Future invalid OpenGL and OpenGL ES versions, for example OpenGL 4.8 if 5.0
553 * comes out before the 4.x series gets that far, also fail with this error and
554 * not @ref GLFW_INVALID_VALUE, because GLFW cannot know what future versions
555 * will exist.
482 */ 556 */
483#define GLFW_VERSION_UNAVAILABLE 0x00010007 557#define GLFW_VERSION_UNAVAILABLE 0x00010007
484/*! @brief A platform-specific error occurred that does not match any of the 558/*! @brief A platform-specific error occurred that does not match any of the
485 * more specific categories. 559 * more specific categories.
560 *
561 * A platform-specific error occurred that does not match any of the more
562 * specific categories.
563 *
564 * @par Analysis
565 * A bug or configuration error in GLFW, the underlying operating system or
566 * its drivers, or a lack of required resources. Report the issue to our
567 * [issue tracker](https://github.com/glfw/glfw/issues).
486 */ 568 */
487#define GLFW_PLATFORM_ERROR 0x00010008 569#define GLFW_PLATFORM_ERROR 0x00010008
488/*! @brief The clipboard did not contain data in the requested format. 570/*! @brief The requested format is not supported or available.
571 *
572 * If emitted during window creation, the requested pixel format is not
573 * supported.
574 *
575 * If emitted when querying the clipboard, the contents of the clipboard could
576 * not be converted to the requested format.
577 *
578 * @par Analysis
579 * If emitted during window creation, one or more
580 * [hard constraints](@ref window_hints_hard) did not match any of the
581 * available pixel formats. If your application is sufficiently flexible,
582 * downgrade your requirements and try again. Otherwise, inform the user that
583 * their machine does not match your requirements.
584 *
585 * @par
586 * If emitted when querying the clipboard, ignore the error or report it to
587 * the user, as appropriate.
489 */ 588 */
490#define GLFW_FORMAT_UNAVAILABLE 0x00010009 589#define GLFW_FORMAT_UNAVAILABLE 0x00010009
491/*! @} */ 590/*! @} */
@@ -495,6 +594,8 @@ extern "C" {
495#define GLFW_RESIZABLE 0x00020003 594#define GLFW_RESIZABLE 0x00020003
496#define GLFW_VISIBLE 0x00020004 595#define GLFW_VISIBLE 0x00020004
497#define GLFW_DECORATED 0x00020005 596#define GLFW_DECORATED 0x00020005
597#define GLFW_AUTO_ICONIFY 0x00020006
598#define GLFW_FLOATING 0x00020007
498 599
499#define GLFW_RED_BITS 0x00021001 600#define GLFW_RED_BITS 0x00021001
500#define GLFW_GREEN_BITS 0x00021002 601#define GLFW_GREEN_BITS 0x00021002
@@ -511,6 +612,7 @@ extern "C" {
511#define GLFW_SAMPLES 0x0002100D 612#define GLFW_SAMPLES 0x0002100D
512#define GLFW_SRGB_CAPABLE 0x0002100E 613#define GLFW_SRGB_CAPABLE 0x0002100E
513#define GLFW_REFRESH_RATE 0x0002100F 614#define GLFW_REFRESH_RATE 0x0002100F
615#define GLFW_DOUBLEBUFFER 0x00021010
514 616
515#define GLFW_CLIENT_API 0x00022001 617#define GLFW_CLIENT_API 0x00022001
516#define GLFW_CONTEXT_VERSION_MAJOR 0x00022002 618#define GLFW_CONTEXT_VERSION_MAJOR 0x00022002
@@ -520,6 +622,7 @@ extern "C" {
520#define GLFW_OPENGL_FORWARD_COMPAT 0x00022006 622#define GLFW_OPENGL_FORWARD_COMPAT 0x00022006
521#define GLFW_OPENGL_DEBUG_CONTEXT 0x00022007 623#define GLFW_OPENGL_DEBUG_CONTEXT 0x00022007
522#define GLFW_OPENGL_PROFILE 0x00022008 624#define GLFW_OPENGL_PROFILE 0x00022008
625#define GLFW_CONTEXT_RELEASE_BEHAVIOR 0x00022009
523 626
524#define GLFW_OPENGL_API 0x00030001 627#define GLFW_OPENGL_API 0x00030001
525#define GLFW_OPENGL_ES_API 0x00030002 628#define GLFW_OPENGL_ES_API 0x00030002
@@ -540,9 +643,54 @@ extern "C" {
540#define GLFW_CURSOR_HIDDEN 0x00034002 643#define GLFW_CURSOR_HIDDEN 0x00034002
541#define GLFW_CURSOR_DISABLED 0x00034003 644#define GLFW_CURSOR_DISABLED 0x00034003
542 645
646#define GLFW_ANY_RELEASE_BEHAVIOR 0
647#define GLFW_RELEASE_BEHAVIOR_FLUSH 0x00035001
648#define GLFW_RELEASE_BEHAVIOR_NONE 0x00035002
649
650/*! @defgroup shapes Standard cursor shapes
651 *
652 * See [standard cursor creation](@ref cursor_standard) for how these are used.
653 *
654 * @ingroup input
655 * @{ */
656
657/*! @brief The regular arrow cursor shape.
658 *
659 * The regular arrow cursor.
660 */
661#define GLFW_ARROW_CURSOR 0x00036001
662/*! @brief The text input I-beam cursor shape.
663 *
664 * The text input I-beam cursor shape.
665 */
666#define GLFW_IBEAM_CURSOR 0x00036002
667/*! @brief The crosshair shape.
668 *
669 * The crosshair shape.
670 */
671#define GLFW_CROSSHAIR_CURSOR 0x00036003
672/*! @brief The hand shape.
673 *
674 * The hand shape.
675 */
676#define GLFW_HAND_CURSOR 0x00036004
677/*! @brief The horizontal resize arrow shape.
678 *
679 * The horizontal resize arrow shape.
680 */
681#define GLFW_HRESIZE_CURSOR 0x00036005
682/*! @brief The vertical resize arrow shape.
683 *
684 * The vertical resize arrow shape.
685 */
686#define GLFW_VRESIZE_CURSOR 0x00036006
687/*! @} */
688
543#define GLFW_CONNECTED 0x00040001 689#define GLFW_CONNECTED 0x00040001
544#define GLFW_DISCONNECTED 0x00040002 690#define GLFW_DISCONNECTED 0x00040002
545 691
692#define GLFW_DONT_CARE -1
693
546 694
547/************************************************************************* 695/*************************************************************************
548 * GLFW API types 696 * GLFW API types
@@ -573,6 +721,14 @@ typedef struct GLFWmonitor GLFWmonitor;
573 */ 721 */
574typedef struct GLFWwindow GLFWwindow; 722typedef struct GLFWwindow GLFWwindow;
575 723
724/*! @brief Opaque cursor object.
725 *
726 * Opaque cursor object.
727 *
728 * @ingroup cursor
729 */
730typedef struct GLFWcursor GLFWcursor;
731
576/*! @brief The function signature for error callbacks. 732/*! @brief The function signature for error callbacks.
577 * 733 *
578 * This is the function signature for error callback functions. 734 * This is the function signature for error callback functions.
@@ -582,7 +738,7 @@ typedef struct GLFWwindow GLFWwindow;
582 * 738 *
583 * @sa glfwSetErrorCallback 739 * @sa glfwSetErrorCallback
584 * 740 *
585 * @ingroup error 741 * @ingroup init
586 */ 742 */
587typedef void (* GLFWerrorfun)(int,const char*); 743typedef void (* GLFWerrorfun)(int,const char*);
588 744
@@ -590,7 +746,7 @@ typedef void (* GLFWerrorfun)(int,const char*);
590 * 746 *
591 * This is the function signature for window position callback functions. 747 * This is the function signature for window position callback functions.
592 * 748 *
593 * @param[in] window The window that the user moved. 749 * @param[in] window The window that was moved.
594 * @param[in] xpos The new x-coordinate, in screen coordinates, of the 750 * @param[in] xpos The new x-coordinate, in screen coordinates, of the
595 * upper-left corner of the client area of the window. 751 * upper-left corner of the client area of the window.
596 * @param[in] ypos The new y-coordinate, in screen coordinates, of the 752 * @param[in] ypos The new y-coordinate, in screen coordinates, of the
@@ -606,7 +762,7 @@ typedef void (* GLFWwindowposfun)(GLFWwindow*,int,int);
606 * 762 *
607 * This is the function signature for window size callback functions. 763 * This is the function signature for window size callback functions.
608 * 764 *
609 * @param[in] window The window that the user resized. 765 * @param[in] window The window that was resized.
610 * @param[in] width The new width, in screen coordinates, of the window. 766 * @param[in] width The new width, in screen coordinates, of the window.
611 * @param[in] height The new height, in screen coordinates, of the window. 767 * @param[in] height The new height, in screen coordinates, of the window.
612 * 768 *
@@ -644,9 +800,9 @@ typedef void (* GLFWwindowrefreshfun)(GLFWwindow*);
644 * 800 *
645 * This is the function signature for window focus callback functions. 801 * This is the function signature for window focus callback functions.
646 * 802 *
647 * @param[in] window The window that was focused or defocused. 803 * @param[in] window The window that gained or lost input focus.
648 * @param[in] focused `GL_TRUE` if the window was focused, or `GL_FALSE` if 804 * @param[in] focused `GL_TRUE` if the window was given input focus, or
649 * it was defocused. 805 * `GL_FALSE` if it lost it.
650 * 806 *
651 * @sa glfwSetWindowFocusCallback 807 * @sa glfwSetWindowFocusCallback
652 * 808 *
@@ -750,7 +906,7 @@ typedef void (* GLFWscrollfun)(GLFWwindow*,double,double);
750 * @param[in] window The window that received the event. 906 * @param[in] window The window that received the event.
751 * @param[in] key The [keyboard key](@ref keys) that was pressed or released. 907 * @param[in] key The [keyboard key](@ref keys) that was pressed or released.
752 * @param[in] scancode The system-specific scancode of the key. 908 * @param[in] scancode The system-specific scancode of the key.
753 * @param[in] action @ref GLFW_PRESS, @ref GLFW_RELEASE or @ref GLFW_REPEAT. 909 * @param[in] action `GLFW_PRESS`, `GLFW_RELEASE` or `GLFW_REPEAT`.
754 * @param[in] mods Bit field describing which [modifier keys](@ref mods) were 910 * @param[in] mods Bit field describing which [modifier keys](@ref mods) were
755 * held down. 911 * held down.
756 * 912 *
@@ -773,6 +929,38 @@ typedef void (* GLFWkeyfun)(GLFWwindow*,int,int,int,int);
773 */ 929 */
774typedef void (* GLFWcharfun)(GLFWwindow*,unsigned int); 930typedef void (* GLFWcharfun)(GLFWwindow*,unsigned int);
775 931
932/*! @brief The function signature for Unicode character with modifiers
933 * callbacks.
934 *
935 * This is the function signature for Unicode character with modifiers callback
936 * functions. It is called for each input character, regardless of what
937 * modifier keys are held down.
938 *
939 * @param[in] window The window that received the event.
940 * @param[in] codepoint The Unicode code point of the character.
941 * @param[in] mods Bit field describing which [modifier keys](@ref mods) were
942 * held down.
943 *
944 * @sa glfwSetCharModsCallback
945 *
946 * @ingroup input
947 */
948typedef void (* GLFWcharmodsfun)(GLFWwindow*,unsigned int,int);
949
950/*! @brief The function signature for file drop callbacks.
951 *
952 * This is the function signature for file drop callbacks.
953 *
954 * @param[in] window The window that received the event.
955 * @param[in] count The number of dropped files.
956 * @param[in] paths The UTF-8 encoded file and/or directory path names.
957 *
958 * @sa glfwSetDropCallback
959 *
960 * @ingroup input
961 */
962typedef void (* GLFWdropfun)(GLFWwindow*,int,const char**);
963
776/*! @brief The function signature for monitor configuration callbacks. 964/*! @brief The function signature for monitor configuration callbacks.
777 * 965 *
778 * This is the function signature for monitor configuration callback functions. 966 * This is the function signature for monitor configuration callback functions.
@@ -838,6 +1026,21 @@ typedef struct GLFWgammaramp
838 unsigned int size; 1026 unsigned int size;
839} GLFWgammaramp; 1027} GLFWgammaramp;
840 1028
1029/*! @brief Image data.
1030 */
1031typedef struct GLFWimage
1032{
1033 /*! The width, in pixels, of this image.
1034 */
1035 int width;
1036 /*! The height, in pixels, of this image.
1037 */
1038 int height;
1039 /*! The pixel data of this image, arranged left-to-right, top-to-bottom.
1040 */
1041 unsigned char* pixels;
1042} GLFWimage;
1043
841 1044
842/************************************************************************* 1045/*************************************************************************
843 * GLFW API functions 1046 * GLFW API functions
@@ -846,53 +1049,70 @@ typedef struct GLFWgammaramp
846/*! @brief Initializes the GLFW library. 1049/*! @brief Initializes the GLFW library.
847 * 1050 *
848 * This function initializes the GLFW library. Before most GLFW functions can 1051 * This function initializes the GLFW library. Before most GLFW functions can
849 * be used, GLFW must be initialized, and before a program terminates GLFW 1052 * be used, GLFW must be initialized, and before an application terminates GLFW
850 * should be terminated in order to free any resources allocated during or 1053 * should be terminated in order to free any resources allocated during or
851 * after initialization. 1054 * after initialization.
852 * 1055 *
853 * If this function fails, it calls @ref glfwTerminate before returning. If it 1056 * If this function fails, it calls @ref glfwTerminate before returning. If it
854 * succeeds, you should call @ref glfwTerminate before the program exits. 1057 * succeeds, you should call @ref glfwTerminate before the application exits.
855 * 1058 *
856 * Additional calls to this function after successful initialization but before 1059 * Additional calls to this function after successful initialization but before
857 * termination will succeed but will do nothing. 1060 * termination will return `GL_TRUE` immediately.
858 * 1061 *
859 * @return `GL_TRUE` if successful, or `GL_FALSE` if an error occurred. 1062 * @return `GL_TRUE` if successful, or `GL_FALSE` if an
1063 * [error](@ref error_handling) occurred.
860 * 1064 *
861 * @par New in GLFW 3 1065 * @remarks __OS X:__ This function will change the current directory of the
862 * This function no longer registers @ref glfwTerminate with `atexit`. 1066 * application to the `Contents/Resources` subdirectory of the application's
1067 * bundle, if present. This can be disabled with a
1068 * [compile-time option](@ref compile_options_osx).
863 * 1069 *
864 * @note This function may only be called from the main thread. 1070 * @remarks __X11:__ If the `LC_CTYPE` category of the current locale is set to
1071 * `"C"` then the environment's locale will be applied to that category. This
1072 * is done because character input will not function when `LC_CTYPE` is set to
1073 * `"C"`. If another locale was set before this function was called, it will
1074 * be left untouched.
865 * 1075 *
866 * @note **OS X:** This function will change the current directory of the 1076 * @par Thread Safety
867 * application to the `Contents/Resources` subdirectory of the application's 1077 * This function may only be called from the main thread.
868 * bundle, if present.
869 * 1078 *
1079 * @sa @ref intro_init
870 * @sa glfwTerminate 1080 * @sa glfwTerminate
871 * 1081 *
1082 * @since Added in GLFW 1.0.
1083 *
872 * @ingroup init 1084 * @ingroup init
873 */ 1085 */
874GLFWAPI int glfwInit(void); 1086GLFWAPI int glfwInit(void);
875 1087
876/*! @brief Terminates the GLFW library. 1088/*! @brief Terminates the GLFW library.
877 * 1089 *
878 * This function destroys all remaining windows, frees any allocated resources 1090 * This function destroys all remaining windows and cursors, restores any
879 * and sets the library to an uninitialized state. Once this is called, you 1091 * modified gamma ramps and frees any other allocated resources. Once this
880 * must again call @ref glfwInit successfully before you will be able to use 1092 * function is called, you must again call @ref glfwInit successfully before
881 * most GLFW functions. 1093 * you will be able to use most GLFW functions.
882 * 1094 *
883 * If GLFW has been successfully initialized, this function should be called 1095 * If GLFW has been successfully initialized, this function should be called
884 * before the program exits. If initialization fails, there is no need to call 1096 * before the application exits. If initialization fails, there is no need to
885 * this function, as it is called by @ref glfwInit before it returns failure. 1097 * call this function, as it is called by @ref glfwInit before it returns
1098 * failure.
886 * 1099 *
887 * @remarks This function may be called before @ref glfwInit. 1100 * @remarks This function may be called before @ref glfwInit.
888 * 1101 *
889 * @note This function may only be called from the main thread.
890 *
891 * @warning No window's context may be current on another thread when this 1102 * @warning No window's context may be current on another thread when this
892 * function is called. 1103 * function is called.
893 * 1104 *
1105 * @par Reentrancy
1106 * This function may not be called from a callback.
1107 *
1108 * @par Thread Safety
1109 * This function may only be called from the main thread.
1110 *
1111 * @sa @ref intro_init
894 * @sa glfwInit 1112 * @sa glfwInit
895 * 1113 *
1114 * @since Added in GLFW 1.0.
1115 *
896 * @ingroup init 1116 * @ingroup init
897 */ 1117 */
898GLFWAPI void glfwTerminate(void); 1118GLFWAPI void glfwTerminate(void);
@@ -903,46 +1123,55 @@ GLFWAPI void glfwTerminate(void);
903 * library. It is intended for when you are using GLFW as a shared library and 1123 * library. It is intended for when you are using GLFW as a shared library and
904 * want to ensure that you are using the minimum required version. 1124 * want to ensure that you are using the minimum required version.
905 * 1125 *
1126 * Any or all of the version arguments may be `NULL`. This function always
1127 * succeeds.
1128 *
906 * @param[out] major Where to store the major version number, or `NULL`. 1129 * @param[out] major Where to store the major version number, or `NULL`.
907 * @param[out] minor Where to store the minor version number, or `NULL`. 1130 * @param[out] minor Where to store the minor version number, or `NULL`.
908 * @param[out] rev Where to store the revision number, or `NULL`. 1131 * @param[out] rev Where to store the revision number, or `NULL`.
909 * 1132 *
910 * @remarks This function may be called before @ref glfwInit. 1133 * @remarks This function may be called before @ref glfwInit.
911 * 1134 *
912 * @remarks This function may be called from any thread. 1135 * @par Thread Safety
1136 * This function may be called from any thread.
913 * 1137 *
1138 * @sa @ref intro_version
914 * @sa glfwGetVersionString 1139 * @sa glfwGetVersionString
915 * 1140 *
1141 * @since Added in GLFW 1.0.
1142 *
916 * @ingroup init 1143 * @ingroup init
917 */ 1144 */
918GLFWAPI void glfwGetVersion(int* major, int* minor, int* rev); 1145GLFWAPI void glfwGetVersion(int* major, int* minor, int* rev);
919 1146
920/*! @brief Returns a string describing the compile-time configuration. 1147/*! @brief Returns a string describing the compile-time configuration.
921 * 1148 *
922 * This function returns a static string generated at compile-time according to 1149 * This function returns the compile-time generated
923 * which configuration macros were defined. This is intended for use when 1150 * [version string](@ref intro_version_string) of the GLFW library binary. It
924 * submitting bug reports, to allow developers to see which code paths are 1151 * describes the version, platform, compiler and any platform-specific
925 * enabled in a binary. 1152 * compile-time options.
926 *
927 * The format of the string is as follows:
928 * - The version of GLFW
929 * - The name of the window system API
930 * - The name of the context creation API
931 * - Any additional options or APIs
932 * 1153 *
933 * For example, when compiling GLFW 3.0 with MinGW using the Win32 and WGL 1154 * __Do not use the version string__ to parse the GLFW library version. The
934 * back ends, the version string may look something like this: 1155 * @ref glfwGetVersion function already provides the version of the running
1156 * library binary.
935 * 1157 *
936 * 3.0.0 Win32 WGL MinGW 1158 * This function always succeeds.
937 * 1159 *
938 * @return The GLFW version string. 1160 * @return The GLFW version string.
939 * 1161 *
940 * @remarks This function may be called before @ref glfwInit. 1162 * @remarks This function may be called before @ref glfwInit.
941 * 1163 *
942 * @remarks This function may be called from any thread. 1164 * @par Pointer Lifetime
1165 * The returned string is static and compile-time generated.
943 * 1166 *
1167 * @par Thread Safety
1168 * This function may be called from any thread.
1169 *
1170 * @sa @ref intro_version
944 * @sa glfwGetVersion 1171 * @sa glfwGetVersion
945 * 1172 *
1173 * @since Added in GLFW 3.0.
1174 *
946 * @ingroup init 1175 * @ingroup init
947 */ 1176 */
948GLFWAPI const char* glfwGetVersionString(void); 1177GLFWAPI const char* glfwGetVersionString(void);
@@ -952,23 +1181,31 @@ GLFWAPI const char* glfwGetVersionString(void);
952 * This function sets the error callback, which is called with an error code 1181 * This function sets the error callback, which is called with an error code
953 * and a human-readable description each time a GLFW error occurs. 1182 * and a human-readable description each time a GLFW error occurs.
954 * 1183 *
1184 * The error callback is called on the thread where the error occurred. If you
1185 * are using GLFW from multiple threads, your error callback needs to be
1186 * written accordingly.
1187 *
1188 * Because the description string may have been generated specifically for that
1189 * error, it is not guaranteed to be valid after the callback has returned. If
1190 * you wish to use it after the callback returns, you need to make a copy.
1191 *
1192 * Once set, the error callback remains set even after the library has been
1193 * terminated.
1194 *
955 * @param[in] cbfun The new callback, or `NULL` to remove the currently set 1195 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
956 * callback. 1196 * callback.
957 * @return The previously set callback, or `NULL` if no callback was set or an 1197 * @return The previously set callback, or `NULL` if no callback was set.
958 * error occurred.
959 * 1198 *
960 * @remarks This function may be called before @ref glfwInit. 1199 * @remarks This function may be called before @ref glfwInit.
961 * 1200 *
962 * @note The error callback is called by the thread where the error was 1201 * @par Thread Safety
963 * generated. If you are using GLFW from multiple threads, your error callback 1202 * This function may only be called from the main thread.
964 * needs to be written accordingly. 1203 *
1204 * @sa @ref error_handling
965 * 1205 *
966 * @note Because the description string provided to the callback may have been 1206 * @since Added in GLFW 3.0.
967 * generated specifically for that error, it is not guaranteed to be valid
968 * after the callback has returned. If you wish to use it after that, you need
969 * to make your own copy of it before returning.
970 * 1207 *
971 * @ingroup error 1208 * @ingroup init
972 */ 1209 */
973GLFWAPI GLFWerrorfun glfwSetErrorCallback(GLFWerrorfun cbfun); 1210GLFWAPI GLFWerrorfun glfwSetErrorCallback(GLFWerrorfun cbfun);
974 1211
@@ -977,19 +1214,25 @@ GLFWAPI GLFWerrorfun glfwSetErrorCallback(GLFWerrorfun cbfun);
977 * This function returns an array of handles for all currently connected 1214 * This function returns an array of handles for all currently connected
978 * monitors. 1215 * monitors.
979 * 1216 *
980 * @param[out] count Where to store the size of the returned array. This is 1217 * @param[out] count Where to store the number of monitors in the returned
981 * set to zero if an error occurred. 1218 * array. This is set to zero if an error occurred.
982 * @return An array of monitor handles, or `NULL` if an error occurred. 1219 * @return An array of monitor handles, or `NULL` if an
1220 * [error](@ref error_handling) occurred.
983 * 1221 *
984 * @note The returned array is allocated and freed by GLFW. You should not 1222 * @par Pointer Lifetime
985 * free it yourself. 1223 * The returned array is allocated and freed by GLFW. You should not free it
1224 * yourself. It is guaranteed to be valid only until the monitor configuration
1225 * changes or the library is terminated.
986 * 1226 *
987 * @note The returned array is valid only until the monitor configuration 1227 * @par Thread Safety
988 * changes. See @ref glfwSetMonitorCallback to receive notifications of 1228 * This function may only be called from the main thread.
989 * configuration changes.
990 * 1229 *
1230 * @sa @ref monitor_monitors
1231 * @sa @ref monitor_event
991 * @sa glfwGetPrimaryMonitor 1232 * @sa glfwGetPrimaryMonitor
992 * 1233 *
1234 * @since Added in GLFW 3.0.
1235 *
993 * @ingroup monitor 1236 * @ingroup monitor
994 */ 1237 */
995GLFWAPI GLFWmonitor** glfwGetMonitors(int* count); 1238GLFWAPI GLFWmonitor** glfwGetMonitors(int* count);
@@ -999,10 +1242,17 @@ GLFWAPI GLFWmonitor** glfwGetMonitors(int* count);
999 * This function returns the primary monitor. This is usually the monitor 1242 * This function returns the primary monitor. This is usually the monitor
1000 * where elements like the Windows task bar or the OS X menu bar is located. 1243 * where elements like the Windows task bar or the OS X menu bar is located.
1001 * 1244 *
1002 * @return The primary monitor, or `NULL` if an error occurred. 1245 * @return The primary monitor, or `NULL` if an [error](@ref error_handling)
1246 * occurred.
1247 *
1248 * @par Thread Safety
1249 * This function may only be called from the main thread.
1003 * 1250 *
1251 * @sa @ref monitor_monitors
1004 * @sa glfwGetMonitors 1252 * @sa glfwGetMonitors
1005 * 1253 *
1254 * @since Added in GLFW 3.0.
1255 *
1006 * @ingroup monitor 1256 * @ingroup monitor
1007 */ 1257 */
1008GLFWAPI GLFWmonitor* glfwGetPrimaryMonitor(void); 1258GLFWAPI GLFWmonitor* glfwGetPrimaryMonitor(void);
@@ -1012,10 +1262,20 @@ GLFWAPI GLFWmonitor* glfwGetPrimaryMonitor(void);
1012 * This function returns the position, in screen coordinates, of the upper-left 1262 * This function returns the position, in screen coordinates, of the upper-left
1013 * corner of the specified monitor. 1263 * corner of the specified monitor.
1014 * 1264 *
1265 * Any or all of the position arguments may be `NULL`. If an error occurs, all
1266 * non-`NULL` position arguments will be set to zero.
1267 *
1015 * @param[in] monitor The monitor to query. 1268 * @param[in] monitor The monitor to query.
1016 * @param[out] xpos Where to store the monitor x-coordinate, or `NULL`. 1269 * @param[out] xpos Where to store the monitor x-coordinate, or `NULL`.
1017 * @param[out] ypos Where to store the monitor y-coordinate, or `NULL`. 1270 * @param[out] ypos Where to store the monitor y-coordinate, or `NULL`.
1018 * 1271 *
1272 * @par Thread Safety
1273 * This function may only be called from the main thread.
1274 *
1275 * @sa @ref monitor_properties
1276 *
1277 * @since Added in GLFW 3.0.
1278 *
1019 * @ingroup monitor 1279 * @ingroup monitor
1020 */ 1280 */
1021GLFWAPI void glfwGetMonitorPos(GLFWmonitor* monitor, int* xpos, int* ypos); 1281GLFWAPI void glfwGetMonitorPos(GLFWmonitor* monitor, int* xpos, int* ypos);
@@ -1025,31 +1285,55 @@ GLFWAPI void glfwGetMonitorPos(GLFWmonitor* monitor, int* xpos, int* ypos);
1025 * This function returns the size, in millimetres, of the display area of the 1285 * This function returns the size, in millimetres, of the display area of the
1026 * specified monitor. 1286 * specified monitor.
1027 * 1287 *
1288 * Some systems do not provide accurate monitor size information, either
1289 * because the monitor
1290 * [EDID](https://en.wikipedia.org/wiki/Extended_display_identification_data)
1291 * data is incorrect or because the driver does not report it accurately.
1292 *
1293 * Any or all of the size arguments may be `NULL`. If an error occurs, all
1294 * non-`NULL` size arguments will be set to zero.
1295 *
1028 * @param[in] monitor The monitor to query. 1296 * @param[in] monitor The monitor to query.
1029 * @param[out] width Where to store the width, in mm, of the monitor's display 1297 * @param[out] widthMM Where to store the width, in millimetres, of the
1030 * area, or `NULL`. 1298 * monitor's display area, or `NULL`.
1031 * @param[out] height Where to store the height, in mm, of the monitor's 1299 * @param[out] heightMM Where to store the height, in millimetres, of the
1032 * display area, or `NULL`. 1300 * monitor's display area, or `NULL`.
1033 * 1301 *
1034 * @note Some operating systems do not provide accurate information, either 1302 * @remarks __Windows:__ The OS calculates the returned physical size from the
1035 * because the monitor's EDID data is incorrect, or because the driver does not 1303 * current resolution and system DPI instead of querying the monitor EDID data.
1036 * report it accurately. 1304 *
1305 * @par Thread Safety
1306 * This function may only be called from the main thread.
1307 *
1308 * @sa @ref monitor_properties
1309 *
1310 * @since Added in GLFW 3.0.
1037 * 1311 *
1038 * @ingroup monitor 1312 * @ingroup monitor
1039 */ 1313 */
1040GLFWAPI void glfwGetMonitorPhysicalSize(GLFWmonitor* monitor, int* width, int* height); 1314GLFWAPI void glfwGetMonitorPhysicalSize(GLFWmonitor* monitor, int* widthMM, int* heightMM);
1041 1315
1042/*! @brief Returns the name of the specified monitor. 1316/*! @brief Returns the name of the specified monitor.
1043 * 1317 *
1044 * This function returns a human-readable name, encoded as UTF-8, of the 1318 * This function returns a human-readable name, encoded as UTF-8, of the
1045 * specified monitor. 1319 * specified monitor. The name typically reflects the make and model of the
1320 * monitor and is not guaranteed to be unique among the connected monitors.
1046 * 1321 *
1047 * @param[in] monitor The monitor to query. 1322 * @param[in] monitor The monitor to query.
1048 * @return The UTF-8 encoded name of the monitor, or `NULL` if an error 1323 * @return The UTF-8 encoded name of the monitor, or `NULL` if an
1049 * occurred. 1324 * [error](@ref error_handling) occurred.
1325 *
1326 * @par Pointer Lifetime
1327 * The returned string is allocated and freed by GLFW. You should not free it
1328 * yourself. It is valid until the specified monitor is disconnected or the
1329 * library is terminated.
1330 *
1331 * @par Thread Safety
1332 * This function may only be called from the main thread.
1333 *
1334 * @sa @ref monitor_properties
1050 * 1335 *
1051 * @note The returned string is allocated and freed by GLFW. You should not 1336 * @since Added in GLFW 3.0.
1052 * free it yourself.
1053 * 1337 *
1054 * @ingroup monitor 1338 * @ingroup monitor
1055 */ 1339 */
@@ -1063,12 +1347,19 @@ GLFWAPI const char* glfwGetMonitorName(GLFWmonitor* monitor);
1063 * 1347 *
1064 * @param[in] cbfun The new callback, or `NULL` to remove the currently set 1348 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
1065 * callback. 1349 * callback.
1066 * @return The previously set callback, or `NULL` if no callback was set or an 1350 * @return The previously set callback, or `NULL` if no callback was set or the
1067 * error occurred. 1351 * library had not been [initialized](@ref intro_init).
1068 * 1352 *
1069 * @bug **X11:** This callback is not yet called on monitor configuration 1353 * @bug __X11:__ This callback is not yet called on monitor configuration
1070 * changes. 1354 * changes.
1071 * 1355 *
1356 * @par Thread Safety
1357 * This function may only be called from the main thread.
1358 *
1359 * @sa @ref monitor_event
1360 *
1361 * @since Added in GLFW 3.0.
1362 *
1072 * @ingroup monitor 1363 * @ingroup monitor
1073 */ 1364 */
1074GLFWAPI GLFWmonitorfun glfwSetMonitorCallback(GLFWmonitorfun cbfun); 1365GLFWAPI GLFWmonitorfun glfwSetMonitorCallback(GLFWmonitorfun cbfun);
@@ -1083,16 +1374,25 @@ GLFWAPI GLFWmonitorfun glfwSetMonitorCallback(GLFWmonitorfun cbfun);
1083 * @param[in] monitor The monitor to query. 1374 * @param[in] monitor The monitor to query.
1084 * @param[out] count Where to store the number of video modes in the returned 1375 * @param[out] count Where to store the number of video modes in the returned
1085 * array. This is set to zero if an error occurred. 1376 * array. This is set to zero if an error occurred.
1086 * @return An array of video modes, or `NULL` if an error occurred. 1377 * @return An array of video modes, or `NULL` if an
1378 * [error](@ref error_handling) occurred.
1087 * 1379 *
1088 * @note The returned array is allocated and freed by GLFW. You should not 1380 * @par Pointer Lifetime
1089 * free it yourself. 1381 * The returned array is allocated and freed by GLFW. You should not free it
1382 * yourself. It is valid until the specified monitor is disconnected, this
1383 * function is called again for that monitor or the library is terminated.
1090 * 1384 *
1091 * @note The returned array is valid only until this function is called again 1385 * @par Thread Safety
1092 * for the specified monitor. 1386 * This function may only be called from the main thread.
1093 * 1387 *
1388 * @sa @ref monitor_modes
1094 * @sa glfwGetVideoMode 1389 * @sa glfwGetVideoMode
1095 * 1390 *
1391 * @since Added in GLFW 1.0.
1392 *
1393 * @par
1394 * __GLFW 3:__ Changed to return an array of modes for a specific monitor.
1395 *
1096 * @ingroup monitor 1396 * @ingroup monitor
1097 */ 1397 */
1098GLFWAPI const GLFWvidmode* glfwGetVideoModes(GLFWmonitor* monitor, int* count); 1398GLFWAPI const GLFWvidmode* glfwGetVideoModes(GLFWmonitor* monitor, int* count);
@@ -1100,17 +1400,26 @@ GLFWAPI const GLFWvidmode* glfwGetVideoModes(GLFWmonitor* monitor, int* count);
1100/*! @brief Returns the current mode of the specified monitor. 1400/*! @brief Returns the current mode of the specified monitor.
1101 * 1401 *
1102 * This function returns the current video mode of the specified monitor. If 1402 * This function returns the current video mode of the specified monitor. If
1103 * you are using a full screen window, the return value will therefore depend 1403 * you have created a full screen window for that monitor, the return value
1104 * on whether it is focused. 1404 * will depend on whether that window is iconified.
1105 * 1405 *
1106 * @param[in] monitor The monitor to query. 1406 * @param[in] monitor The monitor to query.
1107 * @return The current mode of the monitor, or `NULL` if an error occurred. 1407 * @return The current mode of the monitor, or `NULL` if an
1408 * [error](@ref error_handling) occurred.
1409 *
1410 * @par Pointer Lifetime
1411 * The returned array is allocated and freed by GLFW. You should not free it
1412 * yourself. It is valid until the specified monitor is disconnected or the
1413 * library is terminated.
1108 * 1414 *
1109 * @note The returned struct is allocated and freed by GLFW. You should not 1415 * @par Thread Safety
1110 * free it yourself. 1416 * This function may only be called from the main thread.
1111 * 1417 *
1418 * @sa @ref monitor_modes
1112 * @sa glfwGetVideoModes 1419 * @sa glfwGetVideoModes
1113 * 1420 *
1421 * @since Added in GLFW 3.0. Replaces `glfwGetDesktopMode`.
1422 *
1114 * @ingroup monitor 1423 * @ingroup monitor
1115 */ 1424 */
1116GLFWAPI const GLFWvidmode* glfwGetVideoMode(GLFWmonitor* monitor); 1425GLFWAPI const GLFWvidmode* glfwGetVideoMode(GLFWmonitor* monitor);
@@ -1118,24 +1427,43 @@ GLFWAPI const GLFWvidmode* glfwGetVideoMode(GLFWmonitor* monitor);
1118/*! @brief Generates a gamma ramp and sets it for the specified monitor. 1427/*! @brief Generates a gamma ramp and sets it for the specified monitor.
1119 * 1428 *
1120 * This function generates a 256-element gamma ramp from the specified exponent 1429 * This function generates a 256-element gamma ramp from the specified exponent
1121 * and then calls @ref glfwSetGammaRamp with it. 1430 * and then calls @ref glfwSetGammaRamp with it. The value must be a finite
1431 * number greater than zero.
1122 * 1432 *
1123 * @param[in] monitor The monitor whose gamma ramp to set. 1433 * @param[in] monitor The monitor whose gamma ramp to set.
1124 * @param[in] gamma The desired exponent. 1434 * @param[in] gamma The desired exponent.
1125 * 1435 *
1436 * @par Thread Safety
1437 * This function may only be called from the main thread.
1438 *
1439 * @sa @ref monitor_gamma
1440 *
1441 * @since Added in GLFW 3.0.
1442 *
1126 * @ingroup monitor 1443 * @ingroup monitor
1127 */ 1444 */
1128GLFWAPI void glfwSetGamma(GLFWmonitor* monitor, float gamma); 1445GLFWAPI void glfwSetGamma(GLFWmonitor* monitor, float gamma);
1129 1446
1130/*! @brief Retrieves the current gamma ramp for the specified monitor. 1447/*! @brief Returns the current gamma ramp for the specified monitor.
1131 * 1448 *
1132 * This function retrieves the current gamma ramp of the specified monitor. 1449 * This function returns the current gamma ramp of the specified monitor.
1133 * 1450 *
1134 * @param[in] monitor The monitor to query. 1451 * @param[in] monitor The monitor to query.
1135 * @return The current gamma ramp, or `NULL` if an error occurred. 1452 * @return The current gamma ramp, or `NULL` if an
1453 * [error](@ref error_handling) occurred.
1136 * 1454 *
1137 * @note The value arrays of the returned ramp are allocated and freed by GLFW. 1455 * @par Pointer Lifetime
1138 * You should not free them yourself. 1456 * The returned structure and its arrays are allocated and freed by GLFW. You
1457 * should not free them yourself. They are valid until the specified monitor
1458 * is disconnected, this function is called again for that monitor or the
1459 * library is terminated.
1460 *
1461 * @par Thread Safety
1462 * This function may only be called from the main thread.
1463 *
1464 * @sa @ref monitor_gamma
1465 *
1466 * @since Added in GLFW 3.0.
1139 * 1467 *
1140 * @ingroup monitor 1468 * @ingroup monitor
1141 */ 1469 */
@@ -1143,12 +1471,27 @@ GLFWAPI const GLFWgammaramp* glfwGetGammaRamp(GLFWmonitor* monitor);
1143 1471
1144/*! @brief Sets the current gamma ramp for the specified monitor. 1472/*! @brief Sets the current gamma ramp for the specified monitor.
1145 * 1473 *
1146 * This function sets the current gamma ramp for the specified monitor. 1474 * This function sets the current gamma ramp for the specified monitor. The
1475 * original gamma ramp for that monitor is saved by GLFW the first time this
1476 * function is called and is restored by @ref glfwTerminate.
1147 * 1477 *
1148 * @param[in] monitor The monitor whose gamma ramp to set. 1478 * @param[in] monitor The monitor whose gamma ramp to set.
1149 * @param[in] ramp The gamma ramp to use. 1479 * @param[in] ramp The gamma ramp to use.
1150 * 1480 *
1151 * @note Gamma ramp sizes other than 256 are not supported by all hardware. 1481 * @remarks Gamma ramp sizes other than 256 are not supported by all platforms
1482 * or graphics hardware.
1483 *
1484 * @remarks __Windows:__ The gamma ramp size must be 256.
1485 *
1486 * @par Pointer Lifetime
1487 * The specified gamma ramp is copied before this function returns.
1488 *
1489 * @par Thread Safety
1490 * This function may only be called from the main thread.
1491 *
1492 * @sa @ref monitor_gamma
1493 *
1494 * @since Added in GLFW 3.0.
1152 * 1495 *
1153 * @ingroup monitor 1496 * @ingroup monitor
1154 */ 1497 */
@@ -1159,10 +1502,14 @@ GLFWAPI void glfwSetGammaRamp(GLFWmonitor* monitor, const GLFWgammaramp* ramp);
1159 * This function resets all window hints to their 1502 * This function resets all window hints to their
1160 * [default values](@ref window_hints_values). 1503 * [default values](@ref window_hints_values).
1161 * 1504 *
1162 * @note This function may only be called from the main thread. 1505 * @par Thread Safety
1506 * This function may only be called from the main thread.
1163 * 1507 *
1508 * @sa @ref window_hints
1164 * @sa glfwWindowHint 1509 * @sa glfwWindowHint
1165 * 1510 *
1511 * @since Added in GLFW 3.0.
1512 *
1166 * @ingroup window 1513 * @ingroup window
1167 */ 1514 */
1168GLFWAPI void glfwDefaultWindowHints(void); 1515GLFWAPI void glfwDefaultWindowHints(void);
@@ -1172,51 +1519,69 @@ GLFWAPI void glfwDefaultWindowHints(void);
1172 * This function sets hints for the next call to @ref glfwCreateWindow. The 1519 * This function sets hints for the next call to @ref glfwCreateWindow. The
1173 * hints, once set, retain their values until changed by a call to @ref 1520 * hints, once set, retain their values until changed by a call to @ref
1174 * glfwWindowHint or @ref glfwDefaultWindowHints, or until the library is 1521 * glfwWindowHint or @ref glfwDefaultWindowHints, or until the library is
1175 * terminated with @ref glfwTerminate. 1522 * terminated.
1176 * 1523 *
1177 * @param[in] target The [window hint](@ref window_hints) to set. 1524 * @param[in] target The [window hint](@ref window_hints) to set.
1178 * @param[in] hint The new value of the window hint. 1525 * @param[in] hint The new value of the window hint.
1179 * 1526 *
1180 * @par New in GLFW 3 1527 * @par Thread Safety
1181 * Hints are no longer reset to their default values on window creation. To 1528 * This function may only be called from the main thread.
1182 * set default hint values, use @ref glfwDefaultWindowHints.
1183 *
1184 * @note This function may only be called from the main thread.
1185 * 1529 *
1530 * @sa @ref window_hints
1186 * @sa glfwDefaultWindowHints 1531 * @sa glfwDefaultWindowHints
1187 * 1532 *
1533 * @since Added in GLFW 3.0. Replaces `glfwOpenWindowHint`.
1534 *
1188 * @ingroup window 1535 * @ingroup window
1189 */ 1536 */
1190GLFWAPI void glfwWindowHint(int target, int hint); 1537GLFWAPI void glfwWindowHint(int target, int hint);
1191 1538
1192/*! @brief Creates a window and its associated context. 1539/*! @brief Creates a window and its associated context.
1193 * 1540 *
1194 * This function creates a window and its associated context. Most of the 1541 * This function creates a window and its associated OpenGL or OpenGL ES
1195 * options controlling how the window and its context should be created are 1542 * context. Most of the options controlling how the window and its context
1196 * specified through @ref glfwWindowHint. 1543 * should be created are specified with [window hints](@ref window_hints).
1197 * 1544 *
1198 * Successful creation does not change which context is current. Before you 1545 * Successful creation does not change which context is current. Before you
1199 * can use the newly created context, you need to make it current using @ref 1546 * can use the newly created context, you need to
1200 * glfwMakeContextCurrent. 1547 * [make it current](@ref context_current). For information about the `share`
1548 * parameter, see @ref context_sharing.
1201 * 1549 *
1202 * Note that the created window and context may differ from what you requested, 1550 * The created window, framebuffer and context may differ from what you
1203 * as not all parameters and hints are 1551 * requested, as not all parameters and hints are
1204 * [hard constraints](@ref window_hints_hard). This includes the size of the 1552 * [hard constraints](@ref window_hints_hard). This includes the size of the
1205 * window, especially for full screen windows. To retrieve the actual 1553 * window, especially for full screen windows. To query the actual attributes
1206 * attributes of the created window and context, use queries like @ref 1554 * of the created window, framebuffer and context, use queries like @ref
1207 * glfwGetWindowAttrib and @ref glfwGetWindowSize. 1555 * glfwGetWindowAttrib and @ref glfwGetWindowSize.
1208 * 1556 *
1209 * To create a full screen window, you need to specify the monitor to use. If 1557 * To create a full screen window, you need to specify the monitor the window
1210 * no monitor is specified, windowed mode will be used. Unless you have a way 1558 * will cover. If no monitor is specified, windowed mode will be used. Unless
1211 * for the user to choose a specific monitor, it is recommended that you pick 1559 * you have a way for the user to choose a specific monitor, it is recommended
1212 * the primary monitor. For more information on how to retrieve monitors, see 1560 * that you pick the primary monitor. For more information on how to query
1213 * @ref monitor_monitors. 1561 * connected monitors, see @ref monitor_monitors.
1562 *
1563 * For full screen windows, the specified size becomes the resolution of the
1564 * window's _desired video mode_. As long as a full screen window has input
1565 * focus, the supported video mode most closely matching the desired video mode
1566 * is set for the specified monitor. For more information about full screen
1567 * windows, including the creation of so called _windowed full screen_ or
1568 * _borderless full screen_ windows, see @ref window_windowed_full_screen.
1569 *
1570 * By default, newly created windows use the placement recommended by the
1571 * window system. To create the window at a specific position, make it
1572 * initially invisible using the [GLFW_VISIBLE](@ref window_hints_wnd) window
1573 * hint, set its [position](@ref window_pos) and then [show](@ref window_hide)
1574 * it.
1575 *
1576 * If a full screen window has input focus, the screensaver is prohibited from
1577 * starting.
1214 * 1578 *
1215 * To create the window at a specific position, make it initially invisible 1579 * Window systems put limits on window sizes. Very large or very small window
1216 * using the `GLFW_VISIBLE` window hint, set its position and then show it. 1580 * dimensions may be overridden by the window system on creation. Check the
1581 * actual [size](@ref window_size) after creation.
1217 * 1582 *
1218 * If a full screen window is active, the screensaver is prohibited from 1583 * The [swap interval](@ref buffer_swap) is not set during window creation and
1219 * starting. 1584 * the initial value may vary depending on driver settings and defaults.
1220 * 1585 *
1221 * @param[in] width The desired width, in screen coordinates, of the window. 1586 * @param[in] width The desired width, in screen coordinates, of the window.
1222 * This must be greater than zero. 1587 * This must be greater than zero.
@@ -1227,32 +1592,54 @@ GLFWAPI void glfwWindowHint(int target, int hint);
1227 * windowed mode. 1592 * windowed mode.
1228 * @param[in] share The window whose context to share resources with, or `NULL` 1593 * @param[in] share The window whose context to share resources with, or `NULL`
1229 * to not share resources. 1594 * to not share resources.
1230 * @return The handle of the created window, or `NULL` if an error occurred. 1595 * @return The handle of the created window, or `NULL` if an
1596 * [error](@ref error_handling) occurred.
1231 * 1597 *
1232 * @remarks **Windows:** Window creation will fail if the Microsoft GDI 1598 * @remarks __Windows:__ Window creation will fail if the Microsoft GDI
1233 * software OpenGL implementation is the only one available. 1599 * software OpenGL implementation is the only one available.
1234 * 1600 *
1235 * @remarks **Windows:** If the executable has an icon resource named 1601 * @remarks __Windows:__ If the executable has an icon resource named
1236 * `GLFW_ICON,` it will be set as the icon for the window. If no such icon is 1602 * `GLFW_ICON,` it will be set as the icon for the window. If no such icon is
1237 * present, the `IDI_WINLOGO` icon will be used instead. 1603 * present, the `IDI_WINLOGO` icon will be used instead.
1238 * 1604 *
1239 * @remarks **OS X:** The GLFW window has no icon, as it is not a document 1605 * @remarks __Windows:__ The context to share resources with may not be current
1606 * on any other thread.
1607 *
1608 * @remarks __OS X:__ The GLFW window has no icon, as it is not a document
1240 * window, but the dock icon will be the same as the application bundle's icon. 1609 * window, but the dock icon will be the same as the application bundle's icon.
1241 * Also, the first time a window is opened the menu bar is populated with 1610 * For more information on bundles, see the
1242 * common commands like Hide, Quit and About. The (minimal) about dialog uses 1611 * [Bundle Programming Guide](https://developer.apple.com/library/mac/documentation/CoreFoundation/Conceptual/CFBundles/)
1243 * information from the application's bundle. For more information on bundles, 1612 * in the Mac Developer Library.
1244 * see the Bundle Programming Guide provided by Apple. 1613 *
1614 * @remarks __OS X:__ The first time a window is created the menu bar is
1615 * populated with common commands like Hide, Quit and About. The About entry
1616 * opens a minimal about dialog with information from the application's bundle.
1617 * The menu bar can be disabled with a
1618 * [compile-time option](@ref compile_options_osx).
1245 * 1619 *
1246 * @remarks **X11:** There is no mechanism for setting the window icon yet. 1620 * @remarks __OS X:__ On OS X 10.10 and later the window frame will not be
1621 * rendered at full resolution on Retina displays unless the
1622 * `NSHighResolutionCapable` key is enabled in the application bundle's
1623 * `Info.plist`. For more information, see
1624 * [High Resolution Guidelines for OS X](https://developer.apple.com/library/mac/documentation/GraphicsAnimation/Conceptual/HighResolutionOSX/Explained/Explained.html)
1625 * in the Mac Developer Library.
1247 * 1626 *
1248 * @remarks The swap interval is not set during window creation, but is left at 1627 * @remarks __X11:__ There is no mechanism for setting the window icon yet.
1249 * the default value for that platform. For more information, see @ref
1250 * glfwSwapInterval.
1251 * 1628 *
1252 * @note This function may only be called from the main thread. 1629 * @remarks __X11:__ Some window managers will not respect the placement of
1630 * initially hidden windows.
1253 * 1631 *
1632 * @par Reentrancy
1633 * This function may not be called from a callback.
1634 *
1635 * @par Thread Safety
1636 * This function may only be called from the main thread.
1637 *
1638 * @sa @ref window_creation
1254 * @sa glfwDestroyWindow 1639 * @sa glfwDestroyWindow
1255 * 1640 *
1641 * @since Added in GLFW 3.0. Replaces `glfwOpenWindow`.
1642 *
1256 * @ingroup window 1643 * @ingroup window
1257 */ 1644 */
1258GLFWAPI GLFWwindow* glfwCreateWindow(int width, int height, const char* title, GLFWmonitor* monitor, GLFWwindow* share); 1645GLFWAPI GLFWwindow* glfwCreateWindow(int width, int height, const char* title, GLFWmonitor* monitor, GLFWwindow* share);
@@ -1262,19 +1649,25 @@ GLFWAPI GLFWwindow* glfwCreateWindow(int width, int height, const char* title, G
1262 * This function destroys the specified window and its context. On calling 1649 * This function destroys the specified window and its context. On calling
1263 * this function, no further callbacks will be called for that window. 1650 * this function, no further callbacks will be called for that window.
1264 * 1651 *
1265 * @param[in] window The window to destroy. 1652 * If the context of the specified window is current on the main thread, it is
1653 * detached before being destroyed.
1266 * 1654 *
1267 * @note This function may only be called from the main thread. 1655 * @param[in] window The window to destroy.
1268 * 1656 *
1269 * @note This function may not be called from a callback. 1657 * @note The context of the specified window must not be current on any other
1658 * thread when this function is called.
1270 * 1659 *
1271 * @note If the window's context is current on the main thread, it is 1660 * @par Reentrancy
1272 * detached before being destroyed. 1661 * This function may not be called from a callback.
1273 * 1662 *
1274 * @warning The window's context must not be current on any other thread. 1663 * @par Thread Safety
1664 * This function may only be called from the main thread.
1275 * 1665 *
1666 * @sa @ref window_creation
1276 * @sa glfwCreateWindow 1667 * @sa glfwCreateWindow
1277 * 1668 *
1669 * @since Added in GLFW 3.0. Replaces `glfwCloseWindow`.
1670 *
1278 * @ingroup window 1671 * @ingroup window
1279 */ 1672 */
1280GLFWAPI void glfwDestroyWindow(GLFWwindow* window); 1673GLFWAPI void glfwDestroyWindow(GLFWwindow* window);
@@ -1286,7 +1679,12 @@ GLFWAPI void glfwDestroyWindow(GLFWwindow* window);
1286 * @param[in] window The window to query. 1679 * @param[in] window The window to query.
1287 * @return The value of the close flag. 1680 * @return The value of the close flag.
1288 * 1681 *
1289 * @remarks This function may be called from secondary threads. 1682 * @par Thread Safety
1683 * This function may be called from any thread. Access is not synchronized.
1684 *
1685 * @sa @ref window_close
1686 *
1687 * @since Added in GLFW 3.0.
1290 * 1688 *
1291 * @ingroup window 1689 * @ingroup window
1292 */ 1690 */
@@ -1301,7 +1699,12 @@ GLFWAPI int glfwWindowShouldClose(GLFWwindow* window);
1301 * @param[in] window The window whose flag to change. 1699 * @param[in] window The window whose flag to change.
1302 * @param[in] value The new value. 1700 * @param[in] value The new value.
1303 * 1701 *
1304 * @remarks This function may be called from secondary threads. 1702 * @par Thread Safety
1703 * This function may be called from any thread. Access is not synchronized.
1704 *
1705 * @sa @ref window_close
1706 *
1707 * @since Added in GLFW 3.0.
1305 * 1708 *
1306 * @ingroup window 1709 * @ingroup window
1307 */ 1710 */
@@ -1315,7 +1718,15 @@ GLFWAPI void glfwSetWindowShouldClose(GLFWwindow* window, int value);
1315 * @param[in] window The window whose title to change. 1718 * @param[in] window The window whose title to change.
1316 * @param[in] title The UTF-8 encoded window title. 1719 * @param[in] title The UTF-8 encoded window title.
1317 * 1720 *
1318 * @note This function may only be called from the main thread. 1721 * @par Thread Safety
1722 * This function may only be called from the main thread.
1723 *
1724 * @sa @ref window_title
1725 *
1726 * @since Added in GLFW 1.0.
1727 *
1728 * @par
1729 * __GLFW 3:__ Added window handle parameter.
1319 * 1730 *
1320 * @ingroup window 1731 * @ingroup window
1321 */ 1732 */
@@ -1326,14 +1737,23 @@ GLFWAPI void glfwSetWindowTitle(GLFWwindow* window, const char* title);
1326 * This function retrieves the position, in screen coordinates, of the 1737 * This function retrieves the position, in screen coordinates, of the
1327 * upper-left corner of the client area of the specified window. 1738 * upper-left corner of the client area of the specified window.
1328 * 1739 *
1740 * Any or all of the position arguments may be `NULL`. If an error occurs, all
1741 * non-`NULL` position arguments will be set to zero.
1742 *
1329 * @param[in] window The window to query. 1743 * @param[in] window The window to query.
1330 * @param[out] xpos Where to store the x-coordinate of the upper-left corner of 1744 * @param[out] xpos Where to store the x-coordinate of the upper-left corner of
1331 * the client area, or `NULL`. 1745 * the client area, or `NULL`.
1332 * @param[out] ypos Where to store the y-coordinate of the upper-left corner of 1746 * @param[out] ypos Where to store the y-coordinate of the upper-left corner of
1333 * the client area, or `NULL`. 1747 * the client area, or `NULL`.
1334 * 1748 *
1749 * @par Thread Safety
1750 * This function may only be called from the main thread.
1751 *
1752 * @sa @ref window_pos
1335 * @sa glfwSetWindowPos 1753 * @sa glfwSetWindowPos
1336 * 1754 *
1755 * @since Added in GLFW 3.0.
1756 *
1337 * @ingroup window 1757 * @ingroup window
1338 */ 1758 */
1339GLFWAPI void glfwGetWindowPos(GLFWwindow* window, int* xpos, int* ypos); 1759GLFWAPI void glfwGetWindowPos(GLFWwindow* window, int* xpos, int* ypos);
@@ -1341,26 +1761,29 @@ GLFWAPI void glfwGetWindowPos(GLFWwindow* window, int* xpos, int* ypos);
1341/*! @brief Sets the position of the client area of the specified window. 1761/*! @brief Sets the position of the client area of the specified window.
1342 * 1762 *
1343 * This function sets the position, in screen coordinates, of the upper-left 1763 * This function sets the position, in screen coordinates, of the upper-left
1344 * corner of the client area of the window. 1764 * corner of the client area of the specified windowed mode window. If the
1765 * window is a full screen window, this function does nothing.
1345 * 1766 *
1346 * If the specified window is a full screen window, this function does nothing. 1767 * __Do not use this function__ to move an already visible window unless you
1768 * have very good reasons for doing so, as it will confuse and annoy the user.
1347 * 1769 *
1348 * If you wish to set an initial window position you should create a hidden 1770 * The window manager may put limits on what positions are allowed. GLFW
1349 * window (using @ref glfwWindowHint and `GLFW_VISIBLE`), set its position and 1771 * cannot and should not override these limits.
1350 * then show it.
1351 * 1772 *
1352 * @param[in] window The window to query. 1773 * @param[in] window The window to query.
1353 * @param[in] xpos The x-coordinate of the upper-left corner of the client area. 1774 * @param[in] xpos The x-coordinate of the upper-left corner of the client area.
1354 * @param[in] ypos The y-coordinate of the upper-left corner of the client area. 1775 * @param[in] ypos The y-coordinate of the upper-left corner of the client area.
1355 * 1776 *
1356 * @note It is very rarely a good idea to move an already visible window, as it 1777 * @par Thread Safety
1357 * will confuse and annoy the user. 1778 * This function may only be called from the main thread.
1358 * 1779 *
1359 * @note This function may only be called from the main thread. 1780 * @sa @ref window_pos
1781 * @sa glfwGetWindowPos
1360 * 1782 *
1361 * @note The window manager may put limits on what positions are allowed. 1783 * @since Added in GLFW 1.0.
1362 * 1784 *
1363 * @sa glfwGetWindowPos 1785 * @par
1786 * __GLFW 3:__ Added window handle parameter.
1364 * 1787 *
1365 * @ingroup window 1788 * @ingroup window
1366 */ 1789 */
@@ -1370,7 +1793,10 @@ GLFWAPI void glfwSetWindowPos(GLFWwindow* window, int xpos, int ypos);
1370 * 1793 *
1371 * This function retrieves the size, in screen coordinates, of the client area 1794 * This function retrieves the size, in screen coordinates, of the client area
1372 * of the specified window. If you wish to retrieve the size of the 1795 * of the specified window. If you wish to retrieve the size of the
1373 * framebuffer in pixels, see @ref glfwGetFramebufferSize. 1796 * framebuffer of the window in pixels, see @ref glfwGetFramebufferSize.
1797 *
1798 * Any or all of the size arguments may be `NULL`. If an error occurs, all
1799 * non-`NULL` size arguments will be set to zero.
1374 * 1800 *
1375 * @param[in] window The window whose size to retrieve. 1801 * @param[in] window The window whose size to retrieve.
1376 * @param[out] width Where to store the width, in screen coordinates, of the 1802 * @param[out] width Where to store the width, in screen coordinates, of the
@@ -1378,8 +1804,17 @@ GLFWAPI void glfwSetWindowPos(GLFWwindow* window, int xpos, int ypos);
1378 * @param[out] height Where to store the height, in screen coordinates, of the 1804 * @param[out] height Where to store the height, in screen coordinates, of the
1379 * client area, or `NULL`. 1805 * client area, or `NULL`.
1380 * 1806 *
1807 * @par Thread Safety
1808 * This function may only be called from the main thread.
1809 *
1810 * @sa @ref window_size
1381 * @sa glfwSetWindowSize 1811 * @sa glfwSetWindowSize
1382 * 1812 *
1813 * @since Added in GLFW 1.0.
1814 *
1815 * @par
1816 * __GLFW 3:__ Added window handle parameter.
1817 *
1383 * @ingroup window 1818 * @ingroup window
1384 */ 1819 */
1385GLFWAPI void glfwGetWindowSize(GLFWwindow* window, int* width, int* height); 1820GLFWAPI void glfwGetWindowSize(GLFWwindow* window, int* width, int* height);
@@ -1394,16 +1829,24 @@ GLFWAPI void glfwGetWindowSize(GLFWwindow* window, int* width, int* height);
1394 * the context is unaffected, the bit depths of the framebuffer remain 1829 * the context is unaffected, the bit depths of the framebuffer remain
1395 * unchanged. 1830 * unchanged.
1396 * 1831 *
1832 * The window manager may put limits on what sizes are allowed. GLFW cannot
1833 * and should not override these limits.
1834 *
1397 * @param[in] window The window to resize. 1835 * @param[in] window The window to resize.
1398 * @param[in] width The desired width of the specified window. 1836 * @param[in] width The desired width of the specified window.
1399 * @param[in] height The desired height of the specified window. 1837 * @param[in] height The desired height of the specified window.
1400 * 1838 *
1401 * @note This function may only be called from the main thread. 1839 * @par Thread Safety
1402 * 1840 * This function may only be called from the main thread.
1403 * @note The window manager may put limits on what window sizes are allowed.
1404 * 1841 *
1842 * @sa @ref window_size
1405 * @sa glfwGetWindowSize 1843 * @sa glfwGetWindowSize
1406 * 1844 *
1845 * @since Added in GLFW 1.0.
1846 *
1847 * @par
1848 * __GLFW 3:__ Added window handle parameter.
1849 *
1407 * @ingroup window 1850 * @ingroup window
1408 */ 1851 */
1409GLFWAPI void glfwSetWindowSize(GLFWwindow* window, int width, int height); 1852GLFWAPI void glfwSetWindowSize(GLFWwindow* window, int width, int height);
@@ -1414,80 +1857,149 @@ GLFWAPI void glfwSetWindowSize(GLFWwindow* window, int width, int height);
1414 * specified window. If you wish to retrieve the size of the window in screen 1857 * specified window. If you wish to retrieve the size of the window in screen
1415 * coordinates, see @ref glfwGetWindowSize. 1858 * coordinates, see @ref glfwGetWindowSize.
1416 * 1859 *
1860 * Any or all of the size arguments may be `NULL`. If an error occurs, all
1861 * non-`NULL` size arguments will be set to zero.
1862 *
1417 * @param[in] window The window whose framebuffer to query. 1863 * @param[in] window The window whose framebuffer to query.
1418 * @param[out] width Where to store the width, in pixels, of the framebuffer, 1864 * @param[out] width Where to store the width, in pixels, of the framebuffer,
1419 * or `NULL`. 1865 * or `NULL`.
1420 * @param[out] height Where to store the height, in pixels, of the framebuffer, 1866 * @param[out] height Where to store the height, in pixels, of the framebuffer,
1421 * or `NULL`. 1867 * or `NULL`.
1422 * 1868 *
1869 * @par Thread Safety
1870 * This function may only be called from the main thread.
1871 *
1872 * @sa @ref window_fbsize
1423 * @sa glfwSetFramebufferSizeCallback 1873 * @sa glfwSetFramebufferSizeCallback
1424 * 1874 *
1875 * @since Added in GLFW 3.0.
1876 *
1425 * @ingroup window 1877 * @ingroup window
1426 */ 1878 */
1427GLFWAPI void glfwGetFramebufferSize(GLFWwindow* window, int* width, int* height); 1879GLFWAPI void glfwGetFramebufferSize(GLFWwindow* window, int* width, int* height);
1428 1880
1881/*! @brief Retrieves the size of the frame of the window.
1882 *
1883 * This function retrieves the size, in screen coordinates, of each edge of the
1884 * frame of the specified window. This size includes the title bar, if the
1885 * window has one. The size of the frame may vary depending on the
1886 * [window-related hints](@ref window_hints_wnd) used to create it.
1887 *
1888 * Because this function retrieves the size of each window frame edge and not
1889 * the offset along a particular coordinate axis, the retrieved values will
1890 * always be zero or positive.
1891 *
1892 * Any or all of the size arguments may be `NULL`. If an error occurs, all
1893 * non-`NULL` size arguments will be set to zero.
1894 *
1895 * @param[in] window The window whose frame size to query.
1896 * @param[out] left Where to store the size, in screen coordinates, of the left
1897 * edge of the window frame, or `NULL`.
1898 * @param[out] top Where to store the size, in screen coordinates, of the top
1899 * edge of the window frame, or `NULL`.
1900 * @param[out] right Where to store the size, in screen coordinates, of the
1901 * right edge of the window frame, or `NULL`.
1902 * @param[out] bottom Where to store the size, in screen coordinates, of the
1903 * bottom edge of the window frame, or `NULL`.
1904 *
1905 * @par Thread Safety
1906 * This function may only be called from the main thread.
1907 *
1908 * @sa @ref window_size
1909 *
1910 * @since Added in GLFW 3.1.
1911 *
1912 * @ingroup window
1913 */
1914GLFWAPI void glfwGetWindowFrameSize(GLFWwindow* window, int* left, int* top, int* right, int* bottom);
1915
1429/*! @brief Iconifies the specified window. 1916/*! @brief Iconifies the specified window.
1430 * 1917 *
1431 * This function iconifies/minimizes the specified window, if it was previously 1918 * This function iconifies (minimizes) the specified window if it was
1432 * restored. If it is a full screen window, the original monitor resolution is 1919 * previously restored. If the window is already iconified, this function does
1433 * restored until the window is restored. If the window is already iconified, 1920 * nothing.
1434 * this function does nothing. 1921 *
1922 * If the specified window is a full screen window, the original monitor
1923 * resolution is restored until the window is restored.
1435 * 1924 *
1436 * @param[in] window The window to iconify. 1925 * @param[in] window The window to iconify.
1437 * 1926 *
1438 * @note This function may only be called from the main thread. 1927 * @par Thread Safety
1928 * This function may only be called from the main thread.
1439 * 1929 *
1930 * @sa @ref window_iconify
1440 * @sa glfwRestoreWindow 1931 * @sa glfwRestoreWindow
1441 * 1932 *
1933 * @since Added in GLFW 2.1.
1934 *
1935 * @par
1936 * __GLFW 3:__ Added window handle parameter.
1937 *
1442 * @ingroup window 1938 * @ingroup window
1443 */ 1939 */
1444GLFWAPI void glfwIconifyWindow(GLFWwindow* window); 1940GLFWAPI void glfwIconifyWindow(GLFWwindow* window);
1445 1941
1446/*! @brief Restores the specified window. 1942/*! @brief Restores the specified window.
1447 * 1943 *
1448 * This function restores the specified window, if it was previously 1944 * This function restores the specified window if it was previously iconified
1449 * iconified/minimized. If it is a full screen window, the resolution chosen 1945 * (minimized). If the window is already restored, this function does nothing.
1450 * for the window is restored on the selected monitor. If the window is 1946 *
1451 * already restored, this function does nothing. 1947 * If the specified window is a full screen window, the resolution chosen for
1948 * the window is restored on the selected monitor.
1452 * 1949 *
1453 * @param[in] window The window to restore. 1950 * @param[in] window The window to restore.
1454 * 1951 *
1455 * @note This function may only be called from the main thread. 1952 * @par Thread Safety
1953 * This function may only be called from the main thread.
1456 * 1954 *
1955 * @sa @ref window_iconify
1457 * @sa glfwIconifyWindow 1956 * @sa glfwIconifyWindow
1458 * 1957 *
1958 * @since Added in GLFW 2.1.
1959 *
1960 * @par
1961 * __GLFW 3:__ Added window handle parameter.
1962 *
1459 * @ingroup window 1963 * @ingroup window
1460 */ 1964 */
1461GLFWAPI void glfwRestoreWindow(GLFWwindow* window); 1965GLFWAPI void glfwRestoreWindow(GLFWwindow* window);
1462 1966
1463/*! @brief Makes the specified window visible. 1967/*! @brief Makes the specified window visible.
1464 * 1968 *
1465 * This function makes the specified window visible, if it was previously 1969 * This function makes the specified window visible if it was previously
1466 * hidden. If the window is already visible or is in full screen mode, this 1970 * hidden. If the window is already visible or is in full screen mode, this
1467 * function does nothing. 1971 * function does nothing.
1468 * 1972 *
1469 * @param[in] window The window to make visible. 1973 * @param[in] window The window to make visible.
1470 * 1974 *
1471 * @note This function may only be called from the main thread. 1975 * @par Thread Safety
1976 * This function may only be called from the main thread.
1472 * 1977 *
1978 * @sa @ref window_hide
1473 * @sa glfwHideWindow 1979 * @sa glfwHideWindow
1474 * 1980 *
1981 * @since Added in GLFW 3.0.
1982 *
1475 * @ingroup window 1983 * @ingroup window
1476 */ 1984 */
1477GLFWAPI void glfwShowWindow(GLFWwindow* window); 1985GLFWAPI void glfwShowWindow(GLFWwindow* window);
1478 1986
1479/*! @brief Hides the specified window. 1987/*! @brief Hides the specified window.
1480 * 1988 *
1481 * This function hides the specified window, if it was previously visible. If 1989 * This function hides the specified window if it was previously visible. If
1482 * the window is already hidden or is in full screen mode, this function does 1990 * the window is already hidden or is in full screen mode, this function does
1483 * nothing. 1991 * nothing.
1484 * 1992 *
1485 * @param[in] window The window to hide. 1993 * @param[in] window The window to hide.
1486 * 1994 *
1487 * @note This function may only be called from the main thread. 1995 * @par Thread Safety
1996 * This function may only be called from the main thread.
1488 * 1997 *
1998 * @sa @ref window_hide
1489 * @sa glfwShowWindow 1999 * @sa glfwShowWindow
1490 * 2000 *
2001 * @since Added in GLFW 3.0.
2002 *
1491 * @ingroup window 2003 * @ingroup window
1492 */ 2004 */
1493GLFWAPI void glfwHideWindow(GLFWwindow* window); 2005GLFWAPI void glfwHideWindow(GLFWwindow* window);
@@ -1498,7 +2010,15 @@ GLFWAPI void glfwHideWindow(GLFWwindow* window);
1498 * in full screen on. 2010 * in full screen on.
1499 * 2011 *
1500 * @param[in] window The window to query. 2012 * @param[in] window The window to query.
1501 * @return The monitor, or `NULL` if the window is in windowed mode. 2013 * @return The monitor, or `NULL` if the window is in windowed mode or an error
2014 * occurred.
2015 *
2016 * @par Thread Safety
2017 * This function may only be called from the main thread.
2018 *
2019 * @sa @ref window_monitor
2020 *
2021 * @since Added in GLFW 3.0.
1502 * 2022 *
1503 * @ingroup window 2023 * @ingroup window
1504 */ 2024 */
@@ -1506,13 +2026,22 @@ GLFWAPI GLFWmonitor* glfwGetWindowMonitor(GLFWwindow* window);
1506 2026
1507/*! @brief Returns an attribute of the specified window. 2027/*! @brief Returns an attribute of the specified window.
1508 * 2028 *
1509 * This function returns an attribute of the specified window. There are many 2029 * This function returns the value of an attribute of the specified window or
1510 * attributes, some related to the window and others to its context. 2030 * its OpenGL or OpenGL ES context.
1511 * 2031 *
1512 * @param[in] window The window to query. 2032 * @param[in] window The window to query.
1513 * @param[in] attrib The [window attribute](@ref window_attribs) whose value to 2033 * @param[in] attrib The [window attribute](@ref window_attribs) whose value to
1514 * return. 2034 * return.
1515 * @return The value of the attribute, or zero if an error occurred. 2035 * @return The value of the attribute, or zero if an
2036 * [error](@ref error_handling) occurred.
2037 *
2038 * @par Thread Safety
2039 * This function may only be called from the main thread.
2040 *
2041 * @sa @ref window_attribs
2042 *
2043 * @since Added in GLFW 3.0. Replaces `glfwGetWindowParam` and
2044 * `glfwGetGLVersion`.
1516 * 2045 *
1517 * @ingroup window 2046 * @ingroup window
1518 */ 2047 */
@@ -1527,8 +2056,14 @@ GLFWAPI int glfwGetWindowAttrib(GLFWwindow* window, int attrib);
1527 * @param[in] window The window whose pointer to set. 2056 * @param[in] window The window whose pointer to set.
1528 * @param[in] pointer The new value. 2057 * @param[in] pointer The new value.
1529 * 2058 *
2059 * @par Thread Safety
2060 * This function may be called from any thread. Access is not synchronized.
2061 *
2062 * @sa @ref window_userptr
1530 * @sa glfwGetWindowUserPointer 2063 * @sa glfwGetWindowUserPointer
1531 * 2064 *
2065 * @since Added in GLFW 3.0.
2066 *
1532 * @ingroup window 2067 * @ingroup window
1533 */ 2068 */
1534GLFWAPI void glfwSetWindowUserPointer(GLFWwindow* window, void* pointer); 2069GLFWAPI void glfwSetWindowUserPointer(GLFWwindow* window, void* pointer);
@@ -1540,8 +2075,14 @@ GLFWAPI void glfwSetWindowUserPointer(GLFWwindow* window, void* pointer);
1540 * 2075 *
1541 * @param[in] window The window whose pointer to return. 2076 * @param[in] window The window whose pointer to return.
1542 * 2077 *
2078 * @par Thread Safety
2079 * This function may be called from any thread. Access is not synchronized.
2080 *
2081 * @sa @ref window_userptr
1543 * @sa glfwSetWindowUserPointer 2082 * @sa glfwSetWindowUserPointer
1544 * 2083 *
2084 * @since Added in GLFW 3.0.
2085 *
1545 * @ingroup window 2086 * @ingroup window
1546 */ 2087 */
1547GLFWAPI void* glfwGetWindowUserPointer(GLFWwindow* window); 2088GLFWAPI void* glfwGetWindowUserPointer(GLFWwindow* window);
@@ -1555,8 +2096,15 @@ GLFWAPI void* glfwGetWindowUserPointer(GLFWwindow* window);
1555 * @param[in] window The window whose callback to set. 2096 * @param[in] window The window whose callback to set.
1556 * @param[in] cbfun The new callback, or `NULL` to remove the currently set 2097 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
1557 * callback. 2098 * callback.
1558 * @return The previously set callback, or `NULL` if no callback was set or an 2099 * @return The previously set callback, or `NULL` if no callback was set or the
1559 * error occurred. 2100 * library had not been [initialized](@ref intro_init).
2101 *
2102 * @par Thread Safety
2103 * This function may only be called from the main thread.
2104 *
2105 * @sa @ref window_pos
2106 *
2107 * @since Added in GLFW 3.0.
1560 * 2108 *
1561 * @ingroup window 2109 * @ingroup window
1562 */ 2110 */
@@ -1571,8 +2119,18 @@ GLFWAPI GLFWwindowposfun glfwSetWindowPosCallback(GLFWwindow* window, GLFWwindow
1571 * @param[in] window The window whose callback to set. 2119 * @param[in] window The window whose callback to set.
1572 * @param[in] cbfun The new callback, or `NULL` to remove the currently set 2120 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
1573 * callback. 2121 * callback.
1574 * @return The previously set callback, or `NULL` if no callback was set or an 2122 * @return The previously set callback, or `NULL` if no callback was set or the
1575 * error occurred. 2123 * library had not been [initialized](@ref intro_init).
2124 *
2125 * @par Thread Safety
2126 * This function may only be called from the main thread.
2127 *
2128 * @sa @ref window_size
2129 *
2130 * @since Added in GLFW 1.0.
2131 *
2132 * @par
2133 * __GLFW 3:__ Added window handle parameter. Updated callback signature.
1576 * 2134 *
1577 * @ingroup window 2135 * @ingroup window
1578 */ 2136 */
@@ -1592,15 +2150,22 @@ GLFWAPI GLFWwindowsizefun glfwSetWindowSizeCallback(GLFWwindow* window, GLFWwind
1592 * @param[in] window The window whose callback to set. 2150 * @param[in] window The window whose callback to set.
1593 * @param[in] cbfun The new callback, or `NULL` to remove the currently set 2151 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
1594 * callback. 2152 * callback.
1595 * @return The previously set callback, or `NULL` if no callback was set or an 2153 * @return The previously set callback, or `NULL` if no callback was set or the
1596 * error occurred. 2154 * library had not been [initialized](@ref intro_init).
1597 * 2155 *
1598 * @par New in GLFW 3 2156 * @remarks __OS X:__ Selecting Quit from the application menu will
1599 * The close callback no longer returns a value.
1600 *
1601 * @remarks **OS X:** Selecting Quit from the application menu will
1602 * trigger the close callback for all windows. 2157 * trigger the close callback for all windows.
1603 * 2158 *
2159 * @par Thread Safety
2160 * This function may only be called from the main thread.
2161 *
2162 * @sa @ref window_close
2163 *
2164 * @since Added in GLFW 2.5.
2165 *
2166 * @par
2167 * __GLFW 3:__ Added window handle parameter. Updated callback signature.
2168 *
1604 * @ingroup window 2169 * @ingroup window
1605 */ 2170 */
1606GLFWAPI GLFWwindowclosefun glfwSetWindowCloseCallback(GLFWwindow* window, GLFWwindowclosefun cbfun); 2171GLFWAPI GLFWwindowclosefun glfwSetWindowCloseCallback(GLFWwindow* window, GLFWwindowclosefun cbfun);
@@ -1618,12 +2183,18 @@ GLFWAPI GLFWwindowclosefun glfwSetWindowCloseCallback(GLFWwindow* window, GLFWwi
1618 * @param[in] window The window whose callback to set. 2183 * @param[in] window The window whose callback to set.
1619 * @param[in] cbfun The new callback, or `NULL` to remove the currently set 2184 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
1620 * callback. 2185 * callback.
1621 * @return The previously set callback, or `NULL` if no callback was set or an 2186 * @return The previously set callback, or `NULL` if no callback was set or the
1622 * error occurred. 2187 * library had not been [initialized](@ref intro_init).
1623 * 2188 *
1624 * @note On compositing window systems such as Aero, Compiz or Aqua, where the 2189 * @par Thread Safety
1625 * window contents are saved off-screen, this callback may be called only very 2190 * This function may only be called from the main thread.
1626 * infrequently or never at all. 2191 *
2192 * @sa @ref window_refresh
2193 *
2194 * @since Added in GLFW 2.5.
2195 *
2196 * @par
2197 * __GLFW 3:__ Added window handle parameter. Updated callback signature.
1627 * 2198 *
1628 * @ingroup window 2199 * @ingroup window
1629 */ 2200 */
@@ -1632,18 +2203,25 @@ GLFWAPI GLFWwindowrefreshfun glfwSetWindowRefreshCallback(GLFWwindow* window, GL
1632/*! @brief Sets the focus callback for the specified window. 2203/*! @brief Sets the focus callback for the specified window.
1633 * 2204 *
1634 * This function sets the focus callback of the specified window, which is 2205 * This function sets the focus callback of the specified window, which is
1635 * called when the window gains or loses focus. 2206 * called when the window gains or loses input focus.
1636 * 2207 *
1637 * After the focus callback is called for a window that lost focus, synthetic 2208 * After the focus callback is called for a window that lost input focus,
1638 * key and mouse button release events will be generated for all such that had 2209 * synthetic key and mouse button release events will be generated for all such
1639 * been pressed. For more information, see @ref glfwSetKeyCallback and @ref 2210 * that had been pressed. For more information, see @ref glfwSetKeyCallback
1640 * glfwSetMouseButtonCallback. 2211 * and @ref glfwSetMouseButtonCallback.
1641 * 2212 *
1642 * @param[in] window The window whose callback to set. 2213 * @param[in] window The window whose callback to set.
1643 * @param[in] cbfun The new callback, or `NULL` to remove the currently set 2214 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
1644 * callback. 2215 * callback.
1645 * @return The previously set callback, or `NULL` if no callback was set or an 2216 * @return The previously set callback, or `NULL` if no callback was set or the
1646 * error occurred. 2217 * library had not been [initialized](@ref intro_init).
2218 *
2219 * @par Thread Safety
2220 * This function may only be called from the main thread.
2221 *
2222 * @sa @ref window_focus
2223 *
2224 * @since Added in GLFW 3.0.
1647 * 2225 *
1648 * @ingroup window 2226 * @ingroup window
1649 */ 2227 */
@@ -1657,8 +2235,15 @@ GLFWAPI GLFWwindowfocusfun glfwSetWindowFocusCallback(GLFWwindow* window, GLFWwi
1657 * @param[in] window The window whose callback to set. 2235 * @param[in] window The window whose callback to set.
1658 * @param[in] cbfun The new callback, or `NULL` to remove the currently set 2236 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
1659 * callback. 2237 * callback.
1660 * @return The previously set callback, or `NULL` if no callback was set or an 2238 * @return The previously set callback, or `NULL` if no callback was set or the
1661 * error occurred. 2239 * library had not been [initialized](@ref intro_init).
2240 *
2241 * @par Thread Safety
2242 * This function may only be called from the main thread.
2243 *
2244 * @sa @ref window_iconify
2245 *
2246 * @since Added in GLFW 3.0.
1662 * 2247 *
1663 * @ingroup window 2248 * @ingroup window
1664 */ 2249 */
@@ -1672,8 +2257,15 @@ GLFWAPI GLFWwindowiconifyfun glfwSetWindowIconifyCallback(GLFWwindow* window, GL
1672 * @param[in] window The window whose callback to set. 2257 * @param[in] window The window whose callback to set.
1673 * @param[in] cbfun The new callback, or `NULL` to remove the currently set 2258 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
1674 * callback. 2259 * callback.
1675 * @return The previously set callback, or `NULL` if no callback was set or an 2260 * @return The previously set callback, or `NULL` if no callback was set or the
1676 * error occurred. 2261 * library had not been [initialized](@ref intro_init).
2262 *
2263 * @par Thread Safety
2264 * This function may only be called from the main thread.
2265 *
2266 * @sa @ref window_fbsize
2267 *
2268 * @since Added in GLFW 3.0.
1677 * 2269 *
1678 * @ingroup window 2270 * @ingroup window
1679 */ 2271 */
@@ -1681,114 +2273,164 @@ GLFWAPI GLFWframebuffersizefun glfwSetFramebufferSizeCallback(GLFWwindow* window
1681 2273
1682/*! @brief Processes all pending events. 2274/*! @brief Processes all pending events.
1683 * 2275 *
1684 * This function processes only those events that have already been received 2276 * This function processes only those events that are already in the event
1685 * and then returns immediately. Processing events will cause the window and 2277 * queue and then returns immediately. Processing events will cause the window
1686 * input callbacks associated with those events to be called. 2278 * and input callbacks associated with those events to be called.
1687 *
1688 * This function is not required for joystick input to work.
1689 * 2279 *
1690 * @par New in GLFW 3 2280 * On some platforms, a window move, resize or menu operation will cause event
1691 * This function is no longer called by @ref glfwSwapBuffers. You need to call 2281 * processing to block. This is due to how event processing is designed on
1692 * it or @ref glfwWaitEvents yourself. 2282 * those platforms. You can use the
2283 * [window refresh callback](@ref window_refresh) to redraw the contents of
2284 * your window when necessary during such operations.
1693 * 2285 *
1694 * @remarks On some platforms, a window move, resize or menu operation will 2286 * On some platforms, certain events are sent directly to the application
1695 * cause event processing to block. This is due to how event processing is 2287 * without going through the event queue, causing callbacks to be called
1696 * designed on those platforms. You can use the 2288 * outside of a call to one of the event processing functions.
1697 * [window refresh callback](@ref GLFWwindowrefreshfun) to redraw the contents
1698 * of your window when necessary during the operation.
1699 * 2289 *
1700 * @note This function may only be called from the main thread. 2290 * Event processing is not required for joystick input to work.
1701 * 2291 *
1702 * @note This function may not be called from a callback. 2292 * @par Reentrancy
2293 * This function may not be called from a callback.
1703 * 2294 *
1704 * @note On some platforms, certain callbacks may be called outside of a call 2295 * @par Thread Safety
1705 * to one of the event processing functions. 2296 * This function may only be called from the main thread.
1706 * 2297 *
2298 * @sa @ref events
1707 * @sa glfwWaitEvents 2299 * @sa glfwWaitEvents
1708 * 2300 *
2301 * @since Added in GLFW 1.0.
2302 *
1709 * @ingroup window 2303 * @ingroup window
1710 */ 2304 */
1711GLFWAPI void glfwPollEvents(void); 2305GLFWAPI void glfwPollEvents(void);
1712 2306
1713/*! @brief Waits until events are pending and processes them. 2307/*! @brief Waits until events are queued and processes them.
1714 * 2308 *
1715 * This function puts the calling thread to sleep until at least one event has 2309 * This function puts the calling thread to sleep until at least one event is
1716 * been received. Once one or more events have been received, it behaves as if 2310 * available in the event queue. Once one or more events are available,
1717 * @ref glfwPollEvents was called, i.e. the events are processed and the 2311 * it behaves exactly like @ref glfwPollEvents, i.e. the events in the queue
1718 * function then returns immediately. Processing events will cause the window 2312 * are processed and the function then returns immediately. Processing events
1719 * and input callbacks associated with those events to be called. 2313 * will cause the window and input callbacks associated with those events to be
2314 * called.
1720 * 2315 *
1721 * Since not all events are associated with callbacks, this function may return 2316 * Since not all events are associated with callbacks, this function may return
1722 * without a callback having been called even if you are monitoring all 2317 * without a callback having been called even if you are monitoring all
1723 * callbacks. 2318 * callbacks.
1724 * 2319 *
1725 * This function is not required for joystick input to work. 2320 * On some platforms, a window move, resize or menu operation will cause event
2321 * processing to block. This is due to how event processing is designed on
2322 * those platforms. You can use the
2323 * [window refresh callback](@ref window_refresh) to redraw the contents of
2324 * your window when necessary during such operations.
1726 * 2325 *
1727 * @remarks On some platforms, a window move, resize or menu operation will 2326 * On some platforms, certain callbacks may be called outside of a call to one
1728 * cause event processing to block. This is due to how event processing is 2327 * of the event processing functions.
1729 * designed on those platforms. You can use the
1730 * [window refresh callback](@ref GLFWwindowrefreshfun) to redraw the contents
1731 * of your window when necessary during the operation.
1732 * 2328 *
1733 * @note This function may only be called from the main thread. 2329 * If no windows exist, this function returns immediately. For synchronization
2330 * of threads in applications that do not create windows, use your threading
2331 * library of choice.
1734 * 2332 *
1735 * @note This function may not be called from a callback. 2333 * Event processing is not required for joystick input to work.
1736 * 2334 *
1737 * @note On some platforms, certain callbacks may be called outside of a call 2335 * @par Reentrancy
1738 * to one of the event processing functions. 2336 * This function may not be called from a callback.
1739 * 2337 *
2338 * @par Thread Safety
2339 * This function may only be called from the main thread.
2340 *
2341 * @sa @ref events
1740 * @sa glfwPollEvents 2342 * @sa glfwPollEvents
1741 * 2343 *
2344 * @since Added in GLFW 2.5.
2345 *
1742 * @ingroup window 2346 * @ingroup window
1743 */ 2347 */
1744GLFWAPI void glfwWaitEvents(void); 2348GLFWAPI void glfwWaitEvents(void);
1745 2349
2350/*! @brief Posts an empty event to the event queue.
2351 *
2352 * This function posts an empty event from the current thread to the event
2353 * queue, causing @ref glfwWaitEvents to return.
2354 *
2355 * If no windows exist, this function returns immediately. For synchronization
2356 * of threads in applications that do not create windows, use your threading
2357 * library of choice.
2358 *
2359 * @par Thread Safety
2360 * This function may be called from any thread.
2361 *
2362 * @sa @ref events
2363 * @sa glfwWaitEvents
2364 *
2365 * @since Added in GLFW 3.1.
2366 *
2367 * @ingroup window
2368 */
2369GLFWAPI void glfwPostEmptyEvent(void);
2370
1746/*! @brief Returns the value of an input option for the specified window. 2371/*! @brief Returns the value of an input option for the specified window.
1747 * 2372 *
2373 * This function returns the value of an input option for the specified window.
2374 * The mode must be one of `GLFW_CURSOR`, `GLFW_STICKY_KEYS` or
2375 * `GLFW_STICKY_MOUSE_BUTTONS`.
2376 *
1748 * @param[in] window The window to query. 2377 * @param[in] window The window to query.
1749 * @param[in] mode One of `GLFW_CURSOR`, `GLFW_STICKY_KEYS` or 2378 * @param[in] mode One of `GLFW_CURSOR`, `GLFW_STICKY_KEYS` or
1750 * `GLFW_STICKY_MOUSE_BUTTONS`. 2379 * `GLFW_STICKY_MOUSE_BUTTONS`.
1751 * 2380 *
2381 * @par Thread Safety
2382 * This function may only be called from the main thread.
2383 *
1752 * @sa glfwSetInputMode 2384 * @sa glfwSetInputMode
1753 * 2385 *
2386 * @since Added in GLFW 3.0.
2387 *
1754 * @ingroup input 2388 * @ingroup input
1755 */ 2389 */
1756GLFWAPI int glfwGetInputMode(GLFWwindow* window, int mode); 2390GLFWAPI int glfwGetInputMode(GLFWwindow* window, int mode);
1757 2391
1758/*! @brief Sets an input option for the specified window. 2392/*! @brief Sets an input option for the specified window.
1759 * @param[in] window The window whose input mode to set. 2393 *
1760 * @param[in] mode One of `GLFW_CURSOR`, `GLFW_STICKY_KEYS` or 2394 * This function sets an input mode option for the specified window. The mode
2395 * must be one of `GLFW_CURSOR`, `GLFW_STICKY_KEYS` or
1761 * `GLFW_STICKY_MOUSE_BUTTONS`. 2396 * `GLFW_STICKY_MOUSE_BUTTONS`.
1762 * @param[in] value The new value of the specified input mode.
1763 * 2397 *
1764 * If `mode` is `GLFW_CURSOR`, the value must be one of the supported input 2398 * If the mode is `GLFW_CURSOR`, the value must be one of the following cursor
1765 * modes: 2399 * modes:
1766 * - `GLFW_CURSOR_NORMAL` makes the cursor visible and behaving normally. 2400 * - `GLFW_CURSOR_NORMAL` makes the cursor visible and behaving normally.
1767 * - `GLFW_CURSOR_HIDDEN` makes the cursor invisible when it is over the client 2401 * - `GLFW_CURSOR_HIDDEN` makes the cursor invisible when it is over the client
1768 * area of the window but does not restrict the cursor from leaving. This is 2402 * area of the window but does not restrict the cursor from leaving.
1769 * useful if you wish to render your own cursor or have no visible cursor at
1770 * all.
1771 * - `GLFW_CURSOR_DISABLED` hides and grabs the cursor, providing virtual 2403 * - `GLFW_CURSOR_DISABLED` hides and grabs the cursor, providing virtual
1772 * and unlimited cursor movement. This is useful for implementing for 2404 * and unlimited cursor movement. This is useful for implementing for
1773 * example 3D camera controls. 2405 * example 3D camera controls.
1774 * 2406 *
1775 * If `mode` is `GLFW_STICKY_KEYS`, the value must be either `GL_TRUE` to 2407 * If the mode is `GLFW_STICKY_KEYS`, the value must be either `GL_TRUE` to
1776 * enable sticky keys, or `GL_FALSE` to disable it. If sticky keys are 2408 * enable sticky keys, or `GL_FALSE` to disable it. If sticky keys are
1777 * enabled, a key press will ensure that @ref glfwGetKey returns @ref 2409 * enabled, a key press will ensure that @ref glfwGetKey returns `GLFW_PRESS`
1778 * GLFW_PRESS the next time it is called even if the key had been released 2410 * the next time it is called even if the key had been released before the
1779 * before the call. This is useful when you are only interested in whether 2411 * call. This is useful when you are only interested in whether keys have been
1780 * keys have been pressed but not when or in which order. 2412 * pressed but not when or in which order.
1781 * 2413 *
1782 * If `mode` is `GLFW_STICKY_MOUSE_BUTTONS`, the value must be either `GL_TRUE` 2414 * If the mode is `GLFW_STICKY_MOUSE_BUTTONS`, the value must be either
1783 * to enable sticky mouse buttons, or `GL_FALSE` to disable it. If sticky 2415 * `GL_TRUE` to enable sticky mouse buttons, or `GL_FALSE` to disable it. If
1784 * mouse buttons are enabled, a mouse button press will ensure that @ref 2416 * sticky mouse buttons are enabled, a mouse button press will ensure that @ref
1785 * glfwGetMouseButton returns @ref GLFW_PRESS the next time it is called even 2417 * glfwGetMouseButton returns `GLFW_PRESS` the next time it is called even if
1786 * if the mouse button had been released before the call. This is useful when 2418 * the mouse button had been released before the call. This is useful when you
1787 * you are only interested in whether mouse buttons have been pressed but not 2419 * are only interested in whether mouse buttons have been pressed but not when
1788 * when or in which order. 2420 * or in which order.
2421 *
2422 * @param[in] window The window whose input mode to set.
2423 * @param[in] mode One of `GLFW_CURSOR`, `GLFW_STICKY_KEYS` or
2424 * `GLFW_STICKY_MOUSE_BUTTONS`.
2425 * @param[in] value The new value of the specified input mode.
2426 *
2427 * @par Thread Safety
2428 * This function may only be called from the main thread.
1789 * 2429 *
1790 * @sa glfwGetInputMode 2430 * @sa glfwGetInputMode
1791 * 2431 *
2432 * @since Added in GLFW 3.0. Replaces `glfwEnable` and `glfwDisable`.
2433 *
1792 * @ingroup input 2434 * @ingroup input
1793 */ 2435 */
1794GLFWAPI void glfwSetInputMode(GLFWwindow* window, int mode, int value); 2436GLFWAPI void glfwSetInputMode(GLFWwindow* window, int mode, int value);
@@ -1798,22 +2440,34 @@ GLFWAPI void glfwSetInputMode(GLFWwindow* window, int mode, int value);
1798 * 2440 *
1799 * This function returns the last state reported for the specified key to the 2441 * This function returns the last state reported for the specified key to the
1800 * specified window. The returned state is one of `GLFW_PRESS` or 2442 * specified window. The returned state is one of `GLFW_PRESS` or
1801 * `GLFW_RELEASE`. The higher-level state `GLFW_REPEAT` is only reported to 2443 * `GLFW_RELEASE`. The higher-level action `GLFW_REPEAT` is only reported to
1802 * the key callback. 2444 * the key callback.
1803 * 2445 *
1804 * If the `GLFW_STICKY_KEYS` input mode is enabled, this function returns 2446 * If the `GLFW_STICKY_KEYS` input mode is enabled, this function returns
1805 * `GLFW_PRESS` the first time you call this function after a key has been 2447 * `GLFW_PRESS` the first time you call it for a key that was pressed, even if
1806 * pressed, even if the key has already been released. 2448 * that key has already been released.
1807 * 2449 *
1808 * The key functions deal with physical keys, with [key tokens](@ref keys) 2450 * The key functions deal with physical keys, with [key tokens](@ref keys)
1809 * named after their use on the standard US keyboard layout. If you want to 2451 * named after their use on the standard US keyboard layout. If you want to
1810 * input text, use the Unicode character callback instead. 2452 * input text, use the Unicode character callback instead.
1811 * 2453 *
2454 * The [modifier key bit masks](@ref mods) are not key tokens and cannot be
2455 * used with this function.
2456 *
1812 * @param[in] window The desired window. 2457 * @param[in] window The desired window.
1813 * @param[in] key The desired [keyboard key](@ref keys). 2458 * @param[in] key The desired [keyboard key](@ref keys). `GLFW_KEY_UNKNOWN` is
2459 * not a valid key for this function.
1814 * @return One of `GLFW_PRESS` or `GLFW_RELEASE`. 2460 * @return One of `GLFW_PRESS` or `GLFW_RELEASE`.
1815 * 2461 *
1816 * @note `GLFW_KEY_UNKNOWN` is not a valid key for this function. 2462 * @par Thread Safety
2463 * This function may only be called from the main thread.
2464 *
2465 * @sa @ref input_key
2466 *
2467 * @since Added in GLFW 1.0.
2468 *
2469 * @par
2470 * __GLFW 3:__ Added window handle parameter.
1817 * 2471 *
1818 * @ingroup input 2472 * @ingroup input
1819 */ 2473 */
@@ -1823,26 +2477,37 @@ GLFWAPI int glfwGetKey(GLFWwindow* window, int key);
1823 * window. 2477 * window.
1824 * 2478 *
1825 * This function returns the last state reported for the specified mouse button 2479 * This function returns the last state reported for the specified mouse button
1826 * to the specified window. 2480 * to the specified window. The returned state is one of `GLFW_PRESS` or
2481 * `GLFW_RELEASE`.
1827 * 2482 *
1828 * If the `GLFW_STICKY_MOUSE_BUTTONS` input mode is enabled, this function 2483 * If the `GLFW_STICKY_MOUSE_BUTTONS` input mode is enabled, this function
1829 * returns `GLFW_PRESS` the first time you call this function after a mouse 2484 * `GLFW_PRESS` the first time you call it for a mouse button that was pressed,
1830 * button has been pressed, even if the mouse button has already been released. 2485 * even if that mouse button has already been released.
1831 * 2486 *
1832 * @param[in] window The desired window. 2487 * @param[in] window The desired window.
1833 * @param[in] button The desired [mouse button](@ref buttons). 2488 * @param[in] button The desired [mouse button](@ref buttons).
1834 * @return One of `GLFW_PRESS` or `GLFW_RELEASE`. 2489 * @return One of `GLFW_PRESS` or `GLFW_RELEASE`.
1835 * 2490 *
2491 * @par Thread Safety
2492 * This function may only be called from the main thread.
2493 *
2494 * @sa @ref input_mouse_button
2495 *
2496 * @since Added in GLFW 1.0.
2497 *
2498 * @par
2499 * __GLFW 3:__ Added window handle parameter.
2500 *
1836 * @ingroup input 2501 * @ingroup input
1837 */ 2502 */
1838GLFWAPI int glfwGetMouseButton(GLFWwindow* window, int button); 2503GLFWAPI int glfwGetMouseButton(GLFWwindow* window, int button);
1839 2504
1840/*! @brief Retrieves the last reported cursor position, relative to the client 2505/*! @brief Retrieves the position of the cursor relative to the client area of
1841 * area of the window. 2506 * the window.
1842 * 2507 *
1843 * This function returns the last reported position of the cursor, in screen 2508 * This function returns the position of the cursor, in screen coordinates,
1844 * coordinates, relative to the upper-left corner of the client area of the 2509 * relative to the upper-left corner of the client area of the specified
1845 * specified window. 2510 * window.
1846 * 2511 *
1847 * If the cursor is disabled (with `GLFW_CURSOR_DISABLED`) then the cursor 2512 * If the cursor is disabled (with `GLFW_CURSOR_DISABLED`) then the cursor
1848 * position is unbounded and limited only by the minimum and maximum values of 2513 * position is unbounded and limited only by the minimum and maximum values of
@@ -1852,14 +2517,23 @@ GLFWAPI int glfwGetMouseButton(GLFWwindow* window, int button);
1852 * `floor` function. Casting directly to an integer type works for positive 2517 * `floor` function. Casting directly to an integer type works for positive
1853 * coordinates, but fails for negative ones. 2518 * coordinates, but fails for negative ones.
1854 * 2519 *
2520 * Any or all of the position arguments may be `NULL`. If an error occurs, all
2521 * non-`NULL` position arguments will be set to zero.
2522 *
1855 * @param[in] window The desired window. 2523 * @param[in] window The desired window.
1856 * @param[out] xpos Where to store the cursor x-coordinate, relative to the 2524 * @param[out] xpos Where to store the cursor x-coordinate, relative to the
1857 * left edge of the client area, or `NULL`. 2525 * left edge of the client area, or `NULL`.
1858 * @param[out] ypos Where to store the cursor y-coordinate, relative to the to 2526 * @param[out] ypos Where to store the cursor y-coordinate, relative to the to
1859 * top edge of the client area, or `NULL`. 2527 * top edge of the client area, or `NULL`.
1860 * 2528 *
2529 * @par Thread Safety
2530 * This function may only be called from the main thread.
2531 *
2532 * @sa @ref cursor_pos
1861 * @sa glfwSetCursorPos 2533 * @sa glfwSetCursorPos
1862 * 2534 *
2535 * @since Added in GLFW 3.0. Replaces `glfwGetMousePos`.
2536 *
1863 * @ingroup input 2537 * @ingroup input
1864 */ 2538 */
1865GLFWAPI void glfwGetCursorPos(GLFWwindow* window, double* xpos, double* ypos); 2539GLFWAPI void glfwGetCursorPos(GLFWwindow* window, double* xpos, double* ypos);
@@ -1869,11 +2543,16 @@ GLFWAPI void glfwGetCursorPos(GLFWwindow* window, double* xpos, double* ypos);
1869 * 2543 *
1870 * This function sets the position, in screen coordinates, of the cursor 2544 * This function sets the position, in screen coordinates, of the cursor
1871 * relative to the upper-left corner of the client area of the specified 2545 * relative to the upper-left corner of the client area of the specified
1872 * window. The window must be focused. If the window does not have focus when 2546 * window. The window must have input focus. If the window does not have
1873 * this function is called, it fails silently. 2547 * input focus when this function is called, it fails silently.
1874 * 2548 *
1875 * If the cursor is disabled (with `GLFW_CURSOR_DISABLED`) then the cursor 2549 * __Do not use this function__ to implement things like camera controls. GLFW
1876 * position is unbounded and limited only by the minimum and maximum values of 2550 * already provides the `GLFW_CURSOR_DISABLED` cursor mode that hides the
2551 * cursor, transparently re-centers it and provides unconstrained cursor
2552 * motion. See @ref glfwSetInputMode for more information.
2553 *
2554 * If the cursor mode is `GLFW_CURSOR_DISABLED` then the cursor position is
2555 * unconstrained and limited only by the minimum and maximum values of
1877 * a `double`. 2556 * a `double`.
1878 * 2557 *
1879 * @param[in] window The desired window. 2558 * @param[in] window The desired window.
@@ -1882,15 +2561,138 @@ GLFWAPI void glfwGetCursorPos(GLFWwindow* window, double* xpos, double* ypos);
1882 * @param[in] ypos The desired y-coordinate, relative to the top edge of the 2561 * @param[in] ypos The desired y-coordinate, relative to the top edge of the
1883 * client area. 2562 * client area.
1884 * 2563 *
2564 * @remarks __X11:__ Due to the asynchronous nature of a modern X desktop, it
2565 * may take a moment for the window focus event to arrive. This means you will
2566 * not be able to set the cursor position directly after window creation.
2567 *
2568 * @par Thread Safety
2569 * This function may only be called from the main thread.
2570 *
2571 * @sa @ref cursor_pos
1885 * @sa glfwGetCursorPos 2572 * @sa glfwGetCursorPos
1886 * 2573 *
2574 * @since Added in GLFW 3.0. Replaces `glfwSetMousePos`.
2575 *
1887 * @ingroup input 2576 * @ingroup input
1888 */ 2577 */
1889GLFWAPI void glfwSetCursorPos(GLFWwindow* window, double xpos, double ypos); 2578GLFWAPI void glfwSetCursorPos(GLFWwindow* window, double xpos, double ypos);
1890 2579
2580/*! @brief Creates a custom cursor.
2581 *
2582 * Creates a new custom cursor image that can be set for a window with @ref
2583 * glfwSetCursor. The cursor can be destroyed with @ref glfwDestroyCursor.
2584 * Any remaining cursors are destroyed by @ref glfwTerminate.
2585 *
2586 * The pixels are 32-bit little-endian RGBA, i.e. eight bits per channel. They
2587 * are arranged canonically as packed sequential rows, starting from the
2588 * top-left corner.
2589 *
2590 * The cursor hotspot is specified in pixels, relative to the upper-left corner
2591 * of the cursor image. Like all other coordinate systems in GLFW, the X-axis
2592 * points to the right and the Y-axis points down.
2593 *
2594 * @param[in] image The desired cursor image.
2595 * @param[in] xhot The desired x-coordinate, in pixels, of the cursor hotspot.
2596 * @param[in] yhot The desired y-coordinate, in pixels, of the cursor hotspot.
2597 *
2598 * @return The handle of the created cursor, or `NULL` if an
2599 * [error](@ref error_handling) occurred.
2600 *
2601 * @par Pointer Lifetime
2602 * The specified image data is copied before this function returns.
2603 *
2604 * @par Reentrancy
2605 * This function may not be called from a callback.
2606 *
2607 * @par Thread Safety
2608 * This function may only be called from the main thread.
2609 *
2610 * @sa @ref cursor_object
2611 * @sa glfwDestroyCursor
2612 * @sa glfwCreateStandardCursor
2613 *
2614 * @since Added in GLFW 3.1.
2615 *
2616 * @ingroup input
2617 */
2618GLFWAPI GLFWcursor* glfwCreateCursor(const GLFWimage* image, int xhot, int yhot);
2619
2620/*! @brief Creates a cursor with a standard shape.
2621 *
2622 * Returns a cursor with a [standard shape](@ref shapes), that can be set for
2623 * a window with @ref glfwSetCursor.
2624 *
2625 * @param[in] shape One of the [standard shapes](@ref shapes).
2626 *
2627 * @return A new cursor ready to use or `NULL` if an
2628 * [error](@ref error_handling) occurred.
2629 *
2630 * @par Reentrancy
2631 * This function may not be called from a callback.
2632 *
2633 * @par Thread Safety
2634 * This function may only be called from the main thread.
2635 *
2636 * @sa @ref cursor_object
2637 * @sa glfwCreateCursor
2638 *
2639 * @since Added in GLFW 3.1.
2640 *
2641 * @ingroup input
2642 */
2643GLFWAPI GLFWcursor* glfwCreateStandardCursor(int shape);
2644
2645/*! @brief Destroys a cursor.
2646 *
2647 * This function destroys a cursor previously created with @ref
2648 * glfwCreateCursor. Any remaining cursors will be destroyed by @ref
2649 * glfwTerminate.
2650 *
2651 * @param[in] cursor The cursor object to destroy.
2652 *
2653 * @par Reentrancy
2654 * This function may not be called from a callback.
2655 *
2656 * @par Thread Safety
2657 * This function may only be called from the main thread.
2658 *
2659 * @sa @ref cursor_object
2660 * @sa glfwCreateCursor
2661 *
2662 * @since Added in GLFW 3.1.
2663 *
2664 * @ingroup input
2665 */
2666GLFWAPI void glfwDestroyCursor(GLFWcursor* cursor);
2667
2668/*! @brief Sets the cursor for the window.
2669 *
2670 * This function sets the cursor image to be used when the cursor is over the
2671 * client area of the specified window. The set cursor will only be visible
2672 * when the [cursor mode](@ref cursor_mode) of the window is
2673 * `GLFW_CURSOR_NORMAL`.
2674 *
2675 * On some platforms, the set cursor may not be visible unless the window also
2676 * has input focus.
2677 *
2678 * @param[in] window The window to set the cursor for.
2679 * @param[in] cursor The cursor to set, or `NULL` to switch back to the default
2680 * arrow cursor.
2681 *
2682 * @par Thread Safety
2683 * This function may only be called from the main thread.
2684 *
2685 * @sa @ref cursor_object
2686 *
2687 * @since Added in GLFW 3.1.
2688 *
2689 * @ingroup input
2690 */
2691GLFWAPI void glfwSetCursor(GLFWwindow* window, GLFWcursor* cursor);
2692
1891/*! @brief Sets the key callback. 2693/*! @brief Sets the key callback.
1892 * 2694 *
1893 * This function sets the key callback of the specific window, which is called 2695 * This function sets the key callback of the specified window, which is called
1894 * when a key is pressed, repeated or released. 2696 * when a key is pressed, repeated or released.
1895 * 2697 *
1896 * The key functions deal with physical keys, with layout independent 2698 * The key functions deal with physical keys, with layout independent
@@ -1898,16 +2700,16 @@ GLFWAPI void glfwSetCursorPos(GLFWwindow* window, double xpos, double ypos);
1898 * layout. If you want to input text, use the 2700 * layout. If you want to input text, use the
1899 * [character callback](@ref glfwSetCharCallback) instead. 2701 * [character callback](@ref glfwSetCharCallback) instead.
1900 * 2702 *
1901 * When a window loses focus, it will generate synthetic key release events 2703 * When a window loses input focus, it will generate synthetic key release
1902 * for all pressed keys. You can tell these events from user-generated events 2704 * events for all pressed keys. You can tell these events from user-generated
1903 * by the fact that the synthetic ones are generated after the window has lost 2705 * events by the fact that the synthetic ones are generated after the focus
1904 * focus, i.e. `GLFW_FOCUSED` will be false and the focus callback will have 2706 * loss event has been processed, i.e. after the
1905 * already been called. 2707 * [window focus callback](@ref glfwSetWindowFocusCallback) has been called.
1906 * 2708 *
1907 * The scancode of a key is specific to that platform or sometimes even to that 2709 * The scancode of a key is specific to that platform or sometimes even to that
1908 * machine. Scancodes are intended to allow users to bind keys that don't have 2710 * machine. Scancodes are intended to allow users to bind keys that don't have
1909 * a GLFW key token. Such keys have `key` set to `GLFW_KEY_UNKNOWN`, their 2711 * a GLFW key token. Such keys have `key` set to `GLFW_KEY_UNKNOWN`, their
1910 * state is not saved and so it cannot be retrieved with @ref glfwGetKey. 2712 * state is not saved and so it cannot be queried with @ref glfwGetKey.
1911 * 2713 *
1912 * Sometimes GLFW needs to generate synthetic key events, in which case the 2714 * Sometimes GLFW needs to generate synthetic key events, in which case the
1913 * scancode may be zero. 2715 * scancode may be zero.
@@ -1915,8 +2717,18 @@ GLFWAPI void glfwSetCursorPos(GLFWwindow* window, double xpos, double ypos);
1915 * @param[in] window The window whose callback to set. 2717 * @param[in] window The window whose callback to set.
1916 * @param[in] cbfun The new key callback, or `NULL` to remove the currently 2718 * @param[in] cbfun The new key callback, or `NULL` to remove the currently
1917 * set callback. 2719 * set callback.
1918 * @return The previously set callback, or `NULL` if no callback was set or an 2720 * @return The previously set callback, or `NULL` if no callback was set or the
1919 * error occurred. 2721 * library had not been [initialized](@ref intro_init).
2722 *
2723 * @par Thread Safety
2724 * This function may only be called from the main thread.
2725 *
2726 * @sa @ref input_key
2727 *
2728 * @since Added in GLFW 1.0.
2729 *
2730 * @par
2731 * __GLFW 3:__ Added window handle parameter. Updated callback signature.
1920 * 2732 *
1921 * @ingroup input 2733 * @ingroup input
1922 */ 2734 */
@@ -1924,11 +2736,56 @@ GLFWAPI GLFWkeyfun glfwSetKeyCallback(GLFWwindow* window, GLFWkeyfun cbfun);
1924 2736
1925/*! @brief Sets the Unicode character callback. 2737/*! @brief Sets the Unicode character callback.
1926 * 2738 *
1927 * This function sets the character callback of the specific window, which is 2739 * This function sets the character callback of the specified window, which is
1928 * called when a Unicode character is input. 2740 * called when a Unicode character is input.
1929 * 2741 *
1930 * The character callback is intended for text input. If you want to know 2742 * The character callback is intended for Unicode text input. As it deals with
1931 * whether a specific key was pressed or released, use the 2743 * characters, it is keyboard layout dependent, whereas the
2744 * [key callback](@ref glfwSetKeyCallback) is not. Characters do not map 1:1
2745 * to physical keys, as a key may produce zero, one or more characters. If you
2746 * want to know whether a specific physical key was pressed or released, see
2747 * the key callback instead.
2748 *
2749 * The character callback behaves as system text input normally does and will
2750 * not be called if modifier keys are held down that would prevent normal text
2751 * input on that platform, for example a Super (Command) key on OS X or Alt key
2752 * on Windows. There is a
2753 * [character with modifiers callback](@ref glfwSetCharModsCallback) that
2754 * receives these events.
2755 *
2756 * @param[in] window The window whose callback to set.
2757 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
2758 * callback.
2759 * @return The previously set callback, or `NULL` if no callback was set or the
2760 * library had not been [initialized](@ref intro_init).
2761 *
2762 * @par Thread Safety
2763 * This function may only be called from the main thread.
2764 *
2765 * @sa @ref input_char
2766 *
2767 * @since Added in GLFW 2.4.
2768 *
2769 * @par
2770 * __GLFW 3:__ Added window handle parameter. Updated callback signature.
2771 *
2772 * @ingroup input
2773 */
2774GLFWAPI GLFWcharfun glfwSetCharCallback(GLFWwindow* window, GLFWcharfun cbfun);
2775
2776/*! @brief Sets the Unicode character with modifiers callback.
2777 *
2778 * This function sets the character with modifiers callback of the specified
2779 * window, which is called when a Unicode character is input regardless of what
2780 * modifier keys are used.
2781 *
2782 * The character with modifiers callback is intended for implementing custom
2783 * Unicode character input. For regular Unicode text input, see the
2784 * [character callback](@ref glfwSetCharCallback). Like the character
2785 * callback, the character with modifiers callback deals with characters and is
2786 * keyboard layout dependent. Characters do not map 1:1 to physical keys, as
2787 * a key may produce zero, one or more characters. If you want to know whether
2788 * a specific physical key was pressed or released, see the
1932 * [key callback](@ref glfwSetKeyCallback) instead. 2789 * [key callback](@ref glfwSetKeyCallback) instead.
1933 * 2790 *
1934 * @param[in] window The window whose callback to set. 2791 * @param[in] window The window whose callback to set.
@@ -1937,26 +2794,43 @@ GLFWAPI GLFWkeyfun glfwSetKeyCallback(GLFWwindow* window, GLFWkeyfun cbfun);
1937 * @return The previously set callback, or `NULL` if no callback was set or an 2794 * @return The previously set callback, or `NULL` if no callback was set or an
1938 * error occurred. 2795 * error occurred.
1939 * 2796 *
2797 * @par Thread Safety
2798 * This function may only be called from the main thread.
2799 *
2800 * @sa @ref input_char
2801 *
2802 * @since Added in GLFW 3.1.
2803 *
1940 * @ingroup input 2804 * @ingroup input
1941 */ 2805 */
1942GLFWAPI GLFWcharfun glfwSetCharCallback(GLFWwindow* window, GLFWcharfun cbfun); 2806GLFWAPI GLFWcharmodsfun glfwSetCharModsCallback(GLFWwindow* window, GLFWcharmodsfun cbfun);
1943 2807
1944/*! @brief Sets the mouse button callback. 2808/*! @brief Sets the mouse button callback.
1945 * 2809 *
1946 * This function sets the mouse button callback of the specified window, which 2810 * This function sets the mouse button callback of the specified window, which
1947 * is called when a mouse button is pressed or released. 2811 * is called when a mouse button is pressed or released.
1948 * 2812 *
1949 * When a window loses focus, it will generate synthetic mouse button release 2813 * When a window loses input focus, it will generate synthetic mouse button
1950 * events for all pressed mouse buttons. You can tell these events from 2814 * release events for all pressed mouse buttons. You can tell these events
1951 * user-generated events by the fact that the synthetic ones are generated 2815 * from user-generated events by the fact that the synthetic ones are generated
1952 * after the window has lost focus, i.e. `GLFW_FOCUSED` will be false and the 2816 * after the focus loss event has been processed, i.e. after the
1953 * focus callback will have already been called. 2817 * [window focus callback](@ref glfwSetWindowFocusCallback) has been called.
1954 * 2818 *
1955 * @param[in] window The window whose callback to set. 2819 * @param[in] window The window whose callback to set.
1956 * @param[in] cbfun The new callback, or `NULL` to remove the currently set 2820 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
1957 * callback. 2821 * callback.
1958 * @return The previously set callback, or `NULL` if no callback was set or an 2822 * @return The previously set callback, or `NULL` if no callback was set or the
1959 * error occurred. 2823 * library had not been [initialized](@ref intro_init).
2824 *
2825 * @par Thread Safety
2826 * This function may only be called from the main thread.
2827 *
2828 * @sa @ref input_mouse_button
2829 *
2830 * @since Added in GLFW 1.0.
2831 *
2832 * @par
2833 * __GLFW 3:__ Added window handle parameter. Updated callback signature.
1960 * 2834 *
1961 * @ingroup input 2835 * @ingroup input
1962 */ 2836 */
@@ -1972,8 +2846,15 @@ GLFWAPI GLFWmousebuttonfun glfwSetMouseButtonCallback(GLFWwindow* window, GLFWmo
1972 * @param[in] window The window whose callback to set. 2846 * @param[in] window The window whose callback to set.
1973 * @param[in] cbfun The new callback, or `NULL` to remove the currently set 2847 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
1974 * callback. 2848 * callback.
1975 * @return The previously set callback, or `NULL` if no callback was set or an 2849 * @return The previously set callback, or `NULL` if no callback was set or the
1976 * error occurred. 2850 * library had not been [initialized](@ref intro_init).
2851 *
2852 * @par Thread Safety
2853 * This function may only be called from the main thread.
2854 *
2855 * @sa @ref cursor_pos
2856 *
2857 * @since Added in GLFW 3.0. Replaces `glfwSetMousePosCallback`.
1977 * 2858 *
1978 * @ingroup input 2859 * @ingroup input
1979 */ 2860 */
@@ -1988,8 +2869,15 @@ GLFWAPI GLFWcursorposfun glfwSetCursorPosCallback(GLFWwindow* window, GLFWcursor
1988 * @param[in] window The window whose callback to set. 2869 * @param[in] window The window whose callback to set.
1989 * @param[in] cbfun The new callback, or `NULL` to remove the currently set 2870 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
1990 * callback. 2871 * callback.
1991 * @return The previously set callback, or `NULL` if no callback was set or an 2872 * @return The previously set callback, or `NULL` if no callback was set or the
1992 * error occurred. 2873 * library had not been [initialized](@ref intro_init).
2874 *
2875 * @par Thread Safety
2876 * This function may only be called from the main thread.
2877 *
2878 * @sa @ref cursor_enter
2879 *
2880 * @since Added in GLFW 3.0.
1993 * 2881 *
1994 * @ingroup input 2882 * @ingroup input
1995 */ 2883 */
@@ -2007,20 +2895,61 @@ GLFWAPI GLFWcursorenterfun glfwSetCursorEnterCallback(GLFWwindow* window, GLFWcu
2007 * @param[in] window The window whose callback to set. 2895 * @param[in] window The window whose callback to set.
2008 * @param[in] cbfun The new scroll callback, or `NULL` to remove the currently 2896 * @param[in] cbfun The new scroll callback, or `NULL` to remove the currently
2009 * set callback. 2897 * set callback.
2010 * @return The previously set callback, or `NULL` if no callback was set or an 2898 * @return The previously set callback, or `NULL` if no callback was set or the
2011 * error occurred. 2899 * library had not been [initialized](@ref intro_init).
2900 *
2901 * @par Thread Safety
2902 * This function may only be called from the main thread.
2903 *
2904 * @sa @ref scrolling
2905 *
2906 * @since Added in GLFW 3.0. Replaces `glfwSetMouseWheelCallback`.
2012 * 2907 *
2013 * @ingroup input 2908 * @ingroup input
2014 */ 2909 */
2015GLFWAPI GLFWscrollfun glfwSetScrollCallback(GLFWwindow* window, GLFWscrollfun cbfun); 2910GLFWAPI GLFWscrollfun glfwSetScrollCallback(GLFWwindow* window, GLFWscrollfun cbfun);
2016 2911
2912/*! @brief Sets the file drop callback.
2913 *
2914 * This function sets the file drop callback of the specified window, which is
2915 * called when one or more dragged files are dropped on the window.
2916 *
2917 * Because the path array and its strings may have been generated specifically
2918 * for that event, they are not guaranteed to be valid after the callback has
2919 * returned. If you wish to use them after the callback returns, you need to
2920 * make a deep copy.
2921 *
2922 * @param[in] window The window whose callback to set.
2923 * @param[in] cbfun The new file drop callback, or `NULL` to remove the
2924 * currently set callback.
2925 * @return The previously set callback, or `NULL` if no callback was set or the
2926 * library had not been [initialized](@ref intro_init).
2927 *
2928 * @par Thread Safety
2929 * This function may only be called from the main thread.
2930 *
2931 * @sa @ref path_drop
2932 *
2933 * @since Added in GLFW 3.1.
2934 *
2935 * @ingroup input
2936 */
2937GLFWAPI GLFWdropfun glfwSetDropCallback(GLFWwindow* window, GLFWdropfun cbfun);
2938
2017/*! @brief Returns whether the specified joystick is present. 2939/*! @brief Returns whether the specified joystick is present.
2018 * 2940 *
2019 * This function returns whether the specified joystick is present. 2941 * This function returns whether the specified joystick is present.
2020 * 2942 *
2021 * @param[in] joy The joystick to query. 2943 * @param[in] joy The [joystick](@ref joysticks) to query.
2022 * @return `GL_TRUE` if the joystick is present, or `GL_FALSE` otherwise. 2944 * @return `GL_TRUE` if the joystick is present, or `GL_FALSE` otherwise.
2023 * 2945 *
2946 * @par Thread Safety
2947 * This function may only be called from the main thread.
2948 *
2949 * @sa @ref joystick
2950 *
2951 * @since Added in GLFW 3.0. Replaces `glfwGetJoystickParam`.
2952 *
2024 * @ingroup input 2953 * @ingroup input
2025 */ 2954 */
2026GLFWAPI int glfwJoystickPresent(int joy); 2955GLFWAPI int glfwJoystickPresent(int joy);
@@ -2028,17 +2957,24 @@ GLFWAPI int glfwJoystickPresent(int joy);
2028/*! @brief Returns the values of all axes of the specified joystick. 2957/*! @brief Returns the values of all axes of the specified joystick.
2029 * 2958 *
2030 * This function returns the values of all axes of the specified joystick. 2959 * This function returns the values of all axes of the specified joystick.
2960 * Each element in the array is a value between -1.0 and 1.0.
2031 * 2961 *
2032 * @param[in] joy The joystick to query. 2962 * @param[in] joy The [joystick](@ref joysticks) to query.
2033 * @param[out] count Where to store the size of the returned array. This is 2963 * @param[out] count Where to store the number of axis values in the returned
2034 * set to zero if an error occurred. 2964 * array. This is set to zero if an error occurred.
2035 * @return An array of axis values, or `NULL` if the joystick is not present. 2965 * @return An array of axis values, or `NULL` if the joystick is not present.
2036 * 2966 *
2037 * @note The returned array is allocated and freed by GLFW. You should not 2967 * @par Pointer Lifetime
2038 * free it yourself. 2968 * The returned array is allocated and freed by GLFW. You should not free it
2969 * yourself. It is valid until the specified joystick is disconnected, this
2970 * function is called again for that joystick or the library is terminated.
2971 *
2972 * @par Thread Safety
2973 * This function may only be called from the main thread.
2039 * 2974 *
2040 * @note The returned array is valid only until the next call to @ref 2975 * @sa @ref joystick_axis
2041 * glfwGetJoystickAxes for that joystick. 2976 *
2977 * @since Added in GLFW 3.0. Replaces `glfwGetJoystickPos`.
2042 * 2978 *
2043 * @ingroup input 2979 * @ingroup input
2044 */ 2980 */
@@ -2047,17 +2983,27 @@ GLFWAPI const float* glfwGetJoystickAxes(int joy, int* count);
2047/*! @brief Returns the state of all buttons of the specified joystick. 2983/*! @brief Returns the state of all buttons of the specified joystick.
2048 * 2984 *
2049 * This function returns the state of all buttons of the specified joystick. 2985 * This function returns the state of all buttons of the specified joystick.
2986 * Each element in the array is either `GLFW_PRESS` or `GLFW_RELEASE`.
2050 * 2987 *
2051 * @param[in] joy The joystick to query. 2988 * @param[in] joy The [joystick](@ref joysticks) to query.
2052 * @param[out] count Where to store the size of the returned array. This is 2989 * @param[out] count Where to store the number of button states in the returned
2053 * set to zero if an error occurred. 2990 * array. This is set to zero if an error occurred.
2054 * @return An array of button states, or `NULL` if the joystick is not present. 2991 * @return An array of button states, or `NULL` if the joystick is not present.
2055 * 2992 *
2056 * @note The returned array is allocated and freed by GLFW. You should not 2993 * @par Pointer Lifetime
2057 * free it yourself. 2994 * The returned array is allocated and freed by GLFW. You should not free it
2995 * yourself. It is valid until the specified joystick is disconnected, this
2996 * function is called again for that joystick or the library is terminated.
2997 *
2998 * @par Thread Safety
2999 * This function may only be called from the main thread.
3000 *
3001 * @sa @ref joystick_button
2058 * 3002 *
2059 * @note The returned array is valid only until the next call to @ref 3003 * @since Added in GLFW 2.2.
2060 * glfwGetJoystickButtons for that joystick. 3004 *
3005 * @par
3006 * __GLFW 3:__ Changed to return a dynamic array.
2061 * 3007 *
2062 * @ingroup input 3008 * @ingroup input
2063 */ 3009 */
@@ -2066,16 +3012,24 @@ GLFWAPI const unsigned char* glfwGetJoystickButtons(int joy, int* count);
2066/*! @brief Returns the name of the specified joystick. 3012/*! @brief Returns the name of the specified joystick.
2067 * 3013 *
2068 * This function returns the name, encoded as UTF-8, of the specified joystick. 3014 * This function returns the name, encoded as UTF-8, of the specified joystick.
3015 * The returned string is allocated and freed by GLFW. You should not free it
3016 * yourself.
2069 * 3017 *
2070 * @param[in] joy The joystick to query. 3018 * @param[in] joy The [joystick](@ref joysticks) to query.
2071 * @return The UTF-8 encoded name of the joystick, or `NULL` if the joystick 3019 * @return The UTF-8 encoded name of the joystick, or `NULL` if the joystick
2072 * is not present. 3020 * is not present.
2073 * 3021 *
2074 * @note The returned string is allocated and freed by GLFW. You should not 3022 * @par Pointer Lifetime
2075 * free it yourself. 3023 * The returned string is allocated and freed by GLFW. You should not free it
3024 * yourself. It is valid until the specified joystick is disconnected, this
3025 * function is called again for that joystick or the library is terminated.
3026 *
3027 * @par Thread Safety
3028 * This function may only be called from the main thread.
2076 * 3029 *
2077 * @note The returned string is valid only until the next call to @ref 3030 * @sa @ref joystick_name
2078 * glfwGetJoystickName for that joystick. 3031 *
3032 * @since Added in GLFW 3.0.
2079 * 3033 *
2080 * @ingroup input 3034 * @ingroup input
2081 */ 3035 */
@@ -2084,40 +3038,50 @@ GLFWAPI const char* glfwGetJoystickName(int joy);
2084/*! @brief Sets the clipboard to the specified string. 3038/*! @brief Sets the clipboard to the specified string.
2085 * 3039 *
2086 * This function sets the system clipboard to the specified, UTF-8 encoded 3040 * This function sets the system clipboard to the specified, UTF-8 encoded
2087 * string. The string is copied before returning, so you don't have to retain 3041 * string.
2088 * it afterwards.
2089 * 3042 *
2090 * @param[in] window The window that will own the clipboard contents. 3043 * @param[in] window The window that will own the clipboard contents.
2091 * @param[in] string A UTF-8 encoded string. 3044 * @param[in] string A UTF-8 encoded string.
2092 * 3045 *
2093 * @note This function may only be called from the main thread. 3046 * @par Pointer Lifetime
3047 * The specified string is copied before this function returns.
3048 *
3049 * @par Thread Safety
3050 * This function may only be called from the main thread.
2094 * 3051 *
3052 * @sa @ref clipboard
2095 * @sa glfwGetClipboardString 3053 * @sa glfwGetClipboardString
2096 * 3054 *
2097 * @ingroup clipboard 3055 * @since Added in GLFW 3.0.
3056 *
3057 * @ingroup input
2098 */ 3058 */
2099GLFWAPI void glfwSetClipboardString(GLFWwindow* window, const char* string); 3059GLFWAPI void glfwSetClipboardString(GLFWwindow* window, const char* string);
2100 3060
2101/*! @brief Retrieves the contents of the clipboard as a string. 3061/*! @brief Returns the contents of the clipboard as a string.
2102 * 3062 *
2103 * This function returns the contents of the system clipboard, if it contains 3063 * This function returns the contents of the system clipboard, if it contains
2104 * or is convertible to a UTF-8 encoded string. 3064 * or is convertible to a UTF-8 encoded string.
2105 * 3065 *
2106 * @param[in] window The window that will request the clipboard contents. 3066 * @param[in] window The window that will request the clipboard contents.
2107 * @return The contents of the clipboard as a UTF-8 encoded string, or `NULL` 3067 * @return The contents of the clipboard as a UTF-8 encoded string, or `NULL`
2108 * if an error occurred. 3068 * if an [error](@ref error_handling) occurred.
2109 * 3069 *
2110 * @note This function may only be called from the main thread. 3070 * @par Pointer Lifetime
3071 * The returned string is allocated and freed by GLFW. You should not free it
3072 * yourself. It is valid until the next call to @ref
3073 * glfwGetClipboardString or @ref glfwSetClipboardString, or until the library
3074 * is terminated.
2111 * 3075 *
2112 * @note The returned string is allocated and freed by GLFW. You should not 3076 * @par Thread Safety
2113 * free it yourself. 3077 * This function may only be called from the main thread.
2114 *
2115 * @note The returned string is valid only until the next call to @ref
2116 * glfwGetClipboardString or @ref glfwSetClipboardString.
2117 * 3078 *
3079 * @sa @ref clipboard
2118 * @sa glfwSetClipboardString 3080 * @sa glfwSetClipboardString
2119 * 3081 *
2120 * @ingroup clipboard 3082 * @since Added in GLFW 3.0.
3083 *
3084 * @ingroup input
2121 */ 3085 */
2122GLFWAPI const char* glfwGetClipboardString(GLFWwindow* window); 3086GLFWAPI const char* glfwGetClipboardString(GLFWwindow* window);
2123 3087
@@ -2127,63 +3091,91 @@ GLFWAPI const char* glfwGetClipboardString(GLFWwindow* window);
2127 * been set using @ref glfwSetTime, the timer measures time elapsed since GLFW 3091 * been set using @ref glfwSetTime, the timer measures time elapsed since GLFW
2128 * was initialized. 3092 * was initialized.
2129 * 3093 *
2130 * @return The current value, in seconds, or zero if an error occurred. 3094 * The resolution of the timer is system dependent, but is usually on the order
3095 * of a few micro- or nanoseconds. It uses the highest-resolution monotonic
3096 * time source on each supported platform.
3097 *
3098 * @return The current value, in seconds, or zero if an
3099 * [error](@ref error_handling) occurred.
3100 *
3101 * @par Thread Safety
3102 * This function may be called from any thread. Access is not synchronized.
2131 * 3103 *
2132 * @remarks This function may be called from secondary threads. 3104 * @sa @ref time
2133 * 3105 *
2134 * @note The resolution of the timer is system dependent, but is usually on the 3106 * @since Added in GLFW 1.0.
2135 * order of a few micro- or nanoseconds. It uses the highest-resolution
2136 * monotonic time source on each supported platform.
2137 * 3107 *
2138 * @ingroup time 3108 * @ingroup input
2139 */ 3109 */
2140GLFWAPI double glfwGetTime(void); 3110GLFWAPI double glfwGetTime(void);
2141 3111
2142/*! @brief Sets the GLFW timer. 3112/*! @brief Sets the GLFW timer.
2143 * 3113 *
2144 * This function sets the value of the GLFW timer. It then continues to count 3114 * This function sets the value of the GLFW timer. It then continues to count
2145 * up from that value. 3115 * up from that value. The value must be a positive finite number less than
3116 * or equal to 18446744073.0, which is approximately 584.5 years.
2146 * 3117 *
2147 * @param[in] time The new value, in seconds. 3118 * @param[in] time The new value, in seconds.
2148 * 3119 *
2149 * @note The resolution of the timer is system dependent, but is usually on the 3120 * @remarks The upper limit of the timer is calculated as
2150 * order of a few micro- or nanoseconds. It uses the highest-resolution 3121 * floor((2<sup>64</sup> - 1) / 10<sup>9</sup>) and is due to implementations
2151 * monotonic time source on each supported platform. 3122 * storing nanoseconds in 64 bits. The limit may be increased in the future.
3123 *
3124 * @par Thread Safety
3125 * This function may only be called from the main thread.
3126 *
3127 * @sa @ref time
3128 *
3129 * @since Added in GLFW 2.2.
2152 * 3130 *
2153 * @ingroup time 3131 * @ingroup input
2154 */ 3132 */
2155GLFWAPI void glfwSetTime(double time); 3133GLFWAPI void glfwSetTime(double time);
2156 3134
2157/*! @brief Makes the context of the specified window current for the calling 3135/*! @brief Makes the context of the specified window current for the calling
2158 * thread. 3136 * thread.
2159 * 3137 *
2160 * This function makes the context of the specified window current on the 3138 * This function makes the OpenGL or OpenGL ES context of the specified window
2161 * calling thread. A context can only be made current on a single thread at 3139 * current on the calling thread. A context can only be made current on
2162 * a time and each thread can have only a single current context at a time. 3140 * a single thread at a time and each thread can have only a single current
3141 * context at a time.
3142 *
3143 * By default, making a context non-current implicitly forces a pipeline flush.
3144 * On machines that support `GL_KHR_context_flush_control`, you can control
3145 * whether a context performs this flush by setting the
3146 * [GLFW_CONTEXT_RELEASE_BEHAVIOR](@ref window_hints_ctx) window hint.
2163 * 3147 *
2164 * @param[in] window The window whose context to make current, or `NULL` to 3148 * @param[in] window The window whose context to make current, or `NULL` to
2165 * detach the current context. 3149 * detach the current context.
2166 * 3150 *
2167 * @remarks This function may be called from secondary threads. 3151 * @par Thread Safety
3152 * This function may be called from any thread.
2168 * 3153 *
3154 * @sa @ref context_current
2169 * @sa glfwGetCurrentContext 3155 * @sa glfwGetCurrentContext
2170 * 3156 *
3157 * @since Added in GLFW 3.0.
3158 *
2171 * @ingroup context 3159 * @ingroup context
2172 */ 3160 */
2173GLFWAPI void glfwMakeContextCurrent(GLFWwindow* window); 3161GLFWAPI void glfwMakeContextCurrent(GLFWwindow* window);
2174 3162
2175/*! @brief Returns the window whose context is current on the calling thread. 3163/*! @brief Returns the window whose context is current on the calling thread.
2176 * 3164 *
2177 * This function returns the window whose context is current on the calling 3165 * This function returns the window whose OpenGL or OpenGL ES context is
2178 * thread. 3166 * current on the calling thread.
2179 * 3167 *
2180 * @return The window whose context is current, or `NULL` if no window's 3168 * @return The window whose context is current, or `NULL` if no window's
2181 * context is current. 3169 * context is current.
2182 * 3170 *
2183 * @remarks This function may be called from secondary threads. 3171 * @par Thread Safety
3172 * This function may be called from any thread.
2184 * 3173 *
3174 * @sa @ref context_current
2185 * @sa glfwMakeContextCurrent 3175 * @sa glfwMakeContextCurrent
2186 * 3176 *
3177 * @since Added in GLFW 3.0.
3178 *
2187 * @ingroup context 3179 * @ingroup context
2188 */ 3180 */
2189GLFWAPI GLFWwindow* glfwGetCurrentContext(void); 3181GLFWAPI GLFWwindow* glfwGetCurrentContext(void);
@@ -2196,24 +3188,28 @@ GLFWAPI GLFWwindow* glfwGetCurrentContext(void);
2196 * 3188 *
2197 * @param[in] window The window whose buffers to swap. 3189 * @param[in] window The window whose buffers to swap.
2198 * 3190 *
2199 * @remarks This function may be called from secondary threads. 3191 * @par Thread Safety
2200 * 3192 * This function may be called from any thread.
2201 * @par New in GLFW 3
2202 * This function no longer calls @ref glfwPollEvents. You need to call it or
2203 * @ref glfwWaitEvents yourself.
2204 * 3193 *
3194 * @sa @ref buffer_swap
2205 * @sa glfwSwapInterval 3195 * @sa glfwSwapInterval
2206 * 3196 *
2207 * @ingroup context 3197 * @since Added in GLFW 1.0.
3198 *
3199 * @par
3200 * __GLFW 3:__ Added window handle parameter.
3201 *
3202 * @ingroup window
2208 */ 3203 */
2209GLFWAPI void glfwSwapBuffers(GLFWwindow* window); 3204GLFWAPI void glfwSwapBuffers(GLFWwindow* window);
2210 3205
2211/*! @brief Sets the swap interval for the current context. 3206/*! @brief Sets the swap interval for the current context.
2212 * 3207 *
2213 * This function sets the swap interval for the current context, i.e. the 3208 * This function sets the swap interval for the current context, i.e. the
2214 * number of screen updates to wait before swapping the buffers of a window and 3209 * number of screen updates to wait from the time @ref glfwSwapBuffers was
2215 * returning from @ref glfwSwapBuffers. This is sometimes called 'vertical 3210 * called before swapping the buffers and returning. This is sometimes called
2216 * synchronization', 'vertical retrace synchronization' or 'vsync'. 3211 * _vertical synchronization_, _vertical retrace synchronization_ or just
3212 * _vsync_.
2217 * 3213 *
2218 * Contexts that support either of the `WGL_EXT_swap_control_tear` and 3214 * Contexts that support either of the `WGL_EXT_swap_control_tear` and
2219 * `GLX_EXT_swap_control_tear` extensions also accept negative swap intervals, 3215 * `GLX_EXT_swap_control_tear` extensions also accept negative swap intervals,
@@ -2222,22 +3218,29 @@ GLFWAPI void glfwSwapBuffers(GLFWwindow* window);
2222 * glfwExtensionSupported. For more information about swap tearing, see the 3218 * glfwExtensionSupported. For more information about swap tearing, see the
2223 * extension specifications. 3219 * extension specifications.
2224 * 3220 *
3221 * A context must be current on the calling thread. Calling this function
3222 * without a current context will cause a @ref GLFW_NO_CURRENT_CONTEXT error.
3223 *
2225 * @param[in] interval The minimum number of screen updates to wait for 3224 * @param[in] interval The minimum number of screen updates to wait for
2226 * until the buffers are swapped by @ref glfwSwapBuffers. 3225 * until the buffers are swapped by @ref glfwSwapBuffers.
2227 * 3226 *
2228 * @remarks This function may be called from secondary threads. 3227 * @remarks This function is not called during context creation, leaving the
2229 * 3228 * swap interval set to whatever is the default on that platform. This is done
2230 * @note This function is not called during window creation, leaving the swap
2231 * interval set to whatever is the default on that platform. This is done
2232 * because some swap interval extensions used by GLFW do not allow the swap 3229 * because some swap interval extensions used by GLFW do not allow the swap
2233 * interval to be reset to zero once it has been set to a non-zero value. 3230 * interval to be reset to zero once it has been set to a non-zero value.
2234 * 3231 *
2235 * @note Some GPU drivers do not honor the requested swap interval, either 3232 * @remarks Some GPU drivers do not honor the requested swap interval, either
2236 * because of user settings that override the request or due to bugs in the 3233 * because of a user setting that overrides the application's request or due to
2237 * driver. 3234 * bugs in the driver.
3235 *
3236 * @par Thread Safety
3237 * This function may be called from any thread.
2238 * 3238 *
3239 * @sa @ref buffer_swap
2239 * @sa glfwSwapBuffers 3240 * @sa glfwSwapBuffers
2240 * 3241 *
3242 * @since Added in GLFW 1.0.
3243 *
2241 * @ingroup context 3244 * @ingroup context
2242 */ 3245 */
2243GLFWAPI void glfwSwapInterval(int interval); 3246GLFWAPI void glfwSwapInterval(int interval);
@@ -2245,19 +3248,28 @@ GLFWAPI void glfwSwapInterval(int interval);
2245/*! @brief Returns whether the specified extension is available. 3248/*! @brief Returns whether the specified extension is available.
2246 * 3249 *
2247 * This function returns whether the specified 3250 * This function returns whether the specified
2248 * [OpenGL or context creation API extension](@ref context_glext) is supported 3251 * [client API extension](@ref context_glext) is supported by the current
2249 * by the current context. For example, on Windows both the OpenGL and WGL 3252 * OpenGL or OpenGL ES context. It searches both for OpenGL and OpenGL ES
2250 * extension strings are checked. 3253 * extension and platform-specific context creation API extensions.
3254 *
3255 * A context must be current on the calling thread. Calling this function
3256 * without a current context will cause a @ref GLFW_NO_CURRENT_CONTEXT error.
3257 *
3258 * As this functions retrieves and searches one or more extension strings each
3259 * call, it is recommended that you cache its results if it is going to be used
3260 * frequently. The extension strings will not change during the lifetime of
3261 * a context, so there is no danger in doing this.
2251 * 3262 *
2252 * @param[in] extension The ASCII encoded name of the extension. 3263 * @param[in] extension The ASCII encoded name of the extension.
2253 * @return `GL_TRUE` if the extension is available, or `GL_FALSE` otherwise. 3264 * @return `GL_TRUE` if the extension is available, or `GL_FALSE` otherwise.
2254 * 3265 *
2255 * @remarks This function may be called from secondary threads. 3266 * @par Thread Safety
3267 * This function may be called from any thread.
2256 * 3268 *
2257 * @note As this functions searches one or more extension strings on each call, 3269 * @sa @ref context_glext
2258 * it is recommended that you cache its results if it's going to be used 3270 * @sa glfwGetProcAddress
2259 * frequently. The extension strings will not change during the lifetime of 3271 *
2260 * a context, so there is no danger in doing this. 3272 * @since Added in GLFW 1.0.
2261 * 3273 *
2262 * @ingroup context 3274 * @ingroup context
2263 */ 3275 */
@@ -2267,18 +3279,34 @@ GLFWAPI int glfwExtensionSupported(const char* extension);
2267 * context. 3279 * context.
2268 * 3280 *
2269 * This function returns the address of the specified 3281 * This function returns the address of the specified
2270 * [client API or extension function](@ref context_glext), if it is supported 3282 * [core or extension function](@ref context_glext), if it is supported
2271 * by the current context. 3283 * by the current context.
2272 * 3284 *
3285 * A context must be current on the calling thread. Calling this function
3286 * without a current context will cause a @ref GLFW_NO_CURRENT_CONTEXT error.
3287 *
2273 * @param[in] procname The ASCII encoded name of the function. 3288 * @param[in] procname The ASCII encoded name of the function.
2274 * @return The address of the function, or `NULL` if the function is 3289 * @return The address of the function, or `NULL` if the function is
2275 * unavailable. 3290 * unavailable or an [error](@ref error_handling) occurred.
3291 *
3292 * @remarks The addresses of a given function is not guaranteed to be the same
3293 * between contexts.
3294 *
3295 * @remarks This function may return a non-`NULL` address despite the
3296 * associated version or extension not being available. Always check the
3297 * context version or extension string presence first.
3298 *
3299 * @par Pointer Lifetime
3300 * The returned function pointer is valid until the context is destroyed or the
3301 * library is terminated.
3302 *
3303 * @par Thread Safety
3304 * This function may be called from any thread.
2276 * 3305 *
2277 * @remarks This function may be called from secondary threads. 3306 * @sa @ref context_glext
3307 * @sa glfwExtensionSupported
2278 * 3308 *
2279 * @note The addresses of these functions are not guaranteed to be the same for 3309 * @since Added in GLFW 1.0.
2280 * all contexts, especially if they use different client APIs or even different
2281 * context creation hints.
2282 * 3310 *
2283 * @ingroup context 3311 * @ingroup context
2284 */ 3312 */
diff --git a/externals/glfw-3.1.1.bin/include/GLFW/glfw3native.h b/externals/glfw-3.1.1.bin/include/GLFW/glfw3native.h
new file mode 100644
index 000000000..b3ce7482d
--- /dev/null
+++ b/externals/glfw-3.1.1.bin/include/GLFW/glfw3native.h
@@ -0,0 +1,356 @@
1/*************************************************************************
2 * GLFW 3.1 - www.glfw.org
3 * A library for OpenGL, window and input
4 *------------------------------------------------------------------------
5 * Copyright (c) 2002-2006 Marcus Geelnard
6 * Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
7 *
8 * This software is provided 'as-is', without any express or implied
9 * warranty. In no event will the authors be held liable for any damages
10 * arising from the use of this software.
11 *
12 * Permission is granted to anyone to use this software for any purpose,
13 * including commercial applications, and to alter it and redistribute it
14 * freely, subject to the following restrictions:
15 *
16 * 1. The origin of this software must not be misrepresented; you must not
17 * claim that you wrote the original software. If you use this software
18 * in a product, an acknowledgment in the product documentation would
19 * be appreciated but is not required.
20 *
21 * 2. Altered source versions must be plainly marked as such, and must not
22 * be misrepresented as being the original software.
23 *
24 * 3. This notice may not be removed or altered from any source
25 * distribution.
26 *
27 *************************************************************************/
28
29#ifndef _glfw3_native_h_
30#define _glfw3_native_h_
31
32#ifdef __cplusplus
33extern "C" {
34#endif
35
36
37/*************************************************************************
38 * Doxygen documentation
39 *************************************************************************/
40
41/*! @defgroup native Native access
42 *
43 * **By using the native access functions you assert that you know what you're
44 * doing and how to fix problems caused by using them. If you don't, you
45 * shouldn't be using them.**
46 *
47 * Before the inclusion of @ref glfw3native.h, you must define exactly one
48 * window system API macro and exactly one context creation API macro. Failure
49 * to do this will cause a compile-time error.
50 *
51 * The available window API macros are:
52 * * `GLFW_EXPOSE_NATIVE_WIN32`
53 * * `GLFW_EXPOSE_NATIVE_COCOA`
54 * * `GLFW_EXPOSE_NATIVE_X11`
55 *
56 * The available context API macros are:
57 * * `GLFW_EXPOSE_NATIVE_WGL`
58 * * `GLFW_EXPOSE_NATIVE_NSGL`
59 * * `GLFW_EXPOSE_NATIVE_GLX`
60 * * `GLFW_EXPOSE_NATIVE_EGL`
61 *
62 * These macros select which of the native access functions that are declared
63 * and which platform-specific headers to include. It is then up your (by
64 * definition platform-specific) code to handle which of these should be
65 * defined.
66 */
67
68
69/*************************************************************************
70 * System headers and types
71 *************************************************************************/
72
73#if defined(GLFW_EXPOSE_NATIVE_WIN32)
74 // This is a workaround for the fact that glfw3.h needs to export APIENTRY (for
75 // example to allow applications to correctly declare a GL_ARB_debug_output
76 // callback) but windows.h assumes no one will define APIENTRY before it does
77 #undef APIENTRY
78 #include <windows.h>
79#elif defined(GLFW_EXPOSE_NATIVE_COCOA)
80 #include <ApplicationServices/ApplicationServices.h>
81 #if defined(__OBJC__)
82 #import <Cocoa/Cocoa.h>
83 #else
84 typedef void* id;
85 #endif
86#elif defined(GLFW_EXPOSE_NATIVE_X11)
87 #include <X11/Xlib.h>
88 #include <X11/extensions/Xrandr.h>
89#else
90 #error "No window API selected"
91#endif
92
93#if defined(GLFW_EXPOSE_NATIVE_WGL)
94 /* WGL is declared by windows.h */
95#elif defined(GLFW_EXPOSE_NATIVE_NSGL)
96 /* NSGL is declared by Cocoa.h */
97#elif defined(GLFW_EXPOSE_NATIVE_GLX)
98 #include <GL/glx.h>
99#elif defined(GLFW_EXPOSE_NATIVE_EGL)
100 #include <EGL/egl.h>
101#else
102 #error "No context API selected"
103#endif
104
105
106/*************************************************************************
107 * Functions
108 *************************************************************************/
109
110#if defined(GLFW_EXPOSE_NATIVE_WIN32)
111/*! @brief Returns the adapter device name of the specified monitor.
112 *
113 * @return The UTF-8 encoded adapter device name (for example `\\.\DISPLAY1`)
114 * of the specified monitor, or `NULL` if an [error](@ref error_handling)
115 * occurred.
116 *
117 * @par Thread Safety
118 * This function may be called from any thread. Access is not synchronized.
119 *
120 * @par History
121 * Added in GLFW 3.1.
122 *
123 * @ingroup native
124 */
125GLFWAPI const char* glfwGetWin32Adapter(GLFWmonitor* monitor);
126
127/*! @brief Returns the display device name of the specified monitor.
128 *
129 * @return The UTF-8 encoded display device name (for example
130 * `\\.\DISPLAY1\Monitor0`) of the specified monitor, or `NULL` if an
131 * [error](@ref error_handling) occurred.
132 *
133 * @par Thread Safety
134 * This function may be called from any thread. Access is not synchronized.
135 *
136 * @par History
137 * Added in GLFW 3.1.
138 *
139 * @ingroup native
140 */
141GLFWAPI const char* glfwGetWin32Monitor(GLFWmonitor* monitor);
142
143/*! @brief Returns the `HWND` of the specified window.
144 *
145 * @return The `HWND` of the specified window, or `NULL` if an
146 * [error](@ref error_handling) occurred.
147 *
148 * @par Thread Safety
149 * This function may be called from any thread. Access is not synchronized.
150 *
151 * @par History
152 * Added in GLFW 3.0.
153 *
154 * @ingroup native
155 */
156GLFWAPI HWND glfwGetWin32Window(GLFWwindow* window);
157#endif
158
159#if defined(GLFW_EXPOSE_NATIVE_WGL)
160/*! @brief Returns the `HGLRC` of the specified window.
161 *
162 * @return The `HGLRC` of the specified window, or `NULL` if an
163 * [error](@ref error_handling) occurred.
164 *
165 * @par Thread Safety
166 * This function may be called from any thread. Access is not synchronized.
167 *
168 * @par History
169 * Added in GLFW 3.0.
170 *
171 * @ingroup native
172 */
173GLFWAPI HGLRC glfwGetWGLContext(GLFWwindow* window);
174#endif
175
176#if defined(GLFW_EXPOSE_NATIVE_COCOA)
177/*! @brief Returns the `CGDirectDisplayID` of the specified monitor.
178 *
179 * @return The `CGDirectDisplayID` of the specified monitor, or
180 * `kCGNullDirectDisplay` if an [error](@ref error_handling) occurred.
181 *
182 * @par Thread Safety
183 * This function may be called from any thread. Access is not synchronized.
184 *
185 * @par History
186 * Added in GLFW 3.1.
187 *
188 * @ingroup native
189 */
190GLFWAPI CGDirectDisplayID glfwGetCocoaMonitor(GLFWmonitor* monitor);
191
192/*! @brief Returns the `NSWindow` of the specified window.
193 *
194 * @return The `NSWindow` of the specified window, or `nil` if an
195 * [error](@ref error_handling) occurred.
196 *
197 * @par Thread Safety
198 * This function may be called from any thread. Access is not synchronized.
199 *
200 * @par History
201 * Added in GLFW 3.0.
202 *
203 * @ingroup native
204 */
205GLFWAPI id glfwGetCocoaWindow(GLFWwindow* window);
206#endif
207
208#if defined(GLFW_EXPOSE_NATIVE_NSGL)
209/*! @brief Returns the `NSOpenGLContext` of the specified window.
210 *
211 * @return The `NSOpenGLContext` of the specified window, or `nil` if an
212 * [error](@ref error_handling) occurred.
213 *
214 * @par Thread Safety
215 * This function may be called from any thread. Access is not synchronized.
216 *
217 * @par History
218 * Added in GLFW 3.0.
219 *
220 * @ingroup native
221 */
222GLFWAPI id glfwGetNSGLContext(GLFWwindow* window);
223#endif
224
225#if defined(GLFW_EXPOSE_NATIVE_X11)
226/*! @brief Returns the `Display` used by GLFW.
227 *
228 * @return The `Display` used by GLFW, or `NULL` if an
229 * [error](@ref error_handling) occurred.
230 *
231 * @par Thread Safety
232 * This function may be called from any thread. Access is not synchronized.
233 *
234 * @par History
235 * Added in GLFW 3.0.
236 *
237 * @ingroup native
238 */
239GLFWAPI Display* glfwGetX11Display(void);
240
241/*! @brief Returns the `RRCrtc` of the specified monitor.
242 *
243 * @return The `RRCrtc` of the specified monitor, or `None` if an
244 * [error](@ref error_handling) occurred.
245 *
246 * @par Thread Safety
247 * This function may be called from any thread. Access is not synchronized.
248 *
249 * @par History
250 * Added in GLFW 3.1.
251 *
252 * @ingroup native
253 */
254GLFWAPI RRCrtc glfwGetX11Adapter(GLFWmonitor* monitor);
255
256/*! @brief Returns the `RROutput` of the specified monitor.
257 *
258 * @return The `RROutput` of the specified monitor, or `None` if an
259 * [error](@ref error_handling) occurred.
260 *
261 * @par Thread Safety
262 * This function may be called from any thread. Access is not synchronized.
263 *
264 * @par History
265 * Added in GLFW 3.1.
266 *
267 * @ingroup native
268 */
269GLFWAPI RROutput glfwGetX11Monitor(GLFWmonitor* monitor);
270
271/*! @brief Returns the `Window` of the specified window.
272 *
273 * @return The `Window` of the specified window, or `None` if an
274 * [error](@ref error_handling) occurred.
275 *
276 * @par Thread Safety
277 * This function may be called from any thread. Access is not synchronized.
278 *
279 * @par History
280 * Added in GLFW 3.0.
281 *
282 * @ingroup native
283 */
284GLFWAPI Window glfwGetX11Window(GLFWwindow* window);
285#endif
286
287#if defined(GLFW_EXPOSE_NATIVE_GLX)
288/*! @brief Returns the `GLXContext` of the specified window.
289 *
290 * @return The `GLXContext` of the specified window, or `NULL` if an
291 * [error](@ref error_handling) occurred.
292 *
293 * @par Thread Safety
294 * This function may be called from any thread. Access is not synchronized.
295 *
296 * @par History
297 * Added in GLFW 3.0.
298 *
299 * @ingroup native
300 */
301GLFWAPI GLXContext glfwGetGLXContext(GLFWwindow* window);
302#endif
303
304#if defined(GLFW_EXPOSE_NATIVE_EGL)
305/*! @brief Returns the `EGLDisplay` used by GLFW.
306 *
307 * @return The `EGLDisplay` used by GLFW, or `EGL_NO_DISPLAY` if an
308 * [error](@ref error_handling) occurred.
309 *
310 * @par Thread Safety
311 * This function may be called from any thread. Access is not synchronized.
312 *
313 * @par History
314 * Added in GLFW 3.0.
315 *
316 * @ingroup native
317 */
318GLFWAPI EGLDisplay glfwGetEGLDisplay(void);
319
320/*! @brief Returns the `EGLContext` of the specified window.
321 *
322 * @return The `EGLContext` of the specified window, or `EGL_NO_CONTEXT` if an
323 * [error](@ref error_handling) occurred.
324 *
325 * @par Thread Safety
326 * This function may be called from any thread. Access is not synchronized.
327 *
328 * @par History
329 * Added in GLFW 3.0.
330 *
331 * @ingroup native
332 */
333GLFWAPI EGLContext glfwGetEGLContext(GLFWwindow* window);
334
335/*! @brief Returns the `EGLSurface` of the specified window.
336 *
337 * @return The `EGLSurface` of the specified window, or `EGL_NO_SURFACE` if an
338 * [error](@ref error_handling) occurred.
339 *
340 * @par Thread Safety
341 * This function may be called from any thread. Access is not synchronized.
342 *
343 * @par History
344 * Added in GLFW 3.0.
345 *
346 * @ingroup native
347 */
348GLFWAPI EGLSurface glfwGetEGLSurface(GLFWwindow* window);
349#endif
350
351#ifdef __cplusplus
352}
353#endif
354
355#endif /* _glfw3_native_h_ */
356
diff --git a/externals/glfw-3.1.1.bin/lib-mingw-i686/glfw3.dll b/externals/glfw-3.1.1.bin/lib-mingw-i686/glfw3.dll
new file mode 100644
index 000000000..84c2e1bc2
--- /dev/null
+++ b/externals/glfw-3.1.1.bin/lib-mingw-i686/glfw3.dll
Binary files differ
diff --git a/externals/glfw-3.0.4.bin/lib-mingw-i686/glfw3dll.a b/externals/glfw-3.1.1.bin/lib-mingw-i686/glfw3dll.a
index 415d85630..dc593d062 100644
--- a/externals/glfw-3.0.4.bin/lib-mingw-i686/glfw3dll.a
+++ b/externals/glfw-3.1.1.bin/lib-mingw-i686/glfw3dll.a
Binary files differ
diff --git a/externals/glfw-3.1.1.bin/lib-mingw-i686/libglfw3.a b/externals/glfw-3.1.1.bin/lib-mingw-i686/libglfw3.a
new file mode 100644
index 000000000..59eae0868
--- /dev/null
+++ b/externals/glfw-3.1.1.bin/lib-mingw-i686/libglfw3.a
Binary files differ
diff --git a/externals/glfw-3.1.1.bin/lib-mingw-x86_64/glfw3.dll b/externals/glfw-3.1.1.bin/lib-mingw-x86_64/glfw3.dll
new file mode 100644
index 000000000..437918eda
--- /dev/null
+++ b/externals/glfw-3.1.1.bin/lib-mingw-x86_64/glfw3.dll
Binary files differ
diff --git a/externals/glfw-3.0.4.bin/lib-mingw-x86_64/glfw3dll.a b/externals/glfw-3.1.1.bin/lib-mingw-x86_64/glfw3dll.a
index d71c65377..be08358ab 100644
--- a/externals/glfw-3.0.4.bin/lib-mingw-x86_64/glfw3dll.a
+++ b/externals/glfw-3.1.1.bin/lib-mingw-x86_64/glfw3dll.a
Binary files differ
diff --git a/externals/glfw-3.1.1.bin/lib-mingw-x86_64/libglfw3.a b/externals/glfw-3.1.1.bin/lib-mingw-x86_64/libglfw3.a
new file mode 100644
index 000000000..e9e7be933
--- /dev/null
+++ b/externals/glfw-3.1.1.bin/lib-mingw-x86_64/libglfw3.a
Binary files differ
diff --git a/externals/glfw-3.1.1.bin/lib-msvc_v120-Win32/glfw3.dll b/externals/glfw-3.1.1.bin/lib-msvc_v120-Win32/glfw3.dll
new file mode 100644
index 000000000..f15748d7a
--- /dev/null
+++ b/externals/glfw-3.1.1.bin/lib-msvc_v120-Win32/glfw3.dll
Binary files differ
diff --git a/externals/glfw-3.1.1.bin/lib-msvc_v120-Win32/glfw3.lib b/externals/glfw-3.1.1.bin/lib-msvc_v120-Win32/glfw3.lib
new file mode 100644
index 000000000..6a5a85a1d
--- /dev/null
+++ b/externals/glfw-3.1.1.bin/lib-msvc_v120-Win32/glfw3.lib
Binary files differ
diff --git a/externals/glfw-3.1.1.bin/lib-msvc_v120-Win32/glfw3dll.lib b/externals/glfw-3.1.1.bin/lib-msvc_v120-Win32/glfw3dll.lib
new file mode 100644
index 000000000..248a5cadf
--- /dev/null
+++ b/externals/glfw-3.1.1.bin/lib-msvc_v120-Win32/glfw3dll.lib
Binary files differ
diff --git a/externals/glfw-3.1.1.bin/lib-msvc_v120-x64/glfw3.dll b/externals/glfw-3.1.1.bin/lib-msvc_v120-x64/glfw3.dll
new file mode 100644
index 000000000..cba172f64
--- /dev/null
+++ b/externals/glfw-3.1.1.bin/lib-msvc_v120-x64/glfw3.dll
Binary files differ
diff --git a/externals/glfw-3.1.1.bin/lib-msvc_v120-x64/glfw3.lib b/externals/glfw-3.1.1.bin/lib-msvc_v120-x64/glfw3.lib
new file mode 100644
index 000000000..efdd64332
--- /dev/null
+++ b/externals/glfw-3.1.1.bin/lib-msvc_v120-x64/glfw3.lib
Binary files differ
diff --git a/externals/glfw-3.1.1.bin/lib-msvc_v120-x64/glfw3dll.lib b/externals/glfw-3.1.1.bin/lib-msvc_v120-x64/glfw3dll.lib
new file mode 100644
index 000000000..49ed2bb67
--- /dev/null
+++ b/externals/glfw-3.1.1.bin/lib-msvc_v120-x64/glfw3dll.lib
Binary files differ
diff --git a/src/core/arm/dyncom/arm_dyncom_interpreter.cpp b/src/core/arm/dyncom/arm_dyncom_interpreter.cpp
index e4b5486e0..b5d1b43cd 100644
--- a/src/core/arm/dyncom/arm_dyncom_interpreter.cpp
+++ b/src/core/arm/dyncom/arm_dyncom_interpreter.cpp
@@ -3564,17 +3564,13 @@ static int InterpreterTranslate(ARMul_State* cpu, int& bb_start, u32 addr) {
3564 unsigned int inst, inst_size = 4; 3564 unsigned int inst, inst_size = 4;
3565 int idx; 3565 int idx;
3566 int ret = NON_BRANCH; 3566 int ret = NON_BRANCH;
3567 int thumb = 0;
3568 int size = 0; // instruction size of basic block 3567 int size = 0; // instruction size of basic block
3569 bb_start = top; 3568 bb_start = top;
3570 3569
3571 if (cpu->TFlag)
3572 thumb = THUMB;
3573
3574 u32 phys_addr = addr; 3570 u32 phys_addr = addr;
3575 u32 pc_start = cpu->Reg[15]; 3571 u32 pc_start = cpu->Reg[15];
3576 3572
3577 while(ret == NON_BRANCH) { 3573 while (ret == NON_BRANCH) {
3578 inst = Memory::Read32(phys_addr & 0xFFFFFFFC); 3574 inst = Memory::Read32(phys_addr & 0xFFFFFFFC);
3579 3575
3580 size++; 3576 size++;
@@ -3890,7 +3886,6 @@ unsigned InterpreterMainLoop(ARMul_State* cpu) {
3890 3886
3891 #define CurrentModeHasSPSR (cpu->Mode != SYSTEM32MODE) && (cpu->Mode != USER32MODE) 3887 #define CurrentModeHasSPSR (cpu->Mode != SYSTEM32MODE) && (cpu->Mode != USER32MODE)
3892 #define PC (cpu->Reg[15]) 3888 #define PC (cpu->Reg[15])
3893 #define CHECK_EXT_INT if (!cpu->NirqSig && !(cpu->Cpsr & 0x80)) goto END;
3894 3889
3895 // GCC and Clang have a C++ extension to support a lookup table of labels. Otherwise, fallback 3890 // GCC and Clang have a C++ extension to support a lookup table of labels. Otherwise, fallback
3896 // to a clunky switch statement. 3891 // to a clunky switch statement.
diff --git a/src/core/hle/service/gsp_gpu.cpp b/src/core/hle/service/gsp_gpu.cpp
index c56475ae4..4af168bfc 100644
--- a/src/core/hle/service/gsp_gpu.cpp
+++ b/src/core/hle/service/gsp_gpu.cpp
@@ -496,6 +496,52 @@ static void TriggerCmdReqQueue(Service::Interface* self) {
496 cmd_buff[1] = 0; // No error 496 cmd_buff[1] = 0; // No error
497} 497}
498 498
499/**
500 * GSP_GPU::ImportDisplayCaptureInfo service function
501 *
502 * Returns information about the current framebuffer state
503 *
504 * Inputs:
505 * 0: Header 0x00180000
506 * Outputs:
507 * 1: Result code
508 * 2: Left framebuffer virtual address for the main screen
509 * 3: Right framebuffer virtual address for the main screen
510 * 4: Main screen framebuffer format
511 * 5: Main screen framebuffer width
512 * 6: Left framebuffer virtual address for the bottom screen
513 * 7: Right framebuffer virtual address for the bottom screen
514 * 8: Bottom screen framebuffer format
515 * 9: Bottom screen framebuffer width
516 */
517static void ImportDisplayCaptureInfo(Service::Interface* self) {
518 u32* cmd_buff = Kernel::GetCommandBuffer();
519
520 // TODO(Subv): We're always returning the framebuffer structures for thread_id = 0,
521 // because we only support a single running application at a time.
522 // This should always return the framebuffer data that is currently displayed on the screen.
523
524 u32 thread_id = 0;
525
526 FrameBufferUpdate* top_screen = GetFrameBufferInfo(thread_id, 0);
527 FrameBufferUpdate* bottom_screen = GetFrameBufferInfo(thread_id, 1);
528
529 cmd_buff[2] = top_screen->framebuffer_info[top_screen->index].address_left;
530 cmd_buff[3] = top_screen->framebuffer_info[top_screen->index].address_right;
531 cmd_buff[4] = top_screen->framebuffer_info[top_screen->index].format;
532 cmd_buff[5] = top_screen->framebuffer_info[top_screen->index].stride;
533
534 cmd_buff[6] = bottom_screen->framebuffer_info[bottom_screen->index].address_left;
535 cmd_buff[7] = bottom_screen->framebuffer_info[bottom_screen->index].address_right;
536 cmd_buff[8] = bottom_screen->framebuffer_info[bottom_screen->index].format;
537 cmd_buff[9] = bottom_screen->framebuffer_info[bottom_screen->index].stride;
538
539 cmd_buff[1] = RESULT_SUCCESS.raw;
540
541 LOG_WARNING(Service_GSP, "called");
542}
543
544
499const Interface::FunctionInfo FunctionTable[] = { 545const Interface::FunctionInfo FunctionTable[] = {
500 {0x00010082, WriteHWRegs, "WriteHWRegs"}, 546 {0x00010082, WriteHWRegs, "WriteHWRegs"},
501 {0x00020084, WriteHWRegsWithMask, "WriteHWRegsWithMask"}, 547 {0x00020084, WriteHWRegsWithMask, "WriteHWRegsWithMask"},
@@ -520,7 +566,7 @@ const Interface::FunctionInfo FunctionTable[] = {
520 {0x00150002, nullptr, "TryAcquireRight"}, 566 {0x00150002, nullptr, "TryAcquireRight"},
521 {0x00160042, nullptr, "AcquireRight"}, 567 {0x00160042, nullptr, "AcquireRight"},
522 {0x00170000, nullptr, "ReleaseRight"}, 568 {0x00170000, nullptr, "ReleaseRight"},
523 {0x00180000, nullptr, "ImportDisplayCaptureInfo"}, 569 {0x00180000, ImportDisplayCaptureInfo, "ImportDisplayCaptureInfo"},
524 {0x00190000, nullptr, "SaveVramSysArea"}, 570 {0x00190000, nullptr, "SaveVramSysArea"},
525 {0x001A0000, nullptr, "RestoreVramSysArea"}, 571 {0x001A0000, nullptr, "RestoreVramSysArea"},
526 {0x001B0000, nullptr, "ResetGpuCore"}, 572 {0x001B0000, nullptr, "ResetGpuCore"},
diff --git a/src/core/hle/svc.cpp b/src/core/hle/svc.cpp
index 347d241f9..ca3ff3328 100644
--- a/src/core/hle/svc.cpp
+++ b/src/core/hle/svc.cpp
@@ -654,6 +654,8 @@ static ResultCode CreateMemoryBlock(Handle* out_handle, u32 addr, u32 size, u32
654 using Kernel::MemoryPermission; 654 using Kernel::MemoryPermission;
655 SharedPtr<SharedMemory> shared_memory = SharedMemory::Create(size, 655 SharedPtr<SharedMemory> shared_memory = SharedMemory::Create(size,
656 (MemoryPermission)my_permission, (MemoryPermission)other_permission); 656 (MemoryPermission)my_permission, (MemoryPermission)other_permission);
657 // Map the SharedMemory to the specified address
658 shared_memory->base_address = addr;
657 CASCADE_RESULT(*out_handle, Kernel::g_handle_table.Create(std::move(shared_memory))); 659 CASCADE_RESULT(*out_handle, Kernel::g_handle_table.Create(std::move(shared_memory)));
658 660
659 LOG_WARNING(Kernel_SVC, "(STUBBED) called addr=0x%08X", addr); 661 LOG_WARNING(Kernel_SVC, "(STUBBED) called addr=0x%08X", addr);