Compare commits

...

32 Commits

Author SHA1 Message Date
Camilla Löwy 92dcf4ce74 Start 3.6 2026-08-03 19:04:50 +02:00
Camilla Löwy d9d6f0f1f9 Start 3.5.1
Due to a misconfigured tool, an incorrect 3.5.0 tag was briefly made
available in the main Git repository.  Thanks to the manual intervention
of many packaging volunteers this has been almost entirely rolled back.
To make sure this release supersedes the incorrect tag everywhere, the
first release of GLFW 3.5 is named 3.5.1.

There are no code changes other than the version patch number.

Fixes #2758
2026-07-31 14:46:04 +02:00
Camilla Löwy deeadd3c30 Tag remaining Git and CI plumbing export-ignore 2026-07-28 17:39:40 +02:00
Camilla Löwy 0984b4354a Update changelog and add credit
Related to #2713
Related to #2810
2026-07-28 17:39:33 +02:00
road2react b7ef2919b0 Wayland: Fix rounding of fractional scale sizes
The framebuffer size for fractional scale surfaces should be rounded to
the closest integer, not truncated as is currently done.

This implements the rounding formula that the discussions over at
wayland-protocols item 132 and MR 309 appear to be converging on.

Fixes #2713
Closes #2810
2026-07-28 17:18:05 +02:00
Camilla Löwy 463cf73610 Win32: Fix scancode for media keys
Media key events were incorrectly reported with a scancode of 0x100.

This is based on a snippet by dougbinks in #2625.

Fixes #1768
Closes #2417
Fixes #2625
2026-07-09 21:51:02 +02:00
Jonas Ådahl ed6452b13c Wayland: Set the correct min/max size when non-resizable
Libdecor is a thin wrapper around xdg_toplevel, and expects the same
kind of information passed to it as if it was a xdg_toplevel. This
includes the min/max size when non-resizable, which was set when using
xdg_toplevel directly, but not when using libdecor. This fixes issues
with min/max size missing when mapping a non-resizable window.

Related to #2842
2026-06-26 16:30:12 +02:00
Camilla Löwy e94108d9db Wayland: Fix undecorated libdecor frame creation
In order to safely call libdecor_frame_set_visibility during window
creation, a libdecor frame state was synthesized and committed.

This commit instead postpones the call to libdecor_frame_set_visibility
until after the frame state received by the frame configure event has
been committed.  This appears to be a more polite approach.

Related to #2842
2026-06-26 16:30:12 +02:00
Camilla Löwy dc86d02ff1 Wayland: Fix some event types not being processed
If there was already an event available in the Wayland queue, that event
would be processed but other kinds of events (libdecor, key repeat,
joystick connection, etc.) would not be.

This commit restores the processing of all available events on every
call to glfw*Events.  It is partially based on #2842 by jadahl.

Because some libdecor plugins also process non-Wayland events, without
providing an fd for them, libdecor_dispatch is now called
unconditionally.

Fixes #2793
Closes #2795
Related to #2842
2026-06-26 16:26:43 +02:00
Camilla Löwy 06406a00a0 Wayland: Remove unused struct member 2026-06-10 01:07:02 +02:00
Tomáš Mráz de0c378aa2 Wayland: Conditionally define _GNU_SOURCE
This fixes a re-definition warning for the _GNU_SOURCE macro.

Edited by elmindreda: code formatting, author credit

Related to go-gl/glfw#359
Fixes #2833
2026-06-10 01:07:02 +02:00
Camilla Löwy 567b1ec244 Cocoa: Fix some key events not being emitted
The key combinations Cmd+Period, Ctrl+Tab and Ctrl+Esc are not passed to
the first responder as key events.

This commit catches and claims these specific key events via the key
equivalents mechanism and emits them from there instead.

Closes #1362
Fixes #2278
2026-06-09 21:56:04 +02:00
Camilla Löwy 0136febb1e Add credit
Related to #2863
2026-06-09 21:56:04 +02:00
halx99 6c397996b8 Fix Windows CI
Closes #2863
2026-06-09 21:55:55 +02:00
Camilla Löwy b00e6a8a88 Update to actions/checkout@v5 from v4
This is necessary due to the deprecation of Node.js 20 on Github Action
runners.
2026-03-30 20:11:56 +02:00
Camilla Löwy 51683a6f1c Use C99 booleans for Khronos API extensions 2026-03-27 14:36:35 +01:00
Camilla Löwy 55fd451d5f Wayland: Remove unused struct member
The libdecor initialization sync callback was saved in the library
struct but never meaningfully used.
2026-03-27 14:35:28 +01:00
Camilla Löwy 1929088dd9 Make the empty events test somewhat plausible
The empty events test now makes slightly more plausible use of
glfwPostEmptyEvent.  As a side-effect, the test now also works as
intended on Wayland.
2026-03-20 16:06:29 +01:00
Camilla Löwy 3130c004e1 Wayland: Fix missing flush in glfwHideWindow 2026-03-20 16:06:29 +01:00
Camilla Löwy bb8048122a Wayland: Fix glfwPostEmptyEvent leaking a proxy
The client-side proxy of the callback from each call to wl_display_sync
was never destroyed.

Fixes #2836
2026-03-20 16:04:12 +01:00
Camilla Löwy 50b0a135a5 Wayland: Fix deadlock causing timeout
If the frame was processed by wl_display_dispatch_queue_pending, this
would be treated as no frame having been received.

Oops.

This bug was introduced by fdd14e65b1.
2026-03-13 17:20:44 +01:00
Camilla Löwy fdd14e65b1 Wayland: Fix EGL buffer swap blocking indefinitely
When the swap interval was nonzero, EGL on Wayland would wait
indefinitely for a frame callback on a suspended window, causing
applications that call eglSwapBuffers to halt.

This re-implements the wait for a surface frame so that we can add
a reasonable timeout, while setting the EGL swap interval to zero.  That
allows applications to make progress despite the window being suspended.

Some insights for how to structure this workaround were gleaned from
dri2_wl_swap_buffers_with_damage in Mesa.

This initial implementation still has a race between glfwHideWindow and
glfwSwapBuffers when rendering on a separate thread.  This could lead to
a window becoming visible again after being hidden on the main thread.

Related to #1350
Fixes #2582
Fixes #2640
Fixes #2719
Fixes #2723
Fixes #2800
Fixes #2827
2026-03-06 14:31:27 +01:00
Camilla Löwy 54b18d5547 Fix cleanup on success in threaded rendering test 2026-03-06 14:31:26 +01:00
Camilla Löwy 05f57c0bee Wayland: Improve support for discrete scrolling
This adds support for high-resolution scroll input scaled to match
legacy discrete scroll input.  It is available on compositors that
support wl_seat version 8 or later.

High-resolution "discrete" values now replace non-scaled scroll
values when available.
2026-03-06 14:31:26 +01:00
Camilla Löwy 0d15b54c7a Use C99 booleans in config structs 2026-03-06 14:31:26 +01:00
Camilla Löwy f472380d7e Use C99 isfinite instead of various ad-hoc tests 2026-03-06 14:31:26 +01:00
Camilla Löwy 1839271de4 Wayland: Remove last traces of legacy Unicode path
The legacy keysym-to-Unicode path is only used on X11 since
21fea01161, but the file was still
included in Wayland-only builds.
2026-03-06 14:31:26 +01:00
Camilla Löwy aa5047709d POSIX: Include helper header via platform glue 2026-03-06 14:31:25 +01:00
Camilla Löwy bae8aa6e7d macOS: Fix Vulkan loader loading for Null platform 2026-03-06 14:31:25 +01:00
Camilla Löwy c5c0b69149 Fix pkgconfig dependency lists treated as strings
All other parts of the file correctly treated these variables as lists.
2026-03-06 14:31:25 +01:00
Camilla Löwy 29cd880ab5 macOS: Clarify separation between Cocoa and macOS
The timer code uses no part of Cocoa and is in turn used by other
backends than Cocoa on macOS.

The macOS timer code is now labeled macOS.  Cocoa-specific files are now
consistently labeled Cocoa, not macOS.
2026-03-06 14:31:25 +01:00
Yan Pujante 3d89365fdb Added Emscripten external platform (comment) 2026-02-28 15:40:56 +00:00
74 changed files with 698 additions and 526 deletions
+2
View File
@@ -3,3 +3,5 @@
.gitattributes export-ignore
.travis.yml export-ignore
.appveyor.yml export-ignore
.mailmap export-ignore
.github export-ignore
+8 -8
View File
@@ -17,7 +17,7 @@ jobs:
CC: clang
CFLAGS: -Werror
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
- name: Install dependencies
run: |
sudo apt update
@@ -57,7 +57,7 @@ jobs:
MACOSX_DEPLOYMENT_TARGET: 10.11
CMAKE_OSX_ARCHITECTURES: x86_64;arm64
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
- name: Configure Null shared library
run: cmake -B build-null-shared -D GLFW_BUILD_COCOA=OFF -D BUILD_SHARED_LIBS=ON
@@ -74,27 +74,27 @@ jobs:
- name: Build Cocoa shared library
run: cmake --build build-cocoa-shared --parallel
build-windows-vs2022:
name: Windows (VS2022)
build-windows-msvc:
name: Windows (MSVC)
runs-on: windows-latest
timeout-minutes: 4
env:
CFLAGS: /WX
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
- name: Configure Win32 shared x86 library
run: cmake -B build-win32-shared-x86 -G "Visual Studio 17 2022" -A Win32 -D BUILD_SHARED_LIBS=ON
run: cmake -B build-win32-shared-x86 -A Win32 -D BUILD_SHARED_LIBS=ON
- name: Build Win32 shared x86 library
run: cmake --build build-win32-shared-x86 --parallel
- name: Configure Win32 static x64 library
run: cmake -B build-win32-static-x64 -G "Visual Studio 17 2022" -A x64
run: cmake -B build-win32-static-x64 -A x64
- name: Build Win32 static x64 library
run: cmake --build build-win32-static-x64 --parallel
- name: Configure Win32 shared x64 library
run: cmake -B build-win32-shared-x64 -G "Visual Studio 17 2022" -A x64 -D BUILD_SHARED_LIBS=ON
run: cmake -B build-win32-shared-x64 -A x64 -D BUILD_SHARED_LIBS=ON
- name: Build Win32 shared x64 library
run: cmake --build build-win32-shared-x64 --parallel
+2 -2
View File
@@ -57,11 +57,11 @@ src/glfw3ConfigVersion.cmake
# Compiled binaries
src/libglfw.so
src/libglfw.so.3
src/libglfw.so.3.5
src/libglfw.so.3.6
src/libglfw.dylib
src/libglfw.dylib
src/libglfw.3.dylib
src/libglfw.3.5.dylib
src/libglfw.3.6.dylib
src/libglfw3.a
src/glfw3.lib
src/glfw3.dll
+1 -1
View File
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.16...3.28 FATAL_ERROR)
project(GLFW VERSION 3.5.0 LANGUAGES C HOMEPAGE_URL "https://www.glfw.org/")
project(GLFW VERSION 3.6.0 LANGUAGES C HOMEPAGE_URL "https://www.glfw.org/")
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
+10
View File
@@ -6,10 +6,12 @@ excludes other invaluable contributions like language bindings and text and
video tutorials.
- Bobyshev Alexander
- Alzathar
- Laurent Aphecetche
- Matt Arsenault
- Takuro Ashie
- ashishgamedev
- avagordon01
- David Avedissian
- Luca Bacci
- Keith Bauer
@@ -55,7 +57,9 @@ video tutorials.
- Bill Currie
- Jason Daly
- danhambleton
- danijel1023
- Jarrod Davis
- Aaron Day
- decce
- Olivier Delannoy
- Paul R. Deppe
@@ -75,6 +79,7 @@ video tutorials.
- Nikita Fediuchin
- Felipe Ferreira
- Michael Fogleman
- Folling
- forworldm
- Jason Francis
- Gerald Franz
@@ -95,6 +100,7 @@ video tutorials.
- Andrew Gutekanst
- Stephen Gutekanst
- Jonathan Hale
- halx99
- Daniel Hauser
- hdf89shfdfs
- Moritz Heinemann
@@ -161,6 +167,7 @@ video tutorials.
- Bryce Mehring
- Jonathan Mercier
- Marcel Metz
- Lucas Michaudel
- Liam Middlebrook
- mightgoyardstill
- Mihail
@@ -177,6 +184,7 @@ video tutorials.
- Jon Morton
- Pierre Moulon
- Martins Mozeiko
- Tomáš Mráz
- Pascal Muetschard
- James Murphy
- Julian Møller
@@ -223,6 +231,7 @@ video tutorials.
- Philip Rideout
- Eddie Ringle
- Max Risuhin
- road2react
- Joe Roback
- Jorge Rodriguez
- Jari Ronkainen
@@ -230,6 +239,7 @@ video tutorials.
- Ed Ropple
- Aleksey Rybalkin
- Mikko Rytkönen
- saikyun
- Riku Salminen
- Yoshinori Sano
- Brandon Schaefer
+2 -45
View File
@@ -118,52 +118,9 @@ guide](https://github.com/glfw/glfw/blob/master/docs/CONTRIBUTING.md) for
information on what to include when reporting a bug.
## Changelog since 3.4
## Changelog since 3.5
- Added `GLFW_UNLIMITED_MOUSE_BUTTONS` input mode that allows mouse buttons beyond
the limit of the mouse button tokens to be reported (#2423)
- Added `glfwGetEGLConfig` function to query the `EGLConfig` of a window (#2045)
- Added `glfwGetGLXFBConfig` function to query the `GLXFBConfig` of a window (#1925)
- Updated minimum CMake version to 3.16 (#2541)
- Removed support for building with original MinGW (#2540)
- [Win32] Removed support for Windows XP and Vista (#2505)
- [Cocoa] Added `QuartzCore` framework as link-time dependency
- [Cocoa] Removed support for OS X 10.10 Yosemite and earlier (#2506)
- [Wayland] Bugfix: The fractional scaling related objects were not destroyed
- [Wayland] Bugfix: `glfwInit` would segfault on compositor with no seat (#2517)
- [Wayland] Bugfix: A drag entering a non-GLFW surface could cause a segfault
- [Wayland] Bugfix: Ignore key repeat events when no window has keyboard focus (#2727)
- [Wayland] Bugfix: Reset key repeat timer when window destroyed (#2741,#2727)
- [Wayland] Bugfix: Memory would leak if reading a data offer failed midway
- [Wayland] Bugfix: Retrieved cursor position would be incorrect when hovering over
fallback decorations
- [Wayland] Bugfix: Fallback decorations would report scroll events
- [Wayland] Bugfix: Keyboard repeat events halted when any key is released (#2568)
- [Wayland] Bugfix: Fallback decorations would show menu at wrong position
- [Wayland] Bugfix: The cursor was not updated when clicking through from
a modal to a fallback decoration
- [Wayland] Bugfix: The cursor position was not updated when clicking through
from a modal to the content area
- [Wayland] Bugfix: free modules at end of terminate function to resolve
potential segmentation fault (#2744)
- [Wayland] Bugfix: Confining or disabling the cursor could segfault on
compositors without `pointer-constraints-unstable-v1`
- [Wayland] Bugfix: Key repeat did not function on very old compositors
- [Wayland] Bugfix: The `libwayland-client` library was not unloaded at termination
- [Wayland] Bugfix: Scroll events were sent twice on some versions of GNOME (#2494)
- [Wayland] Bugfix: Two-dimensional scroll input was emitted as separate axes
- [X11] Bugfix: Running without a WM could trigger an assert (#2593,#2601,#2631)
- [X11] Bugfix: Occasional crash when an idle display awakes (#2766)
- [X11] Bugfix: Prevent BadWindow when creating small windows with a content scale
less than 1 (#2754)
- [X11] Bugfix: Clamp width and height to >= 1 to prevent BadValue error and app exit
- [X11] Bugfix: Floating windows silently became non-floating when hidden (#2276)
- [X11] Bugfix: The `libXext` library was not unloaded at termination
- [Linux] Bugfix: The header for `ioctl` was only implicitly included (#2778)
- [Null] Added Vulkan 'window' surface creation via `VK_EXT_headless_surface`
- [Null] Added EGL context creation on Mesa via `EGL_MESA_platform_surfaceless`
- [EGL] Allowed native access on Wayland with `GLFW_CONTEXT_CREATION_API` set to
`GLFW_NATIVE_CONTEXT_API` (#2518)
None.
## Contact
+1 -1
View File
@@ -310,7 +310,7 @@ With a few changes to your `CMakeLists.txt` you can locate the package and
target files generated when GLFW is installed.
```cmake
find_package(glfw3 3.5 REQUIRED)
find_package(glfw3 3.6 REQUIRED)
```
Once GLFW has been added to the project, link against it with the `glfw` target.
+3 -3
View File
@@ -621,17 +621,17 @@ The format of the string is as follows:
- The names of the always supported context creation APIs EGL and OSMesa
- Any additional compile-time options, APIs and (on Windows) what compiler was used
For example, compiling GLFW 3.5 with MinGW-64 as a DLL for Windows, may result
For example, compiling GLFW 3.6 with MinGW-64 as a DLL for Windows, may result
in a version string like this:
```c
3.5.0 Win32 WGL Null EGL OSMesa MinGW-w64 DLL
3.6.0 Win32 WGL Null EGL OSMesa MinGW-w64 DLL
```
Compiling GLFW as a static library for Linux, with both Wayland and X11 enabled, may
result in a version string like this:
```c
3.5.0 Wayland X11 GLX Null EGL OSMesa monotonic
3.6.0 Wayland X11 GLX Null EGL OSMesa monotonic
```
+2 -44
View File
@@ -1,69 +1,27 @@
# Release notes for version 3.5 {#news}
# Release notes for version 3.6 {#news}
[TOC]
## New features {#features}
### Unlimited mouse buttons {#unlimited_mouse_buttons}
GLFW now has an input mode which allows an unlimited number of mouse buttons to
be reported by the mouse buttton callback, rather than just the associated
[mouse button tokens](@ref buttons). This allows using mouse buttons with
values over 8. For compatibility with older versions, the
@ref GLFW_UNLIMITED_MOUSE_BUTTONS input mode needs to be set to make use of
this.
### EGLConfig native access function {#eglconfig}
GLFW now provides the @ref glfwGetEGLConfig native access function for querying
the `EGLConfig` of a window that has a `EGLSurface`.
### GLXFBConfig native access function {#glxfbconfig}
GLFW now provides the @ref glfwGetGLXFBConfig native access function for
querying the `GLXFBConfig` of a window that has a `GLXWindow`.
## Caveats {#caveats}
## Deprecations {#deprecations}
## Removals {#removals}
### Windows XP and Vista support has been removed {#winxp_vista}
Support for Windows XP and Vista has been removed. Windows XP has been out of extended
support since 2014.
### Original MinGW support has been removed {#original_mingw}
Support for the now unmaintained original MinGW distribution has been removed.
This does not apply to the much more capable [MinGW-w64](https://www.mingw-w64.org/),
which remains fully supported. MinGW-w64 can build both 32- and 64-bit binaries, is
actively maintained and available on many platforms.
## New symbols {#new_symbols}
### New functions {#new_functions}
- @ref glfwGetEGLConfig
- @ref glfwGetGLXFBConfig
### New types {#new_types}
### New constants {#new_constants}
- @ref GLFW_UNLIMITED_MOUSE_BUTTONS
## Release notes for earlier versions {#news_archive}
- [Release notes for 3.5](https://www.glfw.org/docs/3.5/news.html)
- [Release notes for 3.4](https://www.glfw.org/docs/3.4/news.html)
- [Release notes for 3.3](https://www.glfw.org/docs/3.3/news.html)
- [Release notes for 3.2](https://www.glfw.org/docs/3.2/news.html)
+10 -2
View File
@@ -1,5 +1,5 @@
/*************************************************************************
* GLFW 3.5 - www.glfw.org
* GLFW 3.6 - www.glfw.org
* A library for OpenGL, window and input
*------------------------------------------------------------------------
* Copyright (c) 2002-2006 Marcus Geelnard
@@ -291,7 +291,7 @@ extern "C" {
* features are added to the API but it remains backward-compatible.
* @ingroup init
*/
#define GLFW_VERSION_MINOR 5
#define GLFW_VERSION_MINOR 6
/*! @brief The revision number of the GLFW header.
*
* The revision number of the GLFW header. This is incremented when a bug fix
@@ -1344,6 +1344,10 @@ extern "C" {
#define GLFW_PLATFORM_NULL 0x00060005
/*! @} */
/* Reserved platform define for external Emscripten ports: 0x00060006
* See https://github.com/pongasoft/emscripten-glfw
*/
#define GLFW_DONT_CARE -1
@@ -6170,6 +6174,10 @@ GLFWAPI GLFWwindow* glfwGetCurrentContext(void);
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
* GLFW_NO_WINDOW_CONTEXT and @ref GLFW_PLATFORM_ERROR.
*
* @remark __Wayland:__ When the swap interval is greater than zero and the
* window is not in view, this function may take a few extra milliseconds to
* return.
*
* @remark __EGL:__ The context of the specified window must be current on the
* calling thread.
*
+1 -1
View File
@@ -1,5 +1,5 @@
/*************************************************************************
* GLFW 3.5 - www.glfw.org
* GLFW 3.6 - www.glfw.org
* A library for OpenGL, window and input
*------------------------------------------------------------------------
* Copyright (c) 2002-2006 Marcus Geelnard
+10 -5
View File
@@ -10,7 +10,7 @@ add_library(glfw ${GLFW_LIBRARY_TYPE}
# The time, thread and module code is shared between all backends on a given OS,
# including the null backend, which still needs those bits to be functional
if (APPLE)
target_sources(glfw PRIVATE cocoa_time.h cocoa_time.c posix_thread.h
target_sources(glfw PRIVATE macos_time.h macos_time.c posix_thread.h
posix_module.c posix_thread.c)
elseif (WIN32)
target_sources(glfw PRIVATE win32_time.h win32_thread.h win32_module.c
@@ -46,7 +46,7 @@ endif()
if (GLFW_BUILD_X11)
target_compile_definitions(glfw PRIVATE _GLFW_X11)
target_sources(glfw PRIVATE x11_platform.h xkb_unicode.h x11_init.c
target_sources(glfw PRIVATE x11_platform.h x11_init.c
x11_monitor.c x11_window.c xkb_unicode.c
glx_context.c)
endif()
@@ -145,11 +145,11 @@ endif()
if (GLFW_BUILD_COCOA)
target_link_libraries(glfw PRIVATE "-framework Cocoa"
"-framework IOKit"
"-framework CoreFoundation"
"-framework QuartzCore")
set(glfw_PKG_DEPS "")
set(glfw_PKG_LIBS "-framework Cocoa -framework IOKit -framework CoreFoundation -framework QuartzCore")
list(APPEND glfw_PKG_LIBS "-framework Cocoa"
"-framework IOKit"
"-framework QuartzCore")
endif()
if (GLFW_BUILD_WAYLAND)
@@ -234,6 +234,11 @@ if (UNIX AND NOT APPLE)
endif()
endif()
if (APPLE)
target_link_libraries(glfw PRIVATE "-framework CoreFoundation")
list(APPEND glfw_PKG_LIBS "-framework CoreFoundation")
endif()
if (WIN32)
if (GLFW_USE_HYBRID_HPG)
target_compile_definitions(glfw PRIVATE _GLFW_USE_HYBRID_HPG)
+1 -36
View File
@@ -1,5 +1,5 @@
//========================================================================
// GLFW 3.5 macOS - www.glfw.org
// GLFW 3.6 Cocoa - www.glfw.org
//------------------------------------------------------------------------
// Copyright (c) 2009-2019 Camilla Löwy <elmindreda@glfw.org>
//
@@ -450,41 +450,6 @@ static GLFWbool initializeTIS(void)
@end // GLFWApplicationDelegate
//////////////////////////////////////////////////////////////////////////
////// GLFW internal API //////
//////////////////////////////////////////////////////////////////////////
void* _glfwLoadLocalVulkanLoaderCocoa(void)
{
CFBundleRef bundle = CFBundleGetMainBundle();
if (!bundle)
return NULL;
CFURLRef frameworksUrl = CFBundleCopyPrivateFrameworksURL(bundle);
if (!frameworksUrl)
return NULL;
CFURLRef loaderUrl = CFURLCreateCopyAppendingPathComponent(
kCFAllocatorDefault, frameworksUrl, CFSTR("libvulkan.1.dylib"), false);
if (!loaderUrl)
{
CFRelease(frameworksUrl);
return NULL;
}
char path[PATH_MAX];
void* handle = NULL;
if (CFURLGetFileSystemRepresentation(loaderUrl, true, (UInt8*) path, sizeof(path) - 1))
handle = _glfwPlatformLoadModule(path);
CFRelease(loaderUrl);
CFRelease(frameworksUrl);
return handle;
}
//////////////////////////////////////////////////////////////////////////
////// GLFW platform API //////
//////////////////////////////////////////////////////////////////////////
+1 -1
View File
@@ -1,5 +1,5 @@
//========================================================================
// GLFW 3.5 Cocoa - www.glfw.org
// GLFW 3.6 Cocoa - www.glfw.org
//------------------------------------------------------------------------
// Copyright (c) 2006-2017 Camilla Löwy <elmindreda@glfw.org>
//
+1 -1
View File
@@ -1,5 +1,5 @@
//========================================================================
// GLFW 3.5 Cocoa - www.glfw.org
// GLFW 3.6 Cocoa - www.glfw.org
//------------------------------------------------------------------------
// Copyright (c) 2009-2019 Camilla Löwy <elmindreda@glfw.org>
// Copyright (c) 2012 Torsten Walluhn <tw@mad-cad.net>
+1 -1
View File
@@ -1,5 +1,5 @@
//========================================================================
// GLFW 3.5 macOS - www.glfw.org
// GLFW 3.6 Cocoa - www.glfw.org
//------------------------------------------------------------------------
// Copyright (c) 2002-2006 Marcus Geelnard
// Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.org>
+1 -3
View File
@@ -1,5 +1,5 @@
//========================================================================
// GLFW 3.5 macOS - www.glfw.org
// GLFW 3.6 Cocoa - www.glfw.org
//------------------------------------------------------------------------
// Copyright (c) 2009-2019 Camilla Löwy <elmindreda@glfw.org>
//
@@ -291,8 +291,6 @@ void _glfwRestoreVideoModeCocoa(_GLFWmonitor* monitor);
float _glfwTransformYCocoa(float y);
void* _glfwLoadLocalVulkanLoaderCocoa(void);
GLFWbool _glfwInitNSGL(void);
void _glfwTerminateNSGL(void);
GLFWbool _glfwCreateContextNSGL(_GLFWwindow* window,
+29 -1
View File
@@ -1,5 +1,5 @@
//========================================================================
// GLFW 3.5 macOS - www.glfw.org
// GLFW 3.6 Cocoa - www.glfw.org
//------------------------------------------------------------------------
// Copyright (c) 2009-2019 Camilla Löwy <elmindreda@glfw.org>
//
@@ -599,6 +599,34 @@ static const NSRange kEmptyRange = { NSNotFound, 0 };
_glfwInputKey(window, key, [event keyCode], GLFW_RELEASE, mods);
}
- (BOOL)performKeyEquivalent:(NSEvent *)event
{
// HACK: Some key combinations are consumed before reaching keyDown:
// so we claim those events and emit them here
const int key = translateKey([event keyCode]);
const int mods = translateFlags([event modifierFlags]);
if (mods & GLFW_MOD_CONTROL)
{
if (key == GLFW_KEY_TAB || key == GLFW_KEY_ESCAPE)
{
_glfwInputKey(window, key, [event keyCode], GLFW_PRESS, mods);
return YES;
}
}
if (mods & GLFW_MOD_SUPER)
{
if (key == GLFW_KEY_PERIOD)
{
_glfwInputKey(window, key, [event keyCode], GLFW_PRESS, mods);
return YES;
}
}
return [super performKeyEquivalent:event];
}
- (void)scrollWheel:(NSEvent *)event
{
double deltaX = [event scrollingDeltaX];
+8 -3
View File
@@ -1,5 +1,5 @@
//========================================================================
// GLFW 3.5 - www.glfw.org
// GLFW 3.6 - www.glfw.org
//------------------------------------------------------------------------
// Copyright (c) 2002-2006 Marcus Geelnard
// Copyright (c) 2006-2016 Camilla Löwy <elmindreda@glfw.org>
@@ -195,7 +195,7 @@ const _GLFWfbconfig* _glfwChooseFBConfig(const _GLFWfbconfig* desired,
{
current = alternatives + i;
if (desired->stereo > 0 && current->stereo == 0)
if (desired->stereo && !current->stereo)
{
// Stereo is a hard constraint
continue;
@@ -368,7 +368,12 @@ GLFWbool _glfwRefreshContextAttribs(_GLFWwindow* window,
window->context.getProcAddress("glGetIntegerv");
window->context.GetString = (PFNGLGETSTRINGPROC)
window->context.getProcAddress("glGetString");
if (!window->context.GetIntegerv || !window->context.GetString)
window->context.Flush = (PFNGLFLUSHPROC)
window->context.getProcAddress("glFlush");
if (!window->context.GetIntegerv ||
!window->context.GetString ||
!window->context.Flush)
{
_glfwInputError(GLFW_PLATFORM_ERROR, "Entry point retrieval is broken");
glfwMakeContextCurrent((GLFWwindow*) previous);
+27 -2
View File
@@ -1,5 +1,5 @@
//========================================================================
// GLFW 3.5 EGL - www.glfw.org
// GLFW 3.6 EGL - www.glfw.org
//------------------------------------------------------------------------
// Copyright (c) 2002-2006 Marcus Geelnard
// Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.org>
@@ -254,6 +254,12 @@ static void makeContextCurrentEGL(_GLFWwindow* window)
getEGLErrorString(eglGetError()));
return;
}
#if defined(_GLFW_WAYLAND)
// NOTE: Disable EGL vsync so we can substitute our own that includes a timeout
if (_glfw.platform.platformID == GLFW_PLATFORM_WAYLAND)
eglSwapInterval(_glfw.egl.display, 0);
#endif // _GLFW_WAYLAND
}
else
{
@@ -287,6 +293,15 @@ static void swapBuffersEGL(_GLFWwindow* window)
// NOTE: Swapping buffers on a hidden window on Wayland makes it visible
if (!window->wl.visible)
return;
// NOTE: We wait for a frame manually so we can add a timeout,
// as the EGL implementation will wait indefinitely
if (window->wl.egl.interval > 0)
{
window->context.Flush();
if (!_glfwWaitForEGLFrameWayland(window))
return;
}
}
#endif
@@ -295,6 +310,16 @@ static void swapBuffersEGL(_GLFWwindow* window)
static void swapIntervalEGL(int interval)
{
#if defined(_GLFW_WAYLAND)
if (_glfw.platform.platformID == GLFW_PLATFORM_WAYLAND)
{
_GLFWwindow* window = _glfwPlatformGetTls(&_glfw.contextSlot);
assert(window != NULL);
window->wl.egl.interval = interval;
return;
}
#endif
eglSwapInterval(_glfw.egl.display, interval);
}
@@ -650,7 +675,7 @@ GLFWbool _glfwCreateContextEGL(_GLFWwindow* window,
if (ctxconfig->noerror)
{
if (_glfw.egl.KHR_create_context_no_error)
SET_ATTRIB(EGL_CONTEXT_OPENGL_NO_ERROR_KHR, GLFW_TRUE);
SET_ATTRIB(EGL_CONTEXT_OPENGL_NO_ERROR_KHR, true);
}
if (mask)
+14 -16
View File
@@ -1,5 +1,5 @@
//========================================================================
// GLFW 3.5 GLX - www.glfw.org
// GLFW 3.6 GLX - www.glfw.org
//------------------------------------------------------------------------
// Copyright (c) 2002-2006 Marcus Geelnard
// Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.org>
@@ -119,9 +119,7 @@ static GLFWbool chooseGLXFBConfig(const _GLFWfbconfig* desired,
u->accumAlphaBits = getGLXFBConfigAttrib(n, GLX_ACCUM_ALPHA_SIZE);
u->auxBuffers = getGLXFBConfigAttrib(n, GLX_AUX_BUFFERS);
if (getGLXFBConfigAttrib(n, GLX_STEREO))
u->stereo = GLFW_TRUE;
u->stereo = getGLXFBConfigAttrib(n, GLX_STEREO);
if (_glfw.glx.ARB_multisample)
u->samples = getGLXFBConfigAttrib(n, GLX_SAMPLES);
@@ -367,7 +365,7 @@ GLFWbool _glfwInitGLX(void)
getProcAddressGLX("glXSwapIntervalEXT");
if (_glfw.glx.SwapIntervalEXT)
_glfw.glx.EXT_swap_control = GLFW_TRUE;
_glfw.glx.EXT_swap_control = true;
}
if (extensionSupportedGLX("GLX_SGI_swap_control"))
@@ -376,7 +374,7 @@ GLFWbool _glfwInitGLX(void)
getProcAddressGLX("glXSwapIntervalSGI");
if (_glfw.glx.SwapIntervalSGI)
_glfw.glx.SGI_swap_control = GLFW_TRUE;
_glfw.glx.SGI_swap_control = true;
}
if (extensionSupportedGLX("GLX_MESA_swap_control"))
@@ -385,17 +383,17 @@ GLFWbool _glfwInitGLX(void)
getProcAddressGLX("glXSwapIntervalMESA");
if (_glfw.glx.SwapIntervalMESA)
_glfw.glx.MESA_swap_control = GLFW_TRUE;
_glfw.glx.MESA_swap_control = true;
}
if (extensionSupportedGLX("GLX_ARB_multisample"))
_glfw.glx.ARB_multisample = GLFW_TRUE;
_glfw.glx.ARB_multisample = true;
if (extensionSupportedGLX("GLX_ARB_framebuffer_sRGB"))
_glfw.glx.ARB_framebuffer_sRGB = GLFW_TRUE;
_glfw.glx.ARB_framebuffer_sRGB = true;
if (extensionSupportedGLX("GLX_EXT_framebuffer_sRGB"))
_glfw.glx.EXT_framebuffer_sRGB = GLFW_TRUE;
_glfw.glx.EXT_framebuffer_sRGB = true;
if (extensionSupportedGLX("GLX_ARB_create_context"))
{
@@ -403,23 +401,23 @@ GLFWbool _glfwInitGLX(void)
getProcAddressGLX("glXCreateContextAttribsARB");
if (_glfw.glx.CreateContextAttribsARB)
_glfw.glx.ARB_create_context = GLFW_TRUE;
_glfw.glx.ARB_create_context = true;
}
if (extensionSupportedGLX("GLX_ARB_create_context_robustness"))
_glfw.glx.ARB_create_context_robustness = GLFW_TRUE;
_glfw.glx.ARB_create_context_robustness = true;
if (extensionSupportedGLX("GLX_ARB_create_context_profile"))
_glfw.glx.ARB_create_context_profile = GLFW_TRUE;
_glfw.glx.ARB_create_context_profile = true;
if (extensionSupportedGLX("GLX_EXT_create_context_es2_profile"))
_glfw.glx.EXT_create_context_es2_profile = GLFW_TRUE;
_glfw.glx.EXT_create_context_es2_profile = true;
if (extensionSupportedGLX("GLX_ARB_create_context_no_error"))
_glfw.glx.ARB_create_context_no_error = GLFW_TRUE;
_glfw.glx.ARB_create_context_no_error = true;
if (extensionSupportedGLX("GLX_ARB_context_flush_control"))
_glfw.glx.ARB_context_flush_control = GLFW_TRUE;
_glfw.glx.ARB_context_flush_control = true;
return GLFW_TRUE;
}
+5 -5
View File
@@ -1,5 +1,5 @@
//========================================================================
// GLFW 3.5 - www.glfw.org
// GLFW 3.6 - www.glfw.org
//------------------------------------------------------------------------
// Copyright (c) 2002-2006 Marcus Geelnard
// Copyright (c) 2006-2018 Camilla Löwy <elmindreda@glfw.org>
@@ -49,18 +49,18 @@ static GLFWerrorfun _glfwErrorCallback;
static GLFWallocator _glfwInitAllocator;
static _GLFWinitconfig _glfwInitHints =
{
.hatButtons = GLFW_TRUE,
.hatButtons = true,
.angleType = GLFW_ANGLE_PLATFORM_TYPE_NONE,
.platformID = GLFW_ANY_PLATFORM,
.vulkanLoader = NULL,
.ns =
{
.menubar = GLFW_TRUE,
.chdir = GLFW_TRUE
.menubar = true,
.chdir = true
},
.x11 =
{
.xcbVulkanSurface = GLFW_TRUE,
.xcbVulkanSurface = true,
},
.wl =
{
+8 -12
View File
@@ -1,5 +1,5 @@
//========================================================================
// GLFW 3.5 - www.glfw.org
// GLFW 3.6 - www.glfw.org
//------------------------------------------------------------------------
// Copyright (c) 2002-2006 Marcus Geelnard
// Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.org>
@@ -333,10 +333,8 @@ void _glfwInputChar(_GLFWwindow* window, uint32_t codepoint, int mods, GLFWbool
void _glfwInputScroll(_GLFWwindow* window, double xoffset, double yoffset)
{
assert(window != NULL);
assert(xoffset > -FLT_MAX);
assert(xoffset < FLT_MAX);
assert(yoffset > -FLT_MAX);
assert(yoffset < FLT_MAX);
assert(isfinite(xoffset));
assert(isfinite(yoffset));
if (window->callbacks.scroll)
window->callbacks.scroll((GLFWwindow*) window, xoffset, yoffset);
@@ -375,10 +373,8 @@ void _glfwInputMouseClick(_GLFWwindow* window, int button, int action, int mods)
void _glfwInputCursorPos(_GLFWwindow* window, double xpos, double ypos)
{
assert(window != NULL);
assert(xpos > -FLT_MAX);
assert(xpos < FLT_MAX);
assert(ypos > -FLT_MAX);
assert(ypos < FLT_MAX);
assert(isfinite(xpos));
assert(isfinite(ypos));
if (window->virtualCursorPosX == xpos && window->virtualCursorPosY == ypos)
return;
@@ -436,6 +432,7 @@ void _glfwInputJoystickAxis(_GLFWjoystick* js, int axis, float value)
assert(js != NULL);
assert(axis >= 0);
assert(axis < js->axisCount);
assert(isfinite(value));
js->axes[axis] = value;
}
@@ -818,8 +815,7 @@ GLFWAPI void glfwSetCursorPos(GLFWwindow* handle, double xpos, double ypos)
_GLFWwindow* window = (_GLFWwindow*) handle;
assert(window != NULL);
if (xpos != xpos || xpos < -DBL_MAX || xpos > DBL_MAX ||
ypos != ypos || ypos < -DBL_MAX || ypos > DBL_MAX)
if (!isfinite(xpos) || !isfinite(ypos))
{
_glfwInputError(GLFW_INVALID_VALUE,
"Invalid cursor position %f %f",
@@ -1499,7 +1495,7 @@ GLFWAPI void glfwSetTime(double time)
{
_GLFW_REQUIRE_INIT();
if (time != time || time < 0.0 || time > 18446744073.0)
if (!isfinite(time) || time < 0.0 || time > 18446744073.0)
{
_glfwInputError(GLFW_INVALID_VALUE, "Invalid time %f", time);
return;
+53 -51
View File
@@ -1,5 +1,5 @@
//========================================================================
// GLFW 3.5 - www.glfw.org
// GLFW 3.6 - www.glfw.org
//------------------------------------------------------------------------
// Copyright (c) 2002-2006 Marcus Geelnard
// Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.org>
@@ -109,6 +109,7 @@ typedef void (APIENTRY * PFNGLCLEARPROC)(GLbitfield);
typedef const GLubyte* (APIENTRY * PFNGLGETSTRINGPROC)(GLenum);
typedef void (APIENTRY * PFNGLGETINTEGERVPROC)(GLenum,GLint*);
typedef const GLubyte* (APIENTRY * PFNGLGETSTRINGIPROC)(GLenum,GLuint);
typedef void (APIENTRY * PFNGLFLUSHPROC)(void);
#define EGL_SUCCESS 0x3000
#define EGL_NOT_INITIALIZED 0x3001
@@ -374,16 +375,16 @@ struct _GLFWerror
//
struct _GLFWinitconfig
{
GLFWbool hatButtons;
bool hatButtons;
int angleType;
int platformID;
PFN_vkGetInstanceProcAddr vulkanLoader;
struct {
GLFWbool menubar;
GLFWbool chdir;
bool menubar;
bool chdir;
} ns;
struct {
GLFWbool xcbVulkanSurface;
bool xcbVulkanSurface;
} x11;
struct {
int libdecorMode;
@@ -402,18 +403,18 @@ struct _GLFWwndconfig
int ypos;
int width;
int height;
GLFWbool resizable;
GLFWbool visible;
GLFWbool decorated;
GLFWbool focused;
GLFWbool autoIconify;
GLFWbool floating;
GLFWbool maximized;
GLFWbool centerCursor;
GLFWbool focusOnShow;
GLFWbool mousePassthrough;
GLFWbool scaleToMonitor;
GLFWbool scaleFramebuffer;
bool resizable;
bool visible;
bool decorated;
bool focused;
bool autoIconify;
bool floating;
bool maximized;
bool centerCursor;
bool focusOnShow;
bool mousePassthrough;
bool scaleToMonitor;
bool scaleFramebuffer;
struct {
char frameName[256];
} ns;
@@ -422,8 +423,8 @@ struct _GLFWwndconfig
char instanceName[256];
} x11;
struct {
GLFWbool keymenu;
GLFWbool showDefault;
bool keymenu;
bool showDefault;
} win32;
struct {
char appId[256];
@@ -442,15 +443,15 @@ struct _GLFWctxconfig
int source;
int major;
int minor;
GLFWbool forward;
GLFWbool debug;
GLFWbool noerror;
bool forward;
bool debug;
bool noerror;
int profile;
int robustness;
int release;
_GLFWwindow* share;
struct {
GLFWbool offline;
bool offline;
} nsgl;
};
@@ -475,11 +476,11 @@ struct _GLFWfbconfig
int accumBlueBits;
int accumAlphaBits;
int auxBuffers;
GLFWbool stereo;
bool stereo;
int samples;
GLFWbool sRGB;
GLFWbool doublebuffer;
GLFWbool transparent;
bool sRGB;
bool doublebuffer;
bool transparent;
uintptr_t handle;
};
@@ -498,6 +499,7 @@ struct _GLFWcontext
PFNGLGETSTRINGIPROC GetStringi;
PFNGLGETINTEGERVPROC GetIntegerv;
PFNGLGETSTRINGPROC GetString;
PFNGLFLUSHPROC Flush;
void (*makeCurrent)(_GLFWwindow*);
void (*swapBuffers)(_GLFWwindow*);
@@ -805,22 +807,22 @@ struct _GLFWlibrary
EGLint major, minor;
GLFWbool prefix;
GLFWbool KHR_create_context;
GLFWbool KHR_create_context_no_error;
GLFWbool KHR_gl_colorspace;
GLFWbool KHR_get_all_proc_addresses;
GLFWbool KHR_context_flush_control;
GLFWbool EXT_client_extensions;
GLFWbool EXT_platform_base;
GLFWbool EXT_platform_x11;
GLFWbool EXT_platform_wayland;
GLFWbool EXT_present_opaque;
GLFWbool ANGLE_platform_angle;
GLFWbool ANGLE_platform_angle_opengl;
GLFWbool ANGLE_platform_angle_d3d;
GLFWbool ANGLE_platform_angle_vulkan;
GLFWbool ANGLE_platform_angle_metal;
GLFWbool MESA_platform_surfaceless;
bool KHR_create_context;
bool KHR_create_context_no_error;
bool KHR_gl_colorspace;
bool KHR_get_all_proc_addresses;
bool KHR_context_flush_control;
bool EXT_client_extensions;
bool EXT_platform_base;
bool EXT_platform_x11;
bool EXT_platform_wayland;
bool EXT_present_opaque;
bool ANGLE_platform_angle;
bool ANGLE_platform_angle_opengl;
bool ANGLE_platform_angle_d3d;
bool ANGLE_platform_angle_vulkan;
bool ANGLE_platform_angle_metal;
bool MESA_platform_surfaceless;
void* handle;
@@ -864,14 +866,14 @@ struct _GLFWlibrary
void* handle;
char* extensions[2];
PFN_vkGetInstanceProcAddr GetInstanceProcAddr;
GLFWbool KHR_surface;
GLFWbool KHR_win32_surface;
GLFWbool MVK_macos_surface;
GLFWbool EXT_metal_surface;
GLFWbool KHR_xlib_surface;
GLFWbool KHR_xcb_surface;
GLFWbool KHR_wayland_surface;
GLFWbool EXT_headless_surface;
bool KHR_surface;
bool KHR_win32_surface;
bool MVK_macos_surface;
bool EXT_metal_surface;
bool KHR_xlib_surface;
bool KHR_xcb_surface;
bool KHR_wayland_surface;
bool EXT_headless_surface;
} vk;
struct {
+1 -1
View File
@@ -1,5 +1,5 @@
//========================================================================
// GLFW 3.5 Linux - www.glfw.org
// GLFW 3.6 Linux - www.glfw.org
//------------------------------------------------------------------------
// Copyright (c) 2002-2006 Marcus Geelnard
// Copyright (c) 2006-2017 Camilla Löwy <elmindreda@glfw.org>
+1 -1
View File
@@ -1,5 +1,5 @@
//========================================================================
// GLFW 3.5 Linux - www.glfw.org
// GLFW 3.6 Linux - www.glfw.org
//------------------------------------------------------------------------
// Copyright (c) 2014 Jonas Ådahl <jadahl@gmail.com>
//
+5 -5
View File
@@ -1,5 +1,5 @@
//========================================================================
// GLFW 3.5 macOS - www.glfw.org
// GLFW 3.6 macOS - www.glfw.org
//------------------------------------------------------------------------
// Copyright (c) 2009-2016 Camilla Löwy <elmindreda@glfw.org>
//
@@ -26,7 +26,7 @@
#include "internal.h"
#if defined(GLFW_BUILD_COCOA_TIMER)
#if defined(GLFW_BUILD_MACOS_TIMER)
#include <mach/mach_time.h>
@@ -40,7 +40,7 @@ void _glfwPlatformInitTimer(void)
mach_timebase_info_data_t info;
mach_timebase_info(&info);
_glfw.timer.ns.frequency = (info.denom * 1e9) / info.numer;
_glfw.timer.macos.frequency = (info.denom * 1e9) / info.numer;
}
uint64_t _glfwPlatformGetTimerValue(void)
@@ -50,8 +50,8 @@ uint64_t _glfwPlatformGetTimerValue(void)
uint64_t _glfwPlatformGetTimerFrequency(void)
{
return _glfw.timer.ns.frequency;
return _glfw.timer.macos.frequency;
}
#endif // GLFW_BUILD_COCOA_TIMER
#endif // GLFW_BUILD_MACOS_TIMER
+5 -5
View File
@@ -1,5 +1,5 @@
//========================================================================
// GLFW 3.5 macOS - www.glfw.org
// GLFW 3.6 macOS - www.glfw.org
//------------------------------------------------------------------------
// Copyright (c) 2009-2021 Camilla Löwy <elmindreda@glfw.org>
//
@@ -24,12 +24,12 @@
//
//========================================================================
#define GLFW_COCOA_LIBRARY_TIMER_STATE _GLFWtimerNS ns;
#define GLFW_MACOS_LIBRARY_TIMER_STATE _GLFWtimerMacOS macos;
// Cocoa-specific global timer data
// macOS-specific global timer data
//
typedef struct _GLFWtimerNS
typedef struct _GLFWtimerMacOS
{
uint64_t frequency;
} _GLFWtimerNS;
} _GLFWtimerMacOS;
+1 -1
View File
@@ -1,5 +1,5 @@
//========================================================================
// GLFW 3.5 - www.glfw.org
// GLFW 3.6 - www.glfw.org
//------------------------------------------------------------------------
// Copyright (c) 2006-2018 Camilla Löwy <elmindreda@glfw.org>
//
+1 -1
View File
@@ -1,5 +1,5 @@
//========================================================================
// GLFW 3.5 - www.glfw.org
// GLFW 3.6 - www.glfw.org
//------------------------------------------------------------------------
// Copyright (c) 2006-2018 Camilla Löwy <elmindreda@glfw.org>
//
+4 -3
View File
@@ -1,5 +1,5 @@
//========================================================================
// GLFW 3.5 - www.glfw.org
// GLFW 3.6 - www.glfw.org
//------------------------------------------------------------------------
// Copyright (c) 2002-2006 Marcus Geelnard
// Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.org>
@@ -467,14 +467,15 @@ GLFWAPI void glfwSetGamma(GLFWmonitor* handle, float gamma)
unsigned short* values;
GLFWgammaramp ramp;
const GLFWgammaramp* original;
assert(gamma > 0.f);
assert(gamma <= FLT_MAX);
assert(isfinite(gamma));
_GLFW_REQUIRE_INIT();
assert(handle != NULL);
if (gamma != gamma || gamma <= 0.f || gamma > FLT_MAX)
if (!isfinite(gamma) || gamma <= 0.f)
{
_glfwInputError(GLFW_INVALID_VALUE, "Invalid gamma value %f", gamma);
return;
+1 -1
View File
@@ -1,5 +1,5 @@
//========================================================================
// GLFW 3.5 macOS - www.glfw.org
// GLFW 3.6 macOS - www.glfw.org
//------------------------------------------------------------------------
// Copyright (c) 2009-2019 Camilla Löwy <elmindreda@glfw.org>
//
+1 -1
View File
@@ -1,5 +1,5 @@
//========================================================================
// GLFW 3.5 - www.glfw.org
// GLFW 3.6 - www.glfw.org
//------------------------------------------------------------------------
// Copyright (c) 2016 Google Inc.
// Copyright (c) 2016-2017 Camilla Löwy <elmindreda@glfw.org>
+1 -1
View File
@@ -1,5 +1,5 @@
//========================================================================
// GLFW 3.5 - www.glfw.org
// GLFW 3.6 - www.glfw.org
//------------------------------------------------------------------------
// Copyright (c) 2016-2017 Camilla Löwy <elmindreda@glfw.org>
//
+1 -1
View File
@@ -1,5 +1,5 @@
//========================================================================
// GLFW 3.5 - www.glfw.org
// GLFW 3.6 - www.glfw.org
//------------------------------------------------------------------------
// Copyright (c) 2006-2017 Camilla Löwy <elmindreda@glfw.org>
//
+1 -1
View File
@@ -1,5 +1,5 @@
//========================================================================
// GLFW 3.5 - www.glfw.org
// GLFW 3.6 - www.glfw.org
//------------------------------------------------------------------------
// Copyright (c) 2016 Google Inc.
// Copyright (c) 2016-2019 Camilla Löwy <elmindreda@glfw.org>
+1 -1
View File
@@ -1,5 +1,5 @@
//========================================================================
// GLFW 3.5 - www.glfw.org
// GLFW 3.6 - www.glfw.org
//------------------------------------------------------------------------
// Copyright (c) 2016 Google Inc.
// Copyright (c) 2016-2017 Camilla Löwy <elmindreda@glfw.org>
+1 -1
View File
@@ -1,5 +1,5 @@
//========================================================================
// GLFW 3.5 - www.glfw.org
// GLFW 3.6 - www.glfw.org
//------------------------------------------------------------------------
// Copyright (c) 2016 Google Inc.
// Copyright (c) 2016-2019 Camilla Löwy <elmindreda@glfw.org>
+1 -1
View File
@@ -1,5 +1,5 @@
//========================================================================
// GLFW 3.5 OSMesa - www.glfw.org
// GLFW 3.6 OSMesa - www.glfw.org
//------------------------------------------------------------------------
// Copyright (c) 2016 Google Inc.
// Copyright (c) 2016-2017 Camilla Löwy <elmindreda@glfw.org>
+1 -1
View File
@@ -1,5 +1,5 @@
//========================================================================
// GLFW 3.5 - www.glfw.org
// GLFW 3.6 - www.glfw.org
//------------------------------------------------------------------------
// Copyright (c) 2002-2006 Marcus Geelnard
// Copyright (c) 2006-2018 Camilla Löwy <elmindreda@glfw.org>
+7 -6
View File
@@ -1,5 +1,5 @@
//========================================================================
// GLFW 3.5 - www.glfw.org
// GLFW 3.6 - www.glfw.org
//------------------------------------------------------------------------
// Copyright (c) 2002-2006 Marcus Geelnard
// Copyright (c) 2006-2018 Camilla Löwy <elmindreda@glfw.org>
@@ -28,7 +28,7 @@
#if defined(GLFW_BUILD_WIN32_TIMER) || \
defined(GLFW_BUILD_WIN32_MODULE) || \
defined(GLFW_BUILD_WIN32_THREAD) || \
defined(GLFW_BUILD_COCOA_TIMER) || \
defined(GLFW_BUILD_MACOS_TIMER) || \
defined(GLFW_BUILD_POSIX_TIMER) || \
defined(GLFW_BUILD_POSIX_MODULE) || \
defined(GLFW_BUILD_POSIX_THREAD) || \
@@ -184,7 +184,7 @@
#if defined(_WIN32)
#define GLFW_BUILD_WIN32_TIMER
#elif defined(__APPLE__)
#define GLFW_BUILD_COCOA_TIMER
#define GLFW_BUILD_MACOS_TIMER
#else
#define GLFW_BUILD_POSIX_TIMER
#endif
@@ -192,9 +192,9 @@
#if defined(GLFW_BUILD_WIN32_TIMER)
#include "win32_time.h"
#define GLFW_PLATFORM_LIBRARY_TIMER_STATE GLFW_WIN32_LIBRARY_TIMER_STATE
#elif defined(GLFW_BUILD_COCOA_TIMER)
#include "cocoa_time.h"
#define GLFW_PLATFORM_LIBRARY_TIMER_STATE GLFW_COCOA_LIBRARY_TIMER_STATE
#elif defined(GLFW_BUILD_MACOS_TIMER)
#include "macos_time.h"
#define GLFW_PLATFORM_LIBRARY_TIMER_STATE GLFW_MACOS_LIBRARY_TIMER_STATE
#elif defined(GLFW_BUILD_POSIX_TIMER)
#include "posix_time.h"
#define GLFW_PLATFORM_LIBRARY_TIMER_STATE GLFW_POSIX_LIBRARY_TIMER_STATE
@@ -207,6 +207,7 @@
#endif
#if defined(_GLFW_WAYLAND) || defined(_GLFW_X11)
#include "posix_poll.h"
#define GLFW_BUILD_POSIX_POLL
#endif
+1 -1
View File
@@ -1,5 +1,5 @@
//========================================================================
// GLFW 3.5 POSIX - www.glfw.org
// GLFW 3.6 POSIX - www.glfw.org
//------------------------------------------------------------------------
// Copyright (c) 2021 Camilla Löwy <elmindreda@glfw.org>
//
+1 -1
View File
@@ -1,5 +1,5 @@
//========================================================================
// GLFW 3.5 POSIX - www.glfw.org
// GLFW 3.6 POSIX - www.glfw.org
//------------------------------------------------------------------------
// Copyright (c) 2022 Camilla Löwy <elmindreda@glfw.org>
//
+1 -1
View File
@@ -1,5 +1,5 @@
//========================================================================
// GLFW 3.5 POSIX - www.glfw.org
// GLFW 3.6 POSIX - www.glfw.org
//------------------------------------------------------------------------
// Copyright (c) 2022 Camilla Löwy <elmindreda@glfw.org>
//
+1 -1
View File
@@ -1,5 +1,5 @@
//========================================================================
// GLFW 3.5 POSIX - www.glfw.org
// GLFW 3.6 POSIX - www.glfw.org
//------------------------------------------------------------------------
// Copyright (c) 2002-2006 Marcus Geelnard
// Copyright (c) 2006-2017 Camilla Löwy <elmindreda@glfw.org>
+1 -1
View File
@@ -1,5 +1,5 @@
//========================================================================
// GLFW 3.5 POSIX - www.glfw.org
// GLFW 3.6 POSIX - www.glfw.org
//------------------------------------------------------------------------
// Copyright (c) 2002-2006 Marcus Geelnard
// Copyright (c) 2006-2017 Camilla Löwy <elmindreda@glfw.org>
+1 -1
View File
@@ -1,5 +1,5 @@
//========================================================================
// GLFW 3.5 POSIX - www.glfw.org
// GLFW 3.6 POSIX - www.glfw.org
//------------------------------------------------------------------------
// Copyright (c) 2002-2006 Marcus Geelnard
// Copyright (c) 2006-2017 Camilla Löwy <elmindreda@glfw.org>
+1 -1
View File
@@ -1,5 +1,5 @@
//========================================================================
// GLFW 3.5 POSIX - www.glfw.org
// GLFW 3.6 POSIX - www.glfw.org
//------------------------------------------------------------------------
// Copyright (c) 2002-2006 Marcus Geelnard
// Copyright (c) 2006-2017 Camilla Löwy <elmindreda@glfw.org>
+45 -12
View File
@@ -1,5 +1,5 @@
//========================================================================
// GLFW 3.5 - www.glfw.org
// GLFW 3.6 - www.glfw.org
//------------------------------------------------------------------------
// Copyright (c) 2002-2006 Marcus Geelnard
// Copyright (c) 2006-2018 Camilla Löwy <elmindreda@glfw.org>
@@ -34,6 +34,40 @@
#define _GLFW_FIND_LOADER 1
#define _GLFW_REQUIRE_LOADER 2
#if defined(__APPLE__)
#include <CoreFoundation/CoreFoundation.h>
static void* loadLocalVulkanLoaderMacOS(void)
{
CFBundleRef bundle = CFBundleGetMainBundle();
if (!bundle)
return NULL;
CFURLRef frameworksUrl = CFBundleCopyPrivateFrameworksURL(bundle);
if (!frameworksUrl)
return NULL;
CFURLRef loaderUrl = CFURLCreateCopyAppendingPathComponent(
kCFAllocatorDefault, frameworksUrl, CFSTR("libvulkan.1.dylib"), false);
if (!loaderUrl)
{
CFRelease(frameworksUrl);
return NULL;
}
char path[PATH_MAX];
void* handle = NULL;
if (CFURLGetFileSystemRepresentation(loaderUrl, true, (UInt8*) path, sizeof(path) - 1))
handle = _glfwPlatformLoadModule(path);
CFRelease(loaderUrl);
CFRelease(frameworksUrl);
return handle;
}
#endif // __APPLE__
//////////////////////////////////////////////////////////////////////////
////// GLFW internal API //////
@@ -57,11 +91,10 @@ GLFWbool _glfwInitVulkan(int mode)
_glfw.vk.handle = _glfwPlatformLoadModule(_GLFW_VULKAN_LIBRARY);
#elif defined(_WIN32)
_glfw.vk.handle = _glfwPlatformLoadModule("vulkan-1.dll");
#elif defined(_GLFW_COCOA)
#elif defined(__APPLE__)
_glfw.vk.handle = _glfwPlatformLoadModule("libvulkan.1.dylib");
if (!_glfw.vk.handle)
_glfw.vk.handle = _glfwLoadLocalVulkanLoaderCocoa();
#elif defined(__APPLE__)
_glfw.vk.handle = loadLocalVulkanLoaderMacOS();
#elif defined(__OpenBSD__) || defined(__NetBSD__)
_glfw.vk.handle = _glfwPlatformLoadModule("libvulkan.so");
#else
@@ -130,21 +163,21 @@ GLFWbool _glfwInitVulkan(int mode)
for (i = 0; i < count; i++)
{
if (strcmp(ep[i].extensionName, "VK_KHR_surface") == 0)
_glfw.vk.KHR_surface = GLFW_TRUE;
_glfw.vk.KHR_surface = true;
else if (strcmp(ep[i].extensionName, "VK_KHR_win32_surface") == 0)
_glfw.vk.KHR_win32_surface = GLFW_TRUE;
_glfw.vk.KHR_win32_surface = true;
else if (strcmp(ep[i].extensionName, "VK_MVK_macos_surface") == 0)
_glfw.vk.MVK_macos_surface = GLFW_TRUE;
_glfw.vk.MVK_macos_surface = true;
else if (strcmp(ep[i].extensionName, "VK_EXT_metal_surface") == 0)
_glfw.vk.EXT_metal_surface = GLFW_TRUE;
_glfw.vk.EXT_metal_surface = true;
else if (strcmp(ep[i].extensionName, "VK_KHR_xlib_surface") == 0)
_glfw.vk.KHR_xlib_surface = GLFW_TRUE;
_glfw.vk.KHR_xlib_surface = true;
else if (strcmp(ep[i].extensionName, "VK_KHR_xcb_surface") == 0)
_glfw.vk.KHR_xcb_surface = GLFW_TRUE;
_glfw.vk.KHR_xcb_surface = true;
else if (strcmp(ep[i].extensionName, "VK_KHR_wayland_surface") == 0)
_glfw.vk.KHR_wayland_surface = GLFW_TRUE;
_glfw.vk.KHR_wayland_surface = true;
else if (strcmp(ep[i].extensionName, "VK_EXT_headless_surface") == 0)
_glfw.vk.EXT_headless_surface = GLFW_TRUE;
_glfw.vk.EXT_headless_surface = true;
}
_glfw_free(ep);
+7 -15
View File
@@ -1,5 +1,5 @@
//========================================================================
// GLFW 3.5 WGL - www.glfw.org
// GLFW 3.6 WGL - www.glfw.org
//------------------------------------------------------------------------
// Copyright (c) 2002-2006 Marcus Geelnard
// Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.org>
@@ -186,28 +186,22 @@ static int choosePixelFormatWGL(_GLFWwindow* window,
u->accumAlphaBits = FIND_ATTRIB_VALUE(WGL_ACCUM_ALPHA_BITS_ARB);
u->auxBuffers = FIND_ATTRIB_VALUE(WGL_AUX_BUFFERS_ARB);
if (FIND_ATTRIB_VALUE(WGL_STEREO_ARB))
u->stereo = GLFW_TRUE;
u->stereo = FIND_ATTRIB_VALUE(WGL_STEREO_ARB);
if (_glfw.wgl.ARB_multisample)
u->samples = FIND_ATTRIB_VALUE(WGL_SAMPLES_ARB);
if (ctxconfig->client == GLFW_OPENGL_API)
{
if (_glfw.wgl.ARB_framebuffer_sRGB ||
_glfw.wgl.EXT_framebuffer_sRGB)
{
if (FIND_ATTRIB_VALUE(WGL_FRAMEBUFFER_SRGB_CAPABLE_ARB))
u->sRGB = GLFW_TRUE;
}
if (_glfw.wgl.ARB_framebuffer_sRGB || _glfw.wgl.EXT_framebuffer_sRGB)
u->sRGB = FIND_ATTRIB_VALUE(WGL_FRAMEBUFFER_SRGB_CAPABLE_ARB);
}
else
{
if (_glfw.wgl.EXT_colorspace)
{
if (FIND_ATTRIB_VALUE(WGL_COLORSPACE_EXT) == WGL_COLORSPACE_SRGB_EXT)
u->sRGB = GLFW_TRUE;
u->sRGB = true;
}
}
}
@@ -261,9 +255,7 @@ static int choosePixelFormatWGL(_GLFWwindow* window,
u->accumAlphaBits = pfd.cAccumAlphaBits;
u->auxBuffers = pfd.cAuxBuffers;
if (pfd.dwFlags & PFD_STEREO)
u->stereo = GLFW_TRUE;
u->stereo = (pfd.dwFlags & PFD_STEREO);
}
u->handle = pixelFormat;
@@ -664,7 +656,7 @@ GLFWbool _glfwCreateContextWGL(_GLFWwindow* window,
if (ctxconfig->noerror)
{
if (_glfw.wgl.ARB_create_context_no_error)
SET_ATTRIB(WGL_CONTEXT_OPENGL_NO_ERROR_ARB, GLFW_TRUE);
SET_ATTRIB(WGL_CONTEXT_OPENGL_NO_ERROR_ARB, true);
}
// NOTE: Only request an explicitly versioned context when necessary, as
+1 -1
View File
@@ -1,5 +1,5 @@
//========================================================================
// GLFW 3.5 Win32 - www.glfw.org
// GLFW 3.6 Win32 - www.glfw.org
//------------------------------------------------------------------------
// Copyright (c) 2002-2006 Marcus Geelnard
// Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.org>
+1 -1
View File
@@ -1,5 +1,5 @@
//========================================================================
// GLFW 3.5 Win32 - www.glfw.org
// GLFW 3.6 Win32 - www.glfw.org
//------------------------------------------------------------------------
// Copyright (c) 2002-2006 Marcus Geelnard
// Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.org>
+1 -1
View File
@@ -1,5 +1,5 @@
//========================================================================
// GLFW 3.5 Win32 - www.glfw.org
// GLFW 3.6 Win32 - www.glfw.org
//------------------------------------------------------------------------
// Copyright (c) 2006-2017 Camilla Löwy <elmindreda@glfw.org>
//
+1 -1
View File
@@ -1,5 +1,5 @@
//========================================================================
// GLFW 3.5 Win32 - www.glfw.org
// GLFW 3.6 Win32 - www.glfw.org
//------------------------------------------------------------------------
// Copyright (c) 2021 Camilla Löwy <elmindreda@glfw.org>
//
+1 -1
View File
@@ -1,5 +1,5 @@
//========================================================================
// GLFW 3.5 Win32 - www.glfw.org
// GLFW 3.6 Win32 - www.glfw.org
//------------------------------------------------------------------------
// Copyright (c) 2002-2006 Marcus Geelnard
// Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.org>
+13 -13
View File
@@ -1,5 +1,5 @@
//========================================================================
// GLFW 3.5 Win32 - www.glfw.org
// GLFW 3.6 Win32 - www.glfw.org
//------------------------------------------------------------------------
// Copyright (c) 2002-2006 Marcus Geelnard
// Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.org>
@@ -336,18 +336,18 @@ typedef struct _GLFWlibraryWGL
PFNWGLGETEXTENSIONSSTRINGEXTPROC GetExtensionsStringEXT;
PFNWGLGETEXTENSIONSSTRINGARBPROC GetExtensionsStringARB;
PFNWGLCREATECONTEXTATTRIBSARBPROC CreateContextAttribsARB;
GLFWbool EXT_swap_control;
GLFWbool EXT_colorspace;
GLFWbool ARB_multisample;
GLFWbool ARB_framebuffer_sRGB;
GLFWbool EXT_framebuffer_sRGB;
GLFWbool ARB_pixel_format;
GLFWbool ARB_create_context;
GLFWbool ARB_create_context_profile;
GLFWbool EXT_create_context_es2_profile;
GLFWbool ARB_create_context_robustness;
GLFWbool ARB_create_context_no_error;
GLFWbool ARB_context_flush_control;
bool EXT_swap_control;
bool EXT_colorspace;
bool ARB_multisample;
bool ARB_framebuffer_sRGB;
bool EXT_framebuffer_sRGB;
bool ARB_pixel_format;
bool ARB_create_context;
bool ARB_create_context_profile;
bool EXT_create_context_es2_profile;
bool ARB_create_context_robustness;
bool ARB_create_context_no_error;
bool ARB_context_flush_control;
} _GLFWlibraryWGL;
// Win32-specific per-window data
+1 -1
View File
@@ -1,5 +1,5 @@
//========================================================================
// GLFW 3.5 Win32 - www.glfw.org
// GLFW 3.6 Win32 - www.glfw.org
//------------------------------------------------------------------------
// Copyright (c) 2002-2006 Marcus Geelnard
// Copyright (c) 2006-2017 Camilla Löwy <elmindreda@glfw.org>
+1 -1
View File
@@ -1,5 +1,5 @@
//========================================================================
// GLFW 3.5 Win32 - www.glfw.org
// GLFW 3.6 Win32 - www.glfw.org
//------------------------------------------------------------------------
// Copyright (c) 2002-2006 Marcus Geelnard
// Copyright (c) 2006-2017 Camilla Löwy <elmindreda@glfw.org>
+1 -1
View File
@@ -1,5 +1,5 @@
//========================================================================
// GLFW 3.5 Win32 - www.glfw.org
// GLFW 3.6 Win32 - www.glfw.org
//------------------------------------------------------------------------
// Copyright (c) 2002-2006 Marcus Geelnard
// Copyright (c) 2006-2017 Camilla Löwy <elmindreda@glfw.org>
+1 -1
View File
@@ -1,5 +1,5 @@
//========================================================================
// GLFW 3.5 Win32 - www.glfw.org
// GLFW 3.6 Win32 - www.glfw.org
//------------------------------------------------------------------------
// Copyright (c) 2002-2006 Marcus Geelnard
// Copyright (c) 2006-2017 Camilla Löwy <elmindreda@glfw.org>
+6 -5
View File
@@ -1,5 +1,5 @@
//========================================================================
// GLFW 3.5 Win32 - www.glfw.org
// GLFW 3.6 Win32 - www.glfw.org
//------------------------------------------------------------------------
// Copyright (c) 2002-2006 Marcus Geelnard
// Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.org>
@@ -711,11 +711,12 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM l
const int mods = getKeyMods();
scancode = (HIWORD(lParam) & (KF_EXTENDED | 0xff));
if (!scancode)
if (!(scancode & 0xff))
{
// NOTE: Some synthetic key messages have a scancode of zero
// HACK: Map the virtual key back to a usable scancode
scancode = MapVirtualKeyW((UINT) wParam, MAPVK_VK_TO_VSC);
// NOTE: Both media keys and the synthetic key messages from Windows
// Clipboard History are reported with a scancode of zero
// HACK: Map the virtual key to a scancode but preserve extended bit
scancode |= MapVirtualKeyW((UINT) wParam, MAPVK_VK_TO_VSC);
}
// HACK: Alt+PrtSc has a different scancode than just PrtSc
+39 -40
View File
@@ -1,5 +1,5 @@
//========================================================================
// GLFW 3.5 - www.glfw.org
// GLFW 3.6 - www.glfw.org
//------------------------------------------------------------------------
// Copyright (c) 2002-2006 Marcus Geelnard
// Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.org>
@@ -32,7 +32,7 @@
#include <string.h>
#include <stdlib.h>
#include <float.h>
#include <math.h>
//////////////////////////////////////////////////////////////////////////
////// GLFW event API //////
@@ -135,9 +135,9 @@ void _glfwInputWindowContentScale(_GLFWwindow* window, float xscale, float yscal
{
assert(window != NULL);
assert(xscale > 0.f);
assert(xscale < FLT_MAX);
assert(isfinite(xscale));
assert(yscale > 0.f);
assert(yscale < FLT_MAX);
assert(isfinite(yscale));
if (window->callbacks.scale)
window->callbacks.scale((GLFWwindow*) window, xscale, yscale);
@@ -265,16 +265,16 @@ void glfwDefaultWindowHints(void)
// The default is a focused, visible, resizable window with decorations
memset(&_glfw.hints.window, 0, sizeof(_glfw.hints.window));
_glfw.hints.window.resizable = GLFW_TRUE;
_glfw.hints.window.visible = GLFW_TRUE;
_glfw.hints.window.decorated = GLFW_TRUE;
_glfw.hints.window.focused = GLFW_TRUE;
_glfw.hints.window.autoIconify = GLFW_TRUE;
_glfw.hints.window.centerCursor = GLFW_TRUE;
_glfw.hints.window.focusOnShow = GLFW_TRUE;
_glfw.hints.window.resizable = true;
_glfw.hints.window.visible = true;
_glfw.hints.window.decorated = true;
_glfw.hints.window.focused = true;
_glfw.hints.window.autoIconify = true;
_glfw.hints.window.centerCursor = true;
_glfw.hints.window.focusOnShow = true;
_glfw.hints.window.xpos = GLFW_ANY_POSITION;
_glfw.hints.window.ypos = GLFW_ANY_POSITION;
_glfw.hints.window.scaleFramebuffer = GLFW_TRUE;
_glfw.hints.window.scaleFramebuffer = true;
// The default is 24 bits of color, 24 bits of depth and 8 bits of stencil,
// double buffered
@@ -285,7 +285,7 @@ void glfwDefaultWindowHints(void)
_glfw.hints.framebuffer.alphaBits = 8;
_glfw.hints.framebuffer.depthBits = 24;
_glfw.hints.framebuffer.stencilBits = 8;
_glfw.hints.framebuffer.doublebuffer = GLFW_TRUE;
_glfw.hints.framebuffer.doublebuffer = true;
// The default is to select the highest available refresh rate
_glfw.hints.refreshRate = GLFW_DONT_CARE;
@@ -331,40 +331,40 @@ GLFWAPI void glfwWindowHint(int hint, int value)
_glfw.hints.framebuffer.auxBuffers = value;
return;
case GLFW_STEREO:
_glfw.hints.framebuffer.stereo = value ? GLFW_TRUE : GLFW_FALSE;
_glfw.hints.framebuffer.stereo = value;
return;
case GLFW_DOUBLEBUFFER:
_glfw.hints.framebuffer.doublebuffer = value ? GLFW_TRUE : GLFW_FALSE;
_glfw.hints.framebuffer.doublebuffer = value;
return;
case GLFW_TRANSPARENT_FRAMEBUFFER:
_glfw.hints.framebuffer.transparent = value ? GLFW_TRUE : GLFW_FALSE;
_glfw.hints.framebuffer.transparent = value;
return;
case GLFW_SAMPLES:
_glfw.hints.framebuffer.samples = value;
return;
case GLFW_SRGB_CAPABLE:
_glfw.hints.framebuffer.sRGB = value ? GLFW_TRUE : GLFW_FALSE;
_glfw.hints.framebuffer.sRGB = value;
return;
case GLFW_RESIZABLE:
_glfw.hints.window.resizable = value ? GLFW_TRUE : GLFW_FALSE;
_glfw.hints.window.resizable = value;
return;
case GLFW_DECORATED:
_glfw.hints.window.decorated = value ? GLFW_TRUE : GLFW_FALSE;
_glfw.hints.window.decorated = value;
return;
case GLFW_FOCUSED:
_glfw.hints.window.focused = value ? GLFW_TRUE : GLFW_FALSE;
_glfw.hints.window.focused = value;
return;
case GLFW_AUTO_ICONIFY:
_glfw.hints.window.autoIconify = value ? GLFW_TRUE : GLFW_FALSE;
_glfw.hints.window.autoIconify = value;
return;
case GLFW_FLOATING:
_glfw.hints.window.floating = value ? GLFW_TRUE : GLFW_FALSE;
_glfw.hints.window.floating = value;
return;
case GLFW_MAXIMIZED:
_glfw.hints.window.maximized = value ? GLFW_TRUE : GLFW_FALSE;
_glfw.hints.window.maximized = value;
return;
case GLFW_VISIBLE:
_glfw.hints.window.visible = value ? GLFW_TRUE : GLFW_FALSE;
_glfw.hints.window.visible = value;
return;
case GLFW_POSITION_X:
_glfw.hints.window.xpos = value;
@@ -373,29 +373,29 @@ GLFWAPI void glfwWindowHint(int hint, int value)
_glfw.hints.window.ypos = value;
return;
case GLFW_WIN32_KEYBOARD_MENU:
_glfw.hints.window.win32.keymenu = value ? GLFW_TRUE : GLFW_FALSE;
_glfw.hints.window.win32.keymenu = value;
return;
case GLFW_WIN32_SHOWDEFAULT:
_glfw.hints.window.win32.showDefault = value ? GLFW_TRUE : GLFW_FALSE;
_glfw.hints.window.win32.showDefault = value;
return;
case GLFW_COCOA_GRAPHICS_SWITCHING:
_glfw.hints.context.nsgl.offline = value ? GLFW_TRUE : GLFW_FALSE;
_glfw.hints.context.nsgl.offline = value;
return;
case GLFW_SCALE_TO_MONITOR:
_glfw.hints.window.scaleToMonitor = value ? GLFW_TRUE : GLFW_FALSE;
_glfw.hints.window.scaleToMonitor = value;
return;
case GLFW_SCALE_FRAMEBUFFER:
case GLFW_COCOA_RETINA_FRAMEBUFFER:
_glfw.hints.window.scaleFramebuffer = value ? GLFW_TRUE : GLFW_FALSE;
_glfw.hints.window.scaleFramebuffer = value;
return;
case GLFW_CENTER_CURSOR:
_glfw.hints.window.centerCursor = value ? GLFW_TRUE : GLFW_FALSE;
_glfw.hints.window.centerCursor = value;
return;
case GLFW_FOCUS_ON_SHOW:
_glfw.hints.window.focusOnShow = value ? GLFW_TRUE : GLFW_FALSE;
_glfw.hints.window.focusOnShow = value;
return;
case GLFW_MOUSE_PASSTHROUGH:
_glfw.hints.window.mousePassthrough = value ? GLFW_TRUE : GLFW_FALSE;
_glfw.hints.window.mousePassthrough = value;
return;
case GLFW_CLIENT_API:
_glfw.hints.context.client = value;
@@ -413,13 +413,13 @@ GLFWAPI void glfwWindowHint(int hint, int value)
_glfw.hints.context.robustness = value;
return;
case GLFW_OPENGL_FORWARD_COMPAT:
_glfw.hints.context.forward = value ? GLFW_TRUE : GLFW_FALSE;
_glfw.hints.context.forward = value;
return;
case GLFW_CONTEXT_DEBUG:
_glfw.hints.context.debug = value ? GLFW_TRUE : GLFW_FALSE;
_glfw.hints.context.debug = value;
return;
case GLFW_CONTEXT_NO_ERROR:
_glfw.hints.context.noerror = value ? GLFW_TRUE : GLFW_FALSE;
_glfw.hints.context.noerror = value;
return;
case GLFW_OPENGL_PROFILE:
_glfw.hints.context.profile = value;
@@ -776,7 +776,7 @@ GLFWAPI float glfwGetWindowOpacity(GLFWwindow* handle)
GLFWAPI void glfwSetWindowOpacity(GLFWwindow* handle, float opacity)
{
assert(opacity == opacity);
assert(isfinite(opacity));
assert(opacity >= 0.f);
assert(opacity <= 1.f);
@@ -785,7 +785,7 @@ GLFWAPI void glfwSetWindowOpacity(GLFWwindow* handle, float opacity)
_GLFWwindow* window = (_GLFWwindow*) handle;
assert(window != NULL);
if (opacity != opacity || opacity < 0.f || opacity > 1.f)
if (!isfinite(opacity) || opacity < 0.f || opacity > 1.f)
{
_glfwInputError(GLFW_INVALID_VALUE, "Invalid window opacity %f", opacity);
return;
@@ -1178,11 +1178,10 @@ GLFWAPI void glfwWaitEvents(void)
GLFWAPI void glfwWaitEventsTimeout(double timeout)
{
_GLFW_REQUIRE_INIT();
assert(timeout == timeout);
assert(isfinite(timeout));
assert(timeout >= 0.0);
assert(timeout <= DBL_MAX);
if (timeout != timeout || timeout < 0.0 || timeout > DBL_MAX)
if (!isfinite(timeout) || timeout < 0.0)
{
_glfwInputError(GLFW_INVALID_VALUE, "Invalid time %f", timeout);
return;
+30 -11
View File
@@ -1,5 +1,5 @@
//========================================================================
// GLFW 3.5 Wayland - www.glfw.org
// GLFW 3.6 Wayland - www.glfw.org
//------------------------------------------------------------------------
// Copyright (c) 2014 Jonas Ådahl <jadahl@gmail.com>
//
@@ -135,7 +135,7 @@ static void registryHandleGlobal(void* userData,
{
_glfw.wl.seat =
wl_registry_bind(registry, name, &wl_seat_interface,
_glfw_min(5, version));
_glfw_min(8, version));
_glfwAddSeatListenerWayland(_glfw.wl.seat);
}
}
@@ -244,10 +244,7 @@ static void libdecorReadyCallback(void* userData,
uint32_t time)
{
_glfw.wl.libdecor.ready = GLFW_TRUE;
assert(_glfw.wl.libdecor.callback == callback);
wl_callback_destroy(_glfw.wl.libdecor.callback);
_glfw.wl.libdecor.callback = NULL;
wl_callback_destroy(callback);
}
static const struct wl_callback_listener libdecorReadyListener =
@@ -578,6 +575,14 @@ int _glfwInitWayland(void)
_glfwPlatformGetModuleSymbol(_glfw.wl.client.handle, "wl_display_get_fd");
_glfw.wl.client.display_prepare_read = (PFN_wl_display_prepare_read)
_glfwPlatformGetModuleSymbol(_glfw.wl.client.handle, "wl_display_prepare_read");
_glfw.wl.client.display_create_queue = (PFN_wl_display_create_queue)
_glfwPlatformGetModuleSymbol(_glfw.wl.client.handle, "wl_display_create_queue");
_glfw.wl.client.display_prepare_read_queue = (PFN_wl_display_prepare_read_queue)
_glfwPlatformGetModuleSymbol(_glfw.wl.client.handle, "wl_display_prepare_read_queue");
_glfw.wl.client.display_dispatch_queue_pending = (PFN_wl_display_dispatch_queue_pending)
_glfwPlatformGetModuleSymbol(_glfw.wl.client.handle, "wl_display_dispatch_queue_pending");
_glfw.wl.client.event_queue_destroy = (PFN_wl_event_queue_destroy)
_glfwPlatformGetModuleSymbol(_glfw.wl.client.handle, "wl_event_queue_destroy");
_glfw.wl.client.proxy_marshal = (PFN_wl_proxy_marshal)
_glfwPlatformGetModuleSymbol(_glfw.wl.client.handle, "wl_proxy_marshal");
_glfw.wl.client.proxy_add_listener = (PFN_wl_proxy_add_listener)
@@ -600,6 +605,12 @@ int _glfwInitWayland(void)
_glfwPlatformGetModuleSymbol(_glfw.wl.client.handle, "wl_proxy_get_version");
_glfw.wl.client.proxy_marshal_flags = (PFN_wl_proxy_marshal_flags)
_glfwPlatformGetModuleSymbol(_glfw.wl.client.handle, "wl_proxy_marshal_flags");
_glfw.wl.client.proxy_create_wrapper = (PFN_wl_proxy_create_wrapper)
_glfwPlatformGetModuleSymbol(_glfw.wl.client.handle, "wl_proxy_create_wrapper");
_glfw.wl.client.proxy_wrapper_destroy = (PFN_wl_proxy_wrapper_destroy)
_glfwPlatformGetModuleSymbol(_glfw.wl.client.handle, "wl_proxy_wrapper_destroy");
_glfw.wl.client.proxy_set_queue = (PFN_wl_proxy_set_queue)
_glfwPlatformGetModuleSymbol(_glfw.wl.client.handle, "wl_proxy_set_queue");
if (!_glfw.wl.client.display_flush ||
!_glfw.wl.client.display_cancel_read ||
@@ -609,6 +620,10 @@ int _glfwInitWayland(void)
!_glfw.wl.client.display_roundtrip ||
!_glfw.wl.client.display_get_fd ||
!_glfw.wl.client.display_prepare_read ||
!_glfw.wl.client.display_create_queue ||
!_glfw.wl.client.display_prepare_read_queue ||
!_glfw.wl.client.display_dispatch_queue_pending ||
!_glfw.wl.client.event_queue_destroy ||
!_glfw.wl.client.proxy_marshal ||
!_glfw.wl.client.proxy_add_listener ||
!_glfw.wl.client.proxy_destroy ||
@@ -617,7 +632,10 @@ int _glfwInitWayland(void)
!_glfw.wl.client.proxy_get_user_data ||
!_glfw.wl.client.proxy_set_user_data ||
!_glfw.wl.client.proxy_get_tag ||
!_glfw.wl.client.proxy_set_tag)
!_glfw.wl.client.proxy_set_tag ||
!_glfw.wl.client.proxy_create_wrapper ||
!_glfw.wl.client.proxy_wrapper_destroy ||
!_glfw.wl.client.proxy_set_queue)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"Wayland: Failed to load libwayland-client entry point");
@@ -780,6 +798,8 @@ int _glfwInitWayland(void)
_glfwPlatformGetModuleSymbol(_glfw.wl.libdecor.handle, "libdecor_frame_unset_capabilities");
_glfw.wl.libdecor.libdecor_frame_set_visibility_ = (PFN_libdecor_frame_set_visibility)
_glfwPlatformGetModuleSymbol(_glfw.wl.libdecor.handle, "libdecor_frame_set_visibility");
_glfw.wl.libdecor.libdecor_frame_is_visible_ = (PFN_libdecor_frame_is_visible)
_glfwPlatformGetModuleSymbol(_glfw.wl.libdecor.handle, "libdecor_frame_is_visible");
_glfw.wl.libdecor.libdecor_frame_get_xdg_toplevel_ = (PFN_libdecor_frame_get_xdg_toplevel)
_glfwPlatformGetModuleSymbol(_glfw.wl.libdecor.handle, "libdecor_frame_get_xdg_toplevel");
_glfw.wl.libdecor.libdecor_configuration_get_content_size_ = (PFN_libdecor_configuration_get_content_size)
@@ -811,6 +831,7 @@ int _glfwInitWayland(void)
!_glfw.wl.libdecor.libdecor_frame_set_capabilities_ ||
!_glfw.wl.libdecor.libdecor_frame_unset_capabilities_ ||
!_glfw.wl.libdecor.libdecor_frame_set_visibility_ ||
!_glfw.wl.libdecor.libdecor_frame_is_visible_ ||
!_glfw.wl.libdecor.libdecor_frame_get_xdg_toplevel_ ||
!_glfw.wl.libdecor.libdecor_configuration_get_content_size_ ||
!_glfw.wl.libdecor.libdecor_configuration_get_window_state_ ||
@@ -860,10 +881,8 @@ int _glfwInitWayland(void)
libdecor_dispatch(_glfw.wl.libdecor.context, 0);
// Create sync point to "know" when libdecor is ready for use
_glfw.wl.libdecor.callback = wl_display_sync(_glfw.wl.display);
wl_callback_add_listener(_glfw.wl.libdecor.callback,
&libdecorReadyListener,
NULL);
struct wl_callback* callback = wl_display_sync(_glfw.wl.display);
wl_callback_add_listener(callback, &libdecorReadyListener, NULL);
}
}
+1 -1
View File
@@ -1,5 +1,5 @@
//========================================================================
// GLFW 3.5 Wayland - www.glfw.org
// GLFW 3.6 Wayland - www.glfw.org
//------------------------------------------------------------------------
// Copyright (c) 2014 Jonas Ådahl <jadahl@gmail.com>
//
+33 -5
View File
@@ -1,5 +1,5 @@
//========================================================================
// GLFW 3.5 Wayland - www.glfw.org
// GLFW 3.6 Wayland - www.glfw.org
//------------------------------------------------------------------------
// Copyright (c) 2014 Jonas Ådahl <jadahl@gmail.com>
//
@@ -42,8 +42,6 @@ typedef struct VkWaylandSurfaceCreateInfoKHR
typedef VkResult (APIENTRY *PFN_vkCreateWaylandSurfaceKHR)(VkInstance,const VkWaylandSurfaceCreateInfoKHR*,const VkAllocationCallbacks*,VkSurfaceKHR*);
typedef VkBool32 (APIENTRY *PFN_vkGetPhysicalDeviceWaylandPresentationSupportKHR)(VkPhysicalDevice,uint32_t,struct wl_display*);
#include "posix_poll.h"
typedef int (* PFN_wl_display_flush)(struct wl_display* display);
typedef void (* PFN_wl_display_cancel_read)(struct wl_display* display);
typedef int (* PFN_wl_display_dispatch_pending)(struct wl_display* display);
@@ -53,6 +51,10 @@ typedef void (* PFN_wl_display_disconnect)(struct wl_display*);
typedef int (* PFN_wl_display_roundtrip)(struct wl_display*);
typedef int (* PFN_wl_display_get_fd)(struct wl_display*);
typedef int (* PFN_wl_display_prepare_read)(struct wl_display*);
typedef struct wl_event_queue* (* PFN_wl_display_create_queue)(struct wl_display*);
typedef void (* PFN_wl_event_queue_destroy)(struct wl_event_queue*);
typedef int (* PFN_wl_display_prepare_read_queue)(struct wl_display*,struct wl_event_queue*);
typedef int (* PFN_wl_display_dispatch_queue_pending)(struct wl_display*,struct wl_event_queue*);
typedef void (* PFN_wl_proxy_marshal)(struct wl_proxy*,uint32_t,...);
typedef int (* PFN_wl_proxy_add_listener)(struct wl_proxy*,void(**)(void),void*);
typedef void (* PFN_wl_proxy_destroy)(struct wl_proxy*);
@@ -64,6 +66,9 @@ typedef void (* PFN_wl_proxy_set_tag)(struct wl_proxy*,const char*const*);
typedef const char* const* (* PFN_wl_proxy_get_tag)(struct wl_proxy*);
typedef uint32_t (* PFN_wl_proxy_get_version)(struct wl_proxy*);
typedef struct wl_proxy* (* PFN_wl_proxy_marshal_flags)(struct wl_proxy*,uint32_t,const struct wl_interface*,uint32_t,uint32_t,...);
typedef void* (* PFN_wl_proxy_create_wrapper)(void*);
typedef void (* PFN_wl_proxy_wrapper_destroy)(void*);
typedef void (* PFN_wl_proxy_set_queue)(struct wl_proxy*,struct wl_event_queue*);
#define wl_display_flush _glfw.wl.client.display_flush
#define wl_display_cancel_read _glfw.wl.client.display_cancel_read
#define wl_display_dispatch_pending _glfw.wl.client.display_dispatch_pending
@@ -72,6 +77,10 @@ typedef struct wl_proxy* (* PFN_wl_proxy_marshal_flags)(struct wl_proxy*,uint32_
#define wl_display_roundtrip _glfw.wl.client.display_roundtrip
#define wl_display_get_fd _glfw.wl.client.display_get_fd
#define wl_display_prepare_read _glfw.wl.client.display_prepare_read
#define wl_display_create_queue _glfw.wl.client.display_create_queue
#define wl_display_prepare_read_queue _glfw.wl.client.display_prepare_read_queue
#define wl_display_dispatch_queue_pending _glfw.wl.client.display_dispatch_queue_pending
#define wl_event_queue_destroy _glfw.wl.client.event_queue_destroy
#define wl_proxy_marshal _glfw.wl.client.proxy_marshal
#define wl_proxy_add_listener _glfw.wl.client.proxy_add_listener
#define wl_proxy_destroy _glfw.wl.client.proxy_destroy
@@ -83,6 +92,9 @@ typedef struct wl_proxy* (* PFN_wl_proxy_marshal_flags)(struct wl_proxy*,uint32_
#define wl_proxy_set_tag _glfw.wl.client.proxy_set_tag
#define wl_proxy_get_version _glfw.wl.client.proxy_get_version
#define wl_proxy_marshal_flags _glfw.wl.client.proxy_marshal_flags
#define wl_proxy_create_wrapper _glfw.wl.client.proxy_create_wrapper
#define wl_proxy_wrapper_destroy _glfw.wl.client.proxy_wrapper_destroy
#define wl_proxy_set_queue _glfw.wl.client.proxy_set_queue
struct wl_shm;
struct wl_output;
@@ -299,6 +311,7 @@ typedef void (* PFN_libdecor_frame_unset_maximized)(struct libdecor_frame*);
typedef void (* PFN_libdecor_frame_set_capabilities)(struct libdecor_frame*,enum libdecor_capabilities);
typedef void (* PFN_libdecor_frame_unset_capabilities)(struct libdecor_frame*,enum libdecor_capabilities);
typedef void (* PFN_libdecor_frame_set_visibility)(struct libdecor_frame*,bool visible);
typedef bool (* PFN_libdecor_frame_is_visible)(struct libdecor_frame*);
typedef struct xdg_toplevel* (* PFN_libdecor_frame_get_xdg_toplevel)(struct libdecor_frame*);
typedef bool (* PFN_libdecor_configuration_get_content_size)(struct libdecor_configuration*,struct libdecor_frame*,int*,int*);
typedef bool (* PFN_libdecor_configuration_get_window_state)(struct libdecor_configuration*,enum libdecor_window_state*);
@@ -324,6 +337,7 @@ typedef void (* PFN_libdecor_state_free)(struct libdecor_state*);
#define libdecor_frame_set_capabilities _glfw.wl.libdecor.libdecor_frame_set_capabilities_
#define libdecor_frame_unset_capabilities _glfw.wl.libdecor.libdecor_frame_unset_capabilities_
#define libdecor_frame_set_visibility _glfw.wl.libdecor.libdecor_frame_set_visibility_
#define libdecor_frame_is_visible _glfw.wl.libdecor.libdecor_frame_is_visible_
#define libdecor_frame_get_xdg_toplevel _glfw.wl.libdecor.libdecor_frame_get_xdg_toplevel_
#define libdecor_configuration_get_content_size _glfw.wl.libdecor.libdecor_configuration_get_content_size_
#define libdecor_configuration_get_window_state _glfw.wl.libdecor.libdecor_configuration_get_window_state_
@@ -363,10 +377,13 @@ typedef struct _GLFWwindowWayland
GLFWbool transparent;
GLFWbool scaleFramebuffer;
struct wl_surface* surface;
struct wl_callback* callback;
struct {
struct wl_event_queue* queue;
struct wl_egl_window* window;
struct wl_callback* callback;
struct wl_surface* wrapper;
int interval;
} egl;
struct {
@@ -480,6 +497,8 @@ typedef struct _GLFWlibraryWayland
double pointerY;
double scrollX;
double scrollY;
double discreteX;
double discreteY;
int button;
int action;
} pending;
@@ -537,6 +556,10 @@ typedef struct _GLFWlibraryWayland
PFN_wl_display_roundtrip display_roundtrip;
PFN_wl_display_get_fd display_get_fd;
PFN_wl_display_prepare_read display_prepare_read;
PFN_wl_display_create_queue display_create_queue;
PFN_wl_display_prepare_read_queue display_prepare_read_queue;
PFN_wl_display_dispatch_queue_pending display_dispatch_queue_pending;
PFN_wl_event_queue_destroy event_queue_destroy;
PFN_wl_proxy_marshal proxy_marshal;
PFN_wl_proxy_add_listener proxy_add_listener;
PFN_wl_proxy_destroy proxy_destroy;
@@ -548,6 +571,9 @@ typedef struct _GLFWlibraryWayland
PFN_wl_proxy_set_tag proxy_set_tag;
PFN_wl_proxy_get_version proxy_get_version;
PFN_wl_proxy_marshal_flags proxy_marshal_flags;
PFN_wl_proxy_create_wrapper proxy_create_wrapper;
PFN_wl_proxy_wrapper_destroy proxy_wrapper_destroy;
PFN_wl_proxy_set_queue proxy_set_queue;
} client;
struct {
@@ -570,7 +596,6 @@ typedef struct _GLFWlibraryWayland
struct {
void* handle;
struct libdecor* context;
struct wl_callback* callback;
GLFWbool ready;
PFN_libdecor_new libdecor_new_;
PFN_libdecor_unref libdecor_unref_;
@@ -592,6 +617,7 @@ typedef struct _GLFWlibraryWayland
PFN_libdecor_frame_set_capabilities libdecor_frame_set_capabilities_;
PFN_libdecor_frame_unset_capabilities libdecor_frame_unset_capabilities_;
PFN_libdecor_frame_set_visibility libdecor_frame_set_visibility_;
PFN_libdecor_frame_is_visible libdecor_frame_is_visible_;
PFN_libdecor_frame_get_xdg_toplevel libdecor_frame_get_xdg_toplevel_;
PFN_libdecor_configuration_get_content_size libdecor_configuration_get_content_size_;
PFN_libdecor_configuration_get_window_state libdecor_configuration_get_window_state_;
@@ -706,3 +732,5 @@ void _glfwUpdateBufferScaleFromOutputsWayland(_GLFWwindow* window);
void _glfwAddSeatListenerWayland(struct wl_seat* seat);
void _glfwAddDataDeviceListenerWayland(struct wl_data_device* device);
GLFWbool _glfwWaitForEGLFrameWayland(_GLFWwindow* window);
+169 -47
View File
@@ -1,5 +1,5 @@
//========================================================================
// GLFW 3.5 Wayland - www.glfw.org
// GLFW 3.6 Wayland - www.glfw.org
//------------------------------------------------------------------------
// Copyright (c) 2014 Jonas Ådahl <jadahl@gmail.com>
//
@@ -24,7 +24,9 @@
//
//========================================================================
#define _GNU_SOURCE
#if !defined(_GNU_SOURCE)
#define _GNU_SOURCE
#endif
#include "internal.h"
@@ -55,10 +57,11 @@
#define GLFW_BORDER_SIZE 4
#define GLFW_CAPTION_HEIGHT 24
#define GLFW_PENDING_SURFACE 1
#define GLFW_PENDING_BUTTON 2
#define GLFW_PENDING_MOTION 4
#define GLFW_PENDING_SCROLL 8
#define GLFW_PENDING_SURFACE 1
#define GLFW_PENDING_BUTTON 2
#define GLFW_PENDING_MOTION 4
#define GLFW_PENDING_SCROLL 8
#define GLFW_PENDING_DISCRETE 16
static int createTmpfileCloexec(char* tmpname)
{
@@ -198,6 +201,16 @@ static struct wl_buffer* createShmBuffer(const GLFWimage* image)
return buffer;
}
static void callbackHandleDone(void* userData, struct wl_callback* callback, uint32_t data)
{
wl_callback_destroy(callback);
}
static const struct wl_callback_listener noopCallbackListener =
{
callbackHandleDone
};
static void createFallbackEdge(_GLFWwindow* window,
_GLFWfallbackEdgeWayland* edge,
struct wl_surface* parent,
@@ -465,8 +478,9 @@ static void resizeFramebuffer(_GLFWwindow* window)
{
if (window->wl.fractionalScale)
{
window->wl.fbWidth = (window->wl.width * window->wl.scalingNumerator) / 120;
window->wl.fbHeight = (window->wl.height * window->wl.scalingNumerator) / 120;
// Round halfway away from zero per fractional-scale-v1 protocol spec
window->wl.fbWidth = (window->wl.width * window->wl.scalingNumerator + 60) / 120;
window->wl.fbHeight = (window->wl.height * window->wl.scalingNumerator + 60) / 120;
}
else
{
@@ -883,6 +897,10 @@ void libdecorFrameHandleConfigure(struct libdecor_frame* frame,
libdecor_frame_commit(frame, frameState, config);
libdecor_state_free(frameState);
// NOTE: Frame visibility must only be set after a frame state has been committed
if (window->decorated != libdecor_frame_is_visible(window->wl.libdecor.frame))
libdecor_frame_set_visibility(window->wl.libdecor.frame, window->decorated);
if (window->wl.activated != activated)
{
window->wl.activated = activated;
@@ -964,36 +982,39 @@ static GLFWbool createLibdecorFrame(_GLFWwindow* window)
return GLFW_FALSE;
}
struct libdecor_state* frameState =
libdecor_state_new(window->wl.width, window->wl.height);
libdecor_frame_commit(window->wl.libdecor.frame, frameState, NULL);
libdecor_state_free(frameState);
if (strlen(window->wl.appId))
libdecor_frame_set_app_id(window->wl.libdecor.frame, window->wl.appId);
libdecor_frame_set_title(window->wl.libdecor.frame, window->title);
if (window->minwidth != GLFW_DONT_CARE &&
window->minheight != GLFW_DONT_CARE)
if (window->resizable)
{
libdecor_frame_set_min_content_size(window->wl.libdecor.frame,
window->minwidth,
window->minheight);
}
if (window->minwidth != GLFW_DONT_CARE &&
window->minheight != GLFW_DONT_CARE)
{
libdecor_frame_set_min_content_size(window->wl.libdecor.frame,
window->minwidth,
window->minheight);
}
if (window->maxwidth != GLFW_DONT_CARE &&
window->maxheight != GLFW_DONT_CARE)
{
libdecor_frame_set_max_content_size(window->wl.libdecor.frame,
window->maxwidth,
window->maxheight);
if (window->maxwidth != GLFW_DONT_CARE &&
window->maxheight != GLFW_DONT_CARE)
{
libdecor_frame_set_max_content_size(window->wl.libdecor.frame,
window->maxwidth,
window->maxheight);
}
}
if (!window->resizable)
else
{
libdecor_frame_unset_capabilities(window->wl.libdecor.frame,
LIBDECOR_ACTION_RESIZE);
libdecor_frame_set_min_content_size(window->wl.libdecor.frame,
window->wl.width,
window->wl.height);
libdecor_frame_set_max_content_size(window->wl.libdecor.frame,
window->wl.width,
window->wl.height);
}
if (window->monitor)
@@ -1004,12 +1025,11 @@ static GLFWbool createLibdecorFrame(_GLFWwindow* window)
}
else
{
// Frame visibility is applied in libdecorFrameHandleConfigure
if (window->wl.maximized)
libdecor_frame_set_maximized(window->wl.libdecor.frame);
if (!window->decorated)
libdecor_frame_set_visibility(window->wl.libdecor.frame, false);
setIdleInhibitor(window, GLFW_FALSE);
}
@@ -1362,24 +1382,27 @@ static void handleEvents(double* timeout)
#endif
GLFWbool event = GLFW_FALSE;
enum { DISPLAY_FD, KEYREPEAT_FD, CURSOR_FD, LIBDECOR_FD };
enum { DISPLAY_FD, KEYREPEAT_FD, CURSOR_FD };
struct pollfd fds[] =
{
[DISPLAY_FD] = { wl_display_get_fd(_glfw.wl.display), POLLIN },
[KEYREPEAT_FD] = { _glfw.wl.keyRepeatTimerfd, POLLIN },
[CURSOR_FD] = { _glfw.wl.cursorTimerfd, POLLIN },
[LIBDECOR_FD] = { -1, POLLIN }
[CURSOR_FD] = { _glfw.wl.cursorTimerfd, POLLIN }
};
if (_glfw.wl.libdecor.context)
fds[LIBDECOR_FD].fd = libdecor_get_fd(_glfw.wl.libdecor.context);
while (!event)
{
if (_glfw.wl.libdecor.context)
{
// Dispatch unconditionally because it also processes non-Wayland events
if (libdecor_dispatch(_glfw.wl.libdecor.context, 0) > 0)
event = GLFW_TRUE;
}
while (wl_display_prepare_read(_glfw.wl.display) != 0)
{
if (wl_display_dispatch_pending(_glfw.wl.display) > 0)
return;
event = GLFW_TRUE;
}
// If an error other than EAGAIN happens, we have likely been disconnected
@@ -1398,6 +1421,11 @@ static void handleEvents(double* timeout)
return;
}
double immediate = 0.0;
if (event)
timeout = &immediate;
if (!_glfwPollPOSIX(fds, sizeof(fds) / sizeof(fds[0]), timeout))
{
wl_display_cancel_read(_glfw.wl.display);
@@ -1444,12 +1472,6 @@ static void handleEvents(double* timeout)
if (read(_glfw.wl.cursorTimerfd, &repeats, sizeof(repeats)) == 8)
incrementCursorImage();
}
if (fds[LIBDECOR_FD].revents & POLLIN)
{
if (libdecor_dispatch(_glfw.wl.libdecor.context, 0) > 0)
event = GLFW_TRUE;
}
}
}
@@ -1740,7 +1762,9 @@ static void pointerHandleFrame(void* userData, struct wl_pointer* pointer)
if (_glfw.wl.pending.events & GLFW_PENDING_BUTTON)
processPointerButton(_glfw.wl.pending.button, _glfw.wl.pending.action);
if (_glfw.wl.pending.events & GLFW_PENDING_SCROLL)
if (_glfw.wl.pending.events & GLFW_PENDING_DISCRETE)
processPointerScroll(_glfw.wl.pending.discreteX, _glfw.wl.pending.discreteY);
else if (_glfw.wl.pending.events & GLFW_PENDING_SCROLL)
processPointerScroll(_glfw.wl.pending.scrollX, _glfw.wl.pending.scrollY);
memset(&_glfw.wl.pending, 0, sizeof(_glfw.wl.pending));
@@ -1766,6 +1790,21 @@ static void pointerHandleAxisDiscrete(void* userData,
{
}
static void pointerHandleAxisValue120(void* data,
struct wl_pointer* pointer,
uint32_t axis,
int32_t value120)
{
if (!_glfw.wl.pointerSurface)
return;
_glfw.wl.pending.events |= GLFW_PENDING_DISCRETE;
if (axis == WL_POINTER_AXIS_HORIZONTAL_SCROLL)
_glfw.wl.pending.discreteX = -(value120 / 120.0);
else if (axis == WL_POINTER_AXIS_VERTICAL_SCROLL)
_glfw.wl.pending.discreteY = -(value120 / 120.0);
}
static const struct wl_pointer_listener pointerListener =
{
pointerHandleEnter,
@@ -1776,7 +1815,8 @@ static const struct wl_pointer_listener pointerListener =
pointerHandleFrame,
pointerHandleAxisSource,
pointerHandleAxisStop,
pointerHandleAxisDiscrete
pointerHandleAxisDiscrete,
pointerHandleAxisValue120
};
static void keyboardHandleKeymap(void* userData,
@@ -1799,7 +1839,7 @@ static void keyboardHandleKeymap(void* userData,
return;
}
mapStr = mmap(NULL, size, PROT_READ, MAP_SHARED, fd, 0);
mapStr = mmap(NULL, size, PROT_READ, MAP_PRIVATE, fd, 0);
if (mapStr == MAP_FAILED)
{
close(fd);
@@ -2277,6 +2317,18 @@ static const struct xdg_activation_token_v1_listener xdgActivationListener =
xdgActivationHandleDone
};
static void callbackHandleFrame(void* userData, struct wl_callback* callback, uint32_t data)
{
_GLFWwindow* window = userData;
wl_callback_destroy(callback);
window->wl.egl.callback = NULL;
}
static const struct wl_callback_listener frameCallbackListener =
{
callbackHandleFrame
};
void _glfwAddSeatListenerWayland(struct wl_seat* seat)
{
wl_seat_add_listener(seat, &seatListener, NULL);
@@ -2287,6 +2339,42 @@ void _glfwAddDataDeviceListenerWayland(struct wl_data_device* device)
wl_data_device_add_listener(device, &dataDeviceListener, NULL);
}
GLFWbool _glfwWaitForEGLFrameWayland(_GLFWwindow* window)
{
double timeout = 0.02;
while (window->wl.egl.callback)
{
if (wl_display_prepare_read_queue(_glfw.wl.display, window->wl.egl.queue) != 0)
{
wl_display_dispatch_queue_pending(_glfw.wl.display, window->wl.egl.queue);
continue;
}
if (!flushDisplay())
{
wl_display_cancel_read(_glfw.wl.display);
return GLFW_FALSE;
}
struct pollfd fd = { wl_display_get_fd(_glfw.wl.display), POLLIN };
if (!_glfwPollPOSIX(&fd, 1, &timeout))
{
wl_display_cancel_read(_glfw.wl.display);
return GLFW_FALSE;
}
wl_display_read_events(_glfw.wl.display);
wl_display_dispatch_queue_pending(_glfw.wl.display, window->wl.egl.queue);
}
window->wl.egl.callback = wl_surface_frame(window->wl.egl.wrapper);
wl_callback_add_listener(window->wl.egl.callback, &frameCallbackListener, window);
// If the window is hidden when the wait is over then don't swap
return window->wl.visible;
}
//////////////////////////////////////////////////////////////////////////
////// GLFW platform API //////
@@ -2315,6 +2403,27 @@ GLFWbool _glfwCreateWindowWayland(_GLFWwindow* window,
return GLFW_FALSE;
}
window->wl.egl.queue = wl_display_create_queue(_glfw.wl.display);
if (!window->wl.egl.queue)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"Wayland: Failed to create EGL frame queue");
return GLFW_FALSE;
}
window->wl.egl.wrapper = wl_proxy_create_wrapper(window->wl.surface);
if (!window->wl.egl.wrapper)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"Wayland: Failed to create surface wrapper");
return GLFW_FALSE;
}
wl_proxy_set_queue((struct wl_proxy*) window->wl.egl.wrapper,
window->wl.egl.queue);
window->wl.egl.interval = 1;
if (!_glfwInitEGL())
return GLFW_FALSE;
if (!_glfwCreateContextEGL(window, ctxconfig, fbconfig))
@@ -2386,6 +2495,15 @@ void _glfwDestroyWindowWayland(_GLFWwindow* window)
if (window->wl.fallback.buffer)
wl_buffer_destroy(window->wl.fallback.buffer);
if (window->wl.egl.callback)
wl_callback_destroy(window->wl.egl.callback);
if (window->wl.egl.wrapper)
wl_proxy_wrapper_destroy(window->wl.egl.wrapper);
if (window->wl.egl.queue)
wl_event_queue_destroy(window->wl.egl.queue);
if (window->wl.egl.window)
wl_egl_window_destroy(window->wl.egl.window);
@@ -2619,6 +2737,8 @@ void _glfwHideWindowWayland(_GLFWwindow* window)
wl_surface_attach(window->wl.surface, NULL, 0, 0);
wl_surface_commit(window->wl.surface);
flushDisplay();
}
}
@@ -2833,7 +2953,9 @@ void _glfwWaitEventsTimeoutWayland(double timeout)
void _glfwPostEmptyEventWayland(void)
{
wl_display_sync(_glfw.wl.display);
struct wl_callback* callback = wl_display_sync(_glfw.wl.display);
wl_callback_add_listener(callback, &noopCallbackListener, NULL);
flushDisplay();
}
+1 -1
View File
@@ -1,5 +1,5 @@
//========================================================================
// GLFW 3.5 X11 - www.glfw.org
// GLFW 3.6 X11 - www.glfw.org
//------------------------------------------------------------------------
// Copyright (c) 2002-2006 Marcus Geelnard
// Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.org>
+1 -1
View File
@@ -1,5 +1,5 @@
//========================================================================
// GLFW 3.5 X11 - www.glfw.org
// GLFW 3.6 X11 - www.glfw.org
//------------------------------------------------------------------------
// Copyright (c) 2002-2006 Marcus Geelnard
// Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.org>
+16 -16
View File
@@ -1,5 +1,5 @@
//========================================================================
// GLFW 3.5 X11 - www.glfw.org
// GLFW 3.6 X11 - www.glfw.org
//------------------------------------------------------------------------
// Copyright (c) 2002-2006 Marcus Geelnard
// Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.org>
@@ -452,9 +452,6 @@ typedef VkBool32 (APIENTRY *PFN_vkGetPhysicalDeviceXlibPresentationSupportKHR)(V
typedef VkResult (APIENTRY *PFN_vkCreateXcbSurfaceKHR)(VkInstance,const VkXcbSurfaceCreateInfoKHR*,const VkAllocationCallbacks*,VkSurfaceKHR*);
typedef VkBool32 (APIENTRY *PFN_vkGetPhysicalDeviceXcbPresentationSupportKHR)(VkPhysicalDevice,uint32_t,xcb_connection_t*,xcb_visualid_t);
#include "xkb_unicode.h"
#include "posix_poll.h"
#define GLFW_X11_WINDOW_STATE _GLFWwindowX11 x11;
#define GLFW_X11_LIBRARY_WINDOW_STATE _GLFWlibraryX11 x11;
#define GLFW_X11_MONITOR_STATE _GLFWmonitorX11 x11;
@@ -463,6 +460,7 @@ typedef VkBool32 (APIENTRY *PFN_vkGetPhysicalDeviceXcbPresentationSupportKHR)(Vk
#define GLFW_GLX_CONTEXT_STATE _GLFWcontextGLX glx;
#define GLFW_GLX_LIBRARY_CONTEXT_STATE _GLFWlibraryGLX glx;
#define GLFW_INVALID_CODEPOINT 0xffffffffu
// GLX-specific per-context data
//
@@ -505,18 +503,18 @@ typedef struct _GLFWlibraryGLX
PFNGLXSWAPINTERVALEXTPROC SwapIntervalEXT;
PFNGLXSWAPINTERVALMESAPROC SwapIntervalMESA;
PFNGLXCREATECONTEXTATTRIBSARBPROC CreateContextAttribsARB;
GLFWbool SGI_swap_control;
GLFWbool EXT_swap_control;
GLFWbool MESA_swap_control;
GLFWbool ARB_multisample;
GLFWbool ARB_framebuffer_sRGB;
GLFWbool EXT_framebuffer_sRGB;
GLFWbool ARB_create_context;
GLFWbool ARB_create_context_profile;
GLFWbool ARB_create_context_robustness;
GLFWbool EXT_create_context_es2_profile;
GLFWbool ARB_create_context_no_error;
GLFWbool ARB_context_flush_control;
bool SGI_swap_control;
bool EXT_swap_control;
bool MESA_swap_control;
bool ARB_multisample;
bool ARB_framebuffer_sRGB;
bool EXT_framebuffer_sRGB;
bool ARB_create_context;
bool ARB_create_context_profile;
bool ARB_create_context_robustness;
bool EXT_create_context_es2_profile;
bool ARB_create_context_no_error;
bool ARB_context_flush_control;
} _GLFWlibraryGLX;
// X11-specific per-window data
@@ -985,6 +983,8 @@ unsigned long _glfwGetWindowPropertyX11(Window window,
unsigned char** value);
GLFWbool _glfwIsVisualTransparentX11(Visual* visual);
uint32_t _glfwKeySym2UnicodeX11(unsigned int keysym);
void _glfwGrabErrorHandlerX11(void);
void _glfwReleaseErrorHandlerX11(void);
void _glfwInputErrorX11(int error, const char* message);
+3 -3
View File
@@ -1,5 +1,5 @@
//========================================================================
// GLFW 3.5 X11 - www.glfw.org
// GLFW 3.6 X11 - www.glfw.org
//------------------------------------------------------------------------
// Copyright (c) 2002-2006 Marcus Geelnard
// Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.org>
@@ -1308,7 +1308,7 @@ static void processEvent(XEvent *event)
_glfwInputKey(window, key, keycode, GLFW_PRESS, mods);
const uint32_t codepoint = _glfwKeySym2Unicode(keysym);
const uint32_t codepoint = _glfwKeySym2UnicodeX11(keysym);
if (codepoint != GLFW_INVALID_CODEPOINT)
_glfwInputChar(window, codepoint, mods, plain);
}
@@ -2944,7 +2944,7 @@ const char* _glfwGetScancodeNameX11(int scancode)
if (keysym == NoSymbol)
return NULL;
const uint32_t codepoint = _glfwKeySym2Unicode(keysym);
const uint32_t codepoint = _glfwKeySym2UnicodeX11(keysym);
if (codepoint == GLFW_INVALID_CODEPOINT)
return NULL;
+4 -4
View File
@@ -1,5 +1,5 @@
//========================================================================
// GLFW 3.5 X11 - www.glfw.org
// GLFW 3.6 X11 - www.glfw.org
//------------------------------------------------------------------------
// Copyright (c) 2002-2006 Marcus Geelnard
// Copyright (c) 2006-2017 Camilla Löwy <elmindreda@glfw.org>
@@ -27,7 +27,7 @@
#include "internal.h"
#if defined(_GLFW_X11) || defined(_GLFW_WAYLAND)
#if defined(_GLFW_X11)
/*
* Marcus: This code was originally written by Markus G. Kuhn.
@@ -906,7 +906,7 @@ static const struct codepair {
// Convert XKB KeySym to Unicode
//
uint32_t _glfwKeySym2Unicode(unsigned int keysym)
uint32_t _glfwKeySym2UnicodeX11(unsigned int keysym)
{
int min = 0;
int max = sizeof(keysymtab) / sizeof(struct codepair) - 1;
@@ -939,5 +939,5 @@ uint32_t _glfwKeySym2Unicode(unsigned int keysym)
return GLFW_INVALID_CODEPOINT;
}
#endif // _GLFW_WAYLAND or _GLFW_X11
#endif // _GLFW_X11
-30
View File
@@ -1,30 +0,0 @@
//========================================================================
// GLFW 3.5 Linux - www.glfw.org
//------------------------------------------------------------------------
// Copyright (c) 2014 Jonas Ådahl <jadahl@gmail.com>
//
// This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages
// arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it
// freely, subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented; you must not
// claim that you wrote the original software. If you use this software
// in a product, an acknowledgment in the product documentation would
// be appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such, and must not
// be misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source
// distribution.
//
//========================================================================
#define GLFW_INVALID_CODEPOINT 0xffffffffu
uint32_t _glfwKeySym2Unicode(unsigned int keysym);
+75 -30
View File
@@ -23,7 +23,10 @@
//
//========================================================================
//
// This test is intended to verify that posting of empty events works
// This test is intended to verify that the posting of empty events works.
// Background colors are produced on a secondary thread, which then wakes
// the main thread with glfwPostEmptyEvent when a new one is available.
// This allows the main thread to wait for events unconditionally.
//
//========================================================================
@@ -37,25 +40,53 @@
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
static volatile int running = GLFW_TRUE;
struct State
{
mtx_t lock;
bool running;
bool needs_update;
int width;
int height;
float r, g, b;
};
static void error_callback(int error, const char* description)
{
fprintf(stderr, "Error: %s\n", description);
}
static void generate_color(struct State* state)
{
const float r = (float) rand() / (float) RAND_MAX;
const float g = (float) rand() / (float) RAND_MAX;
const float b = (float) rand() / (float) RAND_MAX;
const float l = sqrtf(r * r + g * g + b * b);
mtx_lock(&state->lock);
state->r = r / l;
state->g = g / l;
state->b = b / l;
state->needs_update = true;
mtx_unlock(&state->lock);
}
static int thread_main(void* data)
{
struct timespec time;
struct State* const state = data;
while (running)
srand((unsigned int) time(NULL));
while (state->running)
{
generate_color(state);
glfwPostEmptyEvent();
struct timespec time;
clock_gettime(CLOCK_REALTIME, &time);
time.tv_sec += 1;
thrd_sleep(&time, NULL);
glfwPostEmptyEvent();
}
return 0;
@@ -64,28 +95,38 @@ static int thread_main(void* data)
static void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods)
{
if (key == GLFW_KEY_ESCAPE && action == GLFW_PRESS)
glfwSetWindowShouldClose(window, GLFW_TRUE);
glfwSetWindowShouldClose(window, true);
}
static float nrand(void)
static void framebuffer_size_callback(GLFWwindow* window, int width, int height)
{
return (float) rand() / (float) RAND_MAX;
struct State* const state = glfwGetWindowUserPointer(window);
mtx_lock(&state->lock);
state->width = width;
state->height = height;
state->needs_update = true;
mtx_unlock(&state->lock);
}
int main(void)
{
int result;
thrd_t thread;
GLFWwindow* window;
struct State state = { .running = true };
srand((unsigned int) time(NULL));
if (mtx_init(&state.lock, mtx_plain) != thrd_success)
{
glfwTerminate();
exit(EXIT_FAILURE);
}
generate_color(&state);
glfwSetErrorCallback(error_callback);
if (!glfwInit())
exit(EXIT_FAILURE);
window = glfwCreateWindow(640, 480, "Empty Event Test", NULL, NULL);
GLFWwindow* window = glfwCreateWindow(640, 480, "Empty Event Test", NULL, NULL);
if (!window)
{
glfwTerminate();
@@ -95,8 +136,13 @@ int main(void)
glfwMakeContextCurrent(window);
gladLoadGL(glfwGetProcAddress);
glfwSetKeyCallback(window, key_callback);
glfwSetWindowUserPointer(window, &state);
glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);
glfwGetFramebufferSize(window, &state.width, &state.height);
if (thrd_create(&thread, thread_main, NULL) != thrd_success)
thrd_t color_thread;
if (thrd_create(&color_thread, thread_main, &state) != thrd_success)
{
fprintf(stderr, "Failed to create secondary thread\n");
@@ -104,28 +150,27 @@ int main(void)
exit(EXIT_FAILURE);
}
while (running)
while (!glfwWindowShouldClose(window))
{
int width, height;
float r = nrand(), g = nrand(), b = nrand();
float l = (float) sqrt(r * r + g * g + b * b);
if (state.needs_update)
{
mtx_lock(&state.lock);
glViewport(0, 0, state.width, state.height);
glClearColor(state.r, state.g, state.b, 1.f);
state.needs_update = false;
mtx_unlock(&state.lock);
glfwGetFramebufferSize(window, &width, &height);
glViewport(0, 0, width, height);
glClearColor(r / l, g / l, b / l, 1.f);
glClear(GL_COLOR_BUFFER_BIT);
glfwSwapBuffers(window);
glClear(GL_COLOR_BUFFER_BIT);
glfwSwapBuffers(window);
}
glfwWaitEvents();
if (glfwWindowShouldClose(window))
running = GLFW_FALSE;
}
glfwHideWindow(window);
thrd_join(thread, &result);
glfwDestroyWindow(window);
state.running = false;
thrd_join(color_thread, NULL);
mtx_destroy(&state.lock);
glfwTerminate();
exit(EXIT_SUCCESS);
+4
View File
@@ -146,6 +146,10 @@ int main(void)
for (i = 0; i < count; i++)
thrd_join(threads[i].id, &result);
for (i = 0; i < count; i++)
glfwDestroyWindow(threads[i].window);
glfwTerminate();
exit(EXIT_SUCCESS);
}