mirror of
https://github.com/glfw/glfw.git
synced 2026-09-18 22:55:46 +00:00
Compare commits
16 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 7d5a16ce71 | |||
| a69648e192 | |||
| e10def6de7 | |||
| 84c881c1a8 | |||
| 18d7c241f8 | |||
| 6281424988 | |||
| 81d762bf66 | |||
| 486724c433 | |||
| 55528e9178 | |||
| 689840f2eb | |||
| c59092619a | |||
| bfd9eaf092 | |||
| 6902435005 | |||
| 6eb24a49df | |||
| bec6e7565b | |||
| 19543afbfb |
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
cmake_minimum_required(VERSION 3.0...3.20 FATAL_ERROR)
|
cmake_minimum_required(VERSION 3.0...3.20 FATAL_ERROR)
|
||||||
|
|
||||||
project(GLFW VERSION 3.3.5 LANGUAGES C)
|
project(GLFW VERSION 3.3.6 LANGUAGES C)
|
||||||
|
|
||||||
set(CMAKE_LEGACY_CYGWIN_WIN32 OFF)
|
set(CMAKE_LEGACY_CYGWIN_WIN32 OFF)
|
||||||
|
|
||||||
|
|||||||
@@ -53,6 +53,7 @@ video tutorials.
|
|||||||
- Ralph Eastwood
|
- Ralph Eastwood
|
||||||
- Fredrik Ehnbom
|
- Fredrik Ehnbom
|
||||||
- Robin Eklind
|
- Robin Eklind
|
||||||
|
- Jan Ekström
|
||||||
- Siavash Eliasi
|
- Siavash Eliasi
|
||||||
- TheExileFox
|
- TheExileFox
|
||||||
- Felipe Ferreira
|
- Felipe Ferreira
|
||||||
@@ -61,12 +62,15 @@ video tutorials.
|
|||||||
- Mário Freitas
|
- Mário Freitas
|
||||||
- GeO4d
|
- GeO4d
|
||||||
- Marcus Geelnard
|
- Marcus Geelnard
|
||||||
|
- ghuser404
|
||||||
- Charles Giessen
|
- Charles Giessen
|
||||||
- Ryan C. Gordon
|
- Ryan C. Gordon
|
||||||
- Stephen Gowen
|
- Stephen Gowen
|
||||||
- Kovid Goyal
|
- Kovid Goyal
|
||||||
- Eloi Marín Gratacós
|
- Eloi Marín Gratacós
|
||||||
- Stefan Gustavson
|
- Stefan Gustavson
|
||||||
|
- Andrew Gutekanst
|
||||||
|
- Stephen Gutekanst
|
||||||
- Jonathan Hale
|
- Jonathan Hale
|
||||||
- hdf89shfdfs
|
- hdf89shfdfs
|
||||||
- Sylvain Hellegouarch
|
- Sylvain Hellegouarch
|
||||||
@@ -76,6 +80,7 @@ video tutorials.
|
|||||||
- Paul Holden
|
- Paul Holden
|
||||||
- Warren Hu
|
- Warren Hu
|
||||||
- Charles Huber
|
- Charles Huber
|
||||||
|
- InKryption
|
||||||
- IntellectualKitty
|
- IntellectualKitty
|
||||||
- Aaron Jacobs
|
- Aaron Jacobs
|
||||||
- Erik S. V. Jansson
|
- Erik S. V. Jansson
|
||||||
@@ -208,6 +213,7 @@ video tutorials.
|
|||||||
- Richard A. Wilkes
|
- Richard A. Wilkes
|
||||||
- Tatsuya Yatagawa
|
- Tatsuya Yatagawa
|
||||||
- Ryogo Yoshimura
|
- Ryogo Yoshimura
|
||||||
|
- Rácz Zalán
|
||||||
- Lukas Zanner
|
- Lukas Zanner
|
||||||
- Andrey Zholos
|
- Andrey Zholos
|
||||||
- Aihui Zhu
|
- Aihui Zhu
|
||||||
|
|||||||
@@ -123,26 +123,14 @@ information on what to include when reporting a bug.
|
|||||||
|
|
||||||
## Changelog
|
## Changelog
|
||||||
|
|
||||||
- Updated gamepad mappings from upstream
|
- Bugfix: Joysticks connected before init did not get gamepad mappings (#1996)
|
||||||
- Bugfix: Buffers were swapped at creation on single-buffered windows (#1873)
|
- [Win32] Bugfix: Content scale queries could fail silently (#1615)
|
||||||
- Bugfix: Gamepad mapping updates could spam `GLFW_INVALID_VALUE` due to
|
- [Win32] Bugfix: Content scales could have garbage values if monitor was recently
|
||||||
incompatible controllers sharing hardware ID (#1763)
|
disconnected (#1615)
|
||||||
- Bugfix: Native access functions for context handles did not check that the API matched
|
- [Cocoa] Bugfix: A dependency on an external constant caused crashes on macOS
|
||||||
- [Win32] Bugfix: `USE_MSVC_RUNTIME_LIBRARY_DLL` had no effect on CMake 3.15 or
|
11 and earlier (#1985,#1994)
|
||||||
later (#1783,#1796)
|
- [X11] Bugfix: Icon pixel format conversion worked only by accident, relying on
|
||||||
- [Win32] Bugfix: Compilation with LLVM for Windows failed (#1807,#1824,#1874)
|
undefined behavior (#1986)
|
||||||
- [Cocoa] Bugfix: The MoltenVK layer contents scale was updated only after
|
|
||||||
related events were emitted
|
|
||||||
- [Cocoa] Bugfix: Moving the cursor programmatically would freeze it for
|
|
||||||
a fraction of a second (#1962)
|
|
||||||
- [Cocoa] Bugfix: `kIOMasterPortDefault` was deprecated in macOS 12.0 (#1980)
|
|
||||||
- [X11] Bugfix: Changing `GLFW_FLOATING` could leak memory
|
|
||||||
- [Wayland] Bugfix: Some keys were not repeating in Wayland (#1908)
|
|
||||||
- [Wayland] Bugfix: Non-arrow cursors are offset from the hotspot (#1706,#1899)
|
|
||||||
- [Wayland] Bugfix: The `O_CLOEXEC` flag was not defined on FreeBSD
|
|
||||||
- [NSGL] Bugfix: Defining `GL_SILENCE_DEPRECATION` externally caused
|
|
||||||
a duplicate definition warning (#1840)
|
|
||||||
- [EGL] Bugfix: The `GLFW_DOUBLEBUFFER` context attribute was ignored (#1843)
|
|
||||||
|
|
||||||
|
|
||||||
## Contact
|
## Contact
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
// This is an example program for the GLFW library
|
// This is an example program for the GLFW library
|
||||||
//
|
//
|
||||||
// The program uses a "split window" view, rendering four views of the
|
// The program uses a "split window" view, rendering four views of the
|
||||||
// same scene in one window (e.g. uesful for 3D modelling software). This
|
// same scene in one window (e.g. useful for 3D modelling software). This
|
||||||
// demo uses scissors to separate the four different rendering areas from
|
// demo uses scissors to separate the four different rendering areas from
|
||||||
// each other.
|
// each other.
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -299,7 +299,7 @@ extern "C" {
|
|||||||
* release is made that does not contain any API changes.
|
* release is made that does not contain any API changes.
|
||||||
* @ingroup init
|
* @ingroup init
|
||||||
*/
|
*/
|
||||||
#define GLFW_VERSION_REVISION 5
|
#define GLFW_VERSION_REVISION 6
|
||||||
/*! @} */
|
/*! @} */
|
||||||
|
|
||||||
/*! @brief One.
|
/*! @brief One.
|
||||||
@@ -960,7 +960,7 @@ extern "C" {
|
|||||||
* and [attribute](@ref GLFW_CONTEXT_VERSION_MINOR_attrib).
|
* and [attribute](@ref GLFW_CONTEXT_VERSION_MINOR_attrib).
|
||||||
*/
|
*/
|
||||||
#define GLFW_CONTEXT_VERSION_MINOR 0x00022003
|
#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
|
* Context client API revision number
|
||||||
* [attribute](@ref GLFW_CONTEXT_REVISION_attrib).
|
* [attribute](@ref GLFW_CONTEXT_REVISION_attrib).
|
||||||
@@ -5227,6 +5227,8 @@ GLFWAPI int glfwUpdateGamepadMappings(const char* string);
|
|||||||
* joystick is not present, does not have a mapping or an
|
* joystick is not present, does not have a mapping or an
|
||||||
* [error](@ref error_handling) occurred.
|
* [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
|
* @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
|
* should not free it yourself. It is valid until the specified joystick is
|
||||||
* disconnected, the gamepad mappings are updated or the library is terminated.
|
* disconnected, the gamepad mappings are updated or the library is terminated.
|
||||||
@@ -5316,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`
|
* @return The contents of the clipboard as a UTF-8 encoded string, or `NULL`
|
||||||
* if an [error](@ref error_handling) occurred.
|
* if an [error](@ref error_handling) occurred.
|
||||||
*
|
*
|
||||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
|
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
|
||||||
* GLFW_PLATFORM_ERROR.
|
* GLFW_FORMAT_UNAVAILABLE and @ref GLFW_PLATFORM_ERROR.
|
||||||
*
|
*
|
||||||
* @pointer_lifetime The returned string is allocated and freed by GLFW. You
|
* @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
|
* should not free it yourself. It is valid until the next call to @ref
|
||||||
|
|||||||
+2
-2
@@ -58,7 +58,7 @@ static char* getMonitorName(CGDirectDisplayID displayID, NSScreen* screen)
|
|||||||
io_service_t service;
|
io_service_t service;
|
||||||
CFDictionaryRef info;
|
CFDictionaryRef info;
|
||||||
|
|
||||||
if (IOServiceGetMatchingServices(kIOMainPortDefault,
|
if (IOServiceGetMatchingServices(MACH_PORT_NULL,
|
||||||
IOServiceMatching("IODisplayConnect"),
|
IOServiceMatching("IODisplayConnect"),
|
||||||
&it) != 0)
|
&it) != 0)
|
||||||
{
|
{
|
||||||
@@ -231,7 +231,7 @@ static double getFallbackRefreshRate(CGDirectDisplayID displayID)
|
|||||||
io_iterator_t it;
|
io_iterator_t it;
|
||||||
io_service_t service;
|
io_service_t service;
|
||||||
|
|
||||||
if (IOServiceGetMatchingServices(kIOMainPortDefault,
|
if (IOServiceGetMatchingServices(MACH_PORT_NULL,
|
||||||
IOServiceMatching("IOFramebuffer"),
|
IOServiceMatching("IOFramebuffer"),
|
||||||
&it) != 0)
|
&it) != 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -41,13 +41,6 @@
|
|||||||
typedef void* id;
|
typedef void* id;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// NOTE: Many Cocoa enum values have been renamed and we need to build across
|
|
||||||
// SDK versions where one is unavailable or the other deprecated
|
|
||||||
// We use the newer names in code and these macros to handle compatibility
|
|
||||||
#if MAC_OS_X_VERSION_MAX_ALLOWED < 120000
|
|
||||||
#define kIOMainPortDefault kIOMasterPortDefault
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// NOTE: Many Cocoa enum values have been renamed and we need to build across
|
// NOTE: Many Cocoa enum values have been renamed and we need to build across
|
||||||
// SDK versions where one is unavailable or the other deprecated
|
// SDK versions where one is unavailable or the other deprecated
|
||||||
// We use the newer names in code and these macros to handle compatibility
|
// We use the newer names in code and these macros to handle compatibility
|
||||||
|
|||||||
+4
-5
@@ -36,16 +36,15 @@
|
|||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
|
|
||||||
// The global variables below comprise all mutable global data in GLFW
|
// NOTE: The global variables below comprise all mutable global data in GLFW
|
||||||
//
|
// Any other mutable global variable is a bug
|
||||||
// Any other 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 };
|
_GLFWlibrary _glfw = { GLFW_FALSE };
|
||||||
|
|
||||||
// These are outside of _glfw so they can be used before initialization and
|
// 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 _GLFWerror _glfwMainThreadError;
|
||||||
static GLFWerrorfun _glfwErrorCallback;
|
static GLFWerrorfun _glfwErrorCallback;
|
||||||
|
|||||||
@@ -401,6 +401,7 @@ void _glfwInputJoystickHat(_GLFWjoystick* js, int hat, char value)
|
|||||||
//
|
//
|
||||||
void _glfwInitGamepadMappings(void)
|
void _glfwInitGamepadMappings(void)
|
||||||
{
|
{
|
||||||
|
int jid;
|
||||||
size_t i;
|
size_t i;
|
||||||
const size_t count = sizeof(_glfwDefaultMappings) / sizeof(char*);
|
const size_t count = sizeof(_glfwDefaultMappings) / sizeof(char*);
|
||||||
_glfw.mappings = calloc(count, sizeof(_GLFWmapping));
|
_glfw.mappings = calloc(count, sizeof(_GLFWmapping));
|
||||||
@@ -410,6 +411,13 @@ void _glfwInitGamepadMappings(void)
|
|||||||
if (parseMapping(&_glfw.mappings[_glfw.mappingCount], _glfwDefaultMappings[i]))
|
if (parseMapping(&_glfw.mappings[_glfw.mappingCount], _glfwDefaultMappings[i]))
|
||||||
_glfw.mappingCount++;
|
_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
|
// Returns an available joystick object with arrays and name allocated
|
||||||
|
|||||||
+12
-1
@@ -318,8 +318,19 @@ void _glfwGetMonitorContentScaleWin32(HMONITOR handle, float* xscale, float* ysc
|
|||||||
{
|
{
|
||||||
UINT xdpi, ydpi;
|
UINT xdpi, ydpi;
|
||||||
|
|
||||||
|
if (xscale)
|
||||||
|
*xscale = 0.f;
|
||||||
|
if (yscale)
|
||||||
|
*yscale = 0.f;
|
||||||
|
|
||||||
if (IsWindows8Point1OrGreater())
|
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
|
else
|
||||||
{
|
{
|
||||||
const HDC dc = GetDC(NULL);
|
const HDC dc = GetDC(NULL);
|
||||||
|
|||||||
+6
-2
@@ -1297,8 +1297,12 @@ static int createNativeWindow(_GLFWwindow* window,
|
|||||||
{
|
{
|
||||||
float xscale, yscale;
|
float xscale, yscale;
|
||||||
_glfwPlatformGetWindowContentScale(window, &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);
|
ClientToScreen(window->win32.handle, (POINT*) &rect.left);
|
||||||
|
|||||||
+12
-6
@@ -2123,8 +2123,8 @@ void _glfwPlatformSetWindowIcon(_GLFWwindow* window,
|
|||||||
for (i = 0; i < count; i++)
|
for (i = 0; i < count; i++)
|
||||||
longCount += 2 + images[i].width * images[i].height;
|
longCount += 2 + images[i].width * images[i].height;
|
||||||
|
|
||||||
long* icon = calloc(longCount, sizeof(long));
|
unsigned long* icon = calloc(longCount, sizeof(unsigned long));
|
||||||
long* target = icon;
|
unsigned long* target = icon;
|
||||||
|
|
||||||
for (i = 0; i < count; i++)
|
for (i = 0; i < count; i++)
|
||||||
{
|
{
|
||||||
@@ -2133,13 +2133,19 @@ void _glfwPlatformSetWindowIcon(_GLFWwindow* window,
|
|||||||
|
|
||||||
for (j = 0; j < images[i].width * images[i].height; j++)
|
for (j = 0; j < images[i].width * images[i].height; j++)
|
||||||
{
|
{
|
||||||
*target++ = (images[i].pixels[j * 4 + 0] << 16) |
|
*target++ = (((unsigned long) images[i].pixels[j * 4 + 0]) << 16) |
|
||||||
(images[i].pixels[j * 4 + 1] << 8) |
|
(((unsigned long) images[i].pixels[j * 4 + 1]) << 8) |
|
||||||
(images[i].pixels[j * 4 + 2] << 0) |
|
(((unsigned long) images[i].pixels[j * 4 + 2]) << 0) |
|
||||||
(images[i].pixels[j * 4 + 3] << 24);
|
(((unsigned long) images[i].pixels[j * 4 + 3]) << 24);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NOTE: XChangeProperty expects 32-bit values like the image data above to be
|
||||||
|
// placed in the 32 least significant bits of individual longs. This is
|
||||||
|
// true even if long is 64-bit and a WM protocol calls for "packed" data.
|
||||||
|
// This is because of a historical mistake that then became part of the Xlib
|
||||||
|
// ABI. Xlib will pack these values into a regular array of 32-bit values
|
||||||
|
// before sending it over the wire.
|
||||||
XChangeProperty(_glfw.x11.display, window->x11.handle,
|
XChangeProperty(_glfw.x11.display, window->x11.handle,
|
||||||
_glfw.x11.NET_WM_ICON,
|
_glfw.x11.NET_WM_ICON,
|
||||||
XA_CARDINAL, 32,
|
XA_CARDINAL, 32,
|
||||||
|
|||||||
Reference in New Issue
Block a user