mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-25 03:08:54 +01:00
parent
ca48736847
commit
dd4d2f6aa0
98
internal/glfw/glfw/include/GLFW/glfw3.h
vendored
98
internal/glfw/glfw/include/GLFW/glfw3.h
vendored
@ -190,6 +190,9 @@ extern "C" {
|
||||
#else /*__APPLE__*/
|
||||
|
||||
#include <GL/glcorearb.h>
|
||||
#if defined(GLFW_INCLUDE_GLEXT)
|
||||
#include <GL/glext.h>
|
||||
#endif
|
||||
|
||||
#endif /*__APPLE__*/
|
||||
|
||||
@ -276,26 +279,27 @@ extern "C" {
|
||||
|
||||
/*! @name GLFW version macros
|
||||
* @{ */
|
||||
/*! @brief The major version number of the GLFW library.
|
||||
/*! @brief The major version number of the GLFW header.
|
||||
*
|
||||
* This is incremented when the API is changed in non-compatible ways.
|
||||
* The major version number of the GLFW header. This is incremented when the
|
||||
* API is changed in non-compatible ways.
|
||||
* @ingroup init
|
||||
*/
|
||||
#define GLFW_VERSION_MAJOR 3
|
||||
/*! @brief The minor version number of the GLFW library.
|
||||
/*! @brief The minor version number of the GLFW header.
|
||||
*
|
||||
* This is incremented when features are added to the API but it remains
|
||||
* backward-compatible.
|
||||
* The minor version number of the GLFW header. This is incremented when
|
||||
* features are added to the API but it remains backward-compatible.
|
||||
* @ingroup init
|
||||
*/
|
||||
#define GLFW_VERSION_MINOR 3
|
||||
/*! @brief The revision number of the GLFW library.
|
||||
/*! @brief The revision number of the GLFW header.
|
||||
*
|
||||
* This is incremented when a bug fix release is made that does not contain any
|
||||
* API changes.
|
||||
* The revision number of the GLFW header. This is incremented when a bug fix
|
||||
* release is made that does not contain any API changes.
|
||||
* @ingroup init
|
||||
*/
|
||||
#define GLFW_VERSION_REVISION 4
|
||||
#define GLFW_VERSION_REVISION 6
|
||||
/*! @} */
|
||||
|
||||
/*! @brief One.
|
||||
@ -956,7 +960,7 @@ extern "C" {
|
||||
* and [attribute](@ref GLFW_CONTEXT_VERSION_MINOR_attrib).
|
||||
*/
|
||||
#define GLFW_CONTEXT_VERSION_MINOR 0x00022003
|
||||
/*! @brief Context client API revision number hint and attribute.
|
||||
/*! @brief Context client API revision number attribute.
|
||||
*
|
||||
* Context client API revision number
|
||||
* [attribute](@ref GLFW_CONTEXT_REVISION_attrib).
|
||||
@ -1215,7 +1219,7 @@ typedef struct GLFWcursor GLFWcursor;
|
||||
*
|
||||
* @ingroup init
|
||||
*/
|
||||
typedef void (* GLFWerrorfun)(int,const char*);
|
||||
typedef void (* GLFWerrorfun)(int error_code, const char* description);
|
||||
|
||||
/*! @brief The function pointer type for window position callbacks.
|
||||
*
|
||||
@ -1238,7 +1242,7 @@ typedef void (* GLFWerrorfun)(int,const char*);
|
||||
*
|
||||
* @ingroup window
|
||||
*/
|
||||
typedef void (* GLFWwindowposfun)(GLFWwindow*,int,int);
|
||||
typedef void (* GLFWwindowposfun)(GLFWwindow* window, int xpos, int ypos);
|
||||
|
||||
/*! @brief The function pointer type for window size callbacks.
|
||||
*
|
||||
@ -1260,7 +1264,7 @@ typedef void (* GLFWwindowposfun)(GLFWwindow*,int,int);
|
||||
*
|
||||
* @ingroup window
|
||||
*/
|
||||
typedef void (* GLFWwindowsizefun)(GLFWwindow*,int,int);
|
||||
typedef void (* GLFWwindowsizefun)(GLFWwindow* window, int width, int height);
|
||||
|
||||
/*! @brief The function pointer type for window close callbacks.
|
||||
*
|
||||
@ -1280,7 +1284,7 @@ typedef void (* GLFWwindowsizefun)(GLFWwindow*,int,int);
|
||||
*
|
||||
* @ingroup window
|
||||
*/
|
||||
typedef void (* GLFWwindowclosefun)(GLFWwindow*);
|
||||
typedef void (* GLFWwindowclosefun)(GLFWwindow* window);
|
||||
|
||||
/*! @brief The function pointer type for window content refresh callbacks.
|
||||
*
|
||||
@ -1300,7 +1304,7 @@ typedef void (* GLFWwindowclosefun)(GLFWwindow*);
|
||||
*
|
||||
* @ingroup window
|
||||
*/
|
||||
typedef void (* GLFWwindowrefreshfun)(GLFWwindow*);
|
||||
typedef void (* GLFWwindowrefreshfun)(GLFWwindow* window);
|
||||
|
||||
/*! @brief The function pointer type for window focus callbacks.
|
||||
*
|
||||
@ -1321,7 +1325,7 @@ typedef void (* GLFWwindowrefreshfun)(GLFWwindow*);
|
||||
*
|
||||
* @ingroup window
|
||||
*/
|
||||
typedef void (* GLFWwindowfocusfun)(GLFWwindow*,int);
|
||||
typedef void (* GLFWwindowfocusfun)(GLFWwindow* window, int focused);
|
||||
|
||||
/*! @brief The function pointer type for window iconify callbacks.
|
||||
*
|
||||
@ -1342,7 +1346,7 @@ typedef void (* GLFWwindowfocusfun)(GLFWwindow*,int);
|
||||
*
|
||||
* @ingroup window
|
||||
*/
|
||||
typedef void (* GLFWwindowiconifyfun)(GLFWwindow*,int);
|
||||
typedef void (* GLFWwindowiconifyfun)(GLFWwindow* window, int iconified);
|
||||
|
||||
/*! @brief The function pointer type for window maximize callbacks.
|
||||
*
|
||||
@ -1363,7 +1367,7 @@ typedef void (* GLFWwindowiconifyfun)(GLFWwindow*,int);
|
||||
*
|
||||
* @ingroup window
|
||||
*/
|
||||
typedef void (* GLFWwindowmaximizefun)(GLFWwindow*,int);
|
||||
typedef void (* GLFWwindowmaximizefun)(GLFWwindow* window, int maximized);
|
||||
|
||||
/*! @brief The function pointer type for framebuffer size callbacks.
|
||||
*
|
||||
@ -1384,7 +1388,7 @@ typedef void (* GLFWwindowmaximizefun)(GLFWwindow*,int);
|
||||
*
|
||||
* @ingroup window
|
||||
*/
|
||||
typedef void (* GLFWframebuffersizefun)(GLFWwindow*,int,int);
|
||||
typedef void (* GLFWframebuffersizefun)(GLFWwindow* window, int width, int height);
|
||||
|
||||
/*! @brief The function pointer type for window content scale callbacks.
|
||||
*
|
||||
@ -1405,7 +1409,7 @@ typedef void (* GLFWframebuffersizefun)(GLFWwindow*,int,int);
|
||||
*
|
||||
* @ingroup window
|
||||
*/
|
||||
typedef void (* GLFWwindowcontentscalefun)(GLFWwindow*,float,float);
|
||||
typedef void (* GLFWwindowcontentscalefun)(GLFWwindow* window, float xscale, float yscale);
|
||||
|
||||
/*! @brief The function pointer type for mouse button callbacks.
|
||||
*
|
||||
@ -1431,7 +1435,7 @@ typedef void (* GLFWwindowcontentscalefun)(GLFWwindow*,float,float);
|
||||
*
|
||||
* @ingroup input
|
||||
*/
|
||||
typedef void (* GLFWmousebuttonfun)(GLFWwindow*,int,int,int);
|
||||
typedef void (* GLFWmousebuttonfun)(GLFWwindow* window, int button, int action, int mods);
|
||||
|
||||
/*! @brief The function pointer type for cursor position callbacks.
|
||||
*
|
||||
@ -1454,7 +1458,7 @@ typedef void (* GLFWmousebuttonfun)(GLFWwindow*,int,int,int);
|
||||
*
|
||||
* @ingroup input
|
||||
*/
|
||||
typedef void (* GLFWcursorposfun)(GLFWwindow*,double,double);
|
||||
typedef void (* GLFWcursorposfun)(GLFWwindow* window, double xpos, double ypos);
|
||||
|
||||
/*! @brief The function pointer type for cursor enter/leave callbacks.
|
||||
*
|
||||
@ -1475,7 +1479,7 @@ typedef void (* GLFWcursorposfun)(GLFWwindow*,double,double);
|
||||
*
|
||||
* @ingroup input
|
||||
*/
|
||||
typedef void (* GLFWcursorenterfun)(GLFWwindow*,int);
|
||||
typedef void (* GLFWcursorenterfun)(GLFWwindow* window, int entered);
|
||||
|
||||
/*! @brief The function pointer type for scroll callbacks.
|
||||
*
|
||||
@ -1496,7 +1500,7 @@ typedef void (* GLFWcursorenterfun)(GLFWwindow*,int);
|
||||
*
|
||||
* @ingroup input
|
||||
*/
|
||||
typedef void (* GLFWscrollfun)(GLFWwindow*,double*,double*);
|
||||
typedef void (* GLFWscrollfun)(GLFWwindow* window, double* xoffset, double* yoffset);
|
||||
|
||||
/*! @brief The function pointer type for keyboard key callbacks.
|
||||
*
|
||||
@ -1522,7 +1526,7 @@ typedef void (* GLFWscrollfun)(GLFWwindow*,double*,double*);
|
||||
*
|
||||
* @ingroup input
|
||||
*/
|
||||
typedef void (* GLFWkeyfun)(GLFWwindow*,int,int,int,int);
|
||||
typedef void (* GLFWkeyfun)(GLFWwindow* window, int key, int scancode, int action, int mods);
|
||||
|
||||
/*! @brief The function pointer type for Unicode character callbacks.
|
||||
*
|
||||
@ -1543,7 +1547,7 @@ typedef void (* GLFWkeyfun)(GLFWwindow*,int,int,int,int);
|
||||
*
|
||||
* @ingroup input
|
||||
*/
|
||||
typedef void (* GLFWcharfun)(GLFWwindow*,unsigned int);
|
||||
typedef void (* GLFWcharfun)(GLFWwindow* window, unsigned int codepoint);
|
||||
|
||||
/*! @brief The function pointer type for Unicode character with modifiers
|
||||
* callbacks.
|
||||
@ -1570,7 +1574,7 @@ typedef void (* GLFWcharfun)(GLFWwindow*,unsigned int);
|
||||
*
|
||||
* @ingroup input
|
||||
*/
|
||||
typedef void (* GLFWcharmodsfun)(GLFWwindow*,unsigned int,int);
|
||||
typedef void (* GLFWcharmodsfun)(GLFWwindow* window, unsigned int codepoint, int mods);
|
||||
|
||||
/*! @brief The function pointer type for path drop callbacks.
|
||||
*
|
||||
@ -1594,7 +1598,7 @@ typedef void (* GLFWcharmodsfun)(GLFWwindow*,unsigned int,int);
|
||||
*
|
||||
* @ingroup input
|
||||
*/
|
||||
typedef void (* GLFWdropfun)(GLFWwindow*,int,const char*[]);
|
||||
typedef void (* GLFWdropfun)(GLFWwindow* window, int path_count, const char* paths[]);
|
||||
|
||||
/*! @brief The function pointer type for monitor configuration callbacks.
|
||||
*
|
||||
@ -1615,7 +1619,7 @@ typedef void (* GLFWdropfun)(GLFWwindow*,int,const char*[]);
|
||||
*
|
||||
* @ingroup monitor
|
||||
*/
|
||||
typedef void (* GLFWmonitorfun)(GLFWmonitor*,int);
|
||||
typedef void (* GLFWmonitorfun)(GLFWmonitor* monitor, int event);
|
||||
|
||||
/*! @brief The function pointer type for joystick configuration callbacks.
|
||||
*
|
||||
@ -1636,7 +1640,7 @@ typedef void (* GLFWmonitorfun)(GLFWmonitor*,int);
|
||||
*
|
||||
* @ingroup input
|
||||
*/
|
||||
typedef void (* GLFWjoystickfun)(int,int);
|
||||
typedef void (* GLFWjoystickfun)(int jid, int event);
|
||||
|
||||
/*! @brief Video mode type.
|
||||
*
|
||||
@ -2124,8 +2128,8 @@ GLFWAPI void glfwGetMonitorWorkarea(GLFWmonitor* monitor, int* xpos, int* ypos,
|
||||
*
|
||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
|
||||
*
|
||||
* @remark @win32 calculates the returned physical size from the
|
||||
* current resolution and system DPI instead of querying the monitor EDID data.
|
||||
* @remark @win32 On Windows 8 and earlier the physical size is calculated from
|
||||
* the current resolution and system DPI instead of querying the monitor EDID data.
|
||||
*
|
||||
* @thread_safety This function must only be called from the main thread.
|
||||
*
|
||||
@ -2279,8 +2283,9 @@ GLFWAPI GLFWmonitorfun glfwSetMonitorCallback(GLFWmonitorfun callback);
|
||||
*
|
||||
* This function returns an array of all video modes supported by the specified
|
||||
* monitor. The returned array is sorted in ascending order, first by color
|
||||
* bit depth (the sum of all channel depths) and then by resolution area (the
|
||||
* product of width and height).
|
||||
* bit depth (the sum of all channel depths), then by resolution area (the
|
||||
* product of width and height), then resolution width and finally by refresh
|
||||
* rate.
|
||||
*
|
||||
* @param[in] monitor The monitor to query.
|
||||
* @param[out] count Where to store the number of video modes in the returned
|
||||
@ -5222,6 +5227,8 @@ GLFWAPI int glfwUpdateGamepadMappings(const char* string);
|
||||
* joystick is not present, does not have a mapping or an
|
||||
* [error](@ref error_handling) occurred.
|
||||
*
|
||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref GLFW_INVALID_ENUM.
|
||||
*
|
||||
* @pointer_lifetime The returned string is allocated and freed by GLFW. You
|
||||
* should not free it yourself. It is valid until the specified joystick is
|
||||
* disconnected, the gamepad mappings are updated or the library is terminated.
|
||||
@ -5311,8 +5318,8 @@ GLFWAPI void glfwSetClipboardString(GLFWwindow* window, const char* string);
|
||||
* @return The contents of the clipboard as a UTF-8 encoded string, or `NULL`
|
||||
* if an [error](@ref error_handling) occurred.
|
||||
*
|
||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
|
||||
* GLFW_PLATFORM_ERROR.
|
||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
|
||||
* GLFW_FORMAT_UNAVAILABLE and @ref GLFW_PLATFORM_ERROR.
|
||||
*
|
||||
* @pointer_lifetime The returned string is allocated and freed by GLFW. You
|
||||
* should not free it yourself. It is valid until the next call to @ref
|
||||
@ -5656,13 +5663,11 @@ GLFWAPI GLFWglproc glfwGetProcAddress(const char* procname);
|
||||
* This function returns whether the Vulkan loader and any minimally functional
|
||||
* ICD have been found.
|
||||
*
|
||||
* The availability of a Vulkan loader and even an ICD does not by itself
|
||||
* guarantee that surface creation or even instance creation is possible.
|
||||
* For example, on Fermi systems Nvidia will install an ICD that provides no
|
||||
* actual Vulkan support. Call @ref glfwGetRequiredInstanceExtensions to check
|
||||
* whether the extensions necessary for Vulkan surface creation are available
|
||||
* and @ref glfwGetPhysicalDevicePresentationSupport to check whether a queue
|
||||
* family of a physical device supports image presentation.
|
||||
* The availability of a Vulkan loader and even an ICD does not by itself guarantee that
|
||||
* surface creation or even instance creation is possible. Call @ref
|
||||
* glfwGetRequiredInstanceExtensions to check whether the extensions necessary for Vulkan
|
||||
* surface creation are available and @ref glfwGetPhysicalDevicePresentationSupport to
|
||||
* check whether a queue family of a physical device supports image presentation.
|
||||
*
|
||||
* @return `GLFW_TRUE` if Vulkan is minimally available, or `GLFW_FALSE`
|
||||
* otherwise.
|
||||
@ -5708,9 +5713,8 @@ GLFWAPI int glfwVulkanSupported(void);
|
||||
* returned array, as it is an error to specify an extension more than once in
|
||||
* the `VkInstanceCreateInfo` struct.
|
||||
*
|
||||
* @remark @macos This function currently supports either the
|
||||
* `VK_MVK_macos_surface` extension from MoltenVK or `VK_EXT_metal_surface`
|
||||
* extension.
|
||||
* @remark @macos GLFW currently supports both the `VK_MVK_macos_surface` and
|
||||
* the newer `VK_EXT_metal_surface` extensions.
|
||||
*
|
||||
* @pointer_lifetime The returned array is allocated and freed by GLFW. You
|
||||
* should not free it yourself. It is guaranteed to be valid only until the
|
||||
@ -5793,7 +5797,7 @@ GLFWAPI GLFWvkproc glfwGetInstanceProcAddress(VkInstance instance, const char* p
|
||||
* GLFW_API_UNAVAILABLE and @ref GLFW_PLATFORM_ERROR.
|
||||
*
|
||||
* @remark @macos This function currently always returns `GLFW_TRUE`, as the
|
||||
* `VK_MVK_macos_surface` extension does not provide
|
||||
* `VK_MVK_macos_surface` and `VK_EXT_metal_surface` extensions do not provide
|
||||
* a `vkGetPhysicalDevice*PresentationSupport` type function.
|
||||
*
|
||||
* @thread_safety This function may be called from any thread. For
|
||||
|
73
internal/glfw/glfw/include/GLFW/glfw3native.h
vendored
73
internal/glfw/glfw/include/GLFW/glfw3native.h
vendored
@ -83,8 +83,8 @@ extern "C" {
|
||||
|
||||
#if defined(GLFW_EXPOSE_NATIVE_WIN32) || defined(GLFW_EXPOSE_NATIVE_WGL)
|
||||
// This is a workaround for the fact that glfw3.h needs to export APIENTRY (for
|
||||
// example to allow applications to correctly declare a GL_ARB_debug_output
|
||||
// callback) but windows.h assumes no one will define APIENTRY before it does
|
||||
// example to allow applications to correctly declare a GL_KHR_debug callback)
|
||||
// but windows.h assumes no one will define APIENTRY before it does
|
||||
#if defined(GLFW_APIENTRY_DEFINED)
|
||||
#undef APIENTRY
|
||||
#undef GLFW_APIENTRY_DEFINED
|
||||
@ -132,6 +132,8 @@ extern "C" {
|
||||
* of the specified monitor, or `NULL` if an [error](@ref error_handling)
|
||||
* occurred.
|
||||
*
|
||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
|
||||
*
|
||||
* @thread_safety This function may be called from any thread. Access is not
|
||||
* synchronized.
|
||||
*
|
||||
@ -147,6 +149,8 @@ GLFWAPI const char* glfwGetWin32Adapter(GLFWmonitor* monitor);
|
||||
* `\\.\DISPLAY1\Monitor0`) of the specified monitor, or `NULL` if an
|
||||
* [error](@ref error_handling) occurred.
|
||||
*
|
||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
|
||||
*
|
||||
* @thread_safety This function may be called from any thread. Access is not
|
||||
* synchronized.
|
||||
*
|
||||
@ -161,6 +165,16 @@ GLFWAPI const char* glfwGetWin32Monitor(GLFWmonitor* monitor);
|
||||
* @return The `HWND` of the specified window, or `NULL` if an
|
||||
* [error](@ref error_handling) occurred.
|
||||
*
|
||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
|
||||
*
|
||||
* @remark The `HDC` associated with the window can be queried with the
|
||||
* [GetDC](https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-getdc)
|
||||
* function.
|
||||
* @code
|
||||
* HDC dc = GetDC(glfwGetWin32Window(window));
|
||||
* @endcode
|
||||
* This DC is private and does not need to be released.
|
||||
*
|
||||
* @thread_safety This function may be called from any thread. Access is not
|
||||
* synchronized.
|
||||
*
|
||||
@ -177,6 +191,17 @@ GLFWAPI HWND glfwGetWin32Window(GLFWwindow* window);
|
||||
* @return The `HGLRC` of the specified window, or `NULL` if an
|
||||
* [error](@ref error_handling) occurred.
|
||||
*
|
||||
* @errors Possible errors include @ref GLFW_NO_WINDOW_CONTEXT and @ref
|
||||
* GLFW_NOT_INITIALIZED.
|
||||
*
|
||||
* @remark The `HDC` associated with the window can be queried with the
|
||||
* [GetDC](https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-getdc)
|
||||
* function.
|
||||
* @code
|
||||
* HDC dc = GetDC(glfwGetWin32Window(window));
|
||||
* @endcode
|
||||
* This DC is private and does not need to be released.
|
||||
*
|
||||
* @thread_safety This function may be called from any thread. Access is not
|
||||
* synchronized.
|
||||
*
|
||||
@ -193,6 +218,8 @@ GLFWAPI HGLRC glfwGetWGLContext(GLFWwindow* window);
|
||||
* @return The `CGDirectDisplayID` of the specified monitor, or
|
||||
* `kCGNullDirectDisplay` if an [error](@ref error_handling) occurred.
|
||||
*
|
||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
|
||||
*
|
||||
* @thread_safety This function may be called from any thread. Access is not
|
||||
* synchronized.
|
||||
*
|
||||
@ -207,6 +234,8 @@ GLFWAPI CGDirectDisplayID glfwGetCocoaMonitor(GLFWmonitor* monitor);
|
||||
* @return The `NSWindow` of the specified window, or `nil` if an
|
||||
* [error](@ref error_handling) occurred.
|
||||
*
|
||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
|
||||
*
|
||||
* @thread_safety This function may be called from any thread. Access is not
|
||||
* synchronized.
|
||||
*
|
||||
@ -223,6 +252,9 @@ GLFWAPI id glfwGetCocoaWindow(GLFWwindow* window);
|
||||
* @return The `NSOpenGLContext` of the specified window, or `nil` if an
|
||||
* [error](@ref error_handling) occurred.
|
||||
*
|
||||
* @errors Possible errors include @ref GLFW_NO_WINDOW_CONTEXT and @ref
|
||||
* GLFW_NOT_INITIALIZED.
|
||||
*
|
||||
* @thread_safety This function may be called from any thread. Access is not
|
||||
* synchronized.
|
||||
*
|
||||
@ -239,6 +271,8 @@ GLFWAPI id glfwGetNSGLContext(GLFWwindow* window);
|
||||
* @return The `Display` used by GLFW, or `NULL` if an
|
||||
* [error](@ref error_handling) occurred.
|
||||
*
|
||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
|
||||
*
|
||||
* @thread_safety This function may be called from any thread. Access is not
|
||||
* synchronized.
|
||||
*
|
||||
@ -253,6 +287,8 @@ GLFWAPI Display* glfwGetX11Display(void);
|
||||
* @return The `RRCrtc` of the specified monitor, or `None` if an
|
||||
* [error](@ref error_handling) occurred.
|
||||
*
|
||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
|
||||
*
|
||||
* @thread_safety This function may be called from any thread. Access is not
|
||||
* synchronized.
|
||||
*
|
||||
@ -267,6 +303,8 @@ GLFWAPI RRCrtc glfwGetX11Adapter(GLFWmonitor* monitor);
|
||||
* @return The `RROutput` of the specified monitor, or `None` if an
|
||||
* [error](@ref error_handling) occurred.
|
||||
*
|
||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
|
||||
*
|
||||
* @thread_safety This function may be called from any thread. Access is not
|
||||
* synchronized.
|
||||
*
|
||||
@ -281,6 +319,8 @@ GLFWAPI RROutput glfwGetX11Monitor(GLFWmonitor* monitor);
|
||||
* @return The `Window` of the specified window, or `None` if an
|
||||
* [error](@ref error_handling) occurred.
|
||||
*
|
||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
|
||||
*
|
||||
* @thread_safety This function may be called from any thread. Access is not
|
||||
* synchronized.
|
||||
*
|
||||
@ -347,6 +387,9 @@ GLFWAPI const char* glfwGetX11SelectionString(void);
|
||||
* @return The `GLXContext` of the specified window, or `NULL` if an
|
||||
* [error](@ref error_handling) occurred.
|
||||
*
|
||||
* @errors Possible errors include @ref GLFW_NO_WINDOW_CONTEXT and @ref
|
||||
* GLFW_NOT_INITIALIZED.
|
||||
*
|
||||
* @thread_safety This function may be called from any thread. Access is not
|
||||
* synchronized.
|
||||
*
|
||||
@ -361,6 +404,9 @@ GLFWAPI GLXContext glfwGetGLXContext(GLFWwindow* window);
|
||||
* @return The `GLXWindow` of the specified window, or `None` if an
|
||||
* [error](@ref error_handling) occurred.
|
||||
*
|
||||
* @errors Possible errors include @ref GLFW_NO_WINDOW_CONTEXT and @ref
|
||||
* GLFW_NOT_INITIALIZED.
|
||||
*
|
||||
* @thread_safety This function may be called from any thread. Access is not
|
||||
* synchronized.
|
||||
*
|
||||
@ -377,6 +423,8 @@ GLFWAPI GLXWindow glfwGetGLXWindow(GLFWwindow* window);
|
||||
* @return The `struct wl_display*` used by GLFW, or `NULL` if an
|
||||
* [error](@ref error_handling) occurred.
|
||||
*
|
||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
|
||||
*
|
||||
* @thread_safety This function may be called from any thread. Access is not
|
||||
* synchronized.
|
||||
*
|
||||
@ -391,6 +439,8 @@ GLFWAPI struct wl_display* glfwGetWaylandDisplay(void);
|
||||
* @return The `struct wl_output*` of the specified monitor, or `NULL` if an
|
||||
* [error](@ref error_handling) occurred.
|
||||
*
|
||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
|
||||
*
|
||||
* @thread_safety This function may be called from any thread. Access is not
|
||||
* synchronized.
|
||||
*
|
||||
@ -405,6 +455,8 @@ GLFWAPI struct wl_output* glfwGetWaylandMonitor(GLFWmonitor* monitor);
|
||||
* @return The main `struct wl_surface*` of the specified window, or `NULL` if
|
||||
* an [error](@ref error_handling) occurred.
|
||||
*
|
||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
|
||||
*
|
||||
* @thread_safety This function may be called from any thread. Access is not
|
||||
* synchronized.
|
||||
*
|
||||
@ -421,6 +473,8 @@ GLFWAPI struct wl_surface* glfwGetWaylandWindow(GLFWwindow* window);
|
||||
* @return The `EGLDisplay` used by GLFW, or `EGL_NO_DISPLAY` if an
|
||||
* [error](@ref error_handling) occurred.
|
||||
*
|
||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
|
||||
*
|
||||
* @thread_safety This function may be called from any thread. Access is not
|
||||
* synchronized.
|
||||
*
|
||||
@ -435,6 +489,9 @@ GLFWAPI EGLDisplay glfwGetEGLDisplay(void);
|
||||
* @return The `EGLContext` of the specified window, or `EGL_NO_CONTEXT` if an
|
||||
* [error](@ref error_handling) occurred.
|
||||
*
|
||||
* @errors Possible errors include @ref GLFW_NO_WINDOW_CONTEXT and @ref
|
||||
* GLFW_NOT_INITIALIZED.
|
||||
*
|
||||
* @thread_safety This function may be called from any thread. Access is not
|
||||
* synchronized.
|
||||
*
|
||||
@ -449,6 +506,9 @@ GLFWAPI EGLContext glfwGetEGLContext(GLFWwindow* window);
|
||||
* @return The `EGLSurface` of the specified window, or `EGL_NO_SURFACE` if an
|
||||
* [error](@ref error_handling) occurred.
|
||||
*
|
||||
* @errors Possible errors include @ref GLFW_NO_WINDOW_CONTEXT and @ref
|
||||
* GLFW_NOT_INITIALIZED.
|
||||
*
|
||||
* @thread_safety This function may be called from any thread. Access is not
|
||||
* synchronized.
|
||||
*
|
||||
@ -472,6 +532,9 @@ GLFWAPI EGLSurface glfwGetEGLSurface(GLFWwindow* window);
|
||||
* @return `GLFW_TRUE` if successful, or `GLFW_FALSE` if an
|
||||
* [error](@ref error_handling) occurred.
|
||||
*
|
||||
* @errors Possible errors include @ref GLFW_NO_WINDOW_CONTEXT and @ref
|
||||
* GLFW_NOT_INITIALIZED.
|
||||
*
|
||||
* @thread_safety This function may be called from any thread. Access is not
|
||||
* synchronized.
|
||||
*
|
||||
@ -493,6 +556,9 @@ GLFWAPI int glfwGetOSMesaColorBuffer(GLFWwindow* window, int* width, int* height
|
||||
* @return `GLFW_TRUE` if successful, or `GLFW_FALSE` if an
|
||||
* [error](@ref error_handling) occurred.
|
||||
*
|
||||
* @errors Possible errors include @ref GLFW_NO_WINDOW_CONTEXT and @ref
|
||||
* GLFW_NOT_INITIALIZED.
|
||||
*
|
||||
* @thread_safety This function may be called from any thread. Access is not
|
||||
* synchronized.
|
||||
*
|
||||
@ -507,6 +573,9 @@ GLFWAPI int glfwGetOSMesaDepthBuffer(GLFWwindow* window, int* width, int* height
|
||||
* @return The `OSMesaContext` of the specified window, or `NULL` if an
|
||||
* [error](@ref error_handling) occurred.
|
||||
*
|
||||
* @errors Possible errors include @ref GLFW_NO_WINDOW_CONTEXT and @ref
|
||||
* GLFW_NOT_INITIALIZED.
|
||||
*
|
||||
* @thread_safety This function may be called from any thread. Access is not
|
||||
* synchronized.
|
||||
*
|
||||
|
10
internal/glfw/glfw/src/context.c
vendored
10
internal/glfw/glfw/src/context.c
vendored
@ -196,12 +196,6 @@ const _GLFWfbconfig* _glfwChooseFBConfig(const _GLFWfbconfig* desired,
|
||||
continue;
|
||||
}
|
||||
|
||||
if (desired->doublebuffer != current->doublebuffer)
|
||||
{
|
||||
// Double buffering is a hard constraint
|
||||
continue;
|
||||
}
|
||||
|
||||
// Count number of missing buffers
|
||||
{
|
||||
missing = 0;
|
||||
@ -570,7 +564,9 @@ GLFWbool _glfwRefreshContextAttribs(_GLFWwindow* window,
|
||||
PFNGLCLEARPROC glClear = (PFNGLCLEARPROC)
|
||||
window->context.getProcAddress("glClear");
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
window->context.swapBuffers(window);
|
||||
|
||||
if (window->doublebuffer)
|
||||
window->context.swapBuffers(window);
|
||||
}
|
||||
|
||||
glfwMakeContextCurrent((GLFWwindow*) previous);
|
||||
|
9
internal/glfw/glfw/src/egl_context.c
vendored
9
internal/glfw/glfw/src/egl_context.c
vendored
@ -173,7 +173,7 @@ static GLFWbool chooseEGLConfig(const _GLFWctxconfig* ctxconfig,
|
||||
u->stencilBits = getEGLConfigAttrib(n, EGL_STENCIL_SIZE);
|
||||
|
||||
u->samples = getEGLConfigAttrib(n, EGL_SAMPLES);
|
||||
u->doublebuffer = GLFW_TRUE;
|
||||
u->doublebuffer = desired->doublebuffer;
|
||||
|
||||
u->handle = (uintptr_t) n;
|
||||
usableCount++;
|
||||
@ -596,6 +596,9 @@ GLFWbool _glfwCreateContextEGL(_GLFWwindow* window,
|
||||
setAttrib(EGL_GL_COLORSPACE_KHR, EGL_GL_COLORSPACE_SRGB_KHR);
|
||||
}
|
||||
|
||||
if (!fbconfig->doublebuffer)
|
||||
setAttrib(EGL_RENDER_BUFFER, EGL_SINGLE_BUFFER);
|
||||
|
||||
setAttrib(EGL_NONE, EGL_NONE);
|
||||
|
||||
window->context.egl.surface =
|
||||
@ -762,7 +765,7 @@ GLFWAPI EGLContext glfwGetEGLContext(GLFWwindow* handle)
|
||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||
_GLFW_REQUIRE_INIT_OR_RETURN(EGL_NO_CONTEXT);
|
||||
|
||||
if (window->context.client == GLFW_NO_API)
|
||||
if (window->context.source != GLFW_EGL_CONTEXT_API)
|
||||
{
|
||||
_glfwInputError(GLFW_NO_WINDOW_CONTEXT, NULL);
|
||||
return EGL_NO_CONTEXT;
|
||||
@ -776,7 +779,7 @@ GLFWAPI EGLSurface glfwGetEGLSurface(GLFWwindow* handle)
|
||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||
_GLFW_REQUIRE_INIT_OR_RETURN(EGL_NO_SURFACE);
|
||||
|
||||
if (window->context.client == GLFW_NO_API)
|
||||
if (window->context.source != GLFW_EGL_CONTEXT_API)
|
||||
{
|
||||
_glfwInputError(GLFW_NO_WINDOW_CONTEXT, NULL);
|
||||
return EGL_NO_SURFACE;
|
||||
|
4
internal/glfw/glfw/src/egl_context.h
vendored
4
internal/glfw/glfw/src/egl_context.h
vendored
@ -80,6 +80,8 @@ typedef struct wl_egl_window* EGLNativeWindowType;
|
||||
#define EGL_OPENGL_ES_API 0x30a0
|
||||
#define EGL_OPENGL_API 0x30a2
|
||||
#define EGL_NONE 0x3038
|
||||
#define EGL_RENDER_BUFFER 0x3086
|
||||
#define EGL_SINGLE_BUFFER 0x3085
|
||||
#define EGL_EXTENSIONS 0x3055
|
||||
#define EGL_CONTEXT_CLIENT_VERSION 0x3098
|
||||
#define EGL_NATIVE_VISUAL_ID 0x302e
|
||||
@ -162,7 +164,6 @@ typedef struct _GLFWcontextEGL
|
||||
EGLSurface surface;
|
||||
|
||||
void* client;
|
||||
|
||||
} _GLFWcontextEGL;
|
||||
|
||||
// EGL-specific global data
|
||||
@ -197,7 +198,6 @@ typedef struct _GLFWlibraryEGL
|
||||
PFN_eglSwapInterval SwapInterval;
|
||||
PFN_eglQueryString QueryString;
|
||||
PFN_eglGetProcAddress GetProcAddress;
|
||||
|
||||
} _GLFWlibraryEGL;
|
||||
|
||||
|
||||
|
26
internal/glfw/glfw/src/init.c
vendored
26
internal/glfw/glfw/src/init.c
vendored
@ -28,7 +28,6 @@
|
||||
//========================================================================
|
||||
|
||||
#include "internal.h"
|
||||
#include "mappings.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
@ -37,16 +36,15 @@
|
||||
#include <assert.h>
|
||||
|
||||
|
||||
// The global variables below comprise all mutable global data in GLFW
|
||||
//
|
||||
// Any other global variable is a bug
|
||||
// NOTE: The global variables below comprise all mutable global data in GLFW
|
||||
// Any other mutable global variable is a bug
|
||||
|
||||
// Global state shared between compilation units of GLFW
|
||||
// This contains all mutable state shared between compilation units of GLFW
|
||||
//
|
||||
_GLFWlibrary _glfw = { GLFW_FALSE };
|
||||
|
||||
// These are outside of _glfw so they can be used before initialization and
|
||||
// after termination
|
||||
// after termination without special handling when _glfw is cleared to zero
|
||||
//
|
||||
static _GLFWerror _glfwMainThreadError;
|
||||
static GLFWerrorfun _glfwErrorCallback;
|
||||
@ -245,24 +243,12 @@ GLFWAPI int glfwInit(void)
|
||||
|
||||
_glfwPlatformSetTls(&_glfw.errorSlot, &_glfwMainThreadError);
|
||||
|
||||
_glfwInitGamepadMappings();
|
||||
|
||||
_glfw.initialized = GLFW_TRUE;
|
||||
_glfw.timer.offset = _glfwPlatformGetTimerValue();
|
||||
|
||||
glfwDefaultWindowHints();
|
||||
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; _glfwDefaultMappings[i]; i++)
|
||||
{
|
||||
if (!glfwUpdateGamepadMappings(_glfwDefaultMappings[i]))
|
||||
{
|
||||
terminate();
|
||||
return GLFW_FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return GLFW_TRUE;
|
||||
}
|
||||
|
||||
|
39
internal/glfw/glfw/src/input.c
vendored
39
internal/glfw/glfw/src/input.c
vendored
@ -28,6 +28,7 @@
|
||||
//========================================================================
|
||||
|
||||
#include "internal.h"
|
||||
#include "mappings.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <float.h>
|
||||
@ -85,25 +86,13 @@ static _GLFWmapping* findValidMapping(const _GLFWjoystick* js)
|
||||
for (i = 0; i <= GLFW_GAMEPAD_BUTTON_LAST; i++)
|
||||
{
|
||||
if (!isValidElementForJoystick(mapping->buttons + i, js))
|
||||
{
|
||||
_glfwInputError(GLFW_INVALID_VALUE,
|
||||
"Invalid button in gamepad mapping %s (%s)",
|
||||
mapping->guid,
|
||||
mapping->name);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i <= GLFW_GAMEPAD_AXIS_LAST; i++)
|
||||
{
|
||||
if (!isValidElementForJoystick(mapping->axes + i, js))
|
||||
{
|
||||
_glfwInputError(GLFW_INVALID_VALUE,
|
||||
"Invalid axis in gamepad mapping %s (%s)",
|
||||
mapping->guid,
|
||||
mapping->name);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -408,6 +397,29 @@ void _glfwInputJoystickHat(_GLFWjoystick* js, int hat, char value)
|
||||
////// GLFW internal API //////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// Adds the built-in set of gamepad mappings
|
||||
//
|
||||
void _glfwInitGamepadMappings(void)
|
||||
{
|
||||
int jid;
|
||||
size_t i;
|
||||
const size_t count = sizeof(_glfwDefaultMappings) / sizeof(char*);
|
||||
_glfw.mappings = calloc(count, sizeof(_GLFWmapping));
|
||||
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
if (parseMapping(&_glfw.mappings[_glfw.mappingCount], _glfwDefaultMappings[i]))
|
||||
_glfw.mappingCount++;
|
||||
}
|
||||
|
||||
for (jid = 0; jid <= GLFW_JOYSTICK_LAST; jid++)
|
||||
{
|
||||
_GLFWjoystick* js = _glfw.joysticks + jid;
|
||||
if (js->present)
|
||||
js->mapping = findValidMapping(js);
|
||||
}
|
||||
}
|
||||
|
||||
// Returns an available joystick object with arrays and name allocated
|
||||
//
|
||||
_GLFWjoystick* _glfwAllocJoystick(const char* name,
|
||||
@ -430,7 +442,6 @@ _GLFWjoystick* _glfwAllocJoystick(const char* name,
|
||||
|
||||
js = _glfw.joysticks + jid;
|
||||
js->present = GLFW_TRUE;
|
||||
js->name = _glfw_strdup(name);
|
||||
js->axes = calloc(axisCount, sizeof(float));
|
||||
js->buttons = calloc(buttonCount + (size_t) hatCount * 4, 1);
|
||||
js->hats = calloc(hatCount, 1);
|
||||
@ -438,6 +449,7 @@ _GLFWjoystick* _glfwAllocJoystick(const char* name,
|
||||
js->buttonCount = buttonCount;
|
||||
js->hatCount = hatCount;
|
||||
|
||||
strncpy(js->name, name, sizeof(js->name) - 1);
|
||||
strncpy(js->guid, guid, sizeof(js->guid) - 1);
|
||||
js->mapping = findValidMapping(js);
|
||||
|
||||
@ -448,7 +460,6 @@ _GLFWjoystick* _glfwAllocJoystick(const char* name,
|
||||
//
|
||||
void _glfwFreeJoystick(_GLFWjoystick* js)
|
||||
{
|
||||
free(js->name);
|
||||
free(js->axes);
|
||||
free(js->buttons);
|
||||
free(js->hats);
|
||||
|
6
internal/glfw/glfw/src/internal.h
vendored
6
internal/glfw/glfw/src/internal.h
vendored
@ -375,6 +375,7 @@ struct _GLFWwindow
|
||||
GLFWbool focusOnShow;
|
||||
GLFWbool shouldClose;
|
||||
void* userPointer;
|
||||
GLFWbool doublebuffer;
|
||||
GLFWvidmode videoMode;
|
||||
_GLFWmonitor* monitor;
|
||||
_GLFWcursor* cursor;
|
||||
@ -423,7 +424,7 @@ struct _GLFWwindow
|
||||
//
|
||||
struct _GLFWmonitor
|
||||
{
|
||||
char* name;
|
||||
char name[128];
|
||||
void* userPointer;
|
||||
|
||||
// Physical dimensions in millimeters.
|
||||
@ -484,7 +485,7 @@ struct _GLFWjoystick
|
||||
int buttonCount;
|
||||
unsigned char* hats;
|
||||
int hatCount;
|
||||
char* name;
|
||||
char name[128];
|
||||
void* userPointer;
|
||||
char guid[33];
|
||||
_GLFWmapping* mapping;
|
||||
@ -760,6 +761,7 @@ void _glfwAllocGammaArrays(GLFWgammaramp* ramp, unsigned int size);
|
||||
void _glfwFreeGammaArrays(GLFWgammaramp* ramp);
|
||||
void _glfwSplitBPP(int bpp, int* red, int* green, int* blue);
|
||||
|
||||
void _glfwInitGamepadMappings(void);
|
||||
_GLFWjoystick* _glfwAllocJoystick(const char* name,
|
||||
const char* guid,
|
||||
int axisCount,
|
||||
|
1117
internal/glfw/glfw/src/mappings.h
vendored
1117
internal/glfw/glfw/src/mappings.h
vendored
File diff suppressed because it is too large
Load Diff
4
internal/glfw/glfw/src/monitor.c
vendored
4
internal/glfw/glfw/src/monitor.c
vendored
@ -170,8 +170,7 @@ _GLFWmonitor* _glfwAllocMonitor(const char* name, int widthMM, int heightMM)
|
||||
monitor->widthMM = widthMM;
|
||||
monitor->heightMM = heightMM;
|
||||
|
||||
if (name)
|
||||
monitor->name = _glfw_strdup(name);
|
||||
strncpy(monitor->name, name, sizeof(monitor->name) - 1);
|
||||
|
||||
return monitor;
|
||||
}
|
||||
@ -189,7 +188,6 @@ void _glfwFreeMonitor(_GLFWmonitor* monitor)
|
||||
_glfwFreeGammaArrays(&monitor->currentRamp);
|
||||
|
||||
free(monitor->modes);
|
||||
free(monitor->name);
|
||||
free(monitor);
|
||||
}
|
||||
|
||||
|
14
internal/glfw/glfw/src/osmesa_context.c
vendored
14
internal/glfw/glfw/src/osmesa_context.c
vendored
@ -302,6 +302,12 @@ GLFWAPI int glfwGetOSMesaColorBuffer(GLFWwindow* handle, int* width,
|
||||
|
||||
_GLFW_REQUIRE_INIT_OR_RETURN(GLFW_FALSE);
|
||||
|
||||
if (window->context.source != GLFW_OSMESA_CONTEXT_API)
|
||||
{
|
||||
_glfwInputError(GLFW_NO_WINDOW_CONTEXT, NULL);
|
||||
return GLFW_FALSE;
|
||||
}
|
||||
|
||||
if (!OSMesaGetColorBuffer(window->context.osmesa.handle,
|
||||
&mesaWidth, &mesaHeight,
|
||||
&mesaFormat, &mesaBuffer))
|
||||
@ -335,6 +341,12 @@ GLFWAPI int glfwGetOSMesaDepthBuffer(GLFWwindow* handle,
|
||||
|
||||
_GLFW_REQUIRE_INIT_OR_RETURN(GLFW_FALSE);
|
||||
|
||||
if (window->context.source != GLFW_OSMESA_CONTEXT_API)
|
||||
{
|
||||
_glfwInputError(GLFW_NO_WINDOW_CONTEXT, NULL);
|
||||
return GLFW_FALSE;
|
||||
}
|
||||
|
||||
if (!OSMesaGetDepthBuffer(window->context.osmesa.handle,
|
||||
&mesaWidth, &mesaHeight,
|
||||
&mesaBytes, &mesaBuffer))
|
||||
@ -361,7 +373,7 @@ GLFWAPI OSMesaContext glfwGetOSMesaContext(GLFWwindow* handle)
|
||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
||||
|
||||
if (window->context.client == GLFW_NO_API)
|
||||
if (window->context.source != GLFW_OSMESA_CONTEXT_API)
|
||||
{
|
||||
_glfwInputError(GLFW_NO_WINDOW_CONTEXT, NULL);
|
||||
return NULL;
|
||||
|
2
internal/glfw/glfw/src/osmesa_context.h
vendored
2
internal/glfw/glfw/src/osmesa_context.h
vendored
@ -66,7 +66,6 @@ typedef struct _GLFWcontextOSMesa
|
||||
int width;
|
||||
int height;
|
||||
void* buffer;
|
||||
|
||||
} _GLFWcontextOSMesa;
|
||||
|
||||
// OSMesa-specific global data
|
||||
@ -82,7 +81,6 @@ typedef struct _GLFWlibraryOSMesa
|
||||
PFN_OSMesaGetColorBuffer GetColorBuffer;
|
||||
PFN_OSMesaGetDepthBuffer GetDepthBuffer;
|
||||
PFN_OSMesaGetProcAddress GetProcAddress;
|
||||
|
||||
} _GLFWlibraryOSMesa;
|
||||
|
||||
|
||||
|
12
internal/glfw/glfw/src/wgl_context.c
vendored
12
internal/glfw/glfw/src/wgl_context.c
vendored
@ -165,6 +165,9 @@ static int choosePixelFormat(_GLFWwindow* window,
|
||||
if (findAttribValue(WGL_ACCELERATION_ARB) == WGL_NO_ACCELERATION_ARB)
|
||||
continue;
|
||||
|
||||
if (findAttribValue(WGL_DOUBLE_BUFFER_ARB) != fbconfig->doublebuffer)
|
||||
continue;
|
||||
|
||||
u->redBits = findAttribValue(WGL_RED_BITS_ARB);
|
||||
u->greenBits = findAttribValue(WGL_GREEN_BITS_ARB);
|
||||
u->blueBits = findAttribValue(WGL_BLUE_BITS_ARB);
|
||||
@ -182,8 +185,6 @@ static int choosePixelFormat(_GLFWwindow* window,
|
||||
|
||||
if (findAttribValue(WGL_STEREO_ARB))
|
||||
u->stereo = GLFW_TRUE;
|
||||
if (findAttribValue(WGL_DOUBLE_BUFFER_ARB))
|
||||
u->doublebuffer = GLFW_TRUE;
|
||||
|
||||
if (_glfw.wgl.ARB_multisample)
|
||||
u->samples = findAttribValue(WGL_SAMPLES_ARB);
|
||||
@ -239,6 +240,9 @@ static int choosePixelFormat(_GLFWwindow* window,
|
||||
if (pfd.iPixelType != PFD_TYPE_RGBA)
|
||||
continue;
|
||||
|
||||
if (!!(pfd.dwFlags & PFD_DOUBLEBUFFER) != fbconfig->doublebuffer)
|
||||
continue;
|
||||
|
||||
u->redBits = pfd.cRedBits;
|
||||
u->greenBits = pfd.cGreenBits;
|
||||
u->blueBits = pfd.cBlueBits;
|
||||
@ -256,8 +260,6 @@ static int choosePixelFormat(_GLFWwindow* window,
|
||||
|
||||
if (pfd.dwFlags & PFD_STEREO)
|
||||
u->stereo = GLFW_TRUE;
|
||||
if (pfd.dwFlags & PFD_DOUBLEBUFFER)
|
||||
u->doublebuffer = GLFW_TRUE;
|
||||
}
|
||||
|
||||
u->handle = pixelFormat;
|
||||
@ -785,7 +787,7 @@ GLFWAPI HGLRC glfwGetWGLContext(GLFWwindow* handle)
|
||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
||||
|
||||
if (window->context.client == GLFW_NO_API)
|
||||
if (window->context.source != GLFW_NATIVE_CONTEXT_API)
|
||||
{
|
||||
_glfwInputError(GLFW_NO_WINDOW_CONTEXT, NULL);
|
||||
return NULL;
|
||||
|
2
internal/glfw/glfw/src/wgl_context.h
vendored
2
internal/glfw/glfw/src/wgl_context.h
vendored
@ -115,7 +115,6 @@ typedef struct _GLFWcontextWGL
|
||||
HDC dc;
|
||||
HGLRC handle;
|
||||
int interval;
|
||||
|
||||
} _GLFWcontextWGL;
|
||||
|
||||
// WGL-specific global data
|
||||
@ -148,7 +147,6 @@ typedef struct _GLFWlibraryWGL
|
||||
GLFWbool ARB_create_context_robustness;
|
||||
GLFWbool ARB_create_context_no_error;
|
||||
GLFWbool ARB_context_flush_control;
|
||||
|
||||
} _GLFWlibraryWGL;
|
||||
|
||||
|
||||
|
16
internal/glfw/glfw/src/win32_init.c
vendored
16
internal/glfw/glfw/src/win32_init.c
vendored
@ -40,7 +40,7 @@ static const GUID _glfw_GUID_DEVINTERFACE_HID =
|
||||
#if defined(_GLFW_USE_HYBRID_HPG) || defined(_GLFW_USE_OPTIMUS_HPG)
|
||||
|
||||
#if defined(_GLFW_BUILD_DLL)
|
||||
#warning "These symbols must be exported by the executable and have no effect in a DLL"
|
||||
#pragma message("These symbols must be exported by the executable and have no effect in a DLL")
|
||||
#endif
|
||||
|
||||
// Executables (but not DLLs) exporting this symbol with this value will be
|
||||
@ -72,17 +72,6 @@ BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved)
|
||||
//
|
||||
static GLFWbool loadLibraries(void)
|
||||
{
|
||||
_glfw.win32.winmm.instance = LoadLibraryA("winmm.dll");
|
||||
if (!_glfw.win32.winmm.instance)
|
||||
{
|
||||
_glfwInputErrorWin32(GLFW_PLATFORM_ERROR,
|
||||
"Win32: Failed to load winmm.dll");
|
||||
return GLFW_FALSE;
|
||||
}
|
||||
|
||||
_glfw.win32.winmm.GetTime = (PFN_timeGetTime)
|
||||
GetProcAddress(_glfw.win32.winmm.instance, "timeGetTime");
|
||||
|
||||
_glfw.win32.user32.instance = LoadLibraryA("user32.dll");
|
||||
if (!_glfw.win32.user32.instance)
|
||||
{
|
||||
@ -180,9 +169,6 @@ static void freeLibraries(void)
|
||||
if (_glfw.win32.dinput8.instance)
|
||||
FreeLibrary(_glfw.win32.dinput8.instance);
|
||||
|
||||
if (_glfw.win32.winmm.instance)
|
||||
FreeLibrary(_glfw.win32.winmm.instance);
|
||||
|
||||
if (_glfw.win32.user32.instance)
|
||||
FreeLibrary(_glfw.win32.user32.instance);
|
||||
|
||||
|
1
internal/glfw/glfw/src/win32_joystick.h
vendored
1
internal/glfw/glfw/src/win32_joystick.h
vendored
@ -28,6 +28,7 @@
|
||||
#define _GLFW_PLATFORM_LIBRARY_JOYSTICK_STATE struct { int dummyLibraryJoystick; }
|
||||
|
||||
#define _GLFW_PLATFORM_MAPPING_NAME "Windows"
|
||||
#define GLFW_BUILD_WIN32_MAPPINGS
|
||||
|
||||
// Joystick element (axis, button or slider)
|
||||
//
|
||||
|
13
internal/glfw/glfw/src/win32_monitor.c
vendored
13
internal/glfw/glfw/src/win32_monitor.c
vendored
@ -318,8 +318,19 @@ void _glfwGetMonitorContentScaleWin32(HMONITOR handle, float* xscale, float* ysc
|
||||
{
|
||||
UINT xdpi, ydpi;
|
||||
|
||||
if (xscale)
|
||||
*xscale = 0.f;
|
||||
if (yscale)
|
||||
*yscale = 0.f;
|
||||
|
||||
if (IsWindows8Point1OrGreater())
|
||||
GetDpiForMonitor(handle, MDT_EFFECTIVE_DPI, &xdpi, &ydpi);
|
||||
{
|
||||
if (GetDpiForMonitor(handle, MDT_EFFECTIVE_DPI, &xdpi, &ydpi) != S_OK)
|
||||
{
|
||||
_glfwInputError(GLFW_PLATFORM_ERROR, "Win32: Failed to query monitor DPI");
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
const HDC dc = GetDC(NULL);
|
||||
|
21
internal/glfw/glfw/src/win32_platform.h
vendored
21
internal/glfw/glfw/src/win32_platform.h
vendored
@ -39,8 +39,8 @@
|
||||
#endif
|
||||
|
||||
// This is a workaround for the fact that glfw3.h needs to export APIENTRY (for
|
||||
// example to allow applications to correctly declare a GL_ARB_debug_output
|
||||
// callback) but windows.h assumes no one will define APIENTRY before it does
|
||||
// example to allow applications to correctly declare a GL_KHR_debug callback)
|
||||
// but windows.h assumes no one will define APIENTRY before it does
|
||||
#undef APIENTRY
|
||||
|
||||
// GLFW on Windows is Unicode only and does not work in MBCS mode
|
||||
@ -218,10 +218,6 @@ typedef enum
|
||||
#define DIDFT_OPTIONAL 0x80000000
|
||||
#endif
|
||||
|
||||
// winmm.dll function pointer typedefs
|
||||
typedef DWORD (WINAPI * PFN_timeGetTime)(void);
|
||||
#define timeGetTime _glfw.win32.winmm.GetTime
|
||||
|
||||
// xinput.dll function pointer typedefs
|
||||
typedef DWORD (WINAPI * PFN_XInputGetCapabilities)(DWORD,DWORD,XINPUT_CAPABILITIES*);
|
||||
typedef DWORD (WINAPI * PFN_XInputGetState)(DWORD,XINPUT_STATE*);
|
||||
@ -328,7 +324,6 @@ typedef struct _GLFWwindowWin32
|
||||
int lastCursorPosX, lastCursorPosY;
|
||||
// The last recevied high surrogate when decoding pairs of UTF-16 messages
|
||||
WCHAR highSurrogate;
|
||||
|
||||
} _GLFWwindowWin32;
|
||||
|
||||
// Win32-specific global data
|
||||
@ -351,11 +346,6 @@ typedef struct _GLFWlibraryWin32
|
||||
int rawInputSize;
|
||||
UINT mouseTrailSize;
|
||||
|
||||
struct {
|
||||
HINSTANCE instance;
|
||||
PFN_timeGetTime GetTime;
|
||||
} winmm;
|
||||
|
||||
struct {
|
||||
HINSTANCE instance;
|
||||
PFN_DirectInput8Create Create;
|
||||
@ -396,7 +386,6 @@ typedef struct _GLFWlibraryWin32
|
||||
HINSTANCE instance;
|
||||
PFN_RtlVerifyVersionInfo RtlVerifyVersionInfo_;
|
||||
} ntdll;
|
||||
|
||||
} _GLFWlibraryWin32;
|
||||
|
||||
// Win32-specific per-monitor data
|
||||
@ -411,7 +400,6 @@ typedef struct _GLFWmonitorWin32
|
||||
char publicDisplayName[32];
|
||||
GLFWbool modesPruned;
|
||||
GLFWbool modeChanged;
|
||||
|
||||
} _GLFWmonitorWin32;
|
||||
|
||||
// Win32-specific per-cursor data
|
||||
@ -419,16 +407,13 @@ typedef struct _GLFWmonitorWin32
|
||||
typedef struct _GLFWcursorWin32
|
||||
{
|
||||
HCURSOR handle;
|
||||
|
||||
} _GLFWcursorWin32;
|
||||
|
||||
// Win32-specific global timer data
|
||||
//
|
||||
typedef struct _GLFWtimerWin32
|
||||
{
|
||||
GLFWbool hasPC;
|
||||
uint64_t frequency;
|
||||
|
||||
} _GLFWtimerWin32;
|
||||
|
||||
// Win32-specific thread local storage data
|
||||
@ -437,7 +422,6 @@ typedef struct _GLFWtlsWin32
|
||||
{
|
||||
GLFWbool allocated;
|
||||
DWORD index;
|
||||
|
||||
} _GLFWtlsWin32;
|
||||
|
||||
// Win32-specific mutex data
|
||||
@ -446,7 +430,6 @@ typedef struct _GLFWmutexWin32
|
||||
{
|
||||
GLFWbool allocated;
|
||||
CRITICAL_SECTION section;
|
||||
|
||||
} _GLFWmutexWin32;
|
||||
|
||||
|
||||
|
24
internal/glfw/glfw/src/win32_time.c
vendored
24
internal/glfw/glfw/src/win32_time.c
vendored
@ -38,18 +38,7 @@
|
||||
//
|
||||
void _glfwInitTimerWin32(void)
|
||||
{
|
||||
uint64_t frequency;
|
||||
|
||||
if (QueryPerformanceFrequency((LARGE_INTEGER*) &frequency))
|
||||
{
|
||||
_glfw.timer.win32.hasPC = GLFW_TRUE;
|
||||
_glfw.timer.win32.frequency = frequency;
|
||||
}
|
||||
else
|
||||
{
|
||||
_glfw.timer.win32.hasPC = GLFW_FALSE;
|
||||
_glfw.timer.win32.frequency = 1000;
|
||||
}
|
||||
QueryPerformanceFrequency((LARGE_INTEGER*) &_glfw.timer.win32.frequency);
|
||||
}
|
||||
|
||||
|
||||
@ -59,14 +48,9 @@ void _glfwInitTimerWin32(void)
|
||||
|
||||
uint64_t _glfwPlatformGetTimerValue(void)
|
||||
{
|
||||
if (_glfw.timer.win32.hasPC)
|
||||
{
|
||||
uint64_t value;
|
||||
QueryPerformanceCounter((LARGE_INTEGER*) &value);
|
||||
return value;
|
||||
}
|
||||
else
|
||||
return (uint64_t) timeGetTime();
|
||||
uint64_t value;
|
||||
QueryPerformanceCounter((LARGE_INTEGER*) &value);
|
||||
return value;
|
||||
}
|
||||
|
||||
uint64_t _glfwPlatformGetTimerFrequency(void)
|
||||
|
10
internal/glfw/glfw/src/win32_window.c
vendored
10
internal/glfw/glfw/src/win32_window.c
vendored
@ -1297,8 +1297,12 @@ static int createNativeWindow(_GLFWwindow* window,
|
||||
{
|
||||
float xscale, yscale;
|
||||
_glfwPlatformGetWindowContentScale(window, &xscale, &yscale);
|
||||
rect.right = (int) (rect.right * xscale);
|
||||
rect.bottom = (int) (rect.bottom * yscale);
|
||||
|
||||
if (xscale > 0.f && yscale > 0.f)
|
||||
{
|
||||
rect.right = (int) (rect.right * xscale);
|
||||
rect.bottom = (int) (rect.bottom * yscale);
|
||||
}
|
||||
}
|
||||
|
||||
ClientToScreen(window->win32.handle, (POINT*) &rect.left);
|
||||
@ -2067,7 +2071,7 @@ const char* _glfwPlatformGetScancodeName(int scancode)
|
||||
if (scancode < 0 || scancode > (KF_EXTENDED | 0xff) ||
|
||||
_glfw.win32.keycodes[scancode] == GLFW_KEY_UNKNOWN)
|
||||
{
|
||||
_glfwInputError(GLFW_INVALID_VALUE, "Invalid scancode");
|
||||
_glfwInputError(GLFW_INVALID_VALUE, "Invalid scancode %i", scancode);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
2
internal/glfw/glfw/src/window.c
vendored
2
internal/glfw/glfw/src/window.c
vendored
@ -205,6 +205,8 @@ GLFWAPI GLFWwindow* glfwCreateWindow(int width, int height,
|
||||
window->focusOnShow = wndconfig.focusOnShow;
|
||||
window->cursorMode = GLFW_CURSOR_NORMAL;
|
||||
|
||||
window->doublebuffer = fbconfig.doublebuffer;
|
||||
|
||||
window->minwidth = GLFW_DONT_CARE;
|
||||
window->minheight = GLFW_DONT_CARE;
|
||||
window->maxwidth = GLFW_DONT_CARE;
|
||||
|
7
internal/glfw/glfw/update.sh
vendored
Executable file
7
internal/glfw/glfw/update.sh
vendored
Executable file
@ -0,0 +1,7 @@
|
||||
set -e
|
||||
|
||||
dir=$(go list -f '{{.Dir}}' github.com/go-gl/glfw/v3.3/glfw)/glfw
|
||||
ls ./deps/mingw | xargs -I '{}' cp $dir/deps/mingw/'{}' ./deps/mingw/'{}'
|
||||
ls ./include/GLFW | xargs -I '{}' cp $dir/include/GLFW/'{}' ./include/GLFW/'{}'
|
||||
ls ./src | xargs -I '{}' cp $dir/src/'{}' ./src/'{}'
|
||||
echo 'Apply the change based on README.md later.'
|
Binary file not shown.
Binary file not shown.
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -5,4 +5,4 @@
|
||||
|
||||
package glfw
|
||||
|
||||
const glfwDLLHash = "9b66cd40f92263367f0076b690cb90174cc981f0c126eb395bc4e35cd8cb767d"
|
||||
const glfwDLLHash = "ad5f2451f6d4fe11bccda498dad4e6ba1522a84c51d78e9003e99b4cff3807ea"
|
||||
|
@ -5,4 +5,4 @@
|
||||
|
||||
package glfw
|
||||
|
||||
const glfwDLLHash = "654e301e14362491530e1c9e2dde434d96eb5c6b11de42af62d85d9cc170f4d8"
|
||||
const glfwDLLHash = "6dd83fa958939315d474392aebac5fd1708d6cfb6b3d5cc6d9e43f35a3243f58"
|
||||
|
Loading…
Reference in New Issue
Block a user