Update GLFW to latest version #1817

This commit is contained in:
Ray 2021-06-08 21:02:24 +02:00
parent 76a907bb79
commit 97b074ac26
27 changed files with 699 additions and 1073 deletions

View file

@ -41,10 +41,6 @@ cmake_dependent_option(GLFW_USE_WAYLAND "Use Wayland for window creation" OFF
cmake_dependent_option(USE_MSVC_RUNTIME_LIBRARY_DLL "Use MSVC runtime library DLL" ON cmake_dependent_option(USE_MSVC_RUNTIME_LIBRARY_DLL "Use MSVC runtime library DLL" ON
"MSVC" OFF) "MSVC" OFF)
if (BUILD_SHARED_LIBS)
set(_GLFW_BUILD_DLL 1)
endif()
if (BUILD_SHARED_LIBS AND UNIX) if (BUILD_SHARED_LIBS AND UNIX)
# On Unix-like systems, shared libraries can use the soname system. # On Unix-like systems, shared libraries can use the soname system.
set(GLFW_LIB_NAME glfw) set(GLFW_LIB_NAME glfw)
@ -73,19 +69,8 @@ endif()
#-------------------------------------------------------------------- #--------------------------------------------------------------------
# Set compiler specific flags # Set compiler specific flags
#-------------------------------------------------------------------- #--------------------------------------------------------------------
if (MSVC) if (MSVC AND NOT USE_MSVC_RUNTIME_LIBRARY_DLL)
if (MSVC90) if (${CMAKE_VERSION} VERSION_LESS 3.15)
# Workaround for VS 2008 not shipping with the DirectX 9 SDK
include(CheckIncludeFile)
check_include_file(dinput.h DINPUT_H_FOUND)
if (NOT DINPUT_H_FOUND)
message(FATAL_ERROR "DirectX 9 headers not found; install DirectX 9 SDK")
endif()
# Workaround for VS 2008 not shipping with stdint.h
list(APPEND glfw_INCLUDE_DIRS "${GLFW_SOURCE_DIR}/deps/vs2008")
endif()
if (NOT USE_MSVC_RUNTIME_LIBRARY_DLL)
foreach (flag CMAKE_C_FLAGS foreach (flag CMAKE_C_FLAGS
CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_DEBUG
CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS_RELEASE
@ -100,41 +85,8 @@ if (MSVC)
endif() endif()
endforeach() endforeach()
endif() else()
endif() set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
if (MINGW)
# Workaround for legacy MinGW not providing XInput and DirectInput
include(CheckIncludeFile)
check_include_file(dinput.h DINPUT_H_FOUND)
check_include_file(xinput.h XINPUT_H_FOUND)
if (NOT DINPUT_H_FOUND OR NOT XINPUT_H_FOUND)
list(APPEND glfw_INCLUDE_DIRS "${GLFW_SOURCE_DIR}/deps/mingw")
endif()
# Enable link-time exploit mitigation features enabled by default on MSVC
include(CheckCCompilerFlag)
# Compatibility with data execution prevention (DEP)
set(CMAKE_REQUIRED_FLAGS "-Wl,--nxcompat")
check_c_compiler_flag("" _GLFW_HAS_DEP)
if (_GLFW_HAS_DEP)
set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--nxcompat ${CMAKE_SHARED_LINKER_FLAGS}")
endif()
# Compatibility with address space layout randomization (ASLR)
set(CMAKE_REQUIRED_FLAGS "-Wl,--dynamicbase")
check_c_compiler_flag("" _GLFW_HAS_ASLR)
if (_GLFW_HAS_ASLR)
set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--dynamicbase ${CMAKE_SHARED_LINKER_FLAGS}")
endif()
# Compatibility with 64-bit address space layout randomization (ASLR)
set(CMAKE_REQUIRED_FLAGS "-Wl,--high-entropy-va")
check_c_compiler_flag("" _GLFW_HAS_64ASLR)
if (_GLFW_HAS_64ASLR)
set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--high-entropy-va ${CMAKE_SHARED_LINKER_FLAGS}")
endif() endif()
endif() endif()
@ -203,11 +155,8 @@ if (_GLFW_X11)
find_package(X11 REQUIRED) find_package(X11 REQUIRED)
list(APPEND glfw_PKG_DEPS "x11")
# Set up library and include paths # Set up library and include paths
list(APPEND glfw_INCLUDE_DIRS "${X11_X11_INCLUDE_PATH}") list(APPEND glfw_INCLUDE_DIRS "${X11_X11_INCLUDE_PATH}")
list(APPEND glfw_LIBRARIES "${X11_X11_LIB}" "${CMAKE_THREAD_LIBS_INIT}")
# Check for XRandR (modern resolution switching and gamma control) # Check for XRandR (modern resolution switching and gamma control)
if (NOT X11_Xrandr_INCLUDE_PATH) if (NOT X11_Xrandr_INCLUDE_PATH)
@ -238,32 +187,24 @@ if (_GLFW_X11)
if (NOT X11_Xshape_INCLUDE_PATH) if (NOT X11_Xshape_INCLUDE_PATH)
message(FATAL_ERROR "X Shape headers not found; install libxext development package") message(FATAL_ERROR "X Shape headers not found; install libxext development package")
endif() endif()
list(APPEND glfw_INCLUDE_DIRS "${X11_Xrandr_INCLUDE_PATH}"
"${X11_Xinerama_INCLUDE_PATH}"
"${X11_Xkb_INCLUDE_PATH}"
"${X11_Xcursor_INCLUDE_PATH}"
"${X11_Xi_INCLUDE_PATH}")
endif() endif()
#-------------------------------------------------------------------- #--------------------------------------------------------------------
# Use Wayland for window creation # Use Wayland for window creation
#-------------------------------------------------------------------- #--------------------------------------------------------------------
if (_GLFW_WAYLAND) if (_GLFW_WAYLAND)
find_package(ECM REQUIRED NO_MODULE)
list(APPEND CMAKE_MODULE_PATH "${ECM_MODULE_PATH}")
find_package(Wayland REQUIRED Client Cursor Egl) include(FindPkgConfig)
find_package(WaylandScanner REQUIRED) pkg_check_modules(Wayland REQUIRED
find_package(WaylandProtocols 1.15 REQUIRED) wayland-client>=0.2.7
wayland-cursor>=0.2.7
wayland-egl>=0.2.7
xkbcommon)
list(APPEND glfw_PKG_DEPS "wayland-egl") list(APPEND glfw_PKG_DEPS "wayland-client")
list(APPEND glfw_INCLUDE_DIRS "${Wayland_INCLUDE_DIRS}") list(APPEND glfw_INCLUDE_DIRS "${Wayland_INCLUDE_DIRS}")
list(APPEND glfw_LIBRARIES "${Wayland_LIBRARIES}" "${CMAKE_THREAD_LIBS_INIT}") list(APPEND glfw_LIBRARIES "${Wayland_LINK_LIBRARIES}")
find_package(XKBCommon REQUIRED)
list(APPEND glfw_INCLUDE_DIRS "${XKBCOMMON_INCLUDE_DIRS}")
include(CheckIncludeFiles) include(CheckIncludeFiles)
include(CheckFunctionExists) include(CheckFunctionExists)
@ -279,14 +220,6 @@ if (_GLFW_WAYLAND)
endif() endif()
endif() endif()
#--------------------------------------------------------------------
# Use OSMesa for offscreen context creation
#--------------------------------------------------------------------
if (_GLFW_OSMESA)
find_package(OSMesa REQUIRED)
list(APPEND glfw_LIBRARIES "${CMAKE_THREAD_LIBS_INIT}")
endif()
#-------------------------------------------------------------------- #--------------------------------------------------------------------
# Use Cocoa for window creation and NSOpenGL for context creation # Use Cocoa for window creation and NSOpenGL for context creation
#-------------------------------------------------------------------- #--------------------------------------------------------------------
@ -312,12 +245,10 @@ endif()
# Export GLFW library dependencies # Export GLFW library dependencies
#-------------------------------------------------------------------- #--------------------------------------------------------------------
foreach(arg ${glfw_PKG_DEPS}) foreach(arg ${glfw_PKG_DEPS})
set(GLFW_PKG_DEPS "${GLFW_PKG_DEPS} ${arg}" CACHE INTERNAL set(GLFW_PKG_DEPS "${GLFW_PKG_DEPS} ${arg}")
"GLFW pkg-config Requires.private")
endforeach() endforeach()
foreach(arg ${glfw_PKG_LIBS}) foreach(arg ${glfw_PKG_LIBS})
set(GLFW_PKG_LIBS "${GLFW_PKG_LIBS} ${arg}" CACHE INTERNAL set(GLFW_PKG_LIBS "${GLFW_PKG_LIBS} ${arg}")
"GLFW pkg-config Libs.private")
endforeach() endforeach()
#-------------------------------------------------------------------- #--------------------------------------------------------------------
@ -336,9 +267,7 @@ write_basic_package_version_file(src/glfw3ConfigVersion.cmake
VERSION ${GLFW_VERSION} VERSION ${GLFW_VERSION}
COMPATIBILITY SameMajorVersion) COMPATIBILITY SameMajorVersion)
configure_file(src/glfw_config.h.in src/glfw_config.h @ONLY) configure_file(CMake/glfw3.pc.in src/glfw3.pc @ONLY)
configure_file(CMake/glfw3.pc.in CMake/glfw3.pc @ONLY)
#-------------------------------------------------------------------- #--------------------------------------------------------------------
# Add subdirectories # Add subdirectories

View file

@ -99,7 +99,7 @@ located in the `deps/` directory.
functions functions
- [linmath.h](https://github.com/datenwolf/linmath.h) for linear algebra in - [linmath.h](https://github.com/datenwolf/linmath.h) for linear algebra in
examples examples
- [Nuklear](https://github.com/vurtun/nuklear) for test and example UI - [Nuklear](https://github.com/Immediate-Mode-UI/Nuklear) for test and example UI
- [stb\_image\_write](https://github.com/nothings/stb) for writing images to disk - [stb\_image\_write](https://github.com/nothings/stb) for writing images to disk
The documentation is generated with [Doxygen](http://doxygen.org/) if CMake can The documentation is generated with [Doxygen](http://doxygen.org/) if CMake can
@ -127,7 +127,10 @@ information on what to include when reporting a bug.
- Added `GLFW_FEATURE_UNIMPLEMENTED` error for incomplete backends (#1692) - Added `GLFW_FEATURE_UNIMPLEMENTED` error for incomplete backends (#1692)
- Added `GLFW_ANGLE_PLATFORM_TYPE` init hint and `GLFW_ANGLE_PLATFORM_TYPE_*` - Added `GLFW_ANGLE_PLATFORM_TYPE` init hint and `GLFW_ANGLE_PLATFORM_TYPE_*`
values to select ANGLE backend (#1380) values to select ANGLE backend (#1380)
- Added `GLFW_X11_XCB_VULKAN_SURFACE` init hint for selecting X11 Vulkan
surface extension (#1793)
- Made joystick subsystem initialize at first use (#1284,#1646) - Made joystick subsystem initialize at first use (#1284,#1646)
- Made `GLFW_DOUBLEBUFFER` a read-only window attribute
- Updated the minimum required CMake version to 3.1 - Updated the minimum required CMake version to 3.1
- Disabled tests and examples by default when built as a CMake subdirectory - Disabled tests and examples by default when built as a CMake subdirectory
- Bugfix: The CMake config-file package used an absolute path and was not - Bugfix: The CMake config-file package used an absolute path and was not
@ -137,6 +140,7 @@ information on what to include when reporting a bug.
- Bugfix: Built-in mappings failed because some OEMs re-used VID/PID (#1583) - Bugfix: Built-in mappings failed because some OEMs re-used VID/PID (#1583)
- Bugfix: Some extension loader headers did not prevent default OpenGL header - Bugfix: Some extension loader headers did not prevent default OpenGL header
inclusion (#1695) inclusion (#1695)
- Bugfix: Buffers were swapped at creation on single-buffered windows (#1873)
- [Win32] Added the `GLFW_WIN32_KEYBOARD_MENU` window hint for enabling access - [Win32] Added the `GLFW_WIN32_KEYBOARD_MENU` window hint for enabling access
to the window menu to the window menu
- [Win32] Added a version info resource to the GLFW DLL - [Win32] Added a version info resource to the GLFW DLL
@ -158,10 +162,20 @@ information on what to include when reporting a bug.
- [Win32] Bugfix: Monitor functions could return invalid values after - [Win32] Bugfix: Monitor functions could return invalid values after
configuration change (#1761) configuration change (#1761)
- [Win32] Bugfix: Initialization would segfault on Windows 8 (not 8.1) (#1775) - [Win32] Bugfix: Initialization would segfault on Windows 8 (not 8.1) (#1775)
- [Win32] Bugfix: Duplicate size events were not filtered (#1610)
- [Win32] Bugfix: Full screen windows were incorrectly resized by DPI changes
(#1582)
- [Win32] Bugfix: `GLFW_SCALE_TO_MONITOR` had no effect on systems older than
Windows 10 version 1703 (#1511)
- [Win32] Bugfix: `USE_MSVC_RUNTIME_LIBRARY_DLL` had no effect on CMake 3.15 or
later (#1783,#1796)
- [Win32] Bugfix: Compilation with LLVM for Windows failed (#1807,#1824,#1874)
- [Cocoa] Added support for `VK_EXT_metal_surface` (#1619) - [Cocoa] Added support for `VK_EXT_metal_surface` (#1619)
- [Cocoa] Added locating the Vulkan loader at runtime in an application bundle - [Cocoa] Added locating the Vulkan loader at runtime in an application bundle
- [Cocoa] Moved main menu creation to GLFW initialization time (#1649) - [Cocoa] Moved main menu creation to GLFW initialization time (#1649)
- [Cocoa] Changed `EGLNativeWindowType` from `NSView` to `CALayer` (#1169) - [Cocoa] Changed `EGLNativeWindowType` from `NSView` to `CALayer` (#1169)
- [Cocoa] Changed F13 key to report Print Screen for cross-platform consistency
(#1786)
- [Cocoa] Removed dependency on the CoreVideo framework - [Cocoa] Removed dependency on the CoreVideo framework
- [Cocoa] Bugfix: `glfwSetWindowSize` used a bottom-left anchor point (#1553) - [Cocoa] Bugfix: `glfwSetWindowSize` used a bottom-left anchor point (#1553)
- [Cocoa] Bugfix: Window remained on screen after destruction until event poll - [Cocoa] Bugfix: Window remained on screen after destruction until event poll
@ -174,6 +188,12 @@ information on what to include when reporting a bug.
(#1635) (#1635)
- [Cocoa] Bugfix: Failing to retrieve the refresh rate of built-in displays - [Cocoa] Bugfix: Failing to retrieve the refresh rate of built-in displays
could leak memory could leak memory
- [Cocoa] Bugfix: Objective-C files were compiled as C with CMake 3.19 (#1787)
- [Cocoa] Bugfix: Duplicate video modes were not filtered out (#1830)
- [Cocoa] Bugfix: Menubar was not clickable on macOS 10.15+ until it lost and
regained focus (#1648,#1802)
- [Cocoa] Bugfix: Monitor name query could segfault on macOS 11 (#1809,#1833)
- [Cocoa] Bugfix: The install name of the installed dylib was relative (#1504)
- [X11] Bugfix: The CMake files did not check for the XInput headers (#1480) - [X11] Bugfix: The CMake files did not check for the XInput headers (#1480)
- [X11] Bugfix: Key names were not updated when the keyboard layout changed - [X11] Bugfix: Key names were not updated when the keyboard layout changed
(#1462,#1528) (#1462,#1528)
@ -199,6 +219,8 @@ information on what to include when reporting a bug.
combinaitons (#1598) combinaitons (#1598)
- [X11] Bugfix: Keys pressed simultaneously with others were not always - [X11] Bugfix: Keys pressed simultaneously with others were not always
reported (#1112,#1415,#1472,#1616) reported (#1112,#1415,#1472,#1616)
- [X11] Bugfix: Some window attributes were not applied on leaving fullscreen
(#1863)
- [Wayland] Removed support for `wl_shell` (#1443) - [Wayland] Removed support for `wl_shell` (#1443)
- [Wayland] Bugfix: The `GLFW_HAND_CURSOR` shape used the wrong image (#1432) - [Wayland] Bugfix: The `GLFW_HAND_CURSOR` shape used the wrong image (#1432)
- [Wayland] Bugfix: `CLOCK_MONOTONIC` was not correctly enabled - [Wayland] Bugfix: `CLOCK_MONOTONIC` was not correctly enabled
@ -206,6 +228,9 @@ information on what to include when reporting a bug.
- [Wayland] Bugfix: Retrieving partial framebuffer size would segfault - [Wayland] Bugfix: Retrieving partial framebuffer size would segfault
- [Wayland] Bugfix: Scrolling offsets were inverted compared to other platforms - [Wayland] Bugfix: Scrolling offsets were inverted compared to other platforms
(#1463) (#1463)
- [Wayland] Bugfix: Client-Side Decorations were destroyed in the wrong worder
(#1798)
- [Wayland] Bugfix: Monitors physical size could report zero (#1784,#1792)
- [POSIX] Bugfix: `CLOCK_MONOTONIC` was not correctly tested for or enabled - [POSIX] Bugfix: `CLOCK_MONOTONIC` was not correctly tested for or enabled
- [NSGL] Removed enforcement of forward-compatible flag for core contexts - [NSGL] Removed enforcement of forward-compatible flag for core contexts
- [NSGL] Bugfix: `GLFW_COCOA_RETINA_FRAMEBUFFER` had no effect on newer - [NSGL] Bugfix: `GLFW_COCOA_RETINA_FRAMEBUFFER` had no effect on newer
@ -240,13 +265,16 @@ GLFW exists because people around the world donated their time and lent their
skills. skills.
- Bobyshev Alexander - Bobyshev Alexander
- Laurent Aphecetche
- Matt Arsenault - Matt Arsenault
- ashishgamedev
- David Avedissian - David Avedissian
- Keith Bauer - Keith Bauer
- John Bartholomew - John Bartholomew
- Coşku Baş - Coşku Baş
- Niklas Behrens - Niklas Behrens
- Andrew Belt - Andrew Belt
- Nevyn Bengtsson
- Niklas Bergström - Niklas Bergström
- Denis Bernard - Denis Bernard
- Doug Binks - Doug Binks
@ -268,6 +296,7 @@ skills.
- Andrew Corrigan - Andrew Corrigan
- Bailey Cosier - Bailey Cosier
- Noel Cower - Noel Cower
- CuriouserThing
- Jason Daly - Jason Daly
- Jarrod Davis - Jarrod Davis
- Olivier Delannoy - Olivier Delannoy
@ -294,6 +323,7 @@ skills.
- Eloi Marín Gratacós - Eloi Marín Gratacós
- Stefan Gustavson - Stefan Gustavson
- Jonathan Hale - Jonathan Hale
- hdf89shfdfs
- Sylvain Hellegouarch - Sylvain Hellegouarch
- Matthew Henry - Matthew Henry
- heromyth - heromyth
@ -318,11 +348,13 @@ skills.
- Konstantin Käfer - Konstantin Käfer
- Eric Larson - Eric Larson
- Francis Lecavalier - Francis Lecavalier
- Jong Won Lee
- Robin Leffmann - Robin Leffmann
- Glenn Lewis - Glenn Lewis
- Shane Liesegang - Shane Liesegang
- Anders Lindqvist - Anders Lindqvist
- Leon Linhart - Leon Linhart
- Marco Lizza
- Eyal Lotem - Eyal Lotem
- Aaron Loucks - Aaron Loucks
- Luflosi - Luflosi
@ -428,6 +460,9 @@ skills.
- Waris - Waris
- Jay Weisskopf - Jay Weisskopf
- Frank Wille - Frank Wille
- Andy Williams
- Joel Winarske
- Richard A. Wilkes
- Tatsuya Yatagawa - Tatsuya Yatagawa
- Ryogo Yoshimura - Ryogo Yoshimura
- Lukas Zanner - Lukas Zanner
@ -436,6 +471,7 @@ skills.
- Santi Zupancic - Santi Zupancic
- Jonas Ådahl - Jonas Ådahl
- Lasse Öörni - Lasse Öörni
- Leonard König
- All the unmentioned and anonymous contributors in the GLFW community, for bug - All the unmentioned and anonymous contributors in the GLFW community, for bug
reports, patches, feedback, testing and encouragement reports, patches, feedback, testing and encouragement

View file

@ -276,23 +276,24 @@ extern "C" {
/*! @name GLFW version macros /*! @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 * @ingroup init
*/ */
#define GLFW_VERSION_MAJOR 3 #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 * The minor version number of the GLFW header. This is incremented when
* backward-compatible. * features are added to the API but it remains backward-compatible.
* @ingroup init * @ingroup init
*/ */
#define GLFW_VERSION_MINOR 4 #define GLFW_VERSION_MINOR 4
/*! @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 * The revision number of the GLFW header. This is incremented when a bug fix
* API changes. * release is made that does not contain any API changes.
* @ingroup init * @ingroup init
*/ */
#define GLFW_VERSION_REVISION 0 #define GLFW_VERSION_REVISION 0
@ -977,9 +978,10 @@ extern "C" {
* Monitor refresh rate [hint](@ref GLFW_REFRESH_RATE). * Monitor refresh rate [hint](@ref GLFW_REFRESH_RATE).
*/ */
#define GLFW_REFRESH_RATE 0x0002100F #define GLFW_REFRESH_RATE 0x0002100F
/*! @brief Framebuffer double buffering hint. /*! @brief Framebuffer double buffering hint and attribute.
* *
* Framebuffer double buffering [hint](@ref GLFW_DOUBLEBUFFER). * Framebuffer double buffering [hint](@ref GLFW_DOUBLEBUFFER_hint) and
* [attribute](@ref GLFW_DOUBLEBUFFER_attrib).
*/ */
#define GLFW_DOUBLEBUFFER 0x00021010 #define GLFW_DOUBLEBUFFER 0x00021010
@ -1250,6 +1252,11 @@ extern "C" {
* macOS specific [init hint](@ref GLFW_COCOA_MENUBAR_hint). * macOS specific [init hint](@ref GLFW_COCOA_MENUBAR_hint).
*/ */
#define GLFW_COCOA_MENUBAR 0x00051002 #define GLFW_COCOA_MENUBAR 0x00051002
/*! @brief X11 specific init hint.
*
* X11 specific [init hint](@ref GLFW_X11_XCB_VULKAN_SURFACE_hint).
*/
#define GLFW_X11_XCB_VULKAN_SURFACE 0x00052001
/*! @} */ /*! @} */
#define GLFW_DONT_CARE -1 #define GLFW_DONT_CARE -1
@ -2417,8 +2424,9 @@ GLFWAPI GLFWmonitorfun glfwSetMonitorCallback(GLFWmonitorfun callback);
* *
* This function returns an array of all video modes supported by the specified * 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 * 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 * bit depth (the sum of all channel depths), then by resolution area (the
* product of width and height). * product of width and height), then resolution width and finally by refresh
* rate.
* *
* @param[in] monitor The monitor to query. * @param[in] monitor The monitor to query.
* @param[out] count Where to store the number of video modes in the returned * @param[out] count Where to store the number of video modes in the returned
@ -5865,9 +5873,8 @@ GLFWAPI int glfwVulkanSupported(void);
* returned array, as it is an error to specify an extension more than once in * returned array, as it is an error to specify an extension more than once in
* the `VkInstanceCreateInfo` struct. * the `VkInstanceCreateInfo` struct.
* *
* @remark @macos This function currently supports either the * @remark @macos GLFW currently supports both the `VK_MVK_macos_surface` and
* `VK_MVK_macos_surface` extension from MoltenVK or `VK_EXT_metal_surface` * the newer `VK_EXT_metal_surface` extensions.
* extension.
* *
* @pointer_lifetime The returned array is allocated and freed by GLFW. You * @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 * should not free it yourself. It is guaranteed to be valid only until the
@ -5950,7 +5957,7 @@ GLFWAPI GLFWvkproc glfwGetInstanceProcAddress(VkInstance instance, const char* p
* GLFW_API_UNAVAILABLE and @ref GLFW_PLATFORM_ERROR. * GLFW_API_UNAVAILABLE and @ref GLFW_PLATFORM_ERROR.
* *
* @remark @macos This function currently always returns `GLFW_TRUE`, as the * @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. * a `vkGetPhysicalDevice*PresentationSupport` type function.
* *
* @thread_safety This function may be called from any thread. For * @thread_safety This function may be called from any thread. For
@ -6013,6 +6020,12 @@ GLFWAPI int glfwGetPhysicalDevicePresentationSupport(VkInstance instance, VkPhys
* @remark @macos This function creates and sets a `CAMetalLayer` instance for * @remark @macos This function creates and sets a `CAMetalLayer` instance for
* the window content view, which is required for MoltenVK to function. * the window content view, which is required for MoltenVK to function.
* *
* @remark @x11 GLFW by default attempts to use the `VK_KHR_xcb_surface`
* extension, if available. You can make it prefer the `VK_KHR_xlib_surface`
* extension by setting the
* [GLFW_X11_XCB_VULKAN_SURFACE](@ref GLFW_X11_XCB_VULKAN_SURFACE_hint) init
* hint.
*
* @thread_safety This function may be called from any thread. For * @thread_safety This function may be called from any thread. For
* synchronization details of Vulkan objects, see the Vulkan specification. * synchronization details of Vulkan objects, see the Vulkan specification.
* *

View file

@ -83,8 +83,8 @@ extern "C" {
#if defined(GLFW_EXPOSE_NATIVE_WIN32) || defined(GLFW_EXPOSE_NATIVE_WGL) #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 // 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 // example to allow applications to correctly declare a GL_KHR_debug callback)
// callback) but windows.h assumes no one will define APIENTRY before it does // but windows.h assumes no one will define APIENTRY before it does
#if defined(GLFW_APIENTRY_DEFINED) #if defined(GLFW_APIENTRY_DEFINED)
#undef APIENTRY #undef APIENTRY
#undef GLFW_APIENTRY_DEFINED #undef GLFW_APIENTRY_DEFINED
@ -96,7 +96,6 @@ extern "C" {
typedef PVOID HANDLE; typedef PVOID HANDLE;
typedef HANDLE HWND; typedef HANDLE HWND;
#elif defined(GLFW_EXPOSE_NATIVE_COCOA) || defined(GLFW_EXPOSE_NATIVE_NSGL) #elif defined(GLFW_EXPOSE_NATIVE_COCOA) || defined(GLFW_EXPOSE_NATIVE_NSGL)
#include <ApplicationServices/ApplicationServices.h>
#if defined(__OBJC__) #if defined(__OBJC__)
#import <Cocoa/Cocoa.h> #import <Cocoa/Cocoa.h>
#else #else

View file

@ -1,149 +1,192 @@
set(common_HEADERS internal.h mappings.h add_library(glfw "${GLFW_SOURCE_DIR}/include/GLFW/glfw3.h"
"${GLFW_BINARY_DIR}/src/glfw_config.h" "${GLFW_SOURCE_DIR}/include/GLFW/glfw3native.h"
"${GLFW_SOURCE_DIR}/include/GLFW/glfw3.h" internal.h mappings.h context.c init.c input.c monitor.c
"${GLFW_SOURCE_DIR}/include/GLFW/glfw3native.h") vulkan.c window.c)
set(common_SOURCES context.c init.c input.c monitor.c vulkan.c window.c)
if (_GLFW_COCOA) if (_GLFW_COCOA)
set(glfw_HEADERS ${common_HEADERS} cocoa_platform.h cocoa_joystick.h target_sources(glfw PRIVATE cocoa_platform.h cocoa_joystick.h posix_thread.h
posix_thread.h nsgl_context.h egl_context.h osmesa_context.h) nsgl_context.h egl_context.h osmesa_context.h
set(glfw_SOURCES ${common_SOURCES} cocoa_init.m cocoa_joystick.m cocoa_init.m cocoa_joystick.m cocoa_monitor.m
cocoa_monitor.m cocoa_window.m cocoa_time.c posix_thread.c cocoa_window.m cocoa_time.c posix_thread.c
nsgl_context.m egl_context.c osmesa_context.c) nsgl_context.m egl_context.c osmesa_context.c)
elseif (_GLFW_WIN32) elseif (_GLFW_WIN32)
set(glfw_HEADERS ${common_HEADERS} win32_platform.h win32_joystick.h target_sources(glfw PRIVATE win32_platform.h win32_joystick.h wgl_context.h
wgl_context.h egl_context.h osmesa_context.h) egl_context.h osmesa_context.h win32_init.c
set(glfw_SOURCES ${common_SOURCES} win32_init.c win32_joystick.c win32_joystick.c win32_monitor.c win32_time.c
win32_monitor.c win32_time.c win32_thread.c win32_window.c win32_thread.c win32_window.c wgl_context.c
wgl_context.c egl_context.c osmesa_context.c) egl_context.c osmesa_context.c)
elseif (_GLFW_X11) elseif (_GLFW_X11)
set(glfw_HEADERS ${common_HEADERS} x11_platform.h xkb_unicode.h posix_time.h target_sources(glfw PRIVATE x11_platform.h xkb_unicode.h posix_time.h
posix_thread.h glx_context.h egl_context.h osmesa_context.h) posix_thread.h glx_context.h egl_context.h
set(glfw_SOURCES ${common_SOURCES} x11_init.c x11_monitor.c x11_window.c osmesa_context.h x11_init.c x11_monitor.c
xkb_unicode.c posix_time.c posix_thread.c glx_context.c x11_window.c xkb_unicode.c posix_time.c
egl_context.c osmesa_context.c) posix_thread.c glx_context.c egl_context.c
osmesa_context.c)
elseif (_GLFW_WAYLAND) elseif (_GLFW_WAYLAND)
set(glfw_HEADERS ${common_HEADERS} wl_platform.h target_sources(glfw PRIVATE wl_platform.h posix_time.h posix_thread.h
posix_time.h posix_thread.h xkb_unicode.h egl_context.h xkb_unicode.h egl_context.h osmesa_context.h
osmesa_context.h) wl_init.c wl_monitor.c wl_window.c posix_time.c
set(glfw_SOURCES ${common_SOURCES} wl_init.c wl_monitor.c wl_window.c posix_thread.c xkb_unicode.c egl_context.c
posix_time.c posix_thread.c xkb_unicode.c osmesa_context.c)
egl_context.c osmesa_context.c)
ecm_add_wayland_client_protocol(glfw_SOURCES
PROTOCOL
"${WAYLAND_PROTOCOLS_PKGDATADIR}/stable/xdg-shell/xdg-shell.xml"
BASENAME xdg-shell)
ecm_add_wayland_client_protocol(glfw_SOURCES
PROTOCOL
"${WAYLAND_PROTOCOLS_PKGDATADIR}/unstable/xdg-decoration/xdg-decoration-unstable-v1.xml"
BASENAME xdg-decoration)
ecm_add_wayland_client_protocol(glfw_SOURCES
PROTOCOL
"${WAYLAND_PROTOCOLS_PKGDATADIR}/stable/viewporter/viewporter.xml"
BASENAME viewporter)
ecm_add_wayland_client_protocol(glfw_SOURCES
PROTOCOL
"${WAYLAND_PROTOCOLS_PKGDATADIR}/unstable/relative-pointer/relative-pointer-unstable-v1.xml"
BASENAME relative-pointer-unstable-v1)
ecm_add_wayland_client_protocol(glfw_SOURCES
PROTOCOL
"${WAYLAND_PROTOCOLS_PKGDATADIR}/unstable/pointer-constraints/pointer-constraints-unstable-v1.xml"
BASENAME pointer-constraints-unstable-v1)
ecm_add_wayland_client_protocol(glfw_SOURCES
PROTOCOL
"${WAYLAND_PROTOCOLS_PKGDATADIR}/unstable/idle-inhibit/idle-inhibit-unstable-v1.xml"
BASENAME idle-inhibit-unstable-v1)
elseif (_GLFW_OSMESA) elseif (_GLFW_OSMESA)
set(glfw_HEADERS ${common_HEADERS} null_platform.h null_joystick.h target_sources(glfw PRIVATE null_platform.h null_joystick.h posix_time.h
posix_time.h posix_thread.h osmesa_context.h) posix_thread.h osmesa_context.h null_init.c
set(glfw_SOURCES ${common_SOURCES} null_init.c null_monitor.c null_window.c null_monitor.c null_window.c null_joystick.c
null_joystick.c posix_time.c posix_thread.c osmesa_context.c) posix_time.c posix_thread.c osmesa_context.c)
endif() endif()
if (_GLFW_X11 OR _GLFW_WAYLAND) if (_GLFW_X11 OR _GLFW_WAYLAND)
if ("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux") if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
set(glfw_HEADERS ${glfw_HEADERS} linux_joystick.h) target_sources(glfw PRIVATE linux_joystick.h linux_joystick.c)
set(glfw_SOURCES ${glfw_SOURCES} linux_joystick.c)
else() else()
set(glfw_HEADERS ${glfw_HEADERS} null_joystick.h) target_sources(glfw PRIVATE null_joystick.h null_joystick.c)
set(glfw_SOURCES ${glfw_SOURCES} null_joystick.c)
endif() endif()
endif() endif()
if (APPLE) if (_GLFW_WAYLAND)
# For some reason, CMake doesn't know about .m find_program(WAYLAND_SCANNER_EXECUTABLE NAMES wayland-scanner)
set_source_files_properties(${glfw_SOURCES} PROPERTIES LANGUAGE C) pkg_check_modules(WAYLAND_PROTOCOLS REQUIRED wayland-protocols>=1.15)
pkg_get_variable(WAYLAND_PROTOCOLS_BASE wayland-protocols pkgdatadir)
macro(wayland_generate protocol_file output_file)
add_custom_command(OUTPUT "${output_file}.h"
COMMAND "${WAYLAND_SCANNER_EXECUTABLE}" client-header "${protocol_file}" "${output_file}.h"
DEPENDS "${protocol_file}"
VERBATIM)
add_custom_command(OUTPUT "${output_file}.c"
COMMAND "${WAYLAND_SCANNER_EXECUTABLE}" private-code "${protocol_file}" "${output_file}.c"
DEPENDS "${protocol_file}"
VERBATIM)
target_sources(glfw PRIVATE "${output_file}.h" "${output_file}.c")
endmacro()
wayland_generate(
"${WAYLAND_PROTOCOLS_BASE}/stable/xdg-shell/xdg-shell.xml"
"${GLFW_BINARY_DIR}/src/wayland-xdg-shell-client-protocol")
wayland_generate(
"${WAYLAND_PROTOCOLS_BASE}/unstable/xdg-decoration/xdg-decoration-unstable-v1.xml"
"${GLFW_BINARY_DIR}/src/wayland-xdg-decoration-client-protocol")
wayland_generate(
"${WAYLAND_PROTOCOLS_BASE}/stable/viewporter/viewporter.xml"
"${GLFW_BINARY_DIR}/src/wayland-viewporter-client-protocol")
wayland_generate(
"${WAYLAND_PROTOCOLS_BASE}/unstable/relative-pointer/relative-pointer-unstable-v1.xml"
"${GLFW_BINARY_DIR}/src/wayland-relative-pointer-unstable-v1-client-protocol")
wayland_generate(
"${WAYLAND_PROTOCOLS_BASE}/unstable/pointer-constraints/pointer-constraints-unstable-v1.xml"
"${GLFW_BINARY_DIR}/src/wayland-pointer-constraints-unstable-v1-client-protocol")
wayland_generate(
"${WAYLAND_PROTOCOLS_BASE}/unstable/idle-inhibit/idle-inhibit-unstable-v1.xml"
"${GLFW_BINARY_DIR}/src/wayland-idle-inhibit-unstable-v1-client-protocol")
endif() endif()
# Make GCC and Clang warn about declarations that VS 2010 and 2012 won't accept if (WIN32 AND BUILD_SHARED_LIBS)
# for all source files that VS will build configure_file(glfw.rc.in glfw.rc @ONLY)
if ("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" OR target_sources(glfw PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/glfw.rc")
"${CMAKE_C_COMPILER_ID}" STREQUAL "Clang" OR
"${CMAKE_C_COMPILER_ID}" STREQUAL "AppleClang")
if (WIN32)
set(windows_SOURCES ${glfw_SOURCES})
else()
set(windows_SOURCES ${common_SOURCES})
endif()
set_source_files_properties(${windows_SOURCES} PROPERTIES
COMPILE_FLAGS -Wdeclaration-after-statement)
endif() endif()
add_library(glfw_objlib OBJECT ${glfw_SOURCES} ${glfw_HEADERS}) configure_file(glfw_config.h.in glfw_config.h @ONLY)
add_library(glfw $<TARGET_OBJECTS:glfw_objlib>) target_compile_definitions(glfw PRIVATE _GLFW_USE_CONFIG_H)
set_target_properties(glfw_objlib PROPERTIES POSITION_INDEPENDENT_CODE ON) target_sources(glfw PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/glfw_config.h")
set_target_properties(glfw PROPERTIES set_target_properties(glfw PROPERTIES
OUTPUT_NAME ${GLFW_LIB_NAME} OUTPUT_NAME ${GLFW_LIB_NAME}
VERSION ${GLFW_VERSION_MAJOR}.${GLFW_VERSION_MINOR} VERSION ${GLFW_VERSION_MAJOR}.${GLFW_VERSION_MINOR}
SOVERSION ${GLFW_VERSION_MAJOR} SOVERSION ${GLFW_VERSION_MAJOR}
POSITION_INDEPENDENT_CODE ON
C_STANDARD 99
C_EXTENSIONS OFF
DEFINE_SYMBOL _GLFW_BUILD_DLL
FOLDER "GLFW3") FOLDER "GLFW3")
if (${CMAKE_VERSION} VERSION_EQUAL "3.1.0" OR
${CMAKE_VERSION} VERSION_GREATER "3.1.0")
set_target_properties(glfw_objlib PROPERTIES C_STANDARD 99)
else()
# Remove this fallback when removing support for CMake version less than 3.1
target_compile_options(glfw_objlib PRIVATE
"$<$<C_COMPILER_ID:AppleClang>:-std=c99>"
"$<$<C_COMPILER_ID:Clang>:-std=c99>"
"$<$<C_COMPILER_ID:GNU>:-std=c99>")
endif()
target_compile_definitions(glfw_objlib PRIVATE _GLFW_USE_CONFIG_H)
target_include_directories(glfw_objlib PUBLIC
"$<BUILD_INTERFACE:${GLFW_SOURCE_DIR}/include>"
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_FULL_INCLUDEDIR}>")
target_include_directories(glfw PUBLIC target_include_directories(glfw PUBLIC
"$<BUILD_INTERFACE:${GLFW_SOURCE_DIR}/include>" "$<BUILD_INTERFACE:${GLFW_SOURCE_DIR}/include>"
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_FULL_INCLUDEDIR}>") "$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>")
target_include_directories(glfw_objlib PRIVATE target_include_directories(glfw PRIVATE
"${GLFW_SOURCE_DIR}/src" "${GLFW_SOURCE_DIR}/src"
"${GLFW_BINARY_DIR}/src" "${GLFW_BINARY_DIR}/src"
${glfw_INCLUDE_DIRS}) ${glfw_INCLUDE_DIRS})
target_link_libraries(glfw PRIVATE Threads::Threads ${glfw_LIBRARIES})
# Workaround for CMake not knowing about .m files before version 3.16
if ("${CMAKE_VERSION}" VERSION_LESS "3.16" AND APPLE)
set_source_files_properties(cocoa_init.m cocoa_joystick.m cocoa_monitor.m
cocoa_window.m nsgl_context.m PROPERTIES
LANGUAGE C)
endif()
# Make GCC warn about declarations that VS 2010 and 2012 won't accept for all
# source files that VS will build (Clang ignores this because we set -std=c99)
if (CMAKE_C_COMPILER_ID STREQUAL "GNU")
set_source_files_properties(context.c init.c input.c monitor.c vulkan.c
window.c win32_init.c win32_joystick.c
win32_monitor.c win32_time.c win32_thread.c
win32_window.c wgl_context.c egl_context.c
osmesa_context.c PROPERTIES
COMPILE_FLAGS -Wdeclaration-after-statement)
endif()
# Enable a reasonable set of warnings
# NOTE: The order matters here, Clang-CL matches both MSVC and Clang
if (MSVC)
target_compile_options(glfw PRIVATE "/W3")
elseif (CMAKE_C_COMPILER_ID STREQUAL "GNU" OR
CMAKE_C_COMPILER_ID STREQUAL "Clang" OR
CMAKE_C_COMPILER_ID STREQUAL "AppleClang")
target_compile_options(glfw PRIVATE "-Wall")
endif()
if (_GLFW_WIN32)
target_compile_definitions(glfw PRIVATE UNICODE _UNICODE)
endif()
# HACK: When building on MinGW, WINVER and UNICODE need to be defined before # HACK: When building on MinGW, WINVER and UNICODE need to be defined before
# the inclusion of stddef.h (by glfw3.h), which is itself included before # the inclusion of stddef.h (by glfw3.h), which is itself included before
# win32_platform.h. We define them here until a saner solution can be found # win32_platform.h. We define them here until a saner solution can be found
# NOTE: MinGW-w64 and Visual C++ do /not/ need this hack. # NOTE: MinGW-w64 and Visual C++ do /not/ need this hack.
target_compile_definitions(glfw_objlib PRIVATE if (MINGW)
"$<$<BOOL:${MINGW}>:UNICODE;WINVER=0x0501>") target_compile_definitions(glfw PRIVATE WINVER=0x0501)
endif()
# Enable a reasonable set of warnings (no, -Wextra is not reasonable) # Workaround for legacy MinGW not providing XInput and DirectInput
target_compile_options(glfw_objlib PRIVATE if (MINGW)
"$<$<C_COMPILER_ID:AppleClang>:-Wall>" include(CheckIncludeFile)
"$<$<C_COMPILER_ID:Clang>:-Wall>" check_include_file(dinput.h DINPUT_H_FOUND)
"$<$<C_COMPILER_ID:GNU>:-Wall>") check_include_file(xinput.h XINPUT_H_FOUND)
if (NOT DINPUT_H_FOUND OR NOT XINPUT_H_FOUND)
target_include_directories(glfw PRIVATE "${GLFW_SOURCE_DIR}/deps/mingw")
endif()
endif()
# Workaround for the MS CRT deprecating parts of the standard library
if (MSVC OR CMAKE_C_SIMULATE_ID STREQUAL "MSVC")
target_compile_definitions(glfw PRIVATE _CRT_SECURE_NO_WARNINGS)
endif()
# Workaround for VS 2008 not shipping with stdint.h
if (MSVC90)
target_include_directories(glfw PUBLIC "${GLFW_SOURCE_DIR}/deps/vs2008")
endif()
# Check for the DirectX 9 SDK as it is not included with VS 2008
if (MSVC90)
include(CheckIncludeFile)
check_include_file(dinput.h DINPUT_H_FOUND)
if (NOT DINPUT_H_FOUND)
message(FATAL_ERROR "DirectX 9 headers not found; install DirectX 9 SDK")
endif()
endif()
if (BUILD_SHARED_LIBS) if (BUILD_SHARED_LIBS)
if (WIN32) if (WIN32)
if (MINGW) if (MINGW)
# Remove the dependency on the shared version of libgcc # Remove the dependency on the shared version of libgcc
# NOTE: MinGW-w64 has the correct default but MinGW needs this # NOTE: MinGW-w64 has the correct default but MinGW needs this
target_link_options(glfw PRIVATE "-static-libgcc") target_link_libraries(glfw PRIVATE "-static-libgcc")
# Remove the lib prefix on the DLL (but not the import library) # Remove the lib prefix on the DLL (but not the import library)
set_target_properties(glfw PROPERTIES PREFIX "") set_target_properties(glfw PROPERTIES PREFIX "")
@ -155,33 +198,48 @@ if (BUILD_SHARED_LIBS)
set_target_properties(glfw PROPERTIES IMPORT_SUFFIX "dll.lib") set_target_properties(glfw PROPERTIES IMPORT_SUFFIX "dll.lib")
endif() endif()
target_compile_definitions(glfw_objlib INTERFACE GLFW_DLL) target_compile_definitions(glfw INTERFACE GLFW_DLL)
elseif (APPLE) endif()
# Add -fno-common to work around a bug in Apple's GCC
target_compile_options(glfw_objlib PRIVATE "-fno-common")
set_target_properties(glfw PROPERTIES if (MINGW)
INSTALL_NAME_DIR "${CMAKE_INSTALL_LIBDIR}") # Enable link-time exploit mitigation features enabled by default on MSVC
include(CheckCCompilerFlag)
# Compatibility with data execution prevention (DEP)
set(CMAKE_REQUIRED_FLAGS "-Wl,--nxcompat")
check_c_compiler_flag("" _GLFW_HAS_DEP)
if (_GLFW_HAS_DEP)
target_link_libraries(glfw PRIVATE "-Wl,--nxcompat")
endif()
# Compatibility with address space layout randomization (ASLR)
set(CMAKE_REQUIRED_FLAGS "-Wl,--dynamicbase")
check_c_compiler_flag("" _GLFW_HAS_ASLR)
if (_GLFW_HAS_ASLR)
target_link_libraries(glfw PRIVATE "-Wl,--dynamicbase")
endif()
# Compatibility with 64-bit address space layout randomization (ASLR)
set(CMAKE_REQUIRED_FLAGS "-Wl,--high-entropy-va")
check_c_compiler_flag("" _GLFW_HAS_64ASLR)
if (_GLFW_HAS_64ASLR)
target_link_libraries(glfw PRIVATE "-Wl,--high-entropy-va")
endif()
# Clear flags again to avoid breaking later tests
set(CMAKE_REQUIRED_FLAGS)
endif() endif()
if (UNIX) if (UNIX)
# Hide symbols not explicitly tagged for export from the shared library # Hide symbols not explicitly tagged for export from the shared library
target_compile_options(glfw_objlib PRIVATE "-fvisibility=hidden") target_compile_options(glfw PRIVATE "-fvisibility=hidden")
endif() endif()
target_link_libraries(glfw PRIVATE ${glfw_LIBRARIES})
else()
target_link_libraries(glfw INTERFACE ${glfw_LIBRARIES})
endif()
if (MSVC)
target_compile_definitions(glfw_objlib PRIVATE _CRT_SECURE_NO_WARNINGS)
endif() endif()
if (GLFW_INSTALL) if (GLFW_INSTALL)
install(TARGETS glfw install(TARGETS glfw
EXPORT glfwTargets EXPORT glfwTargets
RUNTIME DESTINATION "bin" RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}") LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}")
endif() endif()

View file

@ -251,7 +251,7 @@ static void createKeyTables(void)
_glfw.ns.keycodes[0x6D] = GLFW_KEY_F10; _glfw.ns.keycodes[0x6D] = GLFW_KEY_F10;
_glfw.ns.keycodes[0x67] = GLFW_KEY_F11; _glfw.ns.keycodes[0x67] = GLFW_KEY_F11;
_glfw.ns.keycodes[0x6F] = GLFW_KEY_F12; _glfw.ns.keycodes[0x6F] = GLFW_KEY_F12;
_glfw.ns.keycodes[0x69] = GLFW_KEY_F13; _glfw.ns.keycodes[0x69] = GLFW_KEY_PRINT_SCREEN;
_glfw.ns.keycodes[0x6B] = GLFW_KEY_F14; _glfw.ns.keycodes[0x6B] = GLFW_KEY_F14;
_glfw.ns.keycodes[0x71] = GLFW_KEY_F15; _glfw.ns.keycodes[0x71] = GLFW_KEY_F15;
_glfw.ns.keycodes[0x6A] = GLFW_KEY_F16; _glfw.ns.keycodes[0x6A] = GLFW_KEY_F16;
@ -428,9 +428,6 @@ static GLFWbool initializeTIS(void)
{ {
if (_glfw.hints.init.ns.menubar) if (_glfw.hints.init.ns.menubar)
{ {
// In case we are unbundled, make us a proper UI application
[NSApp setActivationPolicy:NSApplicationActivationPolicyRegular];
// Menu bar setup must go between sharedApplication and finishLaunching // Menu bar setup must go between sharedApplication and finishLaunching
// in order to properly emulate the behavior of NSApplicationMain // in order to properly emulate the behavior of NSApplicationMain
@ -557,6 +554,10 @@ int _glfwPlatformInit(void)
if (![[NSRunningApplication currentApplication] isFinishedLaunching]) if (![[NSRunningApplication currentApplication] isFinishedLaunching])
[NSApp run]; [NSApp run];
// In case we are unbundled, make us a proper UI application
if (_glfw.hints.init.ns.menubar)
[NSApp setActivationPolicy:NSApplicationActivationPolicyRegular];
return GLFW_TRUE; return GLFW_TRUE;
} // autoreleasepool } // autoreleasepool

View file

@ -39,8 +39,21 @@
// Get the name of the specified display, or NULL // Get the name of the specified display, or NULL
// //
static char* getDisplayName(CGDirectDisplayID displayID) static char* getMonitorName(CGDirectDisplayID displayID, NSScreen* screen)
{ {
// IOKit doesn't work on Apple Silicon anymore
// Luckily, 10.15 introduced -[NSScreen localizedName].
// Use it if available, and fall back to IOKit otherwise.
if (screen)
{
if ([screen respondsToSelector:@selector(localizedName)])
{
NSString* name = [screen valueForKey:@"localizedName"];
if (name)
return _glfw_strdup([name UTF8String]);
}
}
io_iterator_t it; io_iterator_t it;
io_service_t service; io_service_t service;
CFDictionaryRef info; CFDictionaryRef info;
@ -50,7 +63,7 @@ static char* getDisplayName(CGDirectDisplayID displayID)
&it) != 0) &it) != 0)
{ {
// This may happen if a desktop Mac is running headless // This may happen if a desktop Mac is running headless
return NULL; return _glfw_strdup("Display");
} }
while ((service = IOIteratorNext(it)) != 0) while ((service = IOIteratorNext(it)) != 0)
@ -88,7 +101,7 @@ static char* getDisplayName(CGDirectDisplayID displayID)
{ {
_glfwInputError(GLFW_PLATFORM_ERROR, _glfwInputError(GLFW_PLATFORM_ERROR,
"Cocoa: Failed to find service port for display"); "Cocoa: Failed to find service port for display");
return NULL; return _glfw_strdup("Display");
} }
CFDictionaryRef names = CFDictionaryRef names =
@ -101,7 +114,7 @@ static char* getDisplayName(CGDirectDisplayID displayID)
{ {
// This may happen if a desktop Mac is running headless // This may happen if a desktop Mac is running headless
CFRelease(info); CFRelease(info);
return NULL; return _glfw_strdup("Display");
} }
const CFIndex size = const CFIndex size =
@ -209,31 +222,6 @@ static void endFadeReservation(CGDisplayFadeReservationToken token)
} }
} }
// Finds and caches the NSScreen corresponding to the specified monitor
//
static GLFWbool refreshMonitorScreen(_GLFWmonitor* monitor)
{
if (monitor->ns.screen)
return GLFW_TRUE;
for (NSScreen* screen in [NSScreen screens])
{
NSNumber* displayID = [screen deviceDescription][@"NSScreenNumber"];
// HACK: Compare unit numbers instead of display IDs to work around
// display replacement on machines with automatic graphics
// switching
if (monitor->ns.unitNumber == CGDisplayUnitNumber([displayID unsignedIntValue]))
{
monitor->ns.screen = screen;
return GLFW_TRUE;
}
}
_glfwInputError(GLFW_PLATFORM_ERROR, "Cocoa: Failed to find a screen for monitor");
return GLFW_FALSE;
}
// Returns the display refresh rate queried from the I/O registry // Returns the display refresh rate queried from the I/O registry
// //
static double getFallbackRefreshRate(CGDirectDisplayID displayID) static double getFallbackRefreshRate(CGDirectDisplayID displayID)
@ -334,27 +322,46 @@ void _glfwPollMonitorsNS(void)
if (CGDisplayIsAsleep(displays[i])) if (CGDisplayIsAsleep(displays[i]))
continue; continue;
const uint32_t unitNumber = CGDisplayUnitNumber(displays[i]);
NSScreen* screen = nil;
for (screen in [NSScreen screens])
{
NSNumber* screenNumber = [screen deviceDescription][@"NSScreenNumber"];
// HACK: Compare unit numbers instead of display IDs to work around // HACK: Compare unit numbers instead of display IDs to work around
// display replacement on machines with automatic graphics // display replacement on machines with automatic graphics
// switching // switching
const uint32_t unitNumber = CGDisplayUnitNumber(displays[i]); if (CGDisplayUnitNumber([screenNumber unsignedIntValue]) == unitNumber)
for (uint32_t j = 0; j < disconnectedCount; j++) break;
}
// HACK: Compare unit numbers instead of display IDs to work around
// display replacement on machines with automatic graphics
// switching
uint32_t j;
for (j = 0; j < disconnectedCount; j++)
{ {
if (disconnected[j] && disconnected[j]->ns.unitNumber == unitNumber) if (disconnected[j] && disconnected[j]->ns.unitNumber == unitNumber)
{ {
disconnected[j]->ns.screen = screen;
disconnected[j] = NULL; disconnected[j] = NULL;
break; break;
} }
} }
if (j < disconnectedCount)
continue;
const CGSize size = CGDisplayScreenSize(displays[i]); const CGSize size = CGDisplayScreenSize(displays[i]);
char* name = getDisplayName(displays[i]); char* name = getMonitorName(displays[i], screen);
if (!name) if (!name)
name = _glfw_strdup("Unknown"); continue;
_GLFWmonitor* monitor = _glfwAllocMonitor(name, size.width, size.height); _GLFWmonitor* monitor = _glfwAllocMonitor(name, size.width, size.height);
monitor->ns.displayID = displays[i]; monitor->ns.displayID = displays[i];
monitor->ns.unitNumber = unitNumber; monitor->ns.unitNumber = unitNumber;
monitor->ns.screen = screen;
free(name); free(name);
@ -463,8 +470,11 @@ void _glfwPlatformGetMonitorContentScale(_GLFWmonitor* monitor,
{ {
@autoreleasepool { @autoreleasepool {
if (!refreshMonitorScreen(monitor)) if (!monitor->ns.screen)
return; {
_glfwInputError(GLFW_PLATFORM_ERROR,
"Cocoa: Cannot query content scale without screen");
}
const NSRect points = [monitor->ns.screen frame]; const NSRect points = [monitor->ns.screen frame];
const NSRect pixels = [monitor->ns.screen convertRectToBacking:points]; const NSRect pixels = [monitor->ns.screen convertRectToBacking:points];
@ -483,8 +493,11 @@ void _glfwPlatformGetMonitorWorkarea(_GLFWmonitor* monitor,
{ {
@autoreleasepool { @autoreleasepool {
if (!refreshMonitorScreen(monitor)) if (!monitor->ns.screen)
return; {
_glfwInputError(GLFW_PLATFORM_ERROR,
"Cocoa: Cannot query workarea without screen");
}
const NSRect frameRect = [monitor->ns.screen visibleFrame]; const NSRect frameRect = [monitor->ns.screen visibleFrame];
@ -527,7 +540,7 @@ GLFWvidmode* _glfwPlatformGetVideoModes(_GLFWmonitor* monitor, int* count)
} }
// Skip duplicate modes // Skip duplicate modes
if (i < *count) if (j < *count)
continue; continue;
(*count)++; (*count)++;

View file

@ -1635,14 +1635,21 @@ int _glfwPlatformCreateStandardCursor(_GLFWcursor* cursor, int shape)
SEL cursorSelector = NULL; SEL cursorSelector = NULL;
// HACK: Try to use a private message // HACK: Try to use a private message
if (shape == GLFW_RESIZE_EW_CURSOR) switch (shape)
{
case GLFW_RESIZE_EW_CURSOR:
cursorSelector = NSSelectorFromString(@"_windowResizeEastWestCursor"); cursorSelector = NSSelectorFromString(@"_windowResizeEastWestCursor");
else if (shape == GLFW_RESIZE_NS_CURSOR) break;
case GLFW_RESIZE_NS_CURSOR:
cursorSelector = NSSelectorFromString(@"_windowResizeNorthSouthCursor"); cursorSelector = NSSelectorFromString(@"_windowResizeNorthSouthCursor");
else if (shape == GLFW_RESIZE_NWSE_CURSOR) break;
case GLFW_RESIZE_NWSE_CURSOR:
cursorSelector = NSSelectorFromString(@"_windowResizeNorthWestSouthEastCursor"); cursorSelector = NSSelectorFromString(@"_windowResizeNorthWestSouthEastCursor");
else if (shape == GLFW_RESIZE_NESW_CURSOR) break;
case GLFW_RESIZE_NESW_CURSOR:
cursorSelector = NSSelectorFromString(@"_windowResizeNorthEastSouthWestCursor"); cursorSelector = NSSelectorFromString(@"_windowResizeNorthEastSouthWestCursor");
break;
}
if (cursorSelector && [NSCursor respondsToSelector:cursorSelector]) if (cursorSelector && [NSCursor respondsToSelector:cursorSelector])
{ {
@ -1653,22 +1660,33 @@ int _glfwPlatformCreateStandardCursor(_GLFWcursor* cursor, int shape)
if (!cursor->ns.object) if (!cursor->ns.object)
{ {
if (shape == GLFW_ARROW_CURSOR) switch (shape)
{
case GLFW_ARROW_CURSOR:
cursor->ns.object = [NSCursor arrowCursor]; cursor->ns.object = [NSCursor arrowCursor];
else if (shape == GLFW_IBEAM_CURSOR) break;
case GLFW_IBEAM_CURSOR:
cursor->ns.object = [NSCursor IBeamCursor]; cursor->ns.object = [NSCursor IBeamCursor];
else if (shape == GLFW_CROSSHAIR_CURSOR) break;
case GLFW_CROSSHAIR_CURSOR:
cursor->ns.object = [NSCursor crosshairCursor]; cursor->ns.object = [NSCursor crosshairCursor];
else if (shape == GLFW_POINTING_HAND_CURSOR) break;
case GLFW_POINTING_HAND_CURSOR:
cursor->ns.object = [NSCursor pointingHandCursor]; cursor->ns.object = [NSCursor pointingHandCursor];
else if (shape == GLFW_RESIZE_EW_CURSOR) break;
case GLFW_RESIZE_EW_CURSOR:
cursor->ns.object = [NSCursor resizeLeftRightCursor]; cursor->ns.object = [NSCursor resizeLeftRightCursor];
else if (shape == GLFW_RESIZE_NS_CURSOR) break;
case GLFW_RESIZE_NS_CURSOR:
cursor->ns.object = [NSCursor resizeUpDownCursor]; cursor->ns.object = [NSCursor resizeUpDownCursor];
else if (shape == GLFW_RESIZE_ALL_CURSOR) break;
case GLFW_RESIZE_ALL_CURSOR:
cursor->ns.object = [NSCursor closedHandCursor]; cursor->ns.object = [NSCursor closedHandCursor];
else if (shape == GLFW_NOT_ALLOWED_CURSOR) break;
case GLFW_NOT_ALLOWED_CURSOR:
cursor->ns.object = [NSCursor operationNotAllowedCursor]; cursor->ns.object = [NSCursor operationNotAllowedCursor];
break;
}
} }
if (!cursor->ns.object) if (!cursor->ns.object)

View file

@ -196,12 +196,6 @@ const _GLFWfbconfig* _glfwChooseFBConfig(const _GLFWfbconfig* desired,
continue; continue;
} }
if (desired->doublebuffer != current->doublebuffer)
{
// Double buffering is a hard constraint
continue;
}
// Count number of missing buffers // Count number of missing buffers
{ {
missing = 0; missing = 0;
@ -570,6 +564,8 @@ GLFWbool _glfwRefreshContextAttribs(_GLFWwindow* window,
PFNGLCLEARPROC glClear = (PFNGLCLEARPROC) PFNGLCLEARPROC glClear = (PFNGLCLEARPROC)
window->context.getProcAddress("glClear"); window->context.getProcAddress("glClear");
glClear(GL_COLOR_BUFFER_BIT); glClear(GL_COLOR_BUFFER_BIT);
if (window->doublebuffer)
window->context.swapBuffers(window); window->context.swapBuffers(window);
} }

View file

@ -173,7 +173,7 @@ static GLFWbool chooseEGLConfig(const _GLFWctxconfig* ctxconfig,
u->stencilBits = getEGLConfigAttrib(n, EGL_STENCIL_SIZE); u->stencilBits = getEGLConfigAttrib(n, EGL_STENCIL_SIZE);
u->samples = getEGLConfigAttrib(n, EGL_SAMPLES); u->samples = getEGLConfigAttrib(n, EGL_SAMPLES);
u->doublebuffer = GLFW_TRUE; u->doublebuffer = desired->doublebuffer;
u->handle = (uintptr_t) n; u->handle = (uintptr_t) n;
usableCount++; usableCount++;
@ -643,6 +643,9 @@ GLFWbool _glfwCreateContextEGL(_GLFWwindow* window,
setAttrib(EGL_GL_COLORSPACE_KHR, EGL_GL_COLORSPACE_SRGB_KHR); 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); setAttrib(EGL_NONE, EGL_NONE);
native = _glfwPlatformGetEGLNativeWindow(window); native = _glfwPlatformGetEGLNativeWindow(window);

View file

@ -64,6 +64,8 @@
#define EGL_OPENGL_ES_API 0x30a0 #define EGL_OPENGL_ES_API 0x30a0
#define EGL_OPENGL_API 0x30a2 #define EGL_OPENGL_API 0x30a2
#define EGL_NONE 0x3038 #define EGL_NONE 0x3038
#define EGL_RENDER_BUFFER 0x3086
#define EGL_SINGLE_BUFFER 0x3085
#define EGL_EXTENSIONS 0x3055 #define EGL_EXTENSIONS 0x3055
#define EGL_CONTEXT_CLIENT_VERSION 0x3098 #define EGL_CONTEXT_CLIENT_VERSION 0x3098
#define EGL_NATIVE_VISUAL_ID 0x302e #define EGL_NATIVE_VISUAL_ID 0x302e

View file

@ -92,6 +92,9 @@ static GLFWbool chooseGLXFBConfig(const _GLFWfbconfig* desired,
continue; continue;
} }
if (getGLXFBConfigAttrib(n, GLX_DOUBLEBUFFER) != desired->doublebuffer)
continue;
if (desired->transparent) if (desired->transparent)
{ {
XVisualInfo* vi = glXGetVisualFromFBConfig(_glfw.x11.display, n); XVisualInfo* vi = glXGetVisualFromFBConfig(_glfw.x11.display, n);
@ -119,8 +122,6 @@ static GLFWbool chooseGLXFBConfig(const _GLFWfbconfig* desired,
if (getGLXFBConfigAttrib(n, GLX_STEREO)) if (getGLXFBConfigAttrib(n, GLX_STEREO))
u->stereo = GLFW_TRUE; u->stereo = GLFW_TRUE;
if (getGLXFBConfigAttrib(n, GLX_DOUBLEBUFFER))
u->doublebuffer = GLFW_TRUE;
if (_glfw.glx.ARB_multisample) if (_glfw.glx.ARB_multisample)
u->samples = getGLXFBConfigAttrib(n, GLX_SAMPLES); u->samples = getGLXFBConfigAttrib(n, GLX_SAMPLES);

View file

@ -57,7 +57,10 @@ static _GLFWinitconfig _glfwInitHints =
{ {
GLFW_TRUE, // macOS menu bar GLFW_TRUE, // macOS menu bar
GLFW_TRUE // macOS bundle chdir GLFW_TRUE // macOS bundle chdir
} },
{
GLFW_TRUE, // X11 XCB Vulkan surface
},
}; };
// Terminate the library // Terminate the library
@ -298,6 +301,9 @@ GLFWAPI void glfwInitHint(int hint, int value)
case GLFW_COCOA_MENUBAR: case GLFW_COCOA_MENUBAR:
_glfwInitHints.ns.menubar = value; _glfwInitHints.ns.menubar = value;
return; return;
case GLFW_X11_XCB_VULKAN_SURFACE:
_glfwInitHints.x11.xcbVulkanSurface = value;
return;
} }
_glfwInputError(GLFW_INVALID_ENUM, _glfwInputError(GLFW_INVALID_ENUM,

View file

@ -446,7 +446,6 @@ _GLFWjoystick* _glfwAllocJoystick(const char* name,
js = _glfw.joysticks + jid; js = _glfw.joysticks + jid;
js->present = GLFW_TRUE; js->present = GLFW_TRUE;
js->name = _glfw_strdup(name);
js->axes = calloc(axisCount, sizeof(float)); js->axes = calloc(axisCount, sizeof(float));
js->buttons = calloc(buttonCount + (size_t) hatCount * 4, 1); js->buttons = calloc(buttonCount + (size_t) hatCount * 4, 1);
js->hats = calloc(hatCount, 1); js->hats = calloc(hatCount, 1);
@ -454,6 +453,7 @@ _GLFWjoystick* _glfwAllocJoystick(const char* name,
js->buttonCount = buttonCount; js->buttonCount = buttonCount;
js->hatCount = hatCount; js->hatCount = hatCount;
strncpy(js->name, name, sizeof(js->name) - 1);
strncpy(js->guid, guid, sizeof(js->guid) - 1); strncpy(js->guid, guid, sizeof(js->guid) - 1);
js->mapping = findValidMapping(js); js->mapping = findValidMapping(js);
@ -464,7 +464,6 @@ _GLFWjoystick* _glfwAllocJoystick(const char* name,
// //
void _glfwFreeJoystick(_GLFWjoystick* js) void _glfwFreeJoystick(_GLFWjoystick* js)
{ {
free(js->name);
free(js->axes); free(js->axes);
free(js->buttons); free(js->buttons);
free(js->hats); free(js->hats);

View file

@ -248,6 +248,9 @@ struct _GLFWinitconfig
GLFWbool menubar; GLFWbool menubar;
GLFWbool chdir; GLFWbool chdir;
} ns; } ns;
struct {
GLFWbool xcbVulkanSurface;
} x11;
}; };
// Window configuration // Window configuration
@ -384,6 +387,7 @@ struct _GLFWwindow
GLFWbool mousePassthrough; GLFWbool mousePassthrough;
GLFWbool shouldClose; GLFWbool shouldClose;
void* userPointer; void* userPointer;
GLFWbool doublebuffer;
GLFWvidmode videoMode; GLFWvidmode videoMode;
_GLFWmonitor* monitor; _GLFWmonitor* monitor;
_GLFWcursor* cursor; _GLFWcursor* cursor;
@ -432,7 +436,7 @@ struct _GLFWwindow
// //
struct _GLFWmonitor struct _GLFWmonitor
{ {
char* name; char name[128];
void* userPointer; void* userPointer;
// Physical dimensions in millimeters. // Physical dimensions in millimeters.
@ -493,7 +497,7 @@ struct _GLFWjoystick
int buttonCount; int buttonCount;
unsigned char* hats; unsigned char* hats;
int hatCount; int hatCount;
char* name; char name[128];
void* userPointer; void* userPointer;
char guid[33]; char guid[33];
_GLFWmapping* mapping; _GLFWmapping* mapping;

File diff suppressed because it is too large Load diff

View file

@ -170,8 +170,7 @@ _GLFWmonitor* _glfwAllocMonitor(const char* name, int widthMM, int heightMM)
monitor->widthMM = widthMM; monitor->widthMM = widthMM;
monitor->heightMM = heightMM; monitor->heightMM = heightMM;
if (name) strncpy(monitor->name, name, sizeof(monitor->name) - 1);
monitor->name = _glfw_strdup(name);
return monitor; return monitor;
} }
@ -189,7 +188,6 @@ void _glfwFreeMonitor(_GLFWmonitor* monitor)
_glfwFreeGammaArrays(&monitor->currentRamp); _glfwFreeGammaArrays(&monitor->currentRamp);
free(monitor->modes); free(monitor->modes);
free(monitor->name);
free(monitor); free(monitor);
} }

View file

@ -165,6 +165,9 @@ static int choosePixelFormat(_GLFWwindow* window,
if (findAttribValue(WGL_ACCELERATION_ARB) == WGL_NO_ACCELERATION_ARB) if (findAttribValue(WGL_ACCELERATION_ARB) == WGL_NO_ACCELERATION_ARB)
continue; continue;
if (findAttribValue(WGL_DOUBLE_BUFFER_ARB) != fbconfig->doublebuffer)
continue;
u->redBits = findAttribValue(WGL_RED_BITS_ARB); u->redBits = findAttribValue(WGL_RED_BITS_ARB);
u->greenBits = findAttribValue(WGL_GREEN_BITS_ARB); u->greenBits = findAttribValue(WGL_GREEN_BITS_ARB);
u->blueBits = findAttribValue(WGL_BLUE_BITS_ARB); u->blueBits = findAttribValue(WGL_BLUE_BITS_ARB);
@ -182,8 +185,6 @@ static int choosePixelFormat(_GLFWwindow* window,
if (findAttribValue(WGL_STEREO_ARB)) if (findAttribValue(WGL_STEREO_ARB))
u->stereo = GLFW_TRUE; u->stereo = GLFW_TRUE;
if (findAttribValue(WGL_DOUBLE_BUFFER_ARB))
u->doublebuffer = GLFW_TRUE;
if (_glfw.wgl.ARB_multisample) if (_glfw.wgl.ARB_multisample)
u->samples = findAttribValue(WGL_SAMPLES_ARB); u->samples = findAttribValue(WGL_SAMPLES_ARB);
@ -239,6 +240,9 @@ static int choosePixelFormat(_GLFWwindow* window,
if (pfd.iPixelType != PFD_TYPE_RGBA) if (pfd.iPixelType != PFD_TYPE_RGBA)
continue; continue;
if (!!(pfd.dwFlags & PFD_DOUBLEBUFFER) != fbconfig->doublebuffer)
continue;
u->redBits = pfd.cRedBits; u->redBits = pfd.cRedBits;
u->greenBits = pfd.cGreenBits; u->greenBits = pfd.cGreenBits;
u->blueBits = pfd.cBlueBits; u->blueBits = pfd.cBlueBits;
@ -256,8 +260,6 @@ static int choosePixelFormat(_GLFWwindow* window,
if (pfd.dwFlags & PFD_STEREO) if (pfd.dwFlags & PFD_STEREO)
u->stereo = GLFW_TRUE; u->stereo = GLFW_TRUE;
if (pfd.dwFlags & PFD_DOUBLEBUFFER)
u->doublebuffer = GLFW_TRUE;
} }
u->handle = pixelFormat; u->handle = pixelFormat;

View file

@ -39,6 +39,10 @@ static const GUID _glfw_GUID_DEVINTERFACE_HID =
#if defined(_GLFW_USE_HYBRID_HPG) || defined(_GLFW_USE_OPTIMUS_HPG) #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"
#endif
// Executables (but not DLLs) exporting this symbol with this value will be // Executables (but not DLLs) exporting this symbol with this value will be
// automatically directed to the high-performance GPU on Nvidia Optimus systems // automatically directed to the high-performance GPU on Nvidia Optimus systems
// with up-to-date drivers // with up-to-date drivers
@ -614,7 +618,9 @@ void _glfwPlatformTerminate(void)
const char* _glfwPlatformGetVersionString(void) const char* _glfwPlatformGetVersionString(void)
{ {
return _GLFW_VERSION_NUMBER " Win32 WGL EGL OSMesa" return _GLFW_VERSION_NUMBER " Win32 WGL EGL OSMesa"
#if defined(__MINGW32__) #if defined(__MINGW64_VERSION_MAJOR)
" MinGW-w64"
#elif defined(__MINGW32__)
" MinGW" " MinGW"
#elif defined(_MSC_VER) #elif defined(_MSC_VER)
" VisualC" " VisualC"

View file

@ -39,8 +39,8 @@
#endif #endif
// This is a workaround for the fact that glfw3.h needs to export APIENTRY (for // 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 // example to allow applications to correctly declare a GL_KHR_debug callback)
// callback) but windows.h assumes no one will define APIENTRY before it does // but windows.h assumes no one will define APIENTRY before it does
#undef APIENTRY #undef APIENTRY
// GLFW on Windows is Unicode only and does not work in MBCS mode // GLFW on Windows is Unicode only and does not work in MBCS mode
@ -314,6 +314,9 @@ typedef struct _GLFWwindowWin32
GLFWbool scaleToMonitor; GLFWbool scaleToMonitor;
GLFWbool keymenu; GLFWbool keymenu;
// Cached size used to filter out duplicate events
int width, height;
// The last received cursor position, regardless of source // The last received cursor position, regardless of source
int lastCursorPosX, lastCursorPosY; int lastCursorPosX, lastCursorPosY;
// The last recevied high surrogate when decoding pairs of UTF-16 messages // The last recevied high surrogate when decoding pairs of UTF-16 messages

View file

@ -501,7 +501,17 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
case WM_NCCREATE: case WM_NCCREATE:
{ {
if (_glfwIsWindows10AnniversaryUpdateOrGreaterWin32()) if (_glfwIsWindows10AnniversaryUpdateOrGreaterWin32())
{
const CREATESTRUCTW* cs = (const CREATESTRUCTW*) lParam;
const _GLFWwndconfig* wndconfig = cs->lpCreateParams;
// On per-monitor DPI aware V1 systems, only enable
// non-client scaling for windows that scale the client area
// We need WM_GETDPISCALEDSIZE from V2 to keep the client
// area static when the non-client area is scaled
if (wndconfig && wndconfig->scaleToMonitor)
EnableNonClientDpiScaling(hWnd); EnableNonClientDpiScaling(hWnd);
}
break; break;
} }
@ -961,6 +971,8 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
case WM_SIZE: case WM_SIZE:
{ {
const int width = LOWORD(lParam);
const int height = HIWORD(lParam);
const GLFWbool iconified = wParam == SIZE_MINIMIZED; const GLFWbool iconified = wParam == SIZE_MINIMIZED;
const GLFWbool maximized = wParam == SIZE_MAXIMIZED || const GLFWbool maximized = wParam == SIZE_MAXIMIZED ||
(window->win32.maximized && (window->win32.maximized &&
@ -975,8 +987,14 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
if (window->win32.maximized != maximized) if (window->win32.maximized != maximized)
_glfwInputWindowMaximize(window, maximized); _glfwInputWindowMaximize(window, maximized);
_glfwInputFramebufferSize(window, LOWORD(lParam), HIWORD(lParam)); if (width != window->win32.width || height != window->win32.height)
_glfwInputWindowSize(window, LOWORD(lParam), HIWORD(lParam)); {
window->win32.width = width;
window->win32.height = height;
_glfwInputFramebufferSize(window, width, height);
_glfwInputWindowSize(window, width, height);
}
if (window->monitor && window->win32.iconified != iconified) if (window->monitor && window->win32.iconified != iconified)
{ {
@ -1130,9 +1148,11 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
const float xscale = HIWORD(wParam) / (float) USER_DEFAULT_SCREEN_DPI; const float xscale = HIWORD(wParam) / (float) USER_DEFAULT_SCREEN_DPI;
const float yscale = LOWORD(wParam) / (float) USER_DEFAULT_SCREEN_DPI; const float yscale = LOWORD(wParam) / (float) USER_DEFAULT_SCREEN_DPI;
// Only apply the suggested size if the OS is new enough to have // Resize windowed mode windows that either permit rescaling or that
// sent a WM_GETDPISCALEDSIZE before this // need it to compensate for non-client area scaling
if (_glfwIsWindows10CreatorsUpdateOrGreaterWin32()) if (!window->monitor &&
(window->win32.scaleToMonitor ||
_glfwIsWindows10CreatorsUpdateOrGreaterWin32()))
{ {
RECT* suggested = (RECT*) lParam; RECT* suggested = (RECT*) lParam;
SetWindowPos(window->win32.handle, HWND_TOP, SetWindowPos(window->win32.handle, HWND_TOP,
@ -1247,7 +1267,7 @@ static int createNativeWindow(_GLFWwindow* window,
NULL, // No parent window NULL, // No parent window
NULL, // No window menu NULL, // No window menu
GetModuleHandleW(NULL), GetModuleHandleW(NULL),
NULL); (LPVOID) wndconfig);
free(wideTitle); free(wideTitle);
@ -1315,6 +1335,8 @@ static int createNativeWindow(_GLFWwindow* window,
window->win32.transparent = GLFW_TRUE; window->win32.transparent = GLFW_TRUE;
} }
_glfwPlatformGetWindowSize(window, &window->win32.width, &window->win32.height);
return GLFW_TRUE; return GLFW_TRUE;
} }
@ -2113,28 +2135,39 @@ int _glfwPlatformCreateStandardCursor(_GLFWcursor* cursor, int shape)
{ {
int id = 0; int id = 0;
if (shape == GLFW_ARROW_CURSOR) switch (shape)
id = OCR_NORMAL;
else if (shape == GLFW_IBEAM_CURSOR)
id = OCR_IBEAM;
else if (shape == GLFW_CROSSHAIR_CURSOR)
id = OCR_CROSS;
else if (shape == GLFW_POINTING_HAND_CURSOR)
id = OCR_HAND;
else if (shape == GLFW_RESIZE_EW_CURSOR)
id = OCR_SIZEWE;
else if (shape == GLFW_RESIZE_NS_CURSOR)
id = OCR_SIZENS;
else if (shape == GLFW_RESIZE_NWSE_CURSOR)
id = OCR_SIZENWSE;
else if (shape == GLFW_RESIZE_NESW_CURSOR)
id = OCR_SIZENESW;
else if (shape == GLFW_RESIZE_ALL_CURSOR)
id = OCR_SIZEALL;
else if (shape == GLFW_NOT_ALLOWED_CURSOR)
id = OCR_NO;
else
{ {
case GLFW_ARROW_CURSOR:
id = OCR_NORMAL;
break;
case GLFW_IBEAM_CURSOR:
id = OCR_IBEAM;
break;
case GLFW_CROSSHAIR_CURSOR:
id = OCR_CROSS;
break;
case GLFW_POINTING_HAND_CURSOR:
id = OCR_HAND;
break;
case GLFW_RESIZE_EW_CURSOR:
id = OCR_SIZEWE;
break;
case GLFW_RESIZE_NS_CURSOR:
id = OCR_SIZENS;
break;
case GLFW_RESIZE_NWSE_CURSOR:
id = OCR_SIZENWSE;
break;
case GLFW_RESIZE_NESW_CURSOR:
id = OCR_SIZENESW;
break;
case GLFW_RESIZE_ALL_CURSOR:
id = OCR_SIZEALL;
break;
case GLFW_NOT_ALLOWED_CURSOR:
id = OCR_NO;
break;
default:
_glfwInputError(GLFW_PLATFORM_ERROR, "Win32: Unknown standard cursor"); _glfwInputError(GLFW_PLATFORM_ERROR, "Win32: Unknown standard cursor");
return GLFW_FALSE; return GLFW_FALSE;
} }

View file

@ -206,6 +206,8 @@ GLFWAPI GLFWwindow* glfwCreateWindow(int width, int height,
window->mousePassthrough = wndconfig.mousePassthrough; window->mousePassthrough = wndconfig.mousePassthrough;
window->cursorMode = GLFW_CURSOR_NORMAL; window->cursorMode = GLFW_CURSOR_NORMAL;
window->doublebuffer = fbconfig.doublebuffer;
window->minwidth = GLFW_DONT_CARE; window->minwidth = GLFW_DONT_CARE;
window->minheight = GLFW_DONT_CARE; window->minheight = GLFW_DONT_CARE;
window->maxwidth = GLFW_DONT_CARE; window->maxwidth = GLFW_DONT_CARE;
@ -841,6 +843,8 @@ GLFWAPI int glfwGetWindowAttrib(GLFWwindow* handle, int attrib)
return window->floating; return window->floating;
case GLFW_AUTO_ICONIFY: case GLFW_AUTO_ICONIFY:
return window->autoIconify; return window->autoIconify;
case GLFW_DOUBLEBUFFER:
return window->doublebuffer;
case GLFW_CLIENT_API: case GLFW_CLIENT_API:
return window->context.client; return window->context.client;
case GLFW_CONTEXT_CREATION_API: case GLFW_CONTEXT_CREATION_API:
@ -882,27 +886,18 @@ GLFWAPI void glfwSetWindowAttrib(GLFWwindow* handle, int attrib, int value)
window->autoIconify = value; window->autoIconify = value;
else if (attrib == GLFW_RESIZABLE) else if (attrib == GLFW_RESIZABLE)
{ {
if (window->resizable == value)
return;
window->resizable = value; window->resizable = value;
if (!window->monitor) if (!window->monitor)
_glfwPlatformSetWindowResizable(window, value); _glfwPlatformSetWindowResizable(window, value);
} }
else if (attrib == GLFW_DECORATED) else if (attrib == GLFW_DECORATED)
{ {
if (window->decorated == value)
return;
window->decorated = value; window->decorated = value;
if (!window->monitor) if (!window->monitor)
_glfwPlatformSetWindowDecorated(window, value); _glfwPlatformSetWindowDecorated(window, value);
} }
else if (attrib == GLFW_FLOATING) else if (attrib == GLFW_FLOATING)
{ {
if (window->floating == value)
return;
window->floating = value; window->floating = value;
if (!window->monitor) if (!window->monitor)
_glfwPlatformSetWindowFloating(window, value); _glfwPlatformSetWindowFloating(window, value);
@ -911,9 +906,6 @@ GLFWAPI void glfwSetWindowAttrib(GLFWwindow* handle, int attrib, int value)
window->focusOnShow = value; window->focusOnShow = value;
else if (attrib == GLFW_MOUSE_PASSTHROUGH) else if (attrib == GLFW_MOUSE_PASSTHROUGH)
{ {
if (window->mousePassthrough == value)
return;
window->mousePassthrough = value; window->mousePassthrough = value;
_glfwPlatformSetWindowMousePassthrough(window, value); _glfwPlatformSetWindowMousePassthrough(window, value);
} }

View file

@ -1038,8 +1038,6 @@ int _glfwPlatformInit(void)
char *cursorSizeEnd; char *cursorSizeEnd;
long cursorSizeLong; long cursorSizeLong;
int cursorSize; int cursorSize;
int i;
_GLFWmonitor* monitor;
_glfw.wl.cursor.handle = _glfw_dlopen("libwayland-cursor.so.0"); _glfw.wl.cursor.handle = _glfw_dlopen("libwayland-cursor.so.0");
if (!_glfw.wl.cursor.handle) if (!_glfw.wl.cursor.handle)
@ -1148,17 +1146,6 @@ int _glfwPlatformInit(void)
// Sync so we got all initial output events // Sync so we got all initial output events
wl_display_roundtrip(_glfw.wl.display); wl_display_roundtrip(_glfw.wl.display);
for (i = 0; i < _glfw.monitorCount; ++i)
{
monitor = _glfw.monitors[i];
if (monitor->widthMM <= 0 || monitor->heightMM <= 0)
{
// If Wayland does not provide a physical size, assume the default 96 DPI
monitor->widthMM = (int) (monitor->modes[monitor->wl.currentMode].width * 25.4f / 96.f);
monitor->heightMM = (int) (monitor->modes[monitor->wl.currentMode].height * 25.4f / 96.f);
}
}
_glfwInitTimerPOSIX(); _glfwInitTimerPOSIX();
_glfw.wl.timerfd = -1; _glfw.wl.timerfd = -1;

View file

@ -47,15 +47,13 @@ static void outputHandleGeometry(void* data,
int32_t transform) int32_t transform)
{ {
struct _GLFWmonitor *monitor = data; struct _GLFWmonitor *monitor = data;
char name[1024];
monitor->wl.x = x; monitor->wl.x = x;
monitor->wl.y = y; monitor->wl.y = y;
monitor->widthMM = physicalWidth; monitor->widthMM = physicalWidth;
monitor->heightMM = physicalHeight; monitor->heightMM = physicalHeight;
snprintf(name, sizeof(name), "%s %s", make, model); snprintf(monitor->name, sizeof(monitor->name), "%s %s", make, model);
monitor->name = _glfw_strdup(name);
} }
static void outputHandleMode(void* data, static void outputHandleMode(void* data,
@ -88,6 +86,14 @@ static void outputHandleDone(void* data, struct wl_output* output)
{ {
struct _GLFWmonitor *monitor = data; struct _GLFWmonitor *monitor = data;
if (monitor->widthMM <= 0 || monitor->heightMM <= 0)
{
// If Wayland does not provide a physical size, assume the default 96 DPI
const GLFWvidmode* mode = &monitor->modes[monitor->wl.currentMode];
monitor->widthMM = (int) (mode->width * 25.4f / 96.f);
monitor->heightMM = (int) (mode->height * 25.4f / 96.f);
}
_glfwInputMonitor(monitor, GLFW_CONNECTED, _GLFW_INSERT_LAST); _glfwInputMonitor(monitor, GLFW_CONNECTED, _GLFW_INSERT_LAST);
} }
@ -125,7 +131,7 @@ void _glfwAddOutputWayland(uint32_t name, uint32_t version)
} }
// The actual name of this output will be set in the geometry handler. // The actual name of this output will be set in the geometry handler.
monitor = _glfwAllocMonitor(NULL, 0, 0); monitor = _glfwAllocMonitor("", 0, 0);
output = wl_registry_bind(_glfw.wl.registry, output = wl_registry_bind(_glfw.wl.registry,
name, name,

View file

@ -246,10 +246,10 @@ static void createDecorations(_GLFWwindow* window)
static void destroyDecoration(_GLFWdecorationWayland* decoration) static void destroyDecoration(_GLFWdecorationWayland* decoration)
{ {
if (decoration->surface)
wl_surface_destroy(decoration->surface);
if (decoration->subsurface) if (decoration->subsurface)
wl_subsurface_destroy(decoration->subsurface); wl_subsurface_destroy(decoration->subsurface);
if (decoration->surface)
wl_surface_destroy(decoration->surface);
if (decoration->viewport) if (decoration->viewport)
wp_viewport_destroy(decoration->viewport); wp_viewport_destroy(decoration->viewport);
decoration->surface = NULL; decoration->surface = NULL;
@ -1242,26 +1242,39 @@ int _glfwPlatformCreateStandardCursor(_GLFWcursor* cursor, int shape)
const char* name = NULL; const char* name = NULL;
// Try the XDG names first // Try the XDG names first
if (shape == GLFW_ARROW_CURSOR) switch (shape)
{
case GLFW_ARROW_CURSOR:
name = "default"; name = "default";
else if (shape == GLFW_IBEAM_CURSOR) break;
case GLFW_IBEAM_CURSOR:
name = "text"; name = "text";
else if (shape == GLFW_CROSSHAIR_CURSOR) break;
case GLFW_CROSSHAIR_CURSOR:
name = "crosshair"; name = "crosshair";
else if (shape == GLFW_POINTING_HAND_CURSOR) break;
case GLFW_POINTING_HAND_CURSOR:
name = "pointer"; name = "pointer";
else if (shape == GLFW_RESIZE_EW_CURSOR) break;
case GLFW_RESIZE_EW_CURSOR:
name = "ew-resize"; name = "ew-resize";
else if (shape == GLFW_RESIZE_NS_CURSOR) break;
case GLFW_RESIZE_NS_CURSOR:
name = "ns-resize"; name = "ns-resize";
else if (shape == GLFW_RESIZE_NWSE_CURSOR) break;
case GLFW_RESIZE_NWSE_CURSOR:
name = "nwse-resize"; name = "nwse-resize";
else if (shape == GLFW_RESIZE_NESW_CURSOR) break;
case GLFW_RESIZE_NESW_CURSOR:
name = "nesw-resize"; name = "nesw-resize";
else if (shape == GLFW_RESIZE_ALL_CURSOR) break;
case GLFW_RESIZE_ALL_CURSOR:
name = "all-scroll"; name = "all-scroll";
else if (shape == GLFW_NOT_ALLOWED_CURSOR) break;
case GLFW_NOT_ALLOWED_CURSOR:
name = "not-allowed"; name = "not-allowed";
break;
}
cursor->wl.cursor = wl_cursor_theme_get_cursor(_glfw.wl.cursorTheme, name); cursor->wl.cursor = wl_cursor_theme_get_cursor(_glfw.wl.cursorTheme, name);
@ -1274,22 +1287,23 @@ int _glfwPlatformCreateStandardCursor(_GLFWcursor* cursor, int shape)
if (!cursor->wl.cursor) if (!cursor->wl.cursor)
{ {
// Fall back to the core X11 names // Fall back to the core X11 names
if (shape == GLFW_ARROW_CURSOR) switch (shape)
name = "left_ptr";
else if (shape == GLFW_IBEAM_CURSOR)
name = "xterm";
else if (shape == GLFW_CROSSHAIR_CURSOR)
name = "crosshair";
else if (shape == GLFW_POINTING_HAND_CURSOR)
name = "hand2";
else if (shape == GLFW_RESIZE_EW_CURSOR)
name = "sb_h_double_arrow";
else if (shape == GLFW_RESIZE_NS_CURSOR)
name = "sb_v_double_arrow";
else if (shape == GLFW_RESIZE_ALL_CURSOR)
name = "fleur";
else
{ {
case GLFW_ARROW_CURSOR:
name = "left_ptr";
case GLFW_IBEAM_CURSOR:
name = "xterm";
case GLFW_CROSSHAIR_CURSOR:
name = "crosshair";
case GLFW_POINTING_HAND_CURSOR:
name = "hand2";
case GLFW_RESIZE_EW_CURSOR:
name = "sb_h_double_arrow";
case GLFW_RESIZE_NS_CURSOR:
name = "sb_v_double_arrow";
case GLFW_RESIZE_ALL_CURSOR:
name = "fleur";
default:
_glfwInputError(GLFW_CURSOR_UNAVAILABLE, _glfwInputError(GLFW_CURSOR_UNAVAILABLE,
"Wayland: Standard cursor shape unavailable"); "Wayland: Standard cursor shape unavailable");
return GLFW_FALSE; return GLFW_FALSE;

View file

@ -813,11 +813,15 @@ static GLFWbool initExtensions(void)
XkbGroupStateMask, XkbGroupStateMask); XkbGroupStateMask, XkbGroupStateMask);
} }
if (_glfw.hints.init.x11.xcbVulkanSurface)
{
#if defined(__CYGWIN__) #if defined(__CYGWIN__)
_glfw.x11.x11xcb.handle = _glfw_dlopen("libX11-xcb-1.so"); _glfw.x11.x11xcb.handle = _glfw_dlopen("libX11-xcb-1.so");
#else #else
_glfw.x11.x11xcb.handle = _glfw_dlopen("libX11-xcb.so.1"); _glfw.x11.x11xcb.handle = _glfw_dlopen("libX11-xcb.so.1");
#endif #endif
}
if (_glfw.x11.x11xcb.handle) if (_glfw.x11.x11xcb.handle)
{ {
_glfw.x11.x11xcb.GetXCBConnection = (PFN_XGetXCBConnection) _glfw.x11.x11xcb.GetXCBConnection = (PFN_XGetXCBConnection)

View file

@ -2485,7 +2485,11 @@ void _glfwPlatformSetWindowMonitor(_GLFWwindow* window,
} }
if (window->monitor) if (window->monitor)
{
_glfwPlatformSetWindowDecorated(window, window->decorated);
_glfwPlatformSetWindowFloating(window, window->floating);
releaseMonitor(window); releaseMonitor(window);
}
_glfwInputWindowMonitor(window, monitor); _glfwInputWindowMonitor(window, monitor);
updateNormalHints(window, width, height); updateNormalHints(window, width, height);
@ -2935,26 +2939,39 @@ int _glfwPlatformCreateStandardCursor(_GLFWcursor* cursor, int shape)
const int size = XcursorGetDefaultSize(_glfw.x11.display); const int size = XcursorGetDefaultSize(_glfw.x11.display);
const char* name = NULL; const char* name = NULL;
if (shape == GLFW_ARROW_CURSOR) switch (shape)
{
case GLFW_ARROW_CURSOR:
name = "default"; name = "default";
else if (shape == GLFW_IBEAM_CURSOR) break;
case GLFW_IBEAM_CURSOR:
name = "text"; name = "text";
else if (shape == GLFW_CROSSHAIR_CURSOR) break;
case GLFW_CROSSHAIR_CURSOR:
name = "crosshair"; name = "crosshair";
else if (shape == GLFW_POINTING_HAND_CURSOR) break;
case GLFW_POINTING_HAND_CURSOR:
name = "pointer"; name = "pointer";
else if (shape == GLFW_RESIZE_EW_CURSOR) break;
case GLFW_RESIZE_EW_CURSOR:
name = "ew-resize"; name = "ew-resize";
else if (shape == GLFW_RESIZE_NS_CURSOR) break;
case GLFW_RESIZE_NS_CURSOR:
name = "ns-resize"; name = "ns-resize";
else if (shape == GLFW_RESIZE_NWSE_CURSOR) break;
case GLFW_RESIZE_NWSE_CURSOR:
name = "nwse-resize"; name = "nwse-resize";
else if (shape == GLFW_RESIZE_NESW_CURSOR) break;
case GLFW_RESIZE_NESW_CURSOR:
name = "nesw-resize"; name = "nesw-resize";
else if (shape == GLFW_RESIZE_ALL_CURSOR) break;
case GLFW_RESIZE_ALL_CURSOR:
name = "all-scroll"; name = "all-scroll";
else if (shape == GLFW_NOT_ALLOWED_CURSOR) break;
case GLFW_NOT_ALLOWED_CURSOR:
name = "not-allowed"; name = "not-allowed";
break;
}
XcursorImage* image = XcursorLibraryLoadImage(name, theme, size); XcursorImage* image = XcursorLibraryLoadImage(name, theme, size);
if (image) if (image)
@ -2969,22 +2986,30 @@ int _glfwPlatformCreateStandardCursor(_GLFWcursor* cursor, int shape)
{ {
unsigned int native = 0; unsigned int native = 0;
if (shape == GLFW_ARROW_CURSOR) switch (shape)
native = XC_left_ptr;
else if (shape == GLFW_IBEAM_CURSOR)
native = XC_xterm;
else if (shape == GLFW_CROSSHAIR_CURSOR)
native = XC_crosshair;
else if (shape == GLFW_POINTING_HAND_CURSOR)
native = XC_hand2;
else if (shape == GLFW_RESIZE_EW_CURSOR)
native = XC_sb_h_double_arrow;
else if (shape == GLFW_RESIZE_NS_CURSOR)
native = XC_sb_v_double_arrow;
else if (shape == GLFW_RESIZE_ALL_CURSOR)
native = XC_fleur;
else
{ {
case GLFW_ARROW_CURSOR:
native = XC_left_ptr;
break;
case GLFW_IBEAM_CURSOR:
native = XC_xterm;
break;
case GLFW_CROSSHAIR_CURSOR:
native = XC_crosshair;
break;
case GLFW_POINTING_HAND_CURSOR:
native = XC_hand2;
break;
case GLFW_RESIZE_EW_CURSOR:
native = XC_sb_h_double_arrow;
break;
case GLFW_RESIZE_NS_CURSOR:
native = XC_sb_v_double_arrow;
break;
case GLFW_RESIZE_ALL_CURSOR:
native = XC_fleur;
break;
default:
_glfwInputError(GLFW_CURSOR_UNAVAILABLE, _glfwInputError(GLFW_CURSOR_UNAVAILABLE,
"X11: Standard cursor shape unavailable"); "X11: Standard cursor shape unavailable");
return GLFW_FALSE; return GLFW_FALSE;