Merge tag '3.4' into latest
diff --git a/.appveyor.yml b/.appveyor.yml
index 2742949..c58911c 100644
--- a/.appveyor.yml
+++ b/.appveyor.yml
@@ -15,10 +15,10 @@
         - GENERATOR: MinGW Makefiles
           BUILD_SHARED_LIBS: OFF
           CFLAGS: -Werror
-        - GENERATOR: Visual Studio 10 2010
+        - GENERATOR: Visual Studio 12 2013
           BUILD_SHARED_LIBS: ON
           CFLAGS: /WX
-        - GENERATOR: Visual Studio 10 2010
+        - GENERATOR: Visual Studio 12 2013
           BUILD_SHARED_LIBS: OFF
           CFLAGS: /WX
 matrix:
@@ -30,14 +30,14 @@
             - GENERATOR: MinGW Makefiles
     build_script:
         - set PATH=%PATH:C:\Program Files\Git\usr\bin=C:\MinGW\bin%
-        - cmake -S . -B build -G "%GENERATOR%" -DBUILD_SHARED_LIBS=%BUILD_SHARED_LIBS%
+        - cmake -B build -G "%GENERATOR%" -DBUILD_SHARED_LIBS=%BUILD_SHARED_LIBS%
         - cmake --build build
 -
     matrix:
         only:
-            - GENERATOR: Visual Studio 10 2010
+            - GENERATOR: Visual Studio 12 2013
     build_script:
-        - cmake -S . -B build -G "%GENERATOR%" -DBUILD_SHARED_LIBS=%BUILD_SHARED_LIBS%
+        - cmake -B build -G "%GENERATOR%" -DBUILD_SHARED_LIBS=%BUILD_SHARED_LIBS%
         - cmake --build build --target glfw
 notifications:
     - provider: Email
diff --git a/.editorconfig b/.editorconfig
new file mode 100644
index 0000000..2b44e7b
--- /dev/null
+++ b/.editorconfig
@@ -0,0 +1,67 @@
+# EditorConfig for GLFW and its internal dependencies
+#
+# All files created by GLFW should indent with four spaces unless their format requires
+# otherwise.  A few files still use other indent styles for historical reasons.
+#
+# Dependencies have (what seemed to be) their existing styles described.  Those with
+# existing trailing whitespace have it preserved to avoid cluttering future commits.
+
+root = true
+
+[*]
+charset = utf-8
+end_of_line = lf
+
+[include/GLFW/*.h]
+indent_style = space
+indent_size = 4
+
+[{src,examples,tests}/*.{c,m,h,rc,in}]
+indent_style = space
+indent_size = 4
+
+[CMakeLists.txt]
+indent_style = space
+indent_size = 4
+
+[CMake/**.{cmake,in}]
+indent_style = space
+indent_size = 4
+
+[*.{md}]
+indent_style = space
+indent_size = 4
+trim_trailing_whitespace = false
+
+[DoxygenLayout.xml]
+indent_style = space
+indent_size = 2
+
+[docs/*.{scss,html}]
+indent_style = tab
+indent_size = unset
+
+[deps/mingw/*.h]
+indent_style = space
+indent_size = 4
+tab_width = 8
+trim_trailing_whitespace = false
+
+[deps/getopt.{c,h}]
+indent_style = space
+indent_size = 2
+
+[deps/linmath.h]
+indent_style = tab
+tab_width = 4
+indent_size = 4
+trim_trailing_whitespace = false
+
+[deps/nuklear*.h]
+indent_style = space
+indent_size = 4
+
+[deps/tinycthread.{c,h}]
+indent_style = space
+indent_size = 2
+
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 90293ba..e980c54 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -9,8 +9,8 @@
     contents: read
 
 jobs:
-    build-linux-x11-clang:
-        name: X11 (Linux, Clang)
+    build-linux-clang:
+        name: Linux (Clang)
         runs-on: ubuntu-latest
         timeout-minutes: 4
         env:
@@ -21,88 +21,61 @@
             - name: Install dependencies
               run: |
                   sudo apt update
-                  sudo apt install libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev libxext-dev
+                  sudo apt install libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev libxext-dev libwayland-dev libxkbcommon-dev
 
-            - name: Configure static library
-              run: cmake -S . -B build-static
-            - name: Build static library
-              run: cmake --build build-static --parallel
+            - name: Configure Null shared library
+              run: cmake -B build-null-shared -D GLFW_BUILD_WAYLAND=OFF -D GLFW_BUILD_X11=OFF -D BUILD_SHARED_LIBS=ON
+            - name: Build Null shared library
+              run: cmake --build build-null-shared --parallel
 
-            - name: Configure shared library
-              run: cmake -S . -B build-shared -D BUILD_SHARED_LIBS=ON
-            - name: Build shared library
-              run: cmake --build build-shared --parallel
+            - name: Configure X11 shared library
+              run: cmake -B build-x11-shared -D GLFW_BUILD_WAYLAND=OFF -D GLFW_BUILD_X11=ON -D BUILD_SHARED_LIBS=ON
+            - name: Build X11 shared library
+              run: cmake --build build-x11-shared --parallel
 
-    build-linux-wayland-clang:
-        name: Wayland (Linux, Clang)
-        runs-on: ubuntu-latest
-        timeout-minutes: 4
-        env:
-            CC: clang
-            CFLAGS: -Werror
-        steps:
-            - uses: actions/checkout@v4
-            - name: Install dependencies
-              run: |
-                  sudo apt update
-                  sudo apt install wayland-protocols libwayland-dev libxkbcommon-dev extra-cmake-modules
+            - name: Configure Wayland shared library
+              run: cmake -B build-wayland-shared -D GLFW_BUILD_WAYLAND=ON -D GLFW_BUILD_X11=OFF -D BUILD_SHARED_LIBS=ON
+            - name: Build Wayland shared library
+              run: cmake --build build-wayland-shared --parallel
 
-            - name: Configure static library
-              run: cmake -S . -B build-static -D GLFW_USE_WAYLAND=ON
-            - name: Build static library
-              run: cmake --build build-static --parallel
+            - name: Configure Wayland+X11 static library
+              run: cmake -B build-full-static -D GLFW_BUILD_WAYLAND=ON -D GLFW_BUILD_X11=ON
+            - name: Build Wayland+X11 static library
+              run: cmake --build build-full-static --parallel
 
-            - name: Configure shared library
-              run: cmake -S . -B build-shared -D GLFW_USE_WAYLAND=ON -D BUILD_SHARED_LIBS=ON
-            - name: Build shared library
-              run: cmake --build build-shared --parallel
+            - name: Configure Wayland+X11 shared library
+              run: cmake -B build-full-shared -D GLFW_BUILD_WAYLAND=ON -D BUILD_SHARED_LIBS=ON -D GLFW_BUILD_X11=ON
+            - name: Build Wayland+X11 shared library
+              run: cmake --build build-full-shared --parallel
 
-    build-linux-null-clang:
-        name: Null (Linux, Clang)
-        runs-on: ubuntu-latest
-        timeout-minutes: 4
-        env:
-            CC: clang
-            CFLAGS: -Werror
-        steps:
-            - uses: actions/checkout@v4
-            - name: Install dependencies
-              run: |
-                  sudo apt update
-                  sudo apt install libosmesa6-dev
-
-            - name: Configure static library
-              run: cmake -S . -B build-static -D GLFW_USE_OSMESA=ON
-            - name: Build static library
-              run: cmake --build build-static --parallel
-
-            - name: Configure shared library
-              run: cmake -S . -B build-shared -D GLFW_USE_OSMESA=ON -D BUILD_SHARED_LIBS=ON
-            - name: Build shared library
-              run: cmake --build build-shared --parallel
-
-    build-macos-cocoa-clang:
-        name: Cocoa (macOS, Clang)
+    build-macos-clang:
+        name: macOS (Clang)
         runs-on: macos-latest
         timeout-minutes: 4
         env:
             CFLAGS: -Werror
             MACOSX_DEPLOYMENT_TARGET: 10.8
+            CMAKE_OSX_ARCHITECTURES: x86_64;arm64
         steps:
             - uses: actions/checkout@v4
 
-            - name: Configure static library
-              run: cmake -S . -B build-static
-            - name: Build static library
-              run: cmake --build build-static --parallel
+            - name: Configure Null shared library
+              run: cmake -B build-null-shared -D GLFW_BUILD_COCOA=OFF -D BUILD_SHARED_LIBS=ON
+            - name: Build Null shared library
+              run: cmake --build build-null-shared --parallel
 
-            - name: Configure shared library
-              run: cmake -S . -B build-shared -D BUILD_SHARED_LIBS=ON
-            - name: Build shared library
-              run: cmake --build build-shared --parallel
+            - name: Configure Cocoa static library
+              run: cmake -B build-cocoa-static
+            - name: Build Cocoa static library
+              run: cmake --build build-cocoa-static --parallel
 
-    build-windows-win32-vs2022:
-        name: Win32 (Windows, VS2022)
+            - name: Configure Cocoa shared library
+              run: cmake -B build-cocoa-shared -D BUILD_SHARED_LIBS=ON
+            - name: Build Cocoa shared library
+              run: cmake --build build-cocoa-shared --parallel
+
+    build-windows-vs2022:
+        name: Windows (VS2022)
         runs-on: windows-latest
         timeout-minutes: 4
         env:
@@ -110,13 +83,18 @@
         steps:
             - uses: actions/checkout@v4
 
-            - name: Configure static library
-              run: cmake -S . -B build-static -G "Visual Studio 17 2022"
-            - name: Build static library
-              run: cmake --build build-static --parallel
+            - 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
+            - name: Build Win32 shared x86 library
+              run: cmake --build build-win32-shared-x86 --parallel
 
-            - name: Configure shared library
-              run: cmake -S . -B build-shared -G "Visual Studio 17 2022" -D BUILD_SHARED_LIBS=ON
-            - name: Build shared library
-              run: cmake --build build-shared --parallel
+            - name: Configure Win32 static x64 library
+              run: cmake -B build-win32-static-x64 -G "Visual Studio 17 2022" -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
+            - name: Build Win32 shared x64 library
+              run: cmake --build build-win32-shared-x64 --parallel
 
diff --git a/.gitignore b/.gitignore
index cbe19ec..9d2d504 100644
--- a/.gitignore
+++ b/.gitignore
@@ -53,19 +53,15 @@
 src/glfw3.pc
 src/glfw3Config.cmake
 src/glfw3ConfigVersion.cmake
-src/wayland-pointer-constraints-unstable-v1-client-protocol.h
-src/wayland-pointer-constraints-unstable-v1-protocol.c
-src/wayland-relative-pointer-unstable-v1-client-protocol.h
-src/wayland-relative-pointer-unstable-v1-protocol.c
 
 # Compiled binaries
 src/libglfw.so
 src/libglfw.so.3
-src/libglfw.so.3.3
+src/libglfw.so.3.4
 src/libglfw.dylib
 src/libglfw.dylib
 src/libglfw.3.dylib
-src/libglfw.3.3.dylib
+src/libglfw.3.4.dylib
 src/libglfw3.a
 src/glfw3.lib
 src/glfw3.dll
@@ -80,8 +76,9 @@
 examples/particles
 examples/splitview
 examples/sharing
-examples/simple
+examples/triangle-opengl
 examples/wave
+examples/windows
 tests/*.app
 tests/*.exe
 tests/clipboard
@@ -92,6 +89,7 @@
 tests/glfwinfo
 tests/icon
 tests/iconify
+tests/inputlag
 tests/joysticks
 tests/monitors
 tests/msaa
@@ -101,5 +99,6 @@
 tests/timeout
 tests/title
 tests/triangle-vulkan
+tests/window
 tests/windows
 
diff --git a/CMake/GenerateMappings.cmake b/CMake/GenerateMappings.cmake
index 47e6374..c8c9e23 100644
--- a/CMake/GenerateMappings.cmake
+++ b/CMake/GenerateMappings.cmake
@@ -26,19 +26,19 @@
     if (line MATCHES "^[0-9a-fA-F]")
         if (line MATCHES "platform:Windows")
             if (GLFW_WIN32_MAPPINGS)
-                set(GLFW_WIN32_MAPPINGS "${GLFW_WIN32_MAPPINGS}\n")
+                string(APPEND GLFW_WIN32_MAPPINGS "\n")
             endif()
-            set(GLFW_WIN32_MAPPINGS "${GLFW_WIN32_MAPPINGS}\"${line}\",")
+            string(APPEND GLFW_WIN32_MAPPINGS "\"${line}\",")
         elseif (line MATCHES "platform:Mac OS X")
             if (GLFW_COCOA_MAPPINGS)
-                set(GLFW_COCOA_MAPPINGS "${GLFW_COCOA_MAPPINGS}\n")
+                string(APPEND GLFW_COCOA_MAPPINGS "\n")
             endif()
-            set(GLFW_COCOA_MAPPINGS "${GLFW_COCOA_MAPPINGS}\"${line}\",")
+            string(APPEND GLFW_COCOA_MAPPINGS "\"${line}\",")
         elseif (line MATCHES "platform:Linux")
             if (GLFW_LINUX_MAPPINGS)
-                set(GLFW_LINUX_MAPPINGS "${GLFW_LINUX_MAPPINGS}\n")
+                string(APPEND GLFW_LINUX_MAPPINGS "\n")
             endif()
-            set(GLFW_LINUX_MAPPINGS "${GLFW_LINUX_MAPPINGS}\"${line}\",")
+            string(APPEND GLFW_LINUX_MAPPINGS "\"${line}\",")
         endif()
     endif()
 endforeach()
diff --git a/CMake/MacOSXBundleInfo.plist.in b/CMake/Info.plist.in
similarity index 100%
rename from CMake/MacOSXBundleInfo.plist.in
rename to CMake/Info.plist.in
diff --git a/cmake_uninstall.cmake.in b/CMake/cmake_uninstall.cmake.in
similarity index 78%
rename from cmake_uninstall.cmake.in
rename to CMake/cmake_uninstall.cmake.in
index 4ea57b1..5ecc476 100644
--- a/cmake_uninstall.cmake.in
+++ b/CMake/cmake_uninstall.cmake.in
@@ -1,9 +1,9 @@
 
-if (NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
-  message(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"")
+if (NOT EXISTS "@GLFW_BINARY_DIR@/install_manifest.txt")
+    message(FATAL_ERROR "Cannot find install manifest: \"@GLFW_BINARY_DIR@/install_manifest.txt\"")
 endif()
 
-file(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files)
+file(READ "@GLFW_BINARY_DIR@/install_manifest.txt" files)
 string(REGEX REPLACE "\n" ";" files "${files}")
 
 foreach (file ${files})
diff --git a/src/glfw3.pc.in b/CMake/glfw3.pc.in
similarity index 77%
rename from src/glfw3.pc.in
rename to CMake/glfw3.pc.in
index 17779ac..36ee218 100644
--- a/src/glfw3.pc.in
+++ b/CMake/glfw3.pc.in
@@ -7,7 +7,7 @@
 Description: A multi-platform library for OpenGL, window and input
 Version: @GLFW_VERSION@
 URL: https://www.glfw.org/
-Requires.private: @GLFW_PKG_DEPS@
+Requires.private: @GLFW_PKG_CONFIG_REQUIRES_PRIVATE@
 Libs: -L${libdir} -l@GLFW_LIB_NAME@@GLFW_LIB_NAME_SUFFIX@
-Libs.private: @GLFW_PKG_LIBS@
+Libs.private: @GLFW_PKG_CONFIG_LIBS_PRIVATE@
 Cflags: -I${includedir}
diff --git a/CMake/glfw3Config.cmake.in b/CMake/glfw3Config.cmake.in
new file mode 100644
index 0000000..4a13a88
--- /dev/null
+++ b/CMake/glfw3Config.cmake.in
@@ -0,0 +1,3 @@
+include(CMakeFindDependencyMacro)
+find_dependency(Threads)
+include("${CMAKE_CURRENT_LIST_DIR}/glfw3Targets.cmake")
diff --git a/CMake/modules/FindWaylandProtocols.cmake b/CMake/modules/FindWaylandProtocols.cmake
deleted file mode 100644
index 8eb83f2..0000000
--- a/CMake/modules/FindWaylandProtocols.cmake
+++ /dev/null
@@ -1,26 +0,0 @@
-find_package(PkgConfig)
-
-pkg_check_modules(WaylandProtocols QUIET wayland-protocols>=${WaylandProtocols_FIND_VERSION})
-
-execute_process(COMMAND ${PKG_CONFIG_EXECUTABLE} --variable=pkgdatadir wayland-protocols
-                OUTPUT_VARIABLE WaylandProtocols_PKGDATADIR
-                RESULT_VARIABLE _pkgconfig_failed)
-if (_pkgconfig_failed)
-    message(FATAL_ERROR "Missing wayland-protocols pkgdatadir")
-endif()
-
-string(REGEX REPLACE "[\r\n]" "" WaylandProtocols_PKGDATADIR "${WaylandProtocols_PKGDATADIR}")
-
-find_package_handle_standard_args(WaylandProtocols
-    FOUND_VAR
-        WaylandProtocols_FOUND
-    REQUIRED_VARS
-        WaylandProtocols_PKGDATADIR
-    VERSION_VAR
-        WaylandProtocols_VERSION
-    HANDLE_COMPONENTS
-)
-
-set(WAYLAND_PROTOCOLS_FOUND ${WaylandProtocols_FOUND})
-set(WAYLAND_PROTOCOLS_PKGDATADIR ${WaylandProtocols_PKGDATADIR})
-set(WAYLAND_PROTOCOLS_VERSION ${WaylandProtocols_VERSION})
diff --git a/CMake/modules/FindXKBCommon.cmake b/CMake/modules/FindXKBCommon.cmake
deleted file mode 100644
index 0f571ee..0000000
--- a/CMake/modules/FindXKBCommon.cmake
+++ /dev/null
@@ -1,34 +0,0 @@
-# - Try to find XKBCommon
-# Once done, this will define
-#
-#   XKBCOMMON_FOUND - System has XKBCommon
-#   XKBCOMMON_INCLUDE_DIRS - The XKBCommon include directories
-#   XKBCOMMON_LIBRARIES - The libraries needed to use XKBCommon
-#   XKBCOMMON_DEFINITIONS - Compiler switches required for using XKBCommon
-
-find_package(PkgConfig)
-pkg_check_modules(PC_XKBCOMMON QUIET xkbcommon)
-set(XKBCOMMON_DEFINITIONS ${PC_XKBCOMMON_CFLAGS_OTHER})
-
-find_path(XKBCOMMON_INCLUDE_DIR
-    NAMES xkbcommon/xkbcommon.h
-    HINTS ${PC_XKBCOMMON_INCLUDE_DIR} ${PC_XKBCOMMON_INCLUDE_DIRS}
-)
-
-find_library(XKBCOMMON_LIBRARY
-    NAMES xkbcommon
-    HINTS ${PC_XKBCOMMON_LIBRARY} ${PC_XKBCOMMON_LIBRARY_DIRS}
-)
-
-set(XKBCOMMON_LIBRARIES ${XKBCOMMON_LIBRARY})
-set(XKBCOMMON_LIBRARY_DIRS ${XKBCOMMON_LIBRARY_DIRS})
-set(XKBCOMMON_INCLUDE_DIRS ${XKBCOMMON_INCLUDE_DIR})
-
-include(FindPackageHandleStandardArgs)
-find_package_handle_standard_args(XKBCommon DEFAULT_MSG
-    XKBCOMMON_LIBRARY
-    XKBCOMMON_INCLUDE_DIR
-)
-
-mark_as_advanced(XKBCOMMON_LIBRARY XKBCOMMON_INCLUDE_DIR)
-
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 840808d..a3cb1fe 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,10 +1,6 @@
-cmake_minimum_required(VERSION 3.0...3.20 FATAL_ERROR)
+cmake_minimum_required(VERSION 3.4...3.28 FATAL_ERROR)
 
-project(GLFW VERSION 3.3.10 LANGUAGES C)
-
-if (POLICY CMP0054)
-    cmake_policy(SET CMP0054 NEW)
-endif()
+project(GLFW VERSION 3.4.0 LANGUAGES C)
 
 if (POLICY CMP0069)
     cmake_policy(SET CMP0069 NEW)
@@ -16,72 +12,73 @@
 
 set_property(GLOBAL PROPERTY USE_FOLDERS ON)
 
+string(COMPARE EQUAL "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_SOURCE_DIR}" GLFW_STANDALONE)
+
 option(BUILD_SHARED_LIBS "Build shared libraries" OFF)
-option(GLFW_BUILD_EXAMPLES "Build the GLFW example programs" ON)
-option(GLFW_BUILD_TESTS "Build the GLFW test programs" ON)
+option(GLFW_BUILD_EXAMPLES "Build the GLFW example programs" ${GLFW_STANDALONE})
+option(GLFW_BUILD_TESTS "Build the GLFW test programs" ${GLFW_STANDALONE})
 option(GLFW_BUILD_DOCS "Build the GLFW documentation" ON)
 option(GLFW_INSTALL "Generate installation target" ON)
-option(GLFW_VULKAN_STATIC "Assume the Vulkan loader is linked with the application" OFF)
 
 include(GNUInstallDirs)
 include(CMakeDependentOption)
 
-cmake_dependent_option(GLFW_USE_OSMESA "Use OSMesa for offscreen context creation" OFF
-                       "UNIX" OFF)
+if (GLFW_USE_OSMESA)
+    message(FATAL_ERROR "GLFW_USE_OSMESA has been removed; set the GLFW_PLATFORM init hint")
+endif()
+
+if (DEFINED GLFW_USE_WAYLAND AND UNIX AND NOT APPLE)
+    message(FATAL_ERROR
+        "GLFW_USE_WAYLAND has been removed; delete the CMake cache and set GLFW_BUILD_WAYLAND and GLFW_BUILD_X11 instead")
+endif()
+
+cmake_dependent_option(GLFW_BUILD_WIN32 "Build support for Win32" ON "WIN32" OFF)
+cmake_dependent_option(GLFW_BUILD_COCOA "Build support for Cocoa" ON "APPLE" OFF)
+cmake_dependent_option(GLFW_BUILD_X11 "Build support for X11" ON "UNIX;NOT APPLE" OFF)
+cmake_dependent_option(GLFW_BUILD_WAYLAND "Build support for Wayland" ON "UNIX;NOT APPLE" OFF)
+
 cmake_dependent_option(GLFW_USE_HYBRID_HPG "Force use of high-performance GPU on hybrid systems" OFF
                        "WIN32" OFF)
-cmake_dependent_option(GLFW_USE_WAYLAND "Use Wayland for window creation" OFF
-                       "UNIX;NOT APPLE" OFF)
 cmake_dependent_option(USE_MSVC_RUNTIME_LIBRARY_DLL "Use MSVC runtime library DLL" ON
                        "MSVC" OFF)
 
-if (BUILD_SHARED_LIBS)
-    set(_GLFW_BUILD_DLL 1)
-endif()
+set(GLFW_LIBRARY_TYPE "${GLFW_LIBRARY_TYPE}" CACHE STRING
+    "Library type override for GLFW (SHARED, STATIC, OBJECT, or empty to follow BUILD_SHARED_LIBS)")
 
-if (BUILD_SHARED_LIBS AND UNIX)
-    # On Unix-like systems, shared libraries can use the soname system.
-    set(GLFW_LIB_NAME glfw)
-else()
-    set(GLFW_LIB_NAME glfw3)
-endif()
-set(GLFW_LIB_NAME_SUFFIX "")
-
-if (GLFW_VULKAN_STATIC)
-    if (BUILD_SHARED_LIBS)
-        # If you absolutely must do this, remove this line and add the Vulkan
-        # loader static library via the CMAKE_SHARED_LINKER_FLAGS
-        message(FATAL_ERROR "You are trying to link the Vulkan loader static library into the GLFW shared library")
+if (GLFW_LIBRARY_TYPE)
+    if (GLFW_LIBRARY_TYPE STREQUAL "SHARED")
+        set(GLFW_BUILD_SHARED_LIBRARY TRUE)
+    else()
+        set(GLFW_BUILD_SHARED_LIBRARY FALSE)
     endif()
-    set(_GLFW_VULKAN_STATIC 1)
+else()
+    set(GLFW_BUILD_SHARED_LIBRARY ${BUILD_SHARED_LIBS})
 endif()
 
 list(APPEND CMAKE_MODULE_PATH "${GLFW_SOURCE_DIR}/CMake/modules")
 
 find_package(Threads REQUIRED)
 
-if (GLFW_BUILD_DOCS)
-    set(DOXYGEN_SKIP_DOT TRUE)
-    find_package(Doxygen)
+#--------------------------------------------------------------------
+# Report backend selection
+#--------------------------------------------------------------------
+if (GLFW_BUILD_WIN32)
+    message(STATUS "Including Win32 support")
+endif()
+if (GLFW_BUILD_COCOA)
+    message(STATUS "Including Cocoa support")
+endif()
+if (GLFW_BUILD_WAYLAND)
+    message(STATUS "Including Wayland support")
+endif()
+if (GLFW_BUILD_X11)
+    message(STATUS "Including X11 support")
 endif()
 
 #--------------------------------------------------------------------
 # Apply Microsoft C runtime library option
 # This is here because it also applies to tests and examples
 #--------------------------------------------------------------------
-if (MSVC)
-    if (MSVC90)
-        # Workaround for VS 2008 not shipping with the DirectX 9 SDK
-        include(CheckIncludeFile)
-        check_include_file(dinput.h DINPUT_H_FOUND)
-        if (NOT DINPUT_H_FOUND)
-            message(FATAL_ERROR "DirectX 9 headers not found; install DirectX 9 SDK")
-        endif()
-        # Workaround for VS 2008 not shipping with stdint.h
-        list(APPEND glfw_INCLUDE_DIRS "${GLFW_SOURCE_DIR}/deps/vs2008")
-    endif()
-endif()
-
 if (MSVC AND NOT USE_MSVC_RUNTIME_LIBRARY_DLL)
     if (CMAKE_VERSION VERSION_LESS 3.15)
         foreach (flag CMAKE_C_FLAGS
@@ -103,222 +100,6 @@
     endif()
 endif()
 
-if (MINGW)
-    # Workaround for legacy MinGW not providing XInput and DirectInput
-    include(CheckIncludeFile)
-
-    check_include_file(dinput.h DINPUT_H_FOUND)
-    check_include_file(xinput.h XINPUT_H_FOUND)
-    if (NOT DINPUT_H_FOUND OR NOT XINPUT_H_FOUND)
-        list(APPEND glfw_INCLUDE_DIRS "${GLFW_SOURCE_DIR}/deps/mingw")
-    endif()
-
-    # Enable link-time exploit mitigation features enabled by default on MSVC
-    include(CheckCCompilerFlag)
-
-    # Compatibility with data execution prevention (DEP)
-    set(CMAKE_REQUIRED_FLAGS "-Wl,--nxcompat")
-    check_c_compiler_flag("" _GLFW_HAS_DEP)
-    if (_GLFW_HAS_DEP)
-        set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--nxcompat ${CMAKE_SHARED_LINKER_FLAGS}")
-    endif()
-
-    # Compatibility with address space layout randomization (ASLR)
-    set(CMAKE_REQUIRED_FLAGS "-Wl,--dynamicbase")
-    check_c_compiler_flag("" _GLFW_HAS_ASLR)
-    if (_GLFW_HAS_ASLR)
-        set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--dynamicbase ${CMAKE_SHARED_LINKER_FLAGS}")
-    endif()
-
-    # Compatibility with 64-bit address space layout randomization (ASLR)
-    set(CMAKE_REQUIRED_FLAGS "-Wl,--high-entropy-va")
-    check_c_compiler_flag("" _GLFW_HAS_64ASLR)
-    if (_GLFW_HAS_64ASLR)
-        set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--high-entropy-va ${CMAKE_SHARED_LINKER_FLAGS}")
-    endif()
-
-    # Clear flags again to avoid breaking later tests
-    set(CMAKE_REQUIRED_FLAGS)
-endif()
-
-#--------------------------------------------------------------------
-# Detect and select backend APIs
-#--------------------------------------------------------------------
-if (GLFW_USE_WAYLAND)
-    set(_GLFW_WAYLAND 1)
-    message(STATUS "Using Wayland for window creation")
-elseif (GLFW_USE_OSMESA)
-    set(_GLFW_OSMESA 1)
-    message(STATUS "Using OSMesa for headless context creation")
-elseif (WIN32)
-    set(_GLFW_WIN32 1)
-    message(STATUS "Using Win32 for window creation")
-elseif (APPLE)
-    set(_GLFW_COCOA 1)
-    message(STATUS "Using Cocoa for window creation")
-elseif (UNIX)
-    set(_GLFW_X11 1)
-    message(STATUS "Using X11 for window creation")
-else()
-    message(FATAL_ERROR "No supported platform was detected")
-endif()
-
-#--------------------------------------------------------------------
-# Find and add Unix math and time libraries
-#--------------------------------------------------------------------
-if (UNIX AND NOT APPLE)
-    find_library(RT_LIBRARY rt)
-    mark_as_advanced(RT_LIBRARY)
-    if (RT_LIBRARY)
-        list(APPEND glfw_LIBRARIES "${RT_LIBRARY}")
-        list(APPEND glfw_PKG_LIBS "-lrt")
-    endif()
-
-    find_library(MATH_LIBRARY m)
-    mark_as_advanced(MATH_LIBRARY)
-    if (MATH_LIBRARY)
-        list(APPEND glfw_LIBRARIES "${MATH_LIBRARY}")
-        list(APPEND glfw_PKG_LIBS "-lm")
-    endif()
-
-    if (CMAKE_DL_LIBS)
-        list(APPEND glfw_LIBRARIES "${CMAKE_DL_LIBS}")
-        list(APPEND glfw_PKG_LIBS "-l${CMAKE_DL_LIBS}")
-    endif()
-endif()
-
-#--------------------------------------------------------------------
-# Use Win32 for window creation
-#--------------------------------------------------------------------
-if (_GLFW_WIN32)
-
-    list(APPEND glfw_PKG_LIBS "-lgdi32")
-
-    if (GLFW_USE_HYBRID_HPG)
-        set(_GLFW_USE_HYBRID_HPG 1)
-    endif()
-
-    if (BUILD_SHARED_LIBS)
-        set (GLFW_LIB_NAME_SUFFIX "dll")
-    endif()
-endif()
-
-#--------------------------------------------------------------------
-# Use X11 for window creation
-#--------------------------------------------------------------------
-if (_GLFW_X11)
-
-    find_package(X11 REQUIRED)
-
-    list(APPEND glfw_PKG_DEPS "x11")
-
-    # Set up library and include paths
-    list(APPEND glfw_INCLUDE_DIRS "${X11_X11_INCLUDE_PATH}")
-    list(APPEND glfw_LIBRARIES "${X11_X11_LIB}" "${CMAKE_THREAD_LIBS_INIT}")
-
-    # Check for XRandR (modern resolution switching and gamma control)
-    if (NOT X11_Xrandr_INCLUDE_PATH)
-        message(FATAL_ERROR "RandR headers not found; install libxrandr development package")
-    endif()
-
-    # Check for Xinerama (legacy multi-monitor support)
-    if (NOT X11_Xinerama_INCLUDE_PATH)
-        message(FATAL_ERROR "Xinerama headers not found; install libxinerama development package")
-    endif()
-
-    # Check for Xkb (X keyboard extension)
-    if (NOT X11_Xkb_INCLUDE_PATH)
-        message(FATAL_ERROR "XKB headers not found; install X11 development package")
-    endif()
-
-    # Check for Xcursor (cursor creation from RGBA images)
-    if (NOT X11_Xcursor_INCLUDE_PATH)
-        message(FATAL_ERROR "Xcursor headers not found; install libxcursor development package")
-    endif()
-
-    # Check for XInput (modern HID input)
-    if (NOT X11_Xi_INCLUDE_PATH)
-        message(FATAL_ERROR "XInput headers not found; install libxi development package")
-    endif()
-
-    list(APPEND glfw_INCLUDE_DIRS "${X11_Xrandr_INCLUDE_PATH}"
-                                  "${X11_Xinerama_INCLUDE_PATH}"
-                                  "${X11_Xkb_INCLUDE_PATH}"
-                                  "${X11_Xcursor_INCLUDE_PATH}"
-                                  "${X11_Xi_INCLUDE_PATH}")
-endif()
-
-#--------------------------------------------------------------------
-# Use Wayland for window creation
-#--------------------------------------------------------------------
-if (_GLFW_WAYLAND)
-    find_package(ECM REQUIRED NO_MODULE)
-    list(APPEND CMAKE_MODULE_PATH "${ECM_MODULE_PATH}")
-
-    find_package(Wayland REQUIRED Client Cursor Egl)
-    find_package(WaylandScanner REQUIRED)
-    find_package(WaylandProtocols 1.15 REQUIRED)
-
-    list(APPEND glfw_PKG_DEPS "wayland-client")
-
-    list(APPEND glfw_INCLUDE_DIRS "${Wayland_INCLUDE_DIRS}")
-    list(APPEND glfw_LIBRARIES "${Wayland_LIBRARIES}" "${CMAKE_THREAD_LIBS_INIT}")
-
-    find_package(XKBCommon REQUIRED)
-    list(APPEND glfw_INCLUDE_DIRS "${XKBCOMMON_INCLUDE_DIRS}")
-
-    include(CheckIncludeFiles)
-    include(CheckFunctionExists)
-    check_function_exists(memfd_create HAVE_MEMFD_CREATE)
-
-    if (NOT CMAKE_SYSTEM_NAME STREQUAL "Linux")
-        find_package(EpollShim)
-        if (EPOLLSHIM_FOUND)
-            list(APPEND glfw_INCLUDE_DIRS "${EPOLLSHIM_INCLUDE_DIRS}")
-            list(APPEND glfw_LIBRARIES "${EPOLLSHIM_LIBRARIES}")
-        endif()
-    endif()
-endif()
-
-#--------------------------------------------------------------------
-# Use OSMesa for offscreen context creation
-#--------------------------------------------------------------------
-if (_GLFW_OSMESA)
-    find_package(OSMesa REQUIRED)
-    list(APPEND glfw_LIBRARIES "${CMAKE_THREAD_LIBS_INIT}")
-endif()
-
-#--------------------------------------------------------------------
-# Use Cocoa for window creation and NSOpenGL for context creation
-#--------------------------------------------------------------------
-if (_GLFW_COCOA)
-
-    list(APPEND glfw_LIBRARIES
-        "-framework Cocoa"
-        "-framework IOKit"
-        "-framework CoreFoundation")
-
-    set(glfw_PKG_DEPS "")
-    set(glfw_PKG_LIBS "-framework Cocoa -framework IOKit -framework CoreFoundation")
-endif()
-
-#--------------------------------------------------------------------
-# Add the Vulkan loader as a dependency if necessary
-#--------------------------------------------------------------------
-if (GLFW_VULKAN_STATIC)
-    list(APPEND glfw_PKG_DEPS "vulkan")
-endif()
-
-#--------------------------------------------------------------------
-# Export GLFW library dependencies
-#--------------------------------------------------------------------
-foreach(arg ${glfw_PKG_DEPS})
-    set(GLFW_PKG_DEPS "${GLFW_PKG_DEPS} ${arg}")
-endforeach()
-foreach(arg ${glfw_PKG_LIBS})
-    set(GLFW_PKG_LIBS "${GLFW_PKG_LIBS} ${arg}")
-endforeach()
-
 #--------------------------------------------------------------------
 # Create generated files
 #--------------------------------------------------------------------
@@ -326,7 +107,7 @@
 
 set(GLFW_CONFIG_PATH "${CMAKE_INSTALL_LIBDIR}/cmake/glfw3")
 
-configure_package_config_file(src/glfw3Config.cmake.in
+configure_package_config_file(CMake/glfw3Config.cmake.in
                               src/glfw3Config.cmake
                               INSTALL_DESTINATION "${GLFW_CONFIG_PATH}"
                               NO_CHECK_REQUIRED_COMPONENTS_MACRO)
@@ -335,10 +116,6 @@
                                  VERSION ${GLFW_VERSION}
                                  COMPATIBILITY SameMajorVersion)
 
-configure_file(src/glfw_config.h.in src/glfw_config.h @ONLY)
-
-configure_file(src/glfw3.pc.in src/glfw3.pc @ONLY)
-
 #--------------------------------------------------------------------
 # Add subdirectories
 #--------------------------------------------------------------------
@@ -352,7 +129,7 @@
     add_subdirectory(tests)
 endif()
 
-if (DOXYGEN_FOUND AND GLFW_BUILD_DOCS)
+if (GLFW_BUILD_DOCS)
     add_subdirectory(docs)
 endif()
 
@@ -376,7 +153,7 @@
 
     # Only generate this target if no higher-level project already has
     if (NOT TARGET uninstall)
-        configure_file(cmake_uninstall.cmake.in
+        configure_file(CMake/cmake_uninstall.cmake.in
                        cmake_uninstall.cmake IMMEDIATE @ONLY)
 
         add_custom_target(uninstall
diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md
index 684850f..c4c74ad 100644
--- a/CONTRIBUTORS.md
+++ b/CONTRIBUTORS.md
@@ -11,9 +11,11 @@
  - Takuro Ashie
  - ashishgamedev
  - David Avedissian
+ - Luca Bacci
  - Keith Bauer
  - John Bartholomew
  - Coşku Baş
+ - Bayemite
  - Niklas Behrens
  - Andrew Belt
  - Nevyn Bengtsson
@@ -32,7 +34,9 @@
  - David Carlier
  - Arturo Castro
  - Chi-kwan Chan
+ - Victor Chernyakin
  - TheChocolateOre
+ - Ali Chraghi
  - Joseph Chua
  - Ian Clarkson
  - Michał Cichoń
@@ -61,7 +65,7 @@
  - Robin Eklind
  - Jan Ekström
  - Siavash Eliasi
- - TheExileFox
+ - Ahmad Fatoum
  - Nikita Fediuchin
  - Felipe Ferreira
  - Michael Fogleman
@@ -97,6 +101,7 @@
  - Warren Hu
  - Charles Huber
  - Brent Huisman
+ - Florian Hülsmann
  - illustris
  - InKryption
  - IntellectualKitty
@@ -119,6 +124,7 @@
  - Rokas Kupstys
  - Konstantin Käfer
  - Eric Larson
+ - Guillaume Lebrun
  - Francis Lecavalier
  - Jong Won Lee
  - Robin Leffmann
@@ -148,6 +154,7 @@
  - Jonathan Mercier
  - Marcel Metz
  - Liam Middlebrook
+ - mightgoyardstill
  - Ave Milia
  - Icyllis Milica
  - Jonathan Miller
@@ -161,21 +168,28 @@
  - Jon Morton
  - Pierre Moulon
  - Martins Mozeiko
+ - Pascal Muetschard
  - James Murphy
  - Julian Møller
+ - Julius Häger
+ - Nat!
  - NateIsStalling
  - ndogxj
  - F. Nedelec
+ - n3rdopolis
  - Kristian Nielsen
  - Joel Niemelä
+ - Victor Nova
  - Kamil Nowakowski
  - onox
  - Denis Ovod
  - Ozzy
  - Andri Pálsson
+ - luz paz
  - Peoro
  - Braden Pellett
  - Christopher Pelloux
+ - Michael Pennington
  - Arturo J. Pérez
  - Vladimir Perminov
  - Olivier Perret
@@ -188,26 +202,31 @@
  - Stanislav Podgorskiy
  - Konstantin Podsvirov
  - Nathan Poirier
+ - Pokechu22
  - Alexandre Pretyman
  - Pablo Prietz
  - przemekmirek
  - pthom
  - Martin Pulec
  - Guillaume Racicot
+ - Juan Ramos
  - Christian Rauch
  - Philip Rideout
  - Eddie Ringle
  - Max Risuhin
  - Joe Roback
  - Jorge Rodriguez
+ - Jari Ronkainen
  - Luca Rood
  - Ed Ropple
  - Aleksey Rybalkin
  - Mikko Rytkönen
  - Riku Salminen
- - Anton Samokhvalov
+ - Yoshinori Sano
  - Brandon Schaefer
  - Sebastian Schuberth
+ - Scr3amer
+ - Jan Schuerkamp
  - Christian Sdunek
  - Matt Sealey
  - Steve Sexton
@@ -218,9 +237,11 @@
  - Dmitri Shuralyov
  - Joao da Silva
  - Daniel Sieger
+ - Daljit Singh
  - Michael Skec
  - Daniel Skorupski
  - Slemmie
+ - Anthony Smith
  - Bradley Smith
  - Cliff Smolinsky
  - Patrick Snape
@@ -236,6 +257,7 @@
  - Nathan Sweet
  - TTK-Bandit
  - Nuno Teixeira
+ - Jared Tiala
  - Sergey Tikhomirov
  - Arthur Tombs
  - TronicLabs
@@ -255,13 +277,14 @@
  - Patrick Walton
  - Jim Wang
  - Xo Wang
+ - Andre Weissflog
  - Jay Weisskopf
  - Frank Wille
- - Richard A. Wilkes
  - Andy Williams
+ - Joel Winarske
+ - Richard A. Wilkes
  - Tatsuya Yatagawa
  - Ryogo Yoshimura
- - Rácz Zalán
  - Lukas Zanner
  - Andrey Zholos
  - Aihui Zhu
diff --git a/README.md b/README.md
index f77a74d..efd1383 100644
--- a/README.md
+++ b/README.md
@@ -10,15 +10,15 @@
 creating windows, contexts and surfaces, reading input, handling events, etc.
 
 GLFW natively supports Windows, macOS and Linux and other Unix-like systems.  On
-Linux both X11 and Wayland are supported.
+Linux both Wayland and X11 are supported.
 
 GLFW is licensed under the [zlib/libpng
 license](https://www.glfw.org/license.html).
 
 You can [download](https://www.glfw.org/download.html) the latest stable release
-as source or Windows binaries, or fetch the `latest` branch from GitHub.  Each
-release starting with 3.0 also has a corresponding [annotated
-tag](https://github.com/glfw/glfw/releases) with source and binary archives.
+as source or Windows binaries.  Each release starting with 3.0 also has
+a corresponding [annotated tag](https://github.com/glfw/glfw/releases) with
+source and binary archives.
 
 The [documentation](https://www.glfw.org/docs/latest/) is available online and is
 included in all source and binary archives.  See the [release
@@ -46,18 +46,19 @@
 
 ## Compiling GLFW
 
-GLFW itself requires only the headers and libraries for your OS and window
-system.  It does not need the headers for any context creation API (WGL, GLX,
-EGL, NSGL, OSMesa) or rendering API (OpenGL, OpenGL ES, Vulkan) to enable
-support for them.
+GLFW is written primarily in C99, with parts of macOS support being written in
+Objective-C.  GLFW itself requires only the headers and libraries for your OS
+and window system.  It does not need any additional headers for context creation
+APIs (WGL, GLX, EGL, NSGL, OSMesa) or rendering APIs (OpenGL, OpenGL ES, Vulkan)
+to enable support for them.
 
-GLFW supports compilation on Windows with Visual C++ 2010 and later, MinGW and
+GLFW supports compilation on Windows with Visual C++ 2013 and later, MinGW and
 MinGW-w64, on macOS with Clang and on Linux and other Unix-like systems with GCC
 and Clang.  It will likely compile in other environments as well, but this is
 not regularly tested.
 
-There are [pre-compiled Windows binaries](https://www.glfw.org/download.html)
-available for all supported compilers.
+There are [pre-compiled binaries](https://www.glfw.org/download.html) available
+for all supported compilers on Windows and macOS.
 
 See the [compilation guide](https://www.glfw.org/docs/latest/compile.html) for
 more information about how to compile GLFW yourself.
@@ -89,10 +90,8 @@
 
 ## Dependencies
 
-GLFW itself depends only on the headers and libraries for your window system.
-
-The (experimental) Wayland backend also depends on the `extra-cmake-modules`
-package, which is used to generate Wayland protocol headers.
+GLFW itself needs only CMake 3.1 or later and the headers and libraries for your
+OS and window system.
 
 The examples and test programs depend on a number of tiny libraries.  These are
 located in the `deps/` directory.
@@ -120,14 +119,326 @@
 information on what to include when reporting a bug.
 
 
-## Changelog
+## Changelog since 3.3.10
 
- - Bugfix: `glfwGetKeyName` emitted `GLFW_INVALID_VALUE` for scancodes with no
-   key token (#1785,#2214)
- - [Wayland] Bugfix: Terminating the library before showing a window could segfault
- - [Wayland] Bugfix: Compilation failed on FreeBSD (#2445)
- - [Linux] Bugfix: `regfree´ was called on invalid data (#2464)
- - [WGL] Bugfix: Context creation failed in Parallels VM (#2191,#2406,#2467)
+ - Added `GLFW_PLATFORM` init hint for runtime platform selection (#1958)
+ - Added `GLFW_ANY_PLATFORM`, `GLFW_PLATFORM_WIN32`, `GLFW_PLATFORM_COCOA`,
+   `GLFW_PLATFORM_WAYLAND`, `GLFW_PLATFORM_X11` and `GLFW_PLATFORM_NULL` symbols to
+   specify the desired platform (#1958)
+ - Added `glfwGetPlatform` function to query what platform was selected (#1655,#1958)
+ - Added `glfwPlatformSupported` function to query if a platform is supported
+   (#1655,#1958)
+ - Added `glfwInitAllocator` for setting a custom memory allocator (#544,#1628,#1947)
+ - Added `GLFWallocator` struct and `GLFWallocatefun`, `GLFWreallocatefun` and
+   `GLFWdeallocatefun` types (#544,#1628,#1947)
+ - Added `glfwGetWindowTitle` function for querying window title (#1448,#1909,#2482)
+ - Added `glfwInitVulkanLoader` for using a non-default Vulkan loader (#1374,#1890)
+ - Added `GLFW_RESIZE_NWSE_CURSOR`, `GLFW_RESIZE_NESW_CURSOR`,
+   `GLFW_RESIZE_ALL_CURSOR` and `GLFW_NOT_ALLOWED_CURSOR` cursor shapes (#427)
+ - Added `GLFW_RESIZE_EW_CURSOR` alias for `GLFW_HRESIZE_CURSOR` (#427)
+ - Added `GLFW_RESIZE_NS_CURSOR` alias for `GLFW_VRESIZE_CURSOR` (#427)
+ - Added `GLFW_POINTING_HAND_CURSOR` alias for `GLFW_HAND_CURSOR` (#427)
+ - Added `GLFW_MOUSE_PASSTHROUGH` window hint for letting mouse input pass
+   through the window (#1236,#1568)
+ - Added `GLFW_CURSOR_CAPTURED` cursor mode to confine the cursor to the window
+   content area (#58)
+ - Added `GLFW_POSITION_X` and `GLFW_POSITION_Y` window hints for initial position
+   (#1603,#1747)
+ - Added `GLFW_SCALE_FRAMEBUFFER` window hint for Wayland and macOS scaling (#2457)
+ - Added `GLFW_ANY_POSITION` hint value for letting the window manager choose (#1603,#1747)
+ - Added `GLFW_PLATFORM_UNAVAILABLE` error for platform detection failures (#1958)
+ - Added `GLFW_FEATURE_UNAVAILABLE` error for platform limitations (#1692)
+ - Added `GLFW_FEATURE_UNIMPLEMENTED` error for incomplete backends (#1692)
+ - Added `GLFW_WAYLAND_APP_ID` window hint string for Wayland app\_id selection
+   (#2121,#2122)
+ - Added `GLFW_ANGLE_PLATFORM_TYPE` init hint and `GLFW_ANGLE_PLATFORM_TYPE_*`
+   values to select ANGLE backend (#1380)
+ - Added `GLFW_X11_XCB_VULKAN_SURFACE` init hint for selecting X11 Vulkan
+   surface extension (#1793)
+ - Added `GLFW_WIN32_KEYBOARD_MENU` window hint for enabling access to the window menu
+ - Added `GLFW_WIN32_SHOWDEFAULT` window hint for applying the parent process
+   show command (#2359)
+ - Added `GLFW_NATIVE_INCLUDE_NONE` for disabling inclusion of native headers (#1348)
+ - Added `GLFW_BUILD_WIN32` CMake option for enabling Win32 support (#1958)
+ - Added `GLFW_BUILD_COCOA` CMake option for enabling Cocoa support (#1958)
+ - Added `GLFW_BUILD_X11` CMake option for enabling X11 support (#1958)
+ - Added `GLFW_LIBRARY_TYPE` CMake variable for overriding the library type
+   (#279,#1307,#1497,#1574,#1928)
+ - Added support for `XDG_SESSION_TYPE` environment variable
+ - Added `GLFW_PKG_CONFIG_REQUIRES_PRIVATE` and `GLFW_PKG_CONFIG_LIBS_PRIVATE` CMake
+   variables exposing pkg-config dependencies (#1307)
+ - Made joystick subsystem initialize at first use (#1284,#1646)
+ - Made `GLFW_DOUBLEBUFFER` a read-only window attribute
+ - Made Wayland the preferred platform over X11 if both are available (#2035)
+ - Updated the minimum required CMake version to 3.4
+ - Updated gamepad mappings from upstream
+ - Renamed `GLFW_USE_WAYLAND` CMake option to `GLFW_BUILD_WAYLAND` (#1958)
+ - Disabled tests and examples by default when built as a CMake subdirectory
+ - Removed `GLFW_USE_OSMESA` CMake option enabling the Null platform (#1958)
+ - Removed CMake generated configuration header
+ - Bugfix: `glfwGetVideoMode` returned an invalid mode on error (#1292)
+ - [Win32] Added a version info resource to the GLFW DLL
+ - [Win32] Made hidden helper window use its own window class
+ - [Win32] Bugfix: The foreground lock timeout was overridden, ignoring the user
+ - [Cocoa] Added `glfwGetCocoaView` native access function (#2235)
+ - [Cocoa] Moved main menu creation to GLFW initialization time (#1649)
+ - [Cocoa] Bugfix: Touching event queue from secondary thread before main thread
+   would abort (#1649)
+ - [Wayland] Added support for `glfwRequestWindowAttention` (#2287)
+ - [Wayland] Added support for `glfwFocusWindow`
+ - [Wayland] Added support for `GLFW_RESIZABLE` (#2203)
+ - [Wayland] Added support for fractional scaling of window contents
+ - [Wayland] Added dynamic loading of all Wayland libraries
+ - [Wayland] Bugfix: `CLOCK_MONOTONIC` was not correctly enabled
+ - [Wayland] Bugfix: `GLFW_HOVERED` was true when the cursor was over any
+   fallback window decoration
+ - [Wayland] Bugfix: Fallback decorations allowed resizing to invalid size
+   (#2204)
+ - [X11] Bugfix: Termination would segfault if the IM had been destroyed
+ - [X11] Bugfix: Any IM started after initialization would not be detected
+ - [Linux] Bugfix: Joystick evdev fds remained open in forks (#2446)
+ - [POSIX] Removed use of deprecated function `gettimeofday`
+ - [POSIX] Bugfix: `CLOCK_MONOTONIC` was not correctly tested for or enabled
+ - [WGL] Disabled the DWM swap interval hack for Windows 8 and later (#1072)
+ - [NSGL] Removed enforcement of forward-compatible flag for core contexts
+ - [NSGL] Bugfix: A core profile OpenGL context was returned if 3.2+
+   compatibility profile was requested
+ - [EGL] Added platform selection via the `EGL_EXT_platform_base` extension
+   (#442)
+ - [EGL] Added ANGLE backend selection via `EGL_ANGLE_platform_angle` extension
+   (#1380)
+
+
+## Changelog since 3.3
+
+ - Added `GLFW_WAYLAND_LIBDECOR` init hint for disabling libdecor support (#1639,#1693)
+ - Bugfix: The CMake config-file package used an absolute path and was not
+   relocatable (#1470)
+ - Bugfix: Video modes with a duplicate screen area were discarded (#1555,#1556)
+ - Bugfix: Compiling with -Wextra-semi caused warnings (#1440)
+ - Bugfix: Built-in mappings failed because some OEMs re-used VID/PID (#1583)
+ - Bugfix: Some extension loader headers did not prevent default OpenGL header
+   inclusion (#1695)
+ - Bugfix: Buffers were swapped at creation on single-buffered windows (#1873)
+ - Bugfix: Gamepad mapping updates could spam `GLFW_INVALID_VALUE` due to
+   incompatible controllers sharing hardware ID (#1763)
+ - Bugfix: Native access functions for context handles did not check that the API matched
+ - Bugfix: `glfwMakeContextCurrent` would access TLS slot before initialization
+ - Bugfix: `glfwSetGammaRamp` could emit `GLFW_INVALID_VALUE` before initialization
+ - Bugfix: `glfwGetJoystickUserPointer` returned `NULL` during disconnection (#2092)
+ - Bugfix: `glfwGetKeyScancode` returned `0` on error when initialized instead of `-1`
+ - Bugfix: Failure to make a newly created context current could cause segfault (#2327)
+ - [Win32] Disabled framebuffer transparency on Windows 7 when DWM windows are
+   opaque (#1512)
+ - [Win32] Bugfix: `GLFW_INCLUDE_VULKAN` plus `VK_USE_PLATFORM_WIN32_KHR` caused
+   symbol redefinition (#1524)
+ - [Win32] Bugfix: The cursor position event was emitted before its cursor enter
+   event (#1490)
+ - [Win32] Bugfix: The window hint `GLFW_MAXIMIZED` did not move or resize the
+   window (#1499)
+ - [Win32] Bugfix: Disabled cursor mode interfered with some non-client actions
+ - [Win32] Bugfix: Super key was not released after Win+V hotkey (#1622)
+ - [Win32] Bugfix: `glfwGetKeyName` could access out of bounds and return an
+   invalid pointer
+ - [Win32] Bugfix: Some synthetic key events were reported as `GLFW_KEY_UNKNOWN`
+   (#1623)
+ - [Win32] Bugfix: Non-BMP Unicode codepoint input was reported as UTF-16
+ - [Win32] Bugfix: Monitor functions could return invalid values after
+   configuration change (#1761)
+ - [Win32] Bugfix: Initialization would segfault on Windows 8 (not 8.1) (#1775)
+ - [Win32] Bugfix: Duplicate size events were not filtered (#1610)
+ - [Win32] Bugfix: Full screen windows were incorrectly resized by DPI changes
+   (#1582)
+ - [Win32] Bugfix: `GLFW_SCALE_TO_MONITOR` had no effect on systems older than
+   Windows 10 version 1703 (#1511)
+ - [Win32] Bugfix: `USE_MSVC_RUNTIME_LIBRARY_DLL` had no effect on CMake 3.15 or
+   later (#1783,#1796)
+ - [Win32] Bugfix: Compilation with LLVM for Windows failed (#1807,#1824,#1874)
+ - [Win32] Bugfix: Content scale queries could fail silently (#1615)
+ - [Win32] Bugfix: Content scales could have garbage values if monitor was recently
+   disconnected (#1615)
+ - [Win32] Bugfix: A window created maximized and undecorated would cover the whole
+   monitor (#1806)
+ - [Win32] Bugfix: The default restored window position was lost when creating a maximized
+   window
+ - [Win32] Bugfix: `glfwMaximizeWindow` would make a hidden window visible
+ - [Win32] Bugfix: `Alt+PrtSc` would emit `GLFW_KEY_UNKNOWN` and a different
+   scancode than `PrtSc` (#1993)
+ - [Win32] Bugfix: `GLFW_KEY_PAUSE` scancode from `glfwGetKeyScancode` did not
+   match event scancode (#1993)
+ - [Win32] Bugfix: Instance-local operations used executable instance (#469,#1296,#1395)
+ - [Win32] Bugfix: The OSMesa library was not unloaded on termination
+ - [Win32] Bugfix: Right shift emitted `GLFW_KEY_UNKNOWN` when using a CJK IME (#2050)
+ - [Win32] Bugfix: `glfwWaitEventsTimeout` did not return for some sent messages (#2408)
+ - [Win32] Bugfix: Fix pkg-config for dynamic library on Windows (#2386, #2420)
+ - [Win32] Bugfix: XInput could reportedly provide invalid DPad bit masks (#2291)
+ - [Win32] Bugfix: Rapid clipboard calls could fail due to Clipboard History
+ - [Win32] Bugfix: Disabled cursor mode doesn't work right when connected over RDP (#1276,#1279,#2431)
+ - [Cocoa] Added support for `VK_EXT_metal_surface` (#1619)
+ - [Cocoa] Added locating the Vulkan loader at runtime in an application bundle
+ - [Cocoa] Changed `EGLNativeWindowType` from `NSView` to `CALayer` (#1169)
+ - [Cocoa] Changed F13 key to report Print Screen for cross-platform consistency
+   (#1786)
+ - [Cocoa] Disabled macOS fullscreen when `GLFW_RESIZABLE` is false
+ - [Cocoa] Removed dependency on the CoreVideo framework
+ - [Cocoa] Bugfix: `glfwSetWindowSize` used a bottom-left anchor point (#1553)
+ - [Cocoa] Bugfix: Window remained on screen after destruction until event poll
+   (#1412)
+ - [Cocoa] Bugfix: Event processing before window creation would assert (#1543)
+ - [Cocoa] Bugfix: Undecorated windows could not be iconified on recent macOS
+ - [Cocoa] Bugfix: Non-BMP Unicode codepoint input was reported as UTF-16
+   (#1635)
+ - [Cocoa] Bugfix: Failing to retrieve the refresh rate of built-in displays
+   could leak memory
+ - [Cocoa] Bugfix: Objective-C files were compiled as C with CMake 3.19 (#1787)
+ - [Cocoa] Bugfix: Duplicate video modes were not filtered out (#1830)
+ - [Cocoa] Bugfix: Menu bar was not clickable on macOS 10.15+ until it lost and
+   regained focus (#1648,#1802)
+ - [Cocoa] Bugfix: Monitor name query could segfault on macOS 11 (#1809,#1833)
+ - [Cocoa] Bugfix: The install name of the installed dylib was relative (#1504)
+ - [Cocoa] Bugfix: The MoltenVK layer contents scale was updated only after
+   related events were emitted
+ - [Cocoa] Bugfix: Moving the cursor programmatically would freeze it for
+   a fraction of a second (#1962)
+ - [Cocoa] Bugfix: `kIOMasterPortDefault` was deprecated in macOS 12.0 (#1980)
+ - [Cocoa] Bugfix: `kUTTypeURL` was deprecated in macOS 12.0 (#2003)
+ - [Cocoa] Bugfix: A connected Apple AirPlay would emit a useless error (#1791)
+ - [Cocoa] Bugfix: The EGL and OSMesa libraries were not unloaded on termination
+ - [Cocoa] Bugfix: `GLFW_MAXIMIZED` was always true when `GLFW_RESIZABLE` was false
+ - [Cocoa] Bugfix: Changing `GLFW_DECORATED` in macOS fullscreen would abort
+   application (#1886)
+ - [Cocoa] Bugfix: Setting a monitor from macOS fullscreen would abort
+   application (#2110)
+ - [Cocoa] Bugfix: The Vulkan loader was not loaded from the `Frameworks` bundle
+   subdirectory (#2113,#2120)
+ - [Cocoa] Bugfix: Compilation failed on OS X 10.8 due to unconditional use of 10.9+
+   symbols (#2161)
+ - [Cocoa] Bugfix: Querying joystick elements could reportedly segfault on macOS
+   13 Ventura (#2320)
+ - [X11] Bugfix: The CMake files did not check for the XInput headers (#1480)
+ - [X11] Bugfix: Key names were not updated when the keyboard layout changed
+   (#1462,#1528)
+ - [X11] Bugfix: Decorations could not be enabled after window creation (#1566)
+ - [X11] Bugfix: Content scale fallback value could be inconsistent (#1578)
+ - [X11] Bugfix: `glfwMaximizeWindow` had no effect on hidden windows
+ - [X11] Bugfix: Clearing `GLFW_FLOATING` on a hidden window caused invalid read
+ - [X11] Bugfix: Changing `GLFW_FLOATING` on a hidden window could silently fail
+ - [X11] Bugfix: Disabled cursor mode was interrupted by indicator windows
+ - [X11] Bugfix: Monitor physical dimensions could be reported as zero mm
+ - [X11] Bugfix: Window position events were not emitted during resizing (#1613)
+ - [X11] Bugfix: `glfwFocusWindow` could terminate on older WMs or without a WM
+ - [X11] Bugfix: Querying a disconnected monitor could segfault (#1602)
+ - [X11] Bugfix: IME input of CJK was broken for "C" locale (#1587,#1636)
+ - [X11] Bugfix: Xlib errors caused by other parts of the application could be
+   reported as GLFW errors
+ - [X11] Bugfix: A handle race condition could cause a `BadWindow` error (#1633)
+ - [X11] Bugfix: XKB path used keysyms instead of physical locations for
+   non-printable keys (#1598)
+ - [X11] Bugfix: Function keys were mapped to `GLFW_KEY_UNKNOWN` for some layout
+   combinations (#1598)
+ - [X11] Bugfix: Keys pressed simultaneously with others were not always
+   reported (#1112,#1415,#1472,#1616)
+ - [X11] Bugfix: Some window attributes were not applied on leaving fullscreen
+   (#1863)
+ - [X11] Bugfix: Changing `GLFW_FLOATING` could leak memory
+ - [X11] Bugfix: Icon pixel format conversion worked only by accident, relying on
+   undefined behavior (#1986)
+ - [X11] Bugfix: Dynamic loading on OpenBSD failed due to soname differences
+ - [X11] Bugfix: Waiting for events would fail if file descriptor was too large
+   (#2024)
+ - [X11] Bugfix: Joystick events could lead to busy-waiting (#1872)
+ - [X11] Bugfix: `glfwWaitEvents*` did not continue for joystick events
+ - [X11] Bugfix: `glfwPostEmptyEvent` could be ignored due to race condition
+   (#379,#1281,#1285,#2033)
+ - [X11] Bugfix: Dynamic loading on NetBSD failed due to soname differences
+ - [X11] Bugfix: Left shift of int constant relied on undefined behavior (#1951)
+ - [X11] Bugfix: The OSMesa libray was not unloaded on termination
+ - [X11] Bugfix: A malformed response during selection transfer could cause a segfault
+ - [X11] Bugfix: Some calls would reset Xlib to the default error handler (#2108)
+ - [Wayland] Added improved fallback window decorations via libdecor (#1639,#1693)
+ - [Wayland] Added support for key names via xkbcommon
+ - [Wayland] Added support for file path drop events (#2040)
+ - [Wayland] Added support for more human-readable monitor names where available
+ - [Wayland] Disabled alpha channel for opaque windows on systems lacking
+   `EGL_EXT_present_opaque` (#1895)
+ - [Wayland] Removed support for `wl_shell` (#1443)
+ - [Wayland] Bugfix: The `GLFW_HAND_CURSOR` shape used the wrong image (#1432)
+ - [Wayland] Bugfix: Repeated keys could be reported with `NULL` window (#1704)
+ - [Wayland] Bugfix: Retrieving partial framebuffer size would segfault
+ - [Wayland] Bugfix: Scrolling offsets were inverted compared to other platforms
+   (#1463)
+ - [Wayland] Bugfix: Client-Side Decorations were destroyed in the wrong order
+   (#1798)
+ - [Wayland] Bugfix: Monitors physical size could report zero (#1784,#1792)
+ - [Wayland] Bugfix: Some keys were not repeating in Wayland (#1908)
+ - [Wayland] Bugfix: Non-arrow cursors are offset from the hotspot (#1706,#1899)
+ - [Wayland] Bugfix: The `O_CLOEXEC` flag was not defined on FreeBSD
+ - [Wayland] Bugfix: Key repeat could lead to a race condition (#1710)
+ - [Wayland] Bugfix: Activating a window would emit two input focus events
+ - [Wayland] Bugfix: Disable key repeat mechanism when window loses input focus
+ - [Wayland] Bugfix: Window hiding and showing did not work (#1492,#1731)
+ - [Wayland] Bugfix: A key being repeated was not released when window lost focus
+ - [Wayland] Bugfix: Showing a hidden window did not emit a window refresh event
+ - [Wayland] Bugfix: Full screen window creation did not ignore `GLFW_VISIBLE`
+ - [Wayland] Bugfix: Some keys were reported as wrong key or `GLFW_KEY_UNKNOWN`
+ - [Wayland] Bugfix: Text input did not repeat along with key repeat
+ - [Wayland] Bugfix: `glfwPostEmptyEvent` sometimes had no effect (#1520,#1521)
+ - [Wayland] Bugfix: `glfwSetClipboardString` would fail if set to result of
+   `glfwGetClipboardString`
+ - [Wayland] Bugfix: Data source creation error would cause double free at termination
+ - [Wayland] Bugfix: Partial writes of clipboard string would cause beginning to repeat
+ - [Wayland] Bugfix: Some errors would cause clipboard string transfer to hang
+ - [Wayland] Bugfix: Drag and drop data was misinterpreted as clipboard string
+ - [Wayland] Bugfix: MIME type matching was not performed for clipboard string
+ - [Wayland] Bugfix: The OSMesa library was not unloaded on termination
+ - [Wayland] Bugfix: `glfwCreateWindow` could emit `GLFW_FEATURE_UNAVAILABLE`
+ - [Wayland] Bugfix: Lock key modifier bits were only set when lock keys were pressed
+ - [Wayland] Bugfix: A window leaving full screen mode would be iconified (#1995)
+ - [Wayland] Bugfix: A window leaving full screen mode ignored its desired size
+ - [Wayland] Bugfix: `glfwSetWindowMonitor` did not update windowed mode size
+ - [Wayland] Bugfix: `glfwRestoreWindow` would make a full screen window windowed
+ - [Wayland] Bugfix: A window maximized or restored by the user would enter an
+   inconsistent state
+ - [Wayland] Bugfix: Window maximization events were not emitted
+ - [Wayland] Bugfix: `glfwRestoreWindow` assumed it was always in windowed mode
+ - [Wayland] Bugfix: `glfwSetWindowSize` would resize a full screen window
+ - [Wayland] Bugfix: A window content scale event would be emitted every time
+   the window resized
+ - [Wayland] Bugfix: If `glfwInit` failed it would close stdin
+ - [Wayland] Bugfix: Manual resizing with fallback decorations behaved erratically
+   (#1991,#2115,#2127)
+ - [Wayland] Bugfix: Size limits included frame size for fallback decorations
+ - [Wayland] Bugfix: Updating `GLFW_DECORATED` had no effect on server-side
+   decorations
+ - [Wayland] Bugfix: A monitor would be reported as connected again if its scale
+   changed
+ - [Wayland] Bugfix: `glfwTerminate` would segfault if any monitor had changed
+   scale
+ - [Wayland] Bugfix: Window content scale events were not emitted when monitor
+   scale changed
+ - [Wayland] Bugfix: `glfwSetWindowAspectRatio` reported an error instead of
+   applying the specified ratio
+ - [Wayland] Bugfix: `GLFW_MAXIMIZED` window hint had no effect
+ - [Wayland] Bugfix: `glfwRestoreWindow` had no effect before first show
+ - [Wayland] Bugfix: Hiding and then showing a window caused program abort on
+   wlroots compositors (#1268)
+ - [Wayland] Bugfix: `GLFW_DECORATED` was ignored when showing a window with XDG
+   decorations
+ - [Wayland] Bugfix: Connecting a mouse after `glfwInit` would segfault (#1450)
+ - [Wayland] Bugfix: Joysticks connected after `glfwInit` were not detected (#2198)
+ - [Wayland] Bugfix: Fallback decorations emitted `GLFW_CURSOR_UNAVAILABLE` errors
+ - [Linux] Bugfix: Joysticks without buttons were ignored (#2042,#2043)
+ - [Linux] Bugfix: A small amount of memory could leak if initialization failed (#2229)
+ - [NSGL] Bugfix: `GLFW_COCOA_RETINA_FRAMEBUFFER` had no effect on newer
+   macOS versions (#1442)
+ - [NSGL] Bugfix: Workaround for swap interval on 10.14 broke on 10.12 (#1483)
+ - [NSGL] Bugfix: Defining `GL_SILENCE_DEPRECATION` externally caused
+   a duplicate definition warning (#1840)
+ - [EGL] Added loading of glvnd `libOpenGL.so.0` where available for OpenGL
+ - [EGL] Bugfix: The `GLFW_DOUBLEBUFFER` context attribute was ignored (#1843)
+ - [EGL] Bugfix: Setting `GLFW_CONTEXT_DEBUG` caused creation to fail (#2348)
+ - [GLX] Added loading of glvnd `libGLX.so.0` where available
+ - [GLX] Bugfix: Context creation failed if GLX 1.4 was not exported by GLX library
 
 
 ## Contact
diff --git a/deps/glad/gl.h b/deps/glad/gl.h
index 5c7879f..b421fe0 100644
--- a/deps/glad/gl.h
+++ b/deps/glad/gl.h
@@ -1,5 +1,5 @@
 /**
- * Loader generated by glad 2.0.0-beta on Sun Apr 14 17:03:32 2019
+ * Loader generated by glad 2.0.0-beta on Tue Aug 24 22:51:07 2021
  *
  * Generator: C/C++
  * Specification: gl
@@ -9,31 +9,51 @@
  *  - gl:compatibility=3.3
  *
  * Options:
- *  - MX_GLOBAL = False
- *  - LOADER = False
  *  - ALIAS = False
- *  - HEADER_ONLY = False
  *  - DEBUG = False
+ *  - HEADER_ONLY = True
+ *  - LOADER = False
  *  - MX = False
+ *  - MX_GLOBAL = False
+ *  - ON_DEMAND = False
  *
  * Commandline:
- *    --api='gl:compatibility=3.3' --extensions='GL_ARB_multisample,GL_ARB_robustness,GL_KHR_debug' c
+ *    --api='gl:compatibility=3.3' --extensions='GL_ARB_multisample,GL_ARB_robustness,GL_KHR_debug' c --header-only
  *
  * Online:
- *    http://glad.sh/#api=gl%3Acompatibility%3D3.3&extensions=GL_ARB_multisample%2CGL_ARB_robustness%2CGL_KHR_debug&generator=c&options=
+ *    http://glad.sh/#api=gl%3Acompatibility%3D3.3&extensions=GL_ARB_multisample%2CGL_ARB_robustness%2CGL_KHR_debug&generator=c&options=HEADER_ONLY
  *
  */
 
 #ifndef GLAD_GL_H_
 #define GLAD_GL_H_
 
+#ifdef __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wreserved-id-macro"
+#endif
 #ifdef __gl_h_
-    #error OpenGL header already included (API: gl), remove previous include!
+  #error OpenGL (gl.h) header already included (API: gl), remove previous include!
 #endif
 #define __gl_h_ 1
-
+#ifdef __gl3_h_
+  #error OpenGL (gl3.h) header already included (API: gl), remove previous include!
+#endif
+#define __gl3_h_ 1
+#ifdef __glext_h_
+  #error OpenGL (glext.h) header already included (API: gl), remove previous include!
+#endif
+#define __glext_h_ 1
+#ifdef __gl3ext_h_
+  #error OpenGL (gl3ext.h) header already included (API: gl), remove previous include!
+#endif
+#define __gl3ext_h_ 1
+#ifdef __clang__
+#pragma clang diagnostic pop
+#endif
 
 #define GLAD_GL
+#define GLAD_OPTION_GL_HEADER_ONLY
 
 #ifdef __cplusplus
 extern "C" {
@@ -137,15 +157,16 @@
 #define GLAPIENTRY GLAD_API_PTR
 #endif
 
-
 #define GLAD_MAKE_VERSION(major, minor) (major * 10000 + minor)
 #define GLAD_VERSION_MAJOR(version) (version / 10000)
 #define GLAD_VERSION_MINOR(version) (version % 10000)
 
+#define GLAD_GENERATOR_VERSION "2.0.0-beta"
+
 typedef void (*GLADapiproc)(void);
 
 typedef GLADapiproc (*GLADloadfunc)(const char *name);
-typedef GLADapiproc (*GLADuserptrloadfunc)(const char *name, void *userptr);
+typedef GLADapiproc (*GLADuserptrloadfunc)(void *userptr, const char *name);
 
 typedef void (*GLADprecallback)(const char *name, GLADapiproc apiproc, int len_args, ...);
 typedef void (*GLADpostcallback)(void *ret, const char *name, GLADapiproc apiproc, int len_args, ...);
@@ -1458,69 +1479,401 @@
 #define GL_ZOOM_Y 0x0D17
 
 
-#include <glad/khrplatform.h>
+#ifndef __khrplatform_h_
+#define __khrplatform_h_
+
+/*
+** Copyright (c) 2008-2018 The Khronos Group Inc.
+**
+** Permission is hereby granted, free of charge, to any person obtaining a
+** copy of this software and/or associated documentation files (the
+** "Materials"), to deal in the Materials without restriction, including
+** without limitation the rights to use, copy, modify, merge, publish,
+** distribute, sublicense, and/or sell copies of the Materials, and to
+** permit persons to whom the Materials are furnished to do so, subject to
+** the following conditions:
+**
+** The above copyright notice and this permission notice shall be included
+** in all copies or substantial portions of the Materials.
+**
+** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
+*/
+
+/* Khronos platform-specific types and definitions.
+ *
+ * The master copy of khrplatform.h is maintained in the Khronos EGL
+ * Registry repository at https://github.com/KhronosGroup/EGL-Registry
+ * The last semantic modification to khrplatform.h was at commit ID:
+ *      67a3e0864c2d75ea5287b9f3d2eb74a745936692
+ *
+ * Adopters may modify this file to suit their platform. Adopters are
+ * encouraged to submit platform specific modifications to the Khronos
+ * group so that they can be included in future versions of this file.
+ * Please submit changes by filing pull requests or issues on
+ * the EGL Registry repository linked above.
+ *
+ *
+ * See the Implementer's Guidelines for information about where this file
+ * should be located on your system and for more details of its use:
+ *    http://www.khronos.org/registry/implementers_guide.pdf
+ *
+ * This file should be included as
+ *        #include <KHR/khrplatform.h>
+ * by Khronos client API header files that use its types and defines.
+ *
+ * The types in khrplatform.h should only be used to define API-specific types.
+ *
+ * Types defined in khrplatform.h:
+ *    khronos_int8_t              signed   8  bit
+ *    khronos_uint8_t             unsigned 8  bit
+ *    khronos_int16_t             signed   16 bit
+ *    khronos_uint16_t            unsigned 16 bit
+ *    khronos_int32_t             signed   32 bit
+ *    khronos_uint32_t            unsigned 32 bit
+ *    khronos_int64_t             signed   64 bit
+ *    khronos_uint64_t            unsigned 64 bit
+ *    khronos_intptr_t            signed   same number of bits as a pointer
+ *    khronos_uintptr_t           unsigned same number of bits as a pointer
+ *    khronos_ssize_t             signed   size
+ *    khronos_usize_t             unsigned size
+ *    khronos_float_t             signed   32 bit floating point
+ *    khronos_time_ns_t           unsigned 64 bit time in nanoseconds
+ *    khronos_utime_nanoseconds_t unsigned time interval or absolute time in
+ *                                         nanoseconds
+ *    khronos_stime_nanoseconds_t signed time interval in nanoseconds
+ *    khronos_boolean_enum_t      enumerated boolean type. This should
+ *      only be used as a base type when a client API's boolean type is
+ *      an enum. Client APIs which use an integer or other type for
+ *      booleans cannot use this as the base type for their boolean.
+ *
+ * Tokens defined in khrplatform.h:
+ *
+ *    KHRONOS_FALSE, KHRONOS_TRUE Enumerated boolean false/true values.
+ *
+ *    KHRONOS_SUPPORT_INT64 is 1 if 64 bit integers are supported; otherwise 0.
+ *    KHRONOS_SUPPORT_FLOAT is 1 if floats are supported; otherwise 0.
+ *
+ * Calling convention macros defined in this file:
+ *    KHRONOS_APICALL
+ *    KHRONOS_GLAD_API_PTR
+ *    KHRONOS_APIATTRIBUTES
+ *
+ * These may be used in function prototypes as:
+ *
+ *      KHRONOS_APICALL void KHRONOS_GLAD_API_PTR funcname(
+ *                                  int arg1,
+ *                                  int arg2) KHRONOS_APIATTRIBUTES;
+ */
+
+#if defined(__SCITECH_SNAP__) && !defined(KHRONOS_STATIC)
+#   define KHRONOS_STATIC 1
+#endif
+
+/*-------------------------------------------------------------------------
+ * Definition of KHRONOS_APICALL
+ *-------------------------------------------------------------------------
+ * This precedes the return type of the function in the function prototype.
+ */
+#if defined(KHRONOS_STATIC)
+    /* If the preprocessor constant KHRONOS_STATIC is defined, make the
+     * header compatible with static linking. */
+#   define KHRONOS_APICALL
+#elif defined(_WIN32)
+#   define KHRONOS_APICALL __declspec(dllimport)
+#elif defined (__SYMBIAN32__)
+#   define KHRONOS_APICALL IMPORT_C
+#elif defined(__ANDROID__)
+#   define KHRONOS_APICALL __attribute__((visibility("default")))
+#else
+#   define KHRONOS_APICALL
+#endif
+
+/*-------------------------------------------------------------------------
+ * Definition of KHRONOS_GLAD_API_PTR
+ *-------------------------------------------------------------------------
+ * This follows the return type of the function  and precedes the function
+ * name in the function prototype.
+ */
+#if defined(_WIN32) && !defined(_WIN32_WCE) && !defined(__SCITECH_SNAP__)
+    /* Win32 but not WinCE */
+#   define KHRONOS_GLAD_API_PTR __stdcall
+#else
+#   define KHRONOS_GLAD_API_PTR
+#endif
+
+/*-------------------------------------------------------------------------
+ * Definition of KHRONOS_APIATTRIBUTES
+ *-------------------------------------------------------------------------
+ * This follows the closing parenthesis of the function prototype arguments.
+ */
+#if defined (__ARMCC_2__)
+#define KHRONOS_APIATTRIBUTES __softfp
+#else
+#define KHRONOS_APIATTRIBUTES
+#endif
+
+/*-------------------------------------------------------------------------
+ * basic type definitions
+ *-----------------------------------------------------------------------*/
+#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || defined(__GNUC__) || defined(__SCO__) || defined(__USLC__)
+
+
+/*
+ * Using <stdint.h>
+ */
+#include <stdint.h>
+typedef int32_t                 khronos_int32_t;
+typedef uint32_t                khronos_uint32_t;
+typedef int64_t                 khronos_int64_t;
+typedef uint64_t                khronos_uint64_t;
+#define KHRONOS_SUPPORT_INT64   1
+#define KHRONOS_SUPPORT_FLOAT   1
+
+#elif defined(__VMS ) || defined(__sgi)
+
+/*
+ * Using <inttypes.h>
+ */
+#include <inttypes.h>
+typedef int32_t                 khronos_int32_t;
+typedef uint32_t                khronos_uint32_t;
+typedef int64_t                 khronos_int64_t;
+typedef uint64_t                khronos_uint64_t;
+#define KHRONOS_SUPPORT_INT64   1
+#define KHRONOS_SUPPORT_FLOAT   1
+
+#elif defined(_WIN32) && !defined(__SCITECH_SNAP__)
+
+/*
+ * Win32
+ */
+typedef __int32                 khronos_int32_t;
+typedef unsigned __int32        khronos_uint32_t;
+typedef __int64                 khronos_int64_t;
+typedef unsigned __int64        khronos_uint64_t;
+#define KHRONOS_SUPPORT_INT64   1
+#define KHRONOS_SUPPORT_FLOAT   1
+
+#elif defined(__sun__) || defined(__digital__)
+
+/*
+ * Sun or Digital
+ */
+typedef int                     khronos_int32_t;
+typedef unsigned int            khronos_uint32_t;
+#if defined(__arch64__) || defined(_LP64)
+typedef long int                khronos_int64_t;
+typedef unsigned long int       khronos_uint64_t;
+#else
+typedef long long int           khronos_int64_t;
+typedef unsigned long long int  khronos_uint64_t;
+#endif /* __arch64__ */
+#define KHRONOS_SUPPORT_INT64   1
+#define KHRONOS_SUPPORT_FLOAT   1
+
+#elif 0
+
+/*
+ * Hypothetical platform with no float or int64 support
+ */
+typedef int                     khronos_int32_t;
+typedef unsigned int            khronos_uint32_t;
+#define KHRONOS_SUPPORT_INT64   0
+#define KHRONOS_SUPPORT_FLOAT   0
+
+#else
+
+/*
+ * Generic fallback
+ */
+#include <stdint.h>
+typedef int32_t                 khronos_int32_t;
+typedef uint32_t                khronos_uint32_t;
+typedef int64_t                 khronos_int64_t;
+typedef uint64_t                khronos_uint64_t;
+#define KHRONOS_SUPPORT_INT64   1
+#define KHRONOS_SUPPORT_FLOAT   1
+
+#endif
+
+
+/*
+ * Types that are (so far) the same on all platforms
+ */
+typedef signed   char          khronos_int8_t;
+typedef unsigned char          khronos_uint8_t;
+typedef signed   short int     khronos_int16_t;
+typedef unsigned short int     khronos_uint16_t;
+
+/*
+ * Types that differ between LLP64 and LP64 architectures - in LLP64,
+ * pointers are 64 bits, but 'long' is still 32 bits. Win64 appears
+ * to be the only LLP64 architecture in current use.
+ */
+#ifdef _WIN64
+typedef signed   long long int khronos_intptr_t;
+typedef unsigned long long int khronos_uintptr_t;
+typedef signed   long long int khronos_ssize_t;
+typedef unsigned long long int khronos_usize_t;
+#else
+typedef signed   long  int     khronos_intptr_t;
+typedef unsigned long  int     khronos_uintptr_t;
+typedef signed   long  int     khronos_ssize_t;
+typedef unsigned long  int     khronos_usize_t;
+#endif
+
+#if KHRONOS_SUPPORT_FLOAT
+/*
+ * Float type
+ */
+typedef          float         khronos_float_t;
+#endif
+
+#if KHRONOS_SUPPORT_INT64
+/* Time types
+ *
+ * These types can be used to represent a time interval in nanoseconds or
+ * an absolute Unadjusted System Time.  Unadjusted System Time is the number
+ * of nanoseconds since some arbitrary system event (e.g. since the last
+ * time the system booted).  The Unadjusted System Time is an unsigned
+ * 64 bit value that wraps back to 0 every 584 years.  Time intervals
+ * may be either signed or unsigned.
+ */
+typedef khronos_uint64_t       khronos_utime_nanoseconds_t;
+typedef khronos_int64_t        khronos_stime_nanoseconds_t;
+#endif
+
+/*
+ * Dummy value used to pad enum types to 32 bits.
+ */
+#ifndef KHRONOS_MAX_ENUM
+#define KHRONOS_MAX_ENUM 0x7FFFFFFF
+#endif
+
+/*
+ * Enumerated boolean type
+ *
+ * Values other than zero should be considered to be true.  Therefore
+ * comparisons should not be made against KHRONOS_TRUE.
+ */
+typedef enum {
+    KHRONOS_FALSE = 0,
+    KHRONOS_TRUE  = 1,
+    KHRONOS_BOOLEAN_ENUM_FORCE_SIZE = KHRONOS_MAX_ENUM
+} khronos_boolean_enum_t;
+
+#endif /* __khrplatform_h_ */
+
 typedef unsigned int GLenum;
+
 typedef unsigned char GLboolean;
+
 typedef unsigned int GLbitfield;
+
 typedef void GLvoid;
+
 typedef khronos_int8_t GLbyte;
+
 typedef khronos_uint8_t GLubyte;
+
 typedef khronos_int16_t GLshort;
+
 typedef khronos_uint16_t GLushort;
+
 typedef int GLint;
+
 typedef unsigned int GLuint;
+
 typedef khronos_int32_t GLclampx;
+
 typedef int GLsizei;
+
 typedef khronos_float_t GLfloat;
+
 typedef khronos_float_t GLclampf;
+
 typedef double GLdouble;
+
 typedef double GLclampd;
+
 typedef void *GLeglClientBufferEXT;
+
 typedef void *GLeglImageOES;
+
 typedef char GLchar;
+
 typedef char GLcharARB;
+
 #ifdef __APPLE__
 typedef void *GLhandleARB;
 #else
 typedef unsigned int GLhandleARB;
 #endif
+
 typedef khronos_uint16_t GLhalf;
+
 typedef khronos_uint16_t GLhalfARB;
+
 typedef khronos_int32_t GLfixed;
+
 #if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && (__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ > 1060)
 typedef khronos_intptr_t GLintptr;
 #else
 typedef khronos_intptr_t GLintptr;
 #endif
+
 #if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && (__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ > 1060)
 typedef khronos_intptr_t GLintptrARB;
 #else
 typedef khronos_intptr_t GLintptrARB;
 #endif
+
 #if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && (__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ > 1060)
 typedef khronos_ssize_t GLsizeiptr;
 #else
 typedef khronos_ssize_t GLsizeiptr;
 #endif
+
 #if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && (__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ > 1060)
 typedef khronos_ssize_t GLsizeiptrARB;
 #else
 typedef khronos_ssize_t GLsizeiptrARB;
 #endif
+
 typedef khronos_int64_t GLint64;
+
 typedef khronos_int64_t GLint64EXT;
+
 typedef khronos_uint64_t GLuint64;
+
 typedef khronos_uint64_t GLuint64EXT;
+
 typedef struct __GLsync *GLsync;
+
 struct _cl_context;
+
 struct _cl_event;
-typedef void ( *GLDEBUGPROC)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const void *userParam);
-typedef void ( *GLDEBUGPROCARB)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const void *userParam);
-typedef void ( *GLDEBUGPROCKHR)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const void *userParam);
-typedef void ( *GLDEBUGPROCAMD)(GLuint id,GLenum category,GLenum severity,GLsizei length,const GLchar *message,void *userParam);
+
+typedef void (GLAD_API_PTR *GLDEBUGPROC)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const void *userParam);
+
+typedef void (GLAD_API_PTR *GLDEBUGPROCARB)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const void *userParam);
+
+typedef void (GLAD_API_PTR *GLDEBUGPROCKHR)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const void *userParam);
+
+typedef void (GLAD_API_PTR *GLDEBUGPROCAMD)(GLuint id,GLenum category,GLenum severity,GLsizei length,const GLchar *message,void *userParam);
+
 typedef unsigned short GLhalfNV;
+
 typedef GLintptr GLvdpauSurfaceNV;
-typedef void ( *GLVULKANPROCNV)(void);
+
+typedef void (GLAD_API_PTR *GLVULKANPROCNV)(void);
+
 
 
 #define GL_VERSION_1_0 1
@@ -1555,762 +1908,761 @@
 GLAD_API_CALL int GLAD_GL_KHR_debug;
 
 
-typedef void (GLAD_API_PTR *PFNGLACCUMPROC)(GLenum   op, GLfloat   value);
-typedef void (GLAD_API_PTR *PFNGLACTIVETEXTUREPROC)(GLenum   texture);
-typedef void (GLAD_API_PTR *PFNGLALPHAFUNCPROC)(GLenum   func, GLfloat   ref);
-typedef GLboolean (GLAD_API_PTR *PFNGLARETEXTURESRESIDENTPROC)(GLsizei   n, const  GLuint  * textures, GLboolean  * residences);
-typedef void (GLAD_API_PTR *PFNGLARRAYELEMENTPROC)(GLint   i);
-typedef void (GLAD_API_PTR *PFNGLATTACHSHADERPROC)(GLuint   program, GLuint   shader);
-typedef void (GLAD_API_PTR *PFNGLBEGINPROC)(GLenum   mode);
-typedef void (GLAD_API_PTR *PFNGLBEGINCONDITIONALRENDERPROC)(GLuint   id, GLenum   mode);
-typedef void (GLAD_API_PTR *PFNGLBEGINQUERYPROC)(GLenum   target, GLuint   id);
-typedef void (GLAD_API_PTR *PFNGLBEGINTRANSFORMFEEDBACKPROC)(GLenum   primitiveMode);
-typedef void (GLAD_API_PTR *PFNGLBINDATTRIBLOCATIONPROC)(GLuint   program, GLuint   index, const  GLchar  * name);
-typedef void (GLAD_API_PTR *PFNGLBINDBUFFERPROC)(GLenum   target, GLuint   buffer);
-typedef void (GLAD_API_PTR *PFNGLBINDBUFFERBASEPROC)(GLenum   target, GLuint   index, GLuint   buffer);
-typedef void (GLAD_API_PTR *PFNGLBINDBUFFERRANGEPROC)(GLenum   target, GLuint   index, GLuint   buffer, GLintptr   offset, GLsizeiptr   size);
-typedef void (GLAD_API_PTR *PFNGLBINDFRAGDATALOCATIONPROC)(GLuint   program, GLuint   color, const  GLchar  * name);
-typedef void (GLAD_API_PTR *PFNGLBINDFRAGDATALOCATIONINDEXEDPROC)(GLuint   program, GLuint   colorNumber, GLuint   index, const  GLchar  * name);
-typedef void (GLAD_API_PTR *PFNGLBINDFRAMEBUFFERPROC)(GLenum   target, GLuint   framebuffer);
-typedef void (GLAD_API_PTR *PFNGLBINDRENDERBUFFERPROC)(GLenum   target, GLuint   renderbuffer);
-typedef void (GLAD_API_PTR *PFNGLBINDSAMPLERPROC)(GLuint   unit, GLuint   sampler);
-typedef void (GLAD_API_PTR *PFNGLBINDTEXTUREPROC)(GLenum   target, GLuint   texture);
-typedef void (GLAD_API_PTR *PFNGLBINDVERTEXARRAYPROC)(GLuint   array);
-typedef void (GLAD_API_PTR *PFNGLBITMAPPROC)(GLsizei   width, GLsizei   height, GLfloat   xorig, GLfloat   yorig, GLfloat   xmove, GLfloat   ymove, const  GLubyte  * bitmap);
-typedef void (GLAD_API_PTR *PFNGLBLENDCOLORPROC)(GLfloat   red, GLfloat   green, GLfloat   blue, GLfloat   alpha);
-typedef void (GLAD_API_PTR *PFNGLBLENDEQUATIONPROC)(GLenum   mode);
-typedef void (GLAD_API_PTR *PFNGLBLENDEQUATIONSEPARATEPROC)(GLenum   modeRGB, GLenum   modeAlpha);
-typedef void (GLAD_API_PTR *PFNGLBLENDFUNCPROC)(GLenum   sfactor, GLenum   dfactor);
-typedef void (GLAD_API_PTR *PFNGLBLENDFUNCSEPARATEPROC)(GLenum   sfactorRGB, GLenum   dfactorRGB, GLenum   sfactorAlpha, GLenum   dfactorAlpha);
-typedef void (GLAD_API_PTR *PFNGLBLITFRAMEBUFFERPROC)(GLint   srcX0, GLint   srcY0, GLint   srcX1, GLint   srcY1, GLint   dstX0, GLint   dstY0, GLint   dstX1, GLint   dstY1, GLbitfield   mask, GLenum   filter);
-typedef void (GLAD_API_PTR *PFNGLBUFFERDATAPROC)(GLenum   target, GLsizeiptr   size, const void * data, GLenum   usage);
-typedef void (GLAD_API_PTR *PFNGLBUFFERSUBDATAPROC)(GLenum   target, GLintptr   offset, GLsizeiptr   size, const void * data);
-typedef void (GLAD_API_PTR *PFNGLCALLLISTPROC)(GLuint   list);
-typedef void (GLAD_API_PTR *PFNGLCALLLISTSPROC)(GLsizei   n, GLenum   type, const void * lists);
-typedef GLenum (GLAD_API_PTR *PFNGLCHECKFRAMEBUFFERSTATUSPROC)(GLenum   target);
-typedef void (GLAD_API_PTR *PFNGLCLAMPCOLORPROC)(GLenum   target, GLenum   clamp);
-typedef void (GLAD_API_PTR *PFNGLCLEARPROC)(GLbitfield   mask);
-typedef void (GLAD_API_PTR *PFNGLCLEARACCUMPROC)(GLfloat   red, GLfloat   green, GLfloat   blue, GLfloat   alpha);
-typedef void (GLAD_API_PTR *PFNGLCLEARBUFFERFIPROC)(GLenum   buffer, GLint   drawbuffer, GLfloat   depth, GLint   stencil);
-typedef void (GLAD_API_PTR *PFNGLCLEARBUFFERFVPROC)(GLenum   buffer, GLint   drawbuffer, const  GLfloat  * value);
-typedef void (GLAD_API_PTR *PFNGLCLEARBUFFERIVPROC)(GLenum   buffer, GLint   drawbuffer, const  GLint  * value);
-typedef void (GLAD_API_PTR *PFNGLCLEARBUFFERUIVPROC)(GLenum   buffer, GLint   drawbuffer, const  GLuint  * value);
-typedef void (GLAD_API_PTR *PFNGLCLEARCOLORPROC)(GLfloat   red, GLfloat   green, GLfloat   blue, GLfloat   alpha);
-typedef void (GLAD_API_PTR *PFNGLCLEARDEPTHPROC)(GLdouble   depth);
-typedef void (GLAD_API_PTR *PFNGLCLEARINDEXPROC)(GLfloat   c);
-typedef void (GLAD_API_PTR *PFNGLCLEARSTENCILPROC)(GLint   s);
-typedef void (GLAD_API_PTR *PFNGLCLIENTACTIVETEXTUREPROC)(GLenum   texture);
-typedef GLenum (GLAD_API_PTR *PFNGLCLIENTWAITSYNCPROC)(GLsync   sync, GLbitfield   flags, GLuint64   timeout);
-typedef void (GLAD_API_PTR *PFNGLCLIPPLANEPROC)(GLenum   plane, const  GLdouble  * equation);
-typedef void (GLAD_API_PTR *PFNGLCOLOR3BPROC)(GLbyte   red, GLbyte   green, GLbyte   blue);
-typedef void (GLAD_API_PTR *PFNGLCOLOR3BVPROC)(const  GLbyte  * v);
-typedef void (GLAD_API_PTR *PFNGLCOLOR3DPROC)(GLdouble   red, GLdouble   green, GLdouble   blue);
-typedef void (GLAD_API_PTR *PFNGLCOLOR3DVPROC)(const  GLdouble  * v);
-typedef void (GLAD_API_PTR *PFNGLCOLOR3FPROC)(GLfloat   red, GLfloat   green, GLfloat   blue);
-typedef void (GLAD_API_PTR *PFNGLCOLOR3FVPROC)(const  GLfloat  * v);
-typedef void (GLAD_API_PTR *PFNGLCOLOR3IPROC)(GLint   red, GLint   green, GLint   blue);
-typedef void (GLAD_API_PTR *PFNGLCOLOR3IVPROC)(const  GLint  * v);
-typedef void (GLAD_API_PTR *PFNGLCOLOR3SPROC)(GLshort   red, GLshort   green, GLshort   blue);
-typedef void (GLAD_API_PTR *PFNGLCOLOR3SVPROC)(const  GLshort  * v);
-typedef void (GLAD_API_PTR *PFNGLCOLOR3UBPROC)(GLubyte   red, GLubyte   green, GLubyte   blue);
-typedef void (GLAD_API_PTR *PFNGLCOLOR3UBVPROC)(const  GLubyte  * v);
-typedef void (GLAD_API_PTR *PFNGLCOLOR3UIPROC)(GLuint   red, GLuint   green, GLuint   blue);
-typedef void (GLAD_API_PTR *PFNGLCOLOR3UIVPROC)(const  GLuint  * v);
-typedef void (GLAD_API_PTR *PFNGLCOLOR3USPROC)(GLushort   red, GLushort   green, GLushort   blue);
-typedef void (GLAD_API_PTR *PFNGLCOLOR3USVPROC)(const  GLushort  * v);
-typedef void (GLAD_API_PTR *PFNGLCOLOR4BPROC)(GLbyte   red, GLbyte   green, GLbyte   blue, GLbyte   alpha);
-typedef void (GLAD_API_PTR *PFNGLCOLOR4BVPROC)(const  GLbyte  * v);
-typedef void (GLAD_API_PTR *PFNGLCOLOR4DPROC)(GLdouble   red, GLdouble   green, GLdouble   blue, GLdouble   alpha);
-typedef void (GLAD_API_PTR *PFNGLCOLOR4DVPROC)(const  GLdouble  * v);
-typedef void (GLAD_API_PTR *PFNGLCOLOR4FPROC)(GLfloat   red, GLfloat   green, GLfloat   blue, GLfloat   alpha);
-typedef void (GLAD_API_PTR *PFNGLCOLOR4FVPROC)(const  GLfloat  * v);
-typedef void (GLAD_API_PTR *PFNGLCOLOR4IPROC)(GLint   red, GLint   green, GLint   blue, GLint   alpha);
-typedef void (GLAD_API_PTR *PFNGLCOLOR4IVPROC)(const  GLint  * v);
-typedef void (GLAD_API_PTR *PFNGLCOLOR4SPROC)(GLshort   red, GLshort   green, GLshort   blue, GLshort   alpha);
-typedef void (GLAD_API_PTR *PFNGLCOLOR4SVPROC)(const  GLshort  * v);
-typedef void (GLAD_API_PTR *PFNGLCOLOR4UBPROC)(GLubyte   red, GLubyte   green, GLubyte   blue, GLubyte   alpha);
-typedef void (GLAD_API_PTR *PFNGLCOLOR4UBVPROC)(const  GLubyte  * v);
-typedef void (GLAD_API_PTR *PFNGLCOLOR4UIPROC)(GLuint   red, GLuint   green, GLuint   blue, GLuint   alpha);
-typedef void (GLAD_API_PTR *PFNGLCOLOR4UIVPROC)(const  GLuint  * v);
-typedef void (GLAD_API_PTR *PFNGLCOLOR4USPROC)(GLushort   red, GLushort   green, GLushort   blue, GLushort   alpha);
-typedef void (GLAD_API_PTR *PFNGLCOLOR4USVPROC)(const  GLushort  * v);
-typedef void (GLAD_API_PTR *PFNGLCOLORMASKPROC)(GLboolean   red, GLboolean   green, GLboolean   blue, GLboolean   alpha);
-typedef void (GLAD_API_PTR *PFNGLCOLORMASKIPROC)(GLuint   index, GLboolean   r, GLboolean   g, GLboolean   b, GLboolean   a);
-typedef void (GLAD_API_PTR *PFNGLCOLORMATERIALPROC)(GLenum   face, GLenum   mode);
-typedef void (GLAD_API_PTR *PFNGLCOLORP3UIPROC)(GLenum   type, GLuint   color);
-typedef void (GLAD_API_PTR *PFNGLCOLORP3UIVPROC)(GLenum   type, const  GLuint  * color);
-typedef void (GLAD_API_PTR *PFNGLCOLORP4UIPROC)(GLenum   type, GLuint   color);
-typedef void (GLAD_API_PTR *PFNGLCOLORP4UIVPROC)(GLenum   type, const  GLuint  * color);
-typedef void (GLAD_API_PTR *PFNGLCOLORPOINTERPROC)(GLint   size, GLenum   type, GLsizei   stride, const void * pointer);
-typedef void (GLAD_API_PTR *PFNGLCOMPILESHADERPROC)(GLuint   shader);
-typedef void (GLAD_API_PTR *PFNGLCOMPRESSEDTEXIMAGE1DPROC)(GLenum   target, GLint   level, GLenum   internalformat, GLsizei   width, GLint   border, GLsizei   imageSize, const void * data);
-typedef void (GLAD_API_PTR *PFNGLCOMPRESSEDTEXIMAGE2DPROC)(GLenum   target, GLint   level, GLenum   internalformat, GLsizei   width, GLsizei   height, GLint   border, GLsizei   imageSize, const void * data);
-typedef void (GLAD_API_PTR *PFNGLCOMPRESSEDTEXIMAGE3DPROC)(GLenum   target, GLint   level, GLenum   internalformat, GLsizei   width, GLsizei   height, GLsizei   depth, GLint   border, GLsizei   imageSize, const void * data);
-typedef void (GLAD_API_PTR *PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC)(GLenum   target, GLint   level, GLint   xoffset, GLsizei   width, GLenum   format, GLsizei   imageSize, const void * data);
-typedef void (GLAD_API_PTR *PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC)(GLenum   target, GLint   level, GLint   xoffset, GLint   yoffset, GLsizei   width, GLsizei   height, GLenum   format, GLsizei   imageSize, const void * data);
-typedef void (GLAD_API_PTR *PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC)(GLenum   target, GLint   level, GLint   xoffset, GLint   yoffset, GLint   zoffset, GLsizei   width, GLsizei   height, GLsizei   depth, GLenum   format, GLsizei   imageSize, const void * data);
-typedef void (GLAD_API_PTR *PFNGLCOPYBUFFERSUBDATAPROC)(GLenum   readTarget, GLenum   writeTarget, GLintptr   readOffset, GLintptr   writeOffset, GLsizeiptr   size);
-typedef void (GLAD_API_PTR *PFNGLCOPYPIXELSPROC)(GLint   x, GLint   y, GLsizei   width, GLsizei   height, GLenum   type);
-typedef void (GLAD_API_PTR *PFNGLCOPYTEXIMAGE1DPROC)(GLenum   target, GLint   level, GLenum   internalformat, GLint   x, GLint   y, GLsizei   width, GLint   border);
-typedef void (GLAD_API_PTR *PFNGLCOPYTEXIMAGE2DPROC)(GLenum   target, GLint   level, GLenum   internalformat, GLint   x, GLint   y, GLsizei   width, GLsizei   height, GLint   border);
-typedef void (GLAD_API_PTR *PFNGLCOPYTEXSUBIMAGE1DPROC)(GLenum   target, GLint   level, GLint   xoffset, GLint   x, GLint   y, GLsizei   width);
-typedef void (GLAD_API_PTR *PFNGLCOPYTEXSUBIMAGE2DPROC)(GLenum   target, GLint   level, GLint   xoffset, GLint   yoffset, GLint   x, GLint   y, GLsizei   width, GLsizei   height);
-typedef void (GLAD_API_PTR *PFNGLCOPYTEXSUBIMAGE3DPROC)(GLenum   target, GLint   level, GLint   xoffset, GLint   yoffset, GLint   zoffset, GLint   x, GLint   y, GLsizei   width, GLsizei   height);
+typedef void (GLAD_API_PTR *PFNGLACCUMPROC)(GLenum op, GLfloat value);
+typedef void (GLAD_API_PTR *PFNGLACTIVETEXTUREPROC)(GLenum texture);
+typedef void (GLAD_API_PTR *PFNGLALPHAFUNCPROC)(GLenum func, GLfloat ref);
+typedef GLboolean (GLAD_API_PTR *PFNGLARETEXTURESRESIDENTPROC)(GLsizei n, const GLuint * textures, GLboolean * residences);
+typedef void (GLAD_API_PTR *PFNGLARRAYELEMENTPROC)(GLint i);
+typedef void (GLAD_API_PTR *PFNGLATTACHSHADERPROC)(GLuint program, GLuint shader);
+typedef void (GLAD_API_PTR *PFNGLBEGINPROC)(GLenum mode);
+typedef void (GLAD_API_PTR *PFNGLBEGINCONDITIONALRENDERPROC)(GLuint id, GLenum mode);
+typedef void (GLAD_API_PTR *PFNGLBEGINQUERYPROC)(GLenum target, GLuint id);
+typedef void (GLAD_API_PTR *PFNGLBEGINTRANSFORMFEEDBACKPROC)(GLenum primitiveMode);
+typedef void (GLAD_API_PTR *PFNGLBINDATTRIBLOCATIONPROC)(GLuint program, GLuint index, const GLchar * name);
+typedef void (GLAD_API_PTR *PFNGLBINDBUFFERPROC)(GLenum target, GLuint buffer);
+typedef void (GLAD_API_PTR *PFNGLBINDBUFFERBASEPROC)(GLenum target, GLuint index, GLuint buffer);
+typedef void (GLAD_API_PTR *PFNGLBINDBUFFERRANGEPROC)(GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size);
+typedef void (GLAD_API_PTR *PFNGLBINDFRAGDATALOCATIONPROC)(GLuint program, GLuint color, const GLchar * name);
+typedef void (GLAD_API_PTR *PFNGLBINDFRAGDATALOCATIONINDEXEDPROC)(GLuint program, GLuint colorNumber, GLuint index, const GLchar * name);
+typedef void (GLAD_API_PTR *PFNGLBINDFRAMEBUFFERPROC)(GLenum target, GLuint framebuffer);
+typedef void (GLAD_API_PTR *PFNGLBINDRENDERBUFFERPROC)(GLenum target, GLuint renderbuffer);
+typedef void (GLAD_API_PTR *PFNGLBINDSAMPLERPROC)(GLuint unit, GLuint sampler);
+typedef void (GLAD_API_PTR *PFNGLBINDTEXTUREPROC)(GLenum target, GLuint texture);
+typedef void (GLAD_API_PTR *PFNGLBINDVERTEXARRAYPROC)(GLuint array);
+typedef void (GLAD_API_PTR *PFNGLBITMAPPROC)(GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte * bitmap);
+typedef void (GLAD_API_PTR *PFNGLBLENDCOLORPROC)(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
+typedef void (GLAD_API_PTR *PFNGLBLENDEQUATIONPROC)(GLenum mode);
+typedef void (GLAD_API_PTR *PFNGLBLENDEQUATIONSEPARATEPROC)(GLenum modeRGB, GLenum modeAlpha);
+typedef void (GLAD_API_PTR *PFNGLBLENDFUNCPROC)(GLenum sfactor, GLenum dfactor);
+typedef void (GLAD_API_PTR *PFNGLBLENDFUNCSEPARATEPROC)(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
+typedef void (GLAD_API_PTR *PFNGLBLITFRAMEBUFFERPROC)(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
+typedef void (GLAD_API_PTR *PFNGLBUFFERDATAPROC)(GLenum target, GLsizeiptr size, const void * data, GLenum usage);
+typedef void (GLAD_API_PTR *PFNGLBUFFERSUBDATAPROC)(GLenum target, GLintptr offset, GLsizeiptr size, const void * data);
+typedef void (GLAD_API_PTR *PFNGLCALLLISTPROC)(GLuint list);
+typedef void (GLAD_API_PTR *PFNGLCALLLISTSPROC)(GLsizei n, GLenum type, const void * lists);
+typedef GLenum (GLAD_API_PTR *PFNGLCHECKFRAMEBUFFERSTATUSPROC)(GLenum target);
+typedef void (GLAD_API_PTR *PFNGLCLAMPCOLORPROC)(GLenum target, GLenum clamp);
+typedef void (GLAD_API_PTR *PFNGLCLEARPROC)(GLbitfield mask);
+typedef void (GLAD_API_PTR *PFNGLCLEARACCUMPROC)(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
+typedef void (GLAD_API_PTR *PFNGLCLEARBUFFERFIPROC)(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil);
+typedef void (GLAD_API_PTR *PFNGLCLEARBUFFERFVPROC)(GLenum buffer, GLint drawbuffer, const GLfloat * value);
+typedef void (GLAD_API_PTR *PFNGLCLEARBUFFERIVPROC)(GLenum buffer, GLint drawbuffer, const GLint * value);
+typedef void (GLAD_API_PTR *PFNGLCLEARBUFFERUIVPROC)(GLenum buffer, GLint drawbuffer, const GLuint * value);
+typedef void (GLAD_API_PTR *PFNGLCLEARCOLORPROC)(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
+typedef void (GLAD_API_PTR *PFNGLCLEARDEPTHPROC)(GLdouble depth);
+typedef void (GLAD_API_PTR *PFNGLCLEARINDEXPROC)(GLfloat c);
+typedef void (GLAD_API_PTR *PFNGLCLEARSTENCILPROC)(GLint s);
+typedef void (GLAD_API_PTR *PFNGLCLIENTACTIVETEXTUREPROC)(GLenum texture);
+typedef GLenum (GLAD_API_PTR *PFNGLCLIENTWAITSYNCPROC)(GLsync sync, GLbitfield flags, GLuint64 timeout);
+typedef void (GLAD_API_PTR *PFNGLCLIPPLANEPROC)(GLenum plane, const GLdouble * equation);
+typedef void (GLAD_API_PTR *PFNGLCOLOR3BPROC)(GLbyte red, GLbyte green, GLbyte blue);
+typedef void (GLAD_API_PTR *PFNGLCOLOR3BVPROC)(const GLbyte * v);
+typedef void (GLAD_API_PTR *PFNGLCOLOR3DPROC)(GLdouble red, GLdouble green, GLdouble blue);
+typedef void (GLAD_API_PTR *PFNGLCOLOR3DVPROC)(const GLdouble * v);
+typedef void (GLAD_API_PTR *PFNGLCOLOR3FPROC)(GLfloat red, GLfloat green, GLfloat blue);
+typedef void (GLAD_API_PTR *PFNGLCOLOR3FVPROC)(const GLfloat * v);
+typedef void (GLAD_API_PTR *PFNGLCOLOR3IPROC)(GLint red, GLint green, GLint blue);
+typedef void (GLAD_API_PTR *PFNGLCOLOR3IVPROC)(const GLint * v);
+typedef void (GLAD_API_PTR *PFNGLCOLOR3SPROC)(GLshort red, GLshort green, GLshort blue);
+typedef void (GLAD_API_PTR *PFNGLCOLOR3SVPROC)(const GLshort * v);
+typedef void (GLAD_API_PTR *PFNGLCOLOR3UBPROC)(GLubyte red, GLubyte green, GLubyte blue);
+typedef void (GLAD_API_PTR *PFNGLCOLOR3UBVPROC)(const GLubyte * v);
+typedef void (GLAD_API_PTR *PFNGLCOLOR3UIPROC)(GLuint red, GLuint green, GLuint blue);
+typedef void (GLAD_API_PTR *PFNGLCOLOR3UIVPROC)(const GLuint * v);
+typedef void (GLAD_API_PTR *PFNGLCOLOR3USPROC)(GLushort red, GLushort green, GLushort blue);
+typedef void (GLAD_API_PTR *PFNGLCOLOR3USVPROC)(const GLushort * v);
+typedef void (GLAD_API_PTR *PFNGLCOLOR4BPROC)(GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha);
+typedef void (GLAD_API_PTR *PFNGLCOLOR4BVPROC)(const GLbyte * v);
+typedef void (GLAD_API_PTR *PFNGLCOLOR4DPROC)(GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha);
+typedef void (GLAD_API_PTR *PFNGLCOLOR4DVPROC)(const GLdouble * v);
+typedef void (GLAD_API_PTR *PFNGLCOLOR4FPROC)(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
+typedef void (GLAD_API_PTR *PFNGLCOLOR4FVPROC)(const GLfloat * v);
+typedef void (GLAD_API_PTR *PFNGLCOLOR4IPROC)(GLint red, GLint green, GLint blue, GLint alpha);
+typedef void (GLAD_API_PTR *PFNGLCOLOR4IVPROC)(const GLint * v);
+typedef void (GLAD_API_PTR *PFNGLCOLOR4SPROC)(GLshort red, GLshort green, GLshort blue, GLshort alpha);
+typedef void (GLAD_API_PTR *PFNGLCOLOR4SVPROC)(const GLshort * v);
+typedef void (GLAD_API_PTR *PFNGLCOLOR4UBPROC)(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha);
+typedef void (GLAD_API_PTR *PFNGLCOLOR4UBVPROC)(const GLubyte * v);
+typedef void (GLAD_API_PTR *PFNGLCOLOR4UIPROC)(GLuint red, GLuint green, GLuint blue, GLuint alpha);
+typedef void (GLAD_API_PTR *PFNGLCOLOR4UIVPROC)(const GLuint * v);
+typedef void (GLAD_API_PTR *PFNGLCOLOR4USPROC)(GLushort red, GLushort green, GLushort blue, GLushort alpha);
+typedef void (GLAD_API_PTR *PFNGLCOLOR4USVPROC)(const GLushort * v);
+typedef void (GLAD_API_PTR *PFNGLCOLORMASKPROC)(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
+typedef void (GLAD_API_PTR *PFNGLCOLORMASKIPROC)(GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a);
+typedef void (GLAD_API_PTR *PFNGLCOLORMATERIALPROC)(GLenum face, GLenum mode);
+typedef void (GLAD_API_PTR *PFNGLCOLORP3UIPROC)(GLenum type, GLuint color);
+typedef void (GLAD_API_PTR *PFNGLCOLORP3UIVPROC)(GLenum type, const GLuint * color);
+typedef void (GLAD_API_PTR *PFNGLCOLORP4UIPROC)(GLenum type, GLuint color);
+typedef void (GLAD_API_PTR *PFNGLCOLORP4UIVPROC)(GLenum type, const GLuint * color);
+typedef void (GLAD_API_PTR *PFNGLCOLORPOINTERPROC)(GLint size, GLenum type, GLsizei stride, const void * pointer);
+typedef void (GLAD_API_PTR *PFNGLCOMPILESHADERPROC)(GLuint shader);
+typedef void (GLAD_API_PTR *PFNGLCOMPRESSEDTEXIMAGE1DPROC)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const void * data);
+typedef void (GLAD_API_PTR *PFNGLCOMPRESSEDTEXIMAGE2DPROC)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void * data);
+typedef void (GLAD_API_PTR *PFNGLCOMPRESSEDTEXIMAGE3DPROC)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void * data);
+typedef void (GLAD_API_PTR *PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC)(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void * data);
+typedef void (GLAD_API_PTR *PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void * data);
+typedef void (GLAD_API_PTR *PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void * data);
+typedef void (GLAD_API_PTR *PFNGLCOPYBUFFERSUBDATAPROC)(GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
+typedef void (GLAD_API_PTR *PFNGLCOPYPIXELSPROC)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum type);
+typedef void (GLAD_API_PTR *PFNGLCOPYTEXIMAGE1DPROC)(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border);
+typedef void (GLAD_API_PTR *PFNGLCOPYTEXIMAGE2DPROC)(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
+typedef void (GLAD_API_PTR *PFNGLCOPYTEXSUBIMAGE1DPROC)(GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width);
+typedef void (GLAD_API_PTR *PFNGLCOPYTEXSUBIMAGE2DPROC)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
+typedef void (GLAD_API_PTR *PFNGLCOPYTEXSUBIMAGE3DPROC)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
 typedef GLuint (GLAD_API_PTR *PFNGLCREATEPROGRAMPROC)(void);
-typedef GLuint (GLAD_API_PTR *PFNGLCREATESHADERPROC)(GLenum   type);
-typedef void (GLAD_API_PTR *PFNGLCULLFACEPROC)(GLenum   mode);
-typedef void (GLAD_API_PTR *PFNGLDEBUGMESSAGECALLBACKPROC)(GLDEBUGPROC   callback, const void * userParam);
-typedef void (GLAD_API_PTR *PFNGLDEBUGMESSAGECONTROLPROC)(GLenum   source, GLenum   type, GLenum   severity, GLsizei   count, const  GLuint  * ids, GLboolean   enabled);
-typedef void (GLAD_API_PTR *PFNGLDEBUGMESSAGEINSERTPROC)(GLenum   source, GLenum   type, GLuint   id, GLenum   severity, GLsizei   length, const  GLchar  * buf);
-typedef void (GLAD_API_PTR *PFNGLDELETEBUFFERSPROC)(GLsizei   n, const  GLuint  * buffers);
-typedef void (GLAD_API_PTR *PFNGLDELETEFRAMEBUFFERSPROC)(GLsizei   n, const  GLuint  * framebuffers);
-typedef void (GLAD_API_PTR *PFNGLDELETELISTSPROC)(GLuint   list, GLsizei   range);
-typedef void (GLAD_API_PTR *PFNGLDELETEPROGRAMPROC)(GLuint   program);
-typedef void (GLAD_API_PTR *PFNGLDELETEQUERIESPROC)(GLsizei   n, const  GLuint  * ids);
-typedef void (GLAD_API_PTR *PFNGLDELETERENDERBUFFERSPROC)(GLsizei   n, const  GLuint  * renderbuffers);
-typedef void (GLAD_API_PTR *PFNGLDELETESAMPLERSPROC)(GLsizei   count, const  GLuint  * samplers);
-typedef void (GLAD_API_PTR *PFNGLDELETESHADERPROC)(GLuint   shader);
-typedef void (GLAD_API_PTR *PFNGLDELETESYNCPROC)(GLsync   sync);
-typedef void (GLAD_API_PTR *PFNGLDELETETEXTURESPROC)(GLsizei   n, const  GLuint  * textures);
-typedef void (GLAD_API_PTR *PFNGLDELETEVERTEXARRAYSPROC)(GLsizei   n, const  GLuint  * arrays);
-typedef void (GLAD_API_PTR *PFNGLDEPTHFUNCPROC)(GLenum   func);
-typedef void (GLAD_API_PTR *PFNGLDEPTHMASKPROC)(GLboolean   flag);
-typedef void (GLAD_API_PTR *PFNGLDEPTHRANGEPROC)(GLdouble   n, GLdouble   f);
-typedef void (GLAD_API_PTR *PFNGLDETACHSHADERPROC)(GLuint   program, GLuint   shader);
-typedef void (GLAD_API_PTR *PFNGLDISABLEPROC)(GLenum   cap);
-typedef void (GLAD_API_PTR *PFNGLDISABLECLIENTSTATEPROC)(GLenum   array);
-typedef void (GLAD_API_PTR *PFNGLDISABLEVERTEXATTRIBARRAYPROC)(GLuint   index);
-typedef void (GLAD_API_PTR *PFNGLDISABLEIPROC)(GLenum   target, GLuint   index);
-typedef void (GLAD_API_PTR *PFNGLDRAWARRAYSPROC)(GLenum   mode, GLint   first, GLsizei   count);
-typedef void (GLAD_API_PTR *PFNGLDRAWARRAYSINSTANCEDPROC)(GLenum   mode, GLint   first, GLsizei   count, GLsizei   instancecount);
-typedef void (GLAD_API_PTR *PFNGLDRAWBUFFERPROC)(GLenum   buf);
-typedef void (GLAD_API_PTR *PFNGLDRAWBUFFERSPROC)(GLsizei   n, const  GLenum  * bufs);
-typedef void (GLAD_API_PTR *PFNGLDRAWELEMENTSPROC)(GLenum   mode, GLsizei   count, GLenum   type, const void * indices);
-typedef void (GLAD_API_PTR *PFNGLDRAWELEMENTSBASEVERTEXPROC)(GLenum   mode, GLsizei   count, GLenum   type, const void * indices, GLint   basevertex);
-typedef void (GLAD_API_PTR *PFNGLDRAWELEMENTSINSTANCEDPROC)(GLenum   mode, GLsizei   count, GLenum   type, const void * indices, GLsizei   instancecount);
-typedef void (GLAD_API_PTR *PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXPROC)(GLenum   mode, GLsizei   count, GLenum   type, const void * indices, GLsizei   instancecount, GLint   basevertex);
-typedef void (GLAD_API_PTR *PFNGLDRAWPIXELSPROC)(GLsizei   width, GLsizei   height, GLenum   format, GLenum   type, const void * pixels);
-typedef void (GLAD_API_PTR *PFNGLDRAWRANGEELEMENTSPROC)(GLenum   mode, GLuint   start, GLuint   end, GLsizei   count, GLenum   type, const void * indices);
-typedef void (GLAD_API_PTR *PFNGLDRAWRANGEELEMENTSBASEVERTEXPROC)(GLenum   mode, GLuint   start, GLuint   end, GLsizei   count, GLenum   type, const void * indices, GLint   basevertex);
-typedef void (GLAD_API_PTR *PFNGLEDGEFLAGPROC)(GLboolean   flag);
-typedef void (GLAD_API_PTR *PFNGLEDGEFLAGPOINTERPROC)(GLsizei   stride, const void * pointer);
-typedef void (GLAD_API_PTR *PFNGLEDGEFLAGVPROC)(const  GLboolean  * flag);
-typedef void (GLAD_API_PTR *PFNGLENABLEPROC)(GLenum   cap);
-typedef void (GLAD_API_PTR *PFNGLENABLECLIENTSTATEPROC)(GLenum   array);
-typedef void (GLAD_API_PTR *PFNGLENABLEVERTEXATTRIBARRAYPROC)(GLuint   index);
-typedef void (GLAD_API_PTR *PFNGLENABLEIPROC)(GLenum   target, GLuint   index);
+typedef GLuint (GLAD_API_PTR *PFNGLCREATESHADERPROC)(GLenum type);
+typedef void (GLAD_API_PTR *PFNGLCULLFACEPROC)(GLenum mode);
+typedef void (GLAD_API_PTR *PFNGLDEBUGMESSAGECALLBACKPROC)(GLDEBUGPROC callback, const void * userParam);
+typedef void (GLAD_API_PTR *PFNGLDEBUGMESSAGECONTROLPROC)(GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint * ids, GLboolean enabled);
+typedef void (GLAD_API_PTR *PFNGLDEBUGMESSAGEINSERTPROC)(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar * buf);
+typedef void (GLAD_API_PTR *PFNGLDELETEBUFFERSPROC)(GLsizei n, const GLuint * buffers);
+typedef void (GLAD_API_PTR *PFNGLDELETEFRAMEBUFFERSPROC)(GLsizei n, const GLuint * framebuffers);
+typedef void (GLAD_API_PTR *PFNGLDELETELISTSPROC)(GLuint list, GLsizei range);
+typedef void (GLAD_API_PTR *PFNGLDELETEPROGRAMPROC)(GLuint program);
+typedef void (GLAD_API_PTR *PFNGLDELETEQUERIESPROC)(GLsizei n, const GLuint * ids);
+typedef void (GLAD_API_PTR *PFNGLDELETERENDERBUFFERSPROC)(GLsizei n, const GLuint * renderbuffers);
+typedef void (GLAD_API_PTR *PFNGLDELETESAMPLERSPROC)(GLsizei count, const GLuint * samplers);
+typedef void (GLAD_API_PTR *PFNGLDELETESHADERPROC)(GLuint shader);
+typedef void (GLAD_API_PTR *PFNGLDELETESYNCPROC)(GLsync sync);
+typedef void (GLAD_API_PTR *PFNGLDELETETEXTURESPROC)(GLsizei n, const GLuint * textures);
+typedef void (GLAD_API_PTR *PFNGLDELETEVERTEXARRAYSPROC)(GLsizei n, const GLuint * arrays);
+typedef void (GLAD_API_PTR *PFNGLDEPTHFUNCPROC)(GLenum func);
+typedef void (GLAD_API_PTR *PFNGLDEPTHMASKPROC)(GLboolean flag);
+typedef void (GLAD_API_PTR *PFNGLDEPTHRANGEPROC)(GLdouble n, GLdouble f);
+typedef void (GLAD_API_PTR *PFNGLDETACHSHADERPROC)(GLuint program, GLuint shader);
+typedef void (GLAD_API_PTR *PFNGLDISABLEPROC)(GLenum cap);
+typedef void (GLAD_API_PTR *PFNGLDISABLECLIENTSTATEPROC)(GLenum array);
+typedef void (GLAD_API_PTR *PFNGLDISABLEVERTEXATTRIBARRAYPROC)(GLuint index);
+typedef void (GLAD_API_PTR *PFNGLDISABLEIPROC)(GLenum target, GLuint index);
+typedef void (GLAD_API_PTR *PFNGLDRAWARRAYSPROC)(GLenum mode, GLint first, GLsizei count);
+typedef void (GLAD_API_PTR *PFNGLDRAWARRAYSINSTANCEDPROC)(GLenum mode, GLint first, GLsizei count, GLsizei instancecount);
+typedef void (GLAD_API_PTR *PFNGLDRAWBUFFERPROC)(GLenum buf);
+typedef void (GLAD_API_PTR *PFNGLDRAWBUFFERSPROC)(GLsizei n, const GLenum * bufs);
+typedef void (GLAD_API_PTR *PFNGLDRAWELEMENTSPROC)(GLenum mode, GLsizei count, GLenum type, const void * indices);
+typedef void (GLAD_API_PTR *PFNGLDRAWELEMENTSBASEVERTEXPROC)(GLenum mode, GLsizei count, GLenum type, const void * indices, GLint basevertex);
+typedef void (GLAD_API_PTR *PFNGLDRAWELEMENTSINSTANCEDPROC)(GLenum mode, GLsizei count, GLenum type, const void * indices, GLsizei instancecount);
+typedef void (GLAD_API_PTR *PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXPROC)(GLenum mode, GLsizei count, GLenum type, const void * indices, GLsizei instancecount, GLint basevertex);
+typedef void (GLAD_API_PTR *PFNGLDRAWPIXELSPROC)(GLsizei width, GLsizei height, GLenum format, GLenum type, const void * pixels);
+typedef void (GLAD_API_PTR *PFNGLDRAWRANGEELEMENTSPROC)(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void * indices);
+typedef void (GLAD_API_PTR *PFNGLDRAWRANGEELEMENTSBASEVERTEXPROC)(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void * indices, GLint basevertex);
+typedef void (GLAD_API_PTR *PFNGLEDGEFLAGPROC)(GLboolean flag);
+typedef void (GLAD_API_PTR *PFNGLEDGEFLAGPOINTERPROC)(GLsizei stride, const void * pointer);
+typedef void (GLAD_API_PTR *PFNGLEDGEFLAGVPROC)(const GLboolean * flag);
+typedef void (GLAD_API_PTR *PFNGLENABLEPROC)(GLenum cap);
+typedef void (GLAD_API_PTR *PFNGLENABLECLIENTSTATEPROC)(GLenum array);
+typedef void (GLAD_API_PTR *PFNGLENABLEVERTEXATTRIBARRAYPROC)(GLuint index);
+typedef void (GLAD_API_PTR *PFNGLENABLEIPROC)(GLenum target, GLuint index);
 typedef void (GLAD_API_PTR *PFNGLENDPROC)(void);
 typedef void (GLAD_API_PTR *PFNGLENDCONDITIONALRENDERPROC)(void);
 typedef void (GLAD_API_PTR *PFNGLENDLISTPROC)(void);
-typedef void (GLAD_API_PTR *PFNGLENDQUERYPROC)(GLenum   target);
+typedef void (GLAD_API_PTR *PFNGLENDQUERYPROC)(GLenum target);
 typedef void (GLAD_API_PTR *PFNGLENDTRANSFORMFEEDBACKPROC)(void);
-typedef void (GLAD_API_PTR *PFNGLEVALCOORD1DPROC)(GLdouble   u);
-typedef void (GLAD_API_PTR *PFNGLEVALCOORD1DVPROC)(const  GLdouble  * u);
-typedef void (GLAD_API_PTR *PFNGLEVALCOORD1FPROC)(GLfloat   u);
-typedef void (GLAD_API_PTR *PFNGLEVALCOORD1FVPROC)(const  GLfloat  * u);
-typedef void (GLAD_API_PTR *PFNGLEVALCOORD2DPROC)(GLdouble   u, GLdouble   v);
-typedef void (GLAD_API_PTR *PFNGLEVALCOORD2DVPROC)(const  GLdouble  * u);
-typedef void (GLAD_API_PTR *PFNGLEVALCOORD2FPROC)(GLfloat   u, GLfloat   v);
-typedef void (GLAD_API_PTR *PFNGLEVALCOORD2FVPROC)(const  GLfloat  * u);
-typedef void (GLAD_API_PTR *PFNGLEVALMESH1PROC)(GLenum   mode, GLint   i1, GLint   i2);
-typedef void (GLAD_API_PTR *PFNGLEVALMESH2PROC)(GLenum   mode, GLint   i1, GLint   i2, GLint   j1, GLint   j2);
-typedef void (GLAD_API_PTR *PFNGLEVALPOINT1PROC)(GLint   i);
-typedef void (GLAD_API_PTR *PFNGLEVALPOINT2PROC)(GLint   i, GLint   j);
-typedef void (GLAD_API_PTR *PFNGLFEEDBACKBUFFERPROC)(GLsizei   size, GLenum   type, GLfloat  * buffer);
-typedef GLsync (GLAD_API_PTR *PFNGLFENCESYNCPROC)(GLenum   condition, GLbitfield   flags);
+typedef void (GLAD_API_PTR *PFNGLEVALCOORD1DPROC)(GLdouble u);
+typedef void (GLAD_API_PTR *PFNGLEVALCOORD1DVPROC)(const GLdouble * u);
+typedef void (GLAD_API_PTR *PFNGLEVALCOORD1FPROC)(GLfloat u);
+typedef void (GLAD_API_PTR *PFNGLEVALCOORD1FVPROC)(const GLfloat * u);
+typedef void (GLAD_API_PTR *PFNGLEVALCOORD2DPROC)(GLdouble u, GLdouble v);
+typedef void (GLAD_API_PTR *PFNGLEVALCOORD2DVPROC)(const GLdouble * u);
+typedef void (GLAD_API_PTR *PFNGLEVALCOORD2FPROC)(GLfloat u, GLfloat v);
+typedef void (GLAD_API_PTR *PFNGLEVALCOORD2FVPROC)(const GLfloat * u);
+typedef void (GLAD_API_PTR *PFNGLEVALMESH1PROC)(GLenum mode, GLint i1, GLint i2);
+typedef void (GLAD_API_PTR *PFNGLEVALMESH2PROC)(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2);
+typedef void (GLAD_API_PTR *PFNGLEVALPOINT1PROC)(GLint i);
+typedef void (GLAD_API_PTR *PFNGLEVALPOINT2PROC)(GLint i, GLint j);
+typedef void (GLAD_API_PTR *PFNGLFEEDBACKBUFFERPROC)(GLsizei size, GLenum type, GLfloat * buffer);
+typedef GLsync (GLAD_API_PTR *PFNGLFENCESYNCPROC)(GLenum condition, GLbitfield flags);
 typedef void (GLAD_API_PTR *PFNGLFINISHPROC)(void);
 typedef void (GLAD_API_PTR *PFNGLFLUSHPROC)(void);
-typedef void (GLAD_API_PTR *PFNGLFLUSHMAPPEDBUFFERRANGEPROC)(GLenum   target, GLintptr   offset, GLsizeiptr   length);
-typedef void (GLAD_API_PTR *PFNGLFOGCOORDPOINTERPROC)(GLenum   type, GLsizei   stride, const void * pointer);
-typedef void (GLAD_API_PTR *PFNGLFOGCOORDDPROC)(GLdouble   coord);
-typedef void (GLAD_API_PTR *PFNGLFOGCOORDDVPROC)(const  GLdouble  * coord);
-typedef void (GLAD_API_PTR *PFNGLFOGCOORDFPROC)(GLfloat   coord);
-typedef void (GLAD_API_PTR *PFNGLFOGCOORDFVPROC)(const  GLfloat  * coord);
-typedef void (GLAD_API_PTR *PFNGLFOGFPROC)(GLenum   pname, GLfloat   param);
-typedef void (GLAD_API_PTR *PFNGLFOGFVPROC)(GLenum   pname, const  GLfloat  * params);
-typedef void (GLAD_API_PTR *PFNGLFOGIPROC)(GLenum   pname, GLint   param);
-typedef void (GLAD_API_PTR *PFNGLFOGIVPROC)(GLenum   pname, const  GLint  * params);
-typedef void (GLAD_API_PTR *PFNGLFRAMEBUFFERRENDERBUFFERPROC)(GLenum   target, GLenum   attachment, GLenum   renderbuffertarget, GLuint   renderbuffer);
-typedef void (GLAD_API_PTR *PFNGLFRAMEBUFFERTEXTUREPROC)(GLenum   target, GLenum   attachment, GLuint   texture, GLint   level);
-typedef void (GLAD_API_PTR *PFNGLFRAMEBUFFERTEXTURE1DPROC)(GLenum   target, GLenum   attachment, GLenum   textarget, GLuint   texture, GLint   level);
-typedef void (GLAD_API_PTR *PFNGLFRAMEBUFFERTEXTURE2DPROC)(GLenum   target, GLenum   attachment, GLenum   textarget, GLuint   texture, GLint   level);
-typedef void (GLAD_API_PTR *PFNGLFRAMEBUFFERTEXTURE3DPROC)(GLenum   target, GLenum   attachment, GLenum   textarget, GLuint   texture, GLint   level, GLint   zoffset);
-typedef void (GLAD_API_PTR *PFNGLFRAMEBUFFERTEXTURELAYERPROC)(GLenum   target, GLenum   attachment, GLuint   texture, GLint   level, GLint   layer);
-typedef void (GLAD_API_PTR *PFNGLFRONTFACEPROC)(GLenum   mode);
-typedef void (GLAD_API_PTR *PFNGLFRUSTUMPROC)(GLdouble   left, GLdouble   right, GLdouble   bottom, GLdouble   top, GLdouble   zNear, GLdouble   zFar);
-typedef void (GLAD_API_PTR *PFNGLGENBUFFERSPROC)(GLsizei   n, GLuint  * buffers);
-typedef void (GLAD_API_PTR *PFNGLGENFRAMEBUFFERSPROC)(GLsizei   n, GLuint  * framebuffers);
-typedef GLuint (GLAD_API_PTR *PFNGLGENLISTSPROC)(GLsizei   range);
-typedef void (GLAD_API_PTR *PFNGLGENQUERIESPROC)(GLsizei   n, GLuint  * ids);
-typedef void (GLAD_API_PTR *PFNGLGENRENDERBUFFERSPROC)(GLsizei   n, GLuint  * renderbuffers);
-typedef void (GLAD_API_PTR *PFNGLGENSAMPLERSPROC)(GLsizei   count, GLuint  * samplers);
-typedef void (GLAD_API_PTR *PFNGLGENTEXTURESPROC)(GLsizei   n, GLuint  * textures);
-typedef void (GLAD_API_PTR *PFNGLGENVERTEXARRAYSPROC)(GLsizei   n, GLuint  * arrays);
-typedef void (GLAD_API_PTR *PFNGLGENERATEMIPMAPPROC)(GLenum   target);
-typedef void (GLAD_API_PTR *PFNGLGETACTIVEATTRIBPROC)(GLuint   program, GLuint   index, GLsizei   bufSize, GLsizei  * length, GLint  * size, GLenum  * type, GLchar  * name);
-typedef void (GLAD_API_PTR *PFNGLGETACTIVEUNIFORMPROC)(GLuint   program, GLuint   index, GLsizei   bufSize, GLsizei  * length, GLint  * size, GLenum  * type, GLchar  * name);
-typedef void (GLAD_API_PTR *PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC)(GLuint   program, GLuint   uniformBlockIndex, GLsizei   bufSize, GLsizei  * length, GLchar  * uniformBlockName);
-typedef void (GLAD_API_PTR *PFNGLGETACTIVEUNIFORMBLOCKIVPROC)(GLuint   program, GLuint   uniformBlockIndex, GLenum   pname, GLint  * params);
-typedef void (GLAD_API_PTR *PFNGLGETACTIVEUNIFORMNAMEPROC)(GLuint   program, GLuint   uniformIndex, GLsizei   bufSize, GLsizei  * length, GLchar  * uniformName);
-typedef void (GLAD_API_PTR *PFNGLGETACTIVEUNIFORMSIVPROC)(GLuint   program, GLsizei   uniformCount, const  GLuint  * uniformIndices, GLenum   pname, GLint  * params);
-typedef void (GLAD_API_PTR *PFNGLGETATTACHEDSHADERSPROC)(GLuint   program, GLsizei   maxCount, GLsizei  * count, GLuint  * shaders);
-typedef GLint (GLAD_API_PTR *PFNGLGETATTRIBLOCATIONPROC)(GLuint   program, const  GLchar  * name);
-typedef void (GLAD_API_PTR *PFNGLGETBOOLEANI_VPROC)(GLenum   target, GLuint   index, GLboolean  * data);
-typedef void (GLAD_API_PTR *PFNGLGETBOOLEANVPROC)(GLenum   pname, GLboolean  * data);
-typedef void (GLAD_API_PTR *PFNGLGETBUFFERPARAMETERI64VPROC)(GLenum   target, GLenum   pname, GLint64  * params);
-typedef void (GLAD_API_PTR *PFNGLGETBUFFERPARAMETERIVPROC)(GLenum   target, GLenum   pname, GLint  * params);
-typedef void (GLAD_API_PTR *PFNGLGETBUFFERPOINTERVPROC)(GLenum   target, GLenum   pname, void ** params);
-typedef void (GLAD_API_PTR *PFNGLGETBUFFERSUBDATAPROC)(GLenum   target, GLintptr   offset, GLsizeiptr   size, void * data);
-typedef void (GLAD_API_PTR *PFNGLGETCLIPPLANEPROC)(GLenum   plane, GLdouble  * equation);
-typedef void (GLAD_API_PTR *PFNGLGETCOMPRESSEDTEXIMAGEPROC)(GLenum   target, GLint   level, void * img);
-typedef GLuint (GLAD_API_PTR *PFNGLGETDEBUGMESSAGELOGPROC)(GLuint   count, GLsizei   bufSize, GLenum  * sources, GLenum  * types, GLuint  * ids, GLenum  * severities, GLsizei  * lengths, GLchar  * messageLog);
-typedef void (GLAD_API_PTR *PFNGLGETDOUBLEVPROC)(GLenum   pname, GLdouble  * data);
+typedef void (GLAD_API_PTR *PFNGLFLUSHMAPPEDBUFFERRANGEPROC)(GLenum target, GLintptr offset, GLsizeiptr length);
+typedef void (GLAD_API_PTR *PFNGLFOGCOORDPOINTERPROC)(GLenum type, GLsizei stride, const void * pointer);
+typedef void (GLAD_API_PTR *PFNGLFOGCOORDDPROC)(GLdouble coord);
+typedef void (GLAD_API_PTR *PFNGLFOGCOORDDVPROC)(const GLdouble * coord);
+typedef void (GLAD_API_PTR *PFNGLFOGCOORDFPROC)(GLfloat coord);
+typedef void (GLAD_API_PTR *PFNGLFOGCOORDFVPROC)(const GLfloat * coord);
+typedef void (GLAD_API_PTR *PFNGLFOGFPROC)(GLenum pname, GLfloat param);
+typedef void (GLAD_API_PTR *PFNGLFOGFVPROC)(GLenum pname, const GLfloat * params);
+typedef void (GLAD_API_PTR *PFNGLFOGIPROC)(GLenum pname, GLint param);
+typedef void (GLAD_API_PTR *PFNGLFOGIVPROC)(GLenum pname, const GLint * params);
+typedef void (GLAD_API_PTR *PFNGLFRAMEBUFFERRENDERBUFFERPROC)(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
+typedef void (GLAD_API_PTR *PFNGLFRAMEBUFFERTEXTUREPROC)(GLenum target, GLenum attachment, GLuint texture, GLint level);
+typedef void (GLAD_API_PTR *PFNGLFRAMEBUFFERTEXTURE1DPROC)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
+typedef void (GLAD_API_PTR *PFNGLFRAMEBUFFERTEXTURE2DPROC)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
+typedef void (GLAD_API_PTR *PFNGLFRAMEBUFFERTEXTURE3DPROC)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset);
+typedef void (GLAD_API_PTR *PFNGLFRAMEBUFFERTEXTURELAYERPROC)(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer);
+typedef void (GLAD_API_PTR *PFNGLFRONTFACEPROC)(GLenum mode);
+typedef void (GLAD_API_PTR *PFNGLFRUSTUMPROC)(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar);
+typedef void (GLAD_API_PTR *PFNGLGENBUFFERSPROC)(GLsizei n, GLuint * buffers);
+typedef void (GLAD_API_PTR *PFNGLGENFRAMEBUFFERSPROC)(GLsizei n, GLuint * framebuffers);
+typedef GLuint (GLAD_API_PTR *PFNGLGENLISTSPROC)(GLsizei range);
+typedef void (GLAD_API_PTR *PFNGLGENQUERIESPROC)(GLsizei n, GLuint * ids);
+typedef void (GLAD_API_PTR *PFNGLGENRENDERBUFFERSPROC)(GLsizei n, GLuint * renderbuffers);
+typedef void (GLAD_API_PTR *PFNGLGENSAMPLERSPROC)(GLsizei count, GLuint * samplers);
+typedef void (GLAD_API_PTR *PFNGLGENTEXTURESPROC)(GLsizei n, GLuint * textures);
+typedef void (GLAD_API_PTR *PFNGLGENVERTEXARRAYSPROC)(GLsizei n, GLuint * arrays);
+typedef void (GLAD_API_PTR *PFNGLGENERATEMIPMAPPROC)(GLenum target);
+typedef void (GLAD_API_PTR *PFNGLGETACTIVEATTRIBPROC)(GLuint program, GLuint index, GLsizei bufSize, GLsizei * length, GLint * size, GLenum * type, GLchar * name);
+typedef void (GLAD_API_PTR *PFNGLGETACTIVEUNIFORMPROC)(GLuint program, GLuint index, GLsizei bufSize, GLsizei * length, GLint * size, GLenum * type, GLchar * name);
+typedef void (GLAD_API_PTR *PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC)(GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei * length, GLchar * uniformBlockName);
+typedef void (GLAD_API_PTR *PFNGLGETACTIVEUNIFORMBLOCKIVPROC)(GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint * params);
+typedef void (GLAD_API_PTR *PFNGLGETACTIVEUNIFORMNAMEPROC)(GLuint program, GLuint uniformIndex, GLsizei bufSize, GLsizei * length, GLchar * uniformName);
+typedef void (GLAD_API_PTR *PFNGLGETACTIVEUNIFORMSIVPROC)(GLuint program, GLsizei uniformCount, const GLuint * uniformIndices, GLenum pname, GLint * params);
+typedef void (GLAD_API_PTR *PFNGLGETATTACHEDSHADERSPROC)(GLuint program, GLsizei maxCount, GLsizei * count, GLuint * shaders);
+typedef GLint (GLAD_API_PTR *PFNGLGETATTRIBLOCATIONPROC)(GLuint program, const GLchar * name);
+typedef void (GLAD_API_PTR *PFNGLGETBOOLEANI_VPROC)(GLenum target, GLuint index, GLboolean * data);
+typedef void (GLAD_API_PTR *PFNGLGETBOOLEANVPROC)(GLenum pname, GLboolean * data);
+typedef void (GLAD_API_PTR *PFNGLGETBUFFERPARAMETERI64VPROC)(GLenum target, GLenum pname, GLint64 * params);
+typedef void (GLAD_API_PTR *PFNGLGETBUFFERPARAMETERIVPROC)(GLenum target, GLenum pname, GLint * params);
+typedef void (GLAD_API_PTR *PFNGLGETBUFFERPOINTERVPROC)(GLenum target, GLenum pname, void ** params);
+typedef void (GLAD_API_PTR *PFNGLGETBUFFERSUBDATAPROC)(GLenum target, GLintptr offset, GLsizeiptr size, void * data);
+typedef void (GLAD_API_PTR *PFNGLGETCLIPPLANEPROC)(GLenum plane, GLdouble * equation);
+typedef void (GLAD_API_PTR *PFNGLGETCOMPRESSEDTEXIMAGEPROC)(GLenum target, GLint level, void * img);
+typedef GLuint (GLAD_API_PTR *PFNGLGETDEBUGMESSAGELOGPROC)(GLuint count, GLsizei bufSize, GLenum * sources, GLenum * types, GLuint * ids, GLenum * severities, GLsizei * lengths, GLchar * messageLog);
+typedef void (GLAD_API_PTR *PFNGLGETDOUBLEVPROC)(GLenum pname, GLdouble * data);
 typedef GLenum (GLAD_API_PTR *PFNGLGETERRORPROC)(void);
-typedef void (GLAD_API_PTR *PFNGLGETFLOATVPROC)(GLenum   pname, GLfloat  * data);
-typedef GLint (GLAD_API_PTR *PFNGLGETFRAGDATAINDEXPROC)(GLuint   program, const  GLchar  * name);
-typedef GLint (GLAD_API_PTR *PFNGLGETFRAGDATALOCATIONPROC)(GLuint   program, const  GLchar  * name);
-typedef void (GLAD_API_PTR *PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC)(GLenum   target, GLenum   attachment, GLenum   pname, GLint  * params);
+typedef void (GLAD_API_PTR *PFNGLGETFLOATVPROC)(GLenum pname, GLfloat * data);
+typedef GLint (GLAD_API_PTR *PFNGLGETFRAGDATAINDEXPROC)(GLuint program, const GLchar * name);
+typedef GLint (GLAD_API_PTR *PFNGLGETFRAGDATALOCATIONPROC)(GLuint program, const GLchar * name);
+typedef void (GLAD_API_PTR *PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC)(GLenum target, GLenum attachment, GLenum pname, GLint * params);
 typedef GLenum (GLAD_API_PTR *PFNGLGETGRAPHICSRESETSTATUSARBPROC)(void);
-typedef void (GLAD_API_PTR *PFNGLGETINTEGER64I_VPROC)(GLenum   target, GLuint   index, GLint64  * data);
-typedef void (GLAD_API_PTR *PFNGLGETINTEGER64VPROC)(GLenum   pname, GLint64  * data);
-typedef void (GLAD_API_PTR *PFNGLGETINTEGERI_VPROC)(GLenum   target, GLuint   index, GLint  * data);
-typedef void (GLAD_API_PTR *PFNGLGETINTEGERVPROC)(GLenum   pname, GLint  * data);
-typedef void (GLAD_API_PTR *PFNGLGETLIGHTFVPROC)(GLenum   light, GLenum   pname, GLfloat  * params);
-typedef void (GLAD_API_PTR *PFNGLGETLIGHTIVPROC)(GLenum   light, GLenum   pname, GLint  * params);
-typedef void (GLAD_API_PTR *PFNGLGETMAPDVPROC)(GLenum   target, GLenum   query, GLdouble  * v);
-typedef void (GLAD_API_PTR *PFNGLGETMAPFVPROC)(GLenum   target, GLenum   query, GLfloat  * v);
-typedef void (GLAD_API_PTR *PFNGLGETMAPIVPROC)(GLenum   target, GLenum   query, GLint  * v);
-typedef void (GLAD_API_PTR *PFNGLGETMATERIALFVPROC)(GLenum   face, GLenum   pname, GLfloat  * params);
-typedef void (GLAD_API_PTR *PFNGLGETMATERIALIVPROC)(GLenum   face, GLenum   pname, GLint  * params);
-typedef void (GLAD_API_PTR *PFNGLGETMULTISAMPLEFVPROC)(GLenum   pname, GLuint   index, GLfloat  * val);
-typedef void (GLAD_API_PTR *PFNGLGETOBJECTLABELPROC)(GLenum   identifier, GLuint   name, GLsizei   bufSize, GLsizei  * length, GLchar  * label);
-typedef void (GLAD_API_PTR *PFNGLGETOBJECTPTRLABELPROC)(const void * ptr, GLsizei   bufSize, GLsizei  * length, GLchar  * label);
-typedef void (GLAD_API_PTR *PFNGLGETPIXELMAPFVPROC)(GLenum   map, GLfloat  * values);
-typedef void (GLAD_API_PTR *PFNGLGETPIXELMAPUIVPROC)(GLenum   map, GLuint  * values);
-typedef void (GLAD_API_PTR *PFNGLGETPIXELMAPUSVPROC)(GLenum   map, GLushort  * values);
-typedef void (GLAD_API_PTR *PFNGLGETPOINTERVPROC)(GLenum   pname, void ** params);
-typedef void (GLAD_API_PTR *PFNGLGETPOLYGONSTIPPLEPROC)(GLubyte  * mask);
-typedef void (GLAD_API_PTR *PFNGLGETPROGRAMINFOLOGPROC)(GLuint   program, GLsizei   bufSize, GLsizei  * length, GLchar  * infoLog);
-typedef void (GLAD_API_PTR *PFNGLGETPROGRAMIVPROC)(GLuint   program, GLenum   pname, GLint  * params);
-typedef void (GLAD_API_PTR *PFNGLGETQUERYOBJECTI64VPROC)(GLuint   id, GLenum   pname, GLint64  * params);
-typedef void (GLAD_API_PTR *PFNGLGETQUERYOBJECTIVPROC)(GLuint   id, GLenum   pname, GLint  * params);
-typedef void (GLAD_API_PTR *PFNGLGETQUERYOBJECTUI64VPROC)(GLuint   id, GLenum   pname, GLuint64  * params);
-typedef void (GLAD_API_PTR *PFNGLGETQUERYOBJECTUIVPROC)(GLuint   id, GLenum   pname, GLuint  * params);
-typedef void (GLAD_API_PTR *PFNGLGETQUERYIVPROC)(GLenum   target, GLenum   pname, GLint  * params);
-typedef void (GLAD_API_PTR *PFNGLGETRENDERBUFFERPARAMETERIVPROC)(GLenum   target, GLenum   pname, GLint  * params);
-typedef void (GLAD_API_PTR *PFNGLGETSAMPLERPARAMETERIIVPROC)(GLuint   sampler, GLenum   pname, GLint  * params);
-typedef void (GLAD_API_PTR *PFNGLGETSAMPLERPARAMETERIUIVPROC)(GLuint   sampler, GLenum   pname, GLuint  * params);
-typedef void (GLAD_API_PTR *PFNGLGETSAMPLERPARAMETERFVPROC)(GLuint   sampler, GLenum   pname, GLfloat  * params);
-typedef void (GLAD_API_PTR *PFNGLGETSAMPLERPARAMETERIVPROC)(GLuint   sampler, GLenum   pname, GLint  * params);
-typedef void (GLAD_API_PTR *PFNGLGETSHADERINFOLOGPROC)(GLuint   shader, GLsizei   bufSize, GLsizei  * length, GLchar  * infoLog);
-typedef void (GLAD_API_PTR *PFNGLGETSHADERSOURCEPROC)(GLuint   shader, GLsizei   bufSize, GLsizei  * length, GLchar  * source);
-typedef void (GLAD_API_PTR *PFNGLGETSHADERIVPROC)(GLuint   shader, GLenum   pname, GLint  * params);
-typedef const GLubyte * (GLAD_API_PTR *PFNGLGETSTRINGPROC)(GLenum   name);
-typedef const GLubyte * (GLAD_API_PTR *PFNGLGETSTRINGIPROC)(GLenum   name, GLuint   index);
-typedef void (GLAD_API_PTR *PFNGLGETSYNCIVPROC)(GLsync   sync, GLenum   pname, GLsizei   bufSize, GLsizei  * length, GLint  * values);
-typedef void (GLAD_API_PTR *PFNGLGETTEXENVFVPROC)(GLenum   target, GLenum   pname, GLfloat  * params);
-typedef void (GLAD_API_PTR *PFNGLGETTEXENVIVPROC)(GLenum   target, GLenum   pname, GLint  * params);
-typedef void (GLAD_API_PTR *PFNGLGETTEXGENDVPROC)(GLenum   coord, GLenum   pname, GLdouble  * params);
-typedef void (GLAD_API_PTR *PFNGLGETTEXGENFVPROC)(GLenum   coord, GLenum   pname, GLfloat  * params);
-typedef void (GLAD_API_PTR *PFNGLGETTEXGENIVPROC)(GLenum   coord, GLenum   pname, GLint  * params);
-typedef void (GLAD_API_PTR *PFNGLGETTEXIMAGEPROC)(GLenum   target, GLint   level, GLenum   format, GLenum   type, void * pixels);
-typedef void (GLAD_API_PTR *PFNGLGETTEXLEVELPARAMETERFVPROC)(GLenum   target, GLint   level, GLenum   pname, GLfloat  * params);
-typedef void (GLAD_API_PTR *PFNGLGETTEXLEVELPARAMETERIVPROC)(GLenum   target, GLint   level, GLenum   pname, GLint  * params);
-typedef void (GLAD_API_PTR *PFNGLGETTEXPARAMETERIIVPROC)(GLenum   target, GLenum   pname, GLint  * params);
-typedef void (GLAD_API_PTR *PFNGLGETTEXPARAMETERIUIVPROC)(GLenum   target, GLenum   pname, GLuint  * params);
-typedef void (GLAD_API_PTR *PFNGLGETTEXPARAMETERFVPROC)(GLenum   target, GLenum   pname, GLfloat  * params);
-typedef void (GLAD_API_PTR *PFNGLGETTEXPARAMETERIVPROC)(GLenum   target, GLenum   pname, GLint  * params);
-typedef void (GLAD_API_PTR *PFNGLGETTRANSFORMFEEDBACKVARYINGPROC)(GLuint   program, GLuint   index, GLsizei   bufSize, GLsizei  * length, GLsizei  * size, GLenum  * type, GLchar  * name);
-typedef GLuint (GLAD_API_PTR *PFNGLGETUNIFORMBLOCKINDEXPROC)(GLuint   program, const  GLchar  * uniformBlockName);
-typedef void (GLAD_API_PTR *PFNGLGETUNIFORMINDICESPROC)(GLuint   program, GLsizei   uniformCount, const  GLchar  *const* uniformNames, GLuint  * uniformIndices);
-typedef GLint (GLAD_API_PTR *PFNGLGETUNIFORMLOCATIONPROC)(GLuint   program, const  GLchar  * name);
-typedef void (GLAD_API_PTR *PFNGLGETUNIFORMFVPROC)(GLuint   program, GLint   location, GLfloat  * params);
-typedef void (GLAD_API_PTR *PFNGLGETUNIFORMIVPROC)(GLuint   program, GLint   location, GLint  * params);
-typedef void (GLAD_API_PTR *PFNGLGETUNIFORMUIVPROC)(GLuint   program, GLint   location, GLuint  * params);
-typedef void (GLAD_API_PTR *PFNGLGETVERTEXATTRIBIIVPROC)(GLuint   index, GLenum   pname, GLint  * params);
-typedef void (GLAD_API_PTR *PFNGLGETVERTEXATTRIBIUIVPROC)(GLuint   index, GLenum   pname, GLuint  * params);
-typedef void (GLAD_API_PTR *PFNGLGETVERTEXATTRIBPOINTERVPROC)(GLuint   index, GLenum   pname, void ** pointer);
-typedef void (GLAD_API_PTR *PFNGLGETVERTEXATTRIBDVPROC)(GLuint   index, GLenum   pname, GLdouble  * params);
-typedef void (GLAD_API_PTR *PFNGLGETVERTEXATTRIBFVPROC)(GLuint   index, GLenum   pname, GLfloat  * params);
-typedef void (GLAD_API_PTR *PFNGLGETVERTEXATTRIBIVPROC)(GLuint   index, GLenum   pname, GLint  * params);
-typedef void (GLAD_API_PTR *PFNGLGETNCOLORTABLEARBPROC)(GLenum   target, GLenum   format, GLenum   type, GLsizei   bufSize, void * table);
-typedef void (GLAD_API_PTR *PFNGLGETNCOMPRESSEDTEXIMAGEARBPROC)(GLenum   target, GLint   lod, GLsizei   bufSize, void * img);
-typedef void (GLAD_API_PTR *PFNGLGETNCONVOLUTIONFILTERARBPROC)(GLenum   target, GLenum   format, GLenum   type, GLsizei   bufSize, void * image);
-typedef void (GLAD_API_PTR *PFNGLGETNHISTOGRAMARBPROC)(GLenum   target, GLboolean   reset, GLenum   format, GLenum   type, GLsizei   bufSize, void * values);
-typedef void (GLAD_API_PTR *PFNGLGETNMAPDVARBPROC)(GLenum   target, GLenum   query, GLsizei   bufSize, GLdouble  * v);
-typedef void (GLAD_API_PTR *PFNGLGETNMAPFVARBPROC)(GLenum   target, GLenum   query, GLsizei   bufSize, GLfloat  * v);
-typedef void (GLAD_API_PTR *PFNGLGETNMAPIVARBPROC)(GLenum   target, GLenum   query, GLsizei   bufSize, GLint  * v);
-typedef void (GLAD_API_PTR *PFNGLGETNMINMAXARBPROC)(GLenum   target, GLboolean   reset, GLenum   format, GLenum   type, GLsizei   bufSize, void * values);
-typedef void (GLAD_API_PTR *PFNGLGETNPIXELMAPFVARBPROC)(GLenum   map, GLsizei   bufSize, GLfloat  * values);
-typedef void (GLAD_API_PTR *PFNGLGETNPIXELMAPUIVARBPROC)(GLenum   map, GLsizei   bufSize, GLuint  * values);
-typedef void (GLAD_API_PTR *PFNGLGETNPIXELMAPUSVARBPROC)(GLenum   map, GLsizei   bufSize, GLushort  * values);
-typedef void (GLAD_API_PTR *PFNGLGETNPOLYGONSTIPPLEARBPROC)(GLsizei   bufSize, GLubyte  * pattern);
-typedef void (GLAD_API_PTR *PFNGLGETNSEPARABLEFILTERARBPROC)(GLenum   target, GLenum   format, GLenum   type, GLsizei   rowBufSize, void * row, GLsizei   columnBufSize, void * column, void * span);
-typedef void (GLAD_API_PTR *PFNGLGETNTEXIMAGEARBPROC)(GLenum   target, GLint   level, GLenum   format, GLenum   type, GLsizei   bufSize, void * img);
-typedef void (GLAD_API_PTR *PFNGLGETNUNIFORMDVARBPROC)(GLuint   program, GLint   location, GLsizei   bufSize, GLdouble  * params);
-typedef void (GLAD_API_PTR *PFNGLGETNUNIFORMFVARBPROC)(GLuint   program, GLint   location, GLsizei   bufSize, GLfloat  * params);
-typedef void (GLAD_API_PTR *PFNGLGETNUNIFORMIVARBPROC)(GLuint   program, GLint   location, GLsizei   bufSize, GLint  * params);
-typedef void (GLAD_API_PTR *PFNGLGETNUNIFORMUIVARBPROC)(GLuint   program, GLint   location, GLsizei   bufSize, GLuint  * params);
-typedef void (GLAD_API_PTR *PFNGLHINTPROC)(GLenum   target, GLenum   mode);
-typedef void (GLAD_API_PTR *PFNGLINDEXMASKPROC)(GLuint   mask);
-typedef void (GLAD_API_PTR *PFNGLINDEXPOINTERPROC)(GLenum   type, GLsizei   stride, const void * pointer);
-typedef void (GLAD_API_PTR *PFNGLINDEXDPROC)(GLdouble   c);
-typedef void (GLAD_API_PTR *PFNGLINDEXDVPROC)(const  GLdouble  * c);
-typedef void (GLAD_API_PTR *PFNGLINDEXFPROC)(GLfloat   c);
-typedef void (GLAD_API_PTR *PFNGLINDEXFVPROC)(const  GLfloat  * c);
-typedef void (GLAD_API_PTR *PFNGLINDEXIPROC)(GLint   c);
-typedef void (GLAD_API_PTR *PFNGLINDEXIVPROC)(const  GLint  * c);
-typedef void (GLAD_API_PTR *PFNGLINDEXSPROC)(GLshort   c);
-typedef void (GLAD_API_PTR *PFNGLINDEXSVPROC)(const  GLshort  * c);
-typedef void (GLAD_API_PTR *PFNGLINDEXUBPROC)(GLubyte   c);
-typedef void (GLAD_API_PTR *PFNGLINDEXUBVPROC)(const  GLubyte  * c);
+typedef void (GLAD_API_PTR *PFNGLGETINTEGER64I_VPROC)(GLenum target, GLuint index, GLint64 * data);
+typedef void (GLAD_API_PTR *PFNGLGETINTEGER64VPROC)(GLenum pname, GLint64 * data);
+typedef void (GLAD_API_PTR *PFNGLGETINTEGERI_VPROC)(GLenum target, GLuint index, GLint * data);
+typedef void (GLAD_API_PTR *PFNGLGETINTEGERVPROC)(GLenum pname, GLint * data);
+typedef void (GLAD_API_PTR *PFNGLGETLIGHTFVPROC)(GLenum light, GLenum pname, GLfloat * params);
+typedef void (GLAD_API_PTR *PFNGLGETLIGHTIVPROC)(GLenum light, GLenum pname, GLint * params);
+typedef void (GLAD_API_PTR *PFNGLGETMAPDVPROC)(GLenum target, GLenum query, GLdouble * v);
+typedef void (GLAD_API_PTR *PFNGLGETMAPFVPROC)(GLenum target, GLenum query, GLfloat * v);
+typedef void (GLAD_API_PTR *PFNGLGETMAPIVPROC)(GLenum target, GLenum query, GLint * v);
+typedef void (GLAD_API_PTR *PFNGLGETMATERIALFVPROC)(GLenum face, GLenum pname, GLfloat * params);
+typedef void (GLAD_API_PTR *PFNGLGETMATERIALIVPROC)(GLenum face, GLenum pname, GLint * params);
+typedef void (GLAD_API_PTR *PFNGLGETMULTISAMPLEFVPROC)(GLenum pname, GLuint index, GLfloat * val);
+typedef void (GLAD_API_PTR *PFNGLGETOBJECTLABELPROC)(GLenum identifier, GLuint name, GLsizei bufSize, GLsizei * length, GLchar * label);
+typedef void (GLAD_API_PTR *PFNGLGETOBJECTPTRLABELPROC)(const void * ptr, GLsizei bufSize, GLsizei * length, GLchar * label);
+typedef void (GLAD_API_PTR *PFNGLGETPIXELMAPFVPROC)(GLenum map, GLfloat * values);
+typedef void (GLAD_API_PTR *PFNGLGETPIXELMAPUIVPROC)(GLenum map, GLuint * values);
+typedef void (GLAD_API_PTR *PFNGLGETPIXELMAPUSVPROC)(GLenum map, GLushort * values);
+typedef void (GLAD_API_PTR *PFNGLGETPOINTERVPROC)(GLenum pname, void ** params);
+typedef void (GLAD_API_PTR *PFNGLGETPOLYGONSTIPPLEPROC)(GLubyte * mask);
+typedef void (GLAD_API_PTR *PFNGLGETPROGRAMINFOLOGPROC)(GLuint program, GLsizei bufSize, GLsizei * length, GLchar * infoLog);
+typedef void (GLAD_API_PTR *PFNGLGETPROGRAMIVPROC)(GLuint program, GLenum pname, GLint * params);
+typedef void (GLAD_API_PTR *PFNGLGETQUERYOBJECTI64VPROC)(GLuint id, GLenum pname, GLint64 * params);
+typedef void (GLAD_API_PTR *PFNGLGETQUERYOBJECTIVPROC)(GLuint id, GLenum pname, GLint * params);
+typedef void (GLAD_API_PTR *PFNGLGETQUERYOBJECTUI64VPROC)(GLuint id, GLenum pname, GLuint64 * params);
+typedef void (GLAD_API_PTR *PFNGLGETQUERYOBJECTUIVPROC)(GLuint id, GLenum pname, GLuint * params);
+typedef void (GLAD_API_PTR *PFNGLGETQUERYIVPROC)(GLenum target, GLenum pname, GLint * params);
+typedef void (GLAD_API_PTR *PFNGLGETRENDERBUFFERPARAMETERIVPROC)(GLenum target, GLenum pname, GLint * params);
+typedef void (GLAD_API_PTR *PFNGLGETSAMPLERPARAMETERIIVPROC)(GLuint sampler, GLenum pname, GLint * params);
+typedef void (GLAD_API_PTR *PFNGLGETSAMPLERPARAMETERIUIVPROC)(GLuint sampler, GLenum pname, GLuint * params);
+typedef void (GLAD_API_PTR *PFNGLGETSAMPLERPARAMETERFVPROC)(GLuint sampler, GLenum pname, GLfloat * params);
+typedef void (GLAD_API_PTR *PFNGLGETSAMPLERPARAMETERIVPROC)(GLuint sampler, GLenum pname, GLint * params);
+typedef void (GLAD_API_PTR *PFNGLGETSHADERINFOLOGPROC)(GLuint shader, GLsizei bufSize, GLsizei * length, GLchar * infoLog);
+typedef void (GLAD_API_PTR *PFNGLGETSHADERSOURCEPROC)(GLuint shader, GLsizei bufSize, GLsizei * length, GLchar * source);
+typedef void (GLAD_API_PTR *PFNGLGETSHADERIVPROC)(GLuint shader, GLenum pname, GLint * params);
+typedef const GLubyte * (GLAD_API_PTR *PFNGLGETSTRINGPROC)(GLenum name);
+typedef const GLubyte * (GLAD_API_PTR *PFNGLGETSTRINGIPROC)(GLenum name, GLuint index);
+typedef void (GLAD_API_PTR *PFNGLGETSYNCIVPROC)(GLsync sync, GLenum pname, GLsizei count, GLsizei * length, GLint * values);
+typedef void (GLAD_API_PTR *PFNGLGETTEXENVFVPROC)(GLenum target, GLenum pname, GLfloat * params);
+typedef void (GLAD_API_PTR *PFNGLGETTEXENVIVPROC)(GLenum target, GLenum pname, GLint * params);
+typedef void (GLAD_API_PTR *PFNGLGETTEXGENDVPROC)(GLenum coord, GLenum pname, GLdouble * params);
+typedef void (GLAD_API_PTR *PFNGLGETTEXGENFVPROC)(GLenum coord, GLenum pname, GLfloat * params);
+typedef void (GLAD_API_PTR *PFNGLGETTEXGENIVPROC)(GLenum coord, GLenum pname, GLint * params);
+typedef void (GLAD_API_PTR *PFNGLGETTEXIMAGEPROC)(GLenum target, GLint level, GLenum format, GLenum type, void * pixels);
+typedef void (GLAD_API_PTR *PFNGLGETTEXLEVELPARAMETERFVPROC)(GLenum target, GLint level, GLenum pname, GLfloat * params);
+typedef void (GLAD_API_PTR *PFNGLGETTEXLEVELPARAMETERIVPROC)(GLenum target, GLint level, GLenum pname, GLint * params);
+typedef void (GLAD_API_PTR *PFNGLGETTEXPARAMETERIIVPROC)(GLenum target, GLenum pname, GLint * params);
+typedef void (GLAD_API_PTR *PFNGLGETTEXPARAMETERIUIVPROC)(GLenum target, GLenum pname, GLuint * params);
+typedef void (GLAD_API_PTR *PFNGLGETTEXPARAMETERFVPROC)(GLenum target, GLenum pname, GLfloat * params);
+typedef void (GLAD_API_PTR *PFNGLGETTEXPARAMETERIVPROC)(GLenum target, GLenum pname, GLint * params);
+typedef void (GLAD_API_PTR *PFNGLGETTRANSFORMFEEDBACKVARYINGPROC)(GLuint program, GLuint index, GLsizei bufSize, GLsizei * length, GLsizei * size, GLenum * type, GLchar * name);
+typedef GLuint (GLAD_API_PTR *PFNGLGETUNIFORMBLOCKINDEXPROC)(GLuint program, const GLchar * uniformBlockName);
+typedef void (GLAD_API_PTR *PFNGLGETUNIFORMINDICESPROC)(GLuint program, GLsizei uniformCount, const GLchar *const* uniformNames, GLuint * uniformIndices);
+typedef GLint (GLAD_API_PTR *PFNGLGETUNIFORMLOCATIONPROC)(GLuint program, const GLchar * name);
+typedef void (GLAD_API_PTR *PFNGLGETUNIFORMFVPROC)(GLuint program, GLint location, GLfloat * params);
+typedef void (GLAD_API_PTR *PFNGLGETUNIFORMIVPROC)(GLuint program, GLint location, GLint * params);
+typedef void (GLAD_API_PTR *PFNGLGETUNIFORMUIVPROC)(GLuint program, GLint location, GLuint * params);
+typedef void (GLAD_API_PTR *PFNGLGETVERTEXATTRIBIIVPROC)(GLuint index, GLenum pname, GLint * params);
+typedef void (GLAD_API_PTR *PFNGLGETVERTEXATTRIBIUIVPROC)(GLuint index, GLenum pname, GLuint * params);
+typedef void (GLAD_API_PTR *PFNGLGETVERTEXATTRIBPOINTERVPROC)(GLuint index, GLenum pname, void ** pointer);
+typedef void (GLAD_API_PTR *PFNGLGETVERTEXATTRIBDVPROC)(GLuint index, GLenum pname, GLdouble * params);
+typedef void (GLAD_API_PTR *PFNGLGETVERTEXATTRIBFVPROC)(GLuint index, GLenum pname, GLfloat * params);
+typedef void (GLAD_API_PTR *PFNGLGETVERTEXATTRIBIVPROC)(GLuint index, GLenum pname, GLint * params);
+typedef void (GLAD_API_PTR *PFNGLGETNCOLORTABLEARBPROC)(GLenum target, GLenum format, GLenum type, GLsizei bufSize, void * table);
+typedef void (GLAD_API_PTR *PFNGLGETNCOMPRESSEDTEXIMAGEARBPROC)(GLenum target, GLint lod, GLsizei bufSize, void * img);
+typedef void (GLAD_API_PTR *PFNGLGETNCONVOLUTIONFILTERARBPROC)(GLenum target, GLenum format, GLenum type, GLsizei bufSize, void * image);
+typedef void (GLAD_API_PTR *PFNGLGETNHISTOGRAMARBPROC)(GLenum target, GLboolean reset, GLenum format, GLenum type, GLsizei bufSize, void * values);
+typedef void (GLAD_API_PTR *PFNGLGETNMAPDVARBPROC)(GLenum target, GLenum query, GLsizei bufSize, GLdouble * v);
+typedef void (GLAD_API_PTR *PFNGLGETNMAPFVARBPROC)(GLenum target, GLenum query, GLsizei bufSize, GLfloat * v);
+typedef void (GLAD_API_PTR *PFNGLGETNMAPIVARBPROC)(GLenum target, GLenum query, GLsizei bufSize, GLint * v);
+typedef void (GLAD_API_PTR *PFNGLGETNMINMAXARBPROC)(GLenum target, GLboolean reset, GLenum format, GLenum type, GLsizei bufSize, void * values);
+typedef void (GLAD_API_PTR *PFNGLGETNPIXELMAPFVARBPROC)(GLenum map, GLsizei bufSize, GLfloat * values);
+typedef void (GLAD_API_PTR *PFNGLGETNPIXELMAPUIVARBPROC)(GLenum map, GLsizei bufSize, GLuint * values);
+typedef void (GLAD_API_PTR *PFNGLGETNPIXELMAPUSVARBPROC)(GLenum map, GLsizei bufSize, GLushort * values);
+typedef void (GLAD_API_PTR *PFNGLGETNPOLYGONSTIPPLEARBPROC)(GLsizei bufSize, GLubyte * pattern);
+typedef void (GLAD_API_PTR *PFNGLGETNSEPARABLEFILTERARBPROC)(GLenum target, GLenum format, GLenum type, GLsizei rowBufSize, void * row, GLsizei columnBufSize, void * column, void * span);
+typedef void (GLAD_API_PTR *PFNGLGETNTEXIMAGEARBPROC)(GLenum target, GLint level, GLenum format, GLenum type, GLsizei bufSize, void * img);
+typedef void (GLAD_API_PTR *PFNGLGETNUNIFORMDVARBPROC)(GLuint program, GLint location, GLsizei bufSize, GLdouble * params);
+typedef void (GLAD_API_PTR *PFNGLGETNUNIFORMFVARBPROC)(GLuint program, GLint location, GLsizei bufSize, GLfloat * params);
+typedef void (GLAD_API_PTR *PFNGLGETNUNIFORMIVARBPROC)(GLuint program, GLint location, GLsizei bufSize, GLint * params);
+typedef void (GLAD_API_PTR *PFNGLGETNUNIFORMUIVARBPROC)(GLuint program, GLint location, GLsizei bufSize, GLuint * params);
+typedef void (GLAD_API_PTR *PFNGLHINTPROC)(GLenum target, GLenum mode);
+typedef void (GLAD_API_PTR *PFNGLINDEXMASKPROC)(GLuint mask);
+typedef void (GLAD_API_PTR *PFNGLINDEXPOINTERPROC)(GLenum type, GLsizei stride, const void * pointer);
+typedef void (GLAD_API_PTR *PFNGLINDEXDPROC)(GLdouble c);
+typedef void (GLAD_API_PTR *PFNGLINDEXDVPROC)(const GLdouble * c);
+typedef void (GLAD_API_PTR *PFNGLINDEXFPROC)(GLfloat c);
+typedef void (GLAD_API_PTR *PFNGLINDEXFVPROC)(const GLfloat * c);
+typedef void (GLAD_API_PTR *PFNGLINDEXIPROC)(GLint c);
+typedef void (GLAD_API_PTR *PFNGLINDEXIVPROC)(const GLint * c);
+typedef void (GLAD_API_PTR *PFNGLINDEXSPROC)(GLshort c);
+typedef void (GLAD_API_PTR *PFNGLINDEXSVPROC)(const GLshort * c);
+typedef void (GLAD_API_PTR *PFNGLINDEXUBPROC)(GLubyte c);
+typedef void (GLAD_API_PTR *PFNGLINDEXUBVPROC)(const GLubyte * c);
 typedef void (GLAD_API_PTR *PFNGLINITNAMESPROC)(void);
-typedef void (GLAD_API_PTR *PFNGLINTERLEAVEDARRAYSPROC)(GLenum   format, GLsizei   stride, const void * pointer);
-typedef GLboolean (GLAD_API_PTR *PFNGLISBUFFERPROC)(GLuint   buffer);
-typedef GLboolean (GLAD_API_PTR *PFNGLISENABLEDPROC)(GLenum   cap);
-typedef GLboolean (GLAD_API_PTR *PFNGLISENABLEDIPROC)(GLenum   target, GLuint   index);
-typedef GLboolean (GLAD_API_PTR *PFNGLISFRAMEBUFFERPROC)(GLuint   framebuffer);
-typedef GLboolean (GLAD_API_PTR *PFNGLISLISTPROC)(GLuint   list);
-typedef GLboolean (GLAD_API_PTR *PFNGLISPROGRAMPROC)(GLuint   program);
-typedef GLboolean (GLAD_API_PTR *PFNGLISQUERYPROC)(GLuint   id);
-typedef GLboolean (GLAD_API_PTR *PFNGLISRENDERBUFFERPROC)(GLuint   renderbuffer);
-typedef GLboolean (GLAD_API_PTR *PFNGLISSAMPLERPROC)(GLuint   sampler);
-typedef GLboolean (GLAD_API_PTR *PFNGLISSHADERPROC)(GLuint   shader);
-typedef GLboolean (GLAD_API_PTR *PFNGLISSYNCPROC)(GLsync   sync);
-typedef GLboolean (GLAD_API_PTR *PFNGLISTEXTUREPROC)(GLuint   texture);
-typedef GLboolean (GLAD_API_PTR *PFNGLISVERTEXARRAYPROC)(GLuint   array);
-typedef void (GLAD_API_PTR *PFNGLLIGHTMODELFPROC)(GLenum   pname, GLfloat   param);
-typedef void (GLAD_API_PTR *PFNGLLIGHTMODELFVPROC)(GLenum   pname, const  GLfloat  * params);
-typedef void (GLAD_API_PTR *PFNGLLIGHTMODELIPROC)(GLenum   pname, GLint   param);
-typedef void (GLAD_API_PTR *PFNGLLIGHTMODELIVPROC)(GLenum   pname, const  GLint  * params);
-typedef void (GLAD_API_PTR *PFNGLLIGHTFPROC)(GLenum   light, GLenum   pname, GLfloat   param);
-typedef void (GLAD_API_PTR *PFNGLLIGHTFVPROC)(GLenum   light, GLenum   pname, const  GLfloat  * params);
-typedef void (GLAD_API_PTR *PFNGLLIGHTIPROC)(GLenum   light, GLenum   pname, GLint   param);
-typedef void (GLAD_API_PTR *PFNGLLIGHTIVPROC)(GLenum   light, GLenum   pname, const  GLint  * params);
-typedef void (GLAD_API_PTR *PFNGLLINESTIPPLEPROC)(GLint   factor, GLushort   pattern);
-typedef void (GLAD_API_PTR *PFNGLLINEWIDTHPROC)(GLfloat   width);
-typedef void (GLAD_API_PTR *PFNGLLINKPROGRAMPROC)(GLuint   program);
-typedef void (GLAD_API_PTR *PFNGLLISTBASEPROC)(GLuint   base);
+typedef void (GLAD_API_PTR *PFNGLINTERLEAVEDARRAYSPROC)(GLenum format, GLsizei stride, const void * pointer);
+typedef GLboolean (GLAD_API_PTR *PFNGLISBUFFERPROC)(GLuint buffer);
+typedef GLboolean (GLAD_API_PTR *PFNGLISENABLEDPROC)(GLenum cap);
+typedef GLboolean (GLAD_API_PTR *PFNGLISENABLEDIPROC)(GLenum target, GLuint index);
+typedef GLboolean (GLAD_API_PTR *PFNGLISFRAMEBUFFERPROC)(GLuint framebuffer);
+typedef GLboolean (GLAD_API_PTR *PFNGLISLISTPROC)(GLuint list);
+typedef GLboolean (GLAD_API_PTR *PFNGLISPROGRAMPROC)(GLuint program);
+typedef GLboolean (GLAD_API_PTR *PFNGLISQUERYPROC)(GLuint id);
+typedef GLboolean (GLAD_API_PTR *PFNGLISRENDERBUFFERPROC)(GLuint renderbuffer);
+typedef GLboolean (GLAD_API_PTR *PFNGLISSAMPLERPROC)(GLuint sampler);
+typedef GLboolean (GLAD_API_PTR *PFNGLISSHADERPROC)(GLuint shader);
+typedef GLboolean (GLAD_API_PTR *PFNGLISSYNCPROC)(GLsync sync);
+typedef GLboolean (GLAD_API_PTR *PFNGLISTEXTUREPROC)(GLuint texture);
+typedef GLboolean (GLAD_API_PTR *PFNGLISVERTEXARRAYPROC)(GLuint array);
+typedef void (GLAD_API_PTR *PFNGLLIGHTMODELFPROC)(GLenum pname, GLfloat param);
+typedef void (GLAD_API_PTR *PFNGLLIGHTMODELFVPROC)(GLenum pname, const GLfloat * params);
+typedef void (GLAD_API_PTR *PFNGLLIGHTMODELIPROC)(GLenum pname, GLint param);
+typedef void (GLAD_API_PTR *PFNGLLIGHTMODELIVPROC)(GLenum pname, const GLint * params);
+typedef void (GLAD_API_PTR *PFNGLLIGHTFPROC)(GLenum light, GLenum pname, GLfloat param);
+typedef void (GLAD_API_PTR *PFNGLLIGHTFVPROC)(GLenum light, GLenum pname, const GLfloat * params);
+typedef void (GLAD_API_PTR *PFNGLLIGHTIPROC)(GLenum light, GLenum pname, GLint param);
+typedef void (GLAD_API_PTR *PFNGLLIGHTIVPROC)(GLenum light, GLenum pname, const GLint * params);
+typedef void (GLAD_API_PTR *PFNGLLINESTIPPLEPROC)(GLint factor, GLushort pattern);
+typedef void (GLAD_API_PTR *PFNGLLINEWIDTHPROC)(GLfloat width);
+typedef void (GLAD_API_PTR *PFNGLLINKPROGRAMPROC)(GLuint program);
+typedef void (GLAD_API_PTR *PFNGLLISTBASEPROC)(GLuint base);
 typedef void (GLAD_API_PTR *PFNGLLOADIDENTITYPROC)(void);
-typedef void (GLAD_API_PTR *PFNGLLOADMATRIXDPROC)(const  GLdouble  * m);
-typedef void (GLAD_API_PTR *PFNGLLOADMATRIXFPROC)(const  GLfloat  * m);
-typedef void (GLAD_API_PTR *PFNGLLOADNAMEPROC)(GLuint   name);
-typedef void (GLAD_API_PTR *PFNGLLOADTRANSPOSEMATRIXDPROC)(const  GLdouble  * m);
-typedef void (GLAD_API_PTR *PFNGLLOADTRANSPOSEMATRIXFPROC)(const  GLfloat  * m);
-typedef void (GLAD_API_PTR *PFNGLLOGICOPPROC)(GLenum   opcode);
-typedef void (GLAD_API_PTR *PFNGLMAP1DPROC)(GLenum   target, GLdouble   u1, GLdouble   u2, GLint   stride, GLint   order, const  GLdouble  * points);
-typedef void (GLAD_API_PTR *PFNGLMAP1FPROC)(GLenum   target, GLfloat   u1, GLfloat   u2, GLint   stride, GLint   order, const  GLfloat  * points);
-typedef void (GLAD_API_PTR *PFNGLMAP2DPROC)(GLenum   target, GLdouble   u1, GLdouble   u2, GLint   ustride, GLint   uorder, GLdouble   v1, GLdouble   v2, GLint   vstride, GLint   vorder, const  GLdouble  * points);
-typedef void (GLAD_API_PTR *PFNGLMAP2FPROC)(GLenum   target, GLfloat   u1, GLfloat   u2, GLint   ustride, GLint   uorder, GLfloat   v1, GLfloat   v2, GLint   vstride, GLint   vorder, const  GLfloat  * points);
-typedef void * (GLAD_API_PTR *PFNGLMAPBUFFERPROC)(GLenum   target, GLenum   access);
-typedef void * (GLAD_API_PTR *PFNGLMAPBUFFERRANGEPROC)(GLenum   target, GLintptr   offset, GLsizeiptr   length, GLbitfield   access);
-typedef void (GLAD_API_PTR *PFNGLMAPGRID1DPROC)(GLint   un, GLdouble   u1, GLdouble   u2);
-typedef void (GLAD_API_PTR *PFNGLMAPGRID1FPROC)(GLint   un, GLfloat   u1, GLfloat   u2);
-typedef void (GLAD_API_PTR *PFNGLMAPGRID2DPROC)(GLint   un, GLdouble   u1, GLdouble   u2, GLint   vn, GLdouble   v1, GLdouble   v2);
-typedef void (GLAD_API_PTR *PFNGLMAPGRID2FPROC)(GLint   un, GLfloat   u1, GLfloat   u2, GLint   vn, GLfloat   v1, GLfloat   v2);
-typedef void (GLAD_API_PTR *PFNGLMATERIALFPROC)(GLenum   face, GLenum   pname, GLfloat   param);
-typedef void (GLAD_API_PTR *PFNGLMATERIALFVPROC)(GLenum   face, GLenum   pname, const  GLfloat  * params);
-typedef void (GLAD_API_PTR *PFNGLMATERIALIPROC)(GLenum   face, GLenum   pname, GLint   param);
-typedef void (GLAD_API_PTR *PFNGLMATERIALIVPROC)(GLenum   face, GLenum   pname, const  GLint  * params);
-typedef void (GLAD_API_PTR *PFNGLMATRIXMODEPROC)(GLenum   mode);
-typedef void (GLAD_API_PTR *PFNGLMULTMATRIXDPROC)(const  GLdouble  * m);
-typedef void (GLAD_API_PTR *PFNGLMULTMATRIXFPROC)(const  GLfloat  * m);
-typedef void (GLAD_API_PTR *PFNGLMULTTRANSPOSEMATRIXDPROC)(const  GLdouble  * m);
-typedef void (GLAD_API_PTR *PFNGLMULTTRANSPOSEMATRIXFPROC)(const  GLfloat  * m);
-typedef void (GLAD_API_PTR *PFNGLMULTIDRAWARRAYSPROC)(GLenum   mode, const  GLint  * first, const  GLsizei  * count, GLsizei   drawcount);
-typedef void (GLAD_API_PTR *PFNGLMULTIDRAWELEMENTSPROC)(GLenum   mode, const  GLsizei  * count, GLenum   type, const void *const* indices, GLsizei   drawcount);
-typedef void (GLAD_API_PTR *PFNGLMULTIDRAWELEMENTSBASEVERTEXPROC)(GLenum   mode, const  GLsizei  * count, GLenum   type, const void *const* indices, GLsizei   drawcount, const  GLint  * basevertex);
-typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORD1DPROC)(GLenum   target, GLdouble   s);
-typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORD1DVPROC)(GLenum   target, const  GLdouble  * v);
-typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORD1FPROC)(GLenum   target, GLfloat   s);
-typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORD1FVPROC)(GLenum   target, const  GLfloat  * v);
-typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORD1IPROC)(GLenum   target, GLint   s);
-typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORD1IVPROC)(GLenum   target, const  GLint  * v);
-typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORD1SPROC)(GLenum   target, GLshort   s);
-typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORD1SVPROC)(GLenum   target, const  GLshort  * v);
-typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORD2DPROC)(GLenum   target, GLdouble   s, GLdouble   t);
-typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORD2DVPROC)(GLenum   target, const  GLdouble  * v);
-typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORD2FPROC)(GLenum   target, GLfloat   s, GLfloat   t);
-typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORD2FVPROC)(GLenum   target, const  GLfloat  * v);
-typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORD2IPROC)(GLenum   target, GLint   s, GLint   t);
-typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORD2IVPROC)(GLenum   target, const  GLint  * v);
-typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORD2SPROC)(GLenum   target, GLshort   s, GLshort   t);
-typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORD2SVPROC)(GLenum   target, const  GLshort  * v);
-typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORD3DPROC)(GLenum   target, GLdouble   s, GLdouble   t, GLdouble   r);
-typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORD3DVPROC)(GLenum   target, const  GLdouble  * v);
-typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORD3FPROC)(GLenum   target, GLfloat   s, GLfloat   t, GLfloat   r);
-typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORD3FVPROC)(GLenum   target, const  GLfloat  * v);
-typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORD3IPROC)(GLenum   target, GLint   s, GLint   t, GLint   r);
-typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORD3IVPROC)(GLenum   target, const  GLint  * v);
-typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORD3SPROC)(GLenum   target, GLshort   s, GLshort   t, GLshort   r);
-typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORD3SVPROC)(GLenum   target, const  GLshort  * v);
-typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORD4DPROC)(GLenum   target, GLdouble   s, GLdouble   t, GLdouble   r, GLdouble   q);
-typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORD4DVPROC)(GLenum   target, const  GLdouble  * v);
-typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORD4FPROC)(GLenum   target, GLfloat   s, GLfloat   t, GLfloat   r, GLfloat   q);
-typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORD4FVPROC)(GLenum   target, const  GLfloat  * v);
-typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORD4IPROC)(GLenum   target, GLint   s, GLint   t, GLint   r, GLint   q);
-typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORD4IVPROC)(GLenum   target, const  GLint  * v);
-typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORD4SPROC)(GLenum   target, GLshort   s, GLshort   t, GLshort   r, GLshort   q);
-typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORD4SVPROC)(GLenum   target, const  GLshort  * v);
-typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORDP1UIPROC)(GLenum   texture, GLenum   type, GLuint   coords);
-typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORDP1UIVPROC)(GLenum   texture, GLenum   type, const  GLuint  * coords);
-typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORDP2UIPROC)(GLenum   texture, GLenum   type, GLuint   coords);
-typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORDP2UIVPROC)(GLenum   texture, GLenum   type, const  GLuint  * coords);
-typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORDP3UIPROC)(GLenum   texture, GLenum   type, GLuint   coords);
-typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORDP3UIVPROC)(GLenum   texture, GLenum   type, const  GLuint  * coords);
-typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORDP4UIPROC)(GLenum   texture, GLenum   type, GLuint   coords);
-typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORDP4UIVPROC)(GLenum   texture, GLenum   type, const  GLuint  * coords);
-typedef void (GLAD_API_PTR *PFNGLNEWLISTPROC)(GLuint   list, GLenum   mode);
-typedef void (GLAD_API_PTR *PFNGLNORMAL3BPROC)(GLbyte   nx, GLbyte   ny, GLbyte   nz);
-typedef void (GLAD_API_PTR *PFNGLNORMAL3BVPROC)(const  GLbyte  * v);
-typedef void (GLAD_API_PTR *PFNGLNORMAL3DPROC)(GLdouble   nx, GLdouble   ny, GLdouble   nz);
-typedef void (GLAD_API_PTR *PFNGLNORMAL3DVPROC)(const  GLdouble  * v);
-typedef void (GLAD_API_PTR *PFNGLNORMAL3FPROC)(GLfloat   nx, GLfloat   ny, GLfloat   nz);
-typedef void (GLAD_API_PTR *PFNGLNORMAL3FVPROC)(const  GLfloat  * v);
-typedef void (GLAD_API_PTR *PFNGLNORMAL3IPROC)(GLint   nx, GLint   ny, GLint   nz);
-typedef void (GLAD_API_PTR *PFNGLNORMAL3IVPROC)(const  GLint  * v);
-typedef void (GLAD_API_PTR *PFNGLNORMAL3SPROC)(GLshort   nx, GLshort   ny, GLshort   nz);
-typedef void (GLAD_API_PTR *PFNGLNORMAL3SVPROC)(const  GLshort  * v);
-typedef void (GLAD_API_PTR *PFNGLNORMALP3UIPROC)(GLenum   type, GLuint   coords);
-typedef void (GLAD_API_PTR *PFNGLNORMALP3UIVPROC)(GLenum   type, const  GLuint  * coords);
-typedef void (GLAD_API_PTR *PFNGLNORMALPOINTERPROC)(GLenum   type, GLsizei   stride, const void * pointer);
-typedef void (GLAD_API_PTR *PFNGLOBJECTLABELPROC)(GLenum   identifier, GLuint   name, GLsizei   length, const  GLchar  * label);
-typedef void (GLAD_API_PTR *PFNGLOBJECTPTRLABELPROC)(const void * ptr, GLsizei   length, const  GLchar  * label);
-typedef void (GLAD_API_PTR *PFNGLORTHOPROC)(GLdouble   left, GLdouble   right, GLdouble   bottom, GLdouble   top, GLdouble   zNear, GLdouble   zFar);
-typedef void (GLAD_API_PTR *PFNGLPASSTHROUGHPROC)(GLfloat   token);
-typedef void (GLAD_API_PTR *PFNGLPIXELMAPFVPROC)(GLenum   map, GLsizei   mapsize, const  GLfloat  * values);
-typedef void (GLAD_API_PTR *PFNGLPIXELMAPUIVPROC)(GLenum   map, GLsizei   mapsize, const  GLuint  * values);
-typedef void (GLAD_API_PTR *PFNGLPIXELMAPUSVPROC)(GLenum   map, GLsizei   mapsize, const  GLushort  * values);
-typedef void (GLAD_API_PTR *PFNGLPIXELSTOREFPROC)(GLenum   pname, GLfloat   param);
-typedef void (GLAD_API_PTR *PFNGLPIXELSTOREIPROC)(GLenum   pname, GLint   param);
-typedef void (GLAD_API_PTR *PFNGLPIXELTRANSFERFPROC)(GLenum   pname, GLfloat   param);
-typedef void (GLAD_API_PTR *PFNGLPIXELTRANSFERIPROC)(GLenum   pname, GLint   param);
-typedef void (GLAD_API_PTR *PFNGLPIXELZOOMPROC)(GLfloat   xfactor, GLfloat   yfactor);
-typedef void (GLAD_API_PTR *PFNGLPOINTPARAMETERFPROC)(GLenum   pname, GLfloat   param);
-typedef void (GLAD_API_PTR *PFNGLPOINTPARAMETERFVPROC)(GLenum   pname, const  GLfloat  * params);
-typedef void (GLAD_API_PTR *PFNGLPOINTPARAMETERIPROC)(GLenum   pname, GLint   param);
-typedef void (GLAD_API_PTR *PFNGLPOINTPARAMETERIVPROC)(GLenum   pname, const  GLint  * params);
-typedef void (GLAD_API_PTR *PFNGLPOINTSIZEPROC)(GLfloat   size);
-typedef void (GLAD_API_PTR *PFNGLPOLYGONMODEPROC)(GLenum   face, GLenum   mode);
-typedef void (GLAD_API_PTR *PFNGLPOLYGONOFFSETPROC)(GLfloat   factor, GLfloat   units);
-typedef void (GLAD_API_PTR *PFNGLPOLYGONSTIPPLEPROC)(const  GLubyte  * mask);
+typedef void (GLAD_API_PTR *PFNGLLOADMATRIXDPROC)(const GLdouble * m);
+typedef void (GLAD_API_PTR *PFNGLLOADMATRIXFPROC)(const GLfloat * m);
+typedef void (GLAD_API_PTR *PFNGLLOADNAMEPROC)(GLuint name);
+typedef void (GLAD_API_PTR *PFNGLLOADTRANSPOSEMATRIXDPROC)(const GLdouble * m);
+typedef void (GLAD_API_PTR *PFNGLLOADTRANSPOSEMATRIXFPROC)(const GLfloat * m);
+typedef void (GLAD_API_PTR *PFNGLLOGICOPPROC)(GLenum opcode);
+typedef void (GLAD_API_PTR *PFNGLMAP1DPROC)(GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble * points);
+typedef void (GLAD_API_PTR *PFNGLMAP1FPROC)(GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat * points);
+typedef void (GLAD_API_PTR *PFNGLMAP2DPROC)(GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble * points);
+typedef void (GLAD_API_PTR *PFNGLMAP2FPROC)(GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat * points);
+typedef void * (GLAD_API_PTR *PFNGLMAPBUFFERPROC)(GLenum target, GLenum access);
+typedef void * (GLAD_API_PTR *PFNGLMAPBUFFERRANGEPROC)(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access);
+typedef void (GLAD_API_PTR *PFNGLMAPGRID1DPROC)(GLint un, GLdouble u1, GLdouble u2);
+typedef void (GLAD_API_PTR *PFNGLMAPGRID1FPROC)(GLint un, GLfloat u1, GLfloat u2);
+typedef void (GLAD_API_PTR *PFNGLMAPGRID2DPROC)(GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2);
+typedef void (GLAD_API_PTR *PFNGLMAPGRID2FPROC)(GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2);
+typedef void (GLAD_API_PTR *PFNGLMATERIALFPROC)(GLenum face, GLenum pname, GLfloat param);
+typedef void (GLAD_API_PTR *PFNGLMATERIALFVPROC)(GLenum face, GLenum pname, const GLfloat * params);
+typedef void (GLAD_API_PTR *PFNGLMATERIALIPROC)(GLenum face, GLenum pname, GLint param);
+typedef void (GLAD_API_PTR *PFNGLMATERIALIVPROC)(GLenum face, GLenum pname, const GLint * params);
+typedef void (GLAD_API_PTR *PFNGLMATRIXMODEPROC)(GLenum mode);
+typedef void (GLAD_API_PTR *PFNGLMULTMATRIXDPROC)(const GLdouble * m);
+typedef void (GLAD_API_PTR *PFNGLMULTMATRIXFPROC)(const GLfloat * m);
+typedef void (GLAD_API_PTR *PFNGLMULTTRANSPOSEMATRIXDPROC)(const GLdouble * m);
+typedef void (GLAD_API_PTR *PFNGLMULTTRANSPOSEMATRIXFPROC)(const GLfloat * m);
+typedef void (GLAD_API_PTR *PFNGLMULTIDRAWARRAYSPROC)(GLenum mode, const GLint * first, const GLsizei * count, GLsizei drawcount);
+typedef void (GLAD_API_PTR *PFNGLMULTIDRAWELEMENTSPROC)(GLenum mode, const GLsizei * count, GLenum type, const void *const* indices, GLsizei drawcount);
+typedef void (GLAD_API_PTR *PFNGLMULTIDRAWELEMENTSBASEVERTEXPROC)(GLenum mode, const GLsizei * count, GLenum type, const void *const* indices, GLsizei drawcount, const GLint * basevertex);
+typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORD1DPROC)(GLenum target, GLdouble s);
+typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORD1DVPROC)(GLenum target, const GLdouble * v);
+typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORD1FPROC)(GLenum target, GLfloat s);
+typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORD1FVPROC)(GLenum target, const GLfloat * v);
+typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORD1IPROC)(GLenum target, GLint s);
+typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORD1IVPROC)(GLenum target, const GLint * v);
+typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORD1SPROC)(GLenum target, GLshort s);
+typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORD1SVPROC)(GLenum target, const GLshort * v);
+typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORD2DPROC)(GLenum target, GLdouble s, GLdouble t);
+typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORD2DVPROC)(GLenum target, const GLdouble * v);
+typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORD2FPROC)(GLenum target, GLfloat s, GLfloat t);
+typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORD2FVPROC)(GLenum target, const GLfloat * v);
+typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORD2IPROC)(GLenum target, GLint s, GLint t);
+typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORD2IVPROC)(GLenum target, const GLint * v);
+typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORD2SPROC)(GLenum target, GLshort s, GLshort t);
+typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORD2SVPROC)(GLenum target, const GLshort * v);
+typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORD3DPROC)(GLenum target, GLdouble s, GLdouble t, GLdouble r);
+typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORD3DVPROC)(GLenum target, const GLdouble * v);
+typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORD3FPROC)(GLenum target, GLfloat s, GLfloat t, GLfloat r);
+typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORD3FVPROC)(GLenum target, const GLfloat * v);
+typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORD3IPROC)(GLenum target, GLint s, GLint t, GLint r);
+typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORD3IVPROC)(GLenum target, const GLint * v);
+typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORD3SPROC)(GLenum target, GLshort s, GLshort t, GLshort r);
+typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORD3SVPROC)(GLenum target, const GLshort * v);
+typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORD4DPROC)(GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q);
+typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORD4DVPROC)(GLenum target, const GLdouble * v);
+typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORD4FPROC)(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q);
+typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORD4FVPROC)(GLenum target, const GLfloat * v);
+typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORD4IPROC)(GLenum target, GLint s, GLint t, GLint r, GLint q);
+typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORD4IVPROC)(GLenum target, const GLint * v);
+typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORD4SPROC)(GLenum target, GLshort s, GLshort t, GLshort r, GLshort q);
+typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORD4SVPROC)(GLenum target, const GLshort * v);
+typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORDP1UIPROC)(GLenum texture, GLenum type, GLuint coords);
+typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORDP1UIVPROC)(GLenum texture, GLenum type, const GLuint * coords);
+typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORDP2UIPROC)(GLenum texture, GLenum type, GLuint coords);
+typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORDP2UIVPROC)(GLenum texture, GLenum type, const GLuint * coords);
+typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORDP3UIPROC)(GLenum texture, GLenum type, GLuint coords);
+typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORDP3UIVPROC)(GLenum texture, GLenum type, const GLuint * coords);
+typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORDP4UIPROC)(GLenum texture, GLenum type, GLuint coords);
+typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORDP4UIVPROC)(GLenum texture, GLenum type, const GLuint * coords);
+typedef void (GLAD_API_PTR *PFNGLNEWLISTPROC)(GLuint list, GLenum mode);
+typedef void (GLAD_API_PTR *PFNGLNORMAL3BPROC)(GLbyte nx, GLbyte ny, GLbyte nz);
+typedef void (GLAD_API_PTR *PFNGLNORMAL3BVPROC)(const GLbyte * v);
+typedef void (GLAD_API_PTR *PFNGLNORMAL3DPROC)(GLdouble nx, GLdouble ny, GLdouble nz);
+typedef void (GLAD_API_PTR *PFNGLNORMAL3DVPROC)(const GLdouble * v);
+typedef void (GLAD_API_PTR *PFNGLNORMAL3FPROC)(GLfloat nx, GLfloat ny, GLfloat nz);
+typedef void (GLAD_API_PTR *PFNGLNORMAL3FVPROC)(const GLfloat * v);
+typedef void (GLAD_API_PTR *PFNGLNORMAL3IPROC)(GLint nx, GLint ny, GLint nz);
+typedef void (GLAD_API_PTR *PFNGLNORMAL3IVPROC)(const GLint * v);
+typedef void (GLAD_API_PTR *PFNGLNORMAL3SPROC)(GLshort nx, GLshort ny, GLshort nz);
+typedef void (GLAD_API_PTR *PFNGLNORMAL3SVPROC)(const GLshort * v);
+typedef void (GLAD_API_PTR *PFNGLNORMALP3UIPROC)(GLenum type, GLuint coords);
+typedef void (GLAD_API_PTR *PFNGLNORMALP3UIVPROC)(GLenum type, const GLuint * coords);
+typedef void (GLAD_API_PTR *PFNGLNORMALPOINTERPROC)(GLenum type, GLsizei stride, const void * pointer);
+typedef void (GLAD_API_PTR *PFNGLOBJECTLABELPROC)(GLenum identifier, GLuint name, GLsizei length, const GLchar * label);
+typedef void (GLAD_API_PTR *PFNGLOBJECTPTRLABELPROC)(const void * ptr, GLsizei length, const GLchar * label);
+typedef void (GLAD_API_PTR *PFNGLORTHOPROC)(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar);
+typedef void (GLAD_API_PTR *PFNGLPASSTHROUGHPROC)(GLfloat token);
+typedef void (GLAD_API_PTR *PFNGLPIXELMAPFVPROC)(GLenum map, GLsizei mapsize, const GLfloat * values);
+typedef void (GLAD_API_PTR *PFNGLPIXELMAPUIVPROC)(GLenum map, GLsizei mapsize, const GLuint * values);
+typedef void (GLAD_API_PTR *PFNGLPIXELMAPUSVPROC)(GLenum map, GLsizei mapsize, const GLushort * values);
+typedef void (GLAD_API_PTR *PFNGLPIXELSTOREFPROC)(GLenum pname, GLfloat param);
+typedef void (GLAD_API_PTR *PFNGLPIXELSTOREIPROC)(GLenum pname, GLint param);
+typedef void (GLAD_API_PTR *PFNGLPIXELTRANSFERFPROC)(GLenum pname, GLfloat param);
+typedef void (GLAD_API_PTR *PFNGLPIXELTRANSFERIPROC)(GLenum pname, GLint param);
+typedef void (GLAD_API_PTR *PFNGLPIXELZOOMPROC)(GLfloat xfactor, GLfloat yfactor);
+typedef void (GLAD_API_PTR *PFNGLPOINTPARAMETERFPROC)(GLenum pname, GLfloat param);
+typedef void (GLAD_API_PTR *PFNGLPOINTPARAMETERFVPROC)(GLenum pname, const GLfloat * params);
+typedef void (GLAD_API_PTR *PFNGLPOINTPARAMETERIPROC)(GLenum pname, GLint param);
+typedef void (GLAD_API_PTR *PFNGLPOINTPARAMETERIVPROC)(GLenum pname, const GLint * params);
+typedef void (GLAD_API_PTR *PFNGLPOINTSIZEPROC)(GLfloat size);
+typedef void (GLAD_API_PTR *PFNGLPOLYGONMODEPROC)(GLenum face, GLenum mode);
+typedef void (GLAD_API_PTR *PFNGLPOLYGONOFFSETPROC)(GLfloat factor, GLfloat units);
+typedef void (GLAD_API_PTR *PFNGLPOLYGONSTIPPLEPROC)(const GLubyte * mask);
 typedef void (GLAD_API_PTR *PFNGLPOPATTRIBPROC)(void);
 typedef void (GLAD_API_PTR *PFNGLPOPCLIENTATTRIBPROC)(void);
 typedef void (GLAD_API_PTR *PFNGLPOPDEBUGGROUPPROC)(void);
 typedef void (GLAD_API_PTR *PFNGLPOPMATRIXPROC)(void);
 typedef void (GLAD_API_PTR *PFNGLPOPNAMEPROC)(void);
-typedef void (GLAD_API_PTR *PFNGLPRIMITIVERESTARTINDEXPROC)(GLuint   index);
-typedef void (GLAD_API_PTR *PFNGLPRIORITIZETEXTURESPROC)(GLsizei   n, const  GLuint  * textures, const  GLfloat  * priorities);
-typedef void (GLAD_API_PTR *PFNGLPROVOKINGVERTEXPROC)(GLenum   mode);
-typedef void (GLAD_API_PTR *PFNGLPUSHATTRIBPROC)(GLbitfield   mask);
-typedef void (GLAD_API_PTR *PFNGLPUSHCLIENTATTRIBPROC)(GLbitfield   mask);
-typedef void (GLAD_API_PTR *PFNGLPUSHDEBUGGROUPPROC)(GLenum   source, GLuint   id, GLsizei   length, const  GLchar  * message);
+typedef void (GLAD_API_PTR *PFNGLPRIMITIVERESTARTINDEXPROC)(GLuint index);
+typedef void (GLAD_API_PTR *PFNGLPRIORITIZETEXTURESPROC)(GLsizei n, const GLuint * textures, const GLfloat * priorities);
+typedef void (GLAD_API_PTR *PFNGLPROVOKINGVERTEXPROC)(GLenum mode);
+typedef void (GLAD_API_PTR *PFNGLPUSHATTRIBPROC)(GLbitfield mask);
+typedef void (GLAD_API_PTR *PFNGLPUSHCLIENTATTRIBPROC)(GLbitfield mask);
+typedef void (GLAD_API_PTR *PFNGLPUSHDEBUGGROUPPROC)(GLenum source, GLuint id, GLsizei length, const GLchar * message);
 typedef void (GLAD_API_PTR *PFNGLPUSHMATRIXPROC)(void);
-typedef void (GLAD_API_PTR *PFNGLPUSHNAMEPROC)(GLuint   name);
-typedef void (GLAD_API_PTR *PFNGLQUERYCOUNTERPROC)(GLuint   id, GLenum   target);
-typedef void (GLAD_API_PTR *PFNGLRASTERPOS2DPROC)(GLdouble   x, GLdouble   y);
-typedef void (GLAD_API_PTR *PFNGLRASTERPOS2DVPROC)(const  GLdouble  * v);
-typedef void (GLAD_API_PTR *PFNGLRASTERPOS2FPROC)(GLfloat   x, GLfloat   y);
-typedef void (GLAD_API_PTR *PFNGLRASTERPOS2FVPROC)(const  GLfloat  * v);
-typedef void (GLAD_API_PTR *PFNGLRASTERPOS2IPROC)(GLint   x, GLint   y);
-typedef void (GLAD_API_PTR *PFNGLRASTERPOS2IVPROC)(const  GLint  * v);
-typedef void (GLAD_API_PTR *PFNGLRASTERPOS2SPROC)(GLshort   x, GLshort   y);
-typedef void (GLAD_API_PTR *PFNGLRASTERPOS2SVPROC)(const  GLshort  * v);
-typedef void (GLAD_API_PTR *PFNGLRASTERPOS3DPROC)(GLdouble   x, GLdouble   y, GLdouble   z);
-typedef void (GLAD_API_PTR *PFNGLRASTERPOS3DVPROC)(const  GLdouble  * v);
-typedef void (GLAD_API_PTR *PFNGLRASTERPOS3FPROC)(GLfloat   x, GLfloat   y, GLfloat   z);
-typedef void (GLAD_API_PTR *PFNGLRASTERPOS3FVPROC)(const  GLfloat  * v);
-typedef void (GLAD_API_PTR *PFNGLRASTERPOS3IPROC)(GLint   x, GLint   y, GLint   z);
-typedef void (GLAD_API_PTR *PFNGLRASTERPOS3IVPROC)(const  GLint  * v);
-typedef void (GLAD_API_PTR *PFNGLRASTERPOS3SPROC)(GLshort   x, GLshort   y, GLshort   z);
-typedef void (GLAD_API_PTR *PFNGLRASTERPOS3SVPROC)(const  GLshort  * v);
-typedef void (GLAD_API_PTR *PFNGLRASTERPOS4DPROC)(GLdouble   x, GLdouble   y, GLdouble   z, GLdouble   w);
-typedef void (GLAD_API_PTR *PFNGLRASTERPOS4DVPROC)(const  GLdouble  * v);
-typedef void (GLAD_API_PTR *PFNGLRASTERPOS4FPROC)(GLfloat   x, GLfloat   y, GLfloat   z, GLfloat   w);
-typedef void (GLAD_API_PTR *PFNGLRASTERPOS4FVPROC)(const  GLfloat  * v);
-typedef void (GLAD_API_PTR *PFNGLRASTERPOS4IPROC)(GLint   x, GLint   y, GLint   z, GLint   w);
-typedef void (GLAD_API_PTR *PFNGLRASTERPOS4IVPROC)(const  GLint  * v);
-typedef void (GLAD_API_PTR *PFNGLRASTERPOS4SPROC)(GLshort   x, GLshort   y, GLshort   z, GLshort   w);
-typedef void (GLAD_API_PTR *PFNGLRASTERPOS4SVPROC)(const  GLshort  * v);
-typedef void (GLAD_API_PTR *PFNGLREADBUFFERPROC)(GLenum   src);
-typedef void (GLAD_API_PTR *PFNGLREADPIXELSPROC)(GLint   x, GLint   y, GLsizei   width, GLsizei   height, GLenum   format, GLenum   type, void * pixels);
-typedef void (GLAD_API_PTR *PFNGLREADNPIXELSPROC)(GLint   x, GLint   y, GLsizei   width, GLsizei   height, GLenum   format, GLenum   type, GLsizei   bufSize, void * data);
-typedef void (GLAD_API_PTR *PFNGLREADNPIXELSARBPROC)(GLint   x, GLint   y, GLsizei   width, GLsizei   height, GLenum   format, GLenum   type, GLsizei   bufSize, void * data);
-typedef void (GLAD_API_PTR *PFNGLRECTDPROC)(GLdouble   x1, GLdouble   y1, GLdouble   x2, GLdouble   y2);
-typedef void (GLAD_API_PTR *PFNGLRECTDVPROC)(const  GLdouble  * v1, const  GLdouble  * v2);
-typedef void (GLAD_API_PTR *PFNGLRECTFPROC)(GLfloat   x1, GLfloat   y1, GLfloat   x2, GLfloat   y2);
-typedef void (GLAD_API_PTR *PFNGLRECTFVPROC)(const  GLfloat  * v1, const  GLfloat  * v2);
-typedef void (GLAD_API_PTR *PFNGLRECTIPROC)(GLint   x1, GLint   y1, GLint   x2, GLint   y2);
-typedef void (GLAD_API_PTR *PFNGLRECTIVPROC)(const  GLint  * v1, const  GLint  * v2);
-typedef void (GLAD_API_PTR *PFNGLRECTSPROC)(GLshort   x1, GLshort   y1, GLshort   x2, GLshort   y2);
-typedef void (GLAD_API_PTR *PFNGLRECTSVPROC)(const  GLshort  * v1, const  GLshort  * v2);
-typedef GLint (GLAD_API_PTR *PFNGLRENDERMODEPROC)(GLenum   mode);
-typedef void (GLAD_API_PTR *PFNGLRENDERBUFFERSTORAGEPROC)(GLenum   target, GLenum   internalformat, GLsizei   width, GLsizei   height);
-typedef void (GLAD_API_PTR *PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC)(GLenum   target, GLsizei   samples, GLenum   internalformat, GLsizei   width, GLsizei   height);
-typedef void (GLAD_API_PTR *PFNGLROTATEDPROC)(GLdouble   angle, GLdouble   x, GLdouble   y, GLdouble   z);
-typedef void (GLAD_API_PTR *PFNGLROTATEFPROC)(GLfloat   angle, GLfloat   x, GLfloat   y, GLfloat   z);
-typedef void (GLAD_API_PTR *PFNGLSAMPLECOVERAGEPROC)(GLfloat   value, GLboolean   invert);
-typedef void (GLAD_API_PTR *PFNGLSAMPLECOVERAGEARBPROC)(GLfloat   value, GLboolean   invert);
-typedef void (GLAD_API_PTR *PFNGLSAMPLEMASKIPROC)(GLuint   maskNumber, GLbitfield   mask);
-typedef void (GLAD_API_PTR *PFNGLSAMPLERPARAMETERIIVPROC)(GLuint   sampler, GLenum   pname, const  GLint  * param);
-typedef void (GLAD_API_PTR *PFNGLSAMPLERPARAMETERIUIVPROC)(GLuint   sampler, GLenum   pname, const  GLuint  * param);
-typedef void (GLAD_API_PTR *PFNGLSAMPLERPARAMETERFPROC)(GLuint   sampler, GLenum   pname, GLfloat   param);
-typedef void (GLAD_API_PTR *PFNGLSAMPLERPARAMETERFVPROC)(GLuint   sampler, GLenum   pname, const  GLfloat  * param);
-typedef void (GLAD_API_PTR *PFNGLSAMPLERPARAMETERIPROC)(GLuint   sampler, GLenum   pname, GLint   param);
-typedef void (GLAD_API_PTR *PFNGLSAMPLERPARAMETERIVPROC)(GLuint   sampler, GLenum   pname, const  GLint  * param);
-typedef void (GLAD_API_PTR *PFNGLSCALEDPROC)(GLdouble   x, GLdouble   y, GLdouble   z);
-typedef void (GLAD_API_PTR *PFNGLSCALEFPROC)(GLfloat   x, GLfloat   y, GLfloat   z);
-typedef void (GLAD_API_PTR *PFNGLSCISSORPROC)(GLint   x, GLint   y, GLsizei   width, GLsizei   height);
-typedef void (GLAD_API_PTR *PFNGLSECONDARYCOLOR3BPROC)(GLbyte   red, GLbyte   green, GLbyte   blue);
-typedef void (GLAD_API_PTR *PFNGLSECONDARYCOLOR3BVPROC)(const  GLbyte  * v);
-typedef void (GLAD_API_PTR *PFNGLSECONDARYCOLOR3DPROC)(GLdouble   red, GLdouble   green, GLdouble   blue);
-typedef void (GLAD_API_PTR *PFNGLSECONDARYCOLOR3DVPROC)(const  GLdouble  * v);
-typedef void (GLAD_API_PTR *PFNGLSECONDARYCOLOR3FPROC)(GLfloat   red, GLfloat   green, GLfloat   blue);
-typedef void (GLAD_API_PTR *PFNGLSECONDARYCOLOR3FVPROC)(const  GLfloat  * v);
-typedef void (GLAD_API_PTR *PFNGLSECONDARYCOLOR3IPROC)(GLint   red, GLint   green, GLint   blue);
-typedef void (GLAD_API_PTR *PFNGLSECONDARYCOLOR3IVPROC)(const  GLint  * v);
-typedef void (GLAD_API_PTR *PFNGLSECONDARYCOLOR3SPROC)(GLshort   red, GLshort   green, GLshort   blue);
-typedef void (GLAD_API_PTR *PFNGLSECONDARYCOLOR3SVPROC)(const  GLshort  * v);
-typedef void (GLAD_API_PTR *PFNGLSECONDARYCOLOR3UBPROC)(GLubyte   red, GLubyte   green, GLubyte   blue);
-typedef void (GLAD_API_PTR *PFNGLSECONDARYCOLOR3UBVPROC)(const  GLubyte  * v);
-typedef void (GLAD_API_PTR *PFNGLSECONDARYCOLOR3UIPROC)(GLuint   red, GLuint   green, GLuint   blue);
-typedef void (GLAD_API_PTR *PFNGLSECONDARYCOLOR3UIVPROC)(const  GLuint  * v);
-typedef void (GLAD_API_PTR *PFNGLSECONDARYCOLOR3USPROC)(GLushort   red, GLushort   green, GLushort   blue);
-typedef void (GLAD_API_PTR *PFNGLSECONDARYCOLOR3USVPROC)(const  GLushort  * v);
-typedef void (GLAD_API_PTR *PFNGLSECONDARYCOLORP3UIPROC)(GLenum   type, GLuint   color);
-typedef void (GLAD_API_PTR *PFNGLSECONDARYCOLORP3UIVPROC)(GLenum   type, const  GLuint  * color);
-typedef void (GLAD_API_PTR *PFNGLSECONDARYCOLORPOINTERPROC)(GLint   size, GLenum   type, GLsizei   stride, const void * pointer);
-typedef void (GLAD_API_PTR *PFNGLSELECTBUFFERPROC)(GLsizei   size, GLuint  * buffer);
-typedef void (GLAD_API_PTR *PFNGLSHADEMODELPROC)(GLenum   mode);
-typedef void (GLAD_API_PTR *PFNGLSHADERSOURCEPROC)(GLuint   shader, GLsizei   count, const  GLchar  *const* string, const  GLint  * length);
-typedef void (GLAD_API_PTR *PFNGLSTENCILFUNCPROC)(GLenum   func, GLint   ref, GLuint   mask);
-typedef void (GLAD_API_PTR *PFNGLSTENCILFUNCSEPARATEPROC)(GLenum   face, GLenum   func, GLint   ref, GLuint   mask);
-typedef void (GLAD_API_PTR *PFNGLSTENCILMASKPROC)(GLuint   mask);
-typedef void (GLAD_API_PTR *PFNGLSTENCILMASKSEPARATEPROC)(GLenum   face, GLuint   mask);
-typedef void (GLAD_API_PTR *PFNGLSTENCILOPPROC)(GLenum   fail, GLenum   zfail, GLenum   zpass);
-typedef void (GLAD_API_PTR *PFNGLSTENCILOPSEPARATEPROC)(GLenum   face, GLenum   sfail, GLenum   dpfail, GLenum   dppass);
-typedef void (GLAD_API_PTR *PFNGLTEXBUFFERPROC)(GLenum   target, GLenum   internalformat, GLuint   buffer);
-typedef void (GLAD_API_PTR *PFNGLTEXCOORD1DPROC)(GLdouble   s);
-typedef void (GLAD_API_PTR *PFNGLTEXCOORD1DVPROC)(const  GLdouble  * v);
-typedef void (GLAD_API_PTR *PFNGLTEXCOORD1FPROC)(GLfloat   s);
-typedef void (GLAD_API_PTR *PFNGLTEXCOORD1FVPROC)(const  GLfloat  * v);
-typedef void (GLAD_API_PTR *PFNGLTEXCOORD1IPROC)(GLint   s);
-typedef void (GLAD_API_PTR *PFNGLTEXCOORD1IVPROC)(const  GLint  * v);
-typedef void (GLAD_API_PTR *PFNGLTEXCOORD1SPROC)(GLshort   s);
-typedef void (GLAD_API_PTR *PFNGLTEXCOORD1SVPROC)(const  GLshort  * v);
-typedef void (GLAD_API_PTR *PFNGLTEXCOORD2DPROC)(GLdouble   s, GLdouble   t);
-typedef void (GLAD_API_PTR *PFNGLTEXCOORD2DVPROC)(const  GLdouble  * v);
-typedef void (GLAD_API_PTR *PFNGLTEXCOORD2FPROC)(GLfloat   s, GLfloat   t);
-typedef void (GLAD_API_PTR *PFNGLTEXCOORD2FVPROC)(const  GLfloat  * v);
-typedef void (GLAD_API_PTR *PFNGLTEXCOORD2IPROC)(GLint   s, GLint   t);
-typedef void (GLAD_API_PTR *PFNGLTEXCOORD2IVPROC)(const  GLint  * v);
-typedef void (GLAD_API_PTR *PFNGLTEXCOORD2SPROC)(GLshort   s, GLshort   t);
-typedef void (GLAD_API_PTR *PFNGLTEXCOORD2SVPROC)(const  GLshort  * v);
-typedef void (GLAD_API_PTR *PFNGLTEXCOORD3DPROC)(GLdouble   s, GLdouble   t, GLdouble   r);
-typedef void (GLAD_API_PTR *PFNGLTEXCOORD3DVPROC)(const  GLdouble  * v);
-typedef void (GLAD_API_PTR *PFNGLTEXCOORD3FPROC)(GLfloat   s, GLfloat   t, GLfloat   r);
-typedef void (GLAD_API_PTR *PFNGLTEXCOORD3FVPROC)(const  GLfloat  * v);
-typedef void (GLAD_API_PTR *PFNGLTEXCOORD3IPROC)(GLint   s, GLint   t, GLint   r);
-typedef void (GLAD_API_PTR *PFNGLTEXCOORD3IVPROC)(const  GLint  * v);
-typedef void (GLAD_API_PTR *PFNGLTEXCOORD3SPROC)(GLshort   s, GLshort   t, GLshort   r);
-typedef void (GLAD_API_PTR *PFNGLTEXCOORD3SVPROC)(const  GLshort  * v);
-typedef void (GLAD_API_PTR *PFNGLTEXCOORD4DPROC)(GLdouble   s, GLdouble   t, GLdouble   r, GLdouble   q);
-typedef void (GLAD_API_PTR *PFNGLTEXCOORD4DVPROC)(const  GLdouble  * v);
-typedef void (GLAD_API_PTR *PFNGLTEXCOORD4FPROC)(GLfloat   s, GLfloat   t, GLfloat   r, GLfloat   q);
-typedef void (GLAD_API_PTR *PFNGLTEXCOORD4FVPROC)(const  GLfloat  * v);
-typedef void (GLAD_API_PTR *PFNGLTEXCOORD4IPROC)(GLint   s, GLint   t, GLint   r, GLint   q);
-typedef void (GLAD_API_PTR *PFNGLTEXCOORD4IVPROC)(const  GLint  * v);
-typedef void (GLAD_API_PTR *PFNGLTEXCOORD4SPROC)(GLshort   s, GLshort   t, GLshort   r, GLshort   q);
-typedef void (GLAD_API_PTR *PFNGLTEXCOORD4SVPROC)(const  GLshort  * v);
-typedef void (GLAD_API_PTR *PFNGLTEXCOORDP1UIPROC)(GLenum   type, GLuint   coords);
-typedef void (GLAD_API_PTR *PFNGLTEXCOORDP1UIVPROC)(GLenum   type, const  GLuint  * coords);
-typedef void (GLAD_API_PTR *PFNGLTEXCOORDP2UIPROC)(GLenum   type, GLuint   coords);
-typedef void (GLAD_API_PTR *PFNGLTEXCOORDP2UIVPROC)(GLenum   type, const  GLuint  * coords);
-typedef void (GLAD_API_PTR *PFNGLTEXCOORDP3UIPROC)(GLenum   type, GLuint   coords);
-typedef void (GLAD_API_PTR *PFNGLTEXCOORDP3UIVPROC)(GLenum   type, const  GLuint  * coords);
-typedef void (GLAD_API_PTR *PFNGLTEXCOORDP4UIPROC)(GLenum   type, GLuint   coords);
-typedef void (GLAD_API_PTR *PFNGLTEXCOORDP4UIVPROC)(GLenum   type, const  GLuint  * coords);
-typedef void (GLAD_API_PTR *PFNGLTEXCOORDPOINTERPROC)(GLint   size, GLenum   type, GLsizei   stride, const void * pointer);
-typedef void (GLAD_API_PTR *PFNGLTEXENVFPROC)(GLenum   target, GLenum   pname, GLfloat   param);
-typedef void (GLAD_API_PTR *PFNGLTEXENVFVPROC)(GLenum   target, GLenum   pname, const  GLfloat  * params);
-typedef void (GLAD_API_PTR *PFNGLTEXENVIPROC)(GLenum   target, GLenum   pname, GLint   param);
-typedef void (GLAD_API_PTR *PFNGLTEXENVIVPROC)(GLenum   target, GLenum   pname, const  GLint  * params);
-typedef void (GLAD_API_PTR *PFNGLTEXGENDPROC)(GLenum   coord, GLenum   pname, GLdouble   param);
-typedef void (GLAD_API_PTR *PFNGLTEXGENDVPROC)(GLenum   coord, GLenum   pname, const  GLdouble  * params);
-typedef void (GLAD_API_PTR *PFNGLTEXGENFPROC)(GLenum   coord, GLenum   pname, GLfloat   param);
-typedef void (GLAD_API_PTR *PFNGLTEXGENFVPROC)(GLenum   coord, GLenum   pname, const  GLfloat  * params);
-typedef void (GLAD_API_PTR *PFNGLTEXGENIPROC)(GLenum   coord, GLenum   pname, GLint   param);
-typedef void (GLAD_API_PTR *PFNGLTEXGENIVPROC)(GLenum   coord, GLenum   pname, const  GLint  * params);
-typedef void (GLAD_API_PTR *PFNGLTEXIMAGE1DPROC)(GLenum   target, GLint   level, GLint   internalformat, GLsizei   width, GLint   border, GLenum   format, GLenum   type, const void * pixels);
-typedef void (GLAD_API_PTR *PFNGLTEXIMAGE2DPROC)(GLenum   target, GLint   level, GLint   internalformat, GLsizei   width, GLsizei   height, GLint   border, GLenum   format, GLenum   type, const void * pixels);
-typedef void (GLAD_API_PTR *PFNGLTEXIMAGE2DMULTISAMPLEPROC)(GLenum   target, GLsizei   samples, GLenum   internalformat, GLsizei   width, GLsizei   height, GLboolean   fixedsamplelocations);
-typedef void (GLAD_API_PTR *PFNGLTEXIMAGE3DPROC)(GLenum   target, GLint   level, GLint   internalformat, GLsizei   width, GLsizei   height, GLsizei   depth, GLint   border, GLenum   format, GLenum   type, const void * pixels);
-typedef void (GLAD_API_PTR *PFNGLTEXIMAGE3DMULTISAMPLEPROC)(GLenum   target, GLsizei   samples, GLenum   internalformat, GLsizei   width, GLsizei   height, GLsizei   depth, GLboolean   fixedsamplelocations);
-typedef void (GLAD_API_PTR *PFNGLTEXPARAMETERIIVPROC)(GLenum   target, GLenum   pname, const  GLint  * params);
-typedef void (GLAD_API_PTR *PFNGLTEXPARAMETERIUIVPROC)(GLenum   target, GLenum   pname, const  GLuint  * params);
-typedef void (GLAD_API_PTR *PFNGLTEXPARAMETERFPROC)(GLenum   target, GLenum   pname, GLfloat   param);
-typedef void (GLAD_API_PTR *PFNGLTEXPARAMETERFVPROC)(GLenum   target, GLenum   pname, const  GLfloat  * params);
-typedef void (GLAD_API_PTR *PFNGLTEXPARAMETERIPROC)(GLenum   target, GLenum   pname, GLint   param);
-typedef void (GLAD_API_PTR *PFNGLTEXPARAMETERIVPROC)(GLenum   target, GLenum   pname, const  GLint  * params);
-typedef void (GLAD_API_PTR *PFNGLTEXSUBIMAGE1DPROC)(GLenum   target, GLint   level, GLint   xoffset, GLsizei   width, GLenum   format, GLenum   type, const void * pixels);
-typedef void (GLAD_API_PTR *PFNGLTEXSUBIMAGE2DPROC)(GLenum   target, GLint   level, GLint   xoffset, GLint   yoffset, GLsizei   width, GLsizei   height, GLenum   format, GLenum   type, const void * pixels);
-typedef void (GLAD_API_PTR *PFNGLTEXSUBIMAGE3DPROC)(GLenum   target, GLint   level, GLint   xoffset, GLint   yoffset, GLint   zoffset, GLsizei   width, GLsizei   height, GLsizei   depth, GLenum   format, GLenum   type, const void * pixels);
-typedef void (GLAD_API_PTR *PFNGLTRANSFORMFEEDBACKVARYINGSPROC)(GLuint   program, GLsizei   count, const  GLchar  *const* varyings, GLenum   bufferMode);
-typedef void (GLAD_API_PTR *PFNGLTRANSLATEDPROC)(GLdouble   x, GLdouble   y, GLdouble   z);
-typedef void (GLAD_API_PTR *PFNGLTRANSLATEFPROC)(GLfloat   x, GLfloat   y, GLfloat   z);
-typedef void (GLAD_API_PTR *PFNGLUNIFORM1FPROC)(GLint   location, GLfloat   v0);
-typedef void (GLAD_API_PTR *PFNGLUNIFORM1FVPROC)(GLint   location, GLsizei   count, const  GLfloat  * value);
-typedef void (GLAD_API_PTR *PFNGLUNIFORM1IPROC)(GLint   location, GLint   v0);
-typedef void (GLAD_API_PTR *PFNGLUNIFORM1IVPROC)(GLint   location, GLsizei   count, const  GLint  * value);
-typedef void (GLAD_API_PTR *PFNGLUNIFORM1UIPROC)(GLint   location, GLuint   v0);
-typedef void (GLAD_API_PTR *PFNGLUNIFORM1UIVPROC)(GLint   location, GLsizei   count, const  GLuint  * value);
-typedef void (GLAD_API_PTR *PFNGLUNIFORM2FPROC)(GLint   location, GLfloat   v0, GLfloat   v1);
-typedef void (GLAD_API_PTR *PFNGLUNIFORM2FVPROC)(GLint   location, GLsizei   count, const  GLfloat  * value);
-typedef void (GLAD_API_PTR *PFNGLUNIFORM2IPROC)(GLint   location, GLint   v0, GLint   v1);
-typedef void (GLAD_API_PTR *PFNGLUNIFORM2IVPROC)(GLint   location, GLsizei   count, const  GLint  * value);
-typedef void (GLAD_API_PTR *PFNGLUNIFORM2UIPROC)(GLint   location, GLuint   v0, GLuint   v1);
-typedef void (GLAD_API_PTR *PFNGLUNIFORM2UIVPROC)(GLint   location, GLsizei   count, const  GLuint  * value);
-typedef void (GLAD_API_PTR *PFNGLUNIFORM3FPROC)(GLint   location, GLfloat   v0, GLfloat   v1, GLfloat   v2);
-typedef void (GLAD_API_PTR *PFNGLUNIFORM3FVPROC)(GLint   location, GLsizei   count, const  GLfloat  * value);
-typedef void (GLAD_API_PTR *PFNGLUNIFORM3IPROC)(GLint   location, GLint   v0, GLint   v1, GLint   v2);
-typedef void (GLAD_API_PTR *PFNGLUNIFORM3IVPROC)(GLint   location, GLsizei   count, const  GLint  * value);
-typedef void (GLAD_API_PTR *PFNGLUNIFORM3UIPROC)(GLint   location, GLuint   v0, GLuint   v1, GLuint   v2);
-typedef void (GLAD_API_PTR *PFNGLUNIFORM3UIVPROC)(GLint   location, GLsizei   count, const  GLuint  * value);
-typedef void (GLAD_API_PTR *PFNGLUNIFORM4FPROC)(GLint   location, GLfloat   v0, GLfloat   v1, GLfloat   v2, GLfloat   v3);
-typedef void (GLAD_API_PTR *PFNGLUNIFORM4FVPROC)(GLint   location, GLsizei   count, const  GLfloat  * value);
-typedef void (GLAD_API_PTR *PFNGLUNIFORM4IPROC)(GLint   location, GLint   v0, GLint   v1, GLint   v2, GLint   v3);
-typedef void (GLAD_API_PTR *PFNGLUNIFORM4IVPROC)(GLint   location, GLsizei   count, const  GLint  * value);
-typedef void (GLAD_API_PTR *PFNGLUNIFORM4UIPROC)(GLint   location, GLuint   v0, GLuint   v1, GLuint   v2, GLuint   v3);
-typedef void (GLAD_API_PTR *PFNGLUNIFORM4UIVPROC)(GLint   location, GLsizei   count, const  GLuint  * value);
-typedef void (GLAD_API_PTR *PFNGLUNIFORMBLOCKBINDINGPROC)(GLuint   program, GLuint   uniformBlockIndex, GLuint   uniformBlockBinding);
-typedef void (GLAD_API_PTR *PFNGLUNIFORMMATRIX2FVPROC)(GLint   location, GLsizei   count, GLboolean   transpose, const  GLfloat  * value);
-typedef void (GLAD_API_PTR *PFNGLUNIFORMMATRIX2X3FVPROC)(GLint   location, GLsizei   count, GLboolean   transpose, const  GLfloat  * value);
-typedef void (GLAD_API_PTR *PFNGLUNIFORMMATRIX2X4FVPROC)(GLint   location, GLsizei   count, GLboolean   transpose, const  GLfloat  * value);
-typedef void (GLAD_API_PTR *PFNGLUNIFORMMATRIX3FVPROC)(GLint   location, GLsizei   count, GLboolean   transpose, const  GLfloat  * value);
-typedef void (GLAD_API_PTR *PFNGLUNIFORMMATRIX3X2FVPROC)(GLint   location, GLsizei   count, GLboolean   transpose, const  GLfloat  * value);
-typedef void (GLAD_API_PTR *PFNGLUNIFORMMATRIX3X4FVPROC)(GLint   location, GLsizei   count, GLboolean   transpose, const  GLfloat  * value);
-typedef void (GLAD_API_PTR *PFNGLUNIFORMMATRIX4FVPROC)(GLint   location, GLsizei   count, GLboolean   transpose, const  GLfloat  * value);
-typedef void (GLAD_API_PTR *PFNGLUNIFORMMATRIX4X2FVPROC)(GLint   location, GLsizei   count, GLboolean   transpose, const  GLfloat  * value);
-typedef void (GLAD_API_PTR *PFNGLUNIFORMMATRIX4X3FVPROC)(GLint   location, GLsizei   count, GLboolean   transpose, const  GLfloat  * value);
-typedef GLboolean (GLAD_API_PTR *PFNGLUNMAPBUFFERPROC)(GLenum   target);
-typedef void (GLAD_API_PTR *PFNGLUSEPROGRAMPROC)(GLuint   program);
-typedef void (GLAD_API_PTR *PFNGLVALIDATEPROGRAMPROC)(GLuint   program);
-typedef void (GLAD_API_PTR *PFNGLVERTEX2DPROC)(GLdouble   x, GLdouble   y);
-typedef void (GLAD_API_PTR *PFNGLVERTEX2DVPROC)(const  GLdouble  * v);
-typedef void (GLAD_API_PTR *PFNGLVERTEX2FPROC)(GLfloat   x, GLfloat   y);
-typedef void (GLAD_API_PTR *PFNGLVERTEX2FVPROC)(const  GLfloat  * v);
-typedef void (GLAD_API_PTR *PFNGLVERTEX2IPROC)(GLint   x, GLint   y);
-typedef void (GLAD_API_PTR *PFNGLVERTEX2IVPROC)(const  GLint  * v);
-typedef void (GLAD_API_PTR *PFNGLVERTEX2SPROC)(GLshort   x, GLshort   y);
-typedef void (GLAD_API_PTR *PFNGLVERTEX2SVPROC)(const  GLshort  * v);
-typedef void (GLAD_API_PTR *PFNGLVERTEX3DPROC)(GLdouble   x, GLdouble   y, GLdouble   z);
-typedef void (GLAD_API_PTR *PFNGLVERTEX3DVPROC)(const  GLdouble  * v);
-typedef void (GLAD_API_PTR *PFNGLVERTEX3FPROC)(GLfloat   x, GLfloat   y, GLfloat   z);
-typedef void (GLAD_API_PTR *PFNGLVERTEX3FVPROC)(const  GLfloat  * v);
-typedef void (GLAD_API_PTR *PFNGLVERTEX3IPROC)(GLint   x, GLint   y, GLint   z);
-typedef void (GLAD_API_PTR *PFNGLVERTEX3IVPROC)(const  GLint  * v);
-typedef void (GLAD_API_PTR *PFNGLVERTEX3SPROC)(GLshort   x, GLshort   y, GLshort   z);
-typedef void (GLAD_API_PTR *PFNGLVERTEX3SVPROC)(const  GLshort  * v);
-typedef void (GLAD_API_PTR *PFNGLVERTEX4DPROC)(GLdouble   x, GLdouble   y, GLdouble   z, GLdouble   w);
-typedef void (GLAD_API_PTR *PFNGLVERTEX4DVPROC)(const  GLdouble  * v);
-typedef void (GLAD_API_PTR *PFNGLVERTEX4FPROC)(GLfloat   x, GLfloat   y, GLfloat   z, GLfloat   w);
-typedef void (GLAD_API_PTR *PFNGLVERTEX4FVPROC)(const  GLfloat  * v);
-typedef void (GLAD_API_PTR *PFNGLVERTEX4IPROC)(GLint   x, GLint   y, GLint   z, GLint   w);
-typedef void (GLAD_API_PTR *PFNGLVERTEX4IVPROC)(const  GLint  * v);
-typedef void (GLAD_API_PTR *PFNGLVERTEX4SPROC)(GLshort   x, GLshort   y, GLshort   z, GLshort   w);
-typedef void (GLAD_API_PTR *PFNGLVERTEX4SVPROC)(const  GLshort  * v);
-typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB1DPROC)(GLuint   index, GLdouble   x);
-typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB1DVPROC)(GLuint   index, const  GLdouble  * v);
-typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB1FPROC)(GLuint   index, GLfloat   x);
-typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB1FVPROC)(GLuint   index, const  GLfloat  * v);
-typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB1SPROC)(GLuint   index, GLshort   x);
-typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB1SVPROC)(GLuint   index, const  GLshort  * v);
-typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB2DPROC)(GLuint   index, GLdouble   x, GLdouble   y);
-typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB2DVPROC)(GLuint   index, const  GLdouble  * v);
-typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB2FPROC)(GLuint   index, GLfloat   x, GLfloat   y);
-typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB2FVPROC)(GLuint   index, const  GLfloat  * v);
-typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB2SPROC)(GLuint   index, GLshort   x, GLshort   y);
-typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB2SVPROC)(GLuint   index, const  GLshort  * v);
-typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB3DPROC)(GLuint   index, GLdouble   x, GLdouble   y, GLdouble   z);
-typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB3DVPROC)(GLuint   index, const  GLdouble  * v);
-typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB3FPROC)(GLuint   index, GLfloat   x, GLfloat   y, GLfloat   z);
-typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB3FVPROC)(GLuint   index, const  GLfloat  * v);
-typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB3SPROC)(GLuint   index, GLshort   x, GLshort   y, GLshort   z);
-typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB3SVPROC)(GLuint   index, const  GLshort  * v);
-typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB4NBVPROC)(GLuint   index, const  GLbyte  * v);
-typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB4NIVPROC)(GLuint   index, const  GLint  * v);
-typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB4NSVPROC)(GLuint   index, const  GLshort  * v);
-typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB4NUBPROC)(GLuint   index, GLubyte   x, GLubyte   y, GLubyte   z, GLubyte   w);
-typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB4NUBVPROC)(GLuint   index, const  GLubyte  * v);
-typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB4NUIVPROC)(GLuint   index, const  GLuint  * v);
-typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB4NUSVPROC)(GLuint   index, const  GLushort  * v);
-typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB4BVPROC)(GLuint   index, const  GLbyte  * v);
-typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB4DPROC)(GLuint   index, GLdouble   x, GLdouble   y, GLdouble   z, GLdouble   w);
-typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB4DVPROC)(GLuint   index, const  GLdouble  * v);
-typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB4FPROC)(GLuint   index, GLfloat   x, GLfloat   y, GLfloat   z, GLfloat   w);
-typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB4FVPROC)(GLuint   index, const  GLfloat  * v);
-typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB4IVPROC)(GLuint   index, const  GLint  * v);
-typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB4SPROC)(GLuint   index, GLshort   x, GLshort   y, GLshort   z, GLshort   w);
-typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB4SVPROC)(GLuint   index, const  GLshort  * v);
-typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB4UBVPROC)(GLuint   index, const  GLubyte  * v);
-typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB4UIVPROC)(GLuint   index, const  GLuint  * v);
-typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB4USVPROC)(GLuint   index, const  GLushort  * v);
-typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBDIVISORPROC)(GLuint   index, GLuint   divisor);
-typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBI1IPROC)(GLuint   index, GLint   x);
-typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBI1IVPROC)(GLuint   index, const  GLint  * v);
-typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBI1UIPROC)(GLuint   index, GLuint   x);
-typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBI1UIVPROC)(GLuint   index, const  GLuint  * v);
-typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBI2IPROC)(GLuint   index, GLint   x, GLint   y);
-typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBI2IVPROC)(GLuint   index, const  GLint  * v);
-typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBI2UIPROC)(GLuint   index, GLuint   x, GLuint   y);
-typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBI2UIVPROC)(GLuint   index, const  GLuint  * v);
-typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBI3IPROC)(GLuint   index, GLint   x, GLint   y, GLint   z);
-typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBI3IVPROC)(GLuint   index, const  GLint  * v);
-typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBI3UIPROC)(GLuint   index, GLuint   x, GLuint   y, GLuint   z);
-typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBI3UIVPROC)(GLuint   index, const  GLuint  * v);
-typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBI4BVPROC)(GLuint   index, const  GLbyte  * v);
-typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBI4IPROC)(GLuint   index, GLint   x, GLint   y, GLint   z, GLint   w);
-typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBI4IVPROC)(GLuint   index, const  GLint  * v);
-typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBI4SVPROC)(GLuint   index, const  GLshort  * v);
-typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBI4UBVPROC)(GLuint   index, const  GLubyte  * v);
-typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBI4UIPROC)(GLuint   index, GLuint   x, GLuint   y, GLuint   z, GLuint   w);
-typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBI4UIVPROC)(GLuint   index, const  GLuint  * v);
-typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBI4USVPROC)(GLuint   index, const  GLushort  * v);
-typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBIPOINTERPROC)(GLuint   index, GLint   size, GLenum   type, GLsizei   stride, const void * pointer);
-typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBP1UIPROC)(GLuint   index, GLenum   type, GLboolean   normalized, GLuint   value);
-typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBP1UIVPROC)(GLuint   index, GLenum   type, GLboolean   normalized, const  GLuint  * value);
-typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBP2UIPROC)(GLuint   index, GLenum   type, GLboolean   normalized, GLuint   value);
-typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBP2UIVPROC)(GLuint   index, GLenum   type, GLboolean   normalized, const  GLuint  * value);
-typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBP3UIPROC)(GLuint   index, GLenum   type, GLboolean   normalized, GLuint   value);
-typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBP3UIVPROC)(GLuint   index, GLenum   type, GLboolean   normalized, const  GLuint  * value);
-typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBP4UIPROC)(GLuint   index, GLenum   type, GLboolean   normalized, GLuint   value);
-typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBP4UIVPROC)(GLuint   index, GLenum   type, GLboolean   normalized, const  GLuint  * value);
-typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBPOINTERPROC)(GLuint   index, GLint   size, GLenum   type, GLboolean   normalized, GLsizei   stride, const void * pointer);
-typedef void (GLAD_API_PTR *PFNGLVERTEXP2UIPROC)(GLenum   type, GLuint   value);
-typedef void (GLAD_API_PTR *PFNGLVERTEXP2UIVPROC)(GLenum   type, const  GLuint  * value);
-typedef void (GLAD_API_PTR *PFNGLVERTEXP3UIPROC)(GLenum   type, GLuint   value);
-typedef void (GLAD_API_PTR *PFNGLVERTEXP3UIVPROC)(GLenum   type, const  GLuint  * value);
-typedef void (GLAD_API_PTR *PFNGLVERTEXP4UIPROC)(GLenum   type, GLuint   value);
-typedef void (GLAD_API_PTR *PFNGLVERTEXP4UIVPROC)(GLenum   type, const  GLuint  * value);
-typedef void (GLAD_API_PTR *PFNGLVERTEXPOINTERPROC)(GLint   size, GLenum   type, GLsizei   stride, const void * pointer);
-typedef void (GLAD_API_PTR *PFNGLVIEWPORTPROC)(GLint   x, GLint   y, GLsizei   width, GLsizei   height);
-typedef void (GLAD_API_PTR *PFNGLWAITSYNCPROC)(GLsync   sync, GLbitfield   flags, GLuint64   timeout);
-typedef void (GLAD_API_PTR *PFNGLWINDOWPOS2DPROC)(GLdouble   x, GLdouble   y);
-typedef void (GLAD_API_PTR *PFNGLWINDOWPOS2DVPROC)(const  GLdouble  * v);
-typedef void (GLAD_API_PTR *PFNGLWINDOWPOS2FPROC)(GLfloat   x, GLfloat   y);
-typedef void (GLAD_API_PTR *PFNGLWINDOWPOS2FVPROC)(const  GLfloat  * v);
-typedef void (GLAD_API_PTR *PFNGLWINDOWPOS2IPROC)(GLint   x, GLint   y);
-typedef void (GLAD_API_PTR *PFNGLWINDOWPOS2IVPROC)(const  GLint  * v);
-typedef void (GLAD_API_PTR *PFNGLWINDOWPOS2SPROC)(GLshort   x, GLshort   y);
-typedef void (GLAD_API_PTR *PFNGLWINDOWPOS2SVPROC)(const  GLshort  * v);
-typedef void (GLAD_API_PTR *PFNGLWINDOWPOS3DPROC)(GLdouble   x, GLdouble   y, GLdouble   z);
-typedef void (GLAD_API_PTR *PFNGLWINDOWPOS3DVPROC)(const  GLdouble  * v);
-typedef void (GLAD_API_PTR *PFNGLWINDOWPOS3FPROC)(GLfloat   x, GLfloat   y, GLfloat   z);
-typedef void (GLAD_API_PTR *PFNGLWINDOWPOS3FVPROC)(const  GLfloat  * v);
-typedef void (GLAD_API_PTR *PFNGLWINDOWPOS3IPROC)(GLint   x, GLint   y, GLint   z);
-typedef void (GLAD_API_PTR *PFNGLWINDOWPOS3IVPROC)(const  GLint  * v);
-typedef void (GLAD_API_PTR *PFNGLWINDOWPOS3SPROC)(GLshort   x, GLshort   y, GLshort   z);
-typedef void (GLAD_API_PTR *PFNGLWINDOWPOS3SVPROC)(const  GLshort  * v);
+typedef void (GLAD_API_PTR *PFNGLPUSHNAMEPROC)(GLuint name);
+typedef void (GLAD_API_PTR *PFNGLQUERYCOUNTERPROC)(GLuint id, GLenum target);
+typedef void (GLAD_API_PTR *PFNGLRASTERPOS2DPROC)(GLdouble x, GLdouble y);
+typedef void (GLAD_API_PTR *PFNGLRASTERPOS2DVPROC)(const GLdouble * v);
+typedef void (GLAD_API_PTR *PFNGLRASTERPOS2FPROC)(GLfloat x, GLfloat y);
+typedef void (GLAD_API_PTR *PFNGLRASTERPOS2FVPROC)(const GLfloat * v);
+typedef void (GLAD_API_PTR *PFNGLRASTERPOS2IPROC)(GLint x, GLint y);
+typedef void (GLAD_API_PTR *PFNGLRASTERPOS2IVPROC)(const GLint * v);
+typedef void (GLAD_API_PTR *PFNGLRASTERPOS2SPROC)(GLshort x, GLshort y);
+typedef void (GLAD_API_PTR *PFNGLRASTERPOS2SVPROC)(const GLshort * v);
+typedef void (GLAD_API_PTR *PFNGLRASTERPOS3DPROC)(GLdouble x, GLdouble y, GLdouble z);
+typedef void (GLAD_API_PTR *PFNGLRASTERPOS3DVPROC)(const GLdouble * v);
+typedef void (GLAD_API_PTR *PFNGLRASTERPOS3FPROC)(GLfloat x, GLfloat y, GLfloat z);
+typedef void (GLAD_API_PTR *PFNGLRASTERPOS3FVPROC)(const GLfloat * v);
+typedef void (GLAD_API_PTR *PFNGLRASTERPOS3IPROC)(GLint x, GLint y, GLint z);
+typedef void (GLAD_API_PTR *PFNGLRASTERPOS3IVPROC)(const GLint * v);
+typedef void (GLAD_API_PTR *PFNGLRASTERPOS3SPROC)(GLshort x, GLshort y, GLshort z);
+typedef void (GLAD_API_PTR *PFNGLRASTERPOS3SVPROC)(const GLshort * v);
+typedef void (GLAD_API_PTR *PFNGLRASTERPOS4DPROC)(GLdouble x, GLdouble y, GLdouble z, GLdouble w);
+typedef void (GLAD_API_PTR *PFNGLRASTERPOS4DVPROC)(const GLdouble * v);
+typedef void (GLAD_API_PTR *PFNGLRASTERPOS4FPROC)(GLfloat x, GLfloat y, GLfloat z, GLfloat w);
+typedef void (GLAD_API_PTR *PFNGLRASTERPOS4FVPROC)(const GLfloat * v);
+typedef void (GLAD_API_PTR *PFNGLRASTERPOS4IPROC)(GLint x, GLint y, GLint z, GLint w);
+typedef void (GLAD_API_PTR *PFNGLRASTERPOS4IVPROC)(const GLint * v);
+typedef void (GLAD_API_PTR *PFNGLRASTERPOS4SPROC)(GLshort x, GLshort y, GLshort z, GLshort w);
+typedef void (GLAD_API_PTR *PFNGLRASTERPOS4SVPROC)(const GLshort * v);
+typedef void (GLAD_API_PTR *PFNGLREADBUFFERPROC)(GLenum src);
+typedef void (GLAD_API_PTR *PFNGLREADPIXELSPROC)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void * pixels);
+typedef void (GLAD_API_PTR *PFNGLREADNPIXELSARBPROC)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void * data);
+typedef void (GLAD_API_PTR *PFNGLRECTDPROC)(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2);
+typedef void (GLAD_API_PTR *PFNGLRECTDVPROC)(const GLdouble * v1, const GLdouble * v2);
+typedef void (GLAD_API_PTR *PFNGLRECTFPROC)(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2);
+typedef void (GLAD_API_PTR *PFNGLRECTFVPROC)(const GLfloat * v1, const GLfloat * v2);
+typedef void (GLAD_API_PTR *PFNGLRECTIPROC)(GLint x1, GLint y1, GLint x2, GLint y2);
+typedef void (GLAD_API_PTR *PFNGLRECTIVPROC)(const GLint * v1, const GLint * v2);
+typedef void (GLAD_API_PTR *PFNGLRECTSPROC)(GLshort x1, GLshort y1, GLshort x2, GLshort y2);
+typedef void (GLAD_API_PTR *PFNGLRECTSVPROC)(const GLshort * v1, const GLshort * v2);
+typedef GLint (GLAD_API_PTR *PFNGLRENDERMODEPROC)(GLenum mode);
+typedef void (GLAD_API_PTR *PFNGLRENDERBUFFERSTORAGEPROC)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
+typedef void (GLAD_API_PTR *PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC)(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
+typedef void (GLAD_API_PTR *PFNGLROTATEDPROC)(GLdouble angle, GLdouble x, GLdouble y, GLdouble z);
+typedef void (GLAD_API_PTR *PFNGLROTATEFPROC)(GLfloat angle, GLfloat x, GLfloat y, GLfloat z);
+typedef void (GLAD_API_PTR *PFNGLSAMPLECOVERAGEPROC)(GLfloat value, GLboolean invert);
+typedef void (GLAD_API_PTR *PFNGLSAMPLECOVERAGEARBPROC)(GLfloat value, GLboolean invert);
+typedef void (GLAD_API_PTR *PFNGLSAMPLEMASKIPROC)(GLuint maskNumber, GLbitfield mask);
+typedef void (GLAD_API_PTR *PFNGLSAMPLERPARAMETERIIVPROC)(GLuint sampler, GLenum pname, const GLint * param);
+typedef void (GLAD_API_PTR *PFNGLSAMPLERPARAMETERIUIVPROC)(GLuint sampler, GLenum pname, const GLuint * param);
+typedef void (GLAD_API_PTR *PFNGLSAMPLERPARAMETERFPROC)(GLuint sampler, GLenum pname, GLfloat param);
+typedef void (GLAD_API_PTR *PFNGLSAMPLERPARAMETERFVPROC)(GLuint sampler, GLenum pname, const GLfloat * param);
+typedef void (GLAD_API_PTR *PFNGLSAMPLERPARAMETERIPROC)(GLuint sampler, GLenum pname, GLint param);
+typedef void (GLAD_API_PTR *PFNGLSAMPLERPARAMETERIVPROC)(GLuint sampler, GLenum pname, const GLint * param);
+typedef void (GLAD_API_PTR *PFNGLSCALEDPROC)(GLdouble x, GLdouble y, GLdouble z);
+typedef void (GLAD_API_PTR *PFNGLSCALEFPROC)(GLfloat x, GLfloat y, GLfloat z);
+typedef void (GLAD_API_PTR *PFNGLSCISSORPROC)(GLint x, GLint y, GLsizei width, GLsizei height);
+typedef void (GLAD_API_PTR *PFNGLSECONDARYCOLOR3BPROC)(GLbyte red, GLbyte green, GLbyte blue);
+typedef void (GLAD_API_PTR *PFNGLSECONDARYCOLOR3BVPROC)(const GLbyte * v);
+typedef void (GLAD_API_PTR *PFNGLSECONDARYCOLOR3DPROC)(GLdouble red, GLdouble green, GLdouble blue);
+typedef void (GLAD_API_PTR *PFNGLSECONDARYCOLOR3DVPROC)(const GLdouble * v);
+typedef void (GLAD_API_PTR *PFNGLSECONDARYCOLOR3FPROC)(GLfloat red, GLfloat green, GLfloat blue);
+typedef void (GLAD_API_PTR *PFNGLSECONDARYCOLOR3FVPROC)(const GLfloat * v);
+typedef void (GLAD_API_PTR *PFNGLSECONDARYCOLOR3IPROC)(GLint red, GLint green, GLint blue);
+typedef void (GLAD_API_PTR *PFNGLSECONDARYCOLOR3IVPROC)(const GLint * v);
+typedef void (GLAD_API_PTR *PFNGLSECONDARYCOLOR3SPROC)(GLshort red, GLshort green, GLshort blue);
+typedef void (GLAD_API_PTR *PFNGLSECONDARYCOLOR3SVPROC)(const GLshort * v);
+typedef void (GLAD_API_PTR *PFNGLSECONDARYCOLOR3UBPROC)(GLubyte red, GLubyte green, GLubyte blue);
+typedef void (GLAD_API_PTR *PFNGLSECONDARYCOLOR3UBVPROC)(const GLubyte * v);
+typedef void (GLAD_API_PTR *PFNGLSECONDARYCOLOR3UIPROC)(GLuint red, GLuint green, GLuint blue);
+typedef void (GLAD_API_PTR *PFNGLSECONDARYCOLOR3UIVPROC)(const GLuint * v);
+typedef void (GLAD_API_PTR *PFNGLSECONDARYCOLOR3USPROC)(GLushort red, GLushort green, GLushort blue);
+typedef void (GLAD_API_PTR *PFNGLSECONDARYCOLOR3USVPROC)(const GLushort * v);
+typedef void (GLAD_API_PTR *PFNGLSECONDARYCOLORP3UIPROC)(GLenum type, GLuint color);
+typedef void (GLAD_API_PTR *PFNGLSECONDARYCOLORP3UIVPROC)(GLenum type, const GLuint * color);
+typedef void (GLAD_API_PTR *PFNGLSECONDARYCOLORPOINTERPROC)(GLint size, GLenum type, GLsizei stride, const void * pointer);
+typedef void (GLAD_API_PTR *PFNGLSELECTBUFFERPROC)(GLsizei size, GLuint * buffer);
+typedef void (GLAD_API_PTR *PFNGLSHADEMODELPROC)(GLenum mode);
+typedef void (GLAD_API_PTR *PFNGLSHADERSOURCEPROC)(GLuint shader, GLsizei count, const GLchar *const* string, const GLint * length);
+typedef void (GLAD_API_PTR *PFNGLSTENCILFUNCPROC)(GLenum func, GLint ref, GLuint mask);
+typedef void (GLAD_API_PTR *PFNGLSTENCILFUNCSEPARATEPROC)(GLenum face, GLenum func, GLint ref, GLuint mask);
+typedef void (GLAD_API_PTR *PFNGLSTENCILMASKPROC)(GLuint mask);
+typedef void (GLAD_API_PTR *PFNGLSTENCILMASKSEPARATEPROC)(GLenum face, GLuint mask);
+typedef void (GLAD_API_PTR *PFNGLSTENCILOPPROC)(GLenum fail, GLenum zfail, GLenum zpass);
+typedef void (GLAD_API_PTR *PFNGLSTENCILOPSEPARATEPROC)(GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass);
+typedef void (GLAD_API_PTR *PFNGLTEXBUFFERPROC)(GLenum target, GLenum internalformat, GLuint buffer);
+typedef void (GLAD_API_PTR *PFNGLTEXCOORD1DPROC)(GLdouble s);
+typedef void (GLAD_API_PTR *PFNGLTEXCOORD1DVPROC)(const GLdouble * v);
+typedef void (GLAD_API_PTR *PFNGLTEXCOORD1FPROC)(GLfloat s);
+typedef void (GLAD_API_PTR *PFNGLTEXCOORD1FVPROC)(const GLfloat * v);
+typedef void (GLAD_API_PTR *PFNGLTEXCOORD1IPROC)(GLint s);
+typedef void (GLAD_API_PTR *PFNGLTEXCOORD1IVPROC)(const GLint * v);
+typedef void (GLAD_API_PTR *PFNGLTEXCOORD1SPROC)(GLshort s);
+typedef void (GLAD_API_PTR *PFNGLTEXCOORD1SVPROC)(const GLshort * v);
+typedef void (GLAD_API_PTR *PFNGLTEXCOORD2DPROC)(GLdouble s, GLdouble t);
+typedef void (GLAD_API_PTR *PFNGLTEXCOORD2DVPROC)(const GLdouble * v);
+typedef void (GLAD_API_PTR *PFNGLTEXCOORD2FPROC)(GLfloat s, GLfloat t);
+typedef void (GLAD_API_PTR *PFNGLTEXCOORD2FVPROC)(const GLfloat * v);
+typedef void (GLAD_API_PTR *PFNGLTEXCOORD2IPROC)(GLint s, GLint t);
+typedef void (GLAD_API_PTR *PFNGLTEXCOORD2IVPROC)(const GLint * v);
+typedef void (GLAD_API_PTR *PFNGLTEXCOORD2SPROC)(GLshort s, GLshort t);
+typedef void (GLAD_API_PTR *PFNGLTEXCOORD2SVPROC)(const GLshort * v);
+typedef void (GLAD_API_PTR *PFNGLTEXCOORD3DPROC)(GLdouble s, GLdouble t, GLdouble r);
+typedef void (GLAD_API_PTR *PFNGLTEXCOORD3DVPROC)(const GLdouble * v);
+typedef void (GLAD_API_PTR *PFNGLTEXCOORD3FPROC)(GLfloat s, GLfloat t, GLfloat r);
+typedef void (GLAD_API_PTR *PFNGLTEXCOORD3FVPROC)(const GLfloat * v);
+typedef void (GLAD_API_PTR *PFNGLTEXCOORD3IPROC)(GLint s, GLint t, GLint r);
+typedef void (GLAD_API_PTR *PFNGLTEXCOORD3IVPROC)(const GLint * v);
+typedef void (GLAD_API_PTR *PFNGLTEXCOORD3SPROC)(GLshort s, GLshort t, GLshort r);
+typedef void (GLAD_API_PTR *PFNGLTEXCOORD3SVPROC)(const GLshort * v);
+typedef void (GLAD_API_PTR *PFNGLTEXCOORD4DPROC)(GLdouble s, GLdouble t, GLdouble r, GLdouble q);
+typedef void (GLAD_API_PTR *PFNGLTEXCOORD4DVPROC)(const GLdouble * v);
+typedef void (GLAD_API_PTR *PFNGLTEXCOORD4FPROC)(GLfloat s, GLfloat t, GLfloat r, GLfloat q);
+typedef void (GLAD_API_PTR *PFNGLTEXCOORD4FVPROC)(const GLfloat * v);
+typedef void (GLAD_API_PTR *PFNGLTEXCOORD4IPROC)(GLint s, GLint t, GLint r, GLint q);
+typedef void (GLAD_API_PTR *PFNGLTEXCOORD4IVPROC)(const GLint * v);
+typedef void (GLAD_API_PTR *PFNGLTEXCOORD4SPROC)(GLshort s, GLshort t, GLshort r, GLshort q);
+typedef void (GLAD_API_PTR *PFNGLTEXCOORD4SVPROC)(const GLshort * v);
+typedef void (GLAD_API_PTR *PFNGLTEXCOORDP1UIPROC)(GLenum type, GLuint coords);
+typedef void (GLAD_API_PTR *PFNGLTEXCOORDP1UIVPROC)(GLenum type, const GLuint * coords);
+typedef void (GLAD_API_PTR *PFNGLTEXCOORDP2UIPROC)(GLenum type, GLuint coords);
+typedef void (GLAD_API_PTR *PFNGLTEXCOORDP2UIVPROC)(GLenum type, const GLuint * coords);
+typedef void (GLAD_API_PTR *PFNGLTEXCOORDP3UIPROC)(GLenum type, GLuint coords);
+typedef void (GLAD_API_PTR *PFNGLTEXCOORDP3UIVPROC)(GLenum type, const GLuint * coords);
+typedef void (GLAD_API_PTR *PFNGLTEXCOORDP4UIPROC)(GLenum type, GLuint coords);
+typedef void (GLAD_API_PTR *PFNGLTEXCOORDP4UIVPROC)(GLenum type, const GLuint * coords);
+typedef void (GLAD_API_PTR *PFNGLTEXCOORDPOINTERPROC)(GLint size, GLenum type, GLsizei stride, const void * pointer);
+typedef void (GLAD_API_PTR *PFNGLTEXENVFPROC)(GLenum target, GLenum pname, GLfloat param);
+typedef void (GLAD_API_PTR *PFNGLTEXENVFVPROC)(GLenum target, GLenum pname, const GLfloat * params);
+typedef void (GLAD_API_PTR *PFNGLTEXENVIPROC)(GLenum target, GLenum pname, GLint param);
+typedef void (GLAD_API_PTR *PFNGLTEXENVIVPROC)(GLenum target, GLenum pname, const GLint * params);
+typedef void (GLAD_API_PTR *PFNGLTEXGENDPROC)(GLenum coord, GLenum pname, GLdouble param);
+typedef void (GLAD_API_PTR *PFNGLTEXGENDVPROC)(GLenum coord, GLenum pname, const GLdouble * params);
+typedef void (GLAD_API_PTR *PFNGLTEXGENFPROC)(GLenum coord, GLenum pname, GLfloat param);
+typedef void (GLAD_API_PTR *PFNGLTEXGENFVPROC)(GLenum coord, GLenum pname, const GLfloat * params);
+typedef void (GLAD_API_PTR *PFNGLTEXGENIPROC)(GLenum coord, GLenum pname, GLint param);
+typedef void (GLAD_API_PTR *PFNGLTEXGENIVPROC)(GLenum coord, GLenum pname, const GLint * params);
+typedef void (GLAD_API_PTR *PFNGLTEXIMAGE1DPROC)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const void * pixels);
+typedef void (GLAD_API_PTR *PFNGLTEXIMAGE2DPROC)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void * pixels);
+typedef void (GLAD_API_PTR *PFNGLTEXIMAGE2DMULTISAMPLEPROC)(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations);
+typedef void (GLAD_API_PTR *PFNGLTEXIMAGE3DPROC)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void * pixels);
+typedef void (GLAD_API_PTR *PFNGLTEXIMAGE3DMULTISAMPLEPROC)(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations);
+typedef void (GLAD_API_PTR *PFNGLTEXPARAMETERIIVPROC)(GLenum target, GLenum pname, const GLint * params);
+typedef void (GLAD_API_PTR *PFNGLTEXPARAMETERIUIVPROC)(GLenum target, GLenum pname, const GLuint * params);
+typedef void (GLAD_API_PTR *PFNGLTEXPARAMETERFPROC)(GLenum target, GLenum pname, GLfloat param);
+typedef void (GLAD_API_PTR *PFNGLTEXPARAMETERFVPROC)(GLenum target, GLenum pname, const GLfloat * params);
+typedef void (GLAD_API_PTR *PFNGLTEXPARAMETERIPROC)(GLenum target, GLenum pname, GLint param);
+typedef void (GLAD_API_PTR *PFNGLTEXPARAMETERIVPROC)(GLenum target, GLenum pname, const GLint * params);
+typedef void (GLAD_API_PTR *PFNGLTEXSUBIMAGE1DPROC)(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const void * pixels);
+typedef void (GLAD_API_PTR *PFNGLTEXSUBIMAGE2DPROC)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void * pixels);
+typedef void (GLAD_API_PTR *PFNGLTEXSUBIMAGE3DPROC)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void * pixels);
+typedef void (GLAD_API_PTR *PFNGLTRANSFORMFEEDBACKVARYINGSPROC)(GLuint program, GLsizei count, const GLchar *const* varyings, GLenum bufferMode);
+typedef void (GLAD_API_PTR *PFNGLTRANSLATEDPROC)(GLdouble x, GLdouble y, GLdouble z);
+typedef void (GLAD_API_PTR *PFNGLTRANSLATEFPROC)(GLfloat x, GLfloat y, GLfloat z);
+typedef void (GLAD_API_PTR *PFNGLUNIFORM1FPROC)(GLint location, GLfloat v0);
+typedef void (GLAD_API_PTR *PFNGLUNIFORM1FVPROC)(GLint location, GLsizei count, const GLfloat * value);
+typedef void (GLAD_API_PTR *PFNGLUNIFORM1IPROC)(GLint location, GLint v0);
+typedef void (GLAD_API_PTR *PFNGLUNIFORM1IVPROC)(GLint location, GLsizei count, const GLint * value);
+typedef void (GLAD_API_PTR *PFNGLUNIFORM1UIPROC)(GLint location, GLuint v0);
+typedef void (GLAD_API_PTR *PFNGLUNIFORM1UIVPROC)(GLint location, GLsizei count, const GLuint * value);
+typedef void (GLAD_API_PTR *PFNGLUNIFORM2FPROC)(GLint location, GLfloat v0, GLfloat v1);
+typedef void (GLAD_API_PTR *PFNGLUNIFORM2FVPROC)(GLint location, GLsizei count, const GLfloat * value);
+typedef void (GLAD_API_PTR *PFNGLUNIFORM2IPROC)(GLint location, GLint v0, GLint v1);
+typedef void (GLAD_API_PTR *PFNGLUNIFORM2IVPROC)(GLint location, GLsizei count, const GLint * value);
+typedef void (GLAD_API_PTR *PFNGLUNIFORM2UIPROC)(GLint location, GLuint v0, GLuint v1);
+typedef void (GLAD_API_PTR *PFNGLUNIFORM2UIVPROC)(GLint location, GLsizei count, const GLuint * value);
+typedef void (GLAD_API_PTR *PFNGLUNIFORM3FPROC)(GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
+typedef void (GLAD_API_PTR *PFNGLUNIFORM3FVPROC)(GLint location, GLsizei count, const GLfloat * value);
+typedef void (GLAD_API_PTR *PFNGLUNIFORM3IPROC)(GLint location, GLint v0, GLint v1, GLint v2);
+typedef void (GLAD_API_PTR *PFNGLUNIFORM3IVPROC)(GLint location, GLsizei count, const GLint * value);
+typedef void (GLAD_API_PTR *PFNGLUNIFORM3UIPROC)(GLint location, GLuint v0, GLuint v1, GLuint v2);
+typedef void (GLAD_API_PTR *PFNGLUNIFORM3UIVPROC)(GLint location, GLsizei count, const GLuint * value);
+typedef void (GLAD_API_PTR *PFNGLUNIFORM4FPROC)(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
+typedef void (GLAD_API_PTR *PFNGLUNIFORM4FVPROC)(GLint location, GLsizei count, const GLfloat * value);
+typedef void (GLAD_API_PTR *PFNGLUNIFORM4IPROC)(GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
+typedef void (GLAD_API_PTR *PFNGLUNIFORM4IVPROC)(GLint location, GLsizei count, const GLint * value);
+typedef void (GLAD_API_PTR *PFNGLUNIFORM4UIPROC)(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
+typedef void (GLAD_API_PTR *PFNGLUNIFORM4UIVPROC)(GLint location, GLsizei count, const GLuint * value);
+typedef void (GLAD_API_PTR *PFNGLUNIFORMBLOCKBINDINGPROC)(GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding);
+typedef void (GLAD_API_PTR *PFNGLUNIFORMMATRIX2FVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value);
+typedef void (GLAD_API_PTR *PFNGLUNIFORMMATRIX2X3FVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value);
+typedef void (GLAD_API_PTR *PFNGLUNIFORMMATRIX2X4FVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value);
+typedef void (GLAD_API_PTR *PFNGLUNIFORMMATRIX3FVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value);
+typedef void (GLAD_API_PTR *PFNGLUNIFORMMATRIX3X2FVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value);
+typedef void (GLAD_API_PTR *PFNGLUNIFORMMATRIX3X4FVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value);
+typedef void (GLAD_API_PTR *PFNGLUNIFORMMATRIX4FVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value);
+typedef void (GLAD_API_PTR *PFNGLUNIFORMMATRIX4X2FVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value);
+typedef void (GLAD_API_PTR *PFNGLUNIFORMMATRIX4X3FVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value);
+typedef GLboolean (GLAD_API_PTR *PFNGLUNMAPBUFFERPROC)(GLenum target);
+typedef void (GLAD_API_PTR *PFNGLUSEPROGRAMPROC)(GLuint program);
+typedef void (GLAD_API_PTR *PFNGLVALIDATEPROGRAMPROC)(GLuint program);
+typedef void (GLAD_API_PTR *PFNGLVERTEX2DPROC)(GLdouble x, GLdouble y);
+typedef void (GLAD_API_PTR *PFNGLVERTEX2DVPROC)(const GLdouble * v);
+typedef void (GLAD_API_PTR *PFNGLVERTEX2FPROC)(GLfloat x, GLfloat y);
+typedef void (GLAD_API_PTR *PFNGLVERTEX2FVPROC)(const GLfloat * v);
+typedef void (GLAD_API_PTR *PFNGLVERTEX2IPROC)(GLint x, GLint y);
+typedef void (GLAD_API_PTR *PFNGLVERTEX2IVPROC)(const GLint * v);
+typedef void (GLAD_API_PTR *PFNGLVERTEX2SPROC)(GLshort x, GLshort y);
+typedef void (GLAD_API_PTR *PFNGLVERTEX2SVPROC)(const GLshort * v);
+typedef void (GLAD_API_PTR *PFNGLVERTEX3DPROC)(GLdouble x, GLdouble y, GLdouble z);
+typedef void (GLAD_API_PTR *PFNGLVERTEX3DVPROC)(const GLdouble * v);
+typedef void (GLAD_API_PTR *PFNGLVERTEX3FPROC)(GLfloat x, GLfloat y, GLfloat z);
+typedef void (GLAD_API_PTR *PFNGLVERTEX3FVPROC)(const GLfloat * v);
+typedef void (GLAD_API_PTR *PFNGLVERTEX3IPROC)(GLint x, GLint y, GLint z);
+typedef void (GLAD_API_PTR *PFNGLVERTEX3IVPROC)(const GLint * v);
+typedef void (GLAD_API_PTR *PFNGLVERTEX3SPROC)(GLshort x, GLshort y, GLshort z);
+typedef void (GLAD_API_PTR *PFNGLVERTEX3SVPROC)(const GLshort * v);
+typedef void (GLAD_API_PTR *PFNGLVERTEX4DPROC)(GLdouble x, GLdouble y, GLdouble z, GLdouble w);
+typedef void (GLAD_API_PTR *PFNGLVERTEX4DVPROC)(const GLdouble * v);
+typedef void (GLAD_API_PTR *PFNGLVERTEX4FPROC)(GLfloat x, GLfloat y, GLfloat z, GLfloat w);
+typedef void (GLAD_API_PTR *PFNGLVERTEX4FVPROC)(const GLfloat * v);
+typedef void (GLAD_API_PTR *PFNGLVERTEX4IPROC)(GLint x, GLint y, GLint z, GLint w);
+typedef void (GLAD_API_PTR *PFNGLVERTEX4IVPROC)(const GLint * v);
+typedef void (GLAD_API_PTR *PFNGLVERTEX4SPROC)(GLshort x, GLshort y, GLshort z, GLshort w);
+typedef void (GLAD_API_PTR *PFNGLVERTEX4SVPROC)(const GLshort * v);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB1DPROC)(GLuint index, GLdouble x);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB1DVPROC)(GLuint index, const GLdouble * v);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB1FPROC)(GLuint index, GLfloat x);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB1FVPROC)(GLuint index, const GLfloat * v);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB1SPROC)(GLuint index, GLshort x);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB1SVPROC)(GLuint index, const GLshort * v);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB2DPROC)(GLuint index, GLdouble x, GLdouble y);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB2DVPROC)(GLuint index, const GLdouble * v);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB2FPROC)(GLuint index, GLfloat x, GLfloat y);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB2FVPROC)(GLuint index, const GLfloat * v);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB2SPROC)(GLuint index, GLshort x, GLshort y);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB2SVPROC)(GLuint index, const GLshort * v);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB3DPROC)(GLuint index, GLdouble x, GLdouble y, GLdouble z);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB3DVPROC)(GLuint index, const GLdouble * v);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB3FPROC)(GLuint index, GLfloat x, GLfloat y, GLfloat z);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB3FVPROC)(GLuint index, const GLfloat * v);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB3SPROC)(GLuint index, GLshort x, GLshort y, GLshort z);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB3SVPROC)(GLuint index, const GLshort * v);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB4NBVPROC)(GLuint index, const GLbyte * v);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB4NIVPROC)(GLuint index, const GLint * v);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB4NSVPROC)(GLuint index, const GLshort * v);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB4NUBPROC)(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB4NUBVPROC)(GLuint index, const GLubyte * v);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB4NUIVPROC)(GLuint index, const GLuint * v);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB4NUSVPROC)(GLuint index, const GLushort * v);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB4BVPROC)(GLuint index, const GLbyte * v);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB4DPROC)(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB4DVPROC)(GLuint index, const GLdouble * v);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB4FPROC)(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB4FVPROC)(GLuint index, const GLfloat * v);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB4IVPROC)(GLuint index, const GLint * v);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB4SPROC)(GLuint index, GLshort x, GLshort y, GLshort z, GLshort w);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB4SVPROC)(GLuint index, const GLshort * v);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB4UBVPROC)(GLuint index, const GLubyte * v);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB4UIVPROC)(GLuint index, const GLuint * v);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB4USVPROC)(GLuint index, const GLushort * v);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBDIVISORPROC)(GLuint index, GLuint divisor);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBI1IPROC)(GLuint index, GLint x);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBI1IVPROC)(GLuint index, const GLint * v);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBI1UIPROC)(GLuint index, GLuint x);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBI1UIVPROC)(GLuint index, const GLuint * v);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBI2IPROC)(GLuint index, GLint x, GLint y);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBI2IVPROC)(GLuint index, const GLint * v);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBI2UIPROC)(GLuint index, GLuint x, GLuint y);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBI2UIVPROC)(GLuint index, const GLuint * v);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBI3IPROC)(GLuint index, GLint x, GLint y, GLint z);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBI3IVPROC)(GLuint index, const GLint * v);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBI3UIPROC)(GLuint index, GLuint x, GLuint y, GLuint z);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBI3UIVPROC)(GLuint index, const GLuint * v);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBI4BVPROC)(GLuint index, const GLbyte * v);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBI4IPROC)(GLuint index, GLint x, GLint y, GLint z, GLint w);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBI4IVPROC)(GLuint index, const GLint * v);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBI4SVPROC)(GLuint index, const GLshort * v);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBI4UBVPROC)(GLuint index, const GLubyte * v);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBI4UIPROC)(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBI4UIVPROC)(GLuint index, const GLuint * v);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBI4USVPROC)(GLuint index, const GLushort * v);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBIPOINTERPROC)(GLuint index, GLint size, GLenum type, GLsizei stride, const void * pointer);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBP1UIPROC)(GLuint index, GLenum type, GLboolean normalized, GLuint value);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBP1UIVPROC)(GLuint index, GLenum type, GLboolean normalized, const GLuint * value);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBP2UIPROC)(GLuint index, GLenum type, GLboolean normalized, GLuint value);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBP2UIVPROC)(GLuint index, GLenum type, GLboolean normalized, const GLuint * value);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBP3UIPROC)(GLuint index, GLenum type, GLboolean normalized, GLuint value);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBP3UIVPROC)(GLuint index, GLenum type, GLboolean normalized, const GLuint * value);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBP4UIPROC)(GLuint index, GLenum type, GLboolean normalized, GLuint value);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBP4UIVPROC)(GLuint index, GLenum type, GLboolean normalized, const GLuint * value);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBPOINTERPROC)(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void * pointer);
+typedef void (GLAD_API_PTR *PFNGLVERTEXP2UIPROC)(GLenum type, GLuint value);
+typedef void (GLAD_API_PTR *PFNGLVERTEXP2UIVPROC)(GLenum type, const GLuint * value);
+typedef void (GLAD_API_PTR *PFNGLVERTEXP3UIPROC)(GLenum type, GLuint value);
+typedef void (GLAD_API_PTR *PFNGLVERTEXP3UIVPROC)(GLenum type, const GLuint * value);
+typedef void (GLAD_API_PTR *PFNGLVERTEXP4UIPROC)(GLenum type, GLuint value);
+typedef void (GLAD_API_PTR *PFNGLVERTEXP4UIVPROC)(GLenum type, const GLuint * value);
+typedef void (GLAD_API_PTR *PFNGLVERTEXPOINTERPROC)(GLint size, GLenum type, GLsizei stride, const void * pointer);
+typedef void (GLAD_API_PTR *PFNGLVIEWPORTPROC)(GLint x, GLint y, GLsizei width, GLsizei height);
+typedef void (GLAD_API_PTR *PFNGLWAITSYNCPROC)(GLsync sync, GLbitfield flags, GLuint64 timeout);
+typedef void (GLAD_API_PTR *PFNGLWINDOWPOS2DPROC)(GLdouble x, GLdouble y);
+typedef void (GLAD_API_PTR *PFNGLWINDOWPOS2DVPROC)(const GLdouble * v);
+typedef void (GLAD_API_PTR *PFNGLWINDOWPOS2FPROC)(GLfloat x, GLfloat y);
+typedef void (GLAD_API_PTR *PFNGLWINDOWPOS2FVPROC)(const GLfloat * v);
+typedef void (GLAD_API_PTR *PFNGLWINDOWPOS2IPROC)(GLint x, GLint y);
+typedef void (GLAD_API_PTR *PFNGLWINDOWPOS2IVPROC)(const GLint * v);
+typedef void (GLAD_API_PTR *PFNGLWINDOWPOS2SPROC)(GLshort x, GLshort y);
+typedef void (GLAD_API_PTR *PFNGLWINDOWPOS2SVPROC)(const GLshort * v);
+typedef void (GLAD_API_PTR *PFNGLWINDOWPOS3DPROC)(GLdouble x, GLdouble y, GLdouble z);
+typedef void (GLAD_API_PTR *PFNGLWINDOWPOS3DVPROC)(const GLdouble * v);
+typedef void (GLAD_API_PTR *PFNGLWINDOWPOS3FPROC)(GLfloat x, GLfloat y, GLfloat z);
+typedef void (GLAD_API_PTR *PFNGLWINDOWPOS3FVPROC)(const GLfloat * v);
+typedef void (GLAD_API_PTR *PFNGLWINDOWPOS3IPROC)(GLint x, GLint y, GLint z);
+typedef void (GLAD_API_PTR *PFNGLWINDOWPOS3IVPROC)(const GLint * v);
+typedef void (GLAD_API_PTR *PFNGLWINDOWPOS3SPROC)(GLshort x, GLshort y, GLshort z);
+typedef void (GLAD_API_PTR *PFNGLWINDOWPOS3SVPROC)(const GLshort * v);
 
 GLAD_API_CALL PFNGLACCUMPROC glad_glAccum;
 #define glAccum glad_glAccum
@@ -3270,8 +3622,6 @@
 #define glReadBuffer glad_glReadBuffer
 GLAD_API_CALL PFNGLREADPIXELSPROC glad_glReadPixels;
 #define glReadPixels glad_glReadPixels
-GLAD_API_CALL PFNGLREADNPIXELSPROC glad_glReadnPixels;
-#define glReadnPixels glad_glReadnPixels
 GLAD_API_CALL PFNGLREADNPIXELSARBPROC glad_glReadnPixelsARB;
 #define glReadnPixelsARB glad_glReadnPixelsARB
 GLAD_API_CALL PFNGLRECTDPROC glad_glRectd;
@@ -3826,15 +4176,1821 @@
 #define glWindowPos3sv glad_glWindowPos3sv
 
 
+
+
+
 GLAD_API_CALL int gladLoadGLUserPtr( GLADuserptrloadfunc load, void *userptr);
 GLAD_API_CALL int gladLoadGL( GLADloadfunc load);
 
 
 
-
-
-
 #ifdef __cplusplus
 }
 #endif
 #endif
+
+/* Source */
+#ifdef GLAD_GL_IMPLEMENTATION
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#ifndef GLAD_IMPL_UTIL_C_
+#define GLAD_IMPL_UTIL_C_
+
+#ifdef _MSC_VER
+#define GLAD_IMPL_UTIL_SSCANF sscanf_s
+#else
+#define GLAD_IMPL_UTIL_SSCANF sscanf
+#endif
+
+#endif /* GLAD_IMPL_UTIL_C_ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+
+int GLAD_GL_VERSION_1_0 = 0;
+int GLAD_GL_VERSION_1_1 = 0;
+int GLAD_GL_VERSION_1_2 = 0;
+int GLAD_GL_VERSION_1_3 = 0;
+int GLAD_GL_VERSION_1_4 = 0;
+int GLAD_GL_VERSION_1_5 = 0;
+int GLAD_GL_VERSION_2_0 = 0;
+int GLAD_GL_VERSION_2_1 = 0;
+int GLAD_GL_VERSION_3_0 = 0;
+int GLAD_GL_VERSION_3_1 = 0;
+int GLAD_GL_VERSION_3_2 = 0;
+int GLAD_GL_VERSION_3_3 = 0;
+int GLAD_GL_ARB_multisample = 0;
+int GLAD_GL_ARB_robustness = 0;
+int GLAD_GL_KHR_debug = 0;
+
+
+
+PFNGLACCUMPROC glad_glAccum = NULL;
+PFNGLACTIVETEXTUREPROC glad_glActiveTexture = NULL;
+PFNGLALPHAFUNCPROC glad_glAlphaFunc = NULL;
+PFNGLARETEXTURESRESIDENTPROC glad_glAreTexturesResident = NULL;
+PFNGLARRAYELEMENTPROC glad_glArrayElement = NULL;
+PFNGLATTACHSHADERPROC glad_glAttachShader = NULL;
+PFNGLBEGINPROC glad_glBegin = NULL;
+PFNGLBEGINCONDITIONALRENDERPROC glad_glBeginConditionalRender = NULL;
+PFNGLBEGINQUERYPROC glad_glBeginQuery = NULL;
+PFNGLBEGINTRANSFORMFEEDBACKPROC glad_glBeginTransformFeedback = NULL;
+PFNGLBINDATTRIBLOCATIONPROC glad_glBindAttribLocation = NULL;
+PFNGLBINDBUFFERPROC glad_glBindBuffer = NULL;
+PFNGLBINDBUFFERBASEPROC glad_glBindBufferBase = NULL;
+PFNGLBINDBUFFERRANGEPROC glad_glBindBufferRange = NULL;
+PFNGLBINDFRAGDATALOCATIONPROC glad_glBindFragDataLocation = NULL;
+PFNGLBINDFRAGDATALOCATIONINDEXEDPROC glad_glBindFragDataLocationIndexed = NULL;
+PFNGLBINDFRAMEBUFFERPROC glad_glBindFramebuffer = NULL;
+PFNGLBINDRENDERBUFFERPROC glad_glBindRenderbuffer = NULL;
+PFNGLBINDSAMPLERPROC glad_glBindSampler = NULL;
+PFNGLBINDTEXTUREPROC glad_glBindTexture = NULL;
+PFNGLBINDVERTEXARRAYPROC glad_glBindVertexArray = NULL;
+PFNGLBITMAPPROC glad_glBitmap = NULL;
+PFNGLBLENDCOLORPROC glad_glBlendColor = NULL;
+PFNGLBLENDEQUATIONPROC glad_glBlendEquation = NULL;
+PFNGLBLENDEQUATIONSEPARATEPROC glad_glBlendEquationSeparate = NULL;
+PFNGLBLENDFUNCPROC glad_glBlendFunc = NULL;
+PFNGLBLENDFUNCSEPARATEPROC glad_glBlendFuncSeparate = NULL;
+PFNGLBLITFRAMEBUFFERPROC glad_glBlitFramebuffer = NULL;
+PFNGLBUFFERDATAPROC glad_glBufferData = NULL;
+PFNGLBUFFERSUBDATAPROC glad_glBufferSubData = NULL;
+PFNGLCALLLISTPROC glad_glCallList = NULL;
+PFNGLCALLLISTSPROC glad_glCallLists = NULL;
+PFNGLCHECKFRAMEBUFFERSTATUSPROC glad_glCheckFramebufferStatus = NULL;
+PFNGLCLAMPCOLORPROC glad_glClampColor = NULL;
+PFNGLCLEARPROC glad_glClear = NULL;
+PFNGLCLEARACCUMPROC glad_glClearAccum = NULL;
+PFNGLCLEARBUFFERFIPROC glad_glClearBufferfi = NULL;
+PFNGLCLEARBUFFERFVPROC glad_glClearBufferfv = NULL;
+PFNGLCLEARBUFFERIVPROC glad_glClearBufferiv = NULL;
+PFNGLCLEARBUFFERUIVPROC glad_glClearBufferuiv = NULL;
+PFNGLCLEARCOLORPROC glad_glClearColor = NULL;
+PFNGLCLEARDEPTHPROC glad_glClearDepth = NULL;
+PFNGLCLEARINDEXPROC glad_glClearIndex = NULL;
+PFNGLCLEARSTENCILPROC glad_glClearStencil = NULL;
+PFNGLCLIENTACTIVETEXTUREPROC glad_glClientActiveTexture = NULL;
+PFNGLCLIENTWAITSYNCPROC glad_glClientWaitSync = NULL;
+PFNGLCLIPPLANEPROC glad_glClipPlane = NULL;
+PFNGLCOLOR3BPROC glad_glColor3b = NULL;
+PFNGLCOLOR3BVPROC glad_glColor3bv = NULL;
+PFNGLCOLOR3DPROC glad_glColor3d = NULL;
+PFNGLCOLOR3DVPROC glad_glColor3dv = NULL;
+PFNGLCOLOR3FPROC glad_glColor3f = NULL;
+PFNGLCOLOR3FVPROC glad_glColor3fv = NULL;
+PFNGLCOLOR3IPROC glad_glColor3i = NULL;
+PFNGLCOLOR3IVPROC glad_glColor3iv = NULL;
+PFNGLCOLOR3SPROC glad_glColor3s = NULL;
+PFNGLCOLOR3SVPROC glad_glColor3sv = NULL;
+PFNGLCOLOR3UBPROC glad_glColor3ub = NULL;
+PFNGLCOLOR3UBVPROC glad_glColor3ubv = NULL;
+PFNGLCOLOR3UIPROC glad_glColor3ui = NULL;
+PFNGLCOLOR3UIVPROC glad_glColor3uiv = NULL;
+PFNGLCOLOR3USPROC glad_glColor3us = NULL;
+PFNGLCOLOR3USVPROC glad_glColor3usv = NULL;
+PFNGLCOLOR4BPROC glad_glColor4b = NULL;
+PFNGLCOLOR4BVPROC glad_glColor4bv = NULL;
+PFNGLCOLOR4DPROC glad_glColor4d = NULL;
+PFNGLCOLOR4DVPROC glad_glColor4dv = NULL;
+PFNGLCOLOR4FPROC glad_glColor4f = NULL;
+PFNGLCOLOR4FVPROC glad_glColor4fv = NULL;
+PFNGLCOLOR4IPROC glad_glColor4i = NULL;
+PFNGLCOLOR4IVPROC glad_glColor4iv = NULL;
+PFNGLCOLOR4SPROC glad_glColor4s = NULL;
+PFNGLCOLOR4SVPROC glad_glColor4sv = NULL;
+PFNGLCOLOR4UBPROC glad_glColor4ub = NULL;
+PFNGLCOLOR4UBVPROC glad_glColor4ubv = NULL;
+PFNGLCOLOR4UIPROC glad_glColor4ui = NULL;
+PFNGLCOLOR4UIVPROC glad_glColor4uiv = NULL;
+PFNGLCOLOR4USPROC glad_glColor4us = NULL;
+PFNGLCOLOR4USVPROC glad_glColor4usv = NULL;
+PFNGLCOLORMASKPROC glad_glColorMask = NULL;
+PFNGLCOLORMASKIPROC glad_glColorMaski = NULL;
+PFNGLCOLORMATERIALPROC glad_glColorMaterial = NULL;
+PFNGLCOLORP3UIPROC glad_glColorP3ui = NULL;
+PFNGLCOLORP3UIVPROC glad_glColorP3uiv = NULL;
+PFNGLCOLORP4UIPROC glad_glColorP4ui = NULL;
+PFNGLCOLORP4UIVPROC glad_glColorP4uiv = NULL;
+PFNGLCOLORPOINTERPROC glad_glColorPointer = NULL;
+PFNGLCOMPILESHADERPROC glad_glCompileShader = NULL;
+PFNGLCOMPRESSEDTEXIMAGE1DPROC glad_glCompressedTexImage1D = NULL;
+PFNGLCOMPRESSEDTEXIMAGE2DPROC glad_glCompressedTexImage2D = NULL;
+PFNGLCOMPRESSEDTEXIMAGE3DPROC glad_glCompressedTexImage3D = NULL;
+PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC glad_glCompressedTexSubImage1D = NULL;
+PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC glad_glCompressedTexSubImage2D = NULL;
+PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC glad_glCompressedTexSubImage3D = NULL;
+PFNGLCOPYBUFFERSUBDATAPROC glad_glCopyBufferSubData = NULL;
+PFNGLCOPYPIXELSPROC glad_glCopyPixels = NULL;
+PFNGLCOPYTEXIMAGE1DPROC glad_glCopyTexImage1D = NULL;
+PFNGLCOPYTEXIMAGE2DPROC glad_glCopyTexImage2D = NULL;
+PFNGLCOPYTEXSUBIMAGE1DPROC glad_glCopyTexSubImage1D = NULL;
+PFNGLCOPYTEXSUBIMAGE2DPROC glad_glCopyTexSubImage2D = NULL;
+PFNGLCOPYTEXSUBIMAGE3DPROC glad_glCopyTexSubImage3D = NULL;
+PFNGLCREATEPROGRAMPROC glad_glCreateProgram = NULL;
+PFNGLCREATESHADERPROC glad_glCreateShader = NULL;
+PFNGLCULLFACEPROC glad_glCullFace = NULL;
+PFNGLDEBUGMESSAGECALLBACKPROC glad_glDebugMessageCallback = NULL;
+PFNGLDEBUGMESSAGECONTROLPROC glad_glDebugMessageControl = NULL;
+PFNGLDEBUGMESSAGEINSERTPROC glad_glDebugMessageInsert = NULL;
+PFNGLDELETEBUFFERSPROC glad_glDeleteBuffers = NULL;
+PFNGLDELETEFRAMEBUFFERSPROC glad_glDeleteFramebuffers = NULL;
+PFNGLDELETELISTSPROC glad_glDeleteLists = NULL;
+PFNGLDELETEPROGRAMPROC glad_glDeleteProgram = NULL;
+PFNGLDELETEQUERIESPROC glad_glDeleteQueries = NULL;
+PFNGLDELETERENDERBUFFERSPROC glad_glDeleteRenderbuffers = NULL;
+PFNGLDELETESAMPLERSPROC glad_glDeleteSamplers = NULL;
+PFNGLDELETESHADERPROC glad_glDeleteShader = NULL;
+PFNGLDELETESYNCPROC glad_glDeleteSync = NULL;
+PFNGLDELETETEXTURESPROC glad_glDeleteTextures = NULL;
+PFNGLDELETEVERTEXARRAYSPROC glad_glDeleteVertexArrays = NULL;
+PFNGLDEPTHFUNCPROC glad_glDepthFunc = NULL;
+PFNGLDEPTHMASKPROC glad_glDepthMask = NULL;
+PFNGLDEPTHRANGEPROC glad_glDepthRange = NULL;
+PFNGLDETACHSHADERPROC glad_glDetachShader = NULL;
+PFNGLDISABLEPROC glad_glDisable = NULL;
+PFNGLDISABLECLIENTSTATEPROC glad_glDisableClientState = NULL;
+PFNGLDISABLEVERTEXATTRIBARRAYPROC glad_glDisableVertexAttribArray = NULL;
+PFNGLDISABLEIPROC glad_glDisablei = NULL;
+PFNGLDRAWARRAYSPROC glad_glDrawArrays = NULL;
+PFNGLDRAWARRAYSINSTANCEDPROC glad_glDrawArraysInstanced = NULL;
+PFNGLDRAWBUFFERPROC glad_glDrawBuffer = NULL;
+PFNGLDRAWBUFFERSPROC glad_glDrawBuffers = NULL;
+PFNGLDRAWELEMENTSPROC glad_glDrawElements = NULL;
+PFNGLDRAWELEMENTSBASEVERTEXPROC glad_glDrawElementsBaseVertex = NULL;
+PFNGLDRAWELEMENTSINSTANCEDPROC glad_glDrawElementsInstanced = NULL;
+PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXPROC glad_glDrawElementsInstancedBaseVertex = NULL;
+PFNGLDRAWPIXELSPROC glad_glDrawPixels = NULL;
+PFNGLDRAWRANGEELEMENTSPROC glad_glDrawRangeElements = NULL;
+PFNGLDRAWRANGEELEMENTSBASEVERTEXPROC glad_glDrawRangeElementsBaseVertex = NULL;
+PFNGLEDGEFLAGPROC glad_glEdgeFlag = NULL;
+PFNGLEDGEFLAGPOINTERPROC glad_glEdgeFlagPointer = NULL;
+PFNGLEDGEFLAGVPROC glad_glEdgeFlagv = NULL;
+PFNGLENABLEPROC glad_glEnable = NULL;
+PFNGLENABLECLIENTSTATEPROC glad_glEnableClientState = NULL;
+PFNGLENABLEVERTEXATTRIBARRAYPROC glad_glEnableVertexAttribArray = NULL;
+PFNGLENABLEIPROC glad_glEnablei = NULL;
+PFNGLENDPROC glad_glEnd = NULL;
+PFNGLENDCONDITIONALRENDERPROC glad_glEndConditionalRender = NULL;
+PFNGLENDLISTPROC glad_glEndList = NULL;
+PFNGLENDQUERYPROC glad_glEndQuery = NULL;
+PFNGLENDTRANSFORMFEEDBACKPROC glad_glEndTransformFeedback = NULL;
+PFNGLEVALCOORD1DPROC glad_glEvalCoord1d = NULL;
+PFNGLEVALCOORD1DVPROC glad_glEvalCoord1dv = NULL;
+PFNGLEVALCOORD1FPROC glad_glEvalCoord1f = NULL;
+PFNGLEVALCOORD1FVPROC glad_glEvalCoord1fv = NULL;
+PFNGLEVALCOORD2DPROC glad_glEvalCoord2d = NULL;
+PFNGLEVALCOORD2DVPROC glad_glEvalCoord2dv = NULL;
+PFNGLEVALCOORD2FPROC glad_glEvalCoord2f = NULL;
+PFNGLEVALCOORD2FVPROC glad_glEvalCoord2fv = NULL;
+PFNGLEVALMESH1PROC glad_glEvalMesh1 = NULL;
+PFNGLEVALMESH2PROC glad_glEvalMesh2 = NULL;
+PFNGLEVALPOINT1PROC glad_glEvalPoint1 = NULL;
+PFNGLEVALPOINT2PROC glad_glEvalPoint2 = NULL;
+PFNGLFEEDBACKBUFFERPROC glad_glFeedbackBuffer = NULL;
+PFNGLFENCESYNCPROC glad_glFenceSync = NULL;
+PFNGLFINISHPROC glad_glFinish = NULL;
+PFNGLFLUSHPROC glad_glFlush = NULL;
+PFNGLFLUSHMAPPEDBUFFERRANGEPROC glad_glFlushMappedBufferRange = NULL;
+PFNGLFOGCOORDPOINTERPROC glad_glFogCoordPointer = NULL;
+PFNGLFOGCOORDDPROC glad_glFogCoordd = NULL;
+PFNGLFOGCOORDDVPROC glad_glFogCoorddv = NULL;
+PFNGLFOGCOORDFPROC glad_glFogCoordf = NULL;
+PFNGLFOGCOORDFVPROC glad_glFogCoordfv = NULL;
+PFNGLFOGFPROC glad_glFogf = NULL;
+PFNGLFOGFVPROC glad_glFogfv = NULL;
+PFNGLFOGIPROC glad_glFogi = NULL;
+PFNGLFOGIVPROC glad_glFogiv = NULL;
+PFNGLFRAMEBUFFERRENDERBUFFERPROC glad_glFramebufferRenderbuffer = NULL;
+PFNGLFRAMEBUFFERTEXTUREPROC glad_glFramebufferTexture = NULL;
+PFNGLFRAMEBUFFERTEXTURE1DPROC glad_glFramebufferTexture1D = NULL;
+PFNGLFRAMEBUFFERTEXTURE2DPROC glad_glFramebufferTexture2D = NULL;
+PFNGLFRAMEBUFFERTEXTURE3DPROC glad_glFramebufferTexture3D = NULL;
+PFNGLFRAMEBUFFERTEXTURELAYERPROC glad_glFramebufferTextureLayer = NULL;
+PFNGLFRONTFACEPROC glad_glFrontFace = NULL;
+PFNGLFRUSTUMPROC glad_glFrustum = NULL;
+PFNGLGENBUFFERSPROC glad_glGenBuffers = NULL;
+PFNGLGENFRAMEBUFFERSPROC glad_glGenFramebuffers = NULL;
+PFNGLGENLISTSPROC glad_glGenLists = NULL;
+PFNGLGENQUERIESPROC glad_glGenQueries = NULL;
+PFNGLGENRENDERBUFFERSPROC glad_glGenRenderbuffers = NULL;
+PFNGLGENSAMPLERSPROC glad_glGenSamplers = NULL;
+PFNGLGENTEXTURESPROC glad_glGenTextures = NULL;
+PFNGLGENVERTEXARRAYSPROC glad_glGenVertexArrays = NULL;
+PFNGLGENERATEMIPMAPPROC glad_glGenerateMipmap = NULL;
+PFNGLGETACTIVEATTRIBPROC glad_glGetActiveAttrib = NULL;
+PFNGLGETACTIVEUNIFORMPROC glad_glGetActiveUniform = NULL;
+PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC glad_glGetActiveUniformBlockName = NULL;
+PFNGLGETACTIVEUNIFORMBLOCKIVPROC glad_glGetActiveUniformBlockiv = NULL;
+PFNGLGETACTIVEUNIFORMNAMEPROC glad_glGetActiveUniformName = NULL;
+PFNGLGETACTIVEUNIFORMSIVPROC glad_glGetActiveUniformsiv = NULL;
+PFNGLGETATTACHEDSHADERSPROC glad_glGetAttachedShaders = NULL;
+PFNGLGETATTRIBLOCATIONPROC glad_glGetAttribLocation = NULL;
+PFNGLGETBOOLEANI_VPROC glad_glGetBooleani_v = NULL;
+PFNGLGETBOOLEANVPROC glad_glGetBooleanv = NULL;
+PFNGLGETBUFFERPARAMETERI64VPROC glad_glGetBufferParameteri64v = NULL;
+PFNGLGETBUFFERPARAMETERIVPROC glad_glGetBufferParameteriv = NULL;
+PFNGLGETBUFFERPOINTERVPROC glad_glGetBufferPointerv = NULL;
+PFNGLGETBUFFERSUBDATAPROC glad_glGetBufferSubData = NULL;
+PFNGLGETCLIPPLANEPROC glad_glGetClipPlane = NULL;
+PFNGLGETCOMPRESSEDTEXIMAGEPROC glad_glGetCompressedTexImage = NULL;
+PFNGLGETDEBUGMESSAGELOGPROC glad_glGetDebugMessageLog = NULL;
+PFNGLGETDOUBLEVPROC glad_glGetDoublev = NULL;
+PFNGLGETERRORPROC glad_glGetError = NULL;
+PFNGLGETFLOATVPROC glad_glGetFloatv = NULL;
+PFNGLGETFRAGDATAINDEXPROC glad_glGetFragDataIndex = NULL;
+PFNGLGETFRAGDATALOCATIONPROC glad_glGetFragDataLocation = NULL;
+PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC glad_glGetFramebufferAttachmentParameteriv = NULL;
+PFNGLGETGRAPHICSRESETSTATUSARBPROC glad_glGetGraphicsResetStatusARB = NULL;
+PFNGLGETINTEGER64I_VPROC glad_glGetInteger64i_v = NULL;
+PFNGLGETINTEGER64VPROC glad_glGetInteger64v = NULL;
+PFNGLGETINTEGERI_VPROC glad_glGetIntegeri_v = NULL;
+PFNGLGETINTEGERVPROC glad_glGetIntegerv = NULL;
+PFNGLGETLIGHTFVPROC glad_glGetLightfv = NULL;
+PFNGLGETLIGHTIVPROC glad_glGetLightiv = NULL;
+PFNGLGETMAPDVPROC glad_glGetMapdv = NULL;
+PFNGLGETMAPFVPROC glad_glGetMapfv = NULL;
+PFNGLGETMAPIVPROC glad_glGetMapiv = NULL;
+PFNGLGETMATERIALFVPROC glad_glGetMaterialfv = NULL;
+PFNGLGETMATERIALIVPROC glad_glGetMaterialiv = NULL;
+PFNGLGETMULTISAMPLEFVPROC glad_glGetMultisamplefv = NULL;
+PFNGLGETOBJECTLABELPROC glad_glGetObjectLabel = NULL;
+PFNGLGETOBJECTPTRLABELPROC glad_glGetObjectPtrLabel = NULL;
+PFNGLGETPIXELMAPFVPROC glad_glGetPixelMapfv = NULL;
+PFNGLGETPIXELMAPUIVPROC glad_glGetPixelMapuiv = NULL;
+PFNGLGETPIXELMAPUSVPROC glad_glGetPixelMapusv = NULL;
+PFNGLGETPOINTERVPROC glad_glGetPointerv = NULL;
+PFNGLGETPOLYGONSTIPPLEPROC glad_glGetPolygonStipple = NULL;
+PFNGLGETPROGRAMINFOLOGPROC glad_glGetProgramInfoLog = NULL;
+PFNGLGETPROGRAMIVPROC glad_glGetProgramiv = NULL;
+PFNGLGETQUERYOBJECTI64VPROC glad_glGetQueryObjecti64v = NULL;
+PFNGLGETQUERYOBJECTIVPROC glad_glGetQueryObjectiv = NULL;
+PFNGLGETQUERYOBJECTUI64VPROC glad_glGetQueryObjectui64v = NULL;
+PFNGLGETQUERYOBJECTUIVPROC glad_glGetQueryObjectuiv = NULL;
+PFNGLGETQUERYIVPROC glad_glGetQueryiv = NULL;
+PFNGLGETRENDERBUFFERPARAMETERIVPROC glad_glGetRenderbufferParameteriv = NULL;
+PFNGLGETSAMPLERPARAMETERIIVPROC glad_glGetSamplerParameterIiv = NULL;
+PFNGLGETSAMPLERPARAMETERIUIVPROC glad_glGetSamplerParameterIuiv = NULL;
+PFNGLGETSAMPLERPARAMETERFVPROC glad_glGetSamplerParameterfv = NULL;
+PFNGLGETSAMPLERPARAMETERIVPROC glad_glGetSamplerParameteriv = NULL;
+PFNGLGETSHADERINFOLOGPROC glad_glGetShaderInfoLog = NULL;
+PFNGLGETSHADERSOURCEPROC glad_glGetShaderSource = NULL;
+PFNGLGETSHADERIVPROC glad_glGetShaderiv = NULL;
+PFNGLGETSTRINGPROC glad_glGetString = NULL;
+PFNGLGETSTRINGIPROC glad_glGetStringi = NULL;
+PFNGLGETSYNCIVPROC glad_glGetSynciv = NULL;
+PFNGLGETTEXENVFVPROC glad_glGetTexEnvfv = NULL;
+PFNGLGETTEXENVIVPROC glad_glGetTexEnviv = NULL;
+PFNGLGETTEXGENDVPROC glad_glGetTexGendv = NULL;
+PFNGLGETTEXGENFVPROC glad_glGetTexGenfv = NULL;
+PFNGLGETTEXGENIVPROC glad_glGetTexGeniv = NULL;
+PFNGLGETTEXIMAGEPROC glad_glGetTexImage = NULL;
+PFNGLGETTEXLEVELPARAMETERFVPROC glad_glGetTexLevelParameterfv = NULL;
+PFNGLGETTEXLEVELPARAMETERIVPROC glad_glGetTexLevelParameteriv = NULL;
+PFNGLGETTEXPARAMETERIIVPROC glad_glGetTexParameterIiv = NULL;
+PFNGLGETTEXPARAMETERIUIVPROC glad_glGetTexParameterIuiv = NULL;
+PFNGLGETTEXPARAMETERFVPROC glad_glGetTexParameterfv = NULL;
+PFNGLGETTEXPARAMETERIVPROC glad_glGetTexParameteriv = NULL;
+PFNGLGETTRANSFORMFEEDBACKVARYINGPROC glad_glGetTransformFeedbackVarying = NULL;
+PFNGLGETUNIFORMBLOCKINDEXPROC glad_glGetUniformBlockIndex = NULL;
+PFNGLGETUNIFORMINDICESPROC glad_glGetUniformIndices = NULL;
+PFNGLGETUNIFORMLOCATIONPROC glad_glGetUniformLocation = NULL;
+PFNGLGETUNIFORMFVPROC glad_glGetUniformfv = NULL;
+PFNGLGETUNIFORMIVPROC glad_glGetUniformiv = NULL;
+PFNGLGETUNIFORMUIVPROC glad_glGetUniformuiv = NULL;
+PFNGLGETVERTEXATTRIBIIVPROC glad_glGetVertexAttribIiv = NULL;
+PFNGLGETVERTEXATTRIBIUIVPROC glad_glGetVertexAttribIuiv = NULL;
+PFNGLGETVERTEXATTRIBPOINTERVPROC glad_glGetVertexAttribPointerv = NULL;
+PFNGLGETVERTEXATTRIBDVPROC glad_glGetVertexAttribdv = NULL;
+PFNGLGETVERTEXATTRIBFVPROC glad_glGetVertexAttribfv = NULL;
+PFNGLGETVERTEXATTRIBIVPROC glad_glGetVertexAttribiv = NULL;
+PFNGLGETNCOLORTABLEARBPROC glad_glGetnColorTableARB = NULL;
+PFNGLGETNCOMPRESSEDTEXIMAGEARBPROC glad_glGetnCompressedTexImageARB = NULL;
+PFNGLGETNCONVOLUTIONFILTERARBPROC glad_glGetnConvolutionFilterARB = NULL;
+PFNGLGETNHISTOGRAMARBPROC glad_glGetnHistogramARB = NULL;
+PFNGLGETNMAPDVARBPROC glad_glGetnMapdvARB = NULL;
+PFNGLGETNMAPFVARBPROC glad_glGetnMapfvARB = NULL;
+PFNGLGETNMAPIVARBPROC glad_glGetnMapivARB = NULL;
+PFNGLGETNMINMAXARBPROC glad_glGetnMinmaxARB = NULL;
+PFNGLGETNPIXELMAPFVARBPROC glad_glGetnPixelMapfvARB = NULL;
+PFNGLGETNPIXELMAPUIVARBPROC glad_glGetnPixelMapuivARB = NULL;
+PFNGLGETNPIXELMAPUSVARBPROC glad_glGetnPixelMapusvARB = NULL;
+PFNGLGETNPOLYGONSTIPPLEARBPROC glad_glGetnPolygonStippleARB = NULL;
+PFNGLGETNSEPARABLEFILTERARBPROC glad_glGetnSeparableFilterARB = NULL;
+PFNGLGETNTEXIMAGEARBPROC glad_glGetnTexImageARB = NULL;
+PFNGLGETNUNIFORMDVARBPROC glad_glGetnUniformdvARB = NULL;
+PFNGLGETNUNIFORMFVARBPROC glad_glGetnUniformfvARB = NULL;
+PFNGLGETNUNIFORMIVARBPROC glad_glGetnUniformivARB = NULL;
+PFNGLGETNUNIFORMUIVARBPROC glad_glGetnUniformuivARB = NULL;
+PFNGLHINTPROC glad_glHint = NULL;
+PFNGLINDEXMASKPROC glad_glIndexMask = NULL;
+PFNGLINDEXPOINTERPROC glad_glIndexPointer = NULL;
+PFNGLINDEXDPROC glad_glIndexd = NULL;
+PFNGLINDEXDVPROC glad_glIndexdv = NULL;
+PFNGLINDEXFPROC glad_glIndexf = NULL;
+PFNGLINDEXFVPROC glad_glIndexfv = NULL;
+PFNGLINDEXIPROC glad_glIndexi = NULL;
+PFNGLINDEXIVPROC glad_glIndexiv = NULL;
+PFNGLINDEXSPROC glad_glIndexs = NULL;
+PFNGLINDEXSVPROC glad_glIndexsv = NULL;
+PFNGLINDEXUBPROC glad_glIndexub = NULL;
+PFNGLINDEXUBVPROC glad_glIndexubv = NULL;
+PFNGLINITNAMESPROC glad_glInitNames = NULL;
+PFNGLINTERLEAVEDARRAYSPROC glad_glInterleavedArrays = NULL;
+PFNGLISBUFFERPROC glad_glIsBuffer = NULL;
+PFNGLISENABLEDPROC glad_glIsEnabled = NULL;
+PFNGLISENABLEDIPROC glad_glIsEnabledi = NULL;
+PFNGLISFRAMEBUFFERPROC glad_glIsFramebuffer = NULL;
+PFNGLISLISTPROC glad_glIsList = NULL;
+PFNGLISPROGRAMPROC glad_glIsProgram = NULL;
+PFNGLISQUERYPROC glad_glIsQuery = NULL;
+PFNGLISRENDERBUFFERPROC glad_glIsRenderbuffer = NULL;
+PFNGLISSAMPLERPROC glad_glIsSampler = NULL;
+PFNGLISSHADERPROC glad_glIsShader = NULL;
+PFNGLISSYNCPROC glad_glIsSync = NULL;
+PFNGLISTEXTUREPROC glad_glIsTexture = NULL;
+PFNGLISVERTEXARRAYPROC glad_glIsVertexArray = NULL;
+PFNGLLIGHTMODELFPROC glad_glLightModelf = NULL;
+PFNGLLIGHTMODELFVPROC glad_glLightModelfv = NULL;
+PFNGLLIGHTMODELIPROC glad_glLightModeli = NULL;
+PFNGLLIGHTMODELIVPROC glad_glLightModeliv = NULL;
+PFNGLLIGHTFPROC glad_glLightf = NULL;
+PFNGLLIGHTFVPROC glad_glLightfv = NULL;
+PFNGLLIGHTIPROC glad_glLighti = NULL;
+PFNGLLIGHTIVPROC glad_glLightiv = NULL;
+PFNGLLINESTIPPLEPROC glad_glLineStipple = NULL;
+PFNGLLINEWIDTHPROC glad_glLineWidth = NULL;
+PFNGLLINKPROGRAMPROC glad_glLinkProgram = NULL;
+PFNGLLISTBASEPROC glad_glListBase = NULL;
+PFNGLLOADIDENTITYPROC glad_glLoadIdentity = NULL;
+PFNGLLOADMATRIXDPROC glad_glLoadMatrixd = NULL;
+PFNGLLOADMATRIXFPROC glad_glLoadMatrixf = NULL;
+PFNGLLOADNAMEPROC glad_glLoadName = NULL;
+PFNGLLOADTRANSPOSEMATRIXDPROC glad_glLoadTransposeMatrixd = NULL;
+PFNGLLOADTRANSPOSEMATRIXFPROC glad_glLoadTransposeMatrixf = NULL;
+PFNGLLOGICOPPROC glad_glLogicOp = NULL;
+PFNGLMAP1DPROC glad_glMap1d = NULL;
+PFNGLMAP1FPROC glad_glMap1f = NULL;
+PFNGLMAP2DPROC glad_glMap2d = NULL;
+PFNGLMAP2FPROC glad_glMap2f = NULL;
+PFNGLMAPBUFFERPROC glad_glMapBuffer = NULL;
+PFNGLMAPBUFFERRANGEPROC glad_glMapBufferRange = NULL;
+PFNGLMAPGRID1DPROC glad_glMapGrid1d = NULL;
+PFNGLMAPGRID1FPROC glad_glMapGrid1f = NULL;
+PFNGLMAPGRID2DPROC glad_glMapGrid2d = NULL;
+PFNGLMAPGRID2FPROC glad_glMapGrid2f = NULL;
+PFNGLMATERIALFPROC glad_glMaterialf = NULL;
+PFNGLMATERIALFVPROC glad_glMaterialfv = NULL;
+PFNGLMATERIALIPROC glad_glMateriali = NULL;
+PFNGLMATERIALIVPROC glad_glMaterialiv = NULL;
+PFNGLMATRIXMODEPROC glad_glMatrixMode = NULL;
+PFNGLMULTMATRIXDPROC glad_glMultMatrixd = NULL;
+PFNGLMULTMATRIXFPROC glad_glMultMatrixf = NULL;
+PFNGLMULTTRANSPOSEMATRIXDPROC glad_glMultTransposeMatrixd = NULL;
+PFNGLMULTTRANSPOSEMATRIXFPROC glad_glMultTransposeMatrixf = NULL;
+PFNGLMULTIDRAWARRAYSPROC glad_glMultiDrawArrays = NULL;
+PFNGLMULTIDRAWELEMENTSPROC glad_glMultiDrawElements = NULL;
+PFNGLMULTIDRAWELEMENTSBASEVERTEXPROC glad_glMultiDrawElementsBaseVertex = NULL;
+PFNGLMULTITEXCOORD1DPROC glad_glMultiTexCoord1d = NULL;
+PFNGLMULTITEXCOORD1DVPROC glad_glMultiTexCoord1dv = NULL;
+PFNGLMULTITEXCOORD1FPROC glad_glMultiTexCoord1f = NULL;
+PFNGLMULTITEXCOORD1FVPROC glad_glMultiTexCoord1fv = NULL;
+PFNGLMULTITEXCOORD1IPROC glad_glMultiTexCoord1i = NULL;
+PFNGLMULTITEXCOORD1IVPROC glad_glMultiTexCoord1iv = NULL;
+PFNGLMULTITEXCOORD1SPROC glad_glMultiTexCoord1s = NULL;
+PFNGLMULTITEXCOORD1SVPROC glad_glMultiTexCoord1sv = NULL;
+PFNGLMULTITEXCOORD2DPROC glad_glMultiTexCoord2d = NULL;
+PFNGLMULTITEXCOORD2DVPROC glad_glMultiTexCoord2dv = NULL;
+PFNGLMULTITEXCOORD2FPROC glad_glMultiTexCoord2f = NULL;
+PFNGLMULTITEXCOORD2FVPROC glad_glMultiTexCoord2fv = NULL;
+PFNGLMULTITEXCOORD2IPROC glad_glMultiTexCoord2i = NULL;
+PFNGLMULTITEXCOORD2IVPROC glad_glMultiTexCoord2iv = NULL;
+PFNGLMULTITEXCOORD2SPROC glad_glMultiTexCoord2s = NULL;
+PFNGLMULTITEXCOORD2SVPROC glad_glMultiTexCoord2sv = NULL;
+PFNGLMULTITEXCOORD3DPROC glad_glMultiTexCoord3d = NULL;
+PFNGLMULTITEXCOORD3DVPROC glad_glMultiTexCoord3dv = NULL;
+PFNGLMULTITEXCOORD3FPROC glad_glMultiTexCoord3f = NULL;
+PFNGLMULTITEXCOORD3FVPROC glad_glMultiTexCoord3fv = NULL;
+PFNGLMULTITEXCOORD3IPROC glad_glMultiTexCoord3i = NULL;
+PFNGLMULTITEXCOORD3IVPROC glad_glMultiTexCoord3iv = NULL;
+PFNGLMULTITEXCOORD3SPROC glad_glMultiTexCoord3s = NULL;
+PFNGLMULTITEXCOORD3SVPROC glad_glMultiTexCoord3sv = NULL;
+PFNGLMULTITEXCOORD4DPROC glad_glMultiTexCoord4d = NULL;
+PFNGLMULTITEXCOORD4DVPROC glad_glMultiTexCoord4dv = NULL;
+PFNGLMULTITEXCOORD4FPROC glad_glMultiTexCoord4f = NULL;
+PFNGLMULTITEXCOORD4FVPROC glad_glMultiTexCoord4fv = NULL;
+PFNGLMULTITEXCOORD4IPROC glad_glMultiTexCoord4i = NULL;
+PFNGLMULTITEXCOORD4IVPROC glad_glMultiTexCoord4iv = NULL;
+PFNGLMULTITEXCOORD4SPROC glad_glMultiTexCoord4s = NULL;
+PFNGLMULTITEXCOORD4SVPROC glad_glMultiTexCoord4sv = NULL;
+PFNGLMULTITEXCOORDP1UIPROC glad_glMultiTexCoordP1ui = NULL;
+PFNGLMULTITEXCOORDP1UIVPROC glad_glMultiTexCoordP1uiv = NULL;
+PFNGLMULTITEXCOORDP2UIPROC glad_glMultiTexCoordP2ui = NULL;
+PFNGLMULTITEXCOORDP2UIVPROC glad_glMultiTexCoordP2uiv = NULL;
+PFNGLMULTITEXCOORDP3UIPROC glad_glMultiTexCoordP3ui = NULL;
+PFNGLMULTITEXCOORDP3UIVPROC glad_glMultiTexCoordP3uiv = NULL;
+PFNGLMULTITEXCOORDP4UIPROC glad_glMultiTexCoordP4ui = NULL;
+PFNGLMULTITEXCOORDP4UIVPROC glad_glMultiTexCoordP4uiv = NULL;
+PFNGLNEWLISTPROC glad_glNewList = NULL;
+PFNGLNORMAL3BPROC glad_glNormal3b = NULL;
+PFNGLNORMAL3BVPROC glad_glNormal3bv = NULL;
+PFNGLNORMAL3DPROC glad_glNormal3d = NULL;
+PFNGLNORMAL3DVPROC glad_glNormal3dv = NULL;
+PFNGLNORMAL3FPROC glad_glNormal3f = NULL;
+PFNGLNORMAL3FVPROC glad_glNormal3fv = NULL;
+PFNGLNORMAL3IPROC glad_glNormal3i = NULL;
+PFNGLNORMAL3IVPROC glad_glNormal3iv = NULL;
+PFNGLNORMAL3SPROC glad_glNormal3s = NULL;
+PFNGLNORMAL3SVPROC glad_glNormal3sv = NULL;
+PFNGLNORMALP3UIPROC glad_glNormalP3ui = NULL;
+PFNGLNORMALP3UIVPROC glad_glNormalP3uiv = NULL;
+PFNGLNORMALPOINTERPROC glad_glNormalPointer = NULL;
+PFNGLOBJECTLABELPROC glad_glObjectLabel = NULL;
+PFNGLOBJECTPTRLABELPROC glad_glObjectPtrLabel = NULL;
+PFNGLORTHOPROC glad_glOrtho = NULL;
+PFNGLPASSTHROUGHPROC glad_glPassThrough = NULL;
+PFNGLPIXELMAPFVPROC glad_glPixelMapfv = NULL;
+PFNGLPIXELMAPUIVPROC glad_glPixelMapuiv = NULL;
+PFNGLPIXELMAPUSVPROC glad_glPixelMapusv = NULL;
+PFNGLPIXELSTOREFPROC glad_glPixelStoref = NULL;
+PFNGLPIXELSTOREIPROC glad_glPixelStorei = NULL;
+PFNGLPIXELTRANSFERFPROC glad_glPixelTransferf = NULL;
+PFNGLPIXELTRANSFERIPROC glad_glPixelTransferi = NULL;
+PFNGLPIXELZOOMPROC glad_glPixelZoom = NULL;
+PFNGLPOINTPARAMETERFPROC glad_glPointParameterf = NULL;
+PFNGLPOINTPARAMETERFVPROC glad_glPointParameterfv = NULL;
+PFNGLPOINTPARAMETERIPROC glad_glPointParameteri = NULL;
+PFNGLPOINTPARAMETERIVPROC glad_glPointParameteriv = NULL;
+PFNGLPOINTSIZEPROC glad_glPointSize = NULL;
+PFNGLPOLYGONMODEPROC glad_glPolygonMode = NULL;
+PFNGLPOLYGONOFFSETPROC glad_glPolygonOffset = NULL;
+PFNGLPOLYGONSTIPPLEPROC glad_glPolygonStipple = NULL;
+PFNGLPOPATTRIBPROC glad_glPopAttrib = NULL;
+PFNGLPOPCLIENTATTRIBPROC glad_glPopClientAttrib = NULL;
+PFNGLPOPDEBUGGROUPPROC glad_glPopDebugGroup = NULL;
+PFNGLPOPMATRIXPROC glad_glPopMatrix = NULL;
+PFNGLPOPNAMEPROC glad_glPopName = NULL;
+PFNGLPRIMITIVERESTARTINDEXPROC glad_glPrimitiveRestartIndex = NULL;
+PFNGLPRIORITIZETEXTURESPROC glad_glPrioritizeTextures = NULL;
+PFNGLPROVOKINGVERTEXPROC glad_glProvokingVertex = NULL;
+PFNGLPUSHATTRIBPROC glad_glPushAttrib = NULL;
+PFNGLPUSHCLIENTATTRIBPROC glad_glPushClientAttrib = NULL;
+PFNGLPUSHDEBUGGROUPPROC glad_glPushDebugGroup = NULL;
+PFNGLPUSHMATRIXPROC glad_glPushMatrix = NULL;
+PFNGLPUSHNAMEPROC glad_glPushName = NULL;
+PFNGLQUERYCOUNTERPROC glad_glQueryCounter = NULL;
+PFNGLRASTERPOS2DPROC glad_glRasterPos2d = NULL;
+PFNGLRASTERPOS2DVPROC glad_glRasterPos2dv = NULL;
+PFNGLRASTERPOS2FPROC glad_glRasterPos2f = NULL;
+PFNGLRASTERPOS2FVPROC glad_glRasterPos2fv = NULL;
+PFNGLRASTERPOS2IPROC glad_glRasterPos2i = NULL;
+PFNGLRASTERPOS2IVPROC glad_glRasterPos2iv = NULL;
+PFNGLRASTERPOS2SPROC glad_glRasterPos2s = NULL;
+PFNGLRASTERPOS2SVPROC glad_glRasterPos2sv = NULL;
+PFNGLRASTERPOS3DPROC glad_glRasterPos3d = NULL;
+PFNGLRASTERPOS3DVPROC glad_glRasterPos3dv = NULL;
+PFNGLRASTERPOS3FPROC glad_glRasterPos3f = NULL;
+PFNGLRASTERPOS3FVPROC glad_glRasterPos3fv = NULL;
+PFNGLRASTERPOS3IPROC glad_glRasterPos3i = NULL;
+PFNGLRASTERPOS3IVPROC glad_glRasterPos3iv = NULL;
+PFNGLRASTERPOS3SPROC glad_glRasterPos3s = NULL;
+PFNGLRASTERPOS3SVPROC glad_glRasterPos3sv = NULL;
+PFNGLRASTERPOS4DPROC glad_glRasterPos4d = NULL;
+PFNGLRASTERPOS4DVPROC glad_glRasterPos4dv = NULL;
+PFNGLRASTERPOS4FPROC glad_glRasterPos4f = NULL;
+PFNGLRASTERPOS4FVPROC glad_glRasterPos4fv = NULL;
+PFNGLRASTERPOS4IPROC glad_glRasterPos4i = NULL;
+PFNGLRASTERPOS4IVPROC glad_glRasterPos4iv = NULL;
+PFNGLRASTERPOS4SPROC glad_glRasterPos4s = NULL;
+PFNGLRASTERPOS4SVPROC glad_glRasterPos4sv = NULL;
+PFNGLREADBUFFERPROC glad_glReadBuffer = NULL;
+PFNGLREADPIXELSPROC glad_glReadPixels = NULL;
+PFNGLREADNPIXELSARBPROC glad_glReadnPixelsARB = NULL;
+PFNGLRECTDPROC glad_glRectd = NULL;
+PFNGLRECTDVPROC glad_glRectdv = NULL;
+PFNGLRECTFPROC glad_glRectf = NULL;
+PFNGLRECTFVPROC glad_glRectfv = NULL;
+PFNGLRECTIPROC glad_glRecti = NULL;
+PFNGLRECTIVPROC glad_glRectiv = NULL;
+PFNGLRECTSPROC glad_glRects = NULL;
+PFNGLRECTSVPROC glad_glRectsv = NULL;
+PFNGLRENDERMODEPROC glad_glRenderMode = NULL;
+PFNGLRENDERBUFFERSTORAGEPROC glad_glRenderbufferStorage = NULL;
+PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC glad_glRenderbufferStorageMultisample = NULL;
+PFNGLROTATEDPROC glad_glRotated = NULL;
+PFNGLROTATEFPROC glad_glRotatef = NULL;
+PFNGLSAMPLECOVERAGEPROC glad_glSampleCoverage = NULL;
+PFNGLSAMPLECOVERAGEARBPROC glad_glSampleCoverageARB = NULL;
+PFNGLSAMPLEMASKIPROC glad_glSampleMaski = NULL;
+PFNGLSAMPLERPARAMETERIIVPROC glad_glSamplerParameterIiv = NULL;
+PFNGLSAMPLERPARAMETERIUIVPROC glad_glSamplerParameterIuiv = NULL;
+PFNGLSAMPLERPARAMETERFPROC glad_glSamplerParameterf = NULL;
+PFNGLSAMPLERPARAMETERFVPROC glad_glSamplerParameterfv = NULL;
+PFNGLSAMPLERPARAMETERIPROC glad_glSamplerParameteri = NULL;
+PFNGLSAMPLERPARAMETERIVPROC glad_glSamplerParameteriv = NULL;
+PFNGLSCALEDPROC glad_glScaled = NULL;
+PFNGLSCALEFPROC glad_glScalef = NULL;
+PFNGLSCISSORPROC glad_glScissor = NULL;
+PFNGLSECONDARYCOLOR3BPROC glad_glSecondaryColor3b = NULL;
+PFNGLSECONDARYCOLOR3BVPROC glad_glSecondaryColor3bv = NULL;
+PFNGLSECONDARYCOLOR3DPROC glad_glSecondaryColor3d = NULL;
+PFNGLSECONDARYCOLOR3DVPROC glad_glSecondaryColor3dv = NULL;
+PFNGLSECONDARYCOLOR3FPROC glad_glSecondaryColor3f = NULL;
+PFNGLSECONDARYCOLOR3FVPROC glad_glSecondaryColor3fv = NULL;
+PFNGLSECONDARYCOLOR3IPROC glad_glSecondaryColor3i = NULL;
+PFNGLSECONDARYCOLOR3IVPROC glad_glSecondaryColor3iv = NULL;
+PFNGLSECONDARYCOLOR3SPROC glad_glSecondaryColor3s = NULL;
+PFNGLSECONDARYCOLOR3SVPROC glad_glSecondaryColor3sv = NULL;
+PFNGLSECONDARYCOLOR3UBPROC glad_glSecondaryColor3ub = NULL;
+PFNGLSECONDARYCOLOR3UBVPROC glad_glSecondaryColor3ubv = NULL;
+PFNGLSECONDARYCOLOR3UIPROC glad_glSecondaryColor3ui = NULL;
+PFNGLSECONDARYCOLOR3UIVPROC glad_glSecondaryColor3uiv = NULL;
+PFNGLSECONDARYCOLOR3USPROC glad_glSecondaryColor3us = NULL;
+PFNGLSECONDARYCOLOR3USVPROC glad_glSecondaryColor3usv = NULL;
+PFNGLSECONDARYCOLORP3UIPROC glad_glSecondaryColorP3ui = NULL;
+PFNGLSECONDARYCOLORP3UIVPROC glad_glSecondaryColorP3uiv = NULL;
+PFNGLSECONDARYCOLORPOINTERPROC glad_glSecondaryColorPointer = NULL;
+PFNGLSELECTBUFFERPROC glad_glSelectBuffer = NULL;
+PFNGLSHADEMODELPROC glad_glShadeModel = NULL;
+PFNGLSHADERSOURCEPROC glad_glShaderSource = NULL;
+PFNGLSTENCILFUNCPROC glad_glStencilFunc = NULL;
+PFNGLSTENCILFUNCSEPARATEPROC glad_glStencilFuncSeparate = NULL;
+PFNGLSTENCILMASKPROC glad_glStencilMask = NULL;
+PFNGLSTENCILMASKSEPARATEPROC glad_glStencilMaskSeparate = NULL;
+PFNGLSTENCILOPPROC glad_glStencilOp = NULL;
+PFNGLSTENCILOPSEPARATEPROC glad_glStencilOpSeparate = NULL;
+PFNGLTEXBUFFERPROC glad_glTexBuffer = NULL;
+PFNGLTEXCOORD1DPROC glad_glTexCoord1d = NULL;
+PFNGLTEXCOORD1DVPROC glad_glTexCoord1dv = NULL;
+PFNGLTEXCOORD1FPROC glad_glTexCoord1f = NULL;
+PFNGLTEXCOORD1FVPROC glad_glTexCoord1fv = NULL;
+PFNGLTEXCOORD1IPROC glad_glTexCoord1i = NULL;
+PFNGLTEXCOORD1IVPROC glad_glTexCoord1iv = NULL;
+PFNGLTEXCOORD1SPROC glad_glTexCoord1s = NULL;
+PFNGLTEXCOORD1SVPROC glad_glTexCoord1sv = NULL;
+PFNGLTEXCOORD2DPROC glad_glTexCoord2d = NULL;
+PFNGLTEXCOORD2DVPROC glad_glTexCoord2dv = NULL;
+PFNGLTEXCOORD2FPROC glad_glTexCoord2f = NULL;
+PFNGLTEXCOORD2FVPROC glad_glTexCoord2fv = NULL;
+PFNGLTEXCOORD2IPROC glad_glTexCoord2i = NULL;
+PFNGLTEXCOORD2IVPROC glad_glTexCoord2iv = NULL;
+PFNGLTEXCOORD2SPROC glad_glTexCoord2s = NULL;
+PFNGLTEXCOORD2SVPROC glad_glTexCoord2sv = NULL;
+PFNGLTEXCOORD3DPROC glad_glTexCoord3d = NULL;
+PFNGLTEXCOORD3DVPROC glad_glTexCoord3dv = NULL;
+PFNGLTEXCOORD3FPROC glad_glTexCoord3f = NULL;
+PFNGLTEXCOORD3FVPROC glad_glTexCoord3fv = NULL;
+PFNGLTEXCOORD3IPROC glad_glTexCoord3i = NULL;
+PFNGLTEXCOORD3IVPROC glad_glTexCoord3iv = NULL;
+PFNGLTEXCOORD3SPROC glad_glTexCoord3s = NULL;
+PFNGLTEXCOORD3SVPROC glad_glTexCoord3sv = NULL;
+PFNGLTEXCOORD4DPROC glad_glTexCoord4d = NULL;
+PFNGLTEXCOORD4DVPROC glad_glTexCoord4dv = NULL;
+PFNGLTEXCOORD4FPROC glad_glTexCoord4f = NULL;
+PFNGLTEXCOORD4FVPROC glad_glTexCoord4fv = NULL;
+PFNGLTEXCOORD4IPROC glad_glTexCoord4i = NULL;
+PFNGLTEXCOORD4IVPROC glad_glTexCoord4iv = NULL;
+PFNGLTEXCOORD4SPROC glad_glTexCoord4s = NULL;
+PFNGLTEXCOORD4SVPROC glad_glTexCoord4sv = NULL;
+PFNGLTEXCOORDP1UIPROC glad_glTexCoordP1ui = NULL;
+PFNGLTEXCOORDP1UIVPROC glad_glTexCoordP1uiv = NULL;
+PFNGLTEXCOORDP2UIPROC glad_glTexCoordP2ui = NULL;
+PFNGLTEXCOORDP2UIVPROC glad_glTexCoordP2uiv = NULL;
+PFNGLTEXCOORDP3UIPROC glad_glTexCoordP3ui = NULL;
+PFNGLTEXCOORDP3UIVPROC glad_glTexCoordP3uiv = NULL;
+PFNGLTEXCOORDP4UIPROC glad_glTexCoordP4ui = NULL;
+PFNGLTEXCOORDP4UIVPROC glad_glTexCoordP4uiv = NULL;
+PFNGLTEXCOORDPOINTERPROC glad_glTexCoordPointer = NULL;
+PFNGLTEXENVFPROC glad_glTexEnvf = NULL;
+PFNGLTEXENVFVPROC glad_glTexEnvfv = NULL;
+PFNGLTEXENVIPROC glad_glTexEnvi = NULL;
+PFNGLTEXENVIVPROC glad_glTexEnviv = NULL;
+PFNGLTEXGENDPROC glad_glTexGend = NULL;
+PFNGLTEXGENDVPROC glad_glTexGendv = NULL;
+PFNGLTEXGENFPROC glad_glTexGenf = NULL;
+PFNGLTEXGENFVPROC glad_glTexGenfv = NULL;
+PFNGLTEXGENIPROC glad_glTexGeni = NULL;
+PFNGLTEXGENIVPROC glad_glTexGeniv = NULL;
+PFNGLTEXIMAGE1DPROC glad_glTexImage1D = NULL;
+PFNGLTEXIMAGE2DPROC glad_glTexImage2D = NULL;
+PFNGLTEXIMAGE2DMULTISAMPLEPROC glad_glTexImage2DMultisample = NULL;
+PFNGLTEXIMAGE3DPROC glad_glTexImage3D = NULL;
+PFNGLTEXIMAGE3DMULTISAMPLEPROC glad_glTexImage3DMultisample = NULL;
+PFNGLTEXPARAMETERIIVPROC glad_glTexParameterIiv = NULL;
+PFNGLTEXPARAMETERIUIVPROC glad_glTexParameterIuiv = NULL;
+PFNGLTEXPARAMETERFPROC glad_glTexParameterf = NULL;
+PFNGLTEXPARAMETERFVPROC glad_glTexParameterfv = NULL;
+PFNGLTEXPARAMETERIPROC glad_glTexParameteri = NULL;
+PFNGLTEXPARAMETERIVPROC glad_glTexParameteriv = NULL;
+PFNGLTEXSUBIMAGE1DPROC glad_glTexSubImage1D = NULL;
+PFNGLTEXSUBIMAGE2DPROC glad_glTexSubImage2D = NULL;
+PFNGLTEXSUBIMAGE3DPROC glad_glTexSubImage3D = NULL;
+PFNGLTRANSFORMFEEDBACKVARYINGSPROC glad_glTransformFeedbackVaryings = NULL;
+PFNGLTRANSLATEDPROC glad_glTranslated = NULL;
+PFNGLTRANSLATEFPROC glad_glTranslatef = NULL;
+PFNGLUNIFORM1FPROC glad_glUniform1f = NULL;
+PFNGLUNIFORM1FVPROC glad_glUniform1fv = NULL;
+PFNGLUNIFORM1IPROC glad_glUniform1i = NULL;
+PFNGLUNIFORM1IVPROC glad_glUniform1iv = NULL;
+PFNGLUNIFORM1UIPROC glad_glUniform1ui = NULL;
+PFNGLUNIFORM1UIVPROC glad_glUniform1uiv = NULL;
+PFNGLUNIFORM2FPROC glad_glUniform2f = NULL;
+PFNGLUNIFORM2FVPROC glad_glUniform2fv = NULL;
+PFNGLUNIFORM2IPROC glad_glUniform2i = NULL;
+PFNGLUNIFORM2IVPROC glad_glUniform2iv = NULL;
+PFNGLUNIFORM2UIPROC glad_glUniform2ui = NULL;
+PFNGLUNIFORM2UIVPROC glad_glUniform2uiv = NULL;
+PFNGLUNIFORM3FPROC glad_glUniform3f = NULL;
+PFNGLUNIFORM3FVPROC glad_glUniform3fv = NULL;
+PFNGLUNIFORM3IPROC glad_glUniform3i = NULL;
+PFNGLUNIFORM3IVPROC glad_glUniform3iv = NULL;
+PFNGLUNIFORM3UIPROC glad_glUniform3ui = NULL;
+PFNGLUNIFORM3UIVPROC glad_glUniform3uiv = NULL;
+PFNGLUNIFORM4FPROC glad_glUniform4f = NULL;
+PFNGLUNIFORM4FVPROC glad_glUniform4fv = NULL;
+PFNGLUNIFORM4IPROC glad_glUniform4i = NULL;
+PFNGLUNIFORM4IVPROC glad_glUniform4iv = NULL;
+PFNGLUNIFORM4UIPROC glad_glUniform4ui = NULL;
+PFNGLUNIFORM4UIVPROC glad_glUniform4uiv = NULL;
+PFNGLUNIFORMBLOCKBINDINGPROC glad_glUniformBlockBinding = NULL;
+PFNGLUNIFORMMATRIX2FVPROC glad_glUniformMatrix2fv = NULL;
+PFNGLUNIFORMMATRIX2X3FVPROC glad_glUniformMatrix2x3fv = NULL;
+PFNGLUNIFORMMATRIX2X4FVPROC glad_glUniformMatrix2x4fv = NULL;
+PFNGLUNIFORMMATRIX3FVPROC glad_glUniformMatrix3fv = NULL;
+PFNGLUNIFORMMATRIX3X2FVPROC glad_glUniformMatrix3x2fv = NULL;
+PFNGLUNIFORMMATRIX3X4FVPROC glad_glUniformMatrix3x4fv = NULL;
+PFNGLUNIFORMMATRIX4FVPROC glad_glUniformMatrix4fv = NULL;
+PFNGLUNIFORMMATRIX4X2FVPROC glad_glUniformMatrix4x2fv = NULL;
+PFNGLUNIFORMMATRIX4X3FVPROC glad_glUniformMatrix4x3fv = NULL;
+PFNGLUNMAPBUFFERPROC glad_glUnmapBuffer = NULL;
+PFNGLUSEPROGRAMPROC glad_glUseProgram = NULL;
+PFNGLVALIDATEPROGRAMPROC glad_glValidateProgram = NULL;
+PFNGLVERTEX2DPROC glad_glVertex2d = NULL;
+PFNGLVERTEX2DVPROC glad_glVertex2dv = NULL;
+PFNGLVERTEX2FPROC glad_glVertex2f = NULL;
+PFNGLVERTEX2FVPROC glad_glVertex2fv = NULL;
+PFNGLVERTEX2IPROC glad_glVertex2i = NULL;
+PFNGLVERTEX2IVPROC glad_glVertex2iv = NULL;
+PFNGLVERTEX2SPROC glad_glVertex2s = NULL;
+PFNGLVERTEX2SVPROC glad_glVertex2sv = NULL;
+PFNGLVERTEX3DPROC glad_glVertex3d = NULL;
+PFNGLVERTEX3DVPROC glad_glVertex3dv = NULL;
+PFNGLVERTEX3FPROC glad_glVertex3f = NULL;
+PFNGLVERTEX3FVPROC glad_glVertex3fv = NULL;
+PFNGLVERTEX3IPROC glad_glVertex3i = NULL;
+PFNGLVERTEX3IVPROC glad_glVertex3iv = NULL;
+PFNGLVERTEX3SPROC glad_glVertex3s = NULL;
+PFNGLVERTEX3SVPROC glad_glVertex3sv = NULL;
+PFNGLVERTEX4DPROC glad_glVertex4d = NULL;
+PFNGLVERTEX4DVPROC glad_glVertex4dv = NULL;
+PFNGLVERTEX4FPROC glad_glVertex4f = NULL;
+PFNGLVERTEX4FVPROC glad_glVertex4fv = NULL;
+PFNGLVERTEX4IPROC glad_glVertex4i = NULL;
+PFNGLVERTEX4IVPROC glad_glVertex4iv = NULL;
+PFNGLVERTEX4SPROC glad_glVertex4s = NULL;
+PFNGLVERTEX4SVPROC glad_glVertex4sv = NULL;
+PFNGLVERTEXATTRIB1DPROC glad_glVertexAttrib1d = NULL;
+PFNGLVERTEXATTRIB1DVPROC glad_glVertexAttrib1dv = NULL;
+PFNGLVERTEXATTRIB1FPROC glad_glVertexAttrib1f = NULL;
+PFNGLVERTEXATTRIB1FVPROC glad_glVertexAttrib1fv = NULL;
+PFNGLVERTEXATTRIB1SPROC glad_glVertexAttrib1s = NULL;
+PFNGLVERTEXATTRIB1SVPROC glad_glVertexAttrib1sv = NULL;
+PFNGLVERTEXATTRIB2DPROC glad_glVertexAttrib2d = NULL;
+PFNGLVERTEXATTRIB2DVPROC glad_glVertexAttrib2dv = NULL;
+PFNGLVERTEXATTRIB2FPROC glad_glVertexAttrib2f = NULL;
+PFNGLVERTEXATTRIB2FVPROC glad_glVertexAttrib2fv = NULL;
+PFNGLVERTEXATTRIB2SPROC glad_glVertexAttrib2s = NULL;
+PFNGLVERTEXATTRIB2SVPROC glad_glVertexAttrib2sv = NULL;
+PFNGLVERTEXATTRIB3DPROC glad_glVertexAttrib3d = NULL;
+PFNGLVERTEXATTRIB3DVPROC glad_glVertexAttrib3dv = NULL;
+PFNGLVERTEXATTRIB3FPROC glad_glVertexAttrib3f = NULL;
+PFNGLVERTEXATTRIB3FVPROC glad_glVertexAttrib3fv = NULL;
+PFNGLVERTEXATTRIB3SPROC glad_glVertexAttrib3s = NULL;
+PFNGLVERTEXATTRIB3SVPROC glad_glVertexAttrib3sv = NULL;
+PFNGLVERTEXATTRIB4NBVPROC glad_glVertexAttrib4Nbv = NULL;
+PFNGLVERTEXATTRIB4NIVPROC glad_glVertexAttrib4Niv = NULL;
+PFNGLVERTEXATTRIB4NSVPROC glad_glVertexAttrib4Nsv = NULL;
+PFNGLVERTEXATTRIB4NUBPROC glad_glVertexAttrib4Nub = NULL;
+PFNGLVERTEXATTRIB4NUBVPROC glad_glVertexAttrib4Nubv = NULL;
+PFNGLVERTEXATTRIB4NUIVPROC glad_glVertexAttrib4Nuiv = NULL;
+PFNGLVERTEXATTRIB4NUSVPROC glad_glVertexAttrib4Nusv = NULL;
+PFNGLVERTEXATTRIB4BVPROC glad_glVertexAttrib4bv = NULL;
+PFNGLVERTEXATTRIB4DPROC glad_glVertexAttrib4d = NULL;
+PFNGLVERTEXATTRIB4DVPROC glad_glVertexAttrib4dv = NULL;
+PFNGLVERTEXATTRIB4FPROC glad_glVertexAttrib4f = NULL;
+PFNGLVERTEXATTRIB4FVPROC glad_glVertexAttrib4fv = NULL;
+PFNGLVERTEXATTRIB4IVPROC glad_glVertexAttrib4iv = NULL;
+PFNGLVERTEXATTRIB4SPROC glad_glVertexAttrib4s = NULL;
+PFNGLVERTEXATTRIB4SVPROC glad_glVertexAttrib4sv = NULL;
+PFNGLVERTEXATTRIB4UBVPROC glad_glVertexAttrib4ubv = NULL;
+PFNGLVERTEXATTRIB4UIVPROC glad_glVertexAttrib4uiv = NULL;
+PFNGLVERTEXATTRIB4USVPROC glad_glVertexAttrib4usv = NULL;
+PFNGLVERTEXATTRIBDIVISORPROC glad_glVertexAttribDivisor = NULL;
+PFNGLVERTEXATTRIBI1IPROC glad_glVertexAttribI1i = NULL;
+PFNGLVERTEXATTRIBI1IVPROC glad_glVertexAttribI1iv = NULL;
+PFNGLVERTEXATTRIBI1UIPROC glad_glVertexAttribI1ui = NULL;
+PFNGLVERTEXATTRIBI1UIVPROC glad_glVertexAttribI1uiv = NULL;
+PFNGLVERTEXATTRIBI2IPROC glad_glVertexAttribI2i = NULL;
+PFNGLVERTEXATTRIBI2IVPROC glad_glVertexAttribI2iv = NULL;
+PFNGLVERTEXATTRIBI2UIPROC glad_glVertexAttribI2ui = NULL;
+PFNGLVERTEXATTRIBI2UIVPROC glad_glVertexAttribI2uiv = NULL;
+PFNGLVERTEXATTRIBI3IPROC glad_glVertexAttribI3i = NULL;
+PFNGLVERTEXATTRIBI3IVPROC glad_glVertexAttribI3iv = NULL;
+PFNGLVERTEXATTRIBI3UIPROC glad_glVertexAttribI3ui = NULL;
+PFNGLVERTEXATTRIBI3UIVPROC glad_glVertexAttribI3uiv = NULL;
+PFNGLVERTEXATTRIBI4BVPROC glad_glVertexAttribI4bv = NULL;
+PFNGLVERTEXATTRIBI4IPROC glad_glVertexAttribI4i = NULL;
+PFNGLVERTEXATTRIBI4IVPROC glad_glVertexAttribI4iv = NULL;
+PFNGLVERTEXATTRIBI4SVPROC glad_glVertexAttribI4sv = NULL;
+PFNGLVERTEXATTRIBI4UBVPROC glad_glVertexAttribI4ubv = NULL;
+PFNGLVERTEXATTRIBI4UIPROC glad_glVertexAttribI4ui = NULL;
+PFNGLVERTEXATTRIBI4UIVPROC glad_glVertexAttribI4uiv = NULL;
+PFNGLVERTEXATTRIBI4USVPROC glad_glVertexAttribI4usv = NULL;
+PFNGLVERTEXATTRIBIPOINTERPROC glad_glVertexAttribIPointer = NULL;
+PFNGLVERTEXATTRIBP1UIPROC glad_glVertexAttribP1ui = NULL;
+PFNGLVERTEXATTRIBP1UIVPROC glad_glVertexAttribP1uiv = NULL;
+PFNGLVERTEXATTRIBP2UIPROC glad_glVertexAttribP2ui = NULL;
+PFNGLVERTEXATTRIBP2UIVPROC glad_glVertexAttribP2uiv = NULL;
+PFNGLVERTEXATTRIBP3UIPROC glad_glVertexAttribP3ui = NULL;
+PFNGLVERTEXATTRIBP3UIVPROC glad_glVertexAttribP3uiv = NULL;
+PFNGLVERTEXATTRIBP4UIPROC glad_glVertexAttribP4ui = NULL;
+PFNGLVERTEXATTRIBP4UIVPROC glad_glVertexAttribP4uiv = NULL;
+PFNGLVERTEXATTRIBPOINTERPROC glad_glVertexAttribPointer = NULL;
+PFNGLVERTEXP2UIPROC glad_glVertexP2ui = NULL;
+PFNGLVERTEXP2UIVPROC glad_glVertexP2uiv = NULL;
+PFNGLVERTEXP3UIPROC glad_glVertexP3ui = NULL;
+PFNGLVERTEXP3UIVPROC glad_glVertexP3uiv = NULL;
+PFNGLVERTEXP4UIPROC glad_glVertexP4ui = NULL;
+PFNGLVERTEXP4UIVPROC glad_glVertexP4uiv = NULL;
+PFNGLVERTEXPOINTERPROC glad_glVertexPointer = NULL;
+PFNGLVIEWPORTPROC glad_glViewport = NULL;
+PFNGLWAITSYNCPROC glad_glWaitSync = NULL;
+PFNGLWINDOWPOS2DPROC glad_glWindowPos2d = NULL;
+PFNGLWINDOWPOS2DVPROC glad_glWindowPos2dv = NULL;
+PFNGLWINDOWPOS2FPROC glad_glWindowPos2f = NULL;
+PFNGLWINDOWPOS2FVPROC glad_glWindowPos2fv = NULL;
+PFNGLWINDOWPOS2IPROC glad_glWindowPos2i = NULL;
+PFNGLWINDOWPOS2IVPROC glad_glWindowPos2iv = NULL;
+PFNGLWINDOWPOS2SPROC glad_glWindowPos2s = NULL;
+PFNGLWINDOWPOS2SVPROC glad_glWindowPos2sv = NULL;
+PFNGLWINDOWPOS3DPROC glad_glWindowPos3d = NULL;
+PFNGLWINDOWPOS3DVPROC glad_glWindowPos3dv = NULL;
+PFNGLWINDOWPOS3FPROC glad_glWindowPos3f = NULL;
+PFNGLWINDOWPOS3FVPROC glad_glWindowPos3fv = NULL;
+PFNGLWINDOWPOS3IPROC glad_glWindowPos3i = NULL;
+PFNGLWINDOWPOS3IVPROC glad_glWindowPos3iv = NULL;
+PFNGLWINDOWPOS3SPROC glad_glWindowPos3s = NULL;
+PFNGLWINDOWPOS3SVPROC glad_glWindowPos3sv = NULL;
+
+
+static void glad_gl_load_GL_VERSION_1_0( GLADuserptrloadfunc load, void* userptr) {
+    if(!GLAD_GL_VERSION_1_0) return;
+    glad_glAccum = (PFNGLACCUMPROC) load(userptr, "glAccum");
+    glad_glAlphaFunc = (PFNGLALPHAFUNCPROC) load(userptr, "glAlphaFunc");
+    glad_glBegin = (PFNGLBEGINPROC) load(userptr, "glBegin");
+    glad_glBitmap = (PFNGLBITMAPPROC) load(userptr, "glBitmap");
+    glad_glBlendFunc = (PFNGLBLENDFUNCPROC) load(userptr, "glBlendFunc");
+    glad_glCallList = (PFNGLCALLLISTPROC) load(userptr, "glCallList");
+    glad_glCallLists = (PFNGLCALLLISTSPROC) load(userptr, "glCallLists");
+    glad_glClear = (PFNGLCLEARPROC) load(userptr, "glClear");
+    glad_glClearAccum = (PFNGLCLEARACCUMPROC) load(userptr, "glClearAccum");
+    glad_glClearColor = (PFNGLCLEARCOLORPROC) load(userptr, "glClearColor");
+    glad_glClearDepth = (PFNGLCLEARDEPTHPROC) load(userptr, "glClearDepth");
+    glad_glClearIndex = (PFNGLCLEARINDEXPROC) load(userptr, "glClearIndex");
+    glad_glClearStencil = (PFNGLCLEARSTENCILPROC) load(userptr, "glClearStencil");
+    glad_glClipPlane = (PFNGLCLIPPLANEPROC) load(userptr, "glClipPlane");
+    glad_glColor3b = (PFNGLCOLOR3BPROC) load(userptr, "glColor3b");
+    glad_glColor3bv = (PFNGLCOLOR3BVPROC) load(userptr, "glColor3bv");
+    glad_glColor3d = (PFNGLCOLOR3DPROC) load(userptr, "glColor3d");
+    glad_glColor3dv = (PFNGLCOLOR3DVPROC) load(userptr, "glColor3dv");
+    glad_glColor3f = (PFNGLCOLOR3FPROC) load(userptr, "glColor3f");
+    glad_glColor3fv = (PFNGLCOLOR3FVPROC) load(userptr, "glColor3fv");
+    glad_glColor3i = (PFNGLCOLOR3IPROC) load(userptr, "glColor3i");
+    glad_glColor3iv = (PFNGLCOLOR3IVPROC) load(userptr, "glColor3iv");
+    glad_glColor3s = (PFNGLCOLOR3SPROC) load(userptr, "glColor3s");
+    glad_glColor3sv = (PFNGLCOLOR3SVPROC) load(userptr, "glColor3sv");
+    glad_glColor3ub = (PFNGLCOLOR3UBPROC) load(userptr, "glColor3ub");
+    glad_glColor3ubv = (PFNGLCOLOR3UBVPROC) load(userptr, "glColor3ubv");
+    glad_glColor3ui = (PFNGLCOLOR3UIPROC) load(userptr, "glColor3ui");
+    glad_glColor3uiv = (PFNGLCOLOR3UIVPROC) load(userptr, "glColor3uiv");
+    glad_glColor3us = (PFNGLCOLOR3USPROC) load(userptr, "glColor3us");
+    glad_glColor3usv = (PFNGLCOLOR3USVPROC) load(userptr, "glColor3usv");
+    glad_glColor4b = (PFNGLCOLOR4BPROC) load(userptr, "glColor4b");
+    glad_glColor4bv = (PFNGLCOLOR4BVPROC) load(userptr, "glColor4bv");
+    glad_glColor4d = (PFNGLCOLOR4DPROC) load(userptr, "glColor4d");
+    glad_glColor4dv = (PFNGLCOLOR4DVPROC) load(userptr, "glColor4dv");
+    glad_glColor4f = (PFNGLCOLOR4FPROC) load(userptr, "glColor4f");
+    glad_glColor4fv = (PFNGLCOLOR4FVPROC) load(userptr, "glColor4fv");
+    glad_glColor4i = (PFNGLCOLOR4IPROC) load(userptr, "glColor4i");
+    glad_glColor4iv = (PFNGLCOLOR4IVPROC) load(userptr, "glColor4iv");
+    glad_glColor4s = (PFNGLCOLOR4SPROC) load(userptr, "glColor4s");
+    glad_glColor4sv = (PFNGLCOLOR4SVPROC) load(userptr, "glColor4sv");
+    glad_glColor4ub = (PFNGLCOLOR4UBPROC) load(userptr, "glColor4ub");
+    glad_glColor4ubv = (PFNGLCOLOR4UBVPROC) load(userptr, "glColor4ubv");
+    glad_glColor4ui = (PFNGLCOLOR4UIPROC) load(userptr, "glColor4ui");
+    glad_glColor4uiv = (PFNGLCOLOR4UIVPROC) load(userptr, "glColor4uiv");
+    glad_glColor4us = (PFNGLCOLOR4USPROC) load(userptr, "glColor4us");
+    glad_glColor4usv = (PFNGLCOLOR4USVPROC) load(userptr, "glColor4usv");
+    glad_glColorMask = (PFNGLCOLORMASKPROC) load(userptr, "glColorMask");
+    glad_glColorMaterial = (PFNGLCOLORMATERIALPROC) load(userptr, "glColorMaterial");
+    glad_glCopyPixels = (PFNGLCOPYPIXELSPROC) load(userptr, "glCopyPixels");
+    glad_glCullFace = (PFNGLCULLFACEPROC) load(userptr, "glCullFace");
+    glad_glDeleteLists = (PFNGLDELETELISTSPROC) load(userptr, "glDeleteLists");
+    glad_glDepthFunc = (PFNGLDEPTHFUNCPROC) load(userptr, "glDepthFunc");
+    glad_glDepthMask = (PFNGLDEPTHMASKPROC) load(userptr, "glDepthMask");
+    glad_glDepthRange = (PFNGLDEPTHRANGEPROC) load(userptr, "glDepthRange");
+    glad_glDisable = (PFNGLDISABLEPROC) load(userptr, "glDisable");
+    glad_glDrawBuffer = (PFNGLDRAWBUFFERPROC) load(userptr, "glDrawBuffer");
+    glad_glDrawPixels = (PFNGLDRAWPIXELSPROC) load(userptr, "glDrawPixels");
+    glad_glEdgeFlag = (PFNGLEDGEFLAGPROC) load(userptr, "glEdgeFlag");
+    glad_glEdgeFlagv = (PFNGLEDGEFLAGVPROC) load(userptr, "glEdgeFlagv");
+    glad_glEnable = (PFNGLENABLEPROC) load(userptr, "glEnable");
+    glad_glEnd = (PFNGLENDPROC) load(userptr, "glEnd");
+    glad_glEndList = (PFNGLENDLISTPROC) load(userptr, "glEndList");
+    glad_glEvalCoord1d = (PFNGLEVALCOORD1DPROC) load(userptr, "glEvalCoord1d");
+    glad_glEvalCoord1dv = (PFNGLEVALCOORD1DVPROC) load(userptr, "glEvalCoord1dv");
+    glad_glEvalCoord1f = (PFNGLEVALCOORD1FPROC) load(userptr, "glEvalCoord1f");
+    glad_glEvalCoord1fv = (PFNGLEVALCOORD1FVPROC) load(userptr, "glEvalCoord1fv");
+    glad_glEvalCoord2d = (PFNGLEVALCOORD2DPROC) load(userptr, "glEvalCoord2d");
+    glad_glEvalCoord2dv = (PFNGLEVALCOORD2DVPROC) load(userptr, "glEvalCoord2dv");
+    glad_glEvalCoord2f = (PFNGLEVALCOORD2FPROC) load(userptr, "glEvalCoord2f");
+    glad_glEvalCoord2fv = (PFNGLEVALCOORD2FVPROC) load(userptr, "glEvalCoord2fv");
+    glad_glEvalMesh1 = (PFNGLEVALMESH1PROC) load(userptr, "glEvalMesh1");
+    glad_glEvalMesh2 = (PFNGLEVALMESH2PROC) load(userptr, "glEvalMesh2");
+    glad_glEvalPoint1 = (PFNGLEVALPOINT1PROC) load(userptr, "glEvalPoint1");
+    glad_glEvalPoint2 = (PFNGLEVALPOINT2PROC) load(userptr, "glEvalPoint2");
+    glad_glFeedbackBuffer = (PFNGLFEEDBACKBUFFERPROC) load(userptr, "glFeedbackBuffer");
+    glad_glFinish = (PFNGLFINISHPROC) load(userptr, "glFinish");
+    glad_glFlush = (PFNGLFLUSHPROC) load(userptr, "glFlush");
+    glad_glFogf = (PFNGLFOGFPROC) load(userptr, "glFogf");
+    glad_glFogfv = (PFNGLFOGFVPROC) load(userptr, "glFogfv");
+    glad_glFogi = (PFNGLFOGIPROC) load(userptr, "glFogi");
+    glad_glFogiv = (PFNGLFOGIVPROC) load(userptr, "glFogiv");
+    glad_glFrontFace = (PFNGLFRONTFACEPROC) load(userptr, "glFrontFace");
+    glad_glFrustum = (PFNGLFRUSTUMPROC) load(userptr, "glFrustum");
+    glad_glGenLists = (PFNGLGENLISTSPROC) load(userptr, "glGenLists");
+    glad_glGetBooleanv = (PFNGLGETBOOLEANVPROC) load(userptr, "glGetBooleanv");
+    glad_glGetClipPlane = (PFNGLGETCLIPPLANEPROC) load(userptr, "glGetClipPlane");
+    glad_glGetDoublev = (PFNGLGETDOUBLEVPROC) load(userptr, "glGetDoublev");
+    glad_glGetError = (PFNGLGETERRORPROC) load(userptr, "glGetError");
+    glad_glGetFloatv = (PFNGLGETFLOATVPROC) load(userptr, "glGetFloatv");
+    glad_glGetIntegerv = (PFNGLGETINTEGERVPROC) load(userptr, "glGetIntegerv");
+    glad_glGetLightfv = (PFNGLGETLIGHTFVPROC) load(userptr, "glGetLightfv");
+    glad_glGetLightiv = (PFNGLGETLIGHTIVPROC) load(userptr, "glGetLightiv");
+    glad_glGetMapdv = (PFNGLGETMAPDVPROC) load(userptr, "glGetMapdv");
+    glad_glGetMapfv = (PFNGLGETMAPFVPROC) load(userptr, "glGetMapfv");
+    glad_glGetMapiv = (PFNGLGETMAPIVPROC) load(userptr, "glGetMapiv");
+    glad_glGetMaterialfv = (PFNGLGETMATERIALFVPROC) load(userptr, "glGetMaterialfv");
+    glad_glGetMaterialiv = (PFNGLGETMATERIALIVPROC) load(userptr, "glGetMaterialiv");
+    glad_glGetPixelMapfv = (PFNGLGETPIXELMAPFVPROC) load(userptr, "glGetPixelMapfv");
+    glad_glGetPixelMapuiv = (PFNGLGETPIXELMAPUIVPROC) load(userptr, "glGetPixelMapuiv");
+    glad_glGetPixelMapusv = (PFNGLGETPIXELMAPUSVPROC) load(userptr, "glGetPixelMapusv");
+    glad_glGetPolygonStipple = (PFNGLGETPOLYGONSTIPPLEPROC) load(userptr, "glGetPolygonStipple");
+    glad_glGetString = (PFNGLGETSTRINGPROC) load(userptr, "glGetString");
+    glad_glGetTexEnvfv = (PFNGLGETTEXENVFVPROC) load(userptr, "glGetTexEnvfv");
+    glad_glGetTexEnviv = (PFNGLGETTEXENVIVPROC) load(userptr, "glGetTexEnviv");
+    glad_glGetTexGendv = (PFNGLGETTEXGENDVPROC) load(userptr, "glGetTexGendv");
+    glad_glGetTexGenfv = (PFNGLGETTEXGENFVPROC) load(userptr, "glGetTexGenfv");
+    glad_glGetTexGeniv = (PFNGLGETTEXGENIVPROC) load(userptr, "glGetTexGeniv");
+    glad_glGetTexImage = (PFNGLGETTEXIMAGEPROC) load(userptr, "glGetTexImage");
+    glad_glGetTexLevelParameterfv = (PFNGLGETTEXLEVELPARAMETERFVPROC) load(userptr, "glGetTexLevelParameterfv");
+    glad_glGetTexLevelParameteriv = (PFNGLGETTEXLEVELPARAMETERIVPROC) load(userptr, "glGetTexLevelParameteriv");
+    glad_glGetTexParameterfv = (PFNGLGETTEXPARAMETERFVPROC) load(userptr, "glGetTexParameterfv");
+    glad_glGetTexParameteriv = (PFNGLGETTEXPARAMETERIVPROC) load(userptr, "glGetTexParameteriv");
+    glad_glHint = (PFNGLHINTPROC) load(userptr, "glHint");
+    glad_glIndexMask = (PFNGLINDEXMASKPROC) load(userptr, "glIndexMask");
+    glad_glIndexd = (PFNGLINDEXDPROC) load(userptr, "glIndexd");
+    glad_glIndexdv = (PFNGLINDEXDVPROC) load(userptr, "glIndexdv");
+    glad_glIndexf = (PFNGLINDEXFPROC) load(userptr, "glIndexf");
+    glad_glIndexfv = (PFNGLINDEXFVPROC) load(userptr, "glIndexfv");
+    glad_glIndexi = (PFNGLINDEXIPROC) load(userptr, "glIndexi");
+    glad_glIndexiv = (PFNGLINDEXIVPROC) load(userptr, "glIndexiv");
+    glad_glIndexs = (PFNGLINDEXSPROC) load(userptr, "glIndexs");
+    glad_glIndexsv = (PFNGLINDEXSVPROC) load(userptr, "glIndexsv");
+    glad_glInitNames = (PFNGLINITNAMESPROC) load(userptr, "glInitNames");
+    glad_glIsEnabled = (PFNGLISENABLEDPROC) load(userptr, "glIsEnabled");
+    glad_glIsList = (PFNGLISLISTPROC) load(userptr, "glIsList");
+    glad_glLightModelf = (PFNGLLIGHTMODELFPROC) load(userptr, "glLightModelf");
+    glad_glLightModelfv = (PFNGLLIGHTMODELFVPROC) load(userptr, "glLightModelfv");
+    glad_glLightModeli = (PFNGLLIGHTMODELIPROC) load(userptr, "glLightModeli");
+    glad_glLightModeliv = (PFNGLLIGHTMODELIVPROC) load(userptr, "glLightModeliv");
+    glad_glLightf = (PFNGLLIGHTFPROC) load(userptr, "glLightf");
+    glad_glLightfv = (PFNGLLIGHTFVPROC) load(userptr, "glLightfv");
+    glad_glLighti = (PFNGLLIGHTIPROC) load(userptr, "glLighti");
+    glad_glLightiv = (PFNGLLIGHTIVPROC) load(userptr, "glLightiv");
+    glad_glLineStipple = (PFNGLLINESTIPPLEPROC) load(userptr, "glLineStipple");
+    glad_glLineWidth = (PFNGLLINEWIDTHPROC) load(userptr, "glLineWidth");
+    glad_glListBase = (PFNGLLISTBASEPROC) load(userptr, "glListBase");
+    glad_glLoadIdentity = (PFNGLLOADIDENTITYPROC) load(userptr, "glLoadIdentity");
+    glad_glLoadMatrixd = (PFNGLLOADMATRIXDPROC) load(userptr, "glLoadMatrixd");
+    glad_glLoadMatrixf = (PFNGLLOADMATRIXFPROC) load(userptr, "glLoadMatrixf");
+    glad_glLoadName = (PFNGLLOADNAMEPROC) load(userptr, "glLoadName");
+    glad_glLogicOp = (PFNGLLOGICOPPROC) load(userptr, "glLogicOp");
+    glad_glMap1d = (PFNGLMAP1DPROC) load(userptr, "glMap1d");
+    glad_glMap1f = (PFNGLMAP1FPROC) load(userptr, "glMap1f");
+    glad_glMap2d = (PFNGLMAP2DPROC) load(userptr, "glMap2d");
+    glad_glMap2f = (PFNGLMAP2FPROC) load(userptr, "glMap2f");
+    glad_glMapGrid1d = (PFNGLMAPGRID1DPROC) load(userptr, "glMapGrid1d");
+    glad_glMapGrid1f = (PFNGLMAPGRID1FPROC) load(userptr, "glMapGrid1f");
+    glad_glMapGrid2d = (PFNGLMAPGRID2DPROC) load(userptr, "glMapGrid2d");
+    glad_glMapGrid2f = (PFNGLMAPGRID2FPROC) load(userptr, "glMapGrid2f");
+    glad_glMaterialf = (PFNGLMATERIALFPROC) load(userptr, "glMaterialf");
+    glad_glMaterialfv = (PFNGLMATERIALFVPROC) load(userptr, "glMaterialfv");
+    glad_glMateriali = (PFNGLMATERIALIPROC) load(userptr, "glMateriali");
+    glad_glMaterialiv = (PFNGLMATERIALIVPROC) load(userptr, "glMaterialiv");
+    glad_glMatrixMode = (PFNGLMATRIXMODEPROC) load(userptr, "glMatrixMode");
+    glad_glMultMatrixd = (PFNGLMULTMATRIXDPROC) load(userptr, "glMultMatrixd");
+    glad_glMultMatrixf = (PFNGLMULTMATRIXFPROC) load(userptr, "glMultMatrixf");
+    glad_glNewList = (PFNGLNEWLISTPROC) load(userptr, "glNewList");
+    glad_glNormal3b = (PFNGLNORMAL3BPROC) load(userptr, "glNormal3b");
+    glad_glNormal3bv = (PFNGLNORMAL3BVPROC) load(userptr, "glNormal3bv");
+    glad_glNormal3d = (PFNGLNORMAL3DPROC) load(userptr, "glNormal3d");
+    glad_glNormal3dv = (PFNGLNORMAL3DVPROC) load(userptr, "glNormal3dv");
+    glad_glNormal3f = (PFNGLNORMAL3FPROC) load(userptr, "glNormal3f");
+    glad_glNormal3fv = (PFNGLNORMAL3FVPROC) load(userptr, "glNormal3fv");
+    glad_glNormal3i = (PFNGLNORMAL3IPROC) load(userptr, "glNormal3i");
+    glad_glNormal3iv = (PFNGLNORMAL3IVPROC) load(userptr, "glNormal3iv");
+    glad_glNormal3s = (PFNGLNORMAL3SPROC) load(userptr, "glNormal3s");
+    glad_glNormal3sv = (PFNGLNORMAL3SVPROC) load(userptr, "glNormal3sv");
+    glad_glOrtho = (PFNGLORTHOPROC) load(userptr, "glOrtho");
+    glad_glPassThrough = (PFNGLPASSTHROUGHPROC) load(userptr, "glPassThrough");
+    glad_glPixelMapfv = (PFNGLPIXELMAPFVPROC) load(userptr, "glPixelMapfv");
+    glad_glPixelMapuiv = (PFNGLPIXELMAPUIVPROC) load(userptr, "glPixelMapuiv");
+    glad_glPixelMapusv = (PFNGLPIXELMAPUSVPROC) load(userptr, "glPixelMapusv");
+    glad_glPixelStoref = (PFNGLPIXELSTOREFPROC) load(userptr, "glPixelStoref");
+    glad_glPixelStorei = (PFNGLPIXELSTOREIPROC) load(userptr, "glPixelStorei");
+    glad_glPixelTransferf = (PFNGLPIXELTRANSFERFPROC) load(userptr, "glPixelTransferf");
+    glad_glPixelTransferi = (PFNGLPIXELTRANSFERIPROC) load(userptr, "glPixelTransferi");
+    glad_glPixelZoom = (PFNGLPIXELZOOMPROC) load(userptr, "glPixelZoom");
+    glad_glPointSize = (PFNGLPOINTSIZEPROC) load(userptr, "glPointSize");
+    glad_glPolygonMode = (PFNGLPOLYGONMODEPROC) load(userptr, "glPolygonMode");
+    glad_glPolygonStipple = (PFNGLPOLYGONSTIPPLEPROC) load(userptr, "glPolygonStipple");
+    glad_glPopAttrib = (PFNGLPOPATTRIBPROC) load(userptr, "glPopAttrib");
+    glad_glPopMatrix = (PFNGLPOPMATRIXPROC) load(userptr, "glPopMatrix");
+    glad_glPopName = (PFNGLPOPNAMEPROC) load(userptr, "glPopName");
+    glad_glPushAttrib = (PFNGLPUSHATTRIBPROC) load(userptr, "glPushAttrib");
+    glad_glPushMatrix = (PFNGLPUSHMATRIXPROC) load(userptr, "glPushMatrix");
+    glad_glPushName = (PFNGLPUSHNAMEPROC) load(userptr, "glPushName");
+    glad_glRasterPos2d = (PFNGLRASTERPOS2DPROC) load(userptr, "glRasterPos2d");
+    glad_glRasterPos2dv = (PFNGLRASTERPOS2DVPROC) load(userptr, "glRasterPos2dv");
+    glad_glRasterPos2f = (PFNGLRASTERPOS2FPROC) load(userptr, "glRasterPos2f");
+    glad_glRasterPos2fv = (PFNGLRASTERPOS2FVPROC) load(userptr, "glRasterPos2fv");
+    glad_glRasterPos2i = (PFNGLRASTERPOS2IPROC) load(userptr, "glRasterPos2i");
+    glad_glRasterPos2iv = (PFNGLRASTERPOS2IVPROC) load(userptr, "glRasterPos2iv");
+    glad_glRasterPos2s = (PFNGLRASTERPOS2SPROC) load(userptr, "glRasterPos2s");
+    glad_glRasterPos2sv = (PFNGLRASTERPOS2SVPROC) load(userptr, "glRasterPos2sv");
+    glad_glRasterPos3d = (PFNGLRASTERPOS3DPROC) load(userptr, "glRasterPos3d");
+    glad_glRasterPos3dv = (PFNGLRASTERPOS3DVPROC) load(userptr, "glRasterPos3dv");
+    glad_glRasterPos3f = (PFNGLRASTERPOS3FPROC) load(userptr, "glRasterPos3f");
+    glad_glRasterPos3fv = (PFNGLRASTERPOS3FVPROC) load(userptr, "glRasterPos3fv");
+    glad_glRasterPos3i = (PFNGLRASTERPOS3IPROC) load(userptr, "glRasterPos3i");
+    glad_glRasterPos3iv = (PFNGLRASTERPOS3IVPROC) load(userptr, "glRasterPos3iv");
+    glad_glRasterPos3s = (PFNGLRASTERPOS3SPROC) load(userptr, "glRasterPos3s");
+    glad_glRasterPos3sv = (PFNGLRASTERPOS3SVPROC) load(userptr, "glRasterPos3sv");
+    glad_glRasterPos4d = (PFNGLRASTERPOS4DPROC) load(userptr, "glRasterPos4d");
+    glad_glRasterPos4dv = (PFNGLRASTERPOS4DVPROC) load(userptr, "glRasterPos4dv");
+    glad_glRasterPos4f = (PFNGLRASTERPOS4FPROC) load(userptr, "glRasterPos4f");
+    glad_glRasterPos4fv = (PFNGLRASTERPOS4FVPROC) load(userptr, "glRasterPos4fv");
+    glad_glRasterPos4i = (PFNGLRASTERPOS4IPROC) load(userptr, "glRasterPos4i");
+    glad_glRasterPos4iv = (PFNGLRASTERPOS4IVPROC) load(userptr, "glRasterPos4iv");
+    glad_glRasterPos4s = (PFNGLRASTERPOS4SPROC) load(userptr, "glRasterPos4s");
+    glad_glRasterPos4sv = (PFNGLRASTERPOS4SVPROC) load(userptr, "glRasterPos4sv");
+    glad_glReadBuffer = (PFNGLREADBUFFERPROC) load(userptr, "glReadBuffer");
+    glad_glReadPixels = (PFNGLREADPIXELSPROC) load(userptr, "glReadPixels");
+    glad_glRectd = (PFNGLRECTDPROC) load(userptr, "glRectd");
+    glad_glRectdv = (PFNGLRECTDVPROC) load(userptr, "glRectdv");
+    glad_glRectf = (PFNGLRECTFPROC) load(userptr, "glRectf");
+    glad_glRectfv = (PFNGLRECTFVPROC) load(userptr, "glRectfv");
+    glad_glRecti = (PFNGLRECTIPROC) load(userptr, "glRecti");
+    glad_glRectiv = (PFNGLRECTIVPROC) load(userptr, "glRectiv");
+    glad_glRects = (PFNGLRECTSPROC) load(userptr, "glRects");
+    glad_glRectsv = (PFNGLRECTSVPROC) load(userptr, "glRectsv");
+    glad_glRenderMode = (PFNGLRENDERMODEPROC) load(userptr, "glRenderMode");
+    glad_glRotated = (PFNGLROTATEDPROC) load(userptr, "glRotated");
+    glad_glRotatef = (PFNGLROTATEFPROC) load(userptr, "glRotatef");
+    glad_glScaled = (PFNGLSCALEDPROC) load(userptr, "glScaled");
+    glad_glScalef = (PFNGLSCALEFPROC) load(userptr, "glScalef");
+    glad_glScissor = (PFNGLSCISSORPROC) load(userptr, "glScissor");
+    glad_glSelectBuffer = (PFNGLSELECTBUFFERPROC) load(userptr, "glSelectBuffer");
+    glad_glShadeModel = (PFNGLSHADEMODELPROC) load(userptr, "glShadeModel");
+    glad_glStencilFunc = (PFNGLSTENCILFUNCPROC) load(userptr, "glStencilFunc");
+    glad_glStencilMask = (PFNGLSTENCILMASKPROC) load(userptr, "glStencilMask");
+    glad_glStencilOp = (PFNGLSTENCILOPPROC) load(userptr, "glStencilOp");
+    glad_glTexCoord1d = (PFNGLTEXCOORD1DPROC) load(userptr, "glTexCoord1d");
+    glad_glTexCoord1dv = (PFNGLTEXCOORD1DVPROC) load(userptr, "glTexCoord1dv");
+    glad_glTexCoord1f = (PFNGLTEXCOORD1FPROC) load(userptr, "glTexCoord1f");
+    glad_glTexCoord1fv = (PFNGLTEXCOORD1FVPROC) load(userptr, "glTexCoord1fv");
+    glad_glTexCoord1i = (PFNGLTEXCOORD1IPROC) load(userptr, "glTexCoord1i");
+    glad_glTexCoord1iv = (PFNGLTEXCOORD1IVPROC) load(userptr, "glTexCoord1iv");
+    glad_glTexCoord1s = (PFNGLTEXCOORD1SPROC) load(userptr, "glTexCoord1s");
+    glad_glTexCoord1sv = (PFNGLTEXCOORD1SVPROC) load(userptr, "glTexCoord1sv");
+    glad_glTexCoord2d = (PFNGLTEXCOORD2DPROC) load(userptr, "glTexCoord2d");
+    glad_glTexCoord2dv = (PFNGLTEXCOORD2DVPROC) load(userptr, "glTexCoord2dv");
+    glad_glTexCoord2f = (PFNGLTEXCOORD2FPROC) load(userptr, "glTexCoord2f");
+    glad_glTexCoord2fv = (PFNGLTEXCOORD2FVPROC) load(userptr, "glTexCoord2fv");
+    glad_glTexCoord2i = (PFNGLTEXCOORD2IPROC) load(userptr, "glTexCoord2i");
+    glad_glTexCoord2iv = (PFNGLTEXCOORD2IVPROC) load(userptr, "glTexCoord2iv");
+    glad_glTexCoord2s = (PFNGLTEXCOORD2SPROC) load(userptr, "glTexCoord2s");
+    glad_glTexCoord2sv = (PFNGLTEXCOORD2SVPROC) load(userptr, "glTexCoord2sv");
+    glad_glTexCoord3d = (PFNGLTEXCOORD3DPROC) load(userptr, "glTexCoord3d");
+    glad_glTexCoord3dv = (PFNGLTEXCOORD3DVPROC) load(userptr, "glTexCoord3dv");
+    glad_glTexCoord3f = (PFNGLTEXCOORD3FPROC) load(userptr, "glTexCoord3f");
+    glad_glTexCoord3fv = (PFNGLTEXCOORD3FVPROC) load(userptr, "glTexCoord3fv");
+    glad_glTexCoord3i = (PFNGLTEXCOORD3IPROC) load(userptr, "glTexCoord3i");
+    glad_glTexCoord3iv = (PFNGLTEXCOORD3IVPROC) load(userptr, "glTexCoord3iv");
+    glad_glTexCoord3s = (PFNGLTEXCOORD3SPROC) load(userptr, "glTexCoord3s");
+    glad_glTexCoord3sv = (PFNGLTEXCOORD3SVPROC) load(userptr, "glTexCoord3sv");
+    glad_glTexCoord4d = (PFNGLTEXCOORD4DPROC) load(userptr, "glTexCoord4d");
+    glad_glTexCoord4dv = (PFNGLTEXCOORD4DVPROC) load(userptr, "glTexCoord4dv");
+    glad_glTexCoord4f = (PFNGLTEXCOORD4FPROC) load(userptr, "glTexCoord4f");
+    glad_glTexCoord4fv = (PFNGLTEXCOORD4FVPROC) load(userptr, "glTexCoord4fv");
+    glad_glTexCoord4i = (PFNGLTEXCOORD4IPROC) load(userptr, "glTexCoord4i");
+    glad_glTexCoord4iv = (PFNGLTEXCOORD4IVPROC) load(userptr, "glTexCoord4iv");
+    glad_glTexCoord4s = (PFNGLTEXCOORD4SPROC) load(userptr, "glTexCoord4s");
+    glad_glTexCoord4sv = (PFNGLTEXCOORD4SVPROC) load(userptr, "glTexCoord4sv");
+    glad_glTexEnvf = (PFNGLTEXENVFPROC) load(userptr, "glTexEnvf");
+    glad_glTexEnvfv = (PFNGLTEXENVFVPROC) load(userptr, "glTexEnvfv");
+    glad_glTexEnvi = (PFNGLTEXENVIPROC) load(userptr, "glTexEnvi");
+    glad_glTexEnviv = (PFNGLTEXENVIVPROC) load(userptr, "glTexEnviv");
+    glad_glTexGend = (PFNGLTEXGENDPROC) load(userptr, "glTexGend");
+    glad_glTexGendv = (PFNGLTEXGENDVPROC) load(userptr, "glTexGendv");
+    glad_glTexGenf = (PFNGLTEXGENFPROC) load(userptr, "glTexGenf");
+    glad_glTexGenfv = (PFNGLTEXGENFVPROC) load(userptr, "glTexGenfv");
+    glad_glTexGeni = (PFNGLTEXGENIPROC) load(userptr, "glTexGeni");
+    glad_glTexGeniv = (PFNGLTEXGENIVPROC) load(userptr, "glTexGeniv");
+    glad_glTexImage1D = (PFNGLTEXIMAGE1DPROC) load(userptr, "glTexImage1D");
+    glad_glTexImage2D = (PFNGLTEXIMAGE2DPROC) load(userptr, "glTexImage2D");
+    glad_glTexParameterf = (PFNGLTEXPARAMETERFPROC) load(userptr, "glTexParameterf");
+    glad_glTexParameterfv = (PFNGLTEXPARAMETERFVPROC) load(userptr, "glTexParameterfv");
+    glad_glTexParameteri = (PFNGLTEXPARAMETERIPROC) load(userptr, "glTexParameteri");
+    glad_glTexParameteriv = (PFNGLTEXPARAMETERIVPROC) load(userptr, "glTexParameteriv");
+    glad_glTranslated = (PFNGLTRANSLATEDPROC) load(userptr, "glTranslated");
+    glad_glTranslatef = (PFNGLTRANSLATEFPROC) load(userptr, "glTranslatef");
+    glad_glVertex2d = (PFNGLVERTEX2DPROC) load(userptr, "glVertex2d");
+    glad_glVertex2dv = (PFNGLVERTEX2DVPROC) load(userptr, "glVertex2dv");
+    glad_glVertex2f = (PFNGLVERTEX2FPROC) load(userptr, "glVertex2f");
+    glad_glVertex2fv = (PFNGLVERTEX2FVPROC) load(userptr, "glVertex2fv");
+    glad_glVertex2i = (PFNGLVERTEX2IPROC) load(userptr, "glVertex2i");
+    glad_glVertex2iv = (PFNGLVERTEX2IVPROC) load(userptr, "glVertex2iv");
+    glad_glVertex2s = (PFNGLVERTEX2SPROC) load(userptr, "glVertex2s");
+    glad_glVertex2sv = (PFNGLVERTEX2SVPROC) load(userptr, "glVertex2sv");
+    glad_glVertex3d = (PFNGLVERTEX3DPROC) load(userptr, "glVertex3d");
+    glad_glVertex3dv = (PFNGLVERTEX3DVPROC) load(userptr, "glVertex3dv");
+    glad_glVertex3f = (PFNGLVERTEX3FPROC) load(userptr, "glVertex3f");
+    glad_glVertex3fv = (PFNGLVERTEX3FVPROC) load(userptr, "glVertex3fv");
+    glad_glVertex3i = (PFNGLVERTEX3IPROC) load(userptr, "glVertex3i");
+    glad_glVertex3iv = (PFNGLVERTEX3IVPROC) load(userptr, "glVertex3iv");
+    glad_glVertex3s = (PFNGLVERTEX3SPROC) load(userptr, "glVertex3s");
+    glad_glVertex3sv = (PFNGLVERTEX3SVPROC) load(userptr, "glVertex3sv");
+    glad_glVertex4d = (PFNGLVERTEX4DPROC) load(userptr, "glVertex4d");
+    glad_glVertex4dv = (PFNGLVERTEX4DVPROC) load(userptr, "glVertex4dv");
+    glad_glVertex4f = (PFNGLVERTEX4FPROC) load(userptr, "glVertex4f");
+    glad_glVertex4fv = (PFNGLVERTEX4FVPROC) load(userptr, "glVertex4fv");
+    glad_glVertex4i = (PFNGLVERTEX4IPROC) load(userptr, "glVertex4i");
+    glad_glVertex4iv = (PFNGLVERTEX4IVPROC) load(userptr, "glVertex4iv");
+    glad_glVertex4s = (PFNGLVERTEX4SPROC) load(userptr, "glVertex4s");
+    glad_glVertex4sv = (PFNGLVERTEX4SVPROC) load(userptr, "glVertex4sv");
+    glad_glViewport = (PFNGLVIEWPORTPROC) load(userptr, "glViewport");
+}
+static void glad_gl_load_GL_VERSION_1_1( GLADuserptrloadfunc load, void* userptr) {
+    if(!GLAD_GL_VERSION_1_1) return;
+    glad_glAreTexturesResident = (PFNGLARETEXTURESRESIDENTPROC) load(userptr, "glAreTexturesResident");
+    glad_glArrayElement = (PFNGLARRAYELEMENTPROC) load(userptr, "glArrayElement");
+    glad_glBindTexture = (PFNGLBINDTEXTUREPROC) load(userptr, "glBindTexture");
+    glad_glColorPointer = (PFNGLCOLORPOINTERPROC) load(userptr, "glColorPointer");
+    glad_glCopyTexImage1D = (PFNGLCOPYTEXIMAGE1DPROC) load(userptr, "glCopyTexImage1D");
+    glad_glCopyTexImage2D = (PFNGLCOPYTEXIMAGE2DPROC) load(userptr, "glCopyTexImage2D");
+    glad_glCopyTexSubImage1D = (PFNGLCOPYTEXSUBIMAGE1DPROC) load(userptr, "glCopyTexSubImage1D");
+    glad_glCopyTexSubImage2D = (PFNGLCOPYTEXSUBIMAGE2DPROC) load(userptr, "glCopyTexSubImage2D");
+    glad_glDeleteTextures = (PFNGLDELETETEXTURESPROC) load(userptr, "glDeleteTextures");
+    glad_glDisableClientState = (PFNGLDISABLECLIENTSTATEPROC) load(userptr, "glDisableClientState");
+    glad_glDrawArrays = (PFNGLDRAWARRAYSPROC) load(userptr, "glDrawArrays");
+    glad_glDrawElements = (PFNGLDRAWELEMENTSPROC) load(userptr, "glDrawElements");
+    glad_glEdgeFlagPointer = (PFNGLEDGEFLAGPOINTERPROC) load(userptr, "glEdgeFlagPointer");
+    glad_glEnableClientState = (PFNGLENABLECLIENTSTATEPROC) load(userptr, "glEnableClientState");
+    glad_glGenTextures = (PFNGLGENTEXTURESPROC) load(userptr, "glGenTextures");
+    glad_glGetPointerv = (PFNGLGETPOINTERVPROC) load(userptr, "glGetPointerv");
+    glad_glIndexPointer = (PFNGLINDEXPOINTERPROC) load(userptr, "glIndexPointer");
+    glad_glIndexub = (PFNGLINDEXUBPROC) load(userptr, "glIndexub");
+    glad_glIndexubv = (PFNGLINDEXUBVPROC) load(userptr, "glIndexubv");
+    glad_glInterleavedArrays = (PFNGLINTERLEAVEDARRAYSPROC) load(userptr, "glInterleavedArrays");
+    glad_glIsTexture = (PFNGLISTEXTUREPROC) load(userptr, "glIsTexture");
+    glad_glNormalPointer = (PFNGLNORMALPOINTERPROC) load(userptr, "glNormalPointer");
+    glad_glPolygonOffset = (PFNGLPOLYGONOFFSETPROC) load(userptr, "glPolygonOffset");
+    glad_glPopClientAttrib = (PFNGLPOPCLIENTATTRIBPROC) load(userptr, "glPopClientAttrib");
+    glad_glPrioritizeTextures = (PFNGLPRIORITIZETEXTURESPROC) load(userptr, "glPrioritizeTextures");
+    glad_glPushClientAttrib = (PFNGLPUSHCLIENTATTRIBPROC) load(userptr, "glPushClientAttrib");
+    glad_glTexCoordPointer = (PFNGLTEXCOORDPOINTERPROC) load(userptr, "glTexCoordPointer");
+    glad_glTexSubImage1D = (PFNGLTEXSUBIMAGE1DPROC) load(userptr, "glTexSubImage1D");
+    glad_glTexSubImage2D = (PFNGLTEXSUBIMAGE2DPROC) load(userptr, "glTexSubImage2D");
+    glad_glVertexPointer = (PFNGLVERTEXPOINTERPROC) load(userptr, "glVertexPointer");
+}
+static void glad_gl_load_GL_VERSION_1_2( GLADuserptrloadfunc load, void* userptr) {
+    if(!GLAD_GL_VERSION_1_2) return;
+    glad_glCopyTexSubImage3D = (PFNGLCOPYTEXSUBIMAGE3DPROC) load(userptr, "glCopyTexSubImage3D");
+    glad_glDrawRangeElements = (PFNGLDRAWRANGEELEMENTSPROC) load(userptr, "glDrawRangeElements");
+    glad_glTexImage3D = (PFNGLTEXIMAGE3DPROC) load(userptr, "glTexImage3D");
+    glad_glTexSubImage3D = (PFNGLTEXSUBIMAGE3DPROC) load(userptr, "glTexSubImage3D");
+}
+static void glad_gl_load_GL_VERSION_1_3( GLADuserptrloadfunc load, void* userptr) {
+    if(!GLAD_GL_VERSION_1_3) return;
+    glad_glActiveTexture = (PFNGLACTIVETEXTUREPROC) load(userptr, "glActiveTexture");
+    glad_glClientActiveTexture = (PFNGLCLIENTACTIVETEXTUREPROC) load(userptr, "glClientActiveTexture");
+    glad_glCompressedTexImage1D = (PFNGLCOMPRESSEDTEXIMAGE1DPROC) load(userptr, "glCompressedTexImage1D");
+    glad_glCompressedTexImage2D = (PFNGLCOMPRESSEDTEXIMAGE2DPROC) load(userptr, "glCompressedTexImage2D");
+    glad_glCompressedTexImage3D = (PFNGLCOMPRESSEDTEXIMAGE3DPROC) load(userptr, "glCompressedTexImage3D");
+    glad_glCompressedTexSubImage1D = (PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC) load(userptr, "glCompressedTexSubImage1D");
+    glad_glCompressedTexSubImage2D = (PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC) load(userptr, "glCompressedTexSubImage2D");
+    glad_glCompressedTexSubImage3D = (PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC) load(userptr, "glCompressedTexSubImage3D");
+    glad_glGetCompressedTexImage = (PFNGLGETCOMPRESSEDTEXIMAGEPROC) load(userptr, "glGetCompressedTexImage");
+    glad_glLoadTransposeMatrixd = (PFNGLLOADTRANSPOSEMATRIXDPROC) load(userptr, "glLoadTransposeMatrixd");
+    glad_glLoadTransposeMatrixf = (PFNGLLOADTRANSPOSEMATRIXFPROC) load(userptr, "glLoadTransposeMatrixf");
+    glad_glMultTransposeMatrixd = (PFNGLMULTTRANSPOSEMATRIXDPROC) load(userptr, "glMultTransposeMatrixd");
+    glad_glMultTransposeMatrixf = (PFNGLMULTTRANSPOSEMATRIXFPROC) load(userptr, "glMultTransposeMatrixf");
+    glad_glMultiTexCoord1d = (PFNGLMULTITEXCOORD1DPROC) load(userptr, "glMultiTexCoord1d");
+    glad_glMultiTexCoord1dv = (PFNGLMULTITEXCOORD1DVPROC) load(userptr, "glMultiTexCoord1dv");
+    glad_glMultiTexCoord1f = (PFNGLMULTITEXCOORD1FPROC) load(userptr, "glMultiTexCoord1f");
+    glad_glMultiTexCoord1fv = (PFNGLMULTITEXCOORD1FVPROC) load(userptr, "glMultiTexCoord1fv");
+    glad_glMultiTexCoord1i = (PFNGLMULTITEXCOORD1IPROC) load(userptr, "glMultiTexCoord1i");
+    glad_glMultiTexCoord1iv = (PFNGLMULTITEXCOORD1IVPROC) load(userptr, "glMultiTexCoord1iv");
+    glad_glMultiTexCoord1s = (PFNGLMULTITEXCOORD1SPROC) load(userptr, "glMultiTexCoord1s");
+    glad_glMultiTexCoord1sv = (PFNGLMULTITEXCOORD1SVPROC) load(userptr, "glMultiTexCoord1sv");
+    glad_glMultiTexCoord2d = (PFNGLMULTITEXCOORD2DPROC) load(userptr, "glMultiTexCoord2d");
+    glad_glMultiTexCoord2dv = (PFNGLMULTITEXCOORD2DVPROC) load(userptr, "glMultiTexCoord2dv");
+    glad_glMultiTexCoord2f = (PFNGLMULTITEXCOORD2FPROC) load(userptr, "glMultiTexCoord2f");
+    glad_glMultiTexCoord2fv = (PFNGLMULTITEXCOORD2FVPROC) load(userptr, "glMultiTexCoord2fv");
+    glad_glMultiTexCoord2i = (PFNGLMULTITEXCOORD2IPROC) load(userptr, "glMultiTexCoord2i");
+    glad_glMultiTexCoord2iv = (PFNGLMULTITEXCOORD2IVPROC) load(userptr, "glMultiTexCoord2iv");
+    glad_glMultiTexCoord2s = (PFNGLMULTITEXCOORD2SPROC) load(userptr, "glMultiTexCoord2s");
+    glad_glMultiTexCoord2sv = (PFNGLMULTITEXCOORD2SVPROC) load(userptr, "glMultiTexCoord2sv");
+    glad_glMultiTexCoord3d = (PFNGLMULTITEXCOORD3DPROC) load(userptr, "glMultiTexCoord3d");
+    glad_glMultiTexCoord3dv = (PFNGLMULTITEXCOORD3DVPROC) load(userptr, "glMultiTexCoord3dv");
+    glad_glMultiTexCoord3f = (PFNGLMULTITEXCOORD3FPROC) load(userptr, "glMultiTexCoord3f");
+    glad_glMultiTexCoord3fv = (PFNGLMULTITEXCOORD3FVPROC) load(userptr, "glMultiTexCoord3fv");
+    glad_glMultiTexCoord3i = (PFNGLMULTITEXCOORD3IPROC) load(userptr, "glMultiTexCoord3i");
+    glad_glMultiTexCoord3iv = (PFNGLMULTITEXCOORD3IVPROC) load(userptr, "glMultiTexCoord3iv");
+    glad_glMultiTexCoord3s = (PFNGLMULTITEXCOORD3SPROC) load(userptr, "glMultiTexCoord3s");
+    glad_glMultiTexCoord3sv = (PFNGLMULTITEXCOORD3SVPROC) load(userptr, "glMultiTexCoord3sv");
+    glad_glMultiTexCoord4d = (PFNGLMULTITEXCOORD4DPROC) load(userptr, "glMultiTexCoord4d");
+    glad_glMultiTexCoord4dv = (PFNGLMULTITEXCOORD4DVPROC) load(userptr, "glMultiTexCoord4dv");
+    glad_glMultiTexCoord4f = (PFNGLMULTITEXCOORD4FPROC) load(userptr, "glMultiTexCoord4f");
+    glad_glMultiTexCoord4fv = (PFNGLMULTITEXCOORD4FVPROC) load(userptr, "glMultiTexCoord4fv");
+    glad_glMultiTexCoord4i = (PFNGLMULTITEXCOORD4IPROC) load(userptr, "glMultiTexCoord4i");
+    glad_glMultiTexCoord4iv = (PFNGLMULTITEXCOORD4IVPROC) load(userptr, "glMultiTexCoord4iv");
+    glad_glMultiTexCoord4s = (PFNGLMULTITEXCOORD4SPROC) load(userptr, "glMultiTexCoord4s");
+    glad_glMultiTexCoord4sv = (PFNGLMULTITEXCOORD4SVPROC) load(userptr, "glMultiTexCoord4sv");
+    glad_glSampleCoverage = (PFNGLSAMPLECOVERAGEPROC) load(userptr, "glSampleCoverage");
+}
+static void glad_gl_load_GL_VERSION_1_4( GLADuserptrloadfunc load, void* userptr) {
+    if(!GLAD_GL_VERSION_1_4) return;
+    glad_glBlendColor = (PFNGLBLENDCOLORPROC) load(userptr, "glBlendColor");
+    glad_glBlendEquation = (PFNGLBLENDEQUATIONPROC) load(userptr, "glBlendEquation");
+    glad_glBlendFuncSeparate = (PFNGLBLENDFUNCSEPARATEPROC) load(userptr, "glBlendFuncSeparate");
+    glad_glFogCoordPointer = (PFNGLFOGCOORDPOINTERPROC) load(userptr, "glFogCoordPointer");
+    glad_glFogCoordd = (PFNGLFOGCOORDDPROC) load(userptr, "glFogCoordd");
+    glad_glFogCoorddv = (PFNGLFOGCOORDDVPROC) load(userptr, "glFogCoorddv");
+    glad_glFogCoordf = (PFNGLFOGCOORDFPROC) load(userptr, "glFogCoordf");
+    glad_glFogCoordfv = (PFNGLFOGCOORDFVPROC) load(userptr, "glFogCoordfv");
+    glad_glMultiDrawArrays = (PFNGLMULTIDRAWARRAYSPROC) load(userptr, "glMultiDrawArrays");
+    glad_glMultiDrawElements = (PFNGLMULTIDRAWELEMENTSPROC) load(userptr, "glMultiDrawElements");
+    glad_glPointParameterf = (PFNGLPOINTPARAMETERFPROC) load(userptr, "glPointParameterf");
+    glad_glPointParameterfv = (PFNGLPOINTPARAMETERFVPROC) load(userptr, "glPointParameterfv");
+    glad_glPointParameteri = (PFNGLPOINTPARAMETERIPROC) load(userptr, "glPointParameteri");
+    glad_glPointParameteriv = (PFNGLPOINTPARAMETERIVPROC) load(userptr, "glPointParameteriv");
+    glad_glSecondaryColor3b = (PFNGLSECONDARYCOLOR3BPROC) load(userptr, "glSecondaryColor3b");
+    glad_glSecondaryColor3bv = (PFNGLSECONDARYCOLOR3BVPROC) load(userptr, "glSecondaryColor3bv");
+    glad_glSecondaryColor3d = (PFNGLSECONDARYCOLOR3DPROC) load(userptr, "glSecondaryColor3d");
+    glad_glSecondaryColor3dv = (PFNGLSECONDARYCOLOR3DVPROC) load(userptr, "glSecondaryColor3dv");
+    glad_glSecondaryColor3f = (PFNGLSECONDARYCOLOR3FPROC) load(userptr, "glSecondaryColor3f");
+    glad_glSecondaryColor3fv = (PFNGLSECONDARYCOLOR3FVPROC) load(userptr, "glSecondaryColor3fv");
+    glad_glSecondaryColor3i = (PFNGLSECONDARYCOLOR3IPROC) load(userptr, "glSecondaryColor3i");
+    glad_glSecondaryColor3iv = (PFNGLSECONDARYCOLOR3IVPROC) load(userptr, "glSecondaryColor3iv");
+    glad_glSecondaryColor3s = (PFNGLSECONDARYCOLOR3SPROC) load(userptr, "glSecondaryColor3s");
+    glad_glSecondaryColor3sv = (PFNGLSECONDARYCOLOR3SVPROC) load(userptr, "glSecondaryColor3sv");
+    glad_glSecondaryColor3ub = (PFNGLSECONDARYCOLOR3UBPROC) load(userptr, "glSecondaryColor3ub");
+    glad_glSecondaryColor3ubv = (PFNGLSECONDARYCOLOR3UBVPROC) load(userptr, "glSecondaryColor3ubv");
+    glad_glSecondaryColor3ui = (PFNGLSECONDARYCOLOR3UIPROC) load(userptr, "glSecondaryColor3ui");
+    glad_glSecondaryColor3uiv = (PFNGLSECONDARYCOLOR3UIVPROC) load(userptr, "glSecondaryColor3uiv");
+    glad_glSecondaryColor3us = (PFNGLSECONDARYCOLOR3USPROC) load(userptr, "glSecondaryColor3us");
+    glad_glSecondaryColor3usv = (PFNGLSECONDARYCOLOR3USVPROC) load(userptr, "glSecondaryColor3usv");
+    glad_glSecondaryColorPointer = (PFNGLSECONDARYCOLORPOINTERPROC) load(userptr, "glSecondaryColorPointer");
+    glad_glWindowPos2d = (PFNGLWINDOWPOS2DPROC) load(userptr, "glWindowPos2d");
+    glad_glWindowPos2dv = (PFNGLWINDOWPOS2DVPROC) load(userptr, "glWindowPos2dv");
+    glad_glWindowPos2f = (PFNGLWINDOWPOS2FPROC) load(userptr, "glWindowPos2f");
+    glad_glWindowPos2fv = (PFNGLWINDOWPOS2FVPROC) load(userptr, "glWindowPos2fv");
+    glad_glWindowPos2i = (PFNGLWINDOWPOS2IPROC) load(userptr, "glWindowPos2i");
+    glad_glWindowPos2iv = (PFNGLWINDOWPOS2IVPROC) load(userptr, "glWindowPos2iv");
+    glad_glWindowPos2s = (PFNGLWINDOWPOS2SPROC) load(userptr, "glWindowPos2s");
+    glad_glWindowPos2sv = (PFNGLWINDOWPOS2SVPROC) load(userptr, "glWindowPos2sv");
+    glad_glWindowPos3d = (PFNGLWINDOWPOS3DPROC) load(userptr, "glWindowPos3d");
+    glad_glWindowPos3dv = (PFNGLWINDOWPOS3DVPROC) load(userptr, "glWindowPos3dv");
+    glad_glWindowPos3f = (PFNGLWINDOWPOS3FPROC) load(userptr, "glWindowPos3f");
+    glad_glWindowPos3fv = (PFNGLWINDOWPOS3FVPROC) load(userptr, "glWindowPos3fv");
+    glad_glWindowPos3i = (PFNGLWINDOWPOS3IPROC) load(userptr, "glWindowPos3i");
+    glad_glWindowPos3iv = (PFNGLWINDOWPOS3IVPROC) load(userptr, "glWindowPos3iv");
+    glad_glWindowPos3s = (PFNGLWINDOWPOS3SPROC) load(userptr, "glWindowPos3s");
+    glad_glWindowPos3sv = (PFNGLWINDOWPOS3SVPROC) load(userptr, "glWindowPos3sv");
+}
+static void glad_gl_load_GL_VERSION_1_5( GLADuserptrloadfunc load, void* userptr) {
+    if(!GLAD_GL_VERSION_1_5) return;
+    glad_glBeginQuery = (PFNGLBEGINQUERYPROC) load(userptr, "glBeginQuery");
+    glad_glBindBuffer = (PFNGLBINDBUFFERPROC) load(userptr, "glBindBuffer");
+    glad_glBufferData = (PFNGLBUFFERDATAPROC) load(userptr, "glBufferData");
+    glad_glBufferSubData = (PFNGLBUFFERSUBDATAPROC) load(userptr, "glBufferSubData");
+    glad_glDeleteBuffers = (PFNGLDELETEBUFFERSPROC) load(userptr, "glDeleteBuffers");
+    glad_glDeleteQueries = (PFNGLDELETEQUERIESPROC) load(userptr, "glDeleteQueries");
+    glad_glEndQuery = (PFNGLENDQUERYPROC) load(userptr, "glEndQuery");
+    glad_glGenBuffers = (PFNGLGENBUFFERSPROC) load(userptr, "glGenBuffers");
+    glad_glGenQueries = (PFNGLGENQUERIESPROC) load(userptr, "glGenQueries");
+    glad_glGetBufferParameteriv = (PFNGLGETBUFFERPARAMETERIVPROC) load(userptr, "glGetBufferParameteriv");
+    glad_glGetBufferPointerv = (PFNGLGETBUFFERPOINTERVPROC) load(userptr, "glGetBufferPointerv");
+    glad_glGetBufferSubData = (PFNGLGETBUFFERSUBDATAPROC) load(userptr, "glGetBufferSubData");
+    glad_glGetQueryObjectiv = (PFNGLGETQUERYOBJECTIVPROC) load(userptr, "glGetQueryObjectiv");
+    glad_glGetQueryObjectuiv = (PFNGLGETQUERYOBJECTUIVPROC) load(userptr, "glGetQueryObjectuiv");
+    glad_glGetQueryiv = (PFNGLGETQUERYIVPROC) load(userptr, "glGetQueryiv");
+    glad_glIsBuffer = (PFNGLISBUFFERPROC) load(userptr, "glIsBuffer");
+    glad_glIsQuery = (PFNGLISQUERYPROC) load(userptr, "glIsQuery");
+    glad_glMapBuffer = (PFNGLMAPBUFFERPROC) load(userptr, "glMapBuffer");
+    glad_glUnmapBuffer = (PFNGLUNMAPBUFFERPROC) load(userptr, "glUnmapBuffer");
+}
+static void glad_gl_load_GL_VERSION_2_0( GLADuserptrloadfunc load, void* userptr) {
+    if(!GLAD_GL_VERSION_2_0) return;
+    glad_glAttachShader = (PFNGLATTACHSHADERPROC) load(userptr, "glAttachShader");
+    glad_glBindAttribLocation = (PFNGLBINDATTRIBLOCATIONPROC) load(userptr, "glBindAttribLocation");
+    glad_glBlendEquationSeparate = (PFNGLBLENDEQUATIONSEPARATEPROC) load(userptr, "glBlendEquationSeparate");
+    glad_glCompileShader = (PFNGLCOMPILESHADERPROC) load(userptr, "glCompileShader");
+    glad_glCreateProgram = (PFNGLCREATEPROGRAMPROC) load(userptr, "glCreateProgram");
+    glad_glCreateShader = (PFNGLCREATESHADERPROC) load(userptr, "glCreateShader");
+    glad_glDeleteProgram = (PFNGLDELETEPROGRAMPROC) load(userptr, "glDeleteProgram");
+    glad_glDeleteShader = (PFNGLDELETESHADERPROC) load(userptr, "glDeleteShader");
+    glad_glDetachShader = (PFNGLDETACHSHADERPROC) load(userptr, "glDetachShader");
+    glad_glDisableVertexAttribArray = (PFNGLDISABLEVERTEXATTRIBARRAYPROC) load(userptr, "glDisableVertexAttribArray");
+    glad_glDrawBuffers = (PFNGLDRAWBUFFERSPROC) load(userptr, "glDrawBuffers");
+    glad_glEnableVertexAttribArray = (PFNGLENABLEVERTEXATTRIBARRAYPROC) load(userptr, "glEnableVertexAttribArray");
+    glad_glGetActiveAttrib = (PFNGLGETACTIVEATTRIBPROC) load(userptr, "glGetActiveAttrib");
+    glad_glGetActiveUniform = (PFNGLGETACTIVEUNIFORMPROC) load(userptr, "glGetActiveUniform");
+    glad_glGetAttachedShaders = (PFNGLGETATTACHEDSHADERSPROC) load(userptr, "glGetAttachedShaders");
+    glad_glGetAttribLocation = (PFNGLGETATTRIBLOCATIONPROC) load(userptr, "glGetAttribLocation");
+    glad_glGetProgramInfoLog = (PFNGLGETPROGRAMINFOLOGPROC) load(userptr, "glGetProgramInfoLog");
+    glad_glGetProgramiv = (PFNGLGETPROGRAMIVPROC) load(userptr, "glGetProgramiv");
+    glad_glGetShaderInfoLog = (PFNGLGETSHADERINFOLOGPROC) load(userptr, "glGetShaderInfoLog");
+    glad_glGetShaderSource = (PFNGLGETSHADERSOURCEPROC) load(userptr, "glGetShaderSource");
+    glad_glGetShaderiv = (PFNGLGETSHADERIVPROC) load(userptr, "glGetShaderiv");
+    glad_glGetUniformLocation = (PFNGLGETUNIFORMLOCATIONPROC) load(userptr, "glGetUniformLocation");
+    glad_glGetUniformfv = (PFNGLGETUNIFORMFVPROC) load(userptr, "glGetUniformfv");
+    glad_glGetUniformiv = (PFNGLGETUNIFORMIVPROC) load(userptr, "glGetUniformiv");
+    glad_glGetVertexAttribPointerv = (PFNGLGETVERTEXATTRIBPOINTERVPROC) load(userptr, "glGetVertexAttribPointerv");
+    glad_glGetVertexAttribdv = (PFNGLGETVERTEXATTRIBDVPROC) load(userptr, "glGetVertexAttribdv");
+    glad_glGetVertexAttribfv = (PFNGLGETVERTEXATTRIBFVPROC) load(userptr, "glGetVertexAttribfv");
+    glad_glGetVertexAttribiv = (PFNGLGETVERTEXATTRIBIVPROC) load(userptr, "glGetVertexAttribiv");
+    glad_glIsProgram = (PFNGLISPROGRAMPROC) load(userptr, "glIsProgram");
+    glad_glIsShader = (PFNGLISSHADERPROC) load(userptr, "glIsShader");
+    glad_glLinkProgram = (PFNGLLINKPROGRAMPROC) load(userptr, "glLinkProgram");
+    glad_glShaderSource = (PFNGLSHADERSOURCEPROC) load(userptr, "glShaderSource");
+    glad_glStencilFuncSeparate = (PFNGLSTENCILFUNCSEPARATEPROC) load(userptr, "glStencilFuncSeparate");
+    glad_glStencilMaskSeparate = (PFNGLSTENCILMASKSEPARATEPROC) load(userptr, "glStencilMaskSeparate");
+    glad_glStencilOpSeparate = (PFNGLSTENCILOPSEPARATEPROC) load(userptr, "glStencilOpSeparate");
+    glad_glUniform1f = (PFNGLUNIFORM1FPROC) load(userptr, "glUniform1f");
+    glad_glUniform1fv = (PFNGLUNIFORM1FVPROC) load(userptr, "glUniform1fv");
+    glad_glUniform1i = (PFNGLUNIFORM1IPROC) load(userptr, "glUniform1i");
+    glad_glUniform1iv = (PFNGLUNIFORM1IVPROC) load(userptr, "glUniform1iv");
+    glad_glUniform2f = (PFNGLUNIFORM2FPROC) load(userptr, "glUniform2f");
+    glad_glUniform2fv = (PFNGLUNIFORM2FVPROC) load(userptr, "glUniform2fv");
+    glad_glUniform2i = (PFNGLUNIFORM2IPROC) load(userptr, "glUniform2i");
+    glad_glUniform2iv = (PFNGLUNIFORM2IVPROC) load(userptr, "glUniform2iv");
+    glad_glUniform3f = (PFNGLUNIFORM3FPROC) load(userptr, "glUniform3f");
+    glad_glUniform3fv = (PFNGLUNIFORM3FVPROC) load(userptr, "glUniform3fv");
+    glad_glUniform3i = (PFNGLUNIFORM3IPROC) load(userptr, "glUniform3i");
+    glad_glUniform3iv = (PFNGLUNIFORM3IVPROC) load(userptr, "glUniform3iv");
+    glad_glUniform4f = (PFNGLUNIFORM4FPROC) load(userptr, "glUniform4f");
+    glad_glUniform4fv = (PFNGLUNIFORM4FVPROC) load(userptr, "glUniform4fv");
+    glad_glUniform4i = (PFNGLUNIFORM4IPROC) load(userptr, "glUniform4i");
+    glad_glUniform4iv = (PFNGLUNIFORM4IVPROC) load(userptr, "glUniform4iv");
+    glad_glUniformMatrix2fv = (PFNGLUNIFORMMATRIX2FVPROC) load(userptr, "glUniformMatrix2fv");
+    glad_glUniformMatrix3fv = (PFNGLUNIFORMMATRIX3FVPROC) load(userptr, "glUniformMatrix3fv");
+    glad_glUniformMatrix4fv = (PFNGLUNIFORMMATRIX4FVPROC) load(userptr, "glUniformMatrix4fv");
+    glad_glUseProgram = (PFNGLUSEPROGRAMPROC) load(userptr, "glUseProgram");
+    glad_glValidateProgram = (PFNGLVALIDATEPROGRAMPROC) load(userptr, "glValidateProgram");
+    glad_glVertexAttrib1d = (PFNGLVERTEXATTRIB1DPROC) load(userptr, "glVertexAttrib1d");
+    glad_glVertexAttrib1dv = (PFNGLVERTEXATTRIB1DVPROC) load(userptr, "glVertexAttrib1dv");
+    glad_glVertexAttrib1f = (PFNGLVERTEXATTRIB1FPROC) load(userptr, "glVertexAttrib1f");
+    glad_glVertexAttrib1fv = (PFNGLVERTEXATTRIB1FVPROC) load(userptr, "glVertexAttrib1fv");
+    glad_glVertexAttrib1s = (PFNGLVERTEXATTRIB1SPROC) load(userptr, "glVertexAttrib1s");
+    glad_glVertexAttrib1sv = (PFNGLVERTEXATTRIB1SVPROC) load(userptr, "glVertexAttrib1sv");
+    glad_glVertexAttrib2d = (PFNGLVERTEXATTRIB2DPROC) load(userptr, "glVertexAttrib2d");
+    glad_glVertexAttrib2dv = (PFNGLVERTEXATTRIB2DVPROC) load(userptr, "glVertexAttrib2dv");
+    glad_glVertexAttrib2f = (PFNGLVERTEXATTRIB2FPROC) load(userptr, "glVertexAttrib2f");
+    glad_glVertexAttrib2fv = (PFNGLVERTEXATTRIB2FVPROC) load(userptr, "glVertexAttrib2fv");
+    glad_glVertexAttrib2s = (PFNGLVERTEXATTRIB2SPROC) load(userptr, "glVertexAttrib2s");
+    glad_glVertexAttrib2sv = (PFNGLVERTEXATTRIB2SVPROC) load(userptr, "glVertexAttrib2sv");
+    glad_glVertexAttrib3d = (PFNGLVERTEXATTRIB3DPROC) load(userptr, "glVertexAttrib3d");
+    glad_glVertexAttrib3dv = (PFNGLVERTEXATTRIB3DVPROC) load(userptr, "glVertexAttrib3dv");
+    glad_glVertexAttrib3f = (PFNGLVERTEXATTRIB3FPROC) load(userptr, "glVertexAttrib3f");
+    glad_glVertexAttrib3fv = (PFNGLVERTEXATTRIB3FVPROC) load(userptr, "glVertexAttrib3fv");
+    glad_glVertexAttrib3s = (PFNGLVERTEXATTRIB3SPROC) load(userptr, "glVertexAttrib3s");
+    glad_glVertexAttrib3sv = (PFNGLVERTEXATTRIB3SVPROC) load(userptr, "glVertexAttrib3sv");
+    glad_glVertexAttrib4Nbv = (PFNGLVERTEXATTRIB4NBVPROC) load(userptr, "glVertexAttrib4Nbv");
+    glad_glVertexAttrib4Niv = (PFNGLVERTEXATTRIB4NIVPROC) load(userptr, "glVertexAttrib4Niv");
+    glad_glVertexAttrib4Nsv = (PFNGLVERTEXATTRIB4NSVPROC) load(userptr, "glVertexAttrib4Nsv");
+    glad_glVertexAttrib4Nub = (PFNGLVERTEXATTRIB4NUBPROC) load(userptr, "glVertexAttrib4Nub");
+    glad_glVertexAttrib4Nubv = (PFNGLVERTEXATTRIB4NUBVPROC) load(userptr, "glVertexAttrib4Nubv");
+    glad_glVertexAttrib4Nuiv = (PFNGLVERTEXATTRIB4NUIVPROC) load(userptr, "glVertexAttrib4Nuiv");
+    glad_glVertexAttrib4Nusv = (PFNGLVERTEXATTRIB4NUSVPROC) load(userptr, "glVertexAttrib4Nusv");
+    glad_glVertexAttrib4bv = (PFNGLVERTEXATTRIB4BVPROC) load(userptr, "glVertexAttrib4bv");
+    glad_glVertexAttrib4d = (PFNGLVERTEXATTRIB4DPROC) load(userptr, "glVertexAttrib4d");
+    glad_glVertexAttrib4dv = (PFNGLVERTEXATTRIB4DVPROC) load(userptr, "glVertexAttrib4dv");
+    glad_glVertexAttrib4f = (PFNGLVERTEXATTRIB4FPROC) load(userptr, "glVertexAttrib4f");
+    glad_glVertexAttrib4fv = (PFNGLVERTEXATTRIB4FVPROC) load(userptr, "glVertexAttrib4fv");
+    glad_glVertexAttrib4iv = (PFNGLVERTEXATTRIB4IVPROC) load(userptr, "glVertexAttrib4iv");
+    glad_glVertexAttrib4s = (PFNGLVERTEXATTRIB4SPROC) load(userptr, "glVertexAttrib4s");
+    glad_glVertexAttrib4sv = (PFNGLVERTEXATTRIB4SVPROC) load(userptr, "glVertexAttrib4sv");
+    glad_glVertexAttrib4ubv = (PFNGLVERTEXATTRIB4UBVPROC) load(userptr, "glVertexAttrib4ubv");
+    glad_glVertexAttrib4uiv = (PFNGLVERTEXATTRIB4UIVPROC) load(userptr, "glVertexAttrib4uiv");
+    glad_glVertexAttrib4usv = (PFNGLVERTEXATTRIB4USVPROC) load(userptr, "glVertexAttrib4usv");
+    glad_glVertexAttribPointer = (PFNGLVERTEXATTRIBPOINTERPROC) load(userptr, "glVertexAttribPointer");
+}
+static void glad_gl_load_GL_VERSION_2_1( GLADuserptrloadfunc load, void* userptr) {
+    if(!GLAD_GL_VERSION_2_1) return;
+    glad_glUniformMatrix2x3fv = (PFNGLUNIFORMMATRIX2X3FVPROC) load(userptr, "glUniformMatrix2x3fv");
+    glad_glUniformMatrix2x4fv = (PFNGLUNIFORMMATRIX2X4FVPROC) load(userptr, "glUniformMatrix2x4fv");
+    glad_glUniformMatrix3x2fv = (PFNGLUNIFORMMATRIX3X2FVPROC) load(userptr, "glUniformMatrix3x2fv");
+    glad_glUniformMatrix3x4fv = (PFNGLUNIFORMMATRIX3X4FVPROC) load(userptr, "glUniformMatrix3x4fv");
+    glad_glUniformMatrix4x2fv = (PFNGLUNIFORMMATRIX4X2FVPROC) load(userptr, "glUniformMatrix4x2fv");
+    glad_glUniformMatrix4x3fv = (PFNGLUNIFORMMATRIX4X3FVPROC) load(userptr, "glUniformMatrix4x3fv");
+}
+static void glad_gl_load_GL_VERSION_3_0( GLADuserptrloadfunc load, void* userptr) {
+    if(!GLAD_GL_VERSION_3_0) return;
+    glad_glBeginConditionalRender = (PFNGLBEGINCONDITIONALRENDERPROC) load(userptr, "glBeginConditionalRender");
+    glad_glBeginTransformFeedback = (PFNGLBEGINTRANSFORMFEEDBACKPROC) load(userptr, "glBeginTransformFeedback");
+    glad_glBindBufferBase = (PFNGLBINDBUFFERBASEPROC) load(userptr, "glBindBufferBase");
+    glad_glBindBufferRange = (PFNGLBINDBUFFERRANGEPROC) load(userptr, "glBindBufferRange");
+    glad_glBindFragDataLocation = (PFNGLBINDFRAGDATALOCATIONPROC) load(userptr, "glBindFragDataLocation");
+    glad_glBindFramebuffer = (PFNGLBINDFRAMEBUFFERPROC) load(userptr, "glBindFramebuffer");
+    glad_glBindRenderbuffer = (PFNGLBINDRENDERBUFFERPROC) load(userptr, "glBindRenderbuffer");
+    glad_glBindVertexArray = (PFNGLBINDVERTEXARRAYPROC) load(userptr, "glBindVertexArray");
+    glad_glBlitFramebuffer = (PFNGLBLITFRAMEBUFFERPROC) load(userptr, "glBlitFramebuffer");
+    glad_glCheckFramebufferStatus = (PFNGLCHECKFRAMEBUFFERSTATUSPROC) load(userptr, "glCheckFramebufferStatus");
+    glad_glClampColor = (PFNGLCLAMPCOLORPROC) load(userptr, "glClampColor");
+    glad_glClearBufferfi = (PFNGLCLEARBUFFERFIPROC) load(userptr, "glClearBufferfi");
+    glad_glClearBufferfv = (PFNGLCLEARBUFFERFVPROC) load(userptr, "glClearBufferfv");
+    glad_glClearBufferiv = (PFNGLCLEARBUFFERIVPROC) load(userptr, "glClearBufferiv");
+    glad_glClearBufferuiv = (PFNGLCLEARBUFFERUIVPROC) load(userptr, "glClearBufferuiv");
+    glad_glColorMaski = (PFNGLCOLORMASKIPROC) load(userptr, "glColorMaski");
+    glad_glDeleteFramebuffers = (PFNGLDELETEFRAMEBUFFERSPROC) load(userptr, "glDeleteFramebuffers");
+    glad_glDeleteRenderbuffers = (PFNGLDELETERENDERBUFFERSPROC) load(userptr, "glDeleteRenderbuffers");
+    glad_glDeleteVertexArrays = (PFNGLDELETEVERTEXARRAYSPROC) load(userptr, "glDeleteVertexArrays");
+    glad_glDisablei = (PFNGLDISABLEIPROC) load(userptr, "glDisablei");
+    glad_glEnablei = (PFNGLENABLEIPROC) load(userptr, "glEnablei");
+    glad_glEndConditionalRender = (PFNGLENDCONDITIONALRENDERPROC) load(userptr, "glEndConditionalRender");
+    glad_glEndTransformFeedback = (PFNGLENDTRANSFORMFEEDBACKPROC) load(userptr, "glEndTransformFeedback");
+    glad_glFlushMappedBufferRange = (PFNGLFLUSHMAPPEDBUFFERRANGEPROC) load(userptr, "glFlushMappedBufferRange");
+    glad_glFramebufferRenderbuffer = (PFNGLFRAMEBUFFERRENDERBUFFERPROC) load(userptr, "glFramebufferRenderbuffer");
+    glad_glFramebufferTexture1D = (PFNGLFRAMEBUFFERTEXTURE1DPROC) load(userptr, "glFramebufferTexture1D");
+    glad_glFramebufferTexture2D = (PFNGLFRAMEBUFFERTEXTURE2DPROC) load(userptr, "glFramebufferTexture2D");
+    glad_glFramebufferTexture3D = (PFNGLFRAMEBUFFERTEXTURE3DPROC) load(userptr, "glFramebufferTexture3D");
+    glad_glFramebufferTextureLayer = (PFNGLFRAMEBUFFERTEXTURELAYERPROC) load(userptr, "glFramebufferTextureLayer");
+    glad_glGenFramebuffers = (PFNGLGENFRAMEBUFFERSPROC) load(userptr, "glGenFramebuffers");
+    glad_glGenRenderbuffers = (PFNGLGENRENDERBUFFERSPROC) load(userptr, "glGenRenderbuffers");
+    glad_glGenVertexArrays = (PFNGLGENVERTEXARRAYSPROC) load(userptr, "glGenVertexArrays");
+    glad_glGenerateMipmap = (PFNGLGENERATEMIPMAPPROC) load(userptr, "glGenerateMipmap");
+    glad_glGetBooleani_v = (PFNGLGETBOOLEANI_VPROC) load(userptr, "glGetBooleani_v");
+    glad_glGetFragDataLocation = (PFNGLGETFRAGDATALOCATIONPROC) load(userptr, "glGetFragDataLocation");
+    glad_glGetFramebufferAttachmentParameteriv = (PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC) load(userptr, "glGetFramebufferAttachmentParameteriv");
+    glad_glGetIntegeri_v = (PFNGLGETINTEGERI_VPROC) load(userptr, "glGetIntegeri_v");
+    glad_glGetRenderbufferParameteriv = (PFNGLGETRENDERBUFFERPARAMETERIVPROC) load(userptr, "glGetRenderbufferParameteriv");
+    glad_glGetStringi = (PFNGLGETSTRINGIPROC) load(userptr, "glGetStringi");
+    glad_glGetTexParameterIiv = (PFNGLGETTEXPARAMETERIIVPROC) load(userptr, "glGetTexParameterIiv");
+    glad_glGetTexParameterIuiv = (PFNGLGETTEXPARAMETERIUIVPROC) load(userptr, "glGetTexParameterIuiv");
+    glad_glGetTransformFeedbackVarying = (PFNGLGETTRANSFORMFEEDBACKVARYINGPROC) load(userptr, "glGetTransformFeedbackVarying");
+    glad_glGetUniformuiv = (PFNGLGETUNIFORMUIVPROC) load(userptr, "glGetUniformuiv");
+    glad_glGetVertexAttribIiv = (PFNGLGETVERTEXATTRIBIIVPROC) load(userptr, "glGetVertexAttribIiv");
+    glad_glGetVertexAttribIuiv = (PFNGLGETVERTEXATTRIBIUIVPROC) load(userptr, "glGetVertexAttribIuiv");
+    glad_glIsEnabledi = (PFNGLISENABLEDIPROC) load(userptr, "glIsEnabledi");
+    glad_glIsFramebuffer = (PFNGLISFRAMEBUFFERPROC) load(userptr, "glIsFramebuffer");
+    glad_glIsRenderbuffer = (PFNGLISRENDERBUFFERPROC) load(userptr, "glIsRenderbuffer");
+    glad_glIsVertexArray = (PFNGLISVERTEXARRAYPROC) load(userptr, "glIsVertexArray");
+    glad_glMapBufferRange = (PFNGLMAPBUFFERRANGEPROC) load(userptr, "glMapBufferRange");
+    glad_glRenderbufferStorage = (PFNGLRENDERBUFFERSTORAGEPROC) load(userptr, "glRenderbufferStorage");
+    glad_glRenderbufferStorageMultisample = (PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC) load(userptr, "glRenderbufferStorageMultisample");
+    glad_glTexParameterIiv = (PFNGLTEXPARAMETERIIVPROC) load(userptr, "glTexParameterIiv");
+    glad_glTexParameterIuiv = (PFNGLTEXPARAMETERIUIVPROC) load(userptr, "glTexParameterIuiv");
+    glad_glTransformFeedbackVaryings = (PFNGLTRANSFORMFEEDBACKVARYINGSPROC) load(userptr, "glTransformFeedbackVaryings");
+    glad_glUniform1ui = (PFNGLUNIFORM1UIPROC) load(userptr, "glUniform1ui");
+    glad_glUniform1uiv = (PFNGLUNIFORM1UIVPROC) load(userptr, "glUniform1uiv");
+    glad_glUniform2ui = (PFNGLUNIFORM2UIPROC) load(userptr, "glUniform2ui");
+    glad_glUniform2uiv = (PFNGLUNIFORM2UIVPROC) load(userptr, "glUniform2uiv");
+    glad_glUniform3ui = (PFNGLUNIFORM3UIPROC) load(userptr, "glUniform3ui");
+    glad_glUniform3uiv = (PFNGLUNIFORM3UIVPROC) load(userptr, "glUniform3uiv");
+    glad_glUniform4ui = (PFNGLUNIFORM4UIPROC) load(userptr, "glUniform4ui");
+    glad_glUniform4uiv = (PFNGLUNIFORM4UIVPROC) load(userptr, "glUniform4uiv");
+    glad_glVertexAttribI1i = (PFNGLVERTEXATTRIBI1IPROC) load(userptr, "glVertexAttribI1i");
+    glad_glVertexAttribI1iv = (PFNGLVERTEXATTRIBI1IVPROC) load(userptr, "glVertexAttribI1iv");
+    glad_glVertexAttribI1ui = (PFNGLVERTEXATTRIBI1UIPROC) load(userptr, "glVertexAttribI1ui");
+    glad_glVertexAttribI1uiv = (PFNGLVERTEXATTRIBI1UIVPROC) load(userptr, "glVertexAttribI1uiv");
+    glad_glVertexAttribI2i = (PFNGLVERTEXATTRIBI2IPROC) load(userptr, "glVertexAttribI2i");
+    glad_glVertexAttribI2iv = (PFNGLVERTEXATTRIBI2IVPROC) load(userptr, "glVertexAttribI2iv");
+    glad_glVertexAttribI2ui = (PFNGLVERTEXATTRIBI2UIPROC) load(userptr, "glVertexAttribI2ui");
+    glad_glVertexAttribI2uiv = (PFNGLVERTEXATTRIBI2UIVPROC) load(userptr, "glVertexAttribI2uiv");
+    glad_glVertexAttribI3i = (PFNGLVERTEXATTRIBI3IPROC) load(userptr, "glVertexAttribI3i");
+    glad_glVertexAttribI3iv = (PFNGLVERTEXATTRIBI3IVPROC) load(userptr, "glVertexAttribI3iv");
+    glad_glVertexAttribI3ui = (PFNGLVERTEXATTRIBI3UIPROC) load(userptr, "glVertexAttribI3ui");
+    glad_glVertexAttribI3uiv = (PFNGLVERTEXATTRIBI3UIVPROC) load(userptr, "glVertexAttribI3uiv");
+    glad_glVertexAttribI4bv = (PFNGLVERTEXATTRIBI4BVPROC) load(userptr, "glVertexAttribI4bv");
+    glad_glVertexAttribI4i = (PFNGLVERTEXATTRIBI4IPROC) load(userptr, "glVertexAttribI4i");
+    glad_glVertexAttribI4iv = (PFNGLVERTEXATTRIBI4IVPROC) load(userptr, "glVertexAttribI4iv");
+    glad_glVertexAttribI4sv = (PFNGLVERTEXATTRIBI4SVPROC) load(userptr, "glVertexAttribI4sv");
+    glad_glVertexAttribI4ubv = (PFNGLVERTEXATTRIBI4UBVPROC) load(userptr, "glVertexAttribI4ubv");
+    glad_glVertexAttribI4ui = (PFNGLVERTEXATTRIBI4UIPROC) load(userptr, "glVertexAttribI4ui");
+    glad_glVertexAttribI4uiv = (PFNGLVERTEXATTRIBI4UIVPROC) load(userptr, "glVertexAttribI4uiv");
+    glad_glVertexAttribI4usv = (PFNGLVERTEXATTRIBI4USVPROC) load(userptr, "glVertexAttribI4usv");
+    glad_glVertexAttribIPointer = (PFNGLVERTEXATTRIBIPOINTERPROC) load(userptr, "glVertexAttribIPointer");
+}
+static void glad_gl_load_GL_VERSION_3_1( GLADuserptrloadfunc load, void* userptr) {
+    if(!GLAD_GL_VERSION_3_1) return;
+    glad_glBindBufferBase = (PFNGLBINDBUFFERBASEPROC) load(userptr, "glBindBufferBase");
+    glad_glBindBufferRange = (PFNGLBINDBUFFERRANGEPROC) load(userptr, "glBindBufferRange");
+    glad_glCopyBufferSubData = (PFNGLCOPYBUFFERSUBDATAPROC) load(userptr, "glCopyBufferSubData");
+    glad_glDrawArraysInstanced = (PFNGLDRAWARRAYSINSTANCEDPROC) load(userptr, "glDrawArraysInstanced");
+    glad_glDrawElementsInstanced = (PFNGLDRAWELEMENTSINSTANCEDPROC) load(userptr, "glDrawElementsInstanced");
+    glad_glGetActiveUniformBlockName = (PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC) load(userptr, "glGetActiveUniformBlockName");
+    glad_glGetActiveUniformBlockiv = (PFNGLGETACTIVEUNIFORMBLOCKIVPROC) load(userptr, "glGetActiveUniformBlockiv");
+    glad_glGetActiveUniformName = (PFNGLGETACTIVEUNIFORMNAMEPROC) load(userptr, "glGetActiveUniformName");
+    glad_glGetActiveUniformsiv = (PFNGLGETACTIVEUNIFORMSIVPROC) load(userptr, "glGetActiveUniformsiv");
+    glad_glGetIntegeri_v = (PFNGLGETINTEGERI_VPROC) load(userptr, "glGetIntegeri_v");
+    glad_glGetUniformBlockIndex = (PFNGLGETUNIFORMBLOCKINDEXPROC) load(userptr, "glGetUniformBlockIndex");
+    glad_glGetUniformIndices = (PFNGLGETUNIFORMINDICESPROC) load(userptr, "glGetUniformIndices");
+    glad_glPrimitiveRestartIndex = (PFNGLPRIMITIVERESTARTINDEXPROC) load(userptr, "glPrimitiveRestartIndex");
+    glad_glTexBuffer = (PFNGLTEXBUFFERPROC) load(userptr, "glTexBuffer");
+    glad_glUniformBlockBinding = (PFNGLUNIFORMBLOCKBINDINGPROC) load(userptr, "glUniformBlockBinding");
+}
+static void glad_gl_load_GL_VERSION_3_2( GLADuserptrloadfunc load, void* userptr) {
+    if(!GLAD_GL_VERSION_3_2) return;
+    glad_glClientWaitSync = (PFNGLCLIENTWAITSYNCPROC) load(userptr, "glClientWaitSync");
+    glad_glDeleteSync = (PFNGLDELETESYNCPROC) load(userptr, "glDeleteSync");
+    glad_glDrawElementsBaseVertex = (PFNGLDRAWELEMENTSBASEVERTEXPROC) load(userptr, "glDrawElementsBaseVertex");
+    glad_glDrawElementsInstancedBaseVertex = (PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXPROC) load(userptr, "glDrawElementsInstancedBaseVertex");
+    glad_glDrawRangeElementsBaseVertex = (PFNGLDRAWRANGEELEMENTSBASEVERTEXPROC) load(userptr, "glDrawRangeElementsBaseVertex");
+    glad_glFenceSync = (PFNGLFENCESYNCPROC) load(userptr, "glFenceSync");
+    glad_glFramebufferTexture = (PFNGLFRAMEBUFFERTEXTUREPROC) load(userptr, "glFramebufferTexture");
+    glad_glGetBufferParameteri64v = (PFNGLGETBUFFERPARAMETERI64VPROC) load(userptr, "glGetBufferParameteri64v");
+    glad_glGetInteger64i_v = (PFNGLGETINTEGER64I_VPROC) load(userptr, "glGetInteger64i_v");
+    glad_glGetInteger64v = (PFNGLGETINTEGER64VPROC) load(userptr, "glGetInteger64v");
+    glad_glGetMultisamplefv = (PFNGLGETMULTISAMPLEFVPROC) load(userptr, "glGetMultisamplefv");
+    glad_glGetSynciv = (PFNGLGETSYNCIVPROC) load(userptr, "glGetSynciv");
+    glad_glIsSync = (PFNGLISSYNCPROC) load(userptr, "glIsSync");
+    glad_glMultiDrawElementsBaseVertex = (PFNGLMULTIDRAWELEMENTSBASEVERTEXPROC) load(userptr, "glMultiDrawElementsBaseVertex");
+    glad_glProvokingVertex = (PFNGLPROVOKINGVERTEXPROC) load(userptr, "glProvokingVertex");
+    glad_glSampleMaski = (PFNGLSAMPLEMASKIPROC) load(userptr, "glSampleMaski");
+    glad_glTexImage2DMultisample = (PFNGLTEXIMAGE2DMULTISAMPLEPROC) load(userptr, "glTexImage2DMultisample");
+    glad_glTexImage3DMultisample = (PFNGLTEXIMAGE3DMULTISAMPLEPROC) load(userptr, "glTexImage3DMultisample");
+    glad_glWaitSync = (PFNGLWAITSYNCPROC) load(userptr, "glWaitSync");
+}
+static void glad_gl_load_GL_VERSION_3_3( GLADuserptrloadfunc load, void* userptr) {
+    if(!GLAD_GL_VERSION_3_3) return;
+    glad_glBindFragDataLocationIndexed = (PFNGLBINDFRAGDATALOCATIONINDEXEDPROC) load(userptr, "glBindFragDataLocationIndexed");
+    glad_glBindSampler = (PFNGLBINDSAMPLERPROC) load(userptr, "glBindSampler");
+    glad_glColorP3ui = (PFNGLCOLORP3UIPROC) load(userptr, "glColorP3ui");
+    glad_glColorP3uiv = (PFNGLCOLORP3UIVPROC) load(userptr, "glColorP3uiv");
+    glad_glColorP4ui = (PFNGLCOLORP4UIPROC) load(userptr, "glColorP4ui");
+    glad_glColorP4uiv = (PFNGLCOLORP4UIVPROC) load(userptr, "glColorP4uiv");
+    glad_glDeleteSamplers = (PFNGLDELETESAMPLERSPROC) load(userptr, "glDeleteSamplers");
+    glad_glGenSamplers = (PFNGLGENSAMPLERSPROC) load(userptr, "glGenSamplers");
+    glad_glGetFragDataIndex = (PFNGLGETFRAGDATAINDEXPROC) load(userptr, "glGetFragDataIndex");
+    glad_glGetQueryObjecti64v = (PFNGLGETQUERYOBJECTI64VPROC) load(userptr, "glGetQueryObjecti64v");
+    glad_glGetQueryObjectui64v = (PFNGLGETQUERYOBJECTUI64VPROC) load(userptr, "glGetQueryObjectui64v");
+    glad_glGetSamplerParameterIiv = (PFNGLGETSAMPLERPARAMETERIIVPROC) load(userptr, "glGetSamplerParameterIiv");
+    glad_glGetSamplerParameterIuiv = (PFNGLGETSAMPLERPARAMETERIUIVPROC) load(userptr, "glGetSamplerParameterIuiv");
+    glad_glGetSamplerParameterfv = (PFNGLGETSAMPLERPARAMETERFVPROC) load(userptr, "glGetSamplerParameterfv");
+    glad_glGetSamplerParameteriv = (PFNGLGETSAMPLERPARAMETERIVPROC) load(userptr, "glGetSamplerParameteriv");
+    glad_glIsSampler = (PFNGLISSAMPLERPROC) load(userptr, "glIsSampler");
+    glad_glMultiTexCoordP1ui = (PFNGLMULTITEXCOORDP1UIPROC) load(userptr, "glMultiTexCoordP1ui");
+    glad_glMultiTexCoordP1uiv = (PFNGLMULTITEXCOORDP1UIVPROC) load(userptr, "glMultiTexCoordP1uiv");
+    glad_glMultiTexCoordP2ui = (PFNGLMULTITEXCOORDP2UIPROC) load(userptr, "glMultiTexCoordP2ui");
+    glad_glMultiTexCoordP2uiv = (PFNGLMULTITEXCOORDP2UIVPROC) load(userptr, "glMultiTexCoordP2uiv");
+    glad_glMultiTexCoordP3ui = (PFNGLMULTITEXCOORDP3UIPROC) load(userptr, "glMultiTexCoordP3ui");
+    glad_glMultiTexCoordP3uiv = (PFNGLMULTITEXCOORDP3UIVPROC) load(userptr, "glMultiTexCoordP3uiv");
+    glad_glMultiTexCoordP4ui = (PFNGLMULTITEXCOORDP4UIPROC) load(userptr, "glMultiTexCoordP4ui");
+    glad_glMultiTexCoordP4uiv = (PFNGLMULTITEXCOORDP4UIVPROC) load(userptr, "glMultiTexCoordP4uiv");
+    glad_glNormalP3ui = (PFNGLNORMALP3UIPROC) load(userptr, "glNormalP3ui");
+    glad_glNormalP3uiv = (PFNGLNORMALP3UIVPROC) load(userptr, "glNormalP3uiv");
+    glad_glQueryCounter = (PFNGLQUERYCOUNTERPROC) load(userptr, "glQueryCounter");
+    glad_glSamplerParameterIiv = (PFNGLSAMPLERPARAMETERIIVPROC) load(userptr, "glSamplerParameterIiv");
+    glad_glSamplerParameterIuiv = (PFNGLSAMPLERPARAMETERIUIVPROC) load(userptr, "glSamplerParameterIuiv");
+    glad_glSamplerParameterf = (PFNGLSAMPLERPARAMETERFPROC) load(userptr, "glSamplerParameterf");
+    glad_glSamplerParameterfv = (PFNGLSAMPLERPARAMETERFVPROC) load(userptr, "glSamplerParameterfv");
+    glad_glSamplerParameteri = (PFNGLSAMPLERPARAMETERIPROC) load(userptr, "glSamplerParameteri");
+    glad_glSamplerParameteriv = (PFNGLSAMPLERPARAMETERIVPROC) load(userptr, "glSamplerParameteriv");
+    glad_glSecondaryColorP3ui = (PFNGLSECONDARYCOLORP3UIPROC) load(userptr, "glSecondaryColorP3ui");
+    glad_glSecondaryColorP3uiv = (PFNGLSECONDARYCOLORP3UIVPROC) load(userptr, "glSecondaryColorP3uiv");
+    glad_glTexCoordP1ui = (PFNGLTEXCOORDP1UIPROC) load(userptr, "glTexCoordP1ui");
+    glad_glTexCoordP1uiv = (PFNGLTEXCOORDP1UIVPROC) load(userptr, "glTexCoordP1uiv");
+    glad_glTexCoordP2ui = (PFNGLTEXCOORDP2UIPROC) load(userptr, "glTexCoordP2ui");
+    glad_glTexCoordP2uiv = (PFNGLTEXCOORDP2UIVPROC) load(userptr, "glTexCoordP2uiv");
+    glad_glTexCoordP3ui = (PFNGLTEXCOORDP3UIPROC) load(userptr, "glTexCoordP3ui");
+    glad_glTexCoordP3uiv = (PFNGLTEXCOORDP3UIVPROC) load(userptr, "glTexCoordP3uiv");
+    glad_glTexCoordP4ui = (PFNGLTEXCOORDP4UIPROC) load(userptr, "glTexCoordP4ui");
+    glad_glTexCoordP4uiv = (PFNGLTEXCOORDP4UIVPROC) load(userptr, "glTexCoordP4uiv");
+    glad_glVertexAttribDivisor = (PFNGLVERTEXATTRIBDIVISORPROC) load(userptr, "glVertexAttribDivisor");
+    glad_glVertexAttribP1ui = (PFNGLVERTEXATTRIBP1UIPROC) load(userptr, "glVertexAttribP1ui");
+    glad_glVertexAttribP1uiv = (PFNGLVERTEXATTRIBP1UIVPROC) load(userptr, "glVertexAttribP1uiv");
+    glad_glVertexAttribP2ui = (PFNGLVERTEXATTRIBP2UIPROC) load(userptr, "glVertexAttribP2ui");
+    glad_glVertexAttribP2uiv = (PFNGLVERTEXATTRIBP2UIVPROC) load(userptr, "glVertexAttribP2uiv");
+    glad_glVertexAttribP3ui = (PFNGLVERTEXATTRIBP3UIPROC) load(userptr, "glVertexAttribP3ui");
+    glad_glVertexAttribP3uiv = (PFNGLVERTEXATTRIBP3UIVPROC) load(userptr, "glVertexAttribP3uiv");
+    glad_glVertexAttribP4ui = (PFNGLVERTEXATTRIBP4UIPROC) load(userptr, "glVertexAttribP4ui");
+    glad_glVertexAttribP4uiv = (PFNGLVERTEXATTRIBP4UIVPROC) load(userptr, "glVertexAttribP4uiv");
+    glad_glVertexP2ui = (PFNGLVERTEXP2UIPROC) load(userptr, "glVertexP2ui");
+    glad_glVertexP2uiv = (PFNGLVERTEXP2UIVPROC) load(userptr, "glVertexP2uiv");
+    glad_glVertexP3ui = (PFNGLVERTEXP3UIPROC) load(userptr, "glVertexP3ui");
+    glad_glVertexP3uiv = (PFNGLVERTEXP3UIVPROC) load(userptr, "glVertexP3uiv");
+    glad_glVertexP4ui = (PFNGLVERTEXP4UIPROC) load(userptr, "glVertexP4ui");
+    glad_glVertexP4uiv = (PFNGLVERTEXP4UIVPROC) load(userptr, "glVertexP4uiv");
+}
+static void glad_gl_load_GL_ARB_multisample( GLADuserptrloadfunc load, void* userptr) {
+    if(!GLAD_GL_ARB_multisample) return;
+    glad_glSampleCoverageARB = (PFNGLSAMPLECOVERAGEARBPROC) load(userptr, "glSampleCoverageARB");
+}
+static void glad_gl_load_GL_ARB_robustness( GLADuserptrloadfunc load, void* userptr) {
+    if(!GLAD_GL_ARB_robustness) return;
+    glad_glGetGraphicsResetStatusARB = (PFNGLGETGRAPHICSRESETSTATUSARBPROC) load(userptr, "glGetGraphicsResetStatusARB");
+    glad_glGetnColorTableARB = (PFNGLGETNCOLORTABLEARBPROC) load(userptr, "glGetnColorTableARB");
+    glad_glGetnCompressedTexImageARB = (PFNGLGETNCOMPRESSEDTEXIMAGEARBPROC) load(userptr, "glGetnCompressedTexImageARB");
+    glad_glGetnConvolutionFilterARB = (PFNGLGETNCONVOLUTIONFILTERARBPROC) load(userptr, "glGetnConvolutionFilterARB");
+    glad_glGetnHistogramARB = (PFNGLGETNHISTOGRAMARBPROC) load(userptr, "glGetnHistogramARB");
+    glad_glGetnMapdvARB = (PFNGLGETNMAPDVARBPROC) load(userptr, "glGetnMapdvARB");
+    glad_glGetnMapfvARB = (PFNGLGETNMAPFVARBPROC) load(userptr, "glGetnMapfvARB");
+    glad_glGetnMapivARB = (PFNGLGETNMAPIVARBPROC) load(userptr, "glGetnMapivARB");
+    glad_glGetnMinmaxARB = (PFNGLGETNMINMAXARBPROC) load(userptr, "glGetnMinmaxARB");
+    glad_glGetnPixelMapfvARB = (PFNGLGETNPIXELMAPFVARBPROC) load(userptr, "glGetnPixelMapfvARB");
+    glad_glGetnPixelMapuivARB = (PFNGLGETNPIXELMAPUIVARBPROC) load(userptr, "glGetnPixelMapuivARB");
+    glad_glGetnPixelMapusvARB = (PFNGLGETNPIXELMAPUSVARBPROC) load(userptr, "glGetnPixelMapusvARB");
+    glad_glGetnPolygonStippleARB = (PFNGLGETNPOLYGONSTIPPLEARBPROC) load(userptr, "glGetnPolygonStippleARB");
+    glad_glGetnSeparableFilterARB = (PFNGLGETNSEPARABLEFILTERARBPROC) load(userptr, "glGetnSeparableFilterARB");
+    glad_glGetnTexImageARB = (PFNGLGETNTEXIMAGEARBPROC) load(userptr, "glGetnTexImageARB");
+    glad_glGetnUniformdvARB = (PFNGLGETNUNIFORMDVARBPROC) load(userptr, "glGetnUniformdvARB");
+    glad_glGetnUniformfvARB = (PFNGLGETNUNIFORMFVARBPROC) load(userptr, "glGetnUniformfvARB");
+    glad_glGetnUniformivARB = (PFNGLGETNUNIFORMIVARBPROC) load(userptr, "glGetnUniformivARB");
+    glad_glGetnUniformuivARB = (PFNGLGETNUNIFORMUIVARBPROC) load(userptr, "glGetnUniformuivARB");
+    glad_glReadnPixelsARB = (PFNGLREADNPIXELSARBPROC) load(userptr, "glReadnPixelsARB");
+}
+static void glad_gl_load_GL_KHR_debug( GLADuserptrloadfunc load, void* userptr) {
+    if(!GLAD_GL_KHR_debug) return;
+    glad_glDebugMessageCallback = (PFNGLDEBUGMESSAGECALLBACKPROC) load(userptr, "glDebugMessageCallback");
+    glad_glDebugMessageControl = (PFNGLDEBUGMESSAGECONTROLPROC) load(userptr, "glDebugMessageControl");
+    glad_glDebugMessageInsert = (PFNGLDEBUGMESSAGEINSERTPROC) load(userptr, "glDebugMessageInsert");
+    glad_glGetDebugMessageLog = (PFNGLGETDEBUGMESSAGELOGPROC) load(userptr, "glGetDebugMessageLog");
+    glad_glGetObjectLabel = (PFNGLGETOBJECTLABELPROC) load(userptr, "glGetObjectLabel");
+    glad_glGetObjectPtrLabel = (PFNGLGETOBJECTPTRLABELPROC) load(userptr, "glGetObjectPtrLabel");
+    glad_glGetPointerv = (PFNGLGETPOINTERVPROC) load(userptr, "glGetPointerv");
+    glad_glObjectLabel = (PFNGLOBJECTLABELPROC) load(userptr, "glObjectLabel");
+    glad_glObjectPtrLabel = (PFNGLOBJECTPTRLABELPROC) load(userptr, "glObjectPtrLabel");
+    glad_glPopDebugGroup = (PFNGLPOPDEBUGGROUPPROC) load(userptr, "glPopDebugGroup");
+    glad_glPushDebugGroup = (PFNGLPUSHDEBUGGROUPPROC) load(userptr, "glPushDebugGroup");
+}
+
+
+
+#if defined(GL_ES_VERSION_3_0) || defined(GL_VERSION_3_0)
+#define GLAD_GL_IS_SOME_NEW_VERSION 1
+#else
+#define GLAD_GL_IS_SOME_NEW_VERSION 0
+#endif
+
+static int glad_gl_get_extensions( int version, const char **out_exts, unsigned int *out_num_exts_i, char ***out_exts_i) {
+#if GLAD_GL_IS_SOME_NEW_VERSION
+    if(GLAD_VERSION_MAJOR(version) < 3) {
+#else
+    (void) version;
+    (void) out_num_exts_i;
+    (void) out_exts_i;
+#endif
+        if (glad_glGetString == NULL) {
+            return 0;
+        }
+        *out_exts = (const char *)glad_glGetString(GL_EXTENSIONS);
+#if GLAD_GL_IS_SOME_NEW_VERSION
+    } else {
+        unsigned int index = 0;
+        unsigned int num_exts_i = 0;
+        char **exts_i = NULL;
+        if (glad_glGetStringi == NULL || glad_glGetIntegerv == NULL) {
+            return 0;
+        }
+        glad_glGetIntegerv(GL_NUM_EXTENSIONS, (int*) &num_exts_i);
+        if (num_exts_i > 0) {
+            exts_i = (char **) malloc(num_exts_i * (sizeof *exts_i));
+        }
+        if (exts_i == NULL) {
+            return 0;
+        }
+        for(index = 0; index < num_exts_i; index++) {
+            const char *gl_str_tmp = (const char*) glad_glGetStringi(GL_EXTENSIONS, index);
+            size_t len = strlen(gl_str_tmp) + 1;
+
+            char *local_str = (char*) malloc(len * sizeof(char));
+            if(local_str != NULL) {
+                memcpy(local_str, gl_str_tmp, len * sizeof(char));
+            }
+
+            exts_i[index] = local_str;
+        }
+
+        *out_num_exts_i = num_exts_i;
+        *out_exts_i = exts_i;
+    }
+#endif
+    return 1;
+}
+static void glad_gl_free_extensions(char **exts_i, unsigned int num_exts_i) {
+    if (exts_i != NULL) {
+        unsigned int index;
+        for(index = 0; index < num_exts_i; index++) {
+            free((void *) (exts_i[index]));
+        }
+        free((void *)exts_i);
+        exts_i = NULL;
+    }
+}
+static int glad_gl_has_extension(int version, const char *exts, unsigned int num_exts_i, char **exts_i, const char *ext) {
+    if(GLAD_VERSION_MAJOR(version) < 3 || !GLAD_GL_IS_SOME_NEW_VERSION) {
+        const char *extensions;
+        const char *loc;
+        const char *terminator;
+        extensions = exts;
+        if(extensions == NULL || ext == NULL) {
+            return 0;
+        }
+        while(1) {
+            loc = strstr(extensions, ext);
+            if(loc == NULL) {
+                return 0;
+            }
+            terminator = loc + strlen(ext);
+            if((loc == extensions || *(loc - 1) == ' ') &&
+                (*terminator == ' ' || *terminator == '\0')) {
+                return 1;
+            }
+            extensions = terminator;
+        }
+    } else {
+        unsigned int index;
+        for(index = 0; index < num_exts_i; index++) {
+            const char *e = exts_i[index];
+            if(strcmp(e, ext) == 0) {
+                return 1;
+            }
+        }
+    }
+    return 0;
+}
+
+static GLADapiproc glad_gl_get_proc_from_userptr(void *userptr, const char* name) {
+    return (GLAD_GNUC_EXTENSION (GLADapiproc (*)(const char *name)) userptr)(name);
+}
+
+static int glad_gl_find_extensions_gl( int version) {
+    const char *exts = NULL;
+    unsigned int num_exts_i = 0;
+    char **exts_i = NULL;
+    if (!glad_gl_get_extensions(version, &exts, &num_exts_i, &exts_i)) return 0;
+
+    GLAD_GL_ARB_multisample = glad_gl_has_extension(version, exts, num_exts_i, exts_i, "GL_ARB_multisample");
+    GLAD_GL_ARB_robustness = glad_gl_has_extension(version, exts, num_exts_i, exts_i, "GL_ARB_robustness");
+    GLAD_GL_KHR_debug = glad_gl_has_extension(version, exts, num_exts_i, exts_i, "GL_KHR_debug");
+
+    glad_gl_free_extensions(exts_i, num_exts_i);
+
+    return 1;
+}
+
+static int glad_gl_find_core_gl(void) {
+    int i;
+    const char* version;
+    const char* prefixes[] = {
+        "OpenGL ES-CM ",
+        "OpenGL ES-CL ",
+        "OpenGL ES ",
+        "OpenGL SC ",
+        NULL
+    };
+    int major = 0;
+    int minor = 0;
+    version = (const char*) glad_glGetString(GL_VERSION);
+    if (!version) return 0;
+    for (i = 0;  prefixes[i];  i++) {
+        const size_t length = strlen(prefixes[i]);
+        if (strncmp(version, prefixes[i], length) == 0) {
+            version += length;
+            break;
+        }
+    }
+
+    GLAD_IMPL_UTIL_SSCANF(version, "%d.%d", &major, &minor);
+
+    GLAD_GL_VERSION_1_0 = (major == 1 && minor >= 0) || major > 1;
+    GLAD_GL_VERSION_1_1 = (major == 1 && minor >= 1) || major > 1;
+    GLAD_GL_VERSION_1_2 = (major == 1 && minor >= 2) || major > 1;
+    GLAD_GL_VERSION_1_3 = (major == 1 && minor >= 3) || major > 1;
+    GLAD_GL_VERSION_1_4 = (major == 1 && minor >= 4) || major > 1;
+    GLAD_GL_VERSION_1_5 = (major == 1 && minor >= 5) || major > 1;
+    GLAD_GL_VERSION_2_0 = (major == 2 && minor >= 0) || major > 2;
+    GLAD_GL_VERSION_2_1 = (major == 2 && minor >= 1) || major > 2;
+    GLAD_GL_VERSION_3_0 = (major == 3 && minor >= 0) || major > 3;
+    GLAD_GL_VERSION_3_1 = (major == 3 && minor >= 1) || major > 3;
+    GLAD_GL_VERSION_3_2 = (major == 3 && minor >= 2) || major > 3;
+    GLAD_GL_VERSION_3_3 = (major == 3 && minor >= 3) || major > 3;
+
+    return GLAD_MAKE_VERSION(major, minor);
+}
+
+int gladLoadGLUserPtr( GLADuserptrloadfunc load, void *userptr) {
+    int version;
+
+    glad_glGetString = (PFNGLGETSTRINGPROC) load(userptr, "glGetString");
+    if(glad_glGetString == NULL) return 0;
+    if(glad_glGetString(GL_VERSION) == NULL) return 0;
+    version = glad_gl_find_core_gl();
+
+    glad_gl_load_GL_VERSION_1_0(load, userptr);
+    glad_gl_load_GL_VERSION_1_1(load, userptr);
+    glad_gl_load_GL_VERSION_1_2(load, userptr);
+    glad_gl_load_GL_VERSION_1_3(load, userptr);
+    glad_gl_load_GL_VERSION_1_4(load, userptr);
+    glad_gl_load_GL_VERSION_1_5(load, userptr);
+    glad_gl_load_GL_VERSION_2_0(load, userptr);
+    glad_gl_load_GL_VERSION_2_1(load, userptr);
+    glad_gl_load_GL_VERSION_3_0(load, userptr);
+    glad_gl_load_GL_VERSION_3_1(load, userptr);
+    glad_gl_load_GL_VERSION_3_2(load, userptr);
+    glad_gl_load_GL_VERSION_3_3(load, userptr);
+
+    if (!glad_gl_find_extensions_gl(version)) return 0;
+    glad_gl_load_GL_ARB_multisample(load, userptr);
+    glad_gl_load_GL_ARB_robustness(load, userptr);
+    glad_gl_load_GL_KHR_debug(load, userptr);
+
+
+
+    return version;
+}
+
+
+int gladLoadGL( GLADloadfunc load) {
+    return gladLoadGLUserPtr( glad_gl_get_proc_from_userptr, GLAD_GNUC_EXTENSION (void*) load);
+}
+
+
+
+ 
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* GLAD_GL_IMPLEMENTATION */
+
diff --git a/deps/glad/gles2.h b/deps/glad/gles2.h
new file mode 100644
index 0000000..d67f110
--- /dev/null
+++ b/deps/glad/gles2.h
@@ -0,0 +1,1805 @@
+/**
+ * Loader generated by glad 2.0.0-beta on Tue Aug 24 22:51:42 2021
+ *
+ * Generator: C/C++
+ * Specification: gl
+ * Extensions: 0
+ *
+ * APIs:
+ *  - gles2=2.0
+ *
+ * Options:
+ *  - ALIAS = False
+ *  - DEBUG = False
+ *  - HEADER_ONLY = True
+ *  - LOADER = False
+ *  - MX = False
+ *  - MX_GLOBAL = False
+ *  - ON_DEMAND = False
+ *
+ * Commandline:
+ *    --api='gles2=2.0' --extensions='' c --header-only
+ *
+ * Online:
+ *    http://glad.sh/#api=gles2%3D2.0&extensions=&generator=c&options=HEADER_ONLY
+ *
+ */
+
+#ifndef GLAD_GLES2_H_
+#define GLAD_GLES2_H_
+
+#ifdef __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wreserved-id-macro"
+#endif
+#ifdef __gl2_h_
+  #error OpenGL ES 2 header already included (API: gles2), remove previous include!
+#endif
+#define __gl2_h_ 1
+#ifdef __gl3_h_
+  #error OpenGL ES 3 header already included (API: gles2), remove previous include!
+#endif
+#define __gl3_h_ 1
+#ifdef __clang__
+#pragma clang diagnostic pop
+#endif
+
+#define GLAD_GLES2
+#define GLAD_OPTION_GLES2_HEADER_ONLY
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef GLAD_PLATFORM_H_
+#define GLAD_PLATFORM_H_
+
+#ifndef GLAD_PLATFORM_WIN32
+  #if defined(_WIN32) || defined(__WIN32__) || defined(WIN32) || defined(__MINGW32__)
+    #define GLAD_PLATFORM_WIN32 1
+  #else
+    #define GLAD_PLATFORM_WIN32 0
+  #endif
+#endif
+
+#ifndef GLAD_PLATFORM_APPLE
+  #ifdef __APPLE__
+    #define GLAD_PLATFORM_APPLE 1
+  #else
+    #define GLAD_PLATFORM_APPLE 0
+  #endif
+#endif
+
+#ifndef GLAD_PLATFORM_EMSCRIPTEN
+  #ifdef __EMSCRIPTEN__
+    #define GLAD_PLATFORM_EMSCRIPTEN 1
+  #else
+    #define GLAD_PLATFORM_EMSCRIPTEN 0
+  #endif
+#endif
+
+#ifndef GLAD_PLATFORM_UWP
+  #if defined(_MSC_VER) && !defined(GLAD_INTERNAL_HAVE_WINAPIFAMILY)
+    #ifdef __has_include
+      #if __has_include(<winapifamily.h>)
+        #define GLAD_INTERNAL_HAVE_WINAPIFAMILY 1
+      #endif
+    #elif _MSC_VER >= 1700 && !_USING_V110_SDK71_
+      #define GLAD_INTERNAL_HAVE_WINAPIFAMILY 1
+    #endif
+  #endif
+
+  #ifdef GLAD_INTERNAL_HAVE_WINAPIFAMILY
+    #include <winapifamily.h>
+    #if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) && WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
+      #define GLAD_PLATFORM_UWP 1
+    #endif
+  #endif
+
+  #ifndef GLAD_PLATFORM_UWP
+    #define GLAD_PLATFORM_UWP 0
+  #endif
+#endif
+
+#ifdef __GNUC__
+  #define GLAD_GNUC_EXTENSION __extension__
+#else
+  #define GLAD_GNUC_EXTENSION
+#endif
+
+#ifndef GLAD_API_CALL
+  #if defined(GLAD_API_CALL_EXPORT)
+    #if GLAD_PLATFORM_WIN32 || defined(__CYGWIN__)
+      #if defined(GLAD_API_CALL_EXPORT_BUILD)
+        #if defined(__GNUC__)
+          #define GLAD_API_CALL __attribute__ ((dllexport)) extern
+        #else
+          #define GLAD_API_CALL __declspec(dllexport) extern
+        #endif
+      #else
+        #if defined(__GNUC__)
+          #define GLAD_API_CALL __attribute__ ((dllimport)) extern
+        #else
+          #define GLAD_API_CALL __declspec(dllimport) extern
+        #endif
+      #endif
+    #elif defined(__GNUC__) && defined(GLAD_API_CALL_EXPORT_BUILD)
+      #define GLAD_API_CALL __attribute__ ((visibility ("default"))) extern
+    #else
+      #define GLAD_API_CALL extern
+    #endif
+  #else
+    #define GLAD_API_CALL extern
+  #endif
+#endif
+
+#ifdef APIENTRY
+  #define GLAD_API_PTR APIENTRY
+#elif GLAD_PLATFORM_WIN32
+  #define GLAD_API_PTR __stdcall
+#else
+  #define GLAD_API_PTR
+#endif
+
+#ifndef GLAPI
+#define GLAPI GLAD_API_CALL
+#endif
+
+#ifndef GLAPIENTRY
+#define GLAPIENTRY GLAD_API_PTR
+#endif
+
+#define GLAD_MAKE_VERSION(major, minor) (major * 10000 + minor)
+#define GLAD_VERSION_MAJOR(version) (version / 10000)
+#define GLAD_VERSION_MINOR(version) (version % 10000)
+
+#define GLAD_GENERATOR_VERSION "2.0.0-beta"
+
+typedef void (*GLADapiproc)(void);
+
+typedef GLADapiproc (*GLADloadfunc)(const char *name);
+typedef GLADapiproc (*GLADuserptrloadfunc)(void *userptr, const char *name);
+
+typedef void (*GLADprecallback)(const char *name, GLADapiproc apiproc, int len_args, ...);
+typedef void (*GLADpostcallback)(void *ret, const char *name, GLADapiproc apiproc, int len_args, ...);
+
+#endif /* GLAD_PLATFORM_H_ */
+
+#define GL_ACTIVE_ATTRIBUTES 0x8B89
+#define GL_ACTIVE_ATTRIBUTE_MAX_LENGTH 0x8B8A
+#define GL_ACTIVE_TEXTURE 0x84E0
+#define GL_ACTIVE_UNIFORMS 0x8B86
+#define GL_ACTIVE_UNIFORM_MAX_LENGTH 0x8B87
+#define GL_ALIASED_LINE_WIDTH_RANGE 0x846E
+#define GL_ALIASED_POINT_SIZE_RANGE 0x846D
+#define GL_ALPHA 0x1906
+#define GL_ALPHA_BITS 0x0D55
+#define GL_ALWAYS 0x0207
+#define GL_ARRAY_BUFFER 0x8892
+#define GL_ARRAY_BUFFER_BINDING 0x8894
+#define GL_ATTACHED_SHADERS 0x8B85
+#define GL_BACK 0x0405
+#define GL_BLEND 0x0BE2
+#define GL_BLEND_COLOR 0x8005
+#define GL_BLEND_DST_ALPHA 0x80CA
+#define GL_BLEND_DST_RGB 0x80C8
+#define GL_BLEND_EQUATION 0x8009
+#define GL_BLEND_EQUATION_ALPHA 0x883D
+#define GL_BLEND_EQUATION_RGB 0x8009
+#define GL_BLEND_SRC_ALPHA 0x80CB
+#define GL_BLEND_SRC_RGB 0x80C9
+#define GL_BLUE_BITS 0x0D54
+#define GL_BOOL 0x8B56
+#define GL_BOOL_VEC2 0x8B57
+#define GL_BOOL_VEC3 0x8B58
+#define GL_BOOL_VEC4 0x8B59
+#define GL_BUFFER_SIZE 0x8764
+#define GL_BUFFER_USAGE 0x8765
+#define GL_BYTE 0x1400
+#define GL_CCW 0x0901
+#define GL_CLAMP_TO_EDGE 0x812F
+#define GL_COLOR_ATTACHMENT0 0x8CE0
+#define GL_COLOR_BUFFER_BIT 0x00004000
+#define GL_COLOR_CLEAR_VALUE 0x0C22
+#define GL_COLOR_WRITEMASK 0x0C23
+#define GL_COMPILE_STATUS 0x8B81
+#define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3
+#define GL_CONSTANT_ALPHA 0x8003
+#define GL_CONSTANT_COLOR 0x8001
+#define GL_CULL_FACE 0x0B44
+#define GL_CULL_FACE_MODE 0x0B45
+#define GL_CURRENT_PROGRAM 0x8B8D
+#define GL_CURRENT_VERTEX_ATTRIB 0x8626
+#define GL_CW 0x0900
+#define GL_DECR 0x1E03
+#define GL_DECR_WRAP 0x8508
+#define GL_DELETE_STATUS 0x8B80
+#define GL_DEPTH_ATTACHMENT 0x8D00
+#define GL_DEPTH_BITS 0x0D56
+#define GL_DEPTH_BUFFER_BIT 0x00000100
+#define GL_DEPTH_CLEAR_VALUE 0x0B73
+#define GL_DEPTH_COMPONENT 0x1902
+#define GL_DEPTH_COMPONENT16 0x81A5
+#define GL_DEPTH_FUNC 0x0B74
+#define GL_DEPTH_RANGE 0x0B70
+#define GL_DEPTH_TEST 0x0B71
+#define GL_DEPTH_WRITEMASK 0x0B72
+#define GL_DITHER 0x0BD0
+#define GL_DONT_CARE 0x1100
+#define GL_DST_ALPHA 0x0304
+#define GL_DST_COLOR 0x0306
+#define GL_DYNAMIC_DRAW 0x88E8
+#define GL_ELEMENT_ARRAY_BUFFER 0x8893
+#define GL_ELEMENT_ARRAY_BUFFER_BINDING 0x8895
+#define GL_EQUAL 0x0202
+#define GL_EXTENSIONS 0x1F03
+#define GL_FALSE 0
+#define GL_FASTEST 0x1101
+#define GL_FIXED 0x140C
+#define GL_FLOAT 0x1406
+#define GL_FLOAT_MAT2 0x8B5A
+#define GL_FLOAT_MAT3 0x8B5B
+#define GL_FLOAT_MAT4 0x8B5C
+#define GL_FLOAT_VEC2 0x8B50
+#define GL_FLOAT_VEC3 0x8B51
+#define GL_FLOAT_VEC4 0x8B52
+#define GL_FRAGMENT_SHADER 0x8B30
+#define GL_FRAMEBUFFER 0x8D40
+#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME 0x8CD1
+#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE 0x8CD0
+#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE 0x8CD3
+#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL 0x8CD2
+#define GL_FRAMEBUFFER_BINDING 0x8CA6
+#define GL_FRAMEBUFFER_COMPLETE 0x8CD5
+#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT 0x8CD6
+#define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS 0x8CD9
+#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT 0x8CD7
+#define GL_FRAMEBUFFER_UNSUPPORTED 0x8CDD
+#define GL_FRONT 0x0404
+#define GL_FRONT_AND_BACK 0x0408
+#define GL_FRONT_FACE 0x0B46
+#define GL_FUNC_ADD 0x8006
+#define GL_FUNC_REVERSE_SUBTRACT 0x800B
+#define GL_FUNC_SUBTRACT 0x800A
+#define GL_GENERATE_MIPMAP_HINT 0x8192
+#define GL_GEQUAL 0x0206
+#define GL_GREATER 0x0204
+#define GL_GREEN_BITS 0x0D53
+#define GL_HIGH_FLOAT 0x8DF2
+#define GL_HIGH_INT 0x8DF5
+#define GL_IMPLEMENTATION_COLOR_READ_FORMAT 0x8B9B
+#define GL_IMPLEMENTATION_COLOR_READ_TYPE 0x8B9A
+#define GL_INCR 0x1E02
+#define GL_INCR_WRAP 0x8507
+#define GL_INFO_LOG_LENGTH 0x8B84
+#define GL_INT 0x1404
+#define GL_INT_VEC2 0x8B53
+#define GL_INT_VEC3 0x8B54
+#define GL_INT_VEC4 0x8B55
+#define GL_INVALID_ENUM 0x0500
+#define GL_INVALID_FRAMEBUFFER_OPERATION 0x0506
+#define GL_INVALID_OPERATION 0x0502
+#define GL_INVALID_VALUE 0x0501
+#define GL_INVERT 0x150A
+#define GL_KEEP 0x1E00
+#define GL_LEQUAL 0x0203
+#define GL_LESS 0x0201
+#define GL_LINEAR 0x2601
+#define GL_LINEAR_MIPMAP_LINEAR 0x2703
+#define GL_LINEAR_MIPMAP_NEAREST 0x2701
+#define GL_LINES 0x0001
+#define GL_LINE_LOOP 0x0002
+#define GL_LINE_STRIP 0x0003
+#define GL_LINE_WIDTH 0x0B21
+#define GL_LINK_STATUS 0x8B82
+#define GL_LOW_FLOAT 0x8DF0
+#define GL_LOW_INT 0x8DF3
+#define GL_LUMINANCE 0x1909
+#define GL_LUMINANCE_ALPHA 0x190A
+#define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS 0x8B4D
+#define GL_MAX_CUBE_MAP_TEXTURE_SIZE 0x851C
+#define GL_MAX_FRAGMENT_UNIFORM_VECTORS 0x8DFD
+#define GL_MAX_RENDERBUFFER_SIZE 0x84E8
+#define GL_MAX_TEXTURE_IMAGE_UNITS 0x8872
+#define GL_MAX_TEXTURE_SIZE 0x0D33
+#define GL_MAX_VARYING_VECTORS 0x8DFC
+#define GL_MAX_VERTEX_ATTRIBS 0x8869
+#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS 0x8B4C
+#define GL_MAX_VERTEX_UNIFORM_VECTORS 0x8DFB
+#define GL_MAX_VIEWPORT_DIMS 0x0D3A
+#define GL_MEDIUM_FLOAT 0x8DF1
+#define GL_MEDIUM_INT 0x8DF4
+#define GL_MIRRORED_REPEAT 0x8370
+#define GL_NEAREST 0x2600
+#define GL_NEAREST_MIPMAP_LINEAR 0x2702
+#define GL_NEAREST_MIPMAP_NEAREST 0x2700
+#define GL_NEVER 0x0200
+#define GL_NICEST 0x1102
+#define GL_NONE 0
+#define GL_NOTEQUAL 0x0205
+#define GL_NO_ERROR 0
+#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2
+#define GL_NUM_SHADER_BINARY_FORMATS 0x8DF9
+#define GL_ONE 1
+#define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004
+#define GL_ONE_MINUS_CONSTANT_COLOR 0x8002
+#define GL_ONE_MINUS_DST_ALPHA 0x0305
+#define GL_ONE_MINUS_DST_COLOR 0x0307
+#define GL_ONE_MINUS_SRC_ALPHA 0x0303
+#define GL_ONE_MINUS_SRC_COLOR 0x0301
+#define GL_OUT_OF_MEMORY 0x0505
+#define GL_PACK_ALIGNMENT 0x0D05
+#define GL_POINTS 0x0000
+#define GL_POLYGON_OFFSET_FACTOR 0x8038
+#define GL_POLYGON_OFFSET_FILL 0x8037
+#define GL_POLYGON_OFFSET_UNITS 0x2A00
+#define GL_RED_BITS 0x0D52
+#define GL_RENDERBUFFER 0x8D41
+#define GL_RENDERBUFFER_ALPHA_SIZE 0x8D53
+#define GL_RENDERBUFFER_BINDING 0x8CA7
+#define GL_RENDERBUFFER_BLUE_SIZE 0x8D52
+#define GL_RENDERBUFFER_DEPTH_SIZE 0x8D54
+#define GL_RENDERBUFFER_GREEN_SIZE 0x8D51
+#define GL_RENDERBUFFER_HEIGHT 0x8D43
+#define GL_RENDERBUFFER_INTERNAL_FORMAT 0x8D44
+#define GL_RENDERBUFFER_RED_SIZE 0x8D50
+#define GL_RENDERBUFFER_STENCIL_SIZE 0x8D55
+#define GL_RENDERBUFFER_WIDTH 0x8D42
+#define GL_RENDERER 0x1F01
+#define GL_REPEAT 0x2901
+#define GL_REPLACE 0x1E01
+#define GL_RGB 0x1907
+#define GL_RGB565 0x8D62
+#define GL_RGB5_A1 0x8057
+#define GL_RGBA 0x1908
+#define GL_RGBA4 0x8056
+#define GL_SAMPLER_2D 0x8B5E
+#define GL_SAMPLER_CUBE 0x8B60
+#define GL_SAMPLES 0x80A9
+#define GL_SAMPLE_ALPHA_TO_COVERAGE 0x809E
+#define GL_SAMPLE_BUFFERS 0x80A8
+#define GL_SAMPLE_COVERAGE 0x80A0
+#define GL_SAMPLE_COVERAGE_INVERT 0x80AB
+#define GL_SAMPLE_COVERAGE_VALUE 0x80AA
+#define GL_SCISSOR_BOX 0x0C10
+#define GL_SCISSOR_TEST 0x0C11
+#define GL_SHADER_BINARY_FORMATS 0x8DF8
+#define GL_SHADER_COMPILER 0x8DFA
+#define GL_SHADER_SOURCE_LENGTH 0x8B88
+#define GL_SHADER_TYPE 0x8B4F
+#define GL_SHADING_LANGUAGE_VERSION 0x8B8C
+#define GL_SHORT 0x1402
+#define GL_SRC_ALPHA 0x0302
+#define GL_SRC_ALPHA_SATURATE 0x0308
+#define GL_SRC_COLOR 0x0300
+#define GL_STATIC_DRAW 0x88E4
+#define GL_STENCIL_ATTACHMENT 0x8D20
+#define GL_STENCIL_BACK_FAIL 0x8801
+#define GL_STENCIL_BACK_FUNC 0x8800
+#define GL_STENCIL_BACK_PASS_DEPTH_FAIL 0x8802
+#define GL_STENCIL_BACK_PASS_DEPTH_PASS 0x8803
+#define GL_STENCIL_BACK_REF 0x8CA3
+#define GL_STENCIL_BACK_VALUE_MASK 0x8CA4
+#define GL_STENCIL_BACK_WRITEMASK 0x8CA5
+#define GL_STENCIL_BITS 0x0D57
+#define GL_STENCIL_BUFFER_BIT 0x00000400
+#define GL_STENCIL_CLEAR_VALUE 0x0B91
+#define GL_STENCIL_FAIL 0x0B94
+#define GL_STENCIL_FUNC 0x0B92
+#define GL_STENCIL_INDEX8 0x8D48
+#define GL_STENCIL_PASS_DEPTH_FAIL 0x0B95
+#define GL_STENCIL_PASS_DEPTH_PASS 0x0B96
+#define GL_STENCIL_REF 0x0B97
+#define GL_STENCIL_TEST 0x0B90
+#define GL_STENCIL_VALUE_MASK 0x0B93
+#define GL_STENCIL_WRITEMASK 0x0B98
+#define GL_STREAM_DRAW 0x88E0
+#define GL_SUBPIXEL_BITS 0x0D50
+#define GL_TEXTURE 0x1702
+#define GL_TEXTURE0 0x84C0
+#define GL_TEXTURE1 0x84C1
+#define GL_TEXTURE10 0x84CA
+#define GL_TEXTURE11 0x84CB
+#define GL_TEXTURE12 0x84CC
+#define GL_TEXTURE13 0x84CD
+#define GL_TEXTURE14 0x84CE
+#define GL_TEXTURE15 0x84CF
+#define GL_TEXTURE16 0x84D0
+#define GL_TEXTURE17 0x84D1
+#define GL_TEXTURE18 0x84D2
+#define GL_TEXTURE19 0x84D3
+#define GL_TEXTURE2 0x84C2
+#define GL_TEXTURE20 0x84D4
+#define GL_TEXTURE21 0x84D5
+#define GL_TEXTURE22 0x84D6
+#define GL_TEXTURE23 0x84D7
+#define GL_TEXTURE24 0x84D8
+#define GL_TEXTURE25 0x84D9
+#define GL_TEXTURE26 0x84DA
+#define GL_TEXTURE27 0x84DB
+#define GL_TEXTURE28 0x84DC
+#define GL_TEXTURE29 0x84DD
+#define GL_TEXTURE3 0x84C3
+#define GL_TEXTURE30 0x84DE
+#define GL_TEXTURE31 0x84DF
+#define GL_TEXTURE4 0x84C4
+#define GL_TEXTURE5 0x84C5
+#define GL_TEXTURE6 0x84C6
+#define GL_TEXTURE7 0x84C7
+#define GL_TEXTURE8 0x84C8
+#define GL_TEXTURE9 0x84C9
+#define GL_TEXTURE_2D 0x0DE1
+#define GL_TEXTURE_BINDING_2D 0x8069
+#define GL_TEXTURE_BINDING_CUBE_MAP 0x8514
+#define GL_TEXTURE_CUBE_MAP 0x8513
+#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x8516
+#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x8518
+#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x851A
+#define GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x8515
+#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x8517
+#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x8519
+#define GL_TEXTURE_MAG_FILTER 0x2800
+#define GL_TEXTURE_MIN_FILTER 0x2801
+#define GL_TEXTURE_WRAP_S 0x2802
+#define GL_TEXTURE_WRAP_T 0x2803
+#define GL_TRIANGLES 0x0004
+#define GL_TRIANGLE_FAN 0x0006
+#define GL_TRIANGLE_STRIP 0x0005
+#define GL_TRUE 1
+#define GL_UNPACK_ALIGNMENT 0x0CF5
+#define GL_UNSIGNED_BYTE 0x1401
+#define GL_UNSIGNED_INT 0x1405
+#define GL_UNSIGNED_SHORT 0x1403
+#define GL_UNSIGNED_SHORT_4_4_4_4 0x8033
+#define GL_UNSIGNED_SHORT_5_5_5_1 0x8034
+#define GL_UNSIGNED_SHORT_5_6_5 0x8363
+#define GL_VALIDATE_STATUS 0x8B83
+#define GL_VENDOR 0x1F00
+#define GL_VERSION 0x1F02
+#define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING 0x889F
+#define GL_VERTEX_ATTRIB_ARRAY_ENABLED 0x8622
+#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED 0x886A
+#define GL_VERTEX_ATTRIB_ARRAY_POINTER 0x8645
+#define GL_VERTEX_ATTRIB_ARRAY_SIZE 0x8623
+#define GL_VERTEX_ATTRIB_ARRAY_STRIDE 0x8624
+#define GL_VERTEX_ATTRIB_ARRAY_TYPE 0x8625
+#define GL_VERTEX_SHADER 0x8B31
+#define GL_VIEWPORT 0x0BA2
+#define GL_ZERO 0
+
+
+#ifndef __khrplatform_h_
+#define __khrplatform_h_
+
+/*
+** Copyright (c) 2008-2018 The Khronos Group Inc.
+**
+** Permission is hereby granted, free of charge, to any person obtaining a
+** copy of this software and/or associated documentation files (the
+** "Materials"), to deal in the Materials without restriction, including
+** without limitation the rights to use, copy, modify, merge, publish,
+** distribute, sublicense, and/or sell copies of the Materials, and to
+** permit persons to whom the Materials are furnished to do so, subject to
+** the following conditions:
+**
+** The above copyright notice and this permission notice shall be included
+** in all copies or substantial portions of the Materials.
+**
+** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
+*/
+
+/* Khronos platform-specific types and definitions.
+ *
+ * The master copy of khrplatform.h is maintained in the Khronos EGL
+ * Registry repository at https://github.com/KhronosGroup/EGL-Registry
+ * The last semantic modification to khrplatform.h was at commit ID:
+ *      67a3e0864c2d75ea5287b9f3d2eb74a745936692
+ *
+ * Adopters may modify this file to suit their platform. Adopters are
+ * encouraged to submit platform specific modifications to the Khronos
+ * group so that they can be included in future versions of this file.
+ * Please submit changes by filing pull requests or issues on
+ * the EGL Registry repository linked above.
+ *
+ *
+ * See the Implementer's Guidelines for information about where this file
+ * should be located on your system and for more details of its use:
+ *    http://www.khronos.org/registry/implementers_guide.pdf
+ *
+ * This file should be included as
+ *        #include <KHR/khrplatform.h>
+ * by Khronos client API header files that use its types and defines.
+ *
+ * The types in khrplatform.h should only be used to define API-specific types.
+ *
+ * Types defined in khrplatform.h:
+ *    khronos_int8_t              signed   8  bit
+ *    khronos_uint8_t             unsigned 8  bit
+ *    khronos_int16_t             signed   16 bit
+ *    khronos_uint16_t            unsigned 16 bit
+ *    khronos_int32_t             signed   32 bit
+ *    khronos_uint32_t            unsigned 32 bit
+ *    khronos_int64_t             signed   64 bit
+ *    khronos_uint64_t            unsigned 64 bit
+ *    khronos_intptr_t            signed   same number of bits as a pointer
+ *    khronos_uintptr_t           unsigned same number of bits as a pointer
+ *    khronos_ssize_t             signed   size
+ *    khronos_usize_t             unsigned size
+ *    khronos_float_t             signed   32 bit floating point
+ *    khronos_time_ns_t           unsigned 64 bit time in nanoseconds
+ *    khronos_utime_nanoseconds_t unsigned time interval or absolute time in
+ *                                         nanoseconds
+ *    khronos_stime_nanoseconds_t signed time interval in nanoseconds
+ *    khronos_boolean_enum_t      enumerated boolean type. This should
+ *      only be used as a base type when a client API's boolean type is
+ *      an enum. Client APIs which use an integer or other type for
+ *      booleans cannot use this as the base type for their boolean.
+ *
+ * Tokens defined in khrplatform.h:
+ *
+ *    KHRONOS_FALSE, KHRONOS_TRUE Enumerated boolean false/true values.
+ *
+ *    KHRONOS_SUPPORT_INT64 is 1 if 64 bit integers are supported; otherwise 0.
+ *    KHRONOS_SUPPORT_FLOAT is 1 if floats are supported; otherwise 0.
+ *
+ * Calling convention macros defined in this file:
+ *    KHRONOS_APICALL
+ *    KHRONOS_GLAD_API_PTR
+ *    KHRONOS_APIATTRIBUTES
+ *
+ * These may be used in function prototypes as:
+ *
+ *      KHRONOS_APICALL void KHRONOS_GLAD_API_PTR funcname(
+ *                                  int arg1,
+ *                                  int arg2) KHRONOS_APIATTRIBUTES;
+ */
+
+#if defined(__SCITECH_SNAP__) && !defined(KHRONOS_STATIC)
+#   define KHRONOS_STATIC 1
+#endif
+
+/*-------------------------------------------------------------------------
+ * Definition of KHRONOS_APICALL
+ *-------------------------------------------------------------------------
+ * This precedes the return type of the function in the function prototype.
+ */
+#if defined(KHRONOS_STATIC)
+    /* If the preprocessor constant KHRONOS_STATIC is defined, make the
+     * header compatible with static linking. */
+#   define KHRONOS_APICALL
+#elif defined(_WIN32)
+#   define KHRONOS_APICALL __declspec(dllimport)
+#elif defined (__SYMBIAN32__)
+#   define KHRONOS_APICALL IMPORT_C
+#elif defined(__ANDROID__)
+#   define KHRONOS_APICALL __attribute__((visibility("default")))
+#else
+#   define KHRONOS_APICALL
+#endif
+
+/*-------------------------------------------------------------------------
+ * Definition of KHRONOS_GLAD_API_PTR
+ *-------------------------------------------------------------------------
+ * This follows the return type of the function  and precedes the function
+ * name in the function prototype.
+ */
+#if defined(_WIN32) && !defined(_WIN32_WCE) && !defined(__SCITECH_SNAP__)
+    /* Win32 but not WinCE */
+#   define KHRONOS_GLAD_API_PTR __stdcall
+#else
+#   define KHRONOS_GLAD_API_PTR
+#endif
+
+/*-------------------------------------------------------------------------
+ * Definition of KHRONOS_APIATTRIBUTES
+ *-------------------------------------------------------------------------
+ * This follows the closing parenthesis of the function prototype arguments.
+ */
+#if defined (__ARMCC_2__)
+#define KHRONOS_APIATTRIBUTES __softfp
+#else
+#define KHRONOS_APIATTRIBUTES
+#endif
+
+/*-------------------------------------------------------------------------
+ * basic type definitions
+ *-----------------------------------------------------------------------*/
+#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || defined(__GNUC__) || defined(__SCO__) || defined(__USLC__)
+
+
+/*
+ * Using <stdint.h>
+ */
+#include <stdint.h>
+typedef int32_t                 khronos_int32_t;
+typedef uint32_t                khronos_uint32_t;
+typedef int64_t                 khronos_int64_t;
+typedef uint64_t                khronos_uint64_t;
+#define KHRONOS_SUPPORT_INT64   1
+#define KHRONOS_SUPPORT_FLOAT   1
+
+#elif defined(__VMS ) || defined(__sgi)
+
+/*
+ * Using <inttypes.h>
+ */
+#include <inttypes.h>
+typedef int32_t                 khronos_int32_t;
+typedef uint32_t                khronos_uint32_t;
+typedef int64_t                 khronos_int64_t;
+typedef uint64_t                khronos_uint64_t;
+#define KHRONOS_SUPPORT_INT64   1
+#define KHRONOS_SUPPORT_FLOAT   1
+
+#elif defined(_WIN32) && !defined(__SCITECH_SNAP__)
+
+/*
+ * Win32
+ */
+typedef __int32                 khronos_int32_t;
+typedef unsigned __int32        khronos_uint32_t;
+typedef __int64                 khronos_int64_t;
+typedef unsigned __int64        khronos_uint64_t;
+#define KHRONOS_SUPPORT_INT64   1
+#define KHRONOS_SUPPORT_FLOAT   1
+
+#elif defined(__sun__) || defined(__digital__)
+
+/*
+ * Sun or Digital
+ */
+typedef int                     khronos_int32_t;
+typedef unsigned int            khronos_uint32_t;
+#if defined(__arch64__) || defined(_LP64)
+typedef long int                khronos_int64_t;
+typedef unsigned long int       khronos_uint64_t;
+#else
+typedef long long int           khronos_int64_t;
+typedef unsigned long long int  khronos_uint64_t;
+#endif /* __arch64__ */
+#define KHRONOS_SUPPORT_INT64   1
+#define KHRONOS_SUPPORT_FLOAT   1
+
+#elif 0
+
+/*
+ * Hypothetical platform with no float or int64 support
+ */
+typedef int                     khronos_int32_t;
+typedef unsigned int            khronos_uint32_t;
+#define KHRONOS_SUPPORT_INT64   0
+#define KHRONOS_SUPPORT_FLOAT   0
+
+#else
+
+/*
+ * Generic fallback
+ */
+#include <stdint.h>
+typedef int32_t                 khronos_int32_t;
+typedef uint32_t                khronos_uint32_t;
+typedef int64_t                 khronos_int64_t;
+typedef uint64_t                khronos_uint64_t;
+#define KHRONOS_SUPPORT_INT64   1
+#define KHRONOS_SUPPORT_FLOAT   1
+
+#endif
+
+
+/*
+ * Types that are (so far) the same on all platforms
+ */
+typedef signed   char          khronos_int8_t;
+typedef unsigned char          khronos_uint8_t;
+typedef signed   short int     khronos_int16_t;
+typedef unsigned short int     khronos_uint16_t;
+
+/*
+ * Types that differ between LLP64 and LP64 architectures - in LLP64,
+ * pointers are 64 bits, but 'long' is still 32 bits. Win64 appears
+ * to be the only LLP64 architecture in current use.
+ */
+#ifdef _WIN64
+typedef signed   long long int khronos_intptr_t;
+typedef unsigned long long int khronos_uintptr_t;
+typedef signed   long long int khronos_ssize_t;
+typedef unsigned long long int khronos_usize_t;
+#else
+typedef signed   long  int     khronos_intptr_t;
+typedef unsigned long  int     khronos_uintptr_t;
+typedef signed   long  int     khronos_ssize_t;
+typedef unsigned long  int     khronos_usize_t;
+#endif
+
+#if KHRONOS_SUPPORT_FLOAT
+/*
+ * Float type
+ */
+typedef          float         khronos_float_t;
+#endif
+
+#if KHRONOS_SUPPORT_INT64
+/* Time types
+ *
+ * These types can be used to represent a time interval in nanoseconds or
+ * an absolute Unadjusted System Time.  Unadjusted System Time is the number
+ * of nanoseconds since some arbitrary system event (e.g. since the last
+ * time the system booted).  The Unadjusted System Time is an unsigned
+ * 64 bit value that wraps back to 0 every 584 years.  Time intervals
+ * may be either signed or unsigned.
+ */
+typedef khronos_uint64_t       khronos_utime_nanoseconds_t;
+typedef khronos_int64_t        khronos_stime_nanoseconds_t;
+#endif
+
+/*
+ * Dummy value used to pad enum types to 32 bits.
+ */
+#ifndef KHRONOS_MAX_ENUM
+#define KHRONOS_MAX_ENUM 0x7FFFFFFF
+#endif
+
+/*
+ * Enumerated boolean type
+ *
+ * Values other than zero should be considered to be true.  Therefore
+ * comparisons should not be made against KHRONOS_TRUE.
+ */
+typedef enum {
+    KHRONOS_FALSE = 0,
+    KHRONOS_TRUE  = 1,
+    KHRONOS_BOOLEAN_ENUM_FORCE_SIZE = KHRONOS_MAX_ENUM
+} khronos_boolean_enum_t;
+
+#endif /* __khrplatform_h_ */
+
+typedef unsigned int GLenum;
+
+typedef unsigned char GLboolean;
+
+typedef unsigned int GLbitfield;
+
+typedef void GLvoid;
+
+typedef khronos_int8_t GLbyte;
+
+typedef khronos_uint8_t GLubyte;
+
+typedef khronos_int16_t GLshort;
+
+typedef khronos_uint16_t GLushort;
+
+typedef int GLint;
+
+typedef unsigned int GLuint;
+
+typedef khronos_int32_t GLclampx;
+
+typedef int GLsizei;
+
+typedef khronos_float_t GLfloat;
+
+typedef khronos_float_t GLclampf;
+
+typedef double GLdouble;
+
+typedef double GLclampd;
+
+typedef void *GLeglClientBufferEXT;
+
+typedef void *GLeglImageOES;
+
+typedef char GLchar;
+
+typedef char GLcharARB;
+
+#ifdef __APPLE__
+typedef void *GLhandleARB;
+#else
+typedef unsigned int GLhandleARB;
+#endif
+
+typedef khronos_uint16_t GLhalf;
+
+typedef khronos_uint16_t GLhalfARB;
+
+typedef khronos_int32_t GLfixed;
+
+#if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && (__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ > 1060)
+typedef khronos_intptr_t GLintptr;
+#else
+typedef khronos_intptr_t GLintptr;
+#endif
+
+#if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && (__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ > 1060)
+typedef khronos_intptr_t GLintptrARB;
+#else
+typedef khronos_intptr_t GLintptrARB;
+#endif
+
+#if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && (__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ > 1060)
+typedef khronos_ssize_t GLsizeiptr;
+#else
+typedef khronos_ssize_t GLsizeiptr;
+#endif
+
+#if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && (__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ > 1060)
+typedef khronos_ssize_t GLsizeiptrARB;
+#else
+typedef khronos_ssize_t GLsizeiptrARB;
+#endif
+
+typedef khronos_int64_t GLint64;
+
+typedef khronos_int64_t GLint64EXT;
+
+typedef khronos_uint64_t GLuint64;
+
+typedef khronos_uint64_t GLuint64EXT;
+
+typedef struct __GLsync *GLsync;
+
+struct _cl_context;
+
+struct _cl_event;
+
+typedef void (GLAD_API_PTR *GLDEBUGPROC)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const void *userParam);
+
+typedef void (GLAD_API_PTR *GLDEBUGPROCARB)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const void *userParam);
+
+typedef void (GLAD_API_PTR *GLDEBUGPROCKHR)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const void *userParam);
+
+typedef void (GLAD_API_PTR *GLDEBUGPROCAMD)(GLuint id,GLenum category,GLenum severity,GLsizei length,const GLchar *message,void *userParam);
+
+typedef unsigned short GLhalfNV;
+
+typedef GLintptr GLvdpauSurfaceNV;
+
+typedef void (GLAD_API_PTR *GLVULKANPROCNV)(void);
+
+
+
+#define GL_ES_VERSION_2_0 1
+GLAD_API_CALL int GLAD_GL_ES_VERSION_2_0;
+
+
+typedef void (GLAD_API_PTR *PFNGLACTIVETEXTUREPROC)(GLenum texture);
+typedef void (GLAD_API_PTR *PFNGLATTACHSHADERPROC)(GLuint program, GLuint shader);
+typedef void (GLAD_API_PTR *PFNGLBINDATTRIBLOCATIONPROC)(GLuint program, GLuint index, const GLchar * name);
+typedef void (GLAD_API_PTR *PFNGLBINDBUFFERPROC)(GLenum target, GLuint buffer);
+typedef void (GLAD_API_PTR *PFNGLBINDFRAMEBUFFERPROC)(GLenum target, GLuint framebuffer);
+typedef void (GLAD_API_PTR *PFNGLBINDRENDERBUFFERPROC)(GLenum target, GLuint renderbuffer);
+typedef void (GLAD_API_PTR *PFNGLBINDTEXTUREPROC)(GLenum target, GLuint texture);
+typedef void (GLAD_API_PTR *PFNGLBLENDCOLORPROC)(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
+typedef void (GLAD_API_PTR *PFNGLBLENDEQUATIONPROC)(GLenum mode);
+typedef void (GLAD_API_PTR *PFNGLBLENDEQUATIONSEPARATEPROC)(GLenum modeRGB, GLenum modeAlpha);
+typedef void (GLAD_API_PTR *PFNGLBLENDFUNCPROC)(GLenum sfactor, GLenum dfactor);
+typedef void (GLAD_API_PTR *PFNGLBLENDFUNCSEPARATEPROC)(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
+typedef void (GLAD_API_PTR *PFNGLBUFFERDATAPROC)(GLenum target, GLsizeiptr size, const void * data, GLenum usage);
+typedef void (GLAD_API_PTR *PFNGLBUFFERSUBDATAPROC)(GLenum target, GLintptr offset, GLsizeiptr size, const void * data);
+typedef GLenum (GLAD_API_PTR *PFNGLCHECKFRAMEBUFFERSTATUSPROC)(GLenum target);
+typedef void (GLAD_API_PTR *PFNGLCLEARPROC)(GLbitfield mask);
+typedef void (GLAD_API_PTR *PFNGLCLEARCOLORPROC)(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
+typedef void (GLAD_API_PTR *PFNGLCLEARDEPTHFPROC)(GLfloat d);
+typedef void (GLAD_API_PTR *PFNGLCLEARSTENCILPROC)(GLint s);
+typedef void (GLAD_API_PTR *PFNGLCOLORMASKPROC)(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
+typedef void (GLAD_API_PTR *PFNGLCOMPILESHADERPROC)(GLuint shader);
+typedef void (GLAD_API_PTR *PFNGLCOMPRESSEDTEXIMAGE2DPROC)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void * data);
+typedef void (GLAD_API_PTR *PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void * data);
+typedef void (GLAD_API_PTR *PFNGLCOPYTEXIMAGE2DPROC)(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
+typedef void (GLAD_API_PTR *PFNGLCOPYTEXSUBIMAGE2DPROC)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
+typedef GLuint (GLAD_API_PTR *PFNGLCREATEPROGRAMPROC)(void);
+typedef GLuint (GLAD_API_PTR *PFNGLCREATESHADERPROC)(GLenum type);
+typedef void (GLAD_API_PTR *PFNGLCULLFACEPROC)(GLenum mode);
+typedef void (GLAD_API_PTR *PFNGLDELETEBUFFERSPROC)(GLsizei n, const GLuint * buffers);
+typedef void (GLAD_API_PTR *PFNGLDELETEFRAMEBUFFERSPROC)(GLsizei n, const GLuint * framebuffers);
+typedef void (GLAD_API_PTR *PFNGLDELETEPROGRAMPROC)(GLuint program);
+typedef void (GLAD_API_PTR *PFNGLDELETERENDERBUFFERSPROC)(GLsizei n, const GLuint * renderbuffers);
+typedef void (GLAD_API_PTR *PFNGLDELETESHADERPROC)(GLuint shader);
+typedef void (GLAD_API_PTR *PFNGLDELETETEXTURESPROC)(GLsizei n, const GLuint * textures);
+typedef void (GLAD_API_PTR *PFNGLDEPTHFUNCPROC)(GLenum func);
+typedef void (GLAD_API_PTR *PFNGLDEPTHMASKPROC)(GLboolean flag);
+typedef void (GLAD_API_PTR *PFNGLDEPTHRANGEFPROC)(GLfloat n, GLfloat f);
+typedef void (GLAD_API_PTR *PFNGLDETACHSHADERPROC)(GLuint program, GLuint shader);
+typedef void (GLAD_API_PTR *PFNGLDISABLEPROC)(GLenum cap);
+typedef void (GLAD_API_PTR *PFNGLDISABLEVERTEXATTRIBARRAYPROC)(GLuint index);
+typedef void (GLAD_API_PTR *PFNGLDRAWARRAYSPROC)(GLenum mode, GLint first, GLsizei count);
+typedef void (GLAD_API_PTR *PFNGLDRAWELEMENTSPROC)(GLenum mode, GLsizei count, GLenum type, const void * indices);
+typedef void (GLAD_API_PTR *PFNGLENABLEPROC)(GLenum cap);
+typedef void (GLAD_API_PTR *PFNGLENABLEVERTEXATTRIBARRAYPROC)(GLuint index);
+typedef void (GLAD_API_PTR *PFNGLFINISHPROC)(void);
+typedef void (GLAD_API_PTR *PFNGLFLUSHPROC)(void);
+typedef void (GLAD_API_PTR *PFNGLFRAMEBUFFERRENDERBUFFERPROC)(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
+typedef void (GLAD_API_PTR *PFNGLFRAMEBUFFERTEXTURE2DPROC)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
+typedef void (GLAD_API_PTR *PFNGLFRONTFACEPROC)(GLenum mode);
+typedef void (GLAD_API_PTR *PFNGLGENBUFFERSPROC)(GLsizei n, GLuint * buffers);
+typedef void (GLAD_API_PTR *PFNGLGENFRAMEBUFFERSPROC)(GLsizei n, GLuint * framebuffers);
+typedef void (GLAD_API_PTR *PFNGLGENRENDERBUFFERSPROC)(GLsizei n, GLuint * renderbuffers);
+typedef void (GLAD_API_PTR *PFNGLGENTEXTURESPROC)(GLsizei n, GLuint * textures);
+typedef void (GLAD_API_PTR *PFNGLGENERATEMIPMAPPROC)(GLenum target);
+typedef void (GLAD_API_PTR *PFNGLGETACTIVEATTRIBPROC)(GLuint program, GLuint index, GLsizei bufSize, GLsizei * length, GLint * size, GLenum * type, GLchar * name);
+typedef void (GLAD_API_PTR *PFNGLGETACTIVEUNIFORMPROC)(GLuint program, GLuint index, GLsizei bufSize, GLsizei * length, GLint * size, GLenum * type, GLchar * name);
+typedef void (GLAD_API_PTR *PFNGLGETATTACHEDSHADERSPROC)(GLuint program, GLsizei maxCount, GLsizei * count, GLuint * shaders);
+typedef GLint (GLAD_API_PTR *PFNGLGETATTRIBLOCATIONPROC)(GLuint program, const GLchar * name);
+typedef void (GLAD_API_PTR *PFNGLGETBOOLEANVPROC)(GLenum pname, GLboolean * data);
+typedef void (GLAD_API_PTR *PFNGLGETBUFFERPARAMETERIVPROC)(GLenum target, GLenum pname, GLint * params);
+typedef GLenum (GLAD_API_PTR *PFNGLGETERRORPROC)(void);
+typedef void (GLAD_API_PTR *PFNGLGETFLOATVPROC)(GLenum pname, GLfloat * data);
+typedef void (GLAD_API_PTR *PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC)(GLenum target, GLenum attachment, GLenum pname, GLint * params);
+typedef void (GLAD_API_PTR *PFNGLGETINTEGERVPROC)(GLenum pname, GLint * data);
+typedef void (GLAD_API_PTR *PFNGLGETPROGRAMINFOLOGPROC)(GLuint program, GLsizei bufSize, GLsizei * length, GLchar * infoLog);
+typedef void (GLAD_API_PTR *PFNGLGETPROGRAMIVPROC)(GLuint program, GLenum pname, GLint * params);
+typedef void (GLAD_API_PTR *PFNGLGETRENDERBUFFERPARAMETERIVPROC)(GLenum target, GLenum pname, GLint * params);
+typedef void (GLAD_API_PTR *PFNGLGETSHADERINFOLOGPROC)(GLuint shader, GLsizei bufSize, GLsizei * length, GLchar * infoLog);
+typedef void (GLAD_API_PTR *PFNGLGETSHADERPRECISIONFORMATPROC)(GLenum shadertype, GLenum precisiontype, GLint * range, GLint * precision);
+typedef void (GLAD_API_PTR *PFNGLGETSHADERSOURCEPROC)(GLuint shader, GLsizei bufSize, GLsizei * length, GLchar * source);
+typedef void (GLAD_API_PTR *PFNGLGETSHADERIVPROC)(GLuint shader, GLenum pname, GLint * params);
+typedef const GLubyte * (GLAD_API_PTR *PFNGLGETSTRINGPROC)(GLenum name);
+typedef void (GLAD_API_PTR *PFNGLGETTEXPARAMETERFVPROC)(GLenum target, GLenum pname, GLfloat * params);
+typedef void (GLAD_API_PTR *PFNGLGETTEXPARAMETERIVPROC)(GLenum target, GLenum pname, GLint * params);
+typedef GLint (GLAD_API_PTR *PFNGLGETUNIFORMLOCATIONPROC)(GLuint program, const GLchar * name);
+typedef void (GLAD_API_PTR *PFNGLGETUNIFORMFVPROC)(GLuint program, GLint location, GLfloat * params);
+typedef void (GLAD_API_PTR *PFNGLGETUNIFORMIVPROC)(GLuint program, GLint location, GLint * params);
+typedef void (GLAD_API_PTR *PFNGLGETVERTEXATTRIBPOINTERVPROC)(GLuint index, GLenum pname, void ** pointer);
+typedef void (GLAD_API_PTR *PFNGLGETVERTEXATTRIBFVPROC)(GLuint index, GLenum pname, GLfloat * params);
+typedef void (GLAD_API_PTR *PFNGLGETVERTEXATTRIBIVPROC)(GLuint index, GLenum pname, GLint * params);
+typedef void (GLAD_API_PTR *PFNGLHINTPROC)(GLenum target, GLenum mode);
+typedef GLboolean (GLAD_API_PTR *PFNGLISBUFFERPROC)(GLuint buffer);
+typedef GLboolean (GLAD_API_PTR *PFNGLISENABLEDPROC)(GLenum cap);
+typedef GLboolean (GLAD_API_PTR *PFNGLISFRAMEBUFFERPROC)(GLuint framebuffer);
+typedef GLboolean (GLAD_API_PTR *PFNGLISPROGRAMPROC)(GLuint program);
+typedef GLboolean (GLAD_API_PTR *PFNGLISRENDERBUFFERPROC)(GLuint renderbuffer);
+typedef GLboolean (GLAD_API_PTR *PFNGLISSHADERPROC)(GLuint shader);
+typedef GLboolean (GLAD_API_PTR *PFNGLISTEXTUREPROC)(GLuint texture);
+typedef void (GLAD_API_PTR *PFNGLLINEWIDTHPROC)(GLfloat width);
+typedef void (GLAD_API_PTR *PFNGLLINKPROGRAMPROC)(GLuint program);
+typedef void (GLAD_API_PTR *PFNGLPIXELSTOREIPROC)(GLenum pname, GLint param);
+typedef void (GLAD_API_PTR *PFNGLPOLYGONOFFSETPROC)(GLfloat factor, GLfloat units);
+typedef void (GLAD_API_PTR *PFNGLREADPIXELSPROC)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void * pixels);
+typedef void (GLAD_API_PTR *PFNGLRELEASESHADERCOMPILERPROC)(void);
+typedef void (GLAD_API_PTR *PFNGLRENDERBUFFERSTORAGEPROC)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
+typedef void (GLAD_API_PTR *PFNGLSAMPLECOVERAGEPROC)(GLfloat value, GLboolean invert);
+typedef void (GLAD_API_PTR *PFNGLSCISSORPROC)(GLint x, GLint y, GLsizei width, GLsizei height);
+typedef void (GLAD_API_PTR *PFNGLSHADERBINARYPROC)(GLsizei count, const GLuint * shaders, GLenum binaryFormat, const void * binary, GLsizei length);
+typedef void (GLAD_API_PTR *PFNGLSHADERSOURCEPROC)(GLuint shader, GLsizei count, const GLchar *const* string, const GLint * length);
+typedef void (GLAD_API_PTR *PFNGLSTENCILFUNCPROC)(GLenum func, GLint ref, GLuint mask);
+typedef void (GLAD_API_PTR *PFNGLSTENCILFUNCSEPARATEPROC)(GLenum face, GLenum func, GLint ref, GLuint mask);
+typedef void (GLAD_API_PTR *PFNGLSTENCILMASKPROC)(GLuint mask);
+typedef void (GLAD_API_PTR *PFNGLSTENCILMASKSEPARATEPROC)(GLenum face, GLuint mask);
+typedef void (GLAD_API_PTR *PFNGLSTENCILOPPROC)(GLenum fail, GLenum zfail, GLenum zpass);
+typedef void (GLAD_API_PTR *PFNGLSTENCILOPSEPARATEPROC)(GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass);
+typedef void (GLAD_API_PTR *PFNGLTEXIMAGE2DPROC)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void * pixels);
+typedef void (GLAD_API_PTR *PFNGLTEXPARAMETERFPROC)(GLenum target, GLenum pname, GLfloat param);
+typedef void (GLAD_API_PTR *PFNGLTEXPARAMETERFVPROC)(GLenum target, GLenum pname, const GLfloat * params);
+typedef void (GLAD_API_PTR *PFNGLTEXPARAMETERIPROC)(GLenum target, GLenum pname, GLint param);
+typedef void (GLAD_API_PTR *PFNGLTEXPARAMETERIVPROC)(GLenum target, GLenum pname, const GLint * params);
+typedef void (GLAD_API_PTR *PFNGLTEXSUBIMAGE2DPROC)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void * pixels);
+typedef void (GLAD_API_PTR *PFNGLUNIFORM1FPROC)(GLint location, GLfloat v0);
+typedef void (GLAD_API_PTR *PFNGLUNIFORM1FVPROC)(GLint location, GLsizei count, const GLfloat * value);
+typedef void (GLAD_API_PTR *PFNGLUNIFORM1IPROC)(GLint location, GLint v0);
+typedef void (GLAD_API_PTR *PFNGLUNIFORM1IVPROC)(GLint location, GLsizei count, const GLint * value);
+typedef void (GLAD_API_PTR *PFNGLUNIFORM2FPROC)(GLint location, GLfloat v0, GLfloat v1);
+typedef void (GLAD_API_PTR *PFNGLUNIFORM2FVPROC)(GLint location, GLsizei count, const GLfloat * value);
+typedef void (GLAD_API_PTR *PFNGLUNIFORM2IPROC)(GLint location, GLint v0, GLint v1);
+typedef void (GLAD_API_PTR *PFNGLUNIFORM2IVPROC)(GLint location, GLsizei count, const GLint * value);
+typedef void (GLAD_API_PTR *PFNGLUNIFORM3FPROC)(GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
+typedef void (GLAD_API_PTR *PFNGLUNIFORM3FVPROC)(GLint location, GLsizei count, const GLfloat * value);
+typedef void (GLAD_API_PTR *PFNGLUNIFORM3IPROC)(GLint location, GLint v0, GLint v1, GLint v2);
+typedef void (GLAD_API_PTR *PFNGLUNIFORM3IVPROC)(GLint location, GLsizei count, const GLint * value);
+typedef void (GLAD_API_PTR *PFNGLUNIFORM4FPROC)(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
+typedef void (GLAD_API_PTR *PFNGLUNIFORM4FVPROC)(GLint location, GLsizei count, const GLfloat * value);
+typedef void (GLAD_API_PTR *PFNGLUNIFORM4IPROC)(GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
+typedef void (GLAD_API_PTR *PFNGLUNIFORM4IVPROC)(GLint location, GLsizei count, const GLint * value);
+typedef void (GLAD_API_PTR *PFNGLUNIFORMMATRIX2FVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value);
+typedef void (GLAD_API_PTR *PFNGLUNIFORMMATRIX3FVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value);
+typedef void (GLAD_API_PTR *PFNGLUNIFORMMATRIX4FVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value);
+typedef void (GLAD_API_PTR *PFNGLUSEPROGRAMPROC)(GLuint program);
+typedef void (GLAD_API_PTR *PFNGLVALIDATEPROGRAMPROC)(GLuint program);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB1FPROC)(GLuint index, GLfloat x);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB1FVPROC)(GLuint index, const GLfloat * v);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB2FPROC)(GLuint index, GLfloat x, GLfloat y);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB2FVPROC)(GLuint index, const GLfloat * v);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB3FPROC)(GLuint index, GLfloat x, GLfloat y, GLfloat z);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB3FVPROC)(GLuint index, const GLfloat * v);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB4FPROC)(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB4FVPROC)(GLuint index, const GLfloat * v);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBPOINTERPROC)(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void * pointer);
+typedef void (GLAD_API_PTR *PFNGLVIEWPORTPROC)(GLint x, GLint y, GLsizei width, GLsizei height);
+
+GLAD_API_CALL PFNGLACTIVETEXTUREPROC glad_glActiveTexture;
+#define glActiveTexture glad_glActiveTexture
+GLAD_API_CALL PFNGLATTACHSHADERPROC glad_glAttachShader;
+#define glAttachShader glad_glAttachShader
+GLAD_API_CALL PFNGLBINDATTRIBLOCATIONPROC glad_glBindAttribLocation;
+#define glBindAttribLocation glad_glBindAttribLocation
+GLAD_API_CALL PFNGLBINDBUFFERPROC glad_glBindBuffer;
+#define glBindBuffer glad_glBindBuffer
+GLAD_API_CALL PFNGLBINDFRAMEBUFFERPROC glad_glBindFramebuffer;
+#define glBindFramebuffer glad_glBindFramebuffer
+GLAD_API_CALL PFNGLBINDRENDERBUFFERPROC glad_glBindRenderbuffer;
+#define glBindRenderbuffer glad_glBindRenderbuffer
+GLAD_API_CALL PFNGLBINDTEXTUREPROC glad_glBindTexture;
+#define glBindTexture glad_glBindTexture
+GLAD_API_CALL PFNGLBLENDCOLORPROC glad_glBlendColor;
+#define glBlendColor glad_glBlendColor
+GLAD_API_CALL PFNGLBLENDEQUATIONPROC glad_glBlendEquation;
+#define glBlendEquation glad_glBlendEquation
+GLAD_API_CALL PFNGLBLENDEQUATIONSEPARATEPROC glad_glBlendEquationSeparate;
+#define glBlendEquationSeparate glad_glBlendEquationSeparate
+GLAD_API_CALL PFNGLBLENDFUNCPROC glad_glBlendFunc;
+#define glBlendFunc glad_glBlendFunc
+GLAD_API_CALL PFNGLBLENDFUNCSEPARATEPROC glad_glBlendFuncSeparate;
+#define glBlendFuncSeparate glad_glBlendFuncSeparate
+GLAD_API_CALL PFNGLBUFFERDATAPROC glad_glBufferData;
+#define glBufferData glad_glBufferData
+GLAD_API_CALL PFNGLBUFFERSUBDATAPROC glad_glBufferSubData;
+#define glBufferSubData glad_glBufferSubData
+GLAD_API_CALL PFNGLCHECKFRAMEBUFFERSTATUSPROC glad_glCheckFramebufferStatus;
+#define glCheckFramebufferStatus glad_glCheckFramebufferStatus
+GLAD_API_CALL PFNGLCLEARPROC glad_glClear;
+#define glClear glad_glClear
+GLAD_API_CALL PFNGLCLEARCOLORPROC glad_glClearColor;
+#define glClearColor glad_glClearColor
+GLAD_API_CALL PFNGLCLEARDEPTHFPROC glad_glClearDepthf;
+#define glClearDepthf glad_glClearDepthf
+GLAD_API_CALL PFNGLCLEARSTENCILPROC glad_glClearStencil;
+#define glClearStencil glad_glClearStencil
+GLAD_API_CALL PFNGLCOLORMASKPROC glad_glColorMask;
+#define glColorMask glad_glColorMask
+GLAD_API_CALL PFNGLCOMPILESHADERPROC glad_glCompileShader;
+#define glCompileShader glad_glCompileShader
+GLAD_API_CALL PFNGLCOMPRESSEDTEXIMAGE2DPROC glad_glCompressedTexImage2D;
+#define glCompressedTexImage2D glad_glCompressedTexImage2D
+GLAD_API_CALL PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC glad_glCompressedTexSubImage2D;
+#define glCompressedTexSubImage2D glad_glCompressedTexSubImage2D
+GLAD_API_CALL PFNGLCOPYTEXIMAGE2DPROC glad_glCopyTexImage2D;
+#define glCopyTexImage2D glad_glCopyTexImage2D
+GLAD_API_CALL PFNGLCOPYTEXSUBIMAGE2DPROC glad_glCopyTexSubImage2D;
+#define glCopyTexSubImage2D glad_glCopyTexSubImage2D
+GLAD_API_CALL PFNGLCREATEPROGRAMPROC glad_glCreateProgram;
+#define glCreateProgram glad_glCreateProgram
+GLAD_API_CALL PFNGLCREATESHADERPROC glad_glCreateShader;
+#define glCreateShader glad_glCreateShader
+GLAD_API_CALL PFNGLCULLFACEPROC glad_glCullFace;
+#define glCullFace glad_glCullFace
+GLAD_API_CALL PFNGLDELETEBUFFERSPROC glad_glDeleteBuffers;
+#define glDeleteBuffers glad_glDeleteBuffers
+GLAD_API_CALL PFNGLDELETEFRAMEBUFFERSPROC glad_glDeleteFramebuffers;
+#define glDeleteFramebuffers glad_glDeleteFramebuffers
+GLAD_API_CALL PFNGLDELETEPROGRAMPROC glad_glDeleteProgram;
+#define glDeleteProgram glad_glDeleteProgram
+GLAD_API_CALL PFNGLDELETERENDERBUFFERSPROC glad_glDeleteRenderbuffers;
+#define glDeleteRenderbuffers glad_glDeleteRenderbuffers
+GLAD_API_CALL PFNGLDELETESHADERPROC glad_glDeleteShader;
+#define glDeleteShader glad_glDeleteShader
+GLAD_API_CALL PFNGLDELETETEXTURESPROC glad_glDeleteTextures;
+#define glDeleteTextures glad_glDeleteTextures
+GLAD_API_CALL PFNGLDEPTHFUNCPROC glad_glDepthFunc;
+#define glDepthFunc glad_glDepthFunc
+GLAD_API_CALL PFNGLDEPTHMASKPROC glad_glDepthMask;
+#define glDepthMask glad_glDepthMask
+GLAD_API_CALL PFNGLDEPTHRANGEFPROC glad_glDepthRangef;
+#define glDepthRangef glad_glDepthRangef
+GLAD_API_CALL PFNGLDETACHSHADERPROC glad_glDetachShader;
+#define glDetachShader glad_glDetachShader
+GLAD_API_CALL PFNGLDISABLEPROC glad_glDisable;
+#define glDisable glad_glDisable
+GLAD_API_CALL PFNGLDISABLEVERTEXATTRIBARRAYPROC glad_glDisableVertexAttribArray;
+#define glDisableVertexAttribArray glad_glDisableVertexAttribArray
+GLAD_API_CALL PFNGLDRAWARRAYSPROC glad_glDrawArrays;
+#define glDrawArrays glad_glDrawArrays
+GLAD_API_CALL PFNGLDRAWELEMENTSPROC glad_glDrawElements;
+#define glDrawElements glad_glDrawElements
+GLAD_API_CALL PFNGLENABLEPROC glad_glEnable;
+#define glEnable glad_glEnable
+GLAD_API_CALL PFNGLENABLEVERTEXATTRIBARRAYPROC glad_glEnableVertexAttribArray;
+#define glEnableVertexAttribArray glad_glEnableVertexAttribArray
+GLAD_API_CALL PFNGLFINISHPROC glad_glFinish;
+#define glFinish glad_glFinish
+GLAD_API_CALL PFNGLFLUSHPROC glad_glFlush;
+#define glFlush glad_glFlush
+GLAD_API_CALL PFNGLFRAMEBUFFERRENDERBUFFERPROC glad_glFramebufferRenderbuffer;
+#define glFramebufferRenderbuffer glad_glFramebufferRenderbuffer
+GLAD_API_CALL PFNGLFRAMEBUFFERTEXTURE2DPROC glad_glFramebufferTexture2D;
+#define glFramebufferTexture2D glad_glFramebufferTexture2D
+GLAD_API_CALL PFNGLFRONTFACEPROC glad_glFrontFace;
+#define glFrontFace glad_glFrontFace
+GLAD_API_CALL PFNGLGENBUFFERSPROC glad_glGenBuffers;
+#define glGenBuffers glad_glGenBuffers
+GLAD_API_CALL PFNGLGENFRAMEBUFFERSPROC glad_glGenFramebuffers;
+#define glGenFramebuffers glad_glGenFramebuffers
+GLAD_API_CALL PFNGLGENRENDERBUFFERSPROC glad_glGenRenderbuffers;
+#define glGenRenderbuffers glad_glGenRenderbuffers
+GLAD_API_CALL PFNGLGENTEXTURESPROC glad_glGenTextures;
+#define glGenTextures glad_glGenTextures
+GLAD_API_CALL PFNGLGENERATEMIPMAPPROC glad_glGenerateMipmap;
+#define glGenerateMipmap glad_glGenerateMipmap
+GLAD_API_CALL PFNGLGETACTIVEATTRIBPROC glad_glGetActiveAttrib;
+#define glGetActiveAttrib glad_glGetActiveAttrib
+GLAD_API_CALL PFNGLGETACTIVEUNIFORMPROC glad_glGetActiveUniform;
+#define glGetActiveUniform glad_glGetActiveUniform
+GLAD_API_CALL PFNGLGETATTACHEDSHADERSPROC glad_glGetAttachedShaders;
+#define glGetAttachedShaders glad_glGetAttachedShaders
+GLAD_API_CALL PFNGLGETATTRIBLOCATIONPROC glad_glGetAttribLocation;
+#define glGetAttribLocation glad_glGetAttribLocation
+GLAD_API_CALL PFNGLGETBOOLEANVPROC glad_glGetBooleanv;
+#define glGetBooleanv glad_glGetBooleanv
+GLAD_API_CALL PFNGLGETBUFFERPARAMETERIVPROC glad_glGetBufferParameteriv;
+#define glGetBufferParameteriv glad_glGetBufferParameteriv
+GLAD_API_CALL PFNGLGETERRORPROC glad_glGetError;
+#define glGetError glad_glGetError
+GLAD_API_CALL PFNGLGETFLOATVPROC glad_glGetFloatv;
+#define glGetFloatv glad_glGetFloatv
+GLAD_API_CALL PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC glad_glGetFramebufferAttachmentParameteriv;
+#define glGetFramebufferAttachmentParameteriv glad_glGetFramebufferAttachmentParameteriv
+GLAD_API_CALL PFNGLGETINTEGERVPROC glad_glGetIntegerv;
+#define glGetIntegerv glad_glGetIntegerv
+GLAD_API_CALL PFNGLGETPROGRAMINFOLOGPROC glad_glGetProgramInfoLog;
+#define glGetProgramInfoLog glad_glGetProgramInfoLog
+GLAD_API_CALL PFNGLGETPROGRAMIVPROC glad_glGetProgramiv;
+#define glGetProgramiv glad_glGetProgramiv
+GLAD_API_CALL PFNGLGETRENDERBUFFERPARAMETERIVPROC glad_glGetRenderbufferParameteriv;
+#define glGetRenderbufferParameteriv glad_glGetRenderbufferParameteriv
+GLAD_API_CALL PFNGLGETSHADERINFOLOGPROC glad_glGetShaderInfoLog;
+#define glGetShaderInfoLog glad_glGetShaderInfoLog
+GLAD_API_CALL PFNGLGETSHADERPRECISIONFORMATPROC glad_glGetShaderPrecisionFormat;
+#define glGetShaderPrecisionFormat glad_glGetShaderPrecisionFormat
+GLAD_API_CALL PFNGLGETSHADERSOURCEPROC glad_glGetShaderSource;
+#define glGetShaderSource glad_glGetShaderSource
+GLAD_API_CALL PFNGLGETSHADERIVPROC glad_glGetShaderiv;
+#define glGetShaderiv glad_glGetShaderiv
+GLAD_API_CALL PFNGLGETSTRINGPROC glad_glGetString;
+#define glGetString glad_glGetString
+GLAD_API_CALL PFNGLGETTEXPARAMETERFVPROC glad_glGetTexParameterfv;
+#define glGetTexParameterfv glad_glGetTexParameterfv
+GLAD_API_CALL PFNGLGETTEXPARAMETERIVPROC glad_glGetTexParameteriv;
+#define glGetTexParameteriv glad_glGetTexParameteriv
+GLAD_API_CALL PFNGLGETUNIFORMLOCATIONPROC glad_glGetUniformLocation;
+#define glGetUniformLocation glad_glGetUniformLocation
+GLAD_API_CALL PFNGLGETUNIFORMFVPROC glad_glGetUniformfv;
+#define glGetUniformfv glad_glGetUniformfv
+GLAD_API_CALL PFNGLGETUNIFORMIVPROC glad_glGetUniformiv;
+#define glGetUniformiv glad_glGetUniformiv
+GLAD_API_CALL PFNGLGETVERTEXATTRIBPOINTERVPROC glad_glGetVertexAttribPointerv;
+#define glGetVertexAttribPointerv glad_glGetVertexAttribPointerv
+GLAD_API_CALL PFNGLGETVERTEXATTRIBFVPROC glad_glGetVertexAttribfv;
+#define glGetVertexAttribfv glad_glGetVertexAttribfv
+GLAD_API_CALL PFNGLGETVERTEXATTRIBIVPROC glad_glGetVertexAttribiv;
+#define glGetVertexAttribiv glad_glGetVertexAttribiv
+GLAD_API_CALL PFNGLHINTPROC glad_glHint;
+#define glHint glad_glHint
+GLAD_API_CALL PFNGLISBUFFERPROC glad_glIsBuffer;
+#define glIsBuffer glad_glIsBuffer
+GLAD_API_CALL PFNGLISENABLEDPROC glad_glIsEnabled;
+#define glIsEnabled glad_glIsEnabled
+GLAD_API_CALL PFNGLISFRAMEBUFFERPROC glad_glIsFramebuffer;
+#define glIsFramebuffer glad_glIsFramebuffer
+GLAD_API_CALL PFNGLISPROGRAMPROC glad_glIsProgram;
+#define glIsProgram glad_glIsProgram
+GLAD_API_CALL PFNGLISRENDERBUFFERPROC glad_glIsRenderbuffer;
+#define glIsRenderbuffer glad_glIsRenderbuffer
+GLAD_API_CALL PFNGLISSHADERPROC glad_glIsShader;
+#define glIsShader glad_glIsShader
+GLAD_API_CALL PFNGLISTEXTUREPROC glad_glIsTexture;
+#define glIsTexture glad_glIsTexture
+GLAD_API_CALL PFNGLLINEWIDTHPROC glad_glLineWidth;
+#define glLineWidth glad_glLineWidth
+GLAD_API_CALL PFNGLLINKPROGRAMPROC glad_glLinkProgram;
+#define glLinkProgram glad_glLinkProgram
+GLAD_API_CALL PFNGLPIXELSTOREIPROC glad_glPixelStorei;
+#define glPixelStorei glad_glPixelStorei
+GLAD_API_CALL PFNGLPOLYGONOFFSETPROC glad_glPolygonOffset;
+#define glPolygonOffset glad_glPolygonOffset
+GLAD_API_CALL PFNGLREADPIXELSPROC glad_glReadPixels;
+#define glReadPixels glad_glReadPixels
+GLAD_API_CALL PFNGLRELEASESHADERCOMPILERPROC glad_glReleaseShaderCompiler;
+#define glReleaseShaderCompiler glad_glReleaseShaderCompiler
+GLAD_API_CALL PFNGLRENDERBUFFERSTORAGEPROC glad_glRenderbufferStorage;
+#define glRenderbufferStorage glad_glRenderbufferStorage
+GLAD_API_CALL PFNGLSAMPLECOVERAGEPROC glad_glSampleCoverage;
+#define glSampleCoverage glad_glSampleCoverage
+GLAD_API_CALL PFNGLSCISSORPROC glad_glScissor;
+#define glScissor glad_glScissor
+GLAD_API_CALL PFNGLSHADERBINARYPROC glad_glShaderBinary;
+#define glShaderBinary glad_glShaderBinary
+GLAD_API_CALL PFNGLSHADERSOURCEPROC glad_glShaderSource;
+#define glShaderSource glad_glShaderSource
+GLAD_API_CALL PFNGLSTENCILFUNCPROC glad_glStencilFunc;
+#define glStencilFunc glad_glStencilFunc
+GLAD_API_CALL PFNGLSTENCILFUNCSEPARATEPROC glad_glStencilFuncSeparate;
+#define glStencilFuncSeparate glad_glStencilFuncSeparate
+GLAD_API_CALL PFNGLSTENCILMASKPROC glad_glStencilMask;
+#define glStencilMask glad_glStencilMask
+GLAD_API_CALL PFNGLSTENCILMASKSEPARATEPROC glad_glStencilMaskSeparate;
+#define glStencilMaskSeparate glad_glStencilMaskSeparate
+GLAD_API_CALL PFNGLSTENCILOPPROC glad_glStencilOp;
+#define glStencilOp glad_glStencilOp
+GLAD_API_CALL PFNGLSTENCILOPSEPARATEPROC glad_glStencilOpSeparate;
+#define glStencilOpSeparate glad_glStencilOpSeparate
+GLAD_API_CALL PFNGLTEXIMAGE2DPROC glad_glTexImage2D;
+#define glTexImage2D glad_glTexImage2D
+GLAD_API_CALL PFNGLTEXPARAMETERFPROC glad_glTexParameterf;
+#define glTexParameterf glad_glTexParameterf
+GLAD_API_CALL PFNGLTEXPARAMETERFVPROC glad_glTexParameterfv;
+#define glTexParameterfv glad_glTexParameterfv
+GLAD_API_CALL PFNGLTEXPARAMETERIPROC glad_glTexParameteri;
+#define glTexParameteri glad_glTexParameteri
+GLAD_API_CALL PFNGLTEXPARAMETERIVPROC glad_glTexParameteriv;
+#define glTexParameteriv glad_glTexParameteriv
+GLAD_API_CALL PFNGLTEXSUBIMAGE2DPROC glad_glTexSubImage2D;
+#define glTexSubImage2D glad_glTexSubImage2D
+GLAD_API_CALL PFNGLUNIFORM1FPROC glad_glUniform1f;
+#define glUniform1f glad_glUniform1f
+GLAD_API_CALL PFNGLUNIFORM1FVPROC glad_glUniform1fv;
+#define glUniform1fv glad_glUniform1fv
+GLAD_API_CALL PFNGLUNIFORM1IPROC glad_glUniform1i;
+#define glUniform1i glad_glUniform1i
+GLAD_API_CALL PFNGLUNIFORM1IVPROC glad_glUniform1iv;
+#define glUniform1iv glad_glUniform1iv
+GLAD_API_CALL PFNGLUNIFORM2FPROC glad_glUniform2f;
+#define glUniform2f glad_glUniform2f
+GLAD_API_CALL PFNGLUNIFORM2FVPROC glad_glUniform2fv;
+#define glUniform2fv glad_glUniform2fv
+GLAD_API_CALL PFNGLUNIFORM2IPROC glad_glUniform2i;
+#define glUniform2i glad_glUniform2i
+GLAD_API_CALL PFNGLUNIFORM2IVPROC glad_glUniform2iv;
+#define glUniform2iv glad_glUniform2iv
+GLAD_API_CALL PFNGLUNIFORM3FPROC glad_glUniform3f;
+#define glUniform3f glad_glUniform3f
+GLAD_API_CALL PFNGLUNIFORM3FVPROC glad_glUniform3fv;
+#define glUniform3fv glad_glUniform3fv
+GLAD_API_CALL PFNGLUNIFORM3IPROC glad_glUniform3i;
+#define glUniform3i glad_glUniform3i
+GLAD_API_CALL PFNGLUNIFORM3IVPROC glad_glUniform3iv;
+#define glUniform3iv glad_glUniform3iv
+GLAD_API_CALL PFNGLUNIFORM4FPROC glad_glUniform4f;
+#define glUniform4f glad_glUniform4f
+GLAD_API_CALL PFNGLUNIFORM4FVPROC glad_glUniform4fv;
+#define glUniform4fv glad_glUniform4fv
+GLAD_API_CALL PFNGLUNIFORM4IPROC glad_glUniform4i;
+#define glUniform4i glad_glUniform4i
+GLAD_API_CALL PFNGLUNIFORM4IVPROC glad_glUniform4iv;
+#define glUniform4iv glad_glUniform4iv
+GLAD_API_CALL PFNGLUNIFORMMATRIX2FVPROC glad_glUniformMatrix2fv;
+#define glUniformMatrix2fv glad_glUniformMatrix2fv
+GLAD_API_CALL PFNGLUNIFORMMATRIX3FVPROC glad_glUniformMatrix3fv;
+#define glUniformMatrix3fv glad_glUniformMatrix3fv
+GLAD_API_CALL PFNGLUNIFORMMATRIX4FVPROC glad_glUniformMatrix4fv;
+#define glUniformMatrix4fv glad_glUniformMatrix4fv
+GLAD_API_CALL PFNGLUSEPROGRAMPROC glad_glUseProgram;
+#define glUseProgram glad_glUseProgram
+GLAD_API_CALL PFNGLVALIDATEPROGRAMPROC glad_glValidateProgram;
+#define glValidateProgram glad_glValidateProgram
+GLAD_API_CALL PFNGLVERTEXATTRIB1FPROC glad_glVertexAttrib1f;
+#define glVertexAttrib1f glad_glVertexAttrib1f
+GLAD_API_CALL PFNGLVERTEXATTRIB1FVPROC glad_glVertexAttrib1fv;
+#define glVertexAttrib1fv glad_glVertexAttrib1fv
+GLAD_API_CALL PFNGLVERTEXATTRIB2FPROC glad_glVertexAttrib2f;
+#define glVertexAttrib2f glad_glVertexAttrib2f
+GLAD_API_CALL PFNGLVERTEXATTRIB2FVPROC glad_glVertexAttrib2fv;
+#define glVertexAttrib2fv glad_glVertexAttrib2fv
+GLAD_API_CALL PFNGLVERTEXATTRIB3FPROC glad_glVertexAttrib3f;
+#define glVertexAttrib3f glad_glVertexAttrib3f
+GLAD_API_CALL PFNGLVERTEXATTRIB3FVPROC glad_glVertexAttrib3fv;
+#define glVertexAttrib3fv glad_glVertexAttrib3fv
+GLAD_API_CALL PFNGLVERTEXATTRIB4FPROC glad_glVertexAttrib4f;
+#define glVertexAttrib4f glad_glVertexAttrib4f
+GLAD_API_CALL PFNGLVERTEXATTRIB4FVPROC glad_glVertexAttrib4fv;
+#define glVertexAttrib4fv glad_glVertexAttrib4fv
+GLAD_API_CALL PFNGLVERTEXATTRIBPOINTERPROC glad_glVertexAttribPointer;
+#define glVertexAttribPointer glad_glVertexAttribPointer
+GLAD_API_CALL PFNGLVIEWPORTPROC glad_glViewport;
+#define glViewport glad_glViewport
+
+
+
+
+
+GLAD_API_CALL int gladLoadGLES2UserPtr( GLADuserptrloadfunc load, void *userptr);
+GLAD_API_CALL int gladLoadGLES2( GLADloadfunc load);
+
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
+/* Source */
+#ifdef GLAD_GLES2_IMPLEMENTATION
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#ifndef GLAD_IMPL_UTIL_C_
+#define GLAD_IMPL_UTIL_C_
+
+#ifdef _MSC_VER
+#define GLAD_IMPL_UTIL_SSCANF sscanf_s
+#else
+#define GLAD_IMPL_UTIL_SSCANF sscanf
+#endif
+
+#endif /* GLAD_IMPL_UTIL_C_ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+
+int GLAD_GL_ES_VERSION_2_0 = 0;
+
+
+
+PFNGLACTIVETEXTUREPROC glad_glActiveTexture = NULL;
+PFNGLATTACHSHADERPROC glad_glAttachShader = NULL;
+PFNGLBINDATTRIBLOCATIONPROC glad_glBindAttribLocation = NULL;
+PFNGLBINDBUFFERPROC glad_glBindBuffer = NULL;
+PFNGLBINDFRAMEBUFFERPROC glad_glBindFramebuffer = NULL;
+PFNGLBINDRENDERBUFFERPROC glad_glBindRenderbuffer = NULL;
+PFNGLBINDTEXTUREPROC glad_glBindTexture = NULL;
+PFNGLBLENDCOLORPROC glad_glBlendColor = NULL;
+PFNGLBLENDEQUATIONPROC glad_glBlendEquation = NULL;
+PFNGLBLENDEQUATIONSEPARATEPROC glad_glBlendEquationSeparate = NULL;
+PFNGLBLENDFUNCPROC glad_glBlendFunc = NULL;
+PFNGLBLENDFUNCSEPARATEPROC glad_glBlendFuncSeparate = NULL;
+PFNGLBUFFERDATAPROC glad_glBufferData = NULL;
+PFNGLBUFFERSUBDATAPROC glad_glBufferSubData = NULL;
+PFNGLCHECKFRAMEBUFFERSTATUSPROC glad_glCheckFramebufferStatus = NULL;
+PFNGLCLEARPROC glad_glClear = NULL;
+PFNGLCLEARCOLORPROC glad_glClearColor = NULL;
+PFNGLCLEARDEPTHFPROC glad_glClearDepthf = NULL;
+PFNGLCLEARSTENCILPROC glad_glClearStencil = NULL;
+PFNGLCOLORMASKPROC glad_glColorMask = NULL;
+PFNGLCOMPILESHADERPROC glad_glCompileShader = NULL;
+PFNGLCOMPRESSEDTEXIMAGE2DPROC glad_glCompressedTexImage2D = NULL;
+PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC glad_glCompressedTexSubImage2D = NULL;
+PFNGLCOPYTEXIMAGE2DPROC glad_glCopyTexImage2D = NULL;
+PFNGLCOPYTEXSUBIMAGE2DPROC glad_glCopyTexSubImage2D = NULL;
+PFNGLCREATEPROGRAMPROC glad_glCreateProgram = NULL;
+PFNGLCREATESHADERPROC glad_glCreateShader = NULL;
+PFNGLCULLFACEPROC glad_glCullFace = NULL;
+PFNGLDELETEBUFFERSPROC glad_glDeleteBuffers = NULL;
+PFNGLDELETEFRAMEBUFFERSPROC glad_glDeleteFramebuffers = NULL;
+PFNGLDELETEPROGRAMPROC glad_glDeleteProgram = NULL;
+PFNGLDELETERENDERBUFFERSPROC glad_glDeleteRenderbuffers = NULL;
+PFNGLDELETESHADERPROC glad_glDeleteShader = NULL;
+PFNGLDELETETEXTURESPROC glad_glDeleteTextures = NULL;
+PFNGLDEPTHFUNCPROC glad_glDepthFunc = NULL;
+PFNGLDEPTHMASKPROC glad_glDepthMask = NULL;
+PFNGLDEPTHRANGEFPROC glad_glDepthRangef = NULL;
+PFNGLDETACHSHADERPROC glad_glDetachShader = NULL;
+PFNGLDISABLEPROC glad_glDisable = NULL;
+PFNGLDISABLEVERTEXATTRIBARRAYPROC glad_glDisableVertexAttribArray = NULL;
+PFNGLDRAWARRAYSPROC glad_glDrawArrays = NULL;
+PFNGLDRAWELEMENTSPROC glad_glDrawElements = NULL;
+PFNGLENABLEPROC glad_glEnable = NULL;
+PFNGLENABLEVERTEXATTRIBARRAYPROC glad_glEnableVertexAttribArray = NULL;
+PFNGLFINISHPROC glad_glFinish = NULL;
+PFNGLFLUSHPROC glad_glFlush = NULL;
+PFNGLFRAMEBUFFERRENDERBUFFERPROC glad_glFramebufferRenderbuffer = NULL;
+PFNGLFRAMEBUFFERTEXTURE2DPROC glad_glFramebufferTexture2D = NULL;
+PFNGLFRONTFACEPROC glad_glFrontFace = NULL;
+PFNGLGENBUFFERSPROC glad_glGenBuffers = NULL;
+PFNGLGENFRAMEBUFFERSPROC glad_glGenFramebuffers = NULL;
+PFNGLGENRENDERBUFFERSPROC glad_glGenRenderbuffers = NULL;
+PFNGLGENTEXTURESPROC glad_glGenTextures = NULL;
+PFNGLGENERATEMIPMAPPROC glad_glGenerateMipmap = NULL;
+PFNGLGETACTIVEATTRIBPROC glad_glGetActiveAttrib = NULL;
+PFNGLGETACTIVEUNIFORMPROC glad_glGetActiveUniform = NULL;
+PFNGLGETATTACHEDSHADERSPROC glad_glGetAttachedShaders = NULL;
+PFNGLGETATTRIBLOCATIONPROC glad_glGetAttribLocation = NULL;
+PFNGLGETBOOLEANVPROC glad_glGetBooleanv = NULL;
+PFNGLGETBUFFERPARAMETERIVPROC glad_glGetBufferParameteriv = NULL;
+PFNGLGETERRORPROC glad_glGetError = NULL;
+PFNGLGETFLOATVPROC glad_glGetFloatv = NULL;
+PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC glad_glGetFramebufferAttachmentParameteriv = NULL;
+PFNGLGETINTEGERVPROC glad_glGetIntegerv = NULL;
+PFNGLGETPROGRAMINFOLOGPROC glad_glGetProgramInfoLog = NULL;
+PFNGLGETPROGRAMIVPROC glad_glGetProgramiv = NULL;
+PFNGLGETRENDERBUFFERPARAMETERIVPROC glad_glGetRenderbufferParameteriv = NULL;
+PFNGLGETSHADERINFOLOGPROC glad_glGetShaderInfoLog = NULL;
+PFNGLGETSHADERPRECISIONFORMATPROC glad_glGetShaderPrecisionFormat = NULL;
+PFNGLGETSHADERSOURCEPROC glad_glGetShaderSource = NULL;
+PFNGLGETSHADERIVPROC glad_glGetShaderiv = NULL;
+PFNGLGETSTRINGPROC glad_glGetString = NULL;
+PFNGLGETTEXPARAMETERFVPROC glad_glGetTexParameterfv = NULL;
+PFNGLGETTEXPARAMETERIVPROC glad_glGetTexParameteriv = NULL;
+PFNGLGETUNIFORMLOCATIONPROC glad_glGetUniformLocation = NULL;
+PFNGLGETUNIFORMFVPROC glad_glGetUniformfv = NULL;
+PFNGLGETUNIFORMIVPROC glad_glGetUniformiv = NULL;
+PFNGLGETVERTEXATTRIBPOINTERVPROC glad_glGetVertexAttribPointerv = NULL;
+PFNGLGETVERTEXATTRIBFVPROC glad_glGetVertexAttribfv = NULL;
+PFNGLGETVERTEXATTRIBIVPROC glad_glGetVertexAttribiv = NULL;
+PFNGLHINTPROC glad_glHint = NULL;
+PFNGLISBUFFERPROC glad_glIsBuffer = NULL;
+PFNGLISENABLEDPROC glad_glIsEnabled = NULL;
+PFNGLISFRAMEBUFFERPROC glad_glIsFramebuffer = NULL;
+PFNGLISPROGRAMPROC glad_glIsProgram = NULL;
+PFNGLISRENDERBUFFERPROC glad_glIsRenderbuffer = NULL;
+PFNGLISSHADERPROC glad_glIsShader = NULL;
+PFNGLISTEXTUREPROC glad_glIsTexture = NULL;
+PFNGLLINEWIDTHPROC glad_glLineWidth = NULL;
+PFNGLLINKPROGRAMPROC glad_glLinkProgram = NULL;
+PFNGLPIXELSTOREIPROC glad_glPixelStorei = NULL;
+PFNGLPOLYGONOFFSETPROC glad_glPolygonOffset = NULL;
+PFNGLREADPIXELSPROC glad_glReadPixels = NULL;
+PFNGLRELEASESHADERCOMPILERPROC glad_glReleaseShaderCompiler = NULL;
+PFNGLRENDERBUFFERSTORAGEPROC glad_glRenderbufferStorage = NULL;
+PFNGLSAMPLECOVERAGEPROC glad_glSampleCoverage = NULL;
+PFNGLSCISSORPROC glad_glScissor = NULL;
+PFNGLSHADERBINARYPROC glad_glShaderBinary = NULL;
+PFNGLSHADERSOURCEPROC glad_glShaderSource = NULL;
+PFNGLSTENCILFUNCPROC glad_glStencilFunc = NULL;
+PFNGLSTENCILFUNCSEPARATEPROC glad_glStencilFuncSeparate = NULL;
+PFNGLSTENCILMASKPROC glad_glStencilMask = NULL;
+PFNGLSTENCILMASKSEPARATEPROC glad_glStencilMaskSeparate = NULL;
+PFNGLSTENCILOPPROC glad_glStencilOp = NULL;
+PFNGLSTENCILOPSEPARATEPROC glad_glStencilOpSeparate = NULL;
+PFNGLTEXIMAGE2DPROC glad_glTexImage2D = NULL;
+PFNGLTEXPARAMETERFPROC glad_glTexParameterf = NULL;
+PFNGLTEXPARAMETERFVPROC glad_glTexParameterfv = NULL;
+PFNGLTEXPARAMETERIPROC glad_glTexParameteri = NULL;
+PFNGLTEXPARAMETERIVPROC glad_glTexParameteriv = NULL;
+PFNGLTEXSUBIMAGE2DPROC glad_glTexSubImage2D = NULL;
+PFNGLUNIFORM1FPROC glad_glUniform1f = NULL;
+PFNGLUNIFORM1FVPROC glad_glUniform1fv = NULL;
+PFNGLUNIFORM1IPROC glad_glUniform1i = NULL;
+PFNGLUNIFORM1IVPROC glad_glUniform1iv = NULL;
+PFNGLUNIFORM2FPROC glad_glUniform2f = NULL;
+PFNGLUNIFORM2FVPROC glad_glUniform2fv = NULL;
+PFNGLUNIFORM2IPROC glad_glUniform2i = NULL;
+PFNGLUNIFORM2IVPROC glad_glUniform2iv = NULL;
+PFNGLUNIFORM3FPROC glad_glUniform3f = NULL;
+PFNGLUNIFORM3FVPROC glad_glUniform3fv = NULL;
+PFNGLUNIFORM3IPROC glad_glUniform3i = NULL;
+PFNGLUNIFORM3IVPROC glad_glUniform3iv = NULL;
+PFNGLUNIFORM4FPROC glad_glUniform4f = NULL;
+PFNGLUNIFORM4FVPROC glad_glUniform4fv = NULL;
+PFNGLUNIFORM4IPROC glad_glUniform4i = NULL;
+PFNGLUNIFORM4IVPROC glad_glUniform4iv = NULL;
+PFNGLUNIFORMMATRIX2FVPROC glad_glUniformMatrix2fv = NULL;
+PFNGLUNIFORMMATRIX3FVPROC glad_glUniformMatrix3fv = NULL;
+PFNGLUNIFORMMATRIX4FVPROC glad_glUniformMatrix4fv = NULL;
+PFNGLUSEPROGRAMPROC glad_glUseProgram = NULL;
+PFNGLVALIDATEPROGRAMPROC glad_glValidateProgram = NULL;
+PFNGLVERTEXATTRIB1FPROC glad_glVertexAttrib1f = NULL;
+PFNGLVERTEXATTRIB1FVPROC glad_glVertexAttrib1fv = NULL;
+PFNGLVERTEXATTRIB2FPROC glad_glVertexAttrib2f = NULL;
+PFNGLVERTEXATTRIB2FVPROC glad_glVertexAttrib2fv = NULL;
+PFNGLVERTEXATTRIB3FPROC glad_glVertexAttrib3f = NULL;
+PFNGLVERTEXATTRIB3FVPROC glad_glVertexAttrib3fv = NULL;
+PFNGLVERTEXATTRIB4FPROC glad_glVertexAttrib4f = NULL;
+PFNGLVERTEXATTRIB4FVPROC glad_glVertexAttrib4fv = NULL;
+PFNGLVERTEXATTRIBPOINTERPROC glad_glVertexAttribPointer = NULL;
+PFNGLVIEWPORTPROC glad_glViewport = NULL;
+
+
+static void glad_gl_load_GL_ES_VERSION_2_0( GLADuserptrloadfunc load, void* userptr) {
+    if(!GLAD_GL_ES_VERSION_2_0) return;
+    glad_glActiveTexture = (PFNGLACTIVETEXTUREPROC) load(userptr, "glActiveTexture");
+    glad_glAttachShader = (PFNGLATTACHSHADERPROC) load(userptr, "glAttachShader");
+    glad_glBindAttribLocation = (PFNGLBINDATTRIBLOCATIONPROC) load(userptr, "glBindAttribLocation");
+    glad_glBindBuffer = (PFNGLBINDBUFFERPROC) load(userptr, "glBindBuffer");
+    glad_glBindFramebuffer = (PFNGLBINDFRAMEBUFFERPROC) load(userptr, "glBindFramebuffer");
+    glad_glBindRenderbuffer = (PFNGLBINDRENDERBUFFERPROC) load(userptr, "glBindRenderbuffer");
+    glad_glBindTexture = (PFNGLBINDTEXTUREPROC) load(userptr, "glBindTexture");
+    glad_glBlendColor = (PFNGLBLENDCOLORPROC) load(userptr, "glBlendColor");
+    glad_glBlendEquation = (PFNGLBLENDEQUATIONPROC) load(userptr, "glBlendEquation");
+    glad_glBlendEquationSeparate = (PFNGLBLENDEQUATIONSEPARATEPROC) load(userptr, "glBlendEquationSeparate");
+    glad_glBlendFunc = (PFNGLBLENDFUNCPROC) load(userptr, "glBlendFunc");
+    glad_glBlendFuncSeparate = (PFNGLBLENDFUNCSEPARATEPROC) load(userptr, "glBlendFuncSeparate");
+    glad_glBufferData = (PFNGLBUFFERDATAPROC) load(userptr, "glBufferData");
+    glad_glBufferSubData = (PFNGLBUFFERSUBDATAPROC) load(userptr, "glBufferSubData");
+    glad_glCheckFramebufferStatus = (PFNGLCHECKFRAMEBUFFERSTATUSPROC) load(userptr, "glCheckFramebufferStatus");
+    glad_glClear = (PFNGLCLEARPROC) load(userptr, "glClear");
+    glad_glClearColor = (PFNGLCLEARCOLORPROC) load(userptr, "glClearColor");
+    glad_glClearDepthf = (PFNGLCLEARDEPTHFPROC) load(userptr, "glClearDepthf");
+    glad_glClearStencil = (PFNGLCLEARSTENCILPROC) load(userptr, "glClearStencil");
+    glad_glColorMask = (PFNGLCOLORMASKPROC) load(userptr, "glColorMask");
+    glad_glCompileShader = (PFNGLCOMPILESHADERPROC) load(userptr, "glCompileShader");
+    glad_glCompressedTexImage2D = (PFNGLCOMPRESSEDTEXIMAGE2DPROC) load(userptr, "glCompressedTexImage2D");
+    glad_glCompressedTexSubImage2D = (PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC) load(userptr, "glCompressedTexSubImage2D");
+    glad_glCopyTexImage2D = (PFNGLCOPYTEXIMAGE2DPROC) load(userptr, "glCopyTexImage2D");
+    glad_glCopyTexSubImage2D = (PFNGLCOPYTEXSUBIMAGE2DPROC) load(userptr, "glCopyTexSubImage2D");
+    glad_glCreateProgram = (PFNGLCREATEPROGRAMPROC) load(userptr, "glCreateProgram");
+    glad_glCreateShader = (PFNGLCREATESHADERPROC) load(userptr, "glCreateShader");
+    glad_glCullFace = (PFNGLCULLFACEPROC) load(userptr, "glCullFace");
+    glad_glDeleteBuffers = (PFNGLDELETEBUFFERSPROC) load(userptr, "glDeleteBuffers");
+    glad_glDeleteFramebuffers = (PFNGLDELETEFRAMEBUFFERSPROC) load(userptr, "glDeleteFramebuffers");
+    glad_glDeleteProgram = (PFNGLDELETEPROGRAMPROC) load(userptr, "glDeleteProgram");
+    glad_glDeleteRenderbuffers = (PFNGLDELETERENDERBUFFERSPROC) load(userptr, "glDeleteRenderbuffers");
+    glad_glDeleteShader = (PFNGLDELETESHADERPROC) load(userptr, "glDeleteShader");
+    glad_glDeleteTextures = (PFNGLDELETETEXTURESPROC) load(userptr, "glDeleteTextures");
+    glad_glDepthFunc = (PFNGLDEPTHFUNCPROC) load(userptr, "glDepthFunc");
+    glad_glDepthMask = (PFNGLDEPTHMASKPROC) load(userptr, "glDepthMask");
+    glad_glDepthRangef = (PFNGLDEPTHRANGEFPROC) load(userptr, "glDepthRangef");
+    glad_glDetachShader = (PFNGLDETACHSHADERPROC) load(userptr, "glDetachShader");
+    glad_glDisable = (PFNGLDISABLEPROC) load(userptr, "glDisable");
+    glad_glDisableVertexAttribArray = (PFNGLDISABLEVERTEXATTRIBARRAYPROC) load(userptr, "glDisableVertexAttribArray");
+    glad_glDrawArrays = (PFNGLDRAWARRAYSPROC) load(userptr, "glDrawArrays");
+    glad_glDrawElements = (PFNGLDRAWELEMENTSPROC) load(userptr, "glDrawElements");
+    glad_glEnable = (PFNGLENABLEPROC) load(userptr, "glEnable");
+    glad_glEnableVertexAttribArray = (PFNGLENABLEVERTEXATTRIBARRAYPROC) load(userptr, "glEnableVertexAttribArray");
+    glad_glFinish = (PFNGLFINISHPROC) load(userptr, "glFinish");
+    glad_glFlush = (PFNGLFLUSHPROC) load(userptr, "glFlush");
+    glad_glFramebufferRenderbuffer = (PFNGLFRAMEBUFFERRENDERBUFFERPROC) load(userptr, "glFramebufferRenderbuffer");
+    glad_glFramebufferTexture2D = (PFNGLFRAMEBUFFERTEXTURE2DPROC) load(userptr, "glFramebufferTexture2D");
+    glad_glFrontFace = (PFNGLFRONTFACEPROC) load(userptr, "glFrontFace");
+    glad_glGenBuffers = (PFNGLGENBUFFERSPROC) load(userptr, "glGenBuffers");
+    glad_glGenFramebuffers = (PFNGLGENFRAMEBUFFERSPROC) load(userptr, "glGenFramebuffers");
+    glad_glGenRenderbuffers = (PFNGLGENRENDERBUFFERSPROC) load(userptr, "glGenRenderbuffers");
+    glad_glGenTextures = (PFNGLGENTEXTURESPROC) load(userptr, "glGenTextures");
+    glad_glGenerateMipmap = (PFNGLGENERATEMIPMAPPROC) load(userptr, "glGenerateMipmap");
+    glad_glGetActiveAttrib = (PFNGLGETACTIVEATTRIBPROC) load(userptr, "glGetActiveAttrib");
+    glad_glGetActiveUniform = (PFNGLGETACTIVEUNIFORMPROC) load(userptr, "glGetActiveUniform");
+    glad_glGetAttachedShaders = (PFNGLGETATTACHEDSHADERSPROC) load(userptr, "glGetAttachedShaders");
+    glad_glGetAttribLocation = (PFNGLGETATTRIBLOCATIONPROC) load(userptr, "glGetAttribLocation");
+    glad_glGetBooleanv = (PFNGLGETBOOLEANVPROC) load(userptr, "glGetBooleanv");
+    glad_glGetBufferParameteriv = (PFNGLGETBUFFERPARAMETERIVPROC) load(userptr, "glGetBufferParameteriv");
+    glad_glGetError = (PFNGLGETERRORPROC) load(userptr, "glGetError");
+    glad_glGetFloatv = (PFNGLGETFLOATVPROC) load(userptr, "glGetFloatv");
+    glad_glGetFramebufferAttachmentParameteriv = (PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC) load(userptr, "glGetFramebufferAttachmentParameteriv");
+    glad_glGetIntegerv = (PFNGLGETINTEGERVPROC) load(userptr, "glGetIntegerv");
+    glad_glGetProgramInfoLog = (PFNGLGETPROGRAMINFOLOGPROC) load(userptr, "glGetProgramInfoLog");
+    glad_glGetProgramiv = (PFNGLGETPROGRAMIVPROC) load(userptr, "glGetProgramiv");
+    glad_glGetRenderbufferParameteriv = (PFNGLGETRENDERBUFFERPARAMETERIVPROC) load(userptr, "glGetRenderbufferParameteriv");
+    glad_glGetShaderInfoLog = (PFNGLGETSHADERINFOLOGPROC) load(userptr, "glGetShaderInfoLog");
+    glad_glGetShaderPrecisionFormat = (PFNGLGETSHADERPRECISIONFORMATPROC) load(userptr, "glGetShaderPrecisionFormat");
+    glad_glGetShaderSource = (PFNGLGETSHADERSOURCEPROC) load(userptr, "glGetShaderSource");
+    glad_glGetShaderiv = (PFNGLGETSHADERIVPROC) load(userptr, "glGetShaderiv");
+    glad_glGetString = (PFNGLGETSTRINGPROC) load(userptr, "glGetString");
+    glad_glGetTexParameterfv = (PFNGLGETTEXPARAMETERFVPROC) load(userptr, "glGetTexParameterfv");
+    glad_glGetTexParameteriv = (PFNGLGETTEXPARAMETERIVPROC) load(userptr, "glGetTexParameteriv");
+    glad_glGetUniformLocation = (PFNGLGETUNIFORMLOCATIONPROC) load(userptr, "glGetUniformLocation");
+    glad_glGetUniformfv = (PFNGLGETUNIFORMFVPROC) load(userptr, "glGetUniformfv");
+    glad_glGetUniformiv = (PFNGLGETUNIFORMIVPROC) load(userptr, "glGetUniformiv");
+    glad_glGetVertexAttribPointerv = (PFNGLGETVERTEXATTRIBPOINTERVPROC) load(userptr, "glGetVertexAttribPointerv");
+    glad_glGetVertexAttribfv = (PFNGLGETVERTEXATTRIBFVPROC) load(userptr, "glGetVertexAttribfv");
+    glad_glGetVertexAttribiv = (PFNGLGETVERTEXATTRIBIVPROC) load(userptr, "glGetVertexAttribiv");
+    glad_glHint = (PFNGLHINTPROC) load(userptr, "glHint");
+    glad_glIsBuffer = (PFNGLISBUFFERPROC) load(userptr, "glIsBuffer");
+    glad_glIsEnabled = (PFNGLISENABLEDPROC) load(userptr, "glIsEnabled");
+    glad_glIsFramebuffer = (PFNGLISFRAMEBUFFERPROC) load(userptr, "glIsFramebuffer");
+    glad_glIsProgram = (PFNGLISPROGRAMPROC) load(userptr, "glIsProgram");
+    glad_glIsRenderbuffer = (PFNGLISRENDERBUFFERPROC) load(userptr, "glIsRenderbuffer");
+    glad_glIsShader = (PFNGLISSHADERPROC) load(userptr, "glIsShader");
+    glad_glIsTexture = (PFNGLISTEXTUREPROC) load(userptr, "glIsTexture");
+    glad_glLineWidth = (PFNGLLINEWIDTHPROC) load(userptr, "glLineWidth");
+    glad_glLinkProgram = (PFNGLLINKPROGRAMPROC) load(userptr, "glLinkProgram");
+    glad_glPixelStorei = (PFNGLPIXELSTOREIPROC) load(userptr, "glPixelStorei");
+    glad_glPolygonOffset = (PFNGLPOLYGONOFFSETPROC) load(userptr, "glPolygonOffset");
+    glad_glReadPixels = (PFNGLREADPIXELSPROC) load(userptr, "glReadPixels");
+    glad_glReleaseShaderCompiler = (PFNGLRELEASESHADERCOMPILERPROC) load(userptr, "glReleaseShaderCompiler");
+    glad_glRenderbufferStorage = (PFNGLRENDERBUFFERSTORAGEPROC) load(userptr, "glRenderbufferStorage");
+    glad_glSampleCoverage = (PFNGLSAMPLECOVERAGEPROC) load(userptr, "glSampleCoverage");
+    glad_glScissor = (PFNGLSCISSORPROC) load(userptr, "glScissor");
+    glad_glShaderBinary = (PFNGLSHADERBINARYPROC) load(userptr, "glShaderBinary");
+    glad_glShaderSource = (PFNGLSHADERSOURCEPROC) load(userptr, "glShaderSource");
+    glad_glStencilFunc = (PFNGLSTENCILFUNCPROC) load(userptr, "glStencilFunc");
+    glad_glStencilFuncSeparate = (PFNGLSTENCILFUNCSEPARATEPROC) load(userptr, "glStencilFuncSeparate");
+    glad_glStencilMask = (PFNGLSTENCILMASKPROC) load(userptr, "glStencilMask");
+    glad_glStencilMaskSeparate = (PFNGLSTENCILMASKSEPARATEPROC) load(userptr, "glStencilMaskSeparate");
+    glad_glStencilOp = (PFNGLSTENCILOPPROC) load(userptr, "glStencilOp");
+    glad_glStencilOpSeparate = (PFNGLSTENCILOPSEPARATEPROC) load(userptr, "glStencilOpSeparate");
+    glad_glTexImage2D = (PFNGLTEXIMAGE2DPROC) load(userptr, "glTexImage2D");
+    glad_glTexParameterf = (PFNGLTEXPARAMETERFPROC) load(userptr, "glTexParameterf");
+    glad_glTexParameterfv = (PFNGLTEXPARAMETERFVPROC) load(userptr, "glTexParameterfv");
+    glad_glTexParameteri = (PFNGLTEXPARAMETERIPROC) load(userptr, "glTexParameteri");
+    glad_glTexParameteriv = (PFNGLTEXPARAMETERIVPROC) load(userptr, "glTexParameteriv");
+    glad_glTexSubImage2D = (PFNGLTEXSUBIMAGE2DPROC) load(userptr, "glTexSubImage2D");
+    glad_glUniform1f = (PFNGLUNIFORM1FPROC) load(userptr, "glUniform1f");
+    glad_glUniform1fv = (PFNGLUNIFORM1FVPROC) load(userptr, "glUniform1fv");
+    glad_glUniform1i = (PFNGLUNIFORM1IPROC) load(userptr, "glUniform1i");
+    glad_glUniform1iv = (PFNGLUNIFORM1IVPROC) load(userptr, "glUniform1iv");
+    glad_glUniform2f = (PFNGLUNIFORM2FPROC) load(userptr, "glUniform2f");
+    glad_glUniform2fv = (PFNGLUNIFORM2FVPROC) load(userptr, "glUniform2fv");
+    glad_glUniform2i = (PFNGLUNIFORM2IPROC) load(userptr, "glUniform2i");
+    glad_glUniform2iv = (PFNGLUNIFORM2IVPROC) load(userptr, "glUniform2iv");
+    glad_glUniform3f = (PFNGLUNIFORM3FPROC) load(userptr, "glUniform3f");
+    glad_glUniform3fv = (PFNGLUNIFORM3FVPROC) load(userptr, "glUniform3fv");
+    glad_glUniform3i = (PFNGLUNIFORM3IPROC) load(userptr, "glUniform3i");
+    glad_glUniform3iv = (PFNGLUNIFORM3IVPROC) load(userptr, "glUniform3iv");
+    glad_glUniform4f = (PFNGLUNIFORM4FPROC) load(userptr, "glUniform4f");
+    glad_glUniform4fv = (PFNGLUNIFORM4FVPROC) load(userptr, "glUniform4fv");
+    glad_glUniform4i = (PFNGLUNIFORM4IPROC) load(userptr, "glUniform4i");
+    glad_glUniform4iv = (PFNGLUNIFORM4IVPROC) load(userptr, "glUniform4iv");
+    glad_glUniformMatrix2fv = (PFNGLUNIFORMMATRIX2FVPROC) load(userptr, "glUniformMatrix2fv");
+    glad_glUniformMatrix3fv = (PFNGLUNIFORMMATRIX3FVPROC) load(userptr, "glUniformMatrix3fv");
+    glad_glUniformMatrix4fv = (PFNGLUNIFORMMATRIX4FVPROC) load(userptr, "glUniformMatrix4fv");
+    glad_glUseProgram = (PFNGLUSEPROGRAMPROC) load(userptr, "glUseProgram");
+    glad_glValidateProgram = (PFNGLVALIDATEPROGRAMPROC) load(userptr, "glValidateProgram");
+    glad_glVertexAttrib1f = (PFNGLVERTEXATTRIB1FPROC) load(userptr, "glVertexAttrib1f");
+    glad_glVertexAttrib1fv = (PFNGLVERTEXATTRIB1FVPROC) load(userptr, "glVertexAttrib1fv");
+    glad_glVertexAttrib2f = (PFNGLVERTEXATTRIB2FPROC) load(userptr, "glVertexAttrib2f");
+    glad_glVertexAttrib2fv = (PFNGLVERTEXATTRIB2FVPROC) load(userptr, "glVertexAttrib2fv");
+    glad_glVertexAttrib3f = (PFNGLVERTEXATTRIB3FPROC) load(userptr, "glVertexAttrib3f");
+    glad_glVertexAttrib3fv = (PFNGLVERTEXATTRIB3FVPROC) load(userptr, "glVertexAttrib3fv");
+    glad_glVertexAttrib4f = (PFNGLVERTEXATTRIB4FPROC) load(userptr, "glVertexAttrib4f");
+    glad_glVertexAttrib4fv = (PFNGLVERTEXATTRIB4FVPROC) load(userptr, "glVertexAttrib4fv");
+    glad_glVertexAttribPointer = (PFNGLVERTEXATTRIBPOINTERPROC) load(userptr, "glVertexAttribPointer");
+    glad_glViewport = (PFNGLVIEWPORTPROC) load(userptr, "glViewport");
+}
+
+
+
+#if defined(GL_ES_VERSION_3_0) || defined(GL_VERSION_3_0)
+#define GLAD_GL_IS_SOME_NEW_VERSION 1
+#else
+#define GLAD_GL_IS_SOME_NEW_VERSION 0
+#endif
+
+static int glad_gl_get_extensions( int version, const char **out_exts, unsigned int *out_num_exts_i, char ***out_exts_i) {
+#if GLAD_GL_IS_SOME_NEW_VERSION
+    if(GLAD_VERSION_MAJOR(version) < 3) {
+#else
+    (void) version;
+    (void) out_num_exts_i;
+    (void) out_exts_i;
+#endif
+        if (glad_glGetString == NULL) {
+            return 0;
+        }
+        *out_exts = (const char *)glad_glGetString(GL_EXTENSIONS);
+#if GLAD_GL_IS_SOME_NEW_VERSION
+    } else {
+        unsigned int index = 0;
+        unsigned int num_exts_i = 0;
+        char **exts_i = NULL;
+        if (glad_glGetStringi == NULL || glad_glGetIntegerv == NULL) {
+            return 0;
+        }
+        glad_glGetIntegerv(GL_NUM_EXTENSIONS, (int*) &num_exts_i);
+        if (num_exts_i > 0) {
+            exts_i = (char **) malloc(num_exts_i * (sizeof *exts_i));
+        }
+        if (exts_i == NULL) {
+            return 0;
+        }
+        for(index = 0; index < num_exts_i; index++) {
+            const char *gl_str_tmp = (const char*) glad_glGetStringi(GL_EXTENSIONS, index);
+            size_t len = strlen(gl_str_tmp) + 1;
+
+            char *local_str = (char*) malloc(len * sizeof(char));
+            if(local_str != NULL) {
+                memcpy(local_str, gl_str_tmp, len * sizeof(char));
+            }
+
+            exts_i[index] = local_str;
+        }
+
+        *out_num_exts_i = num_exts_i;
+        *out_exts_i = exts_i;
+    }
+#endif
+    return 1;
+}
+static void glad_gl_free_extensions(char **exts_i, unsigned int num_exts_i) {
+    if (exts_i != NULL) {
+        unsigned int index;
+        for(index = 0; index < num_exts_i; index++) {
+            free((void *) (exts_i[index]));
+        }
+        free((void *)exts_i);
+        exts_i = NULL;
+    }
+}
+static int glad_gl_has_extension(int version, const char *exts, unsigned int num_exts_i, char **exts_i, const char *ext) {
+    if(GLAD_VERSION_MAJOR(version) < 3 || !GLAD_GL_IS_SOME_NEW_VERSION) {
+        const char *extensions;
+        const char *loc;
+        const char *terminator;
+        extensions = exts;
+        if(extensions == NULL || ext == NULL) {
+            return 0;
+        }
+        while(1) {
+            loc = strstr(extensions, ext);
+            if(loc == NULL) {
+                return 0;
+            }
+            terminator = loc + strlen(ext);
+            if((loc == extensions || *(loc - 1) == ' ') &&
+                (*terminator == ' ' || *terminator == '\0')) {
+                return 1;
+            }
+            extensions = terminator;
+        }
+    } else {
+        unsigned int index;
+        for(index = 0; index < num_exts_i; index++) {
+            const char *e = exts_i[index];
+            if(strcmp(e, ext) == 0) {
+                return 1;
+            }
+        }
+    }
+    return 0;
+}
+
+static GLADapiproc glad_gl_get_proc_from_userptr(void *userptr, const char* name) {
+    return (GLAD_GNUC_EXTENSION (GLADapiproc (*)(const char *name)) userptr)(name);
+}
+
+static int glad_gl_find_extensions_gles2( int version) {
+    const char *exts = NULL;
+    unsigned int num_exts_i = 0;
+    char **exts_i = NULL;
+    if (!glad_gl_get_extensions(version, &exts, &num_exts_i, &exts_i)) return 0;
+
+    (void) glad_gl_has_extension;
+
+    glad_gl_free_extensions(exts_i, num_exts_i);
+
+    return 1;
+}
+
+static int glad_gl_find_core_gles2(void) {
+    int i;
+    const char* version;
+    const char* prefixes[] = {
+        "OpenGL ES-CM ",
+        "OpenGL ES-CL ",
+        "OpenGL ES ",
+        "OpenGL SC ",
+        NULL
+    };
+    int major = 0;
+    int minor = 0;
+    version = (const char*) glad_glGetString(GL_VERSION);
+    if (!version) return 0;
+    for (i = 0;  prefixes[i];  i++) {
+        const size_t length = strlen(prefixes[i]);
+        if (strncmp(version, prefixes[i], length) == 0) {
+            version += length;
+            break;
+        }
+    }
+
+    GLAD_IMPL_UTIL_SSCANF(version, "%d.%d", &major, &minor);
+
+    GLAD_GL_ES_VERSION_2_0 = (major == 2 && minor >= 0) || major > 2;
+
+    return GLAD_MAKE_VERSION(major, minor);
+}
+
+int gladLoadGLES2UserPtr( GLADuserptrloadfunc load, void *userptr) {
+    int version;
+
+    glad_glGetString = (PFNGLGETSTRINGPROC) load(userptr, "glGetString");
+    if(glad_glGetString == NULL) return 0;
+    if(glad_glGetString(GL_VERSION) == NULL) return 0;
+    version = glad_gl_find_core_gles2();
+
+    glad_gl_load_GL_ES_VERSION_2_0(load, userptr);
+
+    if (!glad_gl_find_extensions_gles2(version)) return 0;
+
+
+
+    return version;
+}
+
+
+int gladLoadGLES2( GLADloadfunc load) {
+    return gladLoadGLES2UserPtr( glad_gl_get_proc_from_userptr, GLAD_GNUC_EXTENSION (void*) load);
+}
+
+
+
+ 
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* GLAD_GLES2_IMPLEMENTATION */
+
diff --git a/deps/glad/khrplatform.h b/deps/glad/khrplatform.h
deleted file mode 100644
index 975bbff..0000000
--- a/deps/glad/khrplatform.h
+++ /dev/null
@@ -1,282 +0,0 @@
-#ifndef __khrplatform_h_
-#define __khrplatform_h_
-
-/*
-** Copyright (c) 2008-2018 The Khronos Group Inc.
-**
-** Permission is hereby granted, free of charge, to any person obtaining a
-** copy of this software and/or associated documentation files (the
-** "Materials"), to deal in the Materials without restriction, including
-** without limitation the rights to use, copy, modify, merge, publish,
-** distribute, sublicense, and/or sell copies of the Materials, and to
-** permit persons to whom the Materials are furnished to do so, subject to
-** the following conditions:
-**
-** The above copyright notice and this permission notice shall be included
-** in all copies or substantial portions of the Materials.
-**
-** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
-** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
-*/
-
-/* Khronos platform-specific types and definitions.
- *
- * The master copy of khrplatform.h is maintained in the Khronos EGL
- * Registry repository at https://github.com/KhronosGroup/EGL-Registry
- * The last semantic modification to khrplatform.h was at commit ID:
- *      67a3e0864c2d75ea5287b9f3d2eb74a745936692
- *
- * Adopters may modify this file to suit their platform. Adopters are
- * encouraged to submit platform specific modifications to the Khronos
- * group so that they can be included in future versions of this file.
- * Please submit changes by filing pull requests or issues on
- * the EGL Registry repository linked above.
- *
- *
- * See the Implementer's Guidelines for information about where this file
- * should be located on your system and for more details of its use:
- *    http://www.khronos.org/registry/implementers_guide.pdf
- *
- * This file should be included as
- *        #include <KHR/khrplatform.h>
- * by Khronos client API header files that use its types and defines.
- *
- * The types in khrplatform.h should only be used to define API-specific types.
- *
- * Types defined in khrplatform.h:
- *    khronos_int8_t              signed   8  bit
- *    khronos_uint8_t             unsigned 8  bit
- *    khronos_int16_t             signed   16 bit
- *    khronos_uint16_t            unsigned 16 bit
- *    khronos_int32_t             signed   32 bit
- *    khronos_uint32_t            unsigned 32 bit
- *    khronos_int64_t             signed   64 bit
- *    khronos_uint64_t            unsigned 64 bit
- *    khronos_intptr_t            signed   same number of bits as a pointer
- *    khronos_uintptr_t           unsigned same number of bits as a pointer
- *    khronos_ssize_t             signed   size
- *    khronos_usize_t             unsigned size
- *    khronos_float_t             signed   32 bit floating point
- *    khronos_time_ns_t           unsigned 64 bit time in nanoseconds
- *    khronos_utime_nanoseconds_t unsigned time interval or absolute time in
- *                                         nanoseconds
- *    khronos_stime_nanoseconds_t signed time interval in nanoseconds
- *    khronos_boolean_enum_t      enumerated boolean type. This should
- *      only be used as a base type when a client API's boolean type is
- *      an enum. Client APIs which use an integer or other type for
- *      booleans cannot use this as the base type for their boolean.
- *
- * Tokens defined in khrplatform.h:
- *
- *    KHRONOS_FALSE, KHRONOS_TRUE Enumerated boolean false/true values.
- *
- *    KHRONOS_SUPPORT_INT64 is 1 if 64 bit integers are supported; otherwise 0.
- *    KHRONOS_SUPPORT_FLOAT is 1 if floats are supported; otherwise 0.
- *
- * Calling convention macros defined in this file:
- *    KHRONOS_APICALL
- *    KHRONOS_APIENTRY
- *    KHRONOS_APIATTRIBUTES
- *
- * These may be used in function prototypes as:
- *
- *      KHRONOS_APICALL void KHRONOS_APIENTRY funcname(
- *                                  int arg1,
- *                                  int arg2) KHRONOS_APIATTRIBUTES;
- */
-
-/*-------------------------------------------------------------------------
- * Definition of KHRONOS_APICALL
- *-------------------------------------------------------------------------
- * This precedes the return type of the function in the function prototype.
- */
-#if defined(_WIN32) && !defined(__SCITECH_SNAP__)
-#   define KHRONOS_APICALL __declspec(dllimport)
-#elif defined (__SYMBIAN32__)
-#   define KHRONOS_APICALL IMPORT_C
-#elif defined(__ANDROID__)
-#   define KHRONOS_APICALL __attribute__((visibility("default")))
-#else
-#   define KHRONOS_APICALL
-#endif
-
-/*-------------------------------------------------------------------------
- * Definition of KHRONOS_APIENTRY
- *-------------------------------------------------------------------------
- * This follows the return type of the function  and precedes the function
- * name in the function prototype.
- */
-#if defined(_WIN32) && !defined(_WIN32_WCE) && !defined(__SCITECH_SNAP__)
-    /* Win32 but not WinCE */
-#   define KHRONOS_APIENTRY __stdcall
-#else
-#   define KHRONOS_APIENTRY
-#endif
-
-/*-------------------------------------------------------------------------
- * Definition of KHRONOS_APIATTRIBUTES
- *-------------------------------------------------------------------------
- * This follows the closing parenthesis of the function prototype arguments.
- */
-#if defined (__ARMCC_2__)
-#define KHRONOS_APIATTRIBUTES __softfp
-#else
-#define KHRONOS_APIATTRIBUTES
-#endif
-
-/*-------------------------------------------------------------------------
- * basic type definitions
- *-----------------------------------------------------------------------*/
-#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || defined(__GNUC__) || defined(__SCO__) || defined(__USLC__)
-
-
-/*
- * Using <stdint.h>
- */
-#include <stdint.h>
-typedef int32_t                 khronos_int32_t;
-typedef uint32_t                khronos_uint32_t;
-typedef int64_t                 khronos_int64_t;
-typedef uint64_t                khronos_uint64_t;
-#define KHRONOS_SUPPORT_INT64   1
-#define KHRONOS_SUPPORT_FLOAT   1
-
-#elif defined(__VMS ) || defined(__sgi)
-
-/*
- * Using <inttypes.h>
- */
-#include <inttypes.h>
-typedef int32_t                 khronos_int32_t;
-typedef uint32_t                khronos_uint32_t;
-typedef int64_t                 khronos_int64_t;
-typedef uint64_t                khronos_uint64_t;
-#define KHRONOS_SUPPORT_INT64   1
-#define KHRONOS_SUPPORT_FLOAT   1
-
-#elif defined(_WIN32) && !defined(__SCITECH_SNAP__)
-
-/*
- * Win32
- */
-typedef __int32                 khronos_int32_t;
-typedef unsigned __int32        khronos_uint32_t;
-typedef __int64                 khronos_int64_t;
-typedef unsigned __int64        khronos_uint64_t;
-#define KHRONOS_SUPPORT_INT64   1
-#define KHRONOS_SUPPORT_FLOAT   1
-
-#elif defined(__sun__) || defined(__digital__)
-
-/*
- * Sun or Digital
- */
-typedef int                     khronos_int32_t;
-typedef unsigned int            khronos_uint32_t;
-#if defined(__arch64__) || defined(_LP64)
-typedef long int                khronos_int64_t;
-typedef unsigned long int       khronos_uint64_t;
-#else
-typedef long long int           khronos_int64_t;
-typedef unsigned long long int  khronos_uint64_t;
-#endif /* __arch64__ */
-#define KHRONOS_SUPPORT_INT64   1
-#define KHRONOS_SUPPORT_FLOAT   1
-
-#elif 0
-
-/*
- * Hypothetical platform with no float or int64 support
- */
-typedef int                     khronos_int32_t;
-typedef unsigned int            khronos_uint32_t;
-#define KHRONOS_SUPPORT_INT64   0
-#define KHRONOS_SUPPORT_FLOAT   0
-
-#else
-
-/*
- * Generic fallback
- */
-#include <stdint.h>
-typedef int32_t                 khronos_int32_t;
-typedef uint32_t                khronos_uint32_t;
-typedef int64_t                 khronos_int64_t;
-typedef uint64_t                khronos_uint64_t;
-#define KHRONOS_SUPPORT_INT64   1
-#define KHRONOS_SUPPORT_FLOAT   1
-
-#endif
-
-
-/*
- * Types that are (so far) the same on all platforms
- */
-typedef signed   char          khronos_int8_t;
-typedef unsigned char          khronos_uint8_t;
-typedef signed   short int     khronos_int16_t;
-typedef unsigned short int     khronos_uint16_t;
-
-/*
- * Types that differ between LLP64 and LP64 architectures - in LLP64,
- * pointers are 64 bits, but 'long' is still 32 bits. Win64 appears
- * to be the only LLP64 architecture in current use.
- */
-#ifdef _WIN64
-typedef signed   long long int khronos_intptr_t;
-typedef unsigned long long int khronos_uintptr_t;
-typedef signed   long long int khronos_ssize_t;
-typedef unsigned long long int khronos_usize_t;
-#else
-typedef signed   long  int     khronos_intptr_t;
-typedef unsigned long  int     khronos_uintptr_t;
-typedef signed   long  int     khronos_ssize_t;
-typedef unsigned long  int     khronos_usize_t;
-#endif
-
-#if KHRONOS_SUPPORT_FLOAT
-/*
- * Float type
- */
-typedef          float         khronos_float_t;
-#endif
-
-#if KHRONOS_SUPPORT_INT64
-/* Time types
- *
- * These types can be used to represent a time interval in nanoseconds or
- * an absolute Unadjusted System Time.  Unadjusted System Time is the number
- * of nanoseconds since some arbitrary system event (e.g. since the last
- * time the system booted).  The Unadjusted System Time is an unsigned
- * 64 bit value that wraps back to 0 every 584 years.  Time intervals
- * may be either signed or unsigned.
- */
-typedef khronos_uint64_t       khronos_utime_nanoseconds_t;
-typedef khronos_int64_t        khronos_stime_nanoseconds_t;
-#endif
-
-/*
- * Dummy value used to pad enum types to 32 bits.
- */
-#ifndef KHRONOS_MAX_ENUM
-#define KHRONOS_MAX_ENUM 0x7FFFFFFF
-#endif
-
-/*
- * Enumerated boolean type
- *
- * Values other than zero should be considered to be true.  Therefore
- * comparisons should not be made against KHRONOS_TRUE.
- */
-typedef enum {
-    KHRONOS_FALSE = 0,
-    KHRONOS_TRUE  = 1,
-    KHRONOS_BOOLEAN_ENUM_FORCE_SIZE = KHRONOS_MAX_ENUM
-} khronos_boolean_enum_t;
-
-#endif /* __khrplatform_h_ */
diff --git a/deps/glad/vk_platform.h b/deps/glad/vk_platform.h
deleted file mode 100644
index 277e96a..0000000
--- a/deps/glad/vk_platform.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/* */
-/* File: vk_platform.h */
-/* */
-/*
-** Copyright 2014-2022 The Khronos Group Inc.
-**
-** SPDX-License-Identifier: Apache-2.0
-*/
-
-
-#ifndef VK_PLATFORM_H_
-#define VK_PLATFORM_H_
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif /* __cplusplus */
-
-/*
-***************************************************************************************************
-*   Platform-specific directives and type declarations
-***************************************************************************************************
-*/
-
-/* Platform-specific calling convention macros.
- *
- * Platforms should define these so that Vulkan clients call Vulkan commands
- * with the same calling conventions that the Vulkan implementation expects.
- *
- * VKAPI_ATTR - Placed before the return type in function declarations.
- *              Useful for C++11 and GCC/Clang-style function attribute syntax.
- * VKAPI_CALL - Placed after the return type in function declarations.
- *              Useful for MSVC-style calling convention syntax.
- * VKAPI_PTR  - Placed between the '(' and '*' in function pointer types.
- *
- * Function declaration:  VKAPI_ATTR void VKAPI_CALL vkCommand(void);
- * Function pointer type: typedef void (VKAPI_PTR *PFN_vkCommand)(void);
- */
-#if defined(_WIN32)
-    /* On Windows, Vulkan commands use the stdcall convention */
-    #define VKAPI_ATTR
-    #define VKAPI_CALL __stdcall
-    #define VKAPI_PTR  VKAPI_CALL
-#elif defined(__ANDROID__) && defined(__ARM_ARCH) && __ARM_ARCH < 7
-    #error "Vulkan is not supported for the 'armeabi' NDK ABI"
-#elif defined(__ANDROID__) && defined(__ARM_ARCH) && __ARM_ARCH >= 7 && defined(__ARM_32BIT_STATE)
-    /* On Android 32-bit ARM targets, Vulkan functions use the "hardfloat" */
-    /* calling convention, i.e. float parameters are passed in registers. This */
-    /* is true even if the rest of the application passes floats on the stack, */
-    /* as it does by default when compiling for the armeabi-v7a NDK ABI. */
-    #define VKAPI_ATTR __attribute__((pcs("aapcs-vfp")))
-    #define VKAPI_CALL
-    #define VKAPI_PTR  VKAPI_ATTR
-#else
-    /* On other platforms, use the default calling convention */
-    #define VKAPI_ATTR
-    #define VKAPI_CALL
-    #define VKAPI_PTR
-#endif
-
-#if !defined(VK_NO_STDDEF_H)
-    #include <stddef.h>
-#endif /* !defined(VK_NO_STDDEF_H) */
-
-#if !defined(VK_NO_STDINT_H)
-    #if defined(_MSC_VER) && (_MSC_VER < 1600)
-        typedef signed   __int8  int8_t;
-        typedef unsigned __int8  uint8_t;
-        typedef signed   __int16 int16_t;
-        typedef unsigned __int16 uint16_t;
-        typedef signed   __int32 int32_t;
-        typedef unsigned __int32 uint32_t;
-        typedef signed   __int64 int64_t;
-        typedef unsigned __int64 uint64_t;
-    #else
-        #include <stdint.h>
-    #endif
-#endif /* !defined(VK_NO_STDINT_H) */
-
-#ifdef __cplusplus
-} /* extern "C" */
-#endif /* __cplusplus */
-
-#endif
diff --git a/deps/glad/vulkan.h b/deps/glad/vulkan.h
index 39288ee..469ffe5 100644
--- a/deps/glad/vulkan.h
+++ b/deps/glad/vulkan.h
@@ -1,5 +1,5 @@
 /**
- * Loader generated by glad 2.0.0-beta on Wed Jul 13 21:24:58 2022
+ * Loader generated by glad 2.0.0-beta on Thu Jul  7 20:52:04 2022
  *
  * Generator: C/C++
  * Specification: vk
@@ -11,17 +11,17 @@
  * Options:
  *  - ALIAS = False
  *  - DEBUG = False
- *  - HEADER_ONLY = False
+ *  - HEADER_ONLY = True
  *  - LOADER = False
  *  - MX = False
  *  - MX_GLOBAL = False
  *  - ON_DEMAND = False
  *
  * Commandline:
- *    --api='vulkan=1.3' --extensions='VK_EXT_debug_report,VK_KHR_portability_enumeration,VK_KHR_surface,VK_KHR_swapchain' c
+ *    --api='vulkan=1.3' --extensions='VK_EXT_debug_report,VK_KHR_portability_enumeration,VK_KHR_surface,VK_KHR_swapchain' c --header-only
  *
  * Online:
- *    http://glad.sh/#api=vulkan%3D1.3&extensions=VK_EXT_debug_report%2CVK_KHR_portability_enumeration%2CVK_KHR_surface%2CVK_KHR_swapchain&generator=c&options=
+ *    http://glad.sh/#api=vulkan%3D1.3&extensions=VK_EXT_debug_report%2CVK_KHR_portability_enumeration%2CVK_KHR_surface%2CVK_KHR_swapchain&generator=c&options=HEADER_ONLY
  *
  */
 
@@ -40,6 +40,7 @@
 
 
 #define GLAD_VULKAN
+#define GLAD_OPTION_VULKAN_HEADER_ONLY
 
 #ifdef __cplusplus
 extern "C" {
@@ -189,7 +190,90 @@
 #define VK_WHOLE_SIZE (~0ULL)
 
 
-#include "vk_platform.h"
+/* */
+/* File: vk_platform.h */
+/* */
+/*
+** Copyright 2014-2022 The Khronos Group Inc.
+**
+** SPDX-License-Identifier: Apache-2.0
+*/
+
+
+#ifndef VK_PLATFORM_H_
+#define VK_PLATFORM_H_
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+
+/*
+***************************************************************************************************
+*   Platform-specific directives and type declarations
+***************************************************************************************************
+*/
+
+/* Platform-specific calling convention macros.
+ *
+ * Platforms should define these so that Vulkan clients call Vulkan commands
+ * with the same calling conventions that the Vulkan implementation expects.
+ *
+ * VKAPI_ATTR - Placed before the return type in function declarations.
+ *              Useful for C++11 and GCC/Clang-style function attribute syntax.
+ * VKAPI_CALL - Placed after the return type in function declarations.
+ *              Useful for MSVC-style calling convention syntax.
+ * VKAPI_PTR  - Placed between the '(' and '*' in function pointer types.
+ *
+ * Function declaration:  VKAPI_ATTR void VKAPI_CALL vkCommand(void);
+ * Function pointer type: typedef void (VKAPI_PTR *PFN_vkCommand)(void);
+ */
+#if defined(_WIN32)
+    /* On Windows, Vulkan commands use the stdcall convention */
+    #define VKAPI_ATTR
+    #define VKAPI_CALL __stdcall
+    #define VKAPI_PTR  VKAPI_CALL
+#elif defined(__ANDROID__) && defined(__ARM_ARCH) && __ARM_ARCH < 7
+    #error "Vulkan is not supported for the 'armeabi' NDK ABI"
+#elif defined(__ANDROID__) && defined(__ARM_ARCH) && __ARM_ARCH >= 7 && defined(__ARM_32BIT_STATE)
+    /* On Android 32-bit ARM targets, Vulkan functions use the "hardfloat" */
+    /* calling convention, i.e. float parameters are passed in registers. This */
+    /* is true even if the rest of the application passes floats on the stack, */
+    /* as it does by default when compiling for the armeabi-v7a NDK ABI. */
+    #define VKAPI_ATTR __attribute__((pcs("aapcs-vfp")))
+    #define VKAPI_CALL
+    #define VKAPI_PTR  VKAPI_ATTR
+#else
+    /* On other platforms, use the default calling convention */
+    #define VKAPI_ATTR
+    #define VKAPI_CALL
+    #define VKAPI_PTR
+#endif
+
+#if !defined(VK_NO_STDDEF_H)
+    #include <stddef.h>
+#endif /* !defined(VK_NO_STDDEF_H) */
+
+#if !defined(VK_NO_STDINT_H)
+    #if defined(_MSC_VER) && (_MSC_VER < 1600)
+        typedef signed   __int8  int8_t;
+        typedef unsigned __int8  uint8_t;
+        typedef signed   __int16 int16_t;
+        typedef unsigned __int16 uint16_t;
+        typedef signed   __int32 int32_t;
+        typedef unsigned __int32 uint32_t;
+        typedef signed   __int64 int64_t;
+        typedef unsigned __int64 uint64_t;
+    #else
+        #include <stdint.h>
+    #endif
+#endif /* !defined(VK_NO_STDINT_H) */
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif /* __cplusplus */
+
+#endif
 /* DEPRECATED: This define is deprecated. VK_MAKE_API_VERSION should be used instead. */
 #define VK_MAKE_VERSION(major, minor, patch) \
     ((((uint32_t)(major)) << 22) | (((uint32_t)(minor)) << 12) | ((uint32_t)(patch)))
@@ -5506,3 +5590,741 @@
 }
 #endif
 #endif
+
+/* Source */
+#ifdef GLAD_VULKAN_IMPLEMENTATION
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#ifndef GLAD_IMPL_UTIL_C_
+#define GLAD_IMPL_UTIL_C_
+
+#ifdef _MSC_VER
+#define GLAD_IMPL_UTIL_SSCANF sscanf_s
+#else
+#define GLAD_IMPL_UTIL_SSCANF sscanf
+#endif
+
+#endif /* GLAD_IMPL_UTIL_C_ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+
+int GLAD_VK_VERSION_1_0 = 0;
+int GLAD_VK_VERSION_1_1 = 0;
+int GLAD_VK_VERSION_1_2 = 0;
+int GLAD_VK_VERSION_1_3 = 0;
+int GLAD_VK_EXT_debug_report = 0;
+int GLAD_VK_KHR_portability_enumeration = 0;
+int GLAD_VK_KHR_surface = 0;
+int GLAD_VK_KHR_swapchain = 0;
+
+
+
+PFN_vkAcquireNextImage2KHR glad_vkAcquireNextImage2KHR = NULL;
+PFN_vkAcquireNextImageKHR glad_vkAcquireNextImageKHR = NULL;
+PFN_vkAllocateCommandBuffers glad_vkAllocateCommandBuffers = NULL;
+PFN_vkAllocateDescriptorSets glad_vkAllocateDescriptorSets = NULL;
+PFN_vkAllocateMemory glad_vkAllocateMemory = NULL;
+PFN_vkBeginCommandBuffer glad_vkBeginCommandBuffer = NULL;
+PFN_vkBindBufferMemory glad_vkBindBufferMemory = NULL;
+PFN_vkBindBufferMemory2 glad_vkBindBufferMemory2 = NULL;
+PFN_vkBindImageMemory glad_vkBindImageMemory = NULL;
+PFN_vkBindImageMemory2 glad_vkBindImageMemory2 = NULL;
+PFN_vkCmdBeginQuery glad_vkCmdBeginQuery = NULL;
+PFN_vkCmdBeginRenderPass glad_vkCmdBeginRenderPass = NULL;
+PFN_vkCmdBeginRenderPass2 glad_vkCmdBeginRenderPass2 = NULL;
+PFN_vkCmdBeginRendering glad_vkCmdBeginRendering = NULL;
+PFN_vkCmdBindDescriptorSets glad_vkCmdBindDescriptorSets = NULL;
+PFN_vkCmdBindIndexBuffer glad_vkCmdBindIndexBuffer = NULL;
+PFN_vkCmdBindPipeline glad_vkCmdBindPipeline = NULL;
+PFN_vkCmdBindVertexBuffers glad_vkCmdBindVertexBuffers = NULL;
+PFN_vkCmdBindVertexBuffers2 glad_vkCmdBindVertexBuffers2 = NULL;
+PFN_vkCmdBlitImage glad_vkCmdBlitImage = NULL;
+PFN_vkCmdBlitImage2 glad_vkCmdBlitImage2 = NULL;
+PFN_vkCmdClearAttachments glad_vkCmdClearAttachments = NULL;
+PFN_vkCmdClearColorImage glad_vkCmdClearColorImage = NULL;
+PFN_vkCmdClearDepthStencilImage glad_vkCmdClearDepthStencilImage = NULL;
+PFN_vkCmdCopyBuffer glad_vkCmdCopyBuffer = NULL;
+PFN_vkCmdCopyBuffer2 glad_vkCmdCopyBuffer2 = NULL;
+PFN_vkCmdCopyBufferToImage glad_vkCmdCopyBufferToImage = NULL;
+PFN_vkCmdCopyBufferToImage2 glad_vkCmdCopyBufferToImage2 = NULL;
+PFN_vkCmdCopyImage glad_vkCmdCopyImage = NULL;
+PFN_vkCmdCopyImage2 glad_vkCmdCopyImage2 = NULL;
+PFN_vkCmdCopyImageToBuffer glad_vkCmdCopyImageToBuffer = NULL;
+PFN_vkCmdCopyImageToBuffer2 glad_vkCmdCopyImageToBuffer2 = NULL;
+PFN_vkCmdCopyQueryPoolResults glad_vkCmdCopyQueryPoolResults = NULL;
+PFN_vkCmdDispatch glad_vkCmdDispatch = NULL;
+PFN_vkCmdDispatchBase glad_vkCmdDispatchBase = NULL;
+PFN_vkCmdDispatchIndirect glad_vkCmdDispatchIndirect = NULL;
+PFN_vkCmdDraw glad_vkCmdDraw = NULL;
+PFN_vkCmdDrawIndexed glad_vkCmdDrawIndexed = NULL;
+PFN_vkCmdDrawIndexedIndirect glad_vkCmdDrawIndexedIndirect = NULL;
+PFN_vkCmdDrawIndexedIndirectCount glad_vkCmdDrawIndexedIndirectCount = NULL;
+PFN_vkCmdDrawIndirect glad_vkCmdDrawIndirect = NULL;
+PFN_vkCmdDrawIndirectCount glad_vkCmdDrawIndirectCount = NULL;
+PFN_vkCmdEndQuery glad_vkCmdEndQuery = NULL;
+PFN_vkCmdEndRenderPass glad_vkCmdEndRenderPass = NULL;
+PFN_vkCmdEndRenderPass2 glad_vkCmdEndRenderPass2 = NULL;
+PFN_vkCmdEndRendering glad_vkCmdEndRendering = NULL;
+PFN_vkCmdExecuteCommands glad_vkCmdExecuteCommands = NULL;
+PFN_vkCmdFillBuffer glad_vkCmdFillBuffer = NULL;
+PFN_vkCmdNextSubpass glad_vkCmdNextSubpass = NULL;
+PFN_vkCmdNextSubpass2 glad_vkCmdNextSubpass2 = NULL;
+PFN_vkCmdPipelineBarrier glad_vkCmdPipelineBarrier = NULL;
+PFN_vkCmdPipelineBarrier2 glad_vkCmdPipelineBarrier2 = NULL;
+PFN_vkCmdPushConstants glad_vkCmdPushConstants = NULL;
+PFN_vkCmdResetEvent glad_vkCmdResetEvent = NULL;
+PFN_vkCmdResetEvent2 glad_vkCmdResetEvent2 = NULL;
+PFN_vkCmdResetQueryPool glad_vkCmdResetQueryPool = NULL;
+PFN_vkCmdResolveImage glad_vkCmdResolveImage = NULL;
+PFN_vkCmdResolveImage2 glad_vkCmdResolveImage2 = NULL;
+PFN_vkCmdSetBlendConstants glad_vkCmdSetBlendConstants = NULL;
+PFN_vkCmdSetCullMode glad_vkCmdSetCullMode = NULL;
+PFN_vkCmdSetDepthBias glad_vkCmdSetDepthBias = NULL;
+PFN_vkCmdSetDepthBiasEnable glad_vkCmdSetDepthBiasEnable = NULL;
+PFN_vkCmdSetDepthBounds glad_vkCmdSetDepthBounds = NULL;
+PFN_vkCmdSetDepthBoundsTestEnable glad_vkCmdSetDepthBoundsTestEnable = NULL;
+PFN_vkCmdSetDepthCompareOp glad_vkCmdSetDepthCompareOp = NULL;
+PFN_vkCmdSetDepthTestEnable glad_vkCmdSetDepthTestEnable = NULL;
+PFN_vkCmdSetDepthWriteEnable glad_vkCmdSetDepthWriteEnable = NULL;
+PFN_vkCmdSetDeviceMask glad_vkCmdSetDeviceMask = NULL;
+PFN_vkCmdSetEvent glad_vkCmdSetEvent = NULL;
+PFN_vkCmdSetEvent2 glad_vkCmdSetEvent2 = NULL;
+PFN_vkCmdSetFrontFace glad_vkCmdSetFrontFace = NULL;
+PFN_vkCmdSetLineWidth glad_vkCmdSetLineWidth = NULL;
+PFN_vkCmdSetPrimitiveRestartEnable glad_vkCmdSetPrimitiveRestartEnable = NULL;
+PFN_vkCmdSetPrimitiveTopology glad_vkCmdSetPrimitiveTopology = NULL;
+PFN_vkCmdSetRasterizerDiscardEnable glad_vkCmdSetRasterizerDiscardEnable = NULL;
+PFN_vkCmdSetScissor glad_vkCmdSetScissor = NULL;
+PFN_vkCmdSetScissorWithCount glad_vkCmdSetScissorWithCount = NULL;
+PFN_vkCmdSetStencilCompareMask glad_vkCmdSetStencilCompareMask = NULL;
+PFN_vkCmdSetStencilOp glad_vkCmdSetStencilOp = NULL;
+PFN_vkCmdSetStencilReference glad_vkCmdSetStencilReference = NULL;
+PFN_vkCmdSetStencilTestEnable glad_vkCmdSetStencilTestEnable = NULL;
+PFN_vkCmdSetStencilWriteMask glad_vkCmdSetStencilWriteMask = NULL;
+PFN_vkCmdSetViewport glad_vkCmdSetViewport = NULL;
+PFN_vkCmdSetViewportWithCount glad_vkCmdSetViewportWithCount = NULL;
+PFN_vkCmdUpdateBuffer glad_vkCmdUpdateBuffer = NULL;
+PFN_vkCmdWaitEvents glad_vkCmdWaitEvents = NULL;
+PFN_vkCmdWaitEvents2 glad_vkCmdWaitEvents2 = NULL;
+PFN_vkCmdWriteTimestamp glad_vkCmdWriteTimestamp = NULL;
+PFN_vkCmdWriteTimestamp2 glad_vkCmdWriteTimestamp2 = NULL;
+PFN_vkCreateBuffer glad_vkCreateBuffer = NULL;
+PFN_vkCreateBufferView glad_vkCreateBufferView = NULL;
+PFN_vkCreateCommandPool glad_vkCreateCommandPool = NULL;
+PFN_vkCreateComputePipelines glad_vkCreateComputePipelines = NULL;
+PFN_vkCreateDebugReportCallbackEXT glad_vkCreateDebugReportCallbackEXT = NULL;
+PFN_vkCreateDescriptorPool glad_vkCreateDescriptorPool = NULL;
+PFN_vkCreateDescriptorSetLayout glad_vkCreateDescriptorSetLayout = NULL;
+PFN_vkCreateDescriptorUpdateTemplate glad_vkCreateDescriptorUpdateTemplate = NULL;
+PFN_vkCreateDevice glad_vkCreateDevice = NULL;
+PFN_vkCreateEvent glad_vkCreateEvent = NULL;
+PFN_vkCreateFence glad_vkCreateFence = NULL;
+PFN_vkCreateFramebuffer glad_vkCreateFramebuffer = NULL;
+PFN_vkCreateGraphicsPipelines glad_vkCreateGraphicsPipelines = NULL;
+PFN_vkCreateImage glad_vkCreateImage = NULL;
+PFN_vkCreateImageView glad_vkCreateImageView = NULL;
+PFN_vkCreateInstance glad_vkCreateInstance = NULL;
+PFN_vkCreatePipelineCache glad_vkCreatePipelineCache = NULL;
+PFN_vkCreatePipelineLayout glad_vkCreatePipelineLayout = NULL;
+PFN_vkCreatePrivateDataSlot glad_vkCreatePrivateDataSlot = NULL;
+PFN_vkCreateQueryPool glad_vkCreateQueryPool = NULL;
+PFN_vkCreateRenderPass glad_vkCreateRenderPass = NULL;
+PFN_vkCreateRenderPass2 glad_vkCreateRenderPass2 = NULL;
+PFN_vkCreateSampler glad_vkCreateSampler = NULL;
+PFN_vkCreateSamplerYcbcrConversion glad_vkCreateSamplerYcbcrConversion = NULL;
+PFN_vkCreateSemaphore glad_vkCreateSemaphore = NULL;
+PFN_vkCreateShaderModule glad_vkCreateShaderModule = NULL;
+PFN_vkCreateSwapchainKHR glad_vkCreateSwapchainKHR = NULL;
+PFN_vkDebugReportMessageEXT glad_vkDebugReportMessageEXT = NULL;
+PFN_vkDestroyBuffer glad_vkDestroyBuffer = NULL;
+PFN_vkDestroyBufferView glad_vkDestroyBufferView = NULL;
+PFN_vkDestroyCommandPool glad_vkDestroyCommandPool = NULL;
+PFN_vkDestroyDebugReportCallbackEXT glad_vkDestroyDebugReportCallbackEXT = NULL;
+PFN_vkDestroyDescriptorPool glad_vkDestroyDescriptorPool = NULL;
+PFN_vkDestroyDescriptorSetLayout glad_vkDestroyDescriptorSetLayout = NULL;
+PFN_vkDestroyDescriptorUpdateTemplate glad_vkDestroyDescriptorUpdateTemplate = NULL;
+PFN_vkDestroyDevice glad_vkDestroyDevice = NULL;
+PFN_vkDestroyEvent glad_vkDestroyEvent = NULL;
+PFN_vkDestroyFence glad_vkDestroyFence = NULL;
+PFN_vkDestroyFramebuffer glad_vkDestroyFramebuffer = NULL;
+PFN_vkDestroyImage glad_vkDestroyImage = NULL;
+PFN_vkDestroyImageView glad_vkDestroyImageView = NULL;
+PFN_vkDestroyInstance glad_vkDestroyInstance = NULL;
+PFN_vkDestroyPipeline glad_vkDestroyPipeline = NULL;
+PFN_vkDestroyPipelineCache glad_vkDestroyPipelineCache = NULL;
+PFN_vkDestroyPipelineLayout glad_vkDestroyPipelineLayout = NULL;
+PFN_vkDestroyPrivateDataSlot glad_vkDestroyPrivateDataSlot = NULL;
+PFN_vkDestroyQueryPool glad_vkDestroyQueryPool = NULL;
+PFN_vkDestroyRenderPass glad_vkDestroyRenderPass = NULL;
+PFN_vkDestroySampler glad_vkDestroySampler = NULL;
+PFN_vkDestroySamplerYcbcrConversion glad_vkDestroySamplerYcbcrConversion = NULL;
+PFN_vkDestroySemaphore glad_vkDestroySemaphore = NULL;
+PFN_vkDestroyShaderModule glad_vkDestroyShaderModule = NULL;
+PFN_vkDestroySurfaceKHR glad_vkDestroySurfaceKHR = NULL;
+PFN_vkDestroySwapchainKHR glad_vkDestroySwapchainKHR = NULL;
+PFN_vkDeviceWaitIdle glad_vkDeviceWaitIdle = NULL;
+PFN_vkEndCommandBuffer glad_vkEndCommandBuffer = NULL;
+PFN_vkEnumerateDeviceExtensionProperties glad_vkEnumerateDeviceExtensionProperties = NULL;
+PFN_vkEnumerateDeviceLayerProperties glad_vkEnumerateDeviceLayerProperties = NULL;
+PFN_vkEnumerateInstanceExtensionProperties glad_vkEnumerateInstanceExtensionProperties = NULL;
+PFN_vkEnumerateInstanceLayerProperties glad_vkEnumerateInstanceLayerProperties = NULL;
+PFN_vkEnumerateInstanceVersion glad_vkEnumerateInstanceVersion = NULL;
+PFN_vkEnumeratePhysicalDeviceGroups glad_vkEnumeratePhysicalDeviceGroups = NULL;
+PFN_vkEnumeratePhysicalDevices glad_vkEnumeratePhysicalDevices = NULL;
+PFN_vkFlushMappedMemoryRanges glad_vkFlushMappedMemoryRanges = NULL;
+PFN_vkFreeCommandBuffers glad_vkFreeCommandBuffers = NULL;
+PFN_vkFreeDescriptorSets glad_vkFreeDescriptorSets = NULL;
+PFN_vkFreeMemory glad_vkFreeMemory = NULL;
+PFN_vkGetBufferDeviceAddress glad_vkGetBufferDeviceAddress = NULL;
+PFN_vkGetBufferMemoryRequirements glad_vkGetBufferMemoryRequirements = NULL;
+PFN_vkGetBufferMemoryRequirements2 glad_vkGetBufferMemoryRequirements2 = NULL;
+PFN_vkGetBufferOpaqueCaptureAddress glad_vkGetBufferOpaqueCaptureAddress = NULL;
+PFN_vkGetDescriptorSetLayoutSupport glad_vkGetDescriptorSetLayoutSupport = NULL;
+PFN_vkGetDeviceBufferMemoryRequirements glad_vkGetDeviceBufferMemoryRequirements = NULL;
+PFN_vkGetDeviceGroupPeerMemoryFeatures glad_vkGetDeviceGroupPeerMemoryFeatures = NULL;
+PFN_vkGetDeviceGroupPresentCapabilitiesKHR glad_vkGetDeviceGroupPresentCapabilitiesKHR = NULL;
+PFN_vkGetDeviceGroupSurfacePresentModesKHR glad_vkGetDeviceGroupSurfacePresentModesKHR = NULL;
+PFN_vkGetDeviceImageMemoryRequirements glad_vkGetDeviceImageMemoryRequirements = NULL;
+PFN_vkGetDeviceImageSparseMemoryRequirements glad_vkGetDeviceImageSparseMemoryRequirements = NULL;
+PFN_vkGetDeviceMemoryCommitment glad_vkGetDeviceMemoryCommitment = NULL;
+PFN_vkGetDeviceMemoryOpaqueCaptureAddress glad_vkGetDeviceMemoryOpaqueCaptureAddress = NULL;
+PFN_vkGetDeviceProcAddr glad_vkGetDeviceProcAddr = NULL;
+PFN_vkGetDeviceQueue glad_vkGetDeviceQueue = NULL;
+PFN_vkGetDeviceQueue2 glad_vkGetDeviceQueue2 = NULL;
+PFN_vkGetEventStatus glad_vkGetEventStatus = NULL;
+PFN_vkGetFenceStatus glad_vkGetFenceStatus = NULL;
+PFN_vkGetImageMemoryRequirements glad_vkGetImageMemoryRequirements = NULL;
+PFN_vkGetImageMemoryRequirements2 glad_vkGetImageMemoryRequirements2 = NULL;
+PFN_vkGetImageSparseMemoryRequirements glad_vkGetImageSparseMemoryRequirements = NULL;
+PFN_vkGetImageSparseMemoryRequirements2 glad_vkGetImageSparseMemoryRequirements2 = NULL;
+PFN_vkGetImageSubresourceLayout glad_vkGetImageSubresourceLayout = NULL;
+PFN_vkGetInstanceProcAddr glad_vkGetInstanceProcAddr = NULL;
+PFN_vkGetPhysicalDeviceExternalBufferProperties glad_vkGetPhysicalDeviceExternalBufferProperties = NULL;
+PFN_vkGetPhysicalDeviceExternalFenceProperties glad_vkGetPhysicalDeviceExternalFenceProperties = NULL;
+PFN_vkGetPhysicalDeviceExternalSemaphoreProperties glad_vkGetPhysicalDeviceExternalSemaphoreProperties = NULL;
+PFN_vkGetPhysicalDeviceFeatures glad_vkGetPhysicalDeviceFeatures = NULL;
+PFN_vkGetPhysicalDeviceFeatures2 glad_vkGetPhysicalDeviceFeatures2 = NULL;
+PFN_vkGetPhysicalDeviceFormatProperties glad_vkGetPhysicalDeviceFormatProperties = NULL;
+PFN_vkGetPhysicalDeviceFormatProperties2 glad_vkGetPhysicalDeviceFormatProperties2 = NULL;
+PFN_vkGetPhysicalDeviceImageFormatProperties glad_vkGetPhysicalDeviceImageFormatProperties = NULL;
+PFN_vkGetPhysicalDeviceImageFormatProperties2 glad_vkGetPhysicalDeviceImageFormatProperties2 = NULL;
+PFN_vkGetPhysicalDeviceMemoryProperties glad_vkGetPhysicalDeviceMemoryProperties = NULL;
+PFN_vkGetPhysicalDeviceMemoryProperties2 glad_vkGetPhysicalDeviceMemoryProperties2 = NULL;
+PFN_vkGetPhysicalDevicePresentRectanglesKHR glad_vkGetPhysicalDevicePresentRectanglesKHR = NULL;
+PFN_vkGetPhysicalDeviceProperties glad_vkGetPhysicalDeviceProperties = NULL;
+PFN_vkGetPhysicalDeviceProperties2 glad_vkGetPhysicalDeviceProperties2 = NULL;
+PFN_vkGetPhysicalDeviceQueueFamilyProperties glad_vkGetPhysicalDeviceQueueFamilyProperties = NULL;
+PFN_vkGetPhysicalDeviceQueueFamilyProperties2 glad_vkGetPhysicalDeviceQueueFamilyProperties2 = NULL;
+PFN_vkGetPhysicalDeviceSparseImageFormatProperties glad_vkGetPhysicalDeviceSparseImageFormatProperties = NULL;
+PFN_vkGetPhysicalDeviceSparseImageFormatProperties2 glad_vkGetPhysicalDeviceSparseImageFormatProperties2 = NULL;
+PFN_vkGetPhysicalDeviceSurfaceCapabilitiesKHR glad_vkGetPhysicalDeviceSurfaceCapabilitiesKHR = NULL;
+PFN_vkGetPhysicalDeviceSurfaceFormatsKHR glad_vkGetPhysicalDeviceSurfaceFormatsKHR = NULL;
+PFN_vkGetPhysicalDeviceSurfacePresentModesKHR glad_vkGetPhysicalDeviceSurfacePresentModesKHR = NULL;
+PFN_vkGetPhysicalDeviceSurfaceSupportKHR glad_vkGetPhysicalDeviceSurfaceSupportKHR = NULL;
+PFN_vkGetPhysicalDeviceToolProperties glad_vkGetPhysicalDeviceToolProperties = NULL;
+PFN_vkGetPipelineCacheData glad_vkGetPipelineCacheData = NULL;
+PFN_vkGetPrivateData glad_vkGetPrivateData = NULL;
+PFN_vkGetQueryPoolResults glad_vkGetQueryPoolResults = NULL;
+PFN_vkGetRenderAreaGranularity glad_vkGetRenderAreaGranularity = NULL;
+PFN_vkGetSemaphoreCounterValue glad_vkGetSemaphoreCounterValue = NULL;
+PFN_vkGetSwapchainImagesKHR glad_vkGetSwapchainImagesKHR = NULL;
+PFN_vkInvalidateMappedMemoryRanges glad_vkInvalidateMappedMemoryRanges = NULL;
+PFN_vkMapMemory glad_vkMapMemory = NULL;
+PFN_vkMergePipelineCaches glad_vkMergePipelineCaches = NULL;
+PFN_vkQueueBindSparse glad_vkQueueBindSparse = NULL;
+PFN_vkQueuePresentKHR glad_vkQueuePresentKHR = NULL;
+PFN_vkQueueSubmit glad_vkQueueSubmit = NULL;
+PFN_vkQueueSubmit2 glad_vkQueueSubmit2 = NULL;
+PFN_vkQueueWaitIdle glad_vkQueueWaitIdle = NULL;
+PFN_vkResetCommandBuffer glad_vkResetCommandBuffer = NULL;
+PFN_vkResetCommandPool glad_vkResetCommandPool = NULL;
+PFN_vkResetDescriptorPool glad_vkResetDescriptorPool = NULL;
+PFN_vkResetEvent glad_vkResetEvent = NULL;
+PFN_vkResetFences glad_vkResetFences = NULL;
+PFN_vkResetQueryPool glad_vkResetQueryPool = NULL;
+PFN_vkSetEvent glad_vkSetEvent = NULL;
+PFN_vkSetPrivateData glad_vkSetPrivateData = NULL;
+PFN_vkSignalSemaphore glad_vkSignalSemaphore = NULL;
+PFN_vkTrimCommandPool glad_vkTrimCommandPool = NULL;
+PFN_vkUnmapMemory glad_vkUnmapMemory = NULL;
+PFN_vkUpdateDescriptorSetWithTemplate glad_vkUpdateDescriptorSetWithTemplate = NULL;
+PFN_vkUpdateDescriptorSets glad_vkUpdateDescriptorSets = NULL;
+PFN_vkWaitForFences glad_vkWaitForFences = NULL;
+PFN_vkWaitSemaphores glad_vkWaitSemaphores = NULL;
+
+
+static void glad_vk_load_VK_VERSION_1_0( GLADuserptrloadfunc load, void* userptr) {
+    if(!GLAD_VK_VERSION_1_0) return;
+    glad_vkAllocateCommandBuffers = (PFN_vkAllocateCommandBuffers) load(userptr, "vkAllocateCommandBuffers");
+    glad_vkAllocateDescriptorSets = (PFN_vkAllocateDescriptorSets) load(userptr, "vkAllocateDescriptorSets");
+    glad_vkAllocateMemory = (PFN_vkAllocateMemory) load(userptr, "vkAllocateMemory");
+    glad_vkBeginCommandBuffer = (PFN_vkBeginCommandBuffer) load(userptr, "vkBeginCommandBuffer");
+    glad_vkBindBufferMemory = (PFN_vkBindBufferMemory) load(userptr, "vkBindBufferMemory");
+    glad_vkBindImageMemory = (PFN_vkBindImageMemory) load(userptr, "vkBindImageMemory");
+    glad_vkCmdBeginQuery = (PFN_vkCmdBeginQuery) load(userptr, "vkCmdBeginQuery");
+    glad_vkCmdBeginRenderPass = (PFN_vkCmdBeginRenderPass) load(userptr, "vkCmdBeginRenderPass");
+    glad_vkCmdBindDescriptorSets = (PFN_vkCmdBindDescriptorSets) load(userptr, "vkCmdBindDescriptorSets");
+    glad_vkCmdBindIndexBuffer = (PFN_vkCmdBindIndexBuffer) load(userptr, "vkCmdBindIndexBuffer");
+    glad_vkCmdBindPipeline = (PFN_vkCmdBindPipeline) load(userptr, "vkCmdBindPipeline");
+    glad_vkCmdBindVertexBuffers = (PFN_vkCmdBindVertexBuffers) load(userptr, "vkCmdBindVertexBuffers");
+    glad_vkCmdBlitImage = (PFN_vkCmdBlitImage) load(userptr, "vkCmdBlitImage");
+    glad_vkCmdClearAttachments = (PFN_vkCmdClearAttachments) load(userptr, "vkCmdClearAttachments");
+    glad_vkCmdClearColorImage = (PFN_vkCmdClearColorImage) load(userptr, "vkCmdClearColorImage");
+    glad_vkCmdClearDepthStencilImage = (PFN_vkCmdClearDepthStencilImage) load(userptr, "vkCmdClearDepthStencilImage");
+    glad_vkCmdCopyBuffer = (PFN_vkCmdCopyBuffer) load(userptr, "vkCmdCopyBuffer");
+    glad_vkCmdCopyBufferToImage = (PFN_vkCmdCopyBufferToImage) load(userptr, "vkCmdCopyBufferToImage");
+    glad_vkCmdCopyImage = (PFN_vkCmdCopyImage) load(userptr, "vkCmdCopyImage");
+    glad_vkCmdCopyImageToBuffer = (PFN_vkCmdCopyImageToBuffer) load(userptr, "vkCmdCopyImageToBuffer");
+    glad_vkCmdCopyQueryPoolResults = (PFN_vkCmdCopyQueryPoolResults) load(userptr, "vkCmdCopyQueryPoolResults");
+    glad_vkCmdDispatch = (PFN_vkCmdDispatch) load(userptr, "vkCmdDispatch");
+    glad_vkCmdDispatchIndirect = (PFN_vkCmdDispatchIndirect) load(userptr, "vkCmdDispatchIndirect");
+    glad_vkCmdDraw = (PFN_vkCmdDraw) load(userptr, "vkCmdDraw");
+    glad_vkCmdDrawIndexed = (PFN_vkCmdDrawIndexed) load(userptr, "vkCmdDrawIndexed");
+    glad_vkCmdDrawIndexedIndirect = (PFN_vkCmdDrawIndexedIndirect) load(userptr, "vkCmdDrawIndexedIndirect");
+    glad_vkCmdDrawIndirect = (PFN_vkCmdDrawIndirect) load(userptr, "vkCmdDrawIndirect");
+    glad_vkCmdEndQuery = (PFN_vkCmdEndQuery) load(userptr, "vkCmdEndQuery");
+    glad_vkCmdEndRenderPass = (PFN_vkCmdEndRenderPass) load(userptr, "vkCmdEndRenderPass");
+    glad_vkCmdExecuteCommands = (PFN_vkCmdExecuteCommands) load(userptr, "vkCmdExecuteCommands");
+    glad_vkCmdFillBuffer = (PFN_vkCmdFillBuffer) load(userptr, "vkCmdFillBuffer");
+    glad_vkCmdNextSubpass = (PFN_vkCmdNextSubpass) load(userptr, "vkCmdNextSubpass");
+    glad_vkCmdPipelineBarrier = (PFN_vkCmdPipelineBarrier) load(userptr, "vkCmdPipelineBarrier");
+    glad_vkCmdPushConstants = (PFN_vkCmdPushConstants) load(userptr, "vkCmdPushConstants");
+    glad_vkCmdResetEvent = (PFN_vkCmdResetEvent) load(userptr, "vkCmdResetEvent");
+    glad_vkCmdResetQueryPool = (PFN_vkCmdResetQueryPool) load(userptr, "vkCmdResetQueryPool");
+    glad_vkCmdResolveImage = (PFN_vkCmdResolveImage) load(userptr, "vkCmdResolveImage");
+    glad_vkCmdSetBlendConstants = (PFN_vkCmdSetBlendConstants) load(userptr, "vkCmdSetBlendConstants");
+    glad_vkCmdSetDepthBias = (PFN_vkCmdSetDepthBias) load(userptr, "vkCmdSetDepthBias");
+    glad_vkCmdSetDepthBounds = (PFN_vkCmdSetDepthBounds) load(userptr, "vkCmdSetDepthBounds");
+    glad_vkCmdSetEvent = (PFN_vkCmdSetEvent) load(userptr, "vkCmdSetEvent");
+    glad_vkCmdSetLineWidth = (PFN_vkCmdSetLineWidth) load(userptr, "vkCmdSetLineWidth");
+    glad_vkCmdSetScissor = (PFN_vkCmdSetScissor) load(userptr, "vkCmdSetScissor");
+    glad_vkCmdSetStencilCompareMask = (PFN_vkCmdSetStencilCompareMask) load(userptr, "vkCmdSetStencilCompareMask");
+    glad_vkCmdSetStencilReference = (PFN_vkCmdSetStencilReference) load(userptr, "vkCmdSetStencilReference");
+    glad_vkCmdSetStencilWriteMask = (PFN_vkCmdSetStencilWriteMask) load(userptr, "vkCmdSetStencilWriteMask");
+    glad_vkCmdSetViewport = (PFN_vkCmdSetViewport) load(userptr, "vkCmdSetViewport");
+    glad_vkCmdUpdateBuffer = (PFN_vkCmdUpdateBuffer) load(userptr, "vkCmdUpdateBuffer");
+    glad_vkCmdWaitEvents = (PFN_vkCmdWaitEvents) load(userptr, "vkCmdWaitEvents");
+    glad_vkCmdWriteTimestamp = (PFN_vkCmdWriteTimestamp) load(userptr, "vkCmdWriteTimestamp");
+    glad_vkCreateBuffer = (PFN_vkCreateBuffer) load(userptr, "vkCreateBuffer");
+    glad_vkCreateBufferView = (PFN_vkCreateBufferView) load(userptr, "vkCreateBufferView");
+    glad_vkCreateCommandPool = (PFN_vkCreateCommandPool) load(userptr, "vkCreateCommandPool");
+    glad_vkCreateComputePipelines = (PFN_vkCreateComputePipelines) load(userptr, "vkCreateComputePipelines");
+    glad_vkCreateDescriptorPool = (PFN_vkCreateDescriptorPool) load(userptr, "vkCreateDescriptorPool");
+    glad_vkCreateDescriptorSetLayout = (PFN_vkCreateDescriptorSetLayout) load(userptr, "vkCreateDescriptorSetLayout");
+    glad_vkCreateDevice = (PFN_vkCreateDevice) load(userptr, "vkCreateDevice");
+    glad_vkCreateEvent = (PFN_vkCreateEvent) load(userptr, "vkCreateEvent");
+    glad_vkCreateFence = (PFN_vkCreateFence) load(userptr, "vkCreateFence");
+    glad_vkCreateFramebuffer = (PFN_vkCreateFramebuffer) load(userptr, "vkCreateFramebuffer");
+    glad_vkCreateGraphicsPipelines = (PFN_vkCreateGraphicsPipelines) load(userptr, "vkCreateGraphicsPipelines");
+    glad_vkCreateImage = (PFN_vkCreateImage) load(userptr, "vkCreateImage");
+    glad_vkCreateImageView = (PFN_vkCreateImageView) load(userptr, "vkCreateImageView");
+    glad_vkCreateInstance = (PFN_vkCreateInstance) load(userptr, "vkCreateInstance");
+    glad_vkCreatePipelineCache = (PFN_vkCreatePipelineCache) load(userptr, "vkCreatePipelineCache");
+    glad_vkCreatePipelineLayout = (PFN_vkCreatePipelineLayout) load(userptr, "vkCreatePipelineLayout");
+    glad_vkCreateQueryPool = (PFN_vkCreateQueryPool) load(userptr, "vkCreateQueryPool");
+    glad_vkCreateRenderPass = (PFN_vkCreateRenderPass) load(userptr, "vkCreateRenderPass");
+    glad_vkCreateSampler = (PFN_vkCreateSampler) load(userptr, "vkCreateSampler");
+    glad_vkCreateSemaphore = (PFN_vkCreateSemaphore) load(userptr, "vkCreateSemaphore");
+    glad_vkCreateShaderModule = (PFN_vkCreateShaderModule) load(userptr, "vkCreateShaderModule");
+    glad_vkDestroyBuffer = (PFN_vkDestroyBuffer) load(userptr, "vkDestroyBuffer");
+    glad_vkDestroyBufferView = (PFN_vkDestroyBufferView) load(userptr, "vkDestroyBufferView");
+    glad_vkDestroyCommandPool = (PFN_vkDestroyCommandPool) load(userptr, "vkDestroyCommandPool");
+    glad_vkDestroyDescriptorPool = (PFN_vkDestroyDescriptorPool) load(userptr, "vkDestroyDescriptorPool");
+    glad_vkDestroyDescriptorSetLayout = (PFN_vkDestroyDescriptorSetLayout) load(userptr, "vkDestroyDescriptorSetLayout");
+    glad_vkDestroyDevice = (PFN_vkDestroyDevice) load(userptr, "vkDestroyDevice");
+    glad_vkDestroyEvent = (PFN_vkDestroyEvent) load(userptr, "vkDestroyEvent");
+    glad_vkDestroyFence = (PFN_vkDestroyFence) load(userptr, "vkDestroyFence");
+    glad_vkDestroyFramebuffer = (PFN_vkDestroyFramebuffer) load(userptr, "vkDestroyFramebuffer");
+    glad_vkDestroyImage = (PFN_vkDestroyImage) load(userptr, "vkDestroyImage");
+    glad_vkDestroyImageView = (PFN_vkDestroyImageView) load(userptr, "vkDestroyImageView");
+    glad_vkDestroyInstance = (PFN_vkDestroyInstance) load(userptr, "vkDestroyInstance");
+    glad_vkDestroyPipeline = (PFN_vkDestroyPipeline) load(userptr, "vkDestroyPipeline");
+    glad_vkDestroyPipelineCache = (PFN_vkDestroyPipelineCache) load(userptr, "vkDestroyPipelineCache");
+    glad_vkDestroyPipelineLayout = (PFN_vkDestroyPipelineLayout) load(userptr, "vkDestroyPipelineLayout");
+    glad_vkDestroyQueryPool = (PFN_vkDestroyQueryPool) load(userptr, "vkDestroyQueryPool");
+    glad_vkDestroyRenderPass = (PFN_vkDestroyRenderPass) load(userptr, "vkDestroyRenderPass");
+    glad_vkDestroySampler = (PFN_vkDestroySampler) load(userptr, "vkDestroySampler");
+    glad_vkDestroySemaphore = (PFN_vkDestroySemaphore) load(userptr, "vkDestroySemaphore");
+    glad_vkDestroyShaderModule = (PFN_vkDestroyShaderModule) load(userptr, "vkDestroyShaderModule");
+    glad_vkDeviceWaitIdle = (PFN_vkDeviceWaitIdle) load(userptr, "vkDeviceWaitIdle");
+    glad_vkEndCommandBuffer = (PFN_vkEndCommandBuffer) load(userptr, "vkEndCommandBuffer");
+    glad_vkEnumerateDeviceExtensionProperties = (PFN_vkEnumerateDeviceExtensionProperties) load(userptr, "vkEnumerateDeviceExtensionProperties");
+    glad_vkEnumerateDeviceLayerProperties = (PFN_vkEnumerateDeviceLayerProperties) load(userptr, "vkEnumerateDeviceLayerProperties");
+    glad_vkEnumerateInstanceExtensionProperties = (PFN_vkEnumerateInstanceExtensionProperties) load(userptr, "vkEnumerateInstanceExtensionProperties");
+    glad_vkEnumerateInstanceLayerProperties = (PFN_vkEnumerateInstanceLayerProperties) load(userptr, "vkEnumerateInstanceLayerProperties");
+    glad_vkEnumeratePhysicalDevices = (PFN_vkEnumeratePhysicalDevices) load(userptr, "vkEnumeratePhysicalDevices");
+    glad_vkFlushMappedMemoryRanges = (PFN_vkFlushMappedMemoryRanges) load(userptr, "vkFlushMappedMemoryRanges");
+    glad_vkFreeCommandBuffers = (PFN_vkFreeCommandBuffers) load(userptr, "vkFreeCommandBuffers");
+    glad_vkFreeDescriptorSets = (PFN_vkFreeDescriptorSets) load(userptr, "vkFreeDescriptorSets");
+    glad_vkFreeMemory = (PFN_vkFreeMemory) load(userptr, "vkFreeMemory");
+    glad_vkGetBufferMemoryRequirements = (PFN_vkGetBufferMemoryRequirements) load(userptr, "vkGetBufferMemoryRequirements");
+    glad_vkGetDeviceMemoryCommitment = (PFN_vkGetDeviceMemoryCommitment) load(userptr, "vkGetDeviceMemoryCommitment");
+    glad_vkGetDeviceProcAddr = (PFN_vkGetDeviceProcAddr) load(userptr, "vkGetDeviceProcAddr");
+    glad_vkGetDeviceQueue = (PFN_vkGetDeviceQueue) load(userptr, "vkGetDeviceQueue");
+    glad_vkGetEventStatus = (PFN_vkGetEventStatus) load(userptr, "vkGetEventStatus");
+    glad_vkGetFenceStatus = (PFN_vkGetFenceStatus) load(userptr, "vkGetFenceStatus");
+    glad_vkGetImageMemoryRequirements = (PFN_vkGetImageMemoryRequirements) load(userptr, "vkGetImageMemoryRequirements");
+    glad_vkGetImageSparseMemoryRequirements = (PFN_vkGetImageSparseMemoryRequirements) load(userptr, "vkGetImageSparseMemoryRequirements");
+    glad_vkGetImageSubresourceLayout = (PFN_vkGetImageSubresourceLayout) load(userptr, "vkGetImageSubresourceLayout");
+    glad_vkGetInstanceProcAddr = (PFN_vkGetInstanceProcAddr) load(userptr, "vkGetInstanceProcAddr");
+    glad_vkGetPhysicalDeviceFeatures = (PFN_vkGetPhysicalDeviceFeatures) load(userptr, "vkGetPhysicalDeviceFeatures");
+    glad_vkGetPhysicalDeviceFormatProperties = (PFN_vkGetPhysicalDeviceFormatProperties) load(userptr, "vkGetPhysicalDeviceFormatProperties");
+    glad_vkGetPhysicalDeviceImageFormatProperties = (PFN_vkGetPhysicalDeviceImageFormatProperties) load(userptr, "vkGetPhysicalDeviceImageFormatProperties");
+    glad_vkGetPhysicalDeviceMemoryProperties = (PFN_vkGetPhysicalDeviceMemoryProperties) load(userptr, "vkGetPhysicalDeviceMemoryProperties");
+    glad_vkGetPhysicalDeviceProperties = (PFN_vkGetPhysicalDeviceProperties) load(userptr, "vkGetPhysicalDeviceProperties");
+    glad_vkGetPhysicalDeviceQueueFamilyProperties = (PFN_vkGetPhysicalDeviceQueueFamilyProperties) load(userptr, "vkGetPhysicalDeviceQueueFamilyProperties");
+    glad_vkGetPhysicalDeviceSparseImageFormatProperties = (PFN_vkGetPhysicalDeviceSparseImageFormatProperties) load(userptr, "vkGetPhysicalDeviceSparseImageFormatProperties");
+    glad_vkGetPipelineCacheData = (PFN_vkGetPipelineCacheData) load(userptr, "vkGetPipelineCacheData");
+    glad_vkGetQueryPoolResults = (PFN_vkGetQueryPoolResults) load(userptr, "vkGetQueryPoolResults");
+    glad_vkGetRenderAreaGranularity = (PFN_vkGetRenderAreaGranularity) load(userptr, "vkGetRenderAreaGranularity");
+    glad_vkInvalidateMappedMemoryRanges = (PFN_vkInvalidateMappedMemoryRanges) load(userptr, "vkInvalidateMappedMemoryRanges");
+    glad_vkMapMemory = (PFN_vkMapMemory) load(userptr, "vkMapMemory");
+    glad_vkMergePipelineCaches = (PFN_vkMergePipelineCaches) load(userptr, "vkMergePipelineCaches");
+    glad_vkQueueBindSparse = (PFN_vkQueueBindSparse) load(userptr, "vkQueueBindSparse");
+    glad_vkQueueSubmit = (PFN_vkQueueSubmit) load(userptr, "vkQueueSubmit");
+    glad_vkQueueWaitIdle = (PFN_vkQueueWaitIdle) load(userptr, "vkQueueWaitIdle");
+    glad_vkResetCommandBuffer = (PFN_vkResetCommandBuffer) load(userptr, "vkResetCommandBuffer");
+    glad_vkResetCommandPool = (PFN_vkResetCommandPool) load(userptr, "vkResetCommandPool");
+    glad_vkResetDescriptorPool = (PFN_vkResetDescriptorPool) load(userptr, "vkResetDescriptorPool");
+    glad_vkResetEvent = (PFN_vkResetEvent) load(userptr, "vkResetEvent");
+    glad_vkResetFences = (PFN_vkResetFences) load(userptr, "vkResetFences");
+    glad_vkSetEvent = (PFN_vkSetEvent) load(userptr, "vkSetEvent");
+    glad_vkUnmapMemory = (PFN_vkUnmapMemory) load(userptr, "vkUnmapMemory");
+    glad_vkUpdateDescriptorSets = (PFN_vkUpdateDescriptorSets) load(userptr, "vkUpdateDescriptorSets");
+    glad_vkWaitForFences = (PFN_vkWaitForFences) load(userptr, "vkWaitForFences");
+}
+static void glad_vk_load_VK_VERSION_1_1( GLADuserptrloadfunc load, void* userptr) {
+    if(!GLAD_VK_VERSION_1_1) return;
+    glad_vkBindBufferMemory2 = (PFN_vkBindBufferMemory2) load(userptr, "vkBindBufferMemory2");
+    glad_vkBindImageMemory2 = (PFN_vkBindImageMemory2) load(userptr, "vkBindImageMemory2");
+    glad_vkCmdDispatchBase = (PFN_vkCmdDispatchBase) load(userptr, "vkCmdDispatchBase");
+    glad_vkCmdSetDeviceMask = (PFN_vkCmdSetDeviceMask) load(userptr, "vkCmdSetDeviceMask");
+    glad_vkCreateDescriptorUpdateTemplate = (PFN_vkCreateDescriptorUpdateTemplate) load(userptr, "vkCreateDescriptorUpdateTemplate");
+    glad_vkCreateSamplerYcbcrConversion = (PFN_vkCreateSamplerYcbcrConversion) load(userptr, "vkCreateSamplerYcbcrConversion");
+    glad_vkDestroyDescriptorUpdateTemplate = (PFN_vkDestroyDescriptorUpdateTemplate) load(userptr, "vkDestroyDescriptorUpdateTemplate");
+    glad_vkDestroySamplerYcbcrConversion = (PFN_vkDestroySamplerYcbcrConversion) load(userptr, "vkDestroySamplerYcbcrConversion");
+    glad_vkEnumerateInstanceVersion = (PFN_vkEnumerateInstanceVersion) load(userptr, "vkEnumerateInstanceVersion");
+    glad_vkEnumeratePhysicalDeviceGroups = (PFN_vkEnumeratePhysicalDeviceGroups) load(userptr, "vkEnumeratePhysicalDeviceGroups");
+    glad_vkGetBufferMemoryRequirements2 = (PFN_vkGetBufferMemoryRequirements2) load(userptr, "vkGetBufferMemoryRequirements2");
+    glad_vkGetDescriptorSetLayoutSupport = (PFN_vkGetDescriptorSetLayoutSupport) load(userptr, "vkGetDescriptorSetLayoutSupport");
+    glad_vkGetDeviceGroupPeerMemoryFeatures = (PFN_vkGetDeviceGroupPeerMemoryFeatures) load(userptr, "vkGetDeviceGroupPeerMemoryFeatures");
+    glad_vkGetDeviceQueue2 = (PFN_vkGetDeviceQueue2) load(userptr, "vkGetDeviceQueue2");
+    glad_vkGetImageMemoryRequirements2 = (PFN_vkGetImageMemoryRequirements2) load(userptr, "vkGetImageMemoryRequirements2");
+    glad_vkGetImageSparseMemoryRequirements2 = (PFN_vkGetImageSparseMemoryRequirements2) load(userptr, "vkGetImageSparseMemoryRequirements2");
+    glad_vkGetPhysicalDeviceExternalBufferProperties = (PFN_vkGetPhysicalDeviceExternalBufferProperties) load(userptr, "vkGetPhysicalDeviceExternalBufferProperties");
+    glad_vkGetPhysicalDeviceExternalFenceProperties = (PFN_vkGetPhysicalDeviceExternalFenceProperties) load(userptr, "vkGetPhysicalDeviceExternalFenceProperties");
+    glad_vkGetPhysicalDeviceExternalSemaphoreProperties = (PFN_vkGetPhysicalDeviceExternalSemaphoreProperties) load(userptr, "vkGetPhysicalDeviceExternalSemaphoreProperties");
+    glad_vkGetPhysicalDeviceFeatures2 = (PFN_vkGetPhysicalDeviceFeatures2) load(userptr, "vkGetPhysicalDeviceFeatures2");
+    glad_vkGetPhysicalDeviceFormatProperties2 = (PFN_vkGetPhysicalDeviceFormatProperties2) load(userptr, "vkGetPhysicalDeviceFormatProperties2");
+    glad_vkGetPhysicalDeviceImageFormatProperties2 = (PFN_vkGetPhysicalDeviceImageFormatProperties2) load(userptr, "vkGetPhysicalDeviceImageFormatProperties2");
+    glad_vkGetPhysicalDeviceMemoryProperties2 = (PFN_vkGetPhysicalDeviceMemoryProperties2) load(userptr, "vkGetPhysicalDeviceMemoryProperties2");
+    glad_vkGetPhysicalDeviceProperties2 = (PFN_vkGetPhysicalDeviceProperties2) load(userptr, "vkGetPhysicalDeviceProperties2");
+    glad_vkGetPhysicalDeviceQueueFamilyProperties2 = (PFN_vkGetPhysicalDeviceQueueFamilyProperties2) load(userptr, "vkGetPhysicalDeviceQueueFamilyProperties2");
+    glad_vkGetPhysicalDeviceSparseImageFormatProperties2 = (PFN_vkGetPhysicalDeviceSparseImageFormatProperties2) load(userptr, "vkGetPhysicalDeviceSparseImageFormatProperties2");
+    glad_vkTrimCommandPool = (PFN_vkTrimCommandPool) load(userptr, "vkTrimCommandPool");
+    glad_vkUpdateDescriptorSetWithTemplate = (PFN_vkUpdateDescriptorSetWithTemplate) load(userptr, "vkUpdateDescriptorSetWithTemplate");
+}
+static void glad_vk_load_VK_VERSION_1_2( GLADuserptrloadfunc load, void* userptr) {
+    if(!GLAD_VK_VERSION_1_2) return;
+    glad_vkCmdBeginRenderPass2 = (PFN_vkCmdBeginRenderPass2) load(userptr, "vkCmdBeginRenderPass2");
+    glad_vkCmdDrawIndexedIndirectCount = (PFN_vkCmdDrawIndexedIndirectCount) load(userptr, "vkCmdDrawIndexedIndirectCount");
+    glad_vkCmdDrawIndirectCount = (PFN_vkCmdDrawIndirectCount) load(userptr, "vkCmdDrawIndirectCount");
+    glad_vkCmdEndRenderPass2 = (PFN_vkCmdEndRenderPass2) load(userptr, "vkCmdEndRenderPass2");
+    glad_vkCmdNextSubpass2 = (PFN_vkCmdNextSubpass2) load(userptr, "vkCmdNextSubpass2");
+    glad_vkCreateRenderPass2 = (PFN_vkCreateRenderPass2) load(userptr, "vkCreateRenderPass2");
+    glad_vkGetBufferDeviceAddress = (PFN_vkGetBufferDeviceAddress) load(userptr, "vkGetBufferDeviceAddress");
+    glad_vkGetBufferOpaqueCaptureAddress = (PFN_vkGetBufferOpaqueCaptureAddress) load(userptr, "vkGetBufferOpaqueCaptureAddress");
+    glad_vkGetDeviceMemoryOpaqueCaptureAddress = (PFN_vkGetDeviceMemoryOpaqueCaptureAddress) load(userptr, "vkGetDeviceMemoryOpaqueCaptureAddress");
+    glad_vkGetSemaphoreCounterValue = (PFN_vkGetSemaphoreCounterValue) load(userptr, "vkGetSemaphoreCounterValue");
+    glad_vkResetQueryPool = (PFN_vkResetQueryPool) load(userptr, "vkResetQueryPool");
+    glad_vkSignalSemaphore = (PFN_vkSignalSemaphore) load(userptr, "vkSignalSemaphore");
+    glad_vkWaitSemaphores = (PFN_vkWaitSemaphores) load(userptr, "vkWaitSemaphores");
+}
+static void glad_vk_load_VK_VERSION_1_3( GLADuserptrloadfunc load, void* userptr) {
+    if(!GLAD_VK_VERSION_1_3) return;
+    glad_vkCmdBeginRendering = (PFN_vkCmdBeginRendering) load(userptr, "vkCmdBeginRendering");
+    glad_vkCmdBindVertexBuffers2 = (PFN_vkCmdBindVertexBuffers2) load(userptr, "vkCmdBindVertexBuffers2");
+    glad_vkCmdBlitImage2 = (PFN_vkCmdBlitImage2) load(userptr, "vkCmdBlitImage2");
+    glad_vkCmdCopyBuffer2 = (PFN_vkCmdCopyBuffer2) load(userptr, "vkCmdCopyBuffer2");
+    glad_vkCmdCopyBufferToImage2 = (PFN_vkCmdCopyBufferToImage2) load(userptr, "vkCmdCopyBufferToImage2");
+    glad_vkCmdCopyImage2 = (PFN_vkCmdCopyImage2) load(userptr, "vkCmdCopyImage2");
+    glad_vkCmdCopyImageToBuffer2 = (PFN_vkCmdCopyImageToBuffer2) load(userptr, "vkCmdCopyImageToBuffer2");
+    glad_vkCmdEndRendering = (PFN_vkCmdEndRendering) load(userptr, "vkCmdEndRendering");
+    glad_vkCmdPipelineBarrier2 = (PFN_vkCmdPipelineBarrier2) load(userptr, "vkCmdPipelineBarrier2");
+    glad_vkCmdResetEvent2 = (PFN_vkCmdResetEvent2) load(userptr, "vkCmdResetEvent2");
+    glad_vkCmdResolveImage2 = (PFN_vkCmdResolveImage2) load(userptr, "vkCmdResolveImage2");
+    glad_vkCmdSetCullMode = (PFN_vkCmdSetCullMode) load(userptr, "vkCmdSetCullMode");
+    glad_vkCmdSetDepthBiasEnable = (PFN_vkCmdSetDepthBiasEnable) load(userptr, "vkCmdSetDepthBiasEnable");
+    glad_vkCmdSetDepthBoundsTestEnable = (PFN_vkCmdSetDepthBoundsTestEnable) load(userptr, "vkCmdSetDepthBoundsTestEnable");
+    glad_vkCmdSetDepthCompareOp = (PFN_vkCmdSetDepthCompareOp) load(userptr, "vkCmdSetDepthCompareOp");
+    glad_vkCmdSetDepthTestEnable = (PFN_vkCmdSetDepthTestEnable) load(userptr, "vkCmdSetDepthTestEnable");
+    glad_vkCmdSetDepthWriteEnable = (PFN_vkCmdSetDepthWriteEnable) load(userptr, "vkCmdSetDepthWriteEnable");
+    glad_vkCmdSetEvent2 = (PFN_vkCmdSetEvent2) load(userptr, "vkCmdSetEvent2");
+    glad_vkCmdSetFrontFace = (PFN_vkCmdSetFrontFace) load(userptr, "vkCmdSetFrontFace");
+    glad_vkCmdSetPrimitiveRestartEnable = (PFN_vkCmdSetPrimitiveRestartEnable) load(userptr, "vkCmdSetPrimitiveRestartEnable");
+    glad_vkCmdSetPrimitiveTopology = (PFN_vkCmdSetPrimitiveTopology) load(userptr, "vkCmdSetPrimitiveTopology");
+    glad_vkCmdSetRasterizerDiscardEnable = (PFN_vkCmdSetRasterizerDiscardEnable) load(userptr, "vkCmdSetRasterizerDiscardEnable");
+    glad_vkCmdSetScissorWithCount = (PFN_vkCmdSetScissorWithCount) load(userptr, "vkCmdSetScissorWithCount");
+    glad_vkCmdSetStencilOp = (PFN_vkCmdSetStencilOp) load(userptr, "vkCmdSetStencilOp");
+    glad_vkCmdSetStencilTestEnable = (PFN_vkCmdSetStencilTestEnable) load(userptr, "vkCmdSetStencilTestEnable");
+    glad_vkCmdSetViewportWithCount = (PFN_vkCmdSetViewportWithCount) load(userptr, "vkCmdSetViewportWithCount");
+    glad_vkCmdWaitEvents2 = (PFN_vkCmdWaitEvents2) load(userptr, "vkCmdWaitEvents2");
+    glad_vkCmdWriteTimestamp2 = (PFN_vkCmdWriteTimestamp2) load(userptr, "vkCmdWriteTimestamp2");
+    glad_vkCreatePrivateDataSlot = (PFN_vkCreatePrivateDataSlot) load(userptr, "vkCreatePrivateDataSlot");
+    glad_vkDestroyPrivateDataSlot = (PFN_vkDestroyPrivateDataSlot) load(userptr, "vkDestroyPrivateDataSlot");
+    glad_vkGetDeviceBufferMemoryRequirements = (PFN_vkGetDeviceBufferMemoryRequirements) load(userptr, "vkGetDeviceBufferMemoryRequirements");
+    glad_vkGetDeviceImageMemoryRequirements = (PFN_vkGetDeviceImageMemoryRequirements) load(userptr, "vkGetDeviceImageMemoryRequirements");
+    glad_vkGetDeviceImageSparseMemoryRequirements = (PFN_vkGetDeviceImageSparseMemoryRequirements) load(userptr, "vkGetDeviceImageSparseMemoryRequirements");
+    glad_vkGetPhysicalDeviceToolProperties = (PFN_vkGetPhysicalDeviceToolProperties) load(userptr, "vkGetPhysicalDeviceToolProperties");
+    glad_vkGetPrivateData = (PFN_vkGetPrivateData) load(userptr, "vkGetPrivateData");
+    glad_vkQueueSubmit2 = (PFN_vkQueueSubmit2) load(userptr, "vkQueueSubmit2");
+    glad_vkSetPrivateData = (PFN_vkSetPrivateData) load(userptr, "vkSetPrivateData");
+}
+static void glad_vk_load_VK_EXT_debug_report( GLADuserptrloadfunc load, void* userptr) {
+    if(!GLAD_VK_EXT_debug_report) return;
+    glad_vkCreateDebugReportCallbackEXT = (PFN_vkCreateDebugReportCallbackEXT) load(userptr, "vkCreateDebugReportCallbackEXT");
+    glad_vkDebugReportMessageEXT = (PFN_vkDebugReportMessageEXT) load(userptr, "vkDebugReportMessageEXT");
+    glad_vkDestroyDebugReportCallbackEXT = (PFN_vkDestroyDebugReportCallbackEXT) load(userptr, "vkDestroyDebugReportCallbackEXT");
+}
+static void glad_vk_load_VK_KHR_surface( GLADuserptrloadfunc load, void* userptr) {
+    if(!GLAD_VK_KHR_surface) return;
+    glad_vkDestroySurfaceKHR = (PFN_vkDestroySurfaceKHR) load(userptr, "vkDestroySurfaceKHR");
+    glad_vkGetPhysicalDeviceSurfaceCapabilitiesKHR = (PFN_vkGetPhysicalDeviceSurfaceCapabilitiesKHR) load(userptr, "vkGetPhysicalDeviceSurfaceCapabilitiesKHR");
+    glad_vkGetPhysicalDeviceSurfaceFormatsKHR = (PFN_vkGetPhysicalDeviceSurfaceFormatsKHR) load(userptr, "vkGetPhysicalDeviceSurfaceFormatsKHR");
+    glad_vkGetPhysicalDeviceSurfacePresentModesKHR = (PFN_vkGetPhysicalDeviceSurfacePresentModesKHR) load(userptr, "vkGetPhysicalDeviceSurfacePresentModesKHR");
+    glad_vkGetPhysicalDeviceSurfaceSupportKHR = (PFN_vkGetPhysicalDeviceSurfaceSupportKHR) load(userptr, "vkGetPhysicalDeviceSurfaceSupportKHR");
+}
+static void glad_vk_load_VK_KHR_swapchain( GLADuserptrloadfunc load, void* userptr) {
+    if(!GLAD_VK_KHR_swapchain) return;
+    glad_vkAcquireNextImage2KHR = (PFN_vkAcquireNextImage2KHR) load(userptr, "vkAcquireNextImage2KHR");
+    glad_vkAcquireNextImageKHR = (PFN_vkAcquireNextImageKHR) load(userptr, "vkAcquireNextImageKHR");
+    glad_vkCreateSwapchainKHR = (PFN_vkCreateSwapchainKHR) load(userptr, "vkCreateSwapchainKHR");
+    glad_vkDestroySwapchainKHR = (PFN_vkDestroySwapchainKHR) load(userptr, "vkDestroySwapchainKHR");
+    glad_vkGetDeviceGroupPresentCapabilitiesKHR = (PFN_vkGetDeviceGroupPresentCapabilitiesKHR) load(userptr, "vkGetDeviceGroupPresentCapabilitiesKHR");
+    glad_vkGetDeviceGroupSurfacePresentModesKHR = (PFN_vkGetDeviceGroupSurfacePresentModesKHR) load(userptr, "vkGetDeviceGroupSurfacePresentModesKHR");
+    glad_vkGetPhysicalDevicePresentRectanglesKHR = (PFN_vkGetPhysicalDevicePresentRectanglesKHR) load(userptr, "vkGetPhysicalDevicePresentRectanglesKHR");
+    glad_vkGetSwapchainImagesKHR = (PFN_vkGetSwapchainImagesKHR) load(userptr, "vkGetSwapchainImagesKHR");
+    glad_vkQueuePresentKHR = (PFN_vkQueuePresentKHR) load(userptr, "vkQueuePresentKHR");
+}
+
+
+
+static int glad_vk_get_extensions( VkPhysicalDevice physical_device, uint32_t *out_extension_count, char ***out_extensions) {
+    uint32_t i;
+    uint32_t instance_extension_count = 0;
+    uint32_t device_extension_count = 0;
+    uint32_t max_extension_count = 0;
+    uint32_t total_extension_count = 0;
+    char **extensions = NULL;
+    VkExtensionProperties *ext_properties = NULL;
+    VkResult result;
+
+    if (glad_vkEnumerateInstanceExtensionProperties == NULL || (physical_device != NULL && glad_vkEnumerateDeviceExtensionProperties == NULL)) {
+        return 0;
+    }
+
+    result = glad_vkEnumerateInstanceExtensionProperties(NULL, &instance_extension_count, NULL);
+    if (result != VK_SUCCESS) {
+        return 0;
+    }
+
+    if (physical_device != NULL) {
+        result = glad_vkEnumerateDeviceExtensionProperties(physical_device, NULL, &device_extension_count, NULL);
+        if (result != VK_SUCCESS) {
+            return 0;
+        }
+    }
+
+    total_extension_count = instance_extension_count + device_extension_count;
+    if (total_extension_count <= 0) {
+        return 0;
+    }
+
+    max_extension_count = instance_extension_count > device_extension_count
+        ? instance_extension_count : device_extension_count;
+
+    ext_properties = (VkExtensionProperties*) malloc(max_extension_count * sizeof(VkExtensionProperties));
+    if (ext_properties == NULL) {
+        goto glad_vk_get_extensions_error;
+    }
+
+    result = glad_vkEnumerateInstanceExtensionProperties(NULL, &instance_extension_count, ext_properties);
+    if (result != VK_SUCCESS) {
+        goto glad_vk_get_extensions_error;
+    }
+
+    extensions = (char**) calloc(total_extension_count, sizeof(char*));
+    if (extensions == NULL) {
+        goto glad_vk_get_extensions_error;
+    }
+
+    for (i = 0; i < instance_extension_count; ++i) {
+        VkExtensionProperties ext = ext_properties[i];
+
+        size_t extension_name_length = strlen(ext.extensionName) + 1;
+        extensions[i] = (char*) malloc(extension_name_length * sizeof(char));
+        if (extensions[i] == NULL) {
+            goto glad_vk_get_extensions_error;
+        }
+        memcpy(extensions[i], ext.extensionName, extension_name_length * sizeof(char));
+    }
+
+    if (physical_device != NULL) {
+        result = glad_vkEnumerateDeviceExtensionProperties(physical_device, NULL, &device_extension_count, ext_properties);
+        if (result != VK_SUCCESS) {
+            goto glad_vk_get_extensions_error;
+        }
+
+        for (i = 0; i < device_extension_count; ++i) {
+            VkExtensionProperties ext = ext_properties[i];
+
+            size_t extension_name_length = strlen(ext.extensionName) + 1;
+            extensions[instance_extension_count + i] = (char*) malloc(extension_name_length * sizeof(char));
+            if (extensions[instance_extension_count + i] == NULL) {
+                goto glad_vk_get_extensions_error;
+            }
+            memcpy(extensions[instance_extension_count + i], ext.extensionName, extension_name_length * sizeof(char));
+        }
+    }
+
+    free((void*) ext_properties);
+
+    *out_extension_count = total_extension_count;
+    *out_extensions = extensions;
+
+    return 1;
+
+glad_vk_get_extensions_error:
+    free((void*) ext_properties);
+    if (extensions != NULL) {
+        for (i = 0; i < total_extension_count; ++i) {
+            free((void*) extensions[i]);
+        }
+        free(extensions);
+    }
+    return 0;
+}
+
+static void glad_vk_free_extensions(uint32_t extension_count, char **extensions) {
+    uint32_t i;
+
+    for(i = 0; i < extension_count ; ++i) {
+        free((void*) (extensions[i]));
+    }
+
+    free((void*) extensions);
+}
+
+static int glad_vk_has_extension(const char *name, uint32_t extension_count, char **extensions) {
+    uint32_t i;
+
+    for (i = 0; i < extension_count; ++i) {
+        if(extensions[i] != NULL && strcmp(name, extensions[i]) == 0) {
+            return 1;
+        }
+    }
+
+    return 0;
+}
+
+static GLADapiproc glad_vk_get_proc_from_userptr(void *userptr, const char* name) {
+    return (GLAD_GNUC_EXTENSION (GLADapiproc (*)(const char *name)) userptr)(name);
+}
+
+static int glad_vk_find_extensions_vulkan( VkPhysicalDevice physical_device) {
+    uint32_t extension_count = 0;
+    char **extensions = NULL;
+    if (!glad_vk_get_extensions(physical_device, &extension_count, &extensions)) return 0;
+
+    GLAD_VK_EXT_debug_report = glad_vk_has_extension("VK_EXT_debug_report", extension_count, extensions);
+    GLAD_VK_KHR_portability_enumeration = glad_vk_has_extension("VK_KHR_portability_enumeration", extension_count, extensions);
+    GLAD_VK_KHR_surface = glad_vk_has_extension("VK_KHR_surface", extension_count, extensions);
+    GLAD_VK_KHR_swapchain = glad_vk_has_extension("VK_KHR_swapchain", extension_count, extensions);
+
+    (void) glad_vk_has_extension;
+
+    glad_vk_free_extensions(extension_count, extensions);
+
+    return 1;
+}
+
+static int glad_vk_find_core_vulkan( VkPhysicalDevice physical_device) {
+    int major = 1;
+    int minor = 0;
+
+#ifdef VK_VERSION_1_1
+    if (glad_vkEnumerateInstanceVersion != NULL) {
+        uint32_t version;
+        VkResult result;
+
+        result = glad_vkEnumerateInstanceVersion(&version);
+        if (result == VK_SUCCESS) {
+            major = (int) VK_VERSION_MAJOR(version);
+            minor = (int) VK_VERSION_MINOR(version);
+        }
+    }
+#endif
+
+    if (physical_device != NULL && glad_vkGetPhysicalDeviceProperties != NULL) {
+        VkPhysicalDeviceProperties properties;
+        glad_vkGetPhysicalDeviceProperties(physical_device, &properties);
+
+        major = (int) VK_VERSION_MAJOR(properties.apiVersion);
+        minor = (int) VK_VERSION_MINOR(properties.apiVersion);
+    }
+
+    GLAD_VK_VERSION_1_0 = (major == 1 && minor >= 0) || major > 1;
+    GLAD_VK_VERSION_1_1 = (major == 1 && minor >= 1) || major > 1;
+    GLAD_VK_VERSION_1_2 = (major == 1 && minor >= 2) || major > 1;
+    GLAD_VK_VERSION_1_3 = (major == 1 && minor >= 3) || major > 1;
+
+    return GLAD_MAKE_VERSION(major, minor);
+}
+
+int gladLoadVulkanUserPtr( VkPhysicalDevice physical_device, GLADuserptrloadfunc load, void *userptr) {
+    int version;
+
+#ifdef VK_VERSION_1_1
+    glad_vkEnumerateInstanceVersion  = (PFN_vkEnumerateInstanceVersion) load(userptr, "vkEnumerateInstanceVersion");
+#endif
+    version = glad_vk_find_core_vulkan( physical_device);
+    if (!version) {
+        return 0;
+    }
+
+    glad_vk_load_VK_VERSION_1_0(load, userptr);
+    glad_vk_load_VK_VERSION_1_1(load, userptr);
+    glad_vk_load_VK_VERSION_1_2(load, userptr);
+    glad_vk_load_VK_VERSION_1_3(load, userptr);
+
+    if (!glad_vk_find_extensions_vulkan( physical_device)) return 0;
+    glad_vk_load_VK_EXT_debug_report(load, userptr);
+    glad_vk_load_VK_KHR_surface(load, userptr);
+    glad_vk_load_VK_KHR_swapchain(load, userptr);
+
+
+    return version;
+}
+
+
+int gladLoadVulkan( VkPhysicalDevice physical_device, GLADloadfunc load) {
+    return gladLoadVulkanUserPtr( physical_device, glad_vk_get_proc_from_userptr, GLAD_GNUC_EXTENSION (void*) load);
+}
+
+
+
+ 
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* GLAD_VULKAN_IMPLEMENTATION */
+
diff --git a/deps/glad_gl.c b/deps/glad_gl.c
deleted file mode 100644
index 2d4c87f..0000000
--- a/deps/glad_gl.c
+++ /dev/null
@@ -1,1791 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <glad/gl.h>
-
-#ifndef GLAD_IMPL_UTIL_C_
-#define GLAD_IMPL_UTIL_C_
-
-#ifdef _MSC_VER
-#define GLAD_IMPL_UTIL_SSCANF sscanf_s
-#else
-#define GLAD_IMPL_UTIL_SSCANF sscanf
-#endif
-
-#endif /* GLAD_IMPL_UTIL_C_ */
-
-
-int GLAD_GL_VERSION_1_0 = 0;
-int GLAD_GL_VERSION_1_1 = 0;
-int GLAD_GL_VERSION_1_2 = 0;
-int GLAD_GL_VERSION_1_3 = 0;
-int GLAD_GL_VERSION_1_4 = 0;
-int GLAD_GL_VERSION_1_5 = 0;
-int GLAD_GL_VERSION_2_0 = 0;
-int GLAD_GL_VERSION_2_1 = 0;
-int GLAD_GL_VERSION_3_0 = 0;
-int GLAD_GL_VERSION_3_1 = 0;
-int GLAD_GL_VERSION_3_2 = 0;
-int GLAD_GL_VERSION_3_3 = 0;
-int GLAD_GL_ARB_multisample = 0;
-int GLAD_GL_ARB_robustness = 0;
-int GLAD_GL_KHR_debug = 0;
-
-
-
-PFNGLACCUMPROC glad_glAccum = NULL;
-PFNGLACTIVETEXTUREPROC glad_glActiveTexture = NULL;
-PFNGLALPHAFUNCPROC glad_glAlphaFunc = NULL;
-PFNGLARETEXTURESRESIDENTPROC glad_glAreTexturesResident = NULL;
-PFNGLARRAYELEMENTPROC glad_glArrayElement = NULL;
-PFNGLATTACHSHADERPROC glad_glAttachShader = NULL;
-PFNGLBEGINPROC glad_glBegin = NULL;
-PFNGLBEGINCONDITIONALRENDERPROC glad_glBeginConditionalRender = NULL;
-PFNGLBEGINQUERYPROC glad_glBeginQuery = NULL;
-PFNGLBEGINTRANSFORMFEEDBACKPROC glad_glBeginTransformFeedback = NULL;
-PFNGLBINDATTRIBLOCATIONPROC glad_glBindAttribLocation = NULL;
-PFNGLBINDBUFFERPROC glad_glBindBuffer = NULL;
-PFNGLBINDBUFFERBASEPROC glad_glBindBufferBase = NULL;
-PFNGLBINDBUFFERRANGEPROC glad_glBindBufferRange = NULL;
-PFNGLBINDFRAGDATALOCATIONPROC glad_glBindFragDataLocation = NULL;
-PFNGLBINDFRAGDATALOCATIONINDEXEDPROC glad_glBindFragDataLocationIndexed = NULL;
-PFNGLBINDFRAMEBUFFERPROC glad_glBindFramebuffer = NULL;
-PFNGLBINDRENDERBUFFERPROC glad_glBindRenderbuffer = NULL;
-PFNGLBINDSAMPLERPROC glad_glBindSampler = NULL;
-PFNGLBINDTEXTUREPROC glad_glBindTexture = NULL;
-PFNGLBINDVERTEXARRAYPROC glad_glBindVertexArray = NULL;
-PFNGLBITMAPPROC glad_glBitmap = NULL;
-PFNGLBLENDCOLORPROC glad_glBlendColor = NULL;
-PFNGLBLENDEQUATIONPROC glad_glBlendEquation = NULL;
-PFNGLBLENDEQUATIONSEPARATEPROC glad_glBlendEquationSeparate = NULL;
-PFNGLBLENDFUNCPROC glad_glBlendFunc = NULL;
-PFNGLBLENDFUNCSEPARATEPROC glad_glBlendFuncSeparate = NULL;
-PFNGLBLITFRAMEBUFFERPROC glad_glBlitFramebuffer = NULL;
-PFNGLBUFFERDATAPROC glad_glBufferData = NULL;
-PFNGLBUFFERSUBDATAPROC glad_glBufferSubData = NULL;
-PFNGLCALLLISTPROC glad_glCallList = NULL;
-PFNGLCALLLISTSPROC glad_glCallLists = NULL;
-PFNGLCHECKFRAMEBUFFERSTATUSPROC glad_glCheckFramebufferStatus = NULL;
-PFNGLCLAMPCOLORPROC glad_glClampColor = NULL;
-PFNGLCLEARPROC glad_glClear = NULL;
-PFNGLCLEARACCUMPROC glad_glClearAccum = NULL;
-PFNGLCLEARBUFFERFIPROC glad_glClearBufferfi = NULL;
-PFNGLCLEARBUFFERFVPROC glad_glClearBufferfv = NULL;
-PFNGLCLEARBUFFERIVPROC glad_glClearBufferiv = NULL;
-PFNGLCLEARBUFFERUIVPROC glad_glClearBufferuiv = NULL;
-PFNGLCLEARCOLORPROC glad_glClearColor = NULL;
-PFNGLCLEARDEPTHPROC glad_glClearDepth = NULL;
-PFNGLCLEARINDEXPROC glad_glClearIndex = NULL;
-PFNGLCLEARSTENCILPROC glad_glClearStencil = NULL;
-PFNGLCLIENTACTIVETEXTUREPROC glad_glClientActiveTexture = NULL;
-PFNGLCLIENTWAITSYNCPROC glad_glClientWaitSync = NULL;
-PFNGLCLIPPLANEPROC glad_glClipPlane = NULL;
-PFNGLCOLOR3BPROC glad_glColor3b = NULL;
-PFNGLCOLOR3BVPROC glad_glColor3bv = NULL;
-PFNGLCOLOR3DPROC glad_glColor3d = NULL;
-PFNGLCOLOR3DVPROC glad_glColor3dv = NULL;
-PFNGLCOLOR3FPROC glad_glColor3f = NULL;
-PFNGLCOLOR3FVPROC glad_glColor3fv = NULL;
-PFNGLCOLOR3IPROC glad_glColor3i = NULL;
-PFNGLCOLOR3IVPROC glad_glColor3iv = NULL;
-PFNGLCOLOR3SPROC glad_glColor3s = NULL;
-PFNGLCOLOR3SVPROC glad_glColor3sv = NULL;
-PFNGLCOLOR3UBPROC glad_glColor3ub = NULL;
-PFNGLCOLOR3UBVPROC glad_glColor3ubv = NULL;
-PFNGLCOLOR3UIPROC glad_glColor3ui = NULL;
-PFNGLCOLOR3UIVPROC glad_glColor3uiv = NULL;
-PFNGLCOLOR3USPROC glad_glColor3us = NULL;
-PFNGLCOLOR3USVPROC glad_glColor3usv = NULL;
-PFNGLCOLOR4BPROC glad_glColor4b = NULL;
-PFNGLCOLOR4BVPROC glad_glColor4bv = NULL;
-PFNGLCOLOR4DPROC glad_glColor4d = NULL;
-PFNGLCOLOR4DVPROC glad_glColor4dv = NULL;
-PFNGLCOLOR4FPROC glad_glColor4f = NULL;
-PFNGLCOLOR4FVPROC glad_glColor4fv = NULL;
-PFNGLCOLOR4IPROC glad_glColor4i = NULL;
-PFNGLCOLOR4IVPROC glad_glColor4iv = NULL;
-PFNGLCOLOR4SPROC glad_glColor4s = NULL;
-PFNGLCOLOR4SVPROC glad_glColor4sv = NULL;
-PFNGLCOLOR4UBPROC glad_glColor4ub = NULL;
-PFNGLCOLOR4UBVPROC glad_glColor4ubv = NULL;
-PFNGLCOLOR4UIPROC glad_glColor4ui = NULL;
-PFNGLCOLOR4UIVPROC glad_glColor4uiv = NULL;
-PFNGLCOLOR4USPROC glad_glColor4us = NULL;
-PFNGLCOLOR4USVPROC glad_glColor4usv = NULL;
-PFNGLCOLORMASKPROC glad_glColorMask = NULL;
-PFNGLCOLORMASKIPROC glad_glColorMaski = NULL;
-PFNGLCOLORMATERIALPROC glad_glColorMaterial = NULL;
-PFNGLCOLORP3UIPROC glad_glColorP3ui = NULL;
-PFNGLCOLORP3UIVPROC glad_glColorP3uiv = NULL;
-PFNGLCOLORP4UIPROC glad_glColorP4ui = NULL;
-PFNGLCOLORP4UIVPROC glad_glColorP4uiv = NULL;
-PFNGLCOLORPOINTERPROC glad_glColorPointer = NULL;
-PFNGLCOMPILESHADERPROC glad_glCompileShader = NULL;
-PFNGLCOMPRESSEDTEXIMAGE1DPROC glad_glCompressedTexImage1D = NULL;
-PFNGLCOMPRESSEDTEXIMAGE2DPROC glad_glCompressedTexImage2D = NULL;
-PFNGLCOMPRESSEDTEXIMAGE3DPROC glad_glCompressedTexImage3D = NULL;
-PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC glad_glCompressedTexSubImage1D = NULL;
-PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC glad_glCompressedTexSubImage2D = NULL;
-PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC glad_glCompressedTexSubImage3D = NULL;
-PFNGLCOPYBUFFERSUBDATAPROC glad_glCopyBufferSubData = NULL;
-PFNGLCOPYPIXELSPROC glad_glCopyPixels = NULL;
-PFNGLCOPYTEXIMAGE1DPROC glad_glCopyTexImage1D = NULL;
-PFNGLCOPYTEXIMAGE2DPROC glad_glCopyTexImage2D = NULL;
-PFNGLCOPYTEXSUBIMAGE1DPROC glad_glCopyTexSubImage1D = NULL;
-PFNGLCOPYTEXSUBIMAGE2DPROC glad_glCopyTexSubImage2D = NULL;
-PFNGLCOPYTEXSUBIMAGE3DPROC glad_glCopyTexSubImage3D = NULL;
-PFNGLCREATEPROGRAMPROC glad_glCreateProgram = NULL;
-PFNGLCREATESHADERPROC glad_glCreateShader = NULL;
-PFNGLCULLFACEPROC glad_glCullFace = NULL;
-PFNGLDEBUGMESSAGECALLBACKPROC glad_glDebugMessageCallback = NULL;
-PFNGLDEBUGMESSAGECONTROLPROC glad_glDebugMessageControl = NULL;
-PFNGLDEBUGMESSAGEINSERTPROC glad_glDebugMessageInsert = NULL;
-PFNGLDELETEBUFFERSPROC glad_glDeleteBuffers = NULL;
-PFNGLDELETEFRAMEBUFFERSPROC glad_glDeleteFramebuffers = NULL;
-PFNGLDELETELISTSPROC glad_glDeleteLists = NULL;
-PFNGLDELETEPROGRAMPROC glad_glDeleteProgram = NULL;
-PFNGLDELETEQUERIESPROC glad_glDeleteQueries = NULL;
-PFNGLDELETERENDERBUFFERSPROC glad_glDeleteRenderbuffers = NULL;
-PFNGLDELETESAMPLERSPROC glad_glDeleteSamplers = NULL;
-PFNGLDELETESHADERPROC glad_glDeleteShader = NULL;
-PFNGLDELETESYNCPROC glad_glDeleteSync = NULL;
-PFNGLDELETETEXTURESPROC glad_glDeleteTextures = NULL;
-PFNGLDELETEVERTEXARRAYSPROC glad_glDeleteVertexArrays = NULL;
-PFNGLDEPTHFUNCPROC glad_glDepthFunc = NULL;
-PFNGLDEPTHMASKPROC glad_glDepthMask = NULL;
-PFNGLDEPTHRANGEPROC glad_glDepthRange = NULL;
-PFNGLDETACHSHADERPROC glad_glDetachShader = NULL;
-PFNGLDISABLEPROC glad_glDisable = NULL;
-PFNGLDISABLECLIENTSTATEPROC glad_glDisableClientState = NULL;
-PFNGLDISABLEVERTEXATTRIBARRAYPROC glad_glDisableVertexAttribArray = NULL;
-PFNGLDISABLEIPROC glad_glDisablei = NULL;
-PFNGLDRAWARRAYSPROC glad_glDrawArrays = NULL;
-PFNGLDRAWARRAYSINSTANCEDPROC glad_glDrawArraysInstanced = NULL;
-PFNGLDRAWBUFFERPROC glad_glDrawBuffer = NULL;
-PFNGLDRAWBUFFERSPROC glad_glDrawBuffers = NULL;
-PFNGLDRAWELEMENTSPROC glad_glDrawElements = NULL;
-PFNGLDRAWELEMENTSBASEVERTEXPROC glad_glDrawElementsBaseVertex = NULL;
-PFNGLDRAWELEMENTSINSTANCEDPROC glad_glDrawElementsInstanced = NULL;
-PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXPROC glad_glDrawElementsInstancedBaseVertex = NULL;
-PFNGLDRAWPIXELSPROC glad_glDrawPixels = NULL;
-PFNGLDRAWRANGEELEMENTSPROC glad_glDrawRangeElements = NULL;
-PFNGLDRAWRANGEELEMENTSBASEVERTEXPROC glad_glDrawRangeElementsBaseVertex = NULL;
-PFNGLEDGEFLAGPROC glad_glEdgeFlag = NULL;
-PFNGLEDGEFLAGPOINTERPROC glad_glEdgeFlagPointer = NULL;
-PFNGLEDGEFLAGVPROC glad_glEdgeFlagv = NULL;
-PFNGLENABLEPROC glad_glEnable = NULL;
-PFNGLENABLECLIENTSTATEPROC glad_glEnableClientState = NULL;
-PFNGLENABLEVERTEXATTRIBARRAYPROC glad_glEnableVertexAttribArray = NULL;
-PFNGLENABLEIPROC glad_glEnablei = NULL;
-PFNGLENDPROC glad_glEnd = NULL;
-PFNGLENDCONDITIONALRENDERPROC glad_glEndConditionalRender = NULL;
-PFNGLENDLISTPROC glad_glEndList = NULL;
-PFNGLENDQUERYPROC glad_glEndQuery = NULL;
-PFNGLENDTRANSFORMFEEDBACKPROC glad_glEndTransformFeedback = NULL;
-PFNGLEVALCOORD1DPROC glad_glEvalCoord1d = NULL;
-PFNGLEVALCOORD1DVPROC glad_glEvalCoord1dv = NULL;
-PFNGLEVALCOORD1FPROC glad_glEvalCoord1f = NULL;
-PFNGLEVALCOORD1FVPROC glad_glEvalCoord1fv = NULL;
-PFNGLEVALCOORD2DPROC glad_glEvalCoord2d = NULL;
-PFNGLEVALCOORD2DVPROC glad_glEvalCoord2dv = NULL;
-PFNGLEVALCOORD2FPROC glad_glEvalCoord2f = NULL;
-PFNGLEVALCOORD2FVPROC glad_glEvalCoord2fv = NULL;
-PFNGLEVALMESH1PROC glad_glEvalMesh1 = NULL;
-PFNGLEVALMESH2PROC glad_glEvalMesh2 = NULL;
-PFNGLEVALPOINT1PROC glad_glEvalPoint1 = NULL;
-PFNGLEVALPOINT2PROC glad_glEvalPoint2 = NULL;
-PFNGLFEEDBACKBUFFERPROC glad_glFeedbackBuffer = NULL;
-PFNGLFENCESYNCPROC glad_glFenceSync = NULL;
-PFNGLFINISHPROC glad_glFinish = NULL;
-PFNGLFLUSHPROC glad_glFlush = NULL;
-PFNGLFLUSHMAPPEDBUFFERRANGEPROC glad_glFlushMappedBufferRange = NULL;
-PFNGLFOGCOORDPOINTERPROC glad_glFogCoordPointer = NULL;
-PFNGLFOGCOORDDPROC glad_glFogCoordd = NULL;
-PFNGLFOGCOORDDVPROC glad_glFogCoorddv = NULL;
-PFNGLFOGCOORDFPROC glad_glFogCoordf = NULL;
-PFNGLFOGCOORDFVPROC glad_glFogCoordfv = NULL;
-PFNGLFOGFPROC glad_glFogf = NULL;
-PFNGLFOGFVPROC glad_glFogfv = NULL;
-PFNGLFOGIPROC glad_glFogi = NULL;
-PFNGLFOGIVPROC glad_glFogiv = NULL;
-PFNGLFRAMEBUFFERRENDERBUFFERPROC glad_glFramebufferRenderbuffer = NULL;
-PFNGLFRAMEBUFFERTEXTUREPROC glad_glFramebufferTexture = NULL;
-PFNGLFRAMEBUFFERTEXTURE1DPROC glad_glFramebufferTexture1D = NULL;
-PFNGLFRAMEBUFFERTEXTURE2DPROC glad_glFramebufferTexture2D = NULL;
-PFNGLFRAMEBUFFERTEXTURE3DPROC glad_glFramebufferTexture3D = NULL;
-PFNGLFRAMEBUFFERTEXTURELAYERPROC glad_glFramebufferTextureLayer = NULL;
-PFNGLFRONTFACEPROC glad_glFrontFace = NULL;
-PFNGLFRUSTUMPROC glad_glFrustum = NULL;
-PFNGLGENBUFFERSPROC glad_glGenBuffers = NULL;
-PFNGLGENFRAMEBUFFERSPROC glad_glGenFramebuffers = NULL;
-PFNGLGENLISTSPROC glad_glGenLists = NULL;
-PFNGLGENQUERIESPROC glad_glGenQueries = NULL;
-PFNGLGENRENDERBUFFERSPROC glad_glGenRenderbuffers = NULL;
-PFNGLGENSAMPLERSPROC glad_glGenSamplers = NULL;
-PFNGLGENTEXTURESPROC glad_glGenTextures = NULL;
-PFNGLGENVERTEXARRAYSPROC glad_glGenVertexArrays = NULL;
-PFNGLGENERATEMIPMAPPROC glad_glGenerateMipmap = NULL;
-PFNGLGETACTIVEATTRIBPROC glad_glGetActiveAttrib = NULL;
-PFNGLGETACTIVEUNIFORMPROC glad_glGetActiveUniform = NULL;
-PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC glad_glGetActiveUniformBlockName = NULL;
-PFNGLGETACTIVEUNIFORMBLOCKIVPROC glad_glGetActiveUniformBlockiv = NULL;
-PFNGLGETACTIVEUNIFORMNAMEPROC glad_glGetActiveUniformName = NULL;
-PFNGLGETACTIVEUNIFORMSIVPROC glad_glGetActiveUniformsiv = NULL;
-PFNGLGETATTACHEDSHADERSPROC glad_glGetAttachedShaders = NULL;
-PFNGLGETATTRIBLOCATIONPROC glad_glGetAttribLocation = NULL;
-PFNGLGETBOOLEANI_VPROC glad_glGetBooleani_v = NULL;
-PFNGLGETBOOLEANVPROC glad_glGetBooleanv = NULL;
-PFNGLGETBUFFERPARAMETERI64VPROC glad_glGetBufferParameteri64v = NULL;
-PFNGLGETBUFFERPARAMETERIVPROC glad_glGetBufferParameteriv = NULL;
-PFNGLGETBUFFERPOINTERVPROC glad_glGetBufferPointerv = NULL;
-PFNGLGETBUFFERSUBDATAPROC glad_glGetBufferSubData = NULL;
-PFNGLGETCLIPPLANEPROC glad_glGetClipPlane = NULL;
-PFNGLGETCOMPRESSEDTEXIMAGEPROC glad_glGetCompressedTexImage = NULL;
-PFNGLGETDEBUGMESSAGELOGPROC glad_glGetDebugMessageLog = NULL;
-PFNGLGETDOUBLEVPROC glad_glGetDoublev = NULL;
-PFNGLGETERRORPROC glad_glGetError = NULL;
-PFNGLGETFLOATVPROC glad_glGetFloatv = NULL;
-PFNGLGETFRAGDATAINDEXPROC glad_glGetFragDataIndex = NULL;
-PFNGLGETFRAGDATALOCATIONPROC glad_glGetFragDataLocation = NULL;
-PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC glad_glGetFramebufferAttachmentParameteriv = NULL;
-PFNGLGETGRAPHICSRESETSTATUSARBPROC glad_glGetGraphicsResetStatusARB = NULL;
-PFNGLGETINTEGER64I_VPROC glad_glGetInteger64i_v = NULL;
-PFNGLGETINTEGER64VPROC glad_glGetInteger64v = NULL;
-PFNGLGETINTEGERI_VPROC glad_glGetIntegeri_v = NULL;
-PFNGLGETINTEGERVPROC glad_glGetIntegerv = NULL;
-PFNGLGETLIGHTFVPROC glad_glGetLightfv = NULL;
-PFNGLGETLIGHTIVPROC glad_glGetLightiv = NULL;
-PFNGLGETMAPDVPROC glad_glGetMapdv = NULL;
-PFNGLGETMAPFVPROC glad_glGetMapfv = NULL;
-PFNGLGETMAPIVPROC glad_glGetMapiv = NULL;
-PFNGLGETMATERIALFVPROC glad_glGetMaterialfv = NULL;
-PFNGLGETMATERIALIVPROC glad_glGetMaterialiv = NULL;
-PFNGLGETMULTISAMPLEFVPROC glad_glGetMultisamplefv = NULL;
-PFNGLGETOBJECTLABELPROC glad_glGetObjectLabel = NULL;
-PFNGLGETOBJECTPTRLABELPROC glad_glGetObjectPtrLabel = NULL;
-PFNGLGETPIXELMAPFVPROC glad_glGetPixelMapfv = NULL;
-PFNGLGETPIXELMAPUIVPROC glad_glGetPixelMapuiv = NULL;
-PFNGLGETPIXELMAPUSVPROC glad_glGetPixelMapusv = NULL;
-PFNGLGETPOINTERVPROC glad_glGetPointerv = NULL;
-PFNGLGETPOLYGONSTIPPLEPROC glad_glGetPolygonStipple = NULL;
-PFNGLGETPROGRAMINFOLOGPROC glad_glGetProgramInfoLog = NULL;
-PFNGLGETPROGRAMIVPROC glad_glGetProgramiv = NULL;
-PFNGLGETQUERYOBJECTI64VPROC glad_glGetQueryObjecti64v = NULL;
-PFNGLGETQUERYOBJECTIVPROC glad_glGetQueryObjectiv = NULL;
-PFNGLGETQUERYOBJECTUI64VPROC glad_glGetQueryObjectui64v = NULL;
-PFNGLGETQUERYOBJECTUIVPROC glad_glGetQueryObjectuiv = NULL;
-PFNGLGETQUERYIVPROC glad_glGetQueryiv = NULL;
-PFNGLGETRENDERBUFFERPARAMETERIVPROC glad_glGetRenderbufferParameteriv = NULL;
-PFNGLGETSAMPLERPARAMETERIIVPROC glad_glGetSamplerParameterIiv = NULL;
-PFNGLGETSAMPLERPARAMETERIUIVPROC glad_glGetSamplerParameterIuiv = NULL;
-PFNGLGETSAMPLERPARAMETERFVPROC glad_glGetSamplerParameterfv = NULL;
-PFNGLGETSAMPLERPARAMETERIVPROC glad_glGetSamplerParameteriv = NULL;
-PFNGLGETSHADERINFOLOGPROC glad_glGetShaderInfoLog = NULL;
-PFNGLGETSHADERSOURCEPROC glad_glGetShaderSource = NULL;
-PFNGLGETSHADERIVPROC glad_glGetShaderiv = NULL;
-PFNGLGETSTRINGPROC glad_glGetString = NULL;
-PFNGLGETSTRINGIPROC glad_glGetStringi = NULL;
-PFNGLGETSYNCIVPROC glad_glGetSynciv = NULL;
-PFNGLGETTEXENVFVPROC glad_glGetTexEnvfv = NULL;
-PFNGLGETTEXENVIVPROC glad_glGetTexEnviv = NULL;
-PFNGLGETTEXGENDVPROC glad_glGetTexGendv = NULL;
-PFNGLGETTEXGENFVPROC glad_glGetTexGenfv = NULL;
-PFNGLGETTEXGENIVPROC glad_glGetTexGeniv = NULL;
-PFNGLGETTEXIMAGEPROC glad_glGetTexImage = NULL;
-PFNGLGETTEXLEVELPARAMETERFVPROC glad_glGetTexLevelParameterfv = NULL;
-PFNGLGETTEXLEVELPARAMETERIVPROC glad_glGetTexLevelParameteriv = NULL;
-PFNGLGETTEXPARAMETERIIVPROC glad_glGetTexParameterIiv = NULL;
-PFNGLGETTEXPARAMETERIUIVPROC glad_glGetTexParameterIuiv = NULL;
-PFNGLGETTEXPARAMETERFVPROC glad_glGetTexParameterfv = NULL;
-PFNGLGETTEXPARAMETERIVPROC glad_glGetTexParameteriv = NULL;
-PFNGLGETTRANSFORMFEEDBACKVARYINGPROC glad_glGetTransformFeedbackVarying = NULL;
-PFNGLGETUNIFORMBLOCKINDEXPROC glad_glGetUniformBlockIndex = NULL;
-PFNGLGETUNIFORMINDICESPROC glad_glGetUniformIndices = NULL;
-PFNGLGETUNIFORMLOCATIONPROC glad_glGetUniformLocation = NULL;
-PFNGLGETUNIFORMFVPROC glad_glGetUniformfv = NULL;
-PFNGLGETUNIFORMIVPROC glad_glGetUniformiv = NULL;
-PFNGLGETUNIFORMUIVPROC glad_glGetUniformuiv = NULL;
-PFNGLGETVERTEXATTRIBIIVPROC glad_glGetVertexAttribIiv = NULL;
-PFNGLGETVERTEXATTRIBIUIVPROC glad_glGetVertexAttribIuiv = NULL;
-PFNGLGETVERTEXATTRIBPOINTERVPROC glad_glGetVertexAttribPointerv = NULL;
-PFNGLGETVERTEXATTRIBDVPROC glad_glGetVertexAttribdv = NULL;
-PFNGLGETVERTEXATTRIBFVPROC glad_glGetVertexAttribfv = NULL;
-PFNGLGETVERTEXATTRIBIVPROC glad_glGetVertexAttribiv = NULL;
-PFNGLGETNCOLORTABLEARBPROC glad_glGetnColorTableARB = NULL;
-PFNGLGETNCOMPRESSEDTEXIMAGEARBPROC glad_glGetnCompressedTexImageARB = NULL;
-PFNGLGETNCONVOLUTIONFILTERARBPROC glad_glGetnConvolutionFilterARB = NULL;
-PFNGLGETNHISTOGRAMARBPROC glad_glGetnHistogramARB = NULL;
-PFNGLGETNMAPDVARBPROC glad_glGetnMapdvARB = NULL;
-PFNGLGETNMAPFVARBPROC glad_glGetnMapfvARB = NULL;
-PFNGLGETNMAPIVARBPROC glad_glGetnMapivARB = NULL;
-PFNGLGETNMINMAXARBPROC glad_glGetnMinmaxARB = NULL;
-PFNGLGETNPIXELMAPFVARBPROC glad_glGetnPixelMapfvARB = NULL;
-PFNGLGETNPIXELMAPUIVARBPROC glad_glGetnPixelMapuivARB = NULL;
-PFNGLGETNPIXELMAPUSVARBPROC glad_glGetnPixelMapusvARB = NULL;
-PFNGLGETNPOLYGONSTIPPLEARBPROC glad_glGetnPolygonStippleARB = NULL;
-PFNGLGETNSEPARABLEFILTERARBPROC glad_glGetnSeparableFilterARB = NULL;
-PFNGLGETNTEXIMAGEARBPROC glad_glGetnTexImageARB = NULL;
-PFNGLGETNUNIFORMDVARBPROC glad_glGetnUniformdvARB = NULL;
-PFNGLGETNUNIFORMFVARBPROC glad_glGetnUniformfvARB = NULL;
-PFNGLGETNUNIFORMIVARBPROC glad_glGetnUniformivARB = NULL;
-PFNGLGETNUNIFORMUIVARBPROC glad_glGetnUniformuivARB = NULL;
-PFNGLHINTPROC glad_glHint = NULL;
-PFNGLINDEXMASKPROC glad_glIndexMask = NULL;
-PFNGLINDEXPOINTERPROC glad_glIndexPointer = NULL;
-PFNGLINDEXDPROC glad_glIndexd = NULL;
-PFNGLINDEXDVPROC glad_glIndexdv = NULL;
-PFNGLINDEXFPROC glad_glIndexf = NULL;
-PFNGLINDEXFVPROC glad_glIndexfv = NULL;
-PFNGLINDEXIPROC glad_glIndexi = NULL;
-PFNGLINDEXIVPROC glad_glIndexiv = NULL;
-PFNGLINDEXSPROC glad_glIndexs = NULL;
-PFNGLINDEXSVPROC glad_glIndexsv = NULL;
-PFNGLINDEXUBPROC glad_glIndexub = NULL;
-PFNGLINDEXUBVPROC glad_glIndexubv = NULL;
-PFNGLINITNAMESPROC glad_glInitNames = NULL;
-PFNGLINTERLEAVEDARRAYSPROC glad_glInterleavedArrays = NULL;
-PFNGLISBUFFERPROC glad_glIsBuffer = NULL;
-PFNGLISENABLEDPROC glad_glIsEnabled = NULL;
-PFNGLISENABLEDIPROC glad_glIsEnabledi = NULL;
-PFNGLISFRAMEBUFFERPROC glad_glIsFramebuffer = NULL;
-PFNGLISLISTPROC glad_glIsList = NULL;
-PFNGLISPROGRAMPROC glad_glIsProgram = NULL;
-PFNGLISQUERYPROC glad_glIsQuery = NULL;
-PFNGLISRENDERBUFFERPROC glad_glIsRenderbuffer = NULL;
-PFNGLISSAMPLERPROC glad_glIsSampler = NULL;
-PFNGLISSHADERPROC glad_glIsShader = NULL;
-PFNGLISSYNCPROC glad_glIsSync = NULL;
-PFNGLISTEXTUREPROC glad_glIsTexture = NULL;
-PFNGLISVERTEXARRAYPROC glad_glIsVertexArray = NULL;
-PFNGLLIGHTMODELFPROC glad_glLightModelf = NULL;
-PFNGLLIGHTMODELFVPROC glad_glLightModelfv = NULL;
-PFNGLLIGHTMODELIPROC glad_glLightModeli = NULL;
-PFNGLLIGHTMODELIVPROC glad_glLightModeliv = NULL;
-PFNGLLIGHTFPROC glad_glLightf = NULL;
-PFNGLLIGHTFVPROC glad_glLightfv = NULL;
-PFNGLLIGHTIPROC glad_glLighti = NULL;
-PFNGLLIGHTIVPROC glad_glLightiv = NULL;
-PFNGLLINESTIPPLEPROC glad_glLineStipple = NULL;
-PFNGLLINEWIDTHPROC glad_glLineWidth = NULL;
-PFNGLLINKPROGRAMPROC glad_glLinkProgram = NULL;
-PFNGLLISTBASEPROC glad_glListBase = NULL;
-PFNGLLOADIDENTITYPROC glad_glLoadIdentity = NULL;
-PFNGLLOADMATRIXDPROC glad_glLoadMatrixd = NULL;
-PFNGLLOADMATRIXFPROC glad_glLoadMatrixf = NULL;
-PFNGLLOADNAMEPROC glad_glLoadName = NULL;
-PFNGLLOADTRANSPOSEMATRIXDPROC glad_glLoadTransposeMatrixd = NULL;
-PFNGLLOADTRANSPOSEMATRIXFPROC glad_glLoadTransposeMatrixf = NULL;
-PFNGLLOGICOPPROC glad_glLogicOp = NULL;
-PFNGLMAP1DPROC glad_glMap1d = NULL;
-PFNGLMAP1FPROC glad_glMap1f = NULL;
-PFNGLMAP2DPROC glad_glMap2d = NULL;
-PFNGLMAP2FPROC glad_glMap2f = NULL;
-PFNGLMAPBUFFERPROC glad_glMapBuffer = NULL;
-PFNGLMAPBUFFERRANGEPROC glad_glMapBufferRange = NULL;
-PFNGLMAPGRID1DPROC glad_glMapGrid1d = NULL;
-PFNGLMAPGRID1FPROC glad_glMapGrid1f = NULL;
-PFNGLMAPGRID2DPROC glad_glMapGrid2d = NULL;
-PFNGLMAPGRID2FPROC glad_glMapGrid2f = NULL;
-PFNGLMATERIALFPROC glad_glMaterialf = NULL;
-PFNGLMATERIALFVPROC glad_glMaterialfv = NULL;
-PFNGLMATERIALIPROC glad_glMateriali = NULL;
-PFNGLMATERIALIVPROC glad_glMaterialiv = NULL;
-PFNGLMATRIXMODEPROC glad_glMatrixMode = NULL;
-PFNGLMULTMATRIXDPROC glad_glMultMatrixd = NULL;
-PFNGLMULTMATRIXFPROC glad_glMultMatrixf = NULL;
-PFNGLMULTTRANSPOSEMATRIXDPROC glad_glMultTransposeMatrixd = NULL;
-PFNGLMULTTRANSPOSEMATRIXFPROC glad_glMultTransposeMatrixf = NULL;
-PFNGLMULTIDRAWARRAYSPROC glad_glMultiDrawArrays = NULL;
-PFNGLMULTIDRAWELEMENTSPROC glad_glMultiDrawElements = NULL;
-PFNGLMULTIDRAWELEMENTSBASEVERTEXPROC glad_glMultiDrawElementsBaseVertex = NULL;
-PFNGLMULTITEXCOORD1DPROC glad_glMultiTexCoord1d = NULL;
-PFNGLMULTITEXCOORD1DVPROC glad_glMultiTexCoord1dv = NULL;
-PFNGLMULTITEXCOORD1FPROC glad_glMultiTexCoord1f = NULL;
-PFNGLMULTITEXCOORD1FVPROC glad_glMultiTexCoord1fv = NULL;
-PFNGLMULTITEXCOORD1IPROC glad_glMultiTexCoord1i = NULL;
-PFNGLMULTITEXCOORD1IVPROC glad_glMultiTexCoord1iv = NULL;
-PFNGLMULTITEXCOORD1SPROC glad_glMultiTexCoord1s = NULL;
-PFNGLMULTITEXCOORD1SVPROC glad_glMultiTexCoord1sv = NULL;
-PFNGLMULTITEXCOORD2DPROC glad_glMultiTexCoord2d = NULL;
-PFNGLMULTITEXCOORD2DVPROC glad_glMultiTexCoord2dv = NULL;
-PFNGLMULTITEXCOORD2FPROC glad_glMultiTexCoord2f = NULL;
-PFNGLMULTITEXCOORD2FVPROC glad_glMultiTexCoord2fv = NULL;
-PFNGLMULTITEXCOORD2IPROC glad_glMultiTexCoord2i = NULL;
-PFNGLMULTITEXCOORD2IVPROC glad_glMultiTexCoord2iv = NULL;
-PFNGLMULTITEXCOORD2SPROC glad_glMultiTexCoord2s = NULL;
-PFNGLMULTITEXCOORD2SVPROC glad_glMultiTexCoord2sv = NULL;
-PFNGLMULTITEXCOORD3DPROC glad_glMultiTexCoord3d = NULL;
-PFNGLMULTITEXCOORD3DVPROC glad_glMultiTexCoord3dv = NULL;
-PFNGLMULTITEXCOORD3FPROC glad_glMultiTexCoord3f = NULL;
-PFNGLMULTITEXCOORD3FVPROC glad_glMultiTexCoord3fv = NULL;
-PFNGLMULTITEXCOORD3IPROC glad_glMultiTexCoord3i = NULL;
-PFNGLMULTITEXCOORD3IVPROC glad_glMultiTexCoord3iv = NULL;
-PFNGLMULTITEXCOORD3SPROC glad_glMultiTexCoord3s = NULL;
-PFNGLMULTITEXCOORD3SVPROC glad_glMultiTexCoord3sv = NULL;
-PFNGLMULTITEXCOORD4DPROC glad_glMultiTexCoord4d = NULL;
-PFNGLMULTITEXCOORD4DVPROC glad_glMultiTexCoord4dv = NULL;
-PFNGLMULTITEXCOORD4FPROC glad_glMultiTexCoord4f = NULL;
-PFNGLMULTITEXCOORD4FVPROC glad_glMultiTexCoord4fv = NULL;
-PFNGLMULTITEXCOORD4IPROC glad_glMultiTexCoord4i = NULL;
-PFNGLMULTITEXCOORD4IVPROC glad_glMultiTexCoord4iv = NULL;
-PFNGLMULTITEXCOORD4SPROC glad_glMultiTexCoord4s = NULL;
-PFNGLMULTITEXCOORD4SVPROC glad_glMultiTexCoord4sv = NULL;
-PFNGLMULTITEXCOORDP1UIPROC glad_glMultiTexCoordP1ui = NULL;
-PFNGLMULTITEXCOORDP1UIVPROC glad_glMultiTexCoordP1uiv = NULL;
-PFNGLMULTITEXCOORDP2UIPROC glad_glMultiTexCoordP2ui = NULL;
-PFNGLMULTITEXCOORDP2UIVPROC glad_glMultiTexCoordP2uiv = NULL;
-PFNGLMULTITEXCOORDP3UIPROC glad_glMultiTexCoordP3ui = NULL;
-PFNGLMULTITEXCOORDP3UIVPROC glad_glMultiTexCoordP3uiv = NULL;
-PFNGLMULTITEXCOORDP4UIPROC glad_glMultiTexCoordP4ui = NULL;
-PFNGLMULTITEXCOORDP4UIVPROC glad_glMultiTexCoordP4uiv = NULL;
-PFNGLNEWLISTPROC glad_glNewList = NULL;
-PFNGLNORMAL3BPROC glad_glNormal3b = NULL;
-PFNGLNORMAL3BVPROC glad_glNormal3bv = NULL;
-PFNGLNORMAL3DPROC glad_glNormal3d = NULL;
-PFNGLNORMAL3DVPROC glad_glNormal3dv = NULL;
-PFNGLNORMAL3FPROC glad_glNormal3f = NULL;
-PFNGLNORMAL3FVPROC glad_glNormal3fv = NULL;
-PFNGLNORMAL3IPROC glad_glNormal3i = NULL;
-PFNGLNORMAL3IVPROC glad_glNormal3iv = NULL;
-PFNGLNORMAL3SPROC glad_glNormal3s = NULL;
-PFNGLNORMAL3SVPROC glad_glNormal3sv = NULL;
-PFNGLNORMALP3UIPROC glad_glNormalP3ui = NULL;
-PFNGLNORMALP3UIVPROC glad_glNormalP3uiv = NULL;
-PFNGLNORMALPOINTERPROC glad_glNormalPointer = NULL;
-PFNGLOBJECTLABELPROC glad_glObjectLabel = NULL;
-PFNGLOBJECTPTRLABELPROC glad_glObjectPtrLabel = NULL;
-PFNGLORTHOPROC glad_glOrtho = NULL;
-PFNGLPASSTHROUGHPROC glad_glPassThrough = NULL;
-PFNGLPIXELMAPFVPROC glad_glPixelMapfv = NULL;
-PFNGLPIXELMAPUIVPROC glad_glPixelMapuiv = NULL;
-PFNGLPIXELMAPUSVPROC glad_glPixelMapusv = NULL;
-PFNGLPIXELSTOREFPROC glad_glPixelStoref = NULL;
-PFNGLPIXELSTOREIPROC glad_glPixelStorei = NULL;
-PFNGLPIXELTRANSFERFPROC glad_glPixelTransferf = NULL;
-PFNGLPIXELTRANSFERIPROC glad_glPixelTransferi = NULL;
-PFNGLPIXELZOOMPROC glad_glPixelZoom = NULL;
-PFNGLPOINTPARAMETERFPROC glad_glPointParameterf = NULL;
-PFNGLPOINTPARAMETERFVPROC glad_glPointParameterfv = NULL;
-PFNGLPOINTPARAMETERIPROC glad_glPointParameteri = NULL;
-PFNGLPOINTPARAMETERIVPROC glad_glPointParameteriv = NULL;
-PFNGLPOINTSIZEPROC glad_glPointSize = NULL;
-PFNGLPOLYGONMODEPROC glad_glPolygonMode = NULL;
-PFNGLPOLYGONOFFSETPROC glad_glPolygonOffset = NULL;
-PFNGLPOLYGONSTIPPLEPROC glad_glPolygonStipple = NULL;
-PFNGLPOPATTRIBPROC glad_glPopAttrib = NULL;
-PFNGLPOPCLIENTATTRIBPROC glad_glPopClientAttrib = NULL;
-PFNGLPOPDEBUGGROUPPROC glad_glPopDebugGroup = NULL;
-PFNGLPOPMATRIXPROC glad_glPopMatrix = NULL;
-PFNGLPOPNAMEPROC glad_glPopName = NULL;
-PFNGLPRIMITIVERESTARTINDEXPROC glad_glPrimitiveRestartIndex = NULL;
-PFNGLPRIORITIZETEXTURESPROC glad_glPrioritizeTextures = NULL;
-PFNGLPROVOKINGVERTEXPROC glad_glProvokingVertex = NULL;
-PFNGLPUSHATTRIBPROC glad_glPushAttrib = NULL;
-PFNGLPUSHCLIENTATTRIBPROC glad_glPushClientAttrib = NULL;
-PFNGLPUSHDEBUGGROUPPROC glad_glPushDebugGroup = NULL;
-PFNGLPUSHMATRIXPROC glad_glPushMatrix = NULL;
-PFNGLPUSHNAMEPROC glad_glPushName = NULL;
-PFNGLQUERYCOUNTERPROC glad_glQueryCounter = NULL;
-PFNGLRASTERPOS2DPROC glad_glRasterPos2d = NULL;
-PFNGLRASTERPOS2DVPROC glad_glRasterPos2dv = NULL;
-PFNGLRASTERPOS2FPROC glad_glRasterPos2f = NULL;
-PFNGLRASTERPOS2FVPROC glad_glRasterPos2fv = NULL;
-PFNGLRASTERPOS2IPROC glad_glRasterPos2i = NULL;
-PFNGLRASTERPOS2IVPROC glad_glRasterPos2iv = NULL;
-PFNGLRASTERPOS2SPROC glad_glRasterPos2s = NULL;
-PFNGLRASTERPOS2SVPROC glad_glRasterPos2sv = NULL;
-PFNGLRASTERPOS3DPROC glad_glRasterPos3d = NULL;
-PFNGLRASTERPOS3DVPROC glad_glRasterPos3dv = NULL;
-PFNGLRASTERPOS3FPROC glad_glRasterPos3f = NULL;
-PFNGLRASTERPOS3FVPROC glad_glRasterPos3fv = NULL;
-PFNGLRASTERPOS3IPROC glad_glRasterPos3i = NULL;
-PFNGLRASTERPOS3IVPROC glad_glRasterPos3iv = NULL;
-PFNGLRASTERPOS3SPROC glad_glRasterPos3s = NULL;
-PFNGLRASTERPOS3SVPROC glad_glRasterPos3sv = NULL;
-PFNGLRASTERPOS4DPROC glad_glRasterPos4d = NULL;
-PFNGLRASTERPOS4DVPROC glad_glRasterPos4dv = NULL;
-PFNGLRASTERPOS4FPROC glad_glRasterPos4f = NULL;
-PFNGLRASTERPOS4FVPROC glad_glRasterPos4fv = NULL;
-PFNGLRASTERPOS4IPROC glad_glRasterPos4i = NULL;
-PFNGLRASTERPOS4IVPROC glad_glRasterPos4iv = NULL;
-PFNGLRASTERPOS4SPROC glad_glRasterPos4s = NULL;
-PFNGLRASTERPOS4SVPROC glad_glRasterPos4sv = NULL;
-PFNGLREADBUFFERPROC glad_glReadBuffer = NULL;
-PFNGLREADPIXELSPROC glad_glReadPixels = NULL;
-PFNGLREADNPIXELSPROC glad_glReadnPixels = NULL;
-PFNGLREADNPIXELSARBPROC glad_glReadnPixelsARB = NULL;
-PFNGLRECTDPROC glad_glRectd = NULL;
-PFNGLRECTDVPROC glad_glRectdv = NULL;
-PFNGLRECTFPROC glad_glRectf = NULL;
-PFNGLRECTFVPROC glad_glRectfv = NULL;
-PFNGLRECTIPROC glad_glRecti = NULL;
-PFNGLRECTIVPROC glad_glRectiv = NULL;
-PFNGLRECTSPROC glad_glRects = NULL;
-PFNGLRECTSVPROC glad_glRectsv = NULL;
-PFNGLRENDERMODEPROC glad_glRenderMode = NULL;
-PFNGLRENDERBUFFERSTORAGEPROC glad_glRenderbufferStorage = NULL;
-PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC glad_glRenderbufferStorageMultisample = NULL;
-PFNGLROTATEDPROC glad_glRotated = NULL;
-PFNGLROTATEFPROC glad_glRotatef = NULL;
-PFNGLSAMPLECOVERAGEPROC glad_glSampleCoverage = NULL;
-PFNGLSAMPLECOVERAGEARBPROC glad_glSampleCoverageARB = NULL;
-PFNGLSAMPLEMASKIPROC glad_glSampleMaski = NULL;
-PFNGLSAMPLERPARAMETERIIVPROC glad_glSamplerParameterIiv = NULL;
-PFNGLSAMPLERPARAMETERIUIVPROC glad_glSamplerParameterIuiv = NULL;
-PFNGLSAMPLERPARAMETERFPROC glad_glSamplerParameterf = NULL;
-PFNGLSAMPLERPARAMETERFVPROC glad_glSamplerParameterfv = NULL;
-PFNGLSAMPLERPARAMETERIPROC glad_glSamplerParameteri = NULL;
-PFNGLSAMPLERPARAMETERIVPROC glad_glSamplerParameteriv = NULL;
-PFNGLSCALEDPROC glad_glScaled = NULL;
-PFNGLSCALEFPROC glad_glScalef = NULL;
-PFNGLSCISSORPROC glad_glScissor = NULL;
-PFNGLSECONDARYCOLOR3BPROC glad_glSecondaryColor3b = NULL;
-PFNGLSECONDARYCOLOR3BVPROC glad_glSecondaryColor3bv = NULL;
-PFNGLSECONDARYCOLOR3DPROC glad_glSecondaryColor3d = NULL;
-PFNGLSECONDARYCOLOR3DVPROC glad_glSecondaryColor3dv = NULL;
-PFNGLSECONDARYCOLOR3FPROC glad_glSecondaryColor3f = NULL;
-PFNGLSECONDARYCOLOR3FVPROC glad_glSecondaryColor3fv = NULL;
-PFNGLSECONDARYCOLOR3IPROC glad_glSecondaryColor3i = NULL;
-PFNGLSECONDARYCOLOR3IVPROC glad_glSecondaryColor3iv = NULL;
-PFNGLSECONDARYCOLOR3SPROC glad_glSecondaryColor3s = NULL;
-PFNGLSECONDARYCOLOR3SVPROC glad_glSecondaryColor3sv = NULL;
-PFNGLSECONDARYCOLOR3UBPROC glad_glSecondaryColor3ub = NULL;
-PFNGLSECONDARYCOLOR3UBVPROC glad_glSecondaryColor3ubv = NULL;
-PFNGLSECONDARYCOLOR3UIPROC glad_glSecondaryColor3ui = NULL;
-PFNGLSECONDARYCOLOR3UIVPROC glad_glSecondaryColor3uiv = NULL;
-PFNGLSECONDARYCOLOR3USPROC glad_glSecondaryColor3us = NULL;
-PFNGLSECONDARYCOLOR3USVPROC glad_glSecondaryColor3usv = NULL;
-PFNGLSECONDARYCOLORP3UIPROC glad_glSecondaryColorP3ui = NULL;
-PFNGLSECONDARYCOLORP3UIVPROC glad_glSecondaryColorP3uiv = NULL;
-PFNGLSECONDARYCOLORPOINTERPROC glad_glSecondaryColorPointer = NULL;
-PFNGLSELECTBUFFERPROC glad_glSelectBuffer = NULL;
-PFNGLSHADEMODELPROC glad_glShadeModel = NULL;
-PFNGLSHADERSOURCEPROC glad_glShaderSource = NULL;
-PFNGLSTENCILFUNCPROC glad_glStencilFunc = NULL;
-PFNGLSTENCILFUNCSEPARATEPROC glad_glStencilFuncSeparate = NULL;
-PFNGLSTENCILMASKPROC glad_glStencilMask = NULL;
-PFNGLSTENCILMASKSEPARATEPROC glad_glStencilMaskSeparate = NULL;
-PFNGLSTENCILOPPROC glad_glStencilOp = NULL;
-PFNGLSTENCILOPSEPARATEPROC glad_glStencilOpSeparate = NULL;
-PFNGLTEXBUFFERPROC glad_glTexBuffer = NULL;
-PFNGLTEXCOORD1DPROC glad_glTexCoord1d = NULL;
-PFNGLTEXCOORD1DVPROC glad_glTexCoord1dv = NULL;
-PFNGLTEXCOORD1FPROC glad_glTexCoord1f = NULL;
-PFNGLTEXCOORD1FVPROC glad_glTexCoord1fv = NULL;
-PFNGLTEXCOORD1IPROC glad_glTexCoord1i = NULL;
-PFNGLTEXCOORD1IVPROC glad_glTexCoord1iv = NULL;
-PFNGLTEXCOORD1SPROC glad_glTexCoord1s = NULL;
-PFNGLTEXCOORD1SVPROC glad_glTexCoord1sv = NULL;
-PFNGLTEXCOORD2DPROC glad_glTexCoord2d = NULL;
-PFNGLTEXCOORD2DVPROC glad_glTexCoord2dv = NULL;
-PFNGLTEXCOORD2FPROC glad_glTexCoord2f = NULL;
-PFNGLTEXCOORD2FVPROC glad_glTexCoord2fv = NULL;
-PFNGLTEXCOORD2IPROC glad_glTexCoord2i = NULL;
-PFNGLTEXCOORD2IVPROC glad_glTexCoord2iv = NULL;
-PFNGLTEXCOORD2SPROC glad_glTexCoord2s = NULL;
-PFNGLTEXCOORD2SVPROC glad_glTexCoord2sv = NULL;
-PFNGLTEXCOORD3DPROC glad_glTexCoord3d = NULL;
-PFNGLTEXCOORD3DVPROC glad_glTexCoord3dv = NULL;
-PFNGLTEXCOORD3FPROC glad_glTexCoord3f = NULL;
-PFNGLTEXCOORD3FVPROC glad_glTexCoord3fv = NULL;
-PFNGLTEXCOORD3IPROC glad_glTexCoord3i = NULL;
-PFNGLTEXCOORD3IVPROC glad_glTexCoord3iv = NULL;
-PFNGLTEXCOORD3SPROC glad_glTexCoord3s = NULL;
-PFNGLTEXCOORD3SVPROC glad_glTexCoord3sv = NULL;
-PFNGLTEXCOORD4DPROC glad_glTexCoord4d = NULL;
-PFNGLTEXCOORD4DVPROC glad_glTexCoord4dv = NULL;
-PFNGLTEXCOORD4FPROC glad_glTexCoord4f = NULL;
-PFNGLTEXCOORD4FVPROC glad_glTexCoord4fv = NULL;
-PFNGLTEXCOORD4IPROC glad_glTexCoord4i = NULL;
-PFNGLTEXCOORD4IVPROC glad_glTexCoord4iv = NULL;
-PFNGLTEXCOORD4SPROC glad_glTexCoord4s = NULL;
-PFNGLTEXCOORD4SVPROC glad_glTexCoord4sv = NULL;
-PFNGLTEXCOORDP1UIPROC glad_glTexCoordP1ui = NULL;
-PFNGLTEXCOORDP1UIVPROC glad_glTexCoordP1uiv = NULL;
-PFNGLTEXCOORDP2UIPROC glad_glTexCoordP2ui = NULL;
-PFNGLTEXCOORDP2UIVPROC glad_glTexCoordP2uiv = NULL;
-PFNGLTEXCOORDP3UIPROC glad_glTexCoordP3ui = NULL;
-PFNGLTEXCOORDP3UIVPROC glad_glTexCoordP3uiv = NULL;
-PFNGLTEXCOORDP4UIPROC glad_glTexCoordP4ui = NULL;
-PFNGLTEXCOORDP4UIVPROC glad_glTexCoordP4uiv = NULL;
-PFNGLTEXCOORDPOINTERPROC glad_glTexCoordPointer = NULL;
-PFNGLTEXENVFPROC glad_glTexEnvf = NULL;
-PFNGLTEXENVFVPROC glad_glTexEnvfv = NULL;
-PFNGLTEXENVIPROC glad_glTexEnvi = NULL;
-PFNGLTEXENVIVPROC glad_glTexEnviv = NULL;
-PFNGLTEXGENDPROC glad_glTexGend = NULL;
-PFNGLTEXGENDVPROC glad_glTexGendv = NULL;
-PFNGLTEXGENFPROC glad_glTexGenf = NULL;
-PFNGLTEXGENFVPROC glad_glTexGenfv = NULL;
-PFNGLTEXGENIPROC glad_glTexGeni = NULL;
-PFNGLTEXGENIVPROC glad_glTexGeniv = NULL;
-PFNGLTEXIMAGE1DPROC glad_glTexImage1D = NULL;
-PFNGLTEXIMAGE2DPROC glad_glTexImage2D = NULL;
-PFNGLTEXIMAGE2DMULTISAMPLEPROC glad_glTexImage2DMultisample = NULL;
-PFNGLTEXIMAGE3DPROC glad_glTexImage3D = NULL;
-PFNGLTEXIMAGE3DMULTISAMPLEPROC glad_glTexImage3DMultisample = NULL;
-PFNGLTEXPARAMETERIIVPROC glad_glTexParameterIiv = NULL;
-PFNGLTEXPARAMETERIUIVPROC glad_glTexParameterIuiv = NULL;
-PFNGLTEXPARAMETERFPROC glad_glTexParameterf = NULL;
-PFNGLTEXPARAMETERFVPROC glad_glTexParameterfv = NULL;
-PFNGLTEXPARAMETERIPROC glad_glTexParameteri = NULL;
-PFNGLTEXPARAMETERIVPROC glad_glTexParameteriv = NULL;
-PFNGLTEXSUBIMAGE1DPROC glad_glTexSubImage1D = NULL;
-PFNGLTEXSUBIMAGE2DPROC glad_glTexSubImage2D = NULL;
-PFNGLTEXSUBIMAGE3DPROC glad_glTexSubImage3D = NULL;
-PFNGLTRANSFORMFEEDBACKVARYINGSPROC glad_glTransformFeedbackVaryings = NULL;
-PFNGLTRANSLATEDPROC glad_glTranslated = NULL;
-PFNGLTRANSLATEFPROC glad_glTranslatef = NULL;
-PFNGLUNIFORM1FPROC glad_glUniform1f = NULL;
-PFNGLUNIFORM1FVPROC glad_glUniform1fv = NULL;
-PFNGLUNIFORM1IPROC glad_glUniform1i = NULL;
-PFNGLUNIFORM1IVPROC glad_glUniform1iv = NULL;
-PFNGLUNIFORM1UIPROC glad_glUniform1ui = NULL;
-PFNGLUNIFORM1UIVPROC glad_glUniform1uiv = NULL;
-PFNGLUNIFORM2FPROC glad_glUniform2f = NULL;
-PFNGLUNIFORM2FVPROC glad_glUniform2fv = NULL;
-PFNGLUNIFORM2IPROC glad_glUniform2i = NULL;
-PFNGLUNIFORM2IVPROC glad_glUniform2iv = NULL;
-PFNGLUNIFORM2UIPROC glad_glUniform2ui = NULL;
-PFNGLUNIFORM2UIVPROC glad_glUniform2uiv = NULL;
-PFNGLUNIFORM3FPROC glad_glUniform3f = NULL;
-PFNGLUNIFORM3FVPROC glad_glUniform3fv = NULL;
-PFNGLUNIFORM3IPROC glad_glUniform3i = NULL;
-PFNGLUNIFORM3IVPROC glad_glUniform3iv = NULL;
-PFNGLUNIFORM3UIPROC glad_glUniform3ui = NULL;
-PFNGLUNIFORM3UIVPROC glad_glUniform3uiv = NULL;
-PFNGLUNIFORM4FPROC glad_glUniform4f = NULL;
-PFNGLUNIFORM4FVPROC glad_glUniform4fv = NULL;
-PFNGLUNIFORM4IPROC glad_glUniform4i = NULL;
-PFNGLUNIFORM4IVPROC glad_glUniform4iv = NULL;
-PFNGLUNIFORM4UIPROC glad_glUniform4ui = NULL;
-PFNGLUNIFORM4UIVPROC glad_glUniform4uiv = NULL;
-PFNGLUNIFORMBLOCKBINDINGPROC glad_glUniformBlockBinding = NULL;
-PFNGLUNIFORMMATRIX2FVPROC glad_glUniformMatrix2fv = NULL;
-PFNGLUNIFORMMATRIX2X3FVPROC glad_glUniformMatrix2x3fv = NULL;
-PFNGLUNIFORMMATRIX2X4FVPROC glad_glUniformMatrix2x4fv = NULL;
-PFNGLUNIFORMMATRIX3FVPROC glad_glUniformMatrix3fv = NULL;
-PFNGLUNIFORMMATRIX3X2FVPROC glad_glUniformMatrix3x2fv = NULL;
-PFNGLUNIFORMMATRIX3X4FVPROC glad_glUniformMatrix3x4fv = NULL;
-PFNGLUNIFORMMATRIX4FVPROC glad_glUniformMatrix4fv = NULL;
-PFNGLUNIFORMMATRIX4X2FVPROC glad_glUniformMatrix4x2fv = NULL;
-PFNGLUNIFORMMATRIX4X3FVPROC glad_glUniformMatrix4x3fv = NULL;
-PFNGLUNMAPBUFFERPROC glad_glUnmapBuffer = NULL;
-PFNGLUSEPROGRAMPROC glad_glUseProgram = NULL;
-PFNGLVALIDATEPROGRAMPROC glad_glValidateProgram = NULL;
-PFNGLVERTEX2DPROC glad_glVertex2d = NULL;
-PFNGLVERTEX2DVPROC glad_glVertex2dv = NULL;
-PFNGLVERTEX2FPROC glad_glVertex2f = NULL;
-PFNGLVERTEX2FVPROC glad_glVertex2fv = NULL;
-PFNGLVERTEX2IPROC glad_glVertex2i = NULL;
-PFNGLVERTEX2IVPROC glad_glVertex2iv = NULL;
-PFNGLVERTEX2SPROC glad_glVertex2s = NULL;
-PFNGLVERTEX2SVPROC glad_glVertex2sv = NULL;
-PFNGLVERTEX3DPROC glad_glVertex3d = NULL;
-PFNGLVERTEX3DVPROC glad_glVertex3dv = NULL;
-PFNGLVERTEX3FPROC glad_glVertex3f = NULL;
-PFNGLVERTEX3FVPROC glad_glVertex3fv = NULL;
-PFNGLVERTEX3IPROC glad_glVertex3i = NULL;
-PFNGLVERTEX3IVPROC glad_glVertex3iv = NULL;
-PFNGLVERTEX3SPROC glad_glVertex3s = NULL;
-PFNGLVERTEX3SVPROC glad_glVertex3sv = NULL;
-PFNGLVERTEX4DPROC glad_glVertex4d = NULL;
-PFNGLVERTEX4DVPROC glad_glVertex4dv = NULL;
-PFNGLVERTEX4FPROC glad_glVertex4f = NULL;
-PFNGLVERTEX4FVPROC glad_glVertex4fv = NULL;
-PFNGLVERTEX4IPROC glad_glVertex4i = NULL;
-PFNGLVERTEX4IVPROC glad_glVertex4iv = NULL;
-PFNGLVERTEX4SPROC glad_glVertex4s = NULL;
-PFNGLVERTEX4SVPROC glad_glVertex4sv = NULL;
-PFNGLVERTEXATTRIB1DPROC glad_glVertexAttrib1d = NULL;
-PFNGLVERTEXATTRIB1DVPROC glad_glVertexAttrib1dv = NULL;
-PFNGLVERTEXATTRIB1FPROC glad_glVertexAttrib1f = NULL;
-PFNGLVERTEXATTRIB1FVPROC glad_glVertexAttrib1fv = NULL;
-PFNGLVERTEXATTRIB1SPROC glad_glVertexAttrib1s = NULL;
-PFNGLVERTEXATTRIB1SVPROC glad_glVertexAttrib1sv = NULL;
-PFNGLVERTEXATTRIB2DPROC glad_glVertexAttrib2d = NULL;
-PFNGLVERTEXATTRIB2DVPROC glad_glVertexAttrib2dv = NULL;
-PFNGLVERTEXATTRIB2FPROC glad_glVertexAttrib2f = NULL;
-PFNGLVERTEXATTRIB2FVPROC glad_glVertexAttrib2fv = NULL;
-PFNGLVERTEXATTRIB2SPROC glad_glVertexAttrib2s = NULL;
-PFNGLVERTEXATTRIB2SVPROC glad_glVertexAttrib2sv = NULL;
-PFNGLVERTEXATTRIB3DPROC glad_glVertexAttrib3d = NULL;
-PFNGLVERTEXATTRIB3DVPROC glad_glVertexAttrib3dv = NULL;
-PFNGLVERTEXATTRIB3FPROC glad_glVertexAttrib3f = NULL;
-PFNGLVERTEXATTRIB3FVPROC glad_glVertexAttrib3fv = NULL;
-PFNGLVERTEXATTRIB3SPROC glad_glVertexAttrib3s = NULL;
-PFNGLVERTEXATTRIB3SVPROC glad_glVertexAttrib3sv = NULL;
-PFNGLVERTEXATTRIB4NBVPROC glad_glVertexAttrib4Nbv = NULL;
-PFNGLVERTEXATTRIB4NIVPROC glad_glVertexAttrib4Niv = NULL;
-PFNGLVERTEXATTRIB4NSVPROC glad_glVertexAttrib4Nsv = NULL;
-PFNGLVERTEXATTRIB4NUBPROC glad_glVertexAttrib4Nub = NULL;
-PFNGLVERTEXATTRIB4NUBVPROC glad_glVertexAttrib4Nubv = NULL;
-PFNGLVERTEXATTRIB4NUIVPROC glad_glVertexAttrib4Nuiv = NULL;
-PFNGLVERTEXATTRIB4NUSVPROC glad_glVertexAttrib4Nusv = NULL;
-PFNGLVERTEXATTRIB4BVPROC glad_glVertexAttrib4bv = NULL;
-PFNGLVERTEXATTRIB4DPROC glad_glVertexAttrib4d = NULL;
-PFNGLVERTEXATTRIB4DVPROC glad_glVertexAttrib4dv = NULL;
-PFNGLVERTEXATTRIB4FPROC glad_glVertexAttrib4f = NULL;
-PFNGLVERTEXATTRIB4FVPROC glad_glVertexAttrib4fv = NULL;
-PFNGLVERTEXATTRIB4IVPROC glad_glVertexAttrib4iv = NULL;
-PFNGLVERTEXATTRIB4SPROC glad_glVertexAttrib4s = NULL;
-PFNGLVERTEXATTRIB4SVPROC glad_glVertexAttrib4sv = NULL;
-PFNGLVERTEXATTRIB4UBVPROC glad_glVertexAttrib4ubv = NULL;
-PFNGLVERTEXATTRIB4UIVPROC glad_glVertexAttrib4uiv = NULL;
-PFNGLVERTEXATTRIB4USVPROC glad_glVertexAttrib4usv = NULL;
-PFNGLVERTEXATTRIBDIVISORPROC glad_glVertexAttribDivisor = NULL;
-PFNGLVERTEXATTRIBI1IPROC glad_glVertexAttribI1i = NULL;
-PFNGLVERTEXATTRIBI1IVPROC glad_glVertexAttribI1iv = NULL;
-PFNGLVERTEXATTRIBI1UIPROC glad_glVertexAttribI1ui = NULL;
-PFNGLVERTEXATTRIBI1UIVPROC glad_glVertexAttribI1uiv = NULL;
-PFNGLVERTEXATTRIBI2IPROC glad_glVertexAttribI2i = NULL;
-PFNGLVERTEXATTRIBI2IVPROC glad_glVertexAttribI2iv = NULL;
-PFNGLVERTEXATTRIBI2UIPROC glad_glVertexAttribI2ui = NULL;
-PFNGLVERTEXATTRIBI2UIVPROC glad_glVertexAttribI2uiv = NULL;
-PFNGLVERTEXATTRIBI3IPROC glad_glVertexAttribI3i = NULL;
-PFNGLVERTEXATTRIBI3IVPROC glad_glVertexAttribI3iv = NULL;
-PFNGLVERTEXATTRIBI3UIPROC glad_glVertexAttribI3ui = NULL;
-PFNGLVERTEXATTRIBI3UIVPROC glad_glVertexAttribI3uiv = NULL;
-PFNGLVERTEXATTRIBI4BVPROC glad_glVertexAttribI4bv = NULL;
-PFNGLVERTEXATTRIBI4IPROC glad_glVertexAttribI4i = NULL;
-PFNGLVERTEXATTRIBI4IVPROC glad_glVertexAttribI4iv = NULL;
-PFNGLVERTEXATTRIBI4SVPROC glad_glVertexAttribI4sv = NULL;
-PFNGLVERTEXATTRIBI4UBVPROC glad_glVertexAttribI4ubv = NULL;
-PFNGLVERTEXATTRIBI4UIPROC glad_glVertexAttribI4ui = NULL;
-PFNGLVERTEXATTRIBI4UIVPROC glad_glVertexAttribI4uiv = NULL;
-PFNGLVERTEXATTRIBI4USVPROC glad_glVertexAttribI4usv = NULL;
-PFNGLVERTEXATTRIBIPOINTERPROC glad_glVertexAttribIPointer = NULL;
-PFNGLVERTEXATTRIBP1UIPROC glad_glVertexAttribP1ui = NULL;
-PFNGLVERTEXATTRIBP1UIVPROC glad_glVertexAttribP1uiv = NULL;
-PFNGLVERTEXATTRIBP2UIPROC glad_glVertexAttribP2ui = NULL;
-PFNGLVERTEXATTRIBP2UIVPROC glad_glVertexAttribP2uiv = NULL;
-PFNGLVERTEXATTRIBP3UIPROC glad_glVertexAttribP3ui = NULL;
-PFNGLVERTEXATTRIBP3UIVPROC glad_glVertexAttribP3uiv = NULL;
-PFNGLVERTEXATTRIBP4UIPROC glad_glVertexAttribP4ui = NULL;
-PFNGLVERTEXATTRIBP4UIVPROC glad_glVertexAttribP4uiv = NULL;
-PFNGLVERTEXATTRIBPOINTERPROC glad_glVertexAttribPointer = NULL;
-PFNGLVERTEXP2UIPROC glad_glVertexP2ui = NULL;
-PFNGLVERTEXP2UIVPROC glad_glVertexP2uiv = NULL;
-PFNGLVERTEXP3UIPROC glad_glVertexP3ui = NULL;
-PFNGLVERTEXP3UIVPROC glad_glVertexP3uiv = NULL;
-PFNGLVERTEXP4UIPROC glad_glVertexP4ui = NULL;
-PFNGLVERTEXP4UIVPROC glad_glVertexP4uiv = NULL;
-PFNGLVERTEXPOINTERPROC glad_glVertexPointer = NULL;
-PFNGLVIEWPORTPROC glad_glViewport = NULL;
-PFNGLWAITSYNCPROC glad_glWaitSync = NULL;
-PFNGLWINDOWPOS2DPROC glad_glWindowPos2d = NULL;
-PFNGLWINDOWPOS2DVPROC glad_glWindowPos2dv = NULL;
-PFNGLWINDOWPOS2FPROC glad_glWindowPos2f = NULL;
-PFNGLWINDOWPOS2FVPROC glad_glWindowPos2fv = NULL;
-PFNGLWINDOWPOS2IPROC glad_glWindowPos2i = NULL;
-PFNGLWINDOWPOS2IVPROC glad_glWindowPos2iv = NULL;
-PFNGLWINDOWPOS2SPROC glad_glWindowPos2s = NULL;
-PFNGLWINDOWPOS2SVPROC glad_glWindowPos2sv = NULL;
-PFNGLWINDOWPOS3DPROC glad_glWindowPos3d = NULL;
-PFNGLWINDOWPOS3DVPROC glad_glWindowPos3dv = NULL;
-PFNGLWINDOWPOS3FPROC glad_glWindowPos3f = NULL;
-PFNGLWINDOWPOS3FVPROC glad_glWindowPos3fv = NULL;
-PFNGLWINDOWPOS3IPROC glad_glWindowPos3i = NULL;
-PFNGLWINDOWPOS3IVPROC glad_glWindowPos3iv = NULL;
-PFNGLWINDOWPOS3SPROC glad_glWindowPos3s = NULL;
-PFNGLWINDOWPOS3SVPROC glad_glWindowPos3sv = NULL;
-
-
-static void glad_gl_load_GL_VERSION_1_0( GLADuserptrloadfunc load, void* userptr) {
-    if(!GLAD_GL_VERSION_1_0) return;
-    glAccum = (PFNGLACCUMPROC) load("glAccum", userptr);
-    glAlphaFunc = (PFNGLALPHAFUNCPROC) load("glAlphaFunc", userptr);
-    glBegin = (PFNGLBEGINPROC) load("glBegin", userptr);
-    glBitmap = (PFNGLBITMAPPROC) load("glBitmap", userptr);
-    glBlendFunc = (PFNGLBLENDFUNCPROC) load("glBlendFunc", userptr);
-    glCallList = (PFNGLCALLLISTPROC) load("glCallList", userptr);
-    glCallLists = (PFNGLCALLLISTSPROC) load("glCallLists", userptr);
-    glClear = (PFNGLCLEARPROC) load("glClear", userptr);
-    glClearAccum = (PFNGLCLEARACCUMPROC) load("glClearAccum", userptr);
-    glClearColor = (PFNGLCLEARCOLORPROC) load("glClearColor", userptr);
-    glClearDepth = (PFNGLCLEARDEPTHPROC) load("glClearDepth", userptr);
-    glClearIndex = (PFNGLCLEARINDEXPROC) load("glClearIndex", userptr);
-    glClearStencil = (PFNGLCLEARSTENCILPROC) load("glClearStencil", userptr);
-    glClipPlane = (PFNGLCLIPPLANEPROC) load("glClipPlane", userptr);
-    glColor3b = (PFNGLCOLOR3BPROC) load("glColor3b", userptr);
-    glColor3bv = (PFNGLCOLOR3BVPROC) load("glColor3bv", userptr);
-    glColor3d = (PFNGLCOLOR3DPROC) load("glColor3d", userptr);
-    glColor3dv = (PFNGLCOLOR3DVPROC) load("glColor3dv", userptr);
-    glColor3f = (PFNGLCOLOR3FPROC) load("glColor3f", userptr);
-    glColor3fv = (PFNGLCOLOR3FVPROC) load("glColor3fv", userptr);
-    glColor3i = (PFNGLCOLOR3IPROC) load("glColor3i", userptr);
-    glColor3iv = (PFNGLCOLOR3IVPROC) load("glColor3iv", userptr);
-    glColor3s = (PFNGLCOLOR3SPROC) load("glColor3s", userptr);
-    glColor3sv = (PFNGLCOLOR3SVPROC) load("glColor3sv", userptr);
-    glColor3ub = (PFNGLCOLOR3UBPROC) load("glColor3ub", userptr);
-    glColor3ubv = (PFNGLCOLOR3UBVPROC) load("glColor3ubv", userptr);
-    glColor3ui = (PFNGLCOLOR3UIPROC) load("glColor3ui", userptr);
-    glColor3uiv = (PFNGLCOLOR3UIVPROC) load("glColor3uiv", userptr);
-    glColor3us = (PFNGLCOLOR3USPROC) load("glColor3us", userptr);
-    glColor3usv = (PFNGLCOLOR3USVPROC) load("glColor3usv", userptr);
-    glColor4b = (PFNGLCOLOR4BPROC) load("glColor4b", userptr);
-    glColor4bv = (PFNGLCOLOR4BVPROC) load("glColor4bv", userptr);
-    glColor4d = (PFNGLCOLOR4DPROC) load("glColor4d", userptr);
-    glColor4dv = (PFNGLCOLOR4DVPROC) load("glColor4dv", userptr);
-    glColor4f = (PFNGLCOLOR4FPROC) load("glColor4f", userptr);
-    glColor4fv = (PFNGLCOLOR4FVPROC) load("glColor4fv", userptr);
-    glColor4i = (PFNGLCOLOR4IPROC) load("glColor4i", userptr);
-    glColor4iv = (PFNGLCOLOR4IVPROC) load("glColor4iv", userptr);
-    glColor4s = (PFNGLCOLOR4SPROC) load("glColor4s", userptr);
-    glColor4sv = (PFNGLCOLOR4SVPROC) load("glColor4sv", userptr);
-    glColor4ub = (PFNGLCOLOR4UBPROC) load("glColor4ub", userptr);
-    glColor4ubv = (PFNGLCOLOR4UBVPROC) load("glColor4ubv", userptr);
-    glColor4ui = (PFNGLCOLOR4UIPROC) load("glColor4ui", userptr);
-    glColor4uiv = (PFNGLCOLOR4UIVPROC) load("glColor4uiv", userptr);
-    glColor4us = (PFNGLCOLOR4USPROC) load("glColor4us", userptr);
-    glColor4usv = (PFNGLCOLOR4USVPROC) load("glColor4usv", userptr);
-    glColorMask = (PFNGLCOLORMASKPROC) load("glColorMask", userptr);
-    glColorMaterial = (PFNGLCOLORMATERIALPROC) load("glColorMaterial", userptr);
-    glCopyPixels = (PFNGLCOPYPIXELSPROC) load("glCopyPixels", userptr);
-    glCullFace = (PFNGLCULLFACEPROC) load("glCullFace", userptr);
-    glDeleteLists = (PFNGLDELETELISTSPROC) load("glDeleteLists", userptr);
-    glDepthFunc = (PFNGLDEPTHFUNCPROC) load("glDepthFunc", userptr);
-    glDepthMask = (PFNGLDEPTHMASKPROC) load("glDepthMask", userptr);
-    glDepthRange = (PFNGLDEPTHRANGEPROC) load("glDepthRange", userptr);
-    glDisable = (PFNGLDISABLEPROC) load("glDisable", userptr);
-    glDrawBuffer = (PFNGLDRAWBUFFERPROC) load("glDrawBuffer", userptr);
-    glDrawPixels = (PFNGLDRAWPIXELSPROC) load("glDrawPixels", userptr);
-    glEdgeFlag = (PFNGLEDGEFLAGPROC) load("glEdgeFlag", userptr);
-    glEdgeFlagv = (PFNGLEDGEFLAGVPROC) load("glEdgeFlagv", userptr);
-    glEnable = (PFNGLENABLEPROC) load("glEnable", userptr);
-    glEnd = (PFNGLENDPROC) load("glEnd", userptr);
-    glEndList = (PFNGLENDLISTPROC) load("glEndList", userptr);
-    glEvalCoord1d = (PFNGLEVALCOORD1DPROC) load("glEvalCoord1d", userptr);
-    glEvalCoord1dv = (PFNGLEVALCOORD1DVPROC) load("glEvalCoord1dv", userptr);
-    glEvalCoord1f = (PFNGLEVALCOORD1FPROC) load("glEvalCoord1f", userptr);
-    glEvalCoord1fv = (PFNGLEVALCOORD1FVPROC) load("glEvalCoord1fv", userptr);
-    glEvalCoord2d = (PFNGLEVALCOORD2DPROC) load("glEvalCoord2d", userptr);
-    glEvalCoord2dv = (PFNGLEVALCOORD2DVPROC) load("glEvalCoord2dv", userptr);
-    glEvalCoord2f = (PFNGLEVALCOORD2FPROC) load("glEvalCoord2f", userptr);
-    glEvalCoord2fv = (PFNGLEVALCOORD2FVPROC) load("glEvalCoord2fv", userptr);
-    glEvalMesh1 = (PFNGLEVALMESH1PROC) load("glEvalMesh1", userptr);
-    glEvalMesh2 = (PFNGLEVALMESH2PROC) load("glEvalMesh2", userptr);
-    glEvalPoint1 = (PFNGLEVALPOINT1PROC) load("glEvalPoint1", userptr);
-    glEvalPoint2 = (PFNGLEVALPOINT2PROC) load("glEvalPoint2", userptr);
-    glFeedbackBuffer = (PFNGLFEEDBACKBUFFERPROC) load("glFeedbackBuffer", userptr);
-    glFinish = (PFNGLFINISHPROC) load("glFinish", userptr);
-    glFlush = (PFNGLFLUSHPROC) load("glFlush", userptr);
-    glFogf = (PFNGLFOGFPROC) load("glFogf", userptr);
-    glFogfv = (PFNGLFOGFVPROC) load("glFogfv", userptr);
-    glFogi = (PFNGLFOGIPROC) load("glFogi", userptr);
-    glFogiv = (PFNGLFOGIVPROC) load("glFogiv", userptr);
-    glFrontFace = (PFNGLFRONTFACEPROC) load("glFrontFace", userptr);
-    glFrustum = (PFNGLFRUSTUMPROC) load("glFrustum", userptr);
-    glGenLists = (PFNGLGENLISTSPROC) load("glGenLists", userptr);
-    glGetBooleanv = (PFNGLGETBOOLEANVPROC) load("glGetBooleanv", userptr);
-    glGetClipPlane = (PFNGLGETCLIPPLANEPROC) load("glGetClipPlane", userptr);
-    glGetDoublev = (PFNGLGETDOUBLEVPROC) load("glGetDoublev", userptr);
-    glGetError = (PFNGLGETERRORPROC) load("glGetError", userptr);
-    glGetFloatv = (PFNGLGETFLOATVPROC) load("glGetFloatv", userptr);
-    glGetIntegerv = (PFNGLGETINTEGERVPROC) load("glGetIntegerv", userptr);
-    glGetLightfv = (PFNGLGETLIGHTFVPROC) load("glGetLightfv", userptr);
-    glGetLightiv = (PFNGLGETLIGHTIVPROC) load("glGetLightiv", userptr);
-    glGetMapdv = (PFNGLGETMAPDVPROC) load("glGetMapdv", userptr);
-    glGetMapfv = (PFNGLGETMAPFVPROC) load("glGetMapfv", userptr);
-    glGetMapiv = (PFNGLGETMAPIVPROC) load("glGetMapiv", userptr);
-    glGetMaterialfv = (PFNGLGETMATERIALFVPROC) load("glGetMaterialfv", userptr);
-    glGetMaterialiv = (PFNGLGETMATERIALIVPROC) load("glGetMaterialiv", userptr);
-    glGetPixelMapfv = (PFNGLGETPIXELMAPFVPROC) load("glGetPixelMapfv", userptr);
-    glGetPixelMapuiv = (PFNGLGETPIXELMAPUIVPROC) load("glGetPixelMapuiv", userptr);
-    glGetPixelMapusv = (PFNGLGETPIXELMAPUSVPROC) load("glGetPixelMapusv", userptr);
-    glGetPolygonStipple = (PFNGLGETPOLYGONSTIPPLEPROC) load("glGetPolygonStipple", userptr);
-    glGetString = (PFNGLGETSTRINGPROC) load("glGetString", userptr);
-    glGetTexEnvfv = (PFNGLGETTEXENVFVPROC) load("glGetTexEnvfv", userptr);
-    glGetTexEnviv = (PFNGLGETTEXENVIVPROC) load("glGetTexEnviv", userptr);
-    glGetTexGendv = (PFNGLGETTEXGENDVPROC) load("glGetTexGendv", userptr);
-    glGetTexGenfv = (PFNGLGETTEXGENFVPROC) load("glGetTexGenfv", userptr);
-    glGetTexGeniv = (PFNGLGETTEXGENIVPROC) load("glGetTexGeniv", userptr);
-    glGetTexImage = (PFNGLGETTEXIMAGEPROC) load("glGetTexImage", userptr);
-    glGetTexLevelParameterfv = (PFNGLGETTEXLEVELPARAMETERFVPROC) load("glGetTexLevelParameterfv", userptr);
-    glGetTexLevelParameteriv = (PFNGLGETTEXLEVELPARAMETERIVPROC) load("glGetTexLevelParameteriv", userptr);
-    glGetTexParameterfv = (PFNGLGETTEXPARAMETERFVPROC) load("glGetTexParameterfv", userptr);
-    glGetTexParameteriv = (PFNGLGETTEXPARAMETERIVPROC) load("glGetTexParameteriv", userptr);
-    glHint = (PFNGLHINTPROC) load("glHint", userptr);
-    glIndexMask = (PFNGLINDEXMASKPROC) load("glIndexMask", userptr);
-    glIndexd = (PFNGLINDEXDPROC) load("glIndexd", userptr);
-    glIndexdv = (PFNGLINDEXDVPROC) load("glIndexdv", userptr);
-    glIndexf = (PFNGLINDEXFPROC) load("glIndexf", userptr);
-    glIndexfv = (PFNGLINDEXFVPROC) load("glIndexfv", userptr);
-    glIndexi = (PFNGLINDEXIPROC) load("glIndexi", userptr);
-    glIndexiv = (PFNGLINDEXIVPROC) load("glIndexiv", userptr);
-    glIndexs = (PFNGLINDEXSPROC) load("glIndexs", userptr);
-    glIndexsv = (PFNGLINDEXSVPROC) load("glIndexsv", userptr);
-    glInitNames = (PFNGLINITNAMESPROC) load("glInitNames", userptr);
-    glIsEnabled = (PFNGLISENABLEDPROC) load("glIsEnabled", userptr);
-    glIsList = (PFNGLISLISTPROC) load("glIsList", userptr);
-    glLightModelf = (PFNGLLIGHTMODELFPROC) load("glLightModelf", userptr);
-    glLightModelfv = (PFNGLLIGHTMODELFVPROC) load("glLightModelfv", userptr);
-    glLightModeli = (PFNGLLIGHTMODELIPROC) load("glLightModeli", userptr);
-    glLightModeliv = (PFNGLLIGHTMODELIVPROC) load("glLightModeliv", userptr);
-    glLightf = (PFNGLLIGHTFPROC) load("glLightf", userptr);
-    glLightfv = (PFNGLLIGHTFVPROC) load("glLightfv", userptr);
-    glLighti = (PFNGLLIGHTIPROC) load("glLighti", userptr);
-    glLightiv = (PFNGLLIGHTIVPROC) load("glLightiv", userptr);
-    glLineStipple = (PFNGLLINESTIPPLEPROC) load("glLineStipple", userptr);
-    glLineWidth = (PFNGLLINEWIDTHPROC) load("glLineWidth", userptr);
-    glListBase = (PFNGLLISTBASEPROC) load("glListBase", userptr);
-    glLoadIdentity = (PFNGLLOADIDENTITYPROC) load("glLoadIdentity", userptr);
-    glLoadMatrixd = (PFNGLLOADMATRIXDPROC) load("glLoadMatrixd", userptr);
-    glLoadMatrixf = (PFNGLLOADMATRIXFPROC) load("glLoadMatrixf", userptr);
-    glLoadName = (PFNGLLOADNAMEPROC) load("glLoadName", userptr);
-    glLogicOp = (PFNGLLOGICOPPROC) load("glLogicOp", userptr);
-    glMap1d = (PFNGLMAP1DPROC) load("glMap1d", userptr);
-    glMap1f = (PFNGLMAP1FPROC) load("glMap1f", userptr);
-    glMap2d = (PFNGLMAP2DPROC) load("glMap2d", userptr);
-    glMap2f = (PFNGLMAP2FPROC) load("glMap2f", userptr);
-    glMapGrid1d = (PFNGLMAPGRID1DPROC) load("glMapGrid1d", userptr);
-    glMapGrid1f = (PFNGLMAPGRID1FPROC) load("glMapGrid1f", userptr);
-    glMapGrid2d = (PFNGLMAPGRID2DPROC) load("glMapGrid2d", userptr);
-    glMapGrid2f = (PFNGLMAPGRID2FPROC) load("glMapGrid2f", userptr);
-    glMaterialf = (PFNGLMATERIALFPROC) load("glMaterialf", userptr);
-    glMaterialfv = (PFNGLMATERIALFVPROC) load("glMaterialfv", userptr);
-    glMateriali = (PFNGLMATERIALIPROC) load("glMateriali", userptr);
-    glMaterialiv = (PFNGLMATERIALIVPROC) load("glMaterialiv", userptr);
-    glMatrixMode = (PFNGLMATRIXMODEPROC) load("glMatrixMode", userptr);
-    glMultMatrixd = (PFNGLMULTMATRIXDPROC) load("glMultMatrixd", userptr);
-    glMultMatrixf = (PFNGLMULTMATRIXFPROC) load("glMultMatrixf", userptr);
-    glNewList = (PFNGLNEWLISTPROC) load("glNewList", userptr);
-    glNormal3b = (PFNGLNORMAL3BPROC) load("glNormal3b", userptr);
-    glNormal3bv = (PFNGLNORMAL3BVPROC) load("glNormal3bv", userptr);
-    glNormal3d = (PFNGLNORMAL3DPROC) load("glNormal3d", userptr);
-    glNormal3dv = (PFNGLNORMAL3DVPROC) load("glNormal3dv", userptr);
-    glNormal3f = (PFNGLNORMAL3FPROC) load("glNormal3f", userptr);
-    glNormal3fv = (PFNGLNORMAL3FVPROC) load("glNormal3fv", userptr);
-    glNormal3i = (PFNGLNORMAL3IPROC) load("glNormal3i", userptr);
-    glNormal3iv = (PFNGLNORMAL3IVPROC) load("glNormal3iv", userptr);
-    glNormal3s = (PFNGLNORMAL3SPROC) load("glNormal3s", userptr);
-    glNormal3sv = (PFNGLNORMAL3SVPROC) load("glNormal3sv", userptr);
-    glOrtho = (PFNGLORTHOPROC) load("glOrtho", userptr);
-    glPassThrough = (PFNGLPASSTHROUGHPROC) load("glPassThrough", userptr);
-    glPixelMapfv = (PFNGLPIXELMAPFVPROC) load("glPixelMapfv", userptr);
-    glPixelMapuiv = (PFNGLPIXELMAPUIVPROC) load("glPixelMapuiv", userptr);
-    glPixelMapusv = (PFNGLPIXELMAPUSVPROC) load("glPixelMapusv", userptr);
-    glPixelStoref = (PFNGLPIXELSTOREFPROC) load("glPixelStoref", userptr);
-    glPixelStorei = (PFNGLPIXELSTOREIPROC) load("glPixelStorei", userptr);
-    glPixelTransferf = (PFNGLPIXELTRANSFERFPROC) load("glPixelTransferf", userptr);
-    glPixelTransferi = (PFNGLPIXELTRANSFERIPROC) load("glPixelTransferi", userptr);
-    glPixelZoom = (PFNGLPIXELZOOMPROC) load("glPixelZoom", userptr);
-    glPointSize = (PFNGLPOINTSIZEPROC) load("glPointSize", userptr);
-    glPolygonMode = (PFNGLPOLYGONMODEPROC) load("glPolygonMode", userptr);
-    glPolygonStipple = (PFNGLPOLYGONSTIPPLEPROC) load("glPolygonStipple", userptr);
-    glPopAttrib = (PFNGLPOPATTRIBPROC) load("glPopAttrib", userptr);
-    glPopMatrix = (PFNGLPOPMATRIXPROC) load("glPopMatrix", userptr);
-    glPopName = (PFNGLPOPNAMEPROC) load("glPopName", userptr);
-    glPushAttrib = (PFNGLPUSHATTRIBPROC) load("glPushAttrib", userptr);
-    glPushMatrix = (PFNGLPUSHMATRIXPROC) load("glPushMatrix", userptr);
-    glPushName = (PFNGLPUSHNAMEPROC) load("glPushName", userptr);
-    glRasterPos2d = (PFNGLRASTERPOS2DPROC) load("glRasterPos2d", userptr);
-    glRasterPos2dv = (PFNGLRASTERPOS2DVPROC) load("glRasterPos2dv", userptr);
-    glRasterPos2f = (PFNGLRASTERPOS2FPROC) load("glRasterPos2f", userptr);
-    glRasterPos2fv = (PFNGLRASTERPOS2FVPROC) load("glRasterPos2fv", userptr);
-    glRasterPos2i = (PFNGLRASTERPOS2IPROC) load("glRasterPos2i", userptr);
-    glRasterPos2iv = (PFNGLRASTERPOS2IVPROC) load("glRasterPos2iv", userptr);
-    glRasterPos2s = (PFNGLRASTERPOS2SPROC) load("glRasterPos2s", userptr);
-    glRasterPos2sv = (PFNGLRASTERPOS2SVPROC) load("glRasterPos2sv", userptr);
-    glRasterPos3d = (PFNGLRASTERPOS3DPROC) load("glRasterPos3d", userptr);
-    glRasterPos3dv = (PFNGLRASTERPOS3DVPROC) load("glRasterPos3dv", userptr);
-    glRasterPos3f = (PFNGLRASTERPOS3FPROC) load("glRasterPos3f", userptr);
-    glRasterPos3fv = (PFNGLRASTERPOS3FVPROC) load("glRasterPos3fv", userptr);
-    glRasterPos3i = (PFNGLRASTERPOS3IPROC) load("glRasterPos3i", userptr);
-    glRasterPos3iv = (PFNGLRASTERPOS3IVPROC) load("glRasterPos3iv", userptr);
-    glRasterPos3s = (PFNGLRASTERPOS3SPROC) load("glRasterPos3s", userptr);
-    glRasterPos3sv = (PFNGLRASTERPOS3SVPROC) load("glRasterPos3sv", userptr);
-    glRasterPos4d = (PFNGLRASTERPOS4DPROC) load("glRasterPos4d", userptr);
-    glRasterPos4dv = (PFNGLRASTERPOS4DVPROC) load("glRasterPos4dv", userptr);
-    glRasterPos4f = (PFNGLRASTERPOS4FPROC) load("glRasterPos4f", userptr);
-    glRasterPos4fv = (PFNGLRASTERPOS4FVPROC) load("glRasterPos4fv", userptr);
-    glRasterPos4i = (PFNGLRASTERPOS4IPROC) load("glRasterPos4i", userptr);
-    glRasterPos4iv = (PFNGLRASTERPOS4IVPROC) load("glRasterPos4iv", userptr);
-    glRasterPos4s = (PFNGLRASTERPOS4SPROC) load("glRasterPos4s", userptr);
-    glRasterPos4sv = (PFNGLRASTERPOS4SVPROC) load("glRasterPos4sv", userptr);
-    glReadBuffer = (PFNGLREADBUFFERPROC) load("glReadBuffer", userptr);
-    glReadPixels = (PFNGLREADPIXELSPROC) load("glReadPixels", userptr);
-    glRectd = (PFNGLRECTDPROC) load("glRectd", userptr);
-    glRectdv = (PFNGLRECTDVPROC) load("glRectdv", userptr);
-    glRectf = (PFNGLRECTFPROC) load("glRectf", userptr);
-    glRectfv = (PFNGLRECTFVPROC) load("glRectfv", userptr);
-    glRecti = (PFNGLRECTIPROC) load("glRecti", userptr);
-    glRectiv = (PFNGLRECTIVPROC) load("glRectiv", userptr);
-    glRects = (PFNGLRECTSPROC) load("glRects", userptr);
-    glRectsv = (PFNGLRECTSVPROC) load("glRectsv", userptr);
-    glRenderMode = (PFNGLRENDERMODEPROC) load("glRenderMode", userptr);
-    glRotated = (PFNGLROTATEDPROC) load("glRotated", userptr);
-    glRotatef = (PFNGLROTATEFPROC) load("glRotatef", userptr);
-    glScaled = (PFNGLSCALEDPROC) load("glScaled", userptr);
-    glScalef = (PFNGLSCALEFPROC) load("glScalef", userptr);
-    glScissor = (PFNGLSCISSORPROC) load("glScissor", userptr);
-    glSelectBuffer = (PFNGLSELECTBUFFERPROC) load("glSelectBuffer", userptr);
-    glShadeModel = (PFNGLSHADEMODELPROC) load("glShadeModel", userptr);
-    glStencilFunc = (PFNGLSTENCILFUNCPROC) load("glStencilFunc", userptr);
-    glStencilMask = (PFNGLSTENCILMASKPROC) load("glStencilMask", userptr);
-    glStencilOp = (PFNGLSTENCILOPPROC) load("glStencilOp", userptr);
-    glTexCoord1d = (PFNGLTEXCOORD1DPROC) load("glTexCoord1d", userptr);
-    glTexCoord1dv = (PFNGLTEXCOORD1DVPROC) load("glTexCoord1dv", userptr);
-    glTexCoord1f = (PFNGLTEXCOORD1FPROC) load("glTexCoord1f", userptr);
-    glTexCoord1fv = (PFNGLTEXCOORD1FVPROC) load("glTexCoord1fv", userptr);
-    glTexCoord1i = (PFNGLTEXCOORD1IPROC) load("glTexCoord1i", userptr);
-    glTexCoord1iv = (PFNGLTEXCOORD1IVPROC) load("glTexCoord1iv", userptr);
-    glTexCoord1s = (PFNGLTEXCOORD1SPROC) load("glTexCoord1s", userptr);
-    glTexCoord1sv = (PFNGLTEXCOORD1SVPROC) load("glTexCoord1sv", userptr);
-    glTexCoord2d = (PFNGLTEXCOORD2DPROC) load("glTexCoord2d", userptr);
-    glTexCoord2dv = (PFNGLTEXCOORD2DVPROC) load("glTexCoord2dv", userptr);
-    glTexCoord2f = (PFNGLTEXCOORD2FPROC) load("glTexCoord2f", userptr);
-    glTexCoord2fv = (PFNGLTEXCOORD2FVPROC) load("glTexCoord2fv", userptr);
-    glTexCoord2i = (PFNGLTEXCOORD2IPROC) load("glTexCoord2i", userptr);
-    glTexCoord2iv = (PFNGLTEXCOORD2IVPROC) load("glTexCoord2iv", userptr);
-    glTexCoord2s = (PFNGLTEXCOORD2SPROC) load("glTexCoord2s", userptr);
-    glTexCoord2sv = (PFNGLTEXCOORD2SVPROC) load("glTexCoord2sv", userptr);
-    glTexCoord3d = (PFNGLTEXCOORD3DPROC) load("glTexCoord3d", userptr);
-    glTexCoord3dv = (PFNGLTEXCOORD3DVPROC) load("glTexCoord3dv", userptr);
-    glTexCoord3f = (PFNGLTEXCOORD3FPROC) load("glTexCoord3f", userptr);
-    glTexCoord3fv = (PFNGLTEXCOORD3FVPROC) load("glTexCoord3fv", userptr);
-    glTexCoord3i = (PFNGLTEXCOORD3IPROC) load("glTexCoord3i", userptr);
-    glTexCoord3iv = (PFNGLTEXCOORD3IVPROC) load("glTexCoord3iv", userptr);
-    glTexCoord3s = (PFNGLTEXCOORD3SPROC) load("glTexCoord3s", userptr);
-    glTexCoord3sv = (PFNGLTEXCOORD3SVPROC) load("glTexCoord3sv", userptr);
-    glTexCoord4d = (PFNGLTEXCOORD4DPROC) load("glTexCoord4d", userptr);
-    glTexCoord4dv = (PFNGLTEXCOORD4DVPROC) load("glTexCoord4dv", userptr);
-    glTexCoord4f = (PFNGLTEXCOORD4FPROC) load("glTexCoord4f", userptr);
-    glTexCoord4fv = (PFNGLTEXCOORD4FVPROC) load("glTexCoord4fv", userptr);
-    glTexCoord4i = (PFNGLTEXCOORD4IPROC) load("glTexCoord4i", userptr);
-    glTexCoord4iv = (PFNGLTEXCOORD4IVPROC) load("glTexCoord4iv", userptr);
-    glTexCoord4s = (PFNGLTEXCOORD4SPROC) load("glTexCoord4s", userptr);
-    glTexCoord4sv = (PFNGLTEXCOORD4SVPROC) load("glTexCoord4sv", userptr);
-    glTexEnvf = (PFNGLTEXENVFPROC) load("glTexEnvf", userptr);
-    glTexEnvfv = (PFNGLTEXENVFVPROC) load("glTexEnvfv", userptr);
-    glTexEnvi = (PFNGLTEXENVIPROC) load("glTexEnvi", userptr);
-    glTexEnviv = (PFNGLTEXENVIVPROC) load("glTexEnviv", userptr);
-    glTexGend = (PFNGLTEXGENDPROC) load("glTexGend", userptr);
-    glTexGendv = (PFNGLTEXGENDVPROC) load("glTexGendv", userptr);
-    glTexGenf = (PFNGLTEXGENFPROC) load("glTexGenf", userptr);
-    glTexGenfv = (PFNGLTEXGENFVPROC) load("glTexGenfv", userptr);
-    glTexGeni = (PFNGLTEXGENIPROC) load("glTexGeni", userptr);
-    glTexGeniv = (PFNGLTEXGENIVPROC) load("glTexGeniv", userptr);
-    glTexImage1D = (PFNGLTEXIMAGE1DPROC) load("glTexImage1D", userptr);
-    glTexImage2D = (PFNGLTEXIMAGE2DPROC) load("glTexImage2D", userptr);
-    glTexParameterf = (PFNGLTEXPARAMETERFPROC) load("glTexParameterf", userptr);
-    glTexParameterfv = (PFNGLTEXPARAMETERFVPROC) load("glTexParameterfv", userptr);
-    glTexParameteri = (PFNGLTEXPARAMETERIPROC) load("glTexParameteri", userptr);
-    glTexParameteriv = (PFNGLTEXPARAMETERIVPROC) load("glTexParameteriv", userptr);
-    glTranslated = (PFNGLTRANSLATEDPROC) load("glTranslated", userptr);
-    glTranslatef = (PFNGLTRANSLATEFPROC) load("glTranslatef", userptr);
-    glVertex2d = (PFNGLVERTEX2DPROC) load("glVertex2d", userptr);
-    glVertex2dv = (PFNGLVERTEX2DVPROC) load("glVertex2dv", userptr);
-    glVertex2f = (PFNGLVERTEX2FPROC) load("glVertex2f", userptr);
-    glVertex2fv = (PFNGLVERTEX2FVPROC) load("glVertex2fv", userptr);
-    glVertex2i = (PFNGLVERTEX2IPROC) load("glVertex2i", userptr);
-    glVertex2iv = (PFNGLVERTEX2IVPROC) load("glVertex2iv", userptr);
-    glVertex2s = (PFNGLVERTEX2SPROC) load("glVertex2s", userptr);
-    glVertex2sv = (PFNGLVERTEX2SVPROC) load("glVertex2sv", userptr);
-    glVertex3d = (PFNGLVERTEX3DPROC) load("glVertex3d", userptr);
-    glVertex3dv = (PFNGLVERTEX3DVPROC) load("glVertex3dv", userptr);
-    glVertex3f = (PFNGLVERTEX3FPROC) load("glVertex3f", userptr);
-    glVertex3fv = (PFNGLVERTEX3FVPROC) load("glVertex3fv", userptr);
-    glVertex3i = (PFNGLVERTEX3IPROC) load("glVertex3i", userptr);
-    glVertex3iv = (PFNGLVERTEX3IVPROC) load("glVertex3iv", userptr);
-    glVertex3s = (PFNGLVERTEX3SPROC) load("glVertex3s", userptr);
-    glVertex3sv = (PFNGLVERTEX3SVPROC) load("glVertex3sv", userptr);
-    glVertex4d = (PFNGLVERTEX4DPROC) load("glVertex4d", userptr);
-    glVertex4dv = (PFNGLVERTEX4DVPROC) load("glVertex4dv", userptr);
-    glVertex4f = (PFNGLVERTEX4FPROC) load("glVertex4f", userptr);
-    glVertex4fv = (PFNGLVERTEX4FVPROC) load("glVertex4fv", userptr);
-    glVertex4i = (PFNGLVERTEX4IPROC) load("glVertex4i", userptr);
-    glVertex4iv = (PFNGLVERTEX4IVPROC) load("glVertex4iv", userptr);
-    glVertex4s = (PFNGLVERTEX4SPROC) load("glVertex4s", userptr);
-    glVertex4sv = (PFNGLVERTEX4SVPROC) load("glVertex4sv", userptr);
-    glViewport = (PFNGLVIEWPORTPROC) load("glViewport", userptr);
-}
-static void glad_gl_load_GL_VERSION_1_1( GLADuserptrloadfunc load, void* userptr) {
-    if(!GLAD_GL_VERSION_1_1) return;
-    glAreTexturesResident = (PFNGLARETEXTURESRESIDENTPROC) load("glAreTexturesResident", userptr);
-    glArrayElement = (PFNGLARRAYELEMENTPROC) load("glArrayElement", userptr);
-    glBindTexture = (PFNGLBINDTEXTUREPROC) load("glBindTexture", userptr);
-    glColorPointer = (PFNGLCOLORPOINTERPROC) load("glColorPointer", userptr);
-    glCopyTexImage1D = (PFNGLCOPYTEXIMAGE1DPROC) load("glCopyTexImage1D", userptr);
-    glCopyTexImage2D = (PFNGLCOPYTEXIMAGE2DPROC) load("glCopyTexImage2D", userptr);
-    glCopyTexSubImage1D = (PFNGLCOPYTEXSUBIMAGE1DPROC) load("glCopyTexSubImage1D", userptr);
-    glCopyTexSubImage2D = (PFNGLCOPYTEXSUBIMAGE2DPROC) load("glCopyTexSubImage2D", userptr);
-    glDeleteTextures = (PFNGLDELETETEXTURESPROC) load("glDeleteTextures", userptr);
-    glDisableClientState = (PFNGLDISABLECLIENTSTATEPROC) load("glDisableClientState", userptr);
-    glDrawArrays = (PFNGLDRAWARRAYSPROC) load("glDrawArrays", userptr);
-    glDrawElements = (PFNGLDRAWELEMENTSPROC) load("glDrawElements", userptr);
-    glEdgeFlagPointer = (PFNGLEDGEFLAGPOINTERPROC) load("glEdgeFlagPointer", userptr);
-    glEnableClientState = (PFNGLENABLECLIENTSTATEPROC) load("glEnableClientState", userptr);
-    glGenTextures = (PFNGLGENTEXTURESPROC) load("glGenTextures", userptr);
-    glGetPointerv = (PFNGLGETPOINTERVPROC) load("glGetPointerv", userptr);
-    glIndexPointer = (PFNGLINDEXPOINTERPROC) load("glIndexPointer", userptr);
-    glIndexub = (PFNGLINDEXUBPROC) load("glIndexub", userptr);
-    glIndexubv = (PFNGLINDEXUBVPROC) load("glIndexubv", userptr);
-    glInterleavedArrays = (PFNGLINTERLEAVEDARRAYSPROC) load("glInterleavedArrays", userptr);
-    glIsTexture = (PFNGLISTEXTUREPROC) load("glIsTexture", userptr);
-    glNormalPointer = (PFNGLNORMALPOINTERPROC) load("glNormalPointer", userptr);
-    glPolygonOffset = (PFNGLPOLYGONOFFSETPROC) load("glPolygonOffset", userptr);
-    glPopClientAttrib = (PFNGLPOPCLIENTATTRIBPROC) load("glPopClientAttrib", userptr);
-    glPrioritizeTextures = (PFNGLPRIORITIZETEXTURESPROC) load("glPrioritizeTextures", userptr);
-    glPushClientAttrib = (PFNGLPUSHCLIENTATTRIBPROC) load("glPushClientAttrib", userptr);
-    glTexCoordPointer = (PFNGLTEXCOORDPOINTERPROC) load("glTexCoordPointer", userptr);
-    glTexSubImage1D = (PFNGLTEXSUBIMAGE1DPROC) load("glTexSubImage1D", userptr);
-    glTexSubImage2D = (PFNGLTEXSUBIMAGE2DPROC) load("glTexSubImage2D", userptr);
-    glVertexPointer = (PFNGLVERTEXPOINTERPROC) load("glVertexPointer", userptr);
-}
-static void glad_gl_load_GL_VERSION_1_2( GLADuserptrloadfunc load, void* userptr) {
-    if(!GLAD_GL_VERSION_1_2) return;
-    glCopyTexSubImage3D = (PFNGLCOPYTEXSUBIMAGE3DPROC) load("glCopyTexSubImage3D", userptr);
-    glDrawRangeElements = (PFNGLDRAWRANGEELEMENTSPROC) load("glDrawRangeElements", userptr);
-    glTexImage3D = (PFNGLTEXIMAGE3DPROC) load("glTexImage3D", userptr);
-    glTexSubImage3D = (PFNGLTEXSUBIMAGE3DPROC) load("glTexSubImage3D", userptr);
-}
-static void glad_gl_load_GL_VERSION_1_3( GLADuserptrloadfunc load, void* userptr) {
-    if(!GLAD_GL_VERSION_1_3) return;
-    glActiveTexture = (PFNGLACTIVETEXTUREPROC) load("glActiveTexture", userptr);
-    glClientActiveTexture = (PFNGLCLIENTACTIVETEXTUREPROC) load("glClientActiveTexture", userptr);
-    glCompressedTexImage1D = (PFNGLCOMPRESSEDTEXIMAGE1DPROC) load("glCompressedTexImage1D", userptr);
-    glCompressedTexImage2D = (PFNGLCOMPRESSEDTEXIMAGE2DPROC) load("glCompressedTexImage2D", userptr);
-    glCompressedTexImage3D = (PFNGLCOMPRESSEDTEXIMAGE3DPROC) load("glCompressedTexImage3D", userptr);
-    glCompressedTexSubImage1D = (PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC) load("glCompressedTexSubImage1D", userptr);
-    glCompressedTexSubImage2D = (PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC) load("glCompressedTexSubImage2D", userptr);
-    glCompressedTexSubImage3D = (PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC) load("glCompressedTexSubImage3D", userptr);
-    glGetCompressedTexImage = (PFNGLGETCOMPRESSEDTEXIMAGEPROC) load("glGetCompressedTexImage", userptr);
-    glLoadTransposeMatrixd = (PFNGLLOADTRANSPOSEMATRIXDPROC) load("glLoadTransposeMatrixd", userptr);
-    glLoadTransposeMatrixf = (PFNGLLOADTRANSPOSEMATRIXFPROC) load("glLoadTransposeMatrixf", userptr);
-    glMultTransposeMatrixd = (PFNGLMULTTRANSPOSEMATRIXDPROC) load("glMultTransposeMatrixd", userptr);
-    glMultTransposeMatrixf = (PFNGLMULTTRANSPOSEMATRIXFPROC) load("glMultTransposeMatrixf", userptr);
-    glMultiTexCoord1d = (PFNGLMULTITEXCOORD1DPROC) load("glMultiTexCoord1d", userptr);
-    glMultiTexCoord1dv = (PFNGLMULTITEXCOORD1DVPROC) load("glMultiTexCoord1dv", userptr);
-    glMultiTexCoord1f = (PFNGLMULTITEXCOORD1FPROC) load("glMultiTexCoord1f", userptr);
-    glMultiTexCoord1fv = (PFNGLMULTITEXCOORD1FVPROC) load("glMultiTexCoord1fv", userptr);
-    glMultiTexCoord1i = (PFNGLMULTITEXCOORD1IPROC) load("glMultiTexCoord1i", userptr);
-    glMultiTexCoord1iv = (PFNGLMULTITEXCOORD1IVPROC) load("glMultiTexCoord1iv", userptr);
-    glMultiTexCoord1s = (PFNGLMULTITEXCOORD1SPROC) load("glMultiTexCoord1s", userptr);
-    glMultiTexCoord1sv = (PFNGLMULTITEXCOORD1SVPROC) load("glMultiTexCoord1sv", userptr);
-    glMultiTexCoord2d = (PFNGLMULTITEXCOORD2DPROC) load("glMultiTexCoord2d", userptr);
-    glMultiTexCoord2dv = (PFNGLMULTITEXCOORD2DVPROC) load("glMultiTexCoord2dv", userptr);
-    glMultiTexCoord2f = (PFNGLMULTITEXCOORD2FPROC) load("glMultiTexCoord2f", userptr);
-    glMultiTexCoord2fv = (PFNGLMULTITEXCOORD2FVPROC) load("glMultiTexCoord2fv", userptr);
-    glMultiTexCoord2i = (PFNGLMULTITEXCOORD2IPROC) load("glMultiTexCoord2i", userptr);
-    glMultiTexCoord2iv = (PFNGLMULTITEXCOORD2IVPROC) load("glMultiTexCoord2iv", userptr);
-    glMultiTexCoord2s = (PFNGLMULTITEXCOORD2SPROC) load("glMultiTexCoord2s", userptr);
-    glMultiTexCoord2sv = (PFNGLMULTITEXCOORD2SVPROC) load("glMultiTexCoord2sv", userptr);
-    glMultiTexCoord3d = (PFNGLMULTITEXCOORD3DPROC) load("glMultiTexCoord3d", userptr);
-    glMultiTexCoord3dv = (PFNGLMULTITEXCOORD3DVPROC) load("glMultiTexCoord3dv", userptr);
-    glMultiTexCoord3f = (PFNGLMULTITEXCOORD3FPROC) load("glMultiTexCoord3f", userptr);
-    glMultiTexCoord3fv = (PFNGLMULTITEXCOORD3FVPROC) load("glMultiTexCoord3fv", userptr);
-    glMultiTexCoord3i = (PFNGLMULTITEXCOORD3IPROC) load("glMultiTexCoord3i", userptr);
-    glMultiTexCoord3iv = (PFNGLMULTITEXCOORD3IVPROC) load("glMultiTexCoord3iv", userptr);
-    glMultiTexCoord3s = (PFNGLMULTITEXCOORD3SPROC) load("glMultiTexCoord3s", userptr);
-    glMultiTexCoord3sv = (PFNGLMULTITEXCOORD3SVPROC) load("glMultiTexCoord3sv", userptr);
-    glMultiTexCoord4d = (PFNGLMULTITEXCOORD4DPROC) load("glMultiTexCoord4d", userptr);
-    glMultiTexCoord4dv = (PFNGLMULTITEXCOORD4DVPROC) load("glMultiTexCoord4dv", userptr);
-    glMultiTexCoord4f = (PFNGLMULTITEXCOORD4FPROC) load("glMultiTexCoord4f", userptr);
-    glMultiTexCoord4fv = (PFNGLMULTITEXCOORD4FVPROC) load("glMultiTexCoord4fv", userptr);
-    glMultiTexCoord4i = (PFNGLMULTITEXCOORD4IPROC) load("glMultiTexCoord4i", userptr);
-    glMultiTexCoord4iv = (PFNGLMULTITEXCOORD4IVPROC) load("glMultiTexCoord4iv", userptr);
-    glMultiTexCoord4s = (PFNGLMULTITEXCOORD4SPROC) load("glMultiTexCoord4s", userptr);
-    glMultiTexCoord4sv = (PFNGLMULTITEXCOORD4SVPROC) load("glMultiTexCoord4sv", userptr);
-    glSampleCoverage = (PFNGLSAMPLECOVERAGEPROC) load("glSampleCoverage", userptr);
-}
-static void glad_gl_load_GL_VERSION_1_4( GLADuserptrloadfunc load, void* userptr) {
-    if(!GLAD_GL_VERSION_1_4) return;
-    glBlendColor = (PFNGLBLENDCOLORPROC) load("glBlendColor", userptr);
-    glBlendEquation = (PFNGLBLENDEQUATIONPROC) load("glBlendEquation", userptr);
-    glBlendFuncSeparate = (PFNGLBLENDFUNCSEPARATEPROC) load("glBlendFuncSeparate", userptr);
-    glFogCoordPointer = (PFNGLFOGCOORDPOINTERPROC) load("glFogCoordPointer", userptr);
-    glFogCoordd = (PFNGLFOGCOORDDPROC) load("glFogCoordd", userptr);
-    glFogCoorddv = (PFNGLFOGCOORDDVPROC) load("glFogCoorddv", userptr);
-    glFogCoordf = (PFNGLFOGCOORDFPROC) load("glFogCoordf", userptr);
-    glFogCoordfv = (PFNGLFOGCOORDFVPROC) load("glFogCoordfv", userptr);
-    glMultiDrawArrays = (PFNGLMULTIDRAWARRAYSPROC) load("glMultiDrawArrays", userptr);
-    glMultiDrawElements = (PFNGLMULTIDRAWELEMENTSPROC) load("glMultiDrawElements", userptr);
-    glPointParameterf = (PFNGLPOINTPARAMETERFPROC) load("glPointParameterf", userptr);
-    glPointParameterfv = (PFNGLPOINTPARAMETERFVPROC) load("glPointParameterfv", userptr);
-    glPointParameteri = (PFNGLPOINTPARAMETERIPROC) load("glPointParameteri", userptr);
-    glPointParameteriv = (PFNGLPOINTPARAMETERIVPROC) load("glPointParameteriv", userptr);
-    glSecondaryColor3b = (PFNGLSECONDARYCOLOR3BPROC) load("glSecondaryColor3b", userptr);
-    glSecondaryColor3bv = (PFNGLSECONDARYCOLOR3BVPROC) load("glSecondaryColor3bv", userptr);
-    glSecondaryColor3d = (PFNGLSECONDARYCOLOR3DPROC) load("glSecondaryColor3d", userptr);
-    glSecondaryColor3dv = (PFNGLSECONDARYCOLOR3DVPROC) load("glSecondaryColor3dv", userptr);
-    glSecondaryColor3f = (PFNGLSECONDARYCOLOR3FPROC) load("glSecondaryColor3f", userptr);
-    glSecondaryColor3fv = (PFNGLSECONDARYCOLOR3FVPROC) load("glSecondaryColor3fv", userptr);
-    glSecondaryColor3i = (PFNGLSECONDARYCOLOR3IPROC) load("glSecondaryColor3i", userptr);
-    glSecondaryColor3iv = (PFNGLSECONDARYCOLOR3IVPROC) load("glSecondaryColor3iv", userptr);
-    glSecondaryColor3s = (PFNGLSECONDARYCOLOR3SPROC) load("glSecondaryColor3s", userptr);
-    glSecondaryColor3sv = (PFNGLSECONDARYCOLOR3SVPROC) load("glSecondaryColor3sv", userptr);
-    glSecondaryColor3ub = (PFNGLSECONDARYCOLOR3UBPROC) load("glSecondaryColor3ub", userptr);
-    glSecondaryColor3ubv = (PFNGLSECONDARYCOLOR3UBVPROC) load("glSecondaryColor3ubv", userptr);
-    glSecondaryColor3ui = (PFNGLSECONDARYCOLOR3UIPROC) load("glSecondaryColor3ui", userptr);
-    glSecondaryColor3uiv = (PFNGLSECONDARYCOLOR3UIVPROC) load("glSecondaryColor3uiv", userptr);
-    glSecondaryColor3us = (PFNGLSECONDARYCOLOR3USPROC) load("glSecondaryColor3us", userptr);
-    glSecondaryColor3usv = (PFNGLSECONDARYCOLOR3USVPROC) load("glSecondaryColor3usv", userptr);
-    glSecondaryColorPointer = (PFNGLSECONDARYCOLORPOINTERPROC) load("glSecondaryColorPointer", userptr);
-    glWindowPos2d = (PFNGLWINDOWPOS2DPROC) load("glWindowPos2d", userptr);
-    glWindowPos2dv = (PFNGLWINDOWPOS2DVPROC) load("glWindowPos2dv", userptr);
-    glWindowPos2f = (PFNGLWINDOWPOS2FPROC) load("glWindowPos2f", userptr);
-    glWindowPos2fv = (PFNGLWINDOWPOS2FVPROC) load("glWindowPos2fv", userptr);
-    glWindowPos2i = (PFNGLWINDOWPOS2IPROC) load("glWindowPos2i", userptr);
-    glWindowPos2iv = (PFNGLWINDOWPOS2IVPROC) load("glWindowPos2iv", userptr);
-    glWindowPos2s = (PFNGLWINDOWPOS2SPROC) load("glWindowPos2s", userptr);
-    glWindowPos2sv = (PFNGLWINDOWPOS2SVPROC) load("glWindowPos2sv", userptr);
-    glWindowPos3d = (PFNGLWINDOWPOS3DPROC) load("glWindowPos3d", userptr);
-    glWindowPos3dv = (PFNGLWINDOWPOS3DVPROC) load("glWindowPos3dv", userptr);
-    glWindowPos3f = (PFNGLWINDOWPOS3FPROC) load("glWindowPos3f", userptr);
-    glWindowPos3fv = (PFNGLWINDOWPOS3FVPROC) load("glWindowPos3fv", userptr);
-    glWindowPos3i = (PFNGLWINDOWPOS3IPROC) load("glWindowPos3i", userptr);
-    glWindowPos3iv = (PFNGLWINDOWPOS3IVPROC) load("glWindowPos3iv", userptr);
-    glWindowPos3s = (PFNGLWINDOWPOS3SPROC) load("glWindowPos3s", userptr);
-    glWindowPos3sv = (PFNGLWINDOWPOS3SVPROC) load("glWindowPos3sv", userptr);
-}
-static void glad_gl_load_GL_VERSION_1_5( GLADuserptrloadfunc load, void* userptr) {
-    if(!GLAD_GL_VERSION_1_5) return;
-    glBeginQuery = (PFNGLBEGINQUERYPROC) load("glBeginQuery", userptr);
-    glBindBuffer = (PFNGLBINDBUFFERPROC) load("glBindBuffer", userptr);
-    glBufferData = (PFNGLBUFFERDATAPROC) load("glBufferData", userptr);
-    glBufferSubData = (PFNGLBUFFERSUBDATAPROC) load("glBufferSubData", userptr);
-    glDeleteBuffers = (PFNGLDELETEBUFFERSPROC) load("glDeleteBuffers", userptr);
-    glDeleteQueries = (PFNGLDELETEQUERIESPROC) load("glDeleteQueries", userptr);
-    glEndQuery = (PFNGLENDQUERYPROC) load("glEndQuery", userptr);
-    glGenBuffers = (PFNGLGENBUFFERSPROC) load("glGenBuffers", userptr);
-    glGenQueries = (PFNGLGENQUERIESPROC) load("glGenQueries", userptr);
-    glGetBufferParameteriv = (PFNGLGETBUFFERPARAMETERIVPROC) load("glGetBufferParameteriv", userptr);
-    glGetBufferPointerv = (PFNGLGETBUFFERPOINTERVPROC) load("glGetBufferPointerv", userptr);
-    glGetBufferSubData = (PFNGLGETBUFFERSUBDATAPROC) load("glGetBufferSubData", userptr);
-    glGetQueryObjectiv = (PFNGLGETQUERYOBJECTIVPROC) load("glGetQueryObjectiv", userptr);
-    glGetQueryObjectuiv = (PFNGLGETQUERYOBJECTUIVPROC) load("glGetQueryObjectuiv", userptr);
-    glGetQueryiv = (PFNGLGETQUERYIVPROC) load("glGetQueryiv", userptr);
-    glIsBuffer = (PFNGLISBUFFERPROC) load("glIsBuffer", userptr);
-    glIsQuery = (PFNGLISQUERYPROC) load("glIsQuery", userptr);
-    glMapBuffer = (PFNGLMAPBUFFERPROC) load("glMapBuffer", userptr);
-    glUnmapBuffer = (PFNGLUNMAPBUFFERPROC) load("glUnmapBuffer", userptr);
-}
-static void glad_gl_load_GL_VERSION_2_0( GLADuserptrloadfunc load, void* userptr) {
-    if(!GLAD_GL_VERSION_2_0) return;
-    glAttachShader = (PFNGLATTACHSHADERPROC) load("glAttachShader", userptr);
-    glBindAttribLocation = (PFNGLBINDATTRIBLOCATIONPROC) load("glBindAttribLocation", userptr);
-    glBlendEquationSeparate = (PFNGLBLENDEQUATIONSEPARATEPROC) load("glBlendEquationSeparate", userptr);
-    glCompileShader = (PFNGLCOMPILESHADERPROC) load("glCompileShader", userptr);
-    glCreateProgram = (PFNGLCREATEPROGRAMPROC) load("glCreateProgram", userptr);
-    glCreateShader = (PFNGLCREATESHADERPROC) load("glCreateShader", userptr);
-    glDeleteProgram = (PFNGLDELETEPROGRAMPROC) load("glDeleteProgram", userptr);
-    glDeleteShader = (PFNGLDELETESHADERPROC) load("glDeleteShader", userptr);
-    glDetachShader = (PFNGLDETACHSHADERPROC) load("glDetachShader", userptr);
-    glDisableVertexAttribArray = (PFNGLDISABLEVERTEXATTRIBARRAYPROC) load("glDisableVertexAttribArray", userptr);
-    glDrawBuffers = (PFNGLDRAWBUFFERSPROC) load("glDrawBuffers", userptr);
-    glEnableVertexAttribArray = (PFNGLENABLEVERTEXATTRIBARRAYPROC) load("glEnableVertexAttribArray", userptr);
-    glGetActiveAttrib = (PFNGLGETACTIVEATTRIBPROC) load("glGetActiveAttrib", userptr);
-    glGetActiveUniform = (PFNGLGETACTIVEUNIFORMPROC) load("glGetActiveUniform", userptr);
-    glGetAttachedShaders = (PFNGLGETATTACHEDSHADERSPROC) load("glGetAttachedShaders", userptr);
-    glGetAttribLocation = (PFNGLGETATTRIBLOCATIONPROC) load("glGetAttribLocation", userptr);
-    glGetProgramInfoLog = (PFNGLGETPROGRAMINFOLOGPROC) load("glGetProgramInfoLog", userptr);
-    glGetProgramiv = (PFNGLGETPROGRAMIVPROC) load("glGetProgramiv", userptr);
-    glGetShaderInfoLog = (PFNGLGETSHADERINFOLOGPROC) load("glGetShaderInfoLog", userptr);
-    glGetShaderSource = (PFNGLGETSHADERSOURCEPROC) load("glGetShaderSource", userptr);
-    glGetShaderiv = (PFNGLGETSHADERIVPROC) load("glGetShaderiv", userptr);
-    glGetUniformLocation = (PFNGLGETUNIFORMLOCATIONPROC) load("glGetUniformLocation", userptr);
-    glGetUniformfv = (PFNGLGETUNIFORMFVPROC) load("glGetUniformfv", userptr);
-    glGetUniformiv = (PFNGLGETUNIFORMIVPROC) load("glGetUniformiv", userptr);
-    glGetVertexAttribPointerv = (PFNGLGETVERTEXATTRIBPOINTERVPROC) load("glGetVertexAttribPointerv", userptr);
-    glGetVertexAttribdv = (PFNGLGETVERTEXATTRIBDVPROC) load("glGetVertexAttribdv", userptr);
-    glGetVertexAttribfv = (PFNGLGETVERTEXATTRIBFVPROC) load("glGetVertexAttribfv", userptr);
-    glGetVertexAttribiv = (PFNGLGETVERTEXATTRIBIVPROC) load("glGetVertexAttribiv", userptr);
-    glIsProgram = (PFNGLISPROGRAMPROC) load("glIsProgram", userptr);
-    glIsShader = (PFNGLISSHADERPROC) load("glIsShader", userptr);
-    glLinkProgram = (PFNGLLINKPROGRAMPROC) load("glLinkProgram", userptr);
-    glShaderSource = (PFNGLSHADERSOURCEPROC) load("glShaderSource", userptr);
-    glStencilFuncSeparate = (PFNGLSTENCILFUNCSEPARATEPROC) load("glStencilFuncSeparate", userptr);
-    glStencilMaskSeparate = (PFNGLSTENCILMASKSEPARATEPROC) load("glStencilMaskSeparate", userptr);
-    glStencilOpSeparate = (PFNGLSTENCILOPSEPARATEPROC) load("glStencilOpSeparate", userptr);
-    glUniform1f = (PFNGLUNIFORM1FPROC) load("glUniform1f", userptr);
-    glUniform1fv = (PFNGLUNIFORM1FVPROC) load("glUniform1fv", userptr);
-    glUniform1i = (PFNGLUNIFORM1IPROC) load("glUniform1i", userptr);
-    glUniform1iv = (PFNGLUNIFORM1IVPROC) load("glUniform1iv", userptr);
-    glUniform2f = (PFNGLUNIFORM2FPROC) load("glUniform2f", userptr);
-    glUniform2fv = (PFNGLUNIFORM2FVPROC) load("glUniform2fv", userptr);
-    glUniform2i = (PFNGLUNIFORM2IPROC) load("glUniform2i", userptr);
-    glUniform2iv = (PFNGLUNIFORM2IVPROC) load("glUniform2iv", userptr);
-    glUniform3f = (PFNGLUNIFORM3FPROC) load("glUniform3f", userptr);
-    glUniform3fv = (PFNGLUNIFORM3FVPROC) load("glUniform3fv", userptr);
-    glUniform3i = (PFNGLUNIFORM3IPROC) load("glUniform3i", userptr);
-    glUniform3iv = (PFNGLUNIFORM3IVPROC) load("glUniform3iv", userptr);
-    glUniform4f = (PFNGLUNIFORM4FPROC) load("glUniform4f", userptr);
-    glUniform4fv = (PFNGLUNIFORM4FVPROC) load("glUniform4fv", userptr);
-    glUniform4i = (PFNGLUNIFORM4IPROC) load("glUniform4i", userptr);
-    glUniform4iv = (PFNGLUNIFORM4IVPROC) load("glUniform4iv", userptr);
-    glUniformMatrix2fv = (PFNGLUNIFORMMATRIX2FVPROC) load("glUniformMatrix2fv", userptr);
-    glUniformMatrix3fv = (PFNGLUNIFORMMATRIX3FVPROC) load("glUniformMatrix3fv", userptr);
-    glUniformMatrix4fv = (PFNGLUNIFORMMATRIX4FVPROC) load("glUniformMatrix4fv", userptr);
-    glUseProgram = (PFNGLUSEPROGRAMPROC) load("glUseProgram", userptr);
-    glValidateProgram = (PFNGLVALIDATEPROGRAMPROC) load("glValidateProgram", userptr);
-    glVertexAttrib1d = (PFNGLVERTEXATTRIB1DPROC) load("glVertexAttrib1d", userptr);
-    glVertexAttrib1dv = (PFNGLVERTEXATTRIB1DVPROC) load("glVertexAttrib1dv", userptr);
-    glVertexAttrib1f = (PFNGLVERTEXATTRIB1FPROC) load("glVertexAttrib1f", userptr);
-    glVertexAttrib1fv = (PFNGLVERTEXATTRIB1FVPROC) load("glVertexAttrib1fv", userptr);
-    glVertexAttrib1s = (PFNGLVERTEXATTRIB1SPROC) load("glVertexAttrib1s", userptr);
-    glVertexAttrib1sv = (PFNGLVERTEXATTRIB1SVPROC) load("glVertexAttrib1sv", userptr);
-    glVertexAttrib2d = (PFNGLVERTEXATTRIB2DPROC) load("glVertexAttrib2d", userptr);
-    glVertexAttrib2dv = (PFNGLVERTEXATTRIB2DVPROC) load("glVertexAttrib2dv", userptr);
-    glVertexAttrib2f = (PFNGLVERTEXATTRIB2FPROC) load("glVertexAttrib2f", userptr);
-    glVertexAttrib2fv = (PFNGLVERTEXATTRIB2FVPROC) load("glVertexAttrib2fv", userptr);
-    glVertexAttrib2s = (PFNGLVERTEXATTRIB2SPROC) load("glVertexAttrib2s", userptr);
-    glVertexAttrib2sv = (PFNGLVERTEXATTRIB2SVPROC) load("glVertexAttrib2sv", userptr);
-    glVertexAttrib3d = (PFNGLVERTEXATTRIB3DPROC) load("glVertexAttrib3d", userptr);
-    glVertexAttrib3dv = (PFNGLVERTEXATTRIB3DVPROC) load("glVertexAttrib3dv", userptr);
-    glVertexAttrib3f = (PFNGLVERTEXATTRIB3FPROC) load("glVertexAttrib3f", userptr);
-    glVertexAttrib3fv = (PFNGLVERTEXATTRIB3FVPROC) load("glVertexAttrib3fv", userptr);
-    glVertexAttrib3s = (PFNGLVERTEXATTRIB3SPROC) load("glVertexAttrib3s", userptr);
-    glVertexAttrib3sv = (PFNGLVERTEXATTRIB3SVPROC) load("glVertexAttrib3sv", userptr);
-    glVertexAttrib4Nbv = (PFNGLVERTEXATTRIB4NBVPROC) load("glVertexAttrib4Nbv", userptr);
-    glVertexAttrib4Niv = (PFNGLVERTEXATTRIB4NIVPROC) load("glVertexAttrib4Niv", userptr);
-    glVertexAttrib4Nsv = (PFNGLVERTEXATTRIB4NSVPROC) load("glVertexAttrib4Nsv", userptr);
-    glVertexAttrib4Nub = (PFNGLVERTEXATTRIB4NUBPROC) load("glVertexAttrib4Nub", userptr);
-    glVertexAttrib4Nubv = (PFNGLVERTEXATTRIB4NUBVPROC) load("glVertexAttrib4Nubv", userptr);
-    glVertexAttrib4Nuiv = (PFNGLVERTEXATTRIB4NUIVPROC) load("glVertexAttrib4Nuiv", userptr);
-    glVertexAttrib4Nusv = (PFNGLVERTEXATTRIB4NUSVPROC) load("glVertexAttrib4Nusv", userptr);
-    glVertexAttrib4bv = (PFNGLVERTEXATTRIB4BVPROC) load("glVertexAttrib4bv", userptr);
-    glVertexAttrib4d = (PFNGLVERTEXATTRIB4DPROC) load("glVertexAttrib4d", userptr);
-    glVertexAttrib4dv = (PFNGLVERTEXATTRIB4DVPROC) load("glVertexAttrib4dv", userptr);
-    glVertexAttrib4f = (PFNGLVERTEXATTRIB4FPROC) load("glVertexAttrib4f", userptr);
-    glVertexAttrib4fv = (PFNGLVERTEXATTRIB4FVPROC) load("glVertexAttrib4fv", userptr);
-    glVertexAttrib4iv = (PFNGLVERTEXATTRIB4IVPROC) load("glVertexAttrib4iv", userptr);
-    glVertexAttrib4s = (PFNGLVERTEXATTRIB4SPROC) load("glVertexAttrib4s", userptr);
-    glVertexAttrib4sv = (PFNGLVERTEXATTRIB4SVPROC) load("glVertexAttrib4sv", userptr);
-    glVertexAttrib4ubv = (PFNGLVERTEXATTRIB4UBVPROC) load("glVertexAttrib4ubv", userptr);
-    glVertexAttrib4uiv = (PFNGLVERTEXATTRIB4UIVPROC) load("glVertexAttrib4uiv", userptr);
-    glVertexAttrib4usv = (PFNGLVERTEXATTRIB4USVPROC) load("glVertexAttrib4usv", userptr);
-    glVertexAttribPointer = (PFNGLVERTEXATTRIBPOINTERPROC) load("glVertexAttribPointer", userptr);
-}
-static void glad_gl_load_GL_VERSION_2_1( GLADuserptrloadfunc load, void* userptr) {
-    if(!GLAD_GL_VERSION_2_1) return;
-    glUniformMatrix2x3fv = (PFNGLUNIFORMMATRIX2X3FVPROC) load("glUniformMatrix2x3fv", userptr);
-    glUniformMatrix2x4fv = (PFNGLUNIFORMMATRIX2X4FVPROC) load("glUniformMatrix2x4fv", userptr);
-    glUniformMatrix3x2fv = (PFNGLUNIFORMMATRIX3X2FVPROC) load("glUniformMatrix3x2fv", userptr);
-    glUniformMatrix3x4fv = (PFNGLUNIFORMMATRIX3X4FVPROC) load("glUniformMatrix3x4fv", userptr);
-    glUniformMatrix4x2fv = (PFNGLUNIFORMMATRIX4X2FVPROC) load("glUniformMatrix4x2fv", userptr);
-    glUniformMatrix4x3fv = (PFNGLUNIFORMMATRIX4X3FVPROC) load("glUniformMatrix4x3fv", userptr);
-}
-static void glad_gl_load_GL_VERSION_3_0( GLADuserptrloadfunc load, void* userptr) {
-    if(!GLAD_GL_VERSION_3_0) return;
-    glBeginConditionalRender = (PFNGLBEGINCONDITIONALRENDERPROC) load("glBeginConditionalRender", userptr);
-    glBeginTransformFeedback = (PFNGLBEGINTRANSFORMFEEDBACKPROC) load("glBeginTransformFeedback", userptr);
-    glBindBufferBase = (PFNGLBINDBUFFERBASEPROC) load("glBindBufferBase", userptr);
-    glBindBufferRange = (PFNGLBINDBUFFERRANGEPROC) load("glBindBufferRange", userptr);
-    glBindFragDataLocation = (PFNGLBINDFRAGDATALOCATIONPROC) load("glBindFragDataLocation", userptr);
-    glBindFramebuffer = (PFNGLBINDFRAMEBUFFERPROC) load("glBindFramebuffer", userptr);
-    glBindRenderbuffer = (PFNGLBINDRENDERBUFFERPROC) load("glBindRenderbuffer", userptr);
-    glBindVertexArray = (PFNGLBINDVERTEXARRAYPROC) load("glBindVertexArray", userptr);
-    glBlitFramebuffer = (PFNGLBLITFRAMEBUFFERPROC) load("glBlitFramebuffer", userptr);
-    glCheckFramebufferStatus = (PFNGLCHECKFRAMEBUFFERSTATUSPROC) load("glCheckFramebufferStatus", userptr);
-    glClampColor = (PFNGLCLAMPCOLORPROC) load("glClampColor", userptr);
-    glClearBufferfi = (PFNGLCLEARBUFFERFIPROC) load("glClearBufferfi", userptr);
-    glClearBufferfv = (PFNGLCLEARBUFFERFVPROC) load("glClearBufferfv", userptr);
-    glClearBufferiv = (PFNGLCLEARBUFFERIVPROC) load("glClearBufferiv", userptr);
-    glClearBufferuiv = (PFNGLCLEARBUFFERUIVPROC) load("glClearBufferuiv", userptr);
-    glColorMaski = (PFNGLCOLORMASKIPROC) load("glColorMaski", userptr);
-    glDeleteFramebuffers = (PFNGLDELETEFRAMEBUFFERSPROC) load("glDeleteFramebuffers", userptr);
-    glDeleteRenderbuffers = (PFNGLDELETERENDERBUFFERSPROC) load("glDeleteRenderbuffers", userptr);
-    glDeleteVertexArrays = (PFNGLDELETEVERTEXARRAYSPROC) load("glDeleteVertexArrays", userptr);
-    glDisablei = (PFNGLDISABLEIPROC) load("glDisablei", userptr);
-    glEnablei = (PFNGLENABLEIPROC) load("glEnablei", userptr);
-    glEndConditionalRender = (PFNGLENDCONDITIONALRENDERPROC) load("glEndConditionalRender", userptr);
-    glEndTransformFeedback = (PFNGLENDTRANSFORMFEEDBACKPROC) load("glEndTransformFeedback", userptr);
-    glFlushMappedBufferRange = (PFNGLFLUSHMAPPEDBUFFERRANGEPROC) load("glFlushMappedBufferRange", userptr);
-    glFramebufferRenderbuffer = (PFNGLFRAMEBUFFERRENDERBUFFERPROC) load("glFramebufferRenderbuffer", userptr);
-    glFramebufferTexture1D = (PFNGLFRAMEBUFFERTEXTURE1DPROC) load("glFramebufferTexture1D", userptr);
-    glFramebufferTexture2D = (PFNGLFRAMEBUFFERTEXTURE2DPROC) load("glFramebufferTexture2D", userptr);
-    glFramebufferTexture3D = (PFNGLFRAMEBUFFERTEXTURE3DPROC) load("glFramebufferTexture3D", userptr);
-    glFramebufferTextureLayer = (PFNGLFRAMEBUFFERTEXTURELAYERPROC) load("glFramebufferTextureLayer", userptr);
-    glGenFramebuffers = (PFNGLGENFRAMEBUFFERSPROC) load("glGenFramebuffers", userptr);
-    glGenRenderbuffers = (PFNGLGENRENDERBUFFERSPROC) load("glGenRenderbuffers", userptr);
-    glGenVertexArrays = (PFNGLGENVERTEXARRAYSPROC) load("glGenVertexArrays", userptr);
-    glGenerateMipmap = (PFNGLGENERATEMIPMAPPROC) load("glGenerateMipmap", userptr);
-    glGetBooleani_v = (PFNGLGETBOOLEANI_VPROC) load("glGetBooleani_v", userptr);
-    glGetFragDataLocation = (PFNGLGETFRAGDATALOCATIONPROC) load("glGetFragDataLocation", userptr);
-    glGetFramebufferAttachmentParameteriv = (PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC) load("glGetFramebufferAttachmentParameteriv", userptr);
-    glGetIntegeri_v = (PFNGLGETINTEGERI_VPROC) load("glGetIntegeri_v", userptr);
-    glGetRenderbufferParameteriv = (PFNGLGETRENDERBUFFERPARAMETERIVPROC) load("glGetRenderbufferParameteriv", userptr);
-    glGetStringi = (PFNGLGETSTRINGIPROC) load("glGetStringi", userptr);
-    glGetTexParameterIiv = (PFNGLGETTEXPARAMETERIIVPROC) load("glGetTexParameterIiv", userptr);
-    glGetTexParameterIuiv = (PFNGLGETTEXPARAMETERIUIVPROC) load("glGetTexParameterIuiv", userptr);
-    glGetTransformFeedbackVarying = (PFNGLGETTRANSFORMFEEDBACKVARYINGPROC) load("glGetTransformFeedbackVarying", userptr);
-    glGetUniformuiv = (PFNGLGETUNIFORMUIVPROC) load("glGetUniformuiv", userptr);
-    glGetVertexAttribIiv = (PFNGLGETVERTEXATTRIBIIVPROC) load("glGetVertexAttribIiv", userptr);
-    glGetVertexAttribIuiv = (PFNGLGETVERTEXATTRIBIUIVPROC) load("glGetVertexAttribIuiv", userptr);
-    glIsEnabledi = (PFNGLISENABLEDIPROC) load("glIsEnabledi", userptr);
-    glIsFramebuffer = (PFNGLISFRAMEBUFFERPROC) load("glIsFramebuffer", userptr);
-    glIsRenderbuffer = (PFNGLISRENDERBUFFERPROC) load("glIsRenderbuffer", userptr);
-    glIsVertexArray = (PFNGLISVERTEXARRAYPROC) load("glIsVertexArray", userptr);
-    glMapBufferRange = (PFNGLMAPBUFFERRANGEPROC) load("glMapBufferRange", userptr);
-    glRenderbufferStorage = (PFNGLRENDERBUFFERSTORAGEPROC) load("glRenderbufferStorage", userptr);
-    glRenderbufferStorageMultisample = (PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC) load("glRenderbufferStorageMultisample", userptr);
-    glTexParameterIiv = (PFNGLTEXPARAMETERIIVPROC) load("glTexParameterIiv", userptr);
-    glTexParameterIuiv = (PFNGLTEXPARAMETERIUIVPROC) load("glTexParameterIuiv", userptr);
-    glTransformFeedbackVaryings = (PFNGLTRANSFORMFEEDBACKVARYINGSPROC) load("glTransformFeedbackVaryings", userptr);
-    glUniform1ui = (PFNGLUNIFORM1UIPROC) load("glUniform1ui", userptr);
-    glUniform1uiv = (PFNGLUNIFORM1UIVPROC) load("glUniform1uiv", userptr);
-    glUniform2ui = (PFNGLUNIFORM2UIPROC) load("glUniform2ui", userptr);
-    glUniform2uiv = (PFNGLUNIFORM2UIVPROC) load("glUniform2uiv", userptr);
-    glUniform3ui = (PFNGLUNIFORM3UIPROC) load("glUniform3ui", userptr);
-    glUniform3uiv = (PFNGLUNIFORM3UIVPROC) load("glUniform3uiv", userptr);
-    glUniform4ui = (PFNGLUNIFORM4UIPROC) load("glUniform4ui", userptr);
-    glUniform4uiv = (PFNGLUNIFORM4UIVPROC) load("glUniform4uiv", userptr);
-    glVertexAttribI1i = (PFNGLVERTEXATTRIBI1IPROC) load("glVertexAttribI1i", userptr);
-    glVertexAttribI1iv = (PFNGLVERTEXATTRIBI1IVPROC) load("glVertexAttribI1iv", userptr);
-    glVertexAttribI1ui = (PFNGLVERTEXATTRIBI1UIPROC) load("glVertexAttribI1ui", userptr);
-    glVertexAttribI1uiv = (PFNGLVERTEXATTRIBI1UIVPROC) load("glVertexAttribI1uiv", userptr);
-    glVertexAttribI2i = (PFNGLVERTEXATTRIBI2IPROC) load("glVertexAttribI2i", userptr);
-    glVertexAttribI2iv = (PFNGLVERTEXATTRIBI2IVPROC) load("glVertexAttribI2iv", userptr);
-    glVertexAttribI2ui = (PFNGLVERTEXATTRIBI2UIPROC) load("glVertexAttribI2ui", userptr);
-    glVertexAttribI2uiv = (PFNGLVERTEXATTRIBI2UIVPROC) load("glVertexAttribI2uiv", userptr);
-    glVertexAttribI3i = (PFNGLVERTEXATTRIBI3IPROC) load("glVertexAttribI3i", userptr);
-    glVertexAttribI3iv = (PFNGLVERTEXATTRIBI3IVPROC) load("glVertexAttribI3iv", userptr);
-    glVertexAttribI3ui = (PFNGLVERTEXATTRIBI3UIPROC) load("glVertexAttribI3ui", userptr);
-    glVertexAttribI3uiv = (PFNGLVERTEXATTRIBI3UIVPROC) load("glVertexAttribI3uiv", userptr);
-    glVertexAttribI4bv = (PFNGLVERTEXATTRIBI4BVPROC) load("glVertexAttribI4bv", userptr);
-    glVertexAttribI4i = (PFNGLVERTEXATTRIBI4IPROC) load("glVertexAttribI4i", userptr);
-    glVertexAttribI4iv = (PFNGLVERTEXATTRIBI4IVPROC) load("glVertexAttribI4iv", userptr);
-    glVertexAttribI4sv = (PFNGLVERTEXATTRIBI4SVPROC) load("glVertexAttribI4sv", userptr);
-    glVertexAttribI4ubv = (PFNGLVERTEXATTRIBI4UBVPROC) load("glVertexAttribI4ubv", userptr);
-    glVertexAttribI4ui = (PFNGLVERTEXATTRIBI4UIPROC) load("glVertexAttribI4ui", userptr);
-    glVertexAttribI4uiv = (PFNGLVERTEXATTRIBI4UIVPROC) load("glVertexAttribI4uiv", userptr);
-    glVertexAttribI4usv = (PFNGLVERTEXATTRIBI4USVPROC) load("glVertexAttribI4usv", userptr);
-    glVertexAttribIPointer = (PFNGLVERTEXATTRIBIPOINTERPROC) load("glVertexAttribIPointer", userptr);
-}
-static void glad_gl_load_GL_VERSION_3_1( GLADuserptrloadfunc load, void* userptr) {
-    if(!GLAD_GL_VERSION_3_1) return;
-    glBindBufferBase = (PFNGLBINDBUFFERBASEPROC) load("glBindBufferBase", userptr);
-    glBindBufferRange = (PFNGLBINDBUFFERRANGEPROC) load("glBindBufferRange", userptr);
-    glCopyBufferSubData = (PFNGLCOPYBUFFERSUBDATAPROC) load("glCopyBufferSubData", userptr);
-    glDrawArraysInstanced = (PFNGLDRAWARRAYSINSTANCEDPROC) load("glDrawArraysInstanced", userptr);
-    glDrawElementsInstanced = (PFNGLDRAWELEMENTSINSTANCEDPROC) load("glDrawElementsInstanced", userptr);
-    glGetActiveUniformBlockName = (PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC) load("glGetActiveUniformBlockName", userptr);
-    glGetActiveUniformBlockiv = (PFNGLGETACTIVEUNIFORMBLOCKIVPROC) load("glGetActiveUniformBlockiv", userptr);
-    glGetActiveUniformName = (PFNGLGETACTIVEUNIFORMNAMEPROC) load("glGetActiveUniformName", userptr);
-    glGetActiveUniformsiv = (PFNGLGETACTIVEUNIFORMSIVPROC) load("glGetActiveUniformsiv", userptr);
-    glGetIntegeri_v = (PFNGLGETINTEGERI_VPROC) load("glGetIntegeri_v", userptr);
-    glGetUniformBlockIndex = (PFNGLGETUNIFORMBLOCKINDEXPROC) load("glGetUniformBlockIndex", userptr);
-    glGetUniformIndices = (PFNGLGETUNIFORMINDICESPROC) load("glGetUniformIndices", userptr);
-    glPrimitiveRestartIndex = (PFNGLPRIMITIVERESTARTINDEXPROC) load("glPrimitiveRestartIndex", userptr);
-    glTexBuffer = (PFNGLTEXBUFFERPROC) load("glTexBuffer", userptr);
-    glUniformBlockBinding = (PFNGLUNIFORMBLOCKBINDINGPROC) load("glUniformBlockBinding", userptr);
-}
-static void glad_gl_load_GL_VERSION_3_2( GLADuserptrloadfunc load, void* userptr) {
-    if(!GLAD_GL_VERSION_3_2) return;
-    glClientWaitSync = (PFNGLCLIENTWAITSYNCPROC) load("glClientWaitSync", userptr);
-    glDeleteSync = (PFNGLDELETESYNCPROC) load("glDeleteSync", userptr);
-    glDrawElementsBaseVertex = (PFNGLDRAWELEMENTSBASEVERTEXPROC) load("glDrawElementsBaseVertex", userptr);
-    glDrawElementsInstancedBaseVertex = (PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXPROC) load("glDrawElementsInstancedBaseVertex", userptr);
-    glDrawRangeElementsBaseVertex = (PFNGLDRAWRANGEELEMENTSBASEVERTEXPROC) load("glDrawRangeElementsBaseVertex", userptr);
-    glFenceSync = (PFNGLFENCESYNCPROC) load("glFenceSync", userptr);
-    glFramebufferTexture = (PFNGLFRAMEBUFFERTEXTUREPROC) load("glFramebufferTexture", userptr);
-    glGetBufferParameteri64v = (PFNGLGETBUFFERPARAMETERI64VPROC) load("glGetBufferParameteri64v", userptr);
-    glGetInteger64i_v = (PFNGLGETINTEGER64I_VPROC) load("glGetInteger64i_v", userptr);
-    glGetInteger64v = (PFNGLGETINTEGER64VPROC) load("glGetInteger64v", userptr);
-    glGetMultisamplefv = (PFNGLGETMULTISAMPLEFVPROC) load("glGetMultisamplefv", userptr);
-    glGetSynciv = (PFNGLGETSYNCIVPROC) load("glGetSynciv", userptr);
-    glIsSync = (PFNGLISSYNCPROC) load("glIsSync", userptr);
-    glMultiDrawElementsBaseVertex = (PFNGLMULTIDRAWELEMENTSBASEVERTEXPROC) load("glMultiDrawElementsBaseVertex", userptr);
-    glProvokingVertex = (PFNGLPROVOKINGVERTEXPROC) load("glProvokingVertex", userptr);
-    glSampleMaski = (PFNGLSAMPLEMASKIPROC) load("glSampleMaski", userptr);
-    glTexImage2DMultisample = (PFNGLTEXIMAGE2DMULTISAMPLEPROC) load("glTexImage2DMultisample", userptr);
-    glTexImage3DMultisample = (PFNGLTEXIMAGE3DMULTISAMPLEPROC) load("glTexImage3DMultisample", userptr);
-    glWaitSync = (PFNGLWAITSYNCPROC) load("glWaitSync", userptr);
-}
-static void glad_gl_load_GL_VERSION_3_3( GLADuserptrloadfunc load, void* userptr) {
-    if(!GLAD_GL_VERSION_3_3) return;
-    glBindFragDataLocationIndexed = (PFNGLBINDFRAGDATALOCATIONINDEXEDPROC) load("glBindFragDataLocationIndexed", userptr);
-    glBindSampler = (PFNGLBINDSAMPLERPROC) load("glBindSampler", userptr);
-    glColorP3ui = (PFNGLCOLORP3UIPROC) load("glColorP3ui", userptr);
-    glColorP3uiv = (PFNGLCOLORP3UIVPROC) load("glColorP3uiv", userptr);
-    glColorP4ui = (PFNGLCOLORP4UIPROC) load("glColorP4ui", userptr);
-    glColorP4uiv = (PFNGLCOLORP4UIVPROC) load("glColorP4uiv", userptr);
-    glDeleteSamplers = (PFNGLDELETESAMPLERSPROC) load("glDeleteSamplers", userptr);
-    glGenSamplers = (PFNGLGENSAMPLERSPROC) load("glGenSamplers", userptr);
-    glGetFragDataIndex = (PFNGLGETFRAGDATAINDEXPROC) load("glGetFragDataIndex", userptr);
-    glGetQueryObjecti64v = (PFNGLGETQUERYOBJECTI64VPROC) load("glGetQueryObjecti64v", userptr);
-    glGetQueryObjectui64v = (PFNGLGETQUERYOBJECTUI64VPROC) load("glGetQueryObjectui64v", userptr);
-    glGetSamplerParameterIiv = (PFNGLGETSAMPLERPARAMETERIIVPROC) load("glGetSamplerParameterIiv", userptr);
-    glGetSamplerParameterIuiv = (PFNGLGETSAMPLERPARAMETERIUIVPROC) load("glGetSamplerParameterIuiv", userptr);
-    glGetSamplerParameterfv = (PFNGLGETSAMPLERPARAMETERFVPROC) load("glGetSamplerParameterfv", userptr);
-    glGetSamplerParameteriv = (PFNGLGETSAMPLERPARAMETERIVPROC) load("glGetSamplerParameteriv", userptr);
-    glIsSampler = (PFNGLISSAMPLERPROC) load("glIsSampler", userptr);
-    glMultiTexCoordP1ui = (PFNGLMULTITEXCOORDP1UIPROC) load("glMultiTexCoordP1ui", userptr);
-    glMultiTexCoordP1uiv = (PFNGLMULTITEXCOORDP1UIVPROC) load("glMultiTexCoordP1uiv", userptr);
-    glMultiTexCoordP2ui = (PFNGLMULTITEXCOORDP2UIPROC) load("glMultiTexCoordP2ui", userptr);
-    glMultiTexCoordP2uiv = (PFNGLMULTITEXCOORDP2UIVPROC) load("glMultiTexCoordP2uiv", userptr);
-    glMultiTexCoordP3ui = (PFNGLMULTITEXCOORDP3UIPROC) load("glMultiTexCoordP3ui", userptr);
-    glMultiTexCoordP3uiv = (PFNGLMULTITEXCOORDP3UIVPROC) load("glMultiTexCoordP3uiv", userptr);
-    glMultiTexCoordP4ui = (PFNGLMULTITEXCOORDP4UIPROC) load("glMultiTexCoordP4ui", userptr);
-    glMultiTexCoordP4uiv = (PFNGLMULTITEXCOORDP4UIVPROC) load("glMultiTexCoordP4uiv", userptr);
-    glNormalP3ui = (PFNGLNORMALP3UIPROC) load("glNormalP3ui", userptr);
-    glNormalP3uiv = (PFNGLNORMALP3UIVPROC) load("glNormalP3uiv", userptr);
-    glQueryCounter = (PFNGLQUERYCOUNTERPROC) load("glQueryCounter", userptr);
-    glSamplerParameterIiv = (PFNGLSAMPLERPARAMETERIIVPROC) load("glSamplerParameterIiv", userptr);
-    glSamplerParameterIuiv = (PFNGLSAMPLERPARAMETERIUIVPROC) load("glSamplerParameterIuiv", userptr);
-    glSamplerParameterf = (PFNGLSAMPLERPARAMETERFPROC) load("glSamplerParameterf", userptr);
-    glSamplerParameterfv = (PFNGLSAMPLERPARAMETERFVPROC) load("glSamplerParameterfv", userptr);
-    glSamplerParameteri = (PFNGLSAMPLERPARAMETERIPROC) load("glSamplerParameteri", userptr);
-    glSamplerParameteriv = (PFNGLSAMPLERPARAMETERIVPROC) load("glSamplerParameteriv", userptr);
-    glSecondaryColorP3ui = (PFNGLSECONDARYCOLORP3UIPROC) load("glSecondaryColorP3ui", userptr);
-    glSecondaryColorP3uiv = (PFNGLSECONDARYCOLORP3UIVPROC) load("glSecondaryColorP3uiv", userptr);
-    glTexCoordP1ui = (PFNGLTEXCOORDP1UIPROC) load("glTexCoordP1ui", userptr);
-    glTexCoordP1uiv = (PFNGLTEXCOORDP1UIVPROC) load("glTexCoordP1uiv", userptr);
-    glTexCoordP2ui = (PFNGLTEXCOORDP2UIPROC) load("glTexCoordP2ui", userptr);
-    glTexCoordP2uiv = (PFNGLTEXCOORDP2UIVPROC) load("glTexCoordP2uiv", userptr);
-    glTexCoordP3ui = (PFNGLTEXCOORDP3UIPROC) load("glTexCoordP3ui", userptr);
-    glTexCoordP3uiv = (PFNGLTEXCOORDP3UIVPROC) load("glTexCoordP3uiv", userptr);
-    glTexCoordP4ui = (PFNGLTEXCOORDP4UIPROC) load("glTexCoordP4ui", userptr);
-    glTexCoordP4uiv = (PFNGLTEXCOORDP4UIVPROC) load("glTexCoordP4uiv", userptr);
-    glVertexAttribDivisor = (PFNGLVERTEXATTRIBDIVISORPROC) load("glVertexAttribDivisor", userptr);
-    glVertexAttribP1ui = (PFNGLVERTEXATTRIBP1UIPROC) load("glVertexAttribP1ui", userptr);
-    glVertexAttribP1uiv = (PFNGLVERTEXATTRIBP1UIVPROC) load("glVertexAttribP1uiv", userptr);
-    glVertexAttribP2ui = (PFNGLVERTEXATTRIBP2UIPROC) load("glVertexAttribP2ui", userptr);
-    glVertexAttribP2uiv = (PFNGLVERTEXATTRIBP2UIVPROC) load("glVertexAttribP2uiv", userptr);
-    glVertexAttribP3ui = (PFNGLVERTEXATTRIBP3UIPROC) load("glVertexAttribP3ui", userptr);
-    glVertexAttribP3uiv = (PFNGLVERTEXATTRIBP3UIVPROC) load("glVertexAttribP3uiv", userptr);
-    glVertexAttribP4ui = (PFNGLVERTEXATTRIBP4UIPROC) load("glVertexAttribP4ui", userptr);
-    glVertexAttribP4uiv = (PFNGLVERTEXATTRIBP4UIVPROC) load("glVertexAttribP4uiv", userptr);
-    glVertexP2ui = (PFNGLVERTEXP2UIPROC) load("glVertexP2ui", userptr);
-    glVertexP2uiv = (PFNGLVERTEXP2UIVPROC) load("glVertexP2uiv", userptr);
-    glVertexP3ui = (PFNGLVERTEXP3UIPROC) load("glVertexP3ui", userptr);
-    glVertexP3uiv = (PFNGLVERTEXP3UIVPROC) load("glVertexP3uiv", userptr);
-    glVertexP4ui = (PFNGLVERTEXP4UIPROC) load("glVertexP4ui", userptr);
-    glVertexP4uiv = (PFNGLVERTEXP4UIVPROC) load("glVertexP4uiv", userptr);
-}
-static void glad_gl_load_GL_ARB_multisample( GLADuserptrloadfunc load, void* userptr) {
-    if(!GLAD_GL_ARB_multisample) return;
-    glSampleCoverage = (PFNGLSAMPLECOVERAGEPROC) load("glSampleCoverage", userptr);
-    glSampleCoverageARB = (PFNGLSAMPLECOVERAGEARBPROC) load("glSampleCoverageARB", userptr);
-}
-static void glad_gl_load_GL_ARB_robustness( GLADuserptrloadfunc load, void* userptr) {
-    if(!GLAD_GL_ARB_robustness) return;
-    glGetGraphicsResetStatusARB = (PFNGLGETGRAPHICSRESETSTATUSARBPROC) load("glGetGraphicsResetStatusARB", userptr);
-    glGetnColorTableARB = (PFNGLGETNCOLORTABLEARBPROC) load("glGetnColorTableARB", userptr);
-    glGetnCompressedTexImageARB = (PFNGLGETNCOMPRESSEDTEXIMAGEARBPROC) load("glGetnCompressedTexImageARB", userptr);
-    glGetnConvolutionFilterARB = (PFNGLGETNCONVOLUTIONFILTERARBPROC) load("glGetnConvolutionFilterARB", userptr);
-    glGetnHistogramARB = (PFNGLGETNHISTOGRAMARBPROC) load("glGetnHistogramARB", userptr);
-    glGetnMapdvARB = (PFNGLGETNMAPDVARBPROC) load("glGetnMapdvARB", userptr);
-    glGetnMapfvARB = (PFNGLGETNMAPFVARBPROC) load("glGetnMapfvARB", userptr);
-    glGetnMapivARB = (PFNGLGETNMAPIVARBPROC) load("glGetnMapivARB", userptr);
-    glGetnMinmaxARB = (PFNGLGETNMINMAXARBPROC) load("glGetnMinmaxARB", userptr);
-    glGetnPixelMapfvARB = (PFNGLGETNPIXELMAPFVARBPROC) load("glGetnPixelMapfvARB", userptr);
-    glGetnPixelMapuivARB = (PFNGLGETNPIXELMAPUIVARBPROC) load("glGetnPixelMapuivARB", userptr);
-    glGetnPixelMapusvARB = (PFNGLGETNPIXELMAPUSVARBPROC) load("glGetnPixelMapusvARB", userptr);
-    glGetnPolygonStippleARB = (PFNGLGETNPOLYGONSTIPPLEARBPROC) load("glGetnPolygonStippleARB", userptr);
-    glGetnSeparableFilterARB = (PFNGLGETNSEPARABLEFILTERARBPROC) load("glGetnSeparableFilterARB", userptr);
-    glGetnTexImageARB = (PFNGLGETNTEXIMAGEARBPROC) load("glGetnTexImageARB", userptr);
-    glGetnUniformdvARB = (PFNGLGETNUNIFORMDVARBPROC) load("glGetnUniformdvARB", userptr);
-    glGetnUniformfvARB = (PFNGLGETNUNIFORMFVARBPROC) load("glGetnUniformfvARB", userptr);
-    glGetnUniformivARB = (PFNGLGETNUNIFORMIVARBPROC) load("glGetnUniformivARB", userptr);
-    glGetnUniformuivARB = (PFNGLGETNUNIFORMUIVARBPROC) load("glGetnUniformuivARB", userptr);
-    glReadnPixels = (PFNGLREADNPIXELSPROC) load("glReadnPixels", userptr);
-    glReadnPixelsARB = (PFNGLREADNPIXELSARBPROC) load("glReadnPixelsARB", userptr);
-}
-static void glad_gl_load_GL_KHR_debug( GLADuserptrloadfunc load, void* userptr) {
-    if(!GLAD_GL_KHR_debug) return;
-    glDebugMessageCallback = (PFNGLDEBUGMESSAGECALLBACKPROC) load("glDebugMessageCallback", userptr);
-    glDebugMessageControl = (PFNGLDEBUGMESSAGECONTROLPROC) load("glDebugMessageControl", userptr);
-    glDebugMessageInsert = (PFNGLDEBUGMESSAGEINSERTPROC) load("glDebugMessageInsert", userptr);
-    glGetDebugMessageLog = (PFNGLGETDEBUGMESSAGELOGPROC) load("glGetDebugMessageLog", userptr);
-    glGetObjectLabel = (PFNGLGETOBJECTLABELPROC) load("glGetObjectLabel", userptr);
-    glGetObjectPtrLabel = (PFNGLGETOBJECTPTRLABELPROC) load("glGetObjectPtrLabel", userptr);
-    glGetPointerv = (PFNGLGETPOINTERVPROC) load("glGetPointerv", userptr);
-    glObjectLabel = (PFNGLOBJECTLABELPROC) load("glObjectLabel", userptr);
-    glObjectPtrLabel = (PFNGLOBJECTPTRLABELPROC) load("glObjectPtrLabel", userptr);
-    glPopDebugGroup = (PFNGLPOPDEBUGGROUPPROC) load("glPopDebugGroup", userptr);
-    glPushDebugGroup = (PFNGLPUSHDEBUGGROUPPROC) load("glPushDebugGroup", userptr);
-}
-
-
-
-#if defined(GL_ES_VERSION_3_0) || defined(GL_VERSION_3_0)
-#define GLAD_GL_IS_SOME_NEW_VERSION 1
-#else
-#define GLAD_GL_IS_SOME_NEW_VERSION 0
-#endif
-
-static int glad_gl_get_extensions( int version, const char **out_exts, unsigned int *out_num_exts_i, char ***out_exts_i) {
-#if GLAD_GL_IS_SOME_NEW_VERSION
-    if(GLAD_VERSION_MAJOR(version) < 3) {
-#else
-    (void) version;
-    (void) out_num_exts_i;
-    (void) out_exts_i;
-#endif
-        if (glGetString == NULL) {
-            return 0;
-        }
-        *out_exts = (const char *)glGetString(GL_EXTENSIONS);
-#if GLAD_GL_IS_SOME_NEW_VERSION
-    } else {
-        unsigned int index = 0;
-        unsigned int num_exts_i = 0;
-        char **exts_i = NULL;
-        if (glGetStringi == NULL || glGetIntegerv == NULL) {
-            return 0;
-        }
-        glGetIntegerv(GL_NUM_EXTENSIONS, (int*) &num_exts_i);
-        if (num_exts_i > 0) {
-            exts_i = (char **) malloc(num_exts_i * (sizeof *exts_i));
-        }
-        if (exts_i == NULL) {
-            return 0;
-        }
-        for(index = 0; index < num_exts_i; index++) {
-            const char *gl_str_tmp = (const char*) glGetStringi(GL_EXTENSIONS, index);
-            size_t len = strlen(gl_str_tmp) + 1;
-
-            char *local_str = (char*) malloc(len * sizeof(char));
-            if(local_str != NULL) {
-                memcpy(local_str, gl_str_tmp, len * sizeof(char));
-            }
-
-            exts_i[index] = local_str;
-        }
-
-        *out_num_exts_i = num_exts_i;
-        *out_exts_i = exts_i;
-    }
-#endif
-    return 1;
-}
-static void glad_gl_free_extensions(char **exts_i, unsigned int num_exts_i) {
-    if (exts_i != NULL) {
-        unsigned int index;
-        for(index = 0; index < num_exts_i; index++) {
-            free((void *) (exts_i[index]));
-        }
-        free((void *)exts_i);
-        exts_i = NULL;
-    }
-}
-static int glad_gl_has_extension(int version, const char *exts, unsigned int num_exts_i, char **exts_i, const char *ext) {
-    if(GLAD_VERSION_MAJOR(version) < 3 || !GLAD_GL_IS_SOME_NEW_VERSION) {
-        const char *extensions;
-        const char *loc;
-        const char *terminator;
-        extensions = exts;
-        if(extensions == NULL || ext == NULL) {
-            return 0;
-        }
-        while(1) {
-            loc = strstr(extensions, ext);
-            if(loc == NULL) {
-                return 0;
-            }
-            terminator = loc + strlen(ext);
-            if((loc == extensions || *(loc - 1) == ' ') &&
-                (*terminator == ' ' || *terminator == '\0')) {
-                return 1;
-            }
-            extensions = terminator;
-        }
-    } else {
-        unsigned int index;
-        for(index = 0; index < num_exts_i; index++) {
-            const char *e = exts_i[index];
-            if(strcmp(e, ext) == 0) {
-                return 1;
-            }
-        }
-    }
-    return 0;
-}
-
-static GLADapiproc glad_gl_get_proc_from_userptr(const char* name, void *userptr) {
-    return (GLAD_GNUC_EXTENSION (GLADapiproc (*)(const char *name)) userptr)(name);
-}
-
-static int glad_gl_find_extensions_gl( int version) {
-    const char *exts = NULL;
-    unsigned int num_exts_i = 0;
-    char **exts_i = NULL;
-    if (!glad_gl_get_extensions(version, &exts, &num_exts_i, &exts_i)) return 0;
-
-    GLAD_GL_ARB_multisample = glad_gl_has_extension(version, exts, num_exts_i, exts_i, "GL_ARB_multisample");
-    GLAD_GL_ARB_robustness = glad_gl_has_extension(version, exts, num_exts_i, exts_i, "GL_ARB_robustness");
-    GLAD_GL_KHR_debug = glad_gl_has_extension(version, exts, num_exts_i, exts_i, "GL_KHR_debug");
-
-    glad_gl_free_extensions(exts_i, num_exts_i);
-
-    return 1;
-}
-
-static int glad_gl_find_core_gl(void) {
-    int i, major, minor;
-    const char* version;
-    const char* prefixes[] = {
-        "OpenGL ES-CM ",
-        "OpenGL ES-CL ",
-        "OpenGL ES ",
-        NULL
-    };
-    version = (const char*) glGetString(GL_VERSION);
-    if (!version) return 0;
-    for (i = 0;  prefixes[i];  i++) {
-        const size_t length = strlen(prefixes[i]);
-        if (strncmp(version, prefixes[i], length) == 0) {
-            version += length;
-            break;
-        }
-    }
-
-    GLAD_IMPL_UTIL_SSCANF(version, "%d.%d", &major, &minor);
-
-    GLAD_GL_VERSION_1_0 = (major == 1 && minor >= 0) || major > 1;
-    GLAD_GL_VERSION_1_1 = (major == 1 && minor >= 1) || major > 1;
-    GLAD_GL_VERSION_1_2 = (major == 1 && minor >= 2) || major > 1;
-    GLAD_GL_VERSION_1_3 = (major == 1 && minor >= 3) || major > 1;
-    GLAD_GL_VERSION_1_4 = (major == 1 && minor >= 4) || major > 1;
-    GLAD_GL_VERSION_1_5 = (major == 1 && minor >= 5) || major > 1;
-    GLAD_GL_VERSION_2_0 = (major == 2 && minor >= 0) || major > 2;
-    GLAD_GL_VERSION_2_1 = (major == 2 && minor >= 1) || major > 2;
-    GLAD_GL_VERSION_3_0 = (major == 3 && minor >= 0) || major > 3;
-    GLAD_GL_VERSION_3_1 = (major == 3 && minor >= 1) || major > 3;
-    GLAD_GL_VERSION_3_2 = (major == 3 && minor >= 2) || major > 3;
-    GLAD_GL_VERSION_3_3 = (major == 3 && minor >= 3) || major > 3;
-
-    return GLAD_MAKE_VERSION(major, minor);
-}
-
-int gladLoadGLUserPtr( GLADuserptrloadfunc load, void *userptr) {
-    int version;
-
-    glGetString = (PFNGLGETSTRINGPROC) load("glGetString", userptr);
-    if(glGetString == NULL) return 0;
-    if(glGetString(GL_VERSION) == NULL) return 0;
-    version = glad_gl_find_core_gl();
-
-    glad_gl_load_GL_VERSION_1_0(load, userptr);
-    glad_gl_load_GL_VERSION_1_1(load, userptr);
-    glad_gl_load_GL_VERSION_1_2(load, userptr);
-    glad_gl_load_GL_VERSION_1_3(load, userptr);
-    glad_gl_load_GL_VERSION_1_4(load, userptr);
-    glad_gl_load_GL_VERSION_1_5(load, userptr);
-    glad_gl_load_GL_VERSION_2_0(load, userptr);
-    glad_gl_load_GL_VERSION_2_1(load, userptr);
-    glad_gl_load_GL_VERSION_3_0(load, userptr);
-    glad_gl_load_GL_VERSION_3_1(load, userptr);
-    glad_gl_load_GL_VERSION_3_2(load, userptr);
-    glad_gl_load_GL_VERSION_3_3(load, userptr);
-
-    if (!glad_gl_find_extensions_gl(version)) return 0;
-    glad_gl_load_GL_ARB_multisample(load, userptr);
-    glad_gl_load_GL_ARB_robustness(load, userptr);
-    glad_gl_load_GL_KHR_debug(load, userptr);
-
-
-
-    return version;
-}
-
-
-int gladLoadGL( GLADloadfunc load) {
-    return gladLoadGLUserPtr( glad_gl_get_proc_from_userptr, GLAD_GNUC_EXTENSION (void*) load);
-}
-
-
-
-
diff --git a/deps/glad_vulkan.c b/deps/glad_vulkan.c
deleted file mode 100644
index 6559df8..0000000
--- a/deps/glad_vulkan.c
+++ /dev/null
@@ -1,733 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <glad/vulkan.h>
-
-#ifndef GLAD_IMPL_UTIL_C_
-#define GLAD_IMPL_UTIL_C_
-
-#ifdef _MSC_VER
-#define GLAD_IMPL_UTIL_SSCANF sscanf_s
-#else
-#define GLAD_IMPL_UTIL_SSCANF sscanf
-#endif
-
-#endif /* GLAD_IMPL_UTIL_C_ */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-
-int GLAD_VK_VERSION_1_0 = 0;
-int GLAD_VK_VERSION_1_1 = 0;
-int GLAD_VK_VERSION_1_2 = 0;
-int GLAD_VK_VERSION_1_3 = 0;
-int GLAD_VK_EXT_debug_report = 0;
-int GLAD_VK_KHR_portability_enumeration = 0;
-int GLAD_VK_KHR_surface = 0;
-int GLAD_VK_KHR_swapchain = 0;
-
-
-
-PFN_vkAcquireNextImage2KHR glad_vkAcquireNextImage2KHR = NULL;
-PFN_vkAcquireNextImageKHR glad_vkAcquireNextImageKHR = NULL;
-PFN_vkAllocateCommandBuffers glad_vkAllocateCommandBuffers = NULL;
-PFN_vkAllocateDescriptorSets glad_vkAllocateDescriptorSets = NULL;
-PFN_vkAllocateMemory glad_vkAllocateMemory = NULL;
-PFN_vkBeginCommandBuffer glad_vkBeginCommandBuffer = NULL;
-PFN_vkBindBufferMemory glad_vkBindBufferMemory = NULL;
-PFN_vkBindBufferMemory2 glad_vkBindBufferMemory2 = NULL;
-PFN_vkBindImageMemory glad_vkBindImageMemory = NULL;
-PFN_vkBindImageMemory2 glad_vkBindImageMemory2 = NULL;
-PFN_vkCmdBeginQuery glad_vkCmdBeginQuery = NULL;
-PFN_vkCmdBeginRenderPass glad_vkCmdBeginRenderPass = NULL;
-PFN_vkCmdBeginRenderPass2 glad_vkCmdBeginRenderPass2 = NULL;
-PFN_vkCmdBeginRendering glad_vkCmdBeginRendering = NULL;
-PFN_vkCmdBindDescriptorSets glad_vkCmdBindDescriptorSets = NULL;
-PFN_vkCmdBindIndexBuffer glad_vkCmdBindIndexBuffer = NULL;
-PFN_vkCmdBindPipeline glad_vkCmdBindPipeline = NULL;
-PFN_vkCmdBindVertexBuffers glad_vkCmdBindVertexBuffers = NULL;
-PFN_vkCmdBindVertexBuffers2 glad_vkCmdBindVertexBuffers2 = NULL;
-PFN_vkCmdBlitImage glad_vkCmdBlitImage = NULL;
-PFN_vkCmdBlitImage2 glad_vkCmdBlitImage2 = NULL;
-PFN_vkCmdClearAttachments glad_vkCmdClearAttachments = NULL;
-PFN_vkCmdClearColorImage glad_vkCmdClearColorImage = NULL;
-PFN_vkCmdClearDepthStencilImage glad_vkCmdClearDepthStencilImage = NULL;
-PFN_vkCmdCopyBuffer glad_vkCmdCopyBuffer = NULL;
-PFN_vkCmdCopyBuffer2 glad_vkCmdCopyBuffer2 = NULL;
-PFN_vkCmdCopyBufferToImage glad_vkCmdCopyBufferToImage = NULL;
-PFN_vkCmdCopyBufferToImage2 glad_vkCmdCopyBufferToImage2 = NULL;
-PFN_vkCmdCopyImage glad_vkCmdCopyImage = NULL;
-PFN_vkCmdCopyImage2 glad_vkCmdCopyImage2 = NULL;
-PFN_vkCmdCopyImageToBuffer glad_vkCmdCopyImageToBuffer = NULL;
-PFN_vkCmdCopyImageToBuffer2 glad_vkCmdCopyImageToBuffer2 = NULL;
-PFN_vkCmdCopyQueryPoolResults glad_vkCmdCopyQueryPoolResults = NULL;
-PFN_vkCmdDispatch glad_vkCmdDispatch = NULL;
-PFN_vkCmdDispatchBase glad_vkCmdDispatchBase = NULL;
-PFN_vkCmdDispatchIndirect glad_vkCmdDispatchIndirect = NULL;
-PFN_vkCmdDraw glad_vkCmdDraw = NULL;
-PFN_vkCmdDrawIndexed glad_vkCmdDrawIndexed = NULL;
-PFN_vkCmdDrawIndexedIndirect glad_vkCmdDrawIndexedIndirect = NULL;
-PFN_vkCmdDrawIndexedIndirectCount glad_vkCmdDrawIndexedIndirectCount = NULL;
-PFN_vkCmdDrawIndirect glad_vkCmdDrawIndirect = NULL;
-PFN_vkCmdDrawIndirectCount glad_vkCmdDrawIndirectCount = NULL;
-PFN_vkCmdEndQuery glad_vkCmdEndQuery = NULL;
-PFN_vkCmdEndRenderPass glad_vkCmdEndRenderPass = NULL;
-PFN_vkCmdEndRenderPass2 glad_vkCmdEndRenderPass2 = NULL;
-PFN_vkCmdEndRendering glad_vkCmdEndRendering = NULL;
-PFN_vkCmdExecuteCommands glad_vkCmdExecuteCommands = NULL;
-PFN_vkCmdFillBuffer glad_vkCmdFillBuffer = NULL;
-PFN_vkCmdNextSubpass glad_vkCmdNextSubpass = NULL;
-PFN_vkCmdNextSubpass2 glad_vkCmdNextSubpass2 = NULL;
-PFN_vkCmdPipelineBarrier glad_vkCmdPipelineBarrier = NULL;
-PFN_vkCmdPipelineBarrier2 glad_vkCmdPipelineBarrier2 = NULL;
-PFN_vkCmdPushConstants glad_vkCmdPushConstants = NULL;
-PFN_vkCmdResetEvent glad_vkCmdResetEvent = NULL;
-PFN_vkCmdResetEvent2 glad_vkCmdResetEvent2 = NULL;
-PFN_vkCmdResetQueryPool glad_vkCmdResetQueryPool = NULL;
-PFN_vkCmdResolveImage glad_vkCmdResolveImage = NULL;
-PFN_vkCmdResolveImage2 glad_vkCmdResolveImage2 = NULL;
-PFN_vkCmdSetBlendConstants glad_vkCmdSetBlendConstants = NULL;
-PFN_vkCmdSetCullMode glad_vkCmdSetCullMode = NULL;
-PFN_vkCmdSetDepthBias glad_vkCmdSetDepthBias = NULL;
-PFN_vkCmdSetDepthBiasEnable glad_vkCmdSetDepthBiasEnable = NULL;
-PFN_vkCmdSetDepthBounds glad_vkCmdSetDepthBounds = NULL;
-PFN_vkCmdSetDepthBoundsTestEnable glad_vkCmdSetDepthBoundsTestEnable = NULL;
-PFN_vkCmdSetDepthCompareOp glad_vkCmdSetDepthCompareOp = NULL;
-PFN_vkCmdSetDepthTestEnable glad_vkCmdSetDepthTestEnable = NULL;
-PFN_vkCmdSetDepthWriteEnable glad_vkCmdSetDepthWriteEnable = NULL;
-PFN_vkCmdSetDeviceMask glad_vkCmdSetDeviceMask = NULL;
-PFN_vkCmdSetEvent glad_vkCmdSetEvent = NULL;
-PFN_vkCmdSetEvent2 glad_vkCmdSetEvent2 = NULL;
-PFN_vkCmdSetFrontFace glad_vkCmdSetFrontFace = NULL;
-PFN_vkCmdSetLineWidth glad_vkCmdSetLineWidth = NULL;
-PFN_vkCmdSetPrimitiveRestartEnable glad_vkCmdSetPrimitiveRestartEnable = NULL;
-PFN_vkCmdSetPrimitiveTopology glad_vkCmdSetPrimitiveTopology = NULL;
-PFN_vkCmdSetRasterizerDiscardEnable glad_vkCmdSetRasterizerDiscardEnable = NULL;
-PFN_vkCmdSetScissor glad_vkCmdSetScissor = NULL;
-PFN_vkCmdSetScissorWithCount glad_vkCmdSetScissorWithCount = NULL;
-PFN_vkCmdSetStencilCompareMask glad_vkCmdSetStencilCompareMask = NULL;
-PFN_vkCmdSetStencilOp glad_vkCmdSetStencilOp = NULL;
-PFN_vkCmdSetStencilReference glad_vkCmdSetStencilReference = NULL;
-PFN_vkCmdSetStencilTestEnable glad_vkCmdSetStencilTestEnable = NULL;
-PFN_vkCmdSetStencilWriteMask glad_vkCmdSetStencilWriteMask = NULL;
-PFN_vkCmdSetViewport glad_vkCmdSetViewport = NULL;
-PFN_vkCmdSetViewportWithCount glad_vkCmdSetViewportWithCount = NULL;
-PFN_vkCmdUpdateBuffer glad_vkCmdUpdateBuffer = NULL;
-PFN_vkCmdWaitEvents glad_vkCmdWaitEvents = NULL;
-PFN_vkCmdWaitEvents2 glad_vkCmdWaitEvents2 = NULL;
-PFN_vkCmdWriteTimestamp glad_vkCmdWriteTimestamp = NULL;
-PFN_vkCmdWriteTimestamp2 glad_vkCmdWriteTimestamp2 = NULL;
-PFN_vkCreateBuffer glad_vkCreateBuffer = NULL;
-PFN_vkCreateBufferView glad_vkCreateBufferView = NULL;
-PFN_vkCreateCommandPool glad_vkCreateCommandPool = NULL;
-PFN_vkCreateComputePipelines glad_vkCreateComputePipelines = NULL;
-PFN_vkCreateDebugReportCallbackEXT glad_vkCreateDebugReportCallbackEXT = NULL;
-PFN_vkCreateDescriptorPool glad_vkCreateDescriptorPool = NULL;
-PFN_vkCreateDescriptorSetLayout glad_vkCreateDescriptorSetLayout = NULL;
-PFN_vkCreateDescriptorUpdateTemplate glad_vkCreateDescriptorUpdateTemplate = NULL;
-PFN_vkCreateDevice glad_vkCreateDevice = NULL;
-PFN_vkCreateEvent glad_vkCreateEvent = NULL;
-PFN_vkCreateFence glad_vkCreateFence = NULL;
-PFN_vkCreateFramebuffer glad_vkCreateFramebuffer = NULL;
-PFN_vkCreateGraphicsPipelines glad_vkCreateGraphicsPipelines = NULL;
-PFN_vkCreateImage glad_vkCreateImage = NULL;
-PFN_vkCreateImageView glad_vkCreateImageView = NULL;
-PFN_vkCreateInstance glad_vkCreateInstance = NULL;
-PFN_vkCreatePipelineCache glad_vkCreatePipelineCache = NULL;
-PFN_vkCreatePipelineLayout glad_vkCreatePipelineLayout = NULL;
-PFN_vkCreatePrivateDataSlot glad_vkCreatePrivateDataSlot = NULL;
-PFN_vkCreateQueryPool glad_vkCreateQueryPool = NULL;
-PFN_vkCreateRenderPass glad_vkCreateRenderPass = NULL;
-PFN_vkCreateRenderPass2 glad_vkCreateRenderPass2 = NULL;
-PFN_vkCreateSampler glad_vkCreateSampler = NULL;
-PFN_vkCreateSamplerYcbcrConversion glad_vkCreateSamplerYcbcrConversion = NULL;
-PFN_vkCreateSemaphore glad_vkCreateSemaphore = NULL;
-PFN_vkCreateShaderModule glad_vkCreateShaderModule = NULL;
-PFN_vkCreateSwapchainKHR glad_vkCreateSwapchainKHR = NULL;
-PFN_vkDebugReportMessageEXT glad_vkDebugReportMessageEXT = NULL;
-PFN_vkDestroyBuffer glad_vkDestroyBuffer = NULL;
-PFN_vkDestroyBufferView glad_vkDestroyBufferView = NULL;
-PFN_vkDestroyCommandPool glad_vkDestroyCommandPool = NULL;
-PFN_vkDestroyDebugReportCallbackEXT glad_vkDestroyDebugReportCallbackEXT = NULL;
-PFN_vkDestroyDescriptorPool glad_vkDestroyDescriptorPool = NULL;
-PFN_vkDestroyDescriptorSetLayout glad_vkDestroyDescriptorSetLayout = NULL;
-PFN_vkDestroyDescriptorUpdateTemplate glad_vkDestroyDescriptorUpdateTemplate = NULL;
-PFN_vkDestroyDevice glad_vkDestroyDevice = NULL;
-PFN_vkDestroyEvent glad_vkDestroyEvent = NULL;
-PFN_vkDestroyFence glad_vkDestroyFence = NULL;
-PFN_vkDestroyFramebuffer glad_vkDestroyFramebuffer = NULL;
-PFN_vkDestroyImage glad_vkDestroyImage = NULL;
-PFN_vkDestroyImageView glad_vkDestroyImageView = NULL;
-PFN_vkDestroyInstance glad_vkDestroyInstance = NULL;
-PFN_vkDestroyPipeline glad_vkDestroyPipeline = NULL;
-PFN_vkDestroyPipelineCache glad_vkDestroyPipelineCache = NULL;
-PFN_vkDestroyPipelineLayout glad_vkDestroyPipelineLayout = NULL;
-PFN_vkDestroyPrivateDataSlot glad_vkDestroyPrivateDataSlot = NULL;
-PFN_vkDestroyQueryPool glad_vkDestroyQueryPool = NULL;
-PFN_vkDestroyRenderPass glad_vkDestroyRenderPass = NULL;
-PFN_vkDestroySampler glad_vkDestroySampler = NULL;
-PFN_vkDestroySamplerYcbcrConversion glad_vkDestroySamplerYcbcrConversion = NULL;
-PFN_vkDestroySemaphore glad_vkDestroySemaphore = NULL;
-PFN_vkDestroyShaderModule glad_vkDestroyShaderModule = NULL;
-PFN_vkDestroySurfaceKHR glad_vkDestroySurfaceKHR = NULL;
-PFN_vkDestroySwapchainKHR glad_vkDestroySwapchainKHR = NULL;
-PFN_vkDeviceWaitIdle glad_vkDeviceWaitIdle = NULL;
-PFN_vkEndCommandBuffer glad_vkEndCommandBuffer = NULL;
-PFN_vkEnumerateDeviceExtensionProperties glad_vkEnumerateDeviceExtensionProperties = NULL;
-PFN_vkEnumerateDeviceLayerProperties glad_vkEnumerateDeviceLayerProperties = NULL;
-PFN_vkEnumerateInstanceExtensionProperties glad_vkEnumerateInstanceExtensionProperties = NULL;
-PFN_vkEnumerateInstanceLayerProperties glad_vkEnumerateInstanceLayerProperties = NULL;
-PFN_vkEnumerateInstanceVersion glad_vkEnumerateInstanceVersion = NULL;
-PFN_vkEnumeratePhysicalDeviceGroups glad_vkEnumeratePhysicalDeviceGroups = NULL;
-PFN_vkEnumeratePhysicalDevices glad_vkEnumeratePhysicalDevices = NULL;
-PFN_vkFlushMappedMemoryRanges glad_vkFlushMappedMemoryRanges = NULL;
-PFN_vkFreeCommandBuffers glad_vkFreeCommandBuffers = NULL;
-PFN_vkFreeDescriptorSets glad_vkFreeDescriptorSets = NULL;
-PFN_vkFreeMemory glad_vkFreeMemory = NULL;
-PFN_vkGetBufferDeviceAddress glad_vkGetBufferDeviceAddress = NULL;
-PFN_vkGetBufferMemoryRequirements glad_vkGetBufferMemoryRequirements = NULL;
-PFN_vkGetBufferMemoryRequirements2 glad_vkGetBufferMemoryRequirements2 = NULL;
-PFN_vkGetBufferOpaqueCaptureAddress glad_vkGetBufferOpaqueCaptureAddress = NULL;
-PFN_vkGetDescriptorSetLayoutSupport glad_vkGetDescriptorSetLayoutSupport = NULL;
-PFN_vkGetDeviceBufferMemoryRequirements glad_vkGetDeviceBufferMemoryRequirements = NULL;
-PFN_vkGetDeviceGroupPeerMemoryFeatures glad_vkGetDeviceGroupPeerMemoryFeatures = NULL;
-PFN_vkGetDeviceGroupPresentCapabilitiesKHR glad_vkGetDeviceGroupPresentCapabilitiesKHR = NULL;
-PFN_vkGetDeviceGroupSurfacePresentModesKHR glad_vkGetDeviceGroupSurfacePresentModesKHR = NULL;
-PFN_vkGetDeviceImageMemoryRequirements glad_vkGetDeviceImageMemoryRequirements = NULL;
-PFN_vkGetDeviceImageSparseMemoryRequirements glad_vkGetDeviceImageSparseMemoryRequirements = NULL;
-PFN_vkGetDeviceMemoryCommitment glad_vkGetDeviceMemoryCommitment = NULL;
-PFN_vkGetDeviceMemoryOpaqueCaptureAddress glad_vkGetDeviceMemoryOpaqueCaptureAddress = NULL;
-PFN_vkGetDeviceProcAddr glad_vkGetDeviceProcAddr = NULL;
-PFN_vkGetDeviceQueue glad_vkGetDeviceQueue = NULL;
-PFN_vkGetDeviceQueue2 glad_vkGetDeviceQueue2 = NULL;
-PFN_vkGetEventStatus glad_vkGetEventStatus = NULL;
-PFN_vkGetFenceStatus glad_vkGetFenceStatus = NULL;
-PFN_vkGetImageMemoryRequirements glad_vkGetImageMemoryRequirements = NULL;
-PFN_vkGetImageMemoryRequirements2 glad_vkGetImageMemoryRequirements2 = NULL;
-PFN_vkGetImageSparseMemoryRequirements glad_vkGetImageSparseMemoryRequirements = NULL;
-PFN_vkGetImageSparseMemoryRequirements2 glad_vkGetImageSparseMemoryRequirements2 = NULL;
-PFN_vkGetImageSubresourceLayout glad_vkGetImageSubresourceLayout = NULL;
-PFN_vkGetInstanceProcAddr glad_vkGetInstanceProcAddr = NULL;
-PFN_vkGetPhysicalDeviceExternalBufferProperties glad_vkGetPhysicalDeviceExternalBufferProperties = NULL;
-PFN_vkGetPhysicalDeviceExternalFenceProperties glad_vkGetPhysicalDeviceExternalFenceProperties = NULL;
-PFN_vkGetPhysicalDeviceExternalSemaphoreProperties glad_vkGetPhysicalDeviceExternalSemaphoreProperties = NULL;
-PFN_vkGetPhysicalDeviceFeatures glad_vkGetPhysicalDeviceFeatures = NULL;
-PFN_vkGetPhysicalDeviceFeatures2 glad_vkGetPhysicalDeviceFeatures2 = NULL;
-PFN_vkGetPhysicalDeviceFormatProperties glad_vkGetPhysicalDeviceFormatProperties = NULL;
-PFN_vkGetPhysicalDeviceFormatProperties2 glad_vkGetPhysicalDeviceFormatProperties2 = NULL;
-PFN_vkGetPhysicalDeviceImageFormatProperties glad_vkGetPhysicalDeviceImageFormatProperties = NULL;
-PFN_vkGetPhysicalDeviceImageFormatProperties2 glad_vkGetPhysicalDeviceImageFormatProperties2 = NULL;
-PFN_vkGetPhysicalDeviceMemoryProperties glad_vkGetPhysicalDeviceMemoryProperties = NULL;
-PFN_vkGetPhysicalDeviceMemoryProperties2 glad_vkGetPhysicalDeviceMemoryProperties2 = NULL;
-PFN_vkGetPhysicalDevicePresentRectanglesKHR glad_vkGetPhysicalDevicePresentRectanglesKHR = NULL;
-PFN_vkGetPhysicalDeviceProperties glad_vkGetPhysicalDeviceProperties = NULL;
-PFN_vkGetPhysicalDeviceProperties2 glad_vkGetPhysicalDeviceProperties2 = NULL;
-PFN_vkGetPhysicalDeviceQueueFamilyProperties glad_vkGetPhysicalDeviceQueueFamilyProperties = NULL;
-PFN_vkGetPhysicalDeviceQueueFamilyProperties2 glad_vkGetPhysicalDeviceQueueFamilyProperties2 = NULL;
-PFN_vkGetPhysicalDeviceSparseImageFormatProperties glad_vkGetPhysicalDeviceSparseImageFormatProperties = NULL;
-PFN_vkGetPhysicalDeviceSparseImageFormatProperties2 glad_vkGetPhysicalDeviceSparseImageFormatProperties2 = NULL;
-PFN_vkGetPhysicalDeviceSurfaceCapabilitiesKHR glad_vkGetPhysicalDeviceSurfaceCapabilitiesKHR = NULL;
-PFN_vkGetPhysicalDeviceSurfaceFormatsKHR glad_vkGetPhysicalDeviceSurfaceFormatsKHR = NULL;
-PFN_vkGetPhysicalDeviceSurfacePresentModesKHR glad_vkGetPhysicalDeviceSurfacePresentModesKHR = NULL;
-PFN_vkGetPhysicalDeviceSurfaceSupportKHR glad_vkGetPhysicalDeviceSurfaceSupportKHR = NULL;
-PFN_vkGetPhysicalDeviceToolProperties glad_vkGetPhysicalDeviceToolProperties = NULL;
-PFN_vkGetPipelineCacheData glad_vkGetPipelineCacheData = NULL;
-PFN_vkGetPrivateData glad_vkGetPrivateData = NULL;
-PFN_vkGetQueryPoolResults glad_vkGetQueryPoolResults = NULL;
-PFN_vkGetRenderAreaGranularity glad_vkGetRenderAreaGranularity = NULL;
-PFN_vkGetSemaphoreCounterValue glad_vkGetSemaphoreCounterValue = NULL;
-PFN_vkGetSwapchainImagesKHR glad_vkGetSwapchainImagesKHR = NULL;
-PFN_vkInvalidateMappedMemoryRanges glad_vkInvalidateMappedMemoryRanges = NULL;
-PFN_vkMapMemory glad_vkMapMemory = NULL;
-PFN_vkMergePipelineCaches glad_vkMergePipelineCaches = NULL;
-PFN_vkQueueBindSparse glad_vkQueueBindSparse = NULL;
-PFN_vkQueuePresentKHR glad_vkQueuePresentKHR = NULL;
-PFN_vkQueueSubmit glad_vkQueueSubmit = NULL;
-PFN_vkQueueSubmit2 glad_vkQueueSubmit2 = NULL;
-PFN_vkQueueWaitIdle glad_vkQueueWaitIdle = NULL;
-PFN_vkResetCommandBuffer glad_vkResetCommandBuffer = NULL;
-PFN_vkResetCommandPool glad_vkResetCommandPool = NULL;
-PFN_vkResetDescriptorPool glad_vkResetDescriptorPool = NULL;
-PFN_vkResetEvent glad_vkResetEvent = NULL;
-PFN_vkResetFences glad_vkResetFences = NULL;
-PFN_vkResetQueryPool glad_vkResetQueryPool = NULL;
-PFN_vkSetEvent glad_vkSetEvent = NULL;
-PFN_vkSetPrivateData glad_vkSetPrivateData = NULL;
-PFN_vkSignalSemaphore glad_vkSignalSemaphore = NULL;
-PFN_vkTrimCommandPool glad_vkTrimCommandPool = NULL;
-PFN_vkUnmapMemory glad_vkUnmapMemory = NULL;
-PFN_vkUpdateDescriptorSetWithTemplate glad_vkUpdateDescriptorSetWithTemplate = NULL;
-PFN_vkUpdateDescriptorSets glad_vkUpdateDescriptorSets = NULL;
-PFN_vkWaitForFences glad_vkWaitForFences = NULL;
-PFN_vkWaitSemaphores glad_vkWaitSemaphores = NULL;
-
-
-static void glad_vk_load_VK_VERSION_1_0( GLADuserptrloadfunc load, void* userptr) {
-    if(!GLAD_VK_VERSION_1_0) return;
-    glad_vkAllocateCommandBuffers = (PFN_vkAllocateCommandBuffers) load(userptr, "vkAllocateCommandBuffers");
-    glad_vkAllocateDescriptorSets = (PFN_vkAllocateDescriptorSets) load(userptr, "vkAllocateDescriptorSets");
-    glad_vkAllocateMemory = (PFN_vkAllocateMemory) load(userptr, "vkAllocateMemory");
-    glad_vkBeginCommandBuffer = (PFN_vkBeginCommandBuffer) load(userptr, "vkBeginCommandBuffer");
-    glad_vkBindBufferMemory = (PFN_vkBindBufferMemory) load(userptr, "vkBindBufferMemory");
-    glad_vkBindImageMemory = (PFN_vkBindImageMemory) load(userptr, "vkBindImageMemory");
-    glad_vkCmdBeginQuery = (PFN_vkCmdBeginQuery) load(userptr, "vkCmdBeginQuery");
-    glad_vkCmdBeginRenderPass = (PFN_vkCmdBeginRenderPass) load(userptr, "vkCmdBeginRenderPass");
-    glad_vkCmdBindDescriptorSets = (PFN_vkCmdBindDescriptorSets) load(userptr, "vkCmdBindDescriptorSets");
-    glad_vkCmdBindIndexBuffer = (PFN_vkCmdBindIndexBuffer) load(userptr, "vkCmdBindIndexBuffer");
-    glad_vkCmdBindPipeline = (PFN_vkCmdBindPipeline) load(userptr, "vkCmdBindPipeline");
-    glad_vkCmdBindVertexBuffers = (PFN_vkCmdBindVertexBuffers) load(userptr, "vkCmdBindVertexBuffers");
-    glad_vkCmdBlitImage = (PFN_vkCmdBlitImage) load(userptr, "vkCmdBlitImage");
-    glad_vkCmdClearAttachments = (PFN_vkCmdClearAttachments) load(userptr, "vkCmdClearAttachments");
-    glad_vkCmdClearColorImage = (PFN_vkCmdClearColorImage) load(userptr, "vkCmdClearColorImage");
-    glad_vkCmdClearDepthStencilImage = (PFN_vkCmdClearDepthStencilImage) load(userptr, "vkCmdClearDepthStencilImage");
-    glad_vkCmdCopyBuffer = (PFN_vkCmdCopyBuffer) load(userptr, "vkCmdCopyBuffer");
-    glad_vkCmdCopyBufferToImage = (PFN_vkCmdCopyBufferToImage) load(userptr, "vkCmdCopyBufferToImage");
-    glad_vkCmdCopyImage = (PFN_vkCmdCopyImage) load(userptr, "vkCmdCopyImage");
-    glad_vkCmdCopyImageToBuffer = (PFN_vkCmdCopyImageToBuffer) load(userptr, "vkCmdCopyImageToBuffer");
-    glad_vkCmdCopyQueryPoolResults = (PFN_vkCmdCopyQueryPoolResults) load(userptr, "vkCmdCopyQueryPoolResults");
-    glad_vkCmdDispatch = (PFN_vkCmdDispatch) load(userptr, "vkCmdDispatch");
-    glad_vkCmdDispatchIndirect = (PFN_vkCmdDispatchIndirect) load(userptr, "vkCmdDispatchIndirect");
-    glad_vkCmdDraw = (PFN_vkCmdDraw) load(userptr, "vkCmdDraw");
-    glad_vkCmdDrawIndexed = (PFN_vkCmdDrawIndexed) load(userptr, "vkCmdDrawIndexed");
-    glad_vkCmdDrawIndexedIndirect = (PFN_vkCmdDrawIndexedIndirect) load(userptr, "vkCmdDrawIndexedIndirect");
-    glad_vkCmdDrawIndirect = (PFN_vkCmdDrawIndirect) load(userptr, "vkCmdDrawIndirect");
-    glad_vkCmdEndQuery = (PFN_vkCmdEndQuery) load(userptr, "vkCmdEndQuery");
-    glad_vkCmdEndRenderPass = (PFN_vkCmdEndRenderPass) load(userptr, "vkCmdEndRenderPass");
-    glad_vkCmdExecuteCommands = (PFN_vkCmdExecuteCommands) load(userptr, "vkCmdExecuteCommands");
-    glad_vkCmdFillBuffer = (PFN_vkCmdFillBuffer) load(userptr, "vkCmdFillBuffer");
-    glad_vkCmdNextSubpass = (PFN_vkCmdNextSubpass) load(userptr, "vkCmdNextSubpass");
-    glad_vkCmdPipelineBarrier = (PFN_vkCmdPipelineBarrier) load(userptr, "vkCmdPipelineBarrier");
-    glad_vkCmdPushConstants = (PFN_vkCmdPushConstants) load(userptr, "vkCmdPushConstants");
-    glad_vkCmdResetEvent = (PFN_vkCmdResetEvent) load(userptr, "vkCmdResetEvent");
-    glad_vkCmdResetQueryPool = (PFN_vkCmdResetQueryPool) load(userptr, "vkCmdResetQueryPool");
-    glad_vkCmdResolveImage = (PFN_vkCmdResolveImage) load(userptr, "vkCmdResolveImage");
-    glad_vkCmdSetBlendConstants = (PFN_vkCmdSetBlendConstants) load(userptr, "vkCmdSetBlendConstants");
-    glad_vkCmdSetDepthBias = (PFN_vkCmdSetDepthBias) load(userptr, "vkCmdSetDepthBias");
-    glad_vkCmdSetDepthBounds = (PFN_vkCmdSetDepthBounds) load(userptr, "vkCmdSetDepthBounds");
-    glad_vkCmdSetEvent = (PFN_vkCmdSetEvent) load(userptr, "vkCmdSetEvent");
-    glad_vkCmdSetLineWidth = (PFN_vkCmdSetLineWidth) load(userptr, "vkCmdSetLineWidth");
-    glad_vkCmdSetScissor = (PFN_vkCmdSetScissor) load(userptr, "vkCmdSetScissor");
-    glad_vkCmdSetStencilCompareMask = (PFN_vkCmdSetStencilCompareMask) load(userptr, "vkCmdSetStencilCompareMask");
-    glad_vkCmdSetStencilReference = (PFN_vkCmdSetStencilReference) load(userptr, "vkCmdSetStencilReference");
-    glad_vkCmdSetStencilWriteMask = (PFN_vkCmdSetStencilWriteMask) load(userptr, "vkCmdSetStencilWriteMask");
-    glad_vkCmdSetViewport = (PFN_vkCmdSetViewport) load(userptr, "vkCmdSetViewport");
-    glad_vkCmdUpdateBuffer = (PFN_vkCmdUpdateBuffer) load(userptr, "vkCmdUpdateBuffer");
-    glad_vkCmdWaitEvents = (PFN_vkCmdWaitEvents) load(userptr, "vkCmdWaitEvents");
-    glad_vkCmdWriteTimestamp = (PFN_vkCmdWriteTimestamp) load(userptr, "vkCmdWriteTimestamp");
-    glad_vkCreateBuffer = (PFN_vkCreateBuffer) load(userptr, "vkCreateBuffer");
-    glad_vkCreateBufferView = (PFN_vkCreateBufferView) load(userptr, "vkCreateBufferView");
-    glad_vkCreateCommandPool = (PFN_vkCreateCommandPool) load(userptr, "vkCreateCommandPool");
-    glad_vkCreateComputePipelines = (PFN_vkCreateComputePipelines) load(userptr, "vkCreateComputePipelines");
-    glad_vkCreateDescriptorPool = (PFN_vkCreateDescriptorPool) load(userptr, "vkCreateDescriptorPool");
-    glad_vkCreateDescriptorSetLayout = (PFN_vkCreateDescriptorSetLayout) load(userptr, "vkCreateDescriptorSetLayout");
-    glad_vkCreateDevice = (PFN_vkCreateDevice) load(userptr, "vkCreateDevice");
-    glad_vkCreateEvent = (PFN_vkCreateEvent) load(userptr, "vkCreateEvent");
-    glad_vkCreateFence = (PFN_vkCreateFence) load(userptr, "vkCreateFence");
-    glad_vkCreateFramebuffer = (PFN_vkCreateFramebuffer) load(userptr, "vkCreateFramebuffer");
-    glad_vkCreateGraphicsPipelines = (PFN_vkCreateGraphicsPipelines) load(userptr, "vkCreateGraphicsPipelines");
-    glad_vkCreateImage = (PFN_vkCreateImage) load(userptr, "vkCreateImage");
-    glad_vkCreateImageView = (PFN_vkCreateImageView) load(userptr, "vkCreateImageView");
-    glad_vkCreateInstance = (PFN_vkCreateInstance) load(userptr, "vkCreateInstance");
-    glad_vkCreatePipelineCache = (PFN_vkCreatePipelineCache) load(userptr, "vkCreatePipelineCache");
-    glad_vkCreatePipelineLayout = (PFN_vkCreatePipelineLayout) load(userptr, "vkCreatePipelineLayout");
-    glad_vkCreateQueryPool = (PFN_vkCreateQueryPool) load(userptr, "vkCreateQueryPool");
-    glad_vkCreateRenderPass = (PFN_vkCreateRenderPass) load(userptr, "vkCreateRenderPass");
-    glad_vkCreateSampler = (PFN_vkCreateSampler) load(userptr, "vkCreateSampler");
-    glad_vkCreateSemaphore = (PFN_vkCreateSemaphore) load(userptr, "vkCreateSemaphore");
-    glad_vkCreateShaderModule = (PFN_vkCreateShaderModule) load(userptr, "vkCreateShaderModule");
-    glad_vkDestroyBuffer = (PFN_vkDestroyBuffer) load(userptr, "vkDestroyBuffer");
-    glad_vkDestroyBufferView = (PFN_vkDestroyBufferView) load(userptr, "vkDestroyBufferView");
-    glad_vkDestroyCommandPool = (PFN_vkDestroyCommandPool) load(userptr, "vkDestroyCommandPool");
-    glad_vkDestroyDescriptorPool = (PFN_vkDestroyDescriptorPool) load(userptr, "vkDestroyDescriptorPool");
-    glad_vkDestroyDescriptorSetLayout = (PFN_vkDestroyDescriptorSetLayout) load(userptr, "vkDestroyDescriptorSetLayout");
-    glad_vkDestroyDevice = (PFN_vkDestroyDevice) load(userptr, "vkDestroyDevice");
-    glad_vkDestroyEvent = (PFN_vkDestroyEvent) load(userptr, "vkDestroyEvent");
-    glad_vkDestroyFence = (PFN_vkDestroyFence) load(userptr, "vkDestroyFence");
-    glad_vkDestroyFramebuffer = (PFN_vkDestroyFramebuffer) load(userptr, "vkDestroyFramebuffer");
-    glad_vkDestroyImage = (PFN_vkDestroyImage) load(userptr, "vkDestroyImage");
-    glad_vkDestroyImageView = (PFN_vkDestroyImageView) load(userptr, "vkDestroyImageView");
-    glad_vkDestroyInstance = (PFN_vkDestroyInstance) load(userptr, "vkDestroyInstance");
-    glad_vkDestroyPipeline = (PFN_vkDestroyPipeline) load(userptr, "vkDestroyPipeline");
-    glad_vkDestroyPipelineCache = (PFN_vkDestroyPipelineCache) load(userptr, "vkDestroyPipelineCache");
-    glad_vkDestroyPipelineLayout = (PFN_vkDestroyPipelineLayout) load(userptr, "vkDestroyPipelineLayout");
-    glad_vkDestroyQueryPool = (PFN_vkDestroyQueryPool) load(userptr, "vkDestroyQueryPool");
-    glad_vkDestroyRenderPass = (PFN_vkDestroyRenderPass) load(userptr, "vkDestroyRenderPass");
-    glad_vkDestroySampler = (PFN_vkDestroySampler) load(userptr, "vkDestroySampler");
-    glad_vkDestroySemaphore = (PFN_vkDestroySemaphore) load(userptr, "vkDestroySemaphore");
-    glad_vkDestroyShaderModule = (PFN_vkDestroyShaderModule) load(userptr, "vkDestroyShaderModule");
-    glad_vkDeviceWaitIdle = (PFN_vkDeviceWaitIdle) load(userptr, "vkDeviceWaitIdle");
-    glad_vkEndCommandBuffer = (PFN_vkEndCommandBuffer) load(userptr, "vkEndCommandBuffer");
-    glad_vkEnumerateDeviceExtensionProperties = (PFN_vkEnumerateDeviceExtensionProperties) load(userptr, "vkEnumerateDeviceExtensionProperties");
-    glad_vkEnumerateDeviceLayerProperties = (PFN_vkEnumerateDeviceLayerProperties) load(userptr, "vkEnumerateDeviceLayerProperties");
-    glad_vkEnumerateInstanceExtensionProperties = (PFN_vkEnumerateInstanceExtensionProperties) load(userptr, "vkEnumerateInstanceExtensionProperties");
-    glad_vkEnumerateInstanceLayerProperties = (PFN_vkEnumerateInstanceLayerProperties) load(userptr, "vkEnumerateInstanceLayerProperties");
-    glad_vkEnumeratePhysicalDevices = (PFN_vkEnumeratePhysicalDevices) load(userptr, "vkEnumeratePhysicalDevices");
-    glad_vkFlushMappedMemoryRanges = (PFN_vkFlushMappedMemoryRanges) load(userptr, "vkFlushMappedMemoryRanges");
-    glad_vkFreeCommandBuffers = (PFN_vkFreeCommandBuffers) load(userptr, "vkFreeCommandBuffers");
-    glad_vkFreeDescriptorSets = (PFN_vkFreeDescriptorSets) load(userptr, "vkFreeDescriptorSets");
-    glad_vkFreeMemory = (PFN_vkFreeMemory) load(userptr, "vkFreeMemory");
-    glad_vkGetBufferMemoryRequirements = (PFN_vkGetBufferMemoryRequirements) load(userptr, "vkGetBufferMemoryRequirements");
-    glad_vkGetDeviceMemoryCommitment = (PFN_vkGetDeviceMemoryCommitment) load(userptr, "vkGetDeviceMemoryCommitment");
-    glad_vkGetDeviceProcAddr = (PFN_vkGetDeviceProcAddr) load(userptr, "vkGetDeviceProcAddr");
-    glad_vkGetDeviceQueue = (PFN_vkGetDeviceQueue) load(userptr, "vkGetDeviceQueue");
-    glad_vkGetEventStatus = (PFN_vkGetEventStatus) load(userptr, "vkGetEventStatus");
-    glad_vkGetFenceStatus = (PFN_vkGetFenceStatus) load(userptr, "vkGetFenceStatus");
-    glad_vkGetImageMemoryRequirements = (PFN_vkGetImageMemoryRequirements) load(userptr, "vkGetImageMemoryRequirements");
-    glad_vkGetImageSparseMemoryRequirements = (PFN_vkGetImageSparseMemoryRequirements) load(userptr, "vkGetImageSparseMemoryRequirements");
-    glad_vkGetImageSubresourceLayout = (PFN_vkGetImageSubresourceLayout) load(userptr, "vkGetImageSubresourceLayout");
-    glad_vkGetInstanceProcAddr = (PFN_vkGetInstanceProcAddr) load(userptr, "vkGetInstanceProcAddr");
-    glad_vkGetPhysicalDeviceFeatures = (PFN_vkGetPhysicalDeviceFeatures) load(userptr, "vkGetPhysicalDeviceFeatures");
-    glad_vkGetPhysicalDeviceFormatProperties = (PFN_vkGetPhysicalDeviceFormatProperties) load(userptr, "vkGetPhysicalDeviceFormatProperties");
-    glad_vkGetPhysicalDeviceImageFormatProperties = (PFN_vkGetPhysicalDeviceImageFormatProperties) load(userptr, "vkGetPhysicalDeviceImageFormatProperties");
-    glad_vkGetPhysicalDeviceMemoryProperties = (PFN_vkGetPhysicalDeviceMemoryProperties) load(userptr, "vkGetPhysicalDeviceMemoryProperties");
-    glad_vkGetPhysicalDeviceProperties = (PFN_vkGetPhysicalDeviceProperties) load(userptr, "vkGetPhysicalDeviceProperties");
-    glad_vkGetPhysicalDeviceQueueFamilyProperties = (PFN_vkGetPhysicalDeviceQueueFamilyProperties) load(userptr, "vkGetPhysicalDeviceQueueFamilyProperties");
-    glad_vkGetPhysicalDeviceSparseImageFormatProperties = (PFN_vkGetPhysicalDeviceSparseImageFormatProperties) load(userptr, "vkGetPhysicalDeviceSparseImageFormatProperties");
-    glad_vkGetPipelineCacheData = (PFN_vkGetPipelineCacheData) load(userptr, "vkGetPipelineCacheData");
-    glad_vkGetQueryPoolResults = (PFN_vkGetQueryPoolResults) load(userptr, "vkGetQueryPoolResults");
-    glad_vkGetRenderAreaGranularity = (PFN_vkGetRenderAreaGranularity) load(userptr, "vkGetRenderAreaGranularity");
-    glad_vkInvalidateMappedMemoryRanges = (PFN_vkInvalidateMappedMemoryRanges) load(userptr, "vkInvalidateMappedMemoryRanges");
-    glad_vkMapMemory = (PFN_vkMapMemory) load(userptr, "vkMapMemory");
-    glad_vkMergePipelineCaches = (PFN_vkMergePipelineCaches) load(userptr, "vkMergePipelineCaches");
-    glad_vkQueueBindSparse = (PFN_vkQueueBindSparse) load(userptr, "vkQueueBindSparse");
-    glad_vkQueueSubmit = (PFN_vkQueueSubmit) load(userptr, "vkQueueSubmit");
-    glad_vkQueueWaitIdle = (PFN_vkQueueWaitIdle) load(userptr, "vkQueueWaitIdle");
-    glad_vkResetCommandBuffer = (PFN_vkResetCommandBuffer) load(userptr, "vkResetCommandBuffer");
-    glad_vkResetCommandPool = (PFN_vkResetCommandPool) load(userptr, "vkResetCommandPool");
-    glad_vkResetDescriptorPool = (PFN_vkResetDescriptorPool) load(userptr, "vkResetDescriptorPool");
-    glad_vkResetEvent = (PFN_vkResetEvent) load(userptr, "vkResetEvent");
-    glad_vkResetFences = (PFN_vkResetFences) load(userptr, "vkResetFences");
-    glad_vkSetEvent = (PFN_vkSetEvent) load(userptr, "vkSetEvent");
-    glad_vkUnmapMemory = (PFN_vkUnmapMemory) load(userptr, "vkUnmapMemory");
-    glad_vkUpdateDescriptorSets = (PFN_vkUpdateDescriptorSets) load(userptr, "vkUpdateDescriptorSets");
-    glad_vkWaitForFences = (PFN_vkWaitForFences) load(userptr, "vkWaitForFences");
-}
-static void glad_vk_load_VK_VERSION_1_1( GLADuserptrloadfunc load, void* userptr) {
-    if(!GLAD_VK_VERSION_1_1) return;
-    glad_vkBindBufferMemory2 = (PFN_vkBindBufferMemory2) load(userptr, "vkBindBufferMemory2");
-    glad_vkBindImageMemory2 = (PFN_vkBindImageMemory2) load(userptr, "vkBindImageMemory2");
-    glad_vkCmdDispatchBase = (PFN_vkCmdDispatchBase) load(userptr, "vkCmdDispatchBase");
-    glad_vkCmdSetDeviceMask = (PFN_vkCmdSetDeviceMask) load(userptr, "vkCmdSetDeviceMask");
-    glad_vkCreateDescriptorUpdateTemplate = (PFN_vkCreateDescriptorUpdateTemplate) load(userptr, "vkCreateDescriptorUpdateTemplate");
-    glad_vkCreateSamplerYcbcrConversion = (PFN_vkCreateSamplerYcbcrConversion) load(userptr, "vkCreateSamplerYcbcrConversion");
-    glad_vkDestroyDescriptorUpdateTemplate = (PFN_vkDestroyDescriptorUpdateTemplate) load(userptr, "vkDestroyDescriptorUpdateTemplate");
-    glad_vkDestroySamplerYcbcrConversion = (PFN_vkDestroySamplerYcbcrConversion) load(userptr, "vkDestroySamplerYcbcrConversion");
-    glad_vkEnumerateInstanceVersion = (PFN_vkEnumerateInstanceVersion) load(userptr, "vkEnumerateInstanceVersion");
-    glad_vkEnumeratePhysicalDeviceGroups = (PFN_vkEnumeratePhysicalDeviceGroups) load(userptr, "vkEnumeratePhysicalDeviceGroups");
-    glad_vkGetBufferMemoryRequirements2 = (PFN_vkGetBufferMemoryRequirements2) load(userptr, "vkGetBufferMemoryRequirements2");
-    glad_vkGetDescriptorSetLayoutSupport = (PFN_vkGetDescriptorSetLayoutSupport) load(userptr, "vkGetDescriptorSetLayoutSupport");
-    glad_vkGetDeviceGroupPeerMemoryFeatures = (PFN_vkGetDeviceGroupPeerMemoryFeatures) load(userptr, "vkGetDeviceGroupPeerMemoryFeatures");
-    glad_vkGetDeviceQueue2 = (PFN_vkGetDeviceQueue2) load(userptr, "vkGetDeviceQueue2");
-    glad_vkGetImageMemoryRequirements2 = (PFN_vkGetImageMemoryRequirements2) load(userptr, "vkGetImageMemoryRequirements2");
-    glad_vkGetImageSparseMemoryRequirements2 = (PFN_vkGetImageSparseMemoryRequirements2) load(userptr, "vkGetImageSparseMemoryRequirements2");
-    glad_vkGetPhysicalDeviceExternalBufferProperties = (PFN_vkGetPhysicalDeviceExternalBufferProperties) load(userptr, "vkGetPhysicalDeviceExternalBufferProperties");
-    glad_vkGetPhysicalDeviceExternalFenceProperties = (PFN_vkGetPhysicalDeviceExternalFenceProperties) load(userptr, "vkGetPhysicalDeviceExternalFenceProperties");
-    glad_vkGetPhysicalDeviceExternalSemaphoreProperties = (PFN_vkGetPhysicalDeviceExternalSemaphoreProperties) load(userptr, "vkGetPhysicalDeviceExternalSemaphoreProperties");
-    glad_vkGetPhysicalDeviceFeatures2 = (PFN_vkGetPhysicalDeviceFeatures2) load(userptr, "vkGetPhysicalDeviceFeatures2");
-    glad_vkGetPhysicalDeviceFormatProperties2 = (PFN_vkGetPhysicalDeviceFormatProperties2) load(userptr, "vkGetPhysicalDeviceFormatProperties2");
-    glad_vkGetPhysicalDeviceImageFormatProperties2 = (PFN_vkGetPhysicalDeviceImageFormatProperties2) load(userptr, "vkGetPhysicalDeviceImageFormatProperties2");
-    glad_vkGetPhysicalDeviceMemoryProperties2 = (PFN_vkGetPhysicalDeviceMemoryProperties2) load(userptr, "vkGetPhysicalDeviceMemoryProperties2");
-    glad_vkGetPhysicalDeviceProperties2 = (PFN_vkGetPhysicalDeviceProperties2) load(userptr, "vkGetPhysicalDeviceProperties2");
-    glad_vkGetPhysicalDeviceQueueFamilyProperties2 = (PFN_vkGetPhysicalDeviceQueueFamilyProperties2) load(userptr, "vkGetPhysicalDeviceQueueFamilyProperties2");
-    glad_vkGetPhysicalDeviceSparseImageFormatProperties2 = (PFN_vkGetPhysicalDeviceSparseImageFormatProperties2) load(userptr, "vkGetPhysicalDeviceSparseImageFormatProperties2");
-    glad_vkTrimCommandPool = (PFN_vkTrimCommandPool) load(userptr, "vkTrimCommandPool");
-    glad_vkUpdateDescriptorSetWithTemplate = (PFN_vkUpdateDescriptorSetWithTemplate) load(userptr, "vkUpdateDescriptorSetWithTemplate");
-}
-static void glad_vk_load_VK_VERSION_1_2( GLADuserptrloadfunc load, void* userptr) {
-    if(!GLAD_VK_VERSION_1_2) return;
-    glad_vkCmdBeginRenderPass2 = (PFN_vkCmdBeginRenderPass2) load(userptr, "vkCmdBeginRenderPass2");
-    glad_vkCmdDrawIndexedIndirectCount = (PFN_vkCmdDrawIndexedIndirectCount) load(userptr, "vkCmdDrawIndexedIndirectCount");
-    glad_vkCmdDrawIndirectCount = (PFN_vkCmdDrawIndirectCount) load(userptr, "vkCmdDrawIndirectCount");
-    glad_vkCmdEndRenderPass2 = (PFN_vkCmdEndRenderPass2) load(userptr, "vkCmdEndRenderPass2");
-    glad_vkCmdNextSubpass2 = (PFN_vkCmdNextSubpass2) load(userptr, "vkCmdNextSubpass2");
-    glad_vkCreateRenderPass2 = (PFN_vkCreateRenderPass2) load(userptr, "vkCreateRenderPass2");
-    glad_vkGetBufferDeviceAddress = (PFN_vkGetBufferDeviceAddress) load(userptr, "vkGetBufferDeviceAddress");
-    glad_vkGetBufferOpaqueCaptureAddress = (PFN_vkGetBufferOpaqueCaptureAddress) load(userptr, "vkGetBufferOpaqueCaptureAddress");
-    glad_vkGetDeviceMemoryOpaqueCaptureAddress = (PFN_vkGetDeviceMemoryOpaqueCaptureAddress) load(userptr, "vkGetDeviceMemoryOpaqueCaptureAddress");
-    glad_vkGetSemaphoreCounterValue = (PFN_vkGetSemaphoreCounterValue) load(userptr, "vkGetSemaphoreCounterValue");
-    glad_vkResetQueryPool = (PFN_vkResetQueryPool) load(userptr, "vkResetQueryPool");
-    glad_vkSignalSemaphore = (PFN_vkSignalSemaphore) load(userptr, "vkSignalSemaphore");
-    glad_vkWaitSemaphores = (PFN_vkWaitSemaphores) load(userptr, "vkWaitSemaphores");
-}
-static void glad_vk_load_VK_VERSION_1_3( GLADuserptrloadfunc load, void* userptr) {
-    if(!GLAD_VK_VERSION_1_3) return;
-    glad_vkCmdBeginRendering = (PFN_vkCmdBeginRendering) load(userptr, "vkCmdBeginRendering");
-    glad_vkCmdBindVertexBuffers2 = (PFN_vkCmdBindVertexBuffers2) load(userptr, "vkCmdBindVertexBuffers2");
-    glad_vkCmdBlitImage2 = (PFN_vkCmdBlitImage2) load(userptr, "vkCmdBlitImage2");
-    glad_vkCmdCopyBuffer2 = (PFN_vkCmdCopyBuffer2) load(userptr, "vkCmdCopyBuffer2");
-    glad_vkCmdCopyBufferToImage2 = (PFN_vkCmdCopyBufferToImage2) load(userptr, "vkCmdCopyBufferToImage2");
-    glad_vkCmdCopyImage2 = (PFN_vkCmdCopyImage2) load(userptr, "vkCmdCopyImage2");
-    glad_vkCmdCopyImageToBuffer2 = (PFN_vkCmdCopyImageToBuffer2) load(userptr, "vkCmdCopyImageToBuffer2");
-    glad_vkCmdEndRendering = (PFN_vkCmdEndRendering) load(userptr, "vkCmdEndRendering");
-    glad_vkCmdPipelineBarrier2 = (PFN_vkCmdPipelineBarrier2) load(userptr, "vkCmdPipelineBarrier2");
-    glad_vkCmdResetEvent2 = (PFN_vkCmdResetEvent2) load(userptr, "vkCmdResetEvent2");
-    glad_vkCmdResolveImage2 = (PFN_vkCmdResolveImage2) load(userptr, "vkCmdResolveImage2");
-    glad_vkCmdSetCullMode = (PFN_vkCmdSetCullMode) load(userptr, "vkCmdSetCullMode");
-    glad_vkCmdSetDepthBiasEnable = (PFN_vkCmdSetDepthBiasEnable) load(userptr, "vkCmdSetDepthBiasEnable");
-    glad_vkCmdSetDepthBoundsTestEnable = (PFN_vkCmdSetDepthBoundsTestEnable) load(userptr, "vkCmdSetDepthBoundsTestEnable");
-    glad_vkCmdSetDepthCompareOp = (PFN_vkCmdSetDepthCompareOp) load(userptr, "vkCmdSetDepthCompareOp");
-    glad_vkCmdSetDepthTestEnable = (PFN_vkCmdSetDepthTestEnable) load(userptr, "vkCmdSetDepthTestEnable");
-    glad_vkCmdSetDepthWriteEnable = (PFN_vkCmdSetDepthWriteEnable) load(userptr, "vkCmdSetDepthWriteEnable");
-    glad_vkCmdSetEvent2 = (PFN_vkCmdSetEvent2) load(userptr, "vkCmdSetEvent2");
-    glad_vkCmdSetFrontFace = (PFN_vkCmdSetFrontFace) load(userptr, "vkCmdSetFrontFace");
-    glad_vkCmdSetPrimitiveRestartEnable = (PFN_vkCmdSetPrimitiveRestartEnable) load(userptr, "vkCmdSetPrimitiveRestartEnable");
-    glad_vkCmdSetPrimitiveTopology = (PFN_vkCmdSetPrimitiveTopology) load(userptr, "vkCmdSetPrimitiveTopology");
-    glad_vkCmdSetRasterizerDiscardEnable = (PFN_vkCmdSetRasterizerDiscardEnable) load(userptr, "vkCmdSetRasterizerDiscardEnable");
-    glad_vkCmdSetScissorWithCount = (PFN_vkCmdSetScissorWithCount) load(userptr, "vkCmdSetScissorWithCount");
-    glad_vkCmdSetStencilOp = (PFN_vkCmdSetStencilOp) load(userptr, "vkCmdSetStencilOp");
-    glad_vkCmdSetStencilTestEnable = (PFN_vkCmdSetStencilTestEnable) load(userptr, "vkCmdSetStencilTestEnable");
-    glad_vkCmdSetViewportWithCount = (PFN_vkCmdSetViewportWithCount) load(userptr, "vkCmdSetViewportWithCount");
-    glad_vkCmdWaitEvents2 = (PFN_vkCmdWaitEvents2) load(userptr, "vkCmdWaitEvents2");
-    glad_vkCmdWriteTimestamp2 = (PFN_vkCmdWriteTimestamp2) load(userptr, "vkCmdWriteTimestamp2");
-    glad_vkCreatePrivateDataSlot = (PFN_vkCreatePrivateDataSlot) load(userptr, "vkCreatePrivateDataSlot");
-    glad_vkDestroyPrivateDataSlot = (PFN_vkDestroyPrivateDataSlot) load(userptr, "vkDestroyPrivateDataSlot");
-    glad_vkGetDeviceBufferMemoryRequirements = (PFN_vkGetDeviceBufferMemoryRequirements) load(userptr, "vkGetDeviceBufferMemoryRequirements");
-    glad_vkGetDeviceImageMemoryRequirements = (PFN_vkGetDeviceImageMemoryRequirements) load(userptr, "vkGetDeviceImageMemoryRequirements");
-    glad_vkGetDeviceImageSparseMemoryRequirements = (PFN_vkGetDeviceImageSparseMemoryRequirements) load(userptr, "vkGetDeviceImageSparseMemoryRequirements");
-    glad_vkGetPhysicalDeviceToolProperties = (PFN_vkGetPhysicalDeviceToolProperties) load(userptr, "vkGetPhysicalDeviceToolProperties");
-    glad_vkGetPrivateData = (PFN_vkGetPrivateData) load(userptr, "vkGetPrivateData");
-    glad_vkQueueSubmit2 = (PFN_vkQueueSubmit2) load(userptr, "vkQueueSubmit2");
-    glad_vkSetPrivateData = (PFN_vkSetPrivateData) load(userptr, "vkSetPrivateData");
-}
-static void glad_vk_load_VK_EXT_debug_report( GLADuserptrloadfunc load, void* userptr) {
-    if(!GLAD_VK_EXT_debug_report) return;
-    glad_vkCreateDebugReportCallbackEXT = (PFN_vkCreateDebugReportCallbackEXT) load(userptr, "vkCreateDebugReportCallbackEXT");
-    glad_vkDebugReportMessageEXT = (PFN_vkDebugReportMessageEXT) load(userptr, "vkDebugReportMessageEXT");
-    glad_vkDestroyDebugReportCallbackEXT = (PFN_vkDestroyDebugReportCallbackEXT) load(userptr, "vkDestroyDebugReportCallbackEXT");
-}
-static void glad_vk_load_VK_KHR_surface( GLADuserptrloadfunc load, void* userptr) {
-    if(!GLAD_VK_KHR_surface) return;
-    glad_vkDestroySurfaceKHR = (PFN_vkDestroySurfaceKHR) load(userptr, "vkDestroySurfaceKHR");
-    glad_vkGetPhysicalDeviceSurfaceCapabilitiesKHR = (PFN_vkGetPhysicalDeviceSurfaceCapabilitiesKHR) load(userptr, "vkGetPhysicalDeviceSurfaceCapabilitiesKHR");
-    glad_vkGetPhysicalDeviceSurfaceFormatsKHR = (PFN_vkGetPhysicalDeviceSurfaceFormatsKHR) load(userptr, "vkGetPhysicalDeviceSurfaceFormatsKHR");
-    glad_vkGetPhysicalDeviceSurfacePresentModesKHR = (PFN_vkGetPhysicalDeviceSurfacePresentModesKHR) load(userptr, "vkGetPhysicalDeviceSurfacePresentModesKHR");
-    glad_vkGetPhysicalDeviceSurfaceSupportKHR = (PFN_vkGetPhysicalDeviceSurfaceSupportKHR) load(userptr, "vkGetPhysicalDeviceSurfaceSupportKHR");
-}
-static void glad_vk_load_VK_KHR_swapchain( GLADuserptrloadfunc load, void* userptr) {
-    if(!GLAD_VK_KHR_swapchain) return;
-    glad_vkAcquireNextImage2KHR = (PFN_vkAcquireNextImage2KHR) load(userptr, "vkAcquireNextImage2KHR");
-    glad_vkAcquireNextImageKHR = (PFN_vkAcquireNextImageKHR) load(userptr, "vkAcquireNextImageKHR");
-    glad_vkCreateSwapchainKHR = (PFN_vkCreateSwapchainKHR) load(userptr, "vkCreateSwapchainKHR");
-    glad_vkDestroySwapchainKHR = (PFN_vkDestroySwapchainKHR) load(userptr, "vkDestroySwapchainKHR");
-    glad_vkGetDeviceGroupPresentCapabilitiesKHR = (PFN_vkGetDeviceGroupPresentCapabilitiesKHR) load(userptr, "vkGetDeviceGroupPresentCapabilitiesKHR");
-    glad_vkGetDeviceGroupSurfacePresentModesKHR = (PFN_vkGetDeviceGroupSurfacePresentModesKHR) load(userptr, "vkGetDeviceGroupSurfacePresentModesKHR");
-    glad_vkGetPhysicalDevicePresentRectanglesKHR = (PFN_vkGetPhysicalDevicePresentRectanglesKHR) load(userptr, "vkGetPhysicalDevicePresentRectanglesKHR");
-    glad_vkGetSwapchainImagesKHR = (PFN_vkGetSwapchainImagesKHR) load(userptr, "vkGetSwapchainImagesKHR");
-    glad_vkQueuePresentKHR = (PFN_vkQueuePresentKHR) load(userptr, "vkQueuePresentKHR");
-}
-
-
-
-static int glad_vk_get_extensions( VkPhysicalDevice physical_device, uint32_t *out_extension_count, char ***out_extensions) {
-    uint32_t i;
-    uint32_t instance_extension_count = 0;
-    uint32_t device_extension_count = 0;
-    uint32_t max_extension_count = 0;
-    uint32_t total_extension_count = 0;
-    char **extensions = NULL;
-    VkExtensionProperties *ext_properties = NULL;
-    VkResult result;
-
-    if (glad_vkEnumerateInstanceExtensionProperties == NULL || (physical_device != NULL && glad_vkEnumerateDeviceExtensionProperties == NULL)) {
-        return 0;
-    }
-
-    result = glad_vkEnumerateInstanceExtensionProperties(NULL, &instance_extension_count, NULL);
-    if (result != VK_SUCCESS) {
-        return 0;
-    }
-
-    if (physical_device != NULL) {
-        result = glad_vkEnumerateDeviceExtensionProperties(physical_device, NULL, &device_extension_count, NULL);
-        if (result != VK_SUCCESS) {
-            return 0;
-        }
-    }
-
-    total_extension_count = instance_extension_count + device_extension_count;
-    if (total_extension_count <= 0) {
-        return 0;
-    }
-
-    max_extension_count = instance_extension_count > device_extension_count
-        ? instance_extension_count : device_extension_count;
-
-    ext_properties = (VkExtensionProperties*) malloc(max_extension_count * sizeof(VkExtensionProperties));
-    if (ext_properties == NULL) {
-        goto glad_vk_get_extensions_error;
-    }
-
-    result = glad_vkEnumerateInstanceExtensionProperties(NULL, &instance_extension_count, ext_properties);
-    if (result != VK_SUCCESS) {
-        goto glad_vk_get_extensions_error;
-    }
-
-    extensions = (char**) calloc(total_extension_count, sizeof(char*));
-    if (extensions == NULL) {
-        goto glad_vk_get_extensions_error;
-    }
-
-    for (i = 0; i < instance_extension_count; ++i) {
-        VkExtensionProperties ext = ext_properties[i];
-
-        size_t extension_name_length = strlen(ext.extensionName) + 1;
-        extensions[i] = (char*) malloc(extension_name_length * sizeof(char));
-        if (extensions[i] == NULL) {
-            goto glad_vk_get_extensions_error;
-        }
-        memcpy(extensions[i], ext.extensionName, extension_name_length * sizeof(char));
-    }
-
-    if (physical_device != NULL) {
-        result = glad_vkEnumerateDeviceExtensionProperties(physical_device, NULL, &device_extension_count, ext_properties);
-        if (result != VK_SUCCESS) {
-            goto glad_vk_get_extensions_error;
-        }
-
-        for (i = 0; i < device_extension_count; ++i) {
-            VkExtensionProperties ext = ext_properties[i];
-
-            size_t extension_name_length = strlen(ext.extensionName) + 1;
-            extensions[instance_extension_count + i] = (char*) malloc(extension_name_length * sizeof(char));
-            if (extensions[instance_extension_count + i] == NULL) {
-                goto glad_vk_get_extensions_error;
-            }
-            memcpy(extensions[instance_extension_count + i], ext.extensionName, extension_name_length * sizeof(char));
-        }
-    }
-
-    free((void*) ext_properties);
-
-    *out_extension_count = total_extension_count;
-    *out_extensions = extensions;
-
-    return 1;
-
-glad_vk_get_extensions_error:
-    free((void*) ext_properties);
-    if (extensions != NULL) {
-        for (i = 0; i < total_extension_count; ++i) {
-            free((void*) extensions[i]);
-        }
-        free(extensions);
-    }
-    return 0;
-}
-
-static void glad_vk_free_extensions(uint32_t extension_count, char **extensions) {
-    uint32_t i;
-
-    for(i = 0; i < extension_count ; ++i) {
-        free((void*) (extensions[i]));
-    }
-
-    free((void*) extensions);
-}
-
-static int glad_vk_has_extension(const char *name, uint32_t extension_count, char **extensions) {
-    uint32_t i;
-
-    for (i = 0; i < extension_count; ++i) {
-        if(extensions[i] != NULL && strcmp(name, extensions[i]) == 0) {
-            return 1;
-        }
-    }
-
-    return 0;
-}
-
-static GLADapiproc glad_vk_get_proc_from_userptr(void *userptr, const char* name) {
-    return (GLAD_GNUC_EXTENSION (GLADapiproc (*)(const char *name)) userptr)(name);
-}
-
-static int glad_vk_find_extensions_vulkan( VkPhysicalDevice physical_device) {
-    uint32_t extension_count = 0;
-    char **extensions = NULL;
-    if (!glad_vk_get_extensions(physical_device, &extension_count, &extensions)) return 0;
-
-    GLAD_VK_EXT_debug_report = glad_vk_has_extension("VK_EXT_debug_report", extension_count, extensions);
-    GLAD_VK_KHR_portability_enumeration = glad_vk_has_extension("VK_KHR_portability_enumeration", extension_count, extensions);
-    GLAD_VK_KHR_surface = glad_vk_has_extension("VK_KHR_surface", extension_count, extensions);
-    GLAD_VK_KHR_swapchain = glad_vk_has_extension("VK_KHR_swapchain", extension_count, extensions);
-
-    (void) glad_vk_has_extension;
-
-    glad_vk_free_extensions(extension_count, extensions);
-
-    return 1;
-}
-
-static int glad_vk_find_core_vulkan( VkPhysicalDevice physical_device) {
-    int major = 1;
-    int minor = 0;
-
-#ifdef VK_VERSION_1_1
-    if (glad_vkEnumerateInstanceVersion != NULL) {
-        uint32_t version;
-        VkResult result;
-
-        result = glad_vkEnumerateInstanceVersion(&version);
-        if (result == VK_SUCCESS) {
-            major = (int) VK_VERSION_MAJOR(version);
-            minor = (int) VK_VERSION_MINOR(version);
-        }
-    }
-#endif
-
-    if (physical_device != NULL && glad_vkGetPhysicalDeviceProperties != NULL) {
-        VkPhysicalDeviceProperties properties;
-        glad_vkGetPhysicalDeviceProperties(physical_device, &properties);
-
-        major = (int) VK_VERSION_MAJOR(properties.apiVersion);
-        minor = (int) VK_VERSION_MINOR(properties.apiVersion);
-    }
-
-    GLAD_VK_VERSION_1_0 = (major == 1 && minor >= 0) || major > 1;
-    GLAD_VK_VERSION_1_1 = (major == 1 && minor >= 1) || major > 1;
-    GLAD_VK_VERSION_1_2 = (major == 1 && minor >= 2) || major > 1;
-    GLAD_VK_VERSION_1_3 = (major == 1 && minor >= 3) || major > 1;
-
-    return GLAD_MAKE_VERSION(major, minor);
-}
-
-int gladLoadVulkanUserPtr( VkPhysicalDevice physical_device, GLADuserptrloadfunc load, void *userptr) {
-    int version;
-
-#ifdef VK_VERSION_1_1
-    glad_vkEnumerateInstanceVersion  = (PFN_vkEnumerateInstanceVersion) load(userptr, "vkEnumerateInstanceVersion");
-#endif
-    version = glad_vk_find_core_vulkan( physical_device);
-    if (!version) {
-        return 0;
-    }
-
-    glad_vk_load_VK_VERSION_1_0(load, userptr);
-    glad_vk_load_VK_VERSION_1_1(load, userptr);
-    glad_vk_load_VK_VERSION_1_2(load, userptr);
-    glad_vk_load_VK_VERSION_1_3(load, userptr);
-
-    if (!glad_vk_find_extensions_vulkan( physical_device)) return 0;
-    glad_vk_load_VK_EXT_debug_report(load, userptr);
-    glad_vk_load_VK_KHR_surface(load, userptr);
-    glad_vk_load_VK_KHR_swapchain(load, userptr);
-
-
-    return version;
-}
-
-
-int gladLoadVulkan( VkPhysicalDevice physical_device, GLADloadfunc load) {
-    return gladLoadVulkanUserPtr( physical_device, glad_vk_get_proc_from_userptr, GLAD_GNUC_EXTENSION (void*) load);
-}
-
-
-
- 
-
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/deps/linmath.h b/deps/linmath.h
index 0ab7a41..5c80265 100644
--- a/deps/linmath.h
+++ b/deps/linmath.h
@@ -1,70 +1,96 @@
 #ifndef LINMATH_H
 #define LINMATH_H
 
+#include <string.h>
 #include <math.h>
+#include <string.h>
 
-#ifdef _MSC_VER
-#define inline __inline
+/* 2021-03-21 Camilla Löwy <elmindreda@elmindreda.org>
+ * - Replaced double constants with float equivalents
+ */
+
+#ifdef LINMATH_NO_INLINE
+#define LINMATH_H_FUNC static
+#else
+#define LINMATH_H_FUNC static inline
 #endif
 
 #define LINMATH_H_DEFINE_VEC(n) \
 typedef float vec##n[n]; \
-static inline void vec##n##_add(vec##n r, vec##n const a, vec##n const b) \
+LINMATH_H_FUNC void vec##n##_add(vec##n r, vec##n const a, vec##n const b) \
 { \
 	int i; \
 	for(i=0; i<n; ++i) \
 		r[i] = a[i] + b[i]; \
 } \
-static inline void vec##n##_sub(vec##n r, vec##n const a, vec##n const b) \
+LINMATH_H_FUNC void vec##n##_sub(vec##n r, vec##n const a, vec##n const b) \
 { \
 	int i; \
 	for(i=0; i<n; ++i) \
 		r[i] = a[i] - b[i]; \
 } \
-static inline void vec##n##_scale(vec##n r, vec##n const v, float const s) \
+LINMATH_H_FUNC void vec##n##_scale(vec##n r, vec##n const v, float const s) \
 { \
 	int i; \
 	for(i=0; i<n; ++i) \
 		r[i] = v[i] * s; \
 } \
-static inline float vec##n##_mul_inner(vec##n const a, vec##n const b) \
+LINMATH_H_FUNC float vec##n##_mul_inner(vec##n const a, vec##n const b) \
 { \
-	float p = 0.; \
+	float p = 0.f; \
 	int i; \
 	for(i=0; i<n; ++i) \
 		p += b[i]*a[i]; \
 	return p; \
 } \
-static inline float vec##n##_len(vec##n const v) \
+LINMATH_H_FUNC float vec##n##_len(vec##n const v) \
 { \
-	return (float) sqrt(vec##n##_mul_inner(v,v)); \
+	return sqrtf(vec##n##_mul_inner(v,v)); \
 } \
-static inline void vec##n##_norm(vec##n r, vec##n const v) \
+LINMATH_H_FUNC void vec##n##_norm(vec##n r, vec##n const v) \
 { \
 	float k = 1.f / vec##n##_len(v); \
 	vec##n##_scale(r, v, k); \
+} \
+LINMATH_H_FUNC void vec##n##_min(vec##n r, vec##n const a, vec##n const b) \
+{ \
+	int i; \
+	for(i=0; i<n; ++i) \
+		r[i] = a[i]<b[i] ? a[i] : b[i]; \
+} \
+LINMATH_H_FUNC void vec##n##_max(vec##n r, vec##n const a, vec##n const b) \
+{ \
+	int i; \
+	for(i=0; i<n; ++i) \
+		r[i] = a[i]>b[i] ? a[i] : b[i]; \
+} \
+LINMATH_H_FUNC void vec##n##_dup(vec##n r, vec##n const src) \
+{ \
+	int i; \
+	for(i=0; i<n; ++i) \
+		r[i] = src[i]; \
 }
 
 LINMATH_H_DEFINE_VEC(2)
 LINMATH_H_DEFINE_VEC(3)
 LINMATH_H_DEFINE_VEC(4)
 
-static inline void vec3_mul_cross(vec3 r, vec3 const a, vec3 const b)
+LINMATH_H_FUNC void vec3_mul_cross(vec3 r, vec3 const a, vec3 const b)
 {
 	r[0] = a[1]*b[2] - a[2]*b[1];
 	r[1] = a[2]*b[0] - a[0]*b[2];
 	r[2] = a[0]*b[1] - a[1]*b[0];
 }
 
-static inline void vec3_reflect(vec3 r, vec3 const v, vec3 const n)
+LINMATH_H_FUNC void vec3_reflect(vec3 r, vec3 const v, vec3 const n)
 {
-	float p  = 2.f*vec3_mul_inner(v, n);
+	float p = 2.f * vec3_mul_inner(v, n);
 	int i;
 	for(i=0;i<3;++i)
 		r[i] = v[i] - p*n[i];
 }
 
-static inline void vec4_mul_cross(vec4 r, vec4 a, vec4 b)
+LINMATH_H_FUNC void vec4_mul_cross(vec4 r, vec4 const a, vec4 const b)
 {
 	r[0] = a[1]*b[2] - a[2]*b[1];
 	r[1] = a[2]*b[0] - a[0]*b[2];
@@ -72,7 +98,7 @@
 	r[3] = 1.f;
 }
 
-static inline void vec4_reflect(vec4 r, vec4 v, vec4 n)
+LINMATH_H_FUNC void vec4_reflect(vec4 r, vec4 const v, vec4 const n)
 {
 	float p  = 2.f*vec4_mul_inner(v, n);
 	int i;
@@ -81,68 +107,66 @@
 }
 
 typedef vec4 mat4x4[4];
-static inline void mat4x4_identity(mat4x4 M)
+LINMATH_H_FUNC void mat4x4_identity(mat4x4 M)
 {
 	int i, j;
 	for(i=0; i<4; ++i)
 		for(j=0; j<4; ++j)
 			M[i][j] = i==j ? 1.f : 0.f;
 }
-static inline void mat4x4_dup(mat4x4 M, mat4x4 N)
+LINMATH_H_FUNC void mat4x4_dup(mat4x4 M, mat4x4 const N)
 {
-	int i, j;
+	int i;
 	for(i=0; i<4; ++i)
-		for(j=0; j<4; ++j)
-			M[i][j] = N[i][j];
+		vec4_dup(M[i], N[i]);
 }
-static inline void mat4x4_row(vec4 r, mat4x4 M, int i)
+LINMATH_H_FUNC void mat4x4_row(vec4 r, mat4x4 const M, int i)
 {
 	int k;
 	for(k=0; k<4; ++k)
 		r[k] = M[k][i];
 }
-static inline void mat4x4_col(vec4 r, mat4x4 M, int i)
+LINMATH_H_FUNC void mat4x4_col(vec4 r, mat4x4 const M, int i)
 {
 	int k;
 	for(k=0; k<4; ++k)
 		r[k] = M[i][k];
 }
-static inline void mat4x4_transpose(mat4x4 M, mat4x4 N)
+LINMATH_H_FUNC void mat4x4_transpose(mat4x4 M, mat4x4 const N)
 {
+    // Note: if M and N are the same, the user has to
+    // explicitly make a copy of M and set it to N.
 	int i, j;
 	for(j=0; j<4; ++j)
 		for(i=0; i<4; ++i)
 			M[i][j] = N[j][i];
 }
-static inline void mat4x4_add(mat4x4 M, mat4x4 a, mat4x4 b)
+LINMATH_H_FUNC void mat4x4_add(mat4x4 M, mat4x4 const a, mat4x4 const b)
 {
 	int i;
 	for(i=0; i<4; ++i)
 		vec4_add(M[i], a[i], b[i]);
 }
-static inline void mat4x4_sub(mat4x4 M, mat4x4 a, mat4x4 b)
+LINMATH_H_FUNC void mat4x4_sub(mat4x4 M, mat4x4 const a, mat4x4 const b)
 {
 	int i;
 	for(i=0; i<4; ++i)
 		vec4_sub(M[i], a[i], b[i]);
 }
-static inline void mat4x4_scale(mat4x4 M, mat4x4 a, float k)
+LINMATH_H_FUNC void mat4x4_scale(mat4x4 M, mat4x4 const a, float k)
 {
 	int i;
 	for(i=0; i<4; ++i)
 		vec4_scale(M[i], a[i], k);
 }
-static inline void mat4x4_scale_aniso(mat4x4 M, mat4x4 a, float x, float y, float z)
+LINMATH_H_FUNC void mat4x4_scale_aniso(mat4x4 M, mat4x4 const a, float x, float y, float z)
 {
-	int i;
 	vec4_scale(M[0], a[0], x);
 	vec4_scale(M[1], a[1], y);
 	vec4_scale(M[2], a[2], z);
-	for(i = 0; i < 4; ++i) {
-		M[3][i] = a[3][i];
-	}
+	vec4_dup(M[3], a[3]);
 }
-static inline void mat4x4_mul(mat4x4 M, mat4x4 a, mat4x4 b)
+LINMATH_H_FUNC void mat4x4_mul(mat4x4 M, mat4x4 const a, mat4x4 const b)
 {
 	mat4x4 temp;
 	int k, r, c;
@@ -153,7 +177,7 @@
 	}
 	mat4x4_dup(M, temp);
 }
-static inline void mat4x4_mul_vec4(vec4 r, mat4x4 M, vec4 v)
+LINMATH_H_FUNC void mat4x4_mul_vec4(vec4 r, mat4x4 const M, vec4 const v)
 {
 	int i, j;
 	for(j=0; j<4; ++j) {
@@ -162,14 +186,14 @@
 			r[j] += M[i][j] * v[i];
 	}
 }
-static inline void mat4x4_translate(mat4x4 T, float x, float y, float z)
+LINMATH_H_FUNC void mat4x4_translate(mat4x4 T, float x, float y, float z)
 {
 	mat4x4_identity(T);
 	T[3][0] = x;
 	T[3][1] = y;
 	T[3][2] = z;
 }
-static inline void mat4x4_translate_in_place(mat4x4 M, float x, float y, float z)
+LINMATH_H_FUNC void mat4x4_translate_in_place(mat4x4 M, float x, float y, float z)
 {
 	vec4 t = {x, y, z, 0};
 	vec4 r;
@@ -179,33 +203,32 @@
 		M[3][i] += vec4_mul_inner(r, t);
 	}
 }
-static inline void mat4x4_from_vec3_mul_outer(mat4x4 M, vec3 a, vec3 b)
+LINMATH_H_FUNC void mat4x4_from_vec3_mul_outer(mat4x4 M, vec3 const a, vec3 const b)
 {
 	int i, j;
 	for(i=0; i<4; ++i) for(j=0; j<4; ++j)
 		M[i][j] = i<3 && j<3 ? a[i] * b[j] : 0.f;
 }
-static inline void mat4x4_rotate(mat4x4 R, mat4x4 M, float x, float y, float z, float angle)
+LINMATH_H_FUNC void mat4x4_rotate(mat4x4 R, mat4x4 const M, float x, float y, float z, float angle)
 {
 	float s = sinf(angle);
 	float c = cosf(angle);
 	vec3 u = {x, y, z};
 
 	if(vec3_len(u) > 1e-4) {
-		mat4x4 T, C, S = {{0}};
-
 		vec3_norm(u, u);
+		mat4x4 T;
 		mat4x4_from_vec3_mul_outer(T, u, u);
 
-		S[1][2] =  u[0];
-		S[2][1] = -u[0];
-		S[2][0] =  u[1];
-		S[0][2] = -u[1];
-		S[0][1] =  u[2];
-		S[1][0] = -u[2];
-
+		mat4x4 S = {
+			{    0,  u[2], -u[1], 0},
+			{-u[2],     0,  u[0], 0},
+			{ u[1], -u[0],     0, 0},
+			{    0,     0,     0, 0}
+		};
 		mat4x4_scale(S, S, s);
 
+		mat4x4 C;
 		mat4x4_identity(C);
 		mat4x4_sub(C, C, T);
 
@@ -214,13 +237,13 @@
 		mat4x4_add(T, T, C);
 		mat4x4_add(T, T, S);
 
-		T[3][3] = 1.;
+		T[3][3] = 1.f;
 		mat4x4_mul(R, M, T);
 	} else {
 		mat4x4_dup(R, M);
 	}
 }
-static inline void mat4x4_rotate_X(mat4x4 Q, mat4x4 M, float angle)
+LINMATH_H_FUNC void mat4x4_rotate_X(mat4x4 Q, mat4x4 const M, float angle)
 {
 	float s = sinf(angle);
 	float c = cosf(angle);
@@ -232,7 +255,7 @@
 	};
 	mat4x4_mul(Q, M, R);
 }
-static inline void mat4x4_rotate_Y(mat4x4 Q, mat4x4 M, float angle)
+LINMATH_H_FUNC void mat4x4_rotate_Y(mat4x4 Q, mat4x4 const M, float angle)
 {
 	float s = sinf(angle);
 	float c = cosf(angle);
@@ -244,7 +267,7 @@
 	};
 	mat4x4_mul(Q, M, R);
 }
-static inline void mat4x4_rotate_Z(mat4x4 Q, mat4x4 M, float angle)
+LINMATH_H_FUNC void mat4x4_rotate_Z(mat4x4 Q, mat4x4 const M, float angle)
 {
 	float s = sinf(angle);
 	float c = cosf(angle);
@@ -256,9 +279,8 @@
 	};
 	mat4x4_mul(Q, M, R);
 }
-static inline void mat4x4_invert(mat4x4 T, mat4x4 M)
+LINMATH_H_FUNC void mat4x4_invert(mat4x4 T, mat4x4 const M)
 {
-	float idet;
 	float s[6];
 	float c[6];
 	s[0] = M[0][0]*M[1][1] - M[1][0]*M[0][1];
@@ -274,10 +296,10 @@
 	c[3] = M[2][1]*M[3][2] - M[3][1]*M[2][2];
 	c[4] = M[2][1]*M[3][3] - M[3][1]*M[2][3];
 	c[5] = M[2][2]*M[3][3] - M[3][2]*M[2][3];
-
+	
 	/* Assumes it is invertible */
-	idet = 1.0f/( s[0]*c[5]-s[1]*c[4]+s[2]*c[3]+s[3]*c[2]-s[4]*c[1]+s[5]*c[0] );
-
+	float idet = 1.0f/( s[0]*c[5]-s[1]*c[4]+s[2]*c[3]+s[3]*c[2]-s[4]*c[1]+s[5]*c[0] );
+	
 	T[0][0] = ( M[1][1] * c[5] - M[1][2] * c[4] + M[1][3] * c[3]) * idet;
 	T[0][1] = (-M[0][1] * c[5] + M[0][2] * c[4] - M[0][3] * c[3]) * idet;
 	T[0][2] = ( M[3][1] * s[5] - M[3][2] * s[4] + M[3][3] * s[3]) * idet;
@@ -298,35 +320,34 @@
 	T[3][2] = (-M[3][0] * s[3] + M[3][1] * s[1] - M[3][2] * s[0]) * idet;
 	T[3][3] = ( M[2][0] * s[3] - M[2][1] * s[1] + M[2][2] * s[0]) * idet;
 }
-static inline void mat4x4_orthonormalize(mat4x4 R, mat4x4 M)
+LINMATH_H_FUNC void mat4x4_orthonormalize(mat4x4 R, mat4x4 const M)
 {
-	float s = 1.;
+	mat4x4_dup(R, M);
+	float s = 1.f;
 	vec3 h;
 
-	mat4x4_dup(R, M);
 	vec3_norm(R[2], R[2]);
-
-	s = vec3_mul_inner(R[1], R[2]);
-	vec3_scale(h, R[2], s);
-	vec3_sub(R[1], R[1], h);
-	vec3_norm(R[2], R[2]);
-
+	
 	s = vec3_mul_inner(R[1], R[2]);
 	vec3_scale(h, R[2], s);
 	vec3_sub(R[1], R[1], h);
 	vec3_norm(R[1], R[1]);
 
+	s = vec3_mul_inner(R[0], R[2]);
+	vec3_scale(h, R[2], s);
+	vec3_sub(R[0], R[0], h);
+
 	s = vec3_mul_inner(R[0], R[1]);
 	vec3_scale(h, R[1], s);
 	vec3_sub(R[0], R[0], h);
 	vec3_norm(R[0], R[0]);
 }
 
-static inline void mat4x4_frustum(mat4x4 M, float l, float r, float b, float t, float n, float f)
+LINMATH_H_FUNC void mat4x4_frustum(mat4x4 M, float l, float r, float b, float t, float n, float f)
 {
 	M[0][0] = 2.f*n/(r-l);
 	M[0][1] = M[0][2] = M[0][3] = 0.f;
-
+	
 	M[1][1] = 2.f*n/(t-b);
 	M[1][0] = M[1][2] = M[1][3] = 0.f;
 
@@ -334,11 +355,11 @@
 	M[2][1] = (t+b)/(t-b);
 	M[2][2] = -(f+n)/(f-n);
 	M[2][3] = -1.f;
-
+	
 	M[3][2] = -2.f*(f*n)/(f-n);
 	M[3][0] = M[3][1] = M[3][3] = 0.f;
 }
-static inline void mat4x4_ortho(mat4x4 M, float l, float r, float b, float t, float n, float f)
+LINMATH_H_FUNC void mat4x4_ortho(mat4x4 M, float l, float r, float b, float t, float n, float f)
 {
 	M[0][0] = 2.f/(r-l);
 	M[0][1] = M[0][2] = M[0][3] = 0.f;
@@ -348,17 +369,17 @@
 
 	M[2][2] = -2.f/(f-n);
 	M[2][0] = M[2][1] = M[2][3] = 0.f;
-
+	
 	M[3][0] = -(r+l)/(r-l);
 	M[3][1] = -(t+b)/(t-b);
 	M[3][2] = -(f+n)/(f-n);
 	M[3][3] = 1.f;
 }
-static inline void mat4x4_perspective(mat4x4 m, float y_fov, float aspect, float n, float f)
+LINMATH_H_FUNC void mat4x4_perspective(mat4x4 m, float y_fov, float aspect, float n, float f)
 {
 	/* NOTE: Degrees are an unhandy unit to work with.
 	 * linmath.h uses radians for everything! */
-	float const a = 1.f / (float) tan(y_fov / 2.f);
+	float const a = 1.f / tanf(y_fov / 2.f);
 
 	m[0][0] = a / aspect;
 	m[0][1] = 0.f;
@@ -380,7 +401,7 @@
 	m[3][2] = -((2.f * f * n) / (f - n));
 	m[3][3] = 0.f;
 }
-static inline void mat4x4_look_at(mat4x4 m, vec3 eye, vec3 center, vec3 up)
+LINMATH_H_FUNC void mat4x4_look_at(mat4x4 m, vec3 const eye, vec3 const center, vec3 const up)
 {
 	/* Adapted from Android's OpenGL Matrix.java.                        */
 	/* See the OpenGL GLUT documentation for gluLookAt for a description */
@@ -389,15 +410,14 @@
 	/* TODO: The negation of of can be spared by swapping the order of
 	 *       operands in the following cross products in the right way. */
 	vec3 f;
+	vec3_sub(f, center, eye);	
+	vec3_norm(f, f);	
+	
 	vec3 s;
-	vec3 t;
-
-	vec3_sub(f, center, eye);
-	vec3_norm(f, f);
-
 	vec3_mul_cross(s, f, up);
 	vec3_norm(s, s);
 
+	vec3 t;
 	vec3_mul_cross(t, s, f);
 
 	m[0][0] =  s[0];
@@ -424,24 +444,18 @@
 }
 
 typedef float quat[4];
-static inline void quat_identity(quat q)
+#define quat_add vec4_add
+#define quat_sub vec4_sub
+#define quat_norm vec4_norm
+#define quat_scale vec4_scale
+#define quat_mul_inner vec4_mul_inner
+
+LINMATH_H_FUNC void quat_identity(quat q)
 {
 	q[0] = q[1] = q[2] = 0.f;
 	q[3] = 1.f;
 }
-static inline void quat_add(quat r, quat a, quat b)
-{
-	int i;
-	for(i=0; i<4; ++i)
-		r[i] = a[i] + b[i];
-}
-static inline void quat_sub(quat r, quat a, quat b)
-{
-	int i;
-	for(i=0; i<4; ++i)
-		r[i] = a[i] - b[i];
-}
-static inline void quat_mul(quat r, quat p, quat q)
+LINMATH_H_FUNC void quat_mul(quat r, quat const p, quat const q)
 {
 	vec3 w;
 	vec3_mul_cross(r, p, q);
@@ -451,56 +465,42 @@
 	vec3_add(r, r, w);
 	r[3] = p[3]*q[3] - vec3_mul_inner(p, q);
 }
-static inline void quat_scale(quat r, quat v, float s)
-{
-	int i;
-	for(i=0; i<4; ++i)
-		r[i] = v[i] * s;
-}
-static inline float quat_inner_product(quat a, quat b)
-{
-	float p = 0.f;
-	int i;
-	for(i=0; i<4; ++i)
-		p += b[i]*a[i];
-	return p;
-}
-static inline void quat_conj(quat r, quat q)
+LINMATH_H_FUNC void quat_conj(quat r, quat const q)
 {
 	int i;
 	for(i=0; i<3; ++i)
 		r[i] = -q[i];
 	r[3] = q[3];
 }
-static inline void quat_rotate(quat r, float angle, vec3 axis) {
-	int i;
-	vec3 v;
-	vec3_scale(v, axis, sinf(angle / 2));
-	for(i=0; i<3; ++i)
-		r[i] = v[i];
-	r[3] = cosf(angle / 2);
+LINMATH_H_FUNC void quat_rotate(quat r, float angle, vec3 const axis) {
+    vec3 axis_norm;
+    vec3_norm(axis_norm, axis);
+    float s = sinf(angle / 2);
+    float c = cosf(angle / 2);
+    vec3_scale(r, axis_norm, s);
+    r[3] = c;
 }
-#define quat_norm vec4_norm
-static inline void quat_mul_vec3(vec3 r, quat q, vec3 v)
+LINMATH_H_FUNC void quat_mul_vec3(vec3 r, quat const q, vec3 const v)
 {
 /*
  * Method by Fabian 'ryg' Giessen (of Farbrausch)
 t = 2 * cross(q.xyz, v)
 v' = v + q.w * t + cross(q.xyz, t)
  */
-	vec3 t = {q[0], q[1], q[2]};
+	vec3 t;
+	vec3 q_xyz = {q[0], q[1], q[2]};
 	vec3 u = {q[0], q[1], q[2]};
 
-	vec3_mul_cross(t, t, v);
+	vec3_mul_cross(t, q_xyz, v);
 	vec3_scale(t, t, 2);
 
-	vec3_mul_cross(u, u, t);
+	vec3_mul_cross(u, q_xyz, t);
 	vec3_scale(t, t, q[3]);
 
 	vec3_add(r, v, t);
 	vec3_add(r, r, u);
 }
-static inline void mat4x4_from_quat(mat4x4 M, quat q)
+LINMATH_H_FUNC void mat4x4_from_quat(mat4x4 M, quat const q)
 {
 	float a = q[3];
 	float b = q[0];
@@ -510,7 +510,7 @@
 	float b2 = b*b;
 	float c2 = c*c;
 	float d2 = d*d;
-
+	
 	M[0][0] = a2 + b2 - c2 - d2;
 	M[0][1] = 2.f*(b*c + a*d);
 	M[0][2] = 2.f*(b*d - a*c);
@@ -530,18 +530,21 @@
 	M[3][3] = 1.f;
 }
 
-static inline void mat4x4o_mul_quat(mat4x4 R, mat4x4 M, quat q)
+LINMATH_H_FUNC void mat4x4o_mul_quat(mat4x4 R, mat4x4 const M, quat const q)
 {
-/*  XXX: The way this is written only works for othogonal matrices. */
+/*  XXX: The way this is written only works for orthogonal matrices. */
 /* TODO: Take care of non-orthogonal case. */
 	quat_mul_vec3(R[0], q, M[0]);
 	quat_mul_vec3(R[1], q, M[1]);
 	quat_mul_vec3(R[2], q, M[2]);
 
 	R[3][0] = R[3][1] = R[3][2] = 0.f;
-	R[3][3] = 1.f;
+	R[0][3] = M[0][3];
+	R[1][3] = M[1][3];
+	R[2][3] = M[2][3];
+	R[3][3] = M[3][3];  // typically 1.0, but here we make it general
 }
-static inline void quat_from_mat4x4(quat q, mat4x4 M)
+LINMATH_H_FUNC void quat_from_mat4x4(quat q, mat4x4 const M)
 {
 	float r=0.f;
 	int i;
@@ -557,7 +560,7 @@
 		p = &perm[i];
 	}
 
-	r = (float) sqrt(1.f + M[p[0]][p[0]] - M[p[1]][p[1]] - M[p[2]][p[2]] );
+	r = sqrtf(1.f + M[p[0]][p[0]] - M[p[1]][p[1]] - M[p[2]][p[2]] );
 
 	if(r < 1e-6) {
 		q[0] = 1.f;
@@ -571,4 +574,33 @@
 	q[3] = (M[p[2]][p[1]] - M[p[1]][p[2]])/(2.f*r);
 }
 
+LINMATH_H_FUNC void mat4x4_arcball(mat4x4 R, mat4x4 const M, vec2 const _a, vec2 const _b, float s)
+{
+	vec2 a; memcpy(a, _a, sizeof(a));
+	vec2 b; memcpy(b, _b, sizeof(b));
+	
+	float z_a = 0.f;
+	float z_b = 0.f;
+
+	if(vec2_len(a) < 1.f) {
+		z_a = sqrtf(1.f - vec2_mul_inner(a, a));
+	} else {
+		vec2_norm(a, a);
+	}
+
+	if(vec2_len(b) < 1.f) {
+		z_b = sqrtf(1.f - vec2_mul_inner(b, b));
+	} else {
+		vec2_norm(b, b);
+	}
+	
+	vec3 a_ = {a[0], a[1], z_a};
+	vec3 b_ = {b[0], b[1], z_b};
+
+	vec3 c_;
+	vec3_mul_cross(c_, a_, b_);
+
+	float const angle = acos(vec3_mul_inner(a_, b_)) * s;
+	mat4x4_rotate(R, M, c_[0], c_[1], c_[2], angle);
+}
 #endif
diff --git a/deps/nuklear.h b/deps/nuklear.h
index 6c87353..f2eb9df 100644
--- a/deps/nuklear.h
+++ b/deps/nuklear.h
@@ -105,6 +105,8 @@
 /// NK_INCLUDE_COMMAND_USERDATA     | Defining this adds a userdata pointer into each command. Can be useful for example if you want to provide custom shaders depending on the used widget. Can be combined with the style structures.
 /// NK_BUTTON_TRIGGER_ON_RELEASE    | Different platforms require button clicks occurring either on buttons being pressed (up to down) or released (down to up). By default this library will react on buttons being pressed, but if you define this it will only trigger if a button is released.
 /// NK_ZERO_COMMAND_MEMORY          | Defining this will zero out memory for each drawing command added to a drawing queue (inside nk_command_buffer_push). Zeroing command memory is very useful for fast checking (using memcmp) if command buffers are equal and avoid drawing frames when nothing on screen has changed since previous frame.
+/// NK_UINT_DRAW_INDEX              | Defining this will set the size of vertex index elements when using NK_VERTEX_BUFFER_OUTPUT to 32bit instead of the default of 16bit
+/// NK_KEYSTATE_BASED_INPUT         | Define this if your backend uses key state for each frame rather than key press/release events
 ///
 /// !!! WARNING
 ///     The following flags will pull in the standard C library:
@@ -122,6 +124,7 @@
 ///     - NK_INCLUDE_DEFAULT_FONT
 ///     - NK_INCLUDE_STANDARD_VARARGS
 ///     - NK_INCLUDE_COMMAND_USERDATA
+///     - NK_UINT_DRAW_INDEX
 ///
 /// ### Constants
 /// Define                          | Description
@@ -301,6 +304,7 @@
 #define NK_CLAMP(i,v,x) (NK_MAX(NK_MIN(v,x), i))
 
 #ifdef NK_INCLUDE_STANDARD_VARARGS
+  #include <stdarg.h> /* valist, va_start, va_end, ... */
   #if defined(_MSC_VER) && (_MSC_VER >= 1600) /* VS 2010 and above */
     #include <sal.h>
     #define NK_PRINTF_FORMAT_STRING _Printf_format_string_
@@ -314,7 +318,6 @@
     #define NK_PRINTF_VARARG_FUNC(fmtargnumber)
     #define NK_PRINTF_VALIST_FUNC(fmtargnumber)
   #endif
-  #include <stdarg.h> /* valist, va_start, va_end, ... */
 #endif
 
 /*
@@ -336,7 +339,7 @@
  #define NK_POINTER_TYPE uintptr_t
 #else
   #ifndef NK_INT8
-    #define NK_INT8 char
+    #define NK_INT8 signed char
   #endif
   #ifndef NK_UINT8
     #define NK_UINT8 unsigned char
@@ -1084,6 +1087,12 @@
 ///
 /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
 /// // fill configuration
+/// struct your_vertex
+/// {
+///     float pos[2]; // important to keep it to 2 floats
+///     float uv[2];
+///     unsigned char col[4];
+/// };
 /// struct nk_convert_config cfg = {};
 /// static const struct nk_draw_vertex_layout_element vertex_layout[] = {
 ///     {NK_VERTEX_POSITION, NK_FORMAT_FLOAT, NK_OFFSETOF(struct your_vertex, pos)},
@@ -1209,7 +1218,7 @@
 ///
 /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
 /// nk_flags nk_convert(struct nk_context *ctx, struct nk_buffer *cmds,
-//      struct nk_buffer *vertices, struct nk_buffer *elements, const struct nk_convert_config*);
+///     struct nk_buffer *vertices, struct nk_buffer *elements, const struct nk_convert_config*);
 /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 ///
 /// Parameter   | Description
@@ -1394,6 +1403,7 @@
 /// nk_window_get_content_region_max    | Returns the upper rectangle position of the currently visible and non-clipped space inside the currently processed window
 /// nk_window_get_content_region_size   | Returns the size of the currently visible and non-clipped space inside the currently processed window
 /// nk_window_get_canvas                | Returns the draw command buffer. Can be used to draw custom widgets
+/// nk_window_get_scroll                | Gets the scroll offset of the current window
 /// nk_window_has_focus                 | Returns if the currently processed window is currently active
 /// nk_window_is_collapsed              | Returns if the window with given name is currently minimized/collapsed
 /// nk_window_is_closed                 | Returns if the currently processed window was closed
@@ -1407,6 +1417,7 @@
 /// nk_window_set_position              | Updates position of the currently process window
 /// nk_window_set_size                  | Updates the size of the currently processed window
 /// nk_window_set_focus                 | Set the currently processed window as active window
+/// nk_window_set_scroll                | Sets the scroll offset of the current window
 //
 /// nk_window_close                     | Closes the window with given window name which deletes the window at the end of the frame
 /// nk_window_collapse                  | Collapses the window with given window name
@@ -1427,7 +1438,7 @@
 /// NK_WINDOW_TITLE             | Forces a header at the top at the window showing the title
 /// NK_WINDOW_SCROLL_AUTO_HIDE  | Automatically hides the window scrollbar if no user interaction: also requires delta time in `nk_context` to be set each frame
 /// NK_WINDOW_BACKGROUND        | Always keep window in the background
-/// NK_WINDOW_SCALE_LEFT        | Puts window scaler in the left-ottom corner instead right-bottom
+/// NK_WINDOW_SCALE_LEFT        | Puts window scaler in the left-bottom corner instead right-bottom
 /// NK_WINDOW_NO_INPUT          | Prevents window of scaling, moving or getting focus
 ///
 /// #### nk_collapse_states
@@ -1506,7 +1517,7 @@
 /// Finds and returns a window from passed name
 ///
 /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
-/// void nk_end(struct nk_context *ctx);
+/// struct nk_window *nk_window_find(struct nk_context *ctx, const char *name);
 /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 ///
 /// Parameter   | Description
@@ -1710,6 +1721,22 @@
 /// drawing canvas. Can be used to do custom drawing.
 */
 NK_API struct nk_command_buffer* nk_window_get_canvas(struct nk_context*);
+/*/// #### nk_window_get_scroll
+/// Gets the scroll offset for the current window
+/// !!! WARNING
+///     Only call this function between calls `nk_begin_xxx` and `nk_end`
+///
+/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
+/// void nk_window_get_scroll(struct nk_context *ctx, nk_uint *offset_x, nk_uint *offset_y);
+/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+///
+/// Parameter    | Description
+/// -------------|-----------------------------------------------------------
+/// __ctx__      | Must point to an previously initialized `nk_context` struct
+/// __offset_x__ | A pointer to the x offset output (or NULL to ignore)
+/// __offset_y__ | A pointer to the y offset output (or NULL to ignore)
+*/
+NK_API void nk_window_get_scroll(struct nk_context*, nk_uint *offset_x, nk_uint *offset_y);
 /*/// #### nk_window_has_focus
 /// Returns if the currently processed window is currently active
 /// !!! WARNING
@@ -1876,6 +1903,22 @@
 /// __name__    | Identifier of the window to set focus on
 */
 NK_API void nk_window_set_focus(struct nk_context*, const char *name);
+/*/// #### nk_window_set_scroll
+/// Sets the scroll offset for the current window
+/// !!! WARNING
+///     Only call this function between calls `nk_begin_xxx` and `nk_end`
+///
+/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
+/// void nk_window_set_scroll(struct nk_context *ctx, nk_uint offset_x, nk_uint offset_y);
+/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+///
+/// Parameter    | Description
+/// -------------|-----------------------------------------------------------
+/// __ctx__      | Must point to an previously initialized `nk_context` struct
+/// __offset_x__ | The x offset to scroll to
+/// __offset_y__ | The y offset to scroll to
+*/
+NK_API void nk_window_set_scroll(struct nk_context*, nk_uint offset_x, nk_uint offset_y);
 /*/// #### nk_window_close
 /// Closes a window and marks it for being freed at the end of the frame
 /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
@@ -2588,7 +2631,7 @@
 ///     case ...:
 ///         // [...]
 ///     }
-//      nk_clear(&ctx);
+///     nk_clear(&ctx);
 /// }
 /// nk_free(&ctx);
 /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -2601,6 +2644,8 @@
 /// nk_group_scrolled_offset_begin  | Start a new group with manual separated handling of scrollbar x- and y-offset
 /// nk_group_scrolled_begin         | Start a new group with manual scrollbar handling
 /// nk_group_scrolled_end           | Ends a group with manual scrollbar handling. Should only be called if nk_group_begin returned non-zero
+/// nk_group_get_scroll             | Gets the scroll offset for the given group
+/// nk_group_set_scroll             | Sets the scroll offset for the given group
 */
 /*/// #### nk_group_begin
 /// Starts a new widget group. Requires a previous layouting function to specify a pos/size.
@@ -2690,11 +2735,39 @@
 /// __ctx__     | Must point to an previously initialized `nk_context` struct
 */
 NK_API void nk_group_scrolled_end(struct nk_context*);
+/*/// #### nk_group_get_scroll
+/// Gets the scroll position of the given group.
+/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
+/// void nk_group_get_scroll(struct nk_context*, const char *id, nk_uint *x_offset, nk_uint *y_offset);
+/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+///
+/// Parameter    | Description
+/// -------------|-----------------------------------------------------------
+/// __ctx__      | Must point to an previously initialized `nk_context` struct
+/// __id__       | The id of the group to get the scroll position of
+/// __x_offset__ | A pointer to the x offset output (or NULL to ignore)
+/// __y_offset__ | A pointer to the y offset output (or NULL to ignore)
+*/
+NK_API void nk_group_get_scroll(struct nk_context*, const char *id, nk_uint *x_offset, nk_uint *y_offset);
+/*/// #### nk_group_set_scroll
+/// Sets the scroll position of the given group.
+/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
+/// void nk_group_set_scroll(struct nk_context*, const char *id, nk_uint x_offset, nk_uint y_offset);
+/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+///
+/// Parameter    | Description
+/// -------------|-----------------------------------------------------------
+/// __ctx__      | Must point to an previously initialized `nk_context` struct
+/// __id__       | The id of the group to scroll
+/// __x_offset__ | The x offset to scroll to
+/// __y_offset__ | The y offset to scroll to
+*/
+NK_API void nk_group_set_scroll(struct nk_context*, const char *id, nk_uint x_offset, nk_uint y_offset);
 /* =============================================================================
  *
  *                                  TREE
  *
- * ============================================================================= 
+ * =============================================================================
 /// ### Tree
 /// Trees represent two different concept. First the concept of a collapsable
 /// UI section that can be either in a hidden or visibile state. They allow the UI
@@ -3187,7 +3260,7 @@
 ///     case ...:
 ///         // [...]
 ///     }
-//      nk_clear(&ctx);
+///     nk_clear(&ctx);
 /// }
 /// nk_free(&ctx);
 /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -3395,6 +3468,8 @@
 NK_API int nk_popup_begin(struct nk_context*, enum nk_popup_type, const char*, nk_flags, struct nk_rect bounds);
 NK_API void nk_popup_close(struct nk_context*);
 NK_API void nk_popup_end(struct nk_context*);
+NK_API void nk_popup_get_scroll(struct nk_context*, nk_uint *offset_x, nk_uint *offset_y);
+NK_API void nk_popup_set_scroll(struct nk_context*, nk_uint offset_x, nk_uint offset_y);
 /* =============================================================================
  *
  *                                  COMBOBOX
@@ -4588,7 +4663,11 @@
     In fact it is probably more powerful than needed but allows even more crazy
     things than this library provides by default.
 */
+#ifdef NK_UINT_DRAW_INDEX
+typedef nk_uint nk_draw_index;
+#else
 typedef nk_ushort nk_draw_index;
+#endif
 enum nk_draw_list_stroke {
     NK_STROKE_OPEN = nk_false,
     /* build up path has no connection back to the beginning */
@@ -5603,7 +5682,6 @@
 
 #endif /* NK_NUKLEAR_H_ */
 
-
 #ifdef NK_IMPLEMENTATION
 
 #ifndef NK_INTERNAL_H
@@ -6007,15 +6085,18 @@
 NK_LIB float
 nk_cos(float x)
 {
-    NK_STORAGE const float a0 = +1.00238601909309722f;
-    NK_STORAGE const float a1 = -3.81919947353040024e-2f;
-    NK_STORAGE const float a2 = -3.94382342128062756e-1f;
-    NK_STORAGE const float a3 = -1.18134036025221444e-1f;
-    NK_STORAGE const float a4 = +1.07123798512170878e-1f;
-    NK_STORAGE const float a5 = -1.86637164165180873e-2f;
-    NK_STORAGE const float a6 = +9.90140908664079833e-4f;
-    NK_STORAGE const float a7 = -5.23022132118824778e-14f;
-    return a0 + x*(a1 + x*(a2 + x*(a3 + x*(a4 + x*(a5 + x*(a6 + x*a7))))));
+    /* New implementation. Also generated using lolremez. */
+    /* Old version significantly deviated from expected results. */
+    NK_STORAGE const float a0 = 9.9995999154986614e-1f;
+    NK_STORAGE const float a1 = 1.2548995793001028e-3f;
+    NK_STORAGE const float a2 = -5.0648546280678015e-1f;
+    NK_STORAGE const float a3 = 1.2942246466519995e-2f;
+    NK_STORAGE const float a4 = 2.8668384702547972e-2f;
+    NK_STORAGE const float a5 = 7.3726485210586547e-3f;
+    NK_STORAGE const float a6 = -3.8510875386947414e-3f;
+    NK_STORAGE const float a7 = 4.7196604604366623e-4f;
+    NK_STORAGE const float a8 = -1.8776444013090451e-5f;
+    return a0 + x*(a1 + x*(a2 + x*(a3 + x*(a4 + x*(a5 + x*(a6 + x*(a7 + x*a8)))))));
 }
 NK_LIB nk_uint
 nk_round_up_pow2(nk_uint v)
@@ -7151,23 +7232,29 @@
 {
     /* 32-Bit MurmurHash3: https://code.google.com/p/smhasher/wiki/MurmurHash3*/
     #define NK_ROTL(x,r) ((x) << (r) | ((x) >> (32 - r)))
-    union {const nk_uint *i; const nk_byte *b;} conv = {0};
-    const nk_byte *data = (const nk_byte*)key;
-    const int nblocks = len/4;
+
     nk_uint h1 = seed;
+    nk_uint k1;
+    const nk_byte *data = (const nk_byte*)key;
+    const nk_byte *keyptr = data;
+    nk_byte *k1ptr;
+    const int bsize = sizeof(k1);
+    const int nblocks = len/4;
+
     const nk_uint c1 = 0xcc9e2d51;
     const nk_uint c2 = 0x1b873593;
     const nk_byte *tail;
-    const nk_uint *blocks;
-    nk_uint k1;
     int i;
 
     /* body */
     if (!key) return 0;
-    conv.b = (data + nblocks*4);
-    blocks = (const nk_uint*)conv.i;
-    for (i = -nblocks; i; ++i) {
-        k1 = blocks[i];
+    for (i = 0; i < nblocks; ++i, keyptr += bsize) {
+        k1ptr = (nk_byte*)&k1;
+        k1ptr[0] = keyptr[0];
+        k1ptr[1] = keyptr[1];
+        k1ptr[2] = keyptr[2];
+        k1ptr[3] = keyptr[3];
+
         k1 *= c1;
         k1 = NK_ROTL(k1,15);
         k1 *= c2;
@@ -7181,15 +7268,15 @@
     tail = (const nk_byte*)(data + nblocks*4);
     k1 = 0;
     switch (len & 3) {
-    case 3: k1 ^= (nk_uint)(tail[2] << 16); /* fallthrough */
-    case 2: k1 ^= (nk_uint)(tail[1] << 8u); /* fallthrough */
-    case 1: k1 ^= tail[0];
+        case 3: k1 ^= (nk_uint)(tail[2] << 16); /* fallthrough */
+        case 2: k1 ^= (nk_uint)(tail[1] << 8u); /* fallthrough */
+        case 1: k1 ^= tail[0];
             k1 *= c1;
             k1 = NK_ROTL(k1,15);
             k1 *= c2;
             h1 ^= k1;
             break;
-    default: break;
+        default: break;
     }
 
     /* finalization */
@@ -9356,7 +9443,7 @@
      * backend (OpenGL, DirectX, ...). For example in OpenGL for `glDrawElements`
      * instead of specifing `GL_UNSIGNED_SHORT` you have to define `GL_UNSIGNED_INT`.
      * Sorry for the inconvenience. */
-    NK_ASSERT((sizeof(nk_draw_index) == 2 && list->vertex_count < NK_USHORT_MAX &&
+    if(sizeof(nk_draw_index)==2) NK_ASSERT((list->vertex_count < NK_USHORT_MAX &&
         "To many verticies for 16-bit vertex indicies. Please read comment above on how to solve this problem"));
     return vtx;
 }
@@ -12809,6 +12896,9 @@
                 dst_font->ascent = ((float)unscaled_ascent * font_scale);
                 dst_font->descent = ((float)unscaled_descent * font_scale);
                 dst_font->glyph_offset = glyph_n;
+                // Need to zero this, or it will carry over from a previous
+                // bake, and cause a segfault when accessing glyphs[].
+                dst_font->glyph_count = 0;
             }
 
             /* fill own baked font glyph array */
@@ -13903,8 +13993,12 @@
     NK_ASSERT(ctx);
     if (!ctx) return;
     in = &ctx->input;
+#ifdef NK_KEYSTATE_BASED_INPUT
     if (in->keyboard.keys[key].down != down)
         in->keyboard.keys[key].clicked++;
+#else
+    in->keyboard.keys[key].clicked++;
+#endif
     in->keyboard.keys[key].down = down;
 }
 NK_API void
@@ -15788,7 +15882,7 @@
         nk_fill_rect(out, empty_space, 0, style->window.background);
 
         /* fill right empty space */
-        empty_space.x = layout->bounds.x + layout->bounds.w - layout->border;
+        empty_space.x = layout->bounds.x + layout->bounds.w;
         empty_space.y = layout->bounds.y;
         empty_space.w = panel_padding.x + layout->border;
         empty_space.h = layout->bounds.h;
@@ -15797,11 +15891,11 @@
         nk_fill_rect(out, empty_space, 0, style->window.background);
 
         /* fill bottom empty space */
-        if (*layout->offset_x != 0 && !(layout->flags & NK_WINDOW_NO_SCROLLBAR)) {
+        if (layout->footer_height > 0) {
             empty_space.x = window->bounds.x;
             empty_space.y = layout->bounds.y + layout->bounds.h;
             empty_space.w = window->bounds.w;
-            empty_space.h = scrollbar_size.y;
+            empty_space.h = layout->footer_height;
             nk_fill_rect(out, empty_space, 0, style->window.background);
         }
     }
@@ -16175,8 +16269,8 @@
 {
     struct nk_window *win;
     struct nk_style *style;
-    nk_hash title_hash;
-    int title_len;
+    nk_hash name_hash;
+    int name_len;
     int ret = 0;
 
     NK_ASSERT(ctx);
@@ -16189,12 +16283,12 @@
 
     /* find or create window */
     style = &ctx->style;
-    title_len = (int)nk_strlen(name);
-    title_hash = nk_murmur_hash(name, (int)title_len, NK_WINDOW_TITLE);
-    win = nk_find_window(ctx, title_hash, name);
+    name_len = (int)nk_strlen(name);
+    name_hash = nk_murmur_hash(name, (int)name_len, NK_WINDOW_TITLE);
+    win = nk_find_window(ctx, name_hash, name);
     if (!win) {
         /* create new window */
-        nk_size name_length = (nk_size)nk_strlen(name);
+        nk_size name_length = (nk_size)name_len;
         win = (struct nk_window*)nk_create_window(ctx);
         NK_ASSERT(win);
         if (!win) return 0;
@@ -16206,7 +16300,7 @@
 
         win->flags = flags;
         win->bounds = bounds;
-        win->name = title_hash;
+        win->name = name_hash;
         name_length = NK_MIN(name_length, NK_WINDOW_MAX_NAME-1);
         NK_MEMCPY(win->name_string, name, name_length);
         win->name_string[name_length] = 0;
@@ -16434,6 +16528,20 @@
     if (!ctx || !ctx->current) return 0;
     return ctx->current->layout;
 }
+NK_API void
+nk_window_get_scroll(struct nk_context *ctx, nk_uint *offset_x, nk_uint *offset_y)
+{
+    struct nk_window *win;
+    NK_ASSERT(ctx);
+    NK_ASSERT(ctx->current);
+    if (!ctx || !ctx->current)
+        return ;
+    win = ctx->current;
+    if (offset_x)
+      *offset_x = win->scrollbar.x;
+    if (offset_y)
+      *offset_y = win->scrollbar.y;
+}
 NK_API int
 nk_window_has_focus(const struct nk_context *ctx)
 {
@@ -16600,6 +16708,18 @@
     win->bounds.h = size.y;
 }
 NK_API void
+nk_window_set_scroll(struct nk_context *ctx, nk_uint offset_x, nk_uint offset_y)
+{
+    struct nk_window *win;
+    NK_ASSERT(ctx);
+    NK_ASSERT(ctx->current);
+    if (!ctx || !ctx->current)
+        return;
+    win = ctx->current;
+    win->scrollbar.x = offset_x;
+    win->scrollbar.y = offset_y;
+}
+NK_API void
 nk_window_collapse(struct nk_context *ctx, const char *name,
                     enum nk_collapse_states c)
 {
@@ -16673,7 +16793,6 @@
 
 
 
-
 /* ===============================================================
  *
  *                              POPUP
@@ -16807,7 +16926,11 @@
     } else {
         /* close the popup if user pressed outside or in the header */
         int pressed, in_body, in_header;
+#ifdef NK_BUTTON_TRIGGER_ON_RELEASE
+        pressed = nk_input_is_mouse_released(&ctx->input, NK_BUTTON_LEFT);
+#else
         pressed = nk_input_is_mouse_pressed(&ctx->input, NK_BUTTON_LEFT);
+#endif
         in_body = nk_input_is_mouse_hovering_rect(&ctx->input, body);
         in_header = nk_input_is_mouse_hovering_rect(&ctx->input, header);
         if (pressed && (!in_body || in_header))
@@ -16898,7 +17021,38 @@
     ctx->current = win;
     nk_push_scissor(&win->buffer, win->layout->clip);
 }
+NK_API void
+nk_popup_get_scroll(struct nk_context *ctx, nk_uint *offset_x, nk_uint *offset_y)
+{
+    struct nk_window *popup;
 
+    NK_ASSERT(ctx);
+    NK_ASSERT(ctx->current);
+    NK_ASSERT(ctx->current->layout);
+    if (!ctx || !ctx->current || !ctx->current->layout)
+        return;
+
+    popup = ctx->current;
+    if (offset_x)
+      *offset_x = popup->scrollbar.x;
+    if (offset_y)
+      *offset_y = popup->scrollbar.y;
+}
+NK_API void
+nk_popup_set_scroll(struct nk_context *ctx, nk_uint offset_x, nk_uint offset_y)
+{
+    struct nk_window *popup;
+
+    NK_ASSERT(ctx);
+    NK_ASSERT(ctx->current);
+    NK_ASSERT(ctx->current->layout);
+    if (!ctx || !ctx->current || !ctx->current->layout)
+        return;
+
+    popup = ctx->current;
+    popup->scrollbar.x = offset_x;
+    popup->scrollbar.y = offset_y;
+}
 
 
 
@@ -18025,22 +18179,25 @@
     panel_space = nk_layout_row_calculate_usable_space(&ctx->style, layout->type,
                                             layout->bounds.w, layout->row.columns);
 
+    #define NK_FRAC(x) (x - (int)x) /* will be used to remove fookin gaps */
     /* calculate the width of one item inside the current layout space */
     switch (layout->row.type) {
     case NK_LAYOUT_DYNAMIC_FIXED: {
         /* scaling fixed size widgets item width */
-        item_width = NK_MAX(1.0f,panel_space) / (float)layout->row.columns;
-        item_offset = (float)layout->row.index * item_width;
+        float w = NK_MAX(1.0f,panel_space) / (float)layout->row.columns;
+        item_offset = (float)layout->row.index * w;
+        item_width = w + NK_FRAC(item_offset);
         item_spacing = (float)layout->row.index * spacing.x;
     } break;
     case NK_LAYOUT_DYNAMIC_ROW: {
         /* scaling single ratio widget width */
-        item_width = layout->row.item_width * panel_space;
+        float w = layout->row.item_width * panel_space;
         item_offset = layout->row.item_offset;
+        item_width = w + NK_FRAC(item_offset);
         item_spacing = 0;
 
         if (modify) {
-            layout->row.item_offset += item_width + spacing.x;
+            layout->row.item_offset += w + spacing.x;
             layout->row.filled += layout->row.item_width;
             layout->row.index = 0;
         }
@@ -18051,23 +18208,24 @@
         bounds->x -= (float)*layout->offset_x;
         bounds->y = layout->at_y + (layout->row.height * layout->row.item.y);
         bounds->y -= (float)*layout->offset_y;
-        bounds->w = layout->bounds.w  * layout->row.item.w;
-        bounds->h = layout->row.height * layout->row.item.h;
+        bounds->w = layout->bounds.w  * layout->row.item.w + NK_FRAC(bounds->x);
+        bounds->h = layout->row.height * layout->row.item.h + NK_FRAC(bounds->y);
         return;
     }
     case NK_LAYOUT_DYNAMIC: {
         /* scaling arrays of panel width ratios for every widget */
-        float ratio;
+        float ratio, w;
         NK_ASSERT(layout->row.ratio);
         ratio = (layout->row.ratio[layout->row.index] < 0) ?
             layout->row.item_width : layout->row.ratio[layout->row.index];
 
+        w = (ratio * panel_space);
         item_spacing = (float)layout->row.index * spacing.x;
-        item_width = (ratio * panel_space);
         item_offset = layout->row.item_offset;
+        item_width = w + NK_FRAC(item_offset);
 
         if (modify) {
-            layout->row.item_offset += item_width;
+            layout->row.item_offset += w;
             layout->row.filled += ratio;
         }
     } break;
@@ -18105,13 +18263,16 @@
     } break;
     case NK_LAYOUT_TEMPLATE: {
         /* stretchy row layout with combined dynamic/static widget width*/
+        float w;
         NK_ASSERT(layout->row.index < layout->row.columns);
         NK_ASSERT(layout->row.index < NK_MAX_LAYOUT_ROW_TEMPLATE_COLUMNS);
-        item_width = layout->row.templates[layout->row.index];
+        w = layout->row.templates[layout->row.index];
         item_offset = layout->row.item_offset;
+        item_width = w + NK_FRAC(item_offset);
         item_spacing = (float)layout->row.index * spacing.x;
-        if (modify) layout->row.item_offset += item_width;
+        if (modify) layout->row.item_offset += w;
     } break;
+    #undef NK_FRAC
     default: NK_ASSERT(0); break;
     };
 
@@ -18687,7 +18848,74 @@
 {
     nk_group_scrolled_end(ctx);
 }
+NK_API void
+nk_group_get_scroll(struct nk_context *ctx, const char *id, nk_uint *x_offset, nk_uint *y_offset)
+{
+    int id_len;
+    nk_hash id_hash;
+    struct nk_window *win;
+    nk_uint *x_offset_ptr;
+    nk_uint *y_offset_ptr;
 
+    NK_ASSERT(ctx);
+    NK_ASSERT(id);
+    NK_ASSERT(ctx->current);
+    NK_ASSERT(ctx->current->layout);
+    if (!ctx || !ctx->current || !ctx->current->layout || !id)
+        return;
+
+    /* find persistent group scrollbar value */
+    win = ctx->current;
+    id_len = (int)nk_strlen(id);
+    id_hash = nk_murmur_hash(id, (int)id_len, NK_PANEL_GROUP);
+    x_offset_ptr = nk_find_value(win, id_hash);
+    if (!x_offset_ptr) {
+        x_offset_ptr = nk_add_value(ctx, win, id_hash, 0);
+        y_offset_ptr = nk_add_value(ctx, win, id_hash+1, 0);
+
+        NK_ASSERT(x_offset_ptr);
+        NK_ASSERT(y_offset_ptr);
+        if (!x_offset_ptr || !y_offset_ptr) return;
+        *x_offset_ptr = *y_offset_ptr = 0;
+    } else y_offset_ptr = nk_find_value(win, id_hash+1);
+    if (x_offset)
+      *x_offset = *x_offset_ptr;
+    if (y_offset)
+      *y_offset = *y_offset_ptr;
+}
+NK_API void
+nk_group_set_scroll(struct nk_context *ctx, const char *id, nk_uint x_offset, nk_uint y_offset)
+{
+    int id_len;
+    nk_hash id_hash;
+    struct nk_window *win;
+    nk_uint *x_offset_ptr;
+    nk_uint *y_offset_ptr;
+
+    NK_ASSERT(ctx);
+    NK_ASSERT(id);
+    NK_ASSERT(ctx->current);
+    NK_ASSERT(ctx->current->layout);
+    if (!ctx || !ctx->current || !ctx->current->layout || !id)
+        return;
+
+    /* find persistent group scrollbar value */
+    win = ctx->current;
+    id_len = (int)nk_strlen(id);
+    id_hash = nk_murmur_hash(id, (int)id_len, NK_PANEL_GROUP);
+    x_offset_ptr = nk_find_value(win, id_hash);
+    if (!x_offset_ptr) {
+        x_offset_ptr = nk_add_value(ctx, win, id_hash, 0);
+        y_offset_ptr = nk_add_value(ctx, win, id_hash+1, 0);
+
+        NK_ASSERT(x_offset_ptr);
+        NK_ASSERT(y_offset_ptr);
+        if (!x_offset_ptr || !y_offset_ptr) return;
+        *x_offset_ptr = *y_offset_ptr = 0;
+    } else y_offset_ptr = nk_find_value(win, id_hash+1);
+    *x_offset_ptr = x_offset;
+    *y_offset_ptr = y_offset;
+}
 
 
 
@@ -21179,6 +21407,7 @@
 {
     nk_flags ws = 0;
     int left_mouse_down;
+    int left_mouse_clicked;
     int left_mouse_click_in_cursor;
     float scroll_delta;
 
@@ -21186,13 +21415,14 @@
     if (!in) return scroll_offset;
 
     left_mouse_down = in->mouse.buttons[NK_BUTTON_LEFT].down;
+    left_mouse_clicked = in->mouse.buttons[NK_BUTTON_LEFT].clicked;
     left_mouse_click_in_cursor = nk_input_has_mouse_click_down_in_rect(in,
         NK_BUTTON_LEFT, *cursor, nk_true);
     if (nk_input_is_mouse_hovering_rect(in, *scroll))
         *state = NK_WIDGET_STATE_HOVERED;
 
     scroll_delta = (o == NK_VERTICAL) ? in->mouse.scroll_delta.y: in->mouse.scroll_delta.x;
-    if (left_mouse_down && left_mouse_click_in_cursor) {
+    if (left_mouse_down && left_mouse_click_in_cursor && !left_mouse_clicked) {
         /* update cursor by mouse dragging */
         float pixel, delta;
         *state = NK_WIDGET_STATE_ACTIVE;
@@ -25243,172 +25473,182 @@
 ///    - [yy]: Minor version with non-breaking API and library changes
 ///    - [zz]: Bug fix version with no direct changes to API
 ///
-/// - 2018/04/01 (4.00.1) - Fixed calling `nk_convert` multiple time per single frame
+/// - 2019/09/20 (4.01.3) - Fixed a bug wherein combobox cannot be closed by clicking the header
+///                        when NK_BUTTON_TRIGGER_ON_RELEASE is defined.
+/// - 2019/09/10 (4.01.2) - Fixed the nk_cos function, which deviated significantly.
+/// - 2019/09/08 (4.01.1) - Fixed a bug wherein re-baking of fonts caused a segmentation
+///                        fault due to dst_font->glyph_count not being zeroed on subsequent
+///                        bakes of the same set of fonts.
+/// - 2019/06/23 (4.01.0) - Added nk_***_get_scroll and nk_***_set_scroll for groups, windows, and popups.
+/// - 2019/06/12 (4.00.3) - Fix panel background drawing bug.
+/// - 2018/10/31 (4.00.2) - Added NK_KEYSTATE_BASED_INPUT to "fix" state based backends
+///                        like GLFW without breaking key repeat behavior on event based.
+/// - 2018/04/01 (4.00.1) - Fixed calling `nk_convert` multiple time per single frame.
 /// - 2018/04/01 (4.00.0) - BREAKING CHANGE: nk_draw_list_clear no longer tries to
-///                         clear provided buffers. So make sure to either free
-///                         or clear each passed buffer after calling nk_convert.
-/// - 2018/02/23 (3.00.6) - Fixed slider dragging behavior
-/// - 2018/01/31 (3.00.5) - Fixed overcalculation of cursor data in font baking process
-/// - 2018/01/31 (3.00.4) - Removed name collision with stb_truetype
-/// - 2018/01/28 (3.00.3) - Fixed panel window border drawing bug
-/// - 2018/01/12 (3.00.2) - Added `nk_group_begin_titled` for separed group identifier and title
-/// - 2018/01/07 (3.00.1) - Started to change documentation style
+///                        clear provided buffers. So make sure to either free
+///                        or clear each passed buffer after calling nk_convert.
+/// - 2018/02/23 (3.00.6) - Fixed slider dragging behavior.
+/// - 2018/01/31 (3.00.5) - Fixed overcalculation of cursor data in font baking process.
+/// - 2018/01/31 (3.00.4) - Removed name collision with stb_truetype.
+/// - 2018/01/28 (3.00.3) - Fixed panel window border drawing bug.
+/// - 2018/01/12 (3.00.2) - Added `nk_group_begin_titled` for separed group identifier and title.
+/// - 2018/01/07 (3.00.1) - Started to change documentation style.
 /// - 2018/01/05 (3.00.0) - BREAKING CHANGE: The previous color picker API was broken
 ///                        because of conversions between float and byte color representation.
 ///                        Color pickers now use floating point values to represent
 ///                        HSV values. To get back the old behavior I added some additional
 ///                        color conversion functions to cast between nk_color and
 ///                        nk_colorf.
-/// - 2017/12/23 (2.00.7) - Fixed small warning
-/// - 2017/12/23 (2.00.7) - Fixed nk_edit_buffer behavior if activated to allow input
-/// - 2017/12/23 (2.00.7) - Fixed modifyable progressbar dragging visuals and input behavior
-/// - 2017/12/04 (2.00.6) - Added formated string tooltip widget
-/// - 2017/11/18 (2.00.5) - Fixed window becoming hidden with flag NK_WINDOW_NO_INPUT
-/// - 2017/11/15 (2.00.4) - Fixed font merging
-/// - 2017/11/07 (2.00.3) - Fixed window size and position modifier functions
-/// - 2017/09/14 (2.00.2) - Fixed nk_edit_buffer and nk_edit_focus behavior
-/// - 2017/09/14 (2.00.1) - Fixed window closing behavior
+/// - 2017/12/23 (2.00.7) - Fixed small warning.
+/// - 2017/12/23 (2.00.7) - Fixed `nk_edit_buffer` behavior if activated to allow input.
+/// - 2017/12/23 (2.00.7) - Fixed modifyable progressbar dragging visuals and input behavior.
+/// - 2017/12/04 (2.00.6) - Added formated string tooltip widget.
+/// - 2017/11/18 (2.00.5) - Fixed window becoming hidden with flag `NK_WINDOW_NO_INPUT`.
+/// - 2017/11/15 (2.00.4) - Fixed font merging.
+/// - 2017/11/07 (2.00.3) - Fixed window size and position modifier functions.
+/// - 2017/09/14 (2.00.2) - Fixed `nk_edit_buffer` and `nk_edit_focus` behavior.
+/// - 2017/09/14 (2.00.1) - Fixed window closing behavior.
 /// - 2017/09/14 (2.00.0) - BREAKING CHANGE: Modifing window position and size funtions now
 ///                        require the name of the window and must happen outside the window
 ///                        building process (between function call nk_begin and nk_end).
-/// - 2017/09/11 (1.40.9) - Fixed window background flag if background window is declared last
-/// - 2017/08/27 (1.40.8) - Fixed `nk_item_is_any_active` for hidden windows
-/// - 2017/08/27 (1.40.7) - Fixed window background flag
+/// - 2017/09/11 (1.40.9) - Fixed window background flag if background window is declared last.
+/// - 2017/08/27 (1.40.8) - Fixed `nk_item_is_any_active` for hidden windows.
+/// - 2017/08/27 (1.40.7) - Fixed window background flag.
 /// - 2017/07/07 (1.40.6) - Fixed missing clipping rect check for hovering/clicked
-///                        query for widgets
+///                        query for widgets.
 /// - 2017/07/07 (1.40.5) - Fixed drawing bug for vertex output for lines and stroked
-///                        and filled rectangles
+///                        and filled rectangles.
 /// - 2017/07/07 (1.40.4) - Fixed bug in nk_convert trying to add windows that are in
 ///                        process of being destroyed.
 /// - 2017/07/07 (1.40.3) - Fixed table internal bug caused by storing table size in
 ///                        window instead of directly in table.
-/// - 2017/06/30 (1.40.2) - Removed unneeded semicolon in C++ NK_ALIGNOF macro
-/// - 2017/06/30 (1.40.1) - Fixed drawing lines smaller or equal zero
+/// - 2017/06/30 (1.40.2) - Removed unneeded semicolon in C++ NK_ALIGNOF macro.
+/// - 2017/06/30 (1.40.1) - Fixed drawing lines smaller or equal zero.
 /// - 2017/06/08 (1.40.0) - Removed the breaking part of last commit. Auto layout now only
-///                        comes in effect if you pass in zero was row height argument
+///                        comes in effect if you pass in zero was row height argument.
 /// - 2017/06/08 (1.40.0) - BREAKING CHANGE: while not directly API breaking it will change
 ///                        how layouting works. From now there will be an internal minimum
 ///                        row height derived from font height. If you need a row smaller than
 ///                        that you can directly set it by `nk_layout_set_min_row_height` and
 ///                        reset the value back by calling `nk_layout_reset_min_row_height.
-/// - 2017/06/08 (1.39.1) - Fixed property text edit handling bug caused by past `nk_widget` fix
-/// - 2017/06/08 (1.39.0) - Added function to retrieve window space without calling a nk_layout_xxx function
-/// - 2017/06/06 (1.38.5) - Fixed `nk_convert` return flag for command buffer
-/// - 2017/05/23 (1.38.4) - Fixed activation behavior for widgets partially clipped
-/// - 2017/05/10 (1.38.3) - Fixed wrong min window size mouse scaling over boundries
-/// - 2017/05/09 (1.38.2) - Fixed vertical scrollbar drawing with not enough space
-/// - 2017/05/09 (1.38.1) - Fixed scaler dragging behavior if window size hits minimum size
-/// - 2017/05/06 (1.38.0) - Added platform double-click support
-/// - 2017/04/20 (1.37.1) - Fixed key repeat found inside glfw demo backends
-/// - 2017/04/20 (1.37.0) - Extended properties with selection and clipbard support
-/// - 2017/04/20 (1.36.2) - Fixed #405 overlapping rows with zero padding and spacing
-/// - 2017/04/09 (1.36.1) - Fixed #403 with another widget float error
-/// - 2017/04/09 (1.36.0) - Added window `NK_WINDOW_NO_INPUT` and `NK_WINDOW_NOT_INTERACTIVE` flags
-/// - 2017/04/09 (1.35.3) - Fixed buffer heap corruption
-/// - 2017/03/25 (1.35.2) - Fixed popup overlapping for `NK_WINDOW_BACKGROUND` windows
-/// - 2017/03/25 (1.35.1) - Fixed windows closing behavior
-/// - 2017/03/18 (1.35.0) - Added horizontal scroll requested in #377
-/// - 2017/03/18 (1.34.3) - Fixed long window header titles
-/// - 2017/03/04 (1.34.2) - Fixed text edit filtering
-/// - 2017/03/04 (1.34.1) - Fixed group closable flag
-/// - 2017/02/25 (1.34.0) - Added custom draw command for better language binding support
-/// - 2017/01/24 (1.33.0) - Added programatic way of remove edit focus
-/// - 2017/01/24 (1.32.3) - Fixed wrong define for basic type definitions for windows
-/// - 2017/01/21 (1.32.2) - Fixed input capture from hidden or closed windows
-/// - 2017/01/21 (1.32.1) - Fixed slider behavior and drawing
-/// - 2017/01/13 (1.32.0) - Added flag to put scaler into the bottom left corner
+/// - 2017/06/08 (1.39.1) - Fixed property text edit handling bug caused by past `nk_widget` fix.
+/// - 2017/06/08 (1.39.0) - Added function to retrieve window space without calling a `nk_layout_xxx` function.
+/// - 2017/06/06 (1.38.5) - Fixed `nk_convert` return flag for command buffer.
+/// - 2017/05/23 (1.38.4) - Fixed activation behavior for widgets partially clipped.
+/// - 2017/05/10 (1.38.3) - Fixed wrong min window size mouse scaling over boundries.
+/// - 2017/05/09 (1.38.2) - Fixed vertical scrollbar drawing with not enough space.
+/// - 2017/05/09 (1.38.1) - Fixed scaler dragging behavior if window size hits minimum size.
+/// - 2017/05/06 (1.38.0) - Added platform double-click support.
+/// - 2017/04/20 (1.37.1) - Fixed key repeat found inside glfw demo backends.
+/// - 2017/04/20 (1.37.0) - Extended properties with selection and clipboard support.
+/// - 2017/04/20 (1.36.2) - Fixed #405 overlapping rows with zero padding and spacing.
+/// - 2017/04/09 (1.36.1) - Fixed #403 with another widget float error.
+/// - 2017/04/09 (1.36.0) - Added window `NK_WINDOW_NO_INPUT` and `NK_WINDOW_NOT_INTERACTIVE` flags.
+/// - 2017/04/09 (1.35.3) - Fixed buffer heap corruption.
+/// - 2017/03/25 (1.35.2) - Fixed popup overlapping for `NK_WINDOW_BACKGROUND` windows.
+/// - 2017/03/25 (1.35.1) - Fixed windows closing behavior.
+/// - 2017/03/18 (1.35.0) - Added horizontal scroll requested in #377.
+/// - 2017/03/18 (1.34.3) - Fixed long window header titles.
+/// - 2017/03/04 (1.34.2) - Fixed text edit filtering.
+/// - 2017/03/04 (1.34.1) - Fixed group closable flag.
+/// - 2017/02/25 (1.34.0) - Added custom draw command for better language binding support.
+/// - 2017/01/24 (1.33.0) - Added programatic way of remove edit focus.
+/// - 2017/01/24 (1.32.3) - Fixed wrong define for basic type definitions for windows.
+/// - 2017/01/21 (1.32.2) - Fixed input capture from hidden or closed windows.
+/// - 2017/01/21 (1.32.1) - Fixed slider behavior and drawing.
+/// - 2017/01/13 (1.32.0) - Added flag to put scaler into the bottom left corner.
 /// - 2017/01/13 (1.31.0) - Added additional row layouting method to combine both
 ///                        dynamic and static widgets.
-/// - 2016/12/31 (1.30.0) - Extended scrollbar offset from 16-bit to 32-bit
-/// - 2016/12/31 (1.29.2)- Fixed closing window bug of minimized windows
-/// - 2016/12/03 (1.29.1)- Fixed wrapped text with no seperator and C89 error
-/// - 2016/12/03 (1.29.0) - Changed text wrapping to process words not characters
-/// - 2016/11/22 (1.28.6)- Fixed window minimized closing bug
-/// - 2016/11/19 (1.28.5)- Fixed abstract combo box closing behavior
-/// - 2016/11/19 (1.28.4)- Fixed tooltip flickering
-/// - 2016/11/19 (1.28.3)- Fixed memory leak caused by popup repeated closing
-/// - 2016/11/18 (1.28.2)- Fixed memory leak caused by popup panel allocation
-/// - 2016/11/10 (1.28.1)- Fixed some warnings and C++ error
-/// - 2016/11/10 (1.28.0)- Added additional `nk_button` versions which allows to directly
+/// - 2016/12/31 (1.30.0) - Extended scrollbar offset from 16-bit to 32-bit.
+/// - 2016/12/31 (1.29.2) - Fixed closing window bug of minimized windows.
+/// - 2016/12/03 (1.29.1) - Fixed wrapped text with no seperator and C89 error.
+/// - 2016/12/03 (1.29.0) - Changed text wrapping to process words not characters.
+/// - 2016/11/22 (1.28.6) - Fixed window minimized closing bug.
+/// - 2016/11/19 (1.28.5) - Fixed abstract combo box closing behavior.
+/// - 2016/11/19 (1.28.4) - Fixed tooltip flickering.
+/// - 2016/11/19 (1.28.3) - Fixed memory leak caused by popup repeated closing.
+/// - 2016/11/18 (1.28.2) - Fixed memory leak caused by popup panel allocation.
+/// - 2016/11/10 (1.28.1) - Fixed some warnings and C++ error.
+/// - 2016/11/10 (1.28.0) - Added additional `nk_button` versions which allows to directly
 ///                        pass in a style struct to change buttons visual.
-/// - 2016/11/10 (1.27.0)- Added additional 'nk_tree' versions to support external state
+/// - 2016/11/10 (1.27.0) - Added additional `nk_tree` versions to support external state
 ///                        storage. Just like last the `nk_group` commit the main
 ///                        advantage is that you optionally can minimize nuklears runtime
 ///                        memory consumption or handle hash collisions.
-/// - 2016/11/09 (1.26.0)- Added additional `nk_group` version to support external scrollbar
+/// - 2016/11/09 (1.26.0) - Added additional `nk_group` version to support external scrollbar
 ///                        offset storage. Main advantage is that you can externalize
 ///                        the memory management for the offset. It could also be helpful
 ///                        if you have a hash collision in `nk_group_begin` but really
 ///                        want the name. In addition I added `nk_list_view` which allows
 ///                        to draw big lists inside a group without actually having to
 ///                        commit the whole list to nuklear (issue #269).
-/// - 2016/10/30 (1.25.1)- Fixed clipping rectangle bug inside `nk_draw_list`
-/// - 2016/10/29 (1.25.0)- Pulled `nk_panel` memory management into nuklear and out of
+/// - 2016/10/30 (1.25.1) - Fixed clipping rectangle bug inside `nk_draw_list`.
+/// - 2016/10/29 (1.25.0) - Pulled `nk_panel` memory management into nuklear and out of
 ///                        the hands of the user. From now on users don't have to care
 ///                        about panels unless they care about some information. If you
 ///                        still need the panel just call `nk_window_get_panel`.
-/// - 2016/10/21 (1.24.0)- Changed widget border drawing to stroked rectangle from filled
+/// - 2016/10/21 (1.24.0) - Changed widget border drawing to stroked rectangle from filled
 ///                        rectangle for less overdraw and widget background transparency.
-/// - 2016/10/18 (1.23.0)- Added `nk_edit_focus` for manually edit widget focus control
-/// - 2016/09/29 (1.22.7)- Fixed deduction of basic type in non `<stdint.h>` compilation
-/// - 2016/09/29 (1.22.6)- Fixed edit widget UTF-8 text cursor drawing bug
-/// - 2016/09/28 (1.22.5)- Fixed edit widget UTF-8 text appending/inserting/removing
-/// - 2016/09/28 (1.22.4)- Fixed drawing bug inside edit widgets which offset all text
+/// - 2016/10/18 (1.23.0) - Added `nk_edit_focus` for manually edit widget focus control.
+/// - 2016/09/29 (1.22.7) - Fixed deduction of basic type in non `<stdint.h>` compilation.
+/// - 2016/09/29 (1.22.6) - Fixed edit widget UTF-8 text cursor drawing bug.
+/// - 2016/09/28 (1.22.5) - Fixed edit widget UTF-8 text appending/inserting/removing.
+/// - 2016/09/28 (1.22.4) - Fixed drawing bug inside edit widgets which offset all text
 ///                        text in every edit widget if one of them is scrolled.
-/// - 2016/09/28 (1.22.3)- Fixed small bug in edit widgets if not active. The wrong
+/// - 2016/09/28 (1.22.3) - Fixed small bug in edit widgets if not active. The wrong
 ///                        text length is passed. It should have been in bytes but
 ///                        was passed as glyphes.
-/// - 2016/09/20 (1.22.2)- Fixed color button size calculation
-/// - 2016/09/20 (1.22.1)- Fixed some `nk_vsnprintf` behavior bugs and removed
-///                        `<stdio.h>` again from `NK_INCLUDE_STANDARD_VARARGS`.
-/// - 2016/09/18 (1.22.0)- C89 does not support vsnprintf only C99 and newer as well
+/// - 2016/09/20 (1.22.2) - Fixed color button size calculation.
+/// - 2016/09/20 (1.22.1) - Fixed some `nk_vsnprintf` behavior bugs and removed `<stdio.h>`
+///                        again from `NK_INCLUDE_STANDARD_VARARGS`.
+/// - 2016/09/18 (1.22.0) - C89 does not support vsnprintf only C99 and newer as well
 ///                        as C++11 and newer. In addition to use vsnprintf you have
 ///                        to include <stdio.h>. So just defining `NK_INCLUDE_STD_VAR_ARGS`
 ///                        is not enough. That behavior is now fixed. By default if
 ///                        both varargs as well as stdio is selected I try to use
 ///                        vsnprintf if not possible I will revert to vsprintf. If
 ///                        varargs but not stdio was defined I will use my own function.
-/// - 2016/09/15 (1.21.2)- Fixed panel `close` behavior for deeper panel levels
-/// - 2016/09/15 (1.21.1)- Fixed C++ errors and wrong argument to `nk_panel_get_xxxx`
+/// - 2016/09/15 (1.21.2) - Fixed panel `close` behavior for deeper panel levels.
+/// - 2016/09/15 (1.21.1) - Fixed C++ errors and wrong argument to `nk_panel_get_xxxx`.
 /// - 2016/09/13 (1.21.0) - !BREAKING! Fixed nonblocking popup behavior in menu, combo,
 ///                        and contextual which prevented closing in y-direction if
 ///                        popup did not reach max height.
 ///                        In addition the height parameter was changed into vec2
 ///                        for width and height to have more control over the popup size.
-/// - 2016/09/13 (1.20.3) - Cleaned up and extended type selection
-/// - 2016/09/13 (1.20.2)- Fixed slider behavior hopefully for the last time. This time
+/// - 2016/09/13 (1.20.3) - Cleaned up and extended type selection.
+/// - 2016/09/13 (1.20.2) - Fixed slider behavior hopefully for the last time. This time
 ///                        all calculation are correct so no more hackery.
-/// - 2016/09/13 (1.20.1)- Internal change to divide window/panel flags into panel flags and types.
+/// - 2016/09/13 (1.20.1) - Internal change to divide window/panel flags into panel flags and types.
 ///                        Suprisinly spend years in C and still happened to confuse types
 ///                        with flags. Probably something to take note.
-/// - 2016/09/08 (1.20.0)- Added additional helper function to make it easier to just
+/// - 2016/09/08 (1.20.0) - Added additional helper function to make it easier to just
 ///                        take the produced buffers from `nk_convert` and unplug the
 ///                        iteration process from `nk_context`. So now you can
 ///                        just use the vertex,element and command buffer + two pointer
 ///                        inside the command buffer retrieved by calls `nk__draw_begin`
 ///                        and `nk__draw_end` and macro `nk_draw_foreach_bounded`.
-/// - 2016/09/08 (1.19.0)- Added additional asserts to make sure every `nk_xxx_begin` call
+/// - 2016/09/08 (1.19.0) - Added additional asserts to make sure every `nk_xxx_begin` call
 ///                        for windows, popups, combobox, menu and contextual is guarded by
 ///                        `if` condition and does not produce false drawing output.
-/// - 2016/09/08 (1.18.0)- Changed confusing name for `NK_SYMBOL_RECT_FILLED`, `NK_SYMBOL_RECT`
+/// - 2016/09/08 (1.18.0) - Changed confusing name for `NK_SYMBOL_RECT_FILLED`, `NK_SYMBOL_RECT`
 ///                        to hopefully easier to understand `NK_SYMBOL_RECT_FILLED` and
 ///                        `NK_SYMBOL_RECT_OUTLINE`.
-/// - 2016/09/08 (1.17.0)- Changed confusing name for `NK_SYMBOL_CIRLCE_FILLED`, `NK_SYMBOL_CIRCLE`
+/// - 2016/09/08 (1.17.0) - Changed confusing name for `NK_SYMBOL_CIRLCE_FILLED`, `NK_SYMBOL_CIRCLE`
 ///                        to hopefully easier to understand `NK_SYMBOL_CIRCLE_FILLED` and
 ///                        `NK_SYMBOL_CIRCLE_OUTLINE`.
-/// - 2016/09/08 (1.16.0)- Added additional checks to select correct types if `NK_INCLUDE_FIXED_TYPES`
+/// - 2016/09/08 (1.16.0) - Added additional checks to select correct types if `NK_INCLUDE_FIXED_TYPES`
 ///                        is not defined by supporting the biggest compiler GCC, clang and MSVC.
-/// - 2016/09/07 (1.15.3)- Fixed `NK_INCLUDE_COMMAND_USERDATA` define to not cause an error
-/// - 2016/09/04 (1.15.2)- Fixed wrong combobox height calculation
-/// - 2016/09/03 (1.15.1)- Fixed gaps inside combo boxes in OpenGL
+/// - 2016/09/07 (1.15.3) - Fixed `NK_INCLUDE_COMMAND_USERDATA` define to not cause an error.
+/// - 2016/09/04 (1.15.2) - Fixed wrong combobox height calculation.
+/// - 2016/09/03 (1.15.1) - Fixed gaps inside combo boxes in OpenGL.
 /// - 2016/09/02 (1.15.0) - Changed nuklear to not have any default vertex layout and
 ///                        instead made it user provided. The range of types to convert
 ///                        to is quite limited at the moment, but I would be more than
 ///                        happy to accept PRs to add additional.
-/// - 2016/08/30 (1.14.2) - Removed unused variables
-/// - 2016/08/30 (1.14.1) - Fixed C++ build errors
-/// - 2016/08/30 (1.14.0) - Removed mouse dragging from SDL demo since it does not work correctly
-/// - 2016/08/30 (1.13.4) - Tweaked some default styling variables
+/// - 2016/08/30 (1.14.2) - Removed unused variables.
+/// - 2016/08/30 (1.14.1) - Fixed C++ build errors.
+/// - 2016/08/30 (1.14.0) - Removed mouse dragging from SDL demo since it does not work correctly.
+/// - 2016/08/30 (1.13.4) - Tweaked some default styling variables.
 /// - 2016/08/30 (1.13.3) - Hopefully fixed drawing bug in slider, in general I would
 ///                        refrain from using slider with a big number of steps.
 /// - 2016/08/30 (1.13.2) - Fixed close and minimize button which would fire even if the
@@ -25418,36 +25658,36 @@
 /// - 2016/08/30 (1.13.0) - Removed `NK_WINDOW_DYNAMIC` flag from public API since
 ///                        it is bugged and causes issues in window selection.
 /// - 2016/08/30 (1.12.0) - Removed scaler size. The size of the scaler is now
-///                        determined by the scrollbar size
-/// - 2016/08/30 (1.11.2) - Fixed some drawing bugs caused by changes from 1.11
-/// - 2016/08/30 (1.11.1) - Fixed overlapping minimized window selection
+///                        determined by the scrollbar size.
+/// - 2016/08/30 (1.11.2) - Fixed some drawing bugs caused by changes from 1.11.0.
+/// - 2016/08/30 (1.11.1) - Fixed overlapping minimized window selection.
 /// - 2016/08/30 (1.11.0) - Removed some internal complexity and overly complex code
 ///                        handling panel padding and panel border.
-/// - 2016/08/29 (1.10.0) - Added additional height parameter to `nk_combobox_xxx`
-/// - 2016/08/29 (1.10.0) - Fixed drawing bug in dynamic popups
-/// - 2016/08/29 (1.10.0) - Added experimental mouse scrolling to popups, menus and comboboxes
+/// - 2016/08/29 (1.10.0) - Added additional height parameter to `nk_combobox_xxx`.
+/// - 2016/08/29 (1.10.0) - Fixed drawing bug in dynamic popups.
+/// - 2016/08/29 (1.10.0) - Added experimental mouse scrolling to popups, menus and comboboxes.
 /// - 2016/08/26 (1.10.0) - Added window name string prepresentation to account for
-///                        hash collisions. Currently limited to NK_WINDOW_MAX_NAME
+///                        hash collisions. Currently limited to `NK_WINDOW_MAX_NAME`
 ///                        which in term can be redefined if not big enough.
-/// - 2016/08/26 (1.10.0) - Added stacks for temporary style/UI changes in code
+/// - 2016/08/26 (1.10.0) - Added stacks for temporary style/UI changes in code.
 /// - 2016/08/25 (1.10.0) - Changed `nk_input_is_key_pressed` and 'nk_input_is_key_released'
 ///                        to account for key press and release happening in one frame.
-/// - 2016/08/25 (1.10.0) - Added additional nk_edit flag to directly jump to the end on activate
-/// - 2016/08/17 (1.09.6)- Removed invalid check for value zero in nk_propertyx
-/// - 2016/08/16 (1.09.5)- Fixed ROM mode for deeper levels of popup windows parents.
-/// - 2016/08/15 (1.09.4)- Editbox are now still active if enter was pressed with flag
+/// - 2016/08/25 (1.10.0) - Added additional nk_edit flag to directly jump to the end on activate.
+/// - 2016/08/17 (1.09.6) - Removed invalid check for value zero in `nk_propertyx`.
+/// - 2016/08/16 (1.09.5) - Fixed ROM mode for deeper levels of popup windows parents.
+/// - 2016/08/15 (1.09.4) - Editbox are now still active if enter was pressed with flag
 ///                        `NK_EDIT_SIG_ENTER`. Main reasoning is to be able to keep
 ///                        typing after commiting.
-/// - 2016/08/15 (1.09.4)- Removed redundant code
-/// - 2016/08/15 (1.09.4)- Fixed negative numbers in `nk_strtoi` and remove unused variable
-/// - 2016/08/15 (1.09.3)- Fixed `NK_WINDOW_BACKGROUND` flag behavior to select a background
+/// - 2016/08/15 (1.09.4) - Removed redundant code.
+/// - 2016/08/15 (1.09.4) - Fixed negative numbers in `nk_strtoi` and remove unused variable.
+/// - 2016/08/15 (1.09.3) - Fixed `NK_WINDOW_BACKGROUND` flag behavior to select a background
 ///                        window only as selected by hovering and not by clicking.
-/// - 2016/08/14 (1.09.2)- Fixed a bug in font atlas which caused wrong loading
+/// - 2016/08/14 (1.09.2) - Fixed a bug in font atlas which caused wrong loading
 ///                        of glyphes for font with multiple ranges.
-/// - 2016/08/12 (1.09.1)- Added additional function to check if window is currently
+/// - 2016/08/12 (1.09.1) - Added additional function to check if window is currently
 ///                        hidden and therefore not visible.
-/// - 2016/08/12 (1.09.1)- nk_window_is_closed now queries the correct flag `NK_WINDOW_CLOSED`
-///                        instead of the old flag `NK_WINDOW_HIDDEN`
+/// - 2016/08/12 (1.09.1) - nk_window_is_closed now queries the correct flag `NK_WINDOW_CLOSED`
+///                        instead of the old flag `NK_WINDOW_HIDDEN`.
 /// - 2016/08/09 (1.09.0) - Added additional double version to nk_property and changed
 ///                        the underlying implementation to not cast to float and instead
 ///                        work directly on the given values.
@@ -25457,8 +25697,8 @@
 /// - 2016/08/09 (1.08.0) - Added additional define to overwrite library internal
 ///                        string to floating point number conversion for additional
 ///                        precision.
-/// - 2016/08/08 (1.07.2)- Fixed compiling error without define NK_INCLUDE_FIXED_TYPE
-/// - 2016/08/08 (1.07.1)- Fixed possible floating point error inside `nk_widget` leading
+/// - 2016/08/08 (1.07.2) - Fixed compiling error without define `NK_INCLUDE_FIXED_TYPE`.
+/// - 2016/08/08 (1.07.1) - Fixed possible floating point error inside `nk_widget` leading
 ///                        to wrong wiget width calculation which results in widgets falsly
 ///                        becomming tagged as not inside window and cannot be accessed.
 /// - 2016/08/08 (1.07.0) - Nuklear now differentiates between hiding a window (NK_WINDOW_HIDDEN) and
@@ -25469,31 +25709,31 @@
 ///                        remain.
 /// - 2016/08/08 (1.06.0) - Added `nk_edit_string_zero_terminated` as a second option to
 ///                        `nk_edit_string` which takes, edits and outputs a '\0' terminated string.
-/// - 2016/08/08 (1.05.4)- Fixed scrollbar auto hiding behavior
-/// - 2016/08/08 (1.05.3)- Fixed wrong panel padding selection in `nk_layout_widget_space`
-/// - 2016/08/07 (1.05.2)- Fixed old bug in dynamic immediate mode layout API, calculating
+/// - 2016/08/08 (1.05.4) - Fixed scrollbar auto hiding behavior.
+/// - 2016/08/08 (1.05.3) - Fixed wrong panel padding selection in `nk_layout_widget_space`.
+/// - 2016/08/07 (1.05.2) - Fixed old bug in dynamic immediate mode layout API, calculating
 ///                        wrong item spacing and panel width.
-///- 2016/08/07 (1.05.1)- Hopefully finally fixed combobox popup drawing bug
-///- 2016/08/07 (1.05.0) - Split varargs away from NK_INCLUDE_STANDARD_IO into own
-///                        define NK_INCLUDE_STANDARD_VARARGS to allow more fine
+/// - 2016/08/07 (1.05.1) - Hopefully finally fixed combobox popup drawing bug.
+/// - 2016/08/07 (1.05.0) - Split varargs away from `NK_INCLUDE_STANDARD_IO` into own
+///                        define `NK_INCLUDE_STANDARD_VARARGS` to allow more fine
 ///                        grained controlled over library includes.
-/// - 2016/08/06 (1.04.5)- Changed memset calls to NK_MEMSET
-/// - 2016/08/04 (1.04.4)- Fixed fast window scaling behavior
-/// - 2016/08/04 (1.04.3)- Fixed window scaling, movement bug which appears if you
+/// - 2016/08/06 (1.04.5) - Changed memset calls to `NK_MEMSET`.
+/// - 2016/08/04 (1.04.4) - Fixed fast window scaling behavior.
+/// - 2016/08/04 (1.04.3) - Fixed window scaling, movement bug which appears if you
 ///                        move/scale a window and another window is behind it.
 ///                        If you are fast enough then the window behind gets activated
 ///                        and the operation is blocked. I now require activating
 ///                        by hovering only if mouse is not pressed.
-/// - 2016/08/04 (1.04.2)- Fixed changing fonts
-/// - 2016/08/03 (1.04.1)- Fixed `NK_WINDOW_BACKGROUND` behavior
-/// - 2016/08/03 (1.04.0) - Added color parameter to `nk_draw_image`
+/// - 2016/08/04 (1.04.2) - Fixed changing fonts.
+/// - 2016/08/03 (1.04.1) - Fixed `NK_WINDOW_BACKGROUND` behavior.
+/// - 2016/08/03 (1.04.0) - Added color parameter to `nk_draw_image`.
 /// - 2016/08/03 (1.04.0) - Added additional window padding style attributes for
-///                        sub windows (combo, menu, ...)
-/// - 2016/08/03 (1.04.0) - Added functions to show/hide software cursor
+///                        sub windows (combo, menu, ...).
+/// - 2016/08/03 (1.04.0) - Added functions to show/hide software cursor.
 /// - 2016/08/03 (1.04.0) - Added `NK_WINDOW_BACKGROUND` flag to force a window
-///                        to be always in the background of the screen
-/// - 2016/08/03 (1.03.2)- Removed invalid assert macro for NK_RGB color picker
-/// - 2016/08/01 (1.03.1)- Added helper macros into header include guard
+///                        to be always in the background of the screen.
+/// - 2016/08/03 (1.03.2) - Removed invalid assert macro for NK_RGB color picker.
+/// - 2016/08/01 (1.03.1) - Added helper macros into header include guard.
 /// - 2016/07/29 (1.03.0) - Moved the window/table pool into the header part to
 ///                        simplify memory management by removing the need to
 ///                        allocate the pool.
@@ -25501,16 +25741,15 @@
 ///                        will hide the window scrollbar after NK_SCROLLBAR_HIDING_TIMEOUT
 ///                        seconds without window interaction. To make it work
 ///                        you have to also set a delta time inside the `nk_context`.
-/// - 2016/07/25 (1.01.1) - Fixed small panel and panel border drawing bugs
-/// - 2016/07/15 (1.01.0) - Added software cursor to `nk_style` and `nk_context`
-/// - 2016/07/15 (1.01.0) - Added const correctness to `nk_buffer_push' data argument
+/// - 2016/07/25 (1.01.1) - Fixed small panel and panel border drawing bugs.
+/// - 2016/07/15 (1.01.0) - Added software cursor to `nk_style` and `nk_context`.
+/// - 2016/07/15 (1.01.0) - Added const correctness to `nk_buffer_push' data argument.
 /// - 2016/07/15 (1.01.0) - Removed internal font baking API and simplified
 ///                        font atlas memory management by converting pointer
 ///                        arrays for fonts and font configurations to lists.
 /// - 2016/07/15 (1.00.0) - Changed button API to use context dependend button
 ///                        behavior instead of passing it for every function call.
 /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
 /// ## Gallery
 /// ![Figure [blue]: Feature overview with blue color styling](https://cloud.githubusercontent.com/assets/8057201/13538240/acd96876-e249-11e5-9547-5ac0b19667a0.png)
 /// ![Figure [red]: Feature overview with red color styling](https://cloud.githubusercontent.com/assets/8057201/13538243/b04acd4c-e249-11e5-8fd2-ad7744a5b446.png)
diff --git a/deps/nuklear_glfw_gl2.h b/deps/nuklear_glfw_gl2.h
index 61acc29..a959b14 100644
--- a/deps/nuklear_glfw_gl2.h
+++ b/deps/nuklear_glfw_gl2.h
@@ -230,7 +230,7 @@
 }
 
 NK_INTERN void
-nk_glfw3_clipbard_paste(nk_handle usr, struct nk_text_edit *edit)
+nk_glfw3_clipboard_paste(nk_handle usr, struct nk_text_edit *edit)
 {
     const char *text = glfwGetClipboardString(glfw.win);
     if (text) nk_textedit_paste(edit, text, nk_strlen(text));
@@ -238,7 +238,7 @@
 }
 
 NK_INTERN void
-nk_glfw3_clipbard_copy(nk_handle usr, const char *text, int len)
+nk_glfw3_clipboard_copy(nk_handle usr, const char *text, int len)
 {
     char *str = 0;
     (void)usr;
@@ -261,8 +261,8 @@
         glfwSetMouseButtonCallback(win, nk_glfw3_mouse_button_callback);
     }
     nk_init_default(&glfw.ctx, 0);
-    glfw.ctx.clip.copy = nk_glfw3_clipbard_copy;
-    glfw.ctx.clip.paste = nk_glfw3_clipbard_paste;
+    glfw.ctx.clip.copy = nk_glfw3_clipboard_copy;
+    glfw.ctx.clip.paste = nk_glfw3_clipboard_paste;
     glfw.ctx.clip.userdata = nk_handle_ptr(0);
     nk_buffer_init_default(&glfw.ogl.cmds);
 
diff --git a/deps/vs2008/stdint.h b/deps/vs2008/stdint.h
deleted file mode 100644
index d02608a..0000000
--- a/deps/vs2008/stdint.h
+++ /dev/null
@@ -1,247 +0,0 @@
-// ISO C9x  compliant stdint.h for Microsoft Visual Studio
-// Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124 
-// 
-//  Copyright (c) 2006-2008 Alexander Chemeris
-// 
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-// 
-//   1. Redistributions of source code must retain the above copyright notice,
-//      this list of conditions and the following disclaimer.
-// 
-//   2. Redistributions in binary form must reproduce the above copyright
-//      notice, this list of conditions and the following disclaimer in the
-//      documentation and/or other materials provided with the distribution.
-// 
-//   3. The name of the author may be used to endorse or promote products
-//      derived from this software without specific prior written permission.
-// 
-// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
-// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
-// EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
-// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-// 
-///////////////////////////////////////////////////////////////////////////////
-
-#ifndef _MSC_VER // [
-#error "Use this header only with Microsoft Visual C++ compilers!"
-#endif // _MSC_VER ]
-
-#ifndef _MSC_STDINT_H_ // [
-#define _MSC_STDINT_H_
-
-#if _MSC_VER > 1000
-#pragma once
-#endif
-
-#include <limits.h>
-
-// For Visual Studio 6 in C++ mode and for many Visual Studio versions when
-// compiling for ARM we should wrap <wchar.h> include with 'extern "C++" {}'
-// or compiler give many errors like this:
-//   error C2733: second C linkage of overloaded function 'wmemchr' not allowed
-#ifdef __cplusplus
-extern "C" {
-#endif
-#  include <wchar.h>
-#ifdef __cplusplus
-}
-#endif
-
-// Define _W64 macros to mark types changing their size, like intptr_t.
-#ifndef _W64
-#  if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && _MSC_VER >= 1300
-#     define _W64 __w64
-#  else
-#     define _W64
-#  endif
-#endif
-
-
-// 7.18.1 Integer types
-
-// 7.18.1.1 Exact-width integer types
-
-// Visual Studio 6 and Embedded Visual C++ 4 doesn't
-// realize that, e.g. char has the same size as __int8
-// so we give up on __intX for them.
-#if (_MSC_VER < 1300)
-   typedef signed char       int8_t;
-   typedef signed short      int16_t;
-   typedef signed int        int32_t;
-   typedef unsigned char     uint8_t;
-   typedef unsigned short    uint16_t;
-   typedef unsigned int      uint32_t;
-#else
-   typedef signed __int8     int8_t;
-   typedef signed __int16    int16_t;
-   typedef signed __int32    int32_t;
-   typedef unsigned __int8   uint8_t;
-   typedef unsigned __int16  uint16_t;
-   typedef unsigned __int32  uint32_t;
-#endif
-typedef signed __int64       int64_t;
-typedef unsigned __int64     uint64_t;
-
-
-// 7.18.1.2 Minimum-width integer types
-typedef int8_t    int_least8_t;
-typedef int16_t   int_least16_t;
-typedef int32_t   int_least32_t;
-typedef int64_t   int_least64_t;
-typedef uint8_t   uint_least8_t;
-typedef uint16_t  uint_least16_t;
-typedef uint32_t  uint_least32_t;
-typedef uint64_t  uint_least64_t;
-
-// 7.18.1.3 Fastest minimum-width integer types
-typedef int8_t    int_fast8_t;
-typedef int16_t   int_fast16_t;
-typedef int32_t   int_fast32_t;
-typedef int64_t   int_fast64_t;
-typedef uint8_t   uint_fast8_t;
-typedef uint16_t  uint_fast16_t;
-typedef uint32_t  uint_fast32_t;
-typedef uint64_t  uint_fast64_t;
-
-// 7.18.1.4 Integer types capable of holding object pointers
-#ifdef _WIN64 // [
-   typedef signed __int64    intptr_t;
-   typedef unsigned __int64  uintptr_t;
-#else // _WIN64 ][
-   typedef _W64 signed int   intptr_t;
-   typedef _W64 unsigned int uintptr_t;
-#endif // _WIN64 ]
-
-// 7.18.1.5 Greatest-width integer types
-typedef int64_t   intmax_t;
-typedef uint64_t  uintmax_t;
-
-
-// 7.18.2 Limits of specified-width integer types
-
-#if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) // [   See footnote 220 at page 257 and footnote 221 at page 259
-
-// 7.18.2.1 Limits of exact-width integer types
-#define INT8_MIN     ((int8_t)_I8_MIN)
-#define INT8_MAX     _I8_MAX
-#define INT16_MIN    ((int16_t)_I16_MIN)
-#define INT16_MAX    _I16_MAX
-#define INT32_MIN    ((int32_t)_I32_MIN)
-#define INT32_MAX    _I32_MAX
-#define INT64_MIN    ((int64_t)_I64_MIN)
-#define INT64_MAX    _I64_MAX
-#define UINT8_MAX    _UI8_MAX
-#define UINT16_MAX   _UI16_MAX
-#define UINT32_MAX   _UI32_MAX
-#define UINT64_MAX   _UI64_MAX
-
-// 7.18.2.2 Limits of minimum-width integer types
-#define INT_LEAST8_MIN    INT8_MIN
-#define INT_LEAST8_MAX    INT8_MAX
-#define INT_LEAST16_MIN   INT16_MIN
-#define INT_LEAST16_MAX   INT16_MAX
-#define INT_LEAST32_MIN   INT32_MIN
-#define INT_LEAST32_MAX   INT32_MAX
-#define INT_LEAST64_MIN   INT64_MIN
-#define INT_LEAST64_MAX   INT64_MAX
-#define UINT_LEAST8_MAX   UINT8_MAX
-#define UINT_LEAST16_MAX  UINT16_MAX
-#define UINT_LEAST32_MAX  UINT32_MAX
-#define UINT_LEAST64_MAX  UINT64_MAX
-
-// 7.18.2.3 Limits of fastest minimum-width integer types
-#define INT_FAST8_MIN    INT8_MIN
-#define INT_FAST8_MAX    INT8_MAX
-#define INT_FAST16_MIN   INT16_MIN
-#define INT_FAST16_MAX   INT16_MAX
-#define INT_FAST32_MIN   INT32_MIN
-#define INT_FAST32_MAX   INT32_MAX
-#define INT_FAST64_MIN   INT64_MIN
-#define INT_FAST64_MAX   INT64_MAX
-#define UINT_FAST8_MAX   UINT8_MAX
-#define UINT_FAST16_MAX  UINT16_MAX
-#define UINT_FAST32_MAX  UINT32_MAX
-#define UINT_FAST64_MAX  UINT64_MAX
-
-// 7.18.2.4 Limits of integer types capable of holding object pointers
-#ifdef _WIN64 // [
-#  define INTPTR_MIN   INT64_MIN
-#  define INTPTR_MAX   INT64_MAX
-#  define UINTPTR_MAX  UINT64_MAX
-#else // _WIN64 ][
-#  define INTPTR_MIN   INT32_MIN
-#  define INTPTR_MAX   INT32_MAX
-#  define UINTPTR_MAX  UINT32_MAX
-#endif // _WIN64 ]
-
-// 7.18.2.5 Limits of greatest-width integer types
-#define INTMAX_MIN   INT64_MIN
-#define INTMAX_MAX   INT64_MAX
-#define UINTMAX_MAX  UINT64_MAX
-
-// 7.18.3 Limits of other integer types
-
-#ifdef _WIN64 // [
-#  define PTRDIFF_MIN  _I64_MIN
-#  define PTRDIFF_MAX  _I64_MAX
-#else  // _WIN64 ][
-#  define PTRDIFF_MIN  _I32_MIN
-#  define PTRDIFF_MAX  _I32_MAX
-#endif  // _WIN64 ]
-
-#define SIG_ATOMIC_MIN  INT_MIN
-#define SIG_ATOMIC_MAX  INT_MAX
-
-#ifndef SIZE_MAX // [
-#  ifdef _WIN64 // [
-#     define SIZE_MAX  _UI64_MAX
-#  else // _WIN64 ][
-#     define SIZE_MAX  _UI32_MAX
-#  endif // _WIN64 ]
-#endif // SIZE_MAX ]
-
-// WCHAR_MIN and WCHAR_MAX are also defined in <wchar.h>
-#ifndef WCHAR_MIN // [
-#  define WCHAR_MIN  0
-#endif  // WCHAR_MIN ]
-#ifndef WCHAR_MAX // [
-#  define WCHAR_MAX  _UI16_MAX
-#endif  // WCHAR_MAX ]
-
-#define WINT_MIN  0
-#define WINT_MAX  _UI16_MAX
-
-#endif // __STDC_LIMIT_MACROS ]
-
-
-// 7.18.4 Limits of other integer types
-
-#if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) // [   See footnote 224 at page 260
-
-// 7.18.4.1 Macros for minimum-width integer constants
-
-#define INT8_C(val)  val##i8
-#define INT16_C(val) val##i16
-#define INT32_C(val) val##i32
-#define INT64_C(val) val##i64
-
-#define UINT8_C(val)  val##ui8
-#define UINT16_C(val) val##ui16
-#define UINT32_C(val) val##ui32
-#define UINT64_C(val) val##ui64
-
-// 7.18.4.2 Macros for greatest-width integer constants
-#define INTMAX_C   INT64_C
-#define UINTMAX_C  UINT64_C
-
-#endif // __STDC_CONSTANT_MACROS ]
-
-
-#endif // _MSC_STDINT_H_ ]
diff --git a/deps/wayland/fractional-scale-v1.xml b/deps/wayland/fractional-scale-v1.xml
new file mode 100644
index 0000000..350bfc0
--- /dev/null
+++ b/deps/wayland/fractional-scale-v1.xml
@@ -0,0 +1,102 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<protocol name="fractional_scale_v1">
+  <copyright>
+    Copyright © 2022 Kenny Levinsen
+
+    Permission is hereby granted, free of charge, to any person obtaining a
+    copy of this software and associated documentation files (the "Software"),
+    to deal in the Software without restriction, including without limitation
+    the rights to use, copy, modify, merge, publish, distribute, sublicense,
+    and/or sell copies of the Software, and to permit persons to whom the
+    Software is furnished to do so, subject to the following conditions:
+
+    The above copyright notice and this permission notice (including the next
+    paragraph) shall be included in all copies or substantial portions of the
+    Software.
+
+    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+    IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+    THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+    LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+    FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+    DEALINGS IN THE SOFTWARE.
+  </copyright>
+
+  <description summary="Protocol for requesting fractional surface scales">
+    This protocol allows a compositor to suggest for surfaces to render at
+    fractional scales.
+
+    A client can submit scaled content by utilizing wp_viewport. This is done by
+    creating a wp_viewport object for the surface and setting the destination
+    rectangle to the surface size before the scale factor is applied.
+
+    The buffer size is calculated by multiplying the surface size by the
+    intended scale.
+
+    The wl_surface buffer scale should remain set to 1.
+
+    If a surface has a surface-local size of 100 px by 50 px and wishes to
+    submit buffers with a scale of 1.5, then a buffer of 150px by 75 px should
+    be used and the wp_viewport destination rectangle should be 100 px by 50 px.
+
+    For toplevel surfaces, the size is rounded halfway away from zero. The
+    rounding algorithm for subsurface position and size is not defined.
+  </description>
+
+  <interface name="wp_fractional_scale_manager_v1" version="1">
+    <description summary="fractional surface scale information">
+      A global interface for requesting surfaces to use fractional scales.
+    </description>
+
+    <request name="destroy" type="destructor">
+      <description summary="unbind the fractional surface scale interface">
+        Informs the server that the client will not be using this protocol
+        object anymore. This does not affect any other objects,
+        wp_fractional_scale_v1 objects included.
+      </description>
+    </request>
+
+    <enum name="error">
+      <entry name="fractional_scale_exists" value="0"
+        summary="the surface already has a fractional_scale object associated"/>
+    </enum>
+
+    <request name="get_fractional_scale">
+      <description summary="extend surface interface for scale information">
+        Create an add-on object for the the wl_surface to let the compositor
+        request fractional scales. If the given wl_surface already has a
+        wp_fractional_scale_v1 object associated, the fractional_scale_exists
+        protocol error is raised.
+      </description>
+      <arg name="id" type="new_id" interface="wp_fractional_scale_v1"
+           summary="the new surface scale info interface id"/>
+      <arg name="surface" type="object" interface="wl_surface"
+           summary="the surface"/>
+    </request>
+  </interface>
+
+  <interface name="wp_fractional_scale_v1" version="1">
+    <description summary="fractional scale interface to a wl_surface">
+      An additional interface to a wl_surface object which allows the compositor
+      to inform the client of the preferred scale.
+    </description>
+
+    <request name="destroy" type="destructor">
+      <description summary="remove surface scale information for surface">
+        Destroy the fractional scale object. When this object is destroyed,
+        preferred_scale events will no longer be sent.
+      </description>
+    </request>
+
+    <event name="preferred_scale">
+      <description summary="notify of new preferred scale">
+        Notification of a new preferred scale for this surface that the
+        compositor suggests that the client should use.
+
+        The sent scale is the numerator of a fraction with a denominator of 120.
+      </description>
+      <arg name="scale" type="uint" summary="the new preferred scale"/>
+    </event>
+  </interface>
+</protocol>
diff --git a/deps/wayland/idle-inhibit-unstable-v1.xml b/deps/wayland/idle-inhibit-unstable-v1.xml
new file mode 100644
index 0000000..9c06cdc
--- /dev/null
+++ b/deps/wayland/idle-inhibit-unstable-v1.xml
@@ -0,0 +1,83 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<protocol name="idle_inhibit_unstable_v1">
+
+  <copyright>
+    Copyright © 2015 Samsung Electronics Co., Ltd
+
+    Permission is hereby granted, free of charge, to any person obtaining a
+    copy of this software and associated documentation files (the "Software"),
+    to deal in the Software without restriction, including without limitation
+    the rights to use, copy, modify, merge, publish, distribute, sublicense,
+    and/or sell copies of the Software, and to permit persons to whom the
+    Software is furnished to do so, subject to the following conditions:
+
+    The above copyright notice and this permission notice (including the next
+    paragraph) shall be included in all copies or substantial portions of the
+    Software.
+
+    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+    IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+    THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+    LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+    FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+    DEALINGS IN THE SOFTWARE.
+  </copyright>
+
+  <interface name="zwp_idle_inhibit_manager_v1" version="1">
+    <description summary="control behavior when display idles">
+      This interface permits inhibiting the idle behavior such as screen
+      blanking, locking, and screensaving.  The client binds the idle manager
+      globally, then creates idle-inhibitor objects for each surface.
+
+      Warning! The protocol described in this file is experimental and
+      backward incompatible changes may be made. Backward compatible changes
+      may be added together with the corresponding interface version bump.
+      Backward incompatible changes are done by bumping the version number in
+      the protocol and interface names and resetting the interface version.
+      Once the protocol is to be declared stable, the 'z' prefix and the
+      version number in the protocol and interface names are removed and the
+      interface version number is reset.
+    </description>
+
+    <request name="destroy" type="destructor">
+      <description summary="destroy the idle inhibitor object">
+	Destroy the inhibit manager.
+      </description>
+    </request>
+
+    <request name="create_inhibitor">
+      <description summary="create a new inhibitor object">
+	Create a new inhibitor object associated with the given surface.
+      </description>
+      <arg name="id" type="new_id" interface="zwp_idle_inhibitor_v1"/>
+      <arg name="surface" type="object" interface="wl_surface"
+	   summary="the surface that inhibits the idle behavior"/>
+    </request>
+
+  </interface>
+
+  <interface name="zwp_idle_inhibitor_v1" version="1">
+    <description summary="context object for inhibiting idle behavior">
+      An idle inhibitor prevents the output that the associated surface is
+      visible on from being set to a state where it is not visually usable due
+      to lack of user interaction (e.g. blanked, dimmed, locked, set to power
+      save, etc.)  Any screensaver processes are also blocked from displaying.
+
+      If the surface is destroyed, unmapped, becomes occluded, loses
+      visibility, or otherwise becomes not visually relevant for the user, the
+      idle inhibitor will not be honored by the compositor; if the surface
+      subsequently regains visibility the inhibitor takes effect once again.
+      Likewise, the inhibitor isn't honored if the system was already idled at
+      the time the inhibitor was established, although if the system later
+      de-idles and re-idles the inhibitor will take effect.
+    </description>
+
+    <request name="destroy" type="destructor">
+      <description summary="destroy the idle inhibitor object">
+	Remove the inhibitor effect from the associated wl_surface.
+      </description>
+    </request>
+
+  </interface>
+</protocol>
diff --git a/deps/wayland/pointer-constraints-unstable-v1.xml b/deps/wayland/pointer-constraints-unstable-v1.xml
new file mode 100644
index 0000000..efd64b6
--- /dev/null
+++ b/deps/wayland/pointer-constraints-unstable-v1.xml
@@ -0,0 +1,339 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<protocol name="pointer_constraints_unstable_v1">
+
+  <copyright>
+    Copyright © 2014      Jonas Ådahl
+    Copyright © 2015      Red Hat Inc.
+
+    Permission is hereby granted, free of charge, to any person obtaining a
+    copy of this software and associated documentation files (the "Software"),
+    to deal in the Software without restriction, including without limitation
+    the rights to use, copy, modify, merge, publish, distribute, sublicense,
+    and/or sell copies of the Software, and to permit persons to whom the
+    Software is furnished to do so, subject to the following conditions:
+
+    The above copyright notice and this permission notice (including the next
+    paragraph) shall be included in all copies or substantial portions of the
+    Software.
+
+    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+    IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+    THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+    LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+    FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+    DEALINGS IN THE SOFTWARE.
+  </copyright>
+
+  <description summary="protocol for constraining pointer motions">
+    This protocol specifies a set of interfaces used for adding constraints to
+    the motion of a pointer. Possible constraints include confining pointer
+    motions to a given region, or locking it to its current position.
+
+    In order to constrain the pointer, a client must first bind the global
+    interface "wp_pointer_constraints" which, if a compositor supports pointer
+    constraints, is exposed by the registry. Using the bound global object, the
+    client uses the request that corresponds to the type of constraint it wants
+    to make. See wp_pointer_constraints for more details.
+
+    Warning! The protocol described in this file is experimental and backward
+    incompatible changes may be made. Backward compatible changes may be added
+    together with the corresponding interface version bump. Backward
+    incompatible changes are done by bumping the version number in the protocol
+    and interface names and resetting the interface version. Once the protocol
+    is to be declared stable, the 'z' prefix and the version number in the
+    protocol and interface names are removed and the interface version number is
+    reset.
+  </description>
+
+  <interface name="zwp_pointer_constraints_v1" version="1">
+    <description summary="constrain the movement of a pointer">
+      The global interface exposing pointer constraining functionality. It
+      exposes two requests: lock_pointer for locking the pointer to its
+      position, and confine_pointer for locking the pointer to a region.
+
+      The lock_pointer and confine_pointer requests create the objects
+      wp_locked_pointer and wp_confined_pointer respectively, and the client can
+      use these objects to interact with the lock.
+
+      For any surface, only one lock or confinement may be active across all
+      wl_pointer objects of the same seat. If a lock or confinement is requested
+      when another lock or confinement is active or requested on the same surface
+      and with any of the wl_pointer objects of the same seat, an
+      'already_constrained' error will be raised.
+    </description>
+
+    <enum name="error">
+      <description summary="wp_pointer_constraints error values">
+	These errors can be emitted in response to wp_pointer_constraints
+	requests.
+      </description>
+      <entry name="already_constrained" value="1"
+	     summary="pointer constraint already requested on that surface"/>
+    </enum>
+
+    <enum name="lifetime">
+      <description summary="constraint lifetime">
+	These values represent different lifetime semantics. They are passed
+	as arguments to the factory requests to specify how the constraint
+	lifetimes should be managed.
+      </description>
+      <entry name="oneshot" value="1">
+	<description summary="the pointer constraint is defunct once deactivated">
+	  A oneshot pointer constraint will never reactivate once it has been
+	  deactivated. See the corresponding deactivation event
+	  (wp_locked_pointer.unlocked and wp_confined_pointer.unconfined) for
+	  details.
+	</description>
+      </entry>
+      <entry name="persistent" value="2">
+	<description summary="the pointer constraint may reactivate">
+	  A persistent pointer constraint may again reactivate once it has
+	  been deactivated. See the corresponding deactivation event
+	  (wp_locked_pointer.unlocked and wp_confined_pointer.unconfined) for
+	  details.
+	</description>
+      </entry>
+    </enum>
+
+    <request name="destroy" type="destructor">
+      <description summary="destroy the pointer constraints manager object">
+	Used by the client to notify the server that it will no longer use this
+	pointer constraints object.
+      </description>
+    </request>
+
+    <request name="lock_pointer">
+      <description summary="lock pointer to a position">
+	The lock_pointer request lets the client request to disable movements of
+	the virtual pointer (i.e. the cursor), effectively locking the pointer
+	to a position. This request may not take effect immediately; in the
+	future, when the compositor deems implementation-specific constraints
+	are satisfied, the pointer lock will be activated and the compositor
+	sends a locked event.
+
+	The protocol provides no guarantee that the constraints are ever
+	satisfied, and does not require the compositor to send an error if the
+	constraints cannot ever be satisfied. It is thus possible to request a
+	lock that will never activate.
+
+	There may not be another pointer constraint of any kind requested or
+	active on the surface for any of the wl_pointer objects of the seat of
+	the passed pointer when requesting a lock. If there is, an error will be
+	raised. See general pointer lock documentation for more details.
+
+	The intersection of the region passed with this request and the input
+	region of the surface is used to determine where the pointer must be
+	in order for the lock to activate. It is up to the compositor whether to
+	warp the pointer or require some kind of user interaction for the lock
+	to activate. If the region is null the surface input region is used.
+
+	A surface may receive pointer focus without the lock being activated.
+
+	The request creates a new object wp_locked_pointer which is used to
+	interact with the lock as well as receive updates about its state. See
+	the the description of wp_locked_pointer for further information.
+
+	Note that while a pointer is locked, the wl_pointer objects of the
+	corresponding seat will not emit any wl_pointer.motion events, but
+	relative motion events will still be emitted via wp_relative_pointer
+	objects of the same seat. wl_pointer.axis and wl_pointer.button events
+	are unaffected.
+      </description>
+      <arg name="id" type="new_id" interface="zwp_locked_pointer_v1"/>
+      <arg name="surface" type="object" interface="wl_surface"
+	   summary="surface to lock pointer to"/>
+      <arg name="pointer" type="object" interface="wl_pointer"
+	   summary="the pointer that should be locked"/>
+      <arg name="region" type="object" interface="wl_region" allow-null="true"
+	   summary="region of surface"/>
+      <arg name="lifetime" type="uint" enum="lifetime" summary="lock lifetime"/>
+    </request>
+
+    <request name="confine_pointer">
+      <description summary="confine pointer to a region">
+	The confine_pointer request lets the client request to confine the
+	pointer cursor to a given region. This request may not take effect
+	immediately; in the future, when the compositor deems implementation-
+	specific constraints are satisfied, the pointer confinement will be
+	activated and the compositor sends a confined event.
+
+	The intersection of the region passed with this request and the input
+	region of the surface is used to determine where the pointer must be
+	in order for the confinement to activate. It is up to the compositor
+	whether to warp the pointer or require some kind of user interaction for
+	the confinement to activate. If the region is null the surface input
+	region is used.
+
+	The request will create a new object wp_confined_pointer which is used
+	to interact with the confinement as well as receive updates about its
+	state. See the the description of wp_confined_pointer for further
+	information.
+      </description>
+      <arg name="id" type="new_id" interface="zwp_confined_pointer_v1"/>
+      <arg name="surface" type="object" interface="wl_surface"
+	   summary="surface to lock pointer to"/>
+      <arg name="pointer" type="object" interface="wl_pointer"
+	   summary="the pointer that should be confined"/>
+      <arg name="region" type="object" interface="wl_region" allow-null="true"
+	   summary="region of surface"/>
+      <arg name="lifetime" type="uint" enum="lifetime" summary="confinement lifetime"/>
+    </request>
+  </interface>
+
+  <interface name="zwp_locked_pointer_v1" version="1">
+    <description summary="receive relative pointer motion events">
+      The wp_locked_pointer interface represents a locked pointer state.
+
+      While the lock of this object is active, the wl_pointer objects of the
+      associated seat will not emit any wl_pointer.motion events.
+
+      This object will send the event 'locked' when the lock is activated.
+      Whenever the lock is activated, it is guaranteed that the locked surface
+      will already have received pointer focus and that the pointer will be
+      within the region passed to the request creating this object.
+
+      To unlock the pointer, send the destroy request. This will also destroy
+      the wp_locked_pointer object.
+
+      If the compositor decides to unlock the pointer the unlocked event is
+      sent. See wp_locked_pointer.unlock for details.
+
+      When unlocking, the compositor may warp the cursor position to the set
+      cursor position hint. If it does, it will not result in any relative
+      motion events emitted via wp_relative_pointer.
+
+      If the surface the lock was requested on is destroyed and the lock is not
+      yet activated, the wp_locked_pointer object is now defunct and must be
+      destroyed.
+    </description>
+
+    <request name="destroy" type="destructor">
+      <description summary="destroy the locked pointer object">
+	Destroy the locked pointer object. If applicable, the compositor will
+	unlock the pointer.
+      </description>
+    </request>
+
+    <request name="set_cursor_position_hint">
+      <description summary="set the pointer cursor position hint">
+	Set the cursor position hint relative to the top left corner of the
+	surface.
+
+	If the client is drawing its own cursor, it should update the position
+	hint to the position of its own cursor. A compositor may use this
+	information to warp the pointer upon unlock in order to avoid pointer
+	jumps.
+
+	The cursor position hint is double buffered. The new hint will only take
+	effect when the associated surface gets it pending state applied. See
+	wl_surface.commit for details.
+      </description>
+      <arg name="surface_x" type="fixed"
+	   summary="surface-local x coordinate"/>
+      <arg name="surface_y" type="fixed"
+	   summary="surface-local y coordinate"/>
+    </request>
+
+    <request name="set_region">
+      <description summary="set a new lock region">
+	Set a new region used to lock the pointer.
+
+	The new lock region is double-buffered. The new lock region will
+	only take effect when the associated surface gets its pending state
+	applied. See wl_surface.commit for details.
+
+	For details about the lock region, see wp_locked_pointer.
+      </description>
+      <arg name="region" type="object" interface="wl_region" allow-null="true"
+	   summary="region of surface"/>
+    </request>
+
+    <event name="locked">
+      <description summary="lock activation event">
+	Notification that the pointer lock of the seat's pointer is activated.
+      </description>
+    </event>
+
+    <event name="unlocked">
+      <description summary="lock deactivation event">
+	Notification that the pointer lock of the seat's pointer is no longer
+	active. If this is a oneshot pointer lock (see
+	wp_pointer_constraints.lifetime) this object is now defunct and should
+	be destroyed. If this is a persistent pointer lock (see
+	wp_pointer_constraints.lifetime) this pointer lock may again
+	reactivate in the future.
+      </description>
+    </event>
+  </interface>
+
+  <interface name="zwp_confined_pointer_v1" version="1">
+    <description summary="confined pointer object">
+      The wp_confined_pointer interface represents a confined pointer state.
+
+      This object will send the event 'confined' when the confinement is
+      activated. Whenever the confinement is activated, it is guaranteed that
+      the surface the pointer is confined to will already have received pointer
+      focus and that the pointer will be within the region passed to the request
+      creating this object. It is up to the compositor to decide whether this
+      requires some user interaction and if the pointer will warp to within the
+      passed region if outside.
+
+      To unconfine the pointer, send the destroy request. This will also destroy
+      the wp_confined_pointer object.
+
+      If the compositor decides to unconfine the pointer the unconfined event is
+      sent. The wp_confined_pointer object is at this point defunct and should
+      be destroyed.
+    </description>
+
+    <request name="destroy" type="destructor">
+      <description summary="destroy the confined pointer object">
+	Destroy the confined pointer object. If applicable, the compositor will
+	unconfine the pointer.
+      </description>
+    </request>
+
+    <request name="set_region">
+      <description summary="set a new confine region">
+	Set a new region used to confine the pointer.
+
+	The new confine region is double-buffered. The new confine region will
+	only take effect when the associated surface gets its pending state
+	applied. See wl_surface.commit for details.
+
+	If the confinement is active when the new confinement region is applied
+	and the pointer ends up outside of newly applied region, the pointer may
+	warped to a position within the new confinement region. If warped, a
+	wl_pointer.motion event will be emitted, but no
+	wp_relative_pointer.relative_motion event.
+
+	The compositor may also, instead of using the new region, unconfine the
+	pointer.
+
+	For details about the confine region, see wp_confined_pointer.
+      </description>
+      <arg name="region" type="object" interface="wl_region" allow-null="true"
+	   summary="region of surface"/>
+    </request>
+
+    <event name="confined">
+      <description summary="pointer confined">
+	Notification that the pointer confinement of the seat's pointer is
+	activated.
+      </description>
+    </event>
+
+    <event name="unconfined">
+      <description summary="pointer unconfined">
+	Notification that the pointer confinement of the seat's pointer is no
+	longer active. If this is a oneshot pointer confinement (see
+	wp_pointer_constraints.lifetime) this object is now defunct and should
+	be destroyed. If this is a persistent pointer confinement (see
+	wp_pointer_constraints.lifetime) this pointer confinement may again
+	reactivate in the future.
+      </description>
+    </event>
+  </interface>
+
+</protocol>
diff --git a/deps/wayland/relative-pointer-unstable-v1.xml b/deps/wayland/relative-pointer-unstable-v1.xml
new file mode 100644
index 0000000..ca6f81d
--- /dev/null
+++ b/deps/wayland/relative-pointer-unstable-v1.xml
@@ -0,0 +1,136 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<protocol name="relative_pointer_unstable_v1">
+
+  <copyright>
+    Copyright © 2014      Jonas Ådahl
+    Copyright © 2015      Red Hat Inc.
+
+    Permission is hereby granted, free of charge, to any person obtaining a
+    copy of this software and associated documentation files (the "Software"),
+    to deal in the Software without restriction, including without limitation
+    the rights to use, copy, modify, merge, publish, distribute, sublicense,
+    and/or sell copies of the Software, and to permit persons to whom the
+    Software is furnished to do so, subject to the following conditions:
+
+    The above copyright notice and this permission notice (including the next
+    paragraph) shall be included in all copies or substantial portions of the
+    Software.
+
+    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+    IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+    THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+    LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+    FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+    DEALINGS IN THE SOFTWARE.
+  </copyright>
+
+  <description summary="protocol for relative pointer motion events">
+    This protocol specifies a set of interfaces used for making clients able to
+    receive relative pointer events not obstructed by barriers (such as the
+    monitor edge or other pointer barriers).
+
+    To start receiving relative pointer events, a client must first bind the
+    global interface "wp_relative_pointer_manager" which, if a compositor
+    supports relative pointer motion events, is exposed by the registry. After
+    having created the relative pointer manager proxy object, the client uses
+    it to create the actual relative pointer object using the
+    "get_relative_pointer" request given a wl_pointer. The relative pointer
+    motion events will then, when applicable, be transmitted via the proxy of
+    the newly created relative pointer object. See the documentation of the
+    relative pointer interface for more details.
+
+    Warning! The protocol described in this file is experimental and backward
+    incompatible changes may be made. Backward compatible changes may be added
+    together with the corresponding interface version bump. Backward
+    incompatible changes are done by bumping the version number in the protocol
+    and interface names and resetting the interface version. Once the protocol
+    is to be declared stable, the 'z' prefix and the version number in the
+    protocol and interface names are removed and the interface version number is
+    reset.
+  </description>
+
+  <interface name="zwp_relative_pointer_manager_v1" version="1">
+    <description summary="get relative pointer objects">
+      A global interface used for getting the relative pointer object for a
+      given pointer.
+    </description>
+
+    <request name="destroy" type="destructor">
+      <description summary="destroy the relative pointer manager object">
+	Used by the client to notify the server that it will no longer use this
+	relative pointer manager object.
+      </description>
+    </request>
+
+    <request name="get_relative_pointer">
+      <description summary="get a relative pointer object">
+	Create a relative pointer interface given a wl_pointer object. See the
+	wp_relative_pointer interface for more details.
+      </description>
+      <arg name="id" type="new_id" interface="zwp_relative_pointer_v1"/>
+      <arg name="pointer" type="object" interface="wl_pointer"/>
+    </request>
+  </interface>
+
+  <interface name="zwp_relative_pointer_v1" version="1">
+    <description summary="relative pointer object">
+      A wp_relative_pointer object is an extension to the wl_pointer interface
+      used for emitting relative pointer events. It shares the same focus as
+      wl_pointer objects of the same seat and will only emit events when it has
+      focus.
+    </description>
+
+    <request name="destroy" type="destructor">
+      <description summary="release the relative pointer object"/>
+    </request>
+
+    <event name="relative_motion">
+      <description summary="relative pointer motion">
+	Relative x/y pointer motion from the pointer of the seat associated with
+	this object.
+
+	A relative motion is in the same dimension as regular wl_pointer motion
+	events, except they do not represent an absolute position. For example,
+	moving a pointer from (x, y) to (x', y') would have the equivalent
+	relative motion (x' - x, y' - y). If a pointer motion caused the
+	absolute pointer position to be clipped by for example the edge of the
+	monitor, the relative motion is unaffected by the clipping and will
+	represent the unclipped motion.
+
+	This event also contains non-accelerated motion deltas. The
+	non-accelerated delta is, when applicable, the regular pointer motion
+	delta as it was before having applied motion acceleration and other
+	transformations such as normalization.
+
+	Note that the non-accelerated delta does not represent 'raw' events as
+	they were read from some device. Pointer motion acceleration is device-
+	and configuration-specific and non-accelerated deltas and accelerated
+	deltas may have the same value on some devices.
+
+	Relative motions are not coupled to wl_pointer.motion events, and can be
+	sent in combination with such events, but also independently. There may
+	also be scenarios where wl_pointer.motion is sent, but there is no
+	relative motion. The order of an absolute and relative motion event
+	originating from the same physical motion is not guaranteed.
+
+	If the client needs button events or focus state, it can receive them
+	from a wl_pointer object of the same seat that the wp_relative_pointer
+	object is associated with.
+      </description>
+      <arg name="utime_hi" type="uint"
+	   summary="high 32 bits of a 64 bit timestamp with microsecond granularity"/>
+      <arg name="utime_lo" type="uint"
+	   summary="low 32 bits of a 64 bit timestamp with microsecond granularity"/>
+      <arg name="dx" type="fixed"
+	   summary="the x component of the motion vector"/>
+      <arg name="dy" type="fixed"
+	   summary="the y component of the motion vector"/>
+      <arg name="dx_unaccel" type="fixed"
+	   summary="the x component of the unaccelerated motion vector"/>
+      <arg name="dy_unaccel" type="fixed"
+	   summary="the y component of the unaccelerated motion vector"/>
+    </event>
+  </interface>
+
+</protocol>
diff --git a/deps/wayland/viewporter.xml b/deps/wayland/viewporter.xml
new file mode 100644
index 0000000..d1048d1
--- /dev/null
+++ b/deps/wayland/viewporter.xml
@@ -0,0 +1,180 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<protocol name="viewporter">
+
+  <copyright>
+    Copyright © 2013-2016 Collabora, Ltd.
+
+    Permission is hereby granted, free of charge, to any person obtaining a
+    copy of this software and associated documentation files (the "Software"),
+    to deal in the Software without restriction, including without limitation
+    the rights to use, copy, modify, merge, publish, distribute, sublicense,
+    and/or sell copies of the Software, and to permit persons to whom the
+    Software is furnished to do so, subject to the following conditions:
+
+    The above copyright notice and this permission notice (including the next
+    paragraph) shall be included in all copies or substantial portions of the
+    Software.
+
+    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+    IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+    THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+    LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+    FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+    DEALINGS IN THE SOFTWARE.
+  </copyright>
+
+  <interface name="wp_viewporter" version="1">
+    <description summary="surface cropping and scaling">
+      The global interface exposing surface cropping and scaling
+      capabilities is used to instantiate an interface extension for a
+      wl_surface object. This extended interface will then allow
+      cropping and scaling the surface contents, effectively
+      disconnecting the direct relationship between the buffer and the
+      surface size.
+    </description>
+
+    <request name="destroy" type="destructor">
+      <description summary="unbind from the cropping and scaling interface">
+	Informs the server that the client will not be using this
+	protocol object anymore. This does not affect any other objects,
+	wp_viewport objects included.
+      </description>
+    </request>
+
+    <enum name="error">
+      <entry name="viewport_exists" value="0"
+             summary="the surface already has a viewport object associated"/>
+    </enum>
+
+    <request name="get_viewport">
+      <description summary="extend surface interface for crop and scale">
+	Instantiate an interface extension for the given wl_surface to
+	crop and scale its content. If the given wl_surface already has
+	a wp_viewport object associated, the viewport_exists
+	protocol error is raised.
+      </description>
+      <arg name="id" type="new_id" interface="wp_viewport"
+           summary="the new viewport interface id"/>
+      <arg name="surface" type="object" interface="wl_surface"
+           summary="the surface"/>
+    </request>
+  </interface>
+
+  <interface name="wp_viewport" version="1">
+    <description summary="crop and scale interface to a wl_surface">
+      An additional interface to a wl_surface object, which allows the
+      client to specify the cropping and scaling of the surface
+      contents.
+
+      This interface works with two concepts: the source rectangle (src_x,
+      src_y, src_width, src_height), and the destination size (dst_width,
+      dst_height). The contents of the source rectangle are scaled to the
+      destination size, and content outside the source rectangle is ignored.
+      This state is double-buffered, and is applied on the next
+      wl_surface.commit.
+
+      The two parts of crop and scale state are independent: the source
+      rectangle, and the destination size. Initially both are unset, that
+      is, no scaling is applied. The whole of the current wl_buffer is
+      used as the source, and the surface size is as defined in
+      wl_surface.attach.
+
+      If the destination size is set, it causes the surface size to become
+      dst_width, dst_height. The source (rectangle) is scaled to exactly
+      this size. This overrides whatever the attached wl_buffer size is,
+      unless the wl_buffer is NULL. If the wl_buffer is NULL, the surface
+      has no content and therefore no size. Otherwise, the size is always
+      at least 1x1 in surface local coordinates.
+
+      If the source rectangle is set, it defines what area of the wl_buffer is
+      taken as the source. If the source rectangle is set and the destination
+      size is not set, then src_width and src_height must be integers, and the
+      surface size becomes the source rectangle size. This results in cropping
+      without scaling. If src_width or src_height are not integers and
+      destination size is not set, the bad_size protocol error is raised when
+      the surface state is applied.
+
+      The coordinate transformations from buffer pixel coordinates up to
+      the surface-local coordinates happen in the following order:
+        1. buffer_transform (wl_surface.set_buffer_transform)
+        2. buffer_scale (wl_surface.set_buffer_scale)
+        3. crop and scale (wp_viewport.set*)
+      This means, that the source rectangle coordinates of crop and scale
+      are given in the coordinates after the buffer transform and scale,
+      i.e. in the coordinates that would be the surface-local coordinates
+      if the crop and scale was not applied.
+
+      If src_x or src_y are negative, the bad_value protocol error is raised.
+      Otherwise, if the source rectangle is partially or completely outside of
+      the non-NULL wl_buffer, then the out_of_buffer protocol error is raised
+      when the surface state is applied. A NULL wl_buffer does not raise the
+      out_of_buffer error.
+
+      If the wl_surface associated with the wp_viewport is destroyed,
+      all wp_viewport requests except 'destroy' raise the protocol error
+      no_surface.
+
+      If the wp_viewport object is destroyed, the crop and scale
+      state is removed from the wl_surface. The change will be applied
+      on the next wl_surface.commit.
+    </description>
+
+    <request name="destroy" type="destructor">
+      <description summary="remove scaling and cropping from the surface">
+	The associated wl_surface's crop and scale state is removed.
+	The change is applied on the next wl_surface.commit.
+      </description>
+    </request>
+
+    <enum name="error">
+      <entry name="bad_value" value="0"
+	     summary="negative or zero values in width or height"/>
+      <entry name="bad_size" value="1"
+	     summary="destination size is not integer"/>
+      <entry name="out_of_buffer" value="2"
+	     summary="source rectangle extends outside of the content area"/>
+      <entry name="no_surface" value="3"
+	     summary="the wl_surface was destroyed"/>
+    </enum>
+
+    <request name="set_source">
+      <description summary="set the source rectangle for cropping">
+	Set the source rectangle of the associated wl_surface. See
+	wp_viewport for the description, and relation to the wl_buffer
+	size.
+
+	If all of x, y, width and height are -1.0, the source rectangle is
+	unset instead. Any other set of values where width or height are zero
+	or negative, or x or y are negative, raise the bad_value protocol
+	error.
+
+	The crop and scale state is double-buffered state, and will be
+	applied on the next wl_surface.commit.
+      </description>
+      <arg name="x" type="fixed" summary="source rectangle x"/>
+      <arg name="y" type="fixed" summary="source rectangle y"/>
+      <arg name="width" type="fixed" summary="source rectangle width"/>
+      <arg name="height" type="fixed" summary="source rectangle height"/>
+    </request>
+
+    <request name="set_destination">
+      <description summary="set the surface size for scaling">
+	Set the destination size of the associated wl_surface. See
+	wp_viewport for the description, and relation to the wl_buffer
+	size.
+
+	If width is -1 and height is -1, the destination size is unset
+	instead. Any other pair of values for width and height that
+	contains zero or negative values raises the bad_value protocol
+	error.
+
+	The crop and scale state is double-buffered state, and will be
+	applied on the next wl_surface.commit.
+      </description>
+      <arg name="width" type="int" summary="surface width"/>
+      <arg name="height" type="int" summary="surface height"/>
+    </request>
+  </interface>
+
+</protocol>
diff --git a/deps/wayland/wayland.xml b/deps/wayland/wayland.xml
new file mode 100644
index 0000000..10e039d
--- /dev/null
+++ b/deps/wayland/wayland.xml
@@ -0,0 +1,3151 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<protocol name="wayland">
+
+  <copyright>
+    Copyright © 2008-2011 Kristian Høgsberg
+    Copyright © 2010-2011 Intel Corporation
+    Copyright © 2012-2013 Collabora, Ltd.
+
+    Permission is hereby granted, free of charge, to any person
+    obtaining a copy of this software and associated documentation files
+    (the "Software"), to deal in the Software without restriction,
+    including without limitation the rights to use, copy, modify, merge,
+    publish, distribute, sublicense, and/or sell copies of the Software,
+    and to permit persons to whom the Software is furnished to do so,
+    subject to the following conditions:
+
+    The above copyright notice and this permission notice (including the
+    next paragraph) shall be included in all copies or substantial
+    portions of the Software.
+
+    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+    EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+    MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+    NONINFRINGEMENT.  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+    BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+    ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+    CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+    SOFTWARE.
+  </copyright>
+
+  <interface name="wl_display" version="1">
+    <description summary="core global object">
+      The core global object.  This is a special singleton object.  It
+      is used for internal Wayland protocol features.
+    </description>
+
+    <request name="sync">
+      <description summary="asynchronous roundtrip">
+	The sync request asks the server to emit the 'done' event
+	on the returned wl_callback object.  Since requests are
+	handled in-order and events are delivered in-order, this can
+	be used as a barrier to ensure all previous requests and the
+	resulting events have been handled.
+
+	The object returned by this request will be destroyed by the
+	compositor after the callback is fired and as such the client must not
+	attempt to use it after that point.
+
+	The callback_data passed in the callback is the event serial.
+      </description>
+      <arg name="callback" type="new_id" interface="wl_callback"
+	   summary="callback object for the sync request"/>
+    </request>
+
+    <request name="get_registry">
+      <description summary="get global registry object">
+	This request creates a registry object that allows the client
+	to list and bind the global objects available from the
+	compositor.
+
+	It should be noted that the server side resources consumed in
+	response to a get_registry request can only be released when the
+	client disconnects, not when the client side proxy is destroyed.
+	Therefore, clients should invoke get_registry as infrequently as
+	possible to avoid wasting memory.
+      </description>
+      <arg name="registry" type="new_id" interface="wl_registry"
+	   summary="global registry object"/>
+    </request>
+
+    <event name="error">
+      <description summary="fatal error event">
+	The error event is sent out when a fatal (non-recoverable)
+	error has occurred.  The object_id argument is the object
+	where the error occurred, most often in response to a request
+	to that object.  The code identifies the error and is defined
+	by the object interface.  As such, each interface defines its
+	own set of error codes.  The message is a brief description
+	of the error, for (debugging) convenience.
+      </description>
+      <arg name="object_id" type="object" summary="object where the error occurred"/>
+      <arg name="code" type="uint" summary="error code"/>
+      <arg name="message" type="string" summary="error description"/>
+    </event>
+
+    <enum name="error">
+      <description summary="global error values">
+	These errors are global and can be emitted in response to any
+	server request.
+      </description>
+      <entry name="invalid_object" value="0"
+	     summary="server couldn't find object"/>
+      <entry name="invalid_method" value="1"
+	     summary="method doesn't exist on the specified interface or malformed request"/>
+      <entry name="no_memory" value="2"
+	     summary="server is out of memory"/>
+      <entry name="implementation" value="3"
+	     summary="implementation error in compositor"/>
+    </enum>
+
+    <event name="delete_id">
+      <description summary="acknowledge object ID deletion">
+	This event is used internally by the object ID management
+	logic. When a client deletes an object that it had created,
+	the server will send this event to acknowledge that it has
+	seen the delete request. When the client receives this event,
+	it will know that it can safely reuse the object ID.
+      </description>
+      <arg name="id" type="uint" summary="deleted object ID"/>
+    </event>
+  </interface>
+
+  <interface name="wl_registry" version="1">
+    <description summary="global registry object">
+      The singleton global registry object.  The server has a number of
+      global objects that are available to all clients.  These objects
+      typically represent an actual object in the server (for example,
+      an input device) or they are singleton objects that provide
+      extension functionality.
+
+      When a client creates a registry object, the registry object
+      will emit a global event for each global currently in the
+      registry.  Globals come and go as a result of device or
+      monitor hotplugs, reconfiguration or other events, and the
+      registry will send out global and global_remove events to
+      keep the client up to date with the changes.  To mark the end
+      of the initial burst of events, the client can use the
+      wl_display.sync request immediately after calling
+      wl_display.get_registry.
+
+      A client can bind to a global object by using the bind
+      request.  This creates a client-side handle that lets the object
+      emit events to the client and lets the client invoke requests on
+      the object.
+    </description>
+
+    <request name="bind">
+      <description summary="bind an object to the display">
+	Binds a new, client-created object to the server using the
+	specified name as the identifier.
+      </description>
+      <arg name="name" type="uint" summary="unique numeric name of the object"/>
+      <arg name="id" type="new_id" summary="bounded object"/>
+    </request>
+
+    <event name="global">
+      <description summary="announce global object">
+	Notify the client of global objects.
+
+	The event notifies the client that a global object with
+	the given name is now available, and it implements the
+	given version of the given interface.
+      </description>
+      <arg name="name" type="uint" summary="numeric name of the global object"/>
+      <arg name="interface" type="string" summary="interface implemented by the object"/>
+      <arg name="version" type="uint" summary="interface version"/>
+    </event>
+
+    <event name="global_remove">
+      <description summary="announce removal of global object">
+	Notify the client of removed global objects.
+
+	This event notifies the client that the global identified
+	by name is no longer available.  If the client bound to
+	the global using the bind request, the client should now
+	destroy that object.
+
+	The object remains valid and requests to the object will be
+	ignored until the client destroys it, to avoid races between
+	the global going away and a client sending a request to it.
+      </description>
+      <arg name="name" type="uint" summary="numeric name of the global object"/>
+    </event>
+  </interface>
+
+  <interface name="wl_callback" version="1">
+    <description summary="callback object">
+      Clients can handle the 'done' event to get notified when
+      the related request is done.
+
+      Note, because wl_callback objects are created from multiple independent
+      factory interfaces, the wl_callback interface is frozen at version 1.
+    </description>
+
+    <event name="done" type="destructor">
+      <description summary="done event">
+	Notify the client when the related request is done.
+      </description>
+      <arg name="callback_data" type="uint" summary="request-specific data for the callback"/>
+    </event>
+  </interface>
+
+  <interface name="wl_compositor" version="6">
+    <description summary="the compositor singleton">
+      A compositor.  This object is a singleton global.  The
+      compositor is in charge of combining the contents of multiple
+      surfaces into one displayable output.
+    </description>
+
+    <request name="create_surface">
+      <description summary="create new surface">
+	Ask the compositor to create a new surface.
+      </description>
+      <arg name="id" type="new_id" interface="wl_surface" summary="the new surface"/>
+    </request>
+
+    <request name="create_region">
+      <description summary="create new region">
+	Ask the compositor to create a new region.
+      </description>
+      <arg name="id" type="new_id" interface="wl_region" summary="the new region"/>
+    </request>
+  </interface>
+
+  <interface name="wl_shm_pool" version="1">
+    <description summary="a shared memory pool">
+      The wl_shm_pool object encapsulates a piece of memory shared
+      between the compositor and client.  Through the wl_shm_pool
+      object, the client can allocate shared memory wl_buffer objects.
+      All objects created through the same pool share the same
+      underlying mapped memory. Reusing the mapped memory avoids the
+      setup/teardown overhead and is useful when interactively resizing
+      a surface or for many small buffers.
+    </description>
+
+    <request name="create_buffer">
+      <description summary="create a buffer from the pool">
+	Create a wl_buffer object from the pool.
+
+	The buffer is created offset bytes into the pool and has
+	width and height as specified.  The stride argument specifies
+	the number of bytes from the beginning of one row to the beginning
+	of the next.  The format is the pixel format of the buffer and
+	must be one of those advertised through the wl_shm.format event.
+
+	A buffer will keep a reference to the pool it was created from
+	so it is valid to destroy the pool immediately after creating
+	a buffer from it.
+      </description>
+      <arg name="id" type="new_id" interface="wl_buffer" summary="buffer to create"/>
+      <arg name="offset" type="int" summary="buffer byte offset within the pool"/>
+      <arg name="width" type="int" summary="buffer width, in pixels"/>
+      <arg name="height" type="int" summary="buffer height, in pixels"/>
+      <arg name="stride" type="int" summary="number of bytes from the beginning of one row to the beginning of the next row"/>
+      <arg name="format" type="uint" enum="wl_shm.format" summary="buffer pixel format"/>
+    </request>
+
+    <request name="destroy" type="destructor">
+      <description summary="destroy the pool">
+	Destroy the shared memory pool.
+
+	The mmapped memory will be released when all
+	buffers that have been created from this pool
+	are gone.
+      </description>
+    </request>
+
+    <request name="resize">
+      <description summary="change the size of the pool mapping">
+	This request will cause the server to remap the backing memory
+	for the pool from the file descriptor passed when the pool was
+	created, but using the new size.  This request can only be
+	used to make the pool bigger.
+
+        This request only changes the amount of bytes that are mmapped
+        by the server and does not touch the file corresponding to the
+        file descriptor passed at creation time. It is the client's
+        responsibility to ensure that the file is at least as big as
+        the new pool size.
+      </description>
+      <arg name="size" type="int" summary="new size of the pool, in bytes"/>
+    </request>
+  </interface>
+
+  <interface name="wl_shm" version="1">
+    <description summary="shared memory support">
+      A singleton global object that provides support for shared
+      memory.
+
+      Clients can create wl_shm_pool objects using the create_pool
+      request.
+
+      On binding the wl_shm object one or more format events
+      are emitted to inform clients about the valid pixel formats
+      that can be used for buffers.
+    </description>
+
+    <enum name="error">
+      <description summary="wl_shm error values">
+	These errors can be emitted in response to wl_shm requests.
+      </description>
+      <entry name="invalid_format" value="0" summary="buffer format is not known"/>
+      <entry name="invalid_stride" value="1" summary="invalid size or stride during pool or buffer creation"/>
+      <entry name="invalid_fd" value="2" summary="mmapping the file descriptor failed"/>
+    </enum>
+
+    <enum name="format">
+      <description summary="pixel formats">
+	This describes the memory layout of an individual pixel.
+
+	All renderers should support argb8888 and xrgb8888 but any other
+	formats are optional and may not be supported by the particular
+	renderer in use.
+
+	The drm format codes match the macros defined in drm_fourcc.h, except
+	argb8888 and xrgb8888. The formats actually supported by the compositor
+	will be reported by the format event.
+
+	For all wl_shm formats and unless specified in another protocol
+	extension, pre-multiplied alpha is used for pixel values.
+      </description>
+      <!-- Note to protocol writers: don't update this list manually, instead
+	   run the automated script that keeps it in sync with drm_fourcc.h. -->
+      <entry name="argb8888" value="0" summary="32-bit ARGB format, [31:0] A:R:G:B 8:8:8:8 little endian"/>
+      <entry name="xrgb8888" value="1" summary="32-bit RGB format, [31:0] x:R:G:B 8:8:8:8 little endian"/>
+      <entry name="c8" value="0x20203843" summary="8-bit color index format, [7:0] C"/>
+      <entry name="rgb332" value="0x38424752" summary="8-bit RGB format, [7:0] R:G:B 3:3:2"/>
+      <entry name="bgr233" value="0x38524742" summary="8-bit BGR format, [7:0] B:G:R 2:3:3"/>
+      <entry name="xrgb4444" value="0x32315258" summary="16-bit xRGB format, [15:0] x:R:G:B 4:4:4:4 little endian"/>
+      <entry name="xbgr4444" value="0x32314258" summary="16-bit xBGR format, [15:0] x:B:G:R 4:4:4:4 little endian"/>
+      <entry name="rgbx4444" value="0x32315852" summary="16-bit RGBx format, [15:0] R:G:B:x 4:4:4:4 little endian"/>
+      <entry name="bgrx4444" value="0x32315842" summary="16-bit BGRx format, [15:0] B:G:R:x 4:4:4:4 little endian"/>
+      <entry name="argb4444" value="0x32315241" summary="16-bit ARGB format, [15:0] A:R:G:B 4:4:4:4 little endian"/>
+      <entry name="abgr4444" value="0x32314241" summary="16-bit ABGR format, [15:0] A:B:G:R 4:4:4:4 little endian"/>
+      <entry name="rgba4444" value="0x32314152" summary="16-bit RBGA format, [15:0] R:G:B:A 4:4:4:4 little endian"/>
+      <entry name="bgra4444" value="0x32314142" summary="16-bit BGRA format, [15:0] B:G:R:A 4:4:4:4 little endian"/>
+      <entry name="xrgb1555" value="0x35315258" summary="16-bit xRGB format, [15:0] x:R:G:B 1:5:5:5 little endian"/>
+      <entry name="xbgr1555" value="0x35314258" summary="16-bit xBGR 1555 format, [15:0] x:B:G:R 1:5:5:5 little endian"/>
+      <entry name="rgbx5551" value="0x35315852" summary="16-bit RGBx 5551 format, [15:0] R:G:B:x 5:5:5:1 little endian"/>
+      <entry name="bgrx5551" value="0x35315842" summary="16-bit BGRx 5551 format, [15:0] B:G:R:x 5:5:5:1 little endian"/>
+      <entry name="argb1555" value="0x35315241" summary="16-bit ARGB 1555 format, [15:0] A:R:G:B 1:5:5:5 little endian"/>
+      <entry name="abgr1555" value="0x35314241" summary="16-bit ABGR 1555 format, [15:0] A:B:G:R 1:5:5:5 little endian"/>
+      <entry name="rgba5551" value="0x35314152" summary="16-bit RGBA 5551 format, [15:0] R:G:B:A 5:5:5:1 little endian"/>
+      <entry name="bgra5551" value="0x35314142" summary="16-bit BGRA 5551 format, [15:0] B:G:R:A 5:5:5:1 little endian"/>
+      <entry name="rgb565" value="0x36314752" summary="16-bit RGB 565 format, [15:0] R:G:B 5:6:5 little endian"/>
+      <entry name="bgr565" value="0x36314742" summary="16-bit BGR 565 format, [15:0] B:G:R 5:6:5 little endian"/>
+      <entry name="rgb888" value="0x34324752" summary="24-bit RGB format, [23:0] R:G:B little endian"/>
+      <entry name="bgr888" value="0x34324742" summary="24-bit BGR format, [23:0] B:G:R little endian"/>
+      <entry name="xbgr8888" value="0x34324258" summary="32-bit xBGR format, [31:0] x:B:G:R 8:8:8:8 little endian"/>
+      <entry name="rgbx8888" value="0x34325852" summary="32-bit RGBx format, [31:0] R:G:B:x 8:8:8:8 little endian"/>
+      <entry name="bgrx8888" value="0x34325842" summary="32-bit BGRx format, [31:0] B:G:R:x 8:8:8:8 little endian"/>
+      <entry name="abgr8888" value="0x34324241" summary="32-bit ABGR format, [31:0] A:B:G:R 8:8:8:8 little endian"/>
+      <entry name="rgba8888" value="0x34324152" summary="32-bit RGBA format, [31:0] R:G:B:A 8:8:8:8 little endian"/>
+      <entry name="bgra8888" value="0x34324142" summary="32-bit BGRA format, [31:0] B:G:R:A 8:8:8:8 little endian"/>
+      <entry name="xrgb2101010" value="0x30335258" summary="32-bit xRGB format, [31:0] x:R:G:B 2:10:10:10 little endian"/>
+      <entry name="xbgr2101010" value="0x30334258" summary="32-bit xBGR format, [31:0] x:B:G:R 2:10:10:10 little endian"/>
+      <entry name="rgbx1010102" value="0x30335852" summary="32-bit RGBx format, [31:0] R:G:B:x 10:10:10:2 little endian"/>
+      <entry name="bgrx1010102" value="0x30335842" summary="32-bit BGRx format, [31:0] B:G:R:x 10:10:10:2 little endian"/>
+      <entry name="argb2101010" value="0x30335241" summary="32-bit ARGB format, [31:0] A:R:G:B 2:10:10:10 little endian"/>
+      <entry name="abgr2101010" value="0x30334241" summary="32-bit ABGR format, [31:0] A:B:G:R 2:10:10:10 little endian"/>
+      <entry name="rgba1010102" value="0x30334152" summary="32-bit RGBA format, [31:0] R:G:B:A 10:10:10:2 little endian"/>
+      <entry name="bgra1010102" value="0x30334142" summary="32-bit BGRA format, [31:0] B:G:R:A 10:10:10:2 little endian"/>
+      <entry name="yuyv" value="0x56595559" summary="packed YCbCr format, [31:0] Cr0:Y1:Cb0:Y0 8:8:8:8 little endian"/>
+      <entry name="yvyu" value="0x55595659" summary="packed YCbCr format, [31:0] Cb0:Y1:Cr0:Y0 8:8:8:8 little endian"/>
+      <entry name="uyvy" value="0x59565955" summary="packed YCbCr format, [31:0] Y1:Cr0:Y0:Cb0 8:8:8:8 little endian"/>
+      <entry name="vyuy" value="0x59555956" summary="packed YCbCr format, [31:0] Y1:Cb0:Y0:Cr0 8:8:8:8 little endian"/>
+      <entry name="ayuv" value="0x56555941" summary="packed AYCbCr format, [31:0] A:Y:Cb:Cr 8:8:8:8 little endian"/>
+      <entry name="nv12" value="0x3231564e" summary="2 plane YCbCr Cr:Cb format, 2x2 subsampled Cr:Cb plane"/>
+      <entry name="nv21" value="0x3132564e" summary="2 plane YCbCr Cb:Cr format, 2x2 subsampled Cb:Cr plane"/>
+      <entry name="nv16" value="0x3631564e" summary="2 plane YCbCr Cr:Cb format, 2x1 subsampled Cr:Cb plane"/>
+      <entry name="nv61" value="0x3136564e" summary="2 plane YCbCr Cb:Cr format, 2x1 subsampled Cb:Cr plane"/>
+      <entry name="yuv410" value="0x39565559" summary="3 plane YCbCr format, 4x4 subsampled Cb (1) and Cr (2) planes"/>
+      <entry name="yvu410" value="0x39555659" summary="3 plane YCbCr format, 4x4 subsampled Cr (1) and Cb (2) planes"/>
+      <entry name="yuv411" value="0x31315559" summary="3 plane YCbCr format, 4x1 subsampled Cb (1) and Cr (2) planes"/>
+      <entry name="yvu411" value="0x31315659" summary="3 plane YCbCr format, 4x1 subsampled Cr (1) and Cb (2) planes"/>
+      <entry name="yuv420" value="0x32315559" summary="3 plane YCbCr format, 2x2 subsampled Cb (1) and Cr (2) planes"/>
+      <entry name="yvu420" value="0x32315659" summary="3 plane YCbCr format, 2x2 subsampled Cr (1) and Cb (2) planes"/>
+      <entry name="yuv422" value="0x36315559" summary="3 plane YCbCr format, 2x1 subsampled Cb (1) and Cr (2) planes"/>
+      <entry name="yvu422" value="0x36315659" summary="3 plane YCbCr format, 2x1 subsampled Cr (1) and Cb (2) planes"/>
+      <entry name="yuv444" value="0x34325559" summary="3 plane YCbCr format, non-subsampled Cb (1) and Cr (2) planes"/>
+      <entry name="yvu444" value="0x34325659" summary="3 plane YCbCr format, non-subsampled Cr (1) and Cb (2) planes"/>
+      <entry name="r8" value="0x20203852" summary="[7:0] R"/>
+      <entry name="r16" value="0x20363152" summary="[15:0] R little endian"/>
+      <entry name="rg88" value="0x38384752" summary="[15:0] R:G 8:8 little endian"/>
+      <entry name="gr88" value="0x38385247" summary="[15:0] G:R 8:8 little endian"/>
+      <entry name="rg1616" value="0x32334752" summary="[31:0] R:G 16:16 little endian"/>
+      <entry name="gr1616" value="0x32335247" summary="[31:0] G:R 16:16 little endian"/>
+      <entry name="xrgb16161616f" value="0x48345258" summary="[63:0] x:R:G:B 16:16:16:16 little endian"/>
+      <entry name="xbgr16161616f" value="0x48344258" summary="[63:0] x:B:G:R 16:16:16:16 little endian"/>
+      <entry name="argb16161616f" value="0x48345241" summary="[63:0] A:R:G:B 16:16:16:16 little endian"/>
+      <entry name="abgr16161616f" value="0x48344241" summary="[63:0] A:B:G:R 16:16:16:16 little endian"/>
+      <entry name="xyuv8888" value="0x56555958" summary="[31:0] X:Y:Cb:Cr 8:8:8:8 little endian"/>
+      <entry name="vuy888" value="0x34325556" summary="[23:0] Cr:Cb:Y 8:8:8 little endian"/>
+      <entry name="vuy101010" value="0x30335556" summary="Y followed by U then V, 10:10:10. Non-linear modifier only"/>
+      <entry name="y210" value="0x30313259" summary="[63:0] Cr0:0:Y1:0:Cb0:0:Y0:0 10:6:10:6:10:6:10:6 little endian per 2 Y pixels"/>
+      <entry name="y212" value="0x32313259" summary="[63:0] Cr0:0:Y1:0:Cb0:0:Y0:0 12:4:12:4:12:4:12:4 little endian per 2 Y pixels"/>
+      <entry name="y216" value="0x36313259" summary="[63:0] Cr0:Y1:Cb0:Y0 16:16:16:16 little endian per 2 Y pixels"/>
+      <entry name="y410" value="0x30313459" summary="[31:0] A:Cr:Y:Cb 2:10:10:10 little endian"/>
+      <entry name="y412" value="0x32313459" summary="[63:0] A:0:Cr:0:Y:0:Cb:0 12:4:12:4:12:4:12:4 little endian"/>
+      <entry name="y416" value="0x36313459" summary="[63:0] A:Cr:Y:Cb 16:16:16:16 little endian"/>
+      <entry name="xvyu2101010" value="0x30335658" summary="[31:0] X:Cr:Y:Cb 2:10:10:10 little endian"/>
+      <entry name="xvyu12_16161616" value="0x36335658" summary="[63:0] X:0:Cr:0:Y:0:Cb:0 12:4:12:4:12:4:12:4 little endian"/>
+      <entry name="xvyu16161616" value="0x38345658" summary="[63:0] X:Cr:Y:Cb 16:16:16:16 little endian"/>
+      <entry name="y0l0" value="0x304c3059" summary="[63:0]   A3:A2:Y3:0:Cr0:0:Y2:0:A1:A0:Y1:0:Cb0:0:Y0:0  1:1:8:2:8:2:8:2:1:1:8:2:8:2:8:2 little endian"/>
+      <entry name="x0l0" value="0x304c3058" summary="[63:0]   X3:X2:Y3:0:Cr0:0:Y2:0:X1:X0:Y1:0:Cb0:0:Y0:0  1:1:8:2:8:2:8:2:1:1:8:2:8:2:8:2 little endian"/>
+      <entry name="y0l2" value="0x324c3059" summary="[63:0]   A3:A2:Y3:Cr0:Y2:A1:A0:Y1:Cb0:Y0  1:1:10:10:10:1:1:10:10:10 little endian"/>
+      <entry name="x0l2" value="0x324c3058" summary="[63:0]   X3:X2:Y3:Cr0:Y2:X1:X0:Y1:Cb0:Y0  1:1:10:10:10:1:1:10:10:10 little endian"/>
+      <entry name="yuv420_8bit" value="0x38305559"/>
+      <entry name="yuv420_10bit" value="0x30315559"/>
+      <entry name="xrgb8888_a8" value="0x38415258"/>
+      <entry name="xbgr8888_a8" value="0x38414258"/>
+      <entry name="rgbx8888_a8" value="0x38415852"/>
+      <entry name="bgrx8888_a8" value="0x38415842"/>
+      <entry name="rgb888_a8" value="0x38413852"/>
+      <entry name="bgr888_a8" value="0x38413842"/>
+      <entry name="rgb565_a8" value="0x38413552"/>
+      <entry name="bgr565_a8" value="0x38413542"/>
+      <entry name="nv24" value="0x3432564e" summary="non-subsampled Cr:Cb plane"/>
+      <entry name="nv42" value="0x3234564e" summary="non-subsampled Cb:Cr plane"/>
+      <entry name="p210" value="0x30313250" summary="2x1 subsampled Cr:Cb plane, 10 bit per channel"/>
+      <entry name="p010" value="0x30313050" summary="2x2 subsampled Cr:Cb plane 10 bits per channel"/>
+      <entry name="p012" value="0x32313050" summary="2x2 subsampled Cr:Cb plane 12 bits per channel"/>
+      <entry name="p016" value="0x36313050" summary="2x2 subsampled Cr:Cb plane 16 bits per channel"/>
+      <entry name="axbxgxrx106106106106" value="0x30314241" summary="[63:0] A:x:B:x:G:x:R:x 10:6:10:6:10:6:10:6 little endian"/>
+      <entry name="nv15" value="0x3531564e" summary="2x2 subsampled Cr:Cb plane"/>
+      <entry name="q410" value="0x30313451"/>
+      <entry name="q401" value="0x31303451"/>
+      <entry name="xrgb16161616" value="0x38345258" summary="[63:0] x:R:G:B 16:16:16:16 little endian"/>
+      <entry name="xbgr16161616" value="0x38344258" summary="[63:0] x:B:G:R 16:16:16:16 little endian"/>
+      <entry name="argb16161616" value="0x38345241" summary="[63:0] A:R:G:B 16:16:16:16 little endian"/>
+      <entry name="abgr16161616" value="0x38344241" summary="[63:0] A:B:G:R 16:16:16:16 little endian"/>
+    </enum>
+
+    <request name="create_pool">
+      <description summary="create a shm pool">
+	Create a new wl_shm_pool object.
+
+	The pool can be used to create shared memory based buffer
+	objects.  The server will mmap size bytes of the passed file
+	descriptor, to use as backing memory for the pool.
+      </description>
+      <arg name="id" type="new_id" interface="wl_shm_pool" summary="pool to create"/>
+      <arg name="fd" type="fd" summary="file descriptor for the pool"/>
+      <arg name="size" type="int" summary="pool size, in bytes"/>
+    </request>
+
+    <event name="format">
+      <description summary="pixel format description">
+	Informs the client about a valid pixel format that
+	can be used for buffers. Known formats include
+	argb8888 and xrgb8888.
+      </description>
+      <arg name="format" type="uint" enum="format" summary="buffer pixel format"/>
+    </event>
+  </interface>
+
+  <interface name="wl_buffer" version="1">
+    <description summary="content for a wl_surface">
+      A buffer provides the content for a wl_surface. Buffers are
+      created through factory interfaces such as wl_shm, wp_linux_buffer_params
+      (from the linux-dmabuf protocol extension) or similar. It has a width and
+      a height and can be attached to a wl_surface, but the mechanism by which a
+      client provides and updates the contents is defined by the buffer factory
+      interface.
+
+      If the buffer uses a format that has an alpha channel, the alpha channel
+      is assumed to be premultiplied in the color channels unless otherwise
+      specified.
+
+      Note, because wl_buffer objects are created from multiple independent
+      factory interfaces, the wl_buffer interface is frozen at version 1.
+    </description>
+
+    <request name="destroy" type="destructor">
+      <description summary="destroy a buffer">
+	Destroy a buffer. If and how you need to release the backing
+	storage is defined by the buffer factory interface.
+
+	For possible side-effects to a surface, see wl_surface.attach.
+      </description>
+    </request>
+
+    <event name="release">
+      <description summary="compositor releases buffer">
+	Sent when this wl_buffer is no longer used by the compositor.
+	The client is now free to reuse or destroy this buffer and its
+	backing storage.
+
+	If a client receives a release event before the frame callback
+	requested in the same wl_surface.commit that attaches this
+	wl_buffer to a surface, then the client is immediately free to
+	reuse the buffer and its backing storage, and does not need a
+	second buffer for the next surface content update. Typically
+	this is possible, when the compositor maintains a copy of the
+	wl_surface contents, e.g. as a GL texture. This is an important
+	optimization for GL(ES) compositors with wl_shm clients.
+      </description>
+    </event>
+  </interface>
+
+  <interface name="wl_data_offer" version="3">
+    <description summary="offer to transfer data">
+      A wl_data_offer represents a piece of data offered for transfer
+      by another client (the source client).  It is used by the
+      copy-and-paste and drag-and-drop mechanisms.  The offer
+      describes the different mime types that the data can be
+      converted to and provides the mechanism for transferring the
+      data directly from the source client.
+    </description>
+
+    <enum name="error">
+      <entry name="invalid_finish" value="0"
+	     summary="finish request was called untimely"/>
+      <entry name="invalid_action_mask" value="1"
+	     summary="action mask contains invalid values"/>
+      <entry name="invalid_action" value="2"
+	     summary="action argument has an invalid value"/>
+      <entry name="invalid_offer" value="3"
+	     summary="offer doesn't accept this request"/>
+    </enum>
+
+    <request name="accept">
+      <description summary="accept one of the offered mime types">
+	Indicate that the client can accept the given mime type, or
+	NULL for not accepted.
+
+	For objects of version 2 or older, this request is used by the
+	client to give feedback whether the client can receive the given
+	mime type, or NULL if none is accepted; the feedback does not
+	determine whether the drag-and-drop operation succeeds or not.
+
+	For objects of version 3 or newer, this request determines the
+	final result of the drag-and-drop operation. If the end result
+	is that no mime types were accepted, the drag-and-drop operation
+	will be cancelled and the corresponding drag source will receive
+	wl_data_source.cancelled. Clients may still use this event in
+	conjunction with wl_data_source.action for feedback.
+      </description>
+      <arg name="serial" type="uint" summary="serial number of the accept request"/>
+      <arg name="mime_type" type="string" allow-null="true" summary="mime type accepted by the client"/>
+    </request>
+
+    <request name="receive">
+      <description summary="request that the data is transferred">
+	To transfer the offered data, the client issues this request
+	and indicates the mime type it wants to receive.  The transfer
+	happens through the passed file descriptor (typically created
+	with the pipe system call).  The source client writes the data
+	in the mime type representation requested and then closes the
+	file descriptor.
+
+	The receiving client reads from the read end of the pipe until
+	EOF and then closes its end, at which point the transfer is
+	complete.
+
+	This request may happen multiple times for different mime types,
+	both before and after wl_data_device.drop. Drag-and-drop destination
+	clients may preemptively fetch data or examine it more closely to
+	determine acceptance.
+      </description>
+      <arg name="mime_type" type="string" summary="mime type desired by receiver"/>
+      <arg name="fd" type="fd" summary="file descriptor for data transfer"/>
+    </request>
+
+    <request name="destroy" type="destructor">
+      <description summary="destroy data offer">
+	Destroy the data offer.
+      </description>
+    </request>
+
+    <event name="offer">
+      <description summary="advertise offered mime type">
+	Sent immediately after creating the wl_data_offer object.  One
+	event per offered mime type.
+      </description>
+      <arg name="mime_type" type="string" summary="offered mime type"/>
+    </event>
+
+    <!-- Version 3 additions -->
+
+    <request name="finish" since="3">
+      <description summary="the offer will no longer be used">
+	Notifies the compositor that the drag destination successfully
+	finished the drag-and-drop operation.
+
+	Upon receiving this request, the compositor will emit
+	wl_data_source.dnd_finished on the drag source client.
+
+	It is a client error to perform other requests than
+	wl_data_offer.destroy after this one. It is also an error to perform
+	this request after a NULL mime type has been set in
+	wl_data_offer.accept or no action was received through
+	wl_data_offer.action.
+
+	If wl_data_offer.finish request is received for a non drag and drop
+	operation, the invalid_finish protocol error is raised.
+      </description>
+    </request>
+
+    <request name="set_actions" since="3">
+      <description summary="set the available/preferred drag-and-drop actions">
+	Sets the actions that the destination side client supports for
+	this operation. This request may trigger the emission of
+	wl_data_source.action and wl_data_offer.action events if the compositor
+	needs to change the selected action.
+
+	This request can be called multiple times throughout the
+	drag-and-drop operation, typically in response to wl_data_device.enter
+	or wl_data_device.motion events.
+
+	This request determines the final result of the drag-and-drop
+	operation. If the end result is that no action is accepted,
+	the drag source will receive wl_data_source.cancelled.
+
+	The dnd_actions argument must contain only values expressed in the
+	wl_data_device_manager.dnd_actions enum, and the preferred_action
+	argument must only contain one of those values set, otherwise it
+	will result in a protocol error.
+
+	While managing an "ask" action, the destination drag-and-drop client
+	may perform further wl_data_offer.receive requests, and is expected
+	to perform one last wl_data_offer.set_actions request with a preferred
+	action other than "ask" (and optionally wl_data_offer.accept) before
+	requesting wl_data_offer.finish, in order to convey the action selected
+	by the user. If the preferred action is not in the
+	wl_data_offer.source_actions mask, an error will be raised.
+
+	If the "ask" action is dismissed (e.g. user cancellation), the client
+	is expected to perform wl_data_offer.destroy right away.
+
+	This request can only be made on drag-and-drop offers, a protocol error
+	will be raised otherwise.
+      </description>
+      <arg name="dnd_actions" type="uint" summary="actions supported by the destination client"
+	   enum="wl_data_device_manager.dnd_action"/>
+      <arg name="preferred_action" type="uint" summary="action preferred by the destination client"
+	   enum="wl_data_device_manager.dnd_action"/>
+    </request>
+
+    <event name="source_actions" since="3">
+      <description summary="notify the source-side available actions">
+	This event indicates the actions offered by the data source. It
+	will be sent immediately after creating the wl_data_offer object,
+	or anytime the source side changes its offered actions through
+	wl_data_source.set_actions.
+      </description>
+      <arg name="source_actions" type="uint" summary="actions offered by the data source"
+	   enum="wl_data_device_manager.dnd_action"/>
+    </event>
+
+    <event name="action" since="3">
+      <description summary="notify the selected action">
+	This event indicates the action selected by the compositor after
+	matching the source/destination side actions. Only one action (or
+	none) will be offered here.
+
+	This event can be emitted multiple times during the drag-and-drop
+	operation in response to destination side action changes through
+	wl_data_offer.set_actions.
+
+	This event will no longer be emitted after wl_data_device.drop
+	happened on the drag-and-drop destination, the client must
+	honor the last action received, or the last preferred one set
+	through wl_data_offer.set_actions when handling an "ask" action.
+
+	Compositors may also change the selected action on the fly, mainly
+	in response to keyboard modifier changes during the drag-and-drop
+	operation.
+
+	The most recent action received is always the valid one. Prior to
+	receiving wl_data_device.drop, the chosen action may change (e.g.
+	due to keyboard modifiers being pressed). At the time of receiving
+	wl_data_device.drop the drag-and-drop destination must honor the
+	last action received.
+
+	Action changes may still happen after wl_data_device.drop,
+	especially on "ask" actions, where the drag-and-drop destination
+	may choose another action afterwards. Action changes happening
+	at this stage are always the result of inter-client negotiation, the
+	compositor shall no longer be able to induce a different action.
+
+	Upon "ask" actions, it is expected that the drag-and-drop destination
+	may potentially choose a different action and/or mime type,
+	based on wl_data_offer.source_actions and finally chosen by the
+	user (e.g. popping up a menu with the available options). The
+	final wl_data_offer.set_actions and wl_data_offer.accept requests
+	must happen before the call to wl_data_offer.finish.
+      </description>
+      <arg name="dnd_action" type="uint" summary="action selected by the compositor"
+	   enum="wl_data_device_manager.dnd_action"/>
+    </event>
+  </interface>
+
+  <interface name="wl_data_source" version="3">
+    <description summary="offer to transfer data">
+      The wl_data_source object is the source side of a wl_data_offer.
+      It is created by the source client in a data transfer and
+      provides a way to describe the offered data and a way to respond
+      to requests to transfer the data.
+    </description>
+
+    <enum name="error">
+      <entry name="invalid_action_mask" value="0"
+	     summary="action mask contains invalid values"/>
+      <entry name="invalid_source" value="1"
+	     summary="source doesn't accept this request"/>
+    </enum>
+
+    <request name="offer">
+      <description summary="add an offered mime type">
+	This request adds a mime type to the set of mime types
+	advertised to targets.  Can be called several times to offer
+	multiple types.
+      </description>
+      <arg name="mime_type" type="string" summary="mime type offered by the data source"/>
+    </request>
+
+    <request name="destroy" type="destructor">
+      <description summary="destroy the data source">
+	Destroy the data source.
+      </description>
+    </request>
+
+    <event name="target">
+      <description summary="a target accepts an offered mime type">
+	Sent when a target accepts pointer_focus or motion events.  If
+	a target does not accept any of the offered types, type is NULL.
+
+	Used for feedback during drag-and-drop.
+      </description>
+      <arg name="mime_type" type="string" allow-null="true" summary="mime type accepted by the target"/>
+    </event>
+
+    <event name="send">
+      <description summary="send the data">
+	Request for data from the client.  Send the data as the
+	specified mime type over the passed file descriptor, then
+	close it.
+      </description>
+      <arg name="mime_type" type="string" summary="mime type for the data"/>
+      <arg name="fd" type="fd" summary="file descriptor for the data"/>
+    </event>
+
+    <event name="cancelled">
+      <description summary="selection was cancelled">
+	This data source is no longer valid. There are several reasons why
+	this could happen:
+
+	- The data source has been replaced by another data source.
+	- The drag-and-drop operation was performed, but the drop destination
+	  did not accept any of the mime types offered through
+	  wl_data_source.target.
+	- The drag-and-drop operation was performed, but the drop destination
+	  did not select any of the actions present in the mask offered through
+	  wl_data_source.action.
+	- The drag-and-drop operation was performed but didn't happen over a
+	  surface.
+	- The compositor cancelled the drag-and-drop operation (e.g. compositor
+	  dependent timeouts to avoid stale drag-and-drop transfers).
+
+	The client should clean up and destroy this data source.
+
+	For objects of version 2 or older, wl_data_source.cancelled will
+	only be emitted if the data source was replaced by another data
+	source.
+      </description>
+    </event>
+
+    <!-- Version 3 additions -->
+
+    <request name="set_actions" since="3">
+      <description summary="set the available drag-and-drop actions">
+	Sets the actions that the source side client supports for this
+	operation. This request may trigger wl_data_source.action and
+	wl_data_offer.action events if the compositor needs to change the
+	selected action.
+
+	The dnd_actions argument must contain only values expressed in the
+	wl_data_device_manager.dnd_actions enum, otherwise it will result
+	in a protocol error.
+
+	This request must be made once only, and can only be made on sources
+	used in drag-and-drop, so it must be performed before
+	wl_data_device.start_drag. Attempting to use the source other than
+	for drag-and-drop will raise a protocol error.
+      </description>
+      <arg name="dnd_actions" type="uint" summary="actions supported by the data source"
+	   enum="wl_data_device_manager.dnd_action"/>
+    </request>
+
+    <event name="dnd_drop_performed" since="3">
+      <description summary="the drag-and-drop operation physically finished">
+	The user performed the drop action. This event does not indicate
+	acceptance, wl_data_source.cancelled may still be emitted afterwards
+	if the drop destination does not accept any mime type.
+
+	However, this event might however not be received if the compositor
+	cancelled the drag-and-drop operation before this event could happen.
+
+	Note that the data_source may still be used in the future and should
+	not be destroyed here.
+      </description>
+    </event>
+
+    <event name="dnd_finished" since="3">
+      <description summary="the drag-and-drop operation concluded">
+	The drop destination finished interoperating with this data
+	source, so the client is now free to destroy this data source and
+	free all associated data.
+
+	If the action used to perform the operation was "move", the
+	source can now delete the transferred data.
+      </description>
+    </event>
+
+    <event name="action" since="3">
+      <description summary="notify the selected action">
+	This event indicates the action selected by the compositor after
+	matching the source/destination side actions. Only one action (or
+	none) will be offered here.
+
+	This event can be emitted multiple times during the drag-and-drop
+	operation, mainly in response to destination side changes through
+	wl_data_offer.set_actions, and as the data device enters/leaves
+	surfaces.
+
+	It is only possible to receive this event after
+	wl_data_source.dnd_drop_performed if the drag-and-drop operation
+	ended in an "ask" action, in which case the final wl_data_source.action
+	event will happen immediately before wl_data_source.dnd_finished.
+
+	Compositors may also change the selected action on the fly, mainly
+	in response to keyboard modifier changes during the drag-and-drop
+	operation.
+
+	The most recent action received is always the valid one. The chosen
+	action may change alongside negotiation (e.g. an "ask" action can turn
+	into a "move" operation), so the effects of the final action must
+	always be applied in wl_data_offer.dnd_finished.
+
+	Clients can trigger cursor surface changes from this point, so
+	they reflect the current action.
+      </description>
+      <arg name="dnd_action" type="uint" summary="action selected by the compositor"
+	   enum="wl_data_device_manager.dnd_action"/>
+    </event>
+  </interface>
+
+  <interface name="wl_data_device" version="3">
+    <description summary="data transfer device">
+      There is one wl_data_device per seat which can be obtained
+      from the global wl_data_device_manager singleton.
+
+      A wl_data_device provides access to inter-client data transfer
+      mechanisms such as copy-and-paste and drag-and-drop.
+    </description>
+
+    <enum name="error">
+      <entry name="role" value="0" summary="given wl_surface has another role"/>
+    </enum>
+
+    <request name="start_drag">
+      <description summary="start drag-and-drop operation">
+	This request asks the compositor to start a drag-and-drop
+	operation on behalf of the client.
+
+	The source argument is the data source that provides the data
+	for the eventual data transfer. If source is NULL, enter, leave
+	and motion events are sent only to the client that initiated the
+	drag and the client is expected to handle the data passing
+	internally. If source is destroyed, the drag-and-drop session will be
+	cancelled.
+
+	The origin surface is the surface where the drag originates and
+	the client must have an active implicit grab that matches the
+	serial.
+
+	The icon surface is an optional (can be NULL) surface that
+	provides an icon to be moved around with the cursor.  Initially,
+	the top-left corner of the icon surface is placed at the cursor
+	hotspot, but subsequent wl_surface.attach request can move the
+	relative position. Attach requests must be confirmed with
+	wl_surface.commit as usual. The icon surface is given the role of
+	a drag-and-drop icon. If the icon surface already has another role,
+	it raises a protocol error.
+
+	The input region is ignored for wl_surfaces with the role of a
+	drag-and-drop icon.
+      </description>
+      <arg name="source" type="object" interface="wl_data_source" allow-null="true" summary="data source for the eventual transfer"/>
+      <arg name="origin" type="object" interface="wl_surface" summary="surface where the drag originates"/>
+      <arg name="icon" type="object" interface="wl_surface" allow-null="true" summary="drag-and-drop icon surface"/>
+      <arg name="serial" type="uint" summary="serial number of the implicit grab on the origin"/>
+    </request>
+
+    <request name="set_selection">
+      <description summary="copy data to the selection">
+	This request asks the compositor to set the selection
+	to the data from the source on behalf of the client.
+
+	To unset the selection, set the source to NULL.
+      </description>
+      <arg name="source" type="object" interface="wl_data_source" allow-null="true" summary="data source for the selection"/>
+      <arg name="serial" type="uint" summary="serial number of the event that triggered this request"/>
+    </request>
+
+    <event name="data_offer">
+      <description summary="introduce a new wl_data_offer">
+	The data_offer event introduces a new wl_data_offer object,
+	which will subsequently be used in either the
+	data_device.enter event (for drag-and-drop) or the
+	data_device.selection event (for selections).  Immediately
+	following the data_device.data_offer event, the new data_offer
+	object will send out data_offer.offer events to describe the
+	mime types it offers.
+      </description>
+      <arg name="id" type="new_id" interface="wl_data_offer" summary="the new data_offer object"/>
+    </event>
+
+    <event name="enter">
+      <description summary="initiate drag-and-drop session">
+	This event is sent when an active drag-and-drop pointer enters
+	a surface owned by the client.  The position of the pointer at
+	enter time is provided by the x and y arguments, in surface-local
+	coordinates.
+      </description>
+      <arg name="serial" type="uint" summary="serial number of the enter event"/>
+      <arg name="surface" type="object" interface="wl_surface" summary="client surface entered"/>
+      <arg name="x" type="fixed" summary="surface-local x coordinate"/>
+      <arg name="y" type="fixed" summary="surface-local y coordinate"/>
+      <arg name="id" type="object" interface="wl_data_offer" allow-null="true"
+	   summary="source data_offer object"/>
+    </event>
+
+    <event name="leave">
+      <description summary="end drag-and-drop session">
+	This event is sent when the drag-and-drop pointer leaves the
+	surface and the session ends.  The client must destroy the
+	wl_data_offer introduced at enter time at this point.
+      </description>
+    </event>
+
+    <event name="motion">
+      <description summary="drag-and-drop session motion">
+	This event is sent when the drag-and-drop pointer moves within
+	the currently focused surface. The new position of the pointer
+	is provided by the x and y arguments, in surface-local
+	coordinates.
+      </description>
+      <arg name="time" type="uint" summary="timestamp with millisecond granularity"/>
+      <arg name="x" type="fixed" summary="surface-local x coordinate"/>
+      <arg name="y" type="fixed" summary="surface-local y coordinate"/>
+    </event>
+
+    <event name="drop">
+      <description summary="end drag-and-drop session successfully">
+	The event is sent when a drag-and-drop operation is ended
+	because the implicit grab is removed.
+
+	The drag-and-drop destination is expected to honor the last action
+	received through wl_data_offer.action, if the resulting action is
+	"copy" or "move", the destination can still perform
+	wl_data_offer.receive requests, and is expected to end all
+	transfers with a wl_data_offer.finish request.
+
+	If the resulting action is "ask", the action will not be considered
+	final. The drag-and-drop destination is expected to perform one last
+	wl_data_offer.set_actions request, or wl_data_offer.destroy in order
+	to cancel the operation.
+      </description>
+    </event>
+
+    <event name="selection">
+      <description summary="advertise new selection">
+	The selection event is sent out to notify the client of a new
+	wl_data_offer for the selection for this device.  The
+	data_device.data_offer and the data_offer.offer events are
+	sent out immediately before this event to introduce the data
+	offer object.  The selection event is sent to a client
+	immediately before receiving keyboard focus and when a new
+	selection is set while the client has keyboard focus.  The
+	data_offer is valid until a new data_offer or NULL is received
+	or until the client loses keyboard focus.  Switching surface with
+	keyboard focus within the same client doesn't mean a new selection
+	will be sent.  The client must destroy the previous selection
+	data_offer, if any, upon receiving this event.
+      </description>
+      <arg name="id" type="object" interface="wl_data_offer" allow-null="true"
+	   summary="selection data_offer object"/>
+    </event>
+
+    <!-- Version 2 additions -->
+
+    <request name="release" type="destructor" since="2">
+      <description summary="destroy data device">
+	This request destroys the data device.
+      </description>
+    </request>
+  </interface>
+
+  <interface name="wl_data_device_manager" version="3">
+    <description summary="data transfer interface">
+      The wl_data_device_manager is a singleton global object that
+      provides access to inter-client data transfer mechanisms such as
+      copy-and-paste and drag-and-drop.  These mechanisms are tied to
+      a wl_seat and this interface lets a client get a wl_data_device
+      corresponding to a wl_seat.
+
+      Depending on the version bound, the objects created from the bound
+      wl_data_device_manager object will have different requirements for
+      functioning properly. See wl_data_source.set_actions,
+      wl_data_offer.accept and wl_data_offer.finish for details.
+    </description>
+
+    <request name="create_data_source">
+      <description summary="create a new data source">
+	Create a new data source.
+      </description>
+      <arg name="id" type="new_id" interface="wl_data_source" summary="data source to create"/>
+    </request>
+
+    <request name="get_data_device">
+      <description summary="create a new data device">
+	Create a new data device for a given seat.
+      </description>
+      <arg name="id" type="new_id" interface="wl_data_device" summary="data device to create"/>
+      <arg name="seat" type="object" interface="wl_seat" summary="seat associated with the data device"/>
+    </request>
+
+    <!-- Version 3 additions -->
+
+    <enum name="dnd_action" bitfield="true" since="3">
+      <description summary="drag and drop actions">
+	This is a bitmask of the available/preferred actions in a
+	drag-and-drop operation.
+
+	In the compositor, the selected action is a result of matching the
+	actions offered by the source and destination sides.  "action" events
+	with a "none" action will be sent to both source and destination if
+	there is no match. All further checks will effectively happen on
+	(source actions ∩ destination actions).
+
+	In addition, compositors may also pick different actions in
+	reaction to key modifiers being pressed. One common design that
+	is used in major toolkits (and the behavior recommended for
+	compositors) is:
+
+	- If no modifiers are pressed, the first match (in bit order)
+	  will be used.
+	- Pressing Shift selects "move", if enabled in the mask.
+	- Pressing Control selects "copy", if enabled in the mask.
+
+	Behavior beyond that is considered implementation-dependent.
+	Compositors may for example bind other modifiers (like Alt/Meta)
+	or drags initiated with other buttons than BTN_LEFT to specific
+	actions (e.g. "ask").
+      </description>
+      <entry name="none" value="0" summary="no action"/>
+      <entry name="copy" value="1" summary="copy action"/>
+      <entry name="move" value="2" summary="move action"/>
+      <entry name="ask" value="4" summary="ask action"/>
+    </enum>
+  </interface>
+
+  <interface name="wl_shell" version="1">
+    <description summary="create desktop-style surfaces">
+      This interface is implemented by servers that provide
+      desktop-style user interfaces.
+
+      It allows clients to associate a wl_shell_surface with
+      a basic surface.
+
+      Note! This protocol is deprecated and not intended for production use.
+      For desktop-style user interfaces, use xdg_shell. Compositors and clients
+      should not implement this interface.
+    </description>
+
+    <enum name="error">
+      <entry name="role" value="0" summary="given wl_surface has another role"/>
+    </enum>
+
+    <request name="get_shell_surface">
+      <description summary="create a shell surface from a surface">
+	Create a shell surface for an existing surface. This gives
+	the wl_surface the role of a shell surface. If the wl_surface
+	already has another role, it raises a protocol error.
+
+	Only one shell surface can be associated with a given surface.
+      </description>
+      <arg name="id" type="new_id" interface="wl_shell_surface" summary="shell surface to create"/>
+      <arg name="surface" type="object" interface="wl_surface" summary="surface to be given the shell surface role"/>
+    </request>
+  </interface>
+
+  <interface name="wl_shell_surface" version="1">
+    <description summary="desktop-style metadata interface">
+      An interface that may be implemented by a wl_surface, for
+      implementations that provide a desktop-style user interface.
+
+      It provides requests to treat surfaces like toplevel, fullscreen
+      or popup windows, move, resize or maximize them, associate
+      metadata like title and class, etc.
+
+      On the server side the object is automatically destroyed when
+      the related wl_surface is destroyed. On the client side,
+      wl_shell_surface_destroy() must be called before destroying
+      the wl_surface object.
+    </description>
+
+    <request name="pong">
+      <description summary="respond to a ping event">
+	A client must respond to a ping event with a pong request or
+	the client may be deemed unresponsive.
+      </description>
+      <arg name="serial" type="uint" summary="serial number of the ping event"/>
+    </request>
+
+    <request name="move">
+      <description summary="start an interactive move">
+	Start a pointer-driven move of the surface.
+
+	This request must be used in response to a button press event.
+	The server may ignore move requests depending on the state of
+	the surface (e.g. fullscreen or maximized).
+      </description>
+      <arg name="seat" type="object" interface="wl_seat" summary="seat whose pointer is used"/>
+      <arg name="serial" type="uint" summary="serial number of the implicit grab on the pointer"/>
+    </request>
+
+    <enum name="resize" bitfield="true">
+      <description summary="edge values for resizing">
+	These values are used to indicate which edge of a surface
+	is being dragged in a resize operation. The server may
+	use this information to adapt its behavior, e.g. choose
+	an appropriate cursor image.
+      </description>
+      <entry name="none" value="0" summary="no edge"/>
+      <entry name="top" value="1" summary="top edge"/>
+      <entry name="bottom" value="2" summary="bottom edge"/>
+      <entry name="left" value="4" summary="left edge"/>
+      <entry name="top_left" value="5" summary="top and left edges"/>
+      <entry name="bottom_left" value="6" summary="bottom and left edges"/>
+      <entry name="right" value="8" summary="right edge"/>
+      <entry name="top_right" value="9" summary="top and right edges"/>
+      <entry name="bottom_right" value="10" summary="bottom and right edges"/>
+    </enum>
+
+    <request name="resize">
+      <description summary="start an interactive resize">
+	Start a pointer-driven resizing of the surface.
+
+	This request must be used in response to a button press event.
+	The server may ignore resize requests depending on the state of
+	the surface (e.g. fullscreen or maximized).
+      </description>
+      <arg name="seat" type="object" interface="wl_seat" summary="seat whose pointer is used"/>
+      <arg name="serial" type="uint" summary="serial number of the implicit grab on the pointer"/>
+      <arg name="edges" type="uint" enum="resize" summary="which edge or corner is being dragged"/>
+    </request>
+
+    <request name="set_toplevel">
+      <description summary="make the surface a toplevel surface">
+	Map the surface as a toplevel surface.
+
+	A toplevel surface is not fullscreen, maximized or transient.
+      </description>
+    </request>
+
+    <enum name="transient" bitfield="true">
+      <description summary="details of transient behaviour">
+	These flags specify details of the expected behaviour
+	of transient surfaces. Used in the set_transient request.
+      </description>
+      <entry name="inactive" value="0x1" summary="do not set keyboard focus"/>
+    </enum>
+
+    <request name="set_transient">
+      <description summary="make the surface a transient surface">
+	Map the surface relative to an existing surface.
+
+	The x and y arguments specify the location of the upper left
+	corner of the surface relative to the upper left corner of the
+	parent surface, in surface-local coordinates.
+
+	The flags argument controls details of the transient behaviour.
+      </description>
+      <arg name="parent" type="object" interface="wl_surface" summary="parent surface"/>
+      <arg name="x" type="int" summary="surface-local x coordinate"/>
+      <arg name="y" type="int" summary="surface-local y coordinate"/>
+      <arg name="flags" type="uint" enum="transient" summary="transient surface behavior"/>
+    </request>
+
+    <enum name="fullscreen_method">
+      <description summary="different method to set the surface fullscreen">
+	Hints to indicate to the compositor how to deal with a conflict
+	between the dimensions of the surface and the dimensions of the
+	output. The compositor is free to ignore this parameter.
+      </description>
+      <entry name="default" value="0" summary="no preference, apply default policy"/>
+      <entry name="scale" value="1" summary="scale, preserve the surface's aspect ratio and center on output"/>
+      <entry name="driver" value="2" summary="switch output mode to the smallest mode that can fit the surface, add black borders to compensate size mismatch"/>
+      <entry name="fill" value="3" summary="no upscaling, center on output and add black borders to compensate size mismatch"/>
+    </enum>
+
+    <request name="set_fullscreen">
+      <description summary="make the surface a fullscreen surface">
+	Map the surface as a fullscreen surface.
+
+	If an output parameter is given then the surface will be made
+	fullscreen on that output. If the client does not specify the
+	output then the compositor will apply its policy - usually
+	choosing the output on which the surface has the biggest surface
+	area.
+
+	The client may specify a method to resolve a size conflict
+	between the output size and the surface size - this is provided
+	through the method parameter.
+
+	The framerate parameter is used only when the method is set
+	to "driver", to indicate the preferred framerate. A value of 0
+	indicates that the client does not care about framerate.  The
+	framerate is specified in mHz, that is framerate of 60000 is 60Hz.
+
+	A method of "scale" or "driver" implies a scaling operation of
+	the surface, either via a direct scaling operation or a change of
+	the output mode. This will override any kind of output scaling, so
+	that mapping a surface with a buffer size equal to the mode can
+	fill the screen independent of buffer_scale.
+
+	A method of "fill" means we don't scale up the buffer, however
+	any output scale is applied. This means that you may run into
+	an edge case where the application maps a buffer with the same
+	size of the output mode but buffer_scale 1 (thus making a
+	surface larger than the output). In this case it is allowed to
+	downscale the results to fit the screen.
+
+	The compositor must reply to this request with a configure event
+	with the dimensions for the output on which the surface will
+	be made fullscreen.
+      </description>
+      <arg name="method" type="uint" enum="fullscreen_method" summary="method for resolving size conflict"/>
+      <arg name="framerate" type="uint" summary="framerate in mHz"/>
+      <arg name="output" type="object" interface="wl_output" allow-null="true"
+	   summary="output on which the surface is to be fullscreen"/>
+    </request>
+
+    <request name="set_popup">
+      <description summary="make the surface a popup surface">
+	Map the surface as a popup.
+
+	A popup surface is a transient surface with an added pointer
+	grab.
+
+	An existing implicit grab will be changed to owner-events mode,
+	and the popup grab will continue after the implicit grab ends
+	(i.e. releasing the mouse button does not cause the popup to
+	be unmapped).
+
+	The popup grab continues until the window is destroyed or a
+	mouse button is pressed in any other client's window. A click
+	in any of the client's surfaces is reported as normal, however,
+	clicks in other clients' surfaces will be discarded and trigger
+	the callback.
+
+	The x and y arguments specify the location of the upper left
+	corner of the surface relative to the upper left corner of the
+	parent surface, in surface-local coordinates.
+      </description>
+      <arg name="seat" type="object" interface="wl_seat" summary="seat whose pointer is used"/>
+      <arg name="serial" type="uint" summary="serial number of the implicit grab on the pointer"/>
+      <arg name="parent" type="object" interface="wl_surface" summary="parent surface"/>
+      <arg name="x" type="int" summary="surface-local x coordinate"/>
+      <arg name="y" type="int" summary="surface-local y coordinate"/>
+      <arg name="flags" type="uint" enum="transient" summary="transient surface behavior"/>
+    </request>
+
+    <request name="set_maximized">
+      <description summary="make the surface a maximized surface">
+	Map the surface as a maximized surface.
+
+	If an output parameter is given then the surface will be
+	maximized on that output. If the client does not specify the
+	output then the compositor will apply its policy - usually
+	choosing the output on which the surface has the biggest surface
+	area.
+
+	The compositor will reply with a configure event telling
+	the expected new surface size. The operation is completed
+	on the next buffer attach to this surface.
+
+	A maximized surface typically fills the entire output it is
+	bound to, except for desktop elements such as panels. This is
+	the main difference between a maximized shell surface and a
+	fullscreen shell surface.
+
+	The details depend on the compositor implementation.
+      </description>
+      <arg name="output" type="object" interface="wl_output" allow-null="true"
+	   summary="output on which the surface is to be maximized"/>
+    </request>
+
+    <request name="set_title">
+      <description summary="set surface title">
+	Set a short title for the surface.
+
+	This string may be used to identify the surface in a task bar,
+	window list, or other user interface elements provided by the
+	compositor.
+
+	The string must be encoded in UTF-8.
+      </description>
+      <arg name="title" type="string" summary="surface title"/>
+    </request>
+
+    <request name="set_class">
+      <description summary="set surface class">
+	Set a class for the surface.
+
+	The surface class identifies the general class of applications
+	to which the surface belongs. A common convention is to use the
+	file name (or the full path if it is a non-standard location) of
+	the application's .desktop file as the class.
+      </description>
+      <arg name="class_" type="string" summary="surface class"/>
+    </request>
+
+    <event name="ping">
+      <description summary="ping client">
+	Ping a client to check if it is receiving events and sending
+	requests. A client is expected to reply with a pong request.
+      </description>
+      <arg name="serial" type="uint" summary="serial number of the ping"/>
+    </event>
+
+    <event name="configure">
+      <description summary="suggest resize">
+	The configure event asks the client to resize its surface.
+
+	The size is a hint, in the sense that the client is free to
+	ignore it if it doesn't resize, pick a smaller size (to
+	satisfy aspect ratio or resize in steps of NxM pixels).
+
+	The edges parameter provides a hint about how the surface
+	was resized. The client may use this information to decide
+	how to adjust its content to the new size (e.g. a scrolling
+	area might adjust its content position to leave the viewable
+	content unmoved).
+
+	The client is free to dismiss all but the last configure
+	event it received.
+
+	The width and height arguments specify the size of the window
+	in surface-local coordinates.
+      </description>
+      <arg name="edges" type="uint" enum="resize" summary="how the surface was resized"/>
+      <arg name="width" type="int" summary="new width of the surface"/>
+      <arg name="height" type="int" summary="new height of the surface"/>
+    </event>
+
+    <event name="popup_done">
+      <description summary="popup interaction is done">
+	The popup_done event is sent out when a popup grab is broken,
+	that is, when the user clicks a surface that doesn't belong
+	to the client owning the popup surface.
+      </description>
+    </event>
+  </interface>
+
+  <interface name="wl_surface" version="6">
+    <description summary="an onscreen surface">
+      A surface is a rectangular area that may be displayed on zero
+      or more outputs, and shown any number of times at the compositor's
+      discretion. They can present wl_buffers, receive user input, and
+      define a local coordinate system.
+
+      The size of a surface (and relative positions on it) is described
+      in surface-local coordinates, which may differ from the buffer
+      coordinates of the pixel content, in case a buffer_transform
+      or a buffer_scale is used.
+
+      A surface without a "role" is fairly useless: a compositor does
+      not know where, when or how to present it. The role is the
+      purpose of a wl_surface. Examples of roles are a cursor for a
+      pointer (as set by wl_pointer.set_cursor), a drag icon
+      (wl_data_device.start_drag), a sub-surface
+      (wl_subcompositor.get_subsurface), and a window as defined by a
+      shell protocol (e.g. wl_shell.get_shell_surface).
+
+      A surface can have only one role at a time. Initially a
+      wl_surface does not have a role. Once a wl_surface is given a
+      role, it is set permanently for the whole lifetime of the
+      wl_surface object. Giving the current role again is allowed,
+      unless explicitly forbidden by the relevant interface
+      specification.
+
+      Surface roles are given by requests in other interfaces such as
+      wl_pointer.set_cursor. The request should explicitly mention
+      that this request gives a role to a wl_surface. Often, this
+      request also creates a new protocol object that represents the
+      role and adds additional functionality to wl_surface. When a
+      client wants to destroy a wl_surface, they must destroy this role
+      object before the wl_surface, otherwise a defunct_role_object error is
+      sent.
+
+      Destroying the role object does not remove the role from the
+      wl_surface, but it may stop the wl_surface from "playing the role".
+      For instance, if a wl_subsurface object is destroyed, the wl_surface
+      it was created for will be unmapped and forget its position and
+      z-order. It is allowed to create a wl_subsurface for the same
+      wl_surface again, but it is not allowed to use the wl_surface as
+      a cursor (cursor is a different role than sub-surface, and role
+      switching is not allowed).
+    </description>
+
+    <enum name="error">
+      <description summary="wl_surface error values">
+	These errors can be emitted in response to wl_surface requests.
+      </description>
+      <entry name="invalid_scale" value="0" summary="buffer scale value is invalid"/>
+      <entry name="invalid_transform" value="1" summary="buffer transform value is invalid"/>
+      <entry name="invalid_size" value="2" summary="buffer size is invalid"/>
+      <entry name="invalid_offset" value="3" summary="buffer offset is invalid"/>
+      <entry name="defunct_role_object" value="4"
+             summary="surface was destroyed before its role object"/>
+    </enum>
+
+    <request name="destroy" type="destructor">
+      <description summary="delete surface">
+	Deletes the surface and invalidates its object ID.
+      </description>
+    </request>
+
+    <request name="attach">
+      <description summary="set the surface contents">
+	Set a buffer as the content of this surface.
+
+	The new size of the surface is calculated based on the buffer
+	size transformed by the inverse buffer_transform and the
+	inverse buffer_scale. This means that at commit time the supplied
+	buffer size must be an integer multiple of the buffer_scale. If
+	that's not the case, an invalid_size error is sent.
+
+	The x and y arguments specify the location of the new pending
+	buffer's upper left corner, relative to the current buffer's upper
+	left corner, in surface-local coordinates. In other words, the
+	x and y, combined with the new surface size define in which
+	directions the surface's size changes. Setting anything other than 0
+	as x and y arguments is discouraged, and should instead be replaced
+	with using the separate wl_surface.offset request.
+
+	When the bound wl_surface version is 5 or higher, passing any
+	non-zero x or y is a protocol violation, and will result in an
+        'invalid_offset' error being raised. The x and y arguments are ignored
+        and do not change the pending state. To achieve equivalent semantics,
+        use wl_surface.offset.
+
+	Surface contents are double-buffered state, see wl_surface.commit.
+
+	The initial surface contents are void; there is no content.
+	wl_surface.attach assigns the given wl_buffer as the pending
+	wl_buffer. wl_surface.commit makes the pending wl_buffer the new
+	surface contents, and the size of the surface becomes the size
+	calculated from the wl_buffer, as described above. After commit,
+	there is no pending buffer until the next attach.
+
+	Committing a pending wl_buffer allows the compositor to read the
+	pixels in the wl_buffer. The compositor may access the pixels at
+	any time after the wl_surface.commit request. When the compositor
+	will not access the pixels anymore, it will send the
+	wl_buffer.release event. Only after receiving wl_buffer.release,
+	the client may reuse the wl_buffer. A wl_buffer that has been
+	attached and then replaced by another attach instead of committed
+	will not receive a release event, and is not used by the
+	compositor.
+
+	If a pending wl_buffer has been committed to more than one wl_surface,
+	the delivery of wl_buffer.release events becomes undefined. A well
+	behaved client should not rely on wl_buffer.release events in this
+	case. Alternatively, a client could create multiple wl_buffer objects
+	from the same backing storage or use wp_linux_buffer_release.
+
+	Destroying the wl_buffer after wl_buffer.release does not change
+	the surface contents. Destroying the wl_buffer before wl_buffer.release
+	is allowed as long as the underlying buffer storage isn't re-used (this
+	can happen e.g. on client process termination). However, if the client
+	destroys the wl_buffer before receiving the wl_buffer.release event and
+	mutates the underlying buffer storage, the surface contents become
+	undefined immediately.
+
+	If wl_surface.attach is sent with a NULL wl_buffer, the
+	following wl_surface.commit will remove the surface content.
+      </description>
+      <arg name="buffer" type="object" interface="wl_buffer" allow-null="true"
+	   summary="buffer of surface contents"/>
+      <arg name="x" type="int" summary="surface-local x coordinate"/>
+      <arg name="y" type="int" summary="surface-local y coordinate"/>
+    </request>
+
+    <request name="damage">
+      <description summary="mark part of the surface damaged">
+	This request is used to describe the regions where the pending
+	buffer is different from the current surface contents, and where
+	the surface therefore needs to be repainted. The compositor
+	ignores the parts of the damage that fall outside of the surface.
+
+	Damage is double-buffered state, see wl_surface.commit.
+
+	The damage rectangle is specified in surface-local coordinates,
+	where x and y specify the upper left corner of the damage rectangle.
+
+	The initial value for pending damage is empty: no damage.
+	wl_surface.damage adds pending damage: the new pending damage
+	is the union of old pending damage and the given rectangle.
+
+	wl_surface.commit assigns pending damage as the current damage,
+	and clears pending damage. The server will clear the current
+	damage as it repaints the surface.
+
+	Note! New clients should not use this request. Instead damage can be
+	posted with wl_surface.damage_buffer which uses buffer coordinates
+	instead of surface coordinates.
+      </description>
+      <arg name="x" type="int" summary="surface-local x coordinate"/>
+      <arg name="y" type="int" summary="surface-local y coordinate"/>
+      <arg name="width" type="int" summary="width of damage rectangle"/>
+      <arg name="height" type="int" summary="height of damage rectangle"/>
+    </request>
+
+    <request name="frame">
+      <description summary="request a frame throttling hint">
+	Request a notification when it is a good time to start drawing a new
+	frame, by creating a frame callback. This is useful for throttling
+	redrawing operations, and driving animations.
+
+	When a client is animating on a wl_surface, it can use the 'frame'
+	request to get notified when it is a good time to draw and commit the
+	next frame of animation. If the client commits an update earlier than
+	that, it is likely that some updates will not make it to the display,
+	and the client is wasting resources by drawing too often.
+
+	The frame request will take effect on the next wl_surface.commit.
+	The notification will only be posted for one frame unless
+	requested again. For a wl_surface, the notifications are posted in
+	the order the frame requests were committed.
+
+	The server must send the notifications so that a client
+	will not send excessive updates, while still allowing
+	the highest possible update rate for clients that wait for the reply
+	before drawing again. The server should give some time for the client
+	to draw and commit after sending the frame callback events to let it
+	hit the next output refresh.
+
+	A server should avoid signaling the frame callbacks if the
+	surface is not visible in any way, e.g. the surface is off-screen,
+	or completely obscured by other opaque surfaces.
+
+	The object returned by this request will be destroyed by the
+	compositor after the callback is fired and as such the client must not
+	attempt to use it after that point.
+
+	The callback_data passed in the callback is the current time, in
+	milliseconds, with an undefined base.
+      </description>
+      <arg name="callback" type="new_id" interface="wl_callback" summary="callback object for the frame request"/>
+    </request>
+
+    <request name="set_opaque_region">
+      <description summary="set opaque region">
+	This request sets the region of the surface that contains
+	opaque content.
+
+	The opaque region is an optimization hint for the compositor
+	that lets it optimize the redrawing of content behind opaque
+	regions.  Setting an opaque region is not required for correct
+	behaviour, but marking transparent content as opaque will result
+	in repaint artifacts.
+
+	The opaque region is specified in surface-local coordinates.
+
+	The compositor ignores the parts of the opaque region that fall
+	outside of the surface.
+
+	Opaque region is double-buffered state, see wl_surface.commit.
+
+	wl_surface.set_opaque_region changes the pending opaque region.
+	wl_surface.commit copies the pending region to the current region.
+	Otherwise, the pending and current regions are never changed.
+
+	The initial value for an opaque region is empty. Setting the pending
+	opaque region has copy semantics, and the wl_region object can be
+	destroyed immediately. A NULL wl_region causes the pending opaque
+	region to be set to empty.
+      </description>
+      <arg name="region" type="object" interface="wl_region" allow-null="true"
+	   summary="opaque region of the surface"/>
+    </request>
+
+    <request name="set_input_region">
+      <description summary="set input region">
+	This request sets the region of the surface that can receive
+	pointer and touch events.
+
+	Input events happening outside of this region will try the next
+	surface in the server surface stack. The compositor ignores the
+	parts of the input region that fall outside of the surface.
+
+	The input region is specified in surface-local coordinates.
+
+	Input region is double-buffered state, see wl_surface.commit.
+
+	wl_surface.set_input_region changes the pending input region.
+	wl_surface.commit copies the pending region to the current region.
+	Otherwise the pending and current regions are never changed,
+	except cursor and icon surfaces are special cases, see
+	wl_pointer.set_cursor and wl_data_device.start_drag.
+
+	The initial value for an input region is infinite. That means the
+	whole surface will accept input. Setting the pending input region
+	has copy semantics, and the wl_region object can be destroyed
+	immediately. A NULL wl_region causes the input region to be set
+	to infinite.
+      </description>
+      <arg name="region" type="object" interface="wl_region" allow-null="true"
+	   summary="input region of the surface"/>
+    </request>
+
+    <request name="commit">
+      <description summary="commit pending surface state">
+	Surface state (input, opaque, and damage regions, attached buffers,
+	etc.) is double-buffered. Protocol requests modify the pending state,
+	as opposed to the current state in use by the compositor. A commit
+	request atomically applies all pending state, replacing the current
+	state. After commit, the new pending state is as documented for each
+	related request.
+
+	On commit, a pending wl_buffer is applied first, and all other state
+	second. This means that all coordinates in double-buffered state are
+	relative to the new wl_buffer coming into use, except for
+	wl_surface.attach itself. If there is no pending wl_buffer, the
+	coordinates are relative to the current surface contents.
+
+	All requests that need a commit to become effective are documented
+	to affect double-buffered state.
+
+	Other interfaces may add further double-buffered surface state.
+      </description>
+    </request>
+
+    <event name="enter">
+      <description summary="surface enters an output">
+	This is emitted whenever a surface's creation, movement, or resizing
+	results in some part of it being within the scanout region of an
+	output.
+
+	Note that a surface may be overlapping with zero or more outputs.
+      </description>
+      <arg name="output" type="object" interface="wl_output" summary="output entered by the surface"/>
+    </event>
+
+    <event name="leave">
+      <description summary="surface leaves an output">
+	This is emitted whenever a surface's creation, movement, or resizing
+	results in it no longer having any part of it within the scanout region
+	of an output.
+
+	Clients should not use the number of outputs the surface is on for frame
+	throttling purposes. The surface might be hidden even if no leave event
+	has been sent, and the compositor might expect new surface content
+	updates even if no enter event has been sent. The frame event should be
+	used instead.
+      </description>
+      <arg name="output" type="object" interface="wl_output" summary="output left by the surface"/>
+    </event>
+
+    <!-- Version 2 additions -->
+
+    <request name="set_buffer_transform" since="2">
+      <description summary="sets the buffer transformation">
+	This request sets an optional transformation on how the compositor
+	interprets the contents of the buffer attached to the surface. The
+	accepted values for the transform parameter are the values for
+	wl_output.transform.
+
+	Buffer transform is double-buffered state, see wl_surface.commit.
+
+	A newly created surface has its buffer transformation set to normal.
+
+	wl_surface.set_buffer_transform changes the pending buffer
+	transformation. wl_surface.commit copies the pending buffer
+	transformation to the current one. Otherwise, the pending and current
+	values are never changed.
+
+	The purpose of this request is to allow clients to render content
+	according to the output transform, thus permitting the compositor to
+	use certain optimizations even if the display is rotated. Using
+	hardware overlays and scanning out a client buffer for fullscreen
+	surfaces are examples of such optimizations. Those optimizations are
+	highly dependent on the compositor implementation, so the use of this
+	request should be considered on a case-by-case basis.
+
+	Note that if the transform value includes 90 or 270 degree rotation,
+	the width of the buffer will become the surface height and the height
+	of the buffer will become the surface width.
+
+	If transform is not one of the values from the
+	wl_output.transform enum the invalid_transform protocol error
+	is raised.
+      </description>
+      <arg name="transform" type="int" enum="wl_output.transform"
+	   summary="transform for interpreting buffer contents"/>
+    </request>
+
+    <!-- Version 3 additions -->
+
+    <request name="set_buffer_scale" since="3">
+      <description summary="sets the buffer scaling factor">
+	This request sets an optional scaling factor on how the compositor
+	interprets the contents of the buffer attached to the window.
+
+	Buffer scale is double-buffered state, see wl_surface.commit.
+
+	A newly created surface has its buffer scale set to 1.
+
+	wl_surface.set_buffer_scale changes the pending buffer scale.
+	wl_surface.commit copies the pending buffer scale to the current one.
+	Otherwise, the pending and current values are never changed.
+
+	The purpose of this request is to allow clients to supply higher
+	resolution buffer data for use on high resolution outputs. It is
+	intended that you pick the same buffer scale as the scale of the
+	output that the surface is displayed on. This means the compositor
+	can avoid scaling when rendering the surface on that output.
+
+	Note that if the scale is larger than 1, then you have to attach
+	a buffer that is larger (by a factor of scale in each dimension)
+	than the desired surface size.
+
+	If scale is not positive the invalid_scale protocol error is
+	raised.
+      </description>
+      <arg name="scale" type="int"
+	   summary="positive scale for interpreting buffer contents"/>
+    </request>
+
+    <!-- Version 4 additions -->
+    <request name="damage_buffer" since="4">
+      <description summary="mark part of the surface damaged using buffer coordinates">
+	This request is used to describe the regions where the pending
+	buffer is different from the current surface contents, and where
+	the surface therefore needs to be repainted. The compositor
+	ignores the parts of the damage that fall outside of the surface.
+
+	Damage is double-buffered state, see wl_surface.commit.
+
+	The damage rectangle is specified in buffer coordinates,
+	where x and y specify the upper left corner of the damage rectangle.
+
+	The initial value for pending damage is empty: no damage.
+	wl_surface.damage_buffer adds pending damage: the new pending
+	damage is the union of old pending damage and the given rectangle.
+
+	wl_surface.commit assigns pending damage as the current damage,
+	and clears pending damage. The server will clear the current
+	damage as it repaints the surface.
+
+	This request differs from wl_surface.damage in only one way - it
+	takes damage in buffer coordinates instead of surface-local
+	coordinates. While this generally is more intuitive than surface
+	coordinates, it is especially desirable when using wp_viewport
+	or when a drawing library (like EGL) is unaware of buffer scale
+	and buffer transform.
+
+	Note: Because buffer transformation changes and damage requests may
+	be interleaved in the protocol stream, it is impossible to determine
+	the actual mapping between surface and buffer damage until
+	wl_surface.commit time. Therefore, compositors wishing to take both
+	kinds of damage into account will have to accumulate damage from the
+	two requests separately and only transform from one to the other
+	after receiving the wl_surface.commit.
+      </description>
+      <arg name="x" type="int" summary="buffer-local x coordinate"/>
+      <arg name="y" type="int" summary="buffer-local y coordinate"/>
+      <arg name="width" type="int" summary="width of damage rectangle"/>
+      <arg name="height" type="int" summary="height of damage rectangle"/>
+    </request>
+
+    <!-- Version 5 additions -->
+
+    <request name="offset" since="5">
+      <description summary="set the surface contents offset">
+	The x and y arguments specify the location of the new pending
+	buffer's upper left corner, relative to the current buffer's upper
+	left corner, in surface-local coordinates. In other words, the
+	x and y, combined with the new surface size define in which
+	directions the surface's size changes.
+
+	Surface location offset is double-buffered state, see
+	wl_surface.commit.
+
+	This request is semantically equivalent to and the replaces the x and y
+	arguments in the wl_surface.attach request in wl_surface versions prior
+	to 5. See wl_surface.attach for details.
+      </description>
+      <arg name="x" type="int" summary="surface-local x coordinate"/>
+      <arg name="y" type="int" summary="surface-local y coordinate"/>
+    </request>
+
+    <!-- Version 6 additions -->
+
+    <event name="preferred_buffer_scale" since="6">
+      <description summary="preferred buffer scale for the surface">
+	This event indicates the preferred buffer scale for this surface. It is
+	sent whenever the compositor's preference changes.
+
+	It is intended that scaling aware clients use this event to scale their
+	content and use wl_surface.set_buffer_scale to indicate the scale they
+	have rendered with. This allows clients to supply a higher detail
+	buffer.
+      </description>
+      <arg name="factor" type="int" summary="preferred scaling factor"/>
+    </event>
+
+    <event name="preferred_buffer_transform" since="6">
+      <description summary="preferred buffer transform for the surface">
+	This event indicates the preferred buffer transform for this surface.
+	It is sent whenever the compositor's preference changes.
+
+	It is intended that transform aware clients use this event to apply the
+	transform to their content and use wl_surface.set_buffer_transform to
+	indicate the transform they have rendered with.
+      </description>
+      <arg name="transform" type="uint" enum="wl_output.transform"
+	   summary="preferred transform"/>
+    </event>
+   </interface>
+
+  <interface name="wl_seat" version="9">
+    <description summary="group of input devices">
+      A seat is a group of keyboards, pointer and touch devices. This
+      object is published as a global during start up, or when such a
+      device is hot plugged.  A seat typically has a pointer and
+      maintains a keyboard focus and a pointer focus.
+    </description>
+
+    <enum name="capability" bitfield="true">
+      <description summary="seat capability bitmask">
+	This is a bitmask of capabilities this seat has; if a member is
+	set, then it is present on the seat.
+      </description>
+      <entry name="pointer" value="1" summary="the seat has pointer devices"/>
+      <entry name="keyboard" value="2" summary="the seat has one or more keyboards"/>
+      <entry name="touch" value="4" summary="the seat has touch devices"/>
+    </enum>
+
+    <enum name="error">
+      <description summary="wl_seat error values">
+	These errors can be emitted in response to wl_seat requests.
+      </description>
+      <entry name="missing_capability" value="0"
+	     summary="get_pointer, get_keyboard or get_touch called on seat without the matching capability"/>
+    </enum>
+
+    <event name="capabilities">
+      <description summary="seat capabilities changed">
+	This is emitted whenever a seat gains or loses the pointer,
+	keyboard or touch capabilities.  The argument is a capability
+	enum containing the complete set of capabilities this seat has.
+
+	When the pointer capability is added, a client may create a
+	wl_pointer object using the wl_seat.get_pointer request. This object
+	will receive pointer events until the capability is removed in the
+	future.
+
+	When the pointer capability is removed, a client should destroy the
+	wl_pointer objects associated with the seat where the capability was
+	removed, using the wl_pointer.release request. No further pointer
+	events will be received on these objects.
+
+	In some compositors, if a seat regains the pointer capability and a
+	client has a previously obtained wl_pointer object of version 4 or
+	less, that object may start sending pointer events again. This
+	behavior is considered a misinterpretation of the intended behavior
+	and must not be relied upon by the client. wl_pointer objects of
+	version 5 or later must not send events if created before the most
+	recent event notifying the client of an added pointer capability.
+
+	The above behavior also applies to wl_keyboard and wl_touch with the
+	keyboard and touch capabilities, respectively.
+      </description>
+      <arg name="capabilities" type="uint" enum="capability" summary="capabilities of the seat"/>
+    </event>
+
+    <request name="get_pointer">
+      <description summary="return pointer object">
+	The ID provided will be initialized to the wl_pointer interface
+	for this seat.
+
+	This request only takes effect if the seat has the pointer
+	capability, or has had the pointer capability in the past.
+	It is a protocol violation to issue this request on a seat that has
+	never had the pointer capability. The missing_capability error will
+	be sent in this case.
+      </description>
+      <arg name="id" type="new_id" interface="wl_pointer" summary="seat pointer"/>
+    </request>
+
+    <request name="get_keyboard">
+      <description summary="return keyboard object">
+	The ID provided will be initialized to the wl_keyboard interface
+	for this seat.
+
+	This request only takes effect if the seat has the keyboard
+	capability, or has had the keyboard capability in the past.
+	It is a protocol violation to issue this request on a seat that has
+	never had the keyboard capability. The missing_capability error will
+	be sent in this case.
+      </description>
+      <arg name="id" type="new_id" interface="wl_keyboard" summary="seat keyboard"/>
+    </request>
+
+    <request name="get_touch">
+      <description summary="return touch object">
+	The ID provided will be initialized to the wl_touch interface
+	for this seat.
+
+	This request only takes effect if the seat has the touch
+	capability, or has had the touch capability in the past.
+	It is a protocol violation to issue this request on a seat that has
+	never had the touch capability. The missing_capability error will
+	be sent in this case.
+      </description>
+      <arg name="id" type="new_id" interface="wl_touch" summary="seat touch interface"/>
+    </request>
+
+    <!-- Version 2 additions -->
+
+    <event name="name" since="2">
+      <description summary="unique identifier for this seat">
+	In a multi-seat configuration the seat name can be used by clients to
+	help identify which physical devices the seat represents.
+
+	The seat name is a UTF-8 string with no convention defined for its
+	contents. Each name is unique among all wl_seat globals. The name is
+	only guaranteed to be unique for the current compositor instance.
+
+	The same seat names are used for all clients. Thus, the name can be
+	shared across processes to refer to a specific wl_seat global.
+
+	The name event is sent after binding to the seat global. This event is
+	only sent once per seat object, and the name does not change over the
+	lifetime of the wl_seat global.
+
+	Compositors may re-use the same seat name if the wl_seat global is
+	destroyed and re-created later.
+      </description>
+      <arg name="name" type="string" summary="seat identifier"/>
+    </event>
+
+    <!-- Version 5 additions -->
+
+    <request name="release" type="destructor" since="5">
+      <description summary="release the seat object">
+	Using this request a client can tell the server that it is not going to
+	use the seat object anymore.
+      </description>
+    </request>
+
+  </interface>
+
+  <interface name="wl_pointer" version="9">
+    <description summary="pointer input device">
+      The wl_pointer interface represents one or more input devices,
+      such as mice, which control the pointer location and pointer_focus
+      of a seat.
+
+      The wl_pointer interface generates motion, enter and leave
+      events for the surfaces that the pointer is located over,
+      and button and axis events for button presses, button releases
+      and scrolling.
+    </description>
+
+    <enum name="error">
+      <entry name="role" value="0" summary="given wl_surface has another role"/>
+    </enum>
+
+    <request name="set_cursor">
+      <description summary="set the pointer surface">
+	Set the pointer surface, i.e., the surface that contains the
+	pointer image (cursor). This request gives the surface the role
+	of a cursor. If the surface already has another role, it raises
+	a protocol error.
+
+	The cursor actually changes only if the pointer
+	focus for this device is one of the requesting client's surfaces
+	or the surface parameter is the current pointer surface. If
+	there was a previous surface set with this request it is
+	replaced. If surface is NULL, the pointer image is hidden.
+
+	The parameters hotspot_x and hotspot_y define the position of
+	the pointer surface relative to the pointer location. Its
+	top-left corner is always at (x, y) - (hotspot_x, hotspot_y),
+	where (x, y) are the coordinates of the pointer location, in
+	surface-local coordinates.
+
+	On surface.attach requests to the pointer surface, hotspot_x
+	and hotspot_y are decremented by the x and y parameters
+	passed to the request. Attach must be confirmed by
+	wl_surface.commit as usual.
+
+	The hotspot can also be updated by passing the currently set
+	pointer surface to this request with new values for hotspot_x
+	and hotspot_y.
+
+	The input region is ignored for wl_surfaces with the role of
+	a cursor. When the use as a cursor ends, the wl_surface is
+	unmapped.
+
+	The serial parameter must match the latest wl_pointer.enter
+	serial number sent to the client. Otherwise the request will be
+	ignored.
+      </description>
+      <arg name="serial" type="uint" summary="serial number of the enter event"/>
+      <arg name="surface" type="object" interface="wl_surface" allow-null="true"
+	   summary="pointer surface"/>
+      <arg name="hotspot_x" type="int" summary="surface-local x coordinate"/>
+      <arg name="hotspot_y" type="int" summary="surface-local y coordinate"/>
+    </request>
+
+    <event name="enter">
+      <description summary="enter event">
+	Notification that this seat's pointer is focused on a certain
+	surface.
+
+	When a seat's focus enters a surface, the pointer image
+	is undefined and a client should respond to this event by setting
+	an appropriate pointer image with the set_cursor request.
+      </description>
+      <arg name="serial" type="uint" summary="serial number of the enter event"/>
+      <arg name="surface" type="object" interface="wl_surface" summary="surface entered by the pointer"/>
+      <arg name="surface_x" type="fixed" summary="surface-local x coordinate"/>
+      <arg name="surface_y" type="fixed" summary="surface-local y coordinate"/>
+    </event>
+
+    <event name="leave">
+      <description summary="leave event">
+	Notification that this seat's pointer is no longer focused on
+	a certain surface.
+
+	The leave notification is sent before the enter notification
+	for the new focus.
+      </description>
+      <arg name="serial" type="uint" summary="serial number of the leave event"/>
+      <arg name="surface" type="object" interface="wl_surface" summary="surface left by the pointer"/>
+    </event>
+
+    <event name="motion">
+      <description summary="pointer motion event">
+	Notification of pointer location change. The arguments
+	surface_x and surface_y are the location relative to the
+	focused surface.
+      </description>
+      <arg name="time" type="uint" summary="timestamp with millisecond granularity"/>
+      <arg name="surface_x" type="fixed" summary="surface-local x coordinate"/>
+      <arg name="surface_y" type="fixed" summary="surface-local y coordinate"/>
+    </event>
+
+    <enum name="button_state">
+      <description summary="physical button state">
+	Describes the physical state of a button that produced the button
+	event.
+      </description>
+      <entry name="released" value="0" summary="the button is not pressed"/>
+      <entry name="pressed" value="1" summary="the button is pressed"/>
+    </enum>
+
+    <event name="button">
+      <description summary="pointer button event">
+	Mouse button click and release notifications.
+
+	The location of the click is given by the last motion or
+	enter event.
+	The time argument is a timestamp with millisecond
+	granularity, with an undefined base.
+
+	The button is a button code as defined in the Linux kernel's
+	linux/input-event-codes.h header file, e.g. BTN_LEFT.
+
+	Any 16-bit button code value is reserved for future additions to the
+	kernel's event code list. All other button codes above 0xFFFF are
+	currently undefined but may be used in future versions of this
+	protocol.
+      </description>
+      <arg name="serial" type="uint" summary="serial number of the button event"/>
+      <arg name="time" type="uint" summary="timestamp with millisecond granularity"/>
+      <arg name="button" type="uint" summary="button that produced the event"/>
+      <arg name="state" type="uint" enum="button_state" summary="physical state of the button"/>
+    </event>
+
+    <enum name="axis">
+      <description summary="axis types">
+	Describes the axis types of scroll events.
+      </description>
+      <entry name="vertical_scroll" value="0" summary="vertical axis"/>
+      <entry name="horizontal_scroll" value="1" summary="horizontal axis"/>
+    </enum>
+
+    <event name="axis">
+      <description summary="axis event">
+	Scroll and other axis notifications.
+
+	For scroll events (vertical and horizontal scroll axes), the
+	value parameter is the length of a vector along the specified
+	axis in a coordinate space identical to those of motion events,
+	representing a relative movement along the specified axis.
+
+	For devices that support movements non-parallel to axes multiple
+	axis events will be emitted.
+
+	When applicable, for example for touch pads, the server can
+	choose to emit scroll events where the motion vector is
+	equivalent to a motion event vector.
+
+	When applicable, a client can transform its content relative to the
+	scroll distance.
+      </description>
+      <arg name="time" type="uint" summary="timestamp with millisecond granularity"/>
+      <arg name="axis" type="uint" enum="axis" summary="axis type"/>
+      <arg name="value" type="fixed" summary="length of vector in surface-local coordinate space"/>
+    </event>
+
+    <!-- Version 3 additions -->
+
+    <request name="release" type="destructor" since="3">
+      <description summary="release the pointer object">
+	Using this request a client can tell the server that it is not going to
+	use the pointer object anymore.
+
+	This request destroys the pointer proxy object, so clients must not call
+	wl_pointer_destroy() after using this request.
+      </description>
+    </request>
+
+    <!-- Version 5 additions -->
+
+    <event name="frame" since="5">
+      <description summary="end of a pointer event sequence">
+	Indicates the end of a set of events that logically belong together.
+	A client is expected to accumulate the data in all events within the
+	frame before proceeding.
+
+	All wl_pointer events before a wl_pointer.frame event belong
+	logically together. For example, in a diagonal scroll motion the
+	compositor will send an optional wl_pointer.axis_source event, two
+	wl_pointer.axis events (horizontal and vertical) and finally a
+	wl_pointer.frame event. The client may use this information to
+	calculate a diagonal vector for scrolling.
+
+	When multiple wl_pointer.axis events occur within the same frame,
+	the motion vector is the combined motion of all events.
+	When a wl_pointer.axis and a wl_pointer.axis_stop event occur within
+	the same frame, this indicates that axis movement in one axis has
+	stopped but continues in the other axis.
+	When multiple wl_pointer.axis_stop events occur within the same
+	frame, this indicates that these axes stopped in the same instance.
+
+	A wl_pointer.frame event is sent for every logical event group,
+	even if the group only contains a single wl_pointer event.
+	Specifically, a client may get a sequence: motion, frame, button,
+	frame, axis, frame, axis_stop, frame.
+
+	The wl_pointer.enter and wl_pointer.leave events are logical events
+	generated by the compositor and not the hardware. These events are
+	also grouped by a wl_pointer.frame. When a pointer moves from one
+	surface to another, a compositor should group the
+	wl_pointer.leave event within the same wl_pointer.frame.
+	However, a client must not rely on wl_pointer.leave and
+	wl_pointer.enter being in the same wl_pointer.frame.
+	Compositor-specific policies may require the wl_pointer.leave and
+	wl_pointer.enter event being split across multiple wl_pointer.frame
+	groups.
+      </description>
+    </event>
+
+    <enum name="axis_source">
+      <description summary="axis source types">
+	Describes the source types for axis events. This indicates to the
+	client how an axis event was physically generated; a client may
+	adjust the user interface accordingly. For example, scroll events
+	from a "finger" source may be in a smooth coordinate space with
+	kinetic scrolling whereas a "wheel" source may be in discrete steps
+	of a number of lines.
+
+	The "continuous" axis source is a device generating events in a
+	continuous coordinate space, but using something other than a
+	finger. One example for this source is button-based scrolling where
+	the vertical motion of a device is converted to scroll events while
+	a button is held down.
+
+	The "wheel tilt" axis source indicates that the actual device is a
+	wheel but the scroll event is not caused by a rotation but a
+	(usually sideways) tilt of the wheel.
+      </description>
+      <entry name="wheel" value="0" summary="a physical wheel rotation" />
+      <entry name="finger" value="1" summary="finger on a touch surface" />
+      <entry name="continuous" value="2" summary="continuous coordinate space"/>
+      <entry name="wheel_tilt" value="3" summary="a physical wheel tilt" since="6"/>
+    </enum>
+
+    <event name="axis_source" since="5">
+      <description summary="axis source event">
+	Source information for scroll and other axes.
+
+	This event does not occur on its own. It is sent before a
+	wl_pointer.frame event and carries the source information for
+	all events within that frame.
+
+	The source specifies how this event was generated. If the source is
+	wl_pointer.axis_source.finger, a wl_pointer.axis_stop event will be
+	sent when the user lifts the finger off the device.
+
+	If the source is wl_pointer.axis_source.wheel,
+	wl_pointer.axis_source.wheel_tilt or
+	wl_pointer.axis_source.continuous, a wl_pointer.axis_stop event may
+	or may not be sent. Whether a compositor sends an axis_stop event
+	for these sources is hardware-specific and implementation-dependent;
+	clients must not rely on receiving an axis_stop event for these
+	scroll sources and should treat scroll sequences from these scroll
+	sources as unterminated by default.
+
+	This event is optional. If the source is unknown for a particular
+	axis event sequence, no event is sent.
+	Only one wl_pointer.axis_source event is permitted per frame.
+
+	The order of wl_pointer.axis_discrete and wl_pointer.axis_source is
+	not guaranteed.
+      </description>
+      <arg name="axis_source" type="uint" enum="axis_source" summary="source of the axis event"/>
+    </event>
+
+    <event name="axis_stop" since="5">
+      <description summary="axis stop event">
+	Stop notification for scroll and other axes.
+
+	For some wl_pointer.axis_source types, a wl_pointer.axis_stop event
+	is sent to notify a client that the axis sequence has terminated.
+	This enables the client to implement kinetic scrolling.
+	See the wl_pointer.axis_source documentation for information on when
+	this event may be generated.
+
+	Any wl_pointer.axis events with the same axis_source after this
+	event should be considered as the start of a new axis motion.
+
+	The timestamp is to be interpreted identical to the timestamp in the
+	wl_pointer.axis event. The timestamp value may be the same as a
+	preceding wl_pointer.axis event.
+      </description>
+      <arg name="time" type="uint" summary="timestamp with millisecond granularity"/>
+      <arg name="axis" type="uint" enum="axis" summary="the axis stopped with this event"/>
+    </event>
+
+    <event name="axis_discrete" since="5">
+      <description summary="axis click event">
+	Discrete step information for scroll and other axes.
+
+	This event carries the axis value of the wl_pointer.axis event in
+	discrete steps (e.g. mouse wheel clicks).
+
+	This event is deprecated with wl_pointer version 8 - this event is not
+	sent to clients supporting version 8 or later.
+
+	This event does not occur on its own, it is coupled with a
+	wl_pointer.axis event that represents this axis value on a
+	continuous scale. The protocol guarantees that each axis_discrete
+	event is always followed by exactly one axis event with the same
+	axis number within the same wl_pointer.frame. Note that the protocol
+	allows for other events to occur between the axis_discrete and
+	its coupled axis event, including other axis_discrete or axis
+	events. A wl_pointer.frame must not contain more than one axis_discrete
+	event per axis type.
+
+	This event is optional; continuous scrolling devices
+	like two-finger scrolling on touchpads do not have discrete
+	steps and do not generate this event.
+
+	The discrete value carries the directional information. e.g. a value
+	of -2 is two steps towards the negative direction of this axis.
+
+	The axis number is identical to the axis number in the associated
+	axis event.
+
+	The order of wl_pointer.axis_discrete and wl_pointer.axis_source is
+	not guaranteed.
+      </description>
+      <arg name="axis" type="uint" enum="axis" summary="axis type"/>
+      <arg name="discrete" type="int" summary="number of steps"/>
+    </event>
+
+    <event name="axis_value120" since="8">
+      <description summary="axis high-resolution scroll event">
+	Discrete high-resolution scroll information.
+
+	This event carries high-resolution wheel scroll information,
+	with each multiple of 120 representing one logical scroll step
+	(a wheel detent). For example, an axis_value120 of 30 is one quarter of
+	a logical scroll step in the positive direction, a value120 of
+	-240 are two logical scroll steps in the negative direction within the
+	same hardware event.
+	Clients that rely on discrete scrolling should accumulate the
+	value120 to multiples of 120 before processing the event.
+
+	The value120 must not be zero.
+
+	This event replaces the wl_pointer.axis_discrete event in clients
+	supporting wl_pointer version 8 or later.
+
+	Where a wl_pointer.axis_source event occurs in the same
+	wl_pointer.frame, the axis source applies to this event.
+
+	The order of wl_pointer.axis_value120 and wl_pointer.axis_source is
+	not guaranteed.
+      </description>
+      <arg name="axis" type="uint" enum="axis" summary="axis type"/>
+      <arg name="value120" type="int" summary="scroll distance as fraction of 120"/>
+    </event>
+
+    <!-- Version 9 additions -->
+
+    <enum name="axis_relative_direction">
+      <description summary="axis relative direction">
+	This specifies the direction of the physical motion that caused a
+	wl_pointer.axis event, relative to the wl_pointer.axis direction.
+      </description>
+      <entry name="identical" value="0"
+	  summary="physical motion matches axis direction"/>
+      <entry name="inverted" value="1"
+	  summary="physical motion is the inverse of the axis direction"/>
+    </enum>
+
+    <event name="axis_relative_direction" since="9">
+      <description summary="axis relative physical direction event">
+	Relative directional information of the entity causing the axis
+	motion.
+
+	For a wl_pointer.axis event, the wl_pointer.axis_relative_direction
+	event specifies the movement direction of the entity causing the
+	wl_pointer.axis event. For example:
+	- if a user's fingers on a touchpad move down and this
+	  causes a wl_pointer.axis vertical_scroll down event, the physical
+	  direction is 'identical'
+	- if a user's fingers on a touchpad move down and this causes a
+	  wl_pointer.axis vertical_scroll up scroll up event ('natural
+	  scrolling'), the physical direction is 'inverted'.
+
+	A client may use this information to adjust scroll motion of
+	components. Specifically, enabling natural scrolling causes the
+	content to change direction compared to traditional scrolling.
+	Some widgets like volume control sliders should usually match the
+	physical direction regardless of whether natural scrolling is
+	active. This event enables clients to match the scroll direction of
+	a widget to the physical direction.
+
+	This event does not occur on its own, it is coupled with a
+	wl_pointer.axis event that represents this axis value.
+	The protocol guarantees that each axis_relative_direction event is
+	always followed by exactly one axis event with the same
+	axis number within the same wl_pointer.frame. Note that the protocol
+	allows for other events to occur between the axis_relative_direction
+	and its coupled axis event.
+
+	The axis number is identical to the axis number in the associated
+	axis event.
+
+	The order of wl_pointer.axis_relative_direction,
+	wl_pointer.axis_discrete and wl_pointer.axis_source is not
+	guaranteed.
+      </description>
+      <arg name="axis" type="uint" enum="axis" summary="axis type"/>
+      <arg name="direction" type="uint" enum="axis_relative_direction"
+	  summary="physical direction relative to axis motion"/>
+    </event>
+  </interface>
+
+  <interface name="wl_keyboard" version="9">
+    <description summary="keyboard input device">
+      The wl_keyboard interface represents one or more keyboards
+      associated with a seat.
+    </description>
+
+    <enum name="keymap_format">
+      <description summary="keyboard mapping format">
+	This specifies the format of the keymap provided to the
+	client with the wl_keyboard.keymap event.
+      </description>
+      <entry name="no_keymap" value="0"
+	     summary="no keymap; client must understand how to interpret the raw keycode"/>
+      <entry name="xkb_v1" value="1"
+	     summary="libxkbcommon compatible, null-terminated string; to determine the xkb keycode, clients must add 8 to the key event keycode"/>
+    </enum>
+
+    <event name="keymap">
+      <description summary="keyboard mapping">
+	This event provides a file descriptor to the client which can be
+	memory-mapped in read-only mode to provide a keyboard mapping
+	description.
+
+	From version 7 onwards, the fd must be mapped with MAP_PRIVATE by
+	the recipient, as MAP_SHARED may fail.
+      </description>
+      <arg name="format" type="uint" enum="keymap_format" summary="keymap format"/>
+      <arg name="fd" type="fd" summary="keymap file descriptor"/>
+      <arg name="size" type="uint" summary="keymap size, in bytes"/>
+    </event>
+
+    <event name="enter">
+      <description summary="enter event">
+	Notification that this seat's keyboard focus is on a certain
+	surface.
+
+	The compositor must send the wl_keyboard.modifiers event after this
+	event.
+      </description>
+      <arg name="serial" type="uint" summary="serial number of the enter event"/>
+      <arg name="surface" type="object" interface="wl_surface" summary="surface gaining keyboard focus"/>
+      <arg name="keys" type="array" summary="the currently pressed keys"/>
+    </event>
+
+    <event name="leave">
+      <description summary="leave event">
+	Notification that this seat's keyboard focus is no longer on
+	a certain surface.
+
+	The leave notification is sent before the enter notification
+	for the new focus.
+
+	After this event client must assume that all keys, including modifiers,
+	are lifted and also it must stop key repeating if there's some going on.
+      </description>
+      <arg name="serial" type="uint" summary="serial number of the leave event"/>
+      <arg name="surface" type="object" interface="wl_surface" summary="surface that lost keyboard focus"/>
+    </event>
+
+    <enum name="key_state">
+      <description summary="physical key state">
+	Describes the physical state of a key that produced the key event.
+      </description>
+      <entry name="released" value="0" summary="key is not pressed"/>
+      <entry name="pressed" value="1" summary="key is pressed"/>
+    </enum>
+
+    <event name="key">
+      <description summary="key event">
+	A key was pressed or released.
+	The time argument is a timestamp with millisecond
+	granularity, with an undefined base.
+
+	The key is a platform-specific key code that can be interpreted
+	by feeding it to the keyboard mapping (see the keymap event).
+
+	If this event produces a change in modifiers, then the resulting
+	wl_keyboard.modifiers event must be sent after this event.
+      </description>
+      <arg name="serial" type="uint" summary="serial number of the key event"/>
+      <arg name="time" type="uint" summary="timestamp with millisecond granularity"/>
+      <arg name="key" type="uint" summary="key that produced the event"/>
+      <arg name="state" type="uint" enum="key_state" summary="physical state of the key"/>
+    </event>
+
+    <event name="modifiers">
+      <description summary="modifier and group state">
+	Notifies clients that the modifier and/or group state has
+	changed, and it should update its local state.
+      </description>
+      <arg name="serial" type="uint" summary="serial number of the modifiers event"/>
+      <arg name="mods_depressed" type="uint" summary="depressed modifiers"/>
+      <arg name="mods_latched" type="uint" summary="latched modifiers"/>
+      <arg name="mods_locked" type="uint" summary="locked modifiers"/>
+      <arg name="group" type="uint" summary="keyboard layout"/>
+    </event>
+
+    <!-- Version 3 additions -->
+
+    <request name="release" type="destructor" since="3">
+      <description summary="release the keyboard object"/>
+    </request>
+
+    <!-- Version 4 additions -->
+
+    <event name="repeat_info" since="4">
+      <description summary="repeat rate and delay">
+	Informs the client about the keyboard's repeat rate and delay.
+
+	This event is sent as soon as the wl_keyboard object has been created,
+	and is guaranteed to be received by the client before any key press
+	event.
+
+	Negative values for either rate or delay are illegal. A rate of zero
+	will disable any repeating (regardless of the value of delay).
+
+	This event can be sent later on as well with a new value if necessary,
+	so clients should continue listening for the event past the creation
+	of wl_keyboard.
+      </description>
+      <arg name="rate" type="int"
+	   summary="the rate of repeating keys in characters per second"/>
+      <arg name="delay" type="int"
+	   summary="delay in milliseconds since key down until repeating starts"/>
+    </event>
+  </interface>
+
+  <interface name="wl_touch" version="9">
+    <description summary="touchscreen input device">
+      The wl_touch interface represents a touchscreen
+      associated with a seat.
+
+      Touch interactions can consist of one or more contacts.
+      For each contact, a series of events is generated, starting
+      with a down event, followed by zero or more motion events,
+      and ending with an up event. Events relating to the same
+      contact point can be identified by the ID of the sequence.
+    </description>
+
+    <event name="down">
+      <description summary="touch down event and beginning of a touch sequence">
+	A new touch point has appeared on the surface. This touch point is
+	assigned a unique ID. Future events from this touch point reference
+	this ID. The ID ceases to be valid after a touch up event and may be
+	reused in the future.
+      </description>
+      <arg name="serial" type="uint" summary="serial number of the touch down event"/>
+      <arg name="time" type="uint" summary="timestamp with millisecond granularity"/>
+      <arg name="surface" type="object" interface="wl_surface" summary="surface touched"/>
+      <arg name="id" type="int" summary="the unique ID of this touch point"/>
+      <arg name="x" type="fixed" summary="surface-local x coordinate"/>
+      <arg name="y" type="fixed" summary="surface-local y coordinate"/>
+    </event>
+
+    <event name="up">
+      <description summary="end of a touch event sequence">
+	The touch point has disappeared. No further events will be sent for
+	this touch point and the touch point's ID is released and may be
+	reused in a future touch down event.
+      </description>
+      <arg name="serial" type="uint" summary="serial number of the touch up event"/>
+      <arg name="time" type="uint" summary="timestamp with millisecond granularity"/>
+      <arg name="id" type="int" summary="the unique ID of this touch point"/>
+    </event>
+
+    <event name="motion">
+      <description summary="update of touch point coordinates">
+	A touch point has changed coordinates.
+      </description>
+      <arg name="time" type="uint" summary="timestamp with millisecond granularity"/>
+      <arg name="id" type="int" summary="the unique ID of this touch point"/>
+      <arg name="x" type="fixed" summary="surface-local x coordinate"/>
+      <arg name="y" type="fixed" summary="surface-local y coordinate"/>
+    </event>
+
+    <event name="frame">
+      <description summary="end of touch frame event">
+	Indicates the end of a set of events that logically belong together.
+	A client is expected to accumulate the data in all events within the
+	frame before proceeding.
+
+	A wl_touch.frame terminates at least one event but otherwise no
+	guarantee is provided about the set of events within a frame. A client
+	must assume that any state not updated in a frame is unchanged from the
+	previously known state.
+      </description>
+    </event>
+
+    <event name="cancel">
+      <description summary="touch session cancelled">
+	Sent if the compositor decides the touch stream is a global
+	gesture. No further events are sent to the clients from that
+	particular gesture. Touch cancellation applies to all touch points
+	currently active on this client's surface. The client is
+	responsible for finalizing the touch points, future touch points on
+	this surface may reuse the touch point ID.
+      </description>
+    </event>
+
+    <!-- Version 3 additions -->
+
+    <request name="release" type="destructor" since="3">
+      <description summary="release the touch object"/>
+    </request>
+
+    <!-- Version 6 additions -->
+
+    <event name="shape" since="6">
+      <description summary="update shape of touch point">
+	Sent when a touchpoint has changed its shape.
+
+	This event does not occur on its own. It is sent before a
+	wl_touch.frame event and carries the new shape information for
+	any previously reported, or new touch points of that frame.
+
+	Other events describing the touch point such as wl_touch.down,
+	wl_touch.motion or wl_touch.orientation may be sent within the
+	same wl_touch.frame. A client should treat these events as a single
+	logical touch point update. The order of wl_touch.shape,
+	wl_touch.orientation and wl_touch.motion is not guaranteed.
+	A wl_touch.down event is guaranteed to occur before the first
+	wl_touch.shape event for this touch ID but both events may occur within
+	the same wl_touch.frame.
+
+	A touchpoint shape is approximated by an ellipse through the major and
+	minor axis length. The major axis length describes the longer diameter
+	of the ellipse, while the minor axis length describes the shorter
+	diameter. Major and minor are orthogonal and both are specified in
+	surface-local coordinates. The center of the ellipse is always at the
+	touchpoint location as reported by wl_touch.down or wl_touch.move.
+
+	This event is only sent by the compositor if the touch device supports
+	shape reports. The client has to make reasonable assumptions about the
+	shape if it did not receive this event.
+      </description>
+      <arg name="id" type="int" summary="the unique ID of this touch point"/>
+      <arg name="major" type="fixed" summary="length of the major axis in surface-local coordinates"/>
+      <arg name="minor" type="fixed" summary="length of the minor axis in surface-local coordinates"/>
+    </event>
+
+    <event name="orientation" since="6">
+      <description summary="update orientation of touch point">
+	Sent when a touchpoint has changed its orientation.
+
+	This event does not occur on its own. It is sent before a
+	wl_touch.frame event and carries the new shape information for
+	any previously reported, or new touch points of that frame.
+
+	Other events describing the touch point such as wl_touch.down,
+	wl_touch.motion or wl_touch.shape may be sent within the
+	same wl_touch.frame. A client should treat these events as a single
+	logical touch point update. The order of wl_touch.shape,
+	wl_touch.orientation and wl_touch.motion is not guaranteed.
+	A wl_touch.down event is guaranteed to occur before the first
+	wl_touch.orientation event for this touch ID but both events may occur
+	within the same wl_touch.frame.
+
+	The orientation describes the clockwise angle of a touchpoint's major
+	axis to the positive surface y-axis and is normalized to the -180 to
+	+180 degree range. The granularity of orientation depends on the touch
+	device, some devices only support binary rotation values between 0 and
+	90 degrees.
+
+	This event is only sent by the compositor if the touch device supports
+	orientation reports.
+      </description>
+      <arg name="id" type="int" summary="the unique ID of this touch point"/>
+      <arg name="orientation" type="fixed" summary="angle between major axis and positive surface y-axis in degrees"/>
+    </event>
+  </interface>
+
+  <interface name="wl_output" version="4">
+    <description summary="compositor output region">
+      An output describes part of the compositor geometry.  The
+      compositor works in the 'compositor coordinate system' and an
+      output corresponds to a rectangular area in that space that is
+      actually visible.  This typically corresponds to a monitor that
+      displays part of the compositor space.  This object is published
+      as global during start up, or when a monitor is hotplugged.
+    </description>
+
+    <enum name="subpixel">
+      <description summary="subpixel geometry information">
+	This enumeration describes how the physical
+	pixels on an output are laid out.
+      </description>
+      <entry name="unknown" value="0" summary="unknown geometry"/>
+      <entry name="none" value="1" summary="no geometry"/>
+      <entry name="horizontal_rgb" value="2" summary="horizontal RGB"/>
+      <entry name="horizontal_bgr" value="3" summary="horizontal BGR"/>
+      <entry name="vertical_rgb" value="4" summary="vertical RGB"/>
+      <entry name="vertical_bgr" value="5" summary="vertical BGR"/>
+    </enum>
+
+    <enum name="transform">
+      <description summary="transform from framebuffer to output">
+	This describes the transform that a compositor will apply to a
+	surface to compensate for the rotation or mirroring of an
+	output device.
+
+	The flipped values correspond to an initial flip around a
+	vertical axis followed by rotation.
+
+	The purpose is mainly to allow clients to render accordingly and
+	tell the compositor, so that for fullscreen surfaces, the
+	compositor will still be able to scan out directly from client
+	surfaces.
+      </description>
+      <entry name="normal" value="0" summary="no transform"/>
+      <entry name="90" value="1" summary="90 degrees counter-clockwise"/>
+      <entry name="180" value="2" summary="180 degrees counter-clockwise"/>
+      <entry name="270" value="3" summary="270 degrees counter-clockwise"/>
+      <entry name="flipped" value="4" summary="180 degree flip around a vertical axis"/>
+      <entry name="flipped_90" value="5" summary="flip and rotate 90 degrees counter-clockwise"/>
+      <entry name="flipped_180" value="6" summary="flip and rotate 180 degrees counter-clockwise"/>
+      <entry name="flipped_270" value="7" summary="flip and rotate 270 degrees counter-clockwise"/>
+    </enum>
+
+    <event name="geometry">
+      <description summary="properties of the output">
+	The geometry event describes geometric properties of the output.
+	The event is sent when binding to the output object and whenever
+	any of the properties change.
+
+	The physical size can be set to zero if it doesn't make sense for this
+	output (e.g. for projectors or virtual outputs).
+
+	The geometry event will be followed by a done event (starting from
+	version 2).
+
+	Note: wl_output only advertises partial information about the output
+	position and identification. Some compositors, for instance those not
+	implementing a desktop-style output layout or those exposing virtual
+	outputs, might fake this information. Instead of using x and y, clients
+	should use xdg_output.logical_position. Instead of using make and model,
+	clients should use name and description.
+      </description>
+      <arg name="x" type="int"
+	   summary="x position within the global compositor space"/>
+      <arg name="y" type="int"
+	   summary="y position within the global compositor space"/>
+      <arg name="physical_width" type="int"
+	   summary="width in millimeters of the output"/>
+      <arg name="physical_height" type="int"
+	   summary="height in millimeters of the output"/>
+      <arg name="subpixel" type="int" enum="subpixel"
+	   summary="subpixel orientation of the output"/>
+      <arg name="make" type="string"
+	   summary="textual description of the manufacturer"/>
+      <arg name="model" type="string"
+	   summary="textual description of the model"/>
+      <arg name="transform" type="int" enum="transform"
+	   summary="transform that maps framebuffer to output"/>
+    </event>
+
+    <enum name="mode" bitfield="true">
+      <description summary="mode information">
+	These flags describe properties of an output mode.
+	They are used in the flags bitfield of the mode event.
+      </description>
+      <entry name="current" value="0x1"
+	     summary="indicates this is the current mode"/>
+      <entry name="preferred" value="0x2"
+	     summary="indicates this is the preferred mode"/>
+    </enum>
+
+    <event name="mode">
+      <description summary="advertise available modes for the output">
+	The mode event describes an available mode for the output.
+
+	The event is sent when binding to the output object and there
+	will always be one mode, the current mode.  The event is sent
+	again if an output changes mode, for the mode that is now
+	current.  In other words, the current mode is always the last
+	mode that was received with the current flag set.
+
+	Non-current modes are deprecated. A compositor can decide to only
+	advertise the current mode and never send other modes. Clients
+	should not rely on non-current modes.
+
+	The size of a mode is given in physical hardware units of
+	the output device. This is not necessarily the same as
+	the output size in the global compositor space. For instance,
+	the output may be scaled, as described in wl_output.scale,
+	or transformed, as described in wl_output.transform. Clients
+	willing to retrieve the output size in the global compositor
+	space should use xdg_output.logical_size instead.
+
+	The vertical refresh rate can be set to zero if it doesn't make
+	sense for this output (e.g. for virtual outputs).
+
+	The mode event will be followed by a done event (starting from
+	version 2).
+
+	Clients should not use the refresh rate to schedule frames. Instead,
+	they should use the wl_surface.frame event or the presentation-time
+	protocol.
+
+	Note: this information is not always meaningful for all outputs. Some
+	compositors, such as those exposing virtual outputs, might fake the
+	refresh rate or the size.
+      </description>
+      <arg name="flags" type="uint" enum="mode" summary="bitfield of mode flags"/>
+      <arg name="width" type="int" summary="width of the mode in hardware units"/>
+      <arg name="height" type="int" summary="height of the mode in hardware units"/>
+      <arg name="refresh" type="int" summary="vertical refresh rate in mHz"/>
+    </event>
+
+    <!-- Version 2 additions -->
+
+    <event name="done" since="2">
+      <description summary="sent all information about output">
+	This event is sent after all other properties have been
+	sent after binding to the output object and after any
+	other property changes done after that. This allows
+	changes to the output properties to be seen as
+	atomic, even if they happen via multiple events.
+      </description>
+    </event>
+
+    <event name="scale" since="2">
+      <description summary="output scaling properties">
+	This event contains scaling geometry information
+	that is not in the geometry event. It may be sent after
+	binding the output object or if the output scale changes
+	later. If it is not sent, the client should assume a
+	scale of 1.
+
+	A scale larger than 1 means that the compositor will
+	automatically scale surface buffers by this amount
+	when rendering. This is used for very high resolution
+	displays where applications rendering at the native
+	resolution would be too small to be legible.
+
+	It is intended that scaling aware clients track the
+	current output of a surface, and if it is on a scaled
+	output it should use wl_surface.set_buffer_scale with
+	the scale of the output. That way the compositor can
+	avoid scaling the surface, and the client can supply
+	a higher detail image.
+
+	The scale event will be followed by a done event.
+      </description>
+      <arg name="factor" type="int" summary="scaling factor of output"/>
+    </event>
+
+    <!-- Version 3 additions -->
+
+    <request name="release" type="destructor" since="3">
+      <description summary="release the output object">
+	Using this request a client can tell the server that it is not going to
+	use the output object anymore.
+      </description>
+    </request>
+
+    <!-- Version 4 additions -->
+
+    <event name="name" since="4">
+      <description summary="name of this output">
+	Many compositors will assign user-friendly names to their outputs, show
+	them to the user, allow the user to refer to an output, etc. The client
+	may wish to know this name as well to offer the user similar behaviors.
+
+	The name is a UTF-8 string with no convention defined for its contents.
+	Each name is unique among all wl_output globals. The name is only
+	guaranteed to be unique for the compositor instance.
+
+	The same output name is used for all clients for a given wl_output
+	global. Thus, the name can be shared across processes to refer to a
+	specific wl_output global.
+
+	The name is not guaranteed to be persistent across sessions, thus cannot
+	be used to reliably identify an output in e.g. configuration files.
+
+	Examples of names include 'HDMI-A-1', 'WL-1', 'X11-1', etc. However, do
+	not assume that the name is a reflection of an underlying DRM connector,
+	X11 connection, etc.
+
+	The name event is sent after binding the output object. This event is
+	only sent once per output object, and the name does not change over the
+	lifetime of the wl_output global.
+
+	Compositors may re-use the same output name if the wl_output global is
+	destroyed and re-created later. Compositors should avoid re-using the
+	same name if possible.
+
+	The name event will be followed by a done event.
+      </description>
+      <arg name="name" type="string" summary="output name"/>
+    </event>
+
+    <event name="description" since="4">
+      <description summary="human-readable description of this output">
+	Many compositors can produce human-readable descriptions of their
+	outputs. The client may wish to know this description as well, e.g. for
+	output selection purposes.
+
+	The description is a UTF-8 string with no convention defined for its
+	contents. The description is not guaranteed to be unique among all
+	wl_output globals. Examples might include 'Foocorp 11" Display' or
+	'Virtual X11 output via :1'.
+
+	The description event is sent after binding the output object and
+	whenever the description changes. The description is optional, and may
+	not be sent at all.
+
+	The description event will be followed by a done event.
+      </description>
+      <arg name="description" type="string" summary="output description"/>
+    </event>
+  </interface>
+
+  <interface name="wl_region" version="1">
+    <description summary="region interface">
+      A region object describes an area.
+
+      Region objects are used to describe the opaque and input
+      regions of a surface.
+    </description>
+
+    <request name="destroy" type="destructor">
+      <description summary="destroy region">
+	Destroy the region.  This will invalidate the object ID.
+      </description>
+    </request>
+
+    <request name="add">
+      <description summary="add rectangle to region">
+	Add the specified rectangle to the region.
+      </description>
+      <arg name="x" type="int" summary="region-local x coordinate"/>
+      <arg name="y" type="int" summary="region-local y coordinate"/>
+      <arg name="width" type="int" summary="rectangle width"/>
+      <arg name="height" type="int" summary="rectangle height"/>
+    </request>
+
+    <request name="subtract">
+      <description summary="subtract rectangle from region">
+	Subtract the specified rectangle from the region.
+      </description>
+      <arg name="x" type="int" summary="region-local x coordinate"/>
+      <arg name="y" type="int" summary="region-local y coordinate"/>
+      <arg name="width" type="int" summary="rectangle width"/>
+      <arg name="height" type="int" summary="rectangle height"/>
+    </request>
+  </interface>
+
+  <interface name="wl_subcompositor" version="1">
+    <description summary="sub-surface compositing">
+      The global interface exposing sub-surface compositing capabilities.
+      A wl_surface, that has sub-surfaces associated, is called the
+      parent surface. Sub-surfaces can be arbitrarily nested and create
+      a tree of sub-surfaces.
+
+      The root surface in a tree of sub-surfaces is the main
+      surface. The main surface cannot be a sub-surface, because
+      sub-surfaces must always have a parent.
+
+      A main surface with its sub-surfaces forms a (compound) window.
+      For window management purposes, this set of wl_surface objects is
+      to be considered as a single window, and it should also behave as
+      such.
+
+      The aim of sub-surfaces is to offload some of the compositing work
+      within a window from clients to the compositor. A prime example is
+      a video player with decorations and video in separate wl_surface
+      objects. This should allow the compositor to pass YUV video buffer
+      processing to dedicated overlay hardware when possible.
+    </description>
+
+    <request name="destroy" type="destructor">
+      <description summary="unbind from the subcompositor interface">
+	Informs the server that the client will not be using this
+	protocol object anymore. This does not affect any other
+	objects, wl_subsurface objects included.
+      </description>
+    </request>
+
+    <enum name="error">
+      <entry name="bad_surface" value="0"
+	     summary="the to-be sub-surface is invalid"/>
+      <entry name="bad_parent" value="1"
+	     summary="the to-be sub-surface parent is invalid"/>
+    </enum>
+
+    <request name="get_subsurface">
+      <description summary="give a surface the role sub-surface">
+	Create a sub-surface interface for the given surface, and
+	associate it with the given parent surface. This turns a
+	plain wl_surface into a sub-surface.
+
+	The to-be sub-surface must not already have another role, and it
+	must not have an existing wl_subsurface object. Otherwise the
+	bad_surface protocol error is raised.
+
+	Adding sub-surfaces to a parent is a double-buffered operation on the
+	parent (see wl_surface.commit). The effect of adding a sub-surface
+	becomes visible on the next time the state of the parent surface is
+	applied.
+
+	The parent surface must not be one of the child surface's descendants,
+	and the parent must be different from the child surface, otherwise the
+	bad_parent protocol error is raised.
+
+	This request modifies the behaviour of wl_surface.commit request on
+	the sub-surface, see the documentation on wl_subsurface interface.
+      </description>
+      <arg name="id" type="new_id" interface="wl_subsurface"
+	   summary="the new sub-surface object ID"/>
+      <arg name="surface" type="object" interface="wl_surface"
+	   summary="the surface to be turned into a sub-surface"/>
+      <arg name="parent" type="object" interface="wl_surface"
+	   summary="the parent surface"/>
+    </request>
+  </interface>
+
+  <interface name="wl_subsurface" version="1">
+    <description summary="sub-surface interface to a wl_surface">
+      An additional interface to a wl_surface object, which has been
+      made a sub-surface. A sub-surface has one parent surface. A
+      sub-surface's size and position are not limited to that of the parent.
+      Particularly, a sub-surface is not automatically clipped to its
+      parent's area.
+
+      A sub-surface becomes mapped, when a non-NULL wl_buffer is applied
+      and the parent surface is mapped. The order of which one happens
+      first is irrelevant. A sub-surface is hidden if the parent becomes
+      hidden, or if a NULL wl_buffer is applied. These rules apply
+      recursively through the tree of surfaces.
+
+      The behaviour of a wl_surface.commit request on a sub-surface
+      depends on the sub-surface's mode. The possible modes are
+      synchronized and desynchronized, see methods
+      wl_subsurface.set_sync and wl_subsurface.set_desync. Synchronized
+      mode caches the wl_surface state to be applied when the parent's
+      state gets applied, and desynchronized mode applies the pending
+      wl_surface state directly. A sub-surface is initially in the
+      synchronized mode.
+
+      Sub-surfaces also have another kind of state, which is managed by
+      wl_subsurface requests, as opposed to wl_surface requests. This
+      state includes the sub-surface position relative to the parent
+      surface (wl_subsurface.set_position), and the stacking order of
+      the parent and its sub-surfaces (wl_subsurface.place_above and
+      .place_below). This state is applied when the parent surface's
+      wl_surface state is applied, regardless of the sub-surface's mode.
+      As the exception, set_sync and set_desync are effective immediately.
+
+      The main surface can be thought to be always in desynchronized mode,
+      since it does not have a parent in the sub-surfaces sense.
+
+      Even if a sub-surface is in desynchronized mode, it will behave as
+      in synchronized mode, if its parent surface behaves as in
+      synchronized mode. This rule is applied recursively throughout the
+      tree of surfaces. This means, that one can set a sub-surface into
+      synchronized mode, and then assume that all its child and grand-child
+      sub-surfaces are synchronized, too, without explicitly setting them.
+
+      Destroying a sub-surface takes effect immediately. If you need to
+      synchronize the removal of a sub-surface to the parent surface update,
+      unmap the sub-surface first by attaching a NULL wl_buffer, update parent,
+      and then destroy the sub-surface.
+
+      If the parent wl_surface object is destroyed, the sub-surface is
+      unmapped.
+    </description>
+
+    <request name="destroy" type="destructor">
+      <description summary="remove sub-surface interface">
+	The sub-surface interface is removed from the wl_surface object
+	that was turned into a sub-surface with a
+	wl_subcompositor.get_subsurface request. The wl_surface's association
+	to the parent is deleted. The wl_surface is unmapped immediately.
+      </description>
+    </request>
+
+    <enum name="error">
+      <entry name="bad_surface" value="0"
+	     summary="wl_surface is not a sibling or the parent"/>
+    </enum>
+
+    <request name="set_position">
+      <description summary="reposition the sub-surface">
+	This schedules a sub-surface position change.
+	The sub-surface will be moved so that its origin (top left
+	corner pixel) will be at the location x, y of the parent surface
+	coordinate system. The coordinates are not restricted to the parent
+	surface area. Negative values are allowed.
+
+	The scheduled coordinates will take effect whenever the state of the
+	parent surface is applied. When this happens depends on whether the
+	parent surface is in synchronized mode or not. See
+	wl_subsurface.set_sync and wl_subsurface.set_desync for details.
+
+	If more than one set_position request is invoked by the client before
+	the commit of the parent surface, the position of a new request always
+	replaces the scheduled position from any previous request.
+
+	The initial position is 0, 0.
+      </description>
+      <arg name="x" type="int" summary="x coordinate in the parent surface"/>
+      <arg name="y" type="int" summary="y coordinate in the parent surface"/>
+    </request>
+
+    <request name="place_above">
+      <description summary="restack the sub-surface">
+	This sub-surface is taken from the stack, and put back just
+	above the reference surface, changing the z-order of the sub-surfaces.
+	The reference surface must be one of the sibling surfaces, or the
+	parent surface. Using any other surface, including this sub-surface,
+	will cause a protocol error.
+
+	The z-order is double-buffered. Requests are handled in order and
+	applied immediately to a pending state. The final pending state is
+	copied to the active state the next time the state of the parent
+	surface is applied. When this happens depends on whether the parent
+	surface is in synchronized mode or not. See wl_subsurface.set_sync and
+	wl_subsurface.set_desync for details.
+
+	A new sub-surface is initially added as the top-most in the stack
+	of its siblings and parent.
+      </description>
+      <arg name="sibling" type="object" interface="wl_surface"
+	   summary="the reference surface"/>
+    </request>
+
+    <request name="place_below">
+      <description summary="restack the sub-surface">
+	The sub-surface is placed just below the reference surface.
+	See wl_subsurface.place_above.
+      </description>
+      <arg name="sibling" type="object" interface="wl_surface"
+	   summary="the reference surface"/>
+    </request>
+
+    <request name="set_sync">
+      <description summary="set sub-surface to synchronized mode">
+	Change the commit behaviour of the sub-surface to synchronized
+	mode, also described as the parent dependent mode.
+
+	In synchronized mode, wl_surface.commit on a sub-surface will
+	accumulate the committed state in a cache, but the state will
+	not be applied and hence will not change the compositor output.
+	The cached state is applied to the sub-surface immediately after
+	the parent surface's state is applied. This ensures atomic
+	updates of the parent and all its synchronized sub-surfaces.
+	Applying the cached state will invalidate the cache, so further
+	parent surface commits do not (re-)apply old state.
+
+	See wl_subsurface for the recursive effect of this mode.
+      </description>
+    </request>
+
+    <request name="set_desync">
+      <description summary="set sub-surface to desynchronized mode">
+	Change the commit behaviour of the sub-surface to desynchronized
+	mode, also described as independent or freely running mode.
+
+	In desynchronized mode, wl_surface.commit on a sub-surface will
+	apply the pending state directly, without caching, as happens
+	normally with a wl_surface. Calling wl_surface.commit on the
+	parent surface has no effect on the sub-surface's wl_surface
+	state. This mode allows a sub-surface to be updated on its own.
+
+	If cached state exists when wl_surface.commit is called in
+	desynchronized mode, the pending state is added to the cached
+	state, and applied as a whole. This invalidates the cache.
+
+	Note: even if a sub-surface is set to desynchronized, a parent
+	sub-surface may override it to behave as synchronized. For details,
+	see wl_subsurface.
+
+	If a surface's parent surface behaves as desynchronized, then
+	the cached state is applied on set_desync.
+      </description>
+    </request>
+  </interface>
+
+</protocol>
diff --git a/deps/wayland/xdg-activation-v1.xml b/deps/wayland/xdg-activation-v1.xml
new file mode 100644
index 0000000..9adcc27
--- /dev/null
+++ b/deps/wayland/xdg-activation-v1.xml
@@ -0,0 +1,200 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<protocol name="xdg_activation_v1">
+
+  <copyright>
+    Copyright © 2020 Aleix Pol Gonzalez &lt;aleixpol@kde.org&gt;
+    Copyright © 2020 Carlos Garnacho &lt;carlosg@gnome.org&gt;
+
+    Permission is hereby granted, free of charge, to any person obtaining a
+    copy of this software and associated documentation files (the "Software"),
+    to deal in the Software without restriction, including without limitation
+    the rights to use, copy, modify, merge, publish, distribute, sublicense,
+    and/or sell copies of the Software, and to permit persons to whom the
+    Software is furnished to do so, subject to the following conditions:
+
+    The above copyright notice and this permission notice (including the next
+    paragraph) shall be included in all copies or substantial portions of the
+    Software.
+
+    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+    IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+    THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+    LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+    FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+    DEALINGS IN THE SOFTWARE.
+  </copyright>
+
+  <description summary="Protocol for requesting activation of surfaces">
+    The way for a client to pass focus to another toplevel is as follows.
+
+    The client that intends to activate another toplevel uses the
+    xdg_activation_v1.get_activation_token request to get an activation token.
+    This token is then forwarded to the client, which is supposed to activate
+    one of its surfaces, through a separate band of communication.
+
+    One established way of doing this is through the XDG_ACTIVATION_TOKEN
+    environment variable of a newly launched child process. The child process
+    should unset the environment variable again right after reading it out in
+    order to avoid propagating it to other child processes.
+
+    Another established way exists for Applications implementing the D-Bus
+    interface org.freedesktop.Application, which should get their token under
+    activation-token on their platform_data.
+
+    In general activation tokens may be transferred across clients through
+    means not described in this protocol.
+
+    The client to be activated will then pass the token
+    it received to the xdg_activation_v1.activate request. The compositor can
+    then use this token to decide how to react to the activation request.
+
+    The token the activating client gets may be ineffective either already at
+    the time it receives it, for example if it was not focused, for focus
+    stealing prevention. The activating client will have no way to discover
+    the validity of the token, and may still forward it to the to be activated
+    client.
+
+    The created activation token may optionally get information attached to it
+    that can be used by the compositor to identify the application that we
+    intend to activate. This can for example be used to display a visual hint
+    about what application is being started.
+
+    Warning! The protocol described in this file is currently in the testing
+    phase. Backward compatible changes may be added together with the
+    corresponding interface version bump. Backward incompatible changes can
+    only be done by creating a new major version of the extension.
+  </description>
+
+  <interface name="xdg_activation_v1" version="1">
+    <description summary="interface for activating surfaces">
+      A global interface used for informing the compositor about applications
+      being activated or started, or for applications to request to be
+      activated.
+    </description>
+
+    <request name="destroy" type="destructor">
+      <description summary="destroy the xdg_activation object">
+        Notify the compositor that the xdg_activation object will no longer be
+        used.
+
+        The child objects created via this interface are unaffected and should
+        be destroyed separately.
+      </description>
+    </request>
+
+    <request name="get_activation_token">
+      <description summary="requests a token">
+        Creates an xdg_activation_token_v1 object that will provide
+        the initiating client with a unique token for this activation. This
+        token should be offered to the clients to be activated.
+      </description>
+
+      <arg name="id" type="new_id" interface="xdg_activation_token_v1"/>
+    </request>
+
+    <request name="activate">
+      <description summary="notify new interaction being available">
+        Requests surface activation. It's up to the compositor to display
+        this information as desired, for example by placing the surface above
+        the rest.
+
+        The compositor may know who requested this by checking the activation
+        token and might decide not to follow through with the activation if it's
+        considered unwanted.
+
+        Compositors can ignore unknown activation tokens when an invalid
+        token is passed.
+      </description>
+      <arg name="token" type="string" summary="the activation token of the initiating client"/>
+      <arg name="surface" type="object" interface="wl_surface"
+	   summary="the wl_surface to activate"/>
+    </request>
+  </interface>
+
+  <interface name="xdg_activation_token_v1" version="1">
+    <description summary="an exported activation handle">
+      An object for setting up a token and receiving a token handle that can
+      be passed as an activation token to another client.
+
+      The object is created using the xdg_activation_v1.get_activation_token
+      request. This object should then be populated with the app_id, surface
+      and serial information and committed. The compositor shall then issue a
+      done event with the token. In case the request's parameters are invalid,
+      the compositor will provide an invalid token.
+    </description>
+
+    <enum name="error">
+      <entry name="already_used" value="0"
+             summary="The token has already been used previously"/>
+    </enum>
+
+    <request name="set_serial">
+      <description summary="specifies the seat and serial of the activating event">
+        Provides information about the seat and serial event that requested the
+        token.
+
+        The serial can come from an input or focus event. For instance, if a
+        click triggers the launch of a third-party client, the launcher client
+        should send a set_serial request with the serial and seat from the
+        wl_pointer.button event.
+
+        Some compositors might refuse to activate toplevels when the token
+        doesn't have a valid and recent enough event serial.
+
+        Must be sent before commit. This information is optional.
+      </description>
+      <arg name="serial" type="uint"
+           summary="the serial of the event that triggered the activation"/>
+      <arg name="seat" type="object" interface="wl_seat"
+           summary="the wl_seat of the event"/>
+    </request>
+
+    <request name="set_app_id">
+      <description summary="specifies the application being activated">
+        The requesting client can specify an app_id to associate the token
+        being created with it.
+
+        Must be sent before commit. This information is optional.
+      </description>
+      <arg name="app_id" type="string"
+           summary="the application id of the client being activated."/>
+    </request>
+
+    <request name="set_surface">
+      <description summary="specifies the surface requesting activation">
+        This request sets the surface requesting the activation. Note, this is
+        different from the surface that will be activated.
+
+        Some compositors might refuse to activate toplevels when the token
+        doesn't have a requesting surface.
+
+        Must be sent before commit. This information is optional.
+      </description>
+      <arg name="surface" type="object" interface="wl_surface"
+	   summary="the requesting surface"/>
+    </request>
+
+    <request name="commit">
+      <description summary="issues the token request">
+        Requests an activation token based on the different parameters that
+        have been offered through set_serial, set_surface and set_app_id.
+      </description>
+    </request>
+
+    <event name="done">
+      <description summary="the exported activation token">
+        The 'done' event contains the unique token of this activation request
+        and notifies that the provider is done.
+      </description>
+      <arg name="token" type="string" summary="the exported activation token"/>
+    </event>
+
+    <request name="destroy" type="destructor">
+      <description summary="destroy the xdg_activation_token_v1 object">
+        Notify the compositor that the xdg_activation_token_v1 object will no
+        longer be used. The received token stays valid.
+      </description>
+    </request>
+  </interface>
+</protocol>
diff --git a/deps/wayland/xdg-decoration-unstable-v1.xml b/deps/wayland/xdg-decoration-unstable-v1.xml
new file mode 100644
index 0000000..e596775
--- /dev/null
+++ b/deps/wayland/xdg-decoration-unstable-v1.xml
@@ -0,0 +1,156 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<protocol name="xdg_decoration_unstable_v1">
+  <copyright>
+    Copyright © 2018 Simon Ser
+
+    Permission is hereby granted, free of charge, to any person obtaining a
+    copy of this software and associated documentation files (the "Software"),
+    to deal in the Software without restriction, including without limitation
+    the rights to use, copy, modify, merge, publish, distribute, sublicense,
+    and/or sell copies of the Software, and to permit persons to whom the
+    Software is furnished to do so, subject to the following conditions:
+
+    The above copyright notice and this permission notice (including the next
+    paragraph) shall be included in all copies or substantial portions of the
+    Software.
+
+    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+    IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+    THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+    LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+    FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+    DEALINGS IN THE SOFTWARE.
+  </copyright>
+
+  <interface name="zxdg_decoration_manager_v1" version="1">
+    <description summary="window decoration manager">
+      This interface allows a compositor to announce support for server-side
+      decorations.
+
+      A window decoration is a set of window controls as deemed appropriate by
+      the party managing them, such as user interface components used to move,
+      resize and change a window's state.
+
+      A client can use this protocol to request being decorated by a supporting
+      compositor.
+
+      If compositor and client do not negotiate the use of a server-side
+      decoration using this protocol, clients continue to self-decorate as they
+      see fit.
+
+      Warning! The protocol described in this file is experimental and
+      backward incompatible changes may be made. Backward compatible changes
+      may be added together with the corresponding interface version bump.
+      Backward incompatible changes are done by bumping the version number in
+      the protocol and interface names and resetting the interface version.
+      Once the protocol is to be declared stable, the 'z' prefix and the
+      version number in the protocol and interface names are removed and the
+      interface version number is reset.
+    </description>
+
+    <request name="destroy" type="destructor">
+      <description summary="destroy the decoration manager object">
+        Destroy the decoration manager. This doesn't destroy objects created
+        with the manager.
+      </description>
+    </request>
+
+    <request name="get_toplevel_decoration">
+      <description summary="create a new toplevel decoration object">
+        Create a new decoration object associated with the given toplevel.
+
+        Creating an xdg_toplevel_decoration from an xdg_toplevel which has a
+        buffer attached or committed is a client error, and any attempts by a
+        client to attach or manipulate a buffer prior to the first
+        xdg_toplevel_decoration.configure event must also be treated as
+        errors.
+      </description>
+      <arg name="id" type="new_id" interface="zxdg_toplevel_decoration_v1"/>
+      <arg name="toplevel" type="object" interface="xdg_toplevel"/>
+    </request>
+  </interface>
+
+  <interface name="zxdg_toplevel_decoration_v1" version="1">
+    <description summary="decoration object for a toplevel surface">
+      The decoration object allows the compositor to toggle server-side window
+      decorations for a toplevel surface. The client can request to switch to
+      another mode.
+
+      The xdg_toplevel_decoration object must be destroyed before its
+      xdg_toplevel.
+    </description>
+
+    <enum name="error">
+      <entry name="unconfigured_buffer" value="0"
+        summary="xdg_toplevel has a buffer attached before configure"/>
+      <entry name="already_constructed" value="1"
+        summary="xdg_toplevel already has a decoration object"/>
+      <entry name="orphaned" value="2"
+        summary="xdg_toplevel destroyed before the decoration object"/>
+    </enum>
+
+    <request name="destroy" type="destructor">
+      <description summary="destroy the decoration object">
+        Switch back to a mode without any server-side decorations at the next
+        commit.
+      </description>
+    </request>
+
+    <enum name="mode">
+      <description summary="window decoration modes">
+        These values describe window decoration modes.
+      </description>
+      <entry name="client_side" value="1"
+        summary="no server-side window decoration"/>
+      <entry name="server_side" value="2"
+        summary="server-side window decoration"/>
+    </enum>
+
+    <request name="set_mode">
+      <description summary="set the decoration mode">
+        Set the toplevel surface decoration mode. This informs the compositor
+        that the client prefers the provided decoration mode.
+
+        After requesting a decoration mode, the compositor will respond by
+        emitting an xdg_surface.configure event. The client should then update
+        its content, drawing it without decorations if the received mode is
+        server-side decorations. The client must also acknowledge the configure
+        when committing the new content (see xdg_surface.ack_configure).
+
+        The compositor can decide not to use the client's mode and enforce a
+        different mode instead.
+
+        Clients whose decoration mode depend on the xdg_toplevel state may send
+        a set_mode request in response to an xdg_surface.configure event and wait
+        for the next xdg_surface.configure event to prevent unwanted state.
+        Such clients are responsible for preventing configure loops and must
+        make sure not to send multiple successive set_mode requests with the
+        same decoration mode.
+      </description>
+      <arg name="mode" type="uint" enum="mode" summary="the decoration mode"/>
+    </request>
+
+    <request name="unset_mode">
+      <description summary="unset the decoration mode">
+        Unset the toplevel surface decoration mode. This informs the compositor
+        that the client doesn't prefer a particular decoration mode.
+
+        This request has the same semantics as set_mode.
+      </description>
+    </request>
+
+    <event name="configure">
+      <description summary="suggest a surface change">
+        The configure event asks the client to change its decoration mode. The
+        configured state should not be applied immediately. Clients must send an
+        ack_configure in response to this event. See xdg_surface.configure and
+        xdg_surface.ack_configure for details.
+
+        A configure event can be sent at any time. The specified mode must be
+        obeyed by the client.
+      </description>
+      <arg name="mode" type="uint" enum="mode" summary="the decoration mode"/>
+    </event>
+  </interface>
+</protocol>
diff --git a/deps/wayland/xdg-shell.xml b/deps/wayland/xdg-shell.xml
new file mode 100644
index 0000000..777eaa7
--- /dev/null
+++ b/deps/wayland/xdg-shell.xml
@@ -0,0 +1,1370 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<protocol name="xdg_shell">
+
+  <copyright>
+    Copyright © 2008-2013 Kristian Høgsberg
+    Copyright © 2013      Rafael Antognolli
+    Copyright © 2013      Jasper St. Pierre
+    Copyright © 2010-2013 Intel Corporation
+    Copyright © 2015-2017 Samsung Electronics Co., Ltd
+    Copyright © 2015-2017 Red Hat Inc.
+
+    Permission is hereby granted, free of charge, to any person obtaining a
+    copy of this software and associated documentation files (the "Software"),
+    to deal in the Software without restriction, including without limitation
+    the rights to use, copy, modify, merge, publish, distribute, sublicense,
+    and/or sell copies of the Software, and to permit persons to whom the
+    Software is furnished to do so, subject to the following conditions:
+
+    The above copyright notice and this permission notice (including the next
+    paragraph) shall be included in all copies or substantial portions of the
+    Software.
+
+    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+    IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+    THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+    LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+    FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+    DEALINGS IN THE SOFTWARE.
+  </copyright>
+
+  <interface name="xdg_wm_base" version="6">
+    <description summary="create desktop-style surfaces">
+      The xdg_wm_base interface is exposed as a global object enabling clients
+      to turn their wl_surfaces into windows in a desktop environment. It
+      defines the basic functionality needed for clients and the compositor to
+      create windows that can be dragged, resized, maximized, etc, as well as
+      creating transient windows such as popup menus.
+    </description>
+
+    <enum name="error">
+      <entry name="role" value="0" summary="given wl_surface has another role"/>
+      <entry name="defunct_surfaces" value="1"
+	     summary="xdg_wm_base was destroyed before children"/>
+      <entry name="not_the_topmost_popup" value="2"
+	     summary="the client tried to map or destroy a non-topmost popup"/>
+      <entry name="invalid_popup_parent" value="3"
+	     summary="the client specified an invalid popup parent surface"/>
+      <entry name="invalid_surface_state" value="4"
+	     summary="the client provided an invalid surface state"/>
+      <entry name="invalid_positioner" value="5"
+	     summary="the client provided an invalid positioner"/>
+      <entry name="unresponsive" value="6"
+	     summary="the client didn’t respond to a ping event in time"/>
+    </enum>
+
+    <request name="destroy" type="destructor">
+      <description summary="destroy xdg_wm_base">
+	Destroy this xdg_wm_base object.
+
+	Destroying a bound xdg_wm_base object while there are surfaces
+	still alive created by this xdg_wm_base object instance is illegal
+	and will result in a defunct_surfaces error.
+      </description>
+    </request>
+
+    <request name="create_positioner">
+      <description summary="create a positioner object">
+	Create a positioner object. A positioner object is used to position
+	surfaces relative to some parent surface. See the interface description
+	and xdg_surface.get_popup for details.
+      </description>
+      <arg name="id" type="new_id" interface="xdg_positioner"/>
+    </request>
+
+    <request name="get_xdg_surface">
+      <description summary="create a shell surface from a surface">
+	This creates an xdg_surface for the given surface. While xdg_surface
+	itself is not a role, the corresponding surface may only be assigned
+	a role extending xdg_surface, such as xdg_toplevel or xdg_popup. It is
+	illegal to create an xdg_surface for a wl_surface which already has an
+	assigned role and this will result in a role error.
+
+	This creates an xdg_surface for the given surface. An xdg_surface is
+	used as basis to define a role to a given surface, such as xdg_toplevel
+	or xdg_popup. It also manages functionality shared between xdg_surface
+	based surface roles.
+
+	See the documentation of xdg_surface for more details about what an
+	xdg_surface is and how it is used.
+      </description>
+      <arg name="id" type="new_id" interface="xdg_surface"/>
+      <arg name="surface" type="object" interface="wl_surface"/>
+    </request>
+
+    <request name="pong">
+      <description summary="respond to a ping event">
+	A client must respond to a ping event with a pong request or
+	the client may be deemed unresponsive. See xdg_wm_base.ping
+	and xdg_wm_base.error.unresponsive.
+      </description>
+      <arg name="serial" type="uint" summary="serial of the ping event"/>
+    </request>
+
+    <event name="ping">
+      <description summary="check if the client is alive">
+	The ping event asks the client if it's still alive. Pass the
+	serial specified in the event back to the compositor by sending
+	a "pong" request back with the specified serial. See xdg_wm_base.pong.
+
+	Compositors can use this to determine if the client is still
+	alive. It's unspecified what will happen if the client doesn't
+	respond to the ping request, or in what timeframe. Clients should
+	try to respond in a reasonable amount of time. The “unresponsive”
+	error is provided for compositors that wish to disconnect unresponsive
+	clients.
+
+	A compositor is free to ping in any way it wants, but a client must
+	always respond to any xdg_wm_base object it created.
+      </description>
+      <arg name="serial" type="uint" summary="pass this to the pong request"/>
+    </event>
+  </interface>
+
+  <interface name="xdg_positioner" version="6">
+    <description summary="child surface positioner">
+      The xdg_positioner provides a collection of rules for the placement of a
+      child surface relative to a parent surface. Rules can be defined to ensure
+      the child surface remains within the visible area's borders, and to
+      specify how the child surface changes its position, such as sliding along
+      an axis, or flipping around a rectangle. These positioner-created rules are
+      constrained by the requirement that a child surface must intersect with or
+      be at least partially adjacent to its parent surface.
+
+      See the various requests for details about possible rules.
+
+      At the time of the request, the compositor makes a copy of the rules
+      specified by the xdg_positioner. Thus, after the request is complete the
+      xdg_positioner object can be destroyed or reused; further changes to the
+      object will have no effect on previous usages.
+
+      For an xdg_positioner object to be considered complete, it must have a
+      non-zero size set by set_size, and a non-zero anchor rectangle set by
+      set_anchor_rect. Passing an incomplete xdg_positioner object when
+      positioning a surface raises an invalid_positioner error.
+    </description>
+
+    <enum name="error">
+      <entry name="invalid_input" value="0" summary="invalid input provided"/>
+    </enum>
+
+    <request name="destroy" type="destructor">
+      <description summary="destroy the xdg_positioner object">
+	Notify the compositor that the xdg_positioner will no longer be used.
+      </description>
+    </request>
+
+    <request name="set_size">
+      <description summary="set the size of the to-be positioned rectangle">
+	Set the size of the surface that is to be positioned with the positioner
+	object. The size is in surface-local coordinates and corresponds to the
+	window geometry. See xdg_surface.set_window_geometry.
+
+	If a zero or negative size is set the invalid_input error is raised.
+      </description>
+      <arg name="width" type="int" summary="width of positioned rectangle"/>
+      <arg name="height" type="int" summary="height of positioned rectangle"/>
+    </request>
+
+    <request name="set_anchor_rect">
+      <description summary="set the anchor rectangle within the parent surface">
+	Specify the anchor rectangle within the parent surface that the child
+	surface will be placed relative to. The rectangle is relative to the
+	window geometry as defined by xdg_surface.set_window_geometry of the
+	parent surface.
+
+	When the xdg_positioner object is used to position a child surface, the
+	anchor rectangle may not extend outside the window geometry of the
+	positioned child's parent surface.
+
+	If a negative size is set the invalid_input error is raised.
+      </description>
+      <arg name="x" type="int" summary="x position of anchor rectangle"/>
+      <arg name="y" type="int" summary="y position of anchor rectangle"/>
+      <arg name="width" type="int" summary="width of anchor rectangle"/>
+      <arg name="height" type="int" summary="height of anchor rectangle"/>
+    </request>
+
+    <enum name="anchor">
+      <entry name="none" value="0"/>
+      <entry name="top" value="1"/>
+      <entry name="bottom" value="2"/>
+      <entry name="left" value="3"/>
+      <entry name="right" value="4"/>
+      <entry name="top_left" value="5"/>
+      <entry name="bottom_left" value="6"/>
+      <entry name="top_right" value="7"/>
+      <entry name="bottom_right" value="8"/>
+    </enum>
+
+    <request name="set_anchor">
+      <description summary="set anchor rectangle anchor">
+	Defines the anchor point for the anchor rectangle. The specified anchor
+	is used derive an anchor point that the child surface will be
+	positioned relative to. If a corner anchor is set (e.g. 'top_left' or
+	'bottom_right'), the anchor point will be at the specified corner;
+	otherwise, the derived anchor point will be centered on the specified
+	edge, or in the center of the anchor rectangle if no edge is specified.
+      </description>
+      <arg name="anchor" type="uint" enum="anchor"
+	   summary="anchor"/>
+    </request>
+
+    <enum name="gravity">
+      <entry name="none" value="0"/>
+      <entry name="top" value="1"/>
+      <entry name="bottom" value="2"/>
+      <entry name="left" value="3"/>
+      <entry name="right" value="4"/>
+      <entry name="top_left" value="5"/>
+      <entry name="bottom_left" value="6"/>
+      <entry name="top_right" value="7"/>
+      <entry name="bottom_right" value="8"/>
+    </enum>
+
+    <request name="set_gravity">
+      <description summary="set child surface gravity">
+	Defines in what direction a surface should be positioned, relative to
+	the anchor point of the parent surface. If a corner gravity is
+	specified (e.g. 'bottom_right' or 'top_left'), then the child surface
+	will be placed towards the specified gravity; otherwise, the child
+	surface will be centered over the anchor point on any axis that had no
+	gravity specified. If the gravity is not in the ‘gravity’ enum, an
+	invalid_input error is raised.
+      </description>
+      <arg name="gravity" type="uint" enum="gravity"
+	   summary="gravity direction"/>
+    </request>
+
+    <enum name="constraint_adjustment" bitfield="true">
+      <description summary="constraint adjustments">
+	The constraint adjustment value define ways the compositor will adjust
+	the position of the surface, if the unadjusted position would result
+	in the surface being partly constrained.
+
+	Whether a surface is considered 'constrained' is left to the compositor
+	to determine. For example, the surface may be partly outside the
+	compositor's defined 'work area', thus necessitating the child surface's
+	position be adjusted until it is entirely inside the work area.
+
+	The adjustments can be combined, according to a defined precedence: 1)
+	Flip, 2) Slide, 3) Resize.
+      </description>
+      <entry name="none" value="0">
+	<description summary="don't move the child surface when constrained">
+	  Don't alter the surface position even if it is constrained on some
+	  axis, for example partially outside the edge of an output.
+	</description>
+      </entry>
+      <entry name="slide_x" value="1">
+	<description summary="move along the x axis until unconstrained">
+	  Slide the surface along the x axis until it is no longer constrained.
+
+	  First try to slide towards the direction of the gravity on the x axis
+	  until either the edge in the opposite direction of the gravity is
+	  unconstrained or the edge in the direction of the gravity is
+	  constrained.
+
+	  Then try to slide towards the opposite direction of the gravity on the
+	  x axis until either the edge in the direction of the gravity is
+	  unconstrained or the edge in the opposite direction of the gravity is
+	  constrained.
+	</description>
+      </entry>
+      <entry name="slide_y" value="2">
+	<description summary="move along the y axis until unconstrained">
+	  Slide the surface along the y axis until it is no longer constrained.
+
+	  First try to slide towards the direction of the gravity on the y axis
+	  until either the edge in the opposite direction of the gravity is
+	  unconstrained or the edge in the direction of the gravity is
+	  constrained.
+
+	  Then try to slide towards the opposite direction of the gravity on the
+	  y axis until either the edge in the direction of the gravity is
+	  unconstrained or the edge in the opposite direction of the gravity is
+	  constrained.
+	</description>
+      </entry>
+      <entry name="flip_x" value="4">
+	<description summary="invert the anchor and gravity on the x axis">
+	  Invert the anchor and gravity on the x axis if the surface is
+	  constrained on the x axis. For example, if the left edge of the
+	  surface is constrained, the gravity is 'left' and the anchor is
+	  'left', change the gravity to 'right' and the anchor to 'right'.
+
+	  If the adjusted position also ends up being constrained, the resulting
+	  position of the flip_x adjustment will be the one before the
+	  adjustment.
+	</description>
+      </entry>
+      <entry name="flip_y" value="8">
+	<description summary="invert the anchor and gravity on the y axis">
+	  Invert the anchor and gravity on the y axis if the surface is
+	  constrained on the y axis. For example, if the bottom edge of the
+	  surface is constrained, the gravity is 'bottom' and the anchor is
+	  'bottom', change the gravity to 'top' and the anchor to 'top'.
+
+	  The adjusted position is calculated given the original anchor
+	  rectangle and offset, but with the new flipped anchor and gravity
+	  values.
+
+	  If the adjusted position also ends up being constrained, the resulting
+	  position of the flip_y adjustment will be the one before the
+	  adjustment.
+	</description>
+      </entry>
+      <entry name="resize_x" value="16">
+	<description summary="horizontally resize the surface">
+	  Resize the surface horizontally so that it is completely
+	  unconstrained.
+	</description>
+      </entry>
+      <entry name="resize_y" value="32">
+	<description summary="vertically resize the surface">
+	  Resize the surface vertically so that it is completely unconstrained.
+	</description>
+      </entry>
+    </enum>
+
+    <request name="set_constraint_adjustment">
+      <description summary="set the adjustment to be done when constrained">
+	Specify how the window should be positioned if the originally intended
+	position caused the surface to be constrained, meaning at least
+	partially outside positioning boundaries set by the compositor. The
+	adjustment is set by constructing a bitmask describing the adjustment to
+	be made when the surface is constrained on that axis.
+
+	If no bit for one axis is set, the compositor will assume that the child
+	surface should not change its position on that axis when constrained.
+
+	If more than one bit for one axis is set, the order of how adjustments
+	are applied is specified in the corresponding adjustment descriptions.
+
+	The default adjustment is none.
+      </description>
+      <arg name="constraint_adjustment" type="uint"
+	   summary="bit mask of constraint adjustments"/>
+    </request>
+
+    <request name="set_offset">
+      <description summary="set surface position offset">
+	Specify the surface position offset relative to the position of the
+	anchor on the anchor rectangle and the anchor on the surface. For
+	example if the anchor of the anchor rectangle is at (x, y), the surface
+	has the gravity bottom|right, and the offset is (ox, oy), the calculated
+	surface position will be (x + ox, y + oy). The offset position of the
+	surface is the one used for constraint testing. See
+	set_constraint_adjustment.
+
+	An example use case is placing a popup menu on top of a user interface
+	element, while aligning the user interface element of the parent surface
+	with some user interface element placed somewhere in the popup surface.
+      </description>
+      <arg name="x" type="int" summary="surface position x offset"/>
+      <arg name="y" type="int" summary="surface position y offset"/>
+    </request>
+
+    <!-- Version 3 additions -->
+
+    <request name="set_reactive" since="3">
+      <description summary="continuously reconstrain the surface">
+	When set reactive, the surface is reconstrained if the conditions used
+	for constraining changed, e.g. the parent window moved.
+
+	If the conditions changed and the popup was reconstrained, an
+	xdg_popup.configure event is sent with updated geometry, followed by an
+	xdg_surface.configure event.
+      </description>
+    </request>
+
+    <request name="set_parent_size" since="3">
+      <description summary="">
+	Set the parent window geometry the compositor should use when
+	positioning the popup. The compositor may use this information to
+	determine the future state the popup should be constrained using. If
+	this doesn't match the dimension of the parent the popup is eventually
+	positioned against, the behavior is undefined.
+
+	The arguments are given in the surface-local coordinate space.
+      </description>
+      <arg name="parent_width" type="int"
+	   summary="future window geometry width of parent"/>
+      <arg name="parent_height" type="int"
+	   summary="future window geometry height of parent"/>
+    </request>
+
+    <request name="set_parent_configure" since="3">
+      <description summary="set parent configure this is a response to">
+	Set the serial of an xdg_surface.configure event this positioner will be
+	used in response to. The compositor may use this information together
+	with set_parent_size to determine what future state the popup should be
+	constrained using.
+      </description>
+      <arg name="serial" type="uint"
+	   summary="serial of parent configure event"/>
+    </request>
+  </interface>
+
+  <interface name="xdg_surface" version="6">
+    <description summary="desktop user interface surface base interface">
+      An interface that may be implemented by a wl_surface, for
+      implementations that provide a desktop-style user interface.
+
+      It provides a base set of functionality required to construct user
+      interface elements requiring management by the compositor, such as
+      toplevel windows, menus, etc. The types of functionality are split into
+      xdg_surface roles.
+
+      Creating an xdg_surface does not set the role for a wl_surface. In order
+      to map an xdg_surface, the client must create a role-specific object
+      using, e.g., get_toplevel, get_popup. The wl_surface for any given
+      xdg_surface can have at most one role, and may not be assigned any role
+      not based on xdg_surface.
+
+      A role must be assigned before any other requests are made to the
+      xdg_surface object.
+
+      The client must call wl_surface.commit on the corresponding wl_surface
+      for the xdg_surface state to take effect.
+
+      Creating an xdg_surface from a wl_surface which has a buffer attached or
+      committed is a client error, and any attempts by a client to attach or
+      manipulate a buffer prior to the first xdg_surface.configure call must
+      also be treated as errors.
+
+      After creating a role-specific object and setting it up, the client must
+      perform an initial commit without any buffer attached. The compositor
+      will reply with initial wl_surface state such as
+      wl_surface.preferred_buffer_scale followed by an xdg_surface.configure
+      event. The client must acknowledge it and is then allowed to attach a
+      buffer to map the surface.
+
+      Mapping an xdg_surface-based role surface is defined as making it
+      possible for the surface to be shown by the compositor. Note that
+      a mapped surface is not guaranteed to be visible once it is mapped.
+
+      For an xdg_surface to be mapped by the compositor, the following
+      conditions must be met:
+      (1) the client has assigned an xdg_surface-based role to the surface
+      (2) the client has set and committed the xdg_surface state and the
+	  role-dependent state to the surface
+      (3) the client has committed a buffer to the surface
+
+      A newly-unmapped surface is considered to have met condition (1) out
+      of the 3 required conditions for mapping a surface if its role surface
+      has not been destroyed, i.e. the client must perform the initial commit
+      again before attaching a buffer.
+    </description>
+
+    <enum name="error">
+      <entry name="not_constructed" value="1"
+	     summary="Surface was not fully constructed"/>
+      <entry name="already_constructed" value="2"
+	     summary="Surface was already constructed"/>
+      <entry name="unconfigured_buffer" value="3"
+	     summary="Attaching a buffer to an unconfigured surface"/>
+      <entry name="invalid_serial" value="4"
+	     summary="Invalid serial number when acking a configure event"/>
+      <entry name="invalid_size" value="5"
+	     summary="Width or height was zero or negative"/>
+      <entry name="defunct_role_object" value="6"
+	     summary="Surface was destroyed before its role object"/>
+    </enum>
+
+    <request name="destroy" type="destructor">
+      <description summary="destroy the xdg_surface">
+	Destroy the xdg_surface object. An xdg_surface must only be destroyed
+	after its role object has been destroyed, otherwise
+	a defunct_role_object error is raised.
+      </description>
+    </request>
+
+    <request name="get_toplevel">
+      <description summary="assign the xdg_toplevel surface role">
+	This creates an xdg_toplevel object for the given xdg_surface and gives
+	the associated wl_surface the xdg_toplevel role.
+
+	See the documentation of xdg_toplevel for more details about what an
+	xdg_toplevel is and how it is used.
+      </description>
+      <arg name="id" type="new_id" interface="xdg_toplevel"/>
+    </request>
+
+    <request name="get_popup">
+      <description summary="assign the xdg_popup surface role">
+	This creates an xdg_popup object for the given xdg_surface and gives
+	the associated wl_surface the xdg_popup role.
+
+	If null is passed as a parent, a parent surface must be specified using
+	some other protocol, before committing the initial state.
+
+	See the documentation of xdg_popup for more details about what an
+	xdg_popup is and how it is used.
+      </description>
+      <arg name="id" type="new_id" interface="xdg_popup"/>
+      <arg name="parent" type="object" interface="xdg_surface" allow-null="true"/>
+      <arg name="positioner" type="object" interface="xdg_positioner"/>
+    </request>
+
+    <request name="set_window_geometry">
+      <description summary="set the new window geometry">
+	The window geometry of a surface is its "visible bounds" from the
+	user's perspective. Client-side decorations often have invisible
+	portions like drop-shadows which should be ignored for the
+	purposes of aligning, placing and constraining windows.
+
+	The window geometry is double buffered, and will be applied at the
+	time wl_surface.commit of the corresponding wl_surface is called.
+
+	When maintaining a position, the compositor should treat the (x, y)
+	coordinate of the window geometry as the top left corner of the window.
+	A client changing the (x, y) window geometry coordinate should in
+	general not alter the position of the window.
+
+	Once the window geometry of the surface is set, it is not possible to
+	unset it, and it will remain the same until set_window_geometry is
+	called again, even if a new subsurface or buffer is attached.
+
+	If never set, the value is the full bounds of the surface,
+	including any subsurfaces. This updates dynamically on every
+	commit. This unset is meant for extremely simple clients.
+
+	The arguments are given in the surface-local coordinate space of
+	the wl_surface associated with this xdg_surface, and may extend outside
+	of the wl_surface itself to mark parts of the subsurface tree as part of
+	the window geometry.
+
+	When applied, the effective window geometry will be the set window
+	geometry clamped to the bounding rectangle of the combined
+	geometry of the surface of the xdg_surface and the associated
+	subsurfaces.
+
+	The effective geometry will not be recalculated unless a new call to
+	set_window_geometry is done and the new pending surface state is
+	subsequently applied.
+
+	The width and height of the effective window geometry must be
+	greater than zero. Setting an invalid size will raise an
+	invalid_size error.
+      </description>
+      <arg name="x" type="int"/>
+      <arg name="y" type="int"/>
+      <arg name="width" type="int"/>
+      <arg name="height" type="int"/>
+    </request>
+
+    <request name="ack_configure">
+      <description summary="ack a configure event">
+	When a configure event is received, if a client commits the
+	surface in response to the configure event, then the client
+	must make an ack_configure request sometime before the commit
+	request, passing along the serial of the configure event.
+
+	For instance, for toplevel surfaces the compositor might use this
+	information to move a surface to the top left only when the client has
+	drawn itself for the maximized or fullscreen state.
+
+	If the client receives multiple configure events before it
+	can respond to one, it only has to ack the last configure event.
+	Acking a configure event that was never sent raises an invalid_serial
+	error.
+
+	A client is not required to commit immediately after sending
+	an ack_configure request - it may even ack_configure several times
+	before its next surface commit.
+
+	A client may send multiple ack_configure requests before committing, but
+	only the last request sent before a commit indicates which configure
+	event the client really is responding to.
+
+	Sending an ack_configure request consumes the serial number sent with
+	the request, as well as serial numbers sent by all configure events
+	sent on this xdg_surface prior to the configure event referenced by
+	the committed serial.
+
+	It is an error to issue multiple ack_configure requests referencing a
+	serial from the same configure event, or to issue an ack_configure
+	request referencing a serial from a configure event issued before the
+	event identified by the last ack_configure request for the same
+	xdg_surface. Doing so will raise an invalid_serial error.
+      </description>
+      <arg name="serial" type="uint" summary="the serial from the configure event"/>
+    </request>
+
+    <event name="configure">
+      <description summary="suggest a surface change">
+	The configure event marks the end of a configure sequence. A configure
+	sequence is a set of one or more events configuring the state of the
+	xdg_surface, including the final xdg_surface.configure event.
+
+	Where applicable, xdg_surface surface roles will during a configure
+	sequence extend this event as a latched state sent as events before the
+	xdg_surface.configure event. Such events should be considered to make up
+	a set of atomically applied configuration states, where the
+	xdg_surface.configure commits the accumulated state.
+
+	Clients should arrange their surface for the new states, and then send
+	an ack_configure request with the serial sent in this configure event at
+	some point before committing the new surface.
+
+	If the client receives multiple configure events before it can respond
+	to one, it is free to discard all but the last event it received.
+      </description>
+      <arg name="serial" type="uint" summary="serial of the configure event"/>
+    </event>
+
+  </interface>
+
+  <interface name="xdg_toplevel" version="6">
+    <description summary="toplevel surface">
+      This interface defines an xdg_surface role which allows a surface to,
+      among other things, set window-like properties such as maximize,
+      fullscreen, and minimize, set application-specific metadata like title and
+      id, and well as trigger user interactive operations such as interactive
+      resize and move.
+
+      Unmapping an xdg_toplevel means that the surface cannot be shown
+      by the compositor until it is explicitly mapped again.
+      All active operations (e.g., move, resize) are canceled and all
+      attributes (e.g. title, state, stacking, ...) are discarded for
+      an xdg_toplevel surface when it is unmapped. The xdg_toplevel returns to
+      the state it had right after xdg_surface.get_toplevel. The client
+      can re-map the toplevel by perfoming a commit without any buffer
+      attached, waiting for a configure event and handling it as usual (see
+      xdg_surface description).
+
+      Attaching a null buffer to a toplevel unmaps the surface.
+    </description>
+
+    <request name="destroy" type="destructor">
+      <description summary="destroy the xdg_toplevel">
+	This request destroys the role surface and unmaps the surface;
+	see "Unmapping" behavior in interface section for details.
+      </description>
+    </request>
+
+    <enum name="error">
+      <entry name="invalid_resize_edge" value="0" summary="provided value is
+        not a valid variant of the resize_edge enum"/>
+      <entry name="invalid_parent" value="1"
+        summary="invalid parent toplevel"/>
+      <entry name="invalid_size" value="2"
+	summary="client provided an invalid min or max size"/>
+    </enum>
+
+    <request name="set_parent">
+      <description summary="set the parent of this surface">
+	Set the "parent" of this surface. This surface should be stacked
+	above the parent surface and all other ancestor surfaces.
+
+	Parent surfaces should be set on dialogs, toolboxes, or other
+	"auxiliary" surfaces, so that the parent is raised when the dialog
+	is raised.
+
+	Setting a null parent for a child surface unsets its parent. Setting
+	a null parent for a surface which currently has no parent is a no-op.
+
+	Only mapped surfaces can have child surfaces. Setting a parent which
+	is not mapped is equivalent to setting a null parent. If a surface
+	becomes unmapped, its children's parent is set to the parent of
+	the now-unmapped surface. If the now-unmapped surface has no parent,
+	its children's parent is unset. If the now-unmapped surface becomes
+	mapped again, its parent-child relationship is not restored.
+
+	The parent toplevel must not be one of the child toplevel's
+	descendants, and the parent must be different from the child toplevel,
+	otherwise the invalid_parent protocol error is raised.
+      </description>
+      <arg name="parent" type="object" interface="xdg_toplevel" allow-null="true"/>
+    </request>
+
+    <request name="set_title">
+      <description summary="set surface title">
+	Set a short title for the surface.
+
+	This string may be used to identify the surface in a task bar,
+	window list, or other user interface elements provided by the
+	compositor.
+
+	The string must be encoded in UTF-8.
+      </description>
+      <arg name="title" type="string"/>
+    </request>
+
+    <request name="set_app_id">
+      <description summary="set application ID">
+	Set an application identifier for the surface.
+
+	The app ID identifies the general class of applications to which
+	the surface belongs. The compositor can use this to group multiple
+	surfaces together, or to determine how to launch a new application.
+
+	For D-Bus activatable applications, the app ID is used as the D-Bus
+	service name.
+
+	The compositor shell will try to group application surfaces together
+	by their app ID. As a best practice, it is suggested to select app
+	ID's that match the basename of the application's .desktop file.
+	For example, "org.freedesktop.FooViewer" where the .desktop file is
+	"org.freedesktop.FooViewer.desktop".
+
+	Like other properties, a set_app_id request can be sent after the
+	xdg_toplevel has been mapped to update the property.
+
+	See the desktop-entry specification [0] for more details on
+	application identifiers and how they relate to well-known D-Bus
+	names and .desktop files.
+
+	[0] https://standards.freedesktop.org/desktop-entry-spec/
+      </description>
+      <arg name="app_id" type="string"/>
+    </request>
+
+    <request name="show_window_menu">
+      <description summary="show the window menu">
+	Clients implementing client-side decorations might want to show
+	a context menu when right-clicking on the decorations, giving the
+	user a menu that they can use to maximize or minimize the window.
+
+	This request asks the compositor to pop up such a window menu at
+	the given position, relative to the local surface coordinates of
+	the parent surface. There are no guarantees as to what menu items
+	the window menu contains, or even if a window menu will be drawn
+	at all.
+
+	This request must be used in response to some sort of user action
+	like a button press, key press, or touch down event.
+      </description>
+      <arg name="seat" type="object" interface="wl_seat" summary="the wl_seat of the user event"/>
+      <arg name="serial" type="uint" summary="the serial of the user event"/>
+      <arg name="x" type="int" summary="the x position to pop up the window menu at"/>
+      <arg name="y" type="int" summary="the y position to pop up the window menu at"/>
+    </request>
+
+    <request name="move">
+      <description summary="start an interactive move">
+	Start an interactive, user-driven move of the surface.
+
+	This request must be used in response to some sort of user action
+	like a button press, key press, or touch down event. The passed
+	serial is used to determine the type of interactive move (touch,
+	pointer, etc).
+
+	The server may ignore move requests depending on the state of
+	the surface (e.g. fullscreen or maximized), or if the passed serial
+	is no longer valid.
+
+	If triggered, the surface will lose the focus of the device
+	(wl_pointer, wl_touch, etc) used for the move. It is up to the
+	compositor to visually indicate that the move is taking place, such as
+	updating a pointer cursor, during the move. There is no guarantee
+	that the device focus will return when the move is completed.
+      </description>
+      <arg name="seat" type="object" interface="wl_seat" summary="the wl_seat of the user event"/>
+      <arg name="serial" type="uint" summary="the serial of the user event"/>
+    </request>
+
+    <enum name="resize_edge">
+      <description summary="edge values for resizing">
+	These values are used to indicate which edge of a surface
+	is being dragged in a resize operation.
+      </description>
+      <entry name="none" value="0"/>
+      <entry name="top" value="1"/>
+      <entry name="bottom" value="2"/>
+      <entry name="left" value="4"/>
+      <entry name="top_left" value="5"/>
+      <entry name="bottom_left" value="6"/>
+      <entry name="right" value="8"/>
+      <entry name="top_right" value="9"/>
+      <entry name="bottom_right" value="10"/>
+    </enum>
+
+    <request name="resize">
+      <description summary="start an interactive resize">
+	Start a user-driven, interactive resize of the surface.
+
+	This request must be used in response to some sort of user action
+	like a button press, key press, or touch down event. The passed
+	serial is used to determine the type of interactive resize (touch,
+	pointer, etc).
+
+	The server may ignore resize requests depending on the state of
+	the surface (e.g. fullscreen or maximized).
+
+	If triggered, the client will receive configure events with the
+	"resize" state enum value and the expected sizes. See the "resize"
+	enum value for more details about what is required. The client
+	must also acknowledge configure events using "ack_configure". After
+	the resize is completed, the client will receive another "configure"
+	event without the resize state.
+
+	If triggered, the surface also will lose the focus of the device
+	(wl_pointer, wl_touch, etc) used for the resize. It is up to the
+	compositor to visually indicate that the resize is taking place,
+	such as updating a pointer cursor, during the resize. There is no
+	guarantee that the device focus will return when the resize is
+	completed.
+
+	The edges parameter specifies how the surface should be resized, and
+	is one of the values of the resize_edge enum. Values not matching
+	a variant of the enum will cause the invalid_resize_edge protocol error.
+	The compositor may use this information to update the surface position
+	for example when dragging the top left corner. The compositor may also
+	use this information to adapt its behavior, e.g. choose an appropriate
+	cursor image.
+      </description>
+      <arg name="seat" type="object" interface="wl_seat" summary="the wl_seat of the user event"/>
+      <arg name="serial" type="uint" summary="the serial of the user event"/>
+      <arg name="edges" type="uint" enum="resize_edge" summary="which edge or corner is being dragged"/>
+    </request>
+
+    <enum name="state">
+      <description summary="types of state on the surface">
+	The different state values used on the surface. This is designed for
+	state values like maximized, fullscreen. It is paired with the
+	configure event to ensure that both the client and the compositor
+	setting the state can be synchronized.
+
+	States set in this way are double-buffered. They will get applied on
+	the next commit.
+      </description>
+      <entry name="maximized" value="1" summary="the surface is maximized">
+	<description summary="the surface is maximized">
+	  The surface is maximized. The window geometry specified in the configure
+	  event must be obeyed by the client, or the xdg_wm_base.invalid_surface_state
+	  error is raised.
+
+	  The client should draw without shadow or other
+	  decoration outside of the window geometry.
+	</description>
+      </entry>
+      <entry name="fullscreen" value="2" summary="the surface is fullscreen">
+	<description summary="the surface is fullscreen">
+	  The surface is fullscreen. The window geometry specified in the
+	  configure event is a maximum; the client cannot resize beyond it. For
+	  a surface to cover the whole fullscreened area, the geometry
+	  dimensions must be obeyed by the client. For more details, see
+	  xdg_toplevel.set_fullscreen.
+	</description>
+      </entry>
+      <entry name="resizing" value="3" summary="the surface is being resized">
+	<description summary="the surface is being resized">
+	  The surface is being resized. The window geometry specified in the
+	  configure event is a maximum; the client cannot resize beyond it.
+	  Clients that have aspect ratio or cell sizing configuration can use
+	  a smaller size, however.
+	</description>
+      </entry>
+      <entry name="activated" value="4" summary="the surface is now activated">
+	<description summary="the surface is now activated">
+	  Client window decorations should be painted as if the window is
+	  active. Do not assume this means that the window actually has
+	  keyboard or pointer focus.
+	</description>
+      </entry>
+      <entry name="tiled_left" value="5" since="2">
+	<description summary="the surface’s left edge is tiled">
+	  The window is currently in a tiled layout and the left edge is
+	  considered to be adjacent to another part of the tiling grid.
+	</description>
+      </entry>
+      <entry name="tiled_right" value="6" since="2">
+	<description summary="the surface’s right edge is tiled">
+	  The window is currently in a tiled layout and the right edge is
+	  considered to be adjacent to another part of the tiling grid.
+	</description>
+      </entry>
+      <entry name="tiled_top" value="7" since="2">
+	<description summary="the surface’s top edge is tiled">
+	  The window is currently in a tiled layout and the top edge is
+	  considered to be adjacent to another part of the tiling grid.
+	</description>
+      </entry>
+      <entry name="tiled_bottom" value="8" since="2">
+	<description summary="the surface’s bottom edge is tiled">
+	  The window is currently in a tiled layout and the bottom edge is
+	  considered to be adjacent to another part of the tiling grid.
+	</description>
+      </entry>
+      <entry name="suspended" value="9" since="6">
+        <description summary="surface repaint is suspended">
+	  The surface is currently not ordinarily being repainted; for
+	  example because its content is occluded by another window, or its
+	  outputs are switched off due to screen locking.
+	</description>
+      </entry>
+    </enum>
+
+    <request name="set_max_size">
+      <description summary="set the maximum size">
+	Set a maximum size for the window.
+
+	The client can specify a maximum size so that the compositor does
+	not try to configure the window beyond this size.
+
+	The width and height arguments are in window geometry coordinates.
+	See xdg_surface.set_window_geometry.
+
+	Values set in this way are double-buffered. They will get applied
+	on the next commit.
+
+	The compositor can use this information to allow or disallow
+	different states like maximize or fullscreen and draw accurate
+	animations.
+
+	Similarly, a tiling window manager may use this information to
+	place and resize client windows in a more effective way.
+
+	The client should not rely on the compositor to obey the maximum
+	size. The compositor may decide to ignore the values set by the
+	client and request a larger size.
+
+	If never set, or a value of zero in the request, means that the
+	client has no expected maximum size in the given dimension.
+	As a result, a client wishing to reset the maximum size
+	to an unspecified state can use zero for width and height in the
+	request.
+
+	Requesting a maximum size to be smaller than the minimum size of
+	a surface is illegal and will result in an invalid_size error.
+
+	The width and height must be greater than or equal to zero. Using
+	strictly negative values for width or height will result in a
+	invalid_size error.
+      </description>
+      <arg name="width" type="int"/>
+      <arg name="height" type="int"/>
+    </request>
+
+    <request name="set_min_size">
+      <description summary="set the minimum size">
+	Set a minimum size for the window.
+
+	The client can specify a minimum size so that the compositor does
+	not try to configure the window below this size.
+
+	The width and height arguments are in window geometry coordinates.
+	See xdg_surface.set_window_geometry.
+
+	Values set in this way are double-buffered. They will get applied
+	on the next commit.
+
+	The compositor can use this information to allow or disallow
+	different states like maximize or fullscreen and draw accurate
+	animations.
+
+	Similarly, a tiling window manager may use this information to
+	place and resize client windows in a more effective way.
+
+	The client should not rely on the compositor to obey the minimum
+	size. The compositor may decide to ignore the values set by the
+	client and request a smaller size.
+
+	If never set, or a value of zero in the request, means that the
+	client has no expected minimum size in the given dimension.
+	As a result, a client wishing to reset the minimum size
+	to an unspecified state can use zero for width and height in the
+	request.
+
+	Requesting a minimum size to be larger than the maximum size of
+	a surface is illegal and will result in an invalid_size error.
+
+	The width and height must be greater than or equal to zero. Using
+	strictly negative values for width and height will result in a
+	invalid_size error.
+      </description>
+      <arg name="width" type="int"/>
+      <arg name="height" type="int"/>
+    </request>
+
+    <request name="set_maximized">
+      <description summary="maximize the window">
+	Maximize the surface.
+
+	After requesting that the surface should be maximized, the compositor
+	will respond by emitting a configure event. Whether this configure
+	actually sets the window maximized is subject to compositor policies.
+	The client must then update its content, drawing in the configured
+	state. The client must also acknowledge the configure when committing
+	the new content (see ack_configure).
+
+	It is up to the compositor to decide how and where to maximize the
+	surface, for example which output and what region of the screen should
+	be used.
+
+	If the surface was already maximized, the compositor will still emit
+	a configure event with the "maximized" state.
+
+	If the surface is in a fullscreen state, this request has no direct
+	effect. It may alter the state the surface is returned to when
+	unmaximized unless overridden by the compositor.
+      </description>
+    </request>
+
+    <request name="unset_maximized">
+      <description summary="unmaximize the window">
+	Unmaximize the surface.
+
+	After requesting that the surface should be unmaximized, the compositor
+	will respond by emitting a configure event. Whether this actually
+	un-maximizes the window is subject to compositor policies.
+	If available and applicable, the compositor will include the window
+	geometry dimensions the window had prior to being maximized in the
+	configure event. The client must then update its content, drawing it in
+	the configured state. The client must also acknowledge the configure
+	when committing the new content (see ack_configure).
+
+	It is up to the compositor to position the surface after it was
+	unmaximized; usually the position the surface had before maximizing, if
+	applicable.
+
+	If the surface was already not maximized, the compositor will still
+	emit a configure event without the "maximized" state.
+
+	If the surface is in a fullscreen state, this request has no direct
+	effect. It may alter the state the surface is returned to when
+	unmaximized unless overridden by the compositor.
+      </description>
+    </request>
+
+    <request name="set_fullscreen">
+      <description summary="set the window as fullscreen on an output">
+	Make the surface fullscreen.
+
+	After requesting that the surface should be fullscreened, the
+	compositor will respond by emitting a configure event. Whether the
+	client is actually put into a fullscreen state is subject to compositor
+	policies. The client must also acknowledge the configure when
+	committing the new content (see ack_configure).
+
+	The output passed by the request indicates the client's preference as
+	to which display it should be set fullscreen on. If this value is NULL,
+	it's up to the compositor to choose which display will be used to map
+	this surface.
+
+	If the surface doesn't cover the whole output, the compositor will
+	position the surface in the center of the output and compensate with
+	with border fill covering the rest of the output. The content of the
+	border fill is undefined, but should be assumed to be in some way that
+	attempts to blend into the surrounding area (e.g. solid black).
+
+	If the fullscreened surface is not opaque, the compositor must make
+	sure that other screen content not part of the same surface tree (made
+	up of subsurfaces, popups or similarly coupled surfaces) are not
+	visible below the fullscreened surface.
+      </description>
+      <arg name="output" type="object" interface="wl_output" allow-null="true"/>
+    </request>
+
+    <request name="unset_fullscreen">
+      <description summary="unset the window as fullscreen">
+	Make the surface no longer fullscreen.
+
+	After requesting that the surface should be unfullscreened, the
+	compositor will respond by emitting a configure event.
+	Whether this actually removes the fullscreen state of the client is
+	subject to compositor policies.
+
+	Making a surface unfullscreen sets states for the surface based on the following:
+	* the state(s) it may have had before becoming fullscreen
+	* any state(s) decided by the compositor
+	* any state(s) requested by the client while the surface was fullscreen
+
+	The compositor may include the previous window geometry dimensions in
+	the configure event, if applicable.
+
+	The client must also acknowledge the configure when committing the new
+	content (see ack_configure).
+      </description>
+    </request>
+
+    <request name="set_minimized">
+      <description summary="set the window as minimized">
+	Request that the compositor minimize your surface. There is no
+	way to know if the surface is currently minimized, nor is there
+	any way to unset minimization on this surface.
+
+	If you are looking to throttle redrawing when minimized, please
+	instead use the wl_surface.frame event for this, as this will
+	also work with live previews on windows in Alt-Tab, Expose or
+	similar compositor features.
+      </description>
+    </request>
+
+    <event name="configure">
+      <description summary="suggest a surface change">
+	This configure event asks the client to resize its toplevel surface or
+	to change its state. The configured state should not be applied
+	immediately. See xdg_surface.configure for details.
+
+	The width and height arguments specify a hint to the window
+	about how its surface should be resized in window geometry
+	coordinates. See set_window_geometry.
+
+	If the width or height arguments are zero, it means the client
+	should decide its own window dimension. This may happen when the
+	compositor needs to configure the state of the surface but doesn't
+	have any information about any previous or expected dimension.
+
+	The states listed in the event specify how the width/height
+	arguments should be interpreted, and possibly how it should be
+	drawn.
+
+	Clients must send an ack_configure in response to this event. See
+	xdg_surface.configure and xdg_surface.ack_configure for details.
+      </description>
+      <arg name="width" type="int"/>
+      <arg name="height" type="int"/>
+      <arg name="states" type="array"/>
+    </event>
+
+    <event name="close">
+      <description summary="surface wants to be closed">
+	The close event is sent by the compositor when the user
+	wants the surface to be closed. This should be equivalent to
+	the user clicking the close button in client-side decorations,
+	if your application has any.
+
+	This is only a request that the user intends to close the
+	window. The client may choose to ignore this request, or show
+	a dialog to ask the user to save their data, etc.
+      </description>
+    </event>
+
+    <!-- Version 4 additions -->
+
+    <event name="configure_bounds" since="4">
+      <description summary="recommended window geometry bounds">
+	The configure_bounds event may be sent prior to a xdg_toplevel.configure
+	event to communicate the bounds a window geometry size is recommended
+	to constrain to.
+
+	The passed width and height are in surface coordinate space. If width
+	and height are 0, it means bounds is unknown and equivalent to as if no
+	configure_bounds event was ever sent for this surface.
+
+	The bounds can for example correspond to the size of a monitor excluding
+	any panels or other shell components, so that a surface isn't created in
+	a way that it cannot fit.
+
+	The bounds may change at any point, and in such a case, a new
+	xdg_toplevel.configure_bounds will be sent, followed by
+	xdg_toplevel.configure and xdg_surface.configure.
+      </description>
+      <arg name="width" type="int"/>
+      <arg name="height" type="int"/>
+    </event>
+
+    <!-- Version 5 additions -->
+
+    <enum name="wm_capabilities" since="5">
+      <entry name="window_menu" value="1" summary="show_window_menu is available"/>
+      <entry name="maximize" value="2" summary="set_maximized and unset_maximized are available"/>
+      <entry name="fullscreen" value="3" summary="set_fullscreen and unset_fullscreen are available"/>
+      <entry name="minimize" value="4" summary="set_minimized is available"/>
+    </enum>
+
+    <event name="wm_capabilities" since="5">
+      <description summary="compositor capabilities">
+	This event advertises the capabilities supported by the compositor. If
+	a capability isn't supported, clients should hide or disable the UI
+	elements that expose this functionality. For instance, if the
+	compositor doesn't advertise support for minimized toplevels, a button
+	triggering the set_minimized request should not be displayed.
+
+	The compositor will ignore requests it doesn't support. For instance,
+	a compositor which doesn't advertise support for minimized will ignore
+	set_minimized requests.
+
+	Compositors must send this event once before the first
+	xdg_surface.configure event. When the capabilities change, compositors
+	must send this event again and then send an xdg_surface.configure
+	event.
+
+	The configured state should not be applied immediately. See
+	xdg_surface.configure for details.
+
+	The capabilities are sent as an array of 32-bit unsigned integers in
+	native endianness.
+      </description>
+      <arg name="capabilities" type="array" summary="array of 32-bit capabilities"/>
+    </event>
+  </interface>
+
+  <interface name="xdg_popup" version="6">
+    <description summary="short-lived, popup surfaces for menus">
+      A popup surface is a short-lived, temporary surface. It can be used to
+      implement for example menus, popovers, tooltips and other similar user
+      interface concepts.
+
+      A popup can be made to take an explicit grab. See xdg_popup.grab for
+      details.
+
+      When the popup is dismissed, a popup_done event will be sent out, and at
+      the same time the surface will be unmapped. See the xdg_popup.popup_done
+      event for details.
+
+      Explicitly destroying the xdg_popup object will also dismiss the popup and
+      unmap the surface. Clients that want to dismiss the popup when another
+      surface of their own is clicked should dismiss the popup using the destroy
+      request.
+
+      A newly created xdg_popup will be stacked on top of all previously created
+      xdg_popup surfaces associated with the same xdg_toplevel.
+
+      The parent of an xdg_popup must be mapped (see the xdg_surface
+      description) before the xdg_popup itself.
+
+      The client must call wl_surface.commit on the corresponding wl_surface
+      for the xdg_popup state to take effect.
+    </description>
+
+    <enum name="error">
+      <entry name="invalid_grab" value="0"
+	     summary="tried to grab after being mapped"/>
+    </enum>
+
+    <request name="destroy" type="destructor">
+      <description summary="remove xdg_popup interface">
+	This destroys the popup. Explicitly destroying the xdg_popup
+	object will also dismiss the popup, and unmap the surface.
+
+	If this xdg_popup is not the "topmost" popup, the
+	xdg_wm_base.not_the_topmost_popup protocol error will be sent.
+      </description>
+    </request>
+
+    <request name="grab">
+      <description summary="make the popup take an explicit grab">
+	This request makes the created popup take an explicit grab. An explicit
+	grab will be dismissed when the user dismisses the popup, or when the
+	client destroys the xdg_popup. This can be done by the user clicking
+	outside the surface, using the keyboard, or even locking the screen
+	through closing the lid or a timeout.
+
+	If the compositor denies the grab, the popup will be immediately
+	dismissed.
+
+	This request must be used in response to some sort of user action like a
+	button press, key press, or touch down event. The serial number of the
+	event should be passed as 'serial'.
+
+	The parent of a grabbing popup must either be an xdg_toplevel surface or
+	another xdg_popup with an explicit grab. If the parent is another
+	xdg_popup it means that the popups are nested, with this popup now being
+	the topmost popup.
+
+	Nested popups must be destroyed in the reverse order they were created
+	in, e.g. the only popup you are allowed to destroy at all times is the
+	topmost one.
+
+	When compositors choose to dismiss a popup, they may dismiss every
+	nested grabbing popup as well. When a compositor dismisses popups, it
+	will follow the same dismissing order as required from the client.
+
+	If the topmost grabbing popup is destroyed, the grab will be returned to
+	the parent of the popup, if that parent previously had an explicit grab.
+
+	If the parent is a grabbing popup which has already been dismissed, this
+	popup will be immediately dismissed. If the parent is a popup that did
+	not take an explicit grab, an error will be raised.
+
+	During a popup grab, the client owning the grab will receive pointer
+	and touch events for all their surfaces as normal (similar to an
+	"owner-events" grab in X11 parlance), while the top most grabbing popup
+	will always have keyboard focus.
+      </description>
+      <arg name="seat" type="object" interface="wl_seat"
+	   summary="the wl_seat of the user event"/>
+      <arg name="serial" type="uint" summary="the serial of the user event"/>
+    </request>
+
+    <event name="configure">
+      <description summary="configure the popup surface">
+	This event asks the popup surface to configure itself given the
+	configuration. The configured state should not be applied immediately.
+	See xdg_surface.configure for details.
+
+	The x and y arguments represent the position the popup was placed at
+	given the xdg_positioner rule, relative to the upper left corner of the
+	window geometry of the parent surface.
+
+	For version 2 or older, the configure event for an xdg_popup is only
+	ever sent once for the initial configuration. Starting with version 3,
+	it may be sent again if the popup is setup with an xdg_positioner with
+	set_reactive requested, or in response to xdg_popup.reposition requests.
+      </description>
+      <arg name="x" type="int"
+	   summary="x position relative to parent surface window geometry"/>
+      <arg name="y" type="int"
+	   summary="y position relative to parent surface window geometry"/>
+      <arg name="width" type="int" summary="window geometry width"/>
+      <arg name="height" type="int" summary="window geometry height"/>
+    </event>
+
+    <event name="popup_done">
+      <description summary="popup interaction is done">
+	The popup_done event is sent out when a popup is dismissed by the
+	compositor. The client should destroy the xdg_popup object at this
+	point.
+      </description>
+    </event>
+
+    <!-- Version 3 additions -->
+
+    <request name="reposition" since="3">
+      <description summary="recalculate the popup's location">
+	Reposition an already-mapped popup. The popup will be placed given the
+	details in the passed xdg_positioner object, and a
+	xdg_popup.repositioned followed by xdg_popup.configure and
+	xdg_surface.configure will be emitted in response. Any parameters set
+	by the previous positioner will be discarded.
+
+	The passed token will be sent in the corresponding
+	xdg_popup.repositioned event. The new popup position will not take
+	effect until the corresponding configure event is acknowledged by the
+	client. See xdg_popup.repositioned for details. The token itself is
+	opaque, and has no other special meaning.
+
+	If multiple reposition requests are sent, the compositor may skip all
+	but the last one.
+
+	If the popup is repositioned in response to a configure event for its
+	parent, the client should send an xdg_positioner.set_parent_configure
+	and possibly an xdg_positioner.set_parent_size request to allow the
+	compositor to properly constrain the popup.
+
+	If the popup is repositioned together with a parent that is being
+	resized, but not in response to a configure event, the client should
+	send an xdg_positioner.set_parent_size request.
+      </description>
+      <arg name="positioner" type="object" interface="xdg_positioner"/>
+      <arg name="token" type="uint" summary="reposition request token"/>
+    </request>
+
+    <event name="repositioned" since="3">
+      <description summary="signal the completion of a repositioned request">
+	The repositioned event is sent as part of a popup configuration
+	sequence, together with xdg_popup.configure and lastly
+	xdg_surface.configure to notify the completion of a reposition request.
+
+	The repositioned event is to notify about the completion of a
+	xdg_popup.reposition request. The token argument is the token passed
+	in the xdg_popup.reposition request.
+
+	Immediately after this event is emitted, xdg_popup.configure and
+	xdg_surface.configure will be sent with the updated size and position,
+	as well as a new configure serial.
+
+	The client should optionally update the content of the popup, but must
+	acknowledge the new popup configuration for the new position to take
+	effect. See xdg_surface.ack_configure for details.
+      </description>
+      <arg name="token" type="uint" summary="reposition request token"/>
+    </event>
+
+  </interface>
+</protocol>
diff --git a/docs/CMakeLists.txt b/docs/CMakeLists.txt
index 2347858..5052217 100644
--- a/docs/CMakeLists.txt
+++ b/docs/CMakeLists.txt
@@ -1,34 +1,57 @@
 
 # NOTE: The order of this list determines the order of items in the Guides
 #       (i.e. Pages) list in the generated documentation
-set(GLFW_DOXYGEN_SOURCES
-    "include/GLFW/glfw3.h"
-    "include/GLFW/glfw3native.h"
-    "docs/main.dox"
-    "docs/news.dox"
-    "docs/quick.dox"
-    "docs/moving.dox"
-    "docs/compile.dox"
-    "docs/build.dox"
-    "docs/intro.dox"
-    "docs/context.dox"
-    "docs/monitor.dox"
-    "docs/window.dox"
-    "docs/input.dox"
-    "docs/vulkan.dox"
-    "docs/compat.dox"
-    "docs/internal.dox")
+set(source_files
+    main.md
+    news.md
+    quick.md
+    moving.md
+    compile.md
+    build.md
+    intro.md
+    context.md
+    monitor.md
+    window.md
+    input.md
+    vulkan.md
+    compat.md
+    internal.md)
+
+set(extra_files DoxygenLayout.xml header.html footer.html extra.css spaces.svg)
+
+set(header_paths
+    "${GLFW_SOURCE_DIR}/include/GLFW/glfw3.h"
+    "${GLFW_SOURCE_DIR}/include/GLFW/glfw3native.h")
 
 # Format the source list into a Doxyfile INPUT value that Doxygen can parse
-foreach(path IN LISTS GLFW_DOXYGEN_SOURCES)
-    set(GLFW_DOXYGEN_INPUT "${GLFW_DOXYGEN_INPUT} \\\n\"${GLFW_SOURCE_DIR}/${path}\"")
+foreach(path IN LISTS header_paths)
+    string(APPEND GLFW_DOXYGEN_INPUT " \\\n\"${path}\"")
+endforeach()
+foreach(file IN LISTS source_files)
+    string(APPEND GLFW_DOXYGEN_INPUT " \\\n\"${CMAKE_CURRENT_SOURCE_DIR}/${file}\"")
 endforeach()
 
-configure_file(Doxyfile.in Doxyfile @ONLY)
+set(DOXYGEN_SKIP_DOT TRUE)
+find_package(Doxygen)
 
-add_custom_target(docs ALL "${DOXYGEN_EXECUTABLE}"
-                  WORKING_DIRECTORY "${GLFW_BINARY_DIR}/docs"
-                  COMMENT "Generating HTML documentation" VERBATIM)
+if (NOT DOXYGEN_FOUND OR DOXYGEN_VERSION VERSION_LESS "1.9.8")
+    message(STATUS "Documentation generation requires Doxygen 1.9.8 or later")
+else()
+    configure_file(Doxyfile.in Doxyfile @ONLY)
+    add_custom_command(OUTPUT "html/index.html"
+                       COMMAND "${DOXYGEN_EXECUTABLE}"
+                       WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
+                       MAIN_DEPENDENCY Doxyfile
+                       DEPENDS ${header_paths} ${source_files} ${extra_files}
+                       COMMENT "Generating HTML documentation"
+                       VERBATIM)
 
-set_target_properties(docs PROPERTIES FOLDER "GLFW3")
+    add_custom_target(docs ALL SOURCES "html/index.html")
+    set_target_properties(docs PROPERTIES FOLDER "GLFW3")
+
+    if (GLFW_INSTALL)
+        install(DIRECTORY "${GLFW_BINARY_DIR}/docs/html"
+                DESTINATION "${CMAKE_INSTALL_DOCDIR}")
+    endif()
+endif()
 
diff --git a/docs/CONTRIBUTING.md b/docs/CONTRIBUTING.md
index 5eaf752..73ba01e 100644
--- a/docs/CONTRIBUTING.md
+++ b/docs/CONTRIBUTING.md
@@ -326,7 +326,7 @@
 In addition to the code, a complete bug fix includes:
 
 - Change log entry in `README.md`, describing the incorrect behavior
-- Credits entries for all authors of the bug fix
+- Credits entries in `CONTRIBUTORS.md` for all authors of the bug fix
 
 Bug fixes will not be rejected because they don't include all the above parts,
 but please keep in mind that maintainer time is finite and that there are many
@@ -357,11 +357,11 @@
 In addition to the code, a complete feature includes:
 
 - Change log entry in `README.md`, listing all new symbols
-- News page entry, briefly describing the feature
-- Guide documentation, with minimal examples, in the relevant guide
+- News page entry in `docs/news.md`, briefly describing the feature
+- Guide documentation, with minimal examples, in the relevant guide in the `docs` folder
 - Reference documentation, with all applicable tags
 - Cross-references and mentions in appropriate places
-- Credits entries for all authors of the feature
+- Credits entries in `CONTRIBUTORS.md` for all authors of the feature
 
 If the feature requires platform-specific code, at minimum stubs must be added
 for the new platform function to all supported and experimental platforms.
@@ -373,7 +373,7 @@
 
 If it adds a new OpenGL, OpenGL ES or Vulkan option or extension, support
 for it must be added to `tests/glfwinfo.c` and the behavior of the library when
-the extension is missing documented in `docs/compat.dox`.
+the extension is missing documented in `docs/compat.md`.
 
 If you haven't already, read the excellent article [How to Write a Git Commit
 Message](https://chris.beams.io/posts/git-commit/).
diff --git a/docs/DoxygenLayout.xml b/docs/DoxygenLayout.xml
index ab97172..66cb87f 100644
--- a/docs/DoxygenLayout.xml
+++ b/docs/DoxygenLayout.xml
@@ -5,7 +5,7 @@
     <tab type="mainpage" visible="yes" title="Introduction"/>
     <tab type="user" url="quick_guide.html" title="Tutorial"/>
     <tab type="pages" visible="yes" title="Guides" intro=""/>
-    <tab type="modules" visible="yes" title="Reference" intro=""/>
+    <tab type="topics" visible="yes" title="Reference" intro=""/>
     <tab type="filelist" visible="yes" title="Files"/>
   </navindex>
 
diff --git a/docs/build.dox b/docs/build.md
similarity index 80%
rename from docs/build.dox
rename to docs/build.md
index 1b9c1e1..d00d676 100644
--- a/docs/build.dox
+++ b/docs/build.md
@@ -1,8 +1,6 @@
-/*!
+# Building applications {#build_guide}
 
-@page build_guide Building applications
-
-@tableofcontents
+[TOC]
 
 This is about compiling and linking applications that use GLFW.  For information on
 how to write such applications, start with the
@@ -16,14 +14,14 @@
 the documentation for your development environment.
 
 
-@section build_include Including the GLFW header file
+## Including the GLFW header file {#build_include}
 
 You should include the GLFW header in the source files where you use OpenGL or
 GLFW.
 
-@code
+```c
 #include <GLFW/glfw3.h>
-@endcode
+```
 
 This header defines all the constants and declares all the types and function
 prototypes of the GLFW API.  By default, it also includes the OpenGL header from
@@ -43,17 +41,18 @@
  - Do not include window system headers unless you will use those APIs directly
  - If you do need such headers, include them before the GLFW header
 
-If you are using an OpenGL extension loading library such as
-[glad](https://github.com/Dav1dde/glad), the extension loader header should
-be included before the GLFW one.  GLFW attempts to detect any OpenGL or OpenGL
-ES header or extension loader header included before it and will then disable
-the inclusion of the default OpenGL header.  Most extension loaders also define
-macros that disable similar headers below it.
+If you are using an OpenGL extension loading library such as [glad][], the
+extension loader header should be included before the GLFW one.  GLFW attempts
+to detect any OpenGL or OpenGL ES header or extension loader header included
+before it and will then disable the inclusion of the default OpenGL header.
+Most extension loaders also define macros that disable similar headers below it.
 
-@code
+[glad]: https://github.com/Dav1dde/glad
+
+```c
 #include <glad/gl.h>
 #include <GLFW/glfw3.h>
-@endcode
+```
 
 Both of these mechanisms depend on the extension loader header defining a known
 macro.  If yours doesn't or you don't know which one your users will pick, the
@@ -61,14 +60,14 @@
 including the OpenGL header.  This will also allow you to include the two
 headers in any order.
 
-@code
+```c
 #define GLFW_INCLUDE_NONE
 #include <GLFW/glfw3.h>
 #include <glad/gl.h>
-@endcode
+```
 
 
-@subsection build_macros GLFW header option macros
+### GLFW header option macros {#build_macros}
 
 These macros may be defined before the inclusion of the GLFW header and affect
 its behavior.
@@ -82,8 +81,9 @@
 
 @note GLFW does not provide any of the API headers mentioned below.  They are
 provided by your development environment or your OpenGL, OpenGL ES or Vulkan
-SDK, and most of them can be downloaded from the
-[Khronos Registry](https://www.khronos.org/registry/).
+SDK, and most of them can be downloaded from the [Khronos Registry][registry].
+
+[registry]: https://www.khronos.org/registry/
 
 @anchor GLFW_INCLUDE_GLCOREARB
 __GLFW_INCLUDE_GLCOREARB__ makes the GLFW header include the modern
@@ -142,7 +142,7 @@
 sure they are not applied to the GLFW sources.
 
 
-@section build_link Link with the right libraries
+## Link with the right libraries {#build_link}
 
 GLFW is essentially a wrapper of various platform-specific APIs and therefore
 needs to link against many different system libraries.  If you are using GLFW as
@@ -155,17 +155,18 @@
 environment below.  On Linux and other Unix-like operating systems, the list
 varies but can be retrieved in various ways as described below.
 
-A good general introduction to linking is
-[Beginner's Guide to Linkers](https://www.lurklurk.org/linkers/linkers.html) by
-David Drysdale.
+A good general introduction to linking is [Beginner's Guide to
+Linkers][linker_guide] by David Drysdale.
+
+[linker_guide]: https://www.lurklurk.org/linkers/linkers.html
 
 
-@subsection build_link_win32 With Visual C++ and GLFW binaries
+### With Visual C++ and GLFW binaries {#build_link_win32}
 
-If you are using a downloaded
-[binary archive](https://www.glfw.org/download.html), first make sure you have
-the archive matching the architecture you are building for (32-bit or 64-bit),
-or you will get link errors.  Also make sure you are using the binaries for your
+If you are using a downloaded [binary
+archive](https://www.glfw.org/download.html), first make sure you have the
+archive matching the architecture you are building for (32-bit or 64-bit), or
+you will get link errors.  Also make sure you are using the binaries for your
 version of Visual C++ or you may get other link errors.
 
 There are two version of the static GLFW library in the binary archive, because
@@ -191,22 +192,21 @@
 can be done either in the _Preprocessor Definitions_ project option or by
 defining it in your source code before including the GLFW header.
 
-@code
+```c
 #define GLFW_DLL
 #include <GLFW/glfw3.h>
-@endcode
+```
 
 All link-time dependencies for GLFW are already listed in the _Additional
 Dependencies_ option by default.
 
 
-@subsection build_link_mingw With MinGW-w64 and GLFW binaries
+### With MinGW-w64 and GLFW binaries {#build_link_mingw}
 
 This is intended for building a program from the command-line or by writing
-a makefile, on Windows with [MinGW-w64](https://www.mingw-w64.org/) and GLFW
-binaries.  These can be from a downloaded and extracted
-[binary archive](https://www.glfw.org/download.html) or by compiling GLFW
-yourself.  The paths below assume a binary archive is used.
+a makefile, on Windows with [MinGW-w64][] and GLFW binaries.  These can be from
+a downloaded and extracted [binary archive](https://www.glfw.org/download.html)
+or by compiling GLFW yourself.  The paths below assume a binary archive is used.
 
 If you are using a downloaded binary archive, first make sure you have the
 archive matching the architecture you are building for (32-bit or 64-bit) or you
@@ -217,19 +217,21 @@
 depend on GLFW must be listed before the GLFW library.  GLFW in turn depends on
 `gdi32` and must be listed before it.
 
+[MinGW-w64]: https://www.mingw-w64.org/
+
 If you are using the static version of the GLFW library, which is named
 `libglfw3.a`, do:
 
-@code{.sh}
+```sh
 gcc -o myprog myprog.c -I path/to/glfw/include path/to/glfw/lib-mingw-w64/libglfw3.a -lgdi32
-@endcode
+```
 
 If you are using the DLL version of the GLFW library, which is named
 `glfw3.dll`, you will need to use the `libglfw3dll.a` link library.
 
-@code{.sh}
+```sh
 gcc -o myprog myprog.c -I path/to/glfw/include path/to/glfw/lib-mingw-w64/libglfw3dll.a -lgdi32
-@endcode
+```
 
 The resulting executable will need to find `glfw3.dll` to run, typically by
 keeping both files in the same directory.
@@ -238,19 +240,19 @@
 the @ref GLFW_DLL macro.  This can be done in your source files, as long as it
 done before including the GLFW header:
 
-@code
+```c
 #define GLFW_DLL
 #include <GLFW/glfw3.h>
-@endcode
+```
 
 It can also be done on the command-line:
 
-@code{.sh}
+```sh
 gcc -o myprog myprog.c -D GLFW_DLL -I path/to/glfw/include path/to/glfw/lib-mingw-w64/libglfw3dll.a -lgdi32
-@endcode
+```
 
 
-@subsection build_link_cmake_source With CMake and GLFW source
+### With CMake and GLFW source {#build_link_cmake_source}
 
 This section is about using CMake to compile and link GLFW along with your
 application.  If you want to use an installed binary instead, see @ref
@@ -259,31 +261,21 @@
 With a few changes to your `CMakeLists.txt` you can have the GLFW source tree
 built along with your application.
 
-When including GLFW as part of your build, you probably don't want to build the
-GLFW tests, examples and documentation.  To disable these, set the corresponding
-cache variables before adding the GLFW source tree.
-
-@code
-set(GLFW_BUILD_DOCS OFF CACHE BOOL "" FORCE)
-set(GLFW_BUILD_TESTS OFF CACHE BOOL "" FORCE)
-set(GLFW_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
-@endcode
-
 Add the root directory of the GLFW source tree to your project.  This will add
 the `glfw` target to your project.
 
-@code{.cmake}
+```cmake
 add_subdirectory(path/to/glfw)
-@endcode
+```
 
 Once GLFW has been added, link your application against the `glfw` target.
 This adds the GLFW library and its link-time dependencies as it is currently
 configured, the include directory for the GLFW header and, when applicable, the
 @ref GLFW_DLL macro.
 
-@code{.cmake}
+```cmake
 target_link_libraries(myapp glfw)
-@endcode
+```
 
 Note that the `glfw` target does not depend on OpenGL, as GLFW loads any OpenGL,
 OpenGL ES or Vulkan libraries it needs at runtime.  If your application calls
@@ -291,22 +283,24 @@
 [extension loader library](@ref context_glext_auto), use the OpenGL CMake
 package.
 
-@code{.cmake}
+```cmake
 find_package(OpenGL REQUIRED)
-@endcode
+```
 
 If OpenGL is found, the `OpenGL::GL` target is added to your project, containing
 library and include directory paths.  Link against this like any other library.
 
-@code{.cmake}
+```cmake
 target_link_libraries(myapp OpenGL::GL)
-@endcode
+```
 
 For a minimal example of a program and GLFW sources built with CMake, see the
-[GLFW CMake Starter](https://github.com/juliettef/GLFW-CMake-starter) on GitHub.
+[GLFW CMake Starter][cmake_starter] on GitHub.
+
+[cmake_starter]: https://github.com/juliettef/GLFW-CMake-starter
 
 
-@subsection build_link_cmake_package With CMake and installed GLFW binaries
+### With CMake and installed GLFW binaries {#build_link_cmake_package}
 
 This section is about using CMake to link GLFW after it has been built and
 installed.  If you want to build it along with your application instead, see
@@ -315,17 +309,17 @@
 With a few changes to your `CMakeLists.txt` you can locate the package and
 target files generated when GLFW is installed.
 
-@code{.cmake}
-find_package(glfw3 3.3 REQUIRED)
-@endcode
+```cmake
+find_package(glfw3 3.4 REQUIRED)
+```
 
 Once GLFW has been added to the project, link against it with the `glfw` target.
 This adds the GLFW library and its link-time dependencies, the include directory
 for the GLFW header and, when applicable, the @ref GLFW_DLL macro.
 
-@code{.cmake}
+```cmake
 target_link_libraries(myapp glfw)
-@endcode
+```
 
 Note that the `glfw` target does not depend on OpenGL, as GLFW loads any OpenGL,
 OpenGL ES or Vulkan libraries it needs at runtime.  If your application calls
@@ -333,50 +327,51 @@
 [extension loader library](@ref context_glext_auto), use the OpenGL CMake
 package.
 
-@code{.cmake}
+```cmake
 find_package(OpenGL REQUIRED)
-@endcode
+```
 
 If OpenGL is found, the `OpenGL::GL` target is added to your project, containing
 library and include directory paths.  Link against this like any other library.
 
-@code{.cmake}
+```cmake
 target_link_libraries(myapp OpenGL::GL)
-@endcode
+```
 
 
-@subsection build_link_pkgconfig With pkg-config and GLFW binaries on Unix
+### With pkg-config and GLFW binaries on Unix {#build_link_pkgconfig}
 
 This is intended for building a program from the command-line or by writing
 a makefile, on macOS or any Unix-like system like Linux, FreeBSD and Cygwin.
 
-GLFW supports [pkg-config](https://www.freedesktop.org/wiki/Software/pkg-config/),
-and the `glfw3.pc` pkg-config file is generated when the GLFW library is built
-and is installed along with it.  A pkg-config file describes all necessary
-compile-time and link-time flags and dependencies needed to use a library.  When
-they are updated or if they differ between systems, you will get the correct
-ones automatically.
+GLFW supports [pkg-config][], and the `glfw3.pc` pkg-config file is generated
+when the GLFW library is built and is installed along with it.  A pkg-config
+file describes all necessary compile-time and link-time flags and dependencies
+needed to use a library.  When they are updated or if they differ between
+systems, you will get the correct ones automatically.
+
+[pkg-config]: https://www.freedesktop.org/wiki/Software/pkg-config/
 
 A typical compile and link command-line when using the static version of the
 GLFW library may look like this:
 
-@code{.sh}
+```sh
 cc $(pkg-config --cflags glfw3) -o myprog myprog.c $(pkg-config --static --libs glfw3)
-@endcode
+```
 
 If you are using the shared version of the GLFW library, omit the `--static`
 flag.
 
-@code{.sh}
+```sh
 cc $(pkg-config --cflags glfw3) -o myprog myprog.c $(pkg-config --libs glfw3)
-@endcode
+```
 
 You can also use the `glfw3.pc` file without installing it first, by using the
 `PKG_CONFIG_PATH` environment variable.
 
-@code{.sh}
+```sh
 env PKG_CONFIG_PATH=path/to/glfw/src cc $(pkg-config --cflags glfw3) -o myprog myprog.c $(pkg-config --libs glfw3)
-@endcode
+```
 
 The dependencies do not include OpenGL, as GLFW loads any OpenGL, OpenGL ES or
 Vulkan libraries it needs at runtime.  If your application calls OpenGL
@@ -384,12 +379,12 @@
 [extension loader library](@ref context_glext_auto), you should add the `gl`
 pkg-config package.
 
-@code{.sh}
+```sh
 cc $(pkg-config --cflags glfw3 gl) -o myprog myprog.c $(pkg-config --libs glfw3 gl)
-@endcode
+```
 
 
-@subsection build_link_xcode With Xcode on macOS
+### With Xcode on macOS {#build_link_xcode}
 
 If you are using the dynamic library version of GLFW, add it to the project
 dependencies.
@@ -399,7 +394,7 @@
 found in `/System/Library/Frameworks`.
 
 
-@subsection build_link_osx With command-line or makefile on macOS
+### With command-line or makefile on macOS {#build_link_osx}
 
 It is recommended that you use [pkg-config](@ref build_link_pkgconfig) when
 using installed GLFW binaries from the command line on macOS.  That way you will
@@ -409,9 +404,9 @@
 
 If you are using the dynamic GLFW library, which is named `libglfw.3.dylib`, do:
 
-@code{.sh}
+```sh
 cc -o myprog myprog.c -lglfw -framework Cocoa -framework OpenGL -framework IOKit
-@endcode
+```
 
 If you are using the static library, named `libglfw3.a`, substitute `-lglfw3`
 for `-lglfw`.
@@ -422,4 +417,3 @@
 @note Your machine may have `libGL.*.dylib` style OpenGL library, but that is
 for the X Window System and will not work with the macOS native version of GLFW.
 
-*/
diff --git a/docs/compat.dox b/docs/compat.md
similarity index 63%
rename from docs/compat.dox
rename to docs/compat.md
index ceeff41..ef64b0c 100644
--- a/docs/compat.dox
+++ b/docs/compat.md
@@ -1,8 +1,6 @@
-/*!
+# Standards conformance {#compat_guide}
 
-@page compat_guide Standards conformance
-
-@tableofcontents
+[TOC]
 
 This guide describes the various API extensions used by this version of GLFW.
 It lists what are essentially implementation details, but which are nonetheless
@@ -15,18 +13,18 @@
 be considered a breaking API change.
 
 
-@section compat_x11 X11 extensions, protocols and IPC standards
+## X11 extensions, protocols and IPC standards {#compat_x11}
 
-As GLFW uses Xlib directly, without any intervening toolkit
-library, it has sole responsibility for interacting well with the many and
-varied window managers in use on Unix-like systems.  In order for applications
-and window managers to work well together, a number of standards and
-conventions have been developed that regulate behavior outside the scope of the
-X11 API; most importantly the
-[Inter-Client Communication Conventions Manual](https://www.tronche.com/gui/x/icccm/)
-(ICCCM) and
-[Extended Window Manager Hints](https://standards.freedesktop.org/wm-spec/wm-spec-latest.html)
-(EWMH) standards.
+As GLFW uses Xlib directly, without any intervening toolkit library, it has sole
+responsibility for interacting well with the many and varied window managers in
+use on Unix-like systems.  In order for applications and window managers to work
+well together, a number of standards and conventions have been developed that
+regulate behavior outside the scope of the X11 API; most importantly the
+[Inter-Client Communication Conventions Manual][ICCCM] (ICCCM) and [Extended
+Window Manager Hints][EWMH] (EWMH) standards.
+
+[ICCCM]: https://www.tronche.com/gui/x/icccm/
+[EWMH]: https://standards.freedesktop.org/wm-spec/wm-spec-latest.html
 
 GLFW uses the `_MOTIF_WM_HINTS` window property to support borderless windows.
 If the running window manager does not support this property, the
@@ -52,16 +50,18 @@
 running window manager uses compositing but does not support this property then
 additional copying may be performed for each buffer swap of full screen windows.
 
-GLFW uses the
-[clipboard manager protocol](https://www.freedesktop.org/wiki/ClipboardManager/)
-to push a clipboard string (i.e. selection) owned by a GLFW window about to be
-destroyed to the clipboard manager.  If there is no running clipboard manager,
-the clipboard string will be unavailable once the window has been destroyed.
+GLFW uses the [clipboard manager protocol][ClipboardManager] to push a clipboard
+string (i.e. selection) owned by a GLFW window about to be destroyed to the
+clipboard manager.  If there is no running clipboard manager, the clipboard
+string will be unavailable once the window has been destroyed.
 
-GLFW uses the
-[X drag-and-drop protocol](https://www.freedesktop.org/wiki/Specifications/XDND/)
-to provide file drop events.  If the application originating the drag does not
-support this protocol, drag and drop will not work.
+[clipboardManager]: https://www.freedesktop.org/wiki/ClipboardManager/
+
+GLFW uses the [X drag-and-drop protocol][XDND] to provide file drop events.  If
+the application originating the drag does not support this protocol, drag and
+drop will not work.
+
+[XDND]: https://www.freedesktop.org/wiki/Specifications/XDND/
 
 GLFW uses the XRandR 1.3 extension to provide multi-monitor support.  If the
 running X server does not support this version of this extension, multi-monitor
@@ -85,66 +85,81 @@
 extension or there is no running compositing manager, the
 `GLFW_TRANSPARENT_FRAMEBUFFER` framebuffer hint will have no effect.
 
+GLFW uses both the Xcursor extension and the freedesktop cursor conventions to
+provide an expanded set of standard cursor shapes.  If the running X server does
+not support this extension or the current cursor theme does not support the
+conventions, the `GLFW_RESIZE_NWSE_CURSOR`, `GLFW_RESIZE_NESW_CURSOR` and
+`GLFW_NOT_ALLOWED_CURSOR` shapes will not be available and other shapes may use
+legacy images.
 
-@section compat_wayland Wayland protocols and IPC standards
+
+## Wayland protocols and IPC standards {#compat_wayland}
 
 As GLFW uses libwayland directly, without any intervening toolkit library, it
 has sole responsibility for interacting well with every compositor in use on
 Unix-like systems.  Most of the features are provided by the core protocol,
 while cursor support is provided by the libwayland-cursor helper library, EGL
 integration by libwayland-egl, and keyboard handling by
-[libxkbcommon](https://xkbcommon.org/).  In addition, GLFW uses some protocols
-from wayland-protocols to provide additional features if the compositor
-supports them.
+[libxkbcommon](https://xkbcommon.org/).  In addition, GLFW uses some additional
+Wayland protocols to implement certain features if the compositor supports them.
 
-GLFW uses xkbcommon 0.5.0 to provide compose key support.  When it has been
-built against an older xkbcommon, the compose key will be disabled even if it
-has been configured in the compositor.
+GLFW uses xkbcommon 0.5.0 to provide key and text input support.  Earlier
+versions are not supported.
 
-GLFW uses the [xdg-shell
-protocol](https://cgit.freedesktop.org/wayland/wayland-protocols/tree/stable/xdg-shell/xdg-shell.xml)
-to provide better window management.  This protocol is part of
-wayland-protocols 1.12, and mandatory at build time.
+GLFW uses the [xdg-shell][] protocol to provide better window management.  This
+protocol is mandatory for GLFW to display a window.
 
-GLFW uses the [relative pointer
-protocol](https://cgit.freedesktop.org/wayland/wayland-protocols/tree/unstable/relative-pointer/relative-pointer-unstable-v1.xml)
-alongside the [pointer constraints
-protocol](https://cgit.freedesktop.org/wayland/wayland-protocols/tree/unstable/pointer-constraints/pointer-constraints-unstable-v1.xml)
-to implement disabled cursor.  These two protocols are part of
-wayland-protocols 1.1, and mandatory at build time.  If the running compositor
-does not support both of these protocols, disabling the cursor will have no
-effect.
+[xdg-shell]: https://wayland.app/protocols/xdg-shell
 
-GLFW uses the [idle inhibit
-protocol](https://cgit.freedesktop.org/wayland/wayland-protocols/tree/unstable/idle-inhibit/idle-inhibit-unstable-v1.xml)
-to prohibit the screensaver from starting.  This protocol is part of
-wayland-protocols 1.6, and mandatory at build time.  If the running compositor
-does not support this protocol, the screensaver may start even for full screen
-windows.
+GLFW uses the [relative-pointer-unstable-v1][] protocol alongside the
+[pointer-constraints-unstable-v1][] protocol to implement disabled cursor.  If
+the running compositor does not support both of these protocols, disabling the
+cursor will have no effect.
 
-GLFW uses the [libdecor library](https://gitlab.freedesktop.org/libdecor/libdecor)
-for window decorations, where available.  This in turn provides good quality
-client-side decorations (drawn by the application) on desktop systems that do
-not support server-side decorations (drawn by the window manager).  On systems
-that do not provide either libdecor or xdg-decoration, very basic window
-decorations are provided.  These do not include the window title or any caption
-buttons.
+[relative-pointer-unstable-v1]: https://wayland.app/protocols/relative-pointer-unstable-v1
+[pointer-constraints-unstable-v1]: https://wayland.app/protocols/pointer-constraints-unstable-v1
 
-GLFW uses the [xdg-decoration
-protocol](https://cgit.freedesktop.org/wayland/wayland-protocols/tree/unstable/xdg-decoration/xdg-decoration-unstable-v1.xml)
-to request decorations to be drawn around its windows.  This protocol is part
-of wayland-protocols 1.15, and mandatory at build time.  If the running
-compositor does not support this protocol, a very simple frame will be drawn by
-GLFW itself, using the [viewporter
-protocol](https://cgit.freedesktop.org/wayland/wayland-protocols/tree/stable/viewporter/viewporter.xml)
-alongside
-[subsurfaces](https://cgit.freedesktop.org/wayland/wayland/tree/protocol/wayland.xml#n2598).
-This protocol is part of wayland-protocols 1.4, and mandatory at build time.
-If the running compositor does not support this protocol either, no decorations
-will be drawn around windows.
+GLFW uses the [idle-inhibit-unstable-v1][] protocol to prohibit the screensaver
+from starting.  If the running compositor does not support this protocol, the
+screensaver may start even for full screen windows.
+
+[idle-inhibit-unstable-v1]: https://wayland.app/protocols/idle-inhibit-unstable-v1
+
+GLFW uses the [libdecor][] library for window decorations, where available.
+This in turn provides good quality client-side decorations (drawn by the
+application) on desktop systems that do not support server-side decorations
+(drawn by the window manager).  On systems that do not provide either libdecor
+or xdg-decoration, very basic window decorations are provided.  These do not
+include the window title or any caption buttons.
+
+[libdecor]: https://gitlab.freedesktop.org/libdecor/libdecor
+
+GLFW uses the [xdg-decoration-unstable-v1][] protocol to request decorations to
+be drawn around its windows.  This protocol is part of wayland-protocols 1.15,
+and mandatory at build time.  If the running compositor does not support this
+protocol, a very simple frame will be drawn by GLFW itself, using the
+[viewporter][] protocol alongside subsurfaces.  If the running compositor does
+not support these protocols either, no decorations will be drawn around windows.
+
+[xdg-decoration-unstable-v1]: https://wayland.app/protocols/xdg-decoration-unstable-v1
+[viewporter]: https://wayland.app/protocols/viewporter
+
+GLFW uses the [xdg-activation-v1][] protocol to implement window focus and
+attention requests.  If the running compositor does not support this protocol,
+window focus and attention requests do nothing.
+
+[xdg-activation-v1]: https://wayland.app/protocols/xdg-activation-v1
+
+GLFW uses the [fractional-scale-v1][] protocol to implement fine-grained
+framebuffer scaling.  If the running compositor does not support this protocol,
+the @ref GLFW_SCALE_FRAMEBUFFER window hint will only be able to scale the
+framebuffer by integer scales.  This will typically be the smallest integer not
+less than the actual scale.
+
+[fractional-scale-v1]: https://wayland.app/protocols/fractional-scale-v1
 
 
-@section compat_glx GLX extensions
+## GLX extensions {#compat_glx}
 
 The GLX API is the default API used to create OpenGL contexts on Unix-like
 systems using the X Window System.
@@ -164,10 +179,9 @@
 GLFW uses the `GLX_ARB_create_context` extension when available, even when
 creating OpenGL contexts of version 2.1 and below.  Where this extension is
 unavailable, the `GLFW_CONTEXT_VERSION_MAJOR` and `GLFW_CONTEXT_VERSION_MINOR`
-hints will only be partially supported, the `GLFW_OPENGL_DEBUG_CONTEXT` hint
-will have no effect, and setting the `GLFW_OPENGL_PROFILE` or
-`GLFW_OPENGL_FORWARD_COMPAT` hints to `GLFW_TRUE` will cause @ref
-glfwCreateWindow to fail.
+hints will only be partially supported, the `GLFW_CONTEXT_DEBUG` hint will have
+no effect, and setting the `GLFW_OPENGL_PROFILE` or `GLFW_OPENGL_FORWARD_COMPAT`
+hints to `GLFW_TRUE` will cause @ref glfwCreateWindow to fail.
 
 GLFW uses the `GLX_ARB_create_context_profile` extension to provide support for
 context profiles.  Where this extension is unavailable, setting the
@@ -185,7 +199,7 @@
 extensions are unavailable, the `GLFW_SRGB_CAPABLE` hint will have no effect.
 
 
-@section compat_wgl WGL extensions
+## WGL extensions {#compat_wgl}
 
 The WGL API is used to create OpenGL contexts on Microsoft Windows and other
 implementations of the Win32 API, such as Wine.
@@ -207,10 +221,9 @@
 GLFW uses the `WGL_ARB_create_context` extension when available, even when
 creating OpenGL contexts of version 2.1 and below.  Where this extension is
 unavailable, the `GLFW_CONTEXT_VERSION_MAJOR` and `GLFW_CONTEXT_VERSION_MINOR`
-hints will only be partially supported, the `GLFW_OPENGL_DEBUG_CONTEXT` hint
-will have no effect, and setting the `GLFW_OPENGL_PROFILE` or
-`GLFW_OPENGL_FORWARD_COMPAT` hints to `GLFW_TRUE` will cause @ref
-glfwCreateWindow to fail.
+hints will only be partially supported, the `GLFW_CONTEXT_DEBUG` hint will have
+no effect, and setting the `GLFW_OPENGL_PROFILE` or `GLFW_OPENGL_FORWARD_COMPAT`
+hints to `GLFW_TRUE` will cause @ref glfwCreateWindow to fail.
 
 GLFW uses the `WGL_ARB_create_context_profile` extension to provide support for
 context profiles.  Where this extension is unavailable, setting the
@@ -227,7 +240,7 @@
 extensions are unavailable, the `GLFW_SRGB_CAPABLE` hint will have no effect.
 
 
-@section compat_osx OpenGL on macOS
+## OpenGL on macOS {#compat_osx}
 
 Support for OpenGL 3.2 and above was introduced with OS X 10.7 and even then
 only forward-compatible, core profile contexts are supported.  Support for
@@ -238,19 +251,18 @@
 
 Because of this, on OS X 10.7 and later, the `GLFW_CONTEXT_VERSION_MAJOR` and
 `GLFW_CONTEXT_VERSION_MINOR` hints will cause @ref glfwCreateWindow to fail if
-given version 3.0 or 3.1.  The `GLFW_OPENGL_FORWARD_COMPAT` hint must be set to
-`GLFW_TRUE` and the `GLFW_OPENGL_PROFILE` hint must be set to
+given version 3.0 or 3.1.  The `GLFW_OPENGL_PROFILE` hint must be set to
 `GLFW_OPENGL_CORE_PROFILE` when creating OpenGL 3.2 and later contexts.  The
-`GLFW_OPENGL_DEBUG_CONTEXT` and `GLFW_CONTEXT_NO_ERROR` hints are ignored.
+`GLFW_CONTEXT_DEBUG` and `GLFW_CONTEXT_NO_ERROR` hints are ignored.
 
 Also, on Mac OS X 10.6 and below, the `GLFW_CONTEXT_VERSION_MAJOR` and
 `GLFW_CONTEXT_VERSION_MINOR` hints will fail if given a version above 2.1,
 setting the `GLFW_OPENGL_PROFILE` or `GLFW_OPENGL_FORWARD_COMPAT` hints to
 a non-default value will cause @ref glfwCreateWindow to fail and the
-`GLFW_OPENGL_DEBUG_CONTEXT` hint is ignored.
+`GLFW_CONTEXT_DEBUG` hint is ignored.
 
 
-@section compat_vulkan Vulkan loader and API
+## Vulkan loader and API {#compat_vulkan}
 
 By default, GLFW uses the standard system-wide Vulkan loader to access the
 Vulkan API on all platforms except macOS.  This is installed by both graphics
@@ -260,7 +272,7 @@
 error.
 
 
-@section compat_wsi Vulkan WSI extensions
+## Vulkan WSI extensions {#compat_wsi}
 
 The Vulkan WSI extensions are used to create Vulkan surfaces for GLFW windows on
 all supported platforms.
@@ -286,4 +298,3 @@
 glfwGetRequiredInstanceExtensions will return an empty list and window surface
 creation will fail.
 
-*/
diff --git a/docs/compile.dox b/docs/compile.dox
deleted file mode 100644
index 9bcf14c..0000000
--- a/docs/compile.dox
+++ /dev/null
@@ -1,368 +0,0 @@
-/*!
-
-@page compile_guide Compiling GLFW
-
-@tableofcontents
-
-This is about compiling the GLFW library itself.  For information on how to
-build applications that use GLFW, see @ref build_guide.
-
-
-@section compile_cmake Using CMake
-
-@note GLFW behaves like most other libraries that use CMake so this guide mostly
-describes the basic configure/generate/compile sequence.  If you are already
-familiar with this from other projects, you may want to focus on the @ref
-compile_deps and @ref compile_options sections for GLFW-specific information.
-
-GLFW uses [CMake](https://cmake.org/) to generate project files or makefiles
-for your chosen development environment.  To compile GLFW, first generate these
-files with CMake and then use them to compile the GLFW library. 
-
-If you are on Windows and macOS you can
-[download CMake](https://cmake.org/download/) from their site.
-
-If you are on a Unix-like system such as Linux, FreeBSD or Cygwin or have
-a package system like Fink, MacPorts or Homebrew, you can install its CMake
-package.
-
-CMake is a complex tool and this guide will only show a few of the possible ways
-to set up and compile GLFW.  The CMake project has their own much more detailed
-[CMake user guide](https://cmake.org/cmake/help/latest/guide/user-interaction/)
-that includes everything in this guide not specific to GLFW.  It may be a useful
-companion to this one.
-
-
-@subsection compile_deps Installing dependencies
-
-The C/C++ development environments in Visual Studio, Xcode and MinGW come with
-all necessary dependencies for compiling GLFW, but on Unix-like systems like
-Linux and FreeBSD you will need a few extra packages.
-
-
-@subsubsection compile_deps_x11 Dependencies for X11 on Unix-like systems
-
-To compile GLFW for X11, you need to have the X11 development packages
-installed.  They are not needed to build or run programs that use GLFW.
-
-On Debian and derivatives like Ubuntu and Linux Mint the `xorg-dev` meta-package
-pulls in the development packages for all of X11.
-
-@code{.sh}
-sudo apt install xorg-dev
-@endcode
-
-On Fedora and derivatives like Red Hat the X11 extension packages
-`libXcursor-devel`, `libXi-devel`, `libXinerama-devel` and `libXrandr-devel`
-required by GLFW pull in all its other dependencies.
-
-@code{.sh}
-sudo dnf install libXcursor-devel libXi-devel libXinerama-devel libXrandr-devel
-@endcode
-
-On FreeBSD the X11 headers are installed along the end-user X11 packages, so if
-you have an X server running you should have the headers as well.  If not,
-install the `xorgproto` package.
-
-@code{.sh}
-pkg install xorgproto
-@endcode
-
-On Cygwin the `libXcursor-devel`, `libXi-devel`, `libXinerama-devel`,
-`libXrandr-devel` and `libXrender-devel` packages in the Libs section of the GUI
-installer will install all the headers and other development related files GLFW
-requires for X11.
-
-Once you have the required depdendencies, move on to @ref compile_generate.
-
-
-@subsubsection compile_deps_wayland Dependencies for Wayland on Unix-like systems
-
-To compile GLFW for Wayland, you need to have the Wayland and xkbcommon
-development packages installed.  They are not needed to build or run programs
-that use GLFW.
-
-On Debian and derivatives like Ubuntu and Linux Mint you will need the `libwayland-dev`,
-`libxkbcommon-dev`, `wayland-protocols` and `extra-cmake-modules` packages.
-These will pull in all other dependencies.
-
-@code{.sh}
-sudo apt install libwayland-dev libxkbcommon-dev wayland-protocols extra-cmake-modules
-@endcode
-
-On Fedora and derivatives like Red Hat you will need the `wayland-devel`,
-`libxkbcommon-devel`, `wayland-protocols-devel` and `extra-cmake-modules` packages.
-
-@code{.sh}
-sudo dnf install wayland-devel libxkbcommon-devel wayland-protocols-devel extra-cmake-modules
-@endcode
-
-On FreeBSD you will need the `wayland`, `libxkbcommon`, `wayland-protocols`,
-`evdev-proto` and `kf5-extra-cmake-modules` packages.
-
-@code{.sh}
-pkg install wayland libxkbcommon wayland-protocols evdev-proto kf5-extra-cmake-modules
-@endcode
-
-Once you have the required depdendencies, move on to @ref compile_generate.
-
-
-@subsection compile_generate Generating build files with CMake
-
-Once you have all necessary dependencies it is time to generate the project
-files or makefiles for your development environment.  CMake needs two paths for
-this:
-
- - the path to the root directory of the GLFW source tree (not its `src`
-   subdirectory)
- - the path to the directory where the generated build files and compiled
-   binaries will be placed
-
-If these are the same, it is called an in-tree build, otherwise it is called an
-out-of-tree build.
-
-Out-of-tree builds are recommended as they avoid cluttering up the source tree.
-They also allow you to have several build directories for different
-configurations all using the same source tree.
-
-A common pattern when building a single configuration is to have a build
-directory named `build` in the root of the source tree.
-
-
-@subsubsection compile_generate_gui Generating files with the CMake GUI
-
-Start the CMake GUI and set the paths to the source and build directories
-described above.  Then press _Configure_ and _Generate_.
-
-If you wish change any CMake variables in the list, press _Configure_ and then
-_Generate_ to have the new values take effect.  The variable list will be
-populated after the first configure step.
-
-By default, GLFW will use X11 on Linux and other Unix-like systems other
-than macOS.  To use Wayland instead, set the `GLFW_USE_WAYLAND` option in the
-GLFW section of the variable list, then apply the new value as described above.
-
-Once you have generated the project files or makefiles for your chosen
-development environment, move on to @ref compile_compile.
-
-
-@subsubsection compile_generate_cli Generating files with the CMake command-line tool
-
-To make a build directory, pass the source and build directories to the `cmake`
-command.  These can be relative or absolute paths.  The build directory is
-created if it doesn't already exist.
-
-@code{.sh}
-cmake -S path/to/glfw -B path/to/build
-@endcode
-
-It is common to name the build directory `build` and place it in the root of the
-source tree when only planning to build a single configuration.
-
-@code{.sh}
-cd path/to/glfw
-cmake -S . -B build
-@endcode
-
-Without other flags these will generate Visual Studio project files on Windows
-and makefiles on other platforms.  You can choose other targets using the `-G`
-flag.
-
-@code{.sh}
-cmake -S path/to/glfw -B path/to/build -G Xcode
-@endcode
-
-By default, GLFW will use X11 on Linux and other Unix-like systems other
-than macOS.  To use Wayland instead, set the `GLFW_USE_WAYLAND` CMake option.
-
-@code{.sh}
-cmake -S path/to/glfw -B path/to/build -D GLFW_USE_WAYLAND=1
-@endcode
-
-Once you have generated the project files or makefiles for your chosen
-development environment, move on to @ref compile_compile.
-
-
-@subsection compile_compile Compiling the library
-
-You should now have all required dependencies and the project files or makefiles
-necessary to compile GLFW.  Go ahead and compile the actual GLFW library with
-these files as you would with any other project.
-
-With Visual Studio open `GLFW.sln` and use the Build menu.  With Xcode open
-`GLFW.xcodeproj` and use the Project menu.
-
-With Linux, macOS and other forms of Unix, run `make`.
-
-@code{.sh}
-cd path/to/build
-make
-@endcode
-
-With MinGW, it is `mingw32-make`.
-
-@code{.sh}
-cd path/to/build
-mingw32-make
-@endcode
-
-Any CMake build directory can also be built with the `cmake` command and the
-`--build` flag.
-
-@code{.sh}
-cmake --build path/to/build
-@endcode
-
-This will run the platform specific build tool the directory was generated for.
-
-Once the GLFW library is compiled you are ready to build your application,
-linking it to the GLFW library.  See @ref build_guide for more information.
-
-
-@section compile_options CMake options
-
-The CMake files for GLFW provide a number of options, although not all are
-available on all supported platforms.  Some of these are de facto standards
-among projects using CMake and so have no `GLFW_` prefix.
-
-If you are using the GUI version of CMake, these are listed and can be changed
-from there.  If you are using the command-line version of CMake you can use the
-`ccmake` ncurses GUI to set options.  Some package systems like Ubuntu and other
-distributions based on Debian GNU/Linux have this tool in a separate
-`cmake-curses-gui` package.
-
-Finally, if you don't want to use any GUI, you can set options from the `cmake`
-command-line with the `-D` flag.
-
-@code{.sh}
-cmake -S path/to/glfw -B path/to/build -D BUILD_SHARED_LIBS=ON
-@endcode
-
-
-@subsection compile_options_shared Shared CMake options
-
-@anchor BUILD_SHARED_LIBS
-__BUILD_SHARED_LIBS__ determines whether GLFW is built as a static
-library or as a DLL / shared library / dynamic library.  This is disabled by
-default, producing a static GLFW library.
-
-@anchor GLFW_BUILD_EXAMPLES
-__GLFW_BUILD_EXAMPLES__ determines whether the GLFW examples are built
-along with the library.
-
-@anchor GLFW_BUILD_TESTS
-__GLFW_BUILD_TESTS__ determines whether the GLFW test programs are
-built along with the library.
-
-@anchor GLFW_BUILD_DOCS
-__GLFW_BUILD_DOCS__ determines whether the GLFW documentation is built along
-with the library.  This is enabled by default if
-[Doxygen](https://www.doxygen.nl/) is found by CMake during configuration.
-
-@anchor GLFW_VULKAN_STATIC
-__GLFW_VULKAN_STATIC__ determines whether to use the Vulkan loader linked
-directly with the application.  This is disabled by default.
-
-
-@subsection compile_options_win32 Windows specific CMake options
-
-@anchor USE_MSVC_RUNTIME_LIBRARY_DLL
-__USE_MSVC_RUNTIME_LIBRARY_DLL__ determines whether to use the DLL version or the
-static library version of the Visual C++ runtime library.  When enabled, the
-DLL version of the Visual C++ library is used.  This is enabled by default.
-
-On CMake 3.15 and later you can set the standard CMake
-[CMAKE_MSVC_RUNTIME_LIBRARY](https://cmake.org/cmake/help/latest/variable/CMAKE_MSVC_RUNTIME_LIBRARY.html)
-variable instead of this GLFW-specific option.
-
-@anchor GLFW_USE_HYBRID_HPG
-__GLFW_USE_HYBRID_HPG__ determines whether to export the `NvOptimusEnablement` and
-`AmdPowerXpressRequestHighPerformance` symbols, which force the use of the
-high-performance GPU on Nvidia Optimus and AMD PowerXpress systems.  These symbols
-need to be exported by the EXE to be detected by the driver, so the override
-will not work if GLFW is built as a DLL.  This is disabled by default, letting
-the operating system and driver decide.
-
-
-@subsection compile_options_wayland Wayland specific CMake options
-
-@anchor GLFW_USE_WAYLAND
-__GLFW_USE_WAYLAND__ determines whether to compile the library for Wayland.
-This option is only available on Linux and other Unix-like systems other than
-macOS.  This is disabled by default.
-
-
-@section compile_mingw_cross Cross-compilation with CMake and MinGW
-
-Both Cygwin and many Linux distributions have MinGW or MinGW-w64 packages.  For
-example, Cygwin has the `mingw64-i686-gcc` and `mingw64-x86_64-gcc` packages
-for 32- and 64-bit version of MinGW-w64, while Debian GNU/Linux and derivatives
-like Ubuntu have the `mingw-w64` package for both.
-
-GLFW has CMake toolchain files in the `CMake` subdirectory that set up
-cross-compilation of Windows binaries.  To use these files you set the
-`CMAKE_TOOLCHAIN_FILE` CMake variable with the `-D` flag add an option when
-configuring and generating the build files.
-
-@code{.sh}
-cmake -S path/to/glfw -B path/to/build -D CMAKE_TOOLCHAIN_FILE=path/to/file
-@endcode
-
-The exact toolchain file to use depends on the prefix used by the MinGW or
-MinGW-w64 binaries on your system.  You can usually see this in the /usr
-directory.  For example, both the Ubuntu and Cygwin MinGW-w64 packages have
-`/usr/x86_64-w64-mingw32` for the 64-bit compilers, so the correct invocation
-would be:
-
-@code{.sh}
-cmake -S path/to/glfw -B path/to/build -D CMAKE_TOOLCHAIN_FILE=CMake/x86_64-w64-mingw32.cmake
-@endcode
-
-The path to the toolchain file is relative to the path to the GLFW source tree
-passed to the `-S` flag, not to the current directory.
-
-For more details see the
-[CMake toolchain guide](https://cmake.org/cmake/help/latest/manual/cmake-toolchains.7.html).
-
-
-@section compile_manual Compiling GLFW manually
-
-If you wish to compile GLFW without its CMake build environment then you will
-have to do at least some of the platform-detection yourself.  GLFW needs
-a configuration macro to be defined in order to know what window system it is
-being compiled for and also has optional, platform-specific ones for various
-features.
-
-When building with CMake, the `glfw_config.h` configuration header is generated
-based on the current platform and CMake options.  The GLFW CMake environment
-defines @b GLFW_USE_CONFIG_H, which causes this header to be included by
-`internal.h`.  Without this macro, GLFW will expect the necessary configuration
-macros to be defined on the command-line.
-
-The window creation API is used to create windows, handle input, monitors, gamma
-ramps and clipboard.  The options are:
-
- - @b _GLFW_COCOA to use the Cocoa frameworks
- - @b _GLFW_WIN32 to use the Win32 API
- - @b _GLFW_X11 to use the X Window System
- - @b _GLFW_WAYLAND to use the Wayland API (experimental and incomplete)
- - @b _GLFW_OSMESA to use the OSMesa API (headless and non-interactive)
-
-If you are building GLFW as a shared library / dynamic library / DLL then you
-must also define @b _GLFW_BUILD_DLL.  Otherwise, you must not define it.
-
-If you are linking the Vulkan loader directly with your application then you
-must also define @b _GLFW_VULKAN_STATIC.  Otherwise, GLFW will attempt to use the
-external version.
-
-If you are using a custom name for the Vulkan, EGL, GLX, OSMesa, OpenGL, GLESv1
-or GLESv2 library, you can override the default names by defining those you need
-of @b _GLFW_VULKAN_LIBRARY, @b _GLFW_EGL_LIBRARY, @b _GLFW_GLX_LIBRARY, @b
-_GLFW_OSMESA_LIBRARY, @b _GLFW_OPENGL_LIBRARY, @b _GLFW_GLESV1_LIBRARY and @b
-_GLFW_GLESV2_LIBRARY.  Otherwise, GLFW will use the built-in default names.
-
-@note None of the @ref build_macros may be defined during the compilation of
-GLFW.  If you define any of these in your build files, make sure they are not
-applied to the GLFW sources.
-
-*/
diff --git a/docs/compile.md b/docs/compile.md
new file mode 100644
index 0000000..f8385fe
--- /dev/null
+++ b/docs/compile.md
@@ -0,0 +1,371 @@
+# Compiling GLFW {#compile_guide}
+
+[TOC]
+
+This is about compiling the GLFW library itself.  For information on how to
+build applications that use GLFW, see @ref build_guide.
+
+GLFW uses some C99 features and does not support Visual Studio 2012 and earlier.
+
+
+## Using CMake {#compile_cmake}
+
+GLFW behaves like most other libraries that use CMake so this guide mostly
+describes the standard configure, generate and compile sequence.  If you are already
+familiar with this from other projects, you may want to focus on the @ref
+compile_deps and @ref compile_options sections for GLFW-specific information.
+
+GLFW uses [CMake](https://cmake.org/) to generate project files or makefiles
+for your chosen development environment.  To compile GLFW, first generate these
+files with CMake and then use them to compile the GLFW library. 
+
+If you are on Windows and macOS you can [download
+CMake](https://cmake.org/download/) from their site.
+
+If you are on a Unix-like system such as Linux, FreeBSD or Cygwin or have
+a package system like Fink, MacPorts or Homebrew, you can install its CMake
+package.
+
+CMake is a complex tool and this guide will only show a few of the possible ways
+to set up and compile GLFW.  The CMake project has their own much more detailed
+[CMake user guide][cmake-guide] that includes everything in this guide not
+specific to GLFW.  It may be a useful companion to this one.
+
+[cmake-guide]: https://cmake.org/cmake/help/latest/guide/user-interaction/
+
+
+### Installing dependencies {#compile_deps}
+
+The C/C++ development environments in Visual Studio, Xcode and MinGW come with
+all necessary dependencies for compiling GLFW, but on Unix-like systems like
+Linux and FreeBSD you will need a few extra packages.
+
+
+#### Dependencies for Wayland and X11 {#compile_deps_wayland}
+
+By default, both the Wayland and X11 backends are enabled on Linux and other Unix-like
+systems (except macOS).  To disable one or both of these, set the @ref GLFW_BUILD_WAYLAND
+or @ref GLFW_BUILD_X11 CMake options in the next step when generating build files.
+
+To compile GLFW for both Wayland and X11, you need to have the X11, Wayland and xkbcommon
+development packages installed.  On some systems a few other packages are also required.
+None of the development packages above are needed to build or run programs that use an
+already compiled GLFW library.
+
+On Debian and derivatives like Ubuntu and Linux Mint you will need the `libwayland-dev`
+and `libxkbcommon-dev` packages to compile for Wayland and the `xorg-dev` meta-package to
+compile for X11.  These will pull in all other dependencies.
+
+```sh
+sudo apt install libwayland-dev libxkbcommon-dev xorg-dev
+```
+
+On Fedora and derivatives like Red Hat you will need the `wayland-devel` and
+`libxkbcommon-devel` packages to compile for Wayland and the `libXcursor-devel`,
+`libXi-devel`, `libXinerama-devel` and `libXrandr-devel` packages to compile for X11.
+These will pull in all other dependencies.
+
+```sh
+sudo dnf install wayland-devel libxkbcommon-devel libXcursor-devel libXi-devel libXinerama-devel libXrandr-devel
+```
+
+On FreeBSD you will need the `wayland`, `libxkbcommon` and `evdev-proto` packages to
+compile for Wayland.  The X11 headers are installed along the end-user X11 packages, so if
+you have an X server running you should have the headers as well.  If not, install the
+`xorgproto` package to compile for X11.
+
+```sh
+pkg install wayland libxkbcommon evdev-proto xorgproto
+```
+
+On Cygwin Wayland is not supported but you will need the `libXcursor-devel`,
+`libXi-devel`, `libXinerama-devel`, `libXrandr-devel` and `libXrender-devel` packages to
+compile for X11.  These can be found in the Libs section of the GUI installer and will
+pull in all other dependencies.
+
+Once you have the required dependencies, move on to @ref compile_generate.
+
+
+### Generating build files with CMake {#compile_generate}
+
+Once you have all necessary dependencies it is time to generate the project
+files or makefiles for your development environment.  CMake needs two paths for
+this:
+
+ - the path to the root directory of the GLFW source tree (not its `src`
+   subdirectory)
+ - the path to the directory where the generated build files and compiled
+   binaries will be placed
+
+If these are the same, it is called an in-tree build, otherwise it is called an
+out-of-tree build.
+
+Out-of-tree builds are recommended as they avoid cluttering up the source tree.
+They also allow you to have several build directories for different
+configurations all using the same source tree.
+
+A common pattern when building a single configuration is to have a build
+directory named `build` in the root of the source tree.
+
+
+#### Generating with the CMake GUI {#compile_generate_gui}
+
+Start the CMake GUI and set the paths to the source and build directories
+described above.  Then press _Configure_ and _Generate_.
+
+If you wish change any CMake variables in the list, press _Configure_ and then
+_Generate_ to have the new values take effect.  The variable list will be
+populated after the first configure step.
+
+By default, GLFW will use Wayland and X11 on Linux and other Unix-like systems other than
+macOS.  To disable support for one or both of these, set the @ref GLFW_BUILD_WAYLAND
+and/or @ref GLFW_BUILD_X11 option in the GLFW section of the variable list, then apply the
+new value as described above.
+
+Once you have generated the project files or makefiles for your chosen
+development environment, move on to @ref compile_compile.
+
+
+#### Generating with command-line CMake {#compile_generate_cli}
+
+To make a build directory, pass the source and build directories to the `cmake`
+command.  These can be relative or absolute paths.  The build directory is
+created if it doesn't already exist.
+
+```sh
+cmake -S path/to/glfw -B path/to/build
+```
+
+It is common to name the build directory `build` and place it in the root of the
+source tree when only planning to build a single configuration.
+
+```sh
+cd path/to/glfw
+cmake -S . -B build
+```
+
+Without other flags these will generate Visual Studio project files on Windows
+and makefiles on other platforms.  You can choose other targets using the `-G`
+flag.
+
+```sh
+cmake -S path/to/glfw -B path/to/build -G Xcode
+```
+
+By default, GLFW will use Wayland and X11 on Linux and other Unix-like systems other than
+macOS.  To disable support for one or both of these, set the @ref GLFW_BUILD_WAYLAND
+and/or @ref GLFW_BUILD_X11 CMake option.
+
+```sh
+cmake -S path/to/glfw -B path/to/build -D GLFW_BUILD_X11=0
+```
+
+Once you have generated the project files or makefiles for your chosen
+development environment, move on to @ref compile_compile.
+
+
+### Compiling the library {#compile_compile}
+
+You should now have all required dependencies and the project files or makefiles
+necessary to compile GLFW.  Go ahead and compile the actual GLFW library with
+these files as you would with any other project.
+
+With Visual Studio open `GLFW.sln` and use the Build menu.  With Xcode open
+`GLFW.xcodeproj` and use the Project menu.
+
+With Linux, macOS and other forms of Unix, run `make`.
+
+```sh
+cd path/to/build
+make
+```
+
+With MinGW, it is `mingw32-make`.
+
+```sh
+cd path/to/build
+mingw32-make
+```
+
+Any CMake build directory can also be built with the `cmake` command and the
+`--build` flag.
+
+```sh
+cmake --build path/to/build
+```
+
+This will run the platform specific build tool the directory was generated for.
+
+Once the GLFW library is compiled you are ready to build your application,
+linking it to the GLFW library.  See @ref build_guide for more information.
+
+
+## CMake options {#compile_options}
+
+The CMake files for GLFW provide a number of options, although not all are
+available on all supported platforms.  Some of these are de facto standards
+among projects using CMake and so have no `GLFW_` prefix.
+
+If you are using the GUI version of CMake, these are listed and can be changed
+from there.  If you are using the command-line version of CMake you can use the
+`ccmake` ncurses GUI to set options.  Some package systems like Ubuntu and other
+distributions based on Debian GNU/Linux have this tool in a separate
+`cmake-curses-gui` package.
+
+Finally, if you don't want to use any GUI, you can set options from the `cmake`
+command-line with the `-D` flag.
+
+```sh
+cmake -S path/to/glfw -B path/to/build -D BUILD_SHARED_LIBS=ON
+```
+
+
+### Shared CMake options {#compile_options_shared}
+
+@anchor BUILD_SHARED_LIBS
+__BUILD_SHARED_LIBS__ determines whether GLFW is built as a static library or as
+a DLL / shared library / dynamic library.  This is disabled by default,
+producing a static GLFW library.  This variable has no `GLFW_` prefix because it
+is defined by CMake.  If you want to change the library only for GLFW when it is
+part of a larger project, see @ref GLFW_LIBRARY_TYPE.
+
+@anchor GLFW_LIBRARY_TYPE
+__GLFW_LIBRARY_TYPE__ allows you to override @ref BUILD_SHARED_LIBS only for
+GLFW, without affecting other libraries in a larger project.  When set, the
+value of this option must be a valid CMake library type.  Set it to `STATIC` to
+build GLFW as a static library, `SHARED` to build it as a shared library
+/ dynamic library / DLL, or `OBJECT` to make GLFW a CMake object library.
+
+@anchor GLFW_BUILD_EXAMPLES
+__GLFW_BUILD_EXAMPLES__ determines whether the GLFW examples are built
+along with the library.  This is enabled by default unless GLFW is being built
+as a subproject of a larger CMake project.
+
+@anchor GLFW_BUILD_TESTS
+__GLFW_BUILD_TESTS__ determines whether the GLFW test programs are
+built along with the library.  This is enabled by default unless GLFW is being
+built as a subproject of a larger CMake project.
+
+@anchor GLFW_BUILD_DOCS
+__GLFW_BUILD_DOCS__ determines whether the GLFW documentation is built along
+with the library.  This is enabled by default if
+[Doxygen](https://www.doxygen.nl/) is found by CMake during configuration.
+
+
+### Win32 specific CMake options {#compile_options_win32}
+
+@anchor GLFW_BUILD_WIN32
+__GLFW_BUILD_WIN32__ determines whether to include support for Win32 when compiling the
+library.  This option is only available when compiling for Windows.  This is enabled by
+default.
+
+@anchor USE_MSVC_RUNTIME_LIBRARY_DLL
+__USE_MSVC_RUNTIME_LIBRARY_DLL__ determines whether to use the DLL version or the
+static library version of the Visual C++ runtime library.  When enabled, the
+DLL version of the Visual C++ library is used.  This is enabled by default.
+
+On CMake 3.15 and later you can set the standard CMake [CMAKE_MSVC_RUNTIME_LIBRARY][]
+variable instead of this GLFW-specific option.
+
+[CMAKE_MSVC_RUNTIME_LIBRARY]: https://cmake.org/cmake/help/latest/variable/CMAKE_MSVC_RUNTIME_LIBRARY.html
+
+@anchor GLFW_USE_HYBRID_HPG
+__GLFW_USE_HYBRID_HPG__ determines whether to export the `NvOptimusEnablement` and
+`AmdPowerXpressRequestHighPerformance` symbols, which force the use of the
+high-performance GPU on Nvidia Optimus and AMD PowerXpress systems.  These symbols
+need to be exported by the EXE to be detected by the driver, so the override
+will not work if GLFW is built as a DLL.  This is disabled by default, letting
+the operating system and driver decide.
+
+
+### macOS specific CMake options {#compile_options_macos}
+
+@anchor GLFW_BUILD_COCOA
+__GLFW_BUILD_COCOA__ determines whether to include support for Cocoa when compiling the
+library.  This option is only available when compiling for macOS.  This is enabled by
+default.
+
+
+### Unix-like system specific CMake options {#compile_options_unix}
+
+@anchor GLFW_BUILD_WAYLAND
+__GLFW_BUILD_WAYLAND__ determines whether to include support for Wayland when compiling
+the library.  This option is only available when compiling for Linux and other Unix-like
+systems other than macOS.  This is enabled by default.
+
+@anchor GLFW_BUILD_X11
+__GLFW_BUILD_X11__ determines whether to include support for X11 when compiling the
+library.  This option is only available when compiling for Linux and other Unix-like
+systems other than macOS.  This is enabled by default.
+
+
+## Cross-compilation with CMake and MinGW {#compile_mingw_cross}
+
+Both Cygwin and many Linux distributions have MinGW or MinGW-w64 packages.  For
+example, Cygwin has the `mingw64-i686-gcc` and `mingw64-x86_64-gcc` packages
+for 32- and 64-bit version of MinGW-w64, while Debian GNU/Linux and derivatives
+like Ubuntu have the `mingw-w64` package for both.
+
+GLFW has CMake toolchain files in the `CMake` subdirectory that set up
+cross-compilation of Windows binaries.  To use these files you set the
+`CMAKE_TOOLCHAIN_FILE` CMake variable with the `-D` flag add an option when
+configuring and generating the build files.
+
+```sh
+cmake -S path/to/glfw -B path/to/build -D CMAKE_TOOLCHAIN_FILE=path/to/file
+```
+
+The exact toolchain file to use depends on the prefix used by the MinGW or
+MinGW-w64 binaries on your system.  You can usually see this in the /usr
+directory.  For example, both the Ubuntu and Cygwin MinGW-w64 packages have
+`/usr/x86_64-w64-mingw32` for the 64-bit compilers, so the correct invocation
+would be:
+
+```sh
+cmake -S path/to/glfw -B path/to/build -D CMAKE_TOOLCHAIN_FILE=CMake/x86_64-w64-mingw32.cmake
+```
+
+The path to the toolchain file is relative to the path to the GLFW source tree
+passed to the `-S` flag, not to the current directory.
+
+For more details see the [CMake toolchain guide][cmake-toolchains].
+
+[cmake-toolchains]: https://cmake.org/cmake/help/latest/manual/cmake-toolchains.7.html
+
+
+## Compiling GLFW manually {#compile_manual}
+
+If you wish to compile GLFW without its CMake build environment then you will have to do
+at least some platform-detection yourself.  There are preprocessor macros for
+enabling support for the platforms (window systems) available.  There are also optional,
+platform-specific macros for various features.
+
+When building, GLFW will expect the necessary configuration macros to be defined
+on the command-line.  The GLFW CMake files set these as private compile
+definitions on the GLFW target but if you compile the GLFW sources manually you
+will need to define them yourself.
+
+The window system is used to create windows, handle input, monitors, gamma ramps and
+clipboard.  The options are:
+
+ - @b _GLFW_COCOA to use the Cocoa frameworks
+ - @b _GLFW_WIN32 to use the Win32 API
+ - @b _GLFW_WAYLAND to use the Wayland protocol
+ - @b _GLFW_X11 to use the X Window System
+
+The @b _GLFW_WAYLAND and @b _GLFW_X11 macros may be combined and produces a library that
+attempts to detect the appropriate platform at initialization.
+
+If you are building GLFW as a shared library / dynamic library / DLL then you
+must also define @b _GLFW_BUILD_DLL.  Otherwise, you must not define it.
+
+If you are using a custom name for the Vulkan, EGL, GLX, OSMesa, OpenGL, GLESv1
+or GLESv2 library, you can override the default names by defining those you need
+of @b _GLFW_VULKAN_LIBRARY, @b _GLFW_EGL_LIBRARY, @b _GLFW_GLX_LIBRARY, @b
+_GLFW_OSMESA_LIBRARY, @b _GLFW_OPENGL_LIBRARY, @b _GLFW_GLESV1_LIBRARY and @b
+_GLFW_GLESV2_LIBRARY.  Otherwise, GLFW will use the built-in default names.
+
+@note None of the @ref build_macros may be defined during the compilation of
+GLFW.  If you define any of these in your build files, make sure they are not
+applied to the GLFW sources.
+
diff --git a/docs/context.dox b/docs/context.md
similarity index 90%
rename from docs/context.dox
rename to docs/context.md
index 2fd74ed..bf70553 100644
--- a/docs/context.dox
+++ b/docs/context.md
@@ -1,8 +1,6 @@
-/*!
+# Context guide {#context_guide}
 
-@page context_guide Context guide
-
-@tableofcontents
+[TOC]
 
 This guide introduces the OpenGL and OpenGL ES context related functions of
 GLFW.  For details on a specific function in this category, see the @ref
@@ -15,7 +13,7 @@
  - @ref input_guide
 
 
-@section context_object Context objects
+## Context objects {#context_object}
 
 A window object encapsulates both a top-level window and an OpenGL or OpenGL ES
 context.  It is created with @ref glfwCreateWindow and destroyed with @ref
@@ -34,22 +32,22 @@
 hint to `GLFW_NO_API`.  For more information, see the @ref vulkan_guide.
 
 
-@subsection context_hints Context creation hints
+### Context creation hints {#context_hints}
 
 There are a number of hints, specified using @ref glfwWindowHint, related to
 what kind of context is created.  See
 [context related hints](@ref window_hints_ctx) in the window guide.
 
 
-@subsection context_sharing Context object sharing
+### Context object sharing {#context_sharing}
 
 When creating a window and its OpenGL or OpenGL ES context with @ref
 glfwCreateWindow, you can specify another window whose context the new one
 should share its objects (textures, vertex and element buffers, etc.) with.
 
-@code
+```c
 GLFWwindow* second_window = glfwCreateWindow(640, 480, "Second Window", NULL, first_window);
-@endcode
+```
 
 Object sharing is implemented by the operating system and graphics driver.  On
 platforms where it is possible to choose which types of objects are shared, GLFW
@@ -64,17 +62,17 @@
 GLFW comes with a bare-bones object sharing example program called `sharing`.
 
 
-@subsection context_offscreen Offscreen contexts
+### Offscreen contexts {#context_offscreen}
 
 GLFW doesn't support creating contexts without an associated window.  However,
 contexts with hidden windows can be created with the
 [GLFW_VISIBLE](@ref GLFW_VISIBLE_hint) window hint.
 
-@code
+```c
 glfwWindowHint(GLFW_VISIBLE, GLFW_FALSE);
 
 GLFWwindow* offscreen_context = glfwCreateWindow(640, 480, "", NULL, NULL);
-@endcode
+```
 
 The window never needs to be shown and its context can be used as a plain
 offscreen context.  Depending on the window manager, the size of a hidden
@@ -84,12 +82,8 @@
 You should still [process events](@ref events) as long as you have at least one
 window, even if none of them are visible.
 
-@macos The first time a window is created the menu bar is created.  This is not
-desirable for example when writing a command-line only application.  Menu bar
-creation can be disabled with the @ref GLFW_COCOA_MENUBAR init hint.
 
-
-@subsection context_less Windows without contexts
+### Windows without contexts {#context_less}
 
 You can disable context creation by setting the
 [GLFW_CLIENT_API](@ref GLFW_CLIENT_API_hint) hint to `GLFW_NO_API`.
@@ -98,7 +92,7 @@
 @ref glfwSwapBuffers.  Doing this generates a @ref GLFW_NO_WINDOW_CONTEXT error.
 
 
-@section context_current Current context
+## Current context {#context_current}
 
 Before you can make OpenGL or OpenGL ES calls, you need to have a current
 context of the correct type.  A context can only be current for a single thread
@@ -109,15 +103,15 @@
 
 The context of a window is made current with @ref glfwMakeContextCurrent.
 
-@code
+```c
 glfwMakeContextCurrent(window);
-@endcode
+```
 
 The window of the current context is returned by @ref glfwGetCurrentContext.
 
-@code
+```c
 GLFWwindow* window = glfwGetCurrentContext();
-@endcode
+```
 
 The following GLFW functions require a context to be current.  Calling any these
 functions without a current context will generate a @ref GLFW_NO_CURRENT_CONTEXT
@@ -128,12 +122,12 @@
  - @ref glfwGetProcAddress
 
 
-@section context_swap Buffer swapping
+## Buffer swapping {#context_swap}
 
 See @ref buffer_swap in the window guide.
 
 
-@section context_glext OpenGL and OpenGL ES extensions
+## OpenGL and OpenGL ES extensions {#context_glext}
 
 One of the benefits of OpenGL and OpenGL ES is their extensibility.
 Hardware vendors may include extensions in their implementations that extend the
@@ -156,7 +150,7 @@
 [OpenGL ES Registry](https://www.khronos.org/registry/gles/).
 
 
-@subsection context_glext_auto Loading extension with a loader library
+### Loading extension with a loader library {#context_glext_auto}
 
 An extension loader library is the easiest and best way to access both OpenGL and
 OpenGL ES extensions and modern versions of the core OpenGL or OpenGL ES APIs.
@@ -173,9 +167,9 @@
 API versions and extension sets can be generated.  The generated files are
 written to the `output` directory.
 
-@code{.sh}
+```sh
 python main.py --generator c --no-loader --out-path output
-@endcode
+```
 
 The `--no-loader` option is added because GLFW already provides a function for
 loading OpenGL and OpenGL ES function pointers, one that automatically uses the
@@ -189,14 +183,14 @@
 development environment.  By including the glad header before the GLFW header,
 it suppresses the development environment's OpenGL or OpenGL ES header.
 
-@code
+```c
 #include <glad/glad.h>
 #include <GLFW/glfw3.h>
-@endcode
+```
 
 Finally, you need to initialize glad once you have a suitable current context.
 
-@code
+```c
 window = glfwCreateWindow(640, 480, "My Window", NULL, NULL);
 if (!window)
 {
@@ -206,7 +200,7 @@
 glfwMakeContextCurrent(window);
 
 gladLoadGLLoader((GLADloadproc) glfwGetProcAddress);
-@endcode
+```
 
 Once glad has been loaded, you have access to all OpenGL core and extension
 functions supported by both the context you created and the glad loader you
@@ -219,25 +213,25 @@
 a specific version is supported by the current context with the
 `GLAD_GL_VERSION_x_x` booleans.
 
-@code
+```c
 if (GLAD_GL_VERSION_3_2)
 {
     // Call OpenGL 3.2+ specific code
 }
-@endcode
+```
 
 To check whether a specific extension is supported, use the `GLAD_GL_xxx`
 booleans.
 
-@code
+```c
 if (GLAD_GL_ARB_gl_spirv)
 {
     // Use GL_ARB_gl_spirv
 }
-@endcode
+```
 
 
-@subsection context_glext_manual Loading extensions manually
+### Loading extensions manually {#context_glext_manual}
 
 __Do not use this technique__ unless it is absolutely necessary.  An
 [extension loader library](@ref context_glext_auto) will save you a ton of
@@ -252,7 +246,7 @@
 of OpenGL ES extensions is identical except for the name of the extension header.
 
 
-@subsubsection context_glext_header The glext.h header
+#### The glext.h header {#context_glext_header}
 
 The `glext.h` extension header is a continually updated file that defines the
 interfaces for all OpenGL extensions.  The latest version of this can always be
@@ -271,41 +265,41 @@
 To include the extension header, define @ref GLFW_INCLUDE_GLEXT before including
 the GLFW header.
 
-@code
+```c
 #define GLFW_INCLUDE_GLEXT
 #include <GLFW/glfw3.h>
-@endcode
+```
 
 
-@subsubsection context_glext_string Checking for extensions
+#### Checking for extensions {#context_glext_string}
 
 A given machine may not actually support the extension (it may have older
 drivers or a graphics card that lacks the necessary hardware features), so it
 is necessary to check at run-time whether the context supports the extension.
 This is done with @ref glfwExtensionSupported.
 
-@code
+```c
 if (glfwExtensionSupported("GL_ARB_gl_spirv"))
 {
     // The extension is supported by the current context
 }
-@endcode
+```
 
 The argument is a null terminated ASCII string with the extension name.  If the
 extension is supported, @ref glfwExtensionSupported returns `GLFW_TRUE`,
 otherwise it returns `GLFW_FALSE`.
 
 
-@subsubsection context_glext_proc Fetching function pointers
+#### Fetching function pointers {#context_glext_proc}
 
 Many extensions, though not all, require the use of new OpenGL functions.
 These functions often do not have entry points in the client API libraries of
 your operating system, making it necessary to fetch them at run time.  You can
 retrieve pointers to these functions with @ref glfwGetProcAddress.
 
-@code
+```c
 PFNGLSPECIALIZESHADERARBPROC pfnSpecializeShaderARB = glfwGetProcAddress("glSpecializeShaderARB");
-@endcode
+```
 
 In general, you should avoid giving the function pointer variables the (exact)
 same name as the function, as this may confuse your linker.  Instead, you can
@@ -314,7 +308,7 @@
 Now that all the pieces have been introduced, here is what they might look like
 when used together.
 
-@code
+```c
 #define GLFW_INCLUDE_GLEXT
 #include <GLFW/glfw3.h>
 
@@ -342,6 +336,5 @@
         glSpecializeShaderARB(...);
     }
 }
-@endcode
+```
 
-*/
diff --git a/docs/extra.css b/docs/extra.css
index 05c1938..7eb7e9d 100644
--- a/docs/extra.css
+++ b/docs/extra.css
@@ -1 +1,2 @@
-.sm-dox,.sm-dox a,.sm-dox a:focus,.sm-dox a:active,.sm-dox a:hover,.sm-dox a.highlighted,.sm-dox ul a:hover{background:none;text-shadow:none}.sm-dox a span.sub-arrow{border-color:#f2f2f2 transparent transparent transparent}.sm-dox a span.sub-arrow:active,.sm-dox a span.sub-arrow:focus,.sm-dox a span.sub-arrow:hover,.sm-dox a:hover span.sub-arrow{border-color:#f60 transparent transparent transparent}.sm-dox ul a span.sub-arrow:active,.sm-dox ul a span.sub-arrow:focus,.sm-dox ul a span.sub-arrow:hover,.sm-dox ul a:hover span.sub-arrow{border-color:transparent transparent transparent #f60}.sm-dox ul a:hover{background:#666;text-shadow:none}.sm-dox ul.sm-nowrap a{color:#4d4d4d;text-shadow:none}#main-nav,#main-menu,#main-menu a,#main-menu a:visited,#main-menu a:hover,#main-menu li,.memdoc,dl.reflist dd,div.toc li,.ah,span.lineno,span.lineno a,span.lineno a:hover,.note code,.pre code,.post code,.invariant code,.warning code,.attention code,.deprecated code,.bug code,.todo code,.test code,.doxtable code,.markdownTable code{background:none}#titlearea,.footer,.contents,div.header,.memdoc,table.doxtable td,table.doxtable th,table.markdownTable td,table.markdownTable th,hr,.memSeparator{border:none}#main-menu a,#main-menu a:visited,#main-menu a:hover,#main-menu li,.reflist dt a.el,.levels span,.directory .levels span{text-shadow:none}.memdoc,dl.reflist dd{box-shadow:none}div.headertitle,.note code,.pre code,.post code,.invariant code,.warning code,.attention code,.deprecated code,.bug code,.todo code,.test code,table.doxtable code,table.markdownTable code{padding:0}#nav-path,.directory .levels,span.lineno{display:none}html,#titlearea,.footer,tr.even,.directory tr.even,.doxtable tr:nth-child(even),tr.markdownTableBody:nth-child(even),.mdescLeft,.mdescRight,.memItemLeft,.memItemRight,code,.markdownTableRowEven{background:#f2f2f2}body{color:#4d4d4d}h1,h2,h2.groupheader,h3,div.toc h3,h4,h5,h6,strong,em{color:#1a1a1a;border-bottom:none}h1{padding-top:.5em;font-size:180%}h2{padding-top:.5em;margin-bottom:0;font-size:140%}h3{padding-top:.5em;margin-bottom:0;font-size:110%}.glfwheader{font-size:16px;min-height:64px;max-width:920px;padding:0 32px;margin:0 auto;display:flex;flex-direction:row;flex-wrap:wrap;justify-content:flex-start;align-items:center;align-content:stretch}#glfwhome{line-height:64px;padding-right:48px;color:#666;font-size:2.5em;background:url("https://www.glfw.org/css/arrow.png") no-repeat right}.glfwnavbar{list-style-type:none;margin:0 0 0 auto;float:right}#glfwhome,.glfwnavbar li{float:left}.glfwnavbar a,.glfwnavbar a:visited{line-height:64px;margin-left:2em;display:block;color:#666}.glfwnavbar{padding-left:0}#glfwhome,.glfwnavbar a,.glfwnavbar a:visited{transition:.35s ease}#titlearea,.footer{color:#666}address.footer{text-align:center;padding:2em;margin-top:3em}#top{background:#666}#main-nav{max-width:960px;margin:0 auto;font-size:13px}#main-menu{max-width:920px;margin:0 auto;font-size:13px}.memtitle{display:none}.memproto,.memname{font-weight:bold;text-shadow:none}#main-menu{min-height:36px;display:flex;flex-direction:row;flex-wrap:wrap;justify-content:flex-start;align-items:center;align-content:stretch}#main-menu a,#main-menu a:visited,#main-menu a:hover,#main-menu li{color:#f2f2f2}#main-menu li ul.sm-nowrap li a{color:#4d4d4d}#main-menu li ul.sm-nowrap li a:hover{color:#f60}#main-menu>li:last-child{margin:0 0 0 auto}.contents{min-height:590px}div.contents,div.header{max-width:920px;margin:0 auto;padding:0 32px;background:#fff none}table.doxtable th,table.markdownTable th,dl.reflist dt{background:linear-gradient(to bottom, #ffa733 0%, #ff6600 100%);box-shadow:inset 0 0 32px #f60;text-shadow:0 -1px 1px #b34700;text-align:left;color:#fff}dl.reflist dt a.el{color:#f60;padding:.2em;border-radius:4px;background-color:#ffe0cc}div.toc{float:none;width:auto}div.toc h3{font-size:1.17em}div.toc ul{padding-left:1.5em}div.toc li{font-size:1em;padding-left:0;list-style-type:disc}div.toc,.memproto,div.qindex,div.ah{background:linear-gradient(to bottom, #f2f2f2 0%, #e6e6e6 100%);box-shadow:inset 0 0 32px #e6e6e6;text-shadow:0 1px 1px #fff;color:#1a1a1a;border:2px solid #e6e6e6;border-radius:4px}.paramname{color:#803300}dl.reflist dt{border:2px solid #f60;border-top-left-radius:4px;border-top-right-radius:4px;border-bottom:none}dl.reflist dd{border:2px solid #f60;border-bottom-right-radius:4px;border-bottom-left-radius:4px;border-top:none}table.doxtable,table.markdownTable{border-collapse:inherit;border-spacing:0;border:2px solid #f60;border-radius:4px}a,a:hover,a:visited,a:visited:hover,.contents a:visited,.el,a.el:visited,#glfwhome:hover,#main-menu a:hover,span.lineno a:hover{color:#f60;text-decoration:none}div.directory{border-collapse:inherit;border-spacing:0;border:2px solid #f60;border-radius:4px}hr,.memSeparator{height:2px;background:linear-gradient(to right, #f2f2f2 0%, #d9d9d9 50%, #f2f2f2 100%)}dl.note,dl.pre,dl.post,dl.invariant{background:linear-gradient(to bottom, #ddfad1 0%, #cbf7ba 100%);box-shadow:inset 0 0 32px #baf5a3;color:#1e5309;border:2px solid #afe699}dl.warning,dl.attention{background:linear-gradient(to bottom, #fae8d1 0%, #f7ddba 100%);box-shadow:inset 0 0 32px #f5d1a3;color:#533309;border:2px solid #e6c499}dl.deprecated,dl.bug{background:linear-gradient(to bottom, #fad1e3 0%, #f7bad6 100%);box-shadow:inset 0 0 32px #f5a3c8;color:#53092a;border:2px solid #e699bb}dl.todo,dl.test{background:linear-gradient(to bottom, #d1ecfa 0%, #bae3f7 100%);box-shadow:inset 0 0 32px #a3daf5;color:#093a53;border:2px solid #99cce6}dl.note,dl.pre,dl.post,dl.invariant,dl.warning,dl.attention,dl.deprecated,dl.bug,dl.todo,dl.test{border-radius:4px;padding:1em;text-shadow:0 1px 1px #fff;margin:1em 0}.note a,.pre a,.post a,.invariant a,.warning a,.attention a,.deprecated a,.bug a,.todo a,.test a,.note a:visited,.pre a:visited,.post a:visited,.invariant a:visited,.warning a:visited,.attention a:visited,.deprecated a:visited,.bug a:visited,.todo a:visited,.test a:visited{color:inherit}div.line{line-height:inherit}div.fragment,pre.fragment{background:#f2f2f2;border-radius:4px;border:none;padding:1em;overflow:auto;border-left:4px solid #ccc;margin:1em 0}.lineno a,.lineno a:visited,.line,pre.fragment{color:#4d4d4d}span.preprocessor,span.comment{color:#007899}a.code,a.code:visited{color:#e64500}span.keyword,span.keywordtype,span.keywordflow{color:#404040;font-weight:bold}span.stringliteral{color:#360099}code{padding:.1em;border-radius:4px}/*# sourceMappingURL=extra.css.map */
+.sm-dox,.sm-dox a,.sm-dox a:focus,.sm-dox a:active,.sm-dox a:hover,.sm-dox a.highlighted,.sm-dox ul a:hover{background:none;text-shadow:none}.sm-dox a span.sub-arrow{border-color:#f2f2f2 transparent transparent transparent}.sm-dox a span.sub-arrow:active,.sm-dox a span.sub-arrow:focus,.sm-dox a span.sub-arrow:hover,.sm-dox a:hover span.sub-arrow{border-color:#f60 transparent transparent transparent}.sm-dox ul a span.sub-arrow:active,.sm-dox ul a span.sub-arrow:focus,.sm-dox ul a span.sub-arrow:hover,.sm-dox ul a:hover span.sub-arrow{border-color:transparent transparent transparent #f60}.sm-dox ul a:hover{background:#666;text-shadow:none}.sm-dox ul.sm-nowrap a{color:#4d4d4d;text-shadow:none}#main-nav,#main-menu,#main-menu a,#main-menu a:visited,#main-menu a:hover,#main-menu li,.memdoc,dl.reflist dd,div.toc li,.ah,span.lineno,span.lineno a,span.lineno a:hover,.note code,.pre code,.post code,.invariant code,.warning code,.attention code,.deprecated code,.bug code,.todo code,.test code,.doxtable code,.markdownTable code{background:none}#titlearea,.footer,.contents,div.header,.memdoc,table.doxtable td,table.doxtable th,table.markdownTable td,table.markdownTable th,hr,.memSeparator{border:none}#main-menu a,#main-menu a:visited,#main-menu a:hover,#main-menu li,.reflist dt a.el,.levels span,.directory .levels span{text-shadow:none}.memdoc,dl.reflist dd{box-shadow:none}div.headertitle,.note code,.pre code,.post code,.invariant code,.warning code,.attention code,.deprecated code,.bug code,.todo code,.test code,table.doxtable code,table.markdownTable code{padding:0}#nav-path,.directory .levels,span.lineno{display:none}html,#titlearea,.footer,tr.even,.directory tr.even,.doxtable tr:nth-child(even),tr.markdownTableBody:nth-child(even),.mdescLeft,.mdescRight,.memItemLeft,.memItemRight,code,.markdownTableRowEven{background:#f2f2f2}body{color:#4d4d4d}div.title{font-size:170%;margin:1em 0 0.5em 0}h1,h2,h2.groupheader,h3,div.toc h3,h4,h5,h6,strong,em{color:#1a1a1a;border-bottom:none}h1{padding-top:0.5em;font-size:150%}h2{padding-top:0.5em;margin-bottom:0;font-size:130%}h3{padding-top:0.5em;margin-bottom:0;font-size:110%}.glfwheader{font-size:16px;min-height:64px;max-width:920px;padding:0 32px;margin:0 auto;display:flex;flex-direction:row;flex-wrap:wrap;justify-content:flex-start;align-items:center;align-content:stretch}#glfwhome{line-height:64px;padding-right:48px;color:#666;font-size:2.5em;background:url("https://www.glfw.org/css/arrow.png") no-repeat right}.glfwnavbar{list-style-type:none;margin:0 0 0 auto;float:right}#glfwhome,.glfwnavbar li{float:left}.glfwnavbar a,.glfwnavbar a:visited{line-height:64px;margin-left:2em;display:block;color:#666}.glfwnavbar{padding-left:0}#glfwhome,.glfwnavbar a,.glfwnavbar a:visited{transition:.35s ease}#titlearea,.footer{color:#666}address.footer{text-align:center;padding:2em;margin-top:3em}#top{background:#666}#main-nav{max-width:960px;margin:0 auto;font-size:13px}#main-menu{max-width:920px;margin:0 auto;font-size:13px}.memtitle{display:none}.memproto,.memname{font-weight:bold;text-shadow:none}#main-menu{min-height:36px;display:flex;flex-direction:row;flex-wrap:wrap;justify-content:flex-start;align-items:center;align-content:stretch}#main-menu a:focus{outline-style:none}#main-menu a,#main-menu a:visited,#main-menu a:hover,#main-menu li{color:#f2f2f2}#main-menu li ul.sm-nowrap li a{color:#4d4d4d}#main-menu li ul.sm-nowrap li a:hover{color:#f60}#main-menu>li:last-child{margin:0 0 0 auto}.contents{min-height:590px}div.contents,div.header{max-width:920px;margin:0 auto;padding:0 32px;background:#fff none}table.doxtable th,table.markdownTable th,dl.reflist dt{background:linear-gradient(to bottom, #ffa733 0%, #f60 100%);box-shadow:inset 0 0 32px #f60;text-shadow:0 -1px 1px #b34700;text-align:left;color:#fff}dl.reflist dt a.el{color:#f60;padding:.2em;border-radius:4px;background-color:#ffe0cc}div.toc{float:right;width:35%}@media screen and (max-width: 600px){div.toc{float:none;width:inherit;margin:0}}div.toc h3{font-size:1.17em}div.toc ul{padding-left:1.5em}div.toc li{font-size:1em;padding-left:0;list-style-type:disc}div.toc li.level2,div.toc li.level3{margin-left:0.5em}div.toc,.memproto,div.qindex,div.ah{background:linear-gradient(to bottom, #f2f2f2 0%, #e6e6e6 100%);box-shadow:inset 0 0 32px #e6e6e6;text-shadow:0 1px 1px #fff;color:#1a1a1a;border:2px solid #e6e6e6;border-radius:4px}.paramname{color:#803300}dl.reflist dt{border:2px solid #f60;border-top-left-radius:4px;border-top-right-radius:4px;border-bottom:none}dl.reflist dd{border:2px solid #f60;border-bottom-right-radius:4px;border-bottom-left-radius:4px;border-top:none}table.doxtable,table.markdownTable{border-collapse:inherit;border-spacing:0;border:2px solid #f60;border-radius:4px}a,a:hover,a:visited,a:visited:hover,.contents a:visited,.el,a.el:visited,#glfwhome:hover,#main-menu a:hover,span.lineno a:hover{color:#f60;text-decoration:none}div.directory{border-collapse:inherit;border-spacing:0;border:2px solid #f60;border-radius:4px}hr,.memSeparator{height:2px;background:linear-gradient(to right, #f2f2f2 0%, #d9d9d9 50%, #f2f2f2 100%)}dl.note,dl.pre,dl.post,dl.invariant{background:linear-gradient(to bottom, #ddfad1 0%, #cbf7ba 100%);box-shadow:inset 0 0 32px #baf5a3;color:#1e5309;border:2px solid #afe699}dl.warning,dl.attention{background:linear-gradient(to bottom, #fae8d1 0%, #f7ddba 100%);box-shadow:inset 0 0 32px #f5d1a3;color:#533309;border:2px solid #e6c499}dl.deprecated,dl.bug{background:linear-gradient(to bottom, #fad1e3 0%, #f7bad6 100%);box-shadow:inset 0 0 32px #f5a3c8;color:#53092a;border:2px solid #e699bb}dl.todo,dl.test{background:linear-gradient(to bottom, #d1ecfa 0%, #bae3f7 100%);box-shadow:inset 0 0 32px #a3daf5;color:#093a53;border:2px solid #99cce6}dl.note,dl.pre,dl.post,dl.invariant,dl.warning,dl.attention,dl.deprecated,dl.bug,dl.todo,dl.test{border-radius:4px;padding:1em;text-shadow:0 1px 1px #fff;margin:1em 0}.note a,.pre a,.post a,.invariant a,.warning a,.attention a,.deprecated a,.bug a,.todo a,.test a,.note a:visited,.pre a:visited,.post a:visited,.invariant a:visited,.warning a:visited,.attention a:visited,.deprecated a:visited,.bug a:visited,.todo a:visited,.test a:visited{color:inherit}div.line{line-height:inherit}div.fragment,pre.fragment{background:#f2f2f2;border-radius:4px;border:none;padding:1em;overflow:auto;border-left:4px solid #ccc;margin:1em 0}.lineno a,.lineno a:visited,.line,pre.fragment{color:#4d4d4d}span.preprocessor,span.comment{color:#007899}a.code,a.code:visited{color:#e64500}span.keyword,span.keywordtype,span.keywordflow{color:#404040;font-weight:bold}span.stringliteral{color:#360099}code{padding:.1em;border-radius:4px}
+/*# sourceMappingURL=extra.css.map */
diff --git a/docs/extra.css.map b/docs/extra.css.map
index 7d10c5e..d9a5d7d 100644
--- a/docs/extra.css.map
+++ b/docs/extra.css.map
@@ -1 +1,7 @@
-{"version":3,"sourceRoot":"","sources":["extra.scss"],"names":[],"mappings":"AA8EA,4GACI,gBACA,iBAGJ,yBACC,yDAGD,6HACC,sDAGD,yIACC,sDAGD,mBACI,WA9EuB,KA+EvB,iBAGJ,uBACC,MAzFoB,QA0FjB,iBAGJ,6UACC,gBAGD,mJACC,YAGD,yHACC,iBAGD,sBACC,gBAGD,4LACC,UAGD,yCACC,aAGD,kMACC,WAnHgC,QAsHjC,KACC,MA1HoB,QA6HrB,sDACC,MA/Ge,QAgHf,mBAGD,GACE,iBACA,eAGF,GACE,iBACA,gBACA,eAGF,GACE,iBACA,gBACA,eAGF,YACC,eACA,gBACA,gBACA,eACA,cAEA,aACA,mBACA,eACA,2BACA,mBACA,sBAGD,UACC,iBACA,mBACA,MA/J0B,KAgK1B,gBACA,qEAGD,YACC,qBACA,kBACA,YAGD,yBACC,WAGD,oCACC,iBACA,gBACA,cACA,MAlL0B,KAqL3B,YACC,eAGD,8CACC,qBAGD,mBACC,MA9L0B,KAiM3B,eACC,kBACA,YACA,eAGD,KACC,WAxM0B,KA2M3B,UACC,gBACA,cACA,eAGD,WACC,gBACA,cACA,eAGD,UACI,aAGJ,mBACI,iBACA,iBAGJ,WACC,gBACA,aACA,mBACA,eACA,2BACA,mBACA,sBAGD,mEACC,MA9OgC,QAiPjC,gCACC,MArPoB,QAwPrB,sCACC,MAjOoB,KAoOrB,yBACC,kBAGD,UACC,iBAGD,wBACC,gBACA,cACA,eACA,qBAGD,uDACC,gEACA,+BACA,+BACA,gBACA,MArPgB,KAwPjB,mBACC,MA5PoB,KA6PpB,aACA,kBACA,yBAGD,QACC,WACA,WAGD,WACC,iBAGD,WACC,mBAGD,WACC,cACA,eACA,qBAGD,oCACC,gEACA,kCACA,2BACA,MAlSe,QAmSf,yBACA,kBAGD,WACC,MA3QuB,QA8QxB,cACC,sBACA,2BACA,4BACA,mBAGD,cACC,sBACA,+BACA,8BACA,gBAGD,mCACC,wBACA,iBACA,sBACA,kBAGD,gIACC,MAxToB,KAyTpB,qBAGD,cACC,wBACA,iBACA,sBACA,kBAGD,iBACC,WACA,4EAGD,oCApSC,gEACA,kCACA,cACA,yBAqSD,wBAxSC,gEACA,kCACA,cACA,yBAySD,qBA5SC,gEACA,kCACA,cACA,yBA6SD,gBAhTC,gEACA,kCACA,cACA,yBAiTD,iGACC,kBACA,YACA,2BACA,aAGD,kRACC,cAGD,SACC,oBAGD,0BACC,mBACA,kBACA,YACA,YACA,cACA,2BACA,aAGD,+CACC,MA1YoB,QA6YrB,+BACC,cAGD,sBACC,cAGD,+CACC,cACA,iBAGD,mBACC,cAGD,KACC,aACA","file":"extra.css"}
\ No newline at end of file
+{
+"version": 3,
+"mappings": "AA8EA,2GAA4G,CAC3G,UAAU,CAAC,IAAI,CACf,WAAW,CAAC,IAAI,CAGjB,wBAAyB,CACxB,YAAY,CAAC,2CAAsD,CAGpE,4HAA6H,CAC5H,YAAY,CAAC,wCAAuD,CAGrE,wIAAyI,CACxI,YAAY,CAAC,wCAAuD,CAGrE,kBAAmB,CAClB,UAAU,CA9EgB,IAAa,CA+EvC,WAAW,CAAC,IAAI,CAGjB,sBAAuB,CACtB,KAAK,CAzFe,OAAa,CA0FjC,WAAW,CAAC,IAAI,CAGjB,4UAA6U,CAC5U,UAAU,CAAC,IAAI,CAGhB,kJAAmJ,CAClJ,MAAM,CAAC,IAAI,CAGZ,wHAAyH,CACxH,WAAW,CAAC,IAAI,CAGjB,qBAAsB,CACrB,UAAU,CAAC,IAAI,CAGhB,2LAA4L,CAC3L,OAAO,CAAC,CAAC,CAGV,wCAAyC,CACxC,OAAO,CAAC,IAAI,CAGb,iMAAkM,CACjM,UAAU,CApGW,OAA+B,CAuGrD,IAAK,CACJ,KAAK,CA1He,OAAa,CA6HlC,SAAU,CACN,SAAS,CAAE,IAAI,CACf,MAAM,CAAE,aAAa,CAGzB,qDAAsD,CACrD,KAAK,CApHU,OAAa,CAqH5B,aAAa,CAAC,IAAI,CAGnB,EAAG,CACF,WAAW,CAAC,KAAK,CACjB,SAAS,CAAC,IAAI,CAGf,EAAG,CACF,WAAW,CAAC,KAAK,CACjB,aAAa,CAAC,CAAC,CACf,SAAS,CAAC,IAAI,CAGf,EAAG,CACF,WAAW,CAAC,KAAK,CACjB,aAAa,CAAC,CAAC,CACf,SAAS,CAAC,IAAI,CAGf,WAAY,CACX,SAAS,CAAC,IAAI,CACd,UAAU,CAAC,IAAI,CACf,SAAS,CAAC,KAAK,CACf,OAAO,CAAC,MAAM,CACd,MAAM,CAAC,MAAM,CAEb,OAAO,CAAE,IAAI,CACb,cAAc,CAAE,GAAG,CACnB,SAAS,CAAE,IAAI,CACf,eAAe,CAAE,UAAU,CAC3B,WAAW,CAAE,MAAM,CACnB,aAAa,CAAE,OAAO,CAGvB,SAAU,CACT,WAAW,CAAC,IAAI,CAChB,aAAa,CAAC,IAAI,CAClB,KAAK,CApKqB,IAAa,CAqKvC,SAAS,CAAC,KAAK,CACf,UAAU,CAAC,yDAAyD,CAGrE,WAAY,CACX,eAAe,CAAC,IAAI,CACpB,MAAM,CAAC,UAAU,CACjB,KAAK,CAAC,KAAK,CAGZ,wBAAyB,CACxB,KAAK,CAAC,IAAI,CAGX,mCAAoC,CACnC,WAAW,CAAC,IAAI,CAChB,WAAW,CAAC,GAAG,CACf,OAAO,CAAC,KAAK,CACb,KAAK,CAvLqB,IAAa,CA0LxC,WAAY,CACX,YAAY,CAAE,CAAC,CAGhB,6CAA8C,CAC7C,UAAU,CAAC,SAAS,CAGrB,kBAAmB,CAClB,KAAK,CAnMqB,IAAa,CAsMxC,cAAe,CACd,UAAU,CAAC,MAAM,CACjB,OAAO,CAAC,GAAG,CACX,UAAU,CAAC,GAAG,CAGf,IAAK,CACJ,UAAU,CA7MgB,IAAa,CAgNxC,SAAU,CACT,SAAS,CAAC,KAAK,CACf,MAAM,CAAC,MAAM,CACb,SAAS,CAAC,IAAI,CAGf,UAAW,CACV,SAAS,CAAC,KAAK,CACf,MAAM,CAAC,MAAM,CACb,SAAS,CAAC,IAAI,CAGf,SAAU,CACT,OAAO,CAAC,IAAI,CAGb,kBAAmB,CAClB,WAAW,CAAC,IAAI,CAChB,WAAW,CAAC,IAAI,CAGjB,UAAW,CACV,UAAU,CAAC,IAAI,CACf,OAAO,CAAE,IAAI,CACb,cAAc,CAAE,GAAG,CACnB,SAAS,CAAE,IAAI,CACf,eAAe,CAAE,UAAU,CAC3B,WAAW,CAAE,MAAM,CACnB,aAAa,CAAE,OAAO,CAGvB,kBAAmB,CACf,aAAa,CAAE,IAAI,CAGvB,kEAAmE,CAClE,KAAK,CAxOgB,OAA+B,CA2OrD,+BAAgC,CAC/B,KAAK,CA9Pe,OAAa,CAiQlC,qCAAsC,CACrC,KAAK,CA9NoB,IAAsB,CAiOhD,wBAA2B,CAC1B,MAAM,CAAE,UAAU,CAGnB,SAAU,CACT,UAAU,CAAC,KAAK,CAGjB,uBAAwB,CACvB,SAAS,CAAC,KAAK,CACf,MAAM,CAAC,MAAM,CACb,OAAO,CAAC,MAAM,CACd,UAAU,CAAC,SAA8B,CAG1C,sDAAuD,CACtD,UAAU,CAAC,iDAAoF,CAC/F,UAAU,CAAC,mBAAuC,CAClD,WAAW,CAAC,kBAAgD,CAC5D,UAAU,CAAC,IAAI,CACf,KAAK,CAtPa,IAAe,CAyPlC,kBAAmB,CAClB,KAAK,CAzPoB,IAAsB,CA0P/C,OAAO,CAAC,IAAI,CACZ,aAAa,CAAC,GAAG,CACjB,gBAAgB,CAAC,OAAiC,CAGnD,OAAQ,CACP,KAAK,CAAC,KAAK,CACX,KAAK,CAAC,GAAG,CAGV,oCAAoC,CACnC,OAAQ,CACP,KAAK,CAAC,IAAI,CACV,KAAK,CAAC,OAAO,CACb,MAAM,CAAC,CAAC,EAIV,UAAW,CACV,SAAS,CAAC,MAAM,CAGjB,UAAW,CACV,YAAY,CAAC,KAAK,CAGnB,UAAW,CACV,SAAS,CAAC,GAAG,CACb,YAAY,CAAC,CAAC,CACd,eAAe,CAAC,IAAI,CAIjB,mCAAqB,CACjB,WAAW,CAAC,KAAK,CAIzB,mCAAoC,CACnC,UAAU,CAAC,oDAAgF,CAC3F,UAAU,CAAC,sBAAqC,CAChD,WAAW,CAAC,cAA8C,CAC1D,KAAK,CAzTU,OAAa,CA0T5B,MAAM,CAAC,iBAAgC,CACvC,aAAa,CAAC,GAAG,CAGlB,UAAW,CACV,KAAK,CAlSkB,OAAgC,CAqSxD,aAAc,CACb,MAAM,CAAC,cAA+B,CACtC,sBAAsB,CAAC,GAAG,CAC1B,uBAAuB,CAAC,GAAG,CAC3B,aAAa,CAAC,IAAI,CAGnB,aAAc,CACb,MAAM,CAAC,cAA+B,CACtC,0BAA0B,CAAC,GAAG,CAC9B,yBAAyB,CAAC,GAAG,CAC7B,UAAU,CAAC,IAAI,CAGhB,kCAAmC,CAClC,eAAe,CAAC,OAAO,CACvB,cAAc,CAAC,CAAC,CAChB,MAAM,CAAC,cAA+B,CACtC,aAAa,CAAC,GAAG,CAGlB,+HAAgI,CAC/H,KAAK,CAnUoB,IAAsB,CAoU/C,eAAe,CAAC,IAAI,CAGrB,aAAc,CACb,eAAe,CAAC,OAAO,CACvB,cAAc,CAAC,CAAC,CAChB,MAAM,CAAC,cAA+B,CACtC,aAAa,CAAC,GAAG,CAGlB,gBAAiB,CAChB,MAAM,CAAC,GAAG,CACV,UAAU,CAAC,gEAAiH,CAG7H,mCAAoC,CA3TnC,UAAU,CAAC,oDAAuE,CAClF,UAAU,CAAC,sBAAsC,CACjD,KAAK,CAAC,OAAwB,CAC9B,MAAM,CAAC,iBAAmD,CA4T3D,uBAAwB,CA/TvB,UAAU,CAAC,oDAAuE,CAClF,UAAU,CAAC,sBAAsC,CACjD,KAAK,CAAC,OAAwB,CAC9B,MAAM,CAAC,iBAAmD,CAgU3D,oBAAqB,CAnUpB,UAAU,CAAC,oDAAuE,CAClF,UAAU,CAAC,sBAAsC,CACjD,KAAK,CAAC,OAAwB,CAC9B,MAAM,CAAC,iBAAmD,CAoU3D,eAAgB,CAvUf,UAAU,CAAC,oDAAuE,CAClF,UAAU,CAAC,sBAAsC,CACjD,KAAK,CAAC,OAAwB,CAC9B,MAAM,CAAC,iBAAmD,CAwU3D,gGAAiG,CAChG,aAAa,CAAC,GAAG,CACjB,OAAO,CAAC,GAAG,CACX,WAAW,CAAC,cAAwB,CACpC,MAAM,CAAC,KAAK,CAGb,iRAAkR,CACjR,KAAK,CAAC,OAAO,CAGd,QAAS,CACR,WAAW,CAAC,OAAO,CAGpB,yBAA0B,CACzB,UAAU,CAAC,OAAa,CACxB,aAAa,CAAC,GAAG,CACjB,MAAM,CAAC,IAAI,CACX,OAAO,CAAC,GAAG,CACX,QAAQ,CAAC,IAAI,CACb,WAAW,CAAC,cAAuB,CACnC,MAAM,CAAC,KAAK,CAGb,8CAA+C,CAC9C,KAAK,CAjae,OAAa,CAoalC,8BAA+B,CAC9B,KAAK,CAAC,OAAiB,CAGxB,qBAAsB,CACrB,KAAK,CAAC,OAAgB,CAGvB,8CAA+C,CAC9C,KAAK,CAAC,OAA+B,CACrC,WAAW,CAAC,IAAI,CAGjB,kBAAmB,CAClB,KAAK,CAAC,OAAiB,CAGxB,IAAK,CACJ,OAAO,CAAC,IAAI,CACZ,aAAa,CAAC,GAAG",
+"sources": ["extra.scss"],
+"names": [],
+"file": "extra.css"
+}
diff --git a/docs/extra.scss b/docs/extra.scss
index 6c5f3c2..acf28e2 100644
--- a/docs/extra.scss
+++ b/docs/extra.scss
@@ -135,6 +135,11 @@
 	color:$default-text-color;
 }
 
+div.title {
+    font-size: 170%;
+    margin: 1em 0 0.5em 0;
+}
+
 h1,h2,h2.groupheader,h3,div.toc h3,h4,h5,h6,strong,em {
 	color:$heading-color;
 	border-bottom:none;
@@ -142,13 +147,13 @@
 
 h1 {
 	padding-top:0.5em;
-	font-size:180%;
+	font-size:150%;
 }
 
 h2 {
 	padding-top:0.5em;
 	margin-bottom:0;
-	font-size:140%;
+	font-size:130%;
 }
 
 h3 {
@@ -250,6 +255,10 @@
 	align-content: stretch;
 }
 
+#main-menu a:focus {
+    outline-style: none;
+}
+
 #main-menu a,#main-menu a:visited,#main-menu a:hover,#main-menu li {
 	color:$navbar-link-color;
 }
@@ -293,8 +302,16 @@
 }
 
 div.toc {
-	float:none;
-	width:auto;
+	float:right;
+	width:35%;
+}
+
+@media screen and (max-width:600px) {
+	div.toc {
+		float:none;
+		width:inherit;
+		margin:0;
+	}
 }
 
 div.toc h3 {
@@ -311,6 +328,12 @@
 	list-style-type:disc;
 }
 
+div.toc {
+    li.level2, li.level3 {
+        margin-left:0.5em;
+    }
+}
+
 div.toc,.memproto,div.qindex,div.ah {
 	background:linear-gradient(to bottom,$toc-background-color2 0%,$toc-background-color1 100%);
 	box-shadow:inset 0 0 32px $toc-background-color1;
diff --git a/docs/input.dox b/docs/input.md
similarity index 91%
rename from docs/input.dox
rename to docs/input.md
index f5f5cac..56983b0 100644
--- a/docs/input.dox
+++ b/docs/input.md
@@ -1,8 +1,6 @@
-/*!
+# Input guide {#input_guide}
 
-@page input_guide Input guide
-
-@tableofcontents
+[TOC]
 
 This guide introduces the input related functions of GLFW.  For details on
 a specific function in this category, see the @ref input.  There are also guides
@@ -29,7 +27,7 @@
 information.
 
 
-@section events Event processing
+## Event processing {#events}
 
 GLFW needs to poll the window system for events both to provide input to the
 application and to prove to the window system that the application hasn't locked
@@ -42,18 +40,18 @@
 processes only those events that have already been received and then returns
 immediately.
 
-@code
+```c
 glfwPollEvents();
-@endcode
+```
 
 This is the best choice when rendering continuously, like most games do.
 
 If you only need to update the contents of the window when you receive new
 input, @ref glfwWaitEvents is a better choice.
 
-@code
+```c
 glfwWaitEvents();
-@endcode
+```
 
 It puts the thread to sleep until at least one event has been received and then
 processes all received events.  This saves a great deal of CPU cycles and is
@@ -62,9 +60,9 @@
 If you want to wait for events but have UI elements or other tasks that need
 periodic updates, @ref glfwWaitEventsTimeout lets you specify a timeout.
 
-@code
+```c
 glfwWaitEventsTimeout(0.7);
-@endcode
+```
 
 It puts the thread to sleep until at least one event has been received, or until
 the specified number of seconds have elapsed.  It then processes any received
@@ -74,9 +72,9 @@
 another thread by posting an empty event to the event queue with @ref
 glfwPostEmptyEvent.
 
-@code
+```c
 glfwPostEmptyEvent();
-@endcode
+```
 
 Do not assume that callbacks will _only_ be called in response to the above
 functions.  While it is necessary to process events in one or more of the ways
@@ -91,7 +89,7 @@
 new size before everything returns back out of the @ref glfwSetWindowSize call.
 
 
-@section input_keyboard Keyboard input
+## Keyboard input {#input_keyboard}
 
 GLFW divides keyboard input into two categories; key events and character
 events.  Key events relate to actual physical keyboard keys, whereas character
@@ -103,25 +101,25 @@
 same keyboard layout, input method or even operating system as you.
 
 
-@subsection input_key Key input
+### Key input {#input_key}
 
 If you wish to be notified when a physical key is pressed or released or when it
 repeats, set a key callback.
 
-@code
+```c
 glfwSetKeyCallback(window, key_callback);
-@endcode
+```
 
 The callback function receives the [keyboard key](@ref keys), platform-specific
 scancode, key action and [modifier bits](@ref mods).
 
-@code
+```c
 void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods)
 {
     if (key == GLFW_KEY_E && action == GLFW_PRESS)
         activate_airship();
 }
-@endcode
+```
 
 The action is one of `GLFW_PRESS`, `GLFW_REPEAT` or `GLFW_RELEASE`.  Events with
 `GLFW_PRESS` and `GLFW_RELEASE` actions are emitted for every key press.  Most
@@ -149,21 +147,21 @@
 You can query the scancode for any [key token](@ref keys) supported on the
 current platform with @ref glfwGetKeyScancode.
 
-@code
+```c
 const int scancode = glfwGetKeyScancode(GLFW_KEY_X);
 set_key_mapping(scancode, swap_weapons);
-@endcode
+```
 
 The last reported state for every physical key with a [key token](@ref keys) is
 also saved in per-window state arrays that can be polled with @ref glfwGetKey.
 
-@code
+```c
 int state = glfwGetKey(window, GLFW_KEY_E);
 if (state == GLFW_PRESS)
 {
     activate_airship();
 }
-@endcode
+```
 
 The returned state is one of `GLFW_PRESS` or `GLFW_RELEASE`.
 
@@ -177,9 +175,9 @@
 missed the key press.  The recommended solution for this is to use a
 key callback, but there is also the `GLFW_STICKY_KEYS` input mode.
 
-@code
+```c
 glfwSetInputMode(window, GLFW_STICKY_KEYS, GLFW_TRUE);
-@endcode
+```
 
 When sticky keys mode is enabled, the pollable state of a key will remain
 `GLFW_PRESS` until the state of that key is polled with @ref glfwGetKey.  Once
@@ -190,9 +188,9 @@
 If you wish to know what the state of the Caps Lock and Num Lock keys was when
 input events were generated, set the `GLFW_LOCK_KEY_MODS` input mode.
 
-@code
+```c
 glfwSetInputMode(window, GLFW_LOCK_KEY_MODS, GLFW_TRUE);
-@endcode
+```
 
 When this input mode is enabled, any callback that receives
 [modifier bits](@ref mods) will have the @ref GLFW_MOD_CAPS_LOCK bit set if Caps
@@ -203,7 +201,7 @@
 [key token](@ref keys).
 
 
-@subsection input_char Text input
+### Text input {#input_char}
 
 GLFW supports text input in the form of a stream of
 [Unicode code points](https://en.wikipedia.org/wiki/Unicode), as produced by the
@@ -217,30 +215,30 @@
 
 If you wish to offer regular text input, set a character callback.
 
-@code
+```c
 glfwSetCharCallback(window, character_callback);
-@endcode
+```
 
 The callback function receives Unicode code points for key events that would
 have led to regular text input and generally behaves as a standard text field on
 that platform.
 
-@code
+```c
 void character_callback(GLFWwindow* window, unsigned int codepoint)
 {
 }
-@endcode
+```
 
 
-@subsection input_key_name Key names
+### Key names {#input_key_name}
 
 If you wish to refer to keys by name, you can query the keyboard layout
 dependent name of printable keys with @ref glfwGetKeyName.
 
-@code
+```c
 const char* key_name = glfwGetKeyName(GLFW_KEY_W, 0);
 show_tutorial_hint("Press %s to move forward", key_name);
-@endcode
+```
 
 This function can handle both [keys and scancodes](@ref input_key).  If the
 specified key is `GLFW_KEY_UNKNOWN` then the scancode is used, otherwise it is
@@ -248,42 +246,42 @@
 arguments can always be passed unmodified to this function.
 
 
-@section input_mouse Mouse input
+## Mouse input {#input_mouse}
 
 Mouse input comes in many forms, including mouse motion, button presses and
 scrolling offsets.  The cursor appearance can also be changed, either to
 a custom image or a standard cursor shape from the system theme.
 
 
-@subsection cursor_pos Cursor position
+### Cursor position {#cursor_pos}
 
 If you wish to be notified when the cursor moves over the window, set a cursor
 position callback.
 
-@code
+```c
 glfwSetCursorPosCallback(window, cursor_position_callback);
-@endcode
+```
 
 The callback functions receives the cursor position, measured in screen
 coordinates but relative to the top-left corner of the window content area.  On
 platforms that provide it, the full sub-pixel cursor position is passed on.
 
-@code
+```c
 static void cursor_position_callback(GLFWwindow* window, double xpos, double ypos)
 {
 }
-@endcode
+```
 
 The cursor position is also saved per-window and can be polled with @ref
 glfwGetCursorPos.
 
-@code
+```c
 double xpos, ypos;
 glfwGetCursorPos(window, &xpos, &ypos);
-@endcode
+```
 
 
-@subsection cursor_mode Cursor mode
+### Cursor mode {#cursor_mode}
 
 @anchor GLFW_CURSOR
 The `GLFW_CURSOR` input mode provides several cursor modes for special forms of
@@ -295,9 +293,9 @@
 schemes that require unlimited mouse movement, set the cursor mode to
 `GLFW_CURSOR_DISABLED`.
 
-@code
+```c
 glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);
-@endcode
+```
 
 This will hide the cursor and lock it to the specified window.  GLFW will then
 take care of all the details of cursor re-centering and offset calculation and
@@ -311,22 +309,34 @@
 If you only wish the cursor to become hidden when it is over a window but still
 want it to behave normally, set the cursor mode to `GLFW_CURSOR_HIDDEN`.
 
-@code
+```c
 glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_HIDDEN);
-@endcode
+```
 
 This mode puts no limit on the motion of the cursor.
 
+If you wish the cursor to be visible but confined to the content area of the
+window, set the cursor mode to `GLFW_CURSOR_CAPTURED`.
+
+```c
+glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_CAPTURED);
+```
+
+The cursor will behave normally inside the content area but will not be able to
+leave unless the window loses focus.
+
 To exit out of either of these special modes, restore the `GLFW_CURSOR_NORMAL`
 cursor mode.
 
-@code
+```c
 glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_NORMAL);
-@endcode
+```
+
+If the cursor was disabled, this will move it back to its last visible position.
 
 
 @anchor GLFW_RAW_MOUSE_MOTION
-@subsection raw_mouse_motion Raw mouse motion
+### Raw mouse motion {#raw_mouse_motion}
 
 When the cursor is disabled, raw (unscaled and unaccelerated) mouse motion can
 be enabled if available.
@@ -341,16 +351,16 @@
 raw motion and set the `GLFW_RAW_MOUSE_MOTION` input mode to enable it.  It is
 disabled by default.
 
-@code
+```c
 if (glfwRawMouseMotionSupported())
     glfwSetInputMode(window, GLFW_RAW_MOUSE_MOTION, GLFW_TRUE);
-@endcode
+```
 
 If supported, raw mouse motion can be enabled or disabled per-window and at any
 time but it will only be provided when the cursor is disabled.
 
 
-@subsection cursor_object Cursor objects
+### Cursor objects {#cursor_object}
 
 GLFW supports creating both custom and system theme cursor images, encapsulated
 as @ref GLFWcursor objects.  They are created with @ref glfwCreateCursor or @ref
@@ -358,13 +368,13 @@
 glfwTerminate, if any remain.
 
 
-@subsubsection cursor_custom Custom cursor creation
+#### Custom cursor creation {#cursor_custom}
 
 A custom cursor is created with @ref glfwCreateCursor, which returns a handle to
 the created cursor object.  For example, this creates a 16x16 white square
 cursor with the hot-spot in the upper-left corner:
 
-@code
+```c
 unsigned char pixels[16 * 16 * 4];
 memset(pixels, 0xff, sizeof(pixels));
 
@@ -374,7 +384,7 @@
 image.pixels = pixels;
 
 GLFWcursor* cursor = glfwCreateCursor(&image, 0, 0);
-@endcode
+```
 
 If cursor creation fails, `NULL` will be returned, so it is necessary to check
 the return value.
@@ -384,39 +394,42 @@
 sequential rows, starting from the top-left corner.
 
 
-@subsubsection cursor_standard Standard cursor creation
+#### Standard cursor creation {#cursor_standard}
 
 A cursor with a [standard shape](@ref shapes) from the current system cursor
 theme can be created with @ref glfwCreateStandardCursor.
 
-@code
-GLFWcursor* cursor = glfwCreateStandardCursor(GLFW_HRESIZE_CURSOR);
-@endcode
+```c
+GLFWcursor* url_cursor = glfwCreateStandardCursor(GLFW_POINTING_HAND_CURSOR);
+```
 
 These cursor objects behave in the exact same way as those created with @ref
 glfwCreateCursor except that the system cursor theme provides the actual image.
 
+A few of these shapes are not available everywhere.  If a shape is unavailable,
+`NULL` is returned.  See @ref glfwCreateStandardCursor for details.
 
-@subsubsection cursor_destruction Cursor destruction
+
+#### Cursor destruction {#cursor_destruction}
 
 When a cursor is no longer needed, destroy it with @ref glfwDestroyCursor.
 
-@code
+```c
 glfwDestroyCursor(cursor);
-@endcode
+```
 
 Cursor destruction always succeeds.  If the cursor is current for any window,
 that window will revert to the default cursor.  This does not affect the cursor
 mode.  All remaining cursors are destroyed when @ref glfwTerminate is called.
 
 
-@subsubsection cursor_set Cursor setting
+#### Cursor setting {#cursor_set}
 
 A cursor can be set as current for a window with @ref glfwSetCursor.
 
-@code
+```c
 glfwSetCursor(window, cursor);
-@endcode
+```
 
 Once set, the cursor image will be used as long as the system cursor is over the
 content area of the window and the [cursor mode](@ref cursor_mode) is set
@@ -426,26 +439,26 @@
 
 To revert to the default cursor, set the cursor of that window to `NULL`.
 
-@code
+```c
 glfwSetCursor(window, NULL);
-@endcode
+```
 
 When a cursor is destroyed, any window that has it set will revert to the
 default cursor.  This does not affect the cursor mode.
 
 
-@subsection cursor_enter Cursor enter/leave events
+### Cursor enter/leave events {#cursor_enter}
 
 If you wish to be notified when the cursor enters or leaves the content area of
 a window, set a cursor enter/leave callback.
 
-@code
+```c
 glfwSetCursorEnterCallback(window, cursor_enter_callback);
-@endcode
+```
 
 The callback function receives the new classification of the cursor.
 
-@code
+```c
 void cursor_enter_callback(GLFWwindow* window, int entered)
 {
     if (entered)
@@ -457,38 +470,38 @@
         // The cursor left the content area of the window
     }
 }
-@endcode
+```
 
 You can query whether the cursor is currently inside the content area of the
 window with the [GLFW_HOVERED](@ref GLFW_HOVERED_attrib) window attribute.
 
-@code
+```c
 if (glfwGetWindowAttrib(window, GLFW_HOVERED))
 {
     highlight_interface();
 }
-@endcode
+```
 
 
-@subsection input_mouse_button Mouse button input
+### Mouse button input {#input_mouse_button}
 
 If you wish to be notified when a mouse button is pressed or released, set
 a mouse button callback.
 
-@code
+```c
 glfwSetMouseButtonCallback(window, mouse_button_callback);
-@endcode
+```
 
 The callback function receives the [mouse button](@ref buttons), button action
 and [modifier bits](@ref mods).
 
-@code
+```c
 void mouse_button_callback(GLFWwindow* window, int button, int action, int mods)
 {
     if (button == GLFW_MOUSE_BUTTON_RIGHT && action == GLFW_PRESS)
         popup_menu();
 }
-@endcode
+```
 
 The action is one of `GLFW_PRESS` or `GLFW_RELEASE`.
 
@@ -496,13 +509,13 @@
 saved in per-window state arrays that can be polled with @ref
 glfwGetMouseButton.
 
-@code
+```c
 int state = glfwGetMouseButton(window, GLFW_MOUSE_BUTTON_LEFT);
 if (state == GLFW_PRESS)
 {
     upgrade_cow();
 }
-@endcode
+```
 
 The returned state is one of `GLFW_PRESS` or `GLFW_RELEASE`.
 
@@ -516,9 +529,9 @@
 mouse button callback, but there is also the `GLFW_STICKY_MOUSE_BUTTONS`
 input mode.
 
-@code
+```c
 glfwSetInputMode(window, GLFW_STICKY_MOUSE_BUTTONS, GLFW_TRUE);
-@endcode
+```
 
 When sticky mouse buttons mode is enabled, the pollable state of a mouse button
 will remain `GLFW_PRESS` until the state of that button is polled with @ref
@@ -530,27 +543,27 @@
 [supported mouse button](@ref buttons).
 
 
-@subsection scrolling Scroll input
+### Scroll input {#scrolling}
 
 If you wish to be notified when the user scrolls, whether with a mouse wheel or
 touchpad gesture, set a scroll callback.
 
-@code
+```c
 glfwSetScrollCallback(window, scroll_callback);
-@endcode
+```
 
 The callback function receives two-dimensional scroll offsets.
 
-@code
+```c
 void scroll_callback(GLFWwindow* window, double xoffset, double yoffset)
 {
 }
-@endcode
+```
 
 A normal mouse wheel, being vertical, provides offsets along the Y-axis.
 
 
-@section joystick Joystick input
+## Joystick input {#joystick}
 
 The joystick functions expose connected joysticks and controllers, with both
 referred to as joysticks.  It supports up to sixteen joysticks, ranging from
@@ -558,17 +571,17 @@
 `GLFW_JOYSTICK_LAST`.  You can test whether a [joystick](@ref joysticks) is
 present with @ref glfwJoystickPresent.
 
-@code
+```c
 int present = glfwJoystickPresent(GLFW_JOYSTICK_1);
-@endcode
+```
 
 Each joystick has zero or more axes, zero or more buttons, zero or more hats,
 a human-readable name, a user pointer and an SDL compatible GUID.
 
-When GLFW is initialized, detected joysticks are added to the beginning of
-the array.  Once a joystick is detected, it keeps its assigned ID until it is
-disconnected or the library is terminated, so as joysticks are connected and
-disconnected, there may appear gaps in the IDs.
+Detected joysticks are added to the beginning of the array.  Once a joystick is
+detected, it keeps its assigned ID until it is disconnected or the library is
+terminated, so as joysticks are connected and disconnected, there may appear
+gaps in the IDs.
 
 Joystick axis, button and hat state is updated when polled and does not require
 a window to be created or events to be processed.  However, if you want joystick
@@ -580,30 +593,30 @@
 `joysticks` test program.
 
 
-@subsection joystick_axis Joystick axis states
+### Joystick axis states {#joystick_axis}
 
 The positions of all axes of a joystick are returned by @ref
 glfwGetJoystickAxes.  See the reference documentation for the lifetime of the
 returned array.
 
-@code
+```c
 int count;
 const float* axes = glfwGetJoystickAxes(GLFW_JOYSTICK_5, &count);
-@endcode
+```
 
 Each element in the returned array is a value between -1.0 and 1.0.
 
 
-@subsection joystick_button Joystick button states
+### Joystick button states {#joystick_button}
 
 The states of all buttons of a joystick are returned by @ref
 glfwGetJoystickButtons.  See the reference documentation for the lifetime of the
 returned array.
 
-@code
+```c
 int count;
 const unsigned char* buttons = glfwGetJoystickButtons(GLFW_JOYSTICK_3, &count);
-@endcode
+```
 
 Each element in the returned array is either `GLFW_PRESS` or `GLFW_RELEASE`.
 
@@ -612,15 +625,15 @@
 the reference documentation for @ref glfwGetJoystickButtons for details.
 
 
-@subsection joystick_hat Joystick hat states
+### Joystick hat states {#joystick_hat}
 
 The states of all hats are returned by @ref glfwGetJoystickHats.  See the
 reference documentation for the lifetime of the returned array.
 
-@code
+```c
 int count;
 const unsigned char* hats = glfwGetJoystickHats(GLFW_JOYSTICK_7, &count);
-@endcode
+```
 
 Each element in the returned array is one of the following:
 
@@ -640,34 +653,34 @@
 and left) directions and you can test for these individually by ANDing it with
 the corresponding direction.
 
-@code
+```c
 if (hats[2] & GLFW_HAT_RIGHT)
 {
     // State of hat 2 could be right-up, right or right-down
 }
-@endcode
+```
 
 For backward compatibility with earlier versions that did not have @ref
 glfwGetJoystickHats, all hats are by default also included in the button array.
 See the reference documentation for @ref glfwGetJoystickButtons for details.
 
 
-@subsection joystick_name Joystick name
+### Joystick name {#joystick_name}
 
 The human-readable, UTF-8 encoded name of a joystick is returned by @ref
 glfwGetJoystickName.  See the reference documentation for the lifetime of the
 returned string.
 
-@code
+```c
 const char* name = glfwGetJoystickName(GLFW_JOYSTICK_4);
-@endcode
+```
 
 Joystick names are not guaranteed to be unique.  Two joysticks of the same model
 and make may have the same name.  Only the [joystick ID](@ref joysticks) is
 guaranteed to be unique, and only until that joystick is disconnected.
 
 
-@subsection joystick_userptr Joystick user pointer
+### Joystick user pointer {#joystick_userptr}
 
 Each joystick has a user pointer that can be set with @ref
 glfwSetJoystickUserPointer and queried with @ref glfwGetJoystickUserPointer.
@@ -678,19 +691,19 @@
 The initial value of the pointer is `NULL`.
 
 
-@subsection joystick_event Joystick configuration changes
+### Joystick configuration changes {#joystick_event}
 
 If you wish to be notified when a joystick is connected or disconnected, set
 a joystick callback.
 
-@code
+```c
 glfwSetJoystickCallback(joystick_callback);
-@endcode
+```
 
 The callback function receives the ID of the joystick that has been connected
 and disconnected and the event that occurred.
 
-@code
+```c
 void joystick_callback(int jid, int event)
 {
     if (event == GLFW_CONNECTED)
@@ -702,7 +715,7 @@
         // The joystick was disconnected
     }
 }
-@endcode
+```
 
 For joystick connection and disconnection events to be delivered on all
 platforms, you need to call one of the [event processing](@ref events)
@@ -715,15 +728,17 @@
 returns.
 
 
-@subsection gamepad Gamepad input
+### Gamepad input {#gamepad}
 
 The joystick functions provide unlabeled axes, buttons and hats, with no
 indication of where they are located on the device.  Their order may also vary
 between platforms even with the same device.
 
 To solve this problem the SDL community crowdsourced the
-[SDL_GameControllerDB](https://github.com/gabomdq/SDL_GameControllerDB) project,
-a database of mappings from many different devices to an Xbox-like gamepad.
+[SDL_GameControllerDB][] project, a database of mappings from many different
+devices to an Xbox-like gamepad.
+
+[SDL_GameControllerDB]: https://github.com/gabomdq/SDL_GameControllerDB
 
 GLFW supports this mapping format and contains a copy of the mappings
 available at the time of release.  See @ref gamepad_mapping for how to update
@@ -733,12 +748,12 @@
 You can check whether a joystick is both present and has a gamepad mapping with
 @ref glfwJoystickIsGamepad.
 
-@code
+```c
 if (glfwJoystickIsGamepad(GLFW_JOYSTICK_2))
 {
     // Use as gamepad
 }
-@endcode
+```
 
 If you are only interested in gamepad input you can use this function instead of
 @ref glfwJoystickPresent.
@@ -747,13 +762,13 @@
 glfwGetGamepadName.  This may or may not be the same as the
 [joystick name](@ref joystick_name).
 
-@code
+```c
 const char* name = glfwGetGamepadName(GLFW_JOYSTICK_7);
-@endcode
+```
 
 To retrieve the gamepad state of a joystick, call @ref glfwGetGamepadState.
 
-@code
+```c
 GLFWgamepadstate state;
 
 if (glfwGetGamepadState(GLFW_JOYSTICK_3, &state))
@@ -765,7 +780,7 @@
 
     input_speed(state.axes[GLFW_GAMEPAD_AXIS_RIGHT_TRIGGER]);
 }
-@endcode
+```
 
 The @ref GLFWgamepadstate struct has two arrays; one for button states and one
 for axis states.  The values for each button and axis are the same as for the
@@ -796,18 +811,17 @@
 the largest available index for each array.
 
 
-@subsection gamepad_mapping Gamepad mappings
+### Gamepad mappings {#gamepad_mapping}
 
-GLFW contains a copy of the mappings available in
-[SDL_GameControllerDB](https://github.com/gabomdq/SDL_GameControllerDB) at the
-time of release.  Newer ones can be added at runtime with @ref
+GLFW contains a copy of the mappings available in [SDL_GameControllerDB][] at
+the time of release.  Newer ones can be added at runtime with @ref
 glfwUpdateGamepadMappings.
 
-@code
+```c
 const char* mappings = load_file_contents("game/data/gamecontrollerdb.txt");
 
 glfwUpdateGamepadMappings(mappings);
-@endcode
+```
 
 This function supports everything from single lines up to and including the
 unmodified contents of the whole `gamecontrollerdb.txt` file.
@@ -867,25 +881,25 @@
 This example has been broken into several lines to fit on the page, but real
 gamepad mappings must be a single line.
 
-@code{.unparsed}
+```
 78696e70757401000000000000000000,XInput Gamepad (GLFW),platform:Windows,a:b0,
 b:b1,x:b2,y:b3,leftshoulder:b4,rightshoulder:b5,back:b6,start:b7,leftstick:b8,
 rightstick:b9,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,
 righttrigger:a5,dpup:h0.1,dpright:h0.2,dpdown:h0.4,dpleft:h0.8,
-@endcode
+```
 
 @note GLFW does not yet support the output range and modifiers `+` and `-` that
 were recently added to SDL.  The input modifiers `+`, `-` and `~` are supported
 and described above.
 
 
-@section time Time input
+## Time input {#time}
 
 GLFW provides high-resolution time input, in seconds, with @ref glfwGetTime.
 
-@code
+```c
 double seconds = glfwGetTime();
-@endcode
+```
 
 It returns the number of seconds since the library was initialized with @ref
 glfwInit.  The platform-specific time sources used typically have micro- or
@@ -893,9 +907,9 @@
 
 You can modify the base time with @ref glfwSetTime.
 
-@code
+```c
 glfwSetTime(4.0);
-@endcode
+```
 
 This sets the time to the specified time, in seconds, and it continues to count
 from there.
@@ -903,32 +917,32 @@
 You can also access the raw timer used to implement the functions above,
 with @ref glfwGetTimerValue.
 
-@code
+```c
 uint64_t value = glfwGetTimerValue();
-@endcode
+```
 
 This value is in 1&nbsp;/&nbsp;frequency seconds.  The frequency of the raw
 timer varies depending on the operating system and hardware.  You can query the
 frequency, in Hz, with @ref glfwGetTimerFrequency.
 
-@code
+```c
 uint64_t frequency = glfwGetTimerFrequency();
-@endcode
+```
 
 
-@section clipboard Clipboard input and output
+## Clipboard input and output {#clipboard}
 
 If the system clipboard contains a UTF-8 encoded string or if it can be
 converted to one, you can retrieve it with @ref glfwGetClipboardString.  See the
 reference documentation for the lifetime of the returned string.
 
-@code
+```c
 const char* text = glfwGetClipboardString(NULL);
 if (text)
 {
     insert_text(text);
 }
-@endcode
+```
 
 If the clipboard is empty or if its contents could not be converted, `NULL` is
 returned.
@@ -936,33 +950,32 @@
 The contents of the system clipboard can be set to a UTF-8 encoded string with
 @ref glfwSetClipboardString.
 
-@code
+```c
 glfwSetClipboardString(NULL, "A string with words in it");
-@endcode
+```
 
 
-@section path_drop Path drop input
+## Path drop input {#path_drop}
 
 If you wish to receive the paths of files and/or directories dropped on
 a window, set a file drop callback.
 
-@code
+```c
 glfwSetDropCallback(window, drop_callback);
-@endcode
+```
 
 The callback function receives an array of paths encoded as UTF-8.
 
-@code
+```c
 void drop_callback(GLFWwindow* window, int count, const char** paths)
 {
     int i;
     for (i = 0;  i < count;  i++)
         handle_dropped_file(paths[i]);
 }
-@endcode
+```
 
 The path array and its strings are only valid until the file drop callback
 returns, as they may have been generated specifically for that event.  You need
 to make a deep copy of the array if you want to keep the paths.
 
-*/
diff --git a/docs/internal.dox b/docs/internal.md
similarity index 74%
rename from docs/internal.dox
rename to docs/internal.md
index 685c6d1..b658d77 100644
--- a/docs/internal.dox
+++ b/docs/internal.md
@@ -1,14 +1,12 @@
-/*!
+# Internal structure {#internals_guide}
 
-@page internals_guide Internal structure
-
-@tableofcontents
+[TOC]
 
 There are several interfaces inside GLFW.  Each interface has its own area of
 responsibility and its own naming conventions.
 
 
-@section internals_public Public interface
+## Public interface {#internals_public}
 
 The most well-known is the public interface, described in the glfw3.h header
 file.  This is implemented in source files shared by all platforms and these
@@ -22,7 +20,7 @@
 Examples: `glfwCreateWindow`, `GLFWwindow`, `GLFW_RED_BITS`
 
 
-@section internals_native Native interface
+## Native interface {#internals_native}
 
 The [native interface](@ref native) is a small set of publicly available
 but platform-specific functions, described in the glfw3native.h header file and
@@ -36,7 +34,7 @@
 Examples: `glfwGetX11Window`, `glfwGetWGLContext`
 
 
-@section internals_internal Internal interface
+## Internal interface {#internals_internal}
 
 The internal interface consists of utility functions used by all other
 interfaces.  It is shared code implemented in the same shared source files as
@@ -52,7 +50,7 @@
 Examples: `_glfwIsValidContextConfig`, `_GLFWwindow`, `_glfw.monitorCount`
 
 
-@section internals_platform Platform interface
+## Platform interface {#internals_platform}
 
 The platform interface implements all platform-specific operations as a service
 to the public interface.  This includes event processing.  The platform
@@ -61,12 +59,21 @@
 platform-independent part of the internal structs.  Instead, it calls the event
 interface when events interesting to GLFW are received.
 
-The platform interface mirrors those parts of the public interface that needs to
-perform platform-specific operations on some or all platforms.  The are also
-named the same except that the glfw function prefix is replaced by
-_glfwPlatform.
+The platform interface mostly mirrors those parts of the public interface that needs to
+perform platform-specific operations on some or all platforms.
 
-Examples: `_glfwPlatformCreateWindow`
+The window system bits of the platform API is called through the `_GLFWplatform` struct of
+function pointers, to allow runtime selection of platform.  This includes the window and
+context creation, input and event processing, monitor and Vulkan surface creation parts of
+GLFW.  This is located in the global `_glfw` struct.
+
+Examples: `_glfw.platform.createWindow`
+
+The timer, threading and module loading bits of the platform API are plain functions with
+a `_glfwPlatform` prefix, as these things are independent of what window system is being
+used.
+
+Examples: `_glfwPlatformGetTimerValue`
 
 The platform interface also defines structs that contain platform-specific
 global and per-object state.  Their names mirror those of the internal
@@ -81,7 +88,7 @@
 Examples: `window->win32.handle`, `_glfw.x11.display`
 
 
-@section internals_event Event interface
+## Event interface {#internals_event}
 
 The event interface is implemented in the same shared source files as the public
 interface and is responsible for delivering the events it receives to the
@@ -93,7 +100,7 @@
 Examples: `_glfwInputWindowFocus`, `_glfwInputCursorPos`
 
 
-@section internals_static Static functions
+## Static functions {#internals_static}
 
 Static functions may be used by any interface and have no prefixes or suffixes.
 These use headless camel case.
@@ -101,15 +108,13 @@
 Examples: `isValidElementForJoystick`
 
 
-@section internals_config Configuration macros
+## Configuration macros {#internals_config}
 
 GLFW uses a number of configuration macros to select at compile time which
-interfaces and code paths to use.  They are defined in the glfw_config.h header file,
-which is generated from the `glfw_config.h.in` file by CMake.
+interfaces and code paths to use.  They are defined in the GLFW CMake target.
 
 Configuration macros the same style as tokens in the public interface, except
 with a leading underscore.
 
 Examples: `_GLFW_WIN32`, `_GLFW_BUILD_DLL`
 
-*/
diff --git a/docs/intro.dox b/docs/intro.md
similarity index 61%
rename from docs/intro.dox
rename to docs/intro.md
index 57f86c0..0610202 100644
--- a/docs/intro.dox
+++ b/docs/intro.md
@@ -1,8 +1,6 @@
-/*!
+# Introduction to the API {#intro_guide}
 
-@page intro_guide Introduction to the API
-
-@tableofcontents
+[TOC]
 
 This guide introduces the basic concepts of GLFW and describes initialization,
 error handling and API guarantees and limitations.  For a broad but shallow
@@ -18,21 +16,24 @@
  - @ref input_guide
 
 
-@section intro_init Initialization and termination
+## Initialization and termination {#intro_init}
 
 Before most GLFW functions may be called, the library must be initialized.
 This initialization checks what features are available on the machine,
-enumerates monitors and joysticks, initializes the timer and performs any
-required platform-specific initialization.
+enumerates monitors, initializes the timer and performs any required
+platform-specific initialization.
 
 Only the following functions may be called before the library has been
 successfully initialized, and only from the main thread.
 
  - @ref glfwGetVersion
  - @ref glfwGetVersionString
+ - @ref glfwPlatformSupported
  - @ref glfwGetError
  - @ref glfwSetErrorCallback
  - @ref glfwInitHint
+ - @ref glfwInitAllocator
+ - @ref glfwInitVulkanLoader
  - @ref glfwInit
  - @ref glfwTerminate
 
@@ -40,17 +41,17 @@
 GLFW_NOT_INITIALIZED error.
 
 
-@subsection intro_init_init Initializing GLFW
+### Initializing GLFW {#intro_init_init}
 
 The library is initialized with @ref glfwInit, which returns `GLFW_FALSE` if an
 error occurred.
 
-@code
+```c
 if (!glfwInit())
 {
     // Handle initialization failure
 }
-@endcode
+```
 
 If any part of initialization fails, any parts that succeeded are terminated as
 if @ref glfwTerminate had been called.  The library only needs to be initialized
@@ -62,15 +63,20 @@
 allocated by programs that exit, but GLFW sometimes has to change global system
 settings and these might not be restored without termination.
 
+@macos When the library is initialized the main menu and dock icon are created.
+These are not desirable for a command-line only program.  The creation of the
+main menu and dock icon can be disabled with the @ref GLFW_COCOA_MENUBAR init
+hint.
 
-@subsection init_hints Initialization hints
+
+### Initialization hints {#init_hints}
 
 Initialization hints are set before @ref glfwInit and affect how the library
 behaves until termination.  Hints are set with @ref glfwInitHint.
 
-@code
+```c
 glfwInitHint(GLFW_JOYSTICK_HAT_BUTTONS, GLFW_FALSE);
-@endcode
+```
 
 The values you set hints to are never reset by GLFW, but they only take effect
 during initialization.  Once GLFW has been initialized, any values you set will
@@ -81,69 +87,202 @@
 Setting these hints requires no platform specific headers or functions.
 
 
-@subsubsection init_hints_shared Shared init hints
+#### Shared init hints {#init_hints_shared}
+
+@anchor GLFW_PLATFORM
+__GLFW_PLATFORM__ specifies the platform to use for windowing and input.
+Possible values are `GLFW_ANY_PLATFORM`, `GLFW_PLATFORM_WIN32`,
+`GLFW_PLATFORM_COCOA`, `GLFW_PLATFORM_WAYLAND`, `GLFW_PLATFORM_X11` and
+`GLFW_PLATFORM_NULL`.  The default value is `GLFW_ANY_PLATFORM`, which will
+choose any platform the library includes support for except for the Null
+backend.
+
 
 @anchor GLFW_JOYSTICK_HAT_BUTTONS
 __GLFW_JOYSTICK_HAT_BUTTONS__ specifies whether to also expose joystick hats as
 buttons, for compatibility with earlier versions of GLFW that did not have @ref
 glfwGetJoystickHats.  Possible values are `GLFW_TRUE` and `GLFW_FALSE`.
 
+@anchor GLFW_ANGLE_PLATFORM_TYPE_hint
+__GLFW_ANGLE_PLATFORM_TYPE__ specifies the platform type (rendering backend) to
+request when using OpenGL ES and EGL via [ANGLE][].  If the requested platform
+type is unavailable, ANGLE will use its default. Possible values are one of
+`GLFW_ANGLE_PLATFORM_TYPE_NONE`, `GLFW_ANGLE_PLATFORM_TYPE_OPENGL`,
+`GLFW_ANGLE_PLATFORM_TYPE_OPENGLES`, `GLFW_ANGLE_PLATFORM_TYPE_D3D9`,
+`GLFW_ANGLE_PLATFORM_TYPE_D3D11`, `GLFW_ANGLE_PLATFORM_TYPE_VULKAN` and
+`GLFW_ANGLE_PLATFORM_TYPE_METAL`.
 
-@subsubsection init_hints_osx macOS specific init hints
+[ANGLE]: https://chromium.googlesource.com/angle/angle/
+
+The ANGLE platform type is specified via the `EGL_ANGLE_platform_angle`
+extension.  This extension is not used if this hint is
+`GLFW_ANGLE_PLATFORM_TYPE_NONE`, which is the default value.
+
+
+#### macOS specific init hints {#init_hints_osx}
 
 @anchor GLFW_COCOA_CHDIR_RESOURCES_hint
 __GLFW_COCOA_CHDIR_RESOURCES__ specifies whether to set the current directory to
 the application to the `Contents/Resources` subdirectory of the application's
-bundle, if present.  Set this with @ref glfwInitHint.
+bundle, if present.  Possible values are `GLFW_TRUE` and `GLFW_FALSE`.  This is
+ignored on other platforms.
 
 @anchor GLFW_COCOA_MENUBAR_hint
-__GLFW_COCOA_MENUBAR__ specifies whether to create a basic menu bar, either from
-a nib or manually, when the first window is created, which is when AppKit is
-initialized.  Set this with @ref glfwInitHint.
+__GLFW_COCOA_MENUBAR__ specifies whether to create the menu bar and dock icon
+when GLFW is initialized.  This applies whether the menu bar is created from
+a nib or manually by GLFW.  Possible values are `GLFW_TRUE` and `GLFW_FALSE`.
+This is ignored on other platforms.
 
 
-@subsubsection init_hints_wayland Wayland specific init hints
+#### Wayland specific init hints {#init_hints_wayland}
 
 @anchor GLFW_WAYLAND_LIBDECOR_hint
-__GLFW_WAYLAND_LIBDECOR__ specifies whether to use
-[libdecor](https://gitlab.freedesktop.org/libdecor/libdecor) for window
+__GLFW_WAYLAND_LIBDECOR__ specifies whether to use [libdecor][] for window
 decorations where available.  Possible values are `GLFW_WAYLAND_PREFER_LIBDECOR`
 and `GLFW_WAYLAND_DISABLE_LIBDECOR`.  This is ignored on other platforms.
 
-@note This init hint was added in 3.3.9 and is not present in earlier patch releases.  It
-is safe to attempt to set this hint on earlier versions of GLFW 3.3 but it will emit
-a harmless @ref GLFW_INVALID_ENUM error.  If you need to avoid causing any errors, you can
-check the library version first with @ref glfwGetVersion.
-
-@note To set this hint while also building against earlier versions of GLFW 3.3, you can
-use the numerical constants directly.
-
-@note @code
-int minor, patch;
-glfwGetVersion(NULL, &minor, &patch);
-if (minor > 3 || (minor == 3 && patch >= 9))
-    glfwInitHint(0x00053001 /*GLFW_WAYLAND_LIBDECOR*/, 0x00038002 /*GLFW_WAYLAND_DISABLE_LIBDECOR*/);
-@endcode
+[libdecor]: https://gitlab.freedesktop.org/libdecor/libdecor
 
 
-@subsubsection init_hints_values Supported and default values
+#### X11 specific init hints {#init_hints_x11}
 
-Initialization hint             | Default value | Supported values
-------------------------------- | ------------- | ----------------
-@ref GLFW_JOYSTICK_HAT_BUTTONS  | `GLFW_TRUE`   | `GLFW_TRUE` or `GLFW_FALSE`
-@ref GLFW_COCOA_CHDIR_RESOURCES | `GLFW_TRUE`   | `GLFW_TRUE` or `GLFW_FALSE`
-@ref GLFW_COCOA_MENUBAR         | `GLFW_TRUE`   | `GLFW_TRUE` or `GLFW_FALSE`
-@ref GLFW_WAYLAND_LIBDECOR      | `GLFW_WAYLAND_PREFER_LIBDECOR`  | `GLFW_WAYLAND_PREFER_LIBDECOR` or `GLFW_WAYLAND_DISABLE_LIBDECOR`
+@anchor GLFW_X11_XCB_VULKAN_SURFACE_hint
+__GLFW_X11_XCB_VULKAN_SURFACE__ specifies whether to prefer the
+`VK_KHR_xcb_surface` extension for creating Vulkan surfaces, or whether to use
+the `VK_KHR_xlib_surface` extension.  Possible values are `GLFW_TRUE` and
+`GLFW_FALSE`.  This is ignored on other platforms.
 
 
-@subsection intro_init_terminate Terminating GLFW
+#### Supported and default values {#init_hints_values}
+
+Initialization hint              | Default value                   | Supported values
+-------------------------------- | ------------------------------- | ----------------
+@ref GLFW_PLATFORM               | `GLFW_ANY_PLATFORM`             | `GLFW_ANY_PLATFORM`, `GLFW_PLATFORM_WIN32`, `GLFW_PLATFORM_COCOA`, `GLFW_PLATFORM_WAYLAND`, `GLFW_PLATFORM_X11` or `GLFW_PLATFORM_NULL`
+@ref GLFW_JOYSTICK_HAT_BUTTONS   | `GLFW_TRUE`                     | `GLFW_TRUE` or `GLFW_FALSE`
+@ref GLFW_ANGLE_PLATFORM_TYPE    | `GLFW_ANGLE_PLATFORM_TYPE_NONE` | `GLFW_ANGLE_PLATFORM_TYPE_NONE`, `GLFW_ANGLE_PLATFORM_TYPE_OPENGL`, `GLFW_ANGLE_PLATFORM_TYPE_OPENGLES`, `GLFW_ANGLE_PLATFORM_TYPE_D3D9`, `GLFW_ANGLE_PLATFORM_TYPE_D3D11`, `GLFW_ANGLE_PLATFORM_TYPE_VULKAN` or `GLFW_ANGLE_PLATFORM_TYPE_METAL`
+@ref GLFW_COCOA_CHDIR_RESOURCES  | `GLFW_TRUE`                     | `GLFW_TRUE` or `GLFW_FALSE`
+@ref GLFW_COCOA_MENUBAR          | `GLFW_TRUE`                     | `GLFW_TRUE` or `GLFW_FALSE`
+@ref GLFW_WAYLAND_LIBDECOR       | `GLFW_WAYLAND_PREFER_LIBDECOR`  | `GLFW_WAYLAND_PREFER_LIBDECOR` or `GLFW_WAYLAND_DISABLE_LIBDECOR`
+@ref GLFW_X11_XCB_VULKAN_SURFACE | `GLFW_TRUE`                     | `GLFW_TRUE` or `GLFW_FALSE`
+
+
+### Runtime platform selection {#platform}
+
+GLFW can be compiled for more than one platform (window system) at once.  This lets
+a single library binary support both Wayland and X11 on Linux and other Unix-like systems.
+
+You can control platform selection via the @ref GLFW_PLATFORM initialization hint.  By
+default, this is set to @ref GLFW_ANY_PLATFORM, which will look for supported window
+systems in order of priority and select the first one it finds.  It can also be set to any
+specific platform to have GLFW only look for that one.
+
+```c
+glfwInitHint(GLFW_PLATFORM, GLFW_PLATFORM_X11);
+```
+
+This mechanism also provides the Null platform, which is always supported but needs to be
+explicitly requested.  This platform is effectively a stub, emulating a window system on
+a single 1080p monitor, but will not interact with any actual window system.
+
+```c
+glfwInitHint(GLFW_PLATFORM, GLFW_PLATFORM_NULL);
+```
+
+You can test whether a library binary was compiled with support for a specific platform
+with @ref glfwPlatformSupported.
+
+```c
+if (glfwPlatformSupported(GLFW_PLATFORM_WAYLAND))
+    glfwInitHint(GLFW_PLATFORM, GLFW_PLATFORM_WAYLAND);
+```
+
+Once GLFW has been initialized, you can query which platform was selected with @ref
+glfwGetPlatform.
+
+```c
+int platform = glfwGetPlatform();
+```
+
+If you are using any [native access functions](@ref native), especially on Linux and other
+Unix-like systems, then you may need to check that you are calling the ones matching the
+selected platform.
+
+
+### Custom heap memory allocator {#init_allocator}
+
+The heap memory allocator can be customized before initialization with @ref
+glfwInitAllocator.
+
+```c
+GLFWallocator allocator;
+allocator.allocate = my_malloc;
+allocator.reallocate = my_realloc;
+allocator.deallocate = my_free;
+allocator.user = NULL;
+
+glfwInitAllocator(&allocator);
+```
+
+The allocator will be made active at the beginning of initialization and will be used by
+GLFW until the library has been fully terminated.  Any allocator set after initialization
+will be picked up only at the next initialization.
+
+The allocator will only be used for allocations that would have been made with
+the C standard library.  Memory allocations that must be made with platform
+specific APIs will still use those.
+
+The allocation function must have a signature matching @ref GLFWallocatefun.  It receives
+the desired size, in bytes, and the user pointer passed to @ref glfwInitAllocator and
+returns the address to the allocated memory block.
+
+```c
+void* my_malloc(size_t size, void* user)
+{
+    ...
+}
+```
+
+The documentation for @ref GLFWallocatefun also lists the requirements and limitations for
+an allocation function.  If the active one does not meet all of these, GLFW may fail.
+
+The reallocation function must have a function signature matching @ref GLFWreallocatefun.
+It receives the memory block to be reallocated, the new desired size, in bytes, and the user
+pointer passed to @ref glfwInitAllocator and returns the address to the resized memory
+block.
+
+```c
+void* my_realloc(void* block, size_t size, void* user)
+{
+    ...
+}
+```
+
+The documentation for @ref GLFWreallocatefun also lists the requirements and limitations
+for a reallocation function.  If the active one does not meet all of these, GLFW may fail.
+
+The deallocation function must have a function signature matching @ref GLFWdeallocatefun.
+It receives the memory block to be deallocated and the user pointer passed to @ref
+glfwInitAllocator.
+
+```c
+void my_free(void* block, void* user)
+{
+    ...
+}
+```
+
+The documentation for @ref GLFWdeallocatefun also lists the requirements and limitations
+for a deallocation function.  If the active one does not meet all of these, GLFW may fail.
+
+
+### Terminating GLFW {#intro_init_terminate}
 
 Before your application exits, you should terminate the GLFW library if it has
 been initialized.  This is done with @ref glfwTerminate.
 
-@code
+```c
 glfwTerminate();
-@endcode
+```
 
 This will destroy any remaining window, monitor and cursor objects, restore any
 modified gamma ramps, re-enable the screensaver if it had been disabled and free
@@ -155,7 +294,7 @@
 immediately.
 
 
-@section error_handling Error handling
+## Error handling {#error_handling}
 
 Some GLFW functions have return values that indicate an error, but this is often
 not very helpful when trying to figure out what happened or why it occurred.
@@ -166,12 +305,12 @@
 The last [error code](@ref errors) for the calling thread can be queried at any
 time with @ref glfwGetError.
 
-@code
+```c
 int code = glfwGetError(NULL);
 
 if (code != GLFW_NO_ERROR)
     handle_error(code);
-@endcode
+```
 
 If no error has occurred since the last call, @ref GLFW_NO_ERROR (zero) is
 returned.  The error is cleared before the function returns.
@@ -185,13 +324,13 @@
 code.  If no error has occurred since the last call, the description is set to
 `NULL`.
 
-@code
+```c
 const char* description;
 int code = glfwGetError(&description);
 
 if (description)
     display_error_message(code, description);
-@endcode
+```
 
 The retrieved description string is only valid until the next error occurs.
 This means you must make a copy of it if you want to keep it.
@@ -199,19 +338,19 @@
 You can also set an error callback, which will be called each time an error
 occurs.  It is set with @ref glfwSetErrorCallback.
 
-@code
+```c
 glfwSetErrorCallback(error_callback);
-@endcode
+```
 
 The error callback receives the same error code and human-readable description
 returned by @ref glfwGetError.
 
-@code
+```c
 void error_callback(int code, const char* description)
 {
     display_error_message(code, description);
 }
-@endcode
+```
 
 The error callback is called after the error is stored, so calling @ref
 glfwGetError from within the error callback returns the same values as the
@@ -230,7 +369,7 @@
 future that same call may generate a different error or become valid.
 
 
-@section coordinate_systems Coordinate systems
+## Coordinate systems {#coordinate_systems}
 
 GLFW has two primary coordinate systems: the _virtual screen_ and the window
 _content area_ or _content area_.  Both use the same unit: _virtual screen
@@ -267,7 +406,7 @@
 which monitor the window is currently considered to be on.
 
 
-@section guarantees_limitations Guarantees and limitations
+## Guarantees and limitations {#guarantees_limitations}
 
 This section describes the conditions under which GLFW can be expected to
 function, barring bugs in the operating system or drivers.  Use of GLFW outside
@@ -276,7 +415,7 @@
 not be considered a bug.
 
 
-@subsection lifetime Pointer lifetimes
+### Pointer lifetimes {#lifetime}
 
 GLFW will never free any pointer you provide to it, and you must never free any
 pointer it provides to you.
@@ -296,7 +435,7 @@
 releases.
 
 
-@subsection reentrancy Reentrancy
+### Reentrancy {#reentrancy}
 
 GLFW event processing and object destruction are not reentrant.  This means that
 the following functions must not be called from any callback function:
@@ -312,7 +451,7 @@
 functions not on this list will not be made non-reentrant.
 
 
-@subsection thread_safety Thread safety
+### Thread safety {#thread_safety}
 
 Most GLFW functions must only be called from the main thread (the thread that
 calls main), but some may be called from any thread once the library has been
@@ -371,6 +510,11 @@
  - @ref glfwGetVersion
  - @ref glfwGetVersionString
 
+Platform information may be queried from any thread.
+
+ - @ref glfwPlatformSupported
+ - @ref glfwGetPlatform
+
 All Vulkan related functions may be called from any thread.
 
  - @ref glfwVulkanSupported
@@ -388,7 +532,7 @@
 allow calls from any thread in future releases.
 
 
-@subsection compatibility Version compatibility
+### Version compatibility {#compatibility}
 
 GLFW uses [Semantic Versioning](https://semver.org/).  This guarantees source
 and binary backward compatibility with earlier minor versions of the API.  This
@@ -408,14 +552,14 @@
 precedence over anything stated in a guide.
 
 
-@subsection event_order Event order
+### Event order {#event_order}
 
 The order of arrival of related events is not guaranteed to be consistent
 across platforms.  The exception is synthetic key and mouse button release
 events, which are always delivered after the window defocus event.
 
 
-@section intro_version Version management
+## Version management {#intro_version}
 
 GLFW provides mechanisms for identifying what version of GLFW your application
 was compiled against as well as what version it is currently running against.
@@ -423,33 +567,33 @@
 this to verify that the library binary is compatible with your application.
 
 
-@subsection intro_version_compile Compile-time version
+### Compile-time version {#intro_version_compile}
 
 The compile-time version of GLFW is provided by the GLFW header with the
 `GLFW_VERSION_MAJOR`, `GLFW_VERSION_MINOR` and `GLFW_VERSION_REVISION` macros.
 
-@code
+```c
 printf("Compiled against GLFW %i.%i.%i\n",
        GLFW_VERSION_MAJOR,
        GLFW_VERSION_MINOR,
        GLFW_VERSION_REVISION);
-@endcode
+```
 
 
-@subsection intro_version_runtime Run-time version
+### Run-time version {#intro_version_runtime}
 
 The run-time version can be retrieved with @ref glfwGetVersion, a function that
 may be called regardless of whether GLFW is initialized.
 
-@code
+```c
 int major, minor, revision;
 glfwGetVersion(&major, &minor, &revision);
 
 printf("Running against GLFW %i.%i.%i\n", major, minor, revision);
-@endcode
+```
 
 
-@subsection intro_version_string Version string
+### Version string {#intro_version_string}
 
 GLFW 3 also provides a compile-time generated version string that describes the
 version, platform, compiler and any platform-specific compile-time options.
@@ -463,17 +607,31 @@
 glfwGetVersion function already provides the version of the running library
 binary.
 
+__Do not use the version string__ to parse what platforms are supported.  The @ref
+glfwPlatformSupported function lets you query platform support.
+
+__GLFW 3.4:__ The format of this string was changed to support the addition of
+[runtime platform selection](@ref platform).
+
 The format of the string is as follows:
  - The version of GLFW
- - The name of the window system API
- - The name of the context creation API
- - Any additional options or APIs
+ - For each supported platform:
+   - The name of the window system API
+   - The name of the window system specific context creation API, if applicable
+ - 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, when compiling GLFW 3.3.9 with MinGW for Windows, may result in
-a version string like this:
+For example, compiling GLFW 3.4 with MinGW as a DLL for Windows, may result in a version string
+like this:
 
-@code
-3.3.9 Win32 WGL EGL OSMesa MinGW
-@endcode
+```c
+3.4.0 Win32 WGL Null EGL OSMesa MinGW 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.4.0 Wayland X11 GLX Null EGL OSMesa monotonic
+```
+
diff --git a/docs/main.dox b/docs/main.md
similarity index 86%
rename from docs/main.dox
rename to docs/main.md
index bd563d9..c70f735 100644
--- a/docs/main.dox
+++ b/docs/main.md
@@ -1,14 +1,10 @@
-/*!
-
-@mainpage notitle
-
-@section main_intro Introduction
+# Introduction {#mainpage}
 
 GLFW is a free, Open Source, multi-platform library for OpenGL, OpenGL ES and
 Vulkan application development.  It provides a simple, platform-independent API
 for creating windows, contexts and surfaces, reading input, handling events, etc.
 
-@ref news_33 list new features, caveats and deprecations.
+@ref news list new features, caveats and deprecations.
 
 @ref quick_guide is a guide for users new to GLFW.  It takes you through how to
 write a small but complete program.
@@ -33,9 +29,6 @@
 There is a section on @ref guarantees_limitations for pointer lifetimes,
 reentrancy, thread safety, event order and backward and forward compatibility.
 
-The [FAQ](https://www.glfw.org/faq.html) answers many common questions about the
-design, implementation and use of GLFW.
-
 Finally, @ref compat_guide explains what APIs, standards and protocols GLFW uses
 and what happens when they are not present on a given machine.
 
@@ -43,4 +36,3 @@
 in both the [source distribution](https://www.glfw.org/download.html) and
 [GitHub repository](https://github.com/glfw/glfw).
 
-*/
diff --git a/docs/monitor.dox b/docs/monitor.md
similarity index 83%
rename from docs/monitor.dox
rename to docs/monitor.md
index b4099db..12d9854 100644
--- a/docs/monitor.dox
+++ b/docs/monitor.md
@@ -1,8 +1,6 @@
-/*!
+# Monitor guide {#monitor_guide}
 
-@page monitor_guide Monitor guide
-
-@tableofcontents
+[TOC]
 
 This guide introduces the monitor related functions of GLFW.  For details on
 a specific function in this category, see the @ref monitor.  There are also
@@ -15,7 +13,7 @@
  - @ref input_guide
 
 
-@section monitor_object Monitor objects
+## Monitor objects {#monitor_object}
 
 A monitor object represents a currently connected monitor and is represented as
 a pointer to the [opaque](https://en.wikipedia.org/wiki/Opaque_data_type) type
@@ -36,42 +34,42 @@
 `monitors` test program.
 
 
-@subsection monitor_monitors Retrieving monitors
+### Retrieving monitors {#monitor_monitors}
 
 The primary monitor is returned by @ref glfwGetPrimaryMonitor.  It is the user's
 preferred monitor and is usually the one with global UI elements like task bar
 or menu bar.
 
-@code
+```c
 GLFWmonitor* primary = glfwGetPrimaryMonitor();
-@endcode
+```
 
 You can retrieve all currently connected monitors with @ref glfwGetMonitors.
 See the reference documentation for the lifetime of the returned array.
 
-@code
+```c
 int count;
 GLFWmonitor** monitors = glfwGetMonitors(&count);
-@endcode
+```
 
 The primary monitor is always the first monitor in the returned array, but other
 monitors may be moved to a different index when a monitor is connected or
 disconnected.
 
 
-@subsection monitor_event Monitor configuration changes
+### Monitor configuration changes {#monitor_event}
 
 If you wish to be notified when a monitor is connected or disconnected, set
 a monitor callback.
 
-@code
+```c
 glfwSetMonitorCallback(monitor_callback);
-@endcode
+```
 
 The callback function receives the handle for the monitor that has been
 connected or disconnected and the event that occurred.
 
-@code
+```c
 void monitor_callback(GLFWmonitor* monitor, int event)
 {
     if (event == GLFW_CONNECTED)
@@ -83,7 +81,7 @@
         // The monitor was disconnected
     }
 }
-@endcode
+```
 
 If a monitor is disconnected, all windows that are full screen on it will be
 switched to windowed mode before the callback is called.  Only @ref
@@ -91,14 +89,14 @@
 for a disconnected monitor and only before the monitor callback returns.
 
 
-@section monitor_properties Monitor properties
+## Monitor properties {#monitor_properties}
 
 Each monitor has a current video mode, a list of supported video modes,
 a virtual position, a content scale, a human-readable name, a user pointer, an
 estimated physical size and a gamma ramp.
 
 
-@subsection monitor_modes Video modes
+### Video modes {#monitor_modes}
 
 GLFW generally does a good job selecting a suitable video mode when you create
 a full screen window, change its video mode or make a windowed one full
@@ -109,101 +107,93 @@
 array of the video modes supported by a monitor with @ref glfwGetVideoModes.
 See the reference documentation for the lifetime of the returned array.
 
-@code
+```c
 int count;
 GLFWvidmode* modes = glfwGetVideoModes(monitor, &count);
-@endcode
+```
 
 To get the current video mode of a monitor call @ref glfwGetVideoMode.  See the
 reference documentation for the lifetime of the returned pointer.
 
-@code
+```c
 const GLFWvidmode* mode = glfwGetVideoMode(monitor);
-@endcode
+```
 
 The resolution of a video mode is specified in
 [screen coordinates](@ref coordinate_systems), not pixels.
 
 
-@subsection monitor_size Physical size
+### Physical size {#monitor_size}
 
 The physical size of a monitor in millimetres, or an estimation of it, can be
 retrieved with @ref glfwGetMonitorPhysicalSize.  This has no relation to its
 current _resolution_, i.e. the width and height of its current
 [video mode](@ref monitor_modes).
 
-@code
+```c
 int width_mm, height_mm;
 glfwGetMonitorPhysicalSize(monitor, &width_mm, &height_mm);
-@endcode
+```
 
 While this can be used to calculate the raw DPI of a monitor, this is often not
 useful.  Instead, use the [monitor content scale](@ref monitor_scale) and
 [window content scale](@ref window_scale) to scale your content.
 
 
-@subsection monitor_scale Content scale
+### Content scale {#monitor_scale}
 
 The content scale for a monitor can be retrieved with @ref
 glfwGetMonitorContentScale.
 
-@code
+```c
 float xscale, yscale;
 glfwGetMonitorContentScale(monitor, &xscale, &yscale);
-@endcode
+```
 
-The content scale is the ratio between the current DPI and the platform's
-default DPI.  This is especially important for text and any UI elements.  If the
-pixel dimensions of your UI scaled by this look appropriate on your machine then
-it should appear at a reasonable size on other machines regardless of their DPI
-and scaling settings.  This relies on the system DPI and scaling settings being
-somewhat correct.
-
-The content scale may depend on both the monitor resolution and pixel density
-and on user settings.  It may be very different from the raw DPI calculated from
-the physical size and current resolution.
+For more information on what the content scale is and how to use it, see
+[window content scale](@ref window_scale).
 
 
-@subsection monitor_pos Virtual position
+### Virtual position {#monitor_pos}
 
 The position of the monitor on the virtual desktop, in
 [screen coordinates](@ref coordinate_systems), can be retrieved with @ref
 glfwGetMonitorPos.
 
-@code
+```c
 int xpos, ypos;
 glfwGetMonitorPos(monitor, &xpos, &ypos);
-@endcode
+```
 
 
-@subsection monitor_workarea Work area
+### Work area {#monitor_workarea}
 
 The area of a monitor not occupied by global task bars or menu bars is the work
 area.  This is specified in [screen coordinates](@ref coordinate_systems) and
 can be retrieved with @ref glfwGetMonitorWorkarea.
 
-@code
+```c
 int xpos, ypos, width, height;
 glfwGetMonitorWorkarea(monitor, &xpos, &ypos, &width, &height);
-@endcode
+```
 
 
-@subsection monitor_name Human-readable name
+### Human-readable name {#monitor_name}
 
 The human-readable, UTF-8 encoded name of a monitor is returned by @ref
 glfwGetMonitorName.  See the reference documentation for the lifetime of the
 returned string.
 
-@code
+```c
 const char* name = glfwGetMonitorName(monitor);
-@endcode
+```
 
 Monitor names are not guaranteed to be unique.  Two monitors of the same model
 and make may have the same name.  Only the monitor handle is guaranteed to be
 unique, and only until that monitor is disconnected.
 
 
-@subsection monitor_userptr User pointer
+### User pointer {#monitor_userptr}
 
 Each monitor has a user pointer that can be set with @ref
 glfwSetMonitorUserPointer and queried with @ref glfwGetMonitorUserPointer.  This
@@ -214,12 +204,12 @@
 The initial value of the pointer is `NULL`.
 
 
-@subsection monitor_gamma Gamma ramp
+### Gamma ramp {#monitor_gamma}
 
 The gamma ramp of a monitor can be set with @ref glfwSetGammaRamp, which accepts
 a monitor handle and a pointer to a @ref GLFWgammaramp structure.
 
-@code
+```c
 GLFWgammaramp ramp;
 unsigned short red[256], green[256], blue[256];
 
@@ -234,7 +224,7 @@
 }
 
 glfwSetGammaRamp(monitor, &ramp);
-@endcode
+```
 
 The gamma ramp data is copied before the function returns, so there is no need
 to keep it around once the ramp has been set.
@@ -245,17 +235,17 @@
 The current gamma ramp for a monitor is returned by @ref glfwGetGammaRamp.  See
 the reference documentation for the lifetime of the returned structure.
 
-@code
+```c
 const GLFWgammaramp* ramp = glfwGetGammaRamp(monitor);
-@endcode
+```
 
 If you wish to set a regular gamma ramp, you can have GLFW calculate it for you
 from the desired exponent with @ref glfwSetGamma, which in turn calls @ref
 glfwSetGammaRamp with the resulting ramp.
 
-@code
+```c
 glfwSetGamma(monitor, 1.0);
-@endcode
+```
 
 To experiment with gamma correction via the @ref glfwSetGamma function, run the
 `gamma` test program.
@@ -265,4 +255,3 @@
 gamma.  This means that setting a perfectly linear ramp, or gamma 1.0, will
 produce the default (usually sRGB-like) behavior.
 
-*/
diff --git a/docs/moving.dox b/docs/moving.md
similarity index 76%
rename from docs/moving.dox
rename to docs/moving.md
index 705b4fa..7c1e2f5 100644
--- a/docs/moving.dox
+++ b/docs/moving.md
@@ -1,8 +1,6 @@
-/*!
+# Moving from GLFW 2 to 3 {#moving_guide}
 
-@page moving_guide Moving from GLFW 2 to 3
-
-@tableofcontents
+[TOC]
 
 This is a transition guide for moving from GLFW 2 to 3.  It describes what has
 changed or been removed, but does _not_ include
@@ -11,61 +9,64 @@
 required to create full screen windows with GLFW 3.
 
 
-@section moving_removed Changed and removed features
+## Changed and removed features {#moving_removed}
 
-@subsection moving_renamed_files Renamed library and header file
+### Renamed library and header file {#moving_renamed_files}
 
 The GLFW 3 header is named @ref glfw3.h and moved to the `GLFW` directory, to
 avoid collisions with the headers of other major versions.  Similarly, the GLFW
 3 library is named `glfw3,` except when it's installed as a shared library on
-Unix-like systems, where it uses the
-[soname](https://en.wikipedia.org/wiki/soname) `libglfw.so.3`.
+Unix-like systems, where it uses the [soname][] `libglfw.so.3`.
 
-@par Old syntax
-@code
+[soname]: https://en.wikipedia.org/wiki/soname
+
+__Old syntax__
+```c
 #include <GL/glfw.h>
-@endcode
+```
 
-@par New syntax
-@code
+__New syntax__
+```c
 #include <GLFW/glfw3.h>
-@endcode
+```
 
 
-@subsection moving_threads Removal of threading functions
+### Removal of threading functions {#moving_threads}
 
 The threading functions have been removed, including the per-thread sleep
 function.  They were fairly primitive, under-used, poorly integrated and took
 time away from the focus of GLFW (i.e.  context, input and window).  There are
 better threading libraries available and native threading support is available
-in both [C++11](https://en.cppreference.com/w/cpp/thread) and
-[C11](https://en.cppreference.com/w/c/thread), both of which are gaining
-traction.
+in both [C++11][] and [C11][], both of which are gaining traction.
+
+[C++11]: https://en.cppreference.com/w/cpp/thread
+[C11]: https://en.cppreference.com/w/c/thread
 
 If you wish to use the C++11 or C11 facilities but your compiler doesn't yet
-support them, see the
-[TinyThread++](https://gitorious.org/tinythread/tinythreadpp) and
-[TinyCThread](https://github.com/tinycthread/tinycthread) projects created by
+support them, see the [TinyThread++][] and [TinyCThread][] projects created by
 the original author of GLFW.  These libraries implement a usable subset of the
 threading APIs in C++11 and C11, and in fact some GLFW 3 test programs use
 TinyCThread.
 
+[TinyThread++]: https://gitorious.org/tinythread/tinythreadpp
+[TinyCThread]: https://github.com/tinycthread/tinycthread
+
 However, GLFW 3 has better support for _use from multiple threads_ than GLFW
 2 had.  Contexts can be made current on any thread, although only a single
 thread at a time, and the documentation explicitly states which functions may be
 used from any thread and which must only be used from the main thread.
 
-@par Removed functions
-`glfwSleep`, `glfwCreateThread`, `glfwDestroyThread`, `glfwWaitThread`,
-`glfwGetThreadID`, `glfwCreateMutex`, `glfwDestroyMutex`, `glfwLockMutex`,
-`glfwUnlockMutex`, `glfwCreateCond`, `glfwDestroyCond`, `glfwWaitCond`,
-`glfwSignalCond`, `glfwBroadcastCond` and `glfwGetNumberOfProcessors`.
+__Removed functions__
+> `glfwSleep`, `glfwCreateThread`, `glfwDestroyThread`, `glfwWaitThread`,
+> `glfwGetThreadID`, `glfwCreateMutex`, `glfwDestroyMutex`, `glfwLockMutex`,
+> `glfwUnlockMutex`, `glfwCreateCond`, `glfwDestroyCond`, `glfwWaitCond`,
+> `glfwSignalCond`, `glfwBroadcastCond` and `glfwGetNumberOfProcessors`.
 
-@par Removed types
-`GLFWthreadfun`
+__Removed types__
+> `GLFWthreadfun`
 
 
-@subsection moving_image Removal of image and texture loading
+### Removal of image and texture loading {#moving_image}
 
 The image and texture loading functions have been removed.  They only supported
 the Targa image format, making them mostly useful for beginner level examples.
@@ -79,94 +80,97 @@
 the work and to tie the duplicate to GLFW.  The resulting library would also be
 platform-independent, as both OpenGL and stdio are available wherever GLFW is.
 
-@par Removed functions
-`glfwReadImage`, `glfwReadMemoryImage`, `glfwFreeImage`, `glfwLoadTexture2D`,
-`glfwLoadMemoryTexture2D` and `glfwLoadTextureImage2D`.
+__Removed functions__
+> `glfwReadImage`, `glfwReadMemoryImage`, `glfwFreeImage`, `glfwLoadTexture2D`,
+> `glfwLoadMemoryTexture2D` and `glfwLoadTextureImage2D`.
 
 
-@subsection moving_stdcall Removal of GLFWCALL macro
+### Removal of GLFWCALL macro {#moving_stdcall}
 
-The `GLFWCALL` macro, which made callback functions use
-[__stdcall](https://msdn.microsoft.com/en-us/library/zxk0tw93.aspx) on Windows,
-has been removed.  GLFW is written in C, not Pascal.  Removing this macro means
-there's one less thing for application programmers to remember, i.e. the
-requirement to mark all callback functions with `GLFWCALL`.  It also simplifies
-the creation of DLLs and DLL link libraries, as there's no need to explicitly
-disable `@n` entry point suffixes.
+The `GLFWCALL` macro, which made callback functions use [\_\_stdcall][stdcall]
+on Windows, has been removed.  GLFW is written in C, not Pascal.  Removing this
+macro means there's one less thing for application programmers to remember, i.e.
+the requirement to mark all callback functions with `GLFWCALL`.  It also
+simplifies the creation of DLLs and DLL link libraries, as there's no need to
+explicitly disable `@n` entry point suffixes.
 
-@par Old syntax
-@code
+[stdcall]: https://msdn.microsoft.com/en-us/library/zxk0tw93.aspx
+
+__Old syntax__
+```c
 void GLFWCALL callback_function(...);
-@endcode
+```
 
-@par New syntax
-@code
+__New syntax__
+```c
 void callback_function(...);
-@endcode
+```
 
 
-@subsection moving_window_handles Window handle parameters
+### Window handle parameters {#moving_window_handles}
 
 Because GLFW 3 supports multiple windows, window handle parameters have been
 added to all window-related GLFW functions and callbacks.  The handle of
 a newly created window is returned by @ref glfwCreateWindow (formerly
 `glfwOpenWindow`).  Window handles are pointers to the
-[opaque](https://en.wikipedia.org/wiki/Opaque_data_type) type @ref GLFWwindow.
+[opaque][opaque-type] type @ref GLFWwindow.
 
-@par Old syntax
-@code
+[opaque-type]: https://en.wikipedia.org/wiki/Opaque_data_type
+
+__Old syntax__
+```c
 glfwSetWindowTitle("New Window Title");
-@endcode
+```
 
-@par New syntax
-@code
+__New syntax__
+```c
 glfwSetWindowTitle(window, "New Window Title");
-@endcode
+```
 
 
-@subsection moving_monitor Explicit monitor selection
+### Explicit monitor selection {#moving_monitor}
 
 GLFW 3 provides support for multiple monitors.  To request a full screen mode window,
 instead of passing `GLFW_FULLSCREEN` you specify which monitor you wish the
 window to use.  The @ref glfwGetPrimaryMonitor function returns the monitor that
 GLFW 2 would have selected, but there are many other
 [monitor functions](@ref monitor_guide).  Monitor handles are pointers to the
-[opaque](https://en.wikipedia.org/wiki/Opaque_data_type) type @ref GLFWmonitor.
+[opaque][opaque-type] type @ref GLFWmonitor.
 
-@par Old basic full screen
-@code
+__Old basic full screen__
+```c
 glfwOpenWindow(640, 480, 8, 8, 8, 0, 24, 0, GLFW_FULLSCREEN);
-@endcode
+```
 
-@par New basic full screen
-@code
+__New basic full screen__
+```c
 window = glfwCreateWindow(640, 480, "My Window", glfwGetPrimaryMonitor(), NULL);
-@endcode
+```
 
 @note The framebuffer bit depth parameters of `glfwOpenWindow` have been turned
 into [window hints](@ref window_hints), but as they have been given
 [sane defaults](@ref window_hints_values) you rarely need to set these hints.
 
 
-@subsection moving_autopoll Removal of automatic event polling
+### Removal of automatic event polling {#moving_autopoll}
 
 GLFW 3 does not automatically poll for events in @ref glfwSwapBuffers, meaning
 you need to call @ref glfwPollEvents or @ref glfwWaitEvents yourself.  Unlike
 buffer swap, which acts on a single window, the event processing functions act
 on all windows at once.
 
-@par Old basic main loop
-@code
+__Old basic main loop__
+```c
 while (...)
 {
     // Process input
     // Render output
     glfwSwapBuffers();
 }
-@endcode
+```
 
-@par New basic main loop
-@code
+__New basic main loop__
+```c
 while (...)
 {
     // Process input
@@ -174,10 +178,10 @@
     glfwSwapBuffers(window);
     glfwPollEvents();
 }
-@endcode
+```
 
 
-@subsection moving_context Explicit context management
+### Explicit context management {#moving_context}
 
 Each GLFW 3 window has its own OpenGL context and only you, the application
 programmer, can know which context should be current on which thread at any
@@ -187,7 +191,7 @@
 a window before you can call any OpenGL functions.
 
 
-@subsection moving_hidpi Separation of window and framebuffer sizes
+### Separation of window and framebuffer sizes {#moving_hidpi}
 
 Window positions and sizes now use screen coordinates, which may not be the same
 as pixels on machines with high-DPI monitors.  This is important as OpenGL uses
@@ -197,20 +201,20 @@
 glfwGetFramebufferSize function.  A framebuffer size callback has also been
 added, which can be set with @ref glfwSetFramebufferSizeCallback.
 
-@par Old basic viewport setup
-@code
+__Old basic viewport setup__
+```c
 glfwGetWindowSize(&width, &height);
 glViewport(0, 0, width, height);
-@endcode
+```
 
-@par New basic viewport setup
-@code
+__New basic viewport setup__
+```c
 glfwGetFramebufferSize(window, &width, &height);
 glViewport(0, 0, width, height);
-@endcode
+```
 
 
-@subsection moving_window_close Window closing changes
+### Window closing changes {#moving_window_close}
 
 The `GLFW_OPENED` window parameter has been removed.  As long as the window has
 not been destroyed, whether through @ref glfwDestroyWindow or @ref
@@ -226,43 +230,43 @@
 You can query the close flag at any time with @ref glfwWindowShouldClose and set
 it at any time with @ref glfwSetWindowShouldClose.
 
-@par Old basic main loop
-@code
+__Old basic main loop__
+```c
 while (glfwGetWindowParam(GLFW_OPENED))
 {
     ...
 }
-@endcode
+```
 
-@par New basic main loop
-@code
+__New basic main loop__
+```c
 while (!glfwWindowShouldClose(window))
 {
     ...
 }
-@endcode
+```
 
 The close callback no longer returns a value.  Instead, it is called after the
 close flag has been set, so it can optionally override its value, before
 event processing completes.  You may however not call @ref glfwDestroyWindow
 from the close callback (or any other window related callback).
 
-@par Old syntax
-@code
+__Old syntax__
+```c
 int GLFWCALL window_close_callback(void);
-@endcode
+```
 
-@par New syntax
-@code
+__New syntax__
+```c
 void window_close_callback(GLFWwindow* window);
-@endcode
+```
 
 @note GLFW never clears the close flag to `GLFW_FALSE`, meaning you can use it
 for other reasons to close the window as well, for example the user choosing
 Quit from an in-game menu.
 
 
-@subsection moving_hints Persistent window hints
+### Persistent window hints {#moving_hints}
 
 The `glfwOpenWindowHint` function has been renamed to @ref glfwWindowHint.
 
@@ -271,7 +275,7 @@
 glfwDefaultWindowHints, or until the library is terminated and re-initialized.
 
 
-@subsection moving_video_modes Video mode enumeration
+### Video mode enumeration {#moving_video_modes}
 
 Video mode enumeration is now per-monitor.  The @ref glfwGetVideoModes function
 now returns all available modes for a specific monitor instead of requiring you
@@ -280,7 +284,7 @@
 returns the current mode of a monitor.
 
 
-@subsection moving_char_up Removal of character actions
+### Removal of character actions {#moving_char_up}
 
 The action parameter of the [character callback](@ref GLFWcharfun) has been
 removed.  This was an artefact of the origin of GLFW, i.e. being developed in
@@ -288,18 +292,18 @@
 produce characters with diacritical marks. Even the Swedish keyboard layout
 requires this for uncommon cases like ü.
 
-@par Old syntax
-@code
+__Old syntax__
+```c
 void GLFWCALL character_callback(int character, int action);
-@endcode
+```
 
-@par New syntax
-@code
+__New syntax__
+```c
 void character_callback(GLFWwindow* window, int character);
-@endcode
+```
 
 
-@subsection moving_cursorpos Cursor position changes
+### Cursor position changes {#moving_cursorpos}
 
 The `glfwGetMousePos` function has been renamed to @ref glfwGetCursorPos,
 `glfwSetMousePos` to @ref glfwSetCursorPos and `glfwSetMousePosCallback` to @ref
@@ -315,7 +319,7 @@
 Unless the window is active, the function fails silently.
 
 
-@subsection moving_wheel Wheel position replaced by scroll offsets
+### Wheel position replaced by scroll offsets {#moving_wheel}
 
 The `glfwGetMouseWheel` function has been removed.  Scrolling is the input of
 offsets and has no absolute position.  The mouse wheel callback has been
@@ -323,21 +327,21 @@
 two-dimensional floating point scroll offsets.  This allows you to receive
 precise scroll data from for example modern touchpads.
 
-@par Old syntax
-@code
+__Old syntax__
+```c
 void GLFWCALL mouse_wheel_callback(int position);
-@endcode
+```
 
-@par New syntax
-@code
+__New syntax__
+```c
 void scroll_callback(GLFWwindow* window, double xoffset, double yoffset);
-@endcode
+```
 
-@par Removed functions
-`glfwGetMouseWheel`
+__Removed functions__
+> `glfwGetMouseWheel`
 
 
-@subsection moving_repeat Key repeat action
+### Key repeat action {#moving_repeat}
 
 The `GLFW_KEY_REPEAT` enable has been removed and key repeat is always enabled
 for both keys and characters.  A new key action, `GLFW_REPEAT`, has been added
@@ -346,7 +350,7 @@
 `GLFW_RELEASE`.
 
 
-@subsection moving_keys Physical key input
+### Physical key input {#moving_keys}
 
 GLFW 3 key tokens map to physical keys, unlike in GLFW 2 where they mapped to
 the values generated by the current keyboard layout.  The tokens are named
@@ -366,7 +370,7 @@
 @ref GLFW_KEY_A.
 
 
-@subsection moving_joystick Joystick function changes
+### Joystick function changes {#moving_joystick}
 
 The `glfwGetJoystickPos` function has been renamed to @ref glfwGetJoystickAxes.
 
@@ -376,18 +380,19 @@
 glfwGetJoystickAxes and @ref glfwGetJoystickButtons functions.
 
 
-@subsection moving_mbcs Win32 MBCS support
+### Win32 MBCS support {#moving_mbcs}
 
-The Win32 port of GLFW 3 will not compile in
-[MBCS mode](https://msdn.microsoft.com/en-us/library/5z097dxa.aspx).
-However, because the use of the Unicode version of the Win32 API doesn't affect
-the process as a whole, but only those windows created using it, it's perfectly
+The Win32 port of GLFW 3 will not compile in [MBCS mode][MBCS].  However,
+because the use of the Unicode version of the Win32 API doesn't affect the
+process as a whole, but only those windows created using it, it's perfectly
 possible to call MBCS functions from other parts of the same application.
 Therefore, even if an application using GLFW has MBCS mode code, there's no need
 for GLFW itself to support it.
 
+[MBCS]: https://msdn.microsoft.com/en-us/library/5z097dxa.aspx
 
-@subsection moving_windows Support for versions of Windows older than XP
+
+### Support for versions of Windows older than XP {#moving_windows}
 
 All explicit support for version of Windows older than XP has been removed.
 There is no code that actively prevents GLFW 3 from running on these earlier
@@ -407,7 +412,7 @@
 version of Windows.
 
 
-@subsection moving_syskeys Capture of system-wide hotkeys
+### Capture of system-wide hotkeys {#moving_syskeys}
 
 The ability to disable and capture system-wide hotkeys like Alt+Tab has been
 removed.  Modern applications, whether they're games, scientific visualisations
@@ -415,7 +420,7 @@
 these hotkeys to function even when running in full screen mode.
 
 
-@subsection moving_terminate Automatic termination
+### Automatic termination {#moving_terminate}
 
 GLFW 3 does not register @ref glfwTerminate with `atexit` at initialization,
 because `exit` calls registered functions from the calling thread and while it
@@ -428,37 +433,41 @@
 invalidating any window handles you may still have.
 
 
-@subsection moving_glu GLU header inclusion
+### GLU header inclusion {#moving_glu}
 
 GLFW 3 does not by default include the GLU header and GLU itself has been
-deprecated by [Khronos](https://en.wikipedia.org/wiki/Khronos_Group).  __New
-projects should not use GLU__, but if you need it for legacy code that
-has been moved to GLFW 3, you can request that the GLFW header includes it by
-defining @ref GLFW_INCLUDE_GLU before the inclusion of the GLFW header.
+deprecated by [Khronos][].  __New projects should not use GLU__, but if you need
+it for legacy code that has been moved to GLFW 3, you can request that the GLFW
+header includes it by defining @ref GLFW_INCLUDE_GLU before the inclusion of the
+GLFW header.
 
-@par Old syntax
-@code
+[Khronos]: https://en.wikipedia.org/wiki/Khronos_Group
+
+__Old syntax__
+```c
 #include <GL/glfw.h>
-@endcode
+```
 
-@par New syntax
-@code
+__New syntax__
+```c
 #define GLFW_INCLUDE_GLU
 #include <GLFW/glfw3.h>
-@endcode
+```
 
 There are many libraries that offer replacements for the functionality offered
-by GLU.  For the matrix helper functions, see math libraries like
-[GLM](https://github.com/g-truc/glm) (for C++),
-[linmath.h](https://github.com/datenwolf/linmath.h) (for C) and others.  For the
-tessellation functions, see for example
-[libtess2](https://github.com/memononen/libtess2).
+by GLU.  For the matrix helper functions, see math libraries like [GLM][] (for
+C++), [linmath.h][] (for C) and others.  For the tessellation functions, see for
+example [libtess2][].
+
+[GLM]: https://github.com/g-truc/glm
+[linmath.h]: https://github.com/datenwolf/linmath.h
+[libtess2]: https://github.com/memononen/libtess2
 
 
-@section moving_tables Name change tables
+## Name change tables {#moving_tables}
 
 
-@subsection moving_renamed_functions Renamed functions
+### Renamed functions {#moving_renamed_functions}
 
 | GLFW 2                      | GLFW 3                        | Notes |
 | --------------------------- | ----------------------------- | ----- |
@@ -478,7 +487,7 @@
 | `glfwGetJoystickParam`      | @ref glfwJoystickPresent      | The axis and button counts are provided by @ref glfwGetJoystickAxes and @ref glfwGetJoystickButtons |
 
 
-@subsection moving_renamed_types Renamed types
+### Renamed types {#moving_renamed_types}
 
 | GLFW 2              | GLFW 3                | Notes |
 | ------------------- | --------------------- |       |
@@ -486,7 +495,7 @@
 | `GLFWmouseposfun`   | @ref GLFWcursorposfun |       |
 
 
-@subsection moving_renamed_tokens Renamed tokens
+### Renamed tokens {#moving_renamed_tokens}
 
 | GLFW 2                      | GLFW 3                       | Notes |
 | --------------------------- | ---------------------------- | ----- |
@@ -510,4 +519,3 @@
 | `GLFW_KEY_RALT`             | `GLFW_KEY_RIGHT_ALT`         |       |
 | `GLFW_KEY_RSUPER`           | `GLFW_KEY_RIGHT_SUPER`       |       |
 
-*/
diff --git a/docs/news.dox b/docs/news.dox
deleted file mode 100644
index 1db3a06..0000000
--- a/docs/news.dox
+++ /dev/null
@@ -1,902 +0,0 @@
-/*!
-
-@page news Release notes
-
-@tableofcontents
-
-
-@section news_33 Release notes for version 3.3
-
-These are the release notes for version 3.3.  For a more detailed view including
-all fixed bugs see the [version history](https://www.glfw.org/changelog.html).
-
-Please review the caveats, deprecations and removals if your project was written
-against an earlier version of GLFW 3.
-
-
-@subsection features_33 New features in version 3.3
-
-@subsubsection gamepad_33 Gamepad input via SDL_GameControllerDB
-
-GLFW can now remap game controllers to a standard Xbox-like layout using
-a built-in copy of SDL_GameControllerDB.  Call @ref glfwJoystickIsGamepad to
-check if a joystick has a mapping, @ref glfwGetGamepadState to retrieve its
-input state, @ref glfwUpdateGamepadMappings to add newer mappings and @ref
-glfwGetGamepadName and @ref glfwGetJoystickGUID for mapping related information.
-
-For more information see @ref gamepad.
-
-
-@subsubsection moltenvk_33 Support for Vulkan on macOS via MoltenVK
-
-GLFW now supports [MoltenVK](https://moltengl.com/moltenvk/), a Vulkan
-implementation on top of the Metal API, and its `VK_MVK_macos_surface` window
-surface creation extension.  MoltenVK is included in the [macOS Vulkan
-SDK](https://vulkan.lunarg.com/).
-
-For more information see @ref vulkan_guide.
-
-
-@subsubsection wayland_libdecor_33 Wayland libdecor decorations
-
-GLFW now supports improved fallback window decorations via
-[libdecor](https://gitlab.freedesktop.org/libdecor/libdecor).
-
-Support for libdecor can be toggled before GLFW is initialized with the
-[GLFW_WAYLAND_LIBDECOR](@ref GLFW_WAYLAND_LIBDECOR_hint) init hint.  It is
-enabled by default.
-
-
-@subsubsection content_scale_33 Content scale queries for DPI-aware rendering
-
-GLFW now provides content scales for windows and monitors, i.e. the ratio
-between their current DPI and the platform's default DPI, with @ref
-glfwGetWindowContentScale and @ref glfwGetMonitorContentScale.
-
-Changes of the content scale of a window can be received with the window content
-scale callback, set with @ref glfwSetWindowContentScaleCallback.
-
-The @ref GLFW_SCALE_TO_MONITOR window hint enables automatic resizing of a
-window by the content scale of the monitor it is placed, on platforms like
-Windows where this is necessary.  This takes effect both on creation and when
-the window is moved between monitors.  It is related to but different from
-[GLFW_COCOA_RETINA_FRAMEBUFFER](@ref GLFW_COCOA_RETINA_FRAMEBUFFER_hint).
-
-For more information see @ref window_scale.
-
-
-@subsubsection setwindowattrib_33 Support for updating window attributes
-
-GLFW now supports changing the [GLFW_DECORATED](@ref GLFW_DECORATED_attrib),
-[GLFW_RESIZABLE](@ref GLFW_RESIZABLE_attrib),
-[GLFW_FLOATING](@ref GLFW_FLOATING_attrib),
-[GLFW_AUTO_ICONIFY](@ref GLFW_AUTO_ICONIFY_attrib) and
-[GLFW_FOCUS_ON_SHOW](@ref GLFW_FOCUS_ON_SHOW_attrib) attributes for existing
-windows with @ref glfwSetWindowAttrib.
-
-For more information see @ref window_attribs.
-
-
-@subsubsection raw_motion_33 Support for raw mouse motion
-
-GLFW now supports raw (unscaled and unaccelerated) mouse motion in disabled
-cursor mode with the [GLFW_RAW_MOUSE_MOTION](@ref GLFW_RAW_MOUSE_MOTION) input
-mode.  Raw mouse motion input is not yet implemented on macOS.  Call @ref
-glfwRawMouseMotionSupported to check if GLFW can provide raw mouse motion on the
-current system.
-
-For more information see @ref raw_mouse_motion.
-
-
-@subsubsection joysticks_33 Joystick hats
-
-GLFW can now return the state of hats (i.e. POVs or D-pads) of a joystick with
-@ref glfwGetJoystickHats.  For compatibility, hats are also exposed as buttons.
-This can be disabled with the @ref GLFW_JOYSTICK_HAT_BUTTONS initialization
-hint.
-
-For more information see @ref joystick_hat.
-
-
-@subsubsection geterror_33 Error query
-
-GLFW now supports querying the last error code for the calling thread and its
-human-readable description with @ref glfwGetError.  This can be used instead of
-or together with the error callback.
-
-For more information see @ref error_handling.
-
-
-@subsubsection init_hints_33 Support for initialization hints
-
-GLFW now supports setting library initialization hints with @ref glfwInitHint.
-These must be set before initialization to take effect.  Some of these hints are
-platform specific but are safe to set on any platform.
-
-For more information see @ref init_hints.
-
-
-@subsubsection attention_33 User attention request
-
-GLFW now supports requesting user attention with @ref
-glfwRequestWindowAttention.  Where possible this calls attention to the
-specified window.  On platforms like macOS it calls attention to the whole
-application.
-
-For more information see @ref window_attention.
-
-
-@subsubsection maximize_33 Window maximization callback
-
-GLFW now supports notifying the application that the window has been maximized
-@ref glfwSetWindowMaximizeCallback.  This is called both when the window was
-maximized by the user and when it was done with @ref glfwMaximizeWindow.
-
-For more information see @ref window_maximize.
-
-
-@subsubsection workarea_33 Query for the monitor work area
-
-GLFW now supports querying the work area of a monitor, i.e. the area not
-occupied by task bars or global menu bars, with @ref glfwGetMonitorWorkarea.  On
-platforms that lack this concept, the whole area of the monitor is returned.
-
-For more information see @ref monitor_workarea.
-
-
-@subsubsection transparency_33 Transparent windows and framebuffers
-
-GLFW now supports the creation of windows with transparent framebuffers on
-systems with desktop compositing enabled with the @ref
-GLFW_TRANSPARENT_FRAMEBUFFER window hint and attribute.  This hint must be set
-before window creation and leaves any window decorations opaque.
-
-GLFW now also supports whole window transparency with @ref glfwGetWindowOpacity
-and @ref glfwSetWindowOpacity.  This value controls the opacity of the whole
-window including decorations and unlike framebuffer transparency can be changed
-at any time after window creation.
-
-For more information see @ref window_transparency.
-
-
-@subsubsection key_scancode_33 Query for the scancode of a key
-
-GLFW now supports querying the platform dependent scancode of any physical key
-with @ref glfwGetKeyScancode.
-
-For more information see @ref input_key.
-
-
-@subsubsection center_cursor_33 Cursor centering window hint
-
-GLFW now supports controlling whether the cursor is centered over newly created
-full screen windows with the [GLFW_CENTER_CURSOR](@ref GLFW_CENTER_CURSOR_hint)
-window hint.  It is enabled by default.
-
-
-@subsubsection cursor_hover_33 Mouse cursor hover window attribute
-
-GLFW now supports polling whether the cursor is hovering over the window content
-area with the [GLFW_HOVERED](@ref GLFW_HOVERED_attrib) window attribute.  This
-attribute corresponds to the [cursor enter/leave](@ref cursor_enter) event.
-
-
-@subsubsection focusonshow_33 Window hint and attribute for input focus on show
-
-GLFW now has the [GLFW_FOCUS_ON_SHOW](@ref GLFW_DECORATED_hint) window hint and
-attribute for controlling whether a window gets input focus when shown.  It is
-enabled by default.  It applies both when creating an visible window with @ref
-glfwCreateWindow and when showing it with @ref glfwShowWindow.
-
-This is a workaround for GLFW 3.0 lacking @ref glfwFocusWindow and will be
-corrected in the next major version.
-
-For more information see @ref window_hide.
-
-
-@subsubsection device_userptr_33 Monitor and joystick user pointers
-
-GLFW now supports setting and querying user pointers for connected monitors and
-joysticks with @ref glfwSetMonitorUserPointer, @ref glfwGetMonitorUserPointer,
-@ref glfwSetJoystickUserPointer and @ref glfwGetJoystickUserPointer.
-
-For more information see @ref monitor_userptr and @ref joystick_userptr.
-
-
-@subsubsection macos_nib_33 macOS menu bar from nib file
-
-GLFW will now load a `MainMenu.nib` file if found in the `Contents/Resources`
-directory of the application bundle, as a way to replace the GLFW menu bar
-without recompiling GLFW.  This behavior can be disabled with the
-[GLFW_COCOA_MENUBAR](@ref GLFW_COCOA_MENUBAR_hint) initialization hint.
-
-
-@subsubsection glext_33 Support for more context creation extensions
-
-The context hint @ref GLFW_SRGB_CAPABLE now supports OpenGL ES via
-`WGL_EXT_colorspace`, the context hint @ref GLFW_CONTEXT_NO_ERROR now supports
-`WGL_ARB_create_context_no_error` and `GLX_ARB_create_context_no_error`, the
-context hint @ref GLFW_CONTEXT_RELEASE_BEHAVIOR now supports
-`EGL_KHR_context_flush_control` and @ref glfwGetProcAddress now supports
-`EGL_KHR_get_all_proc_addresses`.
-
-
-@subsubsection osmesa_33 OSMesa off-screen context creation support
-
-GLFW now supports creating off-screen OpenGL contexts using
-[OSMesa](https://www.mesa3d.org/osmesa.html) by setting
-[GLFW_CONTEXT_CREATION_API](@ref GLFW_CONTEXT_CREATION_API_hint) to
-`GLFW_OSMESA_CONTEXT_API`.  Native access function have been added to retrieve
-the OSMesa color and depth buffers.
-
-There is also a new null backend that uses OSMesa as its native context
-creation API, intended for automated testing.  This backend does not provide
-input.
-
-
-@subsection caveats_33 Caveats for version 3.3
-
-@subsubsection joystick_layout_33 Layout of joysticks have changed
-
-The way joystick elements are arranged have changed to match SDL2 in order to
-support SDL_GameControllerDB mappings.  The layout of joysticks may
-change again if required for compatibility with SDL2.  If you need a known and
-stable layout for game controllers, see if you can switch to @ref gamepad.
-
-Existing code that depends on a specific joystick layout will likely have to be
-updated.
-
-
-@subsubsection wait_events_33 No window required to wait for events
-
-The @ref glfwWaitEvents and @ref glfwWaitEventsTimeout functions no longer need
-a window to be created to wait for events.  Before version 3.3 these functions
-would return immediately if there were no user-created windows.  On platforms
-where only windows can receive events, an internal helper window is used.
-
-Existing code that depends on the earlier behavior will likely have to be
-updated.
-
-
-@subsubsection gamma_ramp_size_33 Gamma ramp size of 256 may be rejected
-
-The documentation for versions before 3.3 stated that a gamma ramp size of 256
-would always be accepted.  This was never the case on X11 and could lead to
-artifacts on macOS.  The @ref glfwSetGamma function has been updated to always
-generate a ramp of the correct size.
-
-Existing code that hardcodes a size of 256 should be updated to use the size of
-the current ramp of a monitor when setting a new ramp for that monitor.
-
-
-@subsubsection xinput_deadzone_33 Windows XInput deadzone removed
-
-GLFW no longer applies any deadzone to the input state received from the XInput
-API.  This was never done for any other platform joystick API so this change
-makes the behavior more consistent but you will need to apply your own deadzone
-if desired.
-
-
-@subsubsection x11_clipboard_33 X11 clipboard transfer limits
-
-GLFW now supports reading clipboard text via the `INCR` method, which removes
-the limit on how much text can be read with @ref glfwGetClipboardString.
-However, writing via this method is not yet supported, so you may not be able to
-write a very large string with @ref glfwSetClipboardString even if you read it
-from the clipboard earlier.
-
-The exact size limit for writing to the clipboard is negotiated with each
-receiving application but is at least several tens of kilobytes.  Note that only
-the read limit has changed.  Any string that could be written before still can
-be.
-
-
-@subsubsection x11_linking_33 X11 extension libraries are loaded dynamically
-
-GLFW now loads all X11 extension libraries at initialization.  The only X11
-library you need to link against is `libX11`.  The header files for the
-extension libraries are still required for compilation.
-
-Existing projects and makefiles that link GLFW directly against the extension
-libraries should still build correctly but will add these libraries as load-time
-dependencies.
-
-
-@subsubsection cmake_version_33 CMake 3.0 or later is required
-
-The minimum CMake version has been raised from 2.8.12 to 3.0.  This is only
-a requirement of the GLFW CMake files.  The GLFW source files do not depend on
-CMake.
-
-
-@subsubsection caveat_fbtransparency_33 Framebuffer transparency requires DWM transparency
-
-GLFW no longer supports framebuffer transparency enabled via @ref
-GLFW_TRANSPARENT_FRAMEBUFFER on Windows 7 if DWM transparency is off
-(the Transparency setting under Personalization > Window Color).
-
-
-@subsubsection emptyevents_33 Empty events on X11 no longer roundtrip to server
-
-Starting with GLFW 3.3.7, events posted with @ref glfwPostEmptyEvent now use a separate
-unnamed pipe instead of sending an X11 client event to the helper window.
-
-
-@subsubsection wayland_alpha_33 Framebuffer may lack alpha channel on older Wayland systems
-
-On Wayland, when creating an EGL context on a machine lacking the new
-`EGL_EXT_present_opaque` extension, the @ref GLFW_ALPHA_BITS window hint will be
-ignored and the framebuffer will have no alpha channel.  This is because some
-Wayland compositors treat any buffer with an alpha channel as per-pixel
-transparent.
-
-If you want a per-pixel transparent window, see the
-[GLFW_TRANSPARENT_FRAMEBUFFER](@ref GLFW_TRANSPARENT_FRAMEBUFFER_hint) window
-hint.
-
-
-@subsection deprecations_33 Deprecations in version 3.3
-
-@subsubsection charmods_callback_33 Character with modifiers callback
-
-The character with modifiers callback set with @ref glfwSetCharModsCallback has
-been deprecated and should if possible not be used.
-
-Existing code should still work but further bug fixes will likely not be made.
-The callback will be removed in the next major version.
-
-
-@subsubsection clipboard_window_33 Window parameter to clipboard functions
-
-The window parameter of the clipboard functions @ref glfwGetClipboardString and
-@ref glfwSetClipboardString has been deprecated and is no longer used on any
-platform.  On platforms where the clipboard must be owned by a specific window,
-an internal helper window is used.
-
-Existing code should still work unless it depends on a specific window owning
-the clipboard.  New code may pass `NULL` as the window argument.  The parameter
-will be removed in a future release.
-
-
-@subsection removals_33 Removals in 3.3
-
-@subsubsection macos_options_33 macOS specific CMake options and macros
-
-The `GLFW_USE_RETINA`, `GLFW_USE_CHDIR` and `GLFW_USE_MENUBAR` CMake options and
-the `_GLFW_USE_RETINA`, `_GLFW_USE_CHDIR` and `_GLFW_USE_MENUBAR` compile-time
-macros have been removed.
-
-These options and macros are replaced by the window hint
-[GLFW_COCOA_RETINA_FRAMEBUFFER](@ref GLFW_COCOA_RETINA_FRAMEBUFFER_hint)
-and the init hints
-[GLFW_COCOA_CHDIR_RESOURCES](@ref GLFW_COCOA_CHDIR_RESOURCES_hint) and
-[GLFW_COCOA_MENUBAR](@ref GLFW_COCOA_MENUBAR_hint).
-
-Existing projects and makefiles that set these options or define these macros
-during compilation of GLFW will still build but it will have no effect and the
-default behaviors will be used.
-
-
-@subsubsection vulkan_sdk_33 LunarG Vulkan SDK dependency
-
-The GLFW test programs that previously depended on the LunarG Vulkan SDK now
-instead uses a Vulkan loader generated by
-[glad2](https://github.com/Dav1dde/glad).  This means the GLFW CMake files no
-longer look for the Vulkan SDK.
-
-Existing CMake projects that depended on the Vulkan SDK cache variables from
-GLFW will need to call `find_package(Vulkan)` themselves.  CMake 3.7 and later
-already comes with a
-[Vulkan find module](https://cmake.org/cmake/help/latest/module/FindVulkan.html)
-similar to the one GLFW previously included.
-
-
-@subsubsection lib_suffix_33 CMake option LIB_SUFFIX
-
-The `LIB_SUFFIX` CMake option has been removed.  GLFW now uses the
-GNUInstallDirs CMake package to handle platform specific details like the
-library directory suffix and the `LIB_SUFFIX` CMake option has been removed.
-
-Existing projects and makefiles that set the `LIB_SUFFIX` option will use the
-suffix chosen by the GNUInstallDirs package and the option will be ignored.
-
-
-@subsubsection wl_shell_33 Support for the wl_shell protocol
-
-Support for the wl_shell protocol has been removed and GLFW now only supports
-the XDG-Shell protocol.  If your Wayland compositor does not support XDG-Shell
-then GLFW will fail to initialize.
-
-
-@subsubsection mir_removed_33 Mir support
-
-The experimental Mir support has been completely removed as the Mir project has
-implemented support for the Wayland protocol and is recommending that
-applications use that instead.
-
-Existing projects and makefiles that select Mir when compiling GLFW will fail.
-Use Wayland or X11 instead.
-
-
-@subsection symbols_33 New symbols in version 3.3
-
-@subsubsection functions_33 New functions in version 3.3
-
- - @ref glfwInitHint
- - @ref glfwGetError
- - @ref glfwGetMonitorWorkarea
- - @ref glfwGetMonitorContentScale
- - @ref glfwGetMonitorUserPointer
- - @ref glfwSetMonitorUserPointer
- - @ref glfwWindowHintString
- - @ref glfwGetWindowContentScale
- - @ref glfwGetWindowOpacity
- - @ref glfwSetWindowOpacity
- - @ref glfwRequestWindowAttention
- - @ref glfwSetWindowAttrib
- - @ref glfwSetWindowMaximizeCallback
- - @ref glfwSetWindowContentScaleCallback
- - @ref glfwRawMouseMotionSupported
- - @ref glfwGetKeyScancode
- - @ref glfwGetJoystickHats
- - @ref glfwGetJoystickGUID
- - @ref glfwGetJoystickUserPointer
- - @ref glfwSetJoystickUserPointer
- - @ref glfwJoystickIsGamepad
- - @ref glfwUpdateGamepadMappings
- - @ref glfwGetGamepadName
- - @ref glfwGetGamepadState
-
-
-@subsubsection types_33 New types in version 3.3
-
- - @ref GLFWwindowmaximizefun
- - @ref GLFWwindowcontentscalefun
- - @ref GLFWgamepadstate
- - @ref GLFW_WAYLAND_LIBDECOR
- - @ref GLFW_WAYLAND_PREFER_LIBDECOR
- - @ref GLFW_WAYLAND_DISABLE_LIBDECOR
-
-
-@subsubsection constants_33 New constants in version 3.3
-
- - @ref GLFW_NO_ERROR
- - @ref GLFW_JOYSTICK_HAT_BUTTONS
- - @ref GLFW_COCOA_CHDIR_RESOURCES
- - @ref GLFW_COCOA_MENUBAR
- - @ref GLFW_CENTER_CURSOR
- - @ref GLFW_TRANSPARENT_FRAMEBUFFER
- - @ref GLFW_HOVERED
- - @ref GLFW_FOCUS_ON_SHOW
- - @ref GLFW_SCALE_TO_MONITOR
- - @ref GLFW_COCOA_RETINA_FRAMEBUFFER
- - @ref GLFW_COCOA_FRAME_NAME
- - @ref GLFW_COCOA_GRAPHICS_SWITCHING
- - @ref GLFW_X11_CLASS_NAME
- - @ref GLFW_X11_INSTANCE_NAME
- - @ref GLFW_OSMESA_CONTEXT_API
- - @ref GLFW_HAT_CENTERED
- - @ref GLFW_HAT_UP
- - @ref GLFW_HAT_RIGHT
- - @ref GLFW_HAT_DOWN
- - @ref GLFW_HAT_LEFT
- - @ref GLFW_HAT_RIGHT_UP
- - @ref GLFW_HAT_RIGHT_DOWN
- - @ref GLFW_HAT_LEFT_UP
- - @ref GLFW_HAT_LEFT_DOWN
- - @ref GLFW_MOD_CAPS_LOCK
- - @ref GLFW_MOD_NUM_LOCK
- - @ref GLFW_LOCK_KEY_MODS
- - @ref GLFW_RAW_MOUSE_MOTION
- - @ref GLFW_GAMEPAD_BUTTON_A
- - @ref GLFW_GAMEPAD_BUTTON_B
- - @ref GLFW_GAMEPAD_BUTTON_X
- - @ref GLFW_GAMEPAD_BUTTON_Y
- - @ref GLFW_GAMEPAD_BUTTON_LEFT_BUMPER
- - @ref GLFW_GAMEPAD_BUTTON_RIGHT_BUMPER
- - @ref GLFW_GAMEPAD_BUTTON_BACK
- - @ref GLFW_GAMEPAD_BUTTON_START
- - @ref GLFW_GAMEPAD_BUTTON_GUIDE
- - @ref GLFW_GAMEPAD_BUTTON_LEFT_THUMB
- - @ref GLFW_GAMEPAD_BUTTON_RIGHT_THUMB
- - @ref GLFW_GAMEPAD_BUTTON_DPAD_UP
- - @ref GLFW_GAMEPAD_BUTTON_DPAD_RIGHT
- - @ref GLFW_GAMEPAD_BUTTON_DPAD_DOWN
- - @ref GLFW_GAMEPAD_BUTTON_DPAD_LEFT
- - @ref GLFW_GAMEPAD_BUTTON_LAST
- - @ref GLFW_GAMEPAD_BUTTON_CROSS
- - @ref GLFW_GAMEPAD_BUTTON_CIRCLE
- - @ref GLFW_GAMEPAD_BUTTON_SQUARE
- - @ref GLFW_GAMEPAD_BUTTON_TRIANGLE
- - @ref GLFW_GAMEPAD_AXIS_LEFT_X
- - @ref GLFW_GAMEPAD_AXIS_LEFT_Y
- - @ref GLFW_GAMEPAD_AXIS_RIGHT_X
- - @ref GLFW_GAMEPAD_AXIS_RIGHT_Y
- - @ref GLFW_GAMEPAD_AXIS_LEFT_TRIGGER
- - @ref GLFW_GAMEPAD_AXIS_RIGHT_TRIGGER
- - @ref GLFW_GAMEPAD_AXIS_LAST
-
-
-@section news_32 Release notes for 3.2
-
-These are the release notes for version 3.2.  For a more detailed view including
-all fixed bugs see the [version history](https://www.glfw.org/changelog.html).
-
-
-@subsection features_32 New features in version 3.2
-
-@subsubsection news_32_vulkan Support for Vulkan
-
-GLFW now supports basic integration with Vulkan with @ref glfwVulkanSupported,
-@ref glfwGetRequiredInstanceExtensions, @ref glfwGetInstanceProcAddress, @ref
-glfwGetPhysicalDevicePresentationSupport and @ref glfwCreateWindowSurface.
-Vulkan header inclusion can be selected with
-@ref GLFW_INCLUDE_VULKAN.
-
-
-@subsubsection news_32_setwindowmonitor Window mode switching
-
-GLFW now supports switching between windowed and full screen modes and updating
-the monitor and desired resolution and refresh rate of full screen windows with
-@ref glfwSetWindowMonitor.
-
-
-@subsubsection news_32_maximize Window maxmimization support
-
-GLFW now supports window maximization with @ref glfwMaximizeWindow and the
-@ref GLFW_MAXIMIZED window hint and attribute.
-
-
-@subsubsection news_32_focus Window input focus control
-
-GLFW now supports giving windows input focus with @ref glfwFocusWindow.
-
-
-@subsubsection news_32_sizelimits Window size limit support
-
-GLFW now supports setting both absolute and relative window size limits with
-@ref glfwSetWindowSizeLimits and @ref glfwSetWindowAspectRatio.
-
-
-@subsubsection news_32_keyname Localized key names
-
-GLFW now supports querying the localized name of printable keys with @ref
-glfwGetKeyName, either by key token or by scancode.
-
-
-@subsubsection news_32_waittimeout Wait for events with timeout
-
-GLFW now supports waiting for events for a set amount of time with @ref
-glfwWaitEventsTimeout.
-
-
-@subsubsection news_32_icon Window icon support
-
-GLFW now supports setting the icon of windows with @ref glfwSetWindowIcon.
-
-
-@subsubsection news_32_timer Raw timer access
-
-GLFW now supports raw timer values with @ref glfwGetTimerValue and @ref
-glfwGetTimerFrequency.
-
-
-@subsubsection news_32_joystick Joystick connection callback
-
-GLFW now supports notifying when a joystick has been connected or disconnected
-with @ref glfwSetJoystickCallback.
-
-
-@subsubsection news_32_noapi Context-less windows
-
-GLFW now supports creating windows without a OpenGL or OpenGL ES context by
-setting the [GLFW_CLIENT_API](@ref GLFW_CLIENT_API_hint) hint to `GLFW_NO_API`.
-
-
-@subsubsection news_32_contextapi Run-time context creation API selection
-
-GLFW now supports selecting and querying the context creation API at run-time
-with the @ref GLFW_CONTEXT_CREATION_API hint and attribute.
-
-
-@subsubsection news_32_noerror Error-free context creation
-
-GLFW now supports creating and querying OpenGL and OpenGL ES contexts that do
-not emit errors with the @ref GLFW_CONTEXT_NO_ERROR hint, provided the machine
-supports the `GL_KHR_no_error` extension.
-
-
-@subsubsection news_32_cmake CMake config-file package support
-
-GLFW now supports being used as a
-[config-file package](@ref build_link_cmake_package) from other projects for
-easy linking with the library and its dependencies.
-
-
-@section news_31 Release notes for 3.1
-
-These are the release notes for version 3.1.  For a more detailed view including
-all fixed bugs see the [version history](https://www.glfw.org/changelog.html).
-
-
-@subsection features_31 New features in version 3.1
-
-@subsubsection news_31_cursor Custom mouse cursor images
-
-GLFW now supports creating and setting both custom cursor images and standard
-cursor shapes.  They are created with @ref glfwCreateCursor or @ref
-glfwCreateStandardCursor, set with @ref glfwSetCursor and destroyed with @ref
-glfwDestroyCursor.
-
-@see @ref cursor_object
-
-
-@subsubsection news_31_drop Path drop event
-
-GLFW now provides a callback for receiving the paths of files and directories
-dropped onto GLFW windows.  The callback is set with @ref glfwSetDropCallback.
-
-@see @ref path_drop
-
-
-@subsubsection news_31_emptyevent Main thread wake-up
-
-GLFW now provides the @ref glfwPostEmptyEvent function for posting an empty
-event from another thread to the main thread event queue, causing @ref
-glfwWaitEvents to return.
-
-@see @ref events
-
-
-@subsubsection news_31_framesize Window frame size query
-
-GLFW now supports querying the size, on each side, of the frame around the
-content area of a window, with @ref glfwGetWindowFrameSize.
-
-@see [Window size](@ref window_size)
-
-
-@subsubsection news_31_autoiconify Simultaneous multi-monitor rendering
-
-GLFW now supports disabling auto-iconification of full screen windows with
-the [GLFW_AUTO_ICONIFY](@ref GLFW_AUTO_ICONIFY_hint) window hint.  This is
-intended for people building multi-monitor installations, where you need windows
-to stay in full screen despite losing input focus.
-
-
-@subsubsection news_31_floating Floating windows
-
-GLFW now supports floating windows, also called topmost or always on top, for
-easier debugging with the @ref GLFW_FLOATING window hint and attribute.
-
-
-@subsubsection news_31_focused Initially unfocused windows
-
-GLFW now supports preventing a windowed mode window from gaining input focus on
-creation, with the [GLFW_FOCUSED](@ref GLFW_FOCUSED_hint) window hint.
-
-
-@subsubsection news_31_direct Direct access for window attributes and cursor position
-
-GLFW now queries the window input focus, visibility and iconification attributes
-and the cursor position directly instead of returning cached data.
-
-
-@subsubsection news_31_charmods Character with modifiers callback
-
-GLFW now provides a callback for character events with modifier key bits.  The
-callback is set with @ref glfwSetCharModsCallback.  Unlike the regular character
-callback, this will report character events that will not result in a character
-being input, for example if the Control key is held down.
-
-@see @ref input_char
-
-
-@subsubsection news_31_single Single buffered framebuffers
-
-GLFW now supports the creation of single buffered windows, with the @ref
-GLFW_DOUBLEBUFFER hint.
-
-
-@subsubsection news_31_glext Macro for including extension header
-
-GLFW now includes the extension header appropriate for the chosen OpenGL or
-OpenGL ES header when @ref GLFW_INCLUDE_GLEXT is defined.  GLFW does not provide
-these headers.  They must be provided by your development environment or your
-OpenGL or OpenGL ES SDK.
-
-
-@subsubsection news_31_release Context release behaviors
-
-GLFW now supports controlling and querying whether the pipeline is flushed when
-a context is made non-current, with the @ref GLFW_CONTEXT_RELEASE_BEHAVIOR hint
-and attribute, provided the machine supports the `GL_KHR_context_flush_control`
-extension.
-
-
-@subsubsection news_31_wayland (Experimental) Wayland support
-
-GLFW now has an _experimental_ Wayland display protocol backend that can be
-selected on Linux with a CMake option.
-
-
-@subsubsection news_31_mir (Experimental) Mir support
-
-GLFW now has an _experimental_ Mir display server backend that can be selected
-on Linux with a CMake option.
-
-
-@section news_30 Release notes for 3.0
-
-These are the release notes for version 3.0.  For a more detailed view including
-all fixed bugs see the [version history](https://www.glfw.org/changelog.html).
-
-
-@subsection features_30 New features in version 3.0
-
-@subsubsection news_30_cmake CMake build system
-
-GLFW now uses the CMake build system instead of the various makefiles and
-project files used by earlier versions.  CMake is available for all platforms
-supported by GLFW, is present in most package systems and can generate
-makefiles and/or project files for most popular development environments.
-
-For more information on how to use CMake, see the
-[CMake manual](https://cmake.org/cmake/help/documentation.html).
-
-
-@subsubsection news_30_multiwnd Multi-window support
-
-GLFW now supports the creation of multiple windows, each with their own OpenGL
-or OpenGL ES context, and all window functions now take a window handle.  Event
-callbacks are now per-window and are provided with the handle of the window that
-received the event.  The @ref glfwMakeContextCurrent function has been added to
-select which context is current on a given thread.
-
-
-@subsubsection news_30_multimon Multi-monitor support
-
-GLFW now explicitly supports multiple monitors.  They can be enumerated with
-@ref glfwGetMonitors, queried with @ref glfwGetVideoModes, @ref
-glfwGetMonitorPos, @ref glfwGetMonitorName and @ref glfwGetMonitorPhysicalSize,
-and specified at window creation to make the newly created window full screen on
-that specific monitor.
-
-
-@subsubsection news_30_unicode Unicode support
-
-All string arguments to GLFW functions and all strings returned by GLFW now use
-the UTF-8 encoding.  This includes the window title, error string, clipboard
-text, monitor and joystick names as well as the extension function arguments (as
-ASCII is a subset of UTF-8).
-
-
-@subsubsection news_30_clipboard Clipboard text I/O
-
-GLFW now supports reading and writing plain text to and from the system
-clipboard, with the @ref glfwGetClipboardString and @ref glfwSetClipboardString
-functions.
-
-
-@subsubsection news_30_gamma Gamma ramp support
-
-GLFW now supports setting and reading back the gamma ramp of monitors, with the
-@ref glfwGetGammaRamp and @ref glfwSetGammaRamp functions.  There is also @ref
-glfwSetGamma, which generates a ramp from a gamma value and then sets it.
-
-
-@subsubsection news_30_gles OpenGL ES support
-
-GLFW now supports the creation of OpenGL ES contexts, by setting the
-[GLFW_CLIENT_API](@ref GLFW_CLIENT_API_hint) hint to `GLFW_OPENGL_ES_API`, where
-creation of such contexts are supported.  Note that GLFW _does not implement_
-OpenGL ES, so your driver must provide support in a way usable by GLFW.  Modern
-Nvidia and Intel drivers support creation of OpenGL ES context using the GLX and
-WGL APIs, while AMD provides an EGL implementation instead.
-
-
-@subsubsection news_30_egl (Experimental) EGL support
-
-GLFW now has an experimental EGL context creation back end that can be selected
-through CMake options.
-
-
-@subsubsection news_30_hidpi High-DPI support
-
-GLFW now supports high-DPI monitors on both Windows and macOS, giving windows
-full resolution framebuffers where other UI elements are scaled up.  To achieve
-this, @ref glfwGetFramebufferSize and @ref glfwSetFramebufferSizeCallback have
-been added.  These work with pixels, while the rest of the GLFW API works with
-screen coordinates.  This is important as OpenGL uses pixels, not screen
-coordinates.
-
-
-@subsubsection news_30_error Error callback
-
-GLFW now has an error callback, which can provide your application with much
-more detailed diagnostics than was previously possible.  The callback is passed
-an error code and a description string.
-
-
-@subsubsection news_30_wndptr Per-window user pointer
-
-Each window now has a user-defined pointer, retrieved with @ref
-glfwGetWindowUserPointer and set with @ref glfwSetWindowUserPointer, to make it
-easier to integrate GLFW into C++ code.
-
-
-@subsubsection news_30_iconifyfun Window iconification callback
-
-Each window now has a callback for iconification and restoration events,
-which is set with @ref glfwSetWindowIconifyCallback.
-
-
-@subsubsection news_30_wndposfun Window position callback
-
-Each window now has a callback for position events, which is set with @ref
-glfwSetWindowPosCallback.
-
-
-@subsubsection news_30_wndpos Window position query
-
-The position of a window can now be retrieved using @ref glfwGetWindowPos.
-
-
-@subsubsection news_30_focusfun Window focus callback
-
-Each windows now has a callback for focus events, which is set with @ref
-glfwSetWindowFocusCallback.
-
-
-@subsubsection news_30_enterleave Cursor enter/leave callback
-
-Each window now has a callback for when the mouse cursor enters or leaves its
-content area, which is set with @ref glfwSetCursorEnterCallback.
-
-
-@subsubsection news_30_wndtitle Initial window title
-
-The title of a window is now specified at creation time, as one of the arguments
-to @ref glfwCreateWindow.
-
-
-@subsubsection news_30_hidden Hidden windows
-
-Windows can now be hidden with @ref glfwHideWindow, shown using @ref
-glfwShowWindow and created initially hidden with the @ref GLFW_VISIBLE window
-hint and attribute.  This allows for off-screen rendering in a way compatible
-with most drivers, as well as moving a window to a specific position before
-showing it.
-
-
-@subsubsection news_30_undecorated Undecorated windows
-
-Windowed mode windows can now be created without decorations, e.g. things like
-a frame, a title bar, with the @ref GLFW_DECORATED window hint and attribute.
-This allows for the creation of things like splash screens.
-
-
-@subsubsection news_30_keymods Modifier key bit masks
-
-[Modifier key bit mask](@ref mods) parameters have been added to the
-[mouse button](@ref GLFWmousebuttonfun) and [key](@ref GLFWkeyfun) callbacks.
-
-
-@subsubsection news_30_scancode Platform-specific scancodes
-
-A scancode parameter has been added to the [key callback](@ref GLFWkeyfun). Keys
-that don't have a [key token](@ref keys) still get passed on with the key
-parameter set to `GLFW_KEY_UNKNOWN`.  These scancodes will vary between machines
-and are intended to be used for key bindings.
-
-
-@subsubsection news_30_jsname Joystick names
-
-The name of a joystick can now be retrieved using @ref glfwGetJoystickName.
-
-
-@subsubsection news_30_doxygen Doxygen documentation
-
-You are reading it.
-
-*/
diff --git a/docs/news.md b/docs/news.md
new file mode 100644
index 0000000..3be9548
--- /dev/null
+++ b/docs/news.md
@@ -0,0 +1,402 @@
+# Release notes for version 3.4 {#news}
+
+[TOC]
+
+
+## New features {#features}
+
+### Runtime platform selection {#runtime_platform_selection}
+
+GLFW now supports being compiled for multiple backends and selecting between
+them at runtime with the @ref GLFW_PLATFORM init hint.  After initialization the
+selected platform can be queried with @ref glfwGetPlatform.  You can check if
+support for a given platform is compiled in with @ref glfwPlatformSupported.
+
+For more information see @ref platform.
+
+
+### More standard cursor shapes {#more_cursor_shapes}
+
+GLFW now provides the standard cursor shapes @ref GLFW_RESIZE_NWSE_CURSOR and
+@ref GLFW_RESIZE_NESW_CURSOR for diagonal resizing, @ref GLFW_RESIZE_ALL_CURSOR
+for omnidirectional resizing and @ref GLFW_NOT_ALLOWED_CURSOR for showing an
+action is not allowed.
+
+Unlike the original set, these shapes may not be available everywhere and
+creation will then fail with the new @ref GLFW_CURSOR_UNAVAILABLE error.
+
+The cursors for horizontal and vertical resizing are now referred to as @ref
+GLFW_RESIZE_EW_CURSOR and @ref GLFW_RESIZE_NS_CURSOR, and the pointing hand
+cursor is now referred to as @ref GLFW_POINTING_HAND_CURSOR.  The older names
+are still available.
+
+For more information see @ref cursor_standard.
+
+
+### Mouse event passthrough {#mouse_input_passthrough}
+
+GLFW now provides the [GLFW_MOUSE_PASSTHROUGH](@ref GLFW_MOUSE_PASSTHROUGH_hint)
+window hint for making a window transparent to mouse input, lettings events pass
+to whatever window is behind it.  This can also be changed after window
+creation with the matching [window attribute](@ref GLFW_MOUSE_PASSTHROUGH_attrib).
+
+
+### Ability to get window title {#window_title_function}
+
+GLFW now supports querying the title of a window with the @ref glfwGetWindowTitle
+function.
+
+For more information see @ref window_title.
+
+
+### Captured cursor mode {#captured_cursor_mode}
+
+GLFW now supports confining the cursor to the window content area with the @ref
+GLFW_CURSOR_CAPTURED cursor mode.
+
+For more information see @ref cursor_mode.
+
+
+### Support for custom heap memory allocator {#custom_heap_allocator}
+
+GLFW now supports plugging a custom heap memory allocator at initialization with
+@ref glfwInitAllocator.  The allocator is a struct of type @ref GLFWallocator
+with function pointers corresponding to the standard library functions `malloc`,
+`realloc` and `free`.
+
+For more information see @ref init_allocator.
+
+
+### Window hint for framebuffer scaling {#scale_framebuffer_hint}
+
+GLFW now allows provides the
+[GLFW_SCALE_FRAMEBUFFER](@ref GLFW_SCALE_FRAMEBUFFER_hint) window hint for
+controlling framebuffer scaling on platforms that handle scaling by keeping the
+window size the same while resizing the framebuffer.  The default value is to
+allow framebuffer scaling.
+
+This was already possible on macOS via the
+[GLFW_COCOA_RETINA_FRAMEBUFFER](@ref GLFW_COCOA_RETINA_FRAMEBUFFER_hint) window
+hint.  This is now another name for the same hint value.
+
+For more information see @ref window_scale.
+
+
+### Window hints for initial window position {#window_position_hint}
+
+GLFW now provides the @ref GLFW_POSITION_X and @ref GLFW_POSITION_Y window hints for
+specifying the initial position of the window.  This removes the need to create a hidden
+window, move it and then show it.  The default value of these hints is
+`GLFW_ANY_POSITION`, which selects the previous behavior.
+
+For more information see @ref window_pos.
+
+
+### ANGLE rendering backend hint {#angle_renderer_hint}
+
+GLFW now provides the
+[GLFW_ANGLE_PLATFORM_TYPE](@ref GLFW_ANGLE_PLATFORM_TYPE_hint) init hint for
+requesting a specific rendering backend when using [ANGLE][] to create OpenGL ES
+contexts.
+
+[ANGLE]: https://chromium.googlesource.com/angle/angle/
+
+
+### Windows window menu keyboard access hint {#win32_keymenu_hint}
+
+GLFW now provides the
+[GLFW_WIN32_KEYBOARD_MENU](@ref GLFW_WIN32_KEYBOARD_MENU_hint) window hint for
+enabling keyboard access to the window menu via the Alt+Space and
+Alt-and-then-Space shortcuts.  This may be useful for more GUI-oriented
+applications.
+
+
+### Windows STARTUPINFO show command hint {#win32_showdefault_hint}
+
+GLFW now provides the [GLFW_WIN32_SHOWDEFAULT](@ref GLFW_WIN32_SHOWDEFAULT_hint) window
+hint for applying the show command in the program's `STARTUPINFO` when showing the window
+for the first time.  This may be useful for the main window of a windowed-mode tool.
+
+
+### Cocoa NSView native access function {#cocoa_nsview_function}
+
+GLFW now provides the @ref glfwGetCocoaView native access function
+for returning the Cocoa NSView.
+
+
+### Wayland libdecor decorations {#wayland_libdecor_decorations}
+
+GLFW now supports improved client-side window decorations via
+[libdecor](https://gitlab.freedesktop.org/libdecor/libdecor).  This provides
+fully featured window decorations on desktop environments like GNOME.
+
+Support for libdecor can be toggled before GLFW is initialized with the
+[GLFW_WAYLAND_LIBDECOR](@ref GLFW_WAYLAND_LIBDECOR_hint) init hint.  It is
+enabled by default.
+
+This feature has also been available in GLFW 3.3 since 3.3.9.
+
+
+### Wayland surface app_id hint {#wayland_app_id_hint}
+
+GLFW now supports specifying the app_id for a Wayland window using the
+[GLFW_WAYLAND_APP_ID](@ref GLFW_WAYLAND_APP_ID_hint) window hint string.
+
+
+### X11 Vulkan window surface hint {#x11_xcb_vulkan_surface}
+
+GLFW now supports disabling the use of `VK_KHR_xcb_surface` over
+`VK_KHR_xlib_surface` where available, with the
+[GLFW_X11_XCB_VULKAN_SURFACE](@ref GLFW_X11_XCB_VULKAN_SURFACE_hint) init hint.
+This affects @ref glfwGetRequiredInstanceExtensions and @ref
+glfwCreateWindowSurface.
+
+
+## Caveats {#caveats}
+
+### Multiple sets of native access functions {#multiplatform_caveat}
+
+Because GLFW now supports runtime selection of platform (window system), a library binary
+may export native access functions for multiple platforms.  Starting with version 3.4 you
+must not assume that GLFW is running on a platform just because it exports native access
+functions for it.  After initialization, you can query the selected platform with @ref
+glfwGetPlatform.
+
+
+### Version string format has been changed {#version_string_caveat}
+
+Because GLFW now supports runtime selection of platform (window system), the version
+string returned by @ref glfwGetVersionString has been expanded.  It now contains the names
+of all APIs for all the platforms that the library binary supports.
+
+The version string is intended for bug reporting and should not be parsed.  See
+@ref glfwGetVersion and @ref glfwPlatformSupported instead.
+
+
+### Joystick support is initialized on demand {#joystick_init_caveat}
+
+The joystick part of GLFW is now initialized when first used, primarily to work
+around faulty Windows drivers that cause DirectInput to take up to several
+seconds to enumerate devices.
+
+This change is mostly not observable.  However, if your application waits for
+events without having first called any joystick function or created any visible
+windows, the wait may never unblock as GLFW may not yet have subscribed to
+joystick related OS events.
+
+To work around this, call any joystick function before waiting for events, for
+example by setting a [joystick callback](@ref joystick_event).
+
+
+### Tests and examples are disabled when built as a subproject {#standalone_caveat}
+
+GLFW now by default does not build the tests or examples when it is added as
+a subdirectory of another CMake project.  If you were setting @ref
+GLFW_BUILD_TESTS or @ref GLFW_BUILD_EXAMPLES to false in your CMake files, you
+can now remove this.
+
+If you do want these to be built, set @ref GLFW_BUILD_TESTS and @ref
+GLFW_BUILD_EXAMPLES in your CMake files before adding the GLFW subdirectory.
+
+```cmake
+set(GLFW_BUILD_EXAMPLES ON CACHE BOOL "" FORCE)
+set(GLFW_BUILD_TESTS ON CACHE BOOL "" FORCE)
+add_subdirectory(path/to/glfw)
+```
+
+
+### Configuration header is no longer generated {#config_header_caveat}
+
+The `glfw_config.h` configuration header is no longer generated by CMake and the
+platform selection macros are now part of the GLFW CMake target.  The
+`_GLFW_USE_CONFIG_H` macro is still supported in case you are generating
+a configuration header in a custom build setup.
+
+
+### Documentation generation requires Doxygen 1.9.8 or later {#docs_target_caveat}
+
+Doxygen 1.9.8 or later is now required for the `docs` CMake target to be
+generated.  This is because the documentation now uses more of the Markdown
+support in Doxygen and this support has until recently been relatively unstable.
+
+
+### Windows 7 framebuffer transparency requires DWM transparency {#win7_framebuffer_caveat}
+
+GLFW no longer supports per-pixel framebuffer transparency via @ref
+GLFW_TRANSPARENT_FRAMEBUFFER on Windows 7 if DWM transparency is off
+(the Transparency setting under Personalization > Window Color).
+
+
+### macOS main menu now created at initialization {#macos_menu_caveat}
+
+GLFW now creates the main menu and completes the initialization of NSApplication
+during initialization.  Programs that do not want a main menu can disable it
+with the [GLFW_COCOA_MENUBAR](@ref GLFW_COCOA_MENUBAR_hint) init hint.
+
+
+### macOS CoreVideo dependency has been removed {#corevideo_caveat}
+
+GLFW no longer depends on the CoreVideo framework on macOS and it no longer
+needs to be specified during compilation or linking.
+
+
+### Wayland framebuffer may lack alpha channel on older systems {#wayland_alpha_caveat}
+
+On Wayland, when creating an EGL context on a machine lacking the new
+`EGL_EXT_present_opaque` extension, the @ref GLFW_ALPHA_BITS window hint will be
+ignored and the framebuffer will not have an alpha channel.  This is because
+some Wayland compositors treat any buffer with an alpha channel as per-pixel
+transparent.
+
+If you want a per-pixel transparent window, see the
+[GLFW_TRANSPARENT_FRAMEBUFFER](@ref GLFW_TRANSPARENT_FRAMEBUFFER_hint) window
+hint.
+
+
+### X11 empty events no longer round-trip to server {#x11_emptyevent_caveat}
+
+Events posted with @ref glfwPostEmptyEvent now use a separate unnamed pipe
+instead of sending an X11 client event to the helper window.
+
+
+## Deprecations {#deprecations}
+
+### Windows XP and Vista support is deprecated {#winxp_deprecated}
+
+Support for Windows XP and Vista has been deprecated and will be removed in
+a future release.  Windows XP has been out of extended support since 2014.
+
+
+### Original MinGW support is deprecated {#mingw_deprecated}
+
+Support for the now unmaintained original MinGW distribution has been deprecated
+and will be removed in a future release.
+
+This does not apply to the much more capable MinGW-w64, which remains fully
+supported, actively maintained and available on many platforms.
+
+
+### OS X Yosemite support is deprecated {#yosemite_deprecated}
+
+Support for OS X 10.10 Yosemite and earlier has been deprecated and will be
+removed in a future release.  OS X 10.10 has been out of support since 2017.
+
+
+## Removals {#removals}
+
+### GLFW_VULKAN_STATIC CMake option has been removed {#vulkan_static_removed}
+
+This option was used to compile GLFW directly linked with the Vulkan loader, instead of
+using dynamic loading to get hold of `vkGetInstanceProcAddr` at initialization.  This is
+now done by calling the @ref glfwInitVulkanLoader function before initialization.
+
+If you need backward compatibility, this macro can still be defined for GLFW 3.4 and will
+have no effect.  The call to @ref glfwInitVulkanLoader can be conditionally enabled in
+your code by checking the @ref GLFW_VERSION_MAJOR and @ref GLFW_VERSION_MINOR macros.
+
+
+### GLFW_USE_WAYLAND CMake option has been removed {#use_wayland_removed}
+
+This option was used to compile GLFW for Wayland instead of X11.  GLFW now
+supports selecting the platform at run-time.  By default GLFW is compiled for
+both Wayland and X11 on Linux and other Unix-like systems.
+
+To disable Wayland or X11 or both, set the @ref GLFW_BUILD_WAYLAND and @ref
+GLFW_BUILD_X11 CMake options.
+
+The `GLFW_USE_WAYLAND` CMake variable must not be present in the CMake cache at
+all, or GLFW will fail to configure.  If you are getting this error, delete the
+CMake cache for GLFW and configure again.
+
+
+### GLFW_USE_OSMESA CMake option has been removed {#use_osmesa_removed}
+
+This option was used to compile GLFW for the Null platform.  The Null platform
+is now always available.  To produce a library binary that only supports this
+platform, the way this CMake option used to do, you will instead need to disable
+the default platforms for the target OS.  This means setting the @ref
+GLFW_BUILD_WIN32, @ref GLFW_BUILD_COCOA or @ref GLFW_BUILD_WAYLAND and @ref
+GLFW_BUILD_X11 CMake options to false.
+
+You can set all of them to false and the ones that don't apply for the target OS
+will be ignored.
+
+
+### wl_shell protocol support has been removed {#wl_shell_removed}
+
+Support for the deprecated wl_shell protocol has been removed and GLFW now only
+supports the XDG-Shell protocol.  If your Wayland compositor does not support
+XDG-Shell then GLFW will fail to initialize.
+
+
+## New symbols {#new_symbols}
+
+### New functions {#new_functions}
+
+ - @ref glfwInitAllocator
+ - @ref glfwGetPlatform
+ - @ref glfwPlatformSupported
+ - @ref glfwInitVulkanLoader
+ - @ref glfwGetWindowTitle
+ - @ref glfwGetCocoaView
+
+
+### New types {#new_types}
+
+ - @ref GLFWallocator
+ - @ref GLFWallocatefun
+ - @ref GLFWreallocatefun
+ - @ref GLFWdeallocatefun
+
+
+### New constants {#new_constants}
+
+ - @ref GLFW_PLATFORM
+ - @ref GLFW_ANY_PLATFORM
+ - @ref GLFW_PLATFORM_WIN32
+ - @ref GLFW_PLATFORM_COCOA
+ - @ref GLFW_PLATFORM_WAYLAND
+ - @ref GLFW_PLATFORM_X11
+ - @ref GLFW_PLATFORM_NULL
+ - @ref GLFW_PLATFORM_UNAVAILABLE
+ - @ref GLFW_POINTING_HAND_CURSOR
+ - @ref GLFW_RESIZE_EW_CURSOR
+ - @ref GLFW_RESIZE_NS_CURSOR
+ - @ref GLFW_RESIZE_NWSE_CURSOR
+ - @ref GLFW_RESIZE_NESW_CURSOR
+ - @ref GLFW_RESIZE_ALL_CURSOR
+ - @ref GLFW_MOUSE_PASSTHROUGH
+ - @ref GLFW_NOT_ALLOWED_CURSOR
+ - @ref GLFW_CURSOR_UNAVAILABLE
+ - @ref GLFW_WIN32_KEYBOARD_MENU
+ - @ref GLFW_WIN32_SHOWDEFAULT
+ - @ref GLFW_CONTEXT_DEBUG
+ - @ref GLFW_FEATURE_UNAVAILABLE
+ - @ref GLFW_FEATURE_UNIMPLEMENTED
+ - @ref GLFW_ANGLE_PLATFORM_TYPE
+ - @ref GLFW_ANGLE_PLATFORM_TYPE_NONE
+ - @ref GLFW_ANGLE_PLATFORM_TYPE_OPENGL
+ - @ref GLFW_ANGLE_PLATFORM_TYPE_OPENGLES
+ - @ref GLFW_ANGLE_PLATFORM_TYPE_D3D9
+ - @ref GLFW_ANGLE_PLATFORM_TYPE_D3D11
+ - @ref GLFW_ANGLE_PLATFORM_TYPE_VULKAN
+ - @ref GLFW_ANGLE_PLATFORM_TYPE_METAL
+ - @ref GLFW_X11_XCB_VULKAN_SURFACE
+ - @ref GLFW_CURSOR_CAPTURED
+ - @ref GLFW_POSITION_X
+ - @ref GLFW_POSITION_Y
+ - @ref GLFW_ANY_POSITION
+ - @ref GLFW_WAYLAND_APP_ID
+ - @ref GLFW_WAYLAND_LIBDECOR
+ - @ref GLFW_WAYLAND_PREFER_LIBDECOR
+ - @ref GLFW_WAYLAND_DISABLE_LIBDECOR
+ - @ref GLFW_SCALE_FRAMEBUFFER
+
+
+## Release notes for earlier versions {#news_archive}
+
+- [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)
+- [Release notes for 3.1](https://www.glfw.org/docs/3.1/news.html)
+- [Release notes for 3.0](https://www.glfw.org/docs/3.0/news.html)
+
diff --git a/docs/quick.dox b/docs/quick.md
similarity index 85%
rename from docs/quick.dox
rename to docs/quick.md
index 2cce29f..6f487fc 100644
--- a/docs/quick.dox
+++ b/docs/quick.md
@@ -1,10 +1,8 @@
-/*!
+# Getting started {#quick_guide}
 
-@page quick_guide Getting started
+[TOC]
 
-@tableofcontents
-
-This guide takes you through writing a simple application using GLFW 3.  The
+This guide takes you through writing a small application using GLFW 3.  The
 application will create a window and OpenGL context, render a rotating triangle
 and exit when the user closes the window or presses _Escape_.  This guide will
 introduce a few of the most commonly used functions, but there are many more.
@@ -14,16 +12,16 @@
 behave differently in GLFW 3.
 
 
-@section quick_steps Step by step
+## Step by step {#quick_steps}
 
-@subsection quick_include Including the GLFW header
+### Including the GLFW header {#quick_include}
 
 In the source files of your application where you use GLFW, you need to include
 its header file.
 
-@code
+```c
 #include <GLFW/glfw3.h>
-@endcode
+```
 
 This header provides all the constants, types and function prototypes of the
 GLFW API.
@@ -38,51 +36,51 @@
 header can detect most such headers if they are included first and will then not
 include the one from your development environment.
 
-@code
+```c
 #include <glad/gl.h>
 #include <GLFW/glfw3.h>
-@endcode
+```
 
 To make sure there will be no header conflicts, you can define @ref
 GLFW_INCLUDE_NONE before the GLFW header to explicitly disable inclusion of the
 development environment header.  This also allows the two headers to be included
 in any order.
 
-@code
+```c
 #define GLFW_INCLUDE_NONE
 #include <GLFW/glfw3.h>
 #include <glad/gl.h>
-@endcode
+```
 
 
-@subsection quick_init_term Initializing and terminating GLFW
+### Initializing and terminating GLFW {#quick_init_term}
 
 Before you can use most GLFW functions, the library must be initialized.  On
 successful initialization, `GLFW_TRUE` is returned.  If an error occurred,
 `GLFW_FALSE` is returned.
 
-@code
+```c
 if (!glfwInit())
 {
     // Initialization failed
 }
-@endcode
+```
 
 Note that `GLFW_TRUE` and `GLFW_FALSE` are and will always be one and zero.
 
 When you are done using GLFW, typically just before the application exits, you
 need to terminate GLFW.
 
-@code
+```c
 glfwTerminate();
-@endcode
+```
 
 This destroys any remaining windows and releases any other resources allocated by
 GLFW.  After this call, you must initialize GLFW again before using any GLFW
 functions that require it.
 
 
-@subsection quick_capture_error Setting an error callback
+### Setting an error callback {#quick_capture_error}
 
 Most events are reported through callbacks, whether it's a key being pressed,
 a GLFW window being moved, or an error occurring.  Callbacks are C functions (or
@@ -92,36 +90,36 @@
 You can receive these reports with an error callback.  This function must have
 the signature below but may do anything permitted in other callbacks.
 
-@code
+```c
 void error_callback(int error, const char* description)
 {
     fprintf(stderr, "Error: %s\n", description);
 }
-@endcode
+```
 
 Callback functions must be set, so GLFW knows to call them.  The function to set
 the error callback is one of the few GLFW functions that may be called before
 initialization, which lets you be notified of errors both during and after
 initialization.
 
-@code
+```c
 glfwSetErrorCallback(error_callback);
-@endcode
+```
 
 
-@subsection quick_create_window Creating a window and context
+### Creating a window and context {#quick_create_window}
 
 The window and its OpenGL context are created with a single call to @ref
 glfwCreateWindow, which returns a handle to the created combined window and
 context object
 
-@code
+```c
 GLFWwindow* window = glfwCreateWindow(640, 480, "My Title", NULL, NULL);
 if (!window)
 {
     // Window or OpenGL context creation failed
 }
-@endcode
+```
 
 This creates a 640 by 480 windowed mode window with an OpenGL context.  If
 window or OpenGL context creation fails, `NULL` will be returned.  You should
@@ -134,33 +132,38 @@
 `GLFW_CONTEXT_VERSION_MINOR` hints _before_ creation.  If the required minimum
 version is not supported on the machine, context (and window) creation fails.
 
-@code
-glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 2);
-glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0);
+You can select the OpenGL profile by setting the `GLFW_OPENGL_PROFILE` hint.
+This program uses the core profile as that is the only profile macOS supports
+for OpenGL 3.x and 4.x.
+
+```c
+glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
+glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
+glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
 GLFWwindow* window = glfwCreateWindow(640, 480, "My Title", NULL, NULL);
 if (!window)
 {
     // Window or context creation failed
 }
-@endcode
+```
 
 When a window and context is no longer needed, destroy it.
 
-@code
+```c
 glfwDestroyWindow(window);
-@endcode
+```
 
 Once this function is called, no more events will be delivered for that window
 and its handle becomes invalid.
 
 
-@subsection quick_context_current Making the OpenGL context current
+### Making the OpenGL context current {#quick_context_current}
 
 Before you can use the OpenGL API, you must have a current OpenGL context.
 
-@code
+```c
 glfwMakeContextCurrent(window);
-@endcode
+```
 
 The context will remain current until you make another context current or until
 the window owning the current context is destroyed.
@@ -171,12 +174,12 @@
 [glad](https://github.com/Dav1dde/glad), but the same rule applies to all such
 libraries.
 
-@code
+```c
 gladLoadGL(glfwGetProcAddress);
-@endcode
+```
 
 
-@subsection quick_window_close Checking the window close flag
+### Checking the window close flag {#quick_window_close}
 
 Each window has a flag indicating whether the window should be closed.
 
@@ -186,12 +189,12 @@
 this flag and either destroy the window or give some kind of feedback to the
 user.
 
-@code
+```c
 while (!glfwWindowShouldClose(window))
 {
     // Keep running
 }
-@endcode
+```
 
 You can be notified when the user is attempting to close the window by setting
 a close callback with @ref glfwSetWindowCloseCallback.  The callback will be
@@ -202,41 +205,41 @@
 for example pressing the _Escape_ key.
 
 
-@subsection quick_key_input Receiving input events
+### Receiving input events {#quick_key_input}
 
 Each window has a large number of callbacks that can be set to receive all the
 various kinds of events.  To receive key press and release events, create a key
 callback function.
 
-@code
+```c
 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);
 }
-@endcode
+```
 
 The key callback, like other window related callbacks, are set per-window.
 
-@code
+```c
 glfwSetKeyCallback(window, key_callback);
-@endcode
+```
 
 In order for event callbacks to be called when events occur, you need to process
 events as described below.
 
 
-@subsection quick_render Rendering with OpenGL
+### Rendering with OpenGL {#quick_render}
 
 Once you have a current OpenGL context, you can use OpenGL normally.  In this
 tutorial, a multicolored rotating triangle will be rendered.  The framebuffer
 size needs to be retrieved for `glViewport`.
 
-@code
+```c
 int width, height;
 glfwGetFramebufferSize(window, &width, &height);
 glViewport(0, 0, width, height);
-@endcode
+```
 
 You can also set a framebuffer size callback using @ref
 glfwSetFramebufferSizeCallback and be notified when the size changes.
@@ -253,19 +256,19 @@
 use to create the window and context.
 
 
-@subsection quick_timer Reading the timer
+### Reading the timer {#quick_timer}
 
 To create smooth animation, a time source is needed.  GLFW provides a timer that
 returns the number of seconds since initialization.  The time source used is the
 most accurate on each platform and generally has micro- or nanosecond
 resolution.
 
-@code
+```c
 double time = glfwGetTime();
-@endcode
+```
 
 
-@subsection quick_swap_buffers Swapping buffers
+### Swapping buffers {#quick_swap_buffers}
 
 GLFW windows by default use double buffering.  That means that each window has
 two rendering buffers; a front buffer and a back buffer.  The front buffer is
@@ -274,9 +277,9 @@
 When the entire frame has been rendered, the buffers need to be swapped with one
 another, so the back buffer becomes the front buffer and vice versa.
 
-@code
+```c
 glfwSwapBuffers(window);
-@endcode
+```
 
 The swap interval indicates how many frames to wait until swapping the buffers,
 commonly known as _vsync_.  By default, the swap interval is zero, meaning
@@ -291,15 +294,15 @@
 one.  It can be set to higher values, but this is usually not recommended,
 because of the input latency it leads to.
 
-@code
+```c
 glfwSwapInterval(1);
-@endcode
+```
 
 This function acts on the current context and will fail unless a context is
 current.
 
 
-@subsection quick_process_events Processing events
+### Processing events {#quick_process_events}
 
 GLFW needs to communicate regularly with the window system both in order to
 receive events and to show that the application hasn't locked up.  Event
@@ -310,9 +313,9 @@
 example will use event polling, which processes only those events that have
 already been received and then returns immediately.
 
-@code
+```c
 glfwPollEvents();
-@endcode
+```
 
 This is the best choice when rendering continually, like most games do.  If
 instead you only need to update your rendering once you have received new input,
@@ -322,22 +325,24 @@
 for example, many kinds of editing tools.
 
 
-@section quick_example Putting it together
+## Putting it together {#quick_example}
 
 Now that you know how to initialize GLFW, create a window and poll for
-keyboard input, it's possible to create a simple program.
+keyboard input, it's possible to create a small program.
 
 This program creates a 640 by 480 windowed mode window and starts a loop that
 clears the screen, renders a triangle and processes events until the user either
 presses _Escape_ or closes the window.
 
-@snippet simple.c code
+@snippet triangle-opengl.c code
 
-The program above can be found in the
-[source package](https://www.glfw.org/download.html) as `examples/simple.c`
-and is compiled along with all other examples when you build GLFW.  If you
-built GLFW from the source package then you already have this as `simple.exe` on
-Windows, `simple` on Linux or `simple.app` on macOS.
+The program above can be found in the [source package][download] as
+`examples/triangle-opengl.c` and is compiled along with all other examples when
+you build GLFW.  If you built GLFW from the source package then you already have
+this as `triangle-opengl.exe` on Windows, `triangle-opengl` on Linux or
+`triangle-opengl.app` on macOS.
+
+[download]: https://www.glfw.org/download.html
 
 This tutorial used only a few of the many functions GLFW provides.  There are
 guides for each of the areas covered by GLFW.  Each guide will introduce all the
@@ -358,4 +363,3 @@
 environment.  To learn about the details that are specific to GLFW, see
 @ref build_guide.
 
-*/
diff --git a/docs/vulkan.dox b/docs/vulkan.md
similarity index 80%
rename from docs/vulkan.dox
rename to docs/vulkan.md
index 7e4a0f0..cb67302 100644
--- a/docs/vulkan.dox
+++ b/docs/vulkan.md
@@ -1,8 +1,6 @@
-/*!
+# Vulkan guide {#vulkan_guide}
 
-@page vulkan_guide Vulkan guide
-
-@tableofcontents
+[TOC]
 
 This guide is intended to fill the gaps between the official [Vulkan
 resources](https://www.khronos.org/vulkan/) and the rest of the GLFW
@@ -29,51 +27,62 @@
  - @ref input_guide
 
 
-@section vulkan_loader Linking against the Vulkan loader
+## Finding the Vulkan loader {#vulkan_loader}
 
-By default, GLFW will look for the Vulkan loader on demand at runtime via its
-standard name (`vulkan-1.dll` on Windows, `libvulkan.so.1` on Linux and other
-Unix-like systems and `libvulkan.1.dylib` on macOS).  This means that GLFW does
-not need to be linked against the loader.  However, it also means that if you
-are using the static library form of the Vulkan loader GLFW will either fail to
-find it or (worse) use the wrong one.
+GLFW itself does not ever need to be linked against the Vulkan loader.
 
-The @ref GLFW_VULKAN_STATIC CMake option makes GLFW call the Vulkan loader
-directly instead of dynamically loading it at runtime.  Not linking against the
-Vulkan loader will then be a compile-time error.
+By default, GLFW will load the Vulkan loader dynamically at runtime via its standard name:
+`vulkan-1.dll` on Windows, `libvulkan.so.1` on Linux and other Unix-like systems and
+`libvulkan.1.dylib` on macOS.
 
-@macos To make your application be redistributable you will need to set up the
-application bundle according to the LunarG SDK documentation.  This is explained
-in more detail in the
+@macos GLFW will also look up and search the `Frameworks` subdirectory of your
+application bundle.
+
+If your code is using a Vulkan loader with a different name or in a non-standard location
+you will need to direct GLFW to it.  Pass your version of `vkGetInstanceProcAddr` to @ref
+glfwInitVulkanLoader before initializing GLFW and it will use that function for all Vulkan
+entry point retrieval.  This prevents GLFW from dynamically loading the Vulkan loader.
+
+```c
+glfwInitVulkanLoader(vkGetInstanceProcAddr);
+```
+
+@macos To make your application be redistributable you will need to set up the application
+bundle according to the LunarG SDK documentation.  This is explained in more detail in the
 [SDK documentation for macOS](https://vulkan.lunarg.com/doc/sdk/latest/mac/getting_started.html).
 
 
-@section vulkan_include Including the Vulkan and GLFW header files
+## Including the Vulkan header file {#vulkan_include}
 
-To include the Vulkan header, define @ref GLFW_INCLUDE_VULKAN before including
+To have GLFW include the Vulkan header, define @ref GLFW_INCLUDE_VULKAN before including
 the GLFW header.
 
-@code
+```c
 #define GLFW_INCLUDE_VULKAN
 #include <GLFW/glfw3.h>
-@endcode
+```
 
 If you instead want to include the Vulkan header from a custom location or use
 your own custom Vulkan header then do this before the GLFW header.
 
-@code
+```c
 #include <path/to/vulkan.h>
 #include <GLFW/glfw3.h>
-@endcode
+```
 
-Unless a Vulkan header is included, either by the GLFW header or above it, any
-GLFW functions that take or return Vulkan types will not be declared.
+Unless a Vulkan header is included, either by the GLFW header or above it, the following
+GLFW functions will not be declared, as depend on Vulkan types.
+
+ - @ref glfwInitVulkanLoader
+ - @ref glfwGetInstanceProcAddress
+ - @ref glfwGetPhysicalDevicePresentationSupport
+ - @ref glfwCreateWindowSurface
 
 The `VK_USE_PLATFORM_*_KHR` macros do not need to be defined for the Vulkan part
 of GLFW to work.  Define them only if you are using these extensions directly.
 
 
-@section vulkan_support Querying for Vulkan support
+## Querying for Vulkan support {#vulkan_support}
 
 If you are linking directly against the Vulkan loader then you can skip this
 section.  The canonical desktop loader library exports all Vulkan core and
@@ -83,12 +92,12 @@
 against it, you can check for the availability of a loader and ICD with @ref
 glfwVulkanSupported.
 
-@code
+```c
 if (glfwVulkanSupported())
 {
     // Vulkan is available, at least for compute
 }
-@endcode
+```
 
 This function returns `GLFW_TRUE` if the Vulkan loader and any minimally
 functional ICD was found.
@@ -97,24 +106,24 @@
 will generate a @ref GLFW_API_UNAVAILABLE error.
 
 
-@subsection vulkan_proc Querying Vulkan function pointers
+### Querying Vulkan function pointers {#vulkan_proc}
 
 To load any Vulkan core or extension function from the found loader, call @ref
 glfwGetInstanceProcAddress.  To load functions needed for instance creation,
 pass `NULL` as the instance.
 
-@code
+```c
 PFN_vkCreateInstance pfnCreateInstance = (PFN_vkCreateInstance)
     glfwGetInstanceProcAddress(NULL, "vkCreateInstance");
-@endcode
+```
 
 Once you have created an instance, you can load from it all other Vulkan core
 functions and functions from any instance extensions you enabled.
 
-@code
+```c
 PFN_vkCreateDevice pfnCreateDevice = (PFN_vkCreateDevice)
     glfwGetInstanceProcAddress(instance, "vkCreateDevice");
-@endcode
+```
 
 This function in turn calls `vkGetInstanceProcAddr`.  If that fails, the
 function falls back to a platform-specific query of the Vulkan loader (i.e.
@@ -126,17 +135,17 @@
 of Vulkan function.  This function can be retrieved from an instance with @ref
 glfwGetInstanceProcAddress.
 
-@code
+```c
 PFN_vkGetDeviceProcAddr pfnGetDeviceProcAddr = (PFN_vkGetDeviceProcAddr)
     glfwGetInstanceProcAddress(instance, "vkGetDeviceProcAddr");
-@endcode
+```
 
 Device-specific functions may execute a little faster, due to not having to
 dispatch internally based on the device passed to them.  For more information
 about `vkGetDeviceProcAddr`, see the Vulkan documentation.
 
 
-@section vulkan_ext Querying required Vulkan extensions
+## Querying required Vulkan extensions {#vulkan_ext}
 
 To do anything useful with Vulkan you need to create an instance.  If you want
 to use Vulkan to render to a window, you must enable the instance extensions
@@ -145,10 +154,10 @@
 To query the instance extensions required, call @ref
 glfwGetRequiredInstanceExtensions.
 
-@code
+```c
 uint32_t count;
 const char** extensions = glfwGetRequiredInstanceExtensions(&count);
-@endcode
+```
 
 These extensions must all be enabled when creating instances that are going to
 be passed to @ref glfwGetPhysicalDevicePresentationSupport and @ref
@@ -163,14 +172,14 @@
 you don't require any additional extensions you can pass this list directly to
 the `VkInstanceCreateInfo` struct.
 
-@code
+```c
 VkInstanceCreateInfo ici;
 
 memset(&ici, 0, sizeof(ici));
 ici.enabledExtensionCount = count;
 ici.ppEnabledExtensionNames = extensions;
 ...
-@endcode
+```
 
 Additional extensions may be required by future versions of GLFW.  You should
 check whether any extensions you wish to enable are already in the returned
@@ -185,52 +194,52 @@
 information, see the Vulkan and MoltenVK documentation.
 
 
-@section vulkan_present Querying for Vulkan presentation support
+## Querying for Vulkan presentation support {#vulkan_present}
 
 Not every queue family of every Vulkan device can present images to surfaces.
 To check whether a specific queue family of a physical device supports image
 presentation without first having to create a window and surface, call @ref
 glfwGetPhysicalDevicePresentationSupport.
 
-@code
+```c
 if (glfwGetPhysicalDevicePresentationSupport(instance, physical_device, queue_family_index))
 {
     // Queue family supports image presentation
 }
-@endcode
+```
 
 The `VK_KHR_surface` extension additionally provides the
 `vkGetPhysicalDeviceSurfaceSupportKHR` function, which performs the same test on
 an existing Vulkan surface.
 
 
-@section vulkan_window Creating the window
+## Creating the window {#vulkan_window}
 
 Unless you will be using OpenGL or OpenGL ES with the same window as Vulkan,
 there is no need to create a context.  You can disable context creation with the
 [GLFW_CLIENT_API](@ref GLFW_CLIENT_API_hint) hint.
 
-@code
+```c
 glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API);
 GLFWwindow* window = glfwCreateWindow(640, 480, "Window Title", NULL, NULL);
-@endcode
+```
 
 See @ref context_less for more information.
 
 
-@section vulkan_surface Creating a Vulkan window surface
+## Creating a Vulkan window surface {#vulkan_surface}
 
 You can create a Vulkan surface (as defined by the `VK_KHR_surface` extension)
 for a GLFW window with @ref glfwCreateWindowSurface.
 
-@code
+```c
 VkSurfaceKHR surface;
 VkResult err = glfwCreateWindowSurface(instance, window, NULL, &surface);
 if (err)
 {
     // Window surface creation failed
 }
-@endcode
+```
 
 If an OpenGL or OpenGL ES context was created on the window, the context has
 ownership of the presentation on the window and a Vulkan surface cannot be
@@ -239,4 +248,3 @@
 It is your responsibility to destroy the surface.  GLFW does not destroy it for
 you.  Call `vkDestroySurfaceKHR` function from the same extension to destroy it.
 
-*/
diff --git a/docs/window.dox b/docs/window.md
similarity index 81%
rename from docs/window.dox
rename to docs/window.md
index a0b4be6..371baa5 100644
--- a/docs/window.dox
+++ b/docs/window.md
@@ -1,8 +1,6 @@
-/*!
+# Window guide {#window_guide}
 
-@page window_guide Window guide
-
-@tableofcontents
+[TOC]
 
 This guide introduces the window related functions of GLFW.  For details on
 a specific function in this category, see the @ref window.  There are also
@@ -15,7 +13,7 @@
  - @ref input_guide
 
 
-@section window_object Window objects
+## Window objects {#window_object}
 
 The @ref GLFWwindow object encapsulates both a window and a context.  They are
 created with @ref glfwCreateWindow and destroyed with @ref glfwDestroyWindow, or
@@ -26,15 +24,15 @@
 the `events` test program.
 
 
-@subsection window_creation Window creation
+### Window creation {#window_creation}
 
 A window and its OpenGL or OpenGL ES context are created with @ref
 glfwCreateWindow, which returns a handle to the created window object.  For
 example, this creates a 640 by 480 windowed mode window:
 
-@code
+```c
 GLFWwindow* window = glfwCreateWindow(640, 480, "My Title", NULL, NULL);
-@endcode
+```
 
 If window creation fails, `NULL` will be returned, so it is necessary to check
 the return value.
@@ -44,15 +42,15 @@
 the event.
 
 
-@subsubsection window_full_screen Full screen windows
+#### Full screen windows {#window_full_screen}
 
 To create a full screen window, you need to specify which monitor the window
 should use.  In most cases, the user's primary monitor is a good choice.
 For more information about retrieving monitors, see @ref monitor_monitors.
 
-@code
+```c
 GLFWwindow* window = glfwCreateWindow(640, 480, "My Title", glfwGetPrimaryMonitor(), NULL);
-@endcode
+```
 
 Full screen windows cover the entire display area of a monitor, have no border
 or decorations.
@@ -93,7 +91,7 @@
 will be switched to windowed mode.  See @ref monitor_event for more information.
 
 
-@subsubsection window_windowed_full_screen "Windowed full screen" windows
+#### "Windowed full screen" windows {#window_windowed_full_screen}
 
 If the closest match for the desired video mode is the current one, the video
 mode will not be changed, making window creation faster and application
@@ -101,7 +99,7 @@
 _borderless full screen_ window and counts as a full screen window.  To create
 such a window, request the current video mode.
 
-@code
+```c
 const GLFWvidmode* mode = glfwGetVideoMode(monitor);
 
 glfwWindowHint(GLFW_RED_BITS, mode->redBits);
@@ -110,28 +108,28 @@
 glfwWindowHint(GLFW_REFRESH_RATE, mode->refreshRate);
 
 GLFWwindow* window = glfwCreateWindow(mode->width, mode->height, "My Title", monitor, NULL);
-@endcode
+```
 
 This also works for windowed mode windows that are made full screen.
 
-@code
+```c
 const GLFWvidmode* mode = glfwGetVideoMode(monitor);
 
 glfwSetWindowMonitor(window, monitor, 0, 0, mode->width, mode->height, mode->refreshRate);
-@endcode
+```
 
 Note that @ref glfwGetVideoMode returns the _current_ video mode of a monitor,
 so if you already have a full screen window on that monitor that you want to
 make windowed full screen, you need to have saved the desktop resolution before.
 
 
-@subsection window_destruction Window destruction
+### Window destruction {#window_destruction}
 
 When a window is no longer needed, destroy it with @ref glfwDestroyWindow.
 
-@code
+```c
 glfwDestroyWindow(window);
-@endcode
+```
 
 Window destruction always succeeds.  Before the actual destruction, all
 callbacks are removed so no further events will be delivered for the window.
@@ -141,7 +139,7 @@
 is restored, but the gamma ramp is left untouched.
 
 
-@subsection window_hints Window creation hints
+### Window creation hints {#window_hints}
 
 There are a number of hints that can be set before the creation of a window and
 context.  Some affect the window itself, others affect the framebuffer or
@@ -160,7 +158,7 @@
 arguments to @ref glfwCreateWindow.
 
 
-@subsubsection window_hints_hard Hard and soft constraints
+#### Hard and soft constraints {#window_hints_hard}
 
 Some window hints are hard constraints.  These must match the available
 capabilities _exactly_ for window and context creation to succeed.  Hints
@@ -179,7 +177,7 @@
 - [GLFW_OPENGL_PROFILE](@ref GLFW_OPENGL_PROFILE_hint)
 
 
-@subsubsection window_hints_wnd Window related hints
+#### Window related hints {#window_hints_wnd}
 
 @anchor GLFW_RESIZABLE_hint
 __GLFW_RESIZABLE__ specifies whether the windowed mode window will be resizable
@@ -241,16 +239,46 @@
 
 @anchor GLFW_SCALE_TO_MONITOR
 __GLFW_SCALE_TO_MONITOR__ specified whether the window content area should be
-resized based on the [monitor content scale](@ref monitor_scale) of any monitor
-it is placed on.  This includes the initial placement when the window is
-created.  Possible values are `GLFW_TRUE` and `GLFW_FALSE`.
+resized based on [content scale](@ref window_scale) changes.  This can be
+because of a global user settings change or because the window was moved to
+a monitor with different scale settings.
 
 This hint only has an effect on platforms where screen coordinates and pixels
-always map 1:1 such as Windows and X11.  On platforms like macOS the resolution
-of the framebuffer is changed independently of the window size.
+always map 1:1, such as Windows and X11.  On platforms like macOS the resolution
+of the framebuffer can change independently of the window size.
+
+@anchor GLFW_SCALE_FRAMEBUFFER_hint
+@anchor GLFW_COCOA_RETINA_FRAMEBUFFER_hint
+__GLFW_SCALE_FRAMEBUFFER__ specifies whether the framebuffer should be resized
+based on [content scale](@ref window_scale) changes.  This can be
+because of a global user settings change or because the window was moved to
+a monitor with different scale settings.
+
+This hint only has an effect on platforms where screen coordinates can be scaled
+relative to pixel coordinates, such as macOS and Wayland.  On platforms like
+Windows and X11 the framebuffer and window content area sizes always map 1:1.
+
+This is the new name, introduced in GLFW 3.4.  The older
+`GLFW_COCOA_RETINA_FRAMEBUFFER` name is also available for compatibility.  Both
+names modify the same hint value.
+
+@anchor GLFW_MOUSE_PASSTHROUGH_hint
+__GLFW_MOUSE_PASSTHROUGH__ specifies whether the window is transparent to mouse
+input, letting any mouse events pass through to whatever window is behind it.
+This is only supported for undecorated windows.  Decorated windows with this
+enabled will behave differently between platforms.  Possible values are
+`GLFW_TRUE` and `GLFW_FALSE`.
+
+@anchor GLFW_POSITION_X
+@anchor GLFW_POSITION_Y
+__GLFW_POSITION_X__ and __GLFW_POSITION_Y__ specify the desired initial position
+of the window.  The window manager may modify or ignore these coordinates.  If
+either or both of these hints are set to `GLFW_ANY_POSITION` then the window
+manager will position the window where it thinks the user will prefer it.
+Possible values are any valid screen coordinates and `GLFW_ANY_POSITION`.
 
 
-@subsubsection window_hints_fb Framebuffer related hints
+#### Framebuffer related hints {#window_hints_fb}
 
 @anchor GLFW_RED_BITS
 @anchor GLFW_GREEN_BITS
@@ -303,12 +331,13 @@
 always have sRGB rendering enabled.
 
 @anchor GLFW_DOUBLEBUFFER
+@anchor GLFW_DOUBLEBUFFER_hint
 __GLFW_DOUBLEBUFFER__ specifies whether the framebuffer should be double
 buffered.  You nearly always want to use double buffering.  This is a hard
 constraint.  Possible values are `GLFW_TRUE` and `GLFW_FALSE`.
 
 
-@subsubsection window_hints_mtr Monitor related hints
+#### Monitor related hints {#window_hints_mtr}
 
 @anchor GLFW_REFRESH_RATE
 __GLFW_REFRESH_RATE__ specifies the desired refresh rate for full screen
@@ -316,7 +345,7 @@
 will be used.  This hint is ignored for windowed mode windows.
 
 
-@subsubsection window_hints_ctx Context related hints
+#### Context related hints {#window_hints_ctx}
 
 @anchor GLFW_CLIENT_API_hint
 __GLFW_CLIENT_API__ specifies which client API to create the context for.
@@ -371,12 +400,10 @@
 requested, and vice versa.  This is because OpenGL ES 3.x is backward compatible
 with 2.0, but OpenGL ES 2.0 is not backward compatible with 1.x.
 
-@note @macos The OS only supports forward-compatible core profile contexts for
-OpenGL versions 3.2 and later.  Before creating an OpenGL context of version
-3.2 or later you must set the
-[GLFW_OPENGL_FORWARD_COMPAT](@ref GLFW_OPENGL_FORWARD_COMPAT_hint) and
-[GLFW_OPENGL_PROFILE](@ref GLFW_OPENGL_PROFILE_hint) hints accordingly.  OpenGL
-3.0 and 3.1 contexts are not supported at all on macOS.
+@note @macos The OS only supports core profile contexts for OpenGL versions 3.2
+and later.  Before creating an OpenGL context of version 3.2 or later you must
+set the [GLFW_OPENGL_PROFILE](@ref GLFW_OPENGL_PROFILE_hint) hint accordingly.
+OpenGL 3.0 and 3.1 contexts are not supported at all on macOS.
 
 @anchor GLFW_OPENGL_FORWARD_COMPAT_hint
 __GLFW_OPENGL_FORWARD_COMPAT__ specifies whether the OpenGL context should be
@@ -387,14 +414,19 @@
 Forward-compatibility is described in detail in the
 [OpenGL Reference Manual](https://www.opengl.org/registry/).
 
+@anchor GLFW_CONTEXT_DEBUG_hint
 @anchor GLFW_OPENGL_DEBUG_CONTEXT_hint
-__GLFW_OPENGL_DEBUG_CONTEXT__ specifies whether the context should be created
-in debug mode, which may provide additional error and diagnostic reporting
-functionality.  Possible values are `GLFW_TRUE` and `GLFW_FALSE`.
+__GLFW_CONTEXT_DEBUG__ specifies whether the context should be created in debug
+mode, which may provide additional error and diagnostic reporting functionality.
+Possible values are `GLFW_TRUE` and `GLFW_FALSE`.
 
 Debug contexts for OpenGL and OpenGL ES are described in detail by the
-[GL_KHR_debug](https://www.khronos.org/registry/OpenGL/extensions/KHR/KHR_debug.txt)
-extension.
+[GL_KHR_debug][] extension.
+
+[GL_KHR_debug]: https://www.khronos.org/registry/OpenGL/extensions/KHR/KHR_debug.txt
+
+@note `GLFW_CONTEXT_DEBUG` is the new name introduced in GLFW 3.4.  The older
+`GLFW_OPENGL_DEBUG_CONTEXT` name is also available for compatibility.
 
 @anchor GLFW_OPENGL_PROFILE_hint
 __GLFW_OPENGL_PROFILE__ specifies which OpenGL profile to create the context
@@ -424,8 +456,9 @@
 not be flushed on release.
 
 Context release behaviors are described in detail by the
-[GL_KHR_context_flush_control](https://www.opengl.org/registry/specs/KHR/context_flush_control.txt)
-extension.
+[GL_KHR_context_flush_control][] extension.
+
+[GL_KHR_context_flush_control]: https://www.opengl.org/registry/specs/KHR/context_flush_control.txt
 
 @anchor GLFW_CONTEXT_NO_ERROR_hint
 __GLFW_CONTEXT_NO_ERROR__ specifies whether errors should be generated by the
@@ -433,16 +466,28 @@
 situations that would have generated errors instead cause undefined behavior.
 
 The no error mode for OpenGL and OpenGL ES is described in detail by the
-[GL_KHR_no_error](https://www.opengl.org/registry/specs/KHR/no_error.txt)
-extension.
+[GL_KHR_no_error][] extension.
+
+[GL_KHR_no_error]: https://www.opengl.org/registry/specs/KHR/no_error.txt
 
 
-@subsubsection window_hints_osx macOS specific window hints
+#### Win32 specific hints {#window_hints_win32}
 
-@anchor GLFW_COCOA_RETINA_FRAMEBUFFER_hint
-__GLFW_COCOA_RETINA_FRAMEBUFFER__ specifies whether to use full resolution
-framebuffers on Retina displays.  Possible values are `GLFW_TRUE` and
-`GLFW_FALSE`.  This is ignored on other platforms.
+@anchor GLFW_WIN32_KEYBOARD_MENU_hint
+__GLFW_WIN32_KEYBOARD_MENU__ specifies whether to allow access to the window
+menu via the Alt+Space and Alt-and-then-Space keyboard shortcuts.  This is
+ignored on other platforms.
+
+@anchor GLFW_WIN32_SHOWDEFAULT_hint
+__GLFW_WIN32_SHOWDEFAULT__ specifies whether to show the window the way
+specified in the program's `STARTUPINFO` when it is shown for the first time.
+This is the same information as the `Run` option in the shortcut properties
+window.  If this information was not specified when the program was started,
+GLFW behaves as if this hint was set to `GLFW_FALSE`.  Possible values are
+`GLFW_TRUE` and `GLFW_FALSE`.  This is ignored on other platforms.
+
+
+#### macOS specific hints {#window_hints_osx}
 
 @anchor GLFW_COCOA_FRAME_NAME_hint
 __GLFW_COCOA_FRAME_NAME__ specifies the UTF-8 encoded name to use for autosaving
@@ -466,7 +511,15 @@
 `NSSupportsAutomaticGraphicsSwitching` key to `true`.
 
 
-@subsubsection window_hints_x11 X11 specific window hints
+#### Wayland specific window hints {#window_hints_wayland}
+
+@anchor GLFW_WAYLAND_APP_ID_hint
+__GLFW_WAYLAND_APP_ID__ specifies the Wayland app_id for a window, used
+by window managers to identify types of windows. This is set with
+@ref glfwWindowHintString.
+
+
+#### X11 specific window hints {#window_hints_x11}
 
 @anchor GLFW_X11_CLASS_NAME_hint
 @anchor GLFW_X11_INSTANCE_NAME_hint
@@ -476,7 +529,7 @@
 These are set with @ref glfwWindowHintString.
 
 
-@subsubsection window_hints_values Supported and default values
+#### Supported and default values {#window_hints_values}
 
 Window hint                   | Default value               | Supported values
 ----------------------------- | --------------------------- | ----------------
@@ -491,6 +544,10 @@
 GLFW_TRANSPARENT_FRAMEBUFFER  | `GLFW_FALSE`                | `GLFW_TRUE` or `GLFW_FALSE`
 GLFW_FOCUS_ON_SHOW            | `GLFW_TRUE`                 | `GLFW_TRUE` or `GLFW_FALSE`
 GLFW_SCALE_TO_MONITOR         | `GLFW_FALSE`                | `GLFW_TRUE` or `GLFW_FALSE`
+GLFW_SCALE_FRAMEBUFFER        | `GLFW_TRUE`                 | `GLFW_TRUE` or `GLFW_FALSE`
+GLFW_MOUSE_PASSTHROUGH        | `GLFW_FALSE`                | `GLFW_TRUE` or `GLFW_FALSE`
+GLFW_POSITION_X               | `GLFW_ANY_POSITION`         | Any valid screen x-coordinate or `GLFW_ANY_POSITION`
+GLFW_POSITION_Y               | `GLFW_ANY_POSITION`         | Any valid screen y-coordinate or `GLFW_ANY_POSITION`
 GLFW_RED_BITS                 | 8                           | 0 to `INT_MAX` or `GLFW_DONT_CARE`
 GLFW_GREEN_BITS               | 8                           | 0 to `INT_MAX` or `GLFW_DONT_CARE`
 GLFW_BLUE_BITS                | 8                           | 0 to `INT_MAX` or `GLFW_DONT_CARE`
@@ -514,23 +571,25 @@
 GLFW_CONTEXT_ROBUSTNESS       | `GLFW_NO_ROBUSTNESS`        | `GLFW_NO_ROBUSTNESS`, `GLFW_NO_RESET_NOTIFICATION` or `GLFW_LOSE_CONTEXT_ON_RESET`
 GLFW_CONTEXT_RELEASE_BEHAVIOR | `GLFW_ANY_RELEASE_BEHAVIOR` | `GLFW_ANY_RELEASE_BEHAVIOR`, `GLFW_RELEASE_BEHAVIOR_FLUSH` or `GLFW_RELEASE_BEHAVIOR_NONE`
 GLFW_OPENGL_FORWARD_COMPAT    | `GLFW_FALSE`                | `GLFW_TRUE` or `GLFW_FALSE`
-GLFW_OPENGL_DEBUG_CONTEXT     | `GLFW_FALSE`                | `GLFW_TRUE` or `GLFW_FALSE`
+GLFW_CONTEXT_DEBUG            | `GLFW_FALSE`                | `GLFW_TRUE` or `GLFW_FALSE`
 GLFW_OPENGL_PROFILE           | `GLFW_OPENGL_ANY_PROFILE`   | `GLFW_OPENGL_ANY_PROFILE`, `GLFW_OPENGL_COMPAT_PROFILE` or `GLFW_OPENGL_CORE_PROFILE`
-GLFW_COCOA_RETINA_FRAMEBUFFER | `GLFW_TRUE`                 | `GLFW_TRUE` or `GLFW_FALSE`
+GLFW_WIN32_KEYBOARD_MENU      | `GLFW_FALSE`                | `GLFW_TRUE` or `GLFW_FALSE`
+GLFW_WIN32_SHOWDEFAULT        | `GLFW_FALSE`                | `GLFW_TRUE` or `GLFW_FALSE`
 GLFW_COCOA_FRAME_NAME         | `""`                        | A UTF-8 encoded frame autosave name
 GLFW_COCOA_GRAPHICS_SWITCHING | `GLFW_FALSE`                | `GLFW_TRUE` or `GLFW_FALSE`
+GLFW_WAYLAND_APP_ID           | `""`                        | An ASCII encoded Wayland `app_id` name
 GLFW_X11_CLASS_NAME           | `""`                        | An ASCII encoded `WM_CLASS` class name
 GLFW_X11_INSTANCE_NAME        | `""`                        | An ASCII encoded `WM_CLASS` instance name
 
 
-@section window_events Window event processing
+## Window event processing {#window_events}
 
 See @ref events.
 
 
-@section window_properties Window properties and events
+## Window properties and events {#window_properties}
 
-@subsection window_userptr User pointer
+### User pointer {#window_userptr}
 
 Each window has a user pointer that can be set with @ref
 glfwSetWindowUserPointer and queried with @ref glfwGetWindowUserPointer.  This
@@ -540,7 +599,7 @@
 The initial value of the pointer is `NULL`.
 
 
-@subsection window_close Window closing and close flag
+### Window closing and close flag {#window_close}
 
 When the user attempts to close the window, for example by clicking the close
 widget or using a key chord like Alt+F4, the _close flag_ of the window is set.
@@ -551,7 +610,7 @@
 and can be set or cleared directly with @ref glfwSetWindowShouldClose.  A common
 pattern is to use the close flag as a main loop condition.
 
-@code
+```c
 while (!glfwWindowShouldClose(window))
 {
     render(window);
@@ -559,38 +618,38 @@
     glfwSwapBuffers(window);
     glfwPollEvents();
 }
-@endcode
+```
 
 If you wish to be notified when the user attempts to close a window, set a close
 callback.
 
-@code
+```c
 glfwSetWindowCloseCallback(window, window_close_callback);
-@endcode
+```
 
 The callback function is called directly _after_ the close flag has been set.
 It can be used for example to filter close requests and clear the close flag
 again unless certain conditions are met.
 
-@code
+```c
 void window_close_callback(GLFWwindow* window)
 {
     if (!time_to_close)
         glfwSetWindowShouldClose(window, GLFW_FALSE);
 }
-@endcode
+```
 
 
-@subsection window_size Window size
+### Window size {#window_size}
 
 The size of a window can be changed with @ref glfwSetWindowSize.  For windowed
 mode windows, this sets the size, in
 [screen coordinates](@ref coordinate_systems) of the _content area_ or _content
 area_ of the window.  The window system may impose limits on window size.
 
-@code
+```c
 glfwSetWindowSize(window, 640, 480);
-@endcode
+```
 
 For full screen windows, the specified size becomes the new resolution of the
 window's desired video mode.  The video mode most closely matching the new
@@ -600,26 +659,26 @@
 If you wish to be notified when a window is resized, whether by the user, the
 system or your own code, set a size callback.
 
-@code
+```c
 glfwSetWindowSizeCallback(window, window_size_callback);
-@endcode
+```
 
 The callback function receives the new size, in screen coordinates, of the
 content area of the window when the window is resized.
 
-@code
+```c
 void window_size_callback(GLFWwindow* window, int width, int height)
 {
 }
-@endcode
+```
 
 There is also @ref glfwGetWindowSize for directly retrieving the current size of
 a window.
 
-@code
+```c
 int width, height;
 glfwGetWindowSize(window, &width, &height);
-@endcode
+```
 
 @note Do not pass the window size to `glViewport` or other pixel-based OpenGL
 calls.  The window size is in screen coordinates, not pixels.  Use the
@@ -630,17 +689,17 @@
 windows typically have title bars and window frames around this rectangle.  You
 can retrieve the extents of these with @ref glfwGetWindowFrameSize.
 
-@code
+```c
 int left, top, right, bottom;
 glfwGetWindowFrameSize(window, &left, &top, &right, &bottom);
-@endcode
+```
 
 The returned values are the distances, in screen coordinates, from the edges of
 the content area to the corresponding edges of the full window.  As they are
 distances and not coordinates, they are always zero or positive.
 
 
-@subsection window_fbsize Framebuffer size
+### Framebuffer size {#window_fbsize}
 
 While the size of a window is measured in screen coordinates, OpenGL works with
 pixels.  The size you pass into `glViewport`, for example, should be in pixels.
@@ -651,70 +710,75 @@
 If you wish to be notified when the framebuffer of a window is resized, whether
 by the user or the system, set a size callback.
 
-@code
+```c
 glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);
-@endcode
+```
 
 The callback function receives the new size of the framebuffer when it is
 resized, which can for example be used to update the OpenGL viewport.
 
-@code
+```c
 void framebuffer_size_callback(GLFWwindow* window, int width, int height)
 {
     glViewport(0, 0, width, height);
 }
-@endcode
+```
 
 There is also @ref glfwGetFramebufferSize for directly retrieving the current
 size of the framebuffer of a window.
 
-@code
+```c
 int width, height;
 glfwGetFramebufferSize(window, &width, &height);
 glViewport(0, 0, width, height);
-@endcode
+```
 
 The size of a framebuffer may change independently of the size of a window, for
 example if the window is dragged between a regular monitor and a high-DPI one.
 
 
-@subsection window_scale Window content scale
+### Window content scale {#window_scale}
 
 The content scale for a window can be retrieved with @ref
 glfwGetWindowContentScale.
 
-@code
+```c
 float xscale, yscale;
 glfwGetWindowContentScale(window, &xscale, &yscale);
-@endcode
+```
 
-The content scale is the ratio between the current DPI and the platform's
-default DPI.  This is especially important for text and any UI elements.  If the
-pixel dimensions of your UI scaled by this look appropriate on your machine then
-it should appear at a reasonable size on other machines regardless of their DPI
-and scaling settings.  This relies on the system DPI and scaling settings being
-somewhat correct.
+The content scale can be thought of as the ratio between the current DPI and the
+platform's default DPI.  It is intended to be a scaling factor to apply to the
+pixel dimensions of text and other UI elements.  If the dimensions scaled by
+this factor looks appropriate on your machine then it should appear at
+a reasonable size on other machines with different DPI and scaling settings.
+
+This relies on the DPI and scaling settings on both machines being appropriate.
+
+The content scale may depend on both the monitor resolution and pixel density
+and on user settings like DPI or a scaling percentage.  It may be very different
+from the raw DPI calculated from the physical size and current resolution.
 
 On systems where each monitors can have its own content scale, the window
-content scale will depend on which monitor the system considers the window to be
-on.
+content scale will depend on which monitor or monitors the system considers the
+window to be "on".
 
 If you wish to be notified when the content scale of a window changes, whether
 because of a system setting change or because it was moved to a monitor with
 a different scale, set a content scale callback.
 
-@code
+```c
 glfwSetWindowContentScaleCallback(window, window_content_scale_callback);
-@endcode
+```
 
 The callback function receives the new content scale of the window.
 
-@code
+```c
 void window_content_scale_callback(GLFWwindow* window, float xscale, float yscale)
 {
     set_interface_scale(xscale, yscale);
 }
-@endcode
+```
 
 On platforms where pixels and screen coordinates always map 1:1, the window
 will need to be resized to appear the same size when it is moved to a monitor
@@ -722,24 +786,36 @@
 window is created and when its content scale later changes, set the @ref
 GLFW_SCALE_TO_MONITOR window hint.
 
+On platforms where pixels do not necessarily equal screen coordinates, the
+framebuffer will instead need to be sized to provide a full resolution image
+for the window.  When the window moves between monitors with different content
+scales, the window size will remain the same but the framebuffer size will
+change.  This is done automatically by default.  To disable this resizing, set
+the @ref GLFW_SCALE_FRAMEBUFFER window hint.
 
-@subsection window_sizelimits Window size limits
+Both of these hints also apply when the window is created.  Every window starts
+out with a content scale of one.  A window with one or both of these hints set
+will adapt to the appropriate scale in the process of being created, set up and
+shown.
+
+
+### Window size limits {#window_sizelimits}
 
 The minimum and maximum size of the content area of a windowed mode window can
 be enforced with @ref glfwSetWindowSizeLimits.  The user may resize the window
 to any size and aspect ratio within the specified limits, unless the aspect
 ratio is also set.
 
-@code
+```c
 glfwSetWindowSizeLimits(window, 200, 200, 400, 400);
-@endcode
+```
 
 To specify only a minimum size or only a maximum one, set the other pair to
 `GLFW_DONT_CARE`.
 
-@code
+```c
 glfwSetWindowSizeLimits(window, 640, 480, GLFW_DONT_CARE, GLFW_DONT_CARE);
-@endcode
+```
 
 To disable size limits for a window, set them all to `GLFW_DONT_CARE`.
 
@@ -748,19 +824,19 @@
 unless size limits are also set, but the size will be constrained to maintain
 the aspect ratio.
 
-@code
+```c
 glfwSetWindowAspectRatio(window, 16, 9);
-@endcode
+```
 
 The aspect ratio is specified as a numerator and denominator, corresponding to
 the width and height, respectively.  If you want a window to maintain its
 current aspect ratio, use its current size as the ratio.
 
-@code
+```c
 int width, height;
 glfwGetWindowSize(window, &width, &height);
 glfwSetWindowAspectRatio(window, width, height);
-@endcode
+```
 
 To disable the aspect ratio limit for a window, set both terms to
 `GLFW_DONT_CARE`.
@@ -769,51 +845,64 @@
 are undefined if they conflict.
 
 
-@subsection window_pos Window position
+### Window position {#window_pos}
 
-The position of a windowed-mode window can be changed with @ref
+By default, the window manager chooses the position of new windowed mode
+windows, based on its size and which monitor the user appears to be working on.
+This is most often the right choice.  If you need to create a window at
+a specific position, you can set the desired position with the @ref
+GLFW_POSITION_X and @ref GLFW_POSITION_Y window hints.
+
+```c
+glfwWindowHint(GLFW_POSITION_X, 70);
+glfwWindowHint(GLFW_POSITION_Y, 83);
+```
+
+To restore the previous behavior, set these hints to `GLFW_ANY_POSITION`.
+
+The position of a windowed mode window can be changed with @ref
 glfwSetWindowPos.  This moves the window so that the upper-left corner of its
 content area has the specified [screen coordinates](@ref coordinate_systems).
 The window system may put limitations on window placement.
 
-@code
+```c
 glfwSetWindowPos(window, 100, 100);
-@endcode
+```
 
 If you wish to be notified when a window is moved, whether by the user, the
 system or your own code, set a position callback.
 
-@code
+```c
 glfwSetWindowPosCallback(window, window_pos_callback);
-@endcode
+```
 
 The callback function receives the new position, in screen coordinates, of the
 upper-left corner of the content area when the window is moved.
 
-@code
+```c
 void window_pos_callback(GLFWwindow* window, int xpos, int ypos)
 {
 }
-@endcode
+```
 
 There is also @ref glfwGetWindowPos for directly retrieving the current position
 of the content area of the window.
 
-@code
+```c
 int xpos, ypos;
 glfwGetWindowPos(window, &xpos, &ypos);
-@endcode
+```
 
 
-@subsection window_title Window title
+### Window title {#window_title}
 
 All GLFW windows have a title, although undecorated or full screen windows may
 not display it or only display it in a task bar or similar interface.  You can
-set a UTF-8 encoded window title with @ref glfwSetWindowTitle.
+set a new UTF-8 encoded window title with @ref glfwSetWindowTitle.
 
-@code
+```c
 glfwSetWindowTitle(window, "My Window");
-@endcode
+```
 
 The specified string is copied before the function returns, so there is no need
 to keep it around.
@@ -821,29 +910,34 @@
 As long as your source file is encoded as UTF-8, you can use any Unicode
 characters directly in the source.
 
-@code
+```c
 glfwSetWindowTitle(window, "ラストエグザイル");
-@endcode
+```
 
 If you are using C++11 or C11, you can use a UTF-8 string literal.
 
-@code
+```c
 glfwSetWindowTitle(window, u8"This is always a UTF-8 string");
-@endcode
+```
 
+The current window title can be queried with @ref glfwGetWindowTitle.
 
-@subsection window_icon Window icon
+```c
+const char* title = glfwGetWindowTitle(window);
+```
+
+### Window icon {#window_icon}
 
 Decorated windows have icons on some platforms.  You can set this icon by
 specifying a list of candidate images with @ref glfwSetWindowIcon.
 
-@code
+```c
 GLFWimage images[2];
 images[0] = load_icon("my_icon.png");
 images[1] = load_icon("my_icon_small.png");
 
 glfwSetWindowIcon(window, 2, images);
-@endcode
+```
 
 The image data is 32-bit, little-endian, non-premultiplied RGBA, i.e. eight bits
 per channel with the red channel first.  The pixels are arranged canonically as
@@ -851,19 +945,19 @@
 
 To revert to the default window icon, pass in an empty image array.
 
-@code
+```c
 glfwSetWindowIcon(window, 0, NULL);
-@endcode
+```
 
 
-@subsection window_monitor Window monitor
+### Window monitor {#window_monitor}
 
 Full screen windows are associated with a specific monitor.  You can get the
 handle for this monitor with @ref glfwGetWindowMonitor.
 
-@code
+```c
 GLFWmonitor* monitor = glfwGetWindowMonitor(window);
-@endcode
+```
 
 This monitor handle is one of those returned by @ref glfwGetMonitors.
 
@@ -875,18 +969,18 @@
 on a different monitor, specify the desired monitor, resolution and refresh
 rate.  The position arguments are ignored.
 
-@code
+```c
 const GLFWvidmode* mode = glfwGetVideoMode(monitor);
 
 glfwSetWindowMonitor(window, monitor, 0, 0, mode->width, mode->height, mode->refreshRate);
-@endcode
+```
 
 When making the window windowed, specify the desired position and size.  The
 refresh rate argument is ignored.
 
-@code
+```c
 glfwSetWindowMonitor(window, NULL, xpos, ypos, width, height, 0);
-@endcode
+```
 
 This restores any previous window settings such as whether it is decorated,
 floating, resizable, has size or aspect ratio limits, etc..  To restore a window
@@ -894,13 +988,13 @@
 before making it full screen and then pass them in as above.
 
 
-@subsection window_iconify Window iconification
+### Window iconification {#window_iconify}
 
 Windows can be iconified (i.e. minimized) with @ref glfwIconifyWindow.
 
-@code
+```c
 glfwIconifyWindow(window);
-@endcode
+```
 
 When a full screen window is iconified, the original video mode of its monitor
 is restored until the user or application restores the window.
@@ -908,9 +1002,9 @@
 Iconified windows can be restored with @ref glfwRestoreWindow.  This function
 also restores windows from maximization.
 
-@code
+```c
 glfwRestoreWindow(window);
-@endcode
+```
 
 When a full screen window is restored, the desired video mode is restored to its
 monitor as well.
@@ -918,13 +1012,13 @@
 If you wish to be notified when a window is iconified or restored, whether by
 the user, system or your own code, set an iconify callback.
 
-@code
+```c
 glfwSetWindowIconifyCallback(window, window_iconify_callback);
-@endcode
+```
 
 The callback function receives changes in the iconification state of the window.
 
-@code
+```c
 void window_iconify_callback(GLFWwindow* window, int iconified)
 {
     if (iconified)
@@ -936,22 +1030,22 @@
         // The window was restored
     }
 }
-@endcode
+```
 
 You can also get the current iconification state with @ref glfwGetWindowAttrib.
 
-@code
+```c
 int iconified = glfwGetWindowAttrib(window, GLFW_ICONIFIED);
-@endcode
+```
 
 
-@subsection window_maximize Window maximization
+### Window maximization {#window_maximize}
 
 Windows can be maximized (i.e. zoomed) with @ref glfwMaximizeWindow.
 
-@code
+```c
 glfwMaximizeWindow(window);
-@endcode
+```
 
 Full screen windows cannot be maximized and passing a full screen window to this
 function does nothing.
@@ -959,20 +1053,20 @@
 Maximized windows can be restored with @ref glfwRestoreWindow.  This function
 also restores windows from iconification.
 
-@code
+```c
 glfwRestoreWindow(window);
-@endcode
+```
 
 If you wish to be notified when a window is maximized or restored, whether by
 the user, system or your own code, set a maximize callback.
 
-@code
+```c
 glfwSetWindowMaximizeCallback(window, window_maximize_callback);
-@endcode
+```
 
 The callback function receives changes in the maximization state of the window.
 
-@code
+```c
 void window_maximize_callback(GLFWwindow* window, int maximized)
 {
     if (maximized)
@@ -984,30 +1078,30 @@
         // The window was restored
     }
 }
-@endcode
+```
 
 You can also get the current maximization state with @ref glfwGetWindowAttrib.
 
-@code
+```c
 int maximized = glfwGetWindowAttrib(window, GLFW_MAXIMIZED);
-@endcode
+```
 
 By default, newly created windows are not maximized.  You can change this
 behavior by setting the [GLFW_MAXIMIZED](@ref GLFW_MAXIMIZED_hint) window hint
 before creating the window.
 
-@code
+```c
 glfwWindowHint(GLFW_MAXIMIZED, GLFW_TRUE);
-@endcode
+```
 
 
-@subsection window_hide Window visibility
+### Window visibility {#window_hide}
 
 Windowed mode windows can be hidden with @ref glfwHideWindow.
 
-@code
+```c
 glfwHideWindow(window);
-@endcode
+```
 
 This makes the window completely invisible to the user, including removing it
 from the task bar, dock or window list.  Full screen windows cannot be hidden
@@ -1015,9 +1109,9 @@
 
 Hidden windows can be shown with @ref glfwShowWindow.
 
-@code
+```c
 glfwShowWindow(window);
-@endcode
+```
 
 By default, this function will also set the input focus to that window. Set
 the [GLFW_FOCUS_ON_SHOW](@ref GLFW_FOCUS_ON_SHOW_hint) window hint to change
@@ -1026,31 +1120,31 @@
 
 You can also get the current visibility state with @ref glfwGetWindowAttrib.
 
-@code
+```c
 int visible = glfwGetWindowAttrib(window, GLFW_VISIBLE);
-@endcode
+```
 
 By default, newly created windows are visible.  You can change this behavior by
 setting the [GLFW_VISIBLE](@ref GLFW_VISIBLE_hint) window hint before creating
 the window.
 
-@code
+```c
 glfwWindowHint(GLFW_VISIBLE, GLFW_FALSE);
-@endcode
+```
 
 Windows created hidden are completely invisible to the user until shown.  This
 can be useful if you need to set up your window further before showing it, for
 example moving it to a specific location.
 
 
-@subsection window_focus Window input focus
+### Window input focus {#window_focus}
 
 Windows can be given input focus and brought to the front with @ref
 glfwFocusWindow.
 
-@code
+```c
 glfwFocusWindow(window);
-@endcode
+```
 
 Keep in mind that it can be very disruptive to the user when a window is forced
 to the top.  For a less disruptive way of getting the user's attention, see
@@ -1059,13 +1153,13 @@
 If you wish to be notified when a window gains or loses input focus, whether by
 the user, system or your own code, set a focus callback.
 
-@code
+```c
 glfwSetWindowFocusCallback(window, window_focus_callback);
-@endcode
+```
 
 The callback function receives changes in the input focus state of the window.
 
-@code
+```c
 void window_focus_callback(GLFWwindow* window, int focused)
 {
     if (focused)
@@ -1077,63 +1171,63 @@
         // The window lost input focus
     }
 }
-@endcode
+```
 
 You can also get the current input focus state with @ref glfwGetWindowAttrib.
 
-@code
+```c
 int focused = glfwGetWindowAttrib(window, GLFW_FOCUSED);
-@endcode
+```
 
 By default, newly created windows are given input focus.  You can change this
 behavior by setting the [GLFW_FOCUSED](@ref GLFW_FOCUSED_hint) window hint
 before creating the window.
 
-@code
+```c
 glfwWindowHint(GLFW_FOCUSED, GLFW_FALSE);
-@endcode
+```
 
 
-@subsection window_attention Window attention request
+### Window attention request {#window_attention}
 
 If you wish to notify the user of an event without interrupting, you can request
 attention with @ref glfwRequestWindowAttention.
 
-@code
+```c
 glfwRequestWindowAttention(window);
-@endcode
+```
 
 The system will highlight the specified window, or on platforms where this is
 not supported, the application as a whole.  Once the user has given it
 attention, the system will automatically end the request.
 
 
-@subsection window_refresh Window damage and refresh
+### Window damage and refresh {#window_refresh}
 
 If you wish to be notified when the contents of a window is damaged and needs
 to be refreshed, set a window refresh callback.
 
-@code
+```c
 glfwSetWindowRefreshCallback(m_handle, window_refresh_callback);
-@endcode
+```
 
 The callback function is called when the contents of the window needs to be
 refreshed.
 
-@code
+```c
 void window_refresh_callback(GLFWwindow* window)
 {
     draw_editor_ui(window);
     glfwSwapBuffers(window);
 }
-@endcode
+```
 
 @note On compositing window systems such as Aero, Compiz or Aqua, where the
 window contents are saved off-screen, this callback might only be called when
 the window or framebuffer is resized.
 
 
-@subsection window_transparency Window transparency
+### Window transparency {#window_transparency}
 
 GLFW supports two kinds of transparency for windows; framebuffer transparency
 and whole window transparency.  A single window may not use both methods.  The
@@ -1147,9 +1241,9 @@
 the [GLFW_TRANSPARENT_FRAMEBUFFER](@ref GLFW_TRANSPARENT_FRAMEBUFFER_hint)
 window hint.
 
-@code
+```c
 glfwWindowHint(GLFW_TRANSPARENT_FRAMEBUFFER, GLFW_TRUE);
-@endcode
+```
 
 If supported by the system, the window content area will be composited with the
 background using the framebuffer per-pixel alpha channel.  This requires desktop
@@ -1160,21 +1254,21 @@
 [GLFW_TRANSPARENT_FRAMEBUFFER](@ref GLFW_TRANSPARENT_FRAMEBUFFER_attrib)
 window attribute.
 
-@code
+```c
 if (glfwGetWindowAttrib(window, GLFW_TRANSPARENT_FRAMEBUFFER))
 {
     // window framebuffer is currently transparent
 }
-@endcode
+```
 
 GLFW comes with an example that enabled framebuffer transparency called `gears`.
 
 The opacity of the whole window, including any decorations, can be set with @ref
 glfwSetWindowOpacity.
 
-@code
+```c
 glfwSetWindowOpacity(window, 0.5f);
-@endcode
+```
 
 The opacity (or alpha) value is a positive finite number between zero and one,
 where 0 (zero) is fully transparent and 1 (one) is fully opaque.  The initial
@@ -1182,18 +1276,22 @@
 
 The current opacity of a window can be queried with @ref glfwGetWindowOpacity.
 
-@code
+```c
 float opacity = glfwGetWindowOpacity(window);
-@endcode
+```
 
 If the system does not support whole window transparency, this function always
 returns one.
 
 GLFW comes with a test program that lets you control whole window transparency
-at run-time called `opacity`.
+at run-time called `window`.
+
+If you want to use either of these transparency methods to display a temporary
+overlay like for example a notification, the @ref GLFW_FLOATING and @ref
+GLFW_MOUSE_PASSTHROUGH window hints and attributes may be useful.
 
 
-@subsection window_attribs Window attributes
+### Window attributes {#window_attribs}
 
 Windows have a number of attributes that can be returned using @ref
 glfwGetWindowAttrib.  Some reflect state that may change as a result of user
@@ -1201,12 +1299,12 @@
 properties of the window (e.g. what kind of border it has).  Some are related to
 the window and others to its OpenGL or OpenGL ES context.
 
-@code
+```c
 if (glfwGetWindowAttrib(window, GLFW_FOCUSED))
 {
     // window has input focus
 }
-@endcode
+```
 
 The [GLFW_DECORATED](@ref GLFW_DECORATED_attrib),
 [GLFW_RESIZABLE](@ref GLFW_RESIZABLE_attrib),
@@ -1215,13 +1313,13 @@
 [GLFW_FOCUS_ON_SHOW](@ref GLFW_FOCUS_ON_SHOW_attrib) window attributes can be
 changed with @ref glfwSetWindowAttrib.
 
-@code
+```c
 glfwSetWindowAttrib(window, GLFW_RESIZABLE, GLFW_FALSE);
-@endcode
+```
 
 
 
-@subsubsection window_attribs_wnd Window related attributes
+#### Window related attributes {#window_attribs_wnd}
 
 @anchor GLFW_FOCUSED_attrib
 __GLFW_FOCUSED__ indicates whether the specified window has input focus.  See
@@ -1280,7 +1378,16 @@
 with the [GLFW_FOCUS_ON_SHOW](@ref GLFW_FOCUS_ON_SHOW_hint) window hint or
 after with @ref glfwSetWindowAttrib.
 
-@subsubsection window_attribs_ctx Context related attributes
+@anchor GLFW_MOUSE_PASSTHROUGH_attrib
+__GLFW_MOUSE_PASSTHROUGH__ specifies whether the window is transparent to mouse
+input, letting any mouse events pass through to whatever window is behind it.
+This can be set before creation with the
+[GLFW_MOUSE_PASSTHROUGH](@ref GLFW_MOUSE_PASSTHROUGH_hint) window hint or after
+with @ref glfwSetWindowAttrib.  This is only supported for undecorated windows.
+Decorated windows with this enabled will behave differently between platforms.
+
+
+#### Context related attributes {#window_attribs_ctx}
 
 @anchor GLFW_CLIENT_API_attrib
 __GLFW_CLIENT_API__ indicates the client API provided by the window's context;
@@ -1306,10 +1413,14 @@
 __GLFW_OPENGL_FORWARD_COMPAT__ is `GLFW_TRUE` if the window's context is an
 OpenGL forward-compatible one, or `GLFW_FALSE` otherwise.
 
+@anchor GLFW_CONTEXT_DEBUG_attrib
 @anchor GLFW_OPENGL_DEBUG_CONTEXT_attrib
-__GLFW_OPENGL_DEBUG_CONTEXT__ is `GLFW_TRUE` if the window's context is in debug
+__GLFW_CONTEXT_DEBUG__ is `GLFW_TRUE` if the window's context is in debug
 mode, or `GLFW_FALSE` otherwise.
 
+This is the new name, introduced in GLFW 3.4.  The older
+`GLFW_OPENGL_DEBUG_CONTEXT` name is also available for compatibility.
+
 @anchor GLFW_OPENGL_PROFILE_attrib
 __GLFW_OPENGL_PROFILE__ indicates the OpenGL profile used by the context.  This
 is `GLFW_OPENGL_CORE_PROFILE` or `GLFW_OPENGL_COMPAT_PROFILE` if the context
@@ -1339,11 +1450,13 @@
 if the window's context supports robustness, or `GLFW_NO_ROBUSTNESS` otherwise.
 
 
-@subsubsection window_attribs_fb Framebuffer related attributes
+#### Framebuffer related attributes {#window_attribs_fb}
 
-GLFW does not expose attributes of the default framebuffer (i.e. the framebuffer
-attached to the window) as these can be queried directly with either OpenGL,
-OpenGL ES or Vulkan.
+GLFW does not expose most attributes of the default framebuffer (i.e. the
+framebuffer attached to the window) as these can be queried directly with either
+OpenGL, OpenGL ES or Vulkan.  The one exception is
+[GLFW_DOUBLEBUFFER](@ref GLFW_DOUBLEBUFFER_attrib), as this is not provided by
+OpenGL ES.
 
 If you are using version 3.0 or later of OpenGL or OpenGL ES, the
 `glGetFramebufferAttachmentParameteriv` function can be used to retrieve the
@@ -1369,8 +1482,13 @@
 sizes are queried from the `GL_DEPTH` and `GL_STENCIL` attachments,
 respectively.
 
+@anchor GLFW_DOUBLEBUFFER_attrib
+__GLFW_DOUBLEBUFFER__ indicates whether the specified window is double-buffered
+when rendering with OpenGL or OpenGL ES.  This can be set before creation with
+the [GLFW_DOUBLEBUFFER](@ref GLFW_DOUBLEBUFFER_hint) window hint.
 
-@section buffer_swap Buffer swapping
+
+## Buffer swapping {#buffer_swap}
 
 GLFW windows are by default double buffered.  That means that you have two
 rendering buffers; a front buffer and a back buffer.  The front buffer is
@@ -1380,18 +1498,18 @@
 front buffers in order to display what has been rendered and begin rendering
 a new frame.  This is done with @ref glfwSwapBuffers.
 
-@code
+```c
 glfwSwapBuffers(window);
-@endcode
+```
 
 Sometimes it can be useful to select when the buffer swap will occur.  With the
 function @ref glfwSwapInterval it is possible to select the minimum number of
 monitor refreshes the driver should wait from the time @ref glfwSwapBuffers was
 called before swapping the buffers:
 
-@code
+```c
 glfwSwapInterval(1);
-@endcode
+```
 
 If the interval is zero, the swap will take place immediately when @ref
 glfwSwapBuffers is called without waiting for a refresh.  Otherwise at least
@@ -1410,4 +1528,3 @@
 late.  This trades the risk of visible tears for greater framerate stability.
 You can check for these extensions with @ref glfwExtensionSupported.
 
-*/
diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt
index 0eba4e6..e7a0379 100644
--- a/examples/CMakeLists.txt
+++ b/examples/CMakeLists.txt
@@ -18,19 +18,8 @@
     set(ICON glfw.icns)
 endif()
 
-if (${CMAKE_VERSION} VERSION_EQUAL "3.1.0" OR
-    ${CMAKE_VERSION} VERSION_GREATER "3.1.0")
-    set(CMAKE_C_STANDARD 99)
-else()
-    # Remove this fallback when removing support for CMake version less than 3.1
-    add_compile_options("$<$<C_COMPILER_ID:AppleClang>:-std=c99>"
-                        "$<$<C_COMPILER_ID:Clang>:-std=c99>"
-                        "$<$<C_COMPILER_ID:GNU>:-std=c99>")
-
-endif()
-
-set(GLAD_GL "${GLFW_SOURCE_DIR}/deps/glad/gl.h"
-            "${GLFW_SOURCE_DIR}/deps/glad_gl.c")
+set(GLAD_GL "${GLFW_SOURCE_DIR}/deps/glad/gl.h")
+set(GLAD_GLES2 "${GLFW_SOURCE_DIR}/deps/glad/gles2.h")
 set(GETOPT "${GLFW_SOURCE_DIR}/deps/getopt.h"
            "${GLFW_SOURCE_DIR}/deps/getopt.c")
 set(TINYCTHREAD "${GLFW_SOURCE_DIR}/deps/tinycthread.h"
@@ -42,26 +31,25 @@
 add_executable(offscreen offscreen.c ${ICON} ${GLAD_GL})
 add_executable(particles WIN32 MACOSX_BUNDLE particles.c ${ICON} ${TINYCTHREAD} ${GETOPT} ${GLAD_GL})
 add_executable(sharing WIN32 MACOSX_BUNDLE sharing.c ${ICON} ${GLAD_GL})
-add_executable(simple WIN32 MACOSX_BUNDLE simple.c ${ICON} ${GLAD_GL})
 add_executable(splitview WIN32 MACOSX_BUNDLE splitview.c ${ICON} ${GLAD_GL})
+add_executable(triangle-opengl WIN32 MACOSX_BUNDLE triangle-opengl.c ${ICON} ${GLAD_GL})
+add_executable(triangle-opengles WIN32 MACOSX_BUNDLE triangle-opengles.c ${ICON} ${GLAD_GLES2})
 add_executable(wave WIN32 MACOSX_BUNDLE wave.c ${ICON} ${GLAD_GL})
+add_executable(windows WIN32 MACOSX_BUNDLE windows.c ${ICON} ${GLAD_GL})
 
-target_link_libraries(particles "${CMAKE_THREAD_LIBS_INIT}")
+target_link_libraries(particles Threads::Threads)
 if (RT_LIBRARY)
     target_link_libraries(particles "${RT_LIBRARY}")
 endif()
 
-set(GUI_ONLY_BINARIES boing gears heightmap particles sharing simple splitview
-    wave)
+set(GUI_ONLY_BINARIES boing gears heightmap particles sharing splitview
+    triangle-opengl triangle-opengles wave windows)
 set(CONSOLE_BINARIES offscreen)
 
 set_target_properties(${GUI_ONLY_BINARIES} ${CONSOLE_BINARIES} PROPERTIES
+                      C_STANDARD 99
                       FOLDER "GLFW3/Examples")
 
-if (GLFW_USE_OSMESA)
-    target_compile_definitions(offscreen PRIVATE USE_NATIVE_OSMESA)
-endif()
-
 if (MSVC)
     # Tell MSVC to use main instead of WinMain
     set_target_properties(${GUI_ONLY_BINARIES} PROPERTIES
@@ -78,9 +66,11 @@
     set_target_properties(heightmap PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Heightmap")
     set_target_properties(particles PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Particles")
     set_target_properties(sharing PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Sharing")
-    set_target_properties(simple PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Simple")
+    set_target_properties(triangle-opengl PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "OpenGL Triangle")
+    set_target_properties(triangle-opengles PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "OpenGL ES Triangle")
     set_target_properties(splitview PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "SplitView")
     set_target_properties(wave PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Wave")
+    set_target_properties(windows PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Windows")
 
     set_source_files_properties(glfw.icns PROPERTIES
                                 MACOSX_PACKAGE_LOCATION "Resources")
@@ -88,6 +78,6 @@
                           MACOSX_BUNDLE_SHORT_VERSION_STRING ${GLFW_VERSION}
                           MACOSX_BUNDLE_LONG_VERSION_STRING ${GLFW_VERSION}
                           MACOSX_BUNDLE_ICON_FILE glfw.icns
-                          MACOSX_BUNDLE_INFO_PLIST "${GLFW_SOURCE_DIR}/CMake/MacOSXBundleInfo.plist.in")
+                          MACOSX_BUNDLE_INFO_PLIST "${GLFW_SOURCE_DIR}/CMake/Info.plist.in")
 endif()
 
diff --git a/examples/boing.c b/examples/boing.c
index ca38908..ec118a3 100644
--- a/examples/boing.c
+++ b/examples/boing.c
@@ -36,6 +36,7 @@
 #include <stdlib.h>
 #include <math.h>
 
+#define GLAD_GL_IMPLEMENTATION
 #include <glad/gl.h>
 #define GLFW_INCLUDE_NONE
 #include <GLFW/glfw3.h>
diff --git a/examples/gears.c b/examples/gears.c
index 292f44b..3d63013 100644
--- a/examples/gears.c
+++ b/examples/gears.c
@@ -31,6 +31,7 @@
 #include <stdio.h>
 #include <string.h>
 
+#define GLAD_GL_IMPLEMENTATION
 #include <glad/gl.h>
 #define GLFW_INCLUDE_NONE
 #include <GLFW/glfw3.h>
diff --git a/examples/heightmap.c b/examples/heightmap.c
index 988dd0b..ad5d47c 100644
--- a/examples/heightmap.c
+++ b/examples/heightmap.c
@@ -29,6 +29,7 @@
 #include <assert.h>
 #include <stddef.h>
 
+#define GLAD_GL_IMPLEMENTATION
 #include <glad/gl.h>
 #define GLFW_INCLUDE_NONE
 #include <GLFW/glfw3.h>
diff --git a/examples/offscreen.c b/examples/offscreen.c
index 16b8f3c..e285286 100644
--- a/examples/offscreen.c
+++ b/examples/offscreen.c
@@ -23,15 +23,11 @@
 //
 //========================================================================
 
+#define GLAD_GL_IMPLEMENTATION
 #include <glad/gl.h>
 #define GLFW_INCLUDE_NONE
 #include <GLFW/glfw3.h>
 
-#if USE_NATIVE_OSMESA
- #define GLFW_EXPOSE_NATIVE_OSMESA
- #include <GLFW/glfw3native.h>
-#endif
-
 #include "linmath.h"
 
 #include <stdlib.h>
@@ -150,12 +146,8 @@
     glDrawArrays(GL_TRIANGLES, 0, 3);
     glFinish();
 
-#if USE_NATIVE_OSMESA
-    glfwGetOSMesaColorBuffer(window, &width, &height, NULL, (void**) &buffer);
-#else
     buffer = calloc(4, width * height);
     glReadPixels(0, 0, width, height, GL_RGBA, GL_UNSIGNED_BYTE, buffer);
-#endif
 
     // Write image Y-flipped because OpenGL
     stbi_write_png("offscreen.png",
@@ -163,11 +155,7 @@
                    buffer + (width * 4 * (height - 1)),
                    -width * 4);
 
-#if USE_NATIVE_OSMESA
-    // Here is where there's nothing
-#else
     free(buffer);
-#endif
 
     glfwDestroyWindow(window);
 
diff --git a/examples/particles.c b/examples/particles.c
index 9556cca..baafe82 100644
--- a/examples/particles.c
+++ b/examples/particles.c
@@ -39,6 +39,7 @@
 #include <getopt.h>
 #include <linmath.h>
 
+#define GLAD_GL_IMPLEMENTATION
 #include <glad/gl.h>
 #define GLFW_INCLUDE_NONE
 #include <GLFW/glfw3.h>
diff --git a/examples/sharing.c b/examples/sharing.c
index 4a1a232..502f9ee 100644
--- a/examples/sharing.c
+++ b/examples/sharing.c
@@ -23,6 +23,7 @@
 //
 //========================================================================
 
+#define GLAD_GL_IMPLEMENTATION
 #include <glad/gl.h>
 #define GLFW_INCLUDE_NONE
 #include <GLFW/glfw3.h>
@@ -30,7 +31,6 @@
 #include <stdio.h>
 #include <stdlib.h>
 
-#include "getopt.h"
 #include "linmath.h"
 
 static const char* vertex_shader_text =
diff --git a/examples/splitview.c b/examples/splitview.c
index 079c2cb..990df12 100644
--- a/examples/splitview.c
+++ b/examples/splitview.c
@@ -10,6 +10,7 @@
 //  because I am not a friend of orthogonal projections)
 //========================================================================
 
+#define GLAD_GL_IMPLEMENTATION
 #include <glad/gl.h>
 #define GLFW_INCLUDE_NONE
 #include <GLFW/glfw3.h>
diff --git a/examples/simple.c b/examples/triangle-opengl.c
similarity index 70%
rename from examples/simple.c
rename to examples/triangle-opengl.c
index 95d8fe6..ff9e7d3 100644
--- a/examples/simple.c
+++ b/examples/triangle-opengl.c
@@ -1,5 +1,5 @@
 //========================================================================
-// Simple GLFW example
+// OpenGL triangle example
 // Copyright (c) Camilla Löwy <elmindreda@glfw.org>
 //
 // This software is provided 'as-is', without any express or implied
@@ -24,6 +24,7 @@
 //========================================================================
 //! [code]
 
+#define GLAD_GL_IMPLEMENTATION
 #include <glad/gl.h>
 #define GLFW_INCLUDE_NONE
 #include <GLFW/glfw3.h>
@@ -31,25 +32,28 @@
 #include "linmath.h"
 
 #include <stdlib.h>
+#include <stddef.h>
 #include <stdio.h>
 
-static const struct
+typedef struct Vertex
 {
-    float x, y;
-    float r, g, b;
-} vertices[3] =
+    vec2 pos;
+    vec3 col;
+} Vertex;
+
+static const Vertex vertices[3] =
 {
-    { -0.6f, -0.4f, 1.f, 0.f, 0.f },
-    {  0.6f, -0.4f, 0.f, 1.f, 0.f },
-    {   0.f,  0.6f, 0.f, 0.f, 1.f }
+    { { -0.6f, -0.4f }, { 1.f, 0.f, 0.f } },
+    { {  0.6f, -0.4f }, { 0.f, 1.f, 0.f } },
+    { {   0.f,  0.6f }, { 0.f, 0.f, 1.f } }
 };
 
 static const char* vertex_shader_text =
-"#version 110\n"
+"#version 330\n"
 "uniform mat4 MVP;\n"
-"attribute vec3 vCol;\n"
-"attribute vec2 vPos;\n"
-"varying vec3 color;\n"
+"in vec3 vCol;\n"
+"in vec2 vPos;\n"
+"out vec3 color;\n"
 "void main()\n"
 "{\n"
 "    gl_Position = MVP * vec4(vPos, 0.0, 1.0);\n"
@@ -57,11 +61,12 @@
 "}\n";
 
 static const char* fragment_shader_text =
-"#version 110\n"
-"varying vec3 color;\n"
+"#version 330\n"
+"in vec3 color;\n"
+"out vec4 fragment;\n"
 "void main()\n"
 "{\n"
-"    gl_FragColor = vec4(color, 1.0);\n"
+"    fragment = vec4(color, 1.0);\n"
 "}\n";
 
 static void error_callback(int error, const char* description)
@@ -77,19 +82,16 @@
 
 int main(void)
 {
-    GLFWwindow* window;
-    GLuint vertex_buffer, vertex_shader, fragment_shader, program;
-    GLint mvp_location, vpos_location, vcol_location;
-
     glfwSetErrorCallback(error_callback);
 
     if (!glfwInit())
         exit(EXIT_FAILURE);
 
-    glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 2);
-    glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0);
+    glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
+    glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
+    glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
 
-    window = glfwCreateWindow(640, 480, "Simple example", NULL, NULL);
+    GLFWwindow* window = glfwCreateWindow(640, 480, "OpenGL Triangle", NULL, NULL);
     if (!window)
     {
         glfwTerminate();
@@ -104,53 +106,56 @@
 
     // NOTE: OpenGL error checks have been omitted for brevity
 
+    GLuint vertex_buffer;
     glGenBuffers(1, &vertex_buffer);
     glBindBuffer(GL_ARRAY_BUFFER, vertex_buffer);
     glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);
 
-    vertex_shader = glCreateShader(GL_VERTEX_SHADER);
+    const GLuint vertex_shader = glCreateShader(GL_VERTEX_SHADER);
     glShaderSource(vertex_shader, 1, &vertex_shader_text, NULL);
     glCompileShader(vertex_shader);
 
-    fragment_shader = glCreateShader(GL_FRAGMENT_SHADER);
+    const GLuint fragment_shader = glCreateShader(GL_FRAGMENT_SHADER);
     glShaderSource(fragment_shader, 1, &fragment_shader_text, NULL);
     glCompileShader(fragment_shader);
 
-    program = glCreateProgram();
+    const GLuint program = glCreateProgram();
     glAttachShader(program, vertex_shader);
     glAttachShader(program, fragment_shader);
     glLinkProgram(program);
 
-    mvp_location = glGetUniformLocation(program, "MVP");
-    vpos_location = glGetAttribLocation(program, "vPos");
-    vcol_location = glGetAttribLocation(program, "vCol");
+    const GLint mvp_location = glGetUniformLocation(program, "MVP");
+    const GLint vpos_location = glGetAttribLocation(program, "vPos");
+    const GLint vcol_location = glGetAttribLocation(program, "vCol");
 
+    GLuint vertex_array;
+    glGenVertexArrays(1, &vertex_array);
+    glBindVertexArray(vertex_array);
     glEnableVertexAttribArray(vpos_location);
     glVertexAttribPointer(vpos_location, 2, GL_FLOAT, GL_FALSE,
-                          sizeof(vertices[0]), (void*) 0);
+                          sizeof(Vertex), (void*) offsetof(Vertex, pos));
     glEnableVertexAttribArray(vcol_location);
     glVertexAttribPointer(vcol_location, 3, GL_FLOAT, GL_FALSE,
-                          sizeof(vertices[0]), (void*) (sizeof(float) * 2));
+                          sizeof(Vertex), (void*) offsetof(Vertex, col));
 
     while (!glfwWindowShouldClose(window))
     {
-        float ratio;
         int width, height;
-        mat4x4 m, p, mvp;
-
         glfwGetFramebufferSize(window, &width, &height);
-        ratio = width / (float) height;
+        const float ratio = width / (float) height;
 
         glViewport(0, 0, width, height);
         glClear(GL_COLOR_BUFFER_BIT);
 
+        mat4x4 m, p, mvp;
         mat4x4_identity(m);
         mat4x4_rotate_Z(m, m, (float) glfwGetTime());
         mat4x4_ortho(p, -ratio, ratio, -1.f, 1.f, 1.f, -1.f);
         mat4x4_mul(mvp, p, m);
 
         glUseProgram(program);
-        glUniformMatrix4fv(mvp_location, 1, GL_FALSE, (const GLfloat*) mvp);
+        glUniformMatrix4fv(mvp_location, 1, GL_FALSE, (const GLfloat*) &mvp);
+        glBindVertexArray(vertex_array);
         glDrawArrays(GL_TRIANGLES, 0, 3);
 
         glfwSwapBuffers(window);
diff --git a/examples/simple.c b/examples/triangle-opengles.c
similarity index 68%
copy from examples/simple.c
copy to examples/triangle-opengles.c
index 95d8fe6..03eb026 100644
--- a/examples/simple.c
+++ b/examples/triangle-opengles.c
@@ -1,5 +1,5 @@
 //========================================================================
-// Simple GLFW example
+// OpenGL ES 2.0 triangle example
 // Copyright (c) Camilla Löwy <elmindreda@glfw.org>
 //
 // This software is provided 'as-is', without any express or implied
@@ -22,30 +22,34 @@
 //    distribution.
 //
 //========================================================================
-//! [code]
 
-#include <glad/gl.h>
+#define GLAD_GLES2_IMPLEMENTATION
+#include <glad/gles2.h>
 #define GLFW_INCLUDE_NONE
 #include <GLFW/glfw3.h>
 
 #include "linmath.h"
 
 #include <stdlib.h>
+#include <stddef.h>
 #include <stdio.h>
 
-static const struct
+typedef struct Vertex
 {
-    float x, y;
-    float r, g, b;
-} vertices[3] =
+    vec2 pos;
+    vec3 col;
+} Vertex;
+
+static const Vertex vertices[3] =
 {
-    { -0.6f, -0.4f, 1.f, 0.f, 0.f },
-    {  0.6f, -0.4f, 0.f, 1.f, 0.f },
-    {   0.f,  0.6f, 0.f, 0.f, 1.f }
+    { { -0.6f, -0.4f }, { 1.f, 0.f, 0.f } },
+    { {  0.6f, -0.4f }, { 0.f, 1.f, 0.f } },
+    { {   0.f,  0.6f }, { 0.f, 0.f, 1.f } }
 };
 
 static const char* vertex_shader_text =
-"#version 110\n"
+"#version 100\n"
+"precision mediump float;\n"
 "uniform mat4 MVP;\n"
 "attribute vec3 vCol;\n"
 "attribute vec2 vPos;\n"
@@ -57,7 +61,8 @@
 "}\n";
 
 static const char* fragment_shader_text =
-"#version 110\n"
+"#version 100\n"
+"precision mediump float;\n"
 "varying vec3 color;\n"
 "void main()\n"
 "{\n"
@@ -66,7 +71,7 @@
 
 static void error_callback(int error, const char* description)
 {
-    fprintf(stderr, "Error: %s\n", description);
+    fprintf(stderr, "GLFW Error: %s\n", description);
 }
 
 static void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods)
@@ -77,80 +82,80 @@
 
 int main(void)
 {
-    GLFWwindow* window;
-    GLuint vertex_buffer, vertex_shader, fragment_shader, program;
-    GLint mvp_location, vpos_location, vcol_location;
-
     glfwSetErrorCallback(error_callback);
 
     if (!glfwInit())
         exit(EXIT_FAILURE);
 
+    glfwWindowHint(GLFW_CLIENT_API, GLFW_OPENGL_ES_API);
     glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 2);
     glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0);
+    glfwWindowHint(GLFW_CONTEXT_CREATION_API, GLFW_EGL_CONTEXT_API);
 
-    window = glfwCreateWindow(640, 480, "Simple example", NULL, NULL);
+    GLFWwindow* window = glfwCreateWindow(640, 480, "OpenGL ES 2.0 Triangle (EGL)", NULL, NULL);
     if (!window)
     {
-        glfwTerminate();
-        exit(EXIT_FAILURE);
+        glfwWindowHint(GLFW_CONTEXT_CREATION_API, GLFW_NATIVE_CONTEXT_API);
+        window = glfwCreateWindow(640, 480, "OpenGL ES 2.0 Triangle", NULL, NULL);
+        if (!window)
+        {
+            glfwTerminate();
+            exit(EXIT_FAILURE);
+        }
     }
 
     glfwSetKeyCallback(window, key_callback);
 
     glfwMakeContextCurrent(window);
-    gladLoadGL(glfwGetProcAddress);
+    gladLoadGLES2(glfwGetProcAddress);
     glfwSwapInterval(1);
 
-    // NOTE: OpenGL error checks have been omitted for brevity
-
+    GLuint vertex_buffer;
     glGenBuffers(1, &vertex_buffer);
     glBindBuffer(GL_ARRAY_BUFFER, vertex_buffer);
     glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);
 
-    vertex_shader = glCreateShader(GL_VERTEX_SHADER);
+    const GLuint vertex_shader = glCreateShader(GL_VERTEX_SHADER);
     glShaderSource(vertex_shader, 1, &vertex_shader_text, NULL);
     glCompileShader(vertex_shader);
 
-    fragment_shader = glCreateShader(GL_FRAGMENT_SHADER);
+    const GLuint fragment_shader = glCreateShader(GL_FRAGMENT_SHADER);
     glShaderSource(fragment_shader, 1, &fragment_shader_text, NULL);
     glCompileShader(fragment_shader);
 
-    program = glCreateProgram();
+    const GLuint program = glCreateProgram();
     glAttachShader(program, vertex_shader);
     glAttachShader(program, fragment_shader);
     glLinkProgram(program);
 
-    mvp_location = glGetUniformLocation(program, "MVP");
-    vpos_location = glGetAttribLocation(program, "vPos");
-    vcol_location = glGetAttribLocation(program, "vCol");
+    const GLint mvp_location = glGetUniformLocation(program, "MVP");
+    const GLint vpos_location = glGetAttribLocation(program, "vPos");
+    const GLint vcol_location = glGetAttribLocation(program, "vCol");
 
     glEnableVertexAttribArray(vpos_location);
-    glVertexAttribPointer(vpos_location, 2, GL_FLOAT, GL_FALSE,
-                          sizeof(vertices[0]), (void*) 0);
     glEnableVertexAttribArray(vcol_location);
+    glVertexAttribPointer(vpos_location, 2, GL_FLOAT, GL_FALSE,
+                          sizeof(Vertex), (void*) offsetof(Vertex, pos));
     glVertexAttribPointer(vcol_location, 3, GL_FLOAT, GL_FALSE,
-                          sizeof(vertices[0]), (void*) (sizeof(float) * 2));
+                          sizeof(Vertex), (void*) offsetof(Vertex, col));
 
     while (!glfwWindowShouldClose(window))
     {
-        float ratio;
         int width, height;
-        mat4x4 m, p, mvp;
-
         glfwGetFramebufferSize(window, &width, &height);
-        ratio = width / (float) height;
+        const float ratio = width / (float) height;
 
         glViewport(0, 0, width, height);
         glClear(GL_COLOR_BUFFER_BIT);
 
+        mat4x4 m, p, mvp;
         mat4x4_identity(m);
         mat4x4_rotate_Z(m, m, (float) glfwGetTime());
         mat4x4_ortho(p, -ratio, ratio, -1.f, 1.f, 1.f, -1.f);
         mat4x4_mul(mvp, p, m);
 
         glUseProgram(program);
-        glUniformMatrix4fv(mvp_location, 1, GL_FALSE, (const GLfloat*) mvp);
+        glUniformMatrix4fv(mvp_location, 1, GL_FALSE, (const GLfloat*) &mvp);
         glDrawArrays(GL_TRIANGLES, 0, 3);
 
         glfwSwapBuffers(window);
@@ -163,4 +168,3 @@
     exit(EXIT_SUCCESS);
 }
 
-//! [code]
diff --git a/examples/wave.c b/examples/wave.c
index 7acb8b9..d7ead49 100644
--- a/examples/wave.c
+++ b/examples/wave.c
@@ -17,6 +17,7 @@
 #include <stdlib.h>
 #include <math.h>
 
+#define GLAD_GL_IMPLEMENTATION
 #include <glad/gl.h>
 #define GLFW_INCLUDE_NONE
 #include <GLFW/glfw3.h>
diff --git a/examples/windows.c b/examples/windows.c
new file mode 100644
index 0000000..1589ffb
--- /dev/null
+++ b/examples/windows.c
@@ -0,0 +1,106 @@
+//========================================================================
+// Simple multi-window example
+// Copyright (c) Camilla Löwy <elmindreda@glfw.org>
+//
+// 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 GLAD_GL_IMPLEMENTATION
+#include <glad/gl.h>
+#define GLFW_INCLUDE_NONE
+#include <GLFW/glfw3.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+
+int main(int argc, char** argv)
+{
+    int xpos, ypos, height;
+    const char* description;
+    GLFWwindow* windows[4];
+
+    if (!glfwInit())
+    {
+        glfwGetError(&description);
+        printf("Error: %s\n", description);
+        exit(EXIT_FAILURE);
+    }
+
+    glfwWindowHint(GLFW_DECORATED, GLFW_FALSE);
+
+    glfwGetMonitorWorkarea(glfwGetPrimaryMonitor(), &xpos, &ypos, NULL, &height);
+
+    for (int i = 0;  i < 4;  i++)
+    {
+        const int size = height / 5;
+        const struct
+        {
+            float r, g, b;
+        } colors[] =
+        {
+            { 0.95f, 0.32f, 0.11f },
+            { 0.50f, 0.80f, 0.16f },
+            {   0.f, 0.68f, 0.94f },
+            { 0.98f, 0.74f, 0.04f }
+        };
+
+        if (i > 0)
+            glfwWindowHint(GLFW_FOCUS_ON_SHOW, GLFW_FALSE);
+
+        glfwWindowHint(GLFW_POSITION_X, xpos + size * (1 + (i & 1)));
+        glfwWindowHint(GLFW_POSITION_Y, ypos + size * (1 + (i >> 1)));
+
+        windows[i] = glfwCreateWindow(size, size, "Multi-Window Example", NULL, NULL);
+        if (!windows[i])
+        {
+            glfwGetError(&description);
+            printf("Error: %s\n", description);
+            glfwTerminate();
+            exit(EXIT_FAILURE);
+        }
+
+        glfwSetInputMode(windows[i], GLFW_STICKY_KEYS, GLFW_TRUE);
+
+        glfwMakeContextCurrent(windows[i]);
+        gladLoadGL(glfwGetProcAddress);
+        glClearColor(colors[i].r, colors[i].g, colors[i].b, 1.f);
+    }
+
+    for (;;)
+    {
+        for (int i = 0;  i < 4;  i++)
+        {
+            glfwMakeContextCurrent(windows[i]);
+            glClear(GL_COLOR_BUFFER_BIT);
+            glfwSwapBuffers(windows[i]);
+
+            if (glfwWindowShouldClose(windows[i]) ||
+                glfwGetKey(windows[i], GLFW_KEY_ESCAPE))
+            {
+                glfwTerminate();
+                exit(EXIT_SUCCESS);
+            }
+        }
+
+        glfwWaitEvents();
+    }
+}
+
diff --git a/include/GLFW/glfw3.h b/include/GLFW/glfw3.h
index b93a004..9c55ac9 100644
--- a/include/GLFW/glfw3.h
+++ b/include/GLFW/glfw3.h
@@ -1,5 +1,5 @@
 /*************************************************************************
- * GLFW 3.3 - www.glfw.org
+ * GLFW 3.4 - www.glfw.org
  * A library for OpenGL, window and input
  *------------------------------------------------------------------------
  * Copyright (c) 2002-2006 Marcus Geelnard
@@ -291,14 +291,14 @@
  *  features are added to the API but it remains backward-compatible.
  *  @ingroup init
  */
-#define GLFW_VERSION_MINOR          3
+#define GLFW_VERSION_MINOR          4
 /*! @brief The revision number of the GLFW header.
  *
  *  The revision number of the GLFW header.  This is incremented when a bug fix
  *  release is made that does not contain any API changes.
  *  @ingroup init
  */
-#define GLFW_VERSION_REVISION       10
+#define GLFW_VERSION_REVISION       0
 /*! @} */
 
 /*! @brief One.
@@ -379,7 +379,7 @@
  *
  *  The naming of the key codes follow these rules:
  *   - The US keyboard layout is used
- *   - Names of printable alpha-numeric characters are used (e.g. "A", "R",
+ *   - Names of printable alphanumeric characters are used (e.g. "A", "R",
  *     "3", etc.)
  *   - For non-alphanumeric characters, Unicode:ish names are used (e.g.
  *     "COMMA", "LEFT_SQUARE_BRACKET", etc.). Note that some names do not
@@ -721,7 +721,7 @@
  *  GLFW could not find support for the requested API on the system.
  *
  *  @analysis The installed graphics driver does not support the requested
- *  API, or does not support it via the chosen context creation backend.
+ *  API, or does not support it via the chosen context creation API.
  *  Below are a few examples.
  *
  *  @par
@@ -787,6 +787,66 @@
  *  @analysis Application programmer error.  Fix the offending call.
  */
 #define GLFW_NO_WINDOW_CONTEXT      0x0001000A
+/*! @brief The specified cursor shape is not available.
+ *
+ *  The specified standard cursor shape is not available, either because the
+ *  current platform cursor theme does not provide it or because it is not
+ *  available on the platform.
+ *
+ *  @analysis Platform or system settings limitation.  Pick another
+ *  [standard cursor shape](@ref shapes) or create a
+ *  [custom cursor](@ref cursor_custom).
+ */
+#define GLFW_CURSOR_UNAVAILABLE     0x0001000B
+/*! @brief The requested feature is not provided by the platform.
+ *
+ *  The requested feature is not provided by the platform, so GLFW is unable to
+ *  implement it.  The documentation for each function notes if it could emit
+ *  this error.
+ *
+ *  @analysis Platform or platform version limitation.  The error can be ignored
+ *  unless the feature is critical to the application.
+ *
+ *  @par
+ *  A function call that emits this error has no effect other than the error and
+ *  updating any existing out parameters.
+ */
+#define GLFW_FEATURE_UNAVAILABLE    0x0001000C
+/*! @brief The requested feature is not implemented for the platform.
+ *
+ *  The requested feature has not yet been implemented in GLFW for this platform.
+ *
+ *  @analysis An incomplete implementation of GLFW for this platform, hopefully
+ *  fixed in a future release.  The error can be ignored unless the feature is
+ *  critical to the application.
+ *
+ *  @par
+ *  A function call that emits this error has no effect other than the error and
+ *  updating any existing out parameters.
+ */
+#define GLFW_FEATURE_UNIMPLEMENTED  0x0001000D
+/*! @brief Platform unavailable or no matching platform was found.
+ *
+ *  If emitted during initialization, no matching platform was found.  If the @ref
+ *  GLFW_PLATFORM init hint was set to `GLFW_ANY_PLATFORM`, GLFW could not detect any of
+ *  the platforms supported by this library binary, except for the Null platform.  If the
+ *  init hint was set to a specific platform, it is either not supported by this library
+ *  binary or GLFW was not able to detect it.
+ *
+ *  If emitted by a native access function, GLFW was initialized for a different platform
+ *  than the function is for.
+ *
+ *  @analysis Failure to detect any platform usually only happens on non-macOS Unix
+ *  systems, either when no window system is running or the program was run from
+ *  a terminal that does not have the necessary environment variables.  Fall back to
+ *  a different platform if possible or notify the user that no usable platform was
+ *  detected.
+ *
+ *  Failure to detect a specific platform may have the same cause as above or be because
+ *  support for that platform was not compiled in.  Call @ref glfwPlatformSupported to
+ *  check whether a specific platform is supported by a library binary.
+ */
+#define GLFW_PLATFORM_UNAVAILABLE   0x0001000E
 /*! @} */
 
 /*! @addtogroup window
@@ -862,6 +922,25 @@
  */
 #define GLFW_FOCUS_ON_SHOW          0x0002000C
 
+/*! @brief Mouse input transparency window hint and attribute
+ *
+ *  Mouse input transparency [window hint](@ref GLFW_MOUSE_PASSTHROUGH_hint) or
+ *  [window attribute](@ref GLFW_MOUSE_PASSTHROUGH_attrib).
+ */
+#define GLFW_MOUSE_PASSTHROUGH      0x0002000D
+
+/*! @brief Initial position x-coordinate window hint.
+ *
+ *  Initial position x-coordinate [window hint](@ref GLFW_POSITION_X).
+ */
+#define GLFW_POSITION_X             0x0002000E
+
+/*! @brief Initial position y-coordinate window hint.
+ *
+ *  Initial position y-coordinate [window hint](@ref GLFW_POSITION_Y).
+ */
+#define GLFW_POSITION_Y             0x0002000F
+
 /*! @brief Framebuffer bit depth hint.
  *
  *  Framebuffer bit depth [hint](@ref GLFW_RED_BITS).
@@ -937,9 +1016,10 @@
  *  Monitor refresh rate [hint](@ref GLFW_REFRESH_RATE).
  */
 #define GLFW_REFRESH_RATE           0x0002100F
-/*! @brief Framebuffer double buffering hint.
+/*! @brief Framebuffer double buffering hint and attribute.
  *
- *  Framebuffer double buffering [hint](@ref GLFW_DOUBLEBUFFER).
+ *  Framebuffer double buffering [hint](@ref GLFW_DOUBLEBUFFER_hint) and
+ *  [attribute](@ref GLFW_DOUBLEBUFFER_attrib).
  */
 #define GLFW_DOUBLEBUFFER           0x00021010
 
@@ -981,10 +1061,15 @@
 #define GLFW_OPENGL_FORWARD_COMPAT  0x00022006
 /*! @brief Debug mode context hint and attribute.
  *
- *  Debug mode context [hint](@ref GLFW_OPENGL_DEBUG_CONTEXT_hint) and
- *  [attribute](@ref GLFW_OPENGL_DEBUG_CONTEXT_attrib).
+ *  Debug mode context [hint](@ref GLFW_CONTEXT_DEBUG_hint) and
+ *  [attribute](@ref GLFW_CONTEXT_DEBUG_attrib).
  */
-#define GLFW_OPENGL_DEBUG_CONTEXT   0x00022007
+#define GLFW_CONTEXT_DEBUG          0x00022007
+/*! @brief Legacy name for compatibility.
+ *
+ *  This is an alias for compatibility with earlier versions.
+ */
+#define GLFW_OPENGL_DEBUG_CONTEXT   GLFW_CONTEXT_DEBUG
 /*! @brief OpenGL profile hint and attribute.
  *
  *  OpenGL profile [hint](@ref GLFW_OPENGL_PROFILE_hint) and
@@ -1013,8 +1098,15 @@
  *  [window hint](@ref GLFW_SCALE_TO_MONITOR).
  */
 #define GLFW_SCALE_TO_MONITOR       0x0002200C
-/*! @brief macOS specific
- *  [window hint](@ref GLFW_COCOA_RETINA_FRAMEBUFFER_hint).
+/*! @brief Window framebuffer scaling
+ *  [window hint](@ref GLFW_SCALE_FRAMEBUFFER_hint).
+ */
+#define GLFW_SCALE_FRAMEBUFFER      0x0002200D
+/*! @brief Legacy name for compatibility.
+ *
+ *  This is an alias for the
+ *  [GLFW_SCALE_FRAMEBUFFER](@ref GLFW_SCALE_FRAMEBUFFER_hint) window hint for
+ *  compatibility with earlier versions.
  */
 #define GLFW_COCOA_RETINA_FRAMEBUFFER 0x00023001
 /*! @brief macOS specific
@@ -1033,6 +1125,16 @@
  *  [window hint](@ref GLFW_X11_CLASS_NAME_hint).
  */
 #define GLFW_X11_INSTANCE_NAME      0x00024002
+#define GLFW_WIN32_KEYBOARD_MENU    0x00025001
+/*! @brief Win32 specific [window hint](@ref GLFW_WIN32_SHOWDEFAULT_hint).
+ */
+#define GLFW_WIN32_SHOWDEFAULT      0x00025002
+/*! @brief Wayland specific
+ *  [window hint](@ref GLFW_WAYLAND_APP_ID_hint).
+ *  
+ *  Allows specification of the Wayland app_id.
+ */
+#define GLFW_WAYLAND_APP_ID         0x00026001
 /*! @} */
 
 #define GLFW_NO_API                          0
@@ -1056,6 +1158,7 @@
 #define GLFW_CURSOR_NORMAL          0x00034001
 #define GLFW_CURSOR_HIDDEN          0x00034002
 #define GLFW_CURSOR_DISABLED        0x00034003
+#define GLFW_CURSOR_CAPTURED        0x00034004
 
 #define GLFW_ANY_RELEASE_BEHAVIOR            0
 #define GLFW_RELEASE_BEHAVIOR_FLUSH 0x00035001
@@ -1065,20 +1168,31 @@
 #define GLFW_EGL_CONTEXT_API        0x00036002
 #define GLFW_OSMESA_CONTEXT_API     0x00036003
 
+#define GLFW_ANGLE_PLATFORM_TYPE_NONE    0x00037001
+#define GLFW_ANGLE_PLATFORM_TYPE_OPENGL  0x00037002
+#define GLFW_ANGLE_PLATFORM_TYPE_OPENGLES 0x00037003
+#define GLFW_ANGLE_PLATFORM_TYPE_D3D9    0x00037004
+#define GLFW_ANGLE_PLATFORM_TYPE_D3D11   0x00037005
+#define GLFW_ANGLE_PLATFORM_TYPE_VULKAN  0x00037007
+#define GLFW_ANGLE_PLATFORM_TYPE_METAL   0x00037008
+
 #define GLFW_WAYLAND_PREFER_LIBDECOR    0x00038001
 #define GLFW_WAYLAND_DISABLE_LIBDECOR   0x00038002
 
+#define GLFW_ANY_POSITION           0x80000000
+
 /*! @defgroup shapes Standard cursor shapes
  *  @brief Standard system cursor shapes.
  *
- *  See [standard cursor creation](@ref cursor_standard) for how these are used.
+ *  These are the [standard cursor shapes](@ref cursor_standard) that can be
+ *  requested from the platform (window system).
  *
  *  @ingroup input
  *  @{ */
 
 /*! @brief The regular arrow cursor shape.
  *
- *  The regular arrow cursor.
+ *  The regular arrow cursor shape.
  */
 #define GLFW_ARROW_CURSOR           0x00036001
 /*! @brief The text input I-beam cursor shape.
@@ -1086,26 +1200,91 @@
  *  The text input I-beam cursor shape.
  */
 #define GLFW_IBEAM_CURSOR           0x00036002
-/*! @brief The crosshair shape.
+/*! @brief The crosshair cursor shape.
  *
- *  The crosshair shape.
+ *  The crosshair cursor shape.
  */
 #define GLFW_CROSSHAIR_CURSOR       0x00036003
-/*! @brief The hand shape.
+/*! @brief The pointing hand cursor shape.
  *
- *  The hand shape.
+ *  The pointing hand cursor shape.
  */
-#define GLFW_HAND_CURSOR            0x00036004
-/*! @brief The horizontal resize arrow shape.
+#define GLFW_POINTING_HAND_CURSOR   0x00036004
+/*! @brief The horizontal resize/move arrow shape.
  *
- *  The horizontal resize arrow shape.
+ *  The horizontal resize/move arrow shape.  This is usually a horizontal
+ *  double-headed arrow.
  */
-#define GLFW_HRESIZE_CURSOR         0x00036005
-/*! @brief The vertical resize arrow shape.
+#define GLFW_RESIZE_EW_CURSOR       0x00036005
+/*! @brief The vertical resize/move arrow shape.
  *
- *  The vertical resize arrow shape.
+ *  The vertical resize/move shape.  This is usually a vertical double-headed
+ *  arrow.
  */
-#define GLFW_VRESIZE_CURSOR         0x00036006
+#define GLFW_RESIZE_NS_CURSOR       0x00036006
+/*! @brief The top-left to bottom-right diagonal resize/move arrow shape.
+ *
+ *  The top-left to bottom-right diagonal resize/move shape.  This is usually
+ *  a diagonal double-headed arrow.
+ *
+ *  @note @macos This shape is provided by a private system API and may fail
+ *  with @ref GLFW_CURSOR_UNAVAILABLE in the future.
+ *
+ *  @note @wayland This shape is provided by a newer standard not supported by
+ *  all cursor themes.
+ *
+ *  @note @x11 This shape is provided by a newer standard not supported by all
+ *  cursor themes.
+ */
+#define GLFW_RESIZE_NWSE_CURSOR     0x00036007
+/*! @brief The top-right to bottom-left diagonal resize/move arrow shape.
+ *
+ *  The top-right to bottom-left diagonal resize/move shape.  This is usually
+ *  a diagonal double-headed arrow.
+ *
+ *  @note @macos This shape is provided by a private system API and may fail
+ *  with @ref GLFW_CURSOR_UNAVAILABLE in the future.
+ *
+ *  @note @wayland This shape is provided by a newer standard not supported by
+ *  all cursor themes.
+ *
+ *  @note @x11 This shape is provided by a newer standard not supported by all
+ *  cursor themes.
+ */
+#define GLFW_RESIZE_NESW_CURSOR     0x00036008
+/*! @brief The omni-directional resize/move cursor shape.
+ *
+ *  The omni-directional resize cursor/move shape.  This is usually either
+ *  a combined horizontal and vertical double-headed arrow or a grabbing hand.
+ */
+#define GLFW_RESIZE_ALL_CURSOR      0x00036009
+/*! @brief The operation-not-allowed shape.
+ *
+ *  The operation-not-allowed shape.  This is usually a circle with a diagonal
+ *  line through it.
+ *
+ *  @note @wayland This shape is provided by a newer standard not supported by
+ *  all cursor themes.
+ *
+ *  @note @x11 This shape is provided by a newer standard not supported by all
+ *  cursor themes.
+ */
+#define GLFW_NOT_ALLOWED_CURSOR     0x0003600A
+/*! @brief Legacy name for compatibility.
+ *
+ *  This is an alias for compatibility with earlier versions.
+ */
+#define GLFW_HRESIZE_CURSOR         GLFW_RESIZE_EW_CURSOR
+/*! @brief Legacy name for compatibility.
+ *
+ *  This is an alias for compatibility with earlier versions.
+ */
+#define GLFW_VRESIZE_CURSOR         GLFW_RESIZE_NS_CURSOR
+/*! @brief Legacy name for compatibility.
+ *
+ *  This is an alias for compatibility with earlier versions.
+ */
+#define GLFW_HAND_CURSOR            GLFW_POINTING_HAND_CURSOR
 /*! @} */
 
 #define GLFW_CONNECTED              0x00040001
@@ -1118,6 +1297,16 @@
  *  Joystick hat buttons [init hint](@ref GLFW_JOYSTICK_HAT_BUTTONS).
  */
 #define GLFW_JOYSTICK_HAT_BUTTONS   0x00050001
+/*! @brief ANGLE rendering backend init hint.
+ *
+ *  ANGLE rendering backend [init hint](@ref GLFW_ANGLE_PLATFORM_TYPE_hint).
+ */
+#define GLFW_ANGLE_PLATFORM_TYPE    0x00050002
+/*! @brief Platform selection init hint.
+ *
+ *  Platform selection [init hint](@ref GLFW_PLATFORM).
+ */
+#define GLFW_PLATFORM               0x00050003
 /*! @brief macOS specific init hint.
  *
  *  macOS specific [init hint](@ref GLFW_COCOA_CHDIR_RESOURCES_hint).
@@ -1128,6 +1317,11 @@
  *  macOS specific [init hint](@ref GLFW_COCOA_MENUBAR_hint).
  */
 #define GLFW_COCOA_MENUBAR          0x00051002
+/*! @brief X11 specific init hint.
+ *
+ *  X11 specific [init hint](@ref GLFW_X11_XCB_VULKAN_SURFACE_hint).
+ */
+#define GLFW_X11_XCB_VULKAN_SURFACE 0x00052001
 /*! @brief Wayland specific init hint.
  *
  *  Wayland specific [init hint](@ref GLFW_WAYLAND_LIBDECOR_hint).
@@ -1135,6 +1329,20 @@
 #define GLFW_WAYLAND_LIBDECOR       0x00053001
 /*! @} */
 
+/*! @addtogroup init
+ *  @{ */
+/*! @brief Hint value that enables automatic platform selection.
+ *
+ *  Hint value for @ref GLFW_PLATFORM that enables automatic platform selection.
+ */
+#define GLFW_ANY_PLATFORM           0x00060000
+#define GLFW_PLATFORM_WIN32         0x00060001
+#define GLFW_PLATFORM_COCOA         0x00060002
+#define GLFW_PLATFORM_WAYLAND       0x00060003
+#define GLFW_PLATFORM_X11           0x00060004
+#define GLFW_PLATFORM_NULL          0x00060005
+/*! @} */
+
 #define GLFW_DONT_CARE              -1
 
 
@@ -1206,6 +1414,157 @@
  */
 typedef struct GLFWcursor GLFWcursor;
 
+/*! @brief The function pointer type for memory allocation callbacks.
+ *
+ *  This is the function pointer type for memory allocation callbacks.  A memory
+ *  allocation callback function has the following signature:
+ *  @code
+ *  void* function_name(size_t size, void* user)
+ *  @endcode
+ *
+ *  This function must return either a memory block at least `size` bytes long,
+ *  or `NULL` if allocation failed.  Note that not all parts of GLFW handle allocation
+ *  failures gracefully yet.
+ *
+ *  This function must support being called during @ref glfwInit but before the library is
+ *  flagged as initialized, as well as during @ref glfwTerminate after the library is no
+ *  longer flagged as initialized.
+ *
+ *  Any memory allocated via this function will be deallocated via the same allocator
+ *  during library termination or earlier.
+ *
+ *  Any memory allocated via this function must be suitably aligned for any object type.
+ *  If you are using C99 or earlier, this alignment is platform-dependent but will be the
+ *  same as what `malloc` provides.  If you are using C11 or later, this is the value of
+ *  `alignof(max_align_t)`.
+ *
+ *  The size will always be greater than zero.  Allocations of size zero are filtered out
+ *  before reaching the custom allocator.
+ *
+ *  If this function returns `NULL`, GLFW will emit @ref GLFW_OUT_OF_MEMORY.
+ *
+ *  This function must not call any GLFW function.
+ *
+ *  @param[in] size The minimum size, in bytes, of the memory block.
+ *  @param[in] user The user-defined pointer from the allocator.
+ *  @return The address of the newly allocated memory block, or `NULL` if an
+ *  error occurred.
+ *
+ *  @pointer_lifetime The returned memory block must be valid at least until it
+ *  is deallocated.
+ *
+ *  @reentrancy This function should not call any GLFW function.
+ *
+ *  @thread_safety This function must support being called from any thread that calls GLFW
+ *  functions.
+ *
+ *  @sa @ref init_allocator
+ *  @sa @ref GLFWallocator
+ *
+ *  @since Added in version 3.4.
+ *
+ *  @ingroup init
+ */
+typedef void* (* GLFWallocatefun)(size_t size, void* user);
+
+/*! @brief The function pointer type for memory reallocation callbacks.
+ *
+ *  This is the function pointer type for memory reallocation callbacks.
+ *  A memory reallocation callback function has the following signature:
+ *  @code
+ *  void* function_name(void* block, size_t size, void* user)
+ *  @endcode
+ *
+ *  This function must return a memory block at least `size` bytes long, or
+ *  `NULL` if allocation failed.  Note that not all parts of GLFW handle allocation
+ *  failures gracefully yet.
+ *
+ *  This function must support being called during @ref glfwInit but before the library is
+ *  flagged as initialized, as well as during @ref glfwTerminate after the library is no
+ *  longer flagged as initialized.
+ *
+ *  Any memory allocated via this function will be deallocated via the same allocator
+ *  during library termination or earlier.
+ *
+ *  Any memory allocated via this function must be suitably aligned for any object type.
+ *  If you are using C99 or earlier, this alignment is platform-dependent but will be the
+ *  same as what `realloc` provides.  If you are using C11 or later, this is the value of
+ *  `alignof(max_align_t)`.
+ *
+ *  The block address will never be `NULL` and the size will always be greater than zero.
+ *  Reallocations of a block to size zero are converted into deallocations before reaching
+ *  the custom allocator.  Reallocations of `NULL` to a non-zero size are converted into
+ *  regular allocations before reaching the custom allocator.
+ *
+ *  If this function returns `NULL`, GLFW will emit @ref GLFW_OUT_OF_MEMORY.
+ *
+ *  This function must not call any GLFW function.
+ *
+ *  @param[in] block The address of the memory block to reallocate.
+ *  @param[in] size The new minimum size, in bytes, of the memory block.
+ *  @param[in] user The user-defined pointer from the allocator.
+ *  @return The address of the newly allocated or resized memory block, or
+ *  `NULL` if an error occurred.
+ *
+ *  @pointer_lifetime The returned memory block must be valid at least until it
+ *  is deallocated.
+ *
+ *  @reentrancy This function should not call any GLFW function.
+ *
+ *  @thread_safety This function must support being called from any thread that calls GLFW
+ *  functions.
+ *
+ *  @sa @ref init_allocator
+ *  @sa @ref GLFWallocator
+ *
+ *  @since Added in version 3.4.
+ *
+ *  @ingroup init
+ */
+typedef void* (* GLFWreallocatefun)(void* block, size_t size, void* user);
+
+/*! @brief The function pointer type for memory deallocation callbacks.
+ *
+ *  This is the function pointer type for memory deallocation callbacks.
+ *  A memory deallocation callback function has the following signature:
+ *  @code
+ *  void function_name(void* block, void* user)
+ *  @endcode
+ *
+ *  This function may deallocate the specified memory block.  This memory block
+ *  will have been allocated with the same allocator.
+ *
+ *  This function must support being called during @ref glfwInit but before the library is
+ *  flagged as initialized, as well as during @ref glfwTerminate after the library is no
+ *  longer flagged as initialized.
+ *
+ *  The block address will never be `NULL`.  Deallocations of `NULL` are filtered out
+ *  before reaching the custom allocator.
+ *
+ *  If this function returns `NULL`, GLFW will emit @ref GLFW_OUT_OF_MEMORY.
+ *
+ *  This function must not call any GLFW function.
+ *
+ *  @param[in] block The address of the memory block to deallocate.
+ *  @param[in] user The user-defined pointer from the allocator.
+ *
+ *  @pointer_lifetime The specified memory block will not be accessed by GLFW
+ *  after this function is called.
+ *
+ *  @reentrancy This function should not call any GLFW function.
+ *
+ *  @thread_safety This function must support being called from any thread that calls GLFW
+ *  functions.
+ *
+ *  @sa @ref init_allocator
+ *  @sa @ref GLFWallocator
+ *
+ *  @since Added in version 3.4.
+ *
+ *  @ingroup init
+ */
+typedef void (* GLFWdeallocatefun)(void* block, void* user);
+
 /*! @brief The function pointer type for error callbacks.
  *
  *  This is the function pointer type for error callbacks.  An error callback
@@ -1521,7 +1880,7 @@
  *
  *  @param[in] window The window that received the event.
  *  @param[in] key The [keyboard key](@ref keys) that was pressed or released.
- *  @param[in] scancode The system-specific scancode of the key.
+ *  @param[in] scancode The platform-specific scancode of the key.
  *  @param[in] action `GLFW_PRESS`, `GLFW_RELEASE` or `GLFW_REPEAT`.  Future
  *  releases may add more actions.
  *  @param[in] mods Bit field describing which [modifier keys](@ref mods) were
@@ -1763,6 +2122,38 @@
     float axes[6];
 } GLFWgamepadstate;
 
+/*! @brief Custom heap memory allocator.
+ *
+ *  This describes a custom heap memory allocator for GLFW.  To set an allocator, pass it
+ *  to @ref glfwInitAllocator before initializing the library.
+ *
+ *  @sa @ref init_allocator
+ *  @sa @ref glfwInitAllocator
+ *
+ *  @since Added in version 3.4.
+ *
+ *  @ingroup init
+ */
+typedef struct GLFWallocator
+{
+    /*! The memory allocation function.  See @ref GLFWallocatefun for details about
+     *  allocation function.
+     */
+    GLFWallocatefun allocate;
+    /*! The memory reallocation function.  See @ref GLFWreallocatefun for details about
+     *  reallocation function.
+     */
+    GLFWreallocatefun reallocate;
+    /*! The memory deallocation function.  See @ref GLFWdeallocatefun for details about
+     *  deallocation function.
+     */
+    GLFWdeallocatefun deallocate;
+    /*! The user pointer for this custom allocator.  This value will be passed to the
+     *  allocator functions.
+     */
+    void* user;
+} GLFWallocator;
+
 
 /*************************************************************************
  * GLFW API functions
@@ -1781,16 +2172,36 @@
  *  Additional calls to this function after successful initialization but before
  *  termination will return `GLFW_TRUE` immediately.
  *
+ *  The @ref GLFW_PLATFORM init hint controls which platforms are considered during
+ *  initialization.  This also depends on which platforms the library was compiled to
+ *  support.
+ *
  *  @return `GLFW_TRUE` if successful, or `GLFW_FALSE` if an
  *  [error](@ref error_handling) occurred.
  *
- *  @errors Possible errors include @ref GLFW_PLATFORM_ERROR.
+ *  @errors Possible errors include @ref GLFW_PLATFORM_UNAVAILABLE and @ref
+ *  GLFW_PLATFORM_ERROR.
  *
  *  @remark @macos This function will change the current directory of the
  *  application to the `Contents/Resources` subdirectory of the application's
  *  bundle, if present.  This can be disabled with the @ref
  *  GLFW_COCOA_CHDIR_RESOURCES init hint.
  *
+ *  @remark @macos This function will create the main menu and dock icon for the
+ *  application.  If GLFW finds a `MainMenu.nib` it is loaded and assumed to
+ *  contain a menu bar.  Otherwise a minimal menu bar is created manually with
+ *  common commands like Hide, Quit and About.  The About entry opens a minimal
+ *  about dialog with information from the application's bundle.  The menu bar
+ *  and dock icon can be disabled entirely with the @ref GLFW_COCOA_MENUBAR init
+ *  hint.
+ *
+ *  @remark __Wayland, X11:__ If the library was compiled with support for both
+ *  Wayland and X11, and the @ref GLFW_PLATFORM init hint is set to
+ *  `GLFW_ANY_PLATFORM`, the `XDG_SESSION_TYPE` environment variable affects
+ *  which platform is picked.  If the environment variable is not set, or is set
+ *  to something other than `wayland` or `x11`, the regular detection mechanism
+ *  will be used instead.
+ *
  *  @remark @x11 This function will set the `LC_CTYPE` category of the
  *  application locale according to the current environment if that category is
  *  still "C".  This is because the "C" locale breaks Unicode text input.
@@ -1798,6 +2209,8 @@
  *  @thread_safety This function must only be called from the main thread.
  *
  *  @sa @ref intro_init
+ *  @sa @ref glfwInitHint
+ *  @sa @ref glfwInitAllocator
  *  @sa @ref glfwTerminate
  *
  *  @since Added in version 1.0.
@@ -1872,6 +2285,85 @@
  */
 GLFWAPI void glfwInitHint(int hint, int value);
 
+/*! @brief Sets the init allocator to the desired value.
+ *
+ *  To use the default allocator, call this function with a `NULL` argument.
+ *
+ *  If you specify an allocator struct, every member must be a valid function
+ *  pointer.  If any member is `NULL`, this function will emit @ref
+ *  GLFW_INVALID_VALUE and the init allocator will be unchanged.
+ *
+ *  The functions in the allocator must fulfil a number of requirements.  See the
+ *  documentation for @ref GLFWallocatefun, @ref GLFWreallocatefun and @ref
+ *  GLFWdeallocatefun for details.
+ *
+ *  @param[in] allocator The allocator to use at the next initialization, or
+ *  `NULL` to use the default one.
+ *
+ *  @errors Possible errors include @ref GLFW_INVALID_VALUE.
+ *
+ *  @pointer_lifetime The specified allocator is copied before this function
+ *  returns.
+ *
+ *  @thread_safety This function must only be called from the main thread.
+ *
+ *  @sa @ref init_allocator
+ *  @sa @ref glfwInit
+ *
+ *  @since Added in version 3.4.
+ *
+ *  @ingroup init
+ */
+GLFWAPI void glfwInitAllocator(const GLFWallocator* allocator);
+
+#if defined(VK_VERSION_1_0)
+
+/*! @brief Sets the desired Vulkan `vkGetInstanceProcAddr` function.
+ *
+ *  This function sets the `vkGetInstanceProcAddr` function that GLFW will use for all
+ *  Vulkan related entry point queries.
+ *
+ *  This feature is mostly useful on macOS, if your copy of the Vulkan loader is in
+ *  a location where GLFW cannot find it through dynamic loading, or if you are still
+ *  using the static library version of the loader.
+ *
+ *  If set to `NULL`, GLFW will try to load the Vulkan loader dynamically by its standard
+ *  name and get this function from there.  This is the default behavior.
+ *
+ *  The standard name of the loader is `vulkan-1.dll` on Windows, `libvulkan.so.1` on
+ *  Linux and other Unix-like systems and `libvulkan.1.dylib` on macOS.  If your code is
+ *  also loading it via these names then you probably don't need to use this function.
+ *
+ *  The function address you set is never reset by GLFW, but it only takes effect during
+ *  initialization.  Once GLFW has been initialized, any updates will be ignored until the
+ *  library is terminated and initialized again.
+ *
+ *  @param[in] loader The address of the function to use, or `NULL`.
+ *
+ *  @par Loader function signature
+ *  @code
+ *  PFN_vkVoidFunction vkGetInstanceProcAddr(VkInstance instance, const char* name)
+ *  @endcode
+ *  For more information about this function, see the
+ *  [Vulkan Registry](https://www.khronos.org/registry/vulkan/).
+ *
+ *  @errors None.
+ *
+ *  @remark This function may be called before @ref glfwInit.
+ *
+ *  @thread_safety This function must only be called from the main thread.
+ *
+ *  @sa @ref vulkan_loader
+ *  @sa @ref glfwInit
+ *
+ *  @since Added in version 3.4.
+ *
+ *  @ingroup init
+ */
+GLFWAPI void glfwInitVulkanLoader(PFN_vkGetInstanceProcAddr loader);
+
+#endif /*VK_VERSION_1_0*/
+
 /*! @brief Retrieves the version of the GLFW library.
  *
  *  This function retrieves the major, minor and revision numbers of the GLFW
@@ -1902,15 +2394,18 @@
 /*! @brief Returns a string describing the compile-time configuration.
  *
  *  This function returns the compile-time generated
- *  [version string](@ref intro_version_string) of the GLFW library binary.  It
- *  describes the version, platform, compiler and any platform-specific
- *  compile-time options.  It should not be confused with the OpenGL or OpenGL
- *  ES version string, queried with `glGetString`.
+ *  [version string](@ref intro_version_string) of the GLFW library binary.  It describes
+ *  the version, platforms, compiler and any platform or operating system specific
+ *  compile-time options.  It should not be confused with the OpenGL or OpenGL ES version
+ *  string, queried with `glGetString`.
  *
  *  __Do not use the version string__ to parse the GLFW library version.  The
  *  @ref glfwGetVersion function provides the version of the running library
  *  binary in numerical format.
  *
+ *  __Do not use the version string__ to parse what platforms are supported.  The @ref
+ *  glfwPlatformSupported function lets you query platform support.
+ *
  *  @return The ASCII encoded GLFW version string.
  *
  *  @errors None.
@@ -2007,6 +2502,51 @@
  */
 GLFWAPI GLFWerrorfun glfwSetErrorCallback(GLFWerrorfun callback);
 
+/*! @brief Returns the currently selected platform.
+ *
+ *  This function returns the platform that was selected during initialization.  The
+ *  returned value will be one of `GLFW_PLATFORM_WIN32`, `GLFW_PLATFORM_COCOA`,
+ *  `GLFW_PLATFORM_WAYLAND`, `GLFW_PLATFORM_X11` or `GLFW_PLATFORM_NULL`.
+ *
+ *  @return The currently selected platform, or zero if an error occurred.
+ *
+ *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
+ *
+ *  @thread_safety This function may be called from any thread.
+ *
+ *  @sa @ref platform
+ *  @sa @ref glfwPlatformSupported
+ *
+ *  @since Added in version 3.4.
+ *
+ *  @ingroup init
+ */
+GLFWAPI int glfwGetPlatform(void);
+
+/*! @brief Returns whether the library includes support for the specified platform.
+ *
+ *  This function returns whether the library was compiled with support for the specified
+ *  platform.  The platform must be one of `GLFW_PLATFORM_WIN32`, `GLFW_PLATFORM_COCOA`,
+ *  `GLFW_PLATFORM_WAYLAND`, `GLFW_PLATFORM_X11` or `GLFW_PLATFORM_NULL`.
+ *
+ *  @param[in] platform The platform to query.
+ *  @return `GLFW_TRUE` if the platform is supported, or `GLFW_FALSE` otherwise.
+ *
+ *  @errors Possible errors include @ref GLFW_INVALID_ENUM.
+ *
+ *  @remark This function may be called before @ref glfwInit.
+ *
+ *  @thread_safety This function may be called from any thread.
+ *
+ *  @sa @ref platform
+ *  @sa @ref glfwGetPlatform
+ *
+ *  @since Added in version 3.4.
+ *
+ *  @ingroup init
+ */
+GLFWAPI int glfwPlatformSupported(int platform);
+
 /*! @brief Returns the currently connected monitors.
  *
  *  This function returns an array of handles for all currently connected
@@ -2090,7 +2630,7 @@
  *  This function returns the position, in screen coordinates, of the upper-left
  *  corner of the work area of the specified monitor along with the work area
  *  size in screen coordinates. The work area is defined as the area of the
- *  monitor not occluded by the operating system task bar where present. If no
+ *  monitor not occluded by the window system task bar where present. If no
  *  task bar exists then the work area is the monitor resolution in screen
  *  coordinates.
  *
@@ -2121,10 +2661,11 @@
  *  This function returns the size, in millimetres, of the display area of the
  *  specified monitor.
  *
- *  Some systems do not provide accurate monitor size information, either
- *  because the monitor
- *  [EDID](https://en.wikipedia.org/wiki/Extended_display_identification_data)
- *  data is incorrect or because the driver does not report it accurately.
+ *  Some platforms do not provide accurate monitor size information, either
+ *  because the monitor [EDID][] data is incorrect or because the driver does
+ *  not report it accurately.
+ *
+ *  [EDID]: https://en.wikipedia.org/wiki/Extended_display_identification_data
  *
  *  Any or all of the size arguments may be `NULL`.  If an error occurs, all
  *  non-`NULL` size arguments will be set to zero.
@@ -2171,6 +2712,9 @@
  *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
  *  GLFW_PLATFORM_ERROR.
  *
+ *  @remark @wayland Fractional scaling information is not yet available for
+ *  monitors, so this function only returns integer content scales.
+ *
  *  @thread_safety This function must only be called from the main thread.
  *
  *  @sa @ref monitor_scale
@@ -2367,11 +2911,11 @@
  *  @param[in] monitor The monitor whose gamma ramp to set.
  *  @param[in] gamma The desired exponent.
  *
- *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
- *  GLFW_INVALID_VALUE and @ref GLFW_PLATFORM_ERROR.
+ *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref GLFW_INVALID_VALUE,
+ *  @ref GLFW_PLATFORM_ERROR and @ref GLFW_FEATURE_UNAVAILABLE (see remarks).
  *
  *  @remark @wayland Gamma handling is a privileged protocol, this function
- *  will thus never be implemented and emits @ref GLFW_PLATFORM_ERROR.
+ *  will thus never be implemented and emits @ref GLFW_FEATURE_UNAVAILABLE.
  *
  *  @thread_safety This function must only be called from the main thread.
  *
@@ -2391,11 +2935,11 @@
  *  @return The current gamma ramp, or `NULL` if an
  *  [error](@ref error_handling) occurred.
  *
- *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
- *  GLFW_PLATFORM_ERROR.
+ *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref GLFW_PLATFORM_ERROR
+ *  and @ref GLFW_FEATURE_UNAVAILABLE (see remarks).
  *
  *  @remark @wayland Gamma handling is a privileged protocol, this function
- *  will thus never be implemented and emits @ref GLFW_PLATFORM_ERROR while
+ *  will thus never be implemented and emits @ref GLFW_FEATURE_UNAVAILABLE while
  *  returning `NULL`.
  *
  *  @pointer_lifetime The returned structure and its arrays are allocated and
@@ -2430,8 +2974,8 @@
  *  @param[in] monitor The monitor whose gamma ramp to set.
  *  @param[in] ramp The gamma ramp to use.
  *
- *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
- *  GLFW_PLATFORM_ERROR.
+ *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref GLFW_PLATFORM_ERROR
+ *  and @ref GLFW_FEATURE_UNAVAILABLE (see remarks).
  *
  *  @remark The size of the specified gamma ramp should match the size of the
  *  current ramp for that monitor.
@@ -2439,7 +2983,7 @@
  *  @remark @win32 The gamma ramp size must be 256.
  *
  *  @remark @wayland Gamma handling is a privileged protocol, this function
- *  will thus never be implemented and emits @ref GLFW_PLATFORM_ERROR.
+ *  will thus never be implemented and emits @ref GLFW_FEATURE_UNAVAILABLE.
  *
  *  @pointer_lifetime The specified gamma ramp is copied before this function
  *  returns.
@@ -2582,10 +3126,10 @@
  *  OpenGL or OpenGL ES context.
  *
  *  By default, newly created windows use the placement recommended by the
- *  window system.  To create the window at a specific position, make it
- *  initially invisible using the [GLFW_VISIBLE](@ref GLFW_VISIBLE_hint) window
- *  hint, set its [position](@ref window_pos) and then [show](@ref window_hide)
- *  it.
+ *  window system.  To create the window at a specific position, set the @ref
+ *  GLFW_POSITION_X and @ref GLFW_POSITION_Y window hints before creation.  To
+ *  restore the default behavior, set either or both hints back to
+ *  `GLFW_ANY_POSITION`.
  *
  *  As long as at least one full screen window is not iconified, the screensaver
  *  is prohibited from starting.
@@ -2625,40 +3169,44 @@
  *  @remark @win32 The context to share resources with must not be current on
  *  any other thread.
  *
- *  @remark @macos The OS only supports forward-compatible core profile contexts
- *  for OpenGL versions 3.2 and later.  Before creating an OpenGL context of
- *  version 3.2 or later you must set the
- *  [GLFW_OPENGL_FORWARD_COMPAT](@ref GLFW_OPENGL_FORWARD_COMPAT_hint) and
- *  [GLFW_OPENGL_PROFILE](@ref GLFW_OPENGL_PROFILE_hint) hints accordingly.
- *  OpenGL 3.0 and 3.1 contexts are not supported at all on macOS.
+ *  @remark @macos The OS only supports core profile contexts for OpenGL
+ *  versions 3.2 and later.  Before creating an OpenGL context of version 3.2 or
+ *  later you must set the [GLFW_OPENGL_PROFILE](@ref GLFW_OPENGL_PROFILE_hint)
+ *  hint accordingly.  OpenGL 3.0 and 3.1 contexts are not supported at all
+ *  on macOS.
  *
  *  @remark @macos The GLFW window has no icon, as it is not a document
  *  window, but the dock icon will be the same as the application bundle's icon.
  *  For more information on bundles, see the
- *  [Bundle Programming Guide](https://developer.apple.com/library/mac/documentation/CoreFoundation/Conceptual/CFBundles/)
- *  in the Mac Developer Library.
+ *  [Bundle Programming Guide][bundle-guide] in the Mac Developer Library.
  *
- *  @remark @macos The first time a window is created the menu bar is created.
- *  If GLFW finds a `MainMenu.nib` it is loaded and assumed to contain a menu
- *  bar.  Otherwise a minimal menu bar is created manually with common commands
- *  like Hide, Quit and About.  The About entry opens a minimal about dialog
- *  with information from the application's bundle.  Menu bar creation can be
- *  disabled entirely with the @ref GLFW_COCOA_MENUBAR init hint.
+ *  [bundle-guide]: https://developer.apple.com/library/mac/documentation/CoreFoundation/Conceptual/CFBundles/
  *
  *  @remark @macos On OS X 10.10 and later the window frame will not be rendered
  *  at full resolution on Retina displays unless the
- *  [GLFW_COCOA_RETINA_FRAMEBUFFER](@ref GLFW_COCOA_RETINA_FRAMEBUFFER_hint)
+ *  [GLFW_SCALE_FRAMEBUFFER](@ref GLFW_SCALE_FRAMEBUFFER_hint)
  *  hint is `GLFW_TRUE` and the `NSHighResolutionCapable` key is enabled in the
  *  application bundle's `Info.plist`.  For more information, see
- *  [High Resolution Guidelines for OS X](https://developer.apple.com/library/mac/documentation/GraphicsAnimation/Conceptual/HighResolutionOSX/Explained/Explained.html)
- *  in the Mac Developer Library.  The GLFW test and example programs use
- *  a custom `Info.plist` template for this, which can be found as
- *  `CMake/MacOSXBundleInfo.plist.in` in the source tree.
+ *  [High Resolution Guidelines for OS X][hidpi-guide] in the Mac Developer
+ *  Library.  The GLFW test and example programs use a custom `Info.plist`
+ *  template for this, which can be found as `CMake/Info.plist.in` in the source
+ *  tree.
+ *
+ *  [hidpi-guide]: https://developer.apple.com/library/mac/documentation/GraphicsAnimation/Conceptual/HighResolutionOSX/Explained/Explained.html
  *
  *  @remark @macos When activating frame autosaving with
  *  [GLFW_COCOA_FRAME_NAME](@ref GLFW_COCOA_FRAME_NAME_hint), the specified
  *  window size and position may be overridden by previously saved values.
  *
+ *  @remark @wayland GLFW uses [libdecor][] where available to create its window
+ *  decorations.  This in turn uses server-side XDG decorations where available
+ *  and provides high quality client-side decorations on compositors like GNOME.
+ *  If both XDG decorations and libdecor are unavailable, GLFW falls back to
+ *  a very simple set of window decorations that only support moving, resizing
+ *  and the window manager's right-click menu.
+ *
+ *  [libdecor]: https://gitlab.freedesktop.org/libdecor/libdecor
+ *
  *  @remark @x11 Some window managers will not respect the placement of
  *  initially hidden windows.
  *
@@ -2675,20 +3223,6 @@
  *  [GLFW_X11_INSTANCE_NAME](@ref GLFW_X11_INSTANCE_NAME_hint) window hints to
  *  override this.
  *
- *  @remark @wayland Compositors should implement the xdg-decoration protocol
- *  for GLFW to decorate the window properly.  If this protocol isn't
- *  supported, or if the compositor prefers client-side decorations, a very
- *  simple fallback frame will be drawn using the wp_viewporter protocol.  A
- *  compositor can still emit close, maximize or fullscreen events, using for
- *  instance a keybind mechanism.  If neither of these protocols is supported,
- *  the window won't be decorated.
- *
- *  @remark @wayland A full screen window will not attempt to change the mode,
- *  no matter what the requested size or refresh rate.
- *
- *  @remark @wayland Screensaver inhibition requires the idle-inhibit protocol
- *  to be implemented in the user's compositor.
- *
  *  @thread_safety This function must only be called from the main thread.
  *
  *  @sa @ref window_creation
@@ -2771,6 +3305,38 @@
  */
 GLFWAPI void glfwSetWindowShouldClose(GLFWwindow* window, int value);
 
+/*! @brief Returns the title of the specified window.
+ *
+ *  This function returns the window title, encoded as UTF-8, of the specified
+ *  window.  This is the title set previously by @ref glfwCreateWindow
+ *  or @ref glfwSetWindowTitle.
+ *
+ *  @param[in] window The window to query.
+ *  @return The UTF-8 encoded window title, or `NULL` if an
+ *  [error](@ref error_handling) occurred.
+ *
+ *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
+ *
+ *  @remark The returned title is currently a copy of the title last set by @ref
+ *  glfwCreateWindow or @ref glfwSetWindowTitle.  It does not include any
+ *  additional text which may be appended by the platform or another program.
+ *
+ *  @pointer_lifetime The returned string is allocated and freed by GLFW.  You
+ *  should not free it yourself.  It is valid until the next call to @ref
+ *  glfwGetWindowTitle or @ref glfwSetWindowTitle, or until the library is
+ *  terminated.
+ *
+ *  @thread_safety This function must only be called from the main thread.
+ *
+ *  @sa @ref window_title
+ *  @sa @ref glfwSetWindowTitle
+ *
+ *  @since Added in version 3.4.
+ *
+ *  @ingroup window
+ */
+GLFWAPI const char* glfwGetWindowTitle(GLFWwindow* window);
+
 /*! @brief Sets the title of the specified window.
  *
  *  This function sets the window title, encoded as UTF-8, of the specified
@@ -2788,6 +3354,7 @@
  *  @thread_safety This function must only be called from the main thread.
  *
  *  @sa @ref window_title
+ *  @sa @ref glfwGetWindowTitle
  *
  *  @since Added in version 1.0.
  *  @glfw3 Added window handle parameter.
@@ -2818,20 +3385,22 @@
  *  count is zero.
  *
  *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
- *  GLFW_INVALID_VALUE and @ref GLFW_PLATFORM_ERROR.
+ *  GLFW_INVALID_VALUE, @ref GLFW_PLATFORM_ERROR and @ref
+ *  GLFW_FEATURE_UNAVAILABLE (see remarks).
  *
  *  @pointer_lifetime The specified image data is copied before this function
  *  returns.
  *
- *  @remark @macos The GLFW window has no icon, as it is not a document
- *  window, so this function does nothing.  The dock icon will be the same as
+ *  @remark @macos Regular windows do not have icons on macOS.  This function
+ *  will emit @ref GLFW_FEATURE_UNAVAILABLE.  The dock icon will be the same as
  *  the application bundle's icon.  For more information on bundles, see the
- *  [Bundle Programming Guide](https://developer.apple.com/library/mac/documentation/CoreFoundation/Conceptual/CFBundles/)
- *  in the Mac Developer Library.
+ *  [Bundle Programming Guide][bundle-guide] in the Mac Developer Library.
+ *
+ *  [bundle-guide]: https://developer.apple.com/library/mac/documentation/CoreFoundation/Conceptual/CFBundles/
  *
  *  @remark @wayland There is no existing protocol to change an icon, the
  *  window will thus inherit the one defined in the application's desktop file.
- *  This function always emits @ref GLFW_PLATFORM_ERROR.
+ *  This function will emit @ref GLFW_FEATURE_UNAVAILABLE.
  *
  *  @thread_safety This function must only be called from the main thread.
  *
@@ -2857,12 +3426,12 @@
  *  @param[out] ypos Where to store the y-coordinate of the upper-left corner of
  *  the content area, or `NULL`.
  *
- *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
- *  GLFW_PLATFORM_ERROR.
+ *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
+ *  GLFW_PLATFORM_ERROR and @ref GLFW_FEATURE_UNAVAILABLE (see remarks).
  *
  *  @remark @wayland There is no way for an application to retrieve the global
- *  position of its windows, this function will always emit @ref
- *  GLFW_PLATFORM_ERROR.
+ *  position of its windows.  This function will emit @ref
+ *  GLFW_FEATURE_UNAVAILABLE.
  *
  *  @thread_safety This function must only be called from the main thread.
  *
@@ -2891,12 +3460,12 @@
  *  @param[in] xpos The x-coordinate of the upper-left corner of the content area.
  *  @param[in] ypos The y-coordinate of the upper-left corner of the content area.
  *
- *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
- *  GLFW_PLATFORM_ERROR.
+ *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
+ *  GLFW_PLATFORM_ERROR and @ref GLFW_FEATURE_UNAVAILABLE (see remarks).
  *
  *  @remark @wayland There is no way for an application to set the global
- *  position of its windows, this function will always emit @ref
- *  GLFW_PLATFORM_ERROR.
+ *  position of its windows.  This function will emit @ref
+ *  GLFW_FEATURE_UNAVAILABLE.
  *
  *  @thread_safety This function must only be called from the main thread.
  *
@@ -3051,9 +3620,6 @@
  *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
  *  GLFW_PLATFORM_ERROR.
  *
- *  @remark @wayland A full screen window will not attempt to change the mode,
- *  no matter what the requested size.
- *
  *  @thread_safety This function must only be called from the main thread.
  *
  *  @sa @ref window_size
@@ -3143,7 +3709,7 @@
  *  regardless of their DPI and scaling settings.  This relies on the system DPI
  *  and scaling settings being somewhat correct.
  *
- *  On systems where each monitors can have its own content scale, the window
+ *  On platforms where each monitors can have its own content scale, the window
  *  content scale will depend on which monitor the system considers the window
  *  to be on.
  *
@@ -3208,8 +3774,11 @@
  *  @param[in] window The window to set the opacity for.
  *  @param[in] opacity The desired opacity of the specified window.
  *
- *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
- *  GLFW_PLATFORM_ERROR.
+ *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
+ *  GLFW_PLATFORM_ERROR and @ref GLFW_FEATURE_UNAVAILABLE (see remarks).
+ *
+ *  @remark @wayland There is no way to set an opacity factor for a window.
+ *  This function will emit @ref GLFW_FEATURE_UNAVAILABLE.
  *
  *  @thread_safety This function must only be called from the main thread.
  *
@@ -3237,6 +3806,10 @@
  *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
  *  GLFW_PLATFORM_ERROR.
  *
+ *  @remark @wayland Once a window is iconified, @ref glfwRestoreWindow won’t
+ *  be able to restore it.  This is a design decision of the xdg-shell
+ *  protocol.
+ *
  *  @thread_safety This function must only be called from the main thread.
  *
  *  @sa @ref window_iconify
@@ -3381,8 +3954,8 @@
  *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
  *  GLFW_PLATFORM_ERROR.
  *
- *  @remark @wayland It is not possible for an application to bring its windows
- *  to front, this function will always emit @ref GLFW_PLATFORM_ERROR.
+ *  @remark @wayland The compositor will likely ignore focus requests unless
+ *  another window created by the same application already has input focus.
  *
  *  @thread_safety This function must only be called from the main thread.
  *
@@ -3487,9 +4060,6 @@
  *  @remark @wayland The desired window position is ignored, as there is no way
  *  for an application to set this property.
  *
- *  @remark @wayland Setting the window to full screen will not attempt to
- *  change the mode, no matter what the requested size or refresh rate.
- *
  *  @thread_safety This function must only be called from the main thread.
  *
  *  @sa @ref window_monitor
@@ -3549,6 +4119,7 @@
  *  [GLFW_FLOATING](@ref GLFW_FLOATING_attrib),
  *  [GLFW_AUTO_ICONIFY](@ref GLFW_AUTO_ICONIFY_attrib) and
  *  [GLFW_FOCUS_ON_SHOW](@ref GLFW_FOCUS_ON_SHOW_attrib).
+ *  [GLFW_MOUSE_PASSTHROUGH](@ref GLFW_MOUSE_PASSTHROUGH_attrib)
  *
  *  Some of these attributes are ignored for full screen windows.  The new
  *  value will take effect if the window is later made windowed.
@@ -3561,14 +4132,14 @@
  *  @param[in] value `GLFW_TRUE` or `GLFW_FALSE`.
  *
  *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
- *  GLFW_INVALID_ENUM, @ref GLFW_INVALID_VALUE, @ref GLFW_PLATFORM_ERROR.
+ *  GLFW_INVALID_ENUM, @ref GLFW_INVALID_VALUE, @ref GLFW_PLATFORM_ERROR and @ref
+ *  GLFW_FEATURE_UNAVAILABLE (see remarks).
  *
  *  @remark Calling @ref glfwGetWindowAttrib will always return the latest
  *  value, even if that value is ignored by the current mode of the window.
  *
- *  @remark @wayland The [GLFW_FLOATING](@ref GLFW_FLOATING_attrib) window
- *  attribute is not supported.  Setting this will emit @ref
- *  GLFW_PLATFORM_ERROR.
+ *  @remark @wayland The [GLFW_FLOATING](@ref GLFW_FLOATING_attrib) window attribute is
+ *  not supported.  Setting this will emit @ref GLFW_FEATURE_UNAVAILABLE.
  *
  *  @thread_safety This function must only be called from the main thread.
  *
@@ -3823,9 +4394,6 @@
  *
  *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
  *
- *  @remark @wayland The XDG-shell protocol has no event for iconification, so
- *  this callback will never be called.
- *
  *  @thread_safety This function must only be called from the main thread.
  *
  *  @sa @ref window_iconify
@@ -4119,6 +4687,8 @@
  *  - `GLFW_CURSOR_DISABLED` hides and grabs the cursor, providing virtual
  *    and unlimited cursor movement.  This is useful for implementing for
  *    example 3D camera controls.
+ *  - `GLFW_CURSOR_CAPTURED` makes the cursor visible and confines it to the
+ *    content area of the window.
  *
  *  If the mode is `GLFW_STICKY_KEYS`, the value must be either `GLFW_TRUE` to
  *  enable sticky keys, or `GLFW_FALSE` to disable it.  If sticky keys are
@@ -4144,7 +4714,7 @@
  *  If the mode is `GLFW_RAW_MOUSE_MOTION`, the value must be either `GLFW_TRUE`
  *  to enable raw (unscaled and unaccelerated) mouse motion when the cursor is
  *  disabled, or `GLFW_FALSE` to disable it.  If raw motion is not supported,
- *  attempting to set this will emit @ref GLFW_PLATFORM_ERROR.  Call @ref
+ *  attempting to set this will emit @ref GLFW_FEATURE_UNAVAILABLE.  Call @ref
  *  glfwRawMouseMotionSupported to check for support.
  *
  *  @param[in] window The window whose input mode to set.
@@ -4154,7 +4724,8 @@
  *  @param[in] value The new value of the specified input mode.
  *
  *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
- *  GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR.
+ *  GLFW_INVALID_ENUM, @ref GLFW_PLATFORM_ERROR and @ref
+ *  GLFW_FEATURE_UNAVAILABLE (see above).
  *
  *  @thread_safety This function must only be called from the main thread.
  *
@@ -4419,11 +4990,11 @@
  *  @param[in] ypos The desired y-coordinate, relative to the top edge of the
  *  content area.
  *
- *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
- *  GLFW_PLATFORM_ERROR.
+ *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
+ *  GLFW_PLATFORM_ERROR and @ref GLFW_FEATURE_UNAVAILABLE (see remarks).
  *
  *  @remark @wayland This function will only work when the cursor mode is
- *  `GLFW_CURSOR_DISABLED`, otherwise it will do nothing.
+ *  `GLFW_CURSOR_DISABLED`, otherwise it will emit @ref GLFW_FEATURE_UNAVAILABLE.
  *
  *  @thread_safety This function must only be called from the main thread.
  *
@@ -4476,19 +5047,44 @@
 
 /*! @brief Creates a cursor with a standard shape.
  *
- *  Returns a cursor with a [standard shape](@ref shapes), that can be set for
- *  a window with @ref glfwSetCursor.
+ *  Returns a cursor with a standard shape, that can be set for a window with
+ *  @ref glfwSetCursor.  The images for these cursors come from the system
+ *  cursor theme and their exact appearance will vary between platforms.
+ *
+ *  Most of these shapes are guaranteed to exist on every supported platform but
+ *  a few may not be present.  See the table below for details.
+ *
+ *  Cursor shape                   | Windows | macOS | X11    | Wayland
+ *  ------------------------------ | ------- | ----- | ------ | -------
+ *  @ref GLFW_ARROW_CURSOR         | Yes     | Yes   | Yes    | Yes
+ *  @ref GLFW_IBEAM_CURSOR         | Yes     | Yes   | Yes    | Yes
+ *  @ref GLFW_CROSSHAIR_CURSOR     | Yes     | Yes   | Yes    | Yes
+ *  @ref GLFW_POINTING_HAND_CURSOR | Yes     | Yes   | Yes    | Yes
+ *  @ref GLFW_RESIZE_EW_CURSOR     | Yes     | Yes   | Yes    | Yes
+ *  @ref GLFW_RESIZE_NS_CURSOR     | Yes     | Yes   | Yes    | Yes
+ *  @ref GLFW_RESIZE_NWSE_CURSOR   | Yes     | Yes<sup>1</sup> | Maybe<sup>2</sup> | Maybe<sup>2</sup>
+ *  @ref GLFW_RESIZE_NESW_CURSOR   | Yes     | Yes<sup>1</sup> | Maybe<sup>2</sup> | Maybe<sup>2</sup>
+ *  @ref GLFW_RESIZE_ALL_CURSOR    | Yes     | Yes   | Yes    | Yes
+ *  @ref GLFW_NOT_ALLOWED_CURSOR   | Yes     | Yes   | Maybe<sup>2</sup> | Maybe<sup>2</sup>
+ *
+ *  1) This uses a private system API and may fail in the future.
+ *
+ *  2) This uses a newer standard that not all cursor themes support.
+ *
+ *  If the requested shape is not available, this function emits a @ref
+ *  GLFW_CURSOR_UNAVAILABLE error and returns `NULL`.
  *
  *  @param[in] shape One of the [standard shapes](@ref shapes).
  *  @return A new cursor ready to use or `NULL` if an
  *  [error](@ref error_handling) occurred.
  *
  *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
- *  GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR.
+ *  GLFW_INVALID_ENUM, @ref GLFW_CURSOR_UNAVAILABLE and @ref
+ *  GLFW_PLATFORM_ERROR.
  *
  *  @thread_safety This function must only be called from the main thread.
  *
- *  @sa @ref cursor_object
+ *  @sa @ref cursor_standard
  *  @sa @ref glfwCreateCursor
  *
  *  @since Added in version 3.1.
@@ -4845,8 +5441,6 @@
  *
  *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
  *
- *  @remark @wayland File drop is currently unimplemented.
- *
  *  @thread_safety This function must only be called from the main thread.
  *
  *  @sa @ref path_drop
@@ -5313,6 +5907,11 @@
  *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
  *  GLFW_PLATFORM_ERROR.
  *
+ *  @remark @win32 The clipboard on Windows has a single global lock for reading and
+ *  writing.  GLFW tries to acquire it a few times, which is almost always enough.  If it
+ *  cannot acquire the lock then this function emits @ref GLFW_PLATFORM_ERROR and returns.
+ *  It is safe to try this multiple times.
+ *
  *  @pointer_lifetime The specified string is copied before this function
  *  returns.
  *
@@ -5341,6 +5940,11 @@
  *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
  *  GLFW_FORMAT_UNAVAILABLE and @ref GLFW_PLATFORM_ERROR.
  *
+ *  @remark @win32 The clipboard on Windows has a single global lock for reading and
+ *  writing.  GLFW tries to acquire it a few times, which is almost always enough.  If it
+ *  cannot acquire the lock then this function emits @ref GLFW_PLATFORM_ERROR and returns.
+ *  It is safe to try this multiple times.
+ *
  *  @pointer_lifetime The returned string is allocated and freed by GLFW.  You
  *  should not free it yourself.  It is valid until the next call to @ref
  *  glfwGetClipboardString or @ref glfwSetClipboardString, or until the library
@@ -5368,7 +5972,7 @@
  *
  *  The resolution of the timer is system dependent, but is usually on the order
  *  of a few micro- or nanoseconds.  It uses the highest-resolution monotonic
- *  time source on each supported platform.
+ *  time source on each operating system.
  *
  *  @return The current time, in seconds, or zero if an
  *  [error](@ref error_handling) occurred.
@@ -5586,7 +6190,7 @@
  *  GLFW_NO_CURRENT_CONTEXT and @ref GLFW_PLATFORM_ERROR.
  *
  *  @remark This function is not called during context creation, leaving the
- *  swap interval set to whatever is the default on that platform.  This is done
+ *  swap interval set to whatever is the default for that API.  This is done
  *  because some swap interval extensions used by GLFW do not allow the swap
  *  interval to be reset to zero once it has been set to a non-zero value.
  *
@@ -5886,6 +6490,13 @@
  *  @remark @macos This function creates and sets a `CAMetalLayer` instance for
  *  the window content view, which is required for MoltenVK to function.
  *
+ *  @remark @x11 By default GLFW prefers the `VK_KHR_xcb_surface` extension,
+ *  with the `VK_KHR_xlib_surface` extension as a fallback.  You can make
+ *  `VK_KHR_xlib_surface` the preferred extension by setting the
+ *  [GLFW_X11_XCB_VULKAN_SURFACE](@ref GLFW_X11_XCB_VULKAN_SURFACE_hint) init
+ *  hint.  The name of the selected extension, if any, is included in the array
+ *  returned by @ref glfwGetRequiredInstanceExtensions.
+ *
  *  @thread_safety This function may be called from any thread.  For
  *  synchronization details of Vulkan objects, see the Vulkan specification.
  *
diff --git a/include/GLFW/glfw3native.h b/include/GLFW/glfw3native.h
index 7e09389..92f0d32 100644
--- a/include/GLFW/glfw3native.h
+++ b/include/GLFW/glfw3native.h
@@ -1,5 +1,5 @@
 /*************************************************************************
- * GLFW 3.3 - www.glfw.org
+ * GLFW 3.4 - www.glfw.org
  * A library for OpenGL, window and input
  *------------------------------------------------------------------------
  * Copyright (c) 2002-2006 Marcus Geelnard
@@ -169,7 +169,8 @@
  *  of the specified monitor, or `NULL` if an [error](@ref error_handling)
  *  occurred.
  *
- *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
+ *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
+ *  GLFW_PLATFORM_UNAVAILABLE.
  *
  *  @thread_safety This function may be called from any thread.  Access is not
  *  synchronized.
@@ -186,7 +187,8 @@
  *  `\\.\DISPLAY1\Monitor0`) of the specified monitor, or `NULL` if an
  *  [error](@ref error_handling) occurred.
  *
- *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
+ *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
+ *  GLFW_PLATFORM_UNAVAILABLE.
  *
  *  @thread_safety This function may be called from any thread.  Access is not
  *  synchronized.
@@ -202,7 +204,8 @@
  *  @return The `HWND` of the specified window, or `NULL` if an
  *  [error](@ref error_handling) occurred.
  *
- *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
+ *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
+ *  GLFW_PLATFORM_UNAVAILABLE.
  *
  *  @remark The `HDC` associated with the window can be queried with the
  *  [GetDC](https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-getdc)
@@ -228,8 +231,8 @@
  *  @return The `HGLRC` of the specified window, or `NULL` if an
  *  [error](@ref error_handling) occurred.
  *
- *  @errors Possible errors include @ref GLFW_NO_WINDOW_CONTEXT and @ref
- *  GLFW_NOT_INITIALIZED.
+ *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
+ *  GLFW_PLATFORM_UNAVAILABLE and @ref GLFW_NO_WINDOW_CONTEXT.
  *
  *  @remark The `HDC` associated with the window can be queried with the
  *  [GetDC](https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-getdc)
@@ -255,7 +258,8 @@
  *  @return The `CGDirectDisplayID` of the specified monitor, or
  *  `kCGNullDirectDisplay` if an [error](@ref error_handling) occurred.
  *
- *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
+ *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
+ *  GLFW_PLATFORM_UNAVAILABLE.
  *
  *  @thread_safety This function may be called from any thread.  Access is not
  *  synchronized.
@@ -271,7 +275,8 @@
  *  @return The `NSWindow` of the specified window, or `nil` if an
  *  [error](@ref error_handling) occurred.
  *
- *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
+ *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
+ *  GLFW_PLATFORM_UNAVAILABLE.
  *
  *  @thread_safety This function may be called from any thread.  Access is not
  *  synchronized.
@@ -281,6 +286,23 @@
  *  @ingroup native
  */
 GLFWAPI id glfwGetCocoaWindow(GLFWwindow* window);
+
+/*! @brief Returns the `NSView` of the specified window.
+ *
+ *  @return The `NSView` of the specified window, or `nil` if an
+ *  [error](@ref error_handling) occurred.
+ *
+ *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
+ *  GLFW_PLATFORM_UNAVAILABLE.
+ *
+ *  @thread_safety This function may be called from any thread.  Access is not
+ *  synchronized.
+ *
+ *  @since Added in version 3.4.
+ *
+ *  @ingroup native
+ */
+GLFWAPI id glfwGetCocoaView(GLFWwindow* window);
 #endif
 
 #if defined(GLFW_EXPOSE_NATIVE_NSGL)
@@ -289,8 +311,8 @@
  *  @return The `NSOpenGLContext` of the specified window, or `nil` if an
  *  [error](@ref error_handling) occurred.
  *
- *  @errors Possible errors include @ref GLFW_NO_WINDOW_CONTEXT and @ref
- *  GLFW_NOT_INITIALIZED.
+ *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
+ *  GLFW_PLATFORM_UNAVAILABLE and @ref GLFW_NO_WINDOW_CONTEXT.
  *
  *  @thread_safety This function may be called from any thread.  Access is not
  *  synchronized.
@@ -308,7 +330,8 @@
  *  @return The `Display` used by GLFW, or `NULL` if an
  *  [error](@ref error_handling) occurred.
  *
- *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
+ *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
+ *  GLFW_PLATFORM_UNAVAILABLE.
  *
  *  @thread_safety This function may be called from any thread.  Access is not
  *  synchronized.
@@ -324,7 +347,8 @@
  *  @return The `RRCrtc` of the specified monitor, or `None` if an
  *  [error](@ref error_handling) occurred.
  *
- *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
+ *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
+ *  GLFW_PLATFORM_UNAVAILABLE.
  *
  *  @thread_safety This function may be called from any thread.  Access is not
  *  synchronized.
@@ -340,7 +364,8 @@
  *  @return The `RROutput` of the specified monitor, or `None` if an
  *  [error](@ref error_handling) occurred.
  *
- *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
+ *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
+ *  GLFW_PLATFORM_UNAVAILABLE.
  *
  *  @thread_safety This function may be called from any thread.  Access is not
  *  synchronized.
@@ -356,7 +381,8 @@
  *  @return The `Window` of the specified window, or `None` if an
  *  [error](@ref error_handling) occurred.
  *
- *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
+ *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
+ *  GLFW_PLATFORM_UNAVAILABLE.
  *
  *  @thread_safety This function may be called from any thread.  Access is not
  *  synchronized.
@@ -371,8 +397,8 @@
  *
  *  @param[in] string A UTF-8 encoded string.
  *
- *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
- *  GLFW_PLATFORM_ERROR.
+ *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
+ *  GLFW_PLATFORM_UNAVAILABLE and @ref GLFW_PLATFORM_ERROR.
  *
  *  @pointer_lifetime The specified string is copied before this function
  *  returns.
@@ -397,8 +423,8 @@
  *  @return The contents of the selection as a UTF-8 encoded string, or `NULL`
  *  if an [error](@ref error_handling) occurred.
  *
- *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
- *  GLFW_PLATFORM_ERROR.
+ *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
+ *  GLFW_PLATFORM_UNAVAILABLE and @ref GLFW_PLATFORM_ERROR.
  *
  *  @pointer_lifetime The returned string is allocated and freed by GLFW. You
  *  should not free it yourself. It is valid until the next call to @ref
@@ -424,8 +450,8 @@
  *  @return The `GLXContext` of the specified window, or `NULL` if an
  *  [error](@ref error_handling) occurred.
  *
- *  @errors Possible errors include @ref GLFW_NO_WINDOW_CONTEXT and @ref
- *  GLFW_NOT_INITIALIZED.
+ *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
+ *  GLFW_NO_WINDOW_CONTEXT and @ref GLFW_PLATFORM_UNAVAILABLE.
  *
  *  @thread_safety This function may be called from any thread.  Access is not
  *  synchronized.
@@ -441,8 +467,8 @@
  *  @return The `GLXWindow` of the specified window, or `None` if an
  *  [error](@ref error_handling) occurred.
  *
- *  @errors Possible errors include @ref GLFW_NO_WINDOW_CONTEXT and @ref
- *  GLFW_NOT_INITIALIZED.
+ *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
+ *  GLFW_NO_WINDOW_CONTEXT and @ref GLFW_PLATFORM_UNAVAILABLE.
  *
  *  @thread_safety This function may be called from any thread.  Access is not
  *  synchronized.
@@ -460,7 +486,8 @@
  *  @return The `struct wl_display*` used by GLFW, or `NULL` if an
  *  [error](@ref error_handling) occurred.
  *
- *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
+ *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
+ *  GLFW_PLATFORM_UNAVAILABLE.
  *
  *  @thread_safety This function may be called from any thread.  Access is not
  *  synchronized.
@@ -476,7 +503,8 @@
  *  @return The `struct wl_output*` of the specified monitor, or `NULL` if an
  *  [error](@ref error_handling) occurred.
  *
- *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
+ *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
+ *  GLFW_PLATFORM_UNAVAILABLE.
  *
  *  @thread_safety This function may be called from any thread.  Access is not
  *  synchronized.
@@ -492,7 +520,8 @@
  *  @return The main `struct wl_surface*` of the specified window, or `NULL` if
  *  an [error](@ref error_handling) occurred.
  *
- *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
+ *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
+ *  GLFW_PLATFORM_UNAVAILABLE.
  *
  *  @thread_safety This function may be called from any thread.  Access is not
  *  synchronized.
@@ -529,8 +558,8 @@
  *  @return The `EGLContext` of the specified window, or `EGL_NO_CONTEXT` if an
  *  [error](@ref error_handling) occurred.
  *
- *  @errors Possible errors include @ref GLFW_NO_WINDOW_CONTEXT and @ref
- *  GLFW_NOT_INITIALIZED.
+ *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
+ *  GLFW_NO_WINDOW_CONTEXT.
  *
  *  @thread_safety This function may be called from any thread.  Access is not
  *  synchronized.
@@ -546,8 +575,8 @@
  *  @return The `EGLSurface` of the specified window, or `EGL_NO_SURFACE` if an
  *  [error](@ref error_handling) occurred.
  *
- *  @errors Possible errors include @ref GLFW_NO_WINDOW_CONTEXT and @ref
- *  GLFW_NOT_INITIALIZED.
+ *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
+ *  GLFW_NO_WINDOW_CONTEXT.
  *
  *  @thread_safety This function may be called from any thread.  Access is not
  *  synchronized.
@@ -572,8 +601,8 @@
  *  @return `GLFW_TRUE` if successful, or `GLFW_FALSE` if an
  *  [error](@ref error_handling) occurred.
  *
- *  @errors Possible errors include @ref GLFW_NO_WINDOW_CONTEXT and @ref
- *  GLFW_NOT_INITIALIZED.
+ *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
+ *  GLFW_NO_WINDOW_CONTEXT.
  *
  *  @thread_safety This function may be called from any thread.  Access is not
  *  synchronized.
@@ -596,8 +625,8 @@
  *  @return `GLFW_TRUE` if successful, or `GLFW_FALSE` if an
  *  [error](@ref error_handling) occurred.
  *
- *  @errors Possible errors include @ref GLFW_NO_WINDOW_CONTEXT and @ref
- *  GLFW_NOT_INITIALIZED.
+ *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
+ *  GLFW_NO_WINDOW_CONTEXT.
  *
  *  @thread_safety This function may be called from any thread.  Access is not
  *  synchronized.
@@ -613,8 +642,8 @@
  *  @return The `OSMesaContext` of the specified window, or `NULL` if an
  *  [error](@ref error_handling) occurred.
  *
- *  @errors Possible errors include @ref GLFW_NO_WINDOW_CONTEXT and @ref
- *  GLFW_NOT_INITIALIZED.
+ *  @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
+ *  GLFW_NO_WINDOW_CONTEXT.
  *
  *  @thread_safety This function may be called from any thread.  Access is not
  *  synchronized.
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index efd6592..1057a6f 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1,9 +1,24 @@
 
-set(common_HEADERS internal.h mappings.h
-                   "${GLFW_BINARY_DIR}/src/glfw_config.h"
-                   "${GLFW_SOURCE_DIR}/include/GLFW/glfw3.h"
-                   "${GLFW_SOURCE_DIR}/include/GLFW/glfw3native.h")
-set(common_SOURCES context.c init.c input.c monitor.c vulkan.c window.c)
+add_library(glfw ${GLFW_LIBRARY_TYPE}
+                 "${GLFW_SOURCE_DIR}/include/GLFW/glfw3.h"
+                 "${GLFW_SOURCE_DIR}/include/GLFW/glfw3native.h"
+                 internal.h platform.h mappings.h
+                 context.c init.c input.c monitor.c platform.c vulkan.c window.c
+                 egl_context.c osmesa_context.c null_platform.h null_joystick.h
+                 null_init.c null_monitor.c null_window.c null_joystick.c)
+
+# 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
+                                posix_module.c posix_thread.c)
+elseif (WIN32)
+    target_sources(glfw PRIVATE win32_time.h win32_thread.h win32_module.c
+                                win32_time.c win32_thread.c)
+else()
+    target_sources(glfw PRIVATE posix_time.h posix_thread.h posix_module.c
+                                posix_time.c posix_thread.c)
+endif()
 
 add_custom_target(update_mappings
     COMMAND "${CMAKE_COMMAND}" -P "${GLFW_SOURCE_DIR}/CMake/GenerateMappings.cmake" mappings.h.in mappings.h
@@ -14,73 +29,114 @@
 
 set_target_properties(update_mappings PROPERTIES FOLDER "GLFW3")
 
-if (_GLFW_COCOA)
-    set(glfw_HEADERS ${common_HEADERS} cocoa_platform.h cocoa_joystick.h
-                     posix_thread.h nsgl_context.h egl_context.h osmesa_context.h)
-    set(glfw_SOURCES ${common_SOURCES} cocoa_init.m cocoa_joystick.m
-                     cocoa_monitor.m cocoa_window.m cocoa_time.c posix_thread.c
-                     nsgl_context.m egl_context.c osmesa_context.c)
-elseif (_GLFW_WIN32)
-    set(glfw_HEADERS ${common_HEADERS} win32_platform.h win32_joystick.h
-                     wgl_context.h egl_context.h osmesa_context.h)
-    set(glfw_SOURCES ${common_SOURCES} win32_init.c win32_joystick.c
-                     win32_monitor.c win32_time.c win32_thread.c win32_window.c
-                     wgl_context.c egl_context.c osmesa_context.c)
-elseif (_GLFW_X11)
-    set(glfw_HEADERS ${common_HEADERS} x11_platform.h xkb_unicode.h posix_time.h
-                     posix_thread.h glx_context.h egl_context.h osmesa_context.h)
-    set(glfw_SOURCES ${common_SOURCES} x11_init.c x11_monitor.c x11_window.c
-                     xkb_unicode.c posix_time.c posix_thread.c glx_context.c
-                     egl_context.c osmesa_context.c)
-elseif (_GLFW_WAYLAND)
-    set(glfw_HEADERS ${common_HEADERS} wl_platform.h
-                     posix_time.h posix_thread.h xkb_unicode.h egl_context.h
-                     osmesa_context.h)
-    set(glfw_SOURCES ${common_SOURCES} wl_init.c wl_monitor.c wl_window.c
-                     posix_time.c posix_thread.c xkb_unicode.c
-                     egl_context.c osmesa_context.c)
-
-    ecm_add_wayland_client_protocol(glfw_SOURCES
-        PROTOCOL
-        "${WAYLAND_PROTOCOLS_PKGDATADIR}/stable/xdg-shell/xdg-shell.xml"
-        BASENAME xdg-shell)
-    ecm_add_wayland_client_protocol(glfw_SOURCES
-        PROTOCOL
-        "${WAYLAND_PROTOCOLS_PKGDATADIR}/unstable/xdg-decoration/xdg-decoration-unstable-v1.xml"
-        BASENAME xdg-decoration)
-    ecm_add_wayland_client_protocol(glfw_SOURCES
-        PROTOCOL
-        "${WAYLAND_PROTOCOLS_PKGDATADIR}/stable/viewporter/viewporter.xml"
-        BASENAME viewporter)
-    ecm_add_wayland_client_protocol(glfw_SOURCES
-        PROTOCOL
-        "${WAYLAND_PROTOCOLS_PKGDATADIR}/unstable/relative-pointer/relative-pointer-unstable-v1.xml"
-        BASENAME relative-pointer-unstable-v1)
-    ecm_add_wayland_client_protocol(glfw_SOURCES
-        PROTOCOL
-        "${WAYLAND_PROTOCOLS_PKGDATADIR}/unstable/pointer-constraints/pointer-constraints-unstable-v1.xml"
-        BASENAME pointer-constraints-unstable-v1)
-    ecm_add_wayland_client_protocol(glfw_SOURCES
-        PROTOCOL
-        "${WAYLAND_PROTOCOLS_PKGDATADIR}/unstable/idle-inhibit/idle-inhibit-unstable-v1.xml"
-        BASENAME idle-inhibit-unstable-v1)
-elseif (_GLFW_OSMESA)
-    set(glfw_HEADERS ${common_HEADERS} null_platform.h null_joystick.h
-                     posix_time.h posix_thread.h osmesa_context.h)
-    set(glfw_SOURCES ${common_SOURCES} null_init.c null_monitor.c null_window.c
-                     null_joystick.c posix_time.c posix_thread.c osmesa_context.c)
+if (GLFW_BUILD_COCOA)
+    target_compile_definitions(glfw PRIVATE _GLFW_COCOA)
+    target_sources(glfw PRIVATE cocoa_platform.h cocoa_joystick.h cocoa_init.m
+                                cocoa_joystick.m cocoa_monitor.m cocoa_window.m
+                                nsgl_context.m)
 endif()
 
-if (_GLFW_X11 OR _GLFW_WAYLAND)
+if (GLFW_BUILD_WIN32)
+    target_compile_definitions(glfw PRIVATE _GLFW_WIN32)
+    target_sources(glfw PRIVATE win32_platform.h win32_joystick.h win32_init.c
+                                win32_joystick.c win32_monitor.c win32_window.c
+                                wgl_context.c)
+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
+                                x11_monitor.c x11_window.c xkb_unicode.c
+                                glx_context.c)
+endif()
+
+if (GLFW_BUILD_WAYLAND)
+    target_compile_definitions(glfw PRIVATE _GLFW_WAYLAND)
+    target_sources(glfw PRIVATE wl_platform.h xkb_unicode.h wl_init.c
+                                wl_monitor.c wl_window.c xkb_unicode.c)
+endif()
+
+if (GLFW_BUILD_X11 OR GLFW_BUILD_WAYLAND)
     if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
-        set(glfw_HEADERS ${glfw_HEADERS} linux_joystick.h)
-        set(glfw_SOURCES ${glfw_SOURCES} linux_joystick.c)
-    else()
-        set(glfw_HEADERS ${glfw_HEADERS} null_joystick.h)
-        set(glfw_SOURCES ${glfw_SOURCES} null_joystick.c)
+        target_sources(glfw PRIVATE linux_joystick.h linux_joystick.c)
     endif()
+    target_sources(glfw PRIVATE posix_poll.h posix_poll.c)
 endif()
 
+if (GLFW_BUILD_WAYLAND)
+    include(CheckIncludeFiles)
+    include(CheckFunctionExists)
+    check_function_exists(memfd_create HAVE_MEMFD_CREATE)
+    if (HAVE_MEMFD_CREATE)
+        target_compile_definitions(glfw PRIVATE HAVE_MEMFD_CREATE)
+    endif()
+
+    find_program(WAYLAND_SCANNER_EXECUTABLE NAMES wayland-scanner)
+    if (NOT WAYLAND_SCANNER_EXECUTABLE)
+        message(FATAL_ERROR "Failed to find wayland-scanner")
+    endif()
+
+    macro(generate_wayland_protocol protocol_file)
+        set(protocol_path "${GLFW_SOURCE_DIR}/deps/wayland/${protocol_file}")
+
+        string(REGEX REPLACE "\\.xml$" "-client-protocol.h" header_file ${protocol_file})
+        string(REGEX REPLACE "\\.xml$" "-client-protocol-code.h" code_file ${protocol_file})
+
+        add_custom_command(OUTPUT ${header_file}
+            COMMAND "${WAYLAND_SCANNER_EXECUTABLE}" client-header "${protocol_path}" ${header_file}
+            DEPENDS "${protocol_path}"
+            VERBATIM)
+
+        add_custom_command(OUTPUT ${code_file}
+            COMMAND "${WAYLAND_SCANNER_EXECUTABLE}" private-code "${protocol_path}" ${code_file}
+            DEPENDS "${protocol_path}"
+            VERBATIM)
+
+        target_sources(glfw PRIVATE ${header_file} ${code_file})
+    endmacro()
+
+    generate_wayland_protocol("wayland.xml")
+    generate_wayland_protocol("viewporter.xml")
+    generate_wayland_protocol("xdg-shell.xml")
+    generate_wayland_protocol("idle-inhibit-unstable-v1.xml")
+    generate_wayland_protocol("pointer-constraints-unstable-v1.xml")
+    generate_wayland_protocol("relative-pointer-unstable-v1.xml")
+    generate_wayland_protocol("fractional-scale-v1.xml")
+    generate_wayland_protocol("xdg-activation-v1.xml")
+    generate_wayland_protocol("xdg-decoration-unstable-v1.xml")
+endif()
+
+if (WIN32 AND GLFW_BUILD_SHARED_LIBRARY)
+    configure_file(glfw.rc.in glfw.rc @ONLY)
+    target_sources(glfw PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/glfw.rc")
+endif()
+
+if (UNIX AND GLFW_BUILD_SHARED_LIBRARY)
+    # On Unix-like systems, shared libraries can use the soname system.
+    set(GLFW_LIB_NAME glfw)
+else()
+    set(GLFW_LIB_NAME glfw3)
+endif()
+set(GLFW_LIB_NAME_SUFFIX "")
+
+set_target_properties(glfw PROPERTIES
+                      OUTPUT_NAME ${GLFW_LIB_NAME}
+                      VERSION ${GLFW_VERSION_MAJOR}.${GLFW_VERSION_MINOR}
+                      SOVERSION ${GLFW_VERSION_MAJOR}
+                      POSITION_INDEPENDENT_CODE ON
+                      C_STANDARD 99
+                      C_EXTENSIONS OFF
+                      DEFINE_SYMBOL _GLFW_BUILD_DLL
+                      FOLDER "GLFW3")
+
+target_include_directories(glfw PUBLIC
+                           "$<BUILD_INTERFACE:${GLFW_SOURCE_DIR}/include>"
+                           "$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>")
+target_include_directories(glfw PRIVATE
+                           "${GLFW_SOURCE_DIR}/src"
+                           "${GLFW_BINARY_DIR}/src")
+target_link_libraries(glfw PRIVATE Threads::Threads)
+
 # Workaround for CMake not knowing about .m files before version 3.16
 if (CMAKE_VERSION VERSION_LESS "3.16" AND APPLE)
     set_source_files_properties(cocoa_init.m cocoa_joystick.m cocoa_monitor.m
@@ -88,45 +144,105 @@
                                 LANGUAGE C)
 endif()
 
-add_library(glfw ${glfw_SOURCES} ${glfw_HEADERS})
-set_target_properties(glfw PROPERTIES
-                      OUTPUT_NAME ${GLFW_LIB_NAME}
-                      VERSION ${GLFW_VERSION_MAJOR}.${GLFW_VERSION_MINOR}
-                      SOVERSION ${GLFW_VERSION_MAJOR}
-                      POSITION_INDEPENDENT_CODE ON
-                      FOLDER "GLFW3")
-
-if (CMAKE_VERSION VERSION_EQUAL "3.1.0" OR
-    CMAKE_VERSION VERSION_GREATER "3.1.0")
-
-    set_target_properties(glfw PROPERTIES C_STANDARD 99)
-else()
-    # Remove this fallback when removing support for CMake version less than 3.1
-    target_compile_options(glfw PRIVATE
-                           "$<$<C_COMPILER_ID:AppleClang>:-std=c99>"
-                           "$<$<C_COMPILER_ID:Clang>:-std=c99>"
-                           "$<$<C_COMPILER_ID:GNU>:-std=c99>")
+if (GLFW_BUILD_WIN32)
+    list(APPEND glfw_PKG_LIBS "-lgdi32")
 endif()
 
-target_compile_definitions(glfw PRIVATE _GLFW_USE_CONFIG_H)
-target_include_directories(glfw PUBLIC
-                           "$<BUILD_INTERFACE:${GLFW_SOURCE_DIR}/include>"
-                           "$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>")
-target_include_directories(glfw PRIVATE
-                           "${GLFW_SOURCE_DIR}/src"
-                           "${GLFW_BINARY_DIR}/src"
-                           ${glfw_INCLUDE_DIRS})
-target_link_libraries(glfw PRIVATE ${glfw_LIBRARIES})
+if (GLFW_BUILD_COCOA)
+    target_link_libraries(glfw PRIVATE "-framework Cocoa"
+                                       "-framework IOKit"
+                                       "-framework CoreFoundation")
 
-# Make GCC warn about declarations that VS 2010 and 2012 won't accept for all
-# source files that VS will build (Clang ignores this because we set -std=c99)
-if (CMAKE_C_COMPILER_ID STREQUAL "GNU")
-    set_source_files_properties(context.c init.c input.c monitor.c vulkan.c
-                                window.c win32_init.c win32_joystick.c
-                                win32_monitor.c win32_time.c win32_thread.c
-                                win32_window.c wgl_context.c egl_context.c
-                                osmesa_context.c PROPERTIES
-                                COMPILE_FLAGS -Wdeclaration-after-statement)
+    set(glfw_PKG_DEPS "")
+    set(glfw_PKG_LIBS "-framework Cocoa -framework IOKit -framework CoreFoundation")
+endif()
+
+if (GLFW_BUILD_WAYLAND)
+    include(FindPkgConfig)
+
+    pkg_check_modules(Wayland REQUIRED
+        wayland-client>=0.2.7
+        wayland-cursor>=0.2.7
+        wayland-egl>=0.2.7
+        xkbcommon>=0.5.0)
+
+    target_include_directories(glfw PRIVATE ${Wayland_INCLUDE_DIRS})
+
+    if (NOT CMAKE_SYSTEM_NAME STREQUAL "Linux")
+        find_package(EpollShim)
+        if (EPOLLSHIM_FOUND)
+            target_include_directories(glfw PRIVATE ${EPOLLSHIM_INCLUDE_DIRS})
+            target_link_libraries(glfw PRIVATE ${EPOLLSHIM_LIBRARIES})
+        endif()
+    endif()
+endif()
+
+if (GLFW_BUILD_X11)
+    find_package(X11 REQUIRED)
+    target_include_directories(glfw PRIVATE "${X11_X11_INCLUDE_PATH}")
+
+    # Check for XRandR (modern resolution switching and gamma control)
+    if (NOT X11_Xrandr_INCLUDE_PATH)
+        message(FATAL_ERROR "RandR headers not found; install libxrandr development package")
+    endif()
+    target_include_directories(glfw PRIVATE "${X11_Xrandr_INCLUDE_PATH}")
+
+    # Check for Xinerama (legacy multi-monitor support)
+    if (NOT X11_Xinerama_INCLUDE_PATH)
+        message(FATAL_ERROR "Xinerama headers not found; install libxinerama development package")
+    endif()
+    target_include_directories(glfw PRIVATE "${X11_Xinerama_INCLUDE_PATH}")
+
+    # Check for Xkb (X keyboard extension)
+    if (NOT X11_Xkb_INCLUDE_PATH)
+        message(FATAL_ERROR "XKB headers not found; install X11 development package")
+    endif()
+    target_include_directories(glfw PRIVATE "${X11_Xkb_INCLUDE_PATH}")
+
+    # Check for Xcursor (cursor creation from RGBA images)
+    if (NOT X11_Xcursor_INCLUDE_PATH)
+        message(FATAL_ERROR "Xcursor headers not found; install libxcursor development package")
+    endif()
+    target_include_directories(glfw PRIVATE "${X11_Xcursor_INCLUDE_PATH}")
+
+    # Check for XInput (modern HID input)
+    if (NOT X11_Xi_INCLUDE_PATH)
+        message(FATAL_ERROR "XInput headers not found; install libxi development package")
+    endif()
+    target_include_directories(glfw PRIVATE "${X11_Xi_INCLUDE_PATH}")
+
+    # Check for X Shape (custom window input shape)
+    if (NOT X11_Xshape_INCLUDE_PATH)
+        message(FATAL_ERROR "X Shape headers not found; install libxext development package")
+    endif()
+    target_include_directories(glfw PRIVATE "${X11_Xshape_INCLUDE_PATH}")
+endif()
+
+if (UNIX AND NOT APPLE)
+    find_library(RT_LIBRARY rt)
+    mark_as_advanced(RT_LIBRARY)
+    if (RT_LIBRARY)
+        target_link_libraries(glfw PRIVATE "${RT_LIBRARY}")
+        list(APPEND glfw_PKG_LIBS "-lrt")
+    endif()
+
+    find_library(MATH_LIBRARY m)
+    mark_as_advanced(MATH_LIBRARY)
+    if (MATH_LIBRARY)
+        target_link_libraries(glfw PRIVATE "${MATH_LIBRARY}")
+        list(APPEND glfw_PKG_LIBS "-lm")
+    endif()
+
+    if (CMAKE_DL_LIBS)
+        target_link_libraries(glfw PRIVATE "${CMAKE_DL_LIBS}")
+        list(APPEND glfw_PKG_LIBS "-l${CMAKE_DL_LIBS}")
+    endif()
+endif()
+
+if (WIN32)
+    if (GLFW_USE_HYBRID_HPG)
+        target_compile_definitions(glfw PRIVATE _GLFW_USE_HYBRID_HPG)
+    endif()
 endif()
 
 # Enable a reasonable set of warnings
@@ -140,7 +256,7 @@
     target_compile_options(glfw PRIVATE "-Wall")
 endif()
 
-if (_GLFW_WIN32)
+if (GLFW_BUILD_WIN32)
     target_compile_definitions(glfw PRIVATE UNICODE _UNICODE)
 endif()
 
@@ -152,7 +268,27 @@
     target_compile_definitions(glfw PRIVATE WINVER=0x0501)
 endif()
 
-if (BUILD_SHARED_LIBS)
+# Workaround for legacy MinGW not providing XInput and DirectInput
+if (MINGW)
+    include(CheckIncludeFile)
+    check_include_file(dinput.h DINPUT_H_FOUND)
+    check_include_file(xinput.h XINPUT_H_FOUND)
+    if (NOT DINPUT_H_FOUND OR NOT XINPUT_H_FOUND)
+        target_include_directories(glfw PRIVATE "${GLFW_SOURCE_DIR}/deps/mingw")
+    endif()
+endif()
+
+# Workaround for the MS CRT deprecating parts of the standard library
+if (MSVC OR CMAKE_C_SIMULATE_ID STREQUAL "MSVC")
+    target_compile_definitions(glfw PRIVATE _CRT_SECURE_NO_WARNINGS)
+endif()
+
+# Workaround for -std=c99 on Linux disabling _DEFAULT_SOURCE (POSIX 2008 and more)
+if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
+    target_compile_definitions(glfw PRIVATE _DEFAULT_SOURCE)
+endif()
+
+if (GLFW_BUILD_SHARED_LIBRARY)
     if (WIN32)
         if (MINGW)
             # Remove the dependency on the shared version of libgcc
@@ -171,9 +307,35 @@
         set (GLFW_LIB_NAME_SUFFIX "dll")
 
         target_compile_definitions(glfw INTERFACE GLFW_DLL)
-    elseif (APPLE)
-        # Add -fno-common to work around a bug in Apple's GCC
-        target_compile_options(glfw PRIVATE "-fno-common")
+    endif()
+
+    if (MINGW)
+        # Enable link-time exploit mitigation features enabled by default on MSVC
+        include(CheckCCompilerFlag)
+
+        # Compatibility with data execution prevention (DEP)
+        set(CMAKE_REQUIRED_FLAGS "-Wl,--nxcompat")
+        check_c_compiler_flag("" _GLFW_HAS_DEP)
+        if (_GLFW_HAS_DEP)
+            target_link_libraries(glfw PRIVATE "-Wl,--nxcompat")
+        endif()
+
+        # Compatibility with address space layout randomization (ASLR)
+        set(CMAKE_REQUIRED_FLAGS "-Wl,--dynamicbase")
+        check_c_compiler_flag("" _GLFW_HAS_ASLR)
+        if (_GLFW_HAS_ASLR)
+            target_link_libraries(glfw PRIVATE "-Wl,--dynamicbase")
+        endif()
+
+        # Compatibility with 64-bit address space layout randomization (ASLR)
+        set(CMAKE_REQUIRED_FLAGS "-Wl,--high-entropy-va")
+        check_c_compiler_flag("" _GLFW_HAS_64ASLR)
+        if (_GLFW_HAS_64ASLR)
+            target_link_libraries(glfw PRIVATE "-Wl,--high-entropy-va")
+        endif()
+
+        # Clear flags again to avoid breaking later tests
+        set(CMAKE_REQUIRED_FLAGS)
     endif()
 
     if (UNIX)
@@ -182,9 +344,19 @@
     endif()
 endif()
 
-if (MSVC OR CMAKE_C_SIMULATE_ID STREQUAL "MSVC")
-    target_compile_definitions(glfw PRIVATE _CRT_SECURE_NO_WARNINGS)
-endif()
+foreach(arg ${glfw_PKG_DEPS})
+    string(APPEND deps " ${arg}")
+endforeach()
+foreach(arg ${glfw_PKG_LIBS})
+    string(APPEND libs " ${arg}")
+endforeach()
+
+set(GLFW_PKG_CONFIG_REQUIRES_PRIVATE "${deps}" CACHE INTERNAL
+    "GLFW pkg-config Requires.private")
+set(GLFW_PKG_CONFIG_LIBS_PRIVATE "${libs}" CACHE INTERNAL
+    "GLFW pkg-config Libs.private")
+
+configure_file("${GLFW_SOURCE_DIR}/CMake/glfw3.pc.in" glfw3.pc @ONLY)
 
 if (GLFW_INSTALL)
     install(TARGETS glfw
diff --git a/src/cocoa_init.m b/src/cocoa_init.m
index fb094d3..e75a551 100644
--- a/src/cocoa_init.m
+++ b/src/cocoa_init.m
@@ -1,5 +1,5 @@
 //========================================================================
-// GLFW 3.3 macOS - www.glfw.org
+// GLFW 3.4 macOS - www.glfw.org
 //------------------------------------------------------------------------
 // Copyright (c) 2009-2019 Camilla Löwy <elmindreda@glfw.org>
 //
@@ -23,10 +23,11 @@
 //    distribution.
 //
 //========================================================================
-// It is fine to use C99 in this file because it will not be built with VS
-//========================================================================
 
 #include "internal.h"
+
+#if defined(_GLFW_COCOA)
+
 #include <sys/param.h> // For MAXPATHLEN
 
 // Needed for _NSGetProgname
@@ -75,7 +76,6 @@
 //
 static void createMenuBar(void)
 {
-    size_t i;
     NSString* appName = nil;
     NSDictionary* bundleInfo = [[NSBundle mainBundle] infoDictionary];
     NSString* nameKeys[] =
@@ -87,7 +87,7 @@
 
     // Try to figure out what the calling application is called
 
-    for (i = 0;  i < sizeof(nameKeys) / sizeof(nameKeys[0]);  i++)
+    for (size_t i = 0;  i < sizeof(nameKeys) / sizeof(nameKeys[0]);  i++)
     {
         id name = bundleInfo[nameKeys[i]];
         if (name &&
@@ -177,8 +177,6 @@
 //
 static void createKeyTables(void)
 {
-    int scancode;
-
     memset(_glfw.ns.keycodes, -1, sizeof(_glfw.ns.keycodes));
     memset(_glfw.ns.scancodes, -1, sizeof(_glfw.ns.scancodes));
 
@@ -297,7 +295,7 @@
     _glfw.ns.keycodes[0x43] = GLFW_KEY_KP_MULTIPLY;
     _glfw.ns.keycodes[0x4E] = GLFW_KEY_KP_SUBTRACT;
 
-    for (scancode = 0;  scancode < 256;  scancode++)
+    for (int scancode = 0;  scancode < 256;  scancode++)
     {
         // Store the reverse translation for faster key name lookup
         if (_glfw.ns.keycodes[scancode] >= 0)
@@ -307,7 +305,7 @@
 
 // Retrieve Unicode data for the current keyboard layout
 //
-static GLFWbool updateUnicodeDataNS(void)
+static GLFWbool updateUnicodeData(void)
 {
     if (_glfw.ns.inputSource)
     {
@@ -377,7 +375,7 @@
     _glfw.ns.tis.kPropertyUnicodeKeyLayoutData =
         *kPropertyUnicodeKeyLayoutData;
 
-    return updateUnicodeDataNS();
+    return updateUnicodeData();
 }
 
 @interface GLFWHelper : NSObject
@@ -387,7 +385,7 @@
 
 - (void)selectedKeyboardInputSourceChanged:(NSObject* )object
 {
-    updateUnicodeDataNS();
+    updateUnicodeData();
 }
 
 - (void)doNothing:(id)object
@@ -403,9 +401,7 @@
 
 - (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender
 {
-    _GLFWwindow* window;
-
-    for (window = _glfw.windowListHead;  window;  window = window->next)
+    for (_GLFWwindow* window = _glfw.windowListHead;  window;  window = window->next)
         _glfwInputWindowCloseRequest(window);
 
     return NSTerminateCancel;
@@ -413,15 +409,13 @@
 
 - (void)applicationDidChangeScreenParameters:(NSNotification *) notification
 {
-    _GLFWwindow* window;
-
-    for (window = _glfw.windowListHead;  window;  window = window->next)
+    for (_GLFWwindow* window = _glfw.windowListHead;  window;  window = window->next)
     {
         if (window->context.client != GLFW_NO_API)
             [window->context.nsgl.object update];
     }
 
-    _glfwPollMonitorsNS();
+    _glfwPollMonitorsCocoa();
 }
 
 - (void)applicationWillFinishLaunching:(NSNotification *)notification
@@ -444,22 +438,14 @@
 
 - (void)applicationDidFinishLaunching:(NSNotification *)notification
 {
-    _glfw.ns.finishedLaunching = GLFW_TRUE;
-    _glfwPlatformPostEmptyEvent();
-
-    // In case we are unbundled, make us a proper UI application
-    if (_glfw.hints.init.ns.menubar)
-        [NSApp setActivationPolicy:NSApplicationActivationPolicyRegular];
-
+    _glfwPostEmptyEventCocoa();
     [NSApp stop:nil];
 }
 
 - (void)applicationDidHide:(NSNotification *)notification
 {
-    int i;
-
-    for (i = 0;  i < _glfw.monitorCount;  i++)
-        _glfwRestoreVideoModeNS(_glfw.monitors[i]);
+    for (int i = 0;  i < _glfw.monitorCount;  i++)
+        _glfwRestoreVideoModeCocoa(_glfw.monitors[i]);
 }
 
 @end // GLFWApplicationDelegate
@@ -469,7 +455,7 @@
 //////                       GLFW internal API                      //////
 //////////////////////////////////////////////////////////////////////////
 
-void* _glfwLoadLocalVulkanLoaderNS(void)
+void* _glfwLoadLocalVulkanLoaderCocoa(void)
 {
     CFBundleRef bundle = CFBundleGetMainBundle();
     if (!bundle)
@@ -491,7 +477,7 @@
     void* handle = NULL;
 
     if (CFURLGetFileSystemRepresentation(loaderUrl, true, (UInt8*) path, sizeof(path) - 1))
-        handle = _glfw_dlopen(path);
+        handle = _glfwPlatformLoadModule(path);
 
     CFRelease(loaderUrl);
     CFRelease(frameworksUrl);
@@ -503,7 +489,89 @@
 //////                       GLFW platform API                      //////
 //////////////////////////////////////////////////////////////////////////
 
-int _glfwPlatformInit(void)
+GLFWbool _glfwConnectCocoa(int platformID, _GLFWplatform* platform)
+{
+    const _GLFWplatform cocoa =
+    {
+        .platformID = GLFW_PLATFORM_COCOA,
+        .init = _glfwInitCocoa,
+        .terminate = _glfwTerminateCocoa,
+        .getCursorPos = _glfwGetCursorPosCocoa,
+        .setCursorPos = _glfwSetCursorPosCocoa,
+        .setCursorMode = _glfwSetCursorModeCocoa,
+        .setRawMouseMotion = _glfwSetRawMouseMotionCocoa,
+        .rawMouseMotionSupported = _glfwRawMouseMotionSupportedCocoa,
+        .createCursor = _glfwCreateCursorCocoa,
+        .createStandardCursor = _glfwCreateStandardCursorCocoa,
+        .destroyCursor = _glfwDestroyCursorCocoa,
+        .setCursor = _glfwSetCursorCocoa,
+        .getScancodeName = _glfwGetScancodeNameCocoa,
+        .getKeyScancode = _glfwGetKeyScancodeCocoa,
+        .setClipboardString = _glfwSetClipboardStringCocoa,
+        .getClipboardString = _glfwGetClipboardStringCocoa,
+        .initJoysticks = _glfwInitJoysticksCocoa,
+        .terminateJoysticks = _glfwTerminateJoysticksCocoa,
+        .pollJoystick = _glfwPollJoystickCocoa,
+        .getMappingName = _glfwGetMappingNameCocoa,
+        .updateGamepadGUID = _glfwUpdateGamepadGUIDCocoa,
+        .freeMonitor = _glfwFreeMonitorCocoa,
+        .getMonitorPos = _glfwGetMonitorPosCocoa,
+        .getMonitorContentScale = _glfwGetMonitorContentScaleCocoa,
+        .getMonitorWorkarea = _glfwGetMonitorWorkareaCocoa,
+        .getVideoModes = _glfwGetVideoModesCocoa,
+        .getVideoMode = _glfwGetVideoModeCocoa,
+        .getGammaRamp = _glfwGetGammaRampCocoa,
+        .setGammaRamp = _glfwSetGammaRampCocoa,
+        .createWindow = _glfwCreateWindowCocoa,
+        .destroyWindow = _glfwDestroyWindowCocoa,
+        .setWindowTitle = _glfwSetWindowTitleCocoa,
+        .setWindowIcon = _glfwSetWindowIconCocoa,
+        .getWindowPos = _glfwGetWindowPosCocoa,
+        .setWindowPos = _glfwSetWindowPosCocoa,
+        .getWindowSize = _glfwGetWindowSizeCocoa,
+        .setWindowSize = _glfwSetWindowSizeCocoa,
+        .setWindowSizeLimits = _glfwSetWindowSizeLimitsCocoa,
+        .setWindowAspectRatio = _glfwSetWindowAspectRatioCocoa,
+        .getFramebufferSize = _glfwGetFramebufferSizeCocoa,
+        .getWindowFrameSize = _glfwGetWindowFrameSizeCocoa,
+        .getWindowContentScale = _glfwGetWindowContentScaleCocoa,
+        .iconifyWindow = _glfwIconifyWindowCocoa,
+        .restoreWindow = _glfwRestoreWindowCocoa,
+        .maximizeWindow = _glfwMaximizeWindowCocoa,
+        .showWindow = _glfwShowWindowCocoa,
+        .hideWindow = _glfwHideWindowCocoa,
+        .requestWindowAttention = _glfwRequestWindowAttentionCocoa,
+        .focusWindow = _glfwFocusWindowCocoa,
+        .setWindowMonitor = _glfwSetWindowMonitorCocoa,
+        .windowFocused = _glfwWindowFocusedCocoa,
+        .windowIconified = _glfwWindowIconifiedCocoa,
+        .windowVisible = _glfwWindowVisibleCocoa,
+        .windowMaximized = _glfwWindowMaximizedCocoa,
+        .windowHovered = _glfwWindowHoveredCocoa,
+        .framebufferTransparent = _glfwFramebufferTransparentCocoa,
+        .getWindowOpacity = _glfwGetWindowOpacityCocoa,
+        .setWindowResizable = _glfwSetWindowResizableCocoa,
+        .setWindowDecorated = _glfwSetWindowDecoratedCocoa,
+        .setWindowFloating = _glfwSetWindowFloatingCocoa,
+        .setWindowOpacity = _glfwSetWindowOpacityCocoa,
+        .setWindowMousePassthrough = _glfwSetWindowMousePassthroughCocoa,
+        .pollEvents = _glfwPollEventsCocoa,
+        .waitEvents = _glfwWaitEventsCocoa,
+        .waitEventsTimeout = _glfwWaitEventsTimeoutCocoa,
+        .postEmptyEvent = _glfwPostEmptyEventCocoa,
+        .getEGLPlatform = _glfwGetEGLPlatformCocoa,
+        .getEGLNativeDisplay = _glfwGetEGLNativeDisplayCocoa,
+        .getEGLNativeWindow = _glfwGetEGLNativeWindowCocoa,
+        .getRequiredInstanceExtensions = _glfwGetRequiredInstanceExtensionsCocoa,
+        .getPhysicalDevicePresentationSupport = _glfwGetPhysicalDevicePresentationSupportCocoa,
+        .createWindowSurface = _glfwCreateWindowSurfaceCocoa
+    };
+
+    *platform = cocoa;
+    return GLFW_TRUE;
+}
+
+int _glfwInitCocoa(void)
 {
     @autoreleasepool {
 
@@ -513,9 +581,6 @@
                              toTarget:_glfw.ns.helper
                            withObject:nil];
 
-    if (NSApp)
-        _glfw.ns.finishedLaunching = GLFW_TRUE;
-
     [NSApplication sharedApplication];
 
     _glfw.ns.delegate = [[GLFWApplicationDelegate alloc] init];
@@ -564,16 +629,21 @@
     if (!initializeTIS())
         return GLFW_FALSE;
 
-    _glfwInitTimerNS();
-    _glfwInitJoysticksNS();
+    _glfwPollMonitorsCocoa();
 
-    _glfwPollMonitorsNS();
+    if (![[NSRunningApplication currentApplication] isFinishedLaunching])
+        [NSApp run];
+
+    // In case we are unbundled, make us a proper UI application
+    if (_glfw.hints.init.ns.menubar)
+        [NSApp setActivationPolicy:NSApplicationActivationPolicyRegular];
+
     return GLFW_TRUE;
 
     } // autoreleasepool
 }
 
-void _glfwPlatformTerminate(void)
+void _glfwTerminateCocoa(void)
 {
     @autoreleasepool {
 
@@ -612,22 +682,14 @@
     if (_glfw.ns.keyUpMonitor)
         [NSEvent removeMonitor:_glfw.ns.keyUpMonitor];
 
-    free(_glfw.ns.clipboardString);
+    _glfw_free(_glfw.ns.clipboardString);
 
     _glfwTerminateNSGL();
     _glfwTerminateEGL();
     _glfwTerminateOSMesa();
-    _glfwTerminateJoysticksNS();
 
     } // autoreleasepool
 }
 
-const char* _glfwPlatformGetVersionString(void)
-{
-    return _GLFW_VERSION_NUMBER " Cocoa NSGL EGL OSMesa"
-#if defined(_GLFW_BUILD_DLL)
-        " dynamic"
-#endif
-        ;
-}
+#endif // _GLFW_COCOA
 
diff --git a/src/cocoa_joystick.h b/src/cocoa_joystick.h
index 0de8678..2f46dfc 100644
--- a/src/cocoa_joystick.h
+++ b/src/cocoa_joystick.h
@@ -1,5 +1,5 @@
 //========================================================================
-// GLFW 3.3 Cocoa - www.glfw.org
+// GLFW 3.4 Cocoa - www.glfw.org
 //------------------------------------------------------------------------
 // Copyright (c) 2006-2017 Camilla Löwy <elmindreda@glfw.org>
 //
@@ -26,14 +26,10 @@
 
 #include <IOKit/IOKitLib.h>
 #include <IOKit/IOCFPlugIn.h>
-#include <IOKit/hid/IOHIDLib.h>
 #include <IOKit/hid/IOHIDKeys.h>
 
-#define _GLFW_PLATFORM_JOYSTICK_STATE         _GLFWjoystickNS ns
-#define _GLFW_PLATFORM_LIBRARY_JOYSTICK_STATE struct { int dummyJoystick; }
-
-#define _GLFW_PLATFORM_MAPPING_NAME "Mac OS X"
-#define GLFW_BUILD_COCOA_MAPPINGS
+#define GLFW_COCOA_JOYSTICK_STATE         _GLFWjoystickNS ns;
+#define GLFW_COCOA_LIBRARY_JOYSTICK_STATE
 
 // Cocoa-specific per-joystick data
 //
@@ -45,7 +41,9 @@
     CFMutableArrayRef   hats;
 } _GLFWjoystickNS;
 
-
-void _glfwInitJoysticksNS(void);
-void _glfwTerminateJoysticksNS(void);
+GLFWbool _glfwInitJoysticksCocoa(void);
+void _glfwTerminateJoysticksCocoa(void);
+GLFWbool _glfwPollJoystickCocoa(_GLFWjoystick* js, int mode);
+const char* _glfwGetMappingNameCocoa(void);
+void _glfwUpdateGamepadGUIDCocoa(char* guid);
 
diff --git a/src/cocoa_joystick.m b/src/cocoa_joystick.m
index f91cf2f..d5de479 100644
--- a/src/cocoa_joystick.m
+++ b/src/cocoa_joystick.m
@@ -1,5 +1,5 @@
 //========================================================================
-// GLFW 3.3 Cocoa - www.glfw.org
+// GLFW 3.4 Cocoa - www.glfw.org
 //------------------------------------------------------------------------
 // Copyright (c) 2009-2019 Camilla Löwy <elmindreda@glfw.org>
 // Copyright (c) 2012 Torsten Walluhn <tw@mad-cad.net>
@@ -24,11 +24,11 @@
 //    distribution.
 //
 //========================================================================
-// It is fine to use C99 in this file because it will not be built with VS
-//========================================================================
 
 #include "internal.h"
 
+#if defined(_GLFW_COCOA)
+
 #include <unistd.h>
 #include <ctype.h>
 #include <string.h>
@@ -96,20 +96,18 @@
 //
 static void closeJoystick(_GLFWjoystick* js)
 {
-    int i;
-
     _glfwInputJoystick(js, GLFW_DISCONNECTED);
 
-    for (i = 0;  i < CFArrayGetCount(js->ns.axes);  i++)
-        free((void*) CFArrayGetValueAtIndex(js->ns.axes, i));
+    for (int i = 0;  i < CFArrayGetCount(js->ns.axes);  i++)
+        _glfw_free((void*) CFArrayGetValueAtIndex(js->ns.axes, i));
     CFRelease(js->ns.axes);
 
-    for (i = 0;  i < CFArrayGetCount(js->ns.buttons);  i++)
-        free((void*) CFArrayGetValueAtIndex(js->ns.buttons, i));
+    for (int i = 0;  i < CFArrayGetCount(js->ns.buttons);  i++)
+        _glfw_free((void*) CFArrayGetValueAtIndex(js->ns.buttons, i));
     CFRelease(js->ns.buttons);
 
-    for (i = 0;  i < CFArrayGetCount(js->ns.hats);  i++)
-        free((void*) CFArrayGetValueAtIndex(js->ns.hats, i));
+    for (int i = 0;  i < CFArrayGetCount(js->ns.hats);  i++)
+        _glfw_free((void*) CFArrayGetValueAtIndex(js->ns.hats, i));
     CFRelease(js->ns.hats);
 
     _glfwFreeJoystick(js);
@@ -125,7 +123,6 @@
     int jid;
     char name[256];
     char guid[33];
-    CFIndex i;
     CFTypeRef property;
     uint32_t vendor = 0, product = 0, version = 0;
     _GLFWjoystick* js;
@@ -188,7 +185,7 @@
                 name[8], name[9], name[10]);
     }
 
-    for (i = 0;  i < CFArrayGetCount(elements);  i++)
+    for (CFIndex i = 0;  i < CFArrayGetCount(elements);  i++)
     {
         IOHIDElementRef native = (IOHIDElementRef)
             CFArrayGetValueAtIndex(elements, i);
@@ -254,7 +251,7 @@
 
         if (target)
         {
-            _GLFWjoyelementNS* element = calloc(1, sizeof(_GLFWjoyelementNS));
+            _GLFWjoyelementNS* element = _glfw_calloc(1, sizeof(_GLFWjoyelementNS));
             element->native  = native;
             element->usage   = usage;
             element->index   = (int) CFArrayGetCount(target);
@@ -293,9 +290,7 @@
                            void* sender,
                            IOHIDDeviceRef device)
 {
-    int jid;
-
-    for (jid = 0;  jid <= GLFW_JOYSTICK_LAST;  jid++)
+    for (int jid = 0;  jid <= GLFW_JOYSTICK_LAST;  jid++)
     {
         if (_glfw.joysticks[jid].connected && _glfw.joysticks[jid].ns.device == device)
         {
@@ -307,12 +302,10 @@
 
 
 //////////////////////////////////////////////////////////////////////////
-//////                       GLFW internal API                      //////
+//////                       GLFW platform API                      //////
 //////////////////////////////////////////////////////////////////////////
 
-// Initialize joystick interface
-//
-void _glfwInitJoysticksNS(void)
+GLFWbool _glfwInitJoysticksCocoa(void)
 {
     CFMutableArrayRef matching;
     const long usages[] =
@@ -331,7 +324,7 @@
     if (!matching)
     {
         _glfwInputError(GLFW_PLATFORM_ERROR, "Cocoa: Failed to create array");
-        return;
+        return GLFW_FALSE;
     }
 
     for (size_t i = 0;  i < sizeof(usages) / sizeof(long);  i++)
@@ -386,36 +379,30 @@
     // Execute the run loop once in order to register any initially-attached
     // joysticks
     CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0, false);
+    return GLFW_TRUE;
 }
 
-// Close all opened joystick handles
-//
-void _glfwTerminateJoysticksNS(void)
+void _glfwTerminateJoysticksCocoa(void)
 {
-    int jid;
-
-    for (jid = 0;  jid <= GLFW_JOYSTICK_LAST;  jid++)
+    for (int jid = 0;  jid <= GLFW_JOYSTICK_LAST;  jid++)
     {
         if (_glfw.joysticks[jid].connected)
             closeJoystick(&_glfw.joysticks[jid]);
     }
 
-    CFRelease(_glfw.ns.hidManager);
-    _glfw.ns.hidManager = NULL;
+    if (_glfw.ns.hidManager)
+    {
+        CFRelease(_glfw.ns.hidManager);
+        _glfw.ns.hidManager = NULL;
+    }
 }
 
 
-//////////////////////////////////////////////////////////////////////////
-//////                       GLFW platform API                      //////
-//////////////////////////////////////////////////////////////////////////
-
-int _glfwPlatformPollJoystick(_GLFWjoystick* js, int mode)
+GLFWbool _glfwPollJoystickCocoa(_GLFWjoystick* js, int mode)
 {
     if (mode & _GLFW_POLL_AXES)
     {
-        CFIndex i;
-
-        for (i = 0;  i < CFArrayGetCount(js->ns.axes);  i++)
+        for (CFIndex i = 0;  i < CFArrayGetCount(js->ns.axes);  i++)
         {
             _GLFWjoyelementNS* axis = (_GLFWjoyelementNS*)
                 CFArrayGetValueAtIndex(js->ns.axes, i);
@@ -440,9 +427,7 @@
 
     if (mode & _GLFW_POLL_BUTTONS)
     {
-        CFIndex i;
-
-        for (i = 0;  i < CFArrayGetCount(js->ns.buttons);  i++)
+        for (CFIndex i = 0;  i < CFArrayGetCount(js->ns.buttons);  i++)
         {
             _GLFWjoyelementNS* button = (_GLFWjoyelementNS*)
                 CFArrayGetValueAtIndex(js->ns.buttons, i);
@@ -451,7 +436,7 @@
             _glfwInputJoystickButton(js, (int) i, state);
         }
 
-        for (i = 0;  i < CFArrayGetCount(js->ns.hats);  i++)
+        for (CFIndex i = 0;  i < CFArrayGetCount(js->ns.hats);  i++)
         {
             const int states[9] =
             {
@@ -479,7 +464,12 @@
     return js->connected;
 }
 
-void _glfwPlatformUpdateGamepadGUID(char* guid)
+const char* _glfwGetMappingNameCocoa(void)
+{
+    return "Mac OS X";
+}
+
+void _glfwUpdateGamepadGUIDCocoa(char* guid)
 {
     if ((strncmp(guid + 4, "000000000000", 12) == 0) &&
         (strncmp(guid + 20, "000000000000", 12) == 0))
@@ -491,3 +481,5 @@
     }
 }
 
+#endif // _GLFW_COCOA
+
diff --git a/src/cocoa_monitor.m b/src/cocoa_monitor.m
index 7769bb7..641d5f0 100644
--- a/src/cocoa_monitor.m
+++ b/src/cocoa_monitor.m
@@ -1,5 +1,5 @@
 //========================================================================
-// GLFW 3.3 macOS - www.glfw.org
+// GLFW 3.4 macOS - www.glfw.org
 //------------------------------------------------------------------------
 // Copyright (c) 2002-2006 Marcus Geelnard
 // Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.org>
@@ -24,11 +24,11 @@
 //    distribution.
 //
 //========================================================================
-// It is fine to use C99 in this file because it will not be built with VS
-//========================================================================
 
 #include "internal.h"
 
+#if defined(_GLFW_COCOA)
+
 #include <stdlib.h>
 #include <limits.h>
 #include <math.h>
@@ -116,7 +116,7 @@
     const CFIndex size =
         CFStringGetMaximumSizeForEncoding(CFStringGetLength(nameRef),
                                           kCFStringEncodingUTF8);
-    char* name = calloc(size + 1, 1);
+    char* name = _glfw_calloc(size + 1, 1);
     CFStringGetCString(nameRef, name, size, kCFStringEncodingUTF8);
 
     CFRelease(info);
@@ -293,11 +293,11 @@
 
 // Poll for changes in the set of connected monitors
 //
-void _glfwPollMonitorsNS(void)
+void _glfwPollMonitorsCocoa(void)
 {
     uint32_t displayCount;
     CGGetOnlineDisplayList(0, NULL, &displayCount);
-    CGDirectDisplayID* displays = calloc(displayCount, sizeof(CGDirectDisplayID));
+    CGDirectDisplayID* displays = _glfw_calloc(displayCount, sizeof(CGDirectDisplayID));
     CGGetOnlineDisplayList(displayCount, displays, &displayCount);
 
     for (int i = 0;  i < _glfw.monitorCount;  i++)
@@ -307,7 +307,7 @@
     uint32_t disconnectedCount = _glfw.monitorCount;
     if (disconnectedCount)
     {
-        disconnected = calloc(_glfw.monitorCount, sizeof(_GLFWmonitor*));
+        disconnected = _glfw_calloc(_glfw.monitorCount, sizeof(_GLFWmonitor*));
         memcpy(disconnected,
                _glfw.monitors,
                _glfw.monitorCount * sizeof(_GLFWmonitor*));
@@ -359,7 +359,7 @@
         monitor->ns.unitNumber = unitNumber;
         monitor->ns.screen     = screen;
 
-        free(name);
+        _glfw_free(name);
 
         CGDisplayModeRef mode = CGDisplayCopyDisplayMode(displays[i]);
         if (CGDisplayModeGetRefreshRate(mode) == 0.0)
@@ -375,16 +375,16 @@
             _glfwInputMonitor(disconnected[i], GLFW_DISCONNECTED, 0);
     }
 
-    free(disconnected);
-    free(displays);
+    _glfw_free(disconnected);
+    _glfw_free(displays);
 }
 
 // Change the current video mode
 //
-void _glfwSetVideoModeNS(_GLFWmonitor* monitor, const GLFWvidmode* desired)
+void _glfwSetVideoModeCocoa(_GLFWmonitor* monitor, const GLFWvidmode* desired)
 {
     GLFWvidmode current;
-    _glfwPlatformGetVideoMode(monitor, &current);
+    _glfwGetVideoModeCocoa(monitor, &current);
 
     const GLFWvidmode* best = _glfwChooseVideoMode(monitor, desired);
     if (_glfwCompareVideoModes(&current, best) == 0)
@@ -424,7 +424,7 @@
 
 // Restore the previously saved (original) video mode
 //
-void _glfwRestoreVideoModeNS(_GLFWmonitor* monitor)
+void _glfwRestoreVideoModeCocoa(_GLFWmonitor* monitor)
 {
     if (monitor->ns.previousMode)
     {
@@ -443,11 +443,11 @@
 //////                       GLFW platform API                      //////
 //////////////////////////////////////////////////////////////////////////
 
-void _glfwPlatformFreeMonitor(_GLFWmonitor* monitor)
+void _glfwFreeMonitorCocoa(_GLFWmonitor* monitor)
 {
 }
 
-void _glfwPlatformGetMonitorPos(_GLFWmonitor* monitor, int* xpos, int* ypos)
+void _glfwGetMonitorPosCocoa(_GLFWmonitor* monitor, int* xpos, int* ypos)
 {
     @autoreleasepool {
 
@@ -461,8 +461,8 @@
     } // autoreleasepool
 }
 
-void _glfwPlatformGetMonitorContentScale(_GLFWmonitor* monitor,
-                                         float* xscale, float* yscale)
+void _glfwGetMonitorContentScaleCocoa(_GLFWmonitor* monitor,
+                                      float* xscale, float* yscale)
 {
     @autoreleasepool {
 
@@ -483,9 +483,9 @@
     } // autoreleasepool
 }
 
-void _glfwPlatformGetMonitorWorkarea(_GLFWmonitor* monitor,
-                                     int* xpos, int* ypos,
-                                     int* width, int* height)
+void _glfwGetMonitorWorkareaCocoa(_GLFWmonitor* monitor,
+                                  int* xpos, int* ypos,
+                                  int* width, int* height)
 {
     @autoreleasepool {
 
@@ -500,7 +500,7 @@
     if (xpos)
         *xpos = frameRect.origin.x;
     if (ypos)
-        *ypos = _glfwTransformYNS(frameRect.origin.y + frameRect.size.height - 1);
+        *ypos = _glfwTransformYCocoa(frameRect.origin.y + frameRect.size.height - 1);
     if (width)
         *width = frameRect.size.width;
     if (height)
@@ -509,7 +509,7 @@
     } // autoreleasepool
 }
 
-GLFWvidmode* _glfwPlatformGetVideoModes(_GLFWmonitor* monitor, int* count)
+GLFWvidmode* _glfwGetVideoModesCocoa(_GLFWmonitor* monitor, int* count)
 {
     @autoreleasepool {
 
@@ -517,7 +517,7 @@
 
     CFArrayRef modes = CGDisplayCopyAllDisplayModes(monitor->ns.displayID, NULL);
     const CFIndex found = CFArrayGetCount(modes);
-    GLFWvidmode* result = calloc(found, sizeof(GLFWvidmode));
+    GLFWvidmode* result = _glfw_calloc(found, sizeof(GLFWvidmode));
 
     for (CFIndex i = 0;  i < found;  i++)
     {
@@ -549,23 +549,30 @@
     } // autoreleasepool
 }
 
-void _glfwPlatformGetVideoMode(_GLFWmonitor* monitor, GLFWvidmode *mode)
+GLFWbool _glfwGetVideoModeCocoa(_GLFWmonitor* monitor, GLFWvidmode *mode)
 {
     @autoreleasepool {
 
     CGDisplayModeRef native = CGDisplayCopyDisplayMode(monitor->ns.displayID);
+    if (!native)
+    {
+        _glfwInputError(GLFW_PLATFORM_ERROR, "Cocoa: Failed to query display mode");
+        return GLFW_FALSE;
+    }
+
     *mode = vidmodeFromCGDisplayMode(native, monitor->ns.fallbackRefreshRate);
     CGDisplayModeRelease(native);
+    return GLFW_TRUE;
 
     } // autoreleasepool
 }
 
-GLFWbool _glfwPlatformGetGammaRamp(_GLFWmonitor* monitor, GLFWgammaramp* ramp)
+GLFWbool _glfwGetGammaRampCocoa(_GLFWmonitor* monitor, GLFWgammaramp* ramp)
 {
     @autoreleasepool {
 
     uint32_t size = CGDisplayGammaTableCapacity(monitor->ns.displayID);
-    CGGammaValue* values = calloc(size * 3, sizeof(CGGammaValue));
+    CGGammaValue* values = _glfw_calloc(size * 3, sizeof(CGGammaValue));
 
     CGGetDisplayTransferByTable(monitor->ns.displayID,
                                 size,
@@ -583,17 +590,17 @@
         ramp->blue[i]  = (unsigned short) (values[i + size * 2] * 65535);
     }
 
-    free(values);
+    _glfw_free(values);
     return GLFW_TRUE;
 
     } // autoreleasepool
 }
 
-void _glfwPlatformSetGammaRamp(_GLFWmonitor* monitor, const GLFWgammaramp* ramp)
+void _glfwSetGammaRampCocoa(_GLFWmonitor* monitor, const GLFWgammaramp* ramp)
 {
     @autoreleasepool {
 
-    CGGammaValue* values = calloc(ramp->size * 3, sizeof(CGGammaValue));
+    CGGammaValue* values = _glfw_calloc(ramp->size * 3, sizeof(CGGammaValue));
 
     for (unsigned int i = 0;  i < ramp->size;  i++)
     {
@@ -608,7 +615,7 @@
                                 values + ramp->size,
                                 values + ramp->size * 2);
 
-    free(values);
+    _glfw_free(values);
 
     } // autoreleasepool
 }
@@ -622,6 +629,15 @@
 {
     _GLFWmonitor* monitor = (_GLFWmonitor*) handle;
     _GLFW_REQUIRE_INIT_OR_RETURN(kCGNullDirectDisplay);
+
+    if (_glfw.platform.platformID != GLFW_PLATFORM_COCOA)
+    {
+        _glfwInputError(GLFW_PLATFORM_UNAVAILABLE, "Cocoa: Platform not initialized");
+        return kCGNullDirectDisplay;
+    }
+
     return monitor->ns.displayID;
 }
 
+#endif // _GLFW_COCOA
+
diff --git a/src/cocoa_platform.h b/src/cocoa_platform.h
index bb67703..3991455 100644
--- a/src/cocoa_platform.h
+++ b/src/cocoa_platform.h
@@ -1,5 +1,5 @@
 //========================================================================
-// GLFW 3.3 macOS - www.glfw.org
+// GLFW 3.4 macOS - www.glfw.org
 //------------------------------------------------------------------------
 // Copyright (c) 2009-2019 Camilla Löwy <elmindreda@glfw.org>
 //
@@ -25,9 +25,9 @@
 //========================================================================
 
 #include <stdint.h>
-#include <dlfcn.h>
 
 #include <Carbon/Carbon.h>
+#include <IOKit/hid/IOHIDLib.h>
 
 // NOTE: All of NSGL was deprecated in the 10.14 SDK
 //       This disables the pointless warnings for every symbol we use
@@ -46,6 +46,11 @@
 //       We use the newer names in code and replace them with the older names if
 //       the base SDK does not provide the newer names.
 
+#if MAC_OS_X_VERSION_MAX_ALLOWED < 101400
+ #define NSOpenGLContextParameterSwapInterval NSOpenGLCPSwapInterval
+ #define NSOpenGLContextParameterSurfaceOpacity NSOpenGLCPSurfaceOpacity
+#endif
+
 #if MAC_OS_X_VERSION_MAX_ALLOWED < 101200
  #define NSBitmapFormatAlphaNonpremultiplied NSAlphaNonpremultipliedBitmapFormat
  #define NSEventMaskAny NSAnyEventMask
@@ -95,24 +100,13 @@
 typedef VkResult (APIENTRY *PFN_vkCreateMacOSSurfaceMVK)(VkInstance,const VkMacOSSurfaceCreateInfoMVK*,const VkAllocationCallbacks*,VkSurfaceKHR*);
 typedef VkResult (APIENTRY *PFN_vkCreateMetalSurfaceEXT)(VkInstance,const VkMetalSurfaceCreateInfoEXT*,const VkAllocationCallbacks*,VkSurfaceKHR*);
 
-#include "posix_thread.h"
-#include "cocoa_joystick.h"
-#include "nsgl_context.h"
-#include "egl_context.h"
-#include "osmesa_context.h"
+#define GLFW_COCOA_WINDOW_STATE         _GLFWwindowNS  ns;
+#define GLFW_COCOA_LIBRARY_WINDOW_STATE _GLFWlibraryNS ns;
+#define GLFW_COCOA_MONITOR_STATE        _GLFWmonitorNS ns;
+#define GLFW_COCOA_CURSOR_STATE         _GLFWcursorNS  ns;
 
-#define _glfw_dlopen(name) dlopen(name, RTLD_LAZY | RTLD_LOCAL)
-#define _glfw_dlclose(handle) dlclose(handle)
-#define _glfw_dlsym(handle, name) dlsym(handle, name)
-
-#define _GLFW_EGL_NATIVE_WINDOW  ((EGLNativeWindowType) window->ns.layer)
-#define _GLFW_EGL_NATIVE_DISPLAY EGL_DEFAULT_DISPLAY
-
-#define _GLFW_PLATFORM_WINDOW_STATE         _GLFWwindowNS  ns
-#define _GLFW_PLATFORM_LIBRARY_WINDOW_STATE _GLFWlibraryNS ns
-#define _GLFW_PLATFORM_LIBRARY_TIMER_STATE  _GLFWtimerNS   ns
-#define _GLFW_PLATFORM_MONITOR_STATE        _GLFWmonitorNS ns
-#define _GLFW_PLATFORM_CURSOR_STATE         _GLFWcursorNS  ns
+#define GLFW_NSGL_CONTEXT_STATE         _GLFWcontextNSGL nsgl;
+#define GLFW_NSGL_LIBRARY_CONTEXT_STATE _GLFWlibraryNSGL nsgl;
 
 // HIToolbox.framework pointer typedefs
 #define kTISPropertyUnicodeKeyLayoutData _glfw.ns.tis.kPropertyUnicodeKeyLayoutData
@@ -124,6 +118,22 @@
 #define LMGetKbdType _glfw.ns.tis.GetKbdType
 
 
+// NSGL-specific per-context data
+//
+typedef struct _GLFWcontextNSGL
+{
+    id                pixelFormat;
+    id                object;
+} _GLFWcontextNSGL;
+
+// NSGL-specific global data
+//
+typedef struct _GLFWlibraryNSGL
+{
+    // dlopen handle for OpenGL.framework (for glfwGetProcAddress)
+    CFBundleRef     framework;
+} _GLFWlibraryNSGL;
+
 // Cocoa-specific per-window data
 //
 typedef struct _GLFWwindowNS
@@ -135,7 +145,7 @@
 
     GLFWbool        maximized;
     GLFWbool        occluded;
-    GLFWbool        retina;
+    GLFWbool        scaleFramebuffer;
 
     // Cached window properties to filter out duplicate events
     int             width, height;
@@ -154,7 +164,6 @@
 {
     CGEventSourceRef    eventSource;
     id                  delegate;
-    GLFWbool            finishedLaunching;
     GLFWbool            cursorHidden;
     TISInputSourceRef   inputSource;
     IOHIDManagerRef     hidManager;
@@ -200,21 +209,94 @@
     id              object;
 } _GLFWcursorNS;
 
-// Cocoa-specific global timer data
-//
-typedef struct _GLFWtimerNS
-{
-    uint64_t        frequency;
-} _GLFWtimerNS;
 
+GLFWbool _glfwConnectCocoa(int platformID, _GLFWplatform* platform);
+int _glfwInitCocoa(void);
+void _glfwTerminateCocoa(void);
 
-void _glfwInitTimerNS(void);
+GLFWbool _glfwCreateWindowCocoa(_GLFWwindow* window, const _GLFWwndconfig* wndconfig, const _GLFWctxconfig* ctxconfig, const _GLFWfbconfig* fbconfig);
+void _glfwDestroyWindowCocoa(_GLFWwindow* window);
+void _glfwSetWindowTitleCocoa(_GLFWwindow* window, const char* title);
+void _glfwSetWindowIconCocoa(_GLFWwindow* window, int count, const GLFWimage* images);
+void _glfwGetWindowPosCocoa(_GLFWwindow* window, int* xpos, int* ypos);
+void _glfwSetWindowPosCocoa(_GLFWwindow* window, int xpos, int ypos);
+void _glfwGetWindowSizeCocoa(_GLFWwindow* window, int* width, int* height);
+void _glfwSetWindowSizeCocoa(_GLFWwindow* window, int width, int height);
+void _glfwSetWindowSizeLimitsCocoa(_GLFWwindow* window, int minwidth, int minheight, int maxwidth, int maxheight);
+void _glfwSetWindowAspectRatioCocoa(_GLFWwindow* window, int numer, int denom);
+void _glfwGetFramebufferSizeCocoa(_GLFWwindow* window, int* width, int* height);
+void _glfwGetWindowFrameSizeCocoa(_GLFWwindow* window, int* left, int* top, int* right, int* bottom);
+void _glfwGetWindowContentScaleCocoa(_GLFWwindow* window, float* xscale, float* yscale);
+void _glfwIconifyWindowCocoa(_GLFWwindow* window);
+void _glfwRestoreWindowCocoa(_GLFWwindow* window);
+void _glfwMaximizeWindowCocoa(_GLFWwindow* window);
+void _glfwShowWindowCocoa(_GLFWwindow* window);
+void _glfwHideWindowCocoa(_GLFWwindow* window);
+void _glfwRequestWindowAttentionCocoa(_GLFWwindow* window);
+void _glfwFocusWindowCocoa(_GLFWwindow* window);
+void _glfwSetWindowMonitorCocoa(_GLFWwindow* window, _GLFWmonitor* monitor, int xpos, int ypos, int width, int height, int refreshRate);
+GLFWbool _glfwWindowFocusedCocoa(_GLFWwindow* window);
+GLFWbool _glfwWindowIconifiedCocoa(_GLFWwindow* window);
+GLFWbool _glfwWindowVisibleCocoa(_GLFWwindow* window);
+GLFWbool _glfwWindowMaximizedCocoa(_GLFWwindow* window);
+GLFWbool _glfwWindowHoveredCocoa(_GLFWwindow* window);
+GLFWbool _glfwFramebufferTransparentCocoa(_GLFWwindow* window);
+void _glfwSetWindowResizableCocoa(_GLFWwindow* window, GLFWbool enabled);
+void _glfwSetWindowDecoratedCocoa(_GLFWwindow* window, GLFWbool enabled);
+void _glfwSetWindowFloatingCocoa(_GLFWwindow* window, GLFWbool enabled);
+float _glfwGetWindowOpacityCocoa(_GLFWwindow* window);
+void _glfwSetWindowOpacityCocoa(_GLFWwindow* window, float opacity);
+void _glfwSetWindowMousePassthroughCocoa(_GLFWwindow* window, GLFWbool enabled);
 
-void _glfwPollMonitorsNS(void);
-void _glfwSetVideoModeNS(_GLFWmonitor* monitor, const GLFWvidmode* desired);
-void _glfwRestoreVideoModeNS(_GLFWmonitor* monitor);
+void _glfwSetRawMouseMotionCocoa(_GLFWwindow *window, GLFWbool enabled);
+GLFWbool _glfwRawMouseMotionSupportedCocoa(void);
 
-float _glfwTransformYNS(float y);
+void _glfwPollEventsCocoa(void);
+void _glfwWaitEventsCocoa(void);
+void _glfwWaitEventsTimeoutCocoa(double timeout);
+void _glfwPostEmptyEventCocoa(void);
 
-void* _glfwLoadLocalVulkanLoaderNS(void);
+void _glfwGetCursorPosCocoa(_GLFWwindow* window, double* xpos, double* ypos);
+void _glfwSetCursorPosCocoa(_GLFWwindow* window, double xpos, double ypos);
+void _glfwSetCursorModeCocoa(_GLFWwindow* window, int mode);
+const char* _glfwGetScancodeNameCocoa(int scancode);
+int _glfwGetKeyScancodeCocoa(int key);
+GLFWbool _glfwCreateCursorCocoa(_GLFWcursor* cursor, const GLFWimage* image, int xhot, int yhot);
+GLFWbool _glfwCreateStandardCursorCocoa(_GLFWcursor* cursor, int shape);
+void _glfwDestroyCursorCocoa(_GLFWcursor* cursor);
+void _glfwSetCursorCocoa(_GLFWwindow* window, _GLFWcursor* cursor);
+void _glfwSetClipboardStringCocoa(const char* string);
+const char* _glfwGetClipboardStringCocoa(void);
+
+EGLenum _glfwGetEGLPlatformCocoa(EGLint** attribs);
+EGLNativeDisplayType _glfwGetEGLNativeDisplayCocoa(void);
+EGLNativeWindowType _glfwGetEGLNativeWindowCocoa(_GLFWwindow* window);
+
+void _glfwGetRequiredInstanceExtensionsCocoa(char** extensions);
+GLFWbool _glfwGetPhysicalDevicePresentationSupportCocoa(VkInstance instance, VkPhysicalDevice device, uint32_t queuefamily);
+VkResult _glfwCreateWindowSurfaceCocoa(VkInstance instance, _GLFWwindow* window, const VkAllocationCallbacks* allocator, VkSurfaceKHR* surface);
+
+void _glfwFreeMonitorCocoa(_GLFWmonitor* monitor);
+void _glfwGetMonitorPosCocoa(_GLFWmonitor* monitor, int* xpos, int* ypos);
+void _glfwGetMonitorContentScaleCocoa(_GLFWmonitor* monitor, float* xscale, float* yscale);
+void _glfwGetMonitorWorkareaCocoa(_GLFWmonitor* monitor, int* xpos, int* ypos, int* width, int* height);
+GLFWvidmode* _glfwGetVideoModesCocoa(_GLFWmonitor* monitor, int* count);
+GLFWbool _glfwGetVideoModeCocoa(_GLFWmonitor* monitor, GLFWvidmode* mode);
+GLFWbool _glfwGetGammaRampCocoa(_GLFWmonitor* monitor, GLFWgammaramp* ramp);
+void _glfwSetGammaRampCocoa(_GLFWmonitor* monitor, const GLFWgammaramp* ramp);
+
+void _glfwPollMonitorsCocoa(void);
+void _glfwSetVideoModeCocoa(_GLFWmonitor* monitor, const GLFWvidmode* desired);
+void _glfwRestoreVideoModeCocoa(_GLFWmonitor* monitor);
+
+float _glfwTransformYCocoa(float y);
+
+void* _glfwLoadLocalVulkanLoaderCocoa(void);
+
+GLFWbool _glfwInitNSGL(void);
+void _glfwTerminateNSGL(void);
+GLFWbool _glfwCreateContextNSGL(_GLFWwindow* window,
+                                const _GLFWctxconfig* ctxconfig,
+                                const _GLFWfbconfig* fbconfig);
+void _glfwDestroyContextNSGL(_GLFWwindow* window);
 
diff --git a/src/cocoa_time.c b/src/cocoa_time.c
index d390cdc..d56f145 100644
--- a/src/cocoa_time.c
+++ b/src/cocoa_time.c
@@ -1,5 +1,5 @@
 //========================================================================
-// GLFW 3.3 macOS - www.glfw.org
+// GLFW 3.4 macOS - www.glfw.org
 //------------------------------------------------------------------------
 // Copyright (c) 2009-2016 Camilla Löwy <elmindreda@glfw.org>
 //
@@ -23,21 +23,19 @@
 //    distribution.
 //
 //========================================================================
-// It is fine to use C99 in this file because it will not be built with VS
-//========================================================================
 
 #include "internal.h"
 
+#if defined(GLFW_BUILD_COCOA_TIMER)
+
 #include <mach/mach_time.h>
 
 
 //////////////////////////////////////////////////////////////////////////
-//////                       GLFW internal API                      //////
+//////                       GLFW platform API                      //////
 //////////////////////////////////////////////////////////////////////////
 
-// Initialise timer
-//
-void _glfwInitTimerNS(void)
+void _glfwPlatformInitTimer(void)
 {
     mach_timebase_info_data_t info;
     mach_timebase_info(&info);
@@ -45,11 +43,6 @@
     _glfw.timer.ns.frequency = (info.denom * 1e9) / info.numer;
 }
 
-
-//////////////////////////////////////////////////////////////////////////
-//////                       GLFW platform API                      //////
-//////////////////////////////////////////////////////////////////////////
-
 uint64_t _glfwPlatformGetTimerValue(void)
 {
     return mach_absolute_time();
@@ -60,3 +53,5 @@
     return _glfw.timer.ns.frequency;
 }
 
+#endif // GLFW_BUILD_COCOA_TIMER
+
diff --git a/src/cocoa_time.h b/src/cocoa_time.h
new file mode 100644
index 0000000..3512e8b
--- /dev/null
+++ b/src/cocoa_time.h
@@ -0,0 +1,35 @@
+//========================================================================
+// GLFW 3.4 macOS - www.glfw.org
+//------------------------------------------------------------------------
+// Copyright (c) 2009-2021 Camilla Löwy <elmindreda@glfw.org>
+//
+// 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_COCOA_LIBRARY_TIMER_STATE  _GLFWtimerNS   ns;
+
+// Cocoa-specific global timer data
+//
+typedef struct _GLFWtimerNS
+{
+    uint64_t        frequency;
+} _GLFWtimerNS;
+
diff --git a/src/cocoa_window.m b/src/cocoa_window.m
index d7e89cf..0dcf0a3 100644
--- a/src/cocoa_window.m
+++ b/src/cocoa_window.m
@@ -1,5 +1,5 @@
 //========================================================================
-// GLFW 3.3 macOS - www.glfw.org
+// GLFW 3.4 macOS - www.glfw.org
 //------------------------------------------------------------------------
 // Copyright (c) 2009-2019 Camilla Löwy <elmindreda@glfw.org>
 //
@@ -23,11 +23,11 @@
 //    distribution.
 //
 //========================================================================
-// It is fine to use C99 in this file because it will not be built with VS
-//========================================================================
 
 #include "internal.h"
 
+#if defined(_GLFW_COCOA)
+
 #include <float.h>
 #include <string.h>
 
@@ -89,20 +89,20 @@
     if (window->cursorMode == GLFW_CURSOR_DISABLED)
     {
         _glfw.ns.disabledCursorWindow = window;
-        _glfwPlatformGetCursorPos(window,
-                                  &_glfw.ns.restoreCursorPosX,
-                                  &_glfw.ns.restoreCursorPosY);
+        _glfwGetCursorPosCocoa(window,
+                               &_glfw.ns.restoreCursorPosX,
+                               &_glfw.ns.restoreCursorPosY);
         _glfwCenterCursorInContentArea(window);
         CGAssociateMouseAndMouseCursorPosition(false);
     }
     else if (_glfw.ns.disabledCursorWindow == window)
     {
         _glfw.ns.disabledCursorWindow = NULL;
-        _glfwPlatformSetCursorPos(window,
-                                  _glfw.ns.restoreCursorPosX,
-                                  _glfw.ns.restoreCursorPosY);
+        _glfwSetCursorPosCocoa(window,
+                               _glfw.ns.restoreCursorPosX,
+                               _glfw.ns.restoreCursorPosY);
         // NOTE: The matching CGAssociateMouseAndMouseCursorPosition call is
-        //       made in _glfwPlatformSetCursorPos as part of a workaround
+        //       made in _glfwSetCursorPosCocoa as part of a workaround
     }
 
     if (cursorInContentArea(window))
@@ -113,10 +113,10 @@
 //
 static void acquireMonitor(_GLFWwindow* window)
 {
-    _glfwSetVideoModeNS(window->monitor, &window->videoMode);
+    _glfwSetVideoModeCocoa(window->monitor, &window->videoMode);
     const CGRect bounds = CGDisplayBounds(window->monitor->ns.displayID);
     const NSRect frame = NSMakeRect(bounds.origin.x,
-                                    _glfwTransformYNS(bounds.origin.y + bounds.size.height - 1),
+                                    _glfwTransformYCocoa(bounds.origin.y + bounds.size.height - 1),
                                     bounds.size.width,
                                     bounds.size.height);
 
@@ -133,7 +133,7 @@
         return;
 
     _glfwInputMonitorWindow(window->monitor, NULL);
-    _glfwRestoreVideoModeNS(window->monitor);
+    _glfwRestoreVideoModeCocoa(window->monitor);
 }
 
 // Translates macOS key modifiers into GLFW ones
@@ -270,7 +270,7 @@
         _glfwCenterCursorInContentArea(window);
 
     int x, y;
-    _glfwPlatformGetWindowPos(window, &x, &y);
+    _glfwGetWindowPosCocoa(window, &x, &y);
     _glfwInputWindowPos(window, x, y);
 }
 
@@ -302,7 +302,7 @@
 - (void)windowDidResignKey:(NSNotification *)notification
 {
     if (window->monitor && window->autoIconify)
-        _glfwPlatformIconifyWindow(window);
+        _glfwIconifyWindowCocoa(window);
 
     _glfwInputWindowFocus(window, GLFW_FALSE);
 }
@@ -513,7 +513,7 @@
 
     if (xscale != window->ns.xscale || yscale != window->ns.yscale)
     {
-        if (window->ns.retina && window->ns.layer)
+        if (window->ns.scaleFramebuffer && window->ns.layer)
             [window->ns.layer setContentsScale:[window->ns.object backingScaleFactor]];
 
         window->ns.xscale = xscale;
@@ -634,7 +634,7 @@
     const NSUInteger count = [urls count];
     if (count)
     {
-        char** paths = calloc(count, sizeof(char*));
+        char** paths = _glfw_calloc(count, sizeof(char*));
 
         for (NSUInteger i = 0;  i < count;  i++)
             paths[i] = _glfw_strdup([urls[i] fileSystemRepresentation]);
@@ -642,8 +642,8 @@
         _glfwInputDrop(window, (int) count, (const char**) paths);
 
         for (NSUInteger i = 0;  i < count;  i++)
-            free(paths[i]);
-        free(paths);
+            _glfw_free(paths[i]);
+        _glfw_free(paths);
     }
 
     return YES;
@@ -790,13 +790,25 @@
         GLFWvidmode mode;
         int xpos, ypos;
 
-        _glfwPlatformGetVideoMode(window->monitor, &mode);
-        _glfwPlatformGetMonitorPos(window->monitor, &xpos, &ypos);
+        _glfwGetVideoModeCocoa(window->monitor, &mode);
+        _glfwGetMonitorPosCocoa(window->monitor, &xpos, &ypos);
 
         contentRect = NSMakeRect(xpos, ypos, mode.width, mode.height);
     }
     else
-        contentRect = NSMakeRect(0, 0, wndconfig->width, wndconfig->height);
+    {
+        if (wndconfig->xpos == GLFW_ANY_POSITION ||
+            wndconfig->ypos == GLFW_ANY_POSITION)
+        {
+            contentRect = NSMakeRect(0, 0, wndconfig->width, wndconfig->height);
+        }
+        else
+        {
+            const int xpos = wndconfig->xpos;
+            const int ypos = _glfwTransformYCocoa(wndconfig->ypos + wndconfig->height - 1);
+            contentRect = NSMakeRect(xpos, ypos, wndconfig->width, wndconfig->height);
+        }
+    }
 
     NSUInteger styleMask = NSWindowStyleMaskMiniaturizable;
 
@@ -826,10 +838,14 @@
         [window->ns.object setLevel:NSMainMenuWindowLevel + 1];
     else
     {
-        [(NSWindow*) window->ns.object center];
-        _glfw.ns.cascadePoint =
-            NSPointToCGPoint([window->ns.object cascadeTopLeftFromPoint:
-                              NSPointFromCGPoint(_glfw.ns.cascadePoint)]);
+        if (wndconfig->xpos == GLFW_ANY_POSITION ||
+            wndconfig->ypos == GLFW_ANY_POSITION)
+        {
+            [(NSWindow*) window->ns.object center];
+            _glfw.ns.cascadePoint =
+                NSPointToCGPoint([window->ns.object cascadeTopLeftFromPoint:
+                                NSPointFromCGPoint(_glfw.ns.cascadePoint)]);
+        }
 
         if (wndconfig->resizable)
         {
@@ -856,7 +872,7 @@
         [window->ns.object setFrameAutosaveName:@(wndconfig->ns.frameName)];
 
     window->ns.view = [[GLFWContentView alloc] initWithGlfwWindow:window];
-    window->ns.retina = wndconfig->ns.retina;
+    window->ns.scaleFramebuffer = wndconfig->scaleFramebuffer;
 
     if (fbconfig->transparent)
     {
@@ -877,8 +893,8 @@
         [window->ns.object setTabbingMode:NSWindowTabbingModeDisallowed];
 #endif
 
-    _glfwPlatformGetWindowSize(window, &window->ns.width, &window->ns.height);
-    _glfwPlatformGetFramebufferSize(window, &window->ns.fbWidth, &window->ns.fbHeight);
+    _glfwGetWindowSizeCocoa(window, &window->ns.width, &window->ns.height);
+    _glfwGetFramebufferSizeCocoa(window, &window->ns.fbWidth, &window->ns.fbHeight);
 
     return GLFW_TRUE;
 }
@@ -890,7 +906,7 @@
 
 // Transforms a y-coordinate between the CG display and NS screen spaces
 //
-float _glfwTransformYNS(float y)
+float _glfwTransformYCocoa(float y)
 {
     return CGDisplayBounds(CGMainDisplayID()).size.height - y - 1;
 }
@@ -900,16 +916,13 @@
 //////                       GLFW platform API                      //////
 //////////////////////////////////////////////////////////////////////////
 
-int _glfwPlatformCreateWindow(_GLFWwindow* window,
-                              const _GLFWwndconfig* wndconfig,
-                              const _GLFWctxconfig* ctxconfig,
-                              const _GLFWfbconfig* fbconfig)
+GLFWbool _glfwCreateWindowCocoa(_GLFWwindow* window,
+                                const _GLFWwndconfig* wndconfig,
+                                const _GLFWctxconfig* ctxconfig,
+                                const _GLFWfbconfig* fbconfig)
 {
     @autoreleasepool {
 
-    if (!_glfw.ns.finishedLaunching)
-        [NSApp run];
-
     if (!createNativeWindow(window, wndconfig, fbconfig))
         return GLFW_FALSE;
 
@@ -946,10 +959,13 @@
             return GLFW_FALSE;
     }
 
+    if (wndconfig->mousePassthrough)
+        _glfwSetWindowMousePassthroughCocoa(window, GLFW_TRUE);
+
     if (window->monitor)
     {
-        _glfwPlatformShowWindow(window);
-        _glfwPlatformFocusWindow(window);
+        _glfwShowWindowCocoa(window);
+        _glfwFocusWindowCocoa(window);
         acquireMonitor(window);
 
         if (wndconfig->centerCursor)
@@ -959,9 +975,9 @@
     {
         if (wndconfig->visible)
         {
-            _glfwPlatformShowWindow(window);
+            _glfwShowWindowCocoa(window);
             if (wndconfig->focused)
-                _glfwPlatformFocusWindow(window);
+                _glfwFocusWindowCocoa(window);
         }
     }
 
@@ -970,7 +986,7 @@
     } // autoreleasepool
 }
 
-void _glfwPlatformDestroyWindow(_GLFWwindow* window)
+void _glfwDestroyWindowCocoa(_GLFWwindow* window)
 {
     @autoreleasepool {
 
@@ -996,12 +1012,12 @@
     window->ns.object = nil;
 
     // HACK: Allow Cocoa to catch up before returning
-    _glfwPlatformPollEvents();
+    _glfwPollEventsCocoa();
 
     } // autoreleasepool
 }
 
-void _glfwPlatformSetWindowTitle(_GLFWwindow* window, const char* title)
+void _glfwSetWindowTitleCocoa(_GLFWwindow* window, const char* title)
 {
     @autoreleasepool {
     NSString* string = @(title);
@@ -1012,13 +1028,14 @@
     } // autoreleasepool
 }
 
-void _glfwPlatformSetWindowIcon(_GLFWwindow* window,
-                                int count, const GLFWimage* images)
+void _glfwSetWindowIconCocoa(_GLFWwindow* window,
+                             int count, const GLFWimage* images)
 {
-    // Regular windows do not have icons
+    _glfwInputError(GLFW_FEATURE_UNAVAILABLE,
+                    "Cocoa: Regular windows do not have icons on macOS");
 }
 
-void _glfwPlatformGetWindowPos(_GLFWwindow* window, int* xpos, int* ypos)
+void _glfwGetWindowPosCocoa(_GLFWwindow* window, int* xpos, int* ypos)
 {
     @autoreleasepool {
 
@@ -1028,24 +1045,24 @@
     if (xpos)
         *xpos = contentRect.origin.x;
     if (ypos)
-        *ypos = _glfwTransformYNS(contentRect.origin.y + contentRect.size.height - 1);
+        *ypos = _glfwTransformYCocoa(contentRect.origin.y + contentRect.size.height - 1);
 
     } // autoreleasepool
 }
 
-void _glfwPlatformSetWindowPos(_GLFWwindow* window, int x, int y)
+void _glfwSetWindowPosCocoa(_GLFWwindow* window, int x, int y)
 {
     @autoreleasepool {
 
     const NSRect contentRect = [window->ns.view frame];
-    const NSRect dummyRect = NSMakeRect(x, _glfwTransformYNS(y + contentRect.size.height - 1), 0, 0);
+    const NSRect dummyRect = NSMakeRect(x, _glfwTransformYCocoa(y + contentRect.size.height - 1), 0, 0);
     const NSRect frameRect = [window->ns.object frameRectForContentRect:dummyRect];
     [window->ns.object setFrameOrigin:frameRect.origin];
 
     } // autoreleasepool
 }
 
-void _glfwPlatformGetWindowSize(_GLFWwindow* window, int* width, int* height)
+void _glfwGetWindowSizeCocoa(_GLFWwindow* window, int* width, int* height)
 {
     @autoreleasepool {
 
@@ -1059,7 +1076,7 @@
     } // autoreleasepool
 }
 
-void _glfwPlatformSetWindowSize(_GLFWwindow* window, int width, int height)
+void _glfwSetWindowSizeCocoa(_GLFWwindow* window, int width, int height)
 {
     @autoreleasepool {
 
@@ -1081,9 +1098,9 @@
     } // autoreleasepool
 }
 
-void _glfwPlatformSetWindowSizeLimits(_GLFWwindow* window,
-                                      int minwidth, int minheight,
-                                      int maxwidth, int maxheight)
+void _glfwSetWindowSizeLimitsCocoa(_GLFWwindow* window,
+                                   int minwidth, int minheight,
+                                   int maxwidth, int maxheight)
 {
     @autoreleasepool {
 
@@ -1100,7 +1117,7 @@
     } // autoreleasepool
 }
 
-void _glfwPlatformSetWindowAspectRatio(_GLFWwindow* window, int numer, int denom)
+void _glfwSetWindowAspectRatioCocoa(_GLFWwindow* window, int numer, int denom)
 {
     @autoreleasepool {
     if (numer == GLFW_DONT_CARE || denom == GLFW_DONT_CARE)
@@ -1110,7 +1127,7 @@
     } // autoreleasepool
 }
 
-void _glfwPlatformGetFramebufferSize(_GLFWwindow* window, int* width, int* height)
+void _glfwGetFramebufferSizeCocoa(_GLFWwindow* window, int* width, int* height)
 {
     @autoreleasepool {
 
@@ -1125,9 +1142,9 @@
     } // autoreleasepool
 }
 
-void _glfwPlatformGetWindowFrameSize(_GLFWwindow* window,
-                                     int* left, int* top,
-                                     int* right, int* bottom)
+void _glfwGetWindowFrameSizeCocoa(_GLFWwindow* window,
+                                  int* left, int* top,
+                                  int* right, int* bottom)
 {
     @autoreleasepool {
 
@@ -1148,8 +1165,8 @@
     } // autoreleasepool
 }
 
-void _glfwPlatformGetWindowContentScale(_GLFWwindow* window,
-                                        float* xscale, float* yscale)
+void _glfwGetWindowContentScaleCocoa(_GLFWwindow* window,
+                                     float* xscale, float* yscale)
 {
     @autoreleasepool {
 
@@ -1164,14 +1181,14 @@
     } // autoreleasepool
 }
 
-void _glfwPlatformIconifyWindow(_GLFWwindow* window)
+void _glfwIconifyWindowCocoa(_GLFWwindow* window)
 {
     @autoreleasepool {
     [window->ns.object miniaturize:nil];
     } // autoreleasepool
 }
 
-void _glfwPlatformRestoreWindow(_GLFWwindow* window)
+void _glfwRestoreWindowCocoa(_GLFWwindow* window)
 {
     @autoreleasepool {
     if ([window->ns.object isMiniaturized])
@@ -1181,7 +1198,7 @@
     } // autoreleasepool
 }
 
-void _glfwPlatformMaximizeWindow(_GLFWwindow* window)
+void _glfwMaximizeWindowCocoa(_GLFWwindow* window)
 {
     @autoreleasepool {
     if (![window->ns.object isZoomed])
@@ -1189,28 +1206,28 @@
     } // autoreleasepool
 }
 
-void _glfwPlatformShowWindow(_GLFWwindow* window)
+void _glfwShowWindowCocoa(_GLFWwindow* window)
 {
     @autoreleasepool {
     [window->ns.object orderFront:nil];
     } // autoreleasepool
 }
 
-void _glfwPlatformHideWindow(_GLFWwindow* window)
+void _glfwHideWindowCocoa(_GLFWwindow* window)
 {
     @autoreleasepool {
     [window->ns.object orderOut:nil];
     } // autoreleasepool
 }
 
-void _glfwPlatformRequestWindowAttention(_GLFWwindow* window)
+void _glfwRequestWindowAttentionCocoa(_GLFWwindow* window)
 {
     @autoreleasepool {
     [NSApp requestUserAttention:NSInformationalRequest];
     } // autoreleasepool
 }
 
-void _glfwPlatformFocusWindow(_GLFWwindow* window)
+void _glfwFocusWindowCocoa(_GLFWwindow* window)
 {
     @autoreleasepool {
     // Make us the active application
@@ -1222,11 +1239,11 @@
     } // autoreleasepool
 }
 
-void _glfwPlatformSetWindowMonitor(_GLFWwindow* window,
-                                   _GLFWmonitor* monitor,
-                                   int xpos, int ypos,
-                                   int width, int height,
-                                   int refreshRate)
+void _glfwSetWindowMonitorCocoa(_GLFWwindow* window,
+                                _GLFWmonitor* monitor,
+                                int xpos, int ypos,
+                                int width, int height,
+                                int refreshRate)
 {
     @autoreleasepool {
 
@@ -1240,7 +1257,7 @@
         else
         {
             const NSRect contentRect =
-                NSMakeRect(xpos, _glfwTransformYNS(ypos + height - 1), width, height);
+                NSMakeRect(xpos, _glfwTransformYCocoa(ypos + height - 1), width, height);
             const NSUInteger styleMask = [window->ns.object styleMask];
             const NSRect frameRect =
                 [window->ns.object frameRectForContentRect:contentRect
@@ -1259,7 +1276,7 @@
 
     // HACK: Allow the state cached in Cocoa to catch up to reality
     // TODO: Solve this in a less terrible way
-    _glfwPlatformPollEvents();
+    _glfwPollEventsCocoa();
 
     NSUInteger styleMask = [window->ns.object styleMask];
 
@@ -1295,7 +1312,7 @@
     }
     else
     {
-        NSRect contentRect = NSMakeRect(xpos, _glfwTransformYNS(ypos + height - 1),
+        NSRect contentRect = NSMakeRect(xpos, _glfwTransformYCocoa(ypos + height - 1),
                                         width, height);
         NSRect frameRect = [window->ns.object frameRectForContentRect:contentRect
                                                             styleMask:styleMask];
@@ -1350,28 +1367,28 @@
     } // autoreleasepool
 }
 
-int _glfwPlatformWindowFocused(_GLFWwindow* window)
+GLFWbool _glfwWindowFocusedCocoa(_GLFWwindow* window)
 {
     @autoreleasepool {
     return [window->ns.object isKeyWindow];
     } // autoreleasepool
 }
 
-int _glfwPlatformWindowIconified(_GLFWwindow* window)
+GLFWbool _glfwWindowIconifiedCocoa(_GLFWwindow* window)
 {
     @autoreleasepool {
     return [window->ns.object isMiniaturized];
     } // autoreleasepool
 }
 
-int _glfwPlatformWindowVisible(_GLFWwindow* window)
+GLFWbool _glfwWindowVisibleCocoa(_GLFWwindow* window)
 {
     @autoreleasepool {
     return [window->ns.object isVisible];
     } // autoreleasepool
 }
 
-int _glfwPlatformWindowMaximized(_GLFWwindow* window)
+GLFWbool _glfwWindowMaximizedCocoa(_GLFWwindow* window)
 {
     @autoreleasepool {
 
@@ -1383,7 +1400,7 @@
     } // autoreleasepool
 }
 
-int _glfwPlatformWindowHovered(_GLFWwindow* window)
+GLFWbool _glfwWindowHoveredCocoa(_GLFWwindow* window)
 {
     @autoreleasepool {
 
@@ -1401,14 +1418,14 @@
     } // autoreleasepool
 }
 
-int _glfwPlatformFramebufferTransparent(_GLFWwindow* window)
+GLFWbool _glfwFramebufferTransparentCocoa(_GLFWwindow* window)
 {
     @autoreleasepool {
     return ![window->ns.object isOpaque] && ![window->ns.view isOpaque];
     } // autoreleasepool
 }
 
-void _glfwPlatformSetWindowResizable(_GLFWwindow* window, GLFWbool enabled)
+void _glfwSetWindowResizableCocoa(_GLFWwindow* window, GLFWbool enabled)
 {
     @autoreleasepool {
 
@@ -1432,7 +1449,7 @@
     } // autoreleasepool
 }
 
-void _glfwPlatformSetWindowDecorated(_GLFWwindow* window, GLFWbool enabled)
+void _glfwSetWindowDecoratedCocoa(_GLFWwindow* window, GLFWbool enabled)
 {
     @autoreleasepool {
 
@@ -1454,7 +1471,7 @@
     } // autoreleasepool
 }
 
-void _glfwPlatformSetWindowFloating(_GLFWwindow* window, GLFWbool enabled)
+void _glfwSetWindowFloatingCocoa(_GLFWwindow* window, GLFWbool enabled)
 {
     @autoreleasepool {
     if (enabled)
@@ -1464,36 +1481,42 @@
     } // autoreleasepool
 }
 
-float _glfwPlatformGetWindowOpacity(_GLFWwindow* window)
+void _glfwSetWindowMousePassthroughCocoa(_GLFWwindow* window, GLFWbool enabled)
+{
+    @autoreleasepool {
+    [window->ns.object setIgnoresMouseEvents:enabled];
+    }
+}
+
+float _glfwGetWindowOpacityCocoa(_GLFWwindow* window)
 {
     @autoreleasepool {
     return (float) [window->ns.object alphaValue];
     } // autoreleasepool
 }
 
-void _glfwPlatformSetWindowOpacity(_GLFWwindow* window, float opacity)
+void _glfwSetWindowOpacityCocoa(_GLFWwindow* window, float opacity)
 {
     @autoreleasepool {
     [window->ns.object setAlphaValue:opacity];
     } // autoreleasepool
 }
 
-void _glfwPlatformSetRawMouseMotion(_GLFWwindow *window, GLFWbool enabled)
+void _glfwSetRawMouseMotionCocoa(_GLFWwindow *window, GLFWbool enabled)
 {
+    _glfwInputError(GLFW_FEATURE_UNIMPLEMENTED,
+                    "Cocoa: Raw mouse motion not yet implemented");
 }
 
-GLFWbool _glfwPlatformRawMouseMotionSupported(void)
+GLFWbool _glfwRawMouseMotionSupportedCocoa(void)
 {
     return GLFW_FALSE;
 }
 
-void _glfwPlatformPollEvents(void)
+void _glfwPollEventsCocoa(void)
 {
     @autoreleasepool {
 
-    if (!_glfw.ns.finishedLaunching)
-        [NSApp run];
-
     for (;;)
     {
         NSEvent* event = [NSApp nextEventMatchingMask:NSEventMaskAny
@@ -1509,13 +1532,10 @@
     } // autoreleasepool
 }
 
-void _glfwPlatformWaitEvents(void)
+void _glfwWaitEventsCocoa(void)
 {
     @autoreleasepool {
 
-    if (!_glfw.ns.finishedLaunching)
-        [NSApp run];
-
     // I wanted to pass NO to dequeue:, and rely on PollEvents to
     // dequeue and send.  For reasons not at all clear to me, passing
     // NO to dequeue: causes this method never to return.
@@ -1525,18 +1545,15 @@
                                           dequeue:YES];
     [NSApp sendEvent:event];
 
-    _glfwPlatformPollEvents();
+    _glfwPollEventsCocoa();
 
     } // autoreleasepool
 }
 
-void _glfwPlatformWaitEventsTimeout(double timeout)
+void _glfwWaitEventsTimeoutCocoa(double timeout)
 {
     @autoreleasepool {
 
-    if (!_glfw.ns.finishedLaunching)
-        [NSApp run];
-
     NSDate* date = [NSDate dateWithTimeIntervalSinceNow:timeout];
     NSEvent* event = [NSApp nextEventMatchingMask:NSEventMaskAny
                                         untilDate:date
@@ -1545,18 +1562,15 @@
     if (event)
         [NSApp sendEvent:event];
 
-    _glfwPlatformPollEvents();
+    _glfwPollEventsCocoa();
 
     } // autoreleasepool
 }
 
-void _glfwPlatformPostEmptyEvent(void)
+void _glfwPostEmptyEventCocoa(void)
 {
     @autoreleasepool {
 
-    if (!_glfw.ns.finishedLaunching)
-        [NSApp run];
-
     NSEvent* event = [NSEvent otherEventWithType:NSEventTypeApplicationDefined
                                         location:NSMakePoint(0, 0)
                                    modifierFlags:0
@@ -1571,7 +1585,7 @@
     } // autoreleasepool
 }
 
-void _glfwPlatformGetCursorPos(_GLFWwindow* window, double* xpos, double* ypos)
+void _glfwGetCursorPosCocoa(_GLFWwindow* window, double* xpos, double* ypos)
 {
     @autoreleasepool {
 
@@ -1587,7 +1601,7 @@
     } // autoreleasepool
 }
 
-void _glfwPlatformSetCursorPos(_GLFWwindow* window, double x, double y)
+void _glfwSetCursorPosCocoa(_GLFWwindow* window, double x, double y)
 {
     @autoreleasepool {
 
@@ -1612,7 +1626,7 @@
         const NSPoint globalPoint = globalRect.origin;
 
         CGWarpMouseCursorPosition(CGPointMake(globalPoint.x,
-                                              _glfwTransformYNS(globalPoint.y)));
+                                              _glfwTransformYCocoa(globalPoint.y)));
     }
 
     // HACK: Calling this right after setting the cursor position prevents macOS
@@ -1623,15 +1637,23 @@
     } // autoreleasepool
 }
 
-void _glfwPlatformSetCursorMode(_GLFWwindow* window, int mode)
+void _glfwSetCursorModeCocoa(_GLFWwindow* window, int mode)
 {
     @autoreleasepool {
-    if (_glfwPlatformWindowFocused(window))
+
+    if (mode == GLFW_CURSOR_CAPTURED)
+    {
+        _glfwInputError(GLFW_FEATURE_UNIMPLEMENTED,
+                        "Cocoa: Captured cursor mode not yet implemented");
+    }
+
+    if (_glfwWindowFocusedCocoa(window))
         updateCursorMode(window);
+
     } // autoreleasepool
 }
 
-const char* _glfwPlatformGetScancodeName(int scancode)
+const char* _glfwGetScancodeNameCocoa(int scancode)
 {
     @autoreleasepool {
 
@@ -1681,14 +1703,14 @@
     } // autoreleasepool
 }
 
-int _glfwPlatformGetKeyScancode(int key)
+int _glfwGetKeyScancodeCocoa(int key)
 {
     return _glfw.ns.scancodes[key];
 }
 
-int _glfwPlatformCreateCursor(_GLFWcursor* cursor,
-                              const GLFWimage* image,
-                              int xhot, int yhot)
+GLFWbool _glfwCreateCursorCocoa(_GLFWcursor* cursor,
+                                const GLFWimage* image,
+                                int xhot, int yhot)
 {
     @autoreleasepool {
 
@@ -1730,27 +1752,71 @@
     } // autoreleasepool
 }
 
-int _glfwPlatformCreateStandardCursor(_GLFWcursor* cursor, int shape)
+GLFWbool _glfwCreateStandardCursorCocoa(_GLFWcursor* cursor, int shape)
 {
     @autoreleasepool {
 
-    if (shape == GLFW_ARROW_CURSOR)
-        cursor->ns.object = [NSCursor arrowCursor];
-    else if (shape == GLFW_IBEAM_CURSOR)
-        cursor->ns.object = [NSCursor IBeamCursor];
-    else if (shape == GLFW_CROSSHAIR_CURSOR)
-        cursor->ns.object = [NSCursor crosshairCursor];
-    else if (shape == GLFW_HAND_CURSOR)
-        cursor->ns.object = [NSCursor pointingHandCursor];
-    else if (shape == GLFW_HRESIZE_CURSOR)
-        cursor->ns.object = [NSCursor resizeLeftRightCursor];
-    else if (shape == GLFW_VRESIZE_CURSOR)
-        cursor->ns.object = [NSCursor resizeUpDownCursor];
+    SEL cursorSelector = NULL;
+
+    // HACK: Try to use a private message
+    switch (shape)
+    {
+        case GLFW_RESIZE_EW_CURSOR:
+            cursorSelector = NSSelectorFromString(@"_windowResizeEastWestCursor");
+            break;
+        case GLFW_RESIZE_NS_CURSOR:
+            cursorSelector = NSSelectorFromString(@"_windowResizeNorthSouthCursor");
+            break;
+        case GLFW_RESIZE_NWSE_CURSOR:
+            cursorSelector = NSSelectorFromString(@"_windowResizeNorthWestSouthEastCursor");
+            break;
+        case GLFW_RESIZE_NESW_CURSOR:
+            cursorSelector = NSSelectorFromString(@"_windowResizeNorthEastSouthWestCursor");
+            break;
+    }
+
+    if (cursorSelector && [NSCursor respondsToSelector:cursorSelector])
+    {
+        id object = [NSCursor performSelector:cursorSelector];
+        if ([object isKindOfClass:[NSCursor class]])
+            cursor->ns.object = object;
+    }
 
     if (!cursor->ns.object)
     {
-        _glfwInputError(GLFW_PLATFORM_ERROR,
-                        "Cocoa: Failed to retrieve standard cursor");
+        switch (shape)
+        {
+            case GLFW_ARROW_CURSOR:
+                cursor->ns.object = [NSCursor arrowCursor];
+                break;
+            case GLFW_IBEAM_CURSOR:
+                cursor->ns.object = [NSCursor IBeamCursor];
+                break;
+            case GLFW_CROSSHAIR_CURSOR:
+                cursor->ns.object = [NSCursor crosshairCursor];
+                break;
+            case GLFW_POINTING_HAND_CURSOR:
+                cursor->ns.object = [NSCursor pointingHandCursor];
+                break;
+            case GLFW_RESIZE_EW_CURSOR:
+                cursor->ns.object = [NSCursor resizeLeftRightCursor];
+                break;
+            case GLFW_RESIZE_NS_CURSOR:
+                cursor->ns.object = [NSCursor resizeUpDownCursor];
+                break;
+            case GLFW_RESIZE_ALL_CURSOR:
+                cursor->ns.object = [NSCursor closedHandCursor];
+                break;
+            case GLFW_NOT_ALLOWED_CURSOR:
+                cursor->ns.object = [NSCursor operationNotAllowedCursor];
+                break;
+        }
+    }
+
+    if (!cursor->ns.object)
+    {
+        _glfwInputError(GLFW_CURSOR_UNAVAILABLE,
+                        "Cocoa: Standard cursor shape unavailable");
         return GLFW_FALSE;
     }
 
@@ -1760,7 +1826,7 @@
     } // autoreleasepool
 }
 
-void _glfwPlatformDestroyCursor(_GLFWcursor* cursor)
+void _glfwDestroyCursorCocoa(_GLFWcursor* cursor)
 {
     @autoreleasepool {
     if (cursor->ns.object)
@@ -1768,7 +1834,7 @@
     } // autoreleasepool
 }
 
-void _glfwPlatformSetCursor(_GLFWwindow* window, _GLFWcursor* cursor)
+void _glfwSetCursorCocoa(_GLFWwindow* window, _GLFWcursor* cursor)
 {
     @autoreleasepool {
     if (cursorInContentArea(window))
@@ -1776,7 +1842,7 @@
     } // autoreleasepool
 }
 
-void _glfwPlatformSetClipboardString(const char* string)
+void _glfwSetClipboardStringCocoa(const char* string)
 {
     @autoreleasepool {
     NSPasteboard* pasteboard = [NSPasteboard generalPasteboard];
@@ -1785,7 +1851,7 @@
     } // autoreleasepool
 }
 
-const char* _glfwPlatformGetClipboardString(void)
+const char* _glfwGetClipboardStringCocoa(void)
 {
     @autoreleasepool {
 
@@ -1806,7 +1872,7 @@
         return NULL;
     }
 
-    free(_glfw.ns.clipboardString);
+    _glfw_free(_glfw.ns.clipboardString);
     _glfw.ns.clipboardString = _glfw_strdup([object UTF8String]);
 
     return _glfw.ns.clipboardString;
@@ -1814,7 +1880,48 @@
     } // autoreleasepool
 }
 
-void _glfwPlatformGetRequiredInstanceExtensions(char** extensions)
+EGLenum _glfwGetEGLPlatformCocoa(EGLint** attribs)
+{
+    if (_glfw.egl.ANGLE_platform_angle)
+    {
+        int type = 0;
+
+        if (_glfw.egl.ANGLE_platform_angle_opengl)
+        {
+            if (_glfw.hints.init.angleType == GLFW_ANGLE_PLATFORM_TYPE_OPENGL)
+                type = EGL_PLATFORM_ANGLE_TYPE_OPENGL_ANGLE;
+        }
+
+        if (_glfw.egl.ANGLE_platform_angle_metal)
+        {
+            if (_glfw.hints.init.angleType == GLFW_ANGLE_PLATFORM_TYPE_METAL)
+                type = EGL_PLATFORM_ANGLE_TYPE_METAL_ANGLE;
+        }
+
+        if (type)
+        {
+            *attribs = _glfw_calloc(3, sizeof(EGLint));
+            (*attribs)[0] = EGL_PLATFORM_ANGLE_TYPE_ANGLE;
+            (*attribs)[1] = type;
+            (*attribs)[2] = EGL_NONE;
+            return EGL_PLATFORM_ANGLE_ANGLE;
+        }
+    }
+
+    return 0;
+}
+
+EGLNativeDisplayType _glfwGetEGLNativeDisplayCocoa(void)
+{
+    return EGL_DEFAULT_DISPLAY;
+}
+
+EGLNativeWindowType _glfwGetEGLNativeWindowCocoa(_GLFWwindow* window)
+{
+    return window->ns.layer;
+}
+
+void _glfwGetRequiredInstanceExtensionsCocoa(char** extensions)
 {
     if (_glfw.vk.KHR_surface && _glfw.vk.EXT_metal_surface)
     {
@@ -1828,17 +1935,17 @@
     }
 }
 
-int _glfwPlatformGetPhysicalDevicePresentationSupport(VkInstance instance,
-                                                      VkPhysicalDevice device,
-                                                      uint32_t queuefamily)
+GLFWbool _glfwGetPhysicalDevicePresentationSupportCocoa(VkInstance instance,
+                                                        VkPhysicalDevice device,
+                                                        uint32_t queuefamily)
 {
     return GLFW_TRUE;
 }
 
-VkResult _glfwPlatformCreateWindowSurface(VkInstance instance,
-                                          _GLFWwindow* window,
-                                          const VkAllocationCallbacks* allocator,
-                                          VkSurfaceKHR* surface)
+VkResult _glfwCreateWindowSurfaceCocoa(VkInstance instance,
+                                       _GLFWwindow* window,
+                                       const VkAllocationCallbacks* allocator,
+                                       VkSurfaceKHR* surface)
 {
     @autoreleasepool {
 
@@ -1862,7 +1969,7 @@
         return VK_ERROR_EXTENSION_NOT_PRESENT;
     }
 
-    if (window->ns.retina)
+    if (window->ns.scaleFramebuffer)
         [window->ns.layer setContentsScale:[window->ns.object backingScaleFactor]];
 
     [window->ns.view setLayer:window->ns.layer];
@@ -1935,6 +2042,31 @@
 {
     _GLFWwindow* window = (_GLFWwindow*) handle;
     _GLFW_REQUIRE_INIT_OR_RETURN(nil);
+
+    if (_glfw.platform.platformID != GLFW_PLATFORM_COCOA)
+    {
+        _glfwInputError(GLFW_PLATFORM_UNAVAILABLE,
+                        "Cocoa: Platform not initialized");
+        return nil;
+    }
+
     return window->ns.object;
 }
 
+GLFWAPI id glfwGetCocoaView(GLFWwindow* handle)
+{
+    _GLFWwindow* window = (_GLFWwindow*) handle;
+    _GLFW_REQUIRE_INIT_OR_RETURN(nil);
+
+    if (_glfw.platform.platformID != GLFW_PLATFORM_COCOA)
+    {
+        _glfwInputError(GLFW_PLATFORM_UNAVAILABLE,
+                        "Cocoa: Platform not initialized");
+        return nil;
+    }
+
+    return window->ns.view;
+}
+
+#endif // _GLFW_COCOA
+
diff --git a/src/context.c b/src/context.c
index b81934b..cc1fac4 100644
--- a/src/context.c
+++ b/src/context.c
@@ -1,5 +1,5 @@
 //========================================================================
-// GLFW 3.3 - www.glfw.org
+// GLFW 3.4 - www.glfw.org
 //------------------------------------------------------------------------
 // Copyright (c) 2002-2006 Marcus Geelnard
 // Copyright (c) 2006-2016 Camilla Löwy <elmindreda@glfw.org>
@@ -24,8 +24,6 @@
 //    distribution.
 //
 //========================================================================
-// Please use C89 style variable declarations in this file because VS 2010
-//========================================================================
 
 #include "internal.h"
 
diff --git a/src/egl_context.c b/src/egl_context.c
index a37f3d3..ef65dd3 100644
--- a/src/egl_context.c
+++ b/src/egl_context.c
@@ -1,5 +1,5 @@
 //========================================================================
-// GLFW 3.3 EGL - www.glfw.org
+// GLFW 3.4 EGL - www.glfw.org
 //------------------------------------------------------------------------
 // Copyright (c) 2002-2006 Marcus Geelnard
 // Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.org>
@@ -24,8 +24,6 @@
 //    distribution.
 //
 //========================================================================
-// Please use C89 style variable declarations in this file because VS 2010
-//========================================================================
 
 #include "internal.h"
 
@@ -120,10 +118,10 @@
         return GLFW_FALSE;
     }
 
-    nativeConfigs = calloc(nativeCount, sizeof(EGLConfig));
+    nativeConfigs = _glfw_calloc(nativeCount, sizeof(EGLConfig));
     eglGetConfigs(_glfw.egl.display, nativeConfigs, nativeCount, &nativeCount);
 
-    usableConfigs = calloc(nativeCount, sizeof(_GLFWfbconfig));
+    usableConfigs = _glfw_calloc(nativeCount, sizeof(_GLFWfbconfig));
     usableCount = 0;
 
     for (i = 0;  i < nativeCount;  i++)
@@ -140,6 +138,7 @@
             continue;
 
 #if defined(_GLFW_X11)
+        if (_glfw.platform.platformID == GLFW_PLATFORM_X11)
         {
             XVisualInfo vi = {0};
 
@@ -177,14 +176,17 @@
         u->stencilBits = getEGLConfigAttrib(n, EGL_STENCIL_SIZE);
 
 #if defined(_GLFW_WAYLAND)
-        // NOTE: The wl_surface opaque region is no guarantee that its buffer
-        //       is presented as opaque, if it also has an alpha channel
-        // HACK: If EGL_EXT_present_opaque is unavailable, ignore any config
-        //       with an alpha channel to ensure the buffer is opaque
-        if (!_glfw.egl.EXT_present_opaque)
+        if (_glfw.platform.platformID == GLFW_PLATFORM_WAYLAND)
         {
-            if (!fbconfig->transparent && u->alphaBits > 0)
-                continue;
+            // NOTE: The wl_surface opaque region is no guarantee that its buffer
+            //       is presented as opaque, if it also has an alpha channel
+            // HACK: If EGL_EXT_present_opaque is unavailable, ignore any config
+            //       with an alpha channel to ensure the buffer is opaque
+            if (!_glfw.egl.EXT_present_opaque)
+            {
+                if (!fbconfig->transparent && u->alphaBits > 0)
+                    continue;
+            }
         }
 #endif // _GLFW_WAYLAND
 
@@ -228,8 +230,8 @@
         }
     }
 
-    free(nativeConfigs);
-    free(usableConfigs);
+    _glfw_free(nativeConfigs);
+    _glfw_free(usableConfigs);
 
     return closest != NULL;
 }
@@ -276,9 +278,12 @@
     }
 
 #if defined(_GLFW_WAYLAND)
-    // NOTE: Swapping buffers on a hidden window on Wayland makes it visible
-    if (!window->wl.visible)
-        return;
+    if (_glfw.platform.platformID == GLFW_PLATFORM_WAYLAND)
+    {
+        // NOTE: Swapping buffers on a hidden window on Wayland makes it visible
+        if (!window->wl.visible)
+            return;
+    }
 #endif
 
     eglSwapBuffers(_glfw.egl.display, window->context.egl.surface);
@@ -308,8 +313,8 @@
 
     if (window->context.egl.client)
     {
-        GLFWglproc proc = (GLFWglproc) _glfw_dlsym(window->context.egl.client,
-                                                   procname);
+        GLFWglproc proc = (GLFWglproc)
+            _glfwPlatformGetModuleSymbol(window->context.egl.client, procname);
         if (proc)
             return proc;
     }
@@ -319,15 +324,14 @@
 
 static void destroyContextEGL(_GLFWwindow* window)
 {
-#if defined(_GLFW_X11)
     // NOTE: Do not unload libGL.so.1 while the X11 display is still open,
     //       as it will make XCloseDisplay segfault
-    if (window->context.client != GLFW_OPENGL_API)
-#endif // _GLFW_X11
+    if (_glfw.platform.platformID != GLFW_PLATFORM_X11 ||
+        window->context.client != GLFW_OPENGL_API)
     {
         if (window->context.egl.client)
         {
-            _glfw_dlclose(window->context.egl.client);
+            _glfwPlatformFreeModule(window->context.egl.client);
             window->context.egl.client = NULL;
         }
     }
@@ -355,6 +359,8 @@
 GLFWbool _glfwInitEGL(void)
 {
     int i;
+    EGLint* attribs = NULL;
+    const char* extensions;
     const char* sonames[] =
     {
 #if defined(_GLFW_EGL_LIBRARY)
@@ -379,7 +385,7 @@
 
     for (i = 0;  sonames[i];  i++)
     {
-        _glfw.egl.handle = _glfw_dlopen(sonames[i]);
+        _glfw.egl.handle = _glfwPlatformLoadModule(sonames[i]);
         if (_glfw.egl.handle)
             break;
     }
@@ -393,37 +399,37 @@
     _glfw.egl.prefix = (strncmp(sonames[i], "lib", 3) == 0);
 
     _glfw.egl.GetConfigAttrib = (PFN_eglGetConfigAttrib)
-        _glfw_dlsym(_glfw.egl.handle, "eglGetConfigAttrib");
+        _glfwPlatformGetModuleSymbol(_glfw.egl.handle, "eglGetConfigAttrib");
     _glfw.egl.GetConfigs = (PFN_eglGetConfigs)
-        _glfw_dlsym(_glfw.egl.handle, "eglGetConfigs");
+        _glfwPlatformGetModuleSymbol(_glfw.egl.handle, "eglGetConfigs");
     _glfw.egl.GetDisplay = (PFN_eglGetDisplay)
-        _glfw_dlsym(_glfw.egl.handle, "eglGetDisplay");
+        _glfwPlatformGetModuleSymbol(_glfw.egl.handle, "eglGetDisplay");
     _glfw.egl.GetError = (PFN_eglGetError)
-        _glfw_dlsym(_glfw.egl.handle, "eglGetError");
+        _glfwPlatformGetModuleSymbol(_glfw.egl.handle, "eglGetError");
     _glfw.egl.Initialize = (PFN_eglInitialize)
-        _glfw_dlsym(_glfw.egl.handle, "eglInitialize");
+        _glfwPlatformGetModuleSymbol(_glfw.egl.handle, "eglInitialize");
     _glfw.egl.Terminate = (PFN_eglTerminate)
-        _glfw_dlsym(_glfw.egl.handle, "eglTerminate");
+        _glfwPlatformGetModuleSymbol(_glfw.egl.handle, "eglTerminate");
     _glfw.egl.BindAPI = (PFN_eglBindAPI)
-        _glfw_dlsym(_glfw.egl.handle, "eglBindAPI");
+        _glfwPlatformGetModuleSymbol(_glfw.egl.handle, "eglBindAPI");
     _glfw.egl.CreateContext = (PFN_eglCreateContext)
-        _glfw_dlsym(_glfw.egl.handle, "eglCreateContext");
+        _glfwPlatformGetModuleSymbol(_glfw.egl.handle, "eglCreateContext");
     _glfw.egl.DestroySurface = (PFN_eglDestroySurface)
-        _glfw_dlsym(_glfw.egl.handle, "eglDestroySurface");
+        _glfwPlatformGetModuleSymbol(_glfw.egl.handle, "eglDestroySurface");
     _glfw.egl.DestroyContext = (PFN_eglDestroyContext)
-        _glfw_dlsym(_glfw.egl.handle, "eglDestroyContext");
+        _glfwPlatformGetModuleSymbol(_glfw.egl.handle, "eglDestroyContext");
     _glfw.egl.CreateWindowSurface = (PFN_eglCreateWindowSurface)
-        _glfw_dlsym(_glfw.egl.handle, "eglCreateWindowSurface");
+        _glfwPlatformGetModuleSymbol(_glfw.egl.handle, "eglCreateWindowSurface");
     _glfw.egl.MakeCurrent = (PFN_eglMakeCurrent)
-        _glfw_dlsym(_glfw.egl.handle, "eglMakeCurrent");
+        _glfwPlatformGetModuleSymbol(_glfw.egl.handle, "eglMakeCurrent");
     _glfw.egl.SwapBuffers = (PFN_eglSwapBuffers)
-        _glfw_dlsym(_glfw.egl.handle, "eglSwapBuffers");
+        _glfwPlatformGetModuleSymbol(_glfw.egl.handle, "eglSwapBuffers");
     _glfw.egl.SwapInterval = (PFN_eglSwapInterval)
-        _glfw_dlsym(_glfw.egl.handle, "eglSwapInterval");
+        _glfwPlatformGetModuleSymbol(_glfw.egl.handle, "eglSwapInterval");
     _glfw.egl.QueryString = (PFN_eglQueryString)
-        _glfw_dlsym(_glfw.egl.handle, "eglQueryString");
+        _glfwPlatformGetModuleSymbol(_glfw.egl.handle, "eglQueryString");
     _glfw.egl.GetProcAddress = (PFN_eglGetProcAddress)
-        _glfw_dlsym(_glfw.egl.handle, "eglGetProcAddress");
+        _glfwPlatformGetModuleSymbol(_glfw.egl.handle, "eglGetProcAddress");
 
     if (!_glfw.egl.GetConfigAttrib ||
         !_glfw.egl.GetConfigs ||
@@ -449,7 +455,51 @@
         return GLFW_FALSE;
     }
 
-    _glfw.egl.display = eglGetDisplay(_GLFW_EGL_NATIVE_DISPLAY);
+    extensions = eglQueryString(EGL_NO_DISPLAY, EGL_EXTENSIONS);
+    if (extensions && eglGetError() == EGL_SUCCESS)
+        _glfw.egl.EXT_client_extensions = GLFW_TRUE;
+
+    if (_glfw.egl.EXT_client_extensions)
+    {
+        _glfw.egl.EXT_platform_base =
+            _glfwStringInExtensionString("EGL_EXT_platform_base", extensions);
+        _glfw.egl.EXT_platform_x11 =
+            _glfwStringInExtensionString("EGL_EXT_platform_x11", extensions);
+        _glfw.egl.EXT_platform_wayland =
+            _glfwStringInExtensionString("EGL_EXT_platform_wayland", extensions);
+        _glfw.egl.ANGLE_platform_angle =
+            _glfwStringInExtensionString("EGL_ANGLE_platform_angle", extensions);
+        _glfw.egl.ANGLE_platform_angle_opengl =
+            _glfwStringInExtensionString("EGL_ANGLE_platform_angle_opengl", extensions);
+        _glfw.egl.ANGLE_platform_angle_d3d =
+            _glfwStringInExtensionString("EGL_ANGLE_platform_angle_d3d", extensions);
+        _glfw.egl.ANGLE_platform_angle_vulkan =
+            _glfwStringInExtensionString("EGL_ANGLE_platform_angle_vulkan", extensions);
+        _glfw.egl.ANGLE_platform_angle_metal =
+            _glfwStringInExtensionString("EGL_ANGLE_platform_angle_metal", extensions);
+    }
+
+    if (_glfw.egl.EXT_platform_base)
+    {
+        _glfw.egl.GetPlatformDisplayEXT = (PFNEGLGETPLATFORMDISPLAYEXTPROC)
+            eglGetProcAddress("eglGetPlatformDisplayEXT");
+        _glfw.egl.CreatePlatformWindowSurfaceEXT = (PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC)
+            eglGetProcAddress("eglCreatePlatformWindowSurfaceEXT");
+    }
+
+    _glfw.egl.platform = _glfw.platform.getEGLPlatform(&attribs);
+    if (_glfw.egl.platform)
+    {
+        _glfw.egl.display =
+            eglGetPlatformDisplayEXT(_glfw.egl.platform,
+                                     _glfw.platform.getEGLNativeDisplay(),
+                                     attribs);
+    }
+    else
+        _glfw.egl.display = eglGetDisplay(_glfw.platform.getEGLNativeDisplay());
+
+    _glfw_free(attribs);
+
     if (_glfw.egl.display == EGL_NO_DISPLAY)
     {
         _glfwInputError(GLFW_API_UNAVAILABLE,
@@ -498,12 +548,12 @@
 
     if (_glfw.egl.handle)
     {
-        _glfw_dlclose(_glfw.egl.handle);
+        _glfwPlatformFreeModule(_glfw.egl.handle);
         _glfw.egl.handle = NULL;
     }
 }
 
-#define setAttrib(a, v) \
+#define SET_ATTRIB(a, v) \
 { \
     assert(((size_t) index + 1) < sizeof(attribs) / sizeof(attribs[0])); \
     attribs[index++] = a; \
@@ -519,6 +569,7 @@
     EGLint attribs[40];
     EGLConfig config;
     EGLContext share = NULL;
+    EGLNativeWindowType native;
     int index = 0;
 
     if (!_glfw.egl.display)
@@ -576,13 +627,13 @@
         {
             if (ctxconfig->robustness == GLFW_NO_RESET_NOTIFICATION)
             {
-                setAttrib(EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_KHR,
-                          EGL_NO_RESET_NOTIFICATION_KHR);
+                SET_ATTRIB(EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_KHR,
+                           EGL_NO_RESET_NOTIFICATION_KHR);
             }
             else if (ctxconfig->robustness == GLFW_LOSE_CONTEXT_ON_RESET)
             {
-                setAttrib(EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_KHR,
-                          EGL_LOSE_CONTEXT_ON_RESET_KHR);
+                SET_ATTRIB(EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_KHR,
+                           EGL_LOSE_CONTEXT_ON_RESET_KHR);
             }
 
             flags |= EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR;
@@ -590,43 +641,43 @@
 
         if (ctxconfig->major != 1 || ctxconfig->minor != 0)
         {
-            setAttrib(EGL_CONTEXT_MAJOR_VERSION_KHR, ctxconfig->major);
-            setAttrib(EGL_CONTEXT_MINOR_VERSION_KHR, ctxconfig->minor);
+            SET_ATTRIB(EGL_CONTEXT_MAJOR_VERSION_KHR, ctxconfig->major);
+            SET_ATTRIB(EGL_CONTEXT_MINOR_VERSION_KHR, ctxconfig->minor);
         }
 
         if (ctxconfig->noerror)
         {
             if (_glfw.egl.KHR_create_context_no_error)
-                setAttrib(EGL_CONTEXT_OPENGL_NO_ERROR_KHR, GLFW_TRUE);
+                SET_ATTRIB(EGL_CONTEXT_OPENGL_NO_ERROR_KHR, GLFW_TRUE);
         }
 
         if (mask)
-            setAttrib(EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR, mask);
+            SET_ATTRIB(EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR, mask);
 
         if (flags)
-            setAttrib(EGL_CONTEXT_FLAGS_KHR, flags);
+            SET_ATTRIB(EGL_CONTEXT_FLAGS_KHR, flags);
     }
     else
     {
         if (ctxconfig->client == GLFW_OPENGL_ES_API)
-            setAttrib(EGL_CONTEXT_CLIENT_VERSION, ctxconfig->major);
+            SET_ATTRIB(EGL_CONTEXT_CLIENT_VERSION, ctxconfig->major);
     }
 
     if (_glfw.egl.KHR_context_flush_control)
     {
         if (ctxconfig->release == GLFW_RELEASE_BEHAVIOR_NONE)
         {
-            setAttrib(EGL_CONTEXT_RELEASE_BEHAVIOR_KHR,
-                      EGL_CONTEXT_RELEASE_BEHAVIOR_NONE_KHR);
+            SET_ATTRIB(EGL_CONTEXT_RELEASE_BEHAVIOR_KHR,
+                       EGL_CONTEXT_RELEASE_BEHAVIOR_NONE_KHR);
         }
         else if (ctxconfig->release == GLFW_RELEASE_BEHAVIOR_FLUSH)
         {
-            setAttrib(EGL_CONTEXT_RELEASE_BEHAVIOR_KHR,
-                      EGL_CONTEXT_RELEASE_BEHAVIOR_FLUSH_KHR);
+            SET_ATTRIB(EGL_CONTEXT_RELEASE_BEHAVIOR_KHR,
+                       EGL_CONTEXT_RELEASE_BEHAVIOR_FLUSH_KHR);
         }
     }
 
-    setAttrib(EGL_NONE, EGL_NONE);
+    SET_ATTRIB(EGL_NONE, EGL_NONE);
 
     window->context.egl.handle = eglCreateContext(_glfw.egl.display,
                                                   config, share, attribs);
@@ -645,24 +696,34 @@
     if (fbconfig->sRGB)
     {
         if (_glfw.egl.KHR_gl_colorspace)
-            setAttrib(EGL_GL_COLORSPACE_KHR, EGL_GL_COLORSPACE_SRGB_KHR);
+            SET_ATTRIB(EGL_GL_COLORSPACE_KHR, EGL_GL_COLORSPACE_SRGB_KHR);
     }
 
     if (!fbconfig->doublebuffer)
-        setAttrib(EGL_RENDER_BUFFER, EGL_SINGLE_BUFFER);
+        SET_ATTRIB(EGL_RENDER_BUFFER, EGL_SINGLE_BUFFER);
 
-#if defined(_GLFW_WAYLAND)
-    if (_glfw.egl.EXT_present_opaque)
-        setAttrib(EGL_PRESENT_OPAQUE_EXT, !fbconfig->transparent);
-#endif // _GLFW_WAYLAND
+    if (_glfw.platform.platformID == GLFW_PLATFORM_WAYLAND)
+    {
+        if (_glfw.egl.EXT_present_opaque)
+            SET_ATTRIB(EGL_PRESENT_OPAQUE_EXT, !fbconfig->transparent);
+    }
 
-    setAttrib(EGL_NONE, EGL_NONE);
+    SET_ATTRIB(EGL_NONE, EGL_NONE);
 
-    window->context.egl.surface =
-        eglCreateWindowSurface(_glfw.egl.display,
-                               config,
-                               _GLFW_EGL_NATIVE_WINDOW,
-                               attribs);
+    native = _glfw.platform.getEGLNativeWindow(window);
+    // HACK: ANGLE does not implement eglCreatePlatformWindowSurfaceEXT
+    //       despite reporting EGL_EXT_platform_base
+    if (_glfw.egl.platform && _glfw.egl.platform != EGL_PLATFORM_ANGLE_ANGLE)
+    {
+        window->context.egl.surface =
+            eglCreatePlatformWindowSurfaceEXT(_glfw.egl.display, config, native, attribs);
+    }
+    else
+    {
+        window->context.egl.surface =
+            eglCreateWindowSurface(_glfw.egl.display, config, native, attribs);
+    }
+
     if (window->context.egl.surface == EGL_NO_SURFACE)
     {
         _glfwInputError(GLFW_PLATFORM_ERROR,
@@ -745,7 +806,7 @@
             if (_glfw.egl.prefix != (strncmp(sonames[i], "lib", 3) == 0))
                 continue;
 
-            window->context.egl.client = _glfw_dlopen(sonames[i]);
+            window->context.egl.client = _glfwPlatformLoadModule(sonames[i]);
             if (window->context.egl.client)
                 break;
         }
@@ -768,7 +829,7 @@
     return GLFW_TRUE;
 }
 
-#undef setAttrib
+#undef SET_ATTRIB
 
 // Returns the Visual and depth of the chosen EGLConfig
 //
diff --git a/src/egl_context.h b/src/egl_context.h
deleted file mode 100644
index 47493a6..0000000
--- a/src/egl_context.h
+++ /dev/null
@@ -1,217 +0,0 @@
-//========================================================================
-// GLFW 3.3 EGL - www.glfw.org
-//------------------------------------------------------------------------
-// Copyright (c) 2002-2006 Marcus Geelnard
-// Copyright (c) 2006-2017 Camilla Löwy <elmindreda@glfw.org>
-//
-// 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.
-//
-//========================================================================
-
-#if defined(_GLFW_USE_EGLPLATFORM_H)
- #include <EGL/eglplatform.h>
-#elif defined(_GLFW_WIN32)
- #define EGLAPIENTRY __stdcall
-typedef HDC EGLNativeDisplayType;
-typedef HWND EGLNativeWindowType;
-#elif defined(_GLFW_COCOA)
- #define EGLAPIENTRY
-typedef void* EGLNativeDisplayType;
-typedef id EGLNativeWindowType;
-#elif defined(_GLFW_X11)
- #define EGLAPIENTRY
-typedef Display* EGLNativeDisplayType;
-typedef Window EGLNativeWindowType;
-#elif defined(_GLFW_WAYLAND)
- #define EGLAPIENTRY
-typedef struct wl_display* EGLNativeDisplayType;
-typedef struct wl_egl_window* EGLNativeWindowType;
-#else
- #error "No supported EGL platform selected"
-#endif
-
-#define EGL_SUCCESS 0x3000
-#define EGL_NOT_INITIALIZED 0x3001
-#define EGL_BAD_ACCESS 0x3002
-#define EGL_BAD_ALLOC 0x3003
-#define EGL_BAD_ATTRIBUTE 0x3004
-#define EGL_BAD_CONFIG 0x3005
-#define EGL_BAD_CONTEXT 0x3006
-#define EGL_BAD_CURRENT_SURFACE 0x3007
-#define EGL_BAD_DISPLAY 0x3008
-#define EGL_BAD_MATCH 0x3009
-#define EGL_BAD_NATIVE_PIXMAP 0x300a
-#define EGL_BAD_NATIVE_WINDOW 0x300b
-#define EGL_BAD_PARAMETER 0x300c
-#define EGL_BAD_SURFACE 0x300d
-#define EGL_CONTEXT_LOST 0x300e
-#define EGL_COLOR_BUFFER_TYPE 0x303f
-#define EGL_RGB_BUFFER 0x308e
-#define EGL_SURFACE_TYPE 0x3033
-#define EGL_WINDOW_BIT 0x0004
-#define EGL_RENDERABLE_TYPE 0x3040
-#define EGL_OPENGL_ES_BIT 0x0001
-#define EGL_OPENGL_ES2_BIT 0x0004
-#define EGL_OPENGL_BIT 0x0008
-#define EGL_ALPHA_SIZE 0x3021
-#define EGL_BLUE_SIZE 0x3022
-#define EGL_GREEN_SIZE 0x3023
-#define EGL_RED_SIZE 0x3024
-#define EGL_DEPTH_SIZE 0x3025
-#define EGL_STENCIL_SIZE 0x3026
-#define EGL_SAMPLES 0x3031
-#define EGL_OPENGL_ES_API 0x30a0
-#define EGL_OPENGL_API 0x30a2
-#define EGL_NONE 0x3038
-#define EGL_RENDER_BUFFER 0x3086
-#define EGL_SINGLE_BUFFER 0x3085
-#define EGL_EXTENSIONS 0x3055
-#define EGL_CONTEXT_CLIENT_VERSION 0x3098
-#define EGL_NATIVE_VISUAL_ID 0x302e
-#define EGL_NO_SURFACE ((EGLSurface) 0)
-#define EGL_NO_DISPLAY ((EGLDisplay) 0)
-#define EGL_NO_CONTEXT ((EGLContext) 0)
-#define EGL_DEFAULT_DISPLAY ((EGLNativeDisplayType) 0)
-
-#define EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR 0x00000002
-#define EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR 0x00000001
-#define EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT_KHR 0x00000002
-#define EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR 0x00000001
-#define EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_KHR 0x31bd
-#define EGL_NO_RESET_NOTIFICATION_KHR 0x31be
-#define EGL_LOSE_CONTEXT_ON_RESET_KHR 0x31bf
-#define EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR 0x00000004
-#define EGL_CONTEXT_MAJOR_VERSION_KHR 0x3098
-#define EGL_CONTEXT_MINOR_VERSION_KHR 0x30fb
-#define EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR 0x30fd
-#define EGL_CONTEXT_FLAGS_KHR 0x30fc
-#define EGL_CONTEXT_OPENGL_NO_ERROR_KHR 0x31b3
-#define EGL_GL_COLORSPACE_KHR 0x309d
-#define EGL_GL_COLORSPACE_SRGB_KHR 0x3089
-#define EGL_CONTEXT_RELEASE_BEHAVIOR_KHR 0x2097
-#define EGL_CONTEXT_RELEASE_BEHAVIOR_NONE_KHR 0
-#define EGL_CONTEXT_RELEASE_BEHAVIOR_FLUSH_KHR 0x2098
-#define EGL_PRESENT_OPAQUE_EXT 0x31df
-
-typedef int EGLint;
-typedef unsigned int EGLBoolean;
-typedef unsigned int EGLenum;
-typedef void* EGLConfig;
-typedef void* EGLContext;
-typedef void* EGLDisplay;
-typedef void* EGLSurface;
-
-// EGL function pointer typedefs
-typedef EGLBoolean (EGLAPIENTRY * PFN_eglGetConfigAttrib)(EGLDisplay,EGLConfig,EGLint,EGLint*);
-typedef EGLBoolean (EGLAPIENTRY * PFN_eglGetConfigs)(EGLDisplay,EGLConfig*,EGLint,EGLint*);
-typedef EGLDisplay (EGLAPIENTRY * PFN_eglGetDisplay)(EGLNativeDisplayType);
-typedef EGLint (EGLAPIENTRY * PFN_eglGetError)(void);
-typedef EGLBoolean (EGLAPIENTRY * PFN_eglInitialize)(EGLDisplay,EGLint*,EGLint*);
-typedef EGLBoolean (EGLAPIENTRY * PFN_eglTerminate)(EGLDisplay);
-typedef EGLBoolean (EGLAPIENTRY * PFN_eglBindAPI)(EGLenum);
-typedef EGLContext (EGLAPIENTRY * PFN_eglCreateContext)(EGLDisplay,EGLConfig,EGLContext,const EGLint*);
-typedef EGLBoolean (EGLAPIENTRY * PFN_eglDestroySurface)(EGLDisplay,EGLSurface);
-typedef EGLBoolean (EGLAPIENTRY * PFN_eglDestroyContext)(EGLDisplay,EGLContext);
-typedef EGLSurface (EGLAPIENTRY * PFN_eglCreateWindowSurface)(EGLDisplay,EGLConfig,EGLNativeWindowType,const EGLint*);
-typedef EGLBoolean (EGLAPIENTRY * PFN_eglMakeCurrent)(EGLDisplay,EGLSurface,EGLSurface,EGLContext);
-typedef EGLBoolean (EGLAPIENTRY * PFN_eglSwapBuffers)(EGLDisplay,EGLSurface);
-typedef EGLBoolean (EGLAPIENTRY * PFN_eglSwapInterval)(EGLDisplay,EGLint);
-typedef const char* (EGLAPIENTRY * PFN_eglQueryString)(EGLDisplay,EGLint);
-typedef GLFWglproc (EGLAPIENTRY * PFN_eglGetProcAddress)(const char*);
-#define eglGetConfigAttrib _glfw.egl.GetConfigAttrib
-#define eglGetConfigs _glfw.egl.GetConfigs
-#define eglGetDisplay _glfw.egl.GetDisplay
-#define eglGetError _glfw.egl.GetError
-#define eglInitialize _glfw.egl.Initialize
-#define eglTerminate _glfw.egl.Terminate
-#define eglBindAPI _glfw.egl.BindAPI
-#define eglCreateContext _glfw.egl.CreateContext
-#define eglDestroySurface _glfw.egl.DestroySurface
-#define eglDestroyContext _glfw.egl.DestroyContext
-#define eglCreateWindowSurface _glfw.egl.CreateWindowSurface
-#define eglMakeCurrent _glfw.egl.MakeCurrent
-#define eglSwapBuffers _glfw.egl.SwapBuffers
-#define eglSwapInterval _glfw.egl.SwapInterval
-#define eglQueryString _glfw.egl.QueryString
-#define eglGetProcAddress _glfw.egl.GetProcAddress
-
-#define _GLFW_EGL_CONTEXT_STATE            _GLFWcontextEGL egl
-#define _GLFW_EGL_LIBRARY_CONTEXT_STATE    _GLFWlibraryEGL egl
-
-
-// EGL-specific per-context data
-//
-typedef struct _GLFWcontextEGL
-{
-   EGLConfig        config;
-   EGLContext       handle;
-   EGLSurface       surface;
-
-   void*            client;
-} _GLFWcontextEGL;
-
-// EGL-specific global data
-//
-typedef struct _GLFWlibraryEGL
-{
-    EGLDisplay      display;
-    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_present_opaque;
-
-    void*           handle;
-
-    PFN_eglGetConfigAttrib      GetConfigAttrib;
-    PFN_eglGetConfigs           GetConfigs;
-    PFN_eglGetDisplay           GetDisplay;
-    PFN_eglGetError             GetError;
-    PFN_eglInitialize           Initialize;
-    PFN_eglTerminate            Terminate;
-    PFN_eglBindAPI              BindAPI;
-    PFN_eglCreateContext        CreateContext;
-    PFN_eglDestroySurface       DestroySurface;
-    PFN_eglDestroyContext       DestroyContext;
-    PFN_eglCreateWindowSurface  CreateWindowSurface;
-    PFN_eglMakeCurrent          MakeCurrent;
-    PFN_eglSwapBuffers          SwapBuffers;
-    PFN_eglSwapInterval         SwapInterval;
-    PFN_eglQueryString          QueryString;
-    PFN_eglGetProcAddress       GetProcAddress;
-} _GLFWlibraryEGL;
-
-
-GLFWbool _glfwInitEGL(void);
-void _glfwTerminateEGL(void);
-GLFWbool _glfwCreateContextEGL(_GLFWwindow* window,
-                               const _GLFWctxconfig* ctxconfig,
-                               const _GLFWfbconfig* fbconfig);
-#if defined(_GLFW_X11)
-GLFWbool _glfwChooseVisualEGL(const _GLFWwndconfig* wndconfig,
-                              const _GLFWctxconfig* ctxconfig,
-                              const _GLFWfbconfig* fbconfig,
-                              Visual** visual, int* depth);
-#endif /*_GLFW_X11*/
-
diff --git a/src/glfw.rc.in b/src/glfw.rc.in
new file mode 100644
index 0000000..ac3460a
--- /dev/null
+++ b/src/glfw.rc.in
@@ -0,0 +1,30 @@
+
+#include <winver.h>
+
+VS_VERSION_INFO VERSIONINFO
+FILEVERSION @GLFW_VERSION_MAJOR@,@GLFW_VERSION_MINOR@,@GLFW_VERSION_PATCH@,0
+PRODUCTVERSION @GLFW_VERSION_MAJOR@,@GLFW_VERSION_MINOR@,@GLFW_VERSION_PATCH@,0
+FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
+FILEFLAGS 0
+FILEOS VOS_NT_WINDOWS32
+FILETYPE VFT_DLL
+FILESUBTYPE 0
+{
+    BLOCK "StringFileInfo"
+    {
+        BLOCK "040904B0"
+        {
+            VALUE "CompanyName", "GLFW"
+            VALUE "FileDescription", "GLFW @GLFW_VERSION@ DLL"
+            VALUE "FileVersion", "@GLFW_VERSION@"
+            VALUE "OriginalFilename", "glfw3.dll"
+            VALUE "ProductName", "GLFW"
+            VALUE "ProductVersion", "@GLFW_VERSION@"
+        }
+    }
+    BLOCK "VarFileInfo"
+    {
+        VALUE "Translation", 0x409, 1200
+    }
+}
+
diff --git a/src/glfw3Config.cmake.in b/src/glfw3Config.cmake.in
deleted file mode 100644
index 1fa200e..0000000
--- a/src/glfw3Config.cmake.in
+++ /dev/null
@@ -1 +0,0 @@
-include("${CMAKE_CURRENT_LIST_DIR}/glfw3Targets.cmake")
diff --git a/src/glfw_config.h.in b/src/glfw_config.h.in
deleted file mode 100644
index e30c9c1..0000000
--- a/src/glfw_config.h.in
+++ /dev/null
@@ -1,58 +0,0 @@
-//========================================================================
-// GLFW 3.3 - www.glfw.org
-//------------------------------------------------------------------------
-// Copyright (c) 2010-2016 Camilla Löwy <elmindreda@glfw.org>
-//
-// 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.
-//
-//========================================================================
-// As glfw_config.h.in, this file is used by CMake to produce the
-// glfw_config.h configuration header file.  If you are adding a feature
-// requiring conditional compilation, this is where to add the macro.
-//========================================================================
-// As glfw_config.h, this file defines compile-time option macros for a
-// specific platform and development environment.  If you are using the
-// GLFW CMake files, modify glfw_config.h.in instead of this file.  If you
-// are using your own build system, make this file define the appropriate
-// macros in whatever way is suitable.
-//========================================================================
-
-// Define this to 1 if building GLFW for X11
-#cmakedefine _GLFW_X11
-// Define this to 1 if building GLFW for Win32
-#cmakedefine _GLFW_WIN32
-// Define this to 1 if building GLFW for Cocoa
-#cmakedefine _GLFW_COCOA
-// Define this to 1 if building GLFW for Wayland
-#cmakedefine _GLFW_WAYLAND
-// Define this to 1 if building GLFW for OSMesa
-#cmakedefine _GLFW_OSMESA
-
-// Define this to 1 if building as a shared library / dynamic library / DLL
-#cmakedefine _GLFW_BUILD_DLL
-// Define this to 1 to use Vulkan loader linked statically into application
-#cmakedefine _GLFW_VULKAN_STATIC
-
-// Define this to 1 to force use of high-performance GPU on hybrid systems
-#cmakedefine _GLFW_USE_HYBRID_HPG
-
-// Define this to 1 if the libc supports memfd_create()
-#cmakedefine HAVE_MEMFD_CREATE
-
diff --git a/src/glx_context.c b/src/glx_context.c
index 220e3d0..7082682 100644
--- a/src/glx_context.c
+++ b/src/glx_context.c
@@ -1,5 +1,5 @@
 //========================================================================
-// GLFW 3.3 GLX - www.glfw.org
+// GLFW 3.4 GLX - www.glfw.org
 //------------------------------------------------------------------------
 // Copyright (c) 2002-2006 Marcus Geelnard
 // Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.org>
@@ -24,11 +24,11 @@
 //    distribution.
 //
 //========================================================================
-// It is fine to use C99 in this file because it will not be built with VS
-//========================================================================
 
 #include "internal.h"
 
+#if defined(_GLFW_X11)
+
 #include <string.h>
 #include <stdlib.h>
 #include <assert.h>
@@ -55,7 +55,7 @@
     GLXFBConfig* nativeConfigs;
     _GLFWfbconfig* usableConfigs;
     const _GLFWfbconfig* closest;
-    int i, nativeCount, usableCount;
+    int nativeCount, usableCount;
     const char* vendor;
     GLFWbool trustWindowBit = GLFW_TRUE;
 
@@ -73,10 +73,10 @@
         return GLFW_FALSE;
     }
 
-    usableConfigs = calloc(nativeCount, sizeof(_GLFWfbconfig));
+    usableConfigs = _glfw_calloc(nativeCount, sizeof(_GLFWfbconfig));
     usableCount = 0;
 
-    for (i = 0;  i < nativeCount;  i++)
+    for (int i = 0;  i < nativeCount;  i++)
     {
         const GLXFBConfig n = nativeConfigs[i];
         _GLFWfbconfig* u = usableConfigs + usableCount;
@@ -138,7 +138,7 @@
         *result = (GLXFBConfig) closest->handle;
 
     XFree(nativeConfigs);
-    free(usableConfigs);
+    _glfw_free(usableConfigs);
 
     return closest != NULL;
 }
@@ -229,7 +229,7 @@
     else
     {
         // NOTE: glvnd provides GLX 1.4, so this can only happen with libGL
-        return _glfw_dlsym(_glfw.glx.handle, procname);
+        return _glfwPlatformGetModuleSymbol(_glfw.glx.handle, procname);
     }
 }
 
@@ -257,7 +257,6 @@
 //
 GLFWbool _glfwInitGLX(void)
 {
-    int i;
     const char* sonames[] =
     {
 #if defined(_GLFW_GLX_LIBRARY)
@@ -277,9 +276,9 @@
     if (_glfw.glx.handle)
         return GLFW_TRUE;
 
-    for (i = 0;  sonames[i];  i++)
+    for (int i = 0;  sonames[i];  i++)
     {
-        _glfw.glx.handle = _glfw_dlopen(sonames[i]);
+        _glfw.glx.handle = _glfwPlatformLoadModule(sonames[i]);
         if (_glfw.glx.handle)
             break;
     }
@@ -290,32 +289,32 @@
         return GLFW_FALSE;
     }
 
-    _glfw.glx.GetFBConfigs =
-        _glfw_dlsym(_glfw.glx.handle, "glXGetFBConfigs");
-    _glfw.glx.GetFBConfigAttrib =
-        _glfw_dlsym(_glfw.glx.handle, "glXGetFBConfigAttrib");
-    _glfw.glx.GetClientString =
-        _glfw_dlsym(_glfw.glx.handle, "glXGetClientString");
-    _glfw.glx.QueryExtension =
-        _glfw_dlsym(_glfw.glx.handle, "glXQueryExtension");
-    _glfw.glx.QueryVersion =
-        _glfw_dlsym(_glfw.glx.handle, "glXQueryVersion");
-    _glfw.glx.DestroyContext =
-        _glfw_dlsym(_glfw.glx.handle, "glXDestroyContext");
-    _glfw.glx.MakeCurrent =
-        _glfw_dlsym(_glfw.glx.handle, "glXMakeCurrent");
-    _glfw.glx.SwapBuffers =
-        _glfw_dlsym(_glfw.glx.handle, "glXSwapBuffers");
-    _glfw.glx.QueryExtensionsString =
-        _glfw_dlsym(_glfw.glx.handle, "glXQueryExtensionsString");
-    _glfw.glx.CreateNewContext =
-        _glfw_dlsym(_glfw.glx.handle, "glXCreateNewContext");
-    _glfw.glx.CreateWindow =
-        _glfw_dlsym(_glfw.glx.handle, "glXCreateWindow");
-    _glfw.glx.DestroyWindow =
-        _glfw_dlsym(_glfw.glx.handle, "glXDestroyWindow");
-    _glfw.glx.GetVisualFromFBConfig =
-        _glfw_dlsym(_glfw.glx.handle, "glXGetVisualFromFBConfig");
+    _glfw.glx.GetFBConfigs = (PFNGLXGETFBCONFIGSPROC)
+        _glfwPlatformGetModuleSymbol(_glfw.glx.handle, "glXGetFBConfigs");
+    _glfw.glx.GetFBConfigAttrib = (PFNGLXGETFBCONFIGATTRIBPROC)
+        _glfwPlatformGetModuleSymbol(_glfw.glx.handle, "glXGetFBConfigAttrib");
+    _glfw.glx.GetClientString = (PFNGLXGETCLIENTSTRINGPROC)
+        _glfwPlatformGetModuleSymbol(_glfw.glx.handle, "glXGetClientString");
+    _glfw.glx.QueryExtension = (PFNGLXQUERYEXTENSIONPROC)
+        _glfwPlatformGetModuleSymbol(_glfw.glx.handle, "glXQueryExtension");
+    _glfw.glx.QueryVersion = (PFNGLXQUERYVERSIONPROC)
+        _glfwPlatformGetModuleSymbol(_glfw.glx.handle, "glXQueryVersion");
+    _glfw.glx.DestroyContext = (PFNGLXDESTROYCONTEXTPROC)
+        _glfwPlatformGetModuleSymbol(_glfw.glx.handle, "glXDestroyContext");
+    _glfw.glx.MakeCurrent = (PFNGLXMAKECURRENTPROC)
+        _glfwPlatformGetModuleSymbol(_glfw.glx.handle, "glXMakeCurrent");
+    _glfw.glx.SwapBuffers = (PFNGLXSWAPBUFFERSPROC)
+        _glfwPlatformGetModuleSymbol(_glfw.glx.handle, "glXSwapBuffers");
+    _glfw.glx.QueryExtensionsString = (PFNGLXQUERYEXTENSIONSSTRINGPROC)
+        _glfwPlatformGetModuleSymbol(_glfw.glx.handle, "glXQueryExtensionsString");
+    _glfw.glx.CreateNewContext = (PFNGLXCREATENEWCONTEXTPROC)
+        _glfwPlatformGetModuleSymbol(_glfw.glx.handle, "glXCreateNewContext");
+    _glfw.glx.CreateWindow = (PFNGLXCREATEWINDOWPROC)
+        _glfwPlatformGetModuleSymbol(_glfw.glx.handle, "glXCreateWindow");
+    _glfw.glx.DestroyWindow = (PFNGLXDESTROYWINDOWPROC)
+        _glfwPlatformGetModuleSymbol(_glfw.glx.handle, "glXDestroyWindow");
+    _glfw.glx.GetVisualFromFBConfig = (PFNGLXGETVISUALFROMFBCONFIGPROC)
+        _glfwPlatformGetModuleSymbol(_glfw.glx.handle, "glXGetVisualFromFBConfig");
 
     if (!_glfw.glx.GetFBConfigs ||
         !_glfw.glx.GetFBConfigAttrib ||
@@ -338,9 +337,9 @@
 
     // NOTE: Unlike GLX 1.3 entry points these are not required to be present
     _glfw.glx.GetProcAddress = (PFNGLXGETPROCADDRESSPROC)
-        _glfw_dlsym(_glfw.glx.handle, "glXGetProcAddress");
+        _glfwPlatformGetModuleSymbol(_glfw.glx.handle, "glXGetProcAddress");
     _glfw.glx.GetProcAddressARB = (PFNGLXGETPROCADDRESSPROC)
-        _glfw_dlsym(_glfw.glx.handle, "glXGetProcAddressARB");
+        _glfwPlatformGetModuleSymbol(_glfw.glx.handle, "glXGetProcAddressARB");
 
     if (!glXQueryExtension(_glfw.x11.display,
                            &_glfw.glx.errorBase,
@@ -432,16 +431,16 @@
 void _glfwTerminateGLX(void)
 {
     // NOTE: This function must not call any X11 functions, as it is called
-    //       after XCloseDisplay (see _glfwPlatformTerminate for details)
+    //       after XCloseDisplay (see _glfwTerminateX11 for details)
 
     if (_glfw.glx.handle)
     {
-        _glfw_dlclose(_glfw.glx.handle);
+        _glfwPlatformFreeModule(_glfw.glx.handle);
         _glfw.glx.handle = NULL;
     }
 }
 
-#define setAttrib(a, v) \
+#define SET_ATTRIB(a, v) \
 { \
     assert(((size_t) index + 1) < sizeof(attribs) / sizeof(attribs[0])); \
     attribs[index++] = a; \
@@ -529,13 +528,13 @@
             {
                 if (ctxconfig->robustness == GLFW_NO_RESET_NOTIFICATION)
                 {
-                    setAttrib(GLX_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB,
-                              GLX_NO_RESET_NOTIFICATION_ARB);
+                    SET_ATTRIB(GLX_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB,
+                               GLX_NO_RESET_NOTIFICATION_ARB);
                 }
                 else if (ctxconfig->robustness == GLFW_LOSE_CONTEXT_ON_RESET)
                 {
-                    setAttrib(GLX_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB,
-                              GLX_LOSE_CONTEXT_ON_RESET_ARB);
+                    SET_ATTRIB(GLX_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB,
+                               GLX_LOSE_CONTEXT_ON_RESET_ARB);
                 }
 
                 flags |= GLX_CONTEXT_ROBUST_ACCESS_BIT_ARB;
@@ -548,13 +547,13 @@
             {
                 if (ctxconfig->release == GLFW_RELEASE_BEHAVIOR_NONE)
                 {
-                    setAttrib(GLX_CONTEXT_RELEASE_BEHAVIOR_ARB,
-                              GLX_CONTEXT_RELEASE_BEHAVIOR_NONE_ARB);
+                    SET_ATTRIB(GLX_CONTEXT_RELEASE_BEHAVIOR_ARB,
+                               GLX_CONTEXT_RELEASE_BEHAVIOR_NONE_ARB);
                 }
                 else if (ctxconfig->release == GLFW_RELEASE_BEHAVIOR_FLUSH)
                 {
-                    setAttrib(GLX_CONTEXT_RELEASE_BEHAVIOR_ARB,
-                              GLX_CONTEXT_RELEASE_BEHAVIOR_FLUSH_ARB);
+                    SET_ATTRIB(GLX_CONTEXT_RELEASE_BEHAVIOR_ARB,
+                               GLX_CONTEXT_RELEASE_BEHAVIOR_FLUSH_ARB);
                 }
             }
         }
@@ -562,7 +561,7 @@
         if (ctxconfig->noerror)
         {
             if (_glfw.glx.ARB_create_context_no_error)
-                setAttrib(GLX_CONTEXT_OPENGL_NO_ERROR_ARB, GLFW_TRUE);
+                SET_ATTRIB(GLX_CONTEXT_OPENGL_NO_ERROR_ARB, GLFW_TRUE);
         }
 
         // NOTE: Only request an explicitly versioned context when necessary, as
@@ -570,17 +569,17 @@
         //       highest version supported by the driver
         if (ctxconfig->major != 1 || ctxconfig->minor != 0)
         {
-            setAttrib(GLX_CONTEXT_MAJOR_VERSION_ARB, ctxconfig->major);
-            setAttrib(GLX_CONTEXT_MINOR_VERSION_ARB, ctxconfig->minor);
+            SET_ATTRIB(GLX_CONTEXT_MAJOR_VERSION_ARB, ctxconfig->major);
+            SET_ATTRIB(GLX_CONTEXT_MINOR_VERSION_ARB, ctxconfig->minor);
         }
 
         if (mask)
-            setAttrib(GLX_CONTEXT_PROFILE_MASK_ARB, mask);
+            SET_ATTRIB(GLX_CONTEXT_PROFILE_MASK_ARB, mask);
 
         if (flags)
-            setAttrib(GLX_CONTEXT_FLAGS_ARB, flags);
+            SET_ATTRIB(GLX_CONTEXT_FLAGS_ARB, flags);
 
-        setAttrib(None, None);
+        SET_ATTRIB(None, None);
 
         window->context.glx.handle =
             _glfw.glx.CreateContextAttribsARB(_glfw.x11.display,
@@ -637,7 +636,7 @@
     return GLFW_TRUE;
 }
 
-#undef setAttrib
+#undef SET_ATTRIB
 
 // Returns the Visual and depth of the chosen GLXFBConfig
 //
@@ -681,6 +680,12 @@
     _GLFWwindow* window = (_GLFWwindow*) handle;
     _GLFW_REQUIRE_INIT_OR_RETURN(NULL);
 
+    if (_glfw.platform.platformID != GLFW_PLATFORM_X11)
+    {
+        _glfwInputError(GLFW_PLATFORM_UNAVAILABLE, "GLX: Platform not initialized");
+        return NULL;
+    }
+
     if (window->context.source != GLFW_NATIVE_CONTEXT_API)
     {
         _glfwInputError(GLFW_NO_WINDOW_CONTEXT, NULL);
@@ -695,6 +700,12 @@
     _GLFWwindow* window = (_GLFWwindow*) handle;
     _GLFW_REQUIRE_INIT_OR_RETURN(None);
 
+    if (_glfw.platform.platformID != GLFW_PLATFORM_X11)
+    {
+        _glfwInputError(GLFW_PLATFORM_UNAVAILABLE, "GLX: Platform not initialized");
+        return None;
+    }
+
     if (window->context.source != GLFW_NATIVE_CONTEXT_API)
     {
         _glfwInputError(GLFW_NO_WINDOW_CONTEXT, NULL);
@@ -704,3 +715,5 @@
     return window->context.glx.window;
 }
 
+#endif // _GLFW_X11
+
diff --git a/src/glx_context.h b/src/glx_context.h
deleted file mode 100644
index 2ea17d1..0000000
--- a/src/glx_context.h
+++ /dev/null
@@ -1,178 +0,0 @@
-//========================================================================
-// GLFW 3.3 GLX - www.glfw.org
-//------------------------------------------------------------------------
-// Copyright (c) 2002-2006 Marcus Geelnard
-// Copyright (c) 2006-2017 Camilla Löwy <elmindreda@glfw.org>
-//
-// 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 GLX_VENDOR 1
-#define GLX_RGBA_BIT 0x00000001
-#define GLX_WINDOW_BIT 0x00000001
-#define GLX_DRAWABLE_TYPE 0x8010
-#define GLX_RENDER_TYPE 0x8011
-#define GLX_RGBA_TYPE 0x8014
-#define GLX_DOUBLEBUFFER 5
-#define GLX_STEREO 6
-#define GLX_AUX_BUFFERS 7
-#define GLX_RED_SIZE 8
-#define GLX_GREEN_SIZE 9
-#define GLX_BLUE_SIZE 10
-#define GLX_ALPHA_SIZE 11
-#define GLX_DEPTH_SIZE 12
-#define GLX_STENCIL_SIZE 13
-#define GLX_ACCUM_RED_SIZE 14
-#define GLX_ACCUM_GREEN_SIZE 15
-#define GLX_ACCUM_BLUE_SIZE 16
-#define GLX_ACCUM_ALPHA_SIZE 17
-#define GLX_SAMPLES 0x186a1
-#define GLX_VISUAL_ID 0x800b
-
-#define GLX_FRAMEBUFFER_SRGB_CAPABLE_ARB 0x20b2
-#define GLX_CONTEXT_DEBUG_BIT_ARB 0x00000001
-#define GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB 0x00000002
-#define GLX_CONTEXT_CORE_PROFILE_BIT_ARB 0x00000001
-#define GLX_CONTEXT_PROFILE_MASK_ARB 0x9126
-#define GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x00000002
-#define GLX_CONTEXT_MAJOR_VERSION_ARB 0x2091
-#define GLX_CONTEXT_MINOR_VERSION_ARB 0x2092
-#define GLX_CONTEXT_FLAGS_ARB 0x2094
-#define GLX_CONTEXT_ES2_PROFILE_BIT_EXT 0x00000004
-#define GLX_CONTEXT_ROBUST_ACCESS_BIT_ARB 0x00000004
-#define GLX_LOSE_CONTEXT_ON_RESET_ARB 0x8252
-#define GLX_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB 0x8256
-#define GLX_NO_RESET_NOTIFICATION_ARB 0x8261
-#define GLX_CONTEXT_RELEASE_BEHAVIOR_ARB 0x2097
-#define GLX_CONTEXT_RELEASE_BEHAVIOR_NONE_ARB 0
-#define GLX_CONTEXT_RELEASE_BEHAVIOR_FLUSH_ARB 0x2098
-#define GLX_CONTEXT_OPENGL_NO_ERROR_ARB 0x31b3
-
-typedef XID GLXWindow;
-typedef XID GLXDrawable;
-typedef struct __GLXFBConfig* GLXFBConfig;
-typedef struct __GLXcontext* GLXContext;
-typedef void (*__GLXextproc)(void);
-
-typedef int (*PFNGLXGETFBCONFIGATTRIBPROC)(Display*,GLXFBConfig,int,int*);
-typedef const char* (*PFNGLXGETCLIENTSTRINGPROC)(Display*,int);
-typedef Bool (*PFNGLXQUERYEXTENSIONPROC)(Display*,int*,int*);
-typedef Bool (*PFNGLXQUERYVERSIONPROC)(Display*,int*,int*);
-typedef void (*PFNGLXDESTROYCONTEXTPROC)(Display*,GLXContext);
-typedef Bool (*PFNGLXMAKECURRENTPROC)(Display*,GLXDrawable,GLXContext);
-typedef void (*PFNGLXSWAPBUFFERSPROC)(Display*,GLXDrawable);
-typedef const char* (*PFNGLXQUERYEXTENSIONSSTRINGPROC)(Display*,int);
-typedef GLXFBConfig* (*PFNGLXGETFBCONFIGSPROC)(Display*,int,int*);
-typedef GLXContext (*PFNGLXCREATENEWCONTEXTPROC)(Display*,GLXFBConfig,int,GLXContext,Bool);
-typedef __GLXextproc (* PFNGLXGETPROCADDRESSPROC)(const GLubyte *procName);
-typedef void (*PFNGLXSWAPINTERVALEXTPROC)(Display*,GLXDrawable,int);
-typedef XVisualInfo* (*PFNGLXGETVISUALFROMFBCONFIGPROC)(Display*,GLXFBConfig);
-typedef GLXWindow (*PFNGLXCREATEWINDOWPROC)(Display*,GLXFBConfig,Window,const int*);
-typedef void (*PFNGLXDESTROYWINDOWPROC)(Display*,GLXWindow);
-
-typedef int (*PFNGLXSWAPINTERVALMESAPROC)(int);
-typedef int (*PFNGLXSWAPINTERVALSGIPROC)(int);
-typedef GLXContext (*PFNGLXCREATECONTEXTATTRIBSARBPROC)(Display*,GLXFBConfig,GLXContext,Bool,const int*);
-
-// libGL.so function pointer typedefs
-#define glXGetFBConfigs _glfw.glx.GetFBConfigs
-#define glXGetFBConfigAttrib _glfw.glx.GetFBConfigAttrib
-#define glXGetClientString _glfw.glx.GetClientString
-#define glXQueryExtension _glfw.glx.QueryExtension
-#define glXQueryVersion _glfw.glx.QueryVersion
-#define glXDestroyContext _glfw.glx.DestroyContext
-#define glXMakeCurrent _glfw.glx.MakeCurrent
-#define glXSwapBuffers _glfw.glx.SwapBuffers
-#define glXQueryExtensionsString _glfw.glx.QueryExtensionsString
-#define glXCreateNewContext _glfw.glx.CreateNewContext
-#define glXGetVisualFromFBConfig _glfw.glx.GetVisualFromFBConfig
-#define glXCreateWindow _glfw.glx.CreateWindow
-#define glXDestroyWindow _glfw.glx.DestroyWindow
-
-#define _GLFW_PLATFORM_CONTEXT_STATE            _GLFWcontextGLX glx
-#define _GLFW_PLATFORM_LIBRARY_CONTEXT_STATE    _GLFWlibraryGLX glx
-
-
-// GLX-specific per-context data
-//
-typedef struct _GLFWcontextGLX
-{
-    GLXContext      handle;
-    GLXWindow       window;
-} _GLFWcontextGLX;
-
-// GLX-specific global data
-//
-typedef struct _GLFWlibraryGLX
-{
-    int             major, minor;
-    int             eventBase;
-    int             errorBase;
-
-    void*           handle;
-
-    // GLX 1.3 functions
-    PFNGLXGETFBCONFIGSPROC              GetFBConfigs;
-    PFNGLXGETFBCONFIGATTRIBPROC         GetFBConfigAttrib;
-    PFNGLXGETCLIENTSTRINGPROC           GetClientString;
-    PFNGLXQUERYEXTENSIONPROC            QueryExtension;
-    PFNGLXQUERYVERSIONPROC              QueryVersion;
-    PFNGLXDESTROYCONTEXTPROC            DestroyContext;
-    PFNGLXMAKECURRENTPROC               MakeCurrent;
-    PFNGLXSWAPBUFFERSPROC               SwapBuffers;
-    PFNGLXQUERYEXTENSIONSSTRINGPROC     QueryExtensionsString;
-    PFNGLXCREATENEWCONTEXTPROC          CreateNewContext;
-    PFNGLXGETVISUALFROMFBCONFIGPROC     GetVisualFromFBConfig;
-    PFNGLXCREATEWINDOWPROC              CreateWindow;
-    PFNGLXDESTROYWINDOWPROC             DestroyWindow;
-
-    // GLX 1.4 and extension functions
-    PFNGLXGETPROCADDRESSPROC            GetProcAddress;
-    PFNGLXGETPROCADDRESSPROC            GetProcAddressARB;
-    PFNGLXSWAPINTERVALSGIPROC           SwapIntervalSGI;
-    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;
-} _GLFWlibraryGLX;
-
-GLFWbool _glfwInitGLX(void);
-void _glfwTerminateGLX(void);
-GLFWbool _glfwCreateContextGLX(_GLFWwindow* window,
-                               const _GLFWctxconfig* ctxconfig,
-                               const _GLFWfbconfig* fbconfig);
-void _glfwDestroyContextGLX(_GLFWwindow* window);
-GLFWbool _glfwChooseVisualGLX(const _GLFWwndconfig* wndconfig,
-                              const _GLFWctxconfig* ctxconfig,
-                              const _GLFWfbconfig* fbconfig,
-                              Visual** visual, int* depth);
-
diff --git a/src/init.c b/src/init.c
index b1af8e5..532264e 100644
--- a/src/init.c
+++ b/src/init.c
@@ -1,5 +1,5 @@
 //========================================================================
-// GLFW 3.3 - www.glfw.org
+// GLFW 3.4 - www.glfw.org
 //------------------------------------------------------------------------
 // Copyright (c) 2002-2006 Marcus Geelnard
 // Copyright (c) 2006-2018 Camilla Löwy <elmindreda@glfw.org>
@@ -24,8 +24,6 @@
 //    distribution.
 //
 //========================================================================
-// Please use C89 style variable declarations in this file because VS 2010
-//========================================================================
 
 #include "internal.h"
 
@@ -48,18 +46,49 @@
 //
 static _GLFWerror _glfwMainThreadError;
 static GLFWerrorfun _glfwErrorCallback;
+static GLFWallocator _glfwInitAllocator;
 static _GLFWinitconfig _glfwInitHints =
 {
-    GLFW_TRUE,      // hat buttons
+    .hatButtons = GLFW_TRUE,
+    .angleType = GLFW_ANGLE_PLATFORM_TYPE_NONE,
+    .platformID = GLFW_ANY_PLATFORM,
+    .vulkanLoader = NULL,
+    .ns =
     {
-        GLFW_TRUE,  // macOS menu bar
-        GLFW_TRUE   // macOS bundle chdir
+        .menubar = GLFW_TRUE,
+        .chdir = GLFW_TRUE
     },
+    .x11 =
     {
-        GLFW_WAYLAND_PREFER_LIBDECOR // Wayland libdecor mode
+        .xcbVulkanSurface = GLFW_TRUE,
+    },
+    .wl =
+    {
+        .libdecorMode = GLFW_WAYLAND_PREFER_LIBDECOR
     },
 };
 
+// The allocation function used when no custom allocator is set
+//
+static void* defaultAllocate(size_t size, void* user)
+{
+    return malloc(size);
+}
+
+// The deallocation function used when no custom allocator is set
+//
+static void defaultDeallocate(void* block, void* user)
+{
+    free(block);
+}
+
+// The reallocation function used when no custom allocator is set
+//
+static void* defaultReallocate(void* block, size_t size, void* user)
+{
+    return realloc(block, size);
+}
+
 // Terminate the library
 //
 static void terminate(void)
@@ -78,20 +107,21 @@
     {
         _GLFWmonitor* monitor = _glfw.monitors[i];
         if (monitor->originalRamp.size)
-            _glfwPlatformSetGammaRamp(monitor, &monitor->originalRamp);
+            _glfw.platform.setGammaRamp(monitor, &monitor->originalRamp);
         _glfwFreeMonitor(monitor);
     }
 
-    free(_glfw.monitors);
+    _glfw_free(_glfw.monitors);
     _glfw.monitors = NULL;
     _glfw.monitorCount = 0;
 
-    free(_glfw.mappings);
+    _glfw_free(_glfw.mappings);
     _glfw.mappings = NULL;
     _glfw.mappingCount = 0;
 
     _glfwTerminateVulkan();
-    _glfwPlatformTerminate();
+    _glfw.platform.terminateJoysticks();
+    _glfw.platform.terminate();
 
     _glfw.initialized = GLFW_FALSE;
 
@@ -99,7 +129,7 @@
     {
         _GLFWerror* error = _glfw.errorListHead;
         _glfw.errorListHead = error->next;
-        free(error);
+        _glfw_free(error);
     }
 
     _glfwPlatformDestroyTls(&_glfw.contextSlot);
@@ -175,8 +205,8 @@
 
         (*count)++;
 
-        path = calloc(strlen(line) + 1, 1);
-        paths = realloc(paths, *count * sizeof(char*));
+        path = _glfw_calloc(strlen(line) + 1, 1);
+        paths = _glfw_realloc(paths, *count * sizeof(char*));
         paths[*count - 1] = path;
 
         while (*line)
@@ -201,7 +231,7 @@
 char* _glfw_strdup(const char* source)
 {
     const size_t length = strlen(source);
-    char* result = calloc(length + 1, 1);
+    char* result = _glfw_calloc(length + 1, 1);
     strcpy(result, source);
     return result;
 }
@@ -216,28 +246,57 @@
     return a > b ? a : b;
 }
 
-float _glfw_fminf(float a, float b)
+void* _glfw_calloc(size_t count, size_t size)
 {
-    if (a != a)
-        return b;
-    else if (b != b)
-        return a;
-    else if (a < b)
-        return a;
+    if (count && size)
+    {
+        void* block;
+
+        if (count > SIZE_MAX / size)
+        {
+            _glfwInputError(GLFW_INVALID_VALUE, "Allocation size overflow");
+            return NULL;
+        }
+
+        block = _glfw.allocator.allocate(count * size, _glfw.allocator.user);
+        if (block)
+            return memset(block, 0, count * size);
+        else
+        {
+            _glfwInputError(GLFW_OUT_OF_MEMORY, NULL);
+            return NULL;
+        }
+    }
     else
-        return b;
+        return NULL;
 }
 
-float _glfw_fmaxf(float a, float b)
+void* _glfw_realloc(void* block, size_t size)
 {
-    if (a != a)
-        return b;
-    else if (b != b)
-        return a;
-    else if (a > b)
-        return a;
+    if (block && size)
+    {
+        void* resized = _glfw.allocator.reallocate(block, size, _glfw.allocator.user);
+        if (resized)
+            return resized;
+        else
+        {
+            _glfwInputError(GLFW_OUT_OF_MEMORY, NULL);
+            return NULL;
+        }
+    }
+    else if (block)
+    {
+        _glfw_free(block);
+        return NULL;
+    }
     else
-        return b;
+        return _glfw_calloc(1, size);
+}
+
+void _glfw_free(void* block)
+{
+    if (block)
+        _glfw.allocator.deallocate(block, _glfw.allocator.user);
 }
 
 
@@ -284,6 +343,14 @@
             strcpy(description, "The requested format is unavailable");
         else if (code == GLFW_NO_WINDOW_CONTEXT)
             strcpy(description, "The specified window has no context");
+        else if (code == GLFW_CURSOR_UNAVAILABLE)
+            strcpy(description, "The specified cursor shape is unavailable");
+        else if (code == GLFW_FEATURE_UNAVAILABLE)
+            strcpy(description, "The requested feature cannot be implemented for this platform");
+        else if (code == GLFW_FEATURE_UNIMPLEMENTED)
+            strcpy(description, "The requested feature has not yet been implemented for this platform");
+        else if (code == GLFW_PLATFORM_UNAVAILABLE)
+            strcpy(description, "The requested platform is unavailable");
         else
             strcpy(description, "ERROR: UNKNOWN GLFW ERROR");
     }
@@ -293,7 +360,7 @@
         error = _glfwPlatformGetTls(&_glfw.errorSlot);
         if (!error)
         {
-            error = calloc(1, sizeof(_GLFWerror));
+            error = _glfw_calloc(1, sizeof(_GLFWerror));
             _glfwPlatformSetTls(&_glfw.errorSlot, error);
             _glfwPlatformLockMutex(&_glfw.errorLock);
             error->next = _glfw.errorListHead;
@@ -324,7 +391,18 @@
     memset(&_glfw, 0, sizeof(_glfw));
     _glfw.hints.init = _glfwInitHints;
 
-    if (!_glfwPlatformInit())
+    _glfw.allocator = _glfwInitAllocator;
+    if (!_glfw.allocator.allocate)
+    {
+        _glfw.allocator.allocate   = defaultAllocate;
+        _glfw.allocator.reallocate = defaultReallocate;
+        _glfw.allocator.deallocate = defaultDeallocate;
+    }
+
+    if (!_glfwSelectPlatform(_glfw.hints.init.platformID, &_glfw.platform))
+        return GLFW_FALSE;
+
+    if (!_glfw.platform.init())
     {
         terminate();
         return GLFW_FALSE;
@@ -342,9 +420,11 @@
 
     _glfwInitGamepadMappings();
 
-    _glfw.initialized = GLFW_TRUE;
+    _glfwPlatformInitTimer();
     _glfw.timer.offset = _glfwPlatformGetTimerValue();
 
+    _glfw.initialized = GLFW_TRUE;
+
     glfwDefaultWindowHints();
     return GLFW_TRUE;
 }
@@ -364,12 +444,21 @@
         case GLFW_JOYSTICK_HAT_BUTTONS:
             _glfwInitHints.hatButtons = value;
             return;
+        case GLFW_ANGLE_PLATFORM_TYPE:
+            _glfwInitHints.angleType = value;
+            return;
+        case GLFW_PLATFORM:
+            _glfwInitHints.platformID = value;
+            return;
         case GLFW_COCOA_CHDIR_RESOURCES:
             _glfwInitHints.ns.chdir = value;
             return;
         case GLFW_COCOA_MENUBAR:
             _glfwInitHints.ns.menubar = value;
             return;
+        case GLFW_X11_XCB_VULKAN_SURFACE:
+            _glfwInitHints.x11.xcbVulkanSurface = value;
+            return;
         case GLFW_WAYLAND_LIBDECOR:
             _glfwInitHints.wl.libdecorMode = value;
             return;
@@ -379,6 +468,24 @@
                     "Invalid init hint 0x%08X", hint);
 }
 
+GLFWAPI void glfwInitAllocator(const GLFWallocator* allocator)
+{
+    if (allocator)
+    {
+        if (allocator->allocate && allocator->reallocate && allocator->deallocate)
+            _glfwInitAllocator = *allocator;
+        else
+            _glfwInputError(GLFW_INVALID_VALUE, "Missing function in allocator");
+    }
+    else
+        memset(&_glfwInitAllocator, 0, sizeof(GLFWallocator));
+}
+
+GLFWAPI void glfwInitVulkanLoader(PFN_vkGetInstanceProcAddr loader)
+{
+    _glfwInitHints.vulkanLoader = loader;
+}
+
 GLFWAPI void glfwGetVersion(int* major, int* minor, int* rev)
 {
     if (major != NULL)
@@ -389,11 +496,6 @@
         *rev = GLFW_VERSION_REVISION;
 }
 
-GLFWAPI const char* glfwGetVersionString(void)
-{
-    return _glfwPlatformGetVersionString();
-}
-
 GLFWAPI int glfwGetError(const char** description)
 {
     _GLFWerror* error;
@@ -420,7 +522,7 @@
 
 GLFWAPI GLFWerrorfun glfwSetErrorCallback(GLFWerrorfun cbfun)
 {
-    _GLFW_SWAP_POINTERS(_glfwErrorCallback, cbfun);
+    _GLFW_SWAP(GLFWerrorfun, _glfwErrorCallback, cbfun);
     return cbfun;
 }
 
diff --git a/src/input.c b/src/input.c
index cbb5945..7b3b340 100644
--- a/src/input.c
+++ b/src/input.c
@@ -1,5 +1,5 @@
 //========================================================================
-// GLFW 3.3 - www.glfw.org
+// GLFW 3.4 - www.glfw.org
 //------------------------------------------------------------------------
 // Copyright (c) 2002-2006 Marcus Geelnard
 // Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.org>
@@ -24,8 +24,6 @@
 //    distribution.
 //
 //========================================================================
-// Please use C89 style variable declarations in this file because VS 2010
-//========================================================================
 
 #include "internal.h"
 #include "mappings.h"
@@ -44,6 +42,29 @@
 #define _GLFW_JOYSTICK_BUTTON   2
 #define _GLFW_JOYSTICK_HATBIT   3
 
+#define GLFW_MOD_MASK (GLFW_MOD_SHIFT | \
+                       GLFW_MOD_CONTROL | \
+                       GLFW_MOD_ALT | \
+                       GLFW_MOD_SUPER | \
+                       GLFW_MOD_CAPS_LOCK | \
+                       GLFW_MOD_NUM_LOCK)
+
+// Initializes the platform joystick API if it has not been already
+//
+static GLFWbool initJoysticks(void)
+{
+    if (!_glfw.joysticksInitialized)
+    {
+        if (!_glfw.platform.initJoysticks())
+        {
+            _glfw.platform.terminateJoysticks();
+            return GLFW_FALSE;
+        }
+    }
+
+    return _glfw.joysticksInitialized = GLFW_TRUE;
+}
+
 // Finds a mapping based on joystick GUID
 //
 static _GLFWmapping* findMapping(const char* guid)
@@ -218,8 +239,9 @@
             }
             else
             {
-                length = strlen(_GLFW_PLATFORM_MAPPING_NAME);
-                if (strncmp(c, _GLFW_PLATFORM_MAPPING_NAME, length) != 0)
+                const char* name = _glfw.platform.getMappingName();
+                length = strlen(name);
+                if (strncmp(c, name, length) != 0)
                     return GLFW_FALSE;
             }
 
@@ -236,7 +258,7 @@
             mapping->guid[i] += 'a' - 'A';
     }
 
-    _glfwPlatformUpdateGamepadGUID(mapping->guid);
+    _glfw.platform.updateGamepadGUID(mapping->guid);
     return GLFW_TRUE;
 }
 
@@ -249,6 +271,12 @@
 //
 void _glfwInputKey(_GLFWwindow* window, int key, int scancode, int action, int mods)
 {
+    assert(window != NULL);
+    assert(key >= 0 || key == GLFW_KEY_UNKNOWN);
+    assert(key <= GLFW_KEY_LAST);
+    assert(action == GLFW_PRESS || action == GLFW_RELEASE);
+    assert(mods == (mods & GLFW_MOD_MASK));
+
     if (key >= 0 && key <= GLFW_KEY_LAST)
     {
         GLFWbool repeated = GLFW_FALSE;
@@ -280,6 +308,10 @@
 //
 void _glfwInputChar(_GLFWwindow* window, uint32_t codepoint, int mods, GLFWbool plain)
 {
+    assert(window != NULL);
+    assert(mods == (mods & GLFW_MOD_MASK));
+    assert(plain == GLFW_TRUE || plain == GLFW_FALSE);
+
     if (codepoint < 32 || (codepoint > 126 && codepoint < 160))
         return;
 
@@ -300,6 +332,12 @@
 //
 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);
+
     if (window->callbacks.scroll)
         window->callbacks.scroll((GLFWwindow*) window, xoffset, yoffset);
 }
@@ -308,6 +346,12 @@
 //
 void _glfwInputMouseClick(_GLFWwindow* window, int button, int action, int mods)
 {
+    assert(window != NULL);
+    assert(button >= 0);
+    assert(button <= GLFW_MOUSE_BUTTON_LAST);
+    assert(action == GLFW_PRESS || action == GLFW_RELEASE);
+    assert(mods == (mods & GLFW_MOD_MASK));
+
     if (button < 0 || button > GLFW_MOUSE_BUTTON_LAST)
         return;
 
@@ -328,6 +372,12 @@
 //
 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);
+
     if (window->virtualCursorPosX == xpos && window->virtualCursorPosY == ypos)
         return;
 
@@ -342,6 +392,9 @@
 //
 void _glfwInputCursorEnter(_GLFWwindow* window, GLFWbool entered)
 {
+    assert(window != NULL);
+    assert(entered == GLFW_TRUE || entered == GLFW_FALSE);
+
     if (window->callbacks.cursorEnter)
         window->callbacks.cursorEnter((GLFWwindow*) window, entered);
 }
@@ -350,6 +403,10 @@
 //
 void _glfwInputDrop(_GLFWwindow* window, int count, const char** paths)
 {
+    assert(window != NULL);
+    assert(count > 0);
+    assert(paths != NULL);
+
     if (window->callbacks.drop)
         window->callbacks.drop((GLFWwindow*) window, count, paths);
 }
@@ -358,7 +415,8 @@
 //
 void _glfwInputJoystick(_GLFWjoystick* js, int event)
 {
-    const int jid = (int) (js - _glfw.joysticks);
+    assert(js != NULL);
+    assert(event == GLFW_CONNECTED || event == GLFW_DISCONNECTED);
 
     if (event == GLFW_CONNECTED)
         js->connected = GLFW_TRUE;
@@ -366,13 +424,17 @@
         js->connected = GLFW_FALSE;
 
     if (_glfw.callbacks.joystick)
-        _glfw.callbacks.joystick(jid, event);
+        _glfw.callbacks.joystick((int) (js - _glfw.joysticks), event);
 }
 
 // Notifies shared code of the new value of a joystick axis
 //
 void _glfwInputJoystickAxis(_GLFWjoystick* js, int axis, float value)
 {
+    assert(js != NULL);
+    assert(axis >= 0);
+    assert(axis < js->axisCount);
+
     js->axes[axis] = value;
 }
 
@@ -380,6 +442,11 @@
 //
 void _glfwInputJoystickButton(_GLFWjoystick* js, int button, char value)
 {
+    assert(js != NULL);
+    assert(button >= 0);
+    assert(button < js->buttonCount);
+    assert(value == GLFW_PRESS || value == GLFW_RELEASE);
+
     js->buttons[button] = value;
 }
 
@@ -387,7 +454,19 @@
 //
 void _glfwInputJoystickHat(_GLFWjoystick* js, int hat, char value)
 {
-    const int base = js->buttonCount + hat * 4;
+    int base;
+
+    assert(js != NULL);
+    assert(hat >= 0);
+    assert(hat < js->hatCount);
+
+    // Valid hat values only use the least significant nibble
+    assert((value & 0xf0) == 0);
+    // Valid hat values do not have both bits of an axis set
+    assert((value & GLFW_HAT_LEFT) == 0 || (value & GLFW_HAT_RIGHT) == 0);
+    assert((value & GLFW_HAT_UP) == 0 || (value & GLFW_HAT_DOWN) == 0);
+
+    base = js->buttonCount + hat * 4;
 
     js->buttons[base + 0] = (value & 0x01) ? GLFW_PRESS : GLFW_RELEASE;
     js->buttons[base + 1] = (value & 0x02) ? GLFW_PRESS : GLFW_RELEASE;
@@ -406,23 +485,15 @@
 //
 void _glfwInitGamepadMappings(void)
 {
-    int jid;
     size_t i;
     const size_t count = sizeof(_glfwDefaultMappings) / sizeof(char*);
-    _glfw.mappings = calloc(count, sizeof(_GLFWmapping));
+    _glfw.mappings = _glfw_calloc(count, sizeof(_GLFWmapping));
 
     for (i = 0;  i < count;  i++)
     {
         if (parseMapping(&_glfw.mappings[_glfw.mappingCount], _glfwDefaultMappings[i]))
             _glfw.mappingCount++;
     }
-
-    for (jid = 0;  jid <= GLFW_JOYSTICK_LAST;  jid++)
-    {
-        _GLFWjoystick* js = _glfw.joysticks + jid;
-        if (js->connected)
-            js->mapping = findValidMapping(js);
-    }
 }
 
 // Returns an available joystick object with arrays and name allocated
@@ -447,9 +518,9 @@
 
     js = _glfw.joysticks + jid;
     js->allocated   = GLFW_TRUE;
-    js->axes        = calloc(axisCount, sizeof(float));
-    js->buttons     = calloc(buttonCount + (size_t) hatCount * 4, 1);
-    js->hats        = calloc(hatCount, 1);
+    js->axes        = _glfw_calloc(axisCount, sizeof(float));
+    js->buttons     = _glfw_calloc(buttonCount + (size_t) hatCount * 4, 1);
+    js->hats        = _glfw_calloc(hatCount, 1);
     js->axisCount   = axisCount;
     js->buttonCount = buttonCount;
     js->hatCount    = hatCount;
@@ -465,9 +536,9 @@
 //
 void _glfwFreeJoystick(_GLFWjoystick* js)
 {
-    free(js->axes);
-    free(js->buttons);
-    free(js->hats);
+    _glfw_free(js->axes);
+    _glfw_free(js->buttons);
+    _glfw_free(js->hats);
     memset(js, 0, sizeof(_GLFWjoystick));
 }
 
@@ -477,8 +548,8 @@
 {
     int width, height;
 
-    _glfwPlatformGetWindowSize(window, &width, &height);
-    _glfwPlatformSetCursorPos(window, width / 2.0, height / 2.0);
+    _glfw.platform.getWindowSize(window, &width, &height);
+    _glfw.platform.setCursorPos(window, width / 2.0, height / 2.0);
 }
 
 
@@ -518,96 +589,109 @@
 
     _GLFW_REQUIRE_INIT();
 
-    if (mode == GLFW_CURSOR)
+    switch (mode)
     {
-        if (value != GLFW_CURSOR_NORMAL &&
-            value != GLFW_CURSOR_HIDDEN &&
-            value != GLFW_CURSOR_DISABLED)
+        case GLFW_CURSOR:
         {
-            _glfwInputError(GLFW_INVALID_ENUM,
-                            "Invalid cursor mode 0x%08X",
-                            value);
-            return;
-        }
-
-        if (window->cursorMode == value)
-            return;
-
-        window->cursorMode = value;
-
-        _glfwPlatformGetCursorPos(window,
-                                  &window->virtualCursorPosX,
-                                  &window->virtualCursorPosY);
-        _glfwPlatformSetCursorMode(window, value);
-    }
-    else if (mode == GLFW_STICKY_KEYS)
-    {
-        value = value ? GLFW_TRUE : GLFW_FALSE;
-        if (window->stickyKeys == value)
-            return;
-
-        if (!value)
-        {
-            int i;
-
-            // Release all sticky keys
-            for (i = 0;  i <= GLFW_KEY_LAST;  i++)
+            if (value != GLFW_CURSOR_NORMAL &&
+                value != GLFW_CURSOR_HIDDEN &&
+                value != GLFW_CURSOR_DISABLED &&
+                value != GLFW_CURSOR_CAPTURED)
             {
-                if (window->keys[i] == _GLFW_STICK)
-                    window->keys[i] = GLFW_RELEASE;
+                _glfwInputError(GLFW_INVALID_ENUM,
+                                "Invalid cursor mode 0x%08X",
+                                value);
+                return;
             }
+
+            if (window->cursorMode == value)
+                return;
+
+            window->cursorMode = value;
+
+            _glfw.platform.getCursorPos(window,
+                                        &window->virtualCursorPosX,
+                                        &window->virtualCursorPosY);
+            _glfw.platform.setCursorMode(window, value);
+            return;
         }
 
-        window->stickyKeys = value;
-    }
-    else if (mode == GLFW_STICKY_MOUSE_BUTTONS)
-    {
-        value = value ? GLFW_TRUE : GLFW_FALSE;
-        if (window->stickyMouseButtons == value)
-            return;
-
-        if (!value)
+        case GLFW_STICKY_KEYS:
         {
-            int i;
+            value = value ? GLFW_TRUE : GLFW_FALSE;
+            if (window->stickyKeys == value)
+                return;
 
-            // Release all sticky mouse buttons
-            for (i = 0;  i <= GLFW_MOUSE_BUTTON_LAST;  i++)
+            if (!value)
             {
-                if (window->mouseButtons[i] == _GLFW_STICK)
-                    window->mouseButtons[i] = GLFW_RELEASE;
+                int i;
+
+                // Release all sticky keys
+                for (i = 0;  i <= GLFW_KEY_LAST;  i++)
+                {
+                    if (window->keys[i] == _GLFW_STICK)
+                        window->keys[i] = GLFW_RELEASE;
+                }
             }
+
+            window->stickyKeys = value;
+            return;
         }
 
-        window->stickyMouseButtons = value;
-    }
-    else if (mode == GLFW_LOCK_KEY_MODS)
-    {
-        window->lockKeyMods = value ? GLFW_TRUE : GLFW_FALSE;
-    }
-    else if (mode == GLFW_RAW_MOUSE_MOTION)
-    {
-        if (!_glfwPlatformRawMouseMotionSupported())
+        case GLFW_STICKY_MOUSE_BUTTONS:
         {
-            _glfwInputError(GLFW_PLATFORM_ERROR,
-                            "Raw mouse motion is not supported on this system");
+            value = value ? GLFW_TRUE : GLFW_FALSE;
+            if (window->stickyMouseButtons == value)
+                return;
+
+            if (!value)
+            {
+                int i;
+
+                // Release all sticky mouse buttons
+                for (i = 0;  i <= GLFW_MOUSE_BUTTON_LAST;  i++)
+                {
+                    if (window->mouseButtons[i] == _GLFW_STICK)
+                        window->mouseButtons[i] = GLFW_RELEASE;
+                }
+            }
+
+            window->stickyMouseButtons = value;
             return;
         }
 
-        value = value ? GLFW_TRUE : GLFW_FALSE;
-        if (window->rawMouseMotion == value)
+        case GLFW_LOCK_KEY_MODS:
+        {
+            window->lockKeyMods = value ? GLFW_TRUE : GLFW_FALSE;
             return;
+        }
 
-        window->rawMouseMotion = value;
-        _glfwPlatformSetRawMouseMotion(window, value);
+        case GLFW_RAW_MOUSE_MOTION:
+        {
+            if (!_glfw.platform.rawMouseMotionSupported())
+            {
+                _glfwInputError(GLFW_PLATFORM_ERROR,
+                                "Raw mouse motion is not supported on this system");
+                return;
+            }
+
+            value = value ? GLFW_TRUE : GLFW_FALSE;
+            if (window->rawMouseMotion == value)
+                return;
+
+            window->rawMouseMotion = value;
+            _glfw.platform.setRawMouseMotion(window, value);
+            return;
+        }
     }
-    else
-        _glfwInputError(GLFW_INVALID_ENUM, "Invalid input mode 0x%08X", mode);
+
+    _glfwInputError(GLFW_INVALID_ENUM, "Invalid input mode 0x%08X", mode);
 }
 
 GLFWAPI int glfwRawMouseMotionSupported(void)
 {
     _GLFW_REQUIRE_INIT_OR_RETURN(GLFW_FALSE);
-    return _glfwPlatformRawMouseMotionSupported();
+    return _glfw.platform.rawMouseMotionSupported();
 }
 
 GLFWAPI const char* glfwGetKeyName(int key, int scancode)
@@ -629,10 +713,10 @@
             return NULL;
         }
 
-        scancode = _glfwPlatformGetKeyScancode(key);
+        scancode = _glfw.platform.getKeyScancode(key);
     }
 
-    return _glfwPlatformGetScancodeName(scancode);
+    return _glfw.platform.getScancodeName(scancode);
 }
 
 GLFWAPI int glfwGetKeyScancode(int key)
@@ -645,7 +729,7 @@
         return -1;
     }
 
-    return _glfwPlatformGetKeyScancode(key);
+    return _glfw.platform.getKeyScancode(key);
 }
 
 GLFWAPI int glfwGetKey(GLFWwindow* handle, int key)
@@ -714,7 +798,7 @@
             *ypos = window->virtualCursorPosY;
     }
     else
-        _glfwPlatformGetCursorPos(window, xpos, ypos);
+        _glfw.platform.getCursorPos(window, xpos, ypos);
 }
 
 GLFWAPI void glfwSetCursorPos(GLFWwindow* handle, double xpos, double ypos)
@@ -733,7 +817,7 @@
         return;
     }
 
-    if (!_glfwPlatformWindowFocused(window))
+    if (!_glfw.platform.windowFocused(window))
         return;
 
     if (window->cursorMode == GLFW_CURSOR_DISABLED)
@@ -745,7 +829,7 @@
     else
     {
         // Update system cursor position
-        _glfwPlatformSetCursorPos(window, xpos, ypos);
+        _glfw.platform.setCursorPos(window, xpos, ypos);
     }
 }
 
@@ -764,11 +848,11 @@
         return NULL;
     }
 
-    cursor = calloc(1, sizeof(_GLFWcursor));
+    cursor = _glfw_calloc(1, sizeof(_GLFWcursor));
     cursor->next = _glfw.cursorListHead;
     _glfw.cursorListHead = cursor;
 
-    if (!_glfwPlatformCreateCursor(cursor, image, xhot, yhot))
+    if (!_glfw.platform.createCursor(cursor, image, xhot, yhot))
     {
         glfwDestroyCursor((GLFWcursor*) cursor);
         return NULL;
@@ -786,19 +870,23 @@
     if (shape != GLFW_ARROW_CURSOR &&
         shape != GLFW_IBEAM_CURSOR &&
         shape != GLFW_CROSSHAIR_CURSOR &&
-        shape != GLFW_HAND_CURSOR &&
-        shape != GLFW_HRESIZE_CURSOR &&
-        shape != GLFW_VRESIZE_CURSOR)
+        shape != GLFW_POINTING_HAND_CURSOR &&
+        shape != GLFW_RESIZE_EW_CURSOR &&
+        shape != GLFW_RESIZE_NS_CURSOR &&
+        shape != GLFW_RESIZE_NWSE_CURSOR &&
+        shape != GLFW_RESIZE_NESW_CURSOR &&
+        shape != GLFW_RESIZE_ALL_CURSOR &&
+        shape != GLFW_NOT_ALLOWED_CURSOR)
     {
         _glfwInputError(GLFW_INVALID_ENUM, "Invalid standard cursor 0x%08X", shape);
         return NULL;
     }
 
-    cursor = calloc(1, sizeof(_GLFWcursor));
+    cursor = _glfw_calloc(1, sizeof(_GLFWcursor));
     cursor->next = _glfw.cursorListHead;
     _glfw.cursorListHead = cursor;
 
-    if (!_glfwPlatformCreateStandardCursor(cursor, shape))
+    if (!_glfw.platform.createStandardCursor(cursor, shape))
     {
         glfwDestroyCursor((GLFWcursor*) cursor);
         return NULL;
@@ -827,7 +915,7 @@
         }
     }
 
-    _glfwPlatformDestroyCursor(cursor);
+    _glfw.platform.destroyCursor(cursor);
 
     // Unlink cursor from global linked list
     {
@@ -839,7 +927,7 @@
         *prev = cursor->next;
     }
 
-    free(cursor);
+    _glfw_free(cursor);
 }
 
 GLFWAPI void glfwSetCursor(GLFWwindow* windowHandle, GLFWcursor* cursorHandle)
@@ -852,7 +940,7 @@
 
     window->cursor = cursor;
 
-    _glfwPlatformSetCursor(window, cursor);
+    _glfw.platform.setCursor(window, cursor);
 }
 
 GLFWAPI GLFWkeyfun glfwSetKeyCallback(GLFWwindow* handle, GLFWkeyfun cbfun)
@@ -861,7 +949,7 @@
     assert(window != NULL);
 
     _GLFW_REQUIRE_INIT_OR_RETURN(NULL);
-    _GLFW_SWAP_POINTERS(window->callbacks.key, cbfun);
+    _GLFW_SWAP(GLFWkeyfun, window->callbacks.key, cbfun);
     return cbfun;
 }
 
@@ -871,7 +959,7 @@
     assert(window != NULL);
 
     _GLFW_REQUIRE_INIT_OR_RETURN(NULL);
-    _GLFW_SWAP_POINTERS(window->callbacks.character, cbfun);
+    _GLFW_SWAP(GLFWcharfun, window->callbacks.character, cbfun);
     return cbfun;
 }
 
@@ -881,7 +969,7 @@
     assert(window != NULL);
 
     _GLFW_REQUIRE_INIT_OR_RETURN(NULL);
-    _GLFW_SWAP_POINTERS(window->callbacks.charmods, cbfun);
+    _GLFW_SWAP(GLFWcharmodsfun, window->callbacks.charmods, cbfun);
     return cbfun;
 }
 
@@ -892,7 +980,7 @@
     assert(window != NULL);
 
     _GLFW_REQUIRE_INIT_OR_RETURN(NULL);
-    _GLFW_SWAP_POINTERS(window->callbacks.mouseButton, cbfun);
+    _GLFW_SWAP(GLFWmousebuttonfun, window->callbacks.mouseButton, cbfun);
     return cbfun;
 }
 
@@ -903,7 +991,7 @@
     assert(window != NULL);
 
     _GLFW_REQUIRE_INIT_OR_RETURN(NULL);
-    _GLFW_SWAP_POINTERS(window->callbacks.cursorPos, cbfun);
+    _GLFW_SWAP(GLFWcursorposfun, window->callbacks.cursorPos, cbfun);
     return cbfun;
 }
 
@@ -914,7 +1002,7 @@
     assert(window != NULL);
 
     _GLFW_REQUIRE_INIT_OR_RETURN(NULL);
-    _GLFW_SWAP_POINTERS(window->callbacks.cursorEnter, cbfun);
+    _GLFW_SWAP(GLFWcursorenterfun, window->callbacks.cursorEnter, cbfun);
     return cbfun;
 }
 
@@ -925,7 +1013,7 @@
     assert(window != NULL);
 
     _GLFW_REQUIRE_INIT_OR_RETURN(NULL);
-    _GLFW_SWAP_POINTERS(window->callbacks.scroll, cbfun);
+    _GLFW_SWAP(GLFWscrollfun, window->callbacks.scroll, cbfun);
     return cbfun;
 }
 
@@ -935,7 +1023,7 @@
     assert(window != NULL);
 
     _GLFW_REQUIRE_INIT_OR_RETURN(NULL);
-    _GLFW_SWAP_POINTERS(window->callbacks.drop, cbfun);
+    _GLFW_SWAP(GLFWdropfun, window->callbacks.drop, cbfun);
     return cbfun;
 }
 
@@ -954,11 +1042,14 @@
         return GLFW_FALSE;
     }
 
+    if (!initJoysticks())
+        return GLFW_FALSE;
+
     js = _glfw.joysticks + jid;
     if (!js->connected)
         return GLFW_FALSE;
 
-    return _glfwPlatformPollJoystick(js, _GLFW_POLL_PRESENCE);
+    return _glfw.platform.pollJoystick(js, _GLFW_POLL_PRESENCE);
 }
 
 GLFWAPI const float* glfwGetJoystickAxes(int jid, int* count)
@@ -979,11 +1070,14 @@
         return NULL;
     }
 
+    if (!initJoysticks())
+        return NULL;
+
     js = _glfw.joysticks + jid;
     if (!js->connected)
         return NULL;
 
-    if (!_glfwPlatformPollJoystick(js, _GLFW_POLL_AXES))
+    if (!_glfw.platform.pollJoystick(js, _GLFW_POLL_AXES))
         return NULL;
 
     *count = js->axisCount;
@@ -1008,11 +1102,14 @@
         return NULL;
     }
 
+    if (!initJoysticks())
+        return NULL;
+
     js = _glfw.joysticks + jid;
     if (!js->connected)
         return NULL;
 
-    if (!_glfwPlatformPollJoystick(js, _GLFW_POLL_BUTTONS))
+    if (!_glfw.platform.pollJoystick(js, _GLFW_POLL_BUTTONS))
         return NULL;
 
     if (_glfw.hints.init.hatButtons)
@@ -1041,11 +1138,14 @@
         return NULL;
     }
 
+    if (!initJoysticks())
+        return NULL;
+
     js = _glfw.joysticks + jid;
     if (!js->connected)
         return NULL;
 
-    if (!_glfwPlatformPollJoystick(js, _GLFW_POLL_BUTTONS))
+    if (!_glfw.platform.pollJoystick(js, _GLFW_POLL_BUTTONS))
         return NULL;
 
     *count = js->hatCount;
@@ -1067,11 +1167,14 @@
         return NULL;
     }
 
+    if (!initJoysticks())
+        return NULL;
+
     js = _glfw.joysticks + jid;
     if (!js->connected)
         return NULL;
 
-    if (!_glfwPlatformPollJoystick(js, _GLFW_POLL_PRESENCE))
+    if (!_glfw.platform.pollJoystick(js, _GLFW_POLL_PRESENCE))
         return NULL;
 
     return js->name;
@@ -1092,11 +1195,14 @@
         return NULL;
     }
 
+    if (!initJoysticks())
+        return NULL;
+
     js = _glfw.joysticks + jid;
     if (!js->connected)
         return NULL;
 
-    if (!_glfwPlatformPollJoystick(js, _GLFW_POLL_PRESENCE))
+    if (!_glfw.platform.pollJoystick(js, _GLFW_POLL_PRESENCE))
         return NULL;
 
     return js->guid;
@@ -1137,7 +1243,11 @@
 GLFWAPI GLFWjoystickfun glfwSetJoystickCallback(GLFWjoystickfun cbfun)
 {
     _GLFW_REQUIRE_INIT_OR_RETURN(NULL);
-    _GLFW_SWAP_POINTERS(_glfw.callbacks.joystick, cbfun);
+
+    if (!initJoysticks())
+        return NULL;
+
+    _GLFW_SWAP(GLFWjoystickfun, _glfw.callbacks.joystick, cbfun);
     return cbfun;
 }
 
@@ -1175,8 +1285,8 @@
                     {
                         _glfw.mappingCount++;
                         _glfw.mappings =
-                            realloc(_glfw.mappings,
-                                    sizeof(_GLFWmapping) * _glfw.mappingCount);
+                            _glfw_realloc(_glfw.mappings,
+                                          sizeof(_GLFWmapping) * _glfw.mappingCount);
                         _glfw.mappings[_glfw.mappingCount - 1] = mapping;
                     }
                 }
@@ -1216,11 +1326,14 @@
         return GLFW_FALSE;
     }
 
+    if (!initJoysticks())
+        return GLFW_FALSE;
+
     js = _glfw.joysticks + jid;
     if (!js->connected)
         return GLFW_FALSE;
 
-    if (!_glfwPlatformPollJoystick(js, _GLFW_POLL_PRESENCE))
+    if (!_glfw.platform.pollJoystick(js, _GLFW_POLL_PRESENCE))
         return GLFW_FALSE;
 
     return js->mapping != NULL;
@@ -1241,11 +1354,14 @@
         return NULL;
     }
 
+    if (!initJoysticks())
+        return NULL;
+
     js = _glfw.joysticks + jid;
     if (!js->connected)
         return NULL;
 
-    if (!_glfwPlatformPollJoystick(js, _GLFW_POLL_PRESENCE))
+    if (!_glfw.platform.pollJoystick(js, _GLFW_POLL_PRESENCE))
         return NULL;
 
     if (!js->mapping)
@@ -1273,11 +1389,14 @@
         return GLFW_FALSE;
     }
 
+    if (!initJoysticks())
+        return GLFW_FALSE;
+
     js = _glfw.joysticks + jid;
     if (!js->connected)
         return GLFW_FALSE;
 
-    if (!_glfwPlatformPollJoystick(js, _GLFW_POLL_ALL))
+    if (!_glfw.platform.pollJoystick(js, _GLFW_POLL_ALL))
         return GLFW_FALSE;
 
     if (!js->mapping)
@@ -1319,7 +1438,7 @@
         if (e->type == _GLFW_JOYSTICK_AXIS)
         {
             const float value = js->axes[e->index] * e->axisScale + e->axisOffset;
-            state->axes[i] = _glfw_fminf(_glfw_fmaxf(value, -1.f), 1.f);
+            state->axes[i] = fminf(fmaxf(value, -1.f), 1.f);
         }
         else if (e->type == _GLFW_JOYSTICK_HATBIT)
         {
@@ -1342,13 +1461,13 @@
     assert(string != NULL);
 
     _GLFW_REQUIRE_INIT();
-    _glfwPlatformSetClipboardString(string);
+    _glfw.platform.setClipboardString(string);
 }
 
 GLFWAPI const char* glfwGetClipboardString(GLFWwindow* handle)
 {
     _GLFW_REQUIRE_INIT_OR_RETURN(NULL);
-    return _glfwPlatformGetClipboardString();
+    return _glfw.platform.getClipboardString();
 }
 
 GLFWAPI double glfwGetTime(void)
diff --git a/src/internal.h b/src/internal.h
index 3f081bf..8873359 100644
--- a/src/internal.h
+++ b/src/internal.h
@@ -1,5 +1,5 @@
 //========================================================================
-// GLFW 3.3 - www.glfw.org
+// GLFW 3.4 - www.glfw.org
 //------------------------------------------------------------------------
 // Copyright (c) 2002-2006 Marcus Geelnard
 // Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.org>
@@ -59,6 +59,7 @@
 #define _GLFW_MESSAGE_SIZE      1024
 
 typedef int GLFWbool;
+typedef void (*GLFWproc)(void);
 
 typedef struct _GLFWerror       _GLFWerror;
 typedef struct _GLFWinitconfig  _GLFWinitconfig;
@@ -67,6 +68,7 @@
 typedef struct _GLFWfbconfig    _GLFWfbconfig;
 typedef struct _GLFWcontext     _GLFWcontext;
 typedef struct _GLFWwindow      _GLFWwindow;
+typedef struct _GLFWplatform    _GLFWplatform;
 typedef struct _GLFWlibrary     _GLFWlibrary;
 typedef struct _GLFWmonitor     _GLFWmonitor;
 typedef struct _GLFWcursor      _GLFWcursor;
@@ -76,13 +78,6 @@
 typedef struct _GLFWtls         _GLFWtls;
 typedef struct _GLFWmutex       _GLFWmutex;
 
-typedef void (* _GLFWmakecontextcurrentfun)(_GLFWwindow*);
-typedef void (* _GLFWswapbuffersfun)(_GLFWwindow*);
-typedef void (* _GLFWswapintervalfun)(int);
-typedef int (* _GLFWextensionsupportedfun)(const char*);
-typedef GLFWglproc (* _GLFWgetprocaddressfun)(const char*);
-typedef void (* _GLFWdestroycontextfun)(_GLFWwindow*);
-
 #define GL_VERSION 0x1f02
 #define GL_NONE 0
 #define GL_COLOR_BUFFER_BIT 0x00004000
@@ -113,6 +108,159 @@
 typedef void (APIENTRY * PFNGLGETINTEGERVPROC)(GLenum,GLint*);
 typedef const GLubyte* (APIENTRY * PFNGLGETSTRINGIPROC)(GLenum,GLuint);
 
+#define EGL_SUCCESS 0x3000
+#define EGL_NOT_INITIALIZED 0x3001
+#define EGL_BAD_ACCESS 0x3002
+#define EGL_BAD_ALLOC 0x3003
+#define EGL_BAD_ATTRIBUTE 0x3004
+#define EGL_BAD_CONFIG 0x3005
+#define EGL_BAD_CONTEXT 0x3006
+#define EGL_BAD_CURRENT_SURFACE 0x3007
+#define EGL_BAD_DISPLAY 0x3008
+#define EGL_BAD_MATCH 0x3009
+#define EGL_BAD_NATIVE_PIXMAP 0x300a
+#define EGL_BAD_NATIVE_WINDOW 0x300b
+#define EGL_BAD_PARAMETER 0x300c
+#define EGL_BAD_SURFACE 0x300d
+#define EGL_CONTEXT_LOST 0x300e
+#define EGL_COLOR_BUFFER_TYPE 0x303f
+#define EGL_RGB_BUFFER 0x308e
+#define EGL_SURFACE_TYPE 0x3033
+#define EGL_WINDOW_BIT 0x0004
+#define EGL_RENDERABLE_TYPE 0x3040
+#define EGL_OPENGL_ES_BIT 0x0001
+#define EGL_OPENGL_ES2_BIT 0x0004
+#define EGL_OPENGL_BIT 0x0008
+#define EGL_ALPHA_SIZE 0x3021
+#define EGL_BLUE_SIZE 0x3022
+#define EGL_GREEN_SIZE 0x3023
+#define EGL_RED_SIZE 0x3024
+#define EGL_DEPTH_SIZE 0x3025
+#define EGL_STENCIL_SIZE 0x3026
+#define EGL_SAMPLES 0x3031
+#define EGL_OPENGL_ES_API 0x30a0
+#define EGL_OPENGL_API 0x30a2
+#define EGL_NONE 0x3038
+#define EGL_RENDER_BUFFER 0x3086
+#define EGL_SINGLE_BUFFER 0x3085
+#define EGL_EXTENSIONS 0x3055
+#define EGL_CONTEXT_CLIENT_VERSION 0x3098
+#define EGL_NATIVE_VISUAL_ID 0x302e
+#define EGL_NO_SURFACE ((EGLSurface) 0)
+#define EGL_NO_DISPLAY ((EGLDisplay) 0)
+#define EGL_NO_CONTEXT ((EGLContext) 0)
+#define EGL_DEFAULT_DISPLAY ((EGLNativeDisplayType) 0)
+
+#define EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR 0x00000002
+#define EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR 0x00000001
+#define EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT_KHR 0x00000002
+#define EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR 0x00000001
+#define EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_KHR 0x31bd
+#define EGL_NO_RESET_NOTIFICATION_KHR 0x31be
+#define EGL_LOSE_CONTEXT_ON_RESET_KHR 0x31bf
+#define EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR 0x00000004
+#define EGL_CONTEXT_MAJOR_VERSION_KHR 0x3098
+#define EGL_CONTEXT_MINOR_VERSION_KHR 0x30fb
+#define EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR 0x30fd
+#define EGL_CONTEXT_FLAGS_KHR 0x30fc
+#define EGL_CONTEXT_OPENGL_NO_ERROR_KHR 0x31b3
+#define EGL_GL_COLORSPACE_KHR 0x309d
+#define EGL_GL_COLORSPACE_SRGB_KHR 0x3089
+#define EGL_CONTEXT_RELEASE_BEHAVIOR_KHR 0x2097
+#define EGL_CONTEXT_RELEASE_BEHAVIOR_NONE_KHR 0
+#define EGL_CONTEXT_RELEASE_BEHAVIOR_FLUSH_KHR 0x2098
+#define EGL_PLATFORM_X11_EXT 0x31d5
+#define EGL_PLATFORM_WAYLAND_EXT 0x31d8
+#define EGL_PRESENT_OPAQUE_EXT 0x31df
+#define EGL_PLATFORM_ANGLE_ANGLE 0x3202
+#define EGL_PLATFORM_ANGLE_TYPE_ANGLE 0x3203
+#define EGL_PLATFORM_ANGLE_TYPE_OPENGL_ANGLE 0x320d
+#define EGL_PLATFORM_ANGLE_TYPE_OPENGLES_ANGLE 0x320e
+#define EGL_PLATFORM_ANGLE_TYPE_D3D9_ANGLE 0x3207
+#define EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE 0x3208
+#define EGL_PLATFORM_ANGLE_TYPE_VULKAN_ANGLE 0x3450
+#define EGL_PLATFORM_ANGLE_TYPE_METAL_ANGLE 0x3489
+#define EGL_PLATFORM_ANGLE_NATIVE_PLATFORM_TYPE_ANGLE 0x348f
+
+typedef int EGLint;
+typedef unsigned int EGLBoolean;
+typedef unsigned int EGLenum;
+typedef void* EGLConfig;
+typedef void* EGLContext;
+typedef void* EGLDisplay;
+typedef void* EGLSurface;
+
+typedef void* EGLNativeDisplayType;
+typedef void* EGLNativeWindowType;
+
+// EGL function pointer typedefs
+typedef EGLBoolean (APIENTRY * PFN_eglGetConfigAttrib)(EGLDisplay,EGLConfig,EGLint,EGLint*);
+typedef EGLBoolean (APIENTRY * PFN_eglGetConfigs)(EGLDisplay,EGLConfig*,EGLint,EGLint*);
+typedef EGLDisplay (APIENTRY * PFN_eglGetDisplay)(EGLNativeDisplayType);
+typedef EGLint (APIENTRY * PFN_eglGetError)(void);
+typedef EGLBoolean (APIENTRY * PFN_eglInitialize)(EGLDisplay,EGLint*,EGLint*);
+typedef EGLBoolean (APIENTRY * PFN_eglTerminate)(EGLDisplay);
+typedef EGLBoolean (APIENTRY * PFN_eglBindAPI)(EGLenum);
+typedef EGLContext (APIENTRY * PFN_eglCreateContext)(EGLDisplay,EGLConfig,EGLContext,const EGLint*);
+typedef EGLBoolean (APIENTRY * PFN_eglDestroySurface)(EGLDisplay,EGLSurface);
+typedef EGLBoolean (APIENTRY * PFN_eglDestroyContext)(EGLDisplay,EGLContext);
+typedef EGLSurface (APIENTRY * PFN_eglCreateWindowSurface)(EGLDisplay,EGLConfig,EGLNativeWindowType,const EGLint*);
+typedef EGLBoolean (APIENTRY * PFN_eglMakeCurrent)(EGLDisplay,EGLSurface,EGLSurface,EGLContext);
+typedef EGLBoolean (APIENTRY * PFN_eglSwapBuffers)(EGLDisplay,EGLSurface);
+typedef EGLBoolean (APIENTRY * PFN_eglSwapInterval)(EGLDisplay,EGLint);
+typedef const char* (APIENTRY * PFN_eglQueryString)(EGLDisplay,EGLint);
+typedef GLFWglproc (APIENTRY * PFN_eglGetProcAddress)(const char*);
+#define eglGetConfigAttrib _glfw.egl.GetConfigAttrib
+#define eglGetConfigs _glfw.egl.GetConfigs
+#define eglGetDisplay _glfw.egl.GetDisplay
+#define eglGetError _glfw.egl.GetError
+#define eglInitialize _glfw.egl.Initialize
+#define eglTerminate _glfw.egl.Terminate
+#define eglBindAPI _glfw.egl.BindAPI
+#define eglCreateContext _glfw.egl.CreateContext
+#define eglDestroySurface _glfw.egl.DestroySurface
+#define eglDestroyContext _glfw.egl.DestroyContext
+#define eglCreateWindowSurface _glfw.egl.CreateWindowSurface
+#define eglMakeCurrent _glfw.egl.MakeCurrent
+#define eglSwapBuffers _glfw.egl.SwapBuffers
+#define eglSwapInterval _glfw.egl.SwapInterval
+#define eglQueryString _glfw.egl.QueryString
+#define eglGetProcAddress _glfw.egl.GetProcAddress
+
+typedef EGLDisplay (APIENTRY * PFNEGLGETPLATFORMDISPLAYEXTPROC)(EGLenum,void*,const EGLint*);
+typedef EGLSurface (APIENTRY * PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC)(EGLDisplay,EGLConfig,void*,const EGLint*);
+#define eglGetPlatformDisplayEXT _glfw.egl.GetPlatformDisplayEXT
+#define eglCreatePlatformWindowSurfaceEXT _glfw.egl.CreatePlatformWindowSurfaceEXT
+
+#define OSMESA_RGBA 0x1908
+#define OSMESA_FORMAT 0x22
+#define OSMESA_DEPTH_BITS 0x30
+#define OSMESA_STENCIL_BITS 0x31
+#define OSMESA_ACCUM_BITS 0x32
+#define OSMESA_PROFILE 0x33
+#define OSMESA_CORE_PROFILE 0x34
+#define OSMESA_COMPAT_PROFILE 0x35
+#define OSMESA_CONTEXT_MAJOR_VERSION 0x36
+#define OSMESA_CONTEXT_MINOR_VERSION 0x37
+
+typedef void* OSMesaContext;
+typedef void (*OSMESAproc)(void);
+
+typedef OSMesaContext (GLAPIENTRY * PFN_OSMesaCreateContextExt)(GLenum,GLint,GLint,GLint,OSMesaContext);
+typedef OSMesaContext (GLAPIENTRY * PFN_OSMesaCreateContextAttribs)(const int*,OSMesaContext);
+typedef void (GLAPIENTRY * PFN_OSMesaDestroyContext)(OSMesaContext);
+typedef int (GLAPIENTRY * PFN_OSMesaMakeCurrent)(OSMesaContext,void*,int,int,int);
+typedef int (GLAPIENTRY * PFN_OSMesaGetColorBuffer)(OSMesaContext,int*,int*,int*,void**);
+typedef int (GLAPIENTRY * PFN_OSMesaGetDepthBuffer)(OSMesaContext,int*,int*,int*,void**);
+typedef GLFWglproc (GLAPIENTRY * PFN_OSMesaGetProcAddress)(const char*);
+#define OSMesaCreateContextExt _glfw.osmesa.CreateContextExt
+#define OSMesaCreateContextAttribs _glfw.osmesa.CreateContextAttribs
+#define OSMesaDestroyContext _glfw.osmesa.DestroyContext
+#define OSMesaMakeCurrent _glfw.osmesa.MakeCurrent
+#define OSMesaGetColorBuffer _glfw.osmesa.GetColorBuffer
+#define OSMesaGetDepthBuffer _glfw.osmesa.GetDepthBuffer
+#define OSMesaGetProcAddress _glfw.osmesa.GetProcAddress
+
 #define VK_NULL_HANDLE 0
 
 typedef void* VkInstance;
@@ -170,36 +318,14 @@
 
 typedef void (APIENTRY * PFN_vkVoidFunction)(void);
 
-#if defined(_GLFW_VULKAN_STATIC)
-  PFN_vkVoidFunction vkGetInstanceProcAddr(VkInstance,const char*);
-  VkResult vkEnumerateInstanceExtensionProperties(const char*,uint32_t*,VkExtensionProperties*);
-#else
-  typedef PFN_vkVoidFunction (APIENTRY * PFN_vkGetInstanceProcAddr)(VkInstance,const char*);
-  typedef VkResult (APIENTRY * PFN_vkEnumerateInstanceExtensionProperties)(const char*,uint32_t*,VkExtensionProperties*);
-  #define vkEnumerateInstanceExtensionProperties _glfw.vk.EnumerateInstanceExtensionProperties
-  #define vkGetInstanceProcAddr _glfw.vk.GetInstanceProcAddr
-#endif
+typedef PFN_vkVoidFunction (APIENTRY * PFN_vkGetInstanceProcAddr)(VkInstance,const char*);
+typedef VkResult (APIENTRY * PFN_vkEnumerateInstanceExtensionProperties)(const char*,uint32_t*,VkExtensionProperties*);
+#define vkGetInstanceProcAddr _glfw.vk.GetInstanceProcAddr
 
-#if defined(_GLFW_COCOA)
- #include "cocoa_platform.h"
-#elif defined(_GLFW_WIN32)
- #include "win32_platform.h"
-#elif defined(_GLFW_X11)
- #include "x11_platform.h"
-#elif defined(_GLFW_WAYLAND)
- #include "wl_platform.h"
-#elif defined(_GLFW_OSMESA)
- #include "null_platform.h"
-#else
- #error "No supported window creation API selected"
-#endif
+#include "platform.h"
 
-// Constructs a version number string from the public header macros
-#define _GLFW_CONCAT_VERSION(m, n, r) #m "." #n "." #r
-#define _GLFW_MAKE_VERSION(m, n, r) _GLFW_CONCAT_VERSION(m, n, r)
-#define _GLFW_VERSION_NUMBER _GLFW_MAKE_VERSION(GLFW_VERSION_MAJOR, \
-                                                GLFW_VERSION_MINOR, \
-                                                GLFW_VERSION_REVISION)
+#define GLFW_NATIVE_INCLUDE_NONE
+#include "../include/GLFW/glfw3native.h"
 
 // Checks for whether the library has been initialized
 #define _GLFW_REQUIRE_INIT()                         \
@@ -216,12 +342,12 @@
     }
 
 // Swaps the provided pointers
-#define _GLFW_SWAP_POINTERS(x, y) \
-    {                             \
-        void* t;                  \
-        t = x;                    \
-        x = y;                    \
-        y = t;                    \
+#define _GLFW_SWAP(type, x, y) \
+    {                          \
+        type t;                \
+        t = x;                 \
+        x = y;                 \
+        y = t;                 \
     }
 
 // Per-thread error structure
@@ -240,11 +366,17 @@
 struct _GLFWinitconfig
 {
     GLFWbool      hatButtons;
+    int           angleType;
+    int           platformID;
+    PFN_vkGetInstanceProcAddr vulkanLoader;
     struct {
         GLFWbool  menubar;
         GLFWbool  chdir;
     } ns;
     struct {
+        GLFWbool  xcbVulkanSurface;
+    } x11;
+    struct {
         int       libdecorMode;
     } wl;
 };
@@ -257,6 +389,8 @@
 //
 struct _GLFWwndconfig
 {
+    int           xpos;
+    int           ypos;
     int           width;
     int           height;
     const char*   title;
@@ -269,15 +403,23 @@
     GLFWbool      maximized;
     GLFWbool      centerCursor;
     GLFWbool      focusOnShow;
+    GLFWbool      mousePassthrough;
     GLFWbool      scaleToMonitor;
+    GLFWbool      scaleFramebuffer;
     struct {
-        GLFWbool  retina;
         char      frameName[256];
     } ns;
     struct {
         char      className[256];
         char      instanceName[256];
     } x11;
+    struct {
+        GLFWbool  keymenu;
+        GLFWbool  showDefault;
+    } win32;
+    struct {
+        char      appId[256];
+    } wl;
 };
 
 // Context configuration
@@ -349,19 +491,29 @@
     PFNGLGETINTEGERVPROC GetIntegerv;
     PFNGLGETSTRINGPROC   GetString;
 
-    _GLFWmakecontextcurrentfun  makeCurrent;
-    _GLFWswapbuffersfun         swapBuffers;
-    _GLFWswapintervalfun        swapInterval;
-    _GLFWextensionsupportedfun  extensionSupported;
-    _GLFWgetprocaddressfun      getProcAddress;
-    _GLFWdestroycontextfun      destroy;
+    void (*makeCurrent)(_GLFWwindow*);
+    void (*swapBuffers)(_GLFWwindow*);
+    void (*swapInterval)(int);
+    int (*extensionSupported)(const char*);
+    GLFWglproc (*getProcAddress)(const char*);
+    void (*destroy)(_GLFWwindow*);
 
-    // This is defined in the context API's context.h
-    _GLFW_PLATFORM_CONTEXT_STATE;
-    // This is defined in egl_context.h
-    _GLFW_EGL_CONTEXT_STATE;
-    // This is defined in osmesa_context.h
-    _GLFW_OSMESA_CONTEXT_STATE;
+    struct {
+        EGLConfig       config;
+        EGLContext      handle;
+        EGLSurface      surface;
+        void*           client;
+    } egl;
+
+    struct {
+        OSMesaContext   handle;
+        int             width;
+        int             height;
+        void*           buffer;
+    } osmesa;
+
+    // This is defined in platform.h
+    GLFW_PLATFORM_CONTEXT_STATE
 };
 
 // Window and context structure
@@ -376,12 +528,14 @@
     GLFWbool            autoIconify;
     GLFWbool            floating;
     GLFWbool            focusOnShow;
+    GLFWbool            mousePassthrough;
     GLFWbool            shouldClose;
     void*               userPointer;
     GLFWbool            doublebuffer;
     GLFWvidmode         videoMode;
     _GLFWmonitor*       monitor;
     _GLFWcursor*        cursor;
+    char*               title;
 
     int                 minwidth, minheight;
     int                 maxwidth, maxheight;
@@ -419,8 +573,8 @@
         GLFWdropfun               drop;
     } callbacks;
 
-    // This is defined in the window API's platform.h
-    _GLFW_PLATFORM_WINDOW_STATE;
+    // This is defined in platform.h
+    GLFW_PLATFORM_WINDOW_STATE
 };
 
 // Monitor structure
@@ -443,8 +597,8 @@
     GLFWgammaramp   originalRamp;
     GLFWgammaramp   currentRamp;
 
-    // This is defined in the window API's platform.h
-    _GLFW_PLATFORM_MONITOR_STATE;
+    // This is defined in platform.h
+    GLFW_PLATFORM_MONITOR_STATE
 };
 
 // Cursor structure
@@ -452,9 +606,8 @@
 struct _GLFWcursor
 {
     _GLFWcursor*    next;
-
-    // This is defined in the window API's platform.h
-    _GLFW_PLATFORM_CURSOR_STATE;
+    // This is defined in platform.h
+    GLFW_PLATFORM_CURSOR_STATE
 };
 
 // Gamepad mapping element structure
@@ -494,24 +647,108 @@
     char            guid[33];
     _GLFWmapping*   mapping;
 
-    // This is defined in the joystick API's joystick.h
-    _GLFW_PLATFORM_JOYSTICK_STATE;
+    // This is defined in platform.h
+    GLFW_PLATFORM_JOYSTICK_STATE
 };
 
 // Thread local storage structure
 //
 struct _GLFWtls
 {
-    // This is defined in the platform's thread.h
-    _GLFW_PLATFORM_TLS_STATE;
+    // This is defined in platform.h
+    GLFW_PLATFORM_TLS_STATE
 };
 
 // Mutex structure
 //
 struct _GLFWmutex
 {
-    // This is defined in the platform's thread.h
-    _GLFW_PLATFORM_MUTEX_STATE;
+    // This is defined in platform.h
+    GLFW_PLATFORM_MUTEX_STATE
+};
+
+// Platform API structure
+//
+struct _GLFWplatform
+{
+    int platformID;
+    // init
+    GLFWbool (*init)(void);
+    void (*terminate)(void);
+    // input
+    void (*getCursorPos)(_GLFWwindow*,double*,double*);
+    void (*setCursorPos)(_GLFWwindow*,double,double);
+    void (*setCursorMode)(_GLFWwindow*,int);
+    void (*setRawMouseMotion)(_GLFWwindow*,GLFWbool);
+    GLFWbool (*rawMouseMotionSupported)(void);
+    GLFWbool (*createCursor)(_GLFWcursor*,const GLFWimage*,int,int);
+    GLFWbool (*createStandardCursor)(_GLFWcursor*,int);
+    void (*destroyCursor)(_GLFWcursor*);
+    void (*setCursor)(_GLFWwindow*,_GLFWcursor*);
+    const char* (*getScancodeName)(int);
+    int (*getKeyScancode)(int);
+    void (*setClipboardString)(const char*);
+    const char* (*getClipboardString)(void);
+    GLFWbool (*initJoysticks)(void);
+    void (*terminateJoysticks)(void);
+    GLFWbool (*pollJoystick)(_GLFWjoystick*,int);
+    const char* (*getMappingName)(void);
+    void (*updateGamepadGUID)(char*);
+    // monitor
+    void (*freeMonitor)(_GLFWmonitor*);
+    void (*getMonitorPos)(_GLFWmonitor*,int*,int*);
+    void (*getMonitorContentScale)(_GLFWmonitor*,float*,float*);
+    void (*getMonitorWorkarea)(_GLFWmonitor*,int*,int*,int*,int*);
+    GLFWvidmode* (*getVideoModes)(_GLFWmonitor*,int*);
+    GLFWbool (*getVideoMode)(_GLFWmonitor*,GLFWvidmode*);
+    GLFWbool (*getGammaRamp)(_GLFWmonitor*,GLFWgammaramp*);
+    void (*setGammaRamp)(_GLFWmonitor*,const GLFWgammaramp*);
+    // window
+    GLFWbool (*createWindow)(_GLFWwindow*,const _GLFWwndconfig*,const _GLFWctxconfig*,const _GLFWfbconfig*);
+    void (*destroyWindow)(_GLFWwindow*);
+    void (*setWindowTitle)(_GLFWwindow*,const char*);
+    void (*setWindowIcon)(_GLFWwindow*,int,const GLFWimage*);
+    void (*getWindowPos)(_GLFWwindow*,int*,int*);
+    void (*setWindowPos)(_GLFWwindow*,int,int);
+    void (*getWindowSize)(_GLFWwindow*,int*,int*);
+    void (*setWindowSize)(_GLFWwindow*,int,int);
+    void (*setWindowSizeLimits)(_GLFWwindow*,int,int,int,int);
+    void (*setWindowAspectRatio)(_GLFWwindow*,int,int);
+    void (*getFramebufferSize)(_GLFWwindow*,int*,int*);
+    void (*getWindowFrameSize)(_GLFWwindow*,int*,int*,int*,int*);
+    void (*getWindowContentScale)(_GLFWwindow*,float*,float*);
+    void (*iconifyWindow)(_GLFWwindow*);
+    void (*restoreWindow)(_GLFWwindow*);
+    void (*maximizeWindow)(_GLFWwindow*);
+    void (*showWindow)(_GLFWwindow*);
+    void (*hideWindow)(_GLFWwindow*);
+    void (*requestWindowAttention)(_GLFWwindow*);
+    void (*focusWindow)(_GLFWwindow*);
+    void (*setWindowMonitor)(_GLFWwindow*,_GLFWmonitor*,int,int,int,int,int);
+    GLFWbool (*windowFocused)(_GLFWwindow*);
+    GLFWbool (*windowIconified)(_GLFWwindow*);
+    GLFWbool (*windowVisible)(_GLFWwindow*);
+    GLFWbool (*windowMaximized)(_GLFWwindow*);
+    GLFWbool (*windowHovered)(_GLFWwindow*);
+    GLFWbool (*framebufferTransparent)(_GLFWwindow*);
+    float (*getWindowOpacity)(_GLFWwindow*);
+    void (*setWindowResizable)(_GLFWwindow*,GLFWbool);
+    void (*setWindowDecorated)(_GLFWwindow*,GLFWbool);
+    void (*setWindowFloating)(_GLFWwindow*,GLFWbool);
+    void (*setWindowOpacity)(_GLFWwindow*,float);
+    void (*setWindowMousePassthrough)(_GLFWwindow*,GLFWbool);
+    void (*pollEvents)(void);
+    void (*waitEvents)(void);
+    void (*waitEventsTimeout)(double);
+    void (*postEmptyEvent)(void);
+    // EGL
+    EGLenum (*getEGLPlatform)(EGLint**);
+    EGLNativeDisplayType (*getEGLNativeDisplay)(void);
+    EGLNativeWindowType (*getEGLNativeWindow)(_GLFWwindow*);
+    // vulkan
+    void (*getRequiredInstanceExtensions)(char**);
+    GLFWbool (*getPhysicalDevicePresentationSupport)(VkInstance,VkPhysicalDevice,uint32_t);
+    VkResult (*createWindowSurface)(VkInstance,_GLFWwindow*,const VkAllocationCallbacks*,VkSurfaceKHR*);
 };
 
 // Library global data
@@ -519,6 +756,9 @@
 struct _GLFWlibrary
 {
     GLFWbool            initialized;
+    GLFWallocator       allocator;
+
+    _GLFWplatform       platform;
 
     struct {
         _GLFWinitconfig init;
@@ -535,6 +775,7 @@
     _GLFWmonitor**      monitors;
     int                 monitorCount;
 
+    GLFWbool            joysticksInitialized;
     _GLFWjoystick       joysticks[GLFW_JOYSTICK_LAST + 1];
     _GLFWmapping*       mappings;
     int                 mappingCount;
@@ -545,30 +786,80 @@
 
     struct {
         uint64_t        offset;
-        // This is defined in the platform's time.h
-        _GLFW_PLATFORM_LIBRARY_TIMER_STATE;
+        // This is defined in platform.h
+        GLFW_PLATFORM_LIBRARY_TIMER_STATE
     } timer;
 
     struct {
+        EGLenum         platform;
+        EGLDisplay      display;
+        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;
+
+        void*           handle;
+
+        PFN_eglGetConfigAttrib      GetConfigAttrib;
+        PFN_eglGetConfigs           GetConfigs;
+        PFN_eglGetDisplay           GetDisplay;
+        PFN_eglGetError             GetError;
+        PFN_eglInitialize           Initialize;
+        PFN_eglTerminate            Terminate;
+        PFN_eglBindAPI              BindAPI;
+        PFN_eglCreateContext        CreateContext;
+        PFN_eglDestroySurface       DestroySurface;
+        PFN_eglDestroyContext       DestroyContext;
+        PFN_eglCreateWindowSurface  CreateWindowSurface;
+        PFN_eglMakeCurrent          MakeCurrent;
+        PFN_eglSwapBuffers          SwapBuffers;
+        PFN_eglSwapInterval         SwapInterval;
+        PFN_eglQueryString          QueryString;
+        PFN_eglGetProcAddress       GetProcAddress;
+
+        PFNEGLGETPLATFORMDISPLAYEXTPROC GetPlatformDisplayEXT;
+        PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC CreatePlatformWindowSurfaceEXT;
+    } egl;
+
+    struct {
+        void*           handle;
+
+        PFN_OSMesaCreateContextExt      CreateContextExt;
+        PFN_OSMesaCreateContextAttribs  CreateContextAttribs;
+        PFN_OSMesaDestroyContext        DestroyContext;
+        PFN_OSMesaMakeCurrent           MakeCurrent;
+        PFN_OSMesaGetColorBuffer        GetColorBuffer;
+        PFN_OSMesaGetDepthBuffer        GetDepthBuffer;
+        PFN_OSMesaGetProcAddress        GetProcAddress;
+
+    } osmesa;
+
+    struct {
         GLFWbool        available;
         void*           handle;
         char*           extensions[2];
-#if !defined(_GLFW_VULKAN_STATIC)
-        PFN_vkEnumerateInstanceExtensionProperties EnumerateInstanceExtensionProperties;
         PFN_vkGetInstanceProcAddr GetInstanceProcAddr;
-#endif
         GLFWbool        KHR_surface;
-#if defined(_GLFW_WIN32)
         GLFWbool        KHR_win32_surface;
-#elif defined(_GLFW_COCOA)
         GLFWbool        MVK_macos_surface;
         GLFWbool        EXT_metal_surface;
-#elif defined(_GLFW_X11)
         GLFWbool        KHR_xlib_surface;
         GLFWbool        KHR_xcb_surface;
-#elif defined(_GLFW_WAYLAND)
         GLFWbool        KHR_wayland_surface;
-#endif
     } vk;
 
     struct {
@@ -576,16 +867,10 @@
         GLFWjoystickfun joystick;
     } callbacks;
 
-    // This is defined in the window API's platform.h
-    _GLFW_PLATFORM_LIBRARY_WINDOW_STATE;
-    // This is defined in the context API's context.h
-    _GLFW_PLATFORM_LIBRARY_CONTEXT_STATE;
-    // This is defined in the platform's joystick.h
-    _GLFW_PLATFORM_LIBRARY_JOYSTICK_STATE;
-    // This is defined in egl_context.h
-    _GLFW_EGL_LIBRARY_CONTEXT_STATE;
-    // This is defined in osmesa_context.h
-    _GLFW_OSMESA_LIBRARY_CONTEXT_STATE;
+    // These are defined in platform.h
+    GLFW_PLATFORM_LIBRARY_WINDOW_STATE
+    GLFW_PLATFORM_LIBRARY_CONTEXT_STATE
+    GLFW_PLATFORM_LIBRARY_JOYSTICK_STATE
 };
 
 // Global state shared between compilation units of GLFW
@@ -597,101 +882,10 @@
 //////                       GLFW platform API                      //////
 //////////////////////////////////////////////////////////////////////////
 
-int _glfwPlatformInit(void);
-void _glfwPlatformTerminate(void);
-const char* _glfwPlatformGetVersionString(void);
-
-void _glfwPlatformGetCursorPos(_GLFWwindow* window, double* xpos, double* ypos);
-void _glfwPlatformSetCursorPos(_GLFWwindow* window, double xpos, double ypos);
-void _glfwPlatformSetCursorMode(_GLFWwindow* window, int mode);
-void _glfwPlatformSetRawMouseMotion(_GLFWwindow *window, GLFWbool enabled);
-GLFWbool _glfwPlatformRawMouseMotionSupported(void);
-int _glfwPlatformCreateCursor(_GLFWcursor* cursor,
-                              const GLFWimage* image, int xhot, int yhot);
-int _glfwPlatformCreateStandardCursor(_GLFWcursor* cursor, int shape);
-void _glfwPlatformDestroyCursor(_GLFWcursor* cursor);
-void _glfwPlatformSetCursor(_GLFWwindow* window, _GLFWcursor* cursor);
-
-const char* _glfwPlatformGetScancodeName(int scancode);
-int _glfwPlatformGetKeyScancode(int key);
-
-void _glfwPlatformFreeMonitor(_GLFWmonitor* monitor);
-void _glfwPlatformGetMonitorPos(_GLFWmonitor* monitor, int* xpos, int* ypos);
-void _glfwPlatformGetMonitorContentScale(_GLFWmonitor* monitor,
-                                         float* xscale, float* yscale);
-void _glfwPlatformGetMonitorWorkarea(_GLFWmonitor* monitor, int* xpos, int* ypos, int *width, int *height);
-GLFWvidmode* _glfwPlatformGetVideoModes(_GLFWmonitor* monitor, int* count);
-void _glfwPlatformGetVideoMode(_GLFWmonitor* monitor, GLFWvidmode* mode);
-GLFWbool _glfwPlatformGetGammaRamp(_GLFWmonitor* monitor, GLFWgammaramp* ramp);
-void _glfwPlatformSetGammaRamp(_GLFWmonitor* monitor, const GLFWgammaramp* ramp);
-
-void _glfwPlatformSetClipboardString(const char* string);
-const char* _glfwPlatformGetClipboardString(void);
-
-int _glfwPlatformPollJoystick(_GLFWjoystick* js, int mode);
-void _glfwPlatformUpdateGamepadGUID(char* guid);
-
+void _glfwPlatformInitTimer(void);
 uint64_t _glfwPlatformGetTimerValue(void);
 uint64_t _glfwPlatformGetTimerFrequency(void);
 
-int _glfwPlatformCreateWindow(_GLFWwindow* window,
-                              const _GLFWwndconfig* wndconfig,
-                              const _GLFWctxconfig* ctxconfig,
-                              const _GLFWfbconfig* fbconfig);
-void _glfwPlatformDestroyWindow(_GLFWwindow* window);
-void _glfwPlatformSetWindowTitle(_GLFWwindow* window, const char* title);
-void _glfwPlatformSetWindowIcon(_GLFWwindow* window,
-                                int count, const GLFWimage* images);
-void _glfwPlatformGetWindowPos(_GLFWwindow* window, int* xpos, int* ypos);
-void _glfwPlatformSetWindowPos(_GLFWwindow* window, int xpos, int ypos);
-void _glfwPlatformGetWindowSize(_GLFWwindow* window, int* width, int* height);
-void _glfwPlatformSetWindowSize(_GLFWwindow* window, int width, int height);
-void _glfwPlatformSetWindowSizeLimits(_GLFWwindow* window,
-                                      int minwidth, int minheight,
-                                      int maxwidth, int maxheight);
-void _glfwPlatformSetWindowAspectRatio(_GLFWwindow* window, int numer, int denom);
-void _glfwPlatformGetFramebufferSize(_GLFWwindow* window, int* width, int* height);
-void _glfwPlatformGetWindowFrameSize(_GLFWwindow* window,
-                                     int* left, int* top,
-                                     int* right, int* bottom);
-void _glfwPlatformGetWindowContentScale(_GLFWwindow* window,
-                                        float* xscale, float* yscale);
-void _glfwPlatformIconifyWindow(_GLFWwindow* window);
-void _glfwPlatformRestoreWindow(_GLFWwindow* window);
-void _glfwPlatformMaximizeWindow(_GLFWwindow* window);
-void _glfwPlatformShowWindow(_GLFWwindow* window);
-void _glfwPlatformHideWindow(_GLFWwindow* window);
-void _glfwPlatformRequestWindowAttention(_GLFWwindow* window);
-void _glfwPlatformFocusWindow(_GLFWwindow* window);
-void _glfwPlatformSetWindowMonitor(_GLFWwindow* window, _GLFWmonitor* monitor,
-                                   int xpos, int ypos, int width, int height,
-                                   int refreshRate);
-int _glfwPlatformWindowFocused(_GLFWwindow* window);
-int _glfwPlatformWindowIconified(_GLFWwindow* window);
-int _glfwPlatformWindowVisible(_GLFWwindow* window);
-int _glfwPlatformWindowMaximized(_GLFWwindow* window);
-int _glfwPlatformWindowHovered(_GLFWwindow* window);
-int _glfwPlatformFramebufferTransparent(_GLFWwindow* window);
-float _glfwPlatformGetWindowOpacity(_GLFWwindow* window);
-void _glfwPlatformSetWindowResizable(_GLFWwindow* window, GLFWbool enabled);
-void _glfwPlatformSetWindowDecorated(_GLFWwindow* window, GLFWbool enabled);
-void _glfwPlatformSetWindowFloating(_GLFWwindow* window, GLFWbool enabled);
-void _glfwPlatformSetWindowOpacity(_GLFWwindow* window, float opacity);
-
-void _glfwPlatformPollEvents(void);
-void _glfwPlatformWaitEvents(void);
-void _glfwPlatformWaitEventsTimeout(double timeout);
-void _glfwPlatformPostEmptyEvent(void);
-
-void _glfwPlatformGetRequiredInstanceExtensions(char** extensions);
-int _glfwPlatformGetPhysicalDevicePresentationSupport(VkInstance instance,
-                                                      VkPhysicalDevice device,
-                                                      uint32_t queuefamily);
-VkResult _glfwPlatformCreateWindowSurface(VkInstance instance,
-                                          _GLFWwindow* window,
-                                          const VkAllocationCallbacks* allocator,
-                                          VkSurfaceKHR* surface);
-
 GLFWbool _glfwPlatformCreateTls(_GLFWtls* tls);
 void _glfwPlatformDestroyTls(_GLFWtls* tls);
 void* _glfwPlatformGetTls(_GLFWtls* tls);
@@ -702,6 +896,10 @@
 void _glfwPlatformLockMutex(_GLFWmutex* mutex);
 void _glfwPlatformUnlockMutex(_GLFWmutex* mutex);
 
+void* _glfwPlatformLoadModule(const char* path);
+void _glfwPlatformFreeModule(void* module);
+GLFWproc _glfwPlatformGetModuleSymbol(void* module, const char* name);
+
 
 //////////////////////////////////////////////////////////////////////////
 //////                         GLFW event API                       //////
@@ -748,6 +946,8 @@
 //////                       GLFW internal API                      //////
 //////////////////////////////////////////////////////////////////////////
 
+GLFWbool _glfwSelectPlatform(int platformID, _GLFWplatform* platform);
+
 GLFWbool _glfwStringInExtensionString(const char* string, const char* extensions);
 const _GLFWfbconfig* _glfwChooseFBConfig(const _GLFWfbconfig* desired,
                                          const _GLFWfbconfig* alternatives,
@@ -774,6 +974,24 @@
 void _glfwFreeJoystick(_GLFWjoystick* js);
 void _glfwCenterCursorInContentArea(_GLFWwindow* window);
 
+GLFWbool _glfwInitEGL(void);
+void _glfwTerminateEGL(void);
+GLFWbool _glfwCreateContextEGL(_GLFWwindow* window,
+                               const _GLFWctxconfig* ctxconfig,
+                               const _GLFWfbconfig* fbconfig);
+#if defined(_GLFW_X11)
+GLFWbool _glfwChooseVisualEGL(const _GLFWwndconfig* wndconfig,
+                              const _GLFWctxconfig* ctxconfig,
+                              const _GLFWfbconfig* fbconfig,
+                              Visual** visual, int* depth);
+#endif /*_GLFW_X11*/
+
+GLFWbool _glfwInitOSMesa(void);
+void _glfwTerminateOSMesa(void);
+GLFWbool _glfwCreateContextOSMesa(_GLFWwindow* window,
+                                  const _GLFWctxconfig* ctxconfig,
+                                  const _GLFWfbconfig* fbconfig);
+
 GLFWbool _glfwInitVulkan(int mode);
 void _glfwTerminateVulkan(void);
 const char* _glfwGetVulkanResultString(VkResult result);
@@ -784,6 +1002,8 @@
 char* _glfw_strdup(const char* source);
 int _glfw_min(int a, int b);
 int _glfw_max(int a, int b);
-float _glfw_fminf(float a, float b);
-float _glfw_fmaxf(float a, float b);
+
+void* _glfw_calloc(size_t count, size_t size);
+void* _glfw_realloc(void* pointer, size_t size);
+void _glfw_free(void* pointer);
 
diff --git a/src/linux_joystick.c b/src/linux_joystick.c
index e4101fe..07d41d3 100644
--- a/src/linux_joystick.c
+++ b/src/linux_joystick.c
@@ -1,5 +1,5 @@
 //========================================================================
-// GLFW 3.3 Linux - www.glfw.org
+// GLFW 3.4 Linux - www.glfw.org
 //------------------------------------------------------------------------
 // Copyright (c) 2002-2006 Marcus Geelnard
 // Copyright (c) 2006-2017 Camilla Löwy <elmindreda@glfw.org>
@@ -24,11 +24,11 @@
 //    distribution.
 //
 //========================================================================
-// It is fine to use C99 in this file because it will not be built with VS
-//========================================================================
 
 #include "internal.h"
 
+#if defined(GLFW_BUILD_LINUX_JOYSTICK)
+
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <sys/inotify.h>
@@ -135,7 +135,7 @@
     }
 
     _GLFWjoystickLinux linjs = {0};
-    linjs.fd = open(path, O_RDONLY | O_NONBLOCK);
+    linjs.fd = open(path, O_RDONLY | O_NONBLOCK | O_CLOEXEC);
     if (linjs.fd == -1)
         return GLFW_FALSE;
 
@@ -264,8 +264,49 @@
 //////                       GLFW internal API                      //////
 //////////////////////////////////////////////////////////////////////////
 
-// Initialize joystick interface
-//
+void _glfwDetectJoystickConnectionLinux(void)
+{
+    if (_glfw.linjs.inotify <= 0)
+        return;
+
+    ssize_t offset = 0;
+    char buffer[16384];
+    const ssize_t size = read(_glfw.linjs.inotify, buffer, sizeof(buffer));
+
+    while (size > offset)
+    {
+        regmatch_t match;
+        const struct inotify_event* e = (struct inotify_event*) (buffer + offset);
+
+        offset += sizeof(struct inotify_event) + e->len;
+
+        if (regexec(&_glfw.linjs.regex, e->name, 1, &match, 0) != 0)
+            continue;
+
+        char path[PATH_MAX];
+        snprintf(path, sizeof(path), "/dev/input/%s", e->name);
+
+        if (e->mask & (IN_CREATE | IN_ATTRIB))
+            openJoystickDevice(path);
+        else if (e->mask & IN_DELETE)
+        {
+            for (int jid = 0;  jid <= GLFW_JOYSTICK_LAST;  jid++)
+            {
+                if (strcmp(_glfw.joysticks[jid].linjs.path, path) == 0)
+                {
+                    closeJoystick(_glfw.joysticks + jid);
+                    break;
+                }
+            }
+        }
+    }
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+//////                       GLFW platform API                      //////
+//////////////////////////////////////////////////////////////////////////
+
 GLFWbool _glfwInitJoysticksLinux(void)
 {
     const char* dirname = "/dev/input";
@@ -321,13 +362,9 @@
     return GLFW_TRUE;
 }
 
-// Close all opened joystick handles
-//
 void _glfwTerminateJoysticksLinux(void)
 {
-    int jid;
-
-    for (jid = 0;  jid <= GLFW_JOYSTICK_LAST;  jid++)
+    for (int jid = 0;  jid <= GLFW_JOYSTICK_LAST;  jid++)
     {
         _GLFWjoystick* js = _glfw.joysticks + jid;
         if (js->connected)
@@ -346,50 +383,7 @@
         regfree(&_glfw.linjs.regex);
 }
 
-void _glfwDetectJoystickConnectionLinux(void)
-{
-    if (_glfw.linjs.inotify <= 0)
-        return;
-
-    ssize_t offset = 0;
-    char buffer[16384];
-    const ssize_t size = read(_glfw.linjs.inotify, buffer, sizeof(buffer));
-
-    while (size > offset)
-    {
-        regmatch_t match;
-        const struct inotify_event* e = (struct inotify_event*) (buffer + offset);
-
-        offset += sizeof(struct inotify_event) + e->len;
-
-        if (regexec(&_glfw.linjs.regex, e->name, 1, &match, 0) != 0)
-            continue;
-
-        char path[PATH_MAX];
-        snprintf(path, sizeof(path), "/dev/input/%s", e->name);
-
-        if (e->mask & (IN_CREATE | IN_ATTRIB))
-            openJoystickDevice(path);
-        else if (e->mask & IN_DELETE)
-        {
-            for (int jid = 0;  jid <= GLFW_JOYSTICK_LAST;  jid++)
-            {
-                if (strcmp(_glfw.joysticks[jid].linjs.path, path) == 0)
-                {
-                    closeJoystick(_glfw.joysticks + jid);
-                    break;
-                }
-            }
-        }
-    }
-}
-
-
-//////////////////////////////////////////////////////////////////////////
-//////                       GLFW platform API                      //////
-//////////////////////////////////////////////////////////////////////////
-
-int _glfwPlatformPollJoystick(_GLFWjoystick* js, int mode)
+GLFWbool _glfwPollJoystickLinux(_GLFWjoystick* js, int mode)
 {
     // Read all queued events (non-blocking)
     for (;;)
@@ -429,7 +423,14 @@
     return js->connected;
 }
 
-void _glfwPlatformUpdateGamepadGUID(char* guid)
+const char* _glfwGetMappingNameLinux(void)
+{
+    return "Linux";
+}
+
+void _glfwUpdateGamepadGUIDLinux(char* guid)
 {
 }
 
+#endif // GLFW_BUILD_LINUX_JOYSTICK
+
diff --git a/src/linux_joystick.h b/src/linux_joystick.h
index 50df677..64462b0 100644
--- a/src/linux_joystick.h
+++ b/src/linux_joystick.h
@@ -1,5 +1,5 @@
 //========================================================================
-// GLFW 3.3 Linux - www.glfw.org
+// GLFW 3.4 Linux - www.glfw.org
 //------------------------------------------------------------------------
 // Copyright (c) 2014 Jonas Ådahl <jadahl@gmail.com>
 //
@@ -28,11 +28,8 @@
 #include <linux/limits.h>
 #include <regex.h>
 
-#define _GLFW_PLATFORM_JOYSTICK_STATE         _GLFWjoystickLinux linjs
-#define _GLFW_PLATFORM_LIBRARY_JOYSTICK_STATE _GLFWlibraryLinux  linjs
-
-#define _GLFW_PLATFORM_MAPPING_NAME "Linux"
-#define GLFW_BUILD_LINUX_MAPPINGS
+#define GLFW_LINUX_JOYSTICK_STATE         _GLFWjoystickLinux linjs;
+#define GLFW_LINUX_LIBRARY_JOYSTICK_STATE _GLFWlibraryLinux  linjs;
 
 // Linux-specific joystick data
 //
@@ -57,8 +54,11 @@
     GLFWbool                dropped;
 } _GLFWlibraryLinux;
 
+void _glfwDetectJoystickConnectionLinux(void);
 
 GLFWbool _glfwInitJoysticksLinux(void);
 void _glfwTerminateJoysticksLinux(void);
-void _glfwDetectJoystickConnectionLinux(void);
+GLFWbool _glfwPollJoystickLinux(_GLFWjoystick* js, int mode);
+const char* _glfwGetMappingNameLinux(void);
+void _glfwUpdateGamepadGUIDLinux(char* guid);
 
diff --git a/src/mappings.h b/src/mappings.h
index 11853a0..270fa4c 100644
--- a/src/mappings.h
+++ b/src/mappings.h
@@ -1,5 +1,5 @@
 //========================================================================
-// GLFW 3.3 - www.glfw.org
+// GLFW 3.4 - www.glfw.org
 //------------------------------------------------------------------------
 // Copyright (c) 2006-2018 Camilla Löwy <elmindreda@glfw.org>
 //
@@ -60,7 +60,7 @@
 
 const char* _glfwDefaultMappings[] =
 {
-#if defined(GLFW_BUILD_WIN32_MAPPINGS)
+#if defined(_GLFW_WIN32)
 "03000000fa2d00000100000000000000,3DRUDDER,leftx:a0,lefty:a1,rightx:a5,righty:a2,platform:Windows,",
 "03000000c82d00002038000000000000,8bitdo,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b4,y:b3,platform:Windows,",
 "03000000c82d00000951000000000000,8BitDo Dogbone Modkit,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,start:b11,platform:Windows,",
@@ -426,9 +426,9 @@
 "78696e70757405000000000000000000,XInput Dance Pad (GLFW),platform:Windows,a:b0,b:b1,x:b2,y:b3,leftshoulder:b4,rightshoulder:b5,back:b6,start:b7,leftstick:b8,rightstick:b9,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,dpup:h0.1,dpright:h0.2,dpdown:h0.4,dpleft:h0.8,",
 "78696e70757406000000000000000000,XInput Guitar (GLFW),platform:Windows,a:b0,b:b1,x:b2,y:b3,leftshoulder:b4,rightshoulder:b5,back:b6,start:b7,leftstick:b8,rightstick:b9,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,dpup:h0.1,dpright:h0.2,dpdown:h0.4,dpleft:h0.8,",
 "78696e70757408000000000000000000,XInput Drum Kit (GLFW),platform:Windows,a:b0,b:b1,x:b2,y:b3,leftshoulder:b4,rightshoulder:b5,back:b6,start:b7,leftstick:b8,rightstick:b9,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,dpup:h0.1,dpright:h0.2,dpdown:h0.4,dpleft:h0.8,",
-#endif // GLFW_BUILD_WIN32_MAPPINGS
+#endif // _GLFW_WIN32
 
-#if defined(GLFW_BUILD_COCOA_MAPPINGS)
+#if defined(_GLFW_COCOA)
 "030000008f0e00000300000009010000,2In1 USB Joystick,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Mac OS X,",
 "03000000c82d00000090000001000000,8BitDo FC30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a5,rightx:a2,righty:a3,start:b11,x:b4,y:b3,platform:Mac OS X,",
 "03000000c82d00001038000000010000,8BitDo FC30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b4,y:b3,platform:Mac OS X,",
@@ -598,9 +598,9 @@
 "03000000172700004431000029010000,XiaoMi Game Controller,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b15,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a6,rightx:a2,righty:a5,start:b11,x:b3,y:b4,platform:Mac OS X,",
 "03000000120c0000100e000000010000,ZEROPLUS P4 Gamepad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Mac OS X,",
 "03000000120c0000101e000000010000,ZEROPLUS P4 Wired Gamepad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Mac OS X,",
-#endif // GLFW_BUILD_COCOA_MAPPINGS
+#endif // _GLFW_COCOA
 
-#if defined(GLFW_BUILD_LINUX_MAPPINGS)
+#if defined(GLFW_BUILD_LINUX_JOYSTICK)
 "03000000c82d00000090000011010000,8BitDo FC30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a5,rightx:a2,righty:a3,start:b11,x:b4,y:b3,platform:Linux,",
 "05000000c82d00001038000000010000,8Bitdo FC30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b4,y:b3,platform:Linux,",
 "05000000c82d00005106000000010000,8BitDo M30,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b8,lefttrigger:b9,leftx:a0,lefty:a1,rightshoulder:b6,righttrigger:b7,start:b11,x:b3,y:b4,platform:Linux,",
@@ -996,6 +996,6 @@
 "03000000c0160000e105000001010000,Xin-Mo Xin-Mo Dual Arcade,a:b4,b:b3,back:b6,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b9,leftshoulder:b2,leftx:a0,lefty:a1,rightshoulder:b5,start:b7,x:b1,y:b0,platform:Linux,",
 "03000000120c0000100e000011010000,ZEROPLUS P4 Gamepad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Linux,",
 "03000000120c0000101e000011010000,ZEROPLUS P4 Wired Gamepad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Linux,",
-#endif // GLFW_BUILD_LINUX_MAPPINGS
+#endif // GLFW_BUILD_LINUX_JOYSTICK
 };
 
diff --git a/src/mappings.h.in b/src/mappings.h.in
index 26b544b..ed62368 100644
--- a/src/mappings.h.in
+++ b/src/mappings.h.in
@@ -1,5 +1,5 @@
 //========================================================================
-// GLFW 3.3 - www.glfw.org
+// GLFW 3.4 - www.glfw.org
 //------------------------------------------------------------------------
 // Copyright (c) 2006-2018 Camilla Löwy <elmindreda@glfw.org>
 //
@@ -60,7 +60,7 @@
 
 const char* _glfwDefaultMappings[] =
 {
-#if defined(GLFW_BUILD_WIN32_MAPPINGS)
+#if defined(_GLFW_WIN32)
 @GLFW_WIN32_MAPPINGS@
 "78696e70757401000000000000000000,XInput Gamepad (GLFW),platform:Windows,a:b0,b:b1,x:b2,y:b3,leftshoulder:b4,rightshoulder:b5,back:b6,start:b7,leftstick:b8,rightstick:b9,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,dpup:h0.1,dpright:h0.2,dpdown:h0.4,dpleft:h0.8,",
 "78696e70757402000000000000000000,XInput Wheel (GLFW),platform:Windows,a:b0,b:b1,x:b2,y:b3,leftshoulder:b4,rightshoulder:b5,back:b6,start:b7,leftstick:b8,rightstick:b9,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,dpup:h0.1,dpright:h0.2,dpdown:h0.4,dpleft:h0.8,",
@@ -69,14 +69,14 @@
 "78696e70757405000000000000000000,XInput Dance Pad (GLFW),platform:Windows,a:b0,b:b1,x:b2,y:b3,leftshoulder:b4,rightshoulder:b5,back:b6,start:b7,leftstick:b8,rightstick:b9,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,dpup:h0.1,dpright:h0.2,dpdown:h0.4,dpleft:h0.8,",
 "78696e70757406000000000000000000,XInput Guitar (GLFW),platform:Windows,a:b0,b:b1,x:b2,y:b3,leftshoulder:b4,rightshoulder:b5,back:b6,start:b7,leftstick:b8,rightstick:b9,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,dpup:h0.1,dpright:h0.2,dpdown:h0.4,dpleft:h0.8,",
 "78696e70757408000000000000000000,XInput Drum Kit (GLFW),platform:Windows,a:b0,b:b1,x:b2,y:b3,leftshoulder:b4,rightshoulder:b5,back:b6,start:b7,leftstick:b8,rightstick:b9,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,dpup:h0.1,dpright:h0.2,dpdown:h0.4,dpleft:h0.8,",
-#endif // GLFW_BUILD_WIN32_MAPPINGS
+#endif // _GLFW_WIN32
 
-#if defined(GLFW_BUILD_COCOA_MAPPINGS)
+#if defined(_GLFW_COCOA)
 @GLFW_COCOA_MAPPINGS@
-#endif // GLFW_BUILD_COCOA_MAPPINGS
+#endif // _GLFW_COCOA
 
-#if defined(GLFW_BUILD_LINUX_MAPPINGS)
+#if defined(GLFW_BUILD_LINUX_JOYSTICK)
 @GLFW_LINUX_MAPPINGS@
-#endif // GLFW_BUILD_LINUX_MAPPINGS
+#endif // GLFW_BUILD_LINUX_JOYSTICK
 };
 
diff --git a/src/monitor.c b/src/monitor.c
index 2601d11..efc286d 100644
--- a/src/monitor.c
+++ b/src/monitor.c
@@ -1,5 +1,5 @@
 //========================================================================
-// GLFW 3.3 - www.glfw.org
+// GLFW 3.4 - www.glfw.org
 //------------------------------------------------------------------------
 // Copyright (c) 2002-2006 Marcus Geelnard
 // Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.org>
@@ -24,8 +24,6 @@
 //    distribution.
 //
 //========================================================================
-// Please use C89 style variable declarations in this file because VS 2010
-//========================================================================
 
 #include "internal.h"
 
@@ -74,13 +72,13 @@
     if (monitor->modes)
         return GLFW_TRUE;
 
-    modes = _glfwPlatformGetVideoModes(monitor, &modeCount);
+    modes = _glfw.platform.getVideoModes(monitor, &modeCount);
     if (!modes)
         return GLFW_FALSE;
 
     qsort(modes, modeCount, sizeof(GLFWvidmode), compareVideoModes);
 
-    free(monitor->modes);
+    _glfw_free(monitor->modes);
     monitor->modes = modes;
     monitor->modeCount = modeCount;
 
@@ -96,11 +94,16 @@
 //
 void _glfwInputMonitor(_GLFWmonitor* monitor, int action, int placement)
 {
+    assert(monitor != NULL);
+    assert(action == GLFW_CONNECTED || action == GLFW_DISCONNECTED);
+    assert(placement == _GLFW_INSERT_FIRST || placement == _GLFW_INSERT_LAST);
+
     if (action == GLFW_CONNECTED)
     {
         _glfw.monitorCount++;
         _glfw.monitors =
-            realloc(_glfw.monitors, sizeof(_GLFWmonitor*) * _glfw.monitorCount);
+            _glfw_realloc(_glfw.monitors,
+                          sizeof(_GLFWmonitor*) * _glfw.monitorCount);
 
         if (placement == _GLFW_INSERT_FIRST)
         {
@@ -122,10 +125,10 @@
             if (window->monitor == monitor)
             {
                 int width, height, xoff, yoff;
-                _glfwPlatformGetWindowSize(window, &width, &height);
-                _glfwPlatformSetWindowMonitor(window, NULL, 0, 0, width, height, 0);
-                _glfwPlatformGetWindowFrameSize(window, &xoff, &yoff, NULL, NULL);
-                _glfwPlatformSetWindowPos(window, xoff, yoff);
+                _glfw.platform.getWindowSize(window, &width, &height);
+                _glfw.platform.setWindowMonitor(window, NULL, 0, 0, width, height, 0);
+                _glfw.platform.getWindowFrameSize(window, &xoff, &yoff, NULL, NULL);
+                _glfw.platform.setWindowPos(window, xoff, yoff);
             }
         }
 
@@ -154,6 +157,7 @@
 //
 void _glfwInputMonitorWindow(_GLFWmonitor* monitor, _GLFWwindow* window)
 {
+    assert(monitor != NULL);
     monitor->window = window;
 }
 
@@ -166,7 +170,7 @@
 //
 _GLFWmonitor* _glfwAllocMonitor(const char* name, int widthMM, int heightMM)
 {
-    _GLFWmonitor* monitor = calloc(1, sizeof(_GLFWmonitor));
+    _GLFWmonitor* monitor = _glfw_calloc(1, sizeof(_GLFWmonitor));
     monitor->widthMM = widthMM;
     monitor->heightMM = heightMM;
 
@@ -182,22 +186,22 @@
     if (monitor == NULL)
         return;
 
-    _glfwPlatformFreeMonitor(monitor);
+    _glfw.platform.freeMonitor(monitor);
 
     _glfwFreeGammaArrays(&monitor->originalRamp);
     _glfwFreeGammaArrays(&monitor->currentRamp);
 
-    free(monitor->modes);
-    free(monitor);
+    _glfw_free(monitor->modes);
+    _glfw_free(monitor);
 }
 
 // Allocates red, green and blue value arrays of the specified size
 //
 void _glfwAllocGammaArrays(GLFWgammaramp* ramp, unsigned int size)
 {
-    ramp->red = calloc(size, sizeof(unsigned short));
-    ramp->green = calloc(size, sizeof(unsigned short));
-    ramp->blue = calloc(size, sizeof(unsigned short));
+    ramp->red = _glfw_calloc(size, sizeof(unsigned short));
+    ramp->green = _glfw_calloc(size, sizeof(unsigned short));
+    ramp->blue = _glfw_calloc(size, sizeof(unsigned short));
     ramp->size = size;
 }
 
@@ -205,9 +209,9 @@
 //
 void _glfwFreeGammaArrays(GLFWgammaramp* ramp)
 {
-    free(ramp->red);
-    free(ramp->green);
-    free(ramp->blue);
+    _glfw_free(ramp->red);
+    _glfw_free(ramp->green);
+    _glfw_free(ramp->blue);
 
     memset(ramp, 0, sizeof(GLFWgammaramp));
 }
@@ -331,7 +335,7 @@
 
     _GLFW_REQUIRE_INIT();
 
-    _glfwPlatformGetMonitorPos(monitor, xpos, ypos);
+    _glfw.platform.getMonitorPos(monitor, xpos, ypos);
 }
 
 GLFWAPI void glfwGetMonitorWorkarea(GLFWmonitor* handle,
@@ -352,7 +356,7 @@
 
     _GLFW_REQUIRE_INIT();
 
-    _glfwPlatformGetMonitorWorkarea(monitor, xpos, ypos, width, height);
+    _glfw.platform.getMonitorWorkarea(monitor, xpos, ypos, width, height);
 }
 
 GLFWAPI void glfwGetMonitorPhysicalSize(GLFWmonitor* handle, int* widthMM, int* heightMM)
@@ -385,7 +389,7 @@
         *yscale = 0.f;
 
     _GLFW_REQUIRE_INIT();
-    _glfwPlatformGetMonitorContentScale(monitor, xscale, yscale);
+    _glfw.platform.getMonitorContentScale(monitor, xscale, yscale);
 }
 
 GLFWAPI const char* glfwGetMonitorName(GLFWmonitor* handle)
@@ -418,7 +422,7 @@
 GLFWAPI GLFWmonitorfun glfwSetMonitorCallback(GLFWmonitorfun cbfun)
 {
     _GLFW_REQUIRE_INIT_OR_RETURN(NULL);
-    _GLFW_SWAP_POINTERS(_glfw.callbacks.monitor, cbfun);
+    _GLFW_SWAP(GLFWmonitorfun, _glfw.callbacks.monitor, cbfun);
     return cbfun;
 }
 
@@ -446,7 +450,9 @@
 
     _GLFW_REQUIRE_INIT_OR_RETURN(NULL);
 
-    _glfwPlatformGetVideoMode(monitor, &monitor->currentMode);
+    if (!_glfw.platform.getVideoMode(monitor, &monitor->currentMode))
+        return NULL;
+
     return &monitor->currentMode;
 }
 
@@ -472,7 +478,7 @@
     if (!original)
         return;
 
-    values = calloc(original->size, sizeof(unsigned short));
+    values = _glfw_calloc(original->size, sizeof(unsigned short));
 
     for (i = 0;  i < original->size;  i++)
     {
@@ -483,7 +489,7 @@
         // Apply gamma curve
         value = powf(value, 1.f / gamma) * 65535.f + 0.5f;
         // Clamp to value range
-        value = _glfw_fminf(value, 65535.f);
+        value = fminf(value, 65535.f);
 
         values[i] = (unsigned short) value;
     }
@@ -494,7 +500,7 @@
     ramp.size = original->size;
 
     glfwSetGammaRamp(handle, &ramp);
-    free(values);
+    _glfw_free(values);
 }
 
 GLFWAPI const GLFWgammaramp* glfwGetGammaRamp(GLFWmonitor* handle)
@@ -505,7 +511,7 @@
     _GLFW_REQUIRE_INIT_OR_RETURN(NULL);
 
     _glfwFreeGammaArrays(&monitor->currentRamp);
-    if (!_glfwPlatformGetGammaRamp(monitor, &monitor->currentRamp))
+    if (!_glfw.platform.getGammaRamp(monitor, &monitor->currentRamp))
         return NULL;
 
     return &monitor->currentRamp;
@@ -533,10 +539,10 @@
 
     if (!monitor->originalRamp.size)
     {
-        if (!_glfwPlatformGetGammaRamp(monitor, &monitor->originalRamp))
+        if (!_glfw.platform.getGammaRamp(monitor, &monitor->originalRamp))
             return;
     }
 
-    _glfwPlatformSetGammaRamp(monitor, ramp);
+    _glfw.platform.setGammaRamp(monitor, ramp);
 }
 
diff --git a/src/nsgl_context.h b/src/nsgl_context.h
deleted file mode 100644
index 010ce4d..0000000
--- a/src/nsgl_context.h
+++ /dev/null
@@ -1,66 +0,0 @@
-//========================================================================
-// GLFW 3.3 macOS - www.glfw.org
-//------------------------------------------------------------------------
-// Copyright (c) 2009-2019 Camilla Löwy <elmindreda@glfw.org>
-//
-// 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.
-//
-//========================================================================
-
-// NOTE: Many Cocoa enum values have been renamed and we need to build across
-//       SDK versions where one is unavailable or deprecated.
-//       We use the newer names in code and replace them with the older names if
-//       the base SDK does not provide the newer names.
-
-#if MAC_OS_X_VERSION_MAX_ALLOWED < 101400
- #define NSOpenGLContextParameterSwapInterval NSOpenGLCPSwapInterval
- #define NSOpenGLContextParameterSurfaceOpacity NSOpenGLCPSurfaceOpacity
-#endif
-
-#define _GLFW_PLATFORM_CONTEXT_STATE            _GLFWcontextNSGL nsgl
-#define _GLFW_PLATFORM_LIBRARY_CONTEXT_STATE    _GLFWlibraryNSGL nsgl
-
-#include <stdatomic.h>
-
-
-// NSGL-specific per-context data
-//
-typedef struct _GLFWcontextNSGL
-{
-    id                pixelFormat;
-    id                object;
-} _GLFWcontextNSGL;
-
-// NSGL-specific global data
-//
-typedef struct _GLFWlibraryNSGL
-{
-    // dlopen handle for OpenGL.framework (for glfwGetProcAddress)
-    CFBundleRef     framework;
-} _GLFWlibraryNSGL;
-
-
-GLFWbool _glfwInitNSGL(void);
-void _glfwTerminateNSGL(void);
-GLFWbool _glfwCreateContextNSGL(_GLFWwindow* window,
-                                const _GLFWctxconfig* ctxconfig,
-                                const _GLFWfbconfig* fbconfig);
-void _glfwDestroyContextNSGL(_GLFWwindow* window);
-
diff --git a/src/nsgl_context.m b/src/nsgl_context.m
index e581b6f..daa8367 100644
--- a/src/nsgl_context.m
+++ b/src/nsgl_context.m
@@ -1,5 +1,5 @@
 //========================================================================
-// GLFW 3.3 macOS - www.glfw.org
+// GLFW 3.4 macOS - www.glfw.org
 //------------------------------------------------------------------------
 // Copyright (c) 2009-2019 Camilla Löwy <elmindreda@glfw.org>
 //
@@ -23,11 +23,11 @@
 //    distribution.
 //
 //========================================================================
-// It is fine to use C99 in this file because it will not be built with VS
-//========================================================================
 
 #include "internal.h"
 
+#if defined(_GLFW_COCOA)
+
 #include <unistd.h>
 #include <math.h>
 
@@ -173,13 +173,13 @@
                             "NSGL: The targeted version of macOS does not support OpenGL 3.0 or 3.1 but may support 3.2 and above");
             return GLFW_FALSE;
         }
+    }
 
-        if (!ctxconfig->forward || ctxconfig->profile != GLFW_OPENGL_CORE_PROFILE)
-        {
-            _glfwInputError(GLFW_VERSION_UNAVAILABLE,
-                            "NSGL: The targeted version of macOS only supports forward-compatible core profile contexts for OpenGL 3.2 and above");
-            return GLFW_FALSE;
-        }
+    if (ctxconfig->major >= 3 && ctxconfig->profile == GLFW_OPENGL_COMPAT_PROFILE)
+    {
+        _glfwInputError(GLFW_VERSION_UNAVAILABLE,
+                        "NSGL: The compatibility profile is not available on macOS");
+        return GLFW_FALSE;
     }
 
     // Context robustness modes (GL_KHR_robustness) are not yet supported by
@@ -194,45 +194,45 @@
     // No-error contexts (GL_KHR_no_error) are not yet supported by macOS but
     // are not a hard constraint, so ignore and continue
 
-#define addAttrib(a) \
+#define ADD_ATTRIB(a) \
 { \
     assert((size_t) index < sizeof(attribs) / sizeof(attribs[0])); \
     attribs[index++] = a; \
 }
-#define setAttrib(a, v) { addAttrib(a); addAttrib(v); }
+#define SET_ATTRIB(a, v) { ADD_ATTRIB(a); ADD_ATTRIB(v); }
 
     NSOpenGLPixelFormatAttribute attribs[40];
     int index = 0;
 
-    addAttrib(NSOpenGLPFAAccelerated);
-    addAttrib(NSOpenGLPFAClosestPolicy);
+    ADD_ATTRIB(NSOpenGLPFAAccelerated);
+    ADD_ATTRIB(NSOpenGLPFAClosestPolicy);
 
     if (ctxconfig->nsgl.offline)
     {
-        addAttrib(NSOpenGLPFAAllowOfflineRenderers);
+        ADD_ATTRIB(NSOpenGLPFAAllowOfflineRenderers);
         // NOTE: This replaces the NSSupportsAutomaticGraphicsSwitching key in
         //       Info.plist for unbundled applications
         // HACK: This assumes that NSOpenGLPixelFormat will remain
         //       a straightforward wrapper of its CGL counterpart
-        addAttrib(kCGLPFASupportsAutomaticGraphicsSwitching);
+        ADD_ATTRIB(kCGLPFASupportsAutomaticGraphicsSwitching);
     }
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 101000
     if (ctxconfig->major >= 4)
     {
-        setAttrib(NSOpenGLPFAOpenGLProfile, NSOpenGLProfileVersion4_1Core);
+        SET_ATTRIB(NSOpenGLPFAOpenGLProfile, NSOpenGLProfileVersion4_1Core);
     }
     else
 #endif /*MAC_OS_X_VERSION_MAX_ALLOWED*/
     if (ctxconfig->major >= 3)
     {
-        setAttrib(NSOpenGLPFAOpenGLProfile, NSOpenGLProfileVersion3_2Core);
+        SET_ATTRIB(NSOpenGLPFAOpenGLProfile, NSOpenGLProfileVersion3_2Core);
     }
 
     if (ctxconfig->major <= 2)
     {
         if (fbconfig->auxBuffers != GLFW_DONT_CARE)
-            setAttrib(NSOpenGLPFAAuxBuffers, fbconfig->auxBuffers);
+            SET_ATTRIB(NSOpenGLPFAAuxBuffers, fbconfig->auxBuffers);
 
         if (fbconfig->accumRedBits != GLFW_DONT_CARE &&
             fbconfig->accumGreenBits != GLFW_DONT_CARE &&
@@ -244,7 +244,7 @@
                                   fbconfig->accumBlueBits +
                                   fbconfig->accumAlphaBits;
 
-            setAttrib(NSOpenGLPFAAccumSize, accumBits);
+            SET_ATTRIB(NSOpenGLPFAAccumSize, accumBits);
         }
     }
 
@@ -262,17 +262,17 @@
         else if (colorBits < 15)
             colorBits = 15;
 
-        setAttrib(NSOpenGLPFAColorSize, colorBits);
+        SET_ATTRIB(NSOpenGLPFAColorSize, colorBits);
     }
 
     if (fbconfig->alphaBits != GLFW_DONT_CARE)
-        setAttrib(NSOpenGLPFAAlphaSize, fbconfig->alphaBits);
+        SET_ATTRIB(NSOpenGLPFAAlphaSize, fbconfig->alphaBits);
 
     if (fbconfig->depthBits != GLFW_DONT_CARE)
-        setAttrib(NSOpenGLPFADepthSize, fbconfig->depthBits);
+        SET_ATTRIB(NSOpenGLPFADepthSize, fbconfig->depthBits);
 
     if (fbconfig->stencilBits != GLFW_DONT_CARE)
-        setAttrib(NSOpenGLPFAStencilSize, fbconfig->stencilBits);
+        SET_ATTRIB(NSOpenGLPFAStencilSize, fbconfig->stencilBits);
 
     if (fbconfig->stereo)
     {
@@ -281,33 +281,33 @@
                         "NSGL: Stereo rendering is deprecated");
         return GLFW_FALSE;
 #else
-        addAttrib(NSOpenGLPFAStereo);
+        ADD_ATTRIB(NSOpenGLPFAStereo);
 #endif
     }
 
     if (fbconfig->doublebuffer)
-        addAttrib(NSOpenGLPFADoubleBuffer);
+        ADD_ATTRIB(NSOpenGLPFADoubleBuffer);
 
     if (fbconfig->samples != GLFW_DONT_CARE)
     {
         if (fbconfig->samples == 0)
         {
-            setAttrib(NSOpenGLPFASampleBuffers, 0);
+            SET_ATTRIB(NSOpenGLPFASampleBuffers, 0);
         }
         else
         {
-            setAttrib(NSOpenGLPFASampleBuffers, 1);
-            setAttrib(NSOpenGLPFASamples, fbconfig->samples);
+            SET_ATTRIB(NSOpenGLPFASampleBuffers, 1);
+            SET_ATTRIB(NSOpenGLPFASamples, fbconfig->samples);
         }
     }
 
     // NOTE: All NSOpenGLPixelFormats on the relevant cards support sRGB
     //       framebuffer, so there's no need (and no way) to request it
 
-    addAttrib(0);
+    ADD_ATTRIB(0);
 
-#undef addAttrib
-#undef setAttrib
+#undef ADD_ATTRIB
+#undef SET_ATTRIB
 
     window->context.nsgl.pixelFormat =
         [[NSOpenGLPixelFormat alloc] initWithAttributes:attribs];
@@ -340,7 +340,7 @@
                                   forParameter:NSOpenGLContextParameterSurfaceOpacity];
     }
 
-    [window->ns.view setWantsBestResolutionOpenGLSurface:window->ns.retina];
+    [window->ns.view setWantsBestResolutionOpenGLSurface:window->ns.scaleFramebuffer];
 
     [window->context.nsgl.object setView:window->ns.view];
 
@@ -364,6 +364,13 @@
     _GLFWwindow* window = (_GLFWwindow*) handle;
     _GLFW_REQUIRE_INIT_OR_RETURN(nil);
 
+    if (_glfw.platform.platformID != GLFW_PLATFORM_COCOA)
+    {
+        _glfwInputError(GLFW_PLATFORM_UNAVAILABLE,
+                        "NSGL: Platform not initialized");
+        return nil;
+    }
+
     if (window->context.source != GLFW_NATIVE_CONTEXT_API)
     {
         _glfwInputError(GLFW_NO_WINDOW_CONTEXT, NULL);
@@ -373,3 +380,5 @@
     return window->context.nsgl.object;
 }
 
+#endif // _GLFW_COCOA
+
diff --git a/src/null_init.c b/src/null_init.c
index 569bc8c..88940fc 100644
--- a/src/null_init.c
+++ b/src/null_init.c
@@ -1,5 +1,5 @@
 //========================================================================
-// GLFW 3.3 - www.glfw.org
+// GLFW 3.4 - www.glfw.org
 //------------------------------------------------------------------------
 // Copyright (c) 2016 Google Inc.
 // Copyright (c) 2016-2017 Camilla Löwy <elmindreda@glfw.org>
@@ -24,29 +24,241 @@
 //    distribution.
 //
 //========================================================================
-// It is fine to use C99 in this file because it will not be built with VS
-//========================================================================
 
 #include "internal.h"
 
+#include <stdlib.h>
+#include <string.h>
+
 
 //////////////////////////////////////////////////////////////////////////
 //////                       GLFW platform API                      //////
 //////////////////////////////////////////////////////////////////////////
 
-int _glfwPlatformInit(void)
+GLFWbool _glfwConnectNull(int platformID, _GLFWplatform* platform)
 {
-    _glfwInitTimerPOSIX();
+    const _GLFWplatform null =
+    {
+        .platformID = GLFW_PLATFORM_NULL,
+        .init = _glfwInitNull,
+        .terminate = _glfwTerminateNull,
+        .getCursorPos = _glfwGetCursorPosNull,
+        .setCursorPos = _glfwSetCursorPosNull,
+        .setCursorMode = _glfwSetCursorModeNull,
+        .setRawMouseMotion = _glfwSetRawMouseMotionNull,
+        .rawMouseMotionSupported = _glfwRawMouseMotionSupportedNull,
+        .createCursor = _glfwCreateCursorNull,
+        .createStandardCursor = _glfwCreateStandardCursorNull,
+        .destroyCursor = _glfwDestroyCursorNull,
+        .setCursor = _glfwSetCursorNull,
+        .getScancodeName = _glfwGetScancodeNameNull,
+        .getKeyScancode = _glfwGetKeyScancodeNull,
+        .setClipboardString = _glfwSetClipboardStringNull,
+        .getClipboardString = _glfwGetClipboardStringNull,
+        .initJoysticks = _glfwInitJoysticksNull,
+        .terminateJoysticks = _glfwTerminateJoysticksNull,
+        .pollJoystick = _glfwPollJoystickNull,
+        .getMappingName = _glfwGetMappingNameNull,
+        .updateGamepadGUID = _glfwUpdateGamepadGUIDNull,
+        .freeMonitor = _glfwFreeMonitorNull,
+        .getMonitorPos = _glfwGetMonitorPosNull,
+        .getMonitorContentScale = _glfwGetMonitorContentScaleNull,
+        .getMonitorWorkarea = _glfwGetMonitorWorkareaNull,
+        .getVideoModes = _glfwGetVideoModesNull,
+        .getVideoMode = _glfwGetVideoModeNull,
+        .getGammaRamp = _glfwGetGammaRampNull,
+        .setGammaRamp = _glfwSetGammaRampNull,
+        .createWindow = _glfwCreateWindowNull,
+        .destroyWindow = _glfwDestroyWindowNull,
+        .setWindowTitle = _glfwSetWindowTitleNull,
+        .setWindowIcon = _glfwSetWindowIconNull,
+        .getWindowPos = _glfwGetWindowPosNull,
+        .setWindowPos = _glfwSetWindowPosNull,
+        .getWindowSize = _glfwGetWindowSizeNull,
+        .setWindowSize = _glfwSetWindowSizeNull,
+        .setWindowSizeLimits = _glfwSetWindowSizeLimitsNull,
+        .setWindowAspectRatio = _glfwSetWindowAspectRatioNull,
+        .getFramebufferSize = _glfwGetFramebufferSizeNull,
+        .getWindowFrameSize = _glfwGetWindowFrameSizeNull,
+        .getWindowContentScale = _glfwGetWindowContentScaleNull,
+        .iconifyWindow = _glfwIconifyWindowNull,
+        .restoreWindow = _glfwRestoreWindowNull,
+        .maximizeWindow = _glfwMaximizeWindowNull,
+        .showWindow = _glfwShowWindowNull,
+        .hideWindow = _glfwHideWindowNull,
+        .requestWindowAttention = _glfwRequestWindowAttentionNull,
+        .focusWindow = _glfwFocusWindowNull,
+        .setWindowMonitor = _glfwSetWindowMonitorNull,
+        .windowFocused = _glfwWindowFocusedNull,
+        .windowIconified = _glfwWindowIconifiedNull,
+        .windowVisible = _glfwWindowVisibleNull,
+        .windowMaximized = _glfwWindowMaximizedNull,
+        .windowHovered = _glfwWindowHoveredNull,
+        .framebufferTransparent = _glfwFramebufferTransparentNull,
+        .getWindowOpacity = _glfwGetWindowOpacityNull,
+        .setWindowResizable = _glfwSetWindowResizableNull,
+        .setWindowDecorated = _glfwSetWindowDecoratedNull,
+        .setWindowFloating = _glfwSetWindowFloatingNull,
+        .setWindowOpacity = _glfwSetWindowOpacityNull,
+        .setWindowMousePassthrough = _glfwSetWindowMousePassthroughNull,
+        .pollEvents = _glfwPollEventsNull,
+        .waitEvents = _glfwWaitEventsNull,
+        .waitEventsTimeout = _glfwWaitEventsTimeoutNull,
+        .postEmptyEvent = _glfwPostEmptyEventNull,
+        .getEGLPlatform = _glfwGetEGLPlatformNull,
+        .getEGLNativeDisplay = _glfwGetEGLNativeDisplayNull,
+        .getEGLNativeWindow = _glfwGetEGLNativeWindowNull,
+        .getRequiredInstanceExtensions = _glfwGetRequiredInstanceExtensionsNull,
+        .getPhysicalDevicePresentationSupport = _glfwGetPhysicalDevicePresentationSupportNull,
+        .createWindowSurface = _glfwCreateWindowSurfaceNull
+    };
+
+    *platform = null;
     return GLFW_TRUE;
 }
 
-void _glfwPlatformTerminate(void)
+int _glfwInitNull(void)
 {
-    _glfwTerminateOSMesa();
+    int scancode;
+
+    memset(_glfw.null.keycodes, -1, sizeof(_glfw.null.keycodes));
+    memset(_glfw.null.scancodes, -1, sizeof(_glfw.null.scancodes));
+
+    _glfw.null.keycodes[GLFW_NULL_SC_SPACE]         = GLFW_KEY_SPACE;
+    _glfw.null.keycodes[GLFW_NULL_SC_APOSTROPHE]    = GLFW_KEY_APOSTROPHE;
+    _glfw.null.keycodes[GLFW_NULL_SC_COMMA]         = GLFW_KEY_COMMA;
+    _glfw.null.keycodes[GLFW_NULL_SC_MINUS]         = GLFW_KEY_MINUS;
+    _glfw.null.keycodes[GLFW_NULL_SC_PERIOD]        = GLFW_KEY_PERIOD;
+    _glfw.null.keycodes[GLFW_NULL_SC_SLASH]         = GLFW_KEY_SLASH;
+    _glfw.null.keycodes[GLFW_NULL_SC_0]             = GLFW_KEY_0;
+    _glfw.null.keycodes[GLFW_NULL_SC_1]             = GLFW_KEY_1;
+    _glfw.null.keycodes[GLFW_NULL_SC_2]             = GLFW_KEY_2;
+    _glfw.null.keycodes[GLFW_NULL_SC_3]             = GLFW_KEY_3;
+    _glfw.null.keycodes[GLFW_NULL_SC_4]             = GLFW_KEY_4;
+    _glfw.null.keycodes[GLFW_NULL_SC_5]             = GLFW_KEY_5;
+    _glfw.null.keycodes[GLFW_NULL_SC_6]             = GLFW_KEY_6;
+    _glfw.null.keycodes[GLFW_NULL_SC_7]             = GLFW_KEY_7;
+    _glfw.null.keycodes[GLFW_NULL_SC_8]             = GLFW_KEY_8;
+    _glfw.null.keycodes[GLFW_NULL_SC_9]             = GLFW_KEY_9;
+    _glfw.null.keycodes[GLFW_NULL_SC_SEMICOLON]     = GLFW_KEY_SEMICOLON;
+    _glfw.null.keycodes[GLFW_NULL_SC_EQUAL]         = GLFW_KEY_EQUAL;
+    _glfw.null.keycodes[GLFW_NULL_SC_A]             = GLFW_KEY_A;
+    _glfw.null.keycodes[GLFW_NULL_SC_B]             = GLFW_KEY_B;
+    _glfw.null.keycodes[GLFW_NULL_SC_C]             = GLFW_KEY_C;
+    _glfw.null.keycodes[GLFW_NULL_SC_D]             = GLFW_KEY_D;
+    _glfw.null.keycodes[GLFW_NULL_SC_E]             = GLFW_KEY_E;
+    _glfw.null.keycodes[GLFW_NULL_SC_F]             = GLFW_KEY_F;
+    _glfw.null.keycodes[GLFW_NULL_SC_G]             = GLFW_KEY_G;
+    _glfw.null.keycodes[GLFW_NULL_SC_H]             = GLFW_KEY_H;
+    _glfw.null.keycodes[GLFW_NULL_SC_I]             = GLFW_KEY_I;
+    _glfw.null.keycodes[GLFW_NULL_SC_J]             = GLFW_KEY_J;
+    _glfw.null.keycodes[GLFW_NULL_SC_K]             = GLFW_KEY_K;
+    _glfw.null.keycodes[GLFW_NULL_SC_L]             = GLFW_KEY_L;
+    _glfw.null.keycodes[GLFW_NULL_SC_M]             = GLFW_KEY_M;
+    _glfw.null.keycodes[GLFW_NULL_SC_N]             = GLFW_KEY_N;
+    _glfw.null.keycodes[GLFW_NULL_SC_O]             = GLFW_KEY_O;
+    _glfw.null.keycodes[GLFW_NULL_SC_P]             = GLFW_KEY_P;
+    _glfw.null.keycodes[GLFW_NULL_SC_Q]             = GLFW_KEY_Q;
+    _glfw.null.keycodes[GLFW_NULL_SC_R]             = GLFW_KEY_R;
+    _glfw.null.keycodes[GLFW_NULL_SC_S]             = GLFW_KEY_S;
+    _glfw.null.keycodes[GLFW_NULL_SC_T]             = GLFW_KEY_T;
+    _glfw.null.keycodes[GLFW_NULL_SC_U]             = GLFW_KEY_U;
+    _glfw.null.keycodes[GLFW_NULL_SC_V]             = GLFW_KEY_V;
+    _glfw.null.keycodes[GLFW_NULL_SC_W]             = GLFW_KEY_W;
+    _glfw.null.keycodes[GLFW_NULL_SC_X]             = GLFW_KEY_X;
+    _glfw.null.keycodes[GLFW_NULL_SC_Y]             = GLFW_KEY_Y;
+    _glfw.null.keycodes[GLFW_NULL_SC_Z]             = GLFW_KEY_Z;
+    _glfw.null.keycodes[GLFW_NULL_SC_LEFT_BRACKET]  = GLFW_KEY_LEFT_BRACKET;
+    _glfw.null.keycodes[GLFW_NULL_SC_BACKSLASH]     = GLFW_KEY_BACKSLASH;
+    _glfw.null.keycodes[GLFW_NULL_SC_RIGHT_BRACKET] = GLFW_KEY_RIGHT_BRACKET;
+    _glfw.null.keycodes[GLFW_NULL_SC_GRAVE_ACCENT]  = GLFW_KEY_GRAVE_ACCENT;
+    _glfw.null.keycodes[GLFW_NULL_SC_WORLD_1]       = GLFW_KEY_WORLD_1;
+    _glfw.null.keycodes[GLFW_NULL_SC_WORLD_2]       = GLFW_KEY_WORLD_2;
+    _glfw.null.keycodes[GLFW_NULL_SC_ESCAPE]        = GLFW_KEY_ESCAPE;
+    _glfw.null.keycodes[GLFW_NULL_SC_ENTER]         = GLFW_KEY_ENTER;
+    _glfw.null.keycodes[GLFW_NULL_SC_TAB]           = GLFW_KEY_TAB;
+    _glfw.null.keycodes[GLFW_NULL_SC_BACKSPACE]     = GLFW_KEY_BACKSPACE;
+    _glfw.null.keycodes[GLFW_NULL_SC_INSERT]        = GLFW_KEY_INSERT;
+    _glfw.null.keycodes[GLFW_NULL_SC_DELETE]        = GLFW_KEY_DELETE;
+    _glfw.null.keycodes[GLFW_NULL_SC_RIGHT]         = GLFW_KEY_RIGHT;
+    _glfw.null.keycodes[GLFW_NULL_SC_LEFT]          = GLFW_KEY_LEFT;
+    _glfw.null.keycodes[GLFW_NULL_SC_DOWN]          = GLFW_KEY_DOWN;
+    _glfw.null.keycodes[GLFW_NULL_SC_UP]            = GLFW_KEY_UP;
+    _glfw.null.keycodes[GLFW_NULL_SC_PAGE_UP]       = GLFW_KEY_PAGE_UP;
+    _glfw.null.keycodes[GLFW_NULL_SC_PAGE_DOWN]     = GLFW_KEY_PAGE_DOWN;
+    _glfw.null.keycodes[GLFW_NULL_SC_HOME]          = GLFW_KEY_HOME;
+    _glfw.null.keycodes[GLFW_NULL_SC_END]           = GLFW_KEY_END;
+    _glfw.null.keycodes[GLFW_NULL_SC_CAPS_LOCK]     = GLFW_KEY_CAPS_LOCK;
+    _glfw.null.keycodes[GLFW_NULL_SC_SCROLL_LOCK]   = GLFW_KEY_SCROLL_LOCK;
+    _glfw.null.keycodes[GLFW_NULL_SC_NUM_LOCK]      = GLFW_KEY_NUM_LOCK;
+    _glfw.null.keycodes[GLFW_NULL_SC_PRINT_SCREEN]  = GLFW_KEY_PRINT_SCREEN;
+    _glfw.null.keycodes[GLFW_NULL_SC_PAUSE]         = GLFW_KEY_PAUSE;
+    _glfw.null.keycodes[GLFW_NULL_SC_F1]            = GLFW_KEY_F1;
+    _glfw.null.keycodes[GLFW_NULL_SC_F2]            = GLFW_KEY_F2;
+    _glfw.null.keycodes[GLFW_NULL_SC_F3]            = GLFW_KEY_F3;
+    _glfw.null.keycodes[GLFW_NULL_SC_F4]            = GLFW_KEY_F4;
+    _glfw.null.keycodes[GLFW_NULL_SC_F5]            = GLFW_KEY_F5;
+    _glfw.null.keycodes[GLFW_NULL_SC_F6]            = GLFW_KEY_F6;
+    _glfw.null.keycodes[GLFW_NULL_SC_F7]            = GLFW_KEY_F7;
+    _glfw.null.keycodes[GLFW_NULL_SC_F8]            = GLFW_KEY_F8;
+    _glfw.null.keycodes[GLFW_NULL_SC_F9]            = GLFW_KEY_F9;
+    _glfw.null.keycodes[GLFW_NULL_SC_F10]           = GLFW_KEY_F10;
+    _glfw.null.keycodes[GLFW_NULL_SC_F11]           = GLFW_KEY_F11;
+    _glfw.null.keycodes[GLFW_NULL_SC_F12]           = GLFW_KEY_F12;
+    _glfw.null.keycodes[GLFW_NULL_SC_F13]           = GLFW_KEY_F13;
+    _glfw.null.keycodes[GLFW_NULL_SC_F14]           = GLFW_KEY_F14;
+    _glfw.null.keycodes[GLFW_NULL_SC_F15]           = GLFW_KEY_F15;
+    _glfw.null.keycodes[GLFW_NULL_SC_F16]           = GLFW_KEY_F16;
+    _glfw.null.keycodes[GLFW_NULL_SC_F17]           = GLFW_KEY_F17;
+    _glfw.null.keycodes[GLFW_NULL_SC_F18]           = GLFW_KEY_F18;
+    _glfw.null.keycodes[GLFW_NULL_SC_F19]           = GLFW_KEY_F19;
+    _glfw.null.keycodes[GLFW_NULL_SC_F20]           = GLFW_KEY_F20;
+    _glfw.null.keycodes[GLFW_NULL_SC_F21]           = GLFW_KEY_F21;
+    _glfw.null.keycodes[GLFW_NULL_SC_F22]           = GLFW_KEY_F22;
+    _glfw.null.keycodes[GLFW_NULL_SC_F23]           = GLFW_KEY_F23;
+    _glfw.null.keycodes[GLFW_NULL_SC_F24]           = GLFW_KEY_F24;
+    _glfw.null.keycodes[GLFW_NULL_SC_F25]           = GLFW_KEY_F25;
+    _glfw.null.keycodes[GLFW_NULL_SC_KP_0]          = GLFW_KEY_KP_0;
+    _glfw.null.keycodes[GLFW_NULL_SC_KP_1]          = GLFW_KEY_KP_1;
+    _glfw.null.keycodes[GLFW_NULL_SC_KP_2]          = GLFW_KEY_KP_2;
+    _glfw.null.keycodes[GLFW_NULL_SC_KP_3]          = GLFW_KEY_KP_3;
+    _glfw.null.keycodes[GLFW_NULL_SC_KP_4]          = GLFW_KEY_KP_4;
+    _glfw.null.keycodes[GLFW_NULL_SC_KP_5]          = GLFW_KEY_KP_5;
+    _glfw.null.keycodes[GLFW_NULL_SC_KP_6]          = GLFW_KEY_KP_6;
+    _glfw.null.keycodes[GLFW_NULL_SC_KP_7]          = GLFW_KEY_KP_7;
+    _glfw.null.keycodes[GLFW_NULL_SC_KP_8]          = GLFW_KEY_KP_8;
+    _glfw.null.keycodes[GLFW_NULL_SC_KP_9]          = GLFW_KEY_KP_9;
+    _glfw.null.keycodes[GLFW_NULL_SC_KP_DECIMAL]    = GLFW_KEY_KP_DECIMAL;
+    _glfw.null.keycodes[GLFW_NULL_SC_KP_DIVIDE]     = GLFW_KEY_KP_DIVIDE;
+    _glfw.null.keycodes[GLFW_NULL_SC_KP_MULTIPLY]   = GLFW_KEY_KP_MULTIPLY;
+    _glfw.null.keycodes[GLFW_NULL_SC_KP_SUBTRACT]   = GLFW_KEY_KP_SUBTRACT;
+    _glfw.null.keycodes[GLFW_NULL_SC_KP_ADD]        = GLFW_KEY_KP_ADD;
+    _glfw.null.keycodes[GLFW_NULL_SC_KP_ENTER]      = GLFW_KEY_KP_ENTER;
+    _glfw.null.keycodes[GLFW_NULL_SC_KP_EQUAL]      = GLFW_KEY_KP_EQUAL;
+    _glfw.null.keycodes[GLFW_NULL_SC_LEFT_SHIFT]    = GLFW_KEY_LEFT_SHIFT;
+    _glfw.null.keycodes[GLFW_NULL_SC_LEFT_CONTROL]  = GLFW_KEY_LEFT_CONTROL;
+    _glfw.null.keycodes[GLFW_NULL_SC_LEFT_ALT]      = GLFW_KEY_LEFT_ALT;
+    _glfw.null.keycodes[GLFW_NULL_SC_LEFT_SUPER]    = GLFW_KEY_LEFT_SUPER;
+    _glfw.null.keycodes[GLFW_NULL_SC_RIGHT_SHIFT]   = GLFW_KEY_RIGHT_SHIFT;
+    _glfw.null.keycodes[GLFW_NULL_SC_RIGHT_CONTROL] = GLFW_KEY_RIGHT_CONTROL;
+    _glfw.null.keycodes[GLFW_NULL_SC_RIGHT_ALT]     = GLFW_KEY_RIGHT_ALT;
+    _glfw.null.keycodes[GLFW_NULL_SC_RIGHT_SUPER]   = GLFW_KEY_RIGHT_SUPER;
+    _glfw.null.keycodes[GLFW_NULL_SC_MENU]          = GLFW_KEY_MENU;
+
+    for (scancode = GLFW_NULL_SC_FIRST;  scancode < GLFW_NULL_SC_LAST;  scancode++)
+    {
+        if (_glfw.null.keycodes[scancode] > 0)
+            _glfw.null.scancodes[_glfw.null.keycodes[scancode]] = scancode;
+    }
+
+    _glfwPollMonitorsNull();
+    return GLFW_TRUE;
 }
 
-const char* _glfwPlatformGetVersionString(void)
+void _glfwTerminateNull(void)
 {
-    return _GLFW_VERSION_NUMBER " null OSMesa";
+    free(_glfw.null.clipboardString);
+    _glfwTerminateOSMesa();
+    _glfwTerminateEGL();
 }
 
diff --git a/src/null_joystick.c b/src/null_joystick.c
index 000faf2..ec1f6b5 100644
--- a/src/null_joystick.c
+++ b/src/null_joystick.c
@@ -1,5 +1,5 @@
 //========================================================================
-// GLFW 3.3 - www.glfw.org
+// GLFW 3.4 - www.glfw.org
 //------------------------------------------------------------------------
 // Copyright (c) 2016-2017 Camilla Löwy <elmindreda@glfw.org>
 //
@@ -23,8 +23,6 @@
 //    distribution.
 //
 //========================================================================
-// It is fine to use C99 in this file because it will not be built with VS
-//========================================================================
 
 #include "internal.h"
 
@@ -33,12 +31,26 @@
 //////                       GLFW platform API                      //////
 //////////////////////////////////////////////////////////////////////////
 
-int _glfwPlatformPollJoystick(_GLFWjoystick* js, int mode)
+GLFWbool _glfwInitJoysticksNull(void)
+{
+    return GLFW_TRUE;
+}
+
+void _glfwTerminateJoysticksNull(void)
+{
+}
+
+GLFWbool _glfwPollJoystickNull(_GLFWjoystick* js, int mode)
 {
     return GLFW_FALSE;
 }
 
-void _glfwPlatformUpdateGamepadGUID(char* guid)
+const char* _glfwGetMappingNameNull(void)
+{
+    return "";
+}
+
+void _glfwUpdateGamepadGUIDNull(char* guid)
 {
 }
 
diff --git a/src/null_joystick.h b/src/null_joystick.h
index 9307ae8..a2199c5 100644
--- a/src/null_joystick.h
+++ b/src/null_joystick.h
@@ -1,5 +1,5 @@
 //========================================================================
-// GLFW 3.3 - www.glfw.org
+// GLFW 3.4 - www.glfw.org
 //------------------------------------------------------------------------
 // Copyright (c) 2006-2017 Camilla Löwy <elmindreda@glfw.org>
 //
@@ -24,8 +24,9 @@
 //
 //========================================================================
 
-#define _GLFW_PLATFORM_JOYSTICK_STATE         struct { int dummyJoystick; }
-#define _GLFW_PLATFORM_LIBRARY_JOYSTICK_STATE struct { int dummyLibraryJoystick; }
-
-#define _GLFW_PLATFORM_MAPPING_NAME ""
+GLFWbool _glfwInitJoysticksNull(void);
+void _glfwTerminateJoysticksNull(void);
+GLFWbool _glfwPollJoystickNull(_GLFWjoystick* js, int mode);
+const char* _glfwGetMappingNameNull(void);
+void _glfwUpdateGamepadGUIDNull(char* guid);
 
diff --git a/src/null_monitor.c b/src/null_monitor.c
index 4514dae..d818f45 100644
--- a/src/null_monitor.c
+++ b/src/null_monitor.c
@@ -1,5 +1,5 @@
 //========================================================================
-// GLFW 3.3 - www.glfw.org
+// GLFW 3.4 - www.glfw.org
 //------------------------------------------------------------------------
 // Copyright (c) 2016 Google Inc.
 // Copyright (c) 2016-2019 Camilla Löwy <elmindreda@glfw.org>
@@ -24,26 +24,60 @@
 //    distribution.
 //
 //========================================================================
-// It is fine to use C99 in this file because it will not be built with VS
-//========================================================================
 
 #include "internal.h"
 
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+
+// The the sole (fake) video mode of our (sole) fake monitor
+//
+static GLFWvidmode getVideoMode(void)
+{
+    GLFWvidmode mode;
+    mode.width = 1920;
+    mode.height = 1080;
+    mode.redBits = 8;
+    mode.greenBits = 8;
+    mode.blueBits = 8;
+    mode.refreshRate = 60;
+    return mode;
+}
+
+//////////////////////////////////////////////////////////////////////////
+//////                       GLFW internal API                      //////
+//////////////////////////////////////////////////////////////////////////
+
+void _glfwPollMonitorsNull(void)
+{
+    const float dpi = 141.f;
+    const GLFWvidmode mode = getVideoMode();
+    _GLFWmonitor* monitor = _glfwAllocMonitor("Null SuperNoop 0",
+                                              (int) (mode.width * 25.4f / dpi),
+                                              (int) (mode.height * 25.4f / dpi));
+    _glfwInputMonitor(monitor, GLFW_CONNECTED, _GLFW_INSERT_FIRST);
+}
 
 //////////////////////////////////////////////////////////////////////////
 //////                       GLFW platform API                      //////
 //////////////////////////////////////////////////////////////////////////
 
-void _glfwPlatformFreeMonitor(_GLFWmonitor* monitor)
+void _glfwFreeMonitorNull(_GLFWmonitor* monitor)
 {
+    _glfwFreeGammaArrays(&monitor->null.ramp);
 }
 
-void _glfwPlatformGetMonitorPos(_GLFWmonitor* monitor, int* xpos, int* ypos)
+void _glfwGetMonitorPosNull(_GLFWmonitor* monitor, int* xpos, int* ypos)
 {
+    if (xpos)
+        *xpos = 0;
+    if (ypos)
+        *ypos = 0;
 }
 
-void _glfwPlatformGetMonitorContentScale(_GLFWmonitor* monitor,
-                                         float* xscale, float* yscale)
+void _glfwGetMonitorContentScaleNull(_GLFWmonitor* monitor,
+                                     float* xscale, float* yscale)
 {
     if (xscale)
         *xscale = 1.f;
@@ -51,27 +85,76 @@
         *yscale = 1.f;
 }
 
-void _glfwPlatformGetMonitorWorkarea(_GLFWmonitor* monitor,
-                                     int* xpos, int* ypos,
-                                     int* width, int* height)
+void _glfwGetMonitorWorkareaNull(_GLFWmonitor* monitor,
+                                 int* xpos, int* ypos,
+                                 int* width, int* height)
 {
+    const GLFWvidmode mode = getVideoMode();
+
+    if (xpos)
+        *xpos = 0;
+    if (ypos)
+        *ypos = 10;
+    if (width)
+        *width = mode.width;
+    if (height)
+        *height = mode.height - 10;
 }
 
-GLFWvidmode* _glfwPlatformGetVideoModes(_GLFWmonitor* monitor, int* found)
+GLFWvidmode* _glfwGetVideoModesNull(_GLFWmonitor* monitor, int* found)
 {
-    return NULL;
+    GLFWvidmode* mode = _glfw_calloc(1, sizeof(GLFWvidmode));
+    *mode = getVideoMode();
+    *found = 1;
+    return mode;
 }
 
-void _glfwPlatformGetVideoMode(_GLFWmonitor* monitor, GLFWvidmode* mode)
+GLFWbool _glfwGetVideoModeNull(_GLFWmonitor* monitor, GLFWvidmode* mode)
 {
+    *mode = getVideoMode();
+    return GLFW_TRUE;
 }
 
-GLFWbool _glfwPlatformGetGammaRamp(_GLFWmonitor* monitor, GLFWgammaramp* ramp)
+GLFWbool _glfwGetGammaRampNull(_GLFWmonitor* monitor, GLFWgammaramp* ramp)
 {
-    return GLFW_FALSE;
+    if (!monitor->null.ramp.size)
+    {
+        unsigned int i;
+
+        _glfwAllocGammaArrays(&monitor->null.ramp, 256);
+
+        for (i = 0;  i < monitor->null.ramp.size;  i++)
+        {
+            const float gamma = 2.2f;
+            float value;
+            value = i / (float) (monitor->null.ramp.size - 1);
+            value = powf(value, 1.f / gamma) * 65535.f + 0.5f;
+            value = fminf(value, 65535.f);
+
+            monitor->null.ramp.red[i]   = (unsigned short) value;
+            monitor->null.ramp.green[i] = (unsigned short) value;
+            monitor->null.ramp.blue[i]  = (unsigned short) value;
+        }
+    }
+
+    _glfwAllocGammaArrays(ramp, monitor->null.ramp.size);
+    memcpy(ramp->red,   monitor->null.ramp.red,   sizeof(short) * ramp->size);
+    memcpy(ramp->green, monitor->null.ramp.green, sizeof(short) * ramp->size);
+    memcpy(ramp->blue,  monitor->null.ramp.blue,  sizeof(short) * ramp->size);
+    return GLFW_TRUE;
 }
 
-void _glfwPlatformSetGammaRamp(_GLFWmonitor* monitor, const GLFWgammaramp* ramp)
+void _glfwSetGammaRampNull(_GLFWmonitor* monitor, const GLFWgammaramp* ramp)
 {
+    if (monitor->null.ramp.size != ramp->size)
+    {
+        _glfwInputError(GLFW_PLATFORM_ERROR,
+                        "Null: Gamma ramp size must match current ramp size");
+        return;
+    }
+
+    memcpy(monitor->null.ramp.red,   ramp->red,   sizeof(short) * ramp->size);
+    memcpy(monitor->null.ramp.green, ramp->green, sizeof(short) * ramp->size);
+    memcpy(monitor->null.ramp.blue,  ramp->blue,  sizeof(short) * ramp->size);
 }
 
diff --git a/src/null_platform.h b/src/null_platform.h
index 708975d..4843a76 100644
--- a/src/null_platform.h
+++ b/src/null_platform.h
@@ -1,5 +1,5 @@
 //========================================================================
-// GLFW 3.3 - www.glfw.org
+// GLFW 3.4 - www.glfw.org
 //------------------------------------------------------------------------
 // Copyright (c) 2016 Google Inc.
 // Copyright (c) 2016-2017 Camilla Löwy <elmindreda@glfw.org>
@@ -25,38 +25,247 @@
 //
 //========================================================================
 
-#include <dlfcn.h>
+#define GLFW_NULL_WINDOW_STATE          _GLFWwindowNull null;
+#define GLFW_NULL_LIBRARY_WINDOW_STATE  _GLFWlibraryNull null;
+#define GLFW_NULL_MONITOR_STATE         _GLFWmonitorNull null;
 
-#define _GLFW_PLATFORM_WINDOW_STATE _GLFWwindowNull null
+#define GLFW_NULL_CONTEXT_STATE
+#define GLFW_NULL_CURSOR_STATE
+#define GLFW_NULL_LIBRARY_CONTEXT_STATE
 
-#define _GLFW_PLATFORM_CONTEXT_STATE         struct { int dummyContext; }
-#define _GLFW_PLATFORM_MONITOR_STATE         struct { int dummyMonitor; }
-#define _GLFW_PLATFORM_CURSOR_STATE          struct { int dummyCursor; }
-#define _GLFW_PLATFORM_LIBRARY_WINDOW_STATE  struct { int dummyLibraryWindow; }
-#define _GLFW_PLATFORM_LIBRARY_CONTEXT_STATE struct { int dummyLibraryContext; }
-#define _GLFW_EGL_CONTEXT_STATE              struct { int dummyEGLContext; }
-#define _GLFW_EGL_LIBRARY_CONTEXT_STATE      struct { int dummyEGLLibraryContext; }
-
-#include "osmesa_context.h"
-#include "posix_time.h"
-#include "posix_thread.h"
-#include "null_joystick.h"
-
-#if defined(_GLFW_WIN32)
- #define _glfw_dlopen(name) LoadLibraryA(name)
- #define _glfw_dlclose(handle) FreeLibrary((HMODULE) handle)
- #define _glfw_dlsym(handle, name) GetProcAddress((HMODULE) handle, name)
-#else
- #define _glfw_dlopen(name) dlopen(name, RTLD_LAZY | RTLD_LOCAL)
- #define _glfw_dlclose(handle) dlclose(handle)
- #define _glfw_dlsym(handle, name) dlsym(handle, name)
-#endif
+#define GLFW_NULL_SC_FIRST          GLFW_NULL_SC_SPACE
+#define GLFW_NULL_SC_SPACE          1
+#define GLFW_NULL_SC_APOSTROPHE     2
+#define GLFW_NULL_SC_COMMA          3
+#define GLFW_NULL_SC_MINUS          4
+#define GLFW_NULL_SC_PERIOD         5
+#define GLFW_NULL_SC_SLASH          6
+#define GLFW_NULL_SC_0              7
+#define GLFW_NULL_SC_1              8
+#define GLFW_NULL_SC_2              9
+#define GLFW_NULL_SC_3              10
+#define GLFW_NULL_SC_4              11
+#define GLFW_NULL_SC_5              12
+#define GLFW_NULL_SC_6              13
+#define GLFW_NULL_SC_7              14
+#define GLFW_NULL_SC_8              15
+#define GLFW_NULL_SC_9              16
+#define GLFW_NULL_SC_SEMICOLON      17
+#define GLFW_NULL_SC_EQUAL          18
+#define GLFW_NULL_SC_LEFT_BRACKET   19
+#define GLFW_NULL_SC_BACKSLASH      20
+#define GLFW_NULL_SC_RIGHT_BRACKET  21
+#define GLFW_NULL_SC_GRAVE_ACCENT   22
+#define GLFW_NULL_SC_WORLD_1        23
+#define GLFW_NULL_SC_WORLD_2        24
+#define GLFW_NULL_SC_ESCAPE         25
+#define GLFW_NULL_SC_ENTER          26
+#define GLFW_NULL_SC_TAB            27
+#define GLFW_NULL_SC_BACKSPACE      28
+#define GLFW_NULL_SC_INSERT         29
+#define GLFW_NULL_SC_DELETE         30
+#define GLFW_NULL_SC_RIGHT          31
+#define GLFW_NULL_SC_LEFT           32
+#define GLFW_NULL_SC_DOWN           33
+#define GLFW_NULL_SC_UP             34
+#define GLFW_NULL_SC_PAGE_UP        35
+#define GLFW_NULL_SC_PAGE_DOWN      36
+#define GLFW_NULL_SC_HOME           37
+#define GLFW_NULL_SC_END            38
+#define GLFW_NULL_SC_CAPS_LOCK      39
+#define GLFW_NULL_SC_SCROLL_LOCK    40
+#define GLFW_NULL_SC_NUM_LOCK       41
+#define GLFW_NULL_SC_PRINT_SCREEN   42
+#define GLFW_NULL_SC_PAUSE          43
+#define GLFW_NULL_SC_A              44
+#define GLFW_NULL_SC_B              45
+#define GLFW_NULL_SC_C              46
+#define GLFW_NULL_SC_D              47
+#define GLFW_NULL_SC_E              48
+#define GLFW_NULL_SC_F              49
+#define GLFW_NULL_SC_G              50
+#define GLFW_NULL_SC_H              51
+#define GLFW_NULL_SC_I              52
+#define GLFW_NULL_SC_J              53
+#define GLFW_NULL_SC_K              54
+#define GLFW_NULL_SC_L              55
+#define GLFW_NULL_SC_M              56
+#define GLFW_NULL_SC_N              57
+#define GLFW_NULL_SC_O              58
+#define GLFW_NULL_SC_P              59
+#define GLFW_NULL_SC_Q              60
+#define GLFW_NULL_SC_R              61
+#define GLFW_NULL_SC_S              62
+#define GLFW_NULL_SC_T              63
+#define GLFW_NULL_SC_U              64
+#define GLFW_NULL_SC_V              65
+#define GLFW_NULL_SC_W              66
+#define GLFW_NULL_SC_X              67
+#define GLFW_NULL_SC_Y              68
+#define GLFW_NULL_SC_Z              69
+#define GLFW_NULL_SC_F1             70
+#define GLFW_NULL_SC_F2             71
+#define GLFW_NULL_SC_F3             72
+#define GLFW_NULL_SC_F4             73
+#define GLFW_NULL_SC_F5             74
+#define GLFW_NULL_SC_F6             75
+#define GLFW_NULL_SC_F7             76
+#define GLFW_NULL_SC_F8             77
+#define GLFW_NULL_SC_F9             78
+#define GLFW_NULL_SC_F10            79
+#define GLFW_NULL_SC_F11            80
+#define GLFW_NULL_SC_F12            81
+#define GLFW_NULL_SC_F13            82
+#define GLFW_NULL_SC_F14            83
+#define GLFW_NULL_SC_F15            84
+#define GLFW_NULL_SC_F16            85
+#define GLFW_NULL_SC_F17            86
+#define GLFW_NULL_SC_F18            87
+#define GLFW_NULL_SC_F19            88
+#define GLFW_NULL_SC_F20            89
+#define GLFW_NULL_SC_F21            90
+#define GLFW_NULL_SC_F22            91
+#define GLFW_NULL_SC_F23            92
+#define GLFW_NULL_SC_F24            93
+#define GLFW_NULL_SC_F25            94
+#define GLFW_NULL_SC_KP_0           95
+#define GLFW_NULL_SC_KP_1           96
+#define GLFW_NULL_SC_KP_2           97
+#define GLFW_NULL_SC_KP_3           98
+#define GLFW_NULL_SC_KP_4           99
+#define GLFW_NULL_SC_KP_5           100
+#define GLFW_NULL_SC_KP_6           101
+#define GLFW_NULL_SC_KP_7           102
+#define GLFW_NULL_SC_KP_8           103
+#define GLFW_NULL_SC_KP_9           104
+#define GLFW_NULL_SC_KP_DECIMAL     105
+#define GLFW_NULL_SC_KP_DIVIDE      106
+#define GLFW_NULL_SC_KP_MULTIPLY    107
+#define GLFW_NULL_SC_KP_SUBTRACT    108
+#define GLFW_NULL_SC_KP_ADD         109
+#define GLFW_NULL_SC_KP_ENTER       110
+#define GLFW_NULL_SC_KP_EQUAL       111
+#define GLFW_NULL_SC_LEFT_SHIFT     112
+#define GLFW_NULL_SC_LEFT_CONTROL   113
+#define GLFW_NULL_SC_LEFT_ALT       114
+#define GLFW_NULL_SC_LEFT_SUPER     115
+#define GLFW_NULL_SC_RIGHT_SHIFT    116
+#define GLFW_NULL_SC_RIGHT_CONTROL  117
+#define GLFW_NULL_SC_RIGHT_ALT      118
+#define GLFW_NULL_SC_RIGHT_SUPER    119
+#define GLFW_NULL_SC_MENU           120
+#define GLFW_NULL_SC_LAST           GLFW_NULL_SC_MENU
 
 // Null-specific per-window data
 //
 typedef struct _GLFWwindowNull
 {
-    int width;
-    int height;
+    int             xpos;
+    int             ypos;
+    int             width;
+    int             height;
+    GLFWbool        visible;
+    GLFWbool        iconified;
+    GLFWbool        maximized;
+    GLFWbool        resizable;
+    GLFWbool        decorated;
+    GLFWbool        floating;
+    GLFWbool        transparent;
+    float           opacity;
 } _GLFWwindowNull;
 
+// Null-specific per-monitor data
+//
+typedef struct _GLFWmonitorNull
+{
+    GLFWgammaramp   ramp;
+} _GLFWmonitorNull;
+
+// Null-specific global data
+//
+typedef struct _GLFWlibraryNull
+{
+    int             xcursor;
+    int             ycursor;
+    char*           clipboardString;
+    _GLFWwindow*    focusedWindow;
+    uint16_t        keycodes[GLFW_NULL_SC_LAST + 1];
+    uint8_t         scancodes[GLFW_KEY_LAST + 1];
+} _GLFWlibraryNull;
+
+void _glfwPollMonitorsNull(void);
+
+GLFWbool _glfwConnectNull(int platformID, _GLFWplatform* platform);
+int _glfwInitNull(void);
+void _glfwTerminateNull(void);
+
+void _glfwFreeMonitorNull(_GLFWmonitor* monitor);
+void _glfwGetMonitorPosNull(_GLFWmonitor* monitor, int* xpos, int* ypos);
+void _glfwGetMonitorContentScaleNull(_GLFWmonitor* monitor, float* xscale, float* yscale);
+void _glfwGetMonitorWorkareaNull(_GLFWmonitor* monitor, int* xpos, int* ypos, int* width, int* height);
+GLFWvidmode* _glfwGetVideoModesNull(_GLFWmonitor* monitor, int* found);
+GLFWbool _glfwGetVideoModeNull(_GLFWmonitor* monitor, GLFWvidmode* mode);
+GLFWbool _glfwGetGammaRampNull(_GLFWmonitor* monitor, GLFWgammaramp* ramp);
+void _glfwSetGammaRampNull(_GLFWmonitor* monitor, const GLFWgammaramp* ramp);
+
+GLFWbool _glfwCreateWindowNull(_GLFWwindow* window, const _GLFWwndconfig* wndconfig, const _GLFWctxconfig* ctxconfig, const _GLFWfbconfig* fbconfig);
+void _glfwDestroyWindowNull(_GLFWwindow* window);
+void _glfwSetWindowTitleNull(_GLFWwindow* window, const char* title);
+void _glfwSetWindowIconNull(_GLFWwindow* window, int count, const GLFWimage* images);
+void _glfwSetWindowMonitorNull(_GLFWwindow* window, _GLFWmonitor* monitor, int xpos, int ypos, int width, int height, int refreshRate);
+void _glfwGetWindowPosNull(_GLFWwindow* window, int* xpos, int* ypos);
+void _glfwSetWindowPosNull(_GLFWwindow* window, int xpos, int ypos);
+void _glfwGetWindowSizeNull(_GLFWwindow* window, int* width, int* height);
+void _glfwSetWindowSizeNull(_GLFWwindow* window, int width, int height);
+void _glfwSetWindowSizeLimitsNull(_GLFWwindow* window, int minwidth, int minheight, int maxwidth, int maxheight);
+void _glfwSetWindowAspectRatioNull(_GLFWwindow* window, int n, int d);
+void _glfwGetFramebufferSizeNull(_GLFWwindow* window, int* width, int* height);
+void _glfwGetWindowFrameSizeNull(_GLFWwindow* window, int* left, int* top, int* right, int* bottom);
+void _glfwGetWindowContentScaleNull(_GLFWwindow* window, float* xscale, float* yscale);
+void _glfwIconifyWindowNull(_GLFWwindow* window);
+void _glfwRestoreWindowNull(_GLFWwindow* window);
+void _glfwMaximizeWindowNull(_GLFWwindow* window);
+GLFWbool _glfwWindowMaximizedNull(_GLFWwindow* window);
+GLFWbool _glfwWindowHoveredNull(_GLFWwindow* window);
+GLFWbool _glfwFramebufferTransparentNull(_GLFWwindow* window);
+void _glfwSetWindowResizableNull(_GLFWwindow* window, GLFWbool enabled);
+void _glfwSetWindowDecoratedNull(_GLFWwindow* window, GLFWbool enabled);
+void _glfwSetWindowFloatingNull(_GLFWwindow* window, GLFWbool enabled);
+void _glfwSetWindowMousePassthroughNull(_GLFWwindow* window, GLFWbool enabled);
+float _glfwGetWindowOpacityNull(_GLFWwindow* window);
+void _glfwSetWindowOpacityNull(_GLFWwindow* window, float opacity);
+void _glfwSetRawMouseMotionNull(_GLFWwindow *window, GLFWbool enabled);
+GLFWbool _glfwRawMouseMotionSupportedNull(void);
+void _glfwShowWindowNull(_GLFWwindow* window);
+void _glfwRequestWindowAttentionNull(_GLFWwindow* window);
+void _glfwHideWindowNull(_GLFWwindow* window);
+void _glfwFocusWindowNull(_GLFWwindow* window);
+GLFWbool _glfwWindowFocusedNull(_GLFWwindow* window);
+GLFWbool _glfwWindowIconifiedNull(_GLFWwindow* window);
+GLFWbool _glfwWindowVisibleNull(_GLFWwindow* window);
+void _glfwPollEventsNull(void);
+void _glfwWaitEventsNull(void);
+void _glfwWaitEventsTimeoutNull(double timeout);
+void _glfwPostEmptyEventNull(void);
+void _glfwGetCursorPosNull(_GLFWwindow* window, double* xpos, double* ypos);
+void _glfwSetCursorPosNull(_GLFWwindow* window, double x, double y);
+void _glfwSetCursorModeNull(_GLFWwindow* window, int mode);
+GLFWbool _glfwCreateCursorNull(_GLFWcursor* cursor, const GLFWimage* image, int xhot, int yhot);
+GLFWbool _glfwCreateStandardCursorNull(_GLFWcursor* cursor, int shape);
+void _glfwDestroyCursorNull(_GLFWcursor* cursor);
+void _glfwSetCursorNull(_GLFWwindow* window, _GLFWcursor* cursor);
+void _glfwSetClipboardStringNull(const char* string);
+const char* _glfwGetClipboardStringNull(void);
+const char* _glfwGetScancodeNameNull(int scancode);
+int _glfwGetKeyScancodeNull(int key);
+
+EGLenum _glfwGetEGLPlatformNull(EGLint** attribs);
+EGLNativeDisplayType _glfwGetEGLNativeDisplayNull(void);
+EGLNativeWindowType _glfwGetEGLNativeWindowNull(_GLFWwindow* window);
+
+void _glfwGetRequiredInstanceExtensionsNull(char** extensions);
+GLFWbool _glfwGetPhysicalDevicePresentationSupportNull(VkInstance instance, VkPhysicalDevice device, uint32_t queuefamily);
+VkResult _glfwCreateWindowSurfaceNull(VkInstance instance, _GLFWwindow* window, const VkAllocationCallbacks* allocator, VkSurfaceKHR* surface);
+
+void _glfwPollMonitorsNull(void);
+
diff --git a/src/null_window.c b/src/null_window.c
index e61c2bd..1db0811 100644
--- a/src/null_window.c
+++ b/src/null_window.c
@@ -1,5 +1,5 @@
 //========================================================================
-// GLFW 3.3 - www.glfw.org
+// GLFW 3.4 - www.glfw.org
 //------------------------------------------------------------------------
 // Copyright (c) 2016 Google Inc.
 // Copyright (c) 2016-2019 Camilla Löwy <elmindreda@glfw.org>
@@ -24,17 +24,83 @@
 //    distribution.
 //
 //========================================================================
-// It is fine to use C99 in this file because it will not be built with VS
-//========================================================================
 
 #include "internal.h"
 
+#include <stdlib.h>
+
+static void applySizeLimits(_GLFWwindow* window, int* width, int* height)
+{
+    if (window->numer != GLFW_DONT_CARE && window->denom != GLFW_DONT_CARE)
+    {
+        const float ratio = (float) window->numer / (float) window->denom;
+        *height = (int) (*width / ratio);
+    }
+
+    if (window->minwidth != GLFW_DONT_CARE)
+        *width = _glfw_max(*width, window->minwidth);
+    else if (window->maxwidth != GLFW_DONT_CARE)
+        *width = _glfw_min(*width, window->maxwidth);
+
+    if (window->minheight != GLFW_DONT_CARE)
+        *height = _glfw_min(*height, window->minheight);
+    else if (window->maxheight != GLFW_DONT_CARE)
+        *height = _glfw_max(*height, window->maxheight);
+}
+
+static void fitToMonitor(_GLFWwindow* window)
+{
+    GLFWvidmode mode;
+    _glfwGetVideoModeNull(window->monitor, &mode);
+    _glfwGetMonitorPosNull(window->monitor,
+                           &window->null.xpos,
+                           &window->null.ypos);
+    window->null.width = mode.width;
+    window->null.height = mode.height;
+}
+
+static void acquireMonitor(_GLFWwindow* window)
+{
+    _glfwInputMonitorWindow(window->monitor, window);
+}
+
+static void releaseMonitor(_GLFWwindow* window)
+{
+    if (window->monitor->window != window)
+        return;
+
+    _glfwInputMonitorWindow(window->monitor, NULL);
+}
 
 static int createNativeWindow(_GLFWwindow* window,
-                              const _GLFWwndconfig* wndconfig)
+                              const _GLFWwndconfig* wndconfig,
+                              const _GLFWfbconfig* fbconfig)
 {
-    window->null.width = wndconfig->width;
-    window->null.height = wndconfig->height;
+    if (window->monitor)
+        fitToMonitor(window);
+    else
+    {
+        if (wndconfig->xpos == GLFW_ANY_POSITION && wndconfig->ypos == GLFW_ANY_POSITION)
+        {
+            window->null.xpos = 17;
+            window->null.ypos = 17;
+        }
+        else
+        {
+            window->null.xpos = wndconfig->xpos;
+            window->null.ypos = wndconfig->ypos;
+        }
+
+        window->null.width = wndconfig->width;
+        window->null.height = wndconfig->height;
+    }
+
+    window->null.visible = wndconfig->visible;
+    window->null.decorated = wndconfig->decorated;
+    window->null.maximized = wndconfig->maximized;
+    window->null.floating = wndconfig->floating;
+    window->null.transparent = fbconfig->transparent;
+    window->null.opacity = 1.f;
 
     return GLFW_TRUE;
 }
@@ -44,12 +110,12 @@
 //////                       GLFW platform API                      //////
 //////////////////////////////////////////////////////////////////////////
 
-int _glfwPlatformCreateWindow(_GLFWwindow* window,
-                              const _GLFWwndconfig* wndconfig,
-                              const _GLFWctxconfig* ctxconfig,
-                              const _GLFWfbconfig* fbconfig)
+GLFWbool _glfwCreateWindowNull(_GLFWwindow* window,
+                               const _GLFWwndconfig* wndconfig,
+                               const _GLFWctxconfig* ctxconfig,
+                               const _GLFWfbconfig* fbconfig)
 {
-    if (!createNativeWindow(window, wndconfig))
+    if (!createNativeWindow(window, wndconfig, fbconfig))
         return GLFW_FALSE;
 
     if (ctxconfig->client != GLFW_NO_API)
@@ -62,51 +128,120 @@
             if (!_glfwCreateContextOSMesa(window, ctxconfig, fbconfig))
                 return GLFW_FALSE;
         }
-        else
+        else if (ctxconfig->source == GLFW_EGL_CONTEXT_API)
         {
-            _glfwInputError(GLFW_API_UNAVAILABLE, "Null: EGL not available");
-            return GLFW_FALSE;
+            if (!_glfwInitEGL())
+                return GLFW_FALSE;
+            if (!_glfwCreateContextEGL(window, ctxconfig, fbconfig))
+                return GLFW_FALSE;
         }
 
         if (!_glfwRefreshContextAttribs(window, ctxconfig))
             return GLFW_FALSE;
     }
 
+    if (wndconfig->mousePassthrough)
+        _glfwSetWindowMousePassthroughNull(window, GLFW_TRUE);
+
+    if (window->monitor)
+    {
+        _glfwShowWindowNull(window);
+        _glfwFocusWindowNull(window);
+        acquireMonitor(window);
+
+        if (wndconfig->centerCursor)
+            _glfwCenterCursorInContentArea(window);
+    }
+    else
+    {
+        if (wndconfig->visible)
+        {
+            _glfwShowWindowNull(window);
+            if (wndconfig->focused)
+                _glfwFocusWindowNull(window);
+        }
+    }
+
     return GLFW_TRUE;
 }
 
-void _glfwPlatformDestroyWindow(_GLFWwindow* window)
+void _glfwDestroyWindowNull(_GLFWwindow* window)
 {
+    if (window->monitor)
+        releaseMonitor(window);
+
+    if (_glfw.null.focusedWindow == window)
+        _glfw.null.focusedWindow = NULL;
+
     if (window->context.destroy)
         window->context.destroy(window);
 }
 
-void _glfwPlatformSetWindowTitle(_GLFWwindow* window, const char* title)
+void _glfwSetWindowTitleNull(_GLFWwindow* window, const char* title)
 {
 }
 
-void _glfwPlatformSetWindowIcon(_GLFWwindow* window, int count,
-                                const GLFWimage* images)
+void _glfwSetWindowIconNull(_GLFWwindow* window, int count, const GLFWimage* images)
 {
 }
 
-void _glfwPlatformSetWindowMonitor(_GLFWwindow* window,
-                                   _GLFWmonitor* monitor,
-                                   int xpos, int ypos,
-                                   int width, int height,
-                                   int refreshRate)
+void _glfwSetWindowMonitorNull(_GLFWwindow* window,
+                               _GLFWmonitor* monitor,
+                               int xpos, int ypos,
+                               int width, int height,
+                               int refreshRate)
 {
+    if (window->monitor == monitor)
+    {
+        if (!monitor)
+        {
+            _glfwSetWindowPosNull(window, xpos, ypos);
+            _glfwSetWindowSizeNull(window, width, height);
+        }
+
+        return;
+    }
+
+    if (window->monitor)
+        releaseMonitor(window);
+
+    _glfwInputWindowMonitor(window, monitor);
+
+    if (window->monitor)
+    {
+        window->null.visible = GLFW_TRUE;
+        acquireMonitor(window);
+        fitToMonitor(window);
+    }
+    else
+    {
+        _glfwSetWindowPosNull(window, xpos, ypos);
+        _glfwSetWindowSizeNull(window, width, height);
+    }
 }
 
-void _glfwPlatformGetWindowPos(_GLFWwindow* window, int* xpos, int* ypos)
+void _glfwGetWindowPosNull(_GLFWwindow* window, int* xpos, int* ypos)
 {
+    if (xpos)
+        *xpos = window->null.xpos;
+    if (ypos)
+        *ypos = window->null.ypos;
 }
 
-void _glfwPlatformSetWindowPos(_GLFWwindow* window, int xpos, int ypos)
+void _glfwSetWindowPosNull(_GLFWwindow* window, int xpos, int ypos)
 {
+    if (window->monitor)
+        return;
+
+    if (window->null.xpos != xpos || window->null.ypos != ypos)
+    {
+        window->null.xpos = xpos;
+        window->null.ypos = ypos;
+        _glfwInputWindowPos(window, xpos, ypos);
+    }
 }
 
-void _glfwPlatformGetWindowSize(_GLFWwindow* window, int* width, int* height)
+void _glfwGetWindowSizeNull(_GLFWwindow* window, int* width, int* height)
 {
     if (width)
         *width = window->null.width;
@@ -114,23 +249,40 @@
         *height = window->null.height;
 }
 
-void _glfwPlatformSetWindowSize(_GLFWwindow* window, int width, int height)
+void _glfwSetWindowSizeNull(_GLFWwindow* window, int width, int height)
 {
-    window->null.width = width;
-    window->null.height = height;
+    if (window->monitor)
+        return;
+
+    if (window->null.width != width || window->null.height != height)
+    {
+        window->null.width = width;
+        window->null.height = height;
+        _glfwInputFramebufferSize(window, width, height);
+        _glfwInputWindowDamage(window);
+        _glfwInputWindowSize(window, width, height);
+    }
 }
 
-void _glfwPlatformSetWindowSizeLimits(_GLFWwindow* window,
-                                      int minwidth, int minheight,
-                                      int maxwidth, int maxheight)
+void _glfwSetWindowSizeLimitsNull(_GLFWwindow* window,
+                                  int minwidth, int minheight,
+                                  int maxwidth, int maxheight)
 {
+    int width = window->null.width;
+    int height = window->null.height;
+    applySizeLimits(window, &width, &height);
+    _glfwSetWindowSizeNull(window, width, height);
 }
 
-void _glfwPlatformSetWindowAspectRatio(_GLFWwindow* window, int n, int d)
+void _glfwSetWindowAspectRatioNull(_GLFWwindow* window, int n, int d)
 {
+    int width = window->null.width;
+    int height = window->null.height;
+    applySizeLimits(window, &width, &height);
+    _glfwSetWindowSizeNull(window, width, height);
 }
 
-void _glfwPlatformGetFramebufferSize(_GLFWwindow* window, int* width, int* height)
+void _glfwGetFramebufferSizeNull(_GLFWwindow* window, int* width, int* height)
 {
     if (width)
         *width = window->null.width;
@@ -138,14 +290,35 @@
         *height = window->null.height;
 }
 
-void _glfwPlatformGetWindowFrameSize(_GLFWwindow* window,
-                                     int* left, int* top,
-                                     int* right, int* bottom)
+void _glfwGetWindowFrameSizeNull(_GLFWwindow* window,
+                                 int* left, int* top,
+                                 int* right, int* bottom)
 {
+    if (window->null.decorated && !window->monitor)
+    {
+        if (left)
+            *left = 1;
+        if (top)
+            *top = 10;
+        if (right)
+            *right = 1;
+        if (bottom)
+            *bottom = 1;
+    }
+    else
+    {
+        if (left)
+            *left = 0;
+        if (top)
+            *top = 0;
+        if (right)
+            *right = 0;
+        if (bottom)
+            *bottom = 0;
+    }
 }
 
-void _glfwPlatformGetWindowContentScale(_GLFWwindow* window,
-                                        float* xscale, float* yscale)
+void _glfwGetWindowContentScaleNull(_GLFWwindow* window, float* xscale, float* yscale)
 {
     if (xscale)
         *xscale = 1.f;
@@ -153,183 +326,394 @@
         *yscale = 1.f;
 }
 
-void _glfwPlatformIconifyWindow(_GLFWwindow* window)
+void _glfwIconifyWindowNull(_GLFWwindow* window)
+{
+    if (_glfw.null.focusedWindow == window)
+    {
+        _glfw.null.focusedWindow = NULL;
+        _glfwInputWindowFocus(window, GLFW_FALSE);
+    }
+
+    if (!window->null.iconified)
+    {
+        window->null.iconified = GLFW_TRUE;
+        _glfwInputWindowIconify(window, GLFW_TRUE);
+
+        if (window->monitor)
+            releaseMonitor(window);
+    }
+}
+
+void _glfwRestoreWindowNull(_GLFWwindow* window)
+{
+    if (window->null.iconified)
+    {
+        window->null.iconified = GLFW_FALSE;
+        _glfwInputWindowIconify(window, GLFW_FALSE);
+
+        if (window->monitor)
+            acquireMonitor(window);
+    }
+    else if (window->null.maximized)
+    {
+        window->null.maximized = GLFW_FALSE;
+        _glfwInputWindowMaximize(window, GLFW_FALSE);
+    }
+}
+
+void _glfwMaximizeWindowNull(_GLFWwindow* window)
+{
+    if (!window->null.maximized)
+    {
+        window->null.maximized = GLFW_TRUE;
+        _glfwInputWindowMaximize(window, GLFW_TRUE);
+    }
+}
+
+GLFWbool _glfwWindowMaximizedNull(_GLFWwindow* window)
+{
+    return window->null.maximized;
+}
+
+GLFWbool _glfwWindowHoveredNull(_GLFWwindow* window)
+{
+    return _glfw.null.xcursor >= window->null.xpos &&
+           _glfw.null.ycursor >= window->null.ypos &&
+           _glfw.null.xcursor <= window->null.xpos + window->null.width - 1 &&
+           _glfw.null.ycursor <= window->null.ypos + window->null.height - 1;
+}
+
+GLFWbool _glfwFramebufferTransparentNull(_GLFWwindow* window)
+{
+    return window->null.transparent;
+}
+
+void _glfwSetWindowResizableNull(_GLFWwindow* window, GLFWbool enabled)
+{
+    window->null.resizable = enabled;
+}
+
+void _glfwSetWindowDecoratedNull(_GLFWwindow* window, GLFWbool enabled)
+{
+    window->null.decorated = enabled;
+}
+
+void _glfwSetWindowFloatingNull(_GLFWwindow* window, GLFWbool enabled)
+{
+    window->null.floating = enabled;
+}
+
+void _glfwSetWindowMousePassthroughNull(_GLFWwindow* window, GLFWbool enabled)
 {
 }
 
-void _glfwPlatformRestoreWindow(_GLFWwindow* window)
+float _glfwGetWindowOpacityNull(_GLFWwindow* window)
+{
+    return window->null.opacity;
+}
+
+void _glfwSetWindowOpacityNull(_GLFWwindow* window, float opacity)
+{
+    window->null.opacity = opacity;
+}
+
+void _glfwSetRawMouseMotionNull(_GLFWwindow *window, GLFWbool enabled)
 {
 }
 
-void _glfwPlatformMaximizeWindow(_GLFWwindow* window)
-{
-}
-
-int _glfwPlatformWindowMaximized(_GLFWwindow* window)
-{
-    return GLFW_FALSE;
-}
-
-int _glfwPlatformWindowHovered(_GLFWwindow* window)
-{
-    return GLFW_FALSE;
-}
-
-int _glfwPlatformFramebufferTransparent(_GLFWwindow* window)
-{
-    return GLFW_FALSE;
-}
-
-void _glfwPlatformSetWindowResizable(_GLFWwindow* window, GLFWbool enabled)
-{
-}
-
-void _glfwPlatformSetWindowDecorated(_GLFWwindow* window, GLFWbool enabled)
-{
-}
-
-void _glfwPlatformSetWindowFloating(_GLFWwindow* window, GLFWbool enabled)
-{
-}
-
-float _glfwPlatformGetWindowOpacity(_GLFWwindow* window)
-{
-    return 1.f;
-}
-
-void _glfwPlatformSetWindowOpacity(_GLFWwindow* window, float opacity)
-{
-}
-
-void _glfwPlatformSetRawMouseMotion(_GLFWwindow *window, GLFWbool enabled)
-{
-}
-
-GLFWbool _glfwPlatformRawMouseMotionSupported(void)
-{
-    return GLFW_FALSE;
-}
-
-void _glfwPlatformShowWindow(_GLFWwindow* window)
-{
-}
-
-
-void _glfwPlatformRequestWindowAttention(_GLFWwindow* window)
-{
-}
-
-void _glfwPlatformUnhideWindow(_GLFWwindow* window)
-{
-}
-
-void _glfwPlatformHideWindow(_GLFWwindow* window)
-{
-}
-
-void _glfwPlatformFocusWindow(_GLFWwindow* window)
-{
-}
-
-int _glfwPlatformWindowFocused(_GLFWwindow* window)
-{
-    return GLFW_FALSE;
-}
-
-int _glfwPlatformWindowIconified(_GLFWwindow* window)
-{
-    return GLFW_FALSE;
-}
-
-int _glfwPlatformWindowVisible(_GLFWwindow* window)
-{
-    return GLFW_FALSE;
-}
-
-void _glfwPlatformPollEvents(void)
-{
-}
-
-void _glfwPlatformWaitEvents(void)
-{
-}
-
-void _glfwPlatformWaitEventsTimeout(double timeout)
-{
-}
-
-void _glfwPlatformPostEmptyEvent(void)
-{
-}
-
-void _glfwPlatformGetCursorPos(_GLFWwindow* window, double* xpos, double* ypos)
-{
-}
-
-void _glfwPlatformSetCursorPos(_GLFWwindow* window, double x, double y)
-{
-}
-
-void _glfwPlatformSetCursorMode(_GLFWwindow* window, int mode)
-{
-}
-
-int _glfwPlatformCreateCursor(_GLFWcursor* cursor,
-                              const GLFWimage* image,
-                              int xhot, int yhot)
+GLFWbool _glfwRawMouseMotionSupportedNull(void)
 {
     return GLFW_TRUE;
 }
 
-int _glfwPlatformCreateStandardCursor(_GLFWcursor* cursor, int shape)
+void _glfwShowWindowNull(_GLFWwindow* window)
+{
+    window->null.visible = GLFW_TRUE;
+}
+
+void _glfwRequestWindowAttentionNull(_GLFWwindow* window)
+{
+}
+
+void _glfwHideWindowNull(_GLFWwindow* window)
+{
+    if (_glfw.null.focusedWindow == window)
+    {
+        _glfw.null.focusedWindow = NULL;
+        _glfwInputWindowFocus(window, GLFW_FALSE);
+    }
+
+    window->null.visible = GLFW_FALSE;
+}
+
+void _glfwFocusWindowNull(_GLFWwindow* window)
+{
+    _GLFWwindow* previous;
+
+    if (_glfw.null.focusedWindow == window)
+        return;
+
+    if (!window->null.visible)
+        return;
+
+    previous = _glfw.null.focusedWindow;
+    _glfw.null.focusedWindow = window;
+
+    if (previous)
+    {
+        _glfwInputWindowFocus(previous, GLFW_FALSE);
+        if (previous->monitor && previous->autoIconify)
+            _glfwIconifyWindowNull(previous);
+    }
+
+    _glfwInputWindowFocus(window, GLFW_TRUE);
+}
+
+GLFWbool _glfwWindowFocusedNull(_GLFWwindow* window)
+{
+    return _glfw.null.focusedWindow == window;
+}
+
+GLFWbool _glfwWindowIconifiedNull(_GLFWwindow* window)
+{
+    return window->null.iconified;
+}
+
+GLFWbool _glfwWindowVisibleNull(_GLFWwindow* window)
+{
+    return window->null.visible;
+}
+
+void _glfwPollEventsNull(void)
+{
+}
+
+void _glfwWaitEventsNull(void)
+{
+}
+
+void _glfwWaitEventsTimeoutNull(double timeout)
+{
+}
+
+void _glfwPostEmptyEventNull(void)
+{
+}
+
+void _glfwGetCursorPosNull(_GLFWwindow* window, double* xpos, double* ypos)
+{
+    if (xpos)
+        *xpos = _glfw.null.xcursor - window->null.xpos;
+    if (ypos)
+        *ypos = _glfw.null.ycursor - window->null.ypos;
+}
+
+void _glfwSetCursorPosNull(_GLFWwindow* window, double x, double y)
+{
+    _glfw.null.xcursor = window->null.xpos + (int) x;
+    _glfw.null.ycursor = window->null.ypos + (int) y;
+}
+
+void _glfwSetCursorModeNull(_GLFWwindow* window, int mode)
+{
+}
+
+GLFWbool _glfwCreateCursorNull(_GLFWcursor* cursor,
+                               const GLFWimage* image,
+                               int xhot, int yhot)
 {
     return GLFW_TRUE;
 }
 
-void _glfwPlatformDestroyCursor(_GLFWcursor* cursor)
+GLFWbool _glfwCreateStandardCursorNull(_GLFWcursor* cursor, int shape)
+{
+    return GLFW_TRUE;
+}
+
+void _glfwDestroyCursorNull(_GLFWcursor* cursor)
 {
 }
 
-void _glfwPlatformSetCursor(_GLFWwindow* window, _GLFWcursor* cursor)
+void _glfwSetCursorNull(_GLFWwindow* window, _GLFWcursor* cursor)
 {
 }
 
-void _glfwPlatformSetClipboardString(const char* string)
+void _glfwSetClipboardStringNull(const char* string)
 {
+    char* copy = _glfw_strdup(string);
+    _glfw_free(_glfw.null.clipboardString);
+    _glfw.null.clipboardString = copy;
 }
 
-const char* _glfwPlatformGetClipboardString(void)
+const char* _glfwGetClipboardStringNull(void)
 {
+    return _glfw.null.clipboardString;
+}
+
+EGLenum _glfwGetEGLPlatformNull(EGLint** attribs)
+{
+    return 0;
+}
+
+EGLNativeDisplayType _glfwGetEGLNativeDisplayNull(void)
+{
+    return 0;
+}
+
+EGLNativeWindowType _glfwGetEGLNativeWindowNull(_GLFWwindow* window)
+{
+    return 0;
+}
+
+const char* _glfwGetScancodeNameNull(int scancode)
+{
+    if (scancode < GLFW_NULL_SC_FIRST || scancode > GLFW_NULL_SC_LAST)
+    {
+        _glfwInputError(GLFW_INVALID_VALUE, "Invalid scancode %i", scancode);
+        return NULL;
+    }
+
+    switch (scancode)
+    {
+        case GLFW_NULL_SC_APOSTROPHE:
+            return "'";
+        case GLFW_NULL_SC_COMMA:
+            return ",";
+        case GLFW_NULL_SC_MINUS:
+        case GLFW_NULL_SC_KP_SUBTRACT:
+            return "-";
+        case GLFW_NULL_SC_PERIOD:
+        case GLFW_NULL_SC_KP_DECIMAL:
+            return ".";
+        case GLFW_NULL_SC_SLASH:
+        case GLFW_NULL_SC_KP_DIVIDE:
+            return "/";
+        case GLFW_NULL_SC_SEMICOLON:
+            return ";";
+        case GLFW_NULL_SC_EQUAL:
+        case GLFW_NULL_SC_KP_EQUAL:
+            return "=";
+        case GLFW_NULL_SC_LEFT_BRACKET:
+            return "[";
+        case GLFW_NULL_SC_RIGHT_BRACKET:
+            return "]";
+        case GLFW_NULL_SC_KP_MULTIPLY:
+            return "*";
+        case GLFW_NULL_SC_KP_ADD:
+            return "+";
+        case GLFW_NULL_SC_BACKSLASH:
+        case GLFW_NULL_SC_WORLD_1:
+        case GLFW_NULL_SC_WORLD_2:
+            return "\\";
+        case GLFW_NULL_SC_0:
+        case GLFW_NULL_SC_KP_0:
+            return "0";
+        case GLFW_NULL_SC_1:
+        case GLFW_NULL_SC_KP_1:
+            return "1";
+        case GLFW_NULL_SC_2:
+        case GLFW_NULL_SC_KP_2:
+            return "2";
+        case GLFW_NULL_SC_3:
+        case GLFW_NULL_SC_KP_3:
+            return "3";
+        case GLFW_NULL_SC_4:
+        case GLFW_NULL_SC_KP_4:
+            return "4";
+        case GLFW_NULL_SC_5:
+        case GLFW_NULL_SC_KP_5:
+            return "5";
+        case GLFW_NULL_SC_6:
+        case GLFW_NULL_SC_KP_6:
+            return "6";
+        case GLFW_NULL_SC_7:
+        case GLFW_NULL_SC_KP_7:
+            return "7";
+        case GLFW_NULL_SC_8:
+        case GLFW_NULL_SC_KP_8:
+            return "8";
+        case GLFW_NULL_SC_9:
+        case GLFW_NULL_SC_KP_9:
+            return "9";
+        case GLFW_NULL_SC_A:
+            return "a";
+        case GLFW_NULL_SC_B:
+            return "b";
+        case GLFW_NULL_SC_C:
+            return "c";
+        case GLFW_NULL_SC_D:
+            return "d";
+        case GLFW_NULL_SC_E:
+            return "e";
+        case GLFW_NULL_SC_F:
+            return "f";
+        case GLFW_NULL_SC_G:
+            return "g";
+        case GLFW_NULL_SC_H:
+            return "h";
+        case GLFW_NULL_SC_I:
+            return "i";
+        case GLFW_NULL_SC_J:
+            return "j";
+        case GLFW_NULL_SC_K:
+            return "k";
+        case GLFW_NULL_SC_L:
+            return "l";
+        case GLFW_NULL_SC_M:
+            return "m";
+        case GLFW_NULL_SC_N:
+            return "n";
+        case GLFW_NULL_SC_O:
+            return "o";
+        case GLFW_NULL_SC_P:
+            return "p";
+        case GLFW_NULL_SC_Q:
+            return "q";
+        case GLFW_NULL_SC_R:
+            return "r";
+        case GLFW_NULL_SC_S:
+            return "s";
+        case GLFW_NULL_SC_T:
+            return "t";
+        case GLFW_NULL_SC_U:
+            return "u";
+        case GLFW_NULL_SC_V:
+            return "v";
+        case GLFW_NULL_SC_W:
+            return "w";
+        case GLFW_NULL_SC_X:
+            return "x";
+        case GLFW_NULL_SC_Y:
+            return "y";
+        case GLFW_NULL_SC_Z:
+            return "z";
+    }
+
     return NULL;
 }
 
-const char* _glfwPlatformGetScancodeName(int scancode)
+int _glfwGetKeyScancodeNull(int key)
 {
-    return "";
+    return _glfw.null.scancodes[key];
 }
 
-int _glfwPlatformGetKeyScancode(int key)
-{
-    return -1;
-}
-
-void _glfwPlatformGetRequiredInstanceExtensions(char** extensions)
+void _glfwGetRequiredInstanceExtensionsNull(char** extensions)
 {
 }
 
-int _glfwPlatformGetPhysicalDevicePresentationSupport(VkInstance instance,
-                                                      VkPhysicalDevice device,
-                                                      uint32_t queuefamily)
+GLFWbool _glfwGetPhysicalDevicePresentationSupportNull(VkInstance instance,
+                                                       VkPhysicalDevice device,
+                                                       uint32_t queuefamily)
 {
     return GLFW_FALSE;
 }
 
-VkResult _glfwPlatformCreateWindowSurface(VkInstance instance,
-                                          _GLFWwindow* window,
-                                          const VkAllocationCallbacks* allocator,
-                                          VkSurfaceKHR* surface)
+VkResult _glfwCreateWindowSurfaceNull(VkInstance instance,
+                                      _GLFWwindow* window,
+                                      const VkAllocationCallbacks* allocator,
+                                      VkSurfaceKHR* surface)
 {
     // This seems like the most appropriate error to return here
-    return VK_ERROR_INITIALIZATION_FAILED;
+    return VK_ERROR_EXTENSION_NOT_PRESENT;
 }
 
diff --git a/src/osmesa_context.c b/src/osmesa_context.c
index 0ab8ec7..2f12adf 100644
--- a/src/osmesa_context.c
+++ b/src/osmesa_context.c
@@ -1,5 +1,5 @@
 //========================================================================
-// GLFW 3.3 OSMesa - www.glfw.org
+// GLFW 3.4 OSMesa - www.glfw.org
 //------------------------------------------------------------------------
 // Copyright (c) 2016 Google Inc.
 // Copyright (c) 2016-2017 Camilla Löwy <elmindreda@glfw.org>
@@ -24,8 +24,6 @@
 //    distribution.
 //
 //========================================================================
-// Please use C89 style variable declarations in this file because VS 2010
-//========================================================================
 
 #include "internal.h"
 
@@ -38,17 +36,17 @@
     if (window)
     {
         int width, height;
-        _glfwPlatformGetFramebufferSize(window, &width, &height);
+        _glfw.platform.getFramebufferSize(window, &width, &height);
 
         // Check to see if we need to allocate a new buffer
         if ((window->context.osmesa.buffer == NULL) ||
             (width != window->context.osmesa.width) ||
             (height != window->context.osmesa.height))
         {
-            free(window->context.osmesa.buffer);
+            _glfw_free(window->context.osmesa.buffer);
 
             // Allocate the new buffer (width * height * 8-bit RGBA)
-            window->context.osmesa.buffer = calloc(4, (size_t) width * height);
+            window->context.osmesa.buffer = _glfw_calloc(4, (size_t) width * height);
             window->context.osmesa.width  = width;
             window->context.osmesa.height = height;
         }
@@ -82,7 +80,7 @@
 
     if (window->context.osmesa.buffer)
     {
-        free(window->context.osmesa.buffer);
+        _glfw_free(window->context.osmesa.buffer);
         window->context.osmesa.width = 0;
         window->context.osmesa.height = 0;
     }
@@ -137,7 +135,7 @@
 
     for (i = 0;  sonames[i];  i++)
     {
-        _glfw.osmesa.handle = _glfw_dlopen(sonames[i]);
+        _glfw.osmesa.handle = _glfwPlatformLoadModule(sonames[i]);
         if (_glfw.osmesa.handle)
             break;
     }
@@ -149,19 +147,19 @@
     }
 
     _glfw.osmesa.CreateContextExt = (PFN_OSMesaCreateContextExt)
-        _glfw_dlsym(_glfw.osmesa.handle, "OSMesaCreateContextExt");
+        _glfwPlatformGetModuleSymbol(_glfw.osmesa.handle, "OSMesaCreateContextExt");
     _glfw.osmesa.CreateContextAttribs = (PFN_OSMesaCreateContextAttribs)
-        _glfw_dlsym(_glfw.osmesa.handle, "OSMesaCreateContextAttribs");
+        _glfwPlatformGetModuleSymbol(_glfw.osmesa.handle, "OSMesaCreateContextAttribs");
     _glfw.osmesa.DestroyContext = (PFN_OSMesaDestroyContext)
-        _glfw_dlsym(_glfw.osmesa.handle, "OSMesaDestroyContext");
+        _glfwPlatformGetModuleSymbol(_glfw.osmesa.handle, "OSMesaDestroyContext");
     _glfw.osmesa.MakeCurrent = (PFN_OSMesaMakeCurrent)
-        _glfw_dlsym(_glfw.osmesa.handle, "OSMesaMakeCurrent");
+        _glfwPlatformGetModuleSymbol(_glfw.osmesa.handle, "OSMesaMakeCurrent");
     _glfw.osmesa.GetColorBuffer = (PFN_OSMesaGetColorBuffer)
-        _glfw_dlsym(_glfw.osmesa.handle, "OSMesaGetColorBuffer");
+        _glfwPlatformGetModuleSymbol(_glfw.osmesa.handle, "OSMesaGetColorBuffer");
     _glfw.osmesa.GetDepthBuffer = (PFN_OSMesaGetDepthBuffer)
-        _glfw_dlsym(_glfw.osmesa.handle, "OSMesaGetDepthBuffer");
+        _glfwPlatformGetModuleSymbol(_glfw.osmesa.handle, "OSMesaGetDepthBuffer");
     _glfw.osmesa.GetProcAddress = (PFN_OSMesaGetProcAddress)
-        _glfw_dlsym(_glfw.osmesa.handle, "OSMesaGetProcAddress");
+        _glfwPlatformGetModuleSymbol(_glfw.osmesa.handle, "OSMesaGetProcAddress");
 
     if (!_glfw.osmesa.CreateContextExt ||
         !_glfw.osmesa.DestroyContext ||
@@ -184,12 +182,12 @@
 {
     if (_glfw.osmesa.handle)
     {
-        _glfw_dlclose(_glfw.osmesa.handle);
+        _glfwPlatformFreeModule(_glfw.osmesa.handle);
         _glfw.osmesa.handle = NULL;
     }
 }
 
-#define setAttrib(a, v) \
+#define SET_ATTRIB(a, v) \
 { \
     assert(((size_t) index + 1) < sizeof(attribs) / sizeof(attribs[0])); \
     attribs[index++] = a; \
@@ -220,24 +218,24 @@
     {
         int index = 0, attribs[40];
 
-        setAttrib(OSMESA_FORMAT, OSMESA_RGBA);
-        setAttrib(OSMESA_DEPTH_BITS, fbconfig->depthBits);
-        setAttrib(OSMESA_STENCIL_BITS, fbconfig->stencilBits);
-        setAttrib(OSMESA_ACCUM_BITS, accumBits);
+        SET_ATTRIB(OSMESA_FORMAT, OSMESA_RGBA);
+        SET_ATTRIB(OSMESA_DEPTH_BITS, fbconfig->depthBits);
+        SET_ATTRIB(OSMESA_STENCIL_BITS, fbconfig->stencilBits);
+        SET_ATTRIB(OSMESA_ACCUM_BITS, accumBits);
 
         if (ctxconfig->profile == GLFW_OPENGL_CORE_PROFILE)
         {
-            setAttrib(OSMESA_PROFILE, OSMESA_CORE_PROFILE);
+            SET_ATTRIB(OSMESA_PROFILE, OSMESA_CORE_PROFILE);
         }
         else if (ctxconfig->profile == GLFW_OPENGL_COMPAT_PROFILE)
         {
-            setAttrib(OSMESA_PROFILE, OSMESA_COMPAT_PROFILE);
+            SET_ATTRIB(OSMESA_PROFILE, OSMESA_COMPAT_PROFILE);
         }
 
         if (ctxconfig->major != 1 || ctxconfig->minor != 0)
         {
-            setAttrib(OSMESA_CONTEXT_MAJOR_VERSION, ctxconfig->major);
-            setAttrib(OSMESA_CONTEXT_MINOR_VERSION, ctxconfig->minor);
+            SET_ATTRIB(OSMESA_CONTEXT_MAJOR_VERSION, ctxconfig->major);
+            SET_ATTRIB(OSMESA_CONTEXT_MINOR_VERSION, ctxconfig->minor);
         }
 
         if (ctxconfig->forward)
@@ -247,7 +245,7 @@
             return GLFW_FALSE;
         }
 
-        setAttrib(0, 0);
+        SET_ATTRIB(0, 0);
 
         window->context.osmesa.handle =
             OSMesaCreateContextAttribs(attribs, share);
@@ -286,7 +284,7 @@
     return GLFW_TRUE;
 }
 
-#undef setAttrib
+#undef SET_ATTRIB
 
 
 //////////////////////////////////////////////////////////////////////////
diff --git a/src/osmesa_context.h b/src/osmesa_context.h
deleted file mode 100644
index 6462637..0000000
--- a/src/osmesa_context.h
+++ /dev/null
@@ -1,92 +0,0 @@
-//========================================================================
-// GLFW 3.3 OSMesa - www.glfw.org
-//------------------------------------------------------------------------
-// Copyright (c) 2016 Google Inc.
-// Copyright (c) 2016-2017 Camilla Löwy <elmindreda@glfw.org>
-//
-// 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 OSMESA_RGBA 0x1908
-#define OSMESA_FORMAT 0x22
-#define OSMESA_DEPTH_BITS 0x30
-#define OSMESA_STENCIL_BITS 0x31
-#define OSMESA_ACCUM_BITS 0x32
-#define OSMESA_PROFILE 0x33
-#define OSMESA_CORE_PROFILE 0x34
-#define OSMESA_COMPAT_PROFILE 0x35
-#define OSMESA_CONTEXT_MAJOR_VERSION 0x36
-#define OSMESA_CONTEXT_MINOR_VERSION 0x37
-
-typedef void* OSMesaContext;
-typedef void (*OSMESAproc)(void);
-
-typedef OSMesaContext (GLAPIENTRY * PFN_OSMesaCreateContextExt)(GLenum,GLint,GLint,GLint,OSMesaContext);
-typedef OSMesaContext (GLAPIENTRY * PFN_OSMesaCreateContextAttribs)(const int*,OSMesaContext);
-typedef void (GLAPIENTRY * PFN_OSMesaDestroyContext)(OSMesaContext);
-typedef int (GLAPIENTRY * PFN_OSMesaMakeCurrent)(OSMesaContext,void*,int,int,int);
-typedef int (GLAPIENTRY * PFN_OSMesaGetColorBuffer)(OSMesaContext,int*,int*,int*,void**);
-typedef int (GLAPIENTRY * PFN_OSMesaGetDepthBuffer)(OSMesaContext,int*,int*,int*,void**);
-typedef GLFWglproc (GLAPIENTRY * PFN_OSMesaGetProcAddress)(const char*);
-#define OSMesaCreateContextExt _glfw.osmesa.CreateContextExt
-#define OSMesaCreateContextAttribs _glfw.osmesa.CreateContextAttribs
-#define OSMesaDestroyContext _glfw.osmesa.DestroyContext
-#define OSMesaMakeCurrent _glfw.osmesa.MakeCurrent
-#define OSMesaGetColorBuffer _glfw.osmesa.GetColorBuffer
-#define OSMesaGetDepthBuffer _glfw.osmesa.GetDepthBuffer
-#define OSMesaGetProcAddress _glfw.osmesa.GetProcAddress
-
-#define _GLFW_OSMESA_CONTEXT_STATE              _GLFWcontextOSMesa osmesa
-#define _GLFW_OSMESA_LIBRARY_CONTEXT_STATE      _GLFWlibraryOSMesa osmesa
-
-
-// OSMesa-specific per-context data
-//
-typedef struct _GLFWcontextOSMesa
-{
-    OSMesaContext       handle;
-    int                 width;
-    int                 height;
-    void*               buffer;
-} _GLFWcontextOSMesa;
-
-// OSMesa-specific global data
-//
-typedef struct _GLFWlibraryOSMesa
-{
-    void*           handle;
-
-    PFN_OSMesaCreateContextExt      CreateContextExt;
-    PFN_OSMesaCreateContextAttribs  CreateContextAttribs;
-    PFN_OSMesaDestroyContext        DestroyContext;
-    PFN_OSMesaMakeCurrent           MakeCurrent;
-    PFN_OSMesaGetColorBuffer        GetColorBuffer;
-    PFN_OSMesaGetDepthBuffer        GetDepthBuffer;
-    PFN_OSMesaGetProcAddress        GetProcAddress;
-} _GLFWlibraryOSMesa;
-
-
-GLFWbool _glfwInitOSMesa(void);
-void _glfwTerminateOSMesa(void);
-GLFWbool _glfwCreateContextOSMesa(_GLFWwindow* window,
-                                  const _GLFWctxconfig* ctxconfig,
-                                  const _GLFWfbconfig* fbconfig);
-
diff --git a/src/platform.c b/src/platform.c
new file mode 100644
index 0000000..af1b0f4
--- /dev/null
+++ b/src/platform.c
@@ -0,0 +1,212 @@
+//========================================================================
+// GLFW 3.4 - www.glfw.org
+//------------------------------------------------------------------------
+// Copyright (c) 2002-2006 Marcus Geelnard
+// Copyright (c) 2006-2018 Camilla Löwy <elmindreda@glfw.org>
+//
+// 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.
+//
+//========================================================================
+
+#include "internal.h"
+
+#include <string.h>
+#include <stdlib.h>
+
+// These construct a string literal from individual numeric constants
+#define _GLFW_CONCAT_VERSION(m, n, r) #m "." #n "." #r
+#define _GLFW_MAKE_VERSION(m, n, r) _GLFW_CONCAT_VERSION(m, n, r)
+
+//////////////////////////////////////////////////////////////////////////
+//////                       GLFW internal API                      //////
+//////////////////////////////////////////////////////////////////////////
+
+static const struct
+{
+    int ID;
+    GLFWbool (*connect)(int,_GLFWplatform*);
+} supportedPlatforms[] =
+{
+#if defined(_GLFW_WIN32)
+    { GLFW_PLATFORM_WIN32, _glfwConnectWin32 },
+#endif
+#if defined(_GLFW_COCOA)
+    { GLFW_PLATFORM_COCOA, _glfwConnectCocoa },
+#endif
+#if defined(_GLFW_WAYLAND)
+    { GLFW_PLATFORM_WAYLAND, _glfwConnectWayland },
+#endif
+#if defined(_GLFW_X11)
+    { GLFW_PLATFORM_X11, _glfwConnectX11 },
+#endif
+};
+
+GLFWbool _glfwSelectPlatform(int desiredID, _GLFWplatform* platform)
+{
+    const size_t count = sizeof(supportedPlatforms) / sizeof(supportedPlatforms[0]);
+    size_t i;
+
+    if (desiredID != GLFW_ANY_PLATFORM &&
+        desiredID != GLFW_PLATFORM_WIN32 &&
+        desiredID != GLFW_PLATFORM_COCOA &&
+        desiredID != GLFW_PLATFORM_WAYLAND &&
+        desiredID != GLFW_PLATFORM_X11 &&
+        desiredID != GLFW_PLATFORM_NULL)
+    {
+        _glfwInputError(GLFW_INVALID_ENUM, "Invalid platform ID 0x%08X", desiredID);
+        return GLFW_FALSE;
+    }
+
+    // Only allow the Null platform if specifically requested
+    if (desiredID == GLFW_PLATFORM_NULL)
+        return _glfwConnectNull(desiredID, platform);
+    else if (count == 0)
+    {
+        _glfwInputError(GLFW_PLATFORM_UNAVAILABLE, "This binary only supports the Null platform");
+        return GLFW_FALSE;
+    }
+
+#if defined(_GLFW_WAYLAND) && defined(_GLFW_X11)
+    if (desiredID == GLFW_ANY_PLATFORM)
+    {
+        const char* const session = getenv("XDG_SESSION_TYPE");
+        if (session)
+        {
+            // Only follow XDG_SESSION_TYPE if it is set correctly and the
+            // environment looks plausble; otherwise fall back to detection
+            if (strcmp(session, "wayland") == 0 && getenv("WAYLAND_DISPLAY"))
+                desiredID = GLFW_PLATFORM_WAYLAND;
+            else if (strcmp(session, "x11") == 0 && getenv("DISPLAY"))
+                desiredID = GLFW_PLATFORM_X11;
+        }
+    }
+#endif
+
+    if (desiredID == GLFW_ANY_PLATFORM)
+    {
+        // If there is exactly one platform available for auto-selection, let it emit the
+        // error on failure as the platform-specific error description may be more helpful
+        if (count == 1)
+            return supportedPlatforms[0].connect(supportedPlatforms[0].ID, platform);
+
+        for (i = 0;  i < count;  i++)
+        {
+            if (supportedPlatforms[i].connect(desiredID, platform))
+                return GLFW_TRUE;
+        }
+
+        _glfwInputError(GLFW_PLATFORM_UNAVAILABLE, "Failed to detect any supported platform");
+    }
+    else
+    {
+        for (i = 0;  i < count;  i++)
+        {
+            if (supportedPlatforms[i].ID == desiredID)
+                return supportedPlatforms[i].connect(desiredID, platform);
+        }
+
+        _glfwInputError(GLFW_PLATFORM_UNAVAILABLE, "The requested platform is not supported");
+    }
+
+    return GLFW_FALSE;
+}
+
+//////////////////////////////////////////////////////////////////////////
+//////                        GLFW public API                       //////
+//////////////////////////////////////////////////////////////////////////
+
+GLFWAPI int glfwGetPlatform(void)
+{
+    _GLFW_REQUIRE_INIT_OR_RETURN(0);
+    return _glfw.platform.platformID;
+}
+
+GLFWAPI int glfwPlatformSupported(int platformID)
+{
+    const size_t count = sizeof(supportedPlatforms) / sizeof(supportedPlatforms[0]);
+    size_t i;
+
+    if (platformID != GLFW_PLATFORM_WIN32 &&
+        platformID != GLFW_PLATFORM_COCOA &&
+        platformID != GLFW_PLATFORM_WAYLAND &&
+        platformID != GLFW_PLATFORM_X11 &&
+        platformID != GLFW_PLATFORM_NULL)
+    {
+        _glfwInputError(GLFW_INVALID_ENUM, "Invalid platform ID 0x%08X", platformID);
+        return GLFW_FALSE;
+    }
+
+    if (platformID == GLFW_PLATFORM_NULL)
+        return GLFW_TRUE;
+
+    for (i = 0;  i < count;  i++)
+    {
+        if (platformID == supportedPlatforms[i].ID)
+            return GLFW_TRUE;
+    }
+
+    return GLFW_FALSE;
+}
+
+GLFWAPI const char* glfwGetVersionString(void)
+{
+    return _GLFW_MAKE_VERSION(GLFW_VERSION_MAJOR,
+                              GLFW_VERSION_MINOR,
+                              GLFW_VERSION_REVISION)
+#if defined(_GLFW_WIN32)
+        " Win32 WGL"
+#endif
+#if defined(_GLFW_COCOA)
+        " Cocoa NSGL"
+#endif
+#if defined(_GLFW_WAYLAND)
+        " Wayland"
+#endif
+#if defined(_GLFW_X11)
+        " X11 GLX"
+#endif
+        " Null"
+        " EGL"
+        " OSMesa"
+#if defined(__MINGW64_VERSION_MAJOR)
+        " MinGW-w64"
+#elif defined(__MINGW32__)
+        " MinGW"
+#elif defined(_MSC_VER)
+        " VisualC"
+#endif
+#if defined(_GLFW_USE_HYBRID_HPG) || defined(_GLFW_USE_OPTIMUS_HPG)
+        " hybrid-GPU"
+#endif
+#if defined(_POSIX_MONOTONIC_CLOCK)
+        " monotonic"
+#endif
+#if defined(_GLFW_BUILD_DLL)
+#if defined(_WIN32)
+        " DLL"
+#elif defined(__APPLE__)
+        " dynamic"
+#else
+        " shared"
+#endif
+#endif
+        ;
+}
+
diff --git a/src/platform.h b/src/platform.h
new file mode 100644
index 0000000..75652dc
--- /dev/null
+++ b/src/platform.h
@@ -0,0 +1,212 @@
+//========================================================================
+// GLFW 3.4 - www.glfw.org
+//------------------------------------------------------------------------
+// Copyright (c) 2002-2006 Marcus Geelnard
+// Copyright (c) 2006-2018 Camilla Löwy <elmindreda@glfw.org>
+//
+// 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.
+//
+//========================================================================
+
+#if defined(GLFW_BUILD_WIN32_TIMER) || \
+    defined(GLFW_BUILD_WIN32_MODULE) || \
+    defined(GLFW_BUILD_WIN32_THREAD) || \
+    defined(GLFW_BUILD_COCOA_TIMER) || \
+    defined(GLFW_BUILD_POSIX_TIMER) || \
+    defined(GLFW_BUILD_POSIX_MODULE) || \
+    defined(GLFW_BUILD_POSIX_THREAD) || \
+    defined(GLFW_BUILD_POSIX_POLL) || \
+    defined(GLFW_BUILD_LINUX_JOYSTICK)
+ #error "You must not define these; define zero or more _GLFW_<platform> macros instead"
+#endif
+
+#include "null_platform.h"
+#define GLFW_EXPOSE_NATIVE_EGL
+#define GLFW_EXPOSE_NATIVE_OSMESA
+
+#if defined(_GLFW_WIN32)
+ #include "win32_platform.h"
+ #define GLFW_EXPOSE_NATIVE_WIN32
+ #define GLFW_EXPOSE_NATIVE_WGL
+#else
+ #define GLFW_WIN32_WINDOW_STATE
+ #define GLFW_WIN32_MONITOR_STATE
+ #define GLFW_WIN32_CURSOR_STATE
+ #define GLFW_WIN32_LIBRARY_WINDOW_STATE
+ #define GLFW_WGL_CONTEXT_STATE
+ #define GLFW_WGL_LIBRARY_CONTEXT_STATE
+#endif
+
+#if defined(_GLFW_COCOA)
+ #include "cocoa_platform.h"
+ #define GLFW_EXPOSE_NATIVE_COCOA
+ #define GLFW_EXPOSE_NATIVE_NSGL
+#else
+ #define GLFW_COCOA_WINDOW_STATE
+ #define GLFW_COCOA_MONITOR_STATE
+ #define GLFW_COCOA_CURSOR_STATE
+ #define GLFW_COCOA_LIBRARY_WINDOW_STATE
+ #define GLFW_NSGL_CONTEXT_STATE
+ #define GLFW_NSGL_LIBRARY_CONTEXT_STATE
+#endif
+
+#if defined(_GLFW_WAYLAND)
+ #include "wl_platform.h"
+ #define GLFW_EXPOSE_NATIVE_WAYLAND
+#else
+ #define GLFW_WAYLAND_WINDOW_STATE
+ #define GLFW_WAYLAND_MONITOR_STATE
+ #define GLFW_WAYLAND_CURSOR_STATE
+ #define GLFW_WAYLAND_LIBRARY_WINDOW_STATE
+#endif
+
+#if defined(_GLFW_X11)
+ #include "x11_platform.h"
+ #define GLFW_EXPOSE_NATIVE_X11
+ #define GLFW_EXPOSE_NATIVE_GLX
+#else
+ #define GLFW_X11_WINDOW_STATE
+ #define GLFW_X11_MONITOR_STATE
+ #define GLFW_X11_CURSOR_STATE
+ #define GLFW_X11_LIBRARY_WINDOW_STATE
+ #define GLFW_GLX_CONTEXT_STATE
+ #define GLFW_GLX_LIBRARY_CONTEXT_STATE
+#endif
+
+#include "null_joystick.h"
+
+#if defined(_GLFW_WIN32)
+ #include "win32_joystick.h"
+#else
+ #define GLFW_WIN32_JOYSTICK_STATE
+ #define GLFW_WIN32_LIBRARY_JOYSTICK_STATE
+#endif
+
+#if defined(_GLFW_COCOA)
+ #include "cocoa_joystick.h"
+#else
+ #define GLFW_COCOA_JOYSTICK_STATE
+ #define GLFW_COCOA_LIBRARY_JOYSTICK_STATE
+#endif
+
+#if (defined(_GLFW_X11) || defined(_GLFW_WAYLAND)) && defined(__linux__)
+ #define GLFW_BUILD_LINUX_JOYSTICK
+#endif
+
+#if defined(GLFW_BUILD_LINUX_JOYSTICK)
+ #include "linux_joystick.h"
+#else
+ #define GLFW_LINUX_JOYSTICK_STATE
+ #define GLFW_LINUX_LIBRARY_JOYSTICK_STATE
+#endif
+
+#define GLFW_PLATFORM_WINDOW_STATE \
+        GLFW_WIN32_WINDOW_STATE \
+        GLFW_COCOA_WINDOW_STATE \
+        GLFW_WAYLAND_WINDOW_STATE \
+        GLFW_X11_WINDOW_STATE \
+        GLFW_NULL_WINDOW_STATE \
+
+#define GLFW_PLATFORM_MONITOR_STATE \
+        GLFW_WIN32_MONITOR_STATE \
+        GLFW_COCOA_MONITOR_STATE \
+        GLFW_WAYLAND_MONITOR_STATE \
+        GLFW_X11_MONITOR_STATE \
+        GLFW_NULL_MONITOR_STATE \
+
+#define GLFW_PLATFORM_CURSOR_STATE \
+        GLFW_WIN32_CURSOR_STATE \
+        GLFW_COCOA_CURSOR_STATE \
+        GLFW_WAYLAND_CURSOR_STATE \
+        GLFW_X11_CURSOR_STATE \
+        GLFW_NULL_CURSOR_STATE \
+
+#define GLFW_PLATFORM_JOYSTICK_STATE \
+        GLFW_WIN32_JOYSTICK_STATE \
+        GLFW_COCOA_JOYSTICK_STATE \
+        GLFW_LINUX_JOYSTICK_STATE
+
+#define GLFW_PLATFORM_LIBRARY_WINDOW_STATE \
+        GLFW_WIN32_LIBRARY_WINDOW_STATE \
+        GLFW_COCOA_LIBRARY_WINDOW_STATE \
+        GLFW_WAYLAND_LIBRARY_WINDOW_STATE \
+        GLFW_X11_LIBRARY_WINDOW_STATE \
+        GLFW_NULL_LIBRARY_WINDOW_STATE \
+
+#define GLFW_PLATFORM_LIBRARY_JOYSTICK_STATE \
+        GLFW_WIN32_LIBRARY_JOYSTICK_STATE \
+        GLFW_COCOA_LIBRARY_JOYSTICK_STATE \
+        GLFW_LINUX_LIBRARY_JOYSTICK_STATE
+
+#define GLFW_PLATFORM_CONTEXT_STATE \
+        GLFW_WGL_CONTEXT_STATE \
+        GLFW_NSGL_CONTEXT_STATE \
+        GLFW_GLX_CONTEXT_STATE
+
+#define GLFW_PLATFORM_LIBRARY_CONTEXT_STATE \
+        GLFW_WGL_LIBRARY_CONTEXT_STATE \
+        GLFW_NSGL_LIBRARY_CONTEXT_STATE \
+        GLFW_GLX_LIBRARY_CONTEXT_STATE
+
+#if defined(_WIN32)
+ #define GLFW_BUILD_WIN32_THREAD
+#else
+ #define GLFW_BUILD_POSIX_THREAD
+#endif
+
+#if defined(GLFW_BUILD_WIN32_THREAD)
+ #include "win32_thread.h"
+ #define GLFW_PLATFORM_TLS_STATE    GLFW_WIN32_TLS_STATE
+ #define GLFW_PLATFORM_MUTEX_STATE  GLFW_WIN32_MUTEX_STATE
+#elif defined(GLFW_BUILD_POSIX_THREAD)
+ #include "posix_thread.h"
+ #define GLFW_PLATFORM_TLS_STATE    GLFW_POSIX_TLS_STATE
+ #define GLFW_PLATFORM_MUTEX_STATE  GLFW_POSIX_MUTEX_STATE
+#endif
+
+#if defined(_WIN32)
+ #define GLFW_BUILD_WIN32_TIMER
+#elif defined(__APPLE__)
+ #define GLFW_BUILD_COCOA_TIMER
+#else
+ #define GLFW_BUILD_POSIX_TIMER
+#endif
+
+#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_POSIX_TIMER)
+ #include "posix_time.h"
+ #define GLFW_PLATFORM_LIBRARY_TIMER_STATE  GLFW_POSIX_LIBRARY_TIMER_STATE
+#endif
+
+#if defined(_WIN32)
+ #define GLFW_BUILD_WIN32_MODULE
+#else
+ #define GLFW_BUILD_POSIX_MODULE
+#endif
+
+#if defined(_GLFW_WAYLAND) || defined(_GLFW_X11)
+ #define GLFW_BUILD_POSIX_POLL
+#endif
+
diff --git a/src/posix_module.c b/src/posix_module.c
new file mode 100644
index 0000000..7d81c67
--- /dev/null
+++ b/src/posix_module.c
@@ -0,0 +1,53 @@
+//========================================================================
+// GLFW 3.4 POSIX - www.glfw.org
+//------------------------------------------------------------------------
+// Copyright (c) 2021 Camilla Löwy <elmindreda@glfw.org>
+//
+// 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.
+//
+//========================================================================
+
+#include "internal.h"
+
+#if defined(GLFW_BUILD_POSIX_MODULE)
+
+#include <dlfcn.h>
+
+//////////////////////////////////////////////////////////////////////////
+//////                       GLFW platform API                      //////
+//////////////////////////////////////////////////////////////////////////
+
+void* _glfwPlatformLoadModule(const char* path)
+{
+    return dlopen(path, RTLD_LAZY | RTLD_LOCAL);
+}
+
+void _glfwPlatformFreeModule(void* module)
+{
+    dlclose(module);
+}
+
+GLFWproc _glfwPlatformGetModuleSymbol(void* module, const char* name)
+{
+    return dlsym(module, name);
+}
+
+#endif // GLFW_BUILD_POSIX_MODULE
+
diff --git a/src/posix_poll.c b/src/posix_poll.c
new file mode 100644
index 0000000..b53e36e
--- /dev/null
+++ b/src/posix_poll.c
@@ -0,0 +1,83 @@
+//========================================================================
+// GLFW 3.4 POSIX - www.glfw.org
+//------------------------------------------------------------------------
+// Copyright (c) 2022 Camilla Löwy <elmindreda@glfw.org>
+//
+// 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 _GNU_SOURCE
+
+#include "internal.h"
+
+#if defined(GLFW_BUILD_POSIX_POLL)
+
+#include <signal.h>
+#include <time.h>
+#include <errno.h>
+
+GLFWbool _glfwPollPOSIX(struct pollfd* fds, nfds_t count, double* timeout)
+{
+    for (;;)
+    {
+        if (timeout)
+        {
+            const uint64_t base = _glfwPlatformGetTimerValue();
+
+#if defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__CYGWIN__)
+            const time_t seconds = (time_t) *timeout;
+            const long nanoseconds = (long) ((*timeout - seconds) * 1e9);
+            const struct timespec ts = { seconds, nanoseconds };
+            const int result = ppoll(fds, count, &ts, NULL);
+#elif defined(__NetBSD__)
+            const time_t seconds = (time_t) *timeout;
+            const long nanoseconds = (long) ((*timeout - seconds) * 1e9);
+            const struct timespec ts = { seconds, nanoseconds };
+            const int result = pollts(fds, count, &ts, NULL);
+#else
+            const int milliseconds = (int) (*timeout * 1e3);
+            const int result = poll(fds, count, milliseconds);
+#endif
+            const int error = errno; // clock_gettime may overwrite our error
+
+            *timeout -= (_glfwPlatformGetTimerValue() - base) /
+                (double) _glfwPlatformGetTimerFrequency();
+
+            if (result > 0)
+                return GLFW_TRUE;
+            else if (result == -1 && error != EINTR && error != EAGAIN)
+                return GLFW_FALSE;
+            else if (*timeout <= 0.0)
+                return GLFW_FALSE;
+        }
+        else
+        {
+            const int result = poll(fds, count, -1);
+            if (result > 0)
+                return GLFW_TRUE;
+            else if (result == -1 && errno != EINTR && errno != EAGAIN)
+                return GLFW_FALSE;
+        }
+    }
+}
+
+#endif // GLFW_BUILD_POSIX_POLL
+
diff --git a/src/posix_poll.h b/src/posix_poll.h
new file mode 100644
index 0000000..4bdd244
--- /dev/null
+++ b/src/posix_poll.h
@@ -0,0 +1,30 @@
+//========================================================================
+// GLFW 3.4 POSIX - www.glfw.org
+//------------------------------------------------------------------------
+// Copyright (c) 2022 Camilla Löwy <elmindreda@glfw.org>
+//
+// 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.
+//
+//========================================================================
+
+#include <poll.h>
+
+GLFWbool _glfwPollPOSIX(struct pollfd* fds, nfds_t count, double* timeout);
+
diff --git a/src/posix_thread.c b/src/posix_thread.c
index f1697dc..3c355a5 100644
--- a/src/posix_thread.c
+++ b/src/posix_thread.c
@@ -1,5 +1,5 @@
 //========================================================================
-// GLFW 3.3 POSIX - www.glfw.org
+// GLFW 3.4 POSIX - www.glfw.org
 //------------------------------------------------------------------------
 // Copyright (c) 2002-2006 Marcus Geelnard
 // Copyright (c) 2006-2017 Camilla Löwy <elmindreda@glfw.org>
@@ -24,11 +24,11 @@
 //    distribution.
 //
 //========================================================================
-// It is fine to use C99 in this file because it will not be built with VS
-//========================================================================
 
 #include "internal.h"
 
+#if defined(GLFW_BUILD_POSIX_THREAD)
+
 #include <assert.h>
 #include <string.h>
 
@@ -103,3 +103,5 @@
     pthread_mutex_unlock(&mutex->posix.handle);
 }
 
+#endif // GLFW_BUILD_POSIX_THREAD
+
diff --git a/src/posix_thread.h b/src/posix_thread.h
index 1c6a5c4..5a5d7b7 100644
--- a/src/posix_thread.h
+++ b/src/posix_thread.h
@@ -1,5 +1,5 @@
 //========================================================================
-// GLFW 3.3 POSIX - www.glfw.org
+// GLFW 3.4 POSIX - www.glfw.org
 //------------------------------------------------------------------------
 // Copyright (c) 2002-2006 Marcus Geelnard
 // Copyright (c) 2006-2017 Camilla Löwy <elmindreda@glfw.org>
@@ -27,8 +27,8 @@
 
 #include <pthread.h>
 
-#define _GLFW_PLATFORM_TLS_STATE    _GLFWtlsPOSIX   posix
-#define _GLFW_PLATFORM_MUTEX_STATE  _GLFWmutexPOSIX posix
+#define GLFW_POSIX_TLS_STATE    _GLFWtlsPOSIX   posix;
+#define GLFW_POSIX_MUTEX_STATE  _GLFWmutexPOSIX posix;
 
 
 // POSIX-specific thread local storage data
diff --git a/src/posix_time.c b/src/posix_time.c
index 040c8f1..a172408 100644
--- a/src/posix_time.c
+++ b/src/posix_time.c
@@ -1,5 +1,5 @@
 //========================================================================
-// GLFW 3.3 POSIX - www.glfw.org
+// GLFW 3.4 POSIX - www.glfw.org
 //------------------------------------------------------------------------
 // Copyright (c) 2002-2006 Marcus Geelnard
 // Copyright (c) 2006-2017 Camilla Löwy <elmindreda@glfw.org>
@@ -24,60 +24,36 @@
 //    distribution.
 //
 //========================================================================
-// It is fine to use C99 in this file because it will not be built with VS
-//========================================================================
 
 #include "internal.h"
 
+#if defined(GLFW_BUILD_POSIX_TIMER)
+
+#include <unistd.h>
 #include <sys/time.h>
-#include <time.h>
-
-
-//////////////////////////////////////////////////////////////////////////
-//////                       GLFW internal API                      //////
-//////////////////////////////////////////////////////////////////////////
-
-// Initialise timer
-//
-void _glfwInitTimerPOSIX(void)
-{
-#if defined(CLOCK_MONOTONIC)
-    struct timespec ts;
-
-    if (clock_gettime(CLOCK_MONOTONIC, &ts) == 0)
-    {
-        _glfw.timer.posix.monotonic = GLFW_TRUE;
-        _glfw.timer.posix.frequency = 1000000000;
-    }
-    else
-#endif
-    {
-        _glfw.timer.posix.monotonic = GLFW_FALSE;
-        _glfw.timer.posix.frequency = 1000000;
-    }
-}
 
 
 //////////////////////////////////////////////////////////////////////////
 //////                       GLFW platform API                      //////
 //////////////////////////////////////////////////////////////////////////
 
+void _glfwPlatformInitTimer(void)
+{
+    _glfw.timer.posix.clock = CLOCK_REALTIME;
+    _glfw.timer.posix.frequency = 1000000000;
+
+#if defined(_POSIX_MONOTONIC_CLOCK)
+    struct timespec ts;
+    if (clock_gettime(CLOCK_MONOTONIC, &ts) == 0)
+        _glfw.timer.posix.clock = CLOCK_MONOTONIC;
+#endif
+}
+
 uint64_t _glfwPlatformGetTimerValue(void)
 {
-#if defined(CLOCK_MONOTONIC)
-    if (_glfw.timer.posix.monotonic)
-    {
-        struct timespec ts;
-        clock_gettime(CLOCK_MONOTONIC, &ts);
-        return (uint64_t) ts.tv_sec * (uint64_t) 1000000000 + (uint64_t) ts.tv_nsec;
-    }
-    else
-#endif
-    {
-        struct timeval tv;
-        gettimeofday(&tv, NULL);
-        return (uint64_t) tv.tv_sec * (uint64_t) 1000000 + (uint64_t) tv.tv_usec;
-    }
+    struct timespec ts;
+    clock_gettime(_glfw.timer.posix.clock, &ts);
+    return (uint64_t) ts.tv_sec * _glfw.timer.posix.frequency + (uint64_t) ts.tv_nsec;
 }
 
 uint64_t _glfwPlatformGetTimerFrequency(void)
@@ -85,3 +61,5 @@
     return _glfw.timer.posix.frequency;
 }
 
+#endif // GLFW_BUILD_POSIX_TIMER
+
diff --git a/src/posix_time.h b/src/posix_time.h
index 911399e..94374ad 100644
--- a/src/posix_time.h
+++ b/src/posix_time.h
@@ -1,5 +1,5 @@
 //========================================================================
-// GLFW 3.3 POSIX - www.glfw.org
+// GLFW 3.4 POSIX - www.glfw.org
 //------------------------------------------------------------------------
 // Copyright (c) 2002-2006 Marcus Geelnard
 // Copyright (c) 2006-2017 Camilla Löwy <elmindreda@glfw.org>
@@ -25,19 +25,17 @@
 //
 //========================================================================
 
-#define _GLFW_PLATFORM_LIBRARY_TIMER_STATE _GLFWtimerPOSIX posix
+#define GLFW_POSIX_LIBRARY_TIMER_STATE _GLFWtimerPOSIX posix;
 
 #include <stdint.h>
+#include <time.h>
 
 
 // POSIX-specific global timer data
 //
 typedef struct _GLFWtimerPOSIX
 {
-    GLFWbool    monotonic;
+    clockid_t   clock;
     uint64_t    frequency;
 } _GLFWtimerPOSIX;
 
-
-void _glfwInitTimerPOSIX(void);
-
diff --git a/src/vulkan.c b/src/vulkan.c
index 1b96579..d9fabde 100644
--- a/src/vulkan.c
+++ b/src/vulkan.c
@@ -1,5 +1,5 @@
 //========================================================================
-// GLFW 3.3 - www.glfw.org
+// GLFW 3.4 - www.glfw.org
 //------------------------------------------------------------------------
 // Copyright (c) 2002-2006 Marcus Geelnard
 // Copyright (c) 2006-2018 Camilla Löwy <elmindreda@glfw.org>
@@ -24,8 +24,6 @@
 //    distribution.
 //
 //========================================================================
-// Please use C89 style variable declarations in this file because VS 2010
-//========================================================================
 
 #include "internal.h"
 
@@ -45,47 +43,52 @@
 {
     VkResult err;
     VkExtensionProperties* ep;
+    PFN_vkEnumerateInstanceExtensionProperties vkEnumerateInstanceExtensionProperties;
     uint32_t i, count;
 
     if (_glfw.vk.available)
         return GLFW_TRUE;
 
-#if !defined(_GLFW_VULKAN_STATIC)
+    if (_glfw.hints.init.vulkanLoader)
+        _glfw.vk.GetInstanceProcAddr = _glfw.hints.init.vulkanLoader;
+    else
+    {
 #if defined(_GLFW_VULKAN_LIBRARY)
-    _glfw.vk.handle = _glfw_dlopen(_GLFW_VULKAN_LIBRARY);
+        _glfw.vk.handle = _glfwPlatformLoadModule(_GLFW_VULKAN_LIBRARY);
 #elif defined(_GLFW_WIN32)
-    _glfw.vk.handle = _glfw_dlopen("vulkan-1.dll");
+        _glfw.vk.handle = _glfwPlatformLoadModule("vulkan-1.dll");
 #elif defined(_GLFW_COCOA)
-    _glfw.vk.handle = _glfw_dlopen("libvulkan.1.dylib");
-    if (!_glfw.vk.handle)
-        _glfw.vk.handle = _glfwLoadLocalVulkanLoaderNS();
+        _glfw.vk.handle = _glfwPlatformLoadModule("libvulkan.1.dylib");
+        if (!_glfw.vk.handle)
+            _glfw.vk.handle = _glfwLoadLocalVulkanLoaderCocoa();
 #elif defined(__OpenBSD__) || defined(__NetBSD__)
-    _glfw.vk.handle = _glfw_dlopen("libvulkan.so");
+        _glfw.vk.handle = _glfwPlatformLoadModule("libvulkan.so");
 #else
-    _glfw.vk.handle = _glfw_dlopen("libvulkan.so.1");
+        _glfw.vk.handle = _glfwPlatformLoadModule("libvulkan.so.1");
 #endif
-    if (!_glfw.vk.handle)
-    {
-        if (mode == _GLFW_REQUIRE_LOADER)
-            _glfwInputError(GLFW_API_UNAVAILABLE, "Vulkan: Loader not found");
+        if (!_glfw.vk.handle)
+        {
+            if (mode == _GLFW_REQUIRE_LOADER)
+                _glfwInputError(GLFW_API_UNAVAILABLE, "Vulkan: Loader not found");
 
-        return GLFW_FALSE;
+            return GLFW_FALSE;
+        }
+
+        _glfw.vk.GetInstanceProcAddr = (PFN_vkGetInstanceProcAddr)
+            _glfwPlatformGetModuleSymbol(_glfw.vk.handle, "vkGetInstanceProcAddr");
+        if (!_glfw.vk.GetInstanceProcAddr)
+        {
+            _glfwInputError(GLFW_API_UNAVAILABLE,
+                            "Vulkan: Loader does not export vkGetInstanceProcAddr");
+
+            _glfwTerminateVulkan();
+            return GLFW_FALSE;
+        }
     }
 
-    _glfw.vk.GetInstanceProcAddr = (PFN_vkGetInstanceProcAddr)
-        _glfw_dlsym(_glfw.vk.handle, "vkGetInstanceProcAddr");
-    if (!_glfw.vk.GetInstanceProcAddr)
-    {
-        _glfwInputError(GLFW_API_UNAVAILABLE,
-                        "Vulkan: Loader does not export vkGetInstanceProcAddr");
-
-        _glfwTerminateVulkan();
-        return GLFW_FALSE;
-    }
-
-    _glfw.vk.EnumerateInstanceExtensionProperties = (PFN_vkEnumerateInstanceExtensionProperties)
+    vkEnumerateInstanceExtensionProperties = (PFN_vkEnumerateInstanceExtensionProperties)
         vkGetInstanceProcAddr(NULL, "vkEnumerateInstanceExtensionProperties");
-    if (!_glfw.vk.EnumerateInstanceExtensionProperties)
+    if (!vkEnumerateInstanceExtensionProperties)
     {
         _glfwInputError(GLFW_API_UNAVAILABLE,
                         "Vulkan: Failed to retrieve vkEnumerateInstanceExtensionProperties");
@@ -93,7 +96,6 @@
         _glfwTerminateVulkan();
         return GLFW_FALSE;
     }
-#endif // _GLFW_VULKAN_STATIC
 
     err = vkEnumerateInstanceExtensionProperties(NULL, &count, NULL);
     if (err)
@@ -110,7 +112,7 @@
         return GLFW_FALSE;
     }
 
-    ep = calloc(count, sizeof(VkExtensionProperties));
+    ep = _glfw_calloc(count, sizeof(VkExtensionProperties));
 
     err = vkEnumerateInstanceExtensionProperties(NULL, &count, ep);
     if (err)
@@ -119,7 +121,7 @@
                         "Vulkan: Failed to query instance extensions: %s",
                         _glfwGetVulkanResultString(err));
 
-        free(ep);
+        _glfw_free(ep);
         _glfwTerminateVulkan();
         return GLFW_FALSE;
     }
@@ -128,40 +130,33 @@
     {
         if (strcmp(ep[i].extensionName, "VK_KHR_surface") == 0)
             _glfw.vk.KHR_surface = GLFW_TRUE;
-#if defined(_GLFW_WIN32)
         else if (strcmp(ep[i].extensionName, "VK_KHR_win32_surface") == 0)
             _glfw.vk.KHR_win32_surface = GLFW_TRUE;
-#elif defined(_GLFW_COCOA)
         else if (strcmp(ep[i].extensionName, "VK_MVK_macos_surface") == 0)
             _glfw.vk.MVK_macos_surface = GLFW_TRUE;
         else if (strcmp(ep[i].extensionName, "VK_EXT_metal_surface") == 0)
             _glfw.vk.EXT_metal_surface = GLFW_TRUE;
-#elif defined(_GLFW_X11)
         else if (strcmp(ep[i].extensionName, "VK_KHR_xlib_surface") == 0)
             _glfw.vk.KHR_xlib_surface = GLFW_TRUE;
         else if (strcmp(ep[i].extensionName, "VK_KHR_xcb_surface") == 0)
             _glfw.vk.KHR_xcb_surface = GLFW_TRUE;
-#elif defined(_GLFW_WAYLAND)
         else if (strcmp(ep[i].extensionName, "VK_KHR_wayland_surface") == 0)
             _glfw.vk.KHR_wayland_surface = GLFW_TRUE;
-#endif
     }
 
-    free(ep);
+    _glfw_free(ep);
 
     _glfw.vk.available = GLFW_TRUE;
 
-    _glfwPlatformGetRequiredInstanceExtensions(_glfw.vk.extensions);
+    _glfw.platform.getRequiredInstanceExtensions(_glfw.vk.extensions);
 
     return GLFW_TRUE;
 }
 
 void _glfwTerminateVulkan(void)
 {
-#if !defined(_GLFW_VULKAN_STATIC)
     if (_glfw.vk.handle)
-        _glfw_dlclose(_glfw.vk.handle);
-#endif
+        _glfwPlatformFreeModule(_glfw.vk.handle);
 }
 
 const char* _glfwGetVulkanResultString(VkResult result)
@@ -259,17 +254,16 @@
     if (!_glfwInitVulkan(_GLFW_REQUIRE_LOADER))
         return NULL;
 
+    // NOTE: Vulkan 1.0 and 1.1 vkGetInstanceProcAddr cannot return itself
+    if (strcmp(procname, "vkGetInstanceProcAddr") == 0)
+        return (GLFWvkproc) vkGetInstanceProcAddr;
+
     proc = (GLFWvkproc) vkGetInstanceProcAddr(instance, procname);
-#if defined(_GLFW_VULKAN_STATIC)
     if (!proc)
     {
-        if (strcmp(procname, "vkGetInstanceProcAddr") == 0)
-            return (GLFWvkproc) vkGetInstanceProcAddr;
+        if (_glfw.vk.handle)
+            proc = (GLFWvkproc) _glfwPlatformGetModuleSymbol(_glfw.vk.handle, procname);
     }
-#else
-    if (!proc)
-        proc = (GLFWvkproc) _glfw_dlsym(_glfw.vk.handle, procname);
-#endif
 
     return proc;
 }
@@ -293,9 +287,9 @@
         return GLFW_FALSE;
     }
 
-    return _glfwPlatformGetPhysicalDevicePresentationSupport(instance,
-                                                             device,
-                                                             queuefamily);
+    return _glfw.platform.getPhysicalDevicePresentationSupport(instance,
+                                                               device,
+                                                               queuefamily);
 }
 
 GLFWAPI VkResult glfwCreateWindowSurface(VkInstance instance,
@@ -329,6 +323,6 @@
         return VK_ERROR_NATIVE_WINDOW_IN_USE_KHR;
     }
 
-    return _glfwPlatformCreateWindowSurface(instance, window, allocator, surface);
+    return _glfw.platform.createWindowSurface(instance, window, allocator, surface);
 }
 
diff --git a/src/wgl_context.c b/src/wgl_context.c
index b245b29..8a23ffc 100644
--- a/src/wgl_context.c
+++ b/src/wgl_context.c
@@ -1,5 +1,5 @@
 //========================================================================
-// GLFW 3.3 WGL - www.glfw.org
+// GLFW 3.4 WGL - www.glfw.org
 //------------------------------------------------------------------------
 // Copyright (c) 2002-2006 Marcus Geelnard
 // Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.org>
@@ -24,21 +24,20 @@
 //    distribution.
 //
 //========================================================================
-// Please use C89 style variable declarations in this file because VS 2010
-//========================================================================
 
 #include "internal.h"
 
+#if defined(_GLFW_WIN32)
+
 #include <stdlib.h>
-#include <malloc.h>
 #include <assert.h>
 
 // Return the value corresponding to the specified attribute
 //
-static int findPixelFormatAttribValue(const int* attribs,
-                                      int attribCount,
-                                      const int* values,
-                                      int attrib)
+static int findPixelFormatAttribValueWGL(const int* attribs,
+                                         int attribCount,
+                                         const int* values,
+                                         int attrib)
 {
     int i;
 
@@ -53,19 +52,19 @@
     return 0;
 }
 
-#define addAttrib(a) \
+#define ADD_ATTRIB(a) \
 { \
     assert((size_t) attribCount < sizeof(attribs) / sizeof(attribs[0])); \
     attribs[attribCount++] = a; \
 }
-#define findAttribValue(a) \
-    findPixelFormatAttribValue(attribs, attribCount, values, a)
+#define FIND_ATTRIB_VALUE(a) \
+    findPixelFormatAttribValueWGL(attribs, attribCount, values, a)
 
 // Return a list of available and usable framebuffer configs
 //
-static int choosePixelFormat(_GLFWwindow* window,
-                             const _GLFWctxconfig* ctxconfig,
-                             const _GLFWfbconfig* fbconfig)
+static int choosePixelFormatWGL(_GLFWwindow* window,
+                                const _GLFWctxconfig* ctxconfig,
+                                const _GLFWfbconfig* fbconfig)
 {
     _GLFWfbconfig* usableConfigs;
     const _GLFWfbconfig* closest;
@@ -80,6 +79,43 @@
 
     if (_glfw.wgl.ARB_pixel_format)
     {
+        ADD_ATTRIB(WGL_SUPPORT_OPENGL_ARB);
+        ADD_ATTRIB(WGL_DRAW_TO_WINDOW_ARB);
+        ADD_ATTRIB(WGL_PIXEL_TYPE_ARB);
+        ADD_ATTRIB(WGL_ACCELERATION_ARB);
+        ADD_ATTRIB(WGL_RED_BITS_ARB);
+        ADD_ATTRIB(WGL_RED_SHIFT_ARB);
+        ADD_ATTRIB(WGL_GREEN_BITS_ARB);
+        ADD_ATTRIB(WGL_GREEN_SHIFT_ARB);
+        ADD_ATTRIB(WGL_BLUE_BITS_ARB);
+        ADD_ATTRIB(WGL_BLUE_SHIFT_ARB);
+        ADD_ATTRIB(WGL_ALPHA_BITS_ARB);
+        ADD_ATTRIB(WGL_ALPHA_SHIFT_ARB);
+        ADD_ATTRIB(WGL_DEPTH_BITS_ARB);
+        ADD_ATTRIB(WGL_STENCIL_BITS_ARB);
+        ADD_ATTRIB(WGL_ACCUM_BITS_ARB);
+        ADD_ATTRIB(WGL_ACCUM_RED_BITS_ARB);
+        ADD_ATTRIB(WGL_ACCUM_GREEN_BITS_ARB);
+        ADD_ATTRIB(WGL_ACCUM_BLUE_BITS_ARB);
+        ADD_ATTRIB(WGL_ACCUM_ALPHA_BITS_ARB);
+        ADD_ATTRIB(WGL_AUX_BUFFERS_ARB);
+        ADD_ATTRIB(WGL_STEREO_ARB);
+        ADD_ATTRIB(WGL_DOUBLE_BUFFER_ARB);
+
+        if (_glfw.wgl.ARB_multisample)
+            ADD_ATTRIB(WGL_SAMPLES_ARB);
+
+        if (ctxconfig->client == GLFW_OPENGL_API)
+        {
+            if (_glfw.wgl.ARB_framebuffer_sRGB || _glfw.wgl.EXT_framebuffer_sRGB)
+                ADD_ATTRIB(WGL_FRAMEBUFFER_SRGB_CAPABLE_ARB);
+        }
+        else
+        {
+            if (_glfw.wgl.EXT_colorspace)
+                ADD_ATTRIB(WGL_COLORSPACE_EXT);
+        }
+
         // NOTE: In a Parallels VM WGL_ARB_pixel_format returns fewer pixel formats than
         //       DescribePixelFormat, violating the guarantees of the extension spec
         // HACK: Iterate through the minimum of both counts
@@ -96,46 +132,9 @@
         }
 
         nativeCount = _glfw_min(nativeCount, extensionCount);
-
-        addAttrib(WGL_SUPPORT_OPENGL_ARB);
-        addAttrib(WGL_DRAW_TO_WINDOW_ARB);
-        addAttrib(WGL_PIXEL_TYPE_ARB);
-        addAttrib(WGL_ACCELERATION_ARB);
-        addAttrib(WGL_RED_BITS_ARB);
-        addAttrib(WGL_RED_SHIFT_ARB);
-        addAttrib(WGL_GREEN_BITS_ARB);
-        addAttrib(WGL_GREEN_SHIFT_ARB);
-        addAttrib(WGL_BLUE_BITS_ARB);
-        addAttrib(WGL_BLUE_SHIFT_ARB);
-        addAttrib(WGL_ALPHA_BITS_ARB);
-        addAttrib(WGL_ALPHA_SHIFT_ARB);
-        addAttrib(WGL_DEPTH_BITS_ARB);
-        addAttrib(WGL_STENCIL_BITS_ARB);
-        addAttrib(WGL_ACCUM_BITS_ARB);
-        addAttrib(WGL_ACCUM_RED_BITS_ARB);
-        addAttrib(WGL_ACCUM_GREEN_BITS_ARB);
-        addAttrib(WGL_ACCUM_BLUE_BITS_ARB);
-        addAttrib(WGL_ACCUM_ALPHA_BITS_ARB);
-        addAttrib(WGL_AUX_BUFFERS_ARB);
-        addAttrib(WGL_STEREO_ARB);
-        addAttrib(WGL_DOUBLE_BUFFER_ARB);
-
-        if (_glfw.wgl.ARB_multisample)
-            addAttrib(WGL_SAMPLES_ARB);
-
-        if (ctxconfig->client == GLFW_OPENGL_API)
-        {
-            if (_glfw.wgl.ARB_framebuffer_sRGB || _glfw.wgl.EXT_framebuffer_sRGB)
-                addAttrib(WGL_FRAMEBUFFER_SRGB_CAPABLE_ARB);
-        }
-        else
-        {
-            if (_glfw.wgl.EXT_colorspace)
-                addAttrib(WGL_COLORSPACE_EXT);
-        }
     }
 
-    usableConfigs = calloc(nativeCount, sizeof(_GLFWfbconfig));
+    usableConfigs = _glfw_calloc(nativeCount, sizeof(_GLFWfbconfig));
 
     for (i = 0;  i < nativeCount;  i++)
     {
@@ -154,52 +153,52 @@
                 _glfwInputErrorWin32(GLFW_PLATFORM_ERROR,
                                     "WGL: Failed to retrieve pixel format attributes");
 
-                free(usableConfigs);
+                _glfw_free(usableConfigs);
                 return 0;
             }
 
-            if (!findAttribValue(WGL_SUPPORT_OPENGL_ARB) ||
-                !findAttribValue(WGL_DRAW_TO_WINDOW_ARB))
+            if (!FIND_ATTRIB_VALUE(WGL_SUPPORT_OPENGL_ARB) ||
+                !FIND_ATTRIB_VALUE(WGL_DRAW_TO_WINDOW_ARB))
             {
                 continue;
             }
 
-            if (findAttribValue(WGL_PIXEL_TYPE_ARB) != WGL_TYPE_RGBA_ARB)
+            if (FIND_ATTRIB_VALUE(WGL_PIXEL_TYPE_ARB) != WGL_TYPE_RGBA_ARB)
                 continue;
 
-            if (findAttribValue(WGL_ACCELERATION_ARB) == WGL_NO_ACCELERATION_ARB)
+            if (FIND_ATTRIB_VALUE(WGL_ACCELERATION_ARB) == WGL_NO_ACCELERATION_ARB)
                 continue;
 
-            if (findAttribValue(WGL_DOUBLE_BUFFER_ARB) != fbconfig->doublebuffer)
+            if (FIND_ATTRIB_VALUE(WGL_DOUBLE_BUFFER_ARB) != fbconfig->doublebuffer)
                 continue;
 
-            u->redBits = findAttribValue(WGL_RED_BITS_ARB);
-            u->greenBits = findAttribValue(WGL_GREEN_BITS_ARB);
-            u->blueBits = findAttribValue(WGL_BLUE_BITS_ARB);
-            u->alphaBits = findAttribValue(WGL_ALPHA_BITS_ARB);
+            u->redBits = FIND_ATTRIB_VALUE(WGL_RED_BITS_ARB);
+            u->greenBits = FIND_ATTRIB_VALUE(WGL_GREEN_BITS_ARB);
+            u->blueBits = FIND_ATTRIB_VALUE(WGL_BLUE_BITS_ARB);
+            u->alphaBits = FIND_ATTRIB_VALUE(WGL_ALPHA_BITS_ARB);
 
-            u->depthBits = findAttribValue(WGL_DEPTH_BITS_ARB);
-            u->stencilBits = findAttribValue(WGL_STENCIL_BITS_ARB);
+            u->depthBits = FIND_ATTRIB_VALUE(WGL_DEPTH_BITS_ARB);
+            u->stencilBits = FIND_ATTRIB_VALUE(WGL_STENCIL_BITS_ARB);
 
-            u->accumRedBits = findAttribValue(WGL_ACCUM_RED_BITS_ARB);
-            u->accumGreenBits = findAttribValue(WGL_ACCUM_GREEN_BITS_ARB);
-            u->accumBlueBits = findAttribValue(WGL_ACCUM_BLUE_BITS_ARB);
-            u->accumAlphaBits = findAttribValue(WGL_ACCUM_ALPHA_BITS_ARB);
+            u->accumRedBits = FIND_ATTRIB_VALUE(WGL_ACCUM_RED_BITS_ARB);
+            u->accumGreenBits = FIND_ATTRIB_VALUE(WGL_ACCUM_GREEN_BITS_ARB);
+            u->accumBlueBits = FIND_ATTRIB_VALUE(WGL_ACCUM_BLUE_BITS_ARB);
+            u->accumAlphaBits = FIND_ATTRIB_VALUE(WGL_ACCUM_ALPHA_BITS_ARB);
 
-            u->auxBuffers = findAttribValue(WGL_AUX_BUFFERS_ARB);
+            u->auxBuffers = FIND_ATTRIB_VALUE(WGL_AUX_BUFFERS_ARB);
 
-            if (findAttribValue(WGL_STEREO_ARB))
+            if (FIND_ATTRIB_VALUE(WGL_STEREO_ARB))
                 u->stereo = GLFW_TRUE;
 
             if (_glfw.wgl.ARB_multisample)
-                u->samples = findAttribValue(WGL_SAMPLES_ARB);
+                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 (findAttribValue(WGL_FRAMEBUFFER_SRGB_CAPABLE_ARB))
+                    if (FIND_ATTRIB_VALUE(WGL_FRAMEBUFFER_SRGB_CAPABLE_ARB))
                         u->sRGB = GLFW_TRUE;
                 }
             }
@@ -207,7 +206,7 @@
             {
                 if (_glfw.wgl.EXT_colorspace)
                 {
-                    if (findAttribValue(WGL_COLORSPACE_EXT) == WGL_COLORSPACE_SRGB_EXT)
+                    if (FIND_ATTRIB_VALUE(WGL_COLORSPACE_EXT) == WGL_COLORSPACE_SRGB_EXT)
                         u->sRGB = GLFW_TRUE;
                 }
             }
@@ -226,7 +225,7 @@
                 _glfwInputErrorWin32(GLFW_PLATFORM_ERROR,
                                     "WGL: Failed to describe pixel format");
 
-                free(usableConfigs);
+                _glfw_free(usableConfigs);
                 return 0;
             }
 
@@ -276,7 +275,7 @@
         _glfwInputError(GLFW_API_UNAVAILABLE,
                         "WGL: The driver does not appear to support OpenGL");
 
-        free(usableConfigs);
+        _glfw_free(usableConfigs);
         return 0;
     }
 
@@ -286,18 +285,18 @@
         _glfwInputError(GLFW_FORMAT_UNAVAILABLE,
                         "WGL: Failed to find a suitable pixel format");
 
-        free(usableConfigs);
+        _glfw_free(usableConfigs);
         return 0;
     }
 
     pixelFormat = (int) closest->handle;
-    free(usableConfigs);
+    _glfw_free(usableConfigs);
 
     return pixelFormat;
 }
 
-#undef addAttrib
-#undef findAttribValue
+#undef ADD_ATTRIB
+#undef FIND_ATTRIB_VALUE
 
 static void makeContextCurrentWGL(_GLFWwindow* window)
 {
@@ -328,14 +327,12 @@
 {
     if (!window->monitor)
     {
-        if (IsWindowsVistaOrGreater())
+        // HACK: Use DwmFlush when desktop composition is enabled on Windows Vista and 7
+        if (!IsWindows8OrGreater() && IsWindowsVistaOrGreater())
         {
-            // DWM Composition is always enabled on Win8+
-            BOOL enabled = IsWindows8OrGreater();
+            BOOL enabled = FALSE;
 
-            // HACK: Use DwmFlush when desktop composition is enabled
-            if (enabled ||
-                (SUCCEEDED(DwmIsCompositionEnabled(&enabled)) && enabled))
+            if (SUCCEEDED(DwmIsCompositionEnabled(&enabled)) && enabled)
             {
                 int count = abs(window->context.wgl.interval);
                 while (count--)
@@ -356,15 +353,13 @@
 
     if (!window->monitor)
     {
-        if (IsWindowsVistaOrGreater())
+        // HACK: Disable WGL swap interval when desktop composition is enabled on Windows
+        //       Vista and 7 to avoid interfering with DWM vsync
+        if (!IsWindows8OrGreater() && IsWindowsVistaOrGreater())
         {
-            // DWM Composition is always enabled on Win8+
-            BOOL enabled = IsWindows8OrGreater();
+            BOOL enabled = FALSE;
 
-            // HACK: Disable WGL swap interval when desktop composition is enabled to
-            //       avoid interfering with DWM vsync
-            if (enabled ||
-                (SUCCEEDED(DwmIsCompositionEnabled(&enabled)) && enabled))
+            if (SUCCEEDED(DwmIsCompositionEnabled(&enabled)) && enabled)
                 interval = 0;
         }
     }
@@ -394,7 +389,7 @@
     if (proc)
         return proc;
 
-    return (GLFWglproc) GetProcAddress(_glfw.wgl.instance, procname);
+    return (GLFWglproc) _glfwPlatformGetModuleSymbol(_glfw.wgl.instance, procname);
 }
 
 static void destroyContextWGL(_GLFWwindow* window)
@@ -406,11 +401,6 @@
     }
 }
 
-
-//////////////////////////////////////////////////////////////////////////
-//////                       GLFW internal API                      //////
-//////////////////////////////////////////////////////////////////////////
-
 // Initialize WGL
 //
 GLFWbool _glfwInitWGL(void)
@@ -422,7 +412,7 @@
     if (_glfw.wgl.instance)
         return GLFW_TRUE;
 
-    _glfw.wgl.instance = LoadLibraryA("opengl32.dll");
+    _glfw.wgl.instance = _glfwPlatformLoadModule("opengl32.dll");
     if (!_glfw.wgl.instance)
     {
         _glfwInputErrorWin32(GLFW_PLATFORM_ERROR,
@@ -431,19 +421,19 @@
     }
 
     _glfw.wgl.CreateContext = (PFN_wglCreateContext)
-        GetProcAddress(_glfw.wgl.instance, "wglCreateContext");
+        _glfwPlatformGetModuleSymbol(_glfw.wgl.instance, "wglCreateContext");
     _glfw.wgl.DeleteContext = (PFN_wglDeleteContext)
-        GetProcAddress(_glfw.wgl.instance, "wglDeleteContext");
+        _glfwPlatformGetModuleSymbol(_glfw.wgl.instance, "wglDeleteContext");
     _glfw.wgl.GetProcAddress = (PFN_wglGetProcAddress)
-        GetProcAddress(_glfw.wgl.instance, "wglGetProcAddress");
+        _glfwPlatformGetModuleSymbol(_glfw.wgl.instance, "wglGetProcAddress");
     _glfw.wgl.GetCurrentDC = (PFN_wglGetCurrentDC)
-        GetProcAddress(_glfw.wgl.instance, "wglGetCurrentDC");
+        _glfwPlatformGetModuleSymbol(_glfw.wgl.instance, "wglGetCurrentDC");
     _glfw.wgl.GetCurrentContext = (PFN_wglGetCurrentContext)
-        GetProcAddress(_glfw.wgl.instance, "wglGetCurrentContext");
+        _glfwPlatformGetModuleSymbol(_glfw.wgl.instance, "wglGetCurrentContext");
     _glfw.wgl.MakeCurrent = (PFN_wglMakeCurrent)
-        GetProcAddress(_glfw.wgl.instance, "wglMakeCurrent");
+        _glfwPlatformGetModuleSymbol(_glfw.wgl.instance, "wglMakeCurrent");
     _glfw.wgl.ShareLists = (PFN_wglShareLists)
-        GetProcAddress(_glfw.wgl.instance, "wglShareLists");
+        _glfwPlatformGetModuleSymbol(_glfw.wgl.instance, "wglShareLists");
 
     // NOTE: A dummy context has to be created for opengl32.dll to load the
     //       OpenGL ICD, from which we can then query WGL extensions
@@ -536,10 +526,10 @@
 void _glfwTerminateWGL(void)
 {
     if (_glfw.wgl.instance)
-        FreeLibrary(_glfw.wgl.instance);
+        _glfwPlatformFreeModule(_glfw.wgl.instance);
 }
 
-#define setAttrib(a, v) \
+#define SET_ATTRIB(a, v) \
 { \
     assert(((size_t) index + 1) < sizeof(attribs) / sizeof(attribs[0])); \
     attribs[index++] = a; \
@@ -568,7 +558,7 @@
         return GLFW_FALSE;
     }
 
-    pixelFormat = choosePixelFormat(window, ctxconfig, fbconfig);
+    pixelFormat = choosePixelFormatWGL(window, ctxconfig, fbconfig);
     if (!pixelFormat)
         return GLFW_FALSE;
 
@@ -647,13 +637,13 @@
             {
                 if (ctxconfig->robustness == GLFW_NO_RESET_NOTIFICATION)
                 {
-                    setAttrib(WGL_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB,
-                              WGL_NO_RESET_NOTIFICATION_ARB);
+                    SET_ATTRIB(WGL_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB,
+                               WGL_NO_RESET_NOTIFICATION_ARB);
                 }
                 else if (ctxconfig->robustness == GLFW_LOSE_CONTEXT_ON_RESET)
                 {
-                    setAttrib(WGL_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB,
-                              WGL_LOSE_CONTEXT_ON_RESET_ARB);
+                    SET_ATTRIB(WGL_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB,
+                               WGL_LOSE_CONTEXT_ON_RESET_ARB);
                 }
 
                 flags |= WGL_CONTEXT_ROBUST_ACCESS_BIT_ARB;
@@ -666,13 +656,13 @@
             {
                 if (ctxconfig->release == GLFW_RELEASE_BEHAVIOR_NONE)
                 {
-                    setAttrib(WGL_CONTEXT_RELEASE_BEHAVIOR_ARB,
-                              WGL_CONTEXT_RELEASE_BEHAVIOR_NONE_ARB);
+                    SET_ATTRIB(WGL_CONTEXT_RELEASE_BEHAVIOR_ARB,
+                               WGL_CONTEXT_RELEASE_BEHAVIOR_NONE_ARB);
                 }
                 else if (ctxconfig->release == GLFW_RELEASE_BEHAVIOR_FLUSH)
                 {
-                    setAttrib(WGL_CONTEXT_RELEASE_BEHAVIOR_ARB,
-                              WGL_CONTEXT_RELEASE_BEHAVIOR_FLUSH_ARB);
+                    SET_ATTRIB(WGL_CONTEXT_RELEASE_BEHAVIOR_ARB,
+                               WGL_CONTEXT_RELEASE_BEHAVIOR_FLUSH_ARB);
                 }
             }
         }
@@ -680,7 +670,7 @@
         if (ctxconfig->noerror)
         {
             if (_glfw.wgl.ARB_create_context_no_error)
-                setAttrib(WGL_CONTEXT_OPENGL_NO_ERROR_ARB, GLFW_TRUE);
+                SET_ATTRIB(WGL_CONTEXT_OPENGL_NO_ERROR_ARB, GLFW_TRUE);
         }
 
         // NOTE: Only request an explicitly versioned context when necessary, as
@@ -688,17 +678,17 @@
         //       highest version supported by the driver
         if (ctxconfig->major != 1 || ctxconfig->minor != 0)
         {
-            setAttrib(WGL_CONTEXT_MAJOR_VERSION_ARB, ctxconfig->major);
-            setAttrib(WGL_CONTEXT_MINOR_VERSION_ARB, ctxconfig->minor);
+            SET_ATTRIB(WGL_CONTEXT_MAJOR_VERSION_ARB, ctxconfig->major);
+            SET_ATTRIB(WGL_CONTEXT_MINOR_VERSION_ARB, ctxconfig->minor);
         }
 
         if (flags)
-            setAttrib(WGL_CONTEXT_FLAGS_ARB, flags);
+            SET_ATTRIB(WGL_CONTEXT_FLAGS_ARB, flags);
 
         if (mask)
-            setAttrib(WGL_CONTEXT_PROFILE_MASK_ARB, mask);
+            SET_ATTRIB(WGL_CONTEXT_PROFILE_MASK_ARB, mask);
 
-        setAttrib(0, 0);
+        SET_ATTRIB(0, 0);
 
         window->context.wgl.handle =
             wglCreateContextAttribsARB(window->context.wgl.dc, share, attribs);
@@ -781,18 +771,20 @@
     return GLFW_TRUE;
 }
 
-#undef setAttrib
-
-
-//////////////////////////////////////////////////////////////////////////
-//////                        GLFW native API                       //////
-//////////////////////////////////////////////////////////////////////////
+#undef SET_ATTRIB
 
 GLFWAPI HGLRC glfwGetWGLContext(GLFWwindow* handle)
 {
     _GLFWwindow* window = (_GLFWwindow*) handle;
     _GLFW_REQUIRE_INIT_OR_RETURN(NULL);
 
+    if (_glfw.platform.platformID != GLFW_PLATFORM_WIN32)
+    {
+        _glfwInputError(GLFW_PLATFORM_UNAVAILABLE,
+                        "WGL: Platform not initialized");
+        return NULL;
+    }
+
     if (window->context.source != GLFW_NATIVE_CONTEXT_API)
     {
         _glfwInputError(GLFW_NO_WINDOW_CONTEXT, NULL);
@@ -802,3 +794,5 @@
     return window->context.wgl.handle;
 }
 
+#endif // _GLFW_WIN32
+
diff --git a/src/wgl_context.h b/src/wgl_context.h
deleted file mode 100644
index 47f0459..0000000
--- a/src/wgl_context.h
+++ /dev/null
@@ -1,158 +0,0 @@
-//========================================================================
-// GLFW 3.3 WGL - www.glfw.org
-//------------------------------------------------------------------------
-// Copyright (c) 2002-2006 Marcus Geelnard
-// Copyright (c) 2006-2018 Camilla Löwy <elmindreda@glfw.org>
-//
-// 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 WGL_NUMBER_PIXEL_FORMATS_ARB 0x2000
-#define WGL_SUPPORT_OPENGL_ARB 0x2010
-#define WGL_DRAW_TO_WINDOW_ARB 0x2001
-#define WGL_PIXEL_TYPE_ARB 0x2013
-#define WGL_TYPE_RGBA_ARB 0x202b
-#define WGL_ACCELERATION_ARB 0x2003
-#define WGL_NO_ACCELERATION_ARB 0x2025
-#define WGL_RED_BITS_ARB 0x2015
-#define WGL_RED_SHIFT_ARB 0x2016
-#define WGL_GREEN_BITS_ARB 0x2017
-#define WGL_GREEN_SHIFT_ARB 0x2018
-#define WGL_BLUE_BITS_ARB 0x2019
-#define WGL_BLUE_SHIFT_ARB 0x201a
-#define WGL_ALPHA_BITS_ARB 0x201b
-#define WGL_ALPHA_SHIFT_ARB 0x201c
-#define WGL_ACCUM_BITS_ARB 0x201d
-#define WGL_ACCUM_RED_BITS_ARB 0x201e
-#define WGL_ACCUM_GREEN_BITS_ARB 0x201f
-#define WGL_ACCUM_BLUE_BITS_ARB 0x2020
-#define WGL_ACCUM_ALPHA_BITS_ARB 0x2021
-#define WGL_DEPTH_BITS_ARB 0x2022
-#define WGL_STENCIL_BITS_ARB 0x2023
-#define WGL_AUX_BUFFERS_ARB 0x2024
-#define WGL_STEREO_ARB 0x2012
-#define WGL_DOUBLE_BUFFER_ARB 0x2011
-#define WGL_SAMPLES_ARB 0x2042
-#define WGL_FRAMEBUFFER_SRGB_CAPABLE_ARB 0x20a9
-#define WGL_CONTEXT_DEBUG_BIT_ARB 0x00000001
-#define WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x00000002
-#define WGL_CONTEXT_PROFILE_MASK_ARB 0x9126
-#define WGL_CONTEXT_CORE_PROFILE_BIT_ARB 0x00000001
-#define WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB 0x00000002
-#define WGL_CONTEXT_MAJOR_VERSION_ARB 0x2091
-#define WGL_CONTEXT_MINOR_VERSION_ARB 0x2092
-#define WGL_CONTEXT_FLAGS_ARB 0x2094
-#define WGL_CONTEXT_ES2_PROFILE_BIT_EXT 0x00000004
-#define WGL_CONTEXT_ROBUST_ACCESS_BIT_ARB 0x00000004
-#define WGL_LOSE_CONTEXT_ON_RESET_ARB 0x8252
-#define WGL_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB 0x8256
-#define WGL_NO_RESET_NOTIFICATION_ARB 0x8261
-#define WGL_CONTEXT_RELEASE_BEHAVIOR_ARB 0x2097
-#define WGL_CONTEXT_RELEASE_BEHAVIOR_NONE_ARB 0
-#define WGL_CONTEXT_RELEASE_BEHAVIOR_FLUSH_ARB 0x2098
-#define WGL_CONTEXT_OPENGL_NO_ERROR_ARB 0x31b3
-#define WGL_COLORSPACE_EXT 0x309d
-#define WGL_COLORSPACE_SRGB_EXT 0x3089
-
-#define ERROR_INVALID_VERSION_ARB 0x2095
-#define ERROR_INVALID_PROFILE_ARB 0x2096
-#define ERROR_INCOMPATIBLE_DEVICE_CONTEXTS_ARB 0x2054
-
-// WGL extension pointer typedefs
-typedef BOOL (WINAPI * PFNWGLSWAPINTERVALEXTPROC)(int);
-typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBIVARBPROC)(HDC,int,int,UINT,const int*,int*);
-typedef const char* (WINAPI * PFNWGLGETEXTENSIONSSTRINGEXTPROC)(void);
-typedef const char* (WINAPI * PFNWGLGETEXTENSIONSSTRINGARBPROC)(HDC);
-typedef HGLRC (WINAPI * PFNWGLCREATECONTEXTATTRIBSARBPROC)(HDC,HGLRC,const int*);
-#define wglSwapIntervalEXT _glfw.wgl.SwapIntervalEXT
-#define wglGetPixelFormatAttribivARB _glfw.wgl.GetPixelFormatAttribivARB
-#define wglGetExtensionsStringEXT _glfw.wgl.GetExtensionsStringEXT
-#define wglGetExtensionsStringARB _glfw.wgl.GetExtensionsStringARB
-#define wglCreateContextAttribsARB _glfw.wgl.CreateContextAttribsARB
-
-// opengl32.dll function pointer typedefs
-typedef HGLRC (WINAPI * PFN_wglCreateContext)(HDC);
-typedef BOOL (WINAPI * PFN_wglDeleteContext)(HGLRC);
-typedef PROC (WINAPI * PFN_wglGetProcAddress)(LPCSTR);
-typedef HDC (WINAPI * PFN_wglGetCurrentDC)(void);
-typedef HGLRC (WINAPI * PFN_wglGetCurrentContext)(void);
-typedef BOOL (WINAPI * PFN_wglMakeCurrent)(HDC,HGLRC);
-typedef BOOL (WINAPI * PFN_wglShareLists)(HGLRC,HGLRC);
-#define wglCreateContext _glfw.wgl.CreateContext
-#define wglDeleteContext _glfw.wgl.DeleteContext
-#define wglGetProcAddress _glfw.wgl.GetProcAddress
-#define wglGetCurrentDC _glfw.wgl.GetCurrentDC
-#define wglGetCurrentContext _glfw.wgl.GetCurrentContext
-#define wglMakeCurrent _glfw.wgl.MakeCurrent
-#define wglShareLists _glfw.wgl.ShareLists
-
-#define _GLFW_PLATFORM_CONTEXT_STATE            _GLFWcontextWGL wgl
-#define _GLFW_PLATFORM_LIBRARY_CONTEXT_STATE    _GLFWlibraryWGL wgl
-
-
-// WGL-specific per-context data
-//
-typedef struct _GLFWcontextWGL
-{
-    HDC       dc;
-    HGLRC     handle;
-    int       interval;
-} _GLFWcontextWGL;
-
-// WGL-specific global data
-//
-typedef struct _GLFWlibraryWGL
-{
-    HINSTANCE                           instance;
-    PFN_wglCreateContext                CreateContext;
-    PFN_wglDeleteContext                DeleteContext;
-    PFN_wglGetProcAddress               GetProcAddress;
-    PFN_wglGetCurrentDC                 GetCurrentDC;
-    PFN_wglGetCurrentContext            GetCurrentContext;
-    PFN_wglMakeCurrent                  MakeCurrent;
-    PFN_wglShareLists                   ShareLists;
-
-    PFNWGLSWAPINTERVALEXTPROC           SwapIntervalEXT;
-    PFNWGLGETPIXELFORMATATTRIBIVARBPROC GetPixelFormatAttribivARB;
-    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;
-} _GLFWlibraryWGL;
-
-
-GLFWbool _glfwInitWGL(void);
-void _glfwTerminateWGL(void);
-GLFWbool _glfwCreateContextWGL(_GLFWwindow* window,
-                               const _GLFWctxconfig* ctxconfig,
-                               const _GLFWfbconfig* fbconfig);
-
diff --git a/src/win32_init.c b/src/win32_init.c
index 885f32f..824e383 100644
--- a/src/win32_init.c
+++ b/src/win32_init.c
@@ -1,5 +1,5 @@
 //========================================================================
-// GLFW 3.3 Win32 - www.glfw.org
+// GLFW 3.4 Win32 - www.glfw.org
 //------------------------------------------------------------------------
 // Copyright (c) 2002-2006 Marcus Geelnard
 // Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.org>
@@ -24,13 +24,12 @@
 //    distribution.
 //
 //========================================================================
-// Please use C89 style variable declarations in this file because VS 2010
-//========================================================================
 
 #include "internal.h"
 
+#if defined(_GLFW_WIN32)
+
 #include <stdlib.h>
-#include <malloc.h>
 
 static const GUID _glfw_GUID_DEVINTERFACE_HID =
     {0x4d1e55b2,0xf16f,0x11cf,{0x88,0xcb,0x00,0x11,0x11,0x00,0x00,0x30}};
@@ -82,7 +81,7 @@
         return GLFW_FALSE;
     }
 
-    _glfw.win32.user32.instance = LoadLibraryA("user32.dll");
+    _glfw.win32.user32.instance = _glfwPlatformLoadModule("user32.dll");
     if (!_glfw.win32.user32.instance)
     {
         _glfwInputErrorWin32(GLFW_PLATFORM_ERROR,
@@ -91,25 +90,25 @@
     }
 
     _glfw.win32.user32.SetProcessDPIAware_ = (PFN_SetProcessDPIAware)
-        GetProcAddress(_glfw.win32.user32.instance, "SetProcessDPIAware");
+        _glfwPlatformGetModuleSymbol(_glfw.win32.user32.instance, "SetProcessDPIAware");
     _glfw.win32.user32.ChangeWindowMessageFilterEx_ = (PFN_ChangeWindowMessageFilterEx)
-        GetProcAddress(_glfw.win32.user32.instance, "ChangeWindowMessageFilterEx");
+        _glfwPlatformGetModuleSymbol(_glfw.win32.user32.instance, "ChangeWindowMessageFilterEx");
     _glfw.win32.user32.EnableNonClientDpiScaling_ = (PFN_EnableNonClientDpiScaling)
-        GetProcAddress(_glfw.win32.user32.instance, "EnableNonClientDpiScaling");
+        _glfwPlatformGetModuleSymbol(_glfw.win32.user32.instance, "EnableNonClientDpiScaling");
     _glfw.win32.user32.SetProcessDpiAwarenessContext_ = (PFN_SetProcessDpiAwarenessContext)
-        GetProcAddress(_glfw.win32.user32.instance, "SetProcessDpiAwarenessContext");
+        _glfwPlatformGetModuleSymbol(_glfw.win32.user32.instance, "SetProcessDpiAwarenessContext");
     _glfw.win32.user32.GetDpiForWindow_ = (PFN_GetDpiForWindow)
-        GetProcAddress(_glfw.win32.user32.instance, "GetDpiForWindow");
+        _glfwPlatformGetModuleSymbol(_glfw.win32.user32.instance, "GetDpiForWindow");
     _glfw.win32.user32.AdjustWindowRectExForDpi_ = (PFN_AdjustWindowRectExForDpi)
-        GetProcAddress(_glfw.win32.user32.instance, "AdjustWindowRectExForDpi");
+        _glfwPlatformGetModuleSymbol(_glfw.win32.user32.instance, "AdjustWindowRectExForDpi");
     _glfw.win32.user32.GetSystemMetricsForDpi_ = (PFN_GetSystemMetricsForDpi)
-        GetProcAddress(_glfw.win32.user32.instance, "GetSystemMetricsForDpi");
+        _glfwPlatformGetModuleSymbol(_glfw.win32.user32.instance, "GetSystemMetricsForDpi");
 
-    _glfw.win32.dinput8.instance = LoadLibraryA("dinput8.dll");
+    _glfw.win32.dinput8.instance = _glfwPlatformLoadModule("dinput8.dll");
     if (_glfw.win32.dinput8.instance)
     {
         _glfw.win32.dinput8.Create = (PFN_DirectInput8Create)
-            GetProcAddress(_glfw.win32.dinput8.instance, "DirectInput8Create");
+            _glfwPlatformGetModuleSymbol(_glfw.win32.dinput8.instance, "DirectInput8Create");
     }
 
     {
@@ -126,46 +125,46 @@
 
         for (i = 0;  names[i];  i++)
         {
-            _glfw.win32.xinput.instance = LoadLibraryA(names[i]);
+            _glfw.win32.xinput.instance = _glfwPlatformLoadModule(names[i]);
             if (_glfw.win32.xinput.instance)
             {
                 _glfw.win32.xinput.GetCapabilities = (PFN_XInputGetCapabilities)
-                    GetProcAddress(_glfw.win32.xinput.instance, "XInputGetCapabilities");
+                    _glfwPlatformGetModuleSymbol(_glfw.win32.xinput.instance, "XInputGetCapabilities");
                 _glfw.win32.xinput.GetState = (PFN_XInputGetState)
-                    GetProcAddress(_glfw.win32.xinput.instance, "XInputGetState");
+                    _glfwPlatformGetModuleSymbol(_glfw.win32.xinput.instance, "XInputGetState");
 
                 break;
             }
         }
     }
 
-    _glfw.win32.dwmapi.instance = LoadLibraryA("dwmapi.dll");
+    _glfw.win32.dwmapi.instance = _glfwPlatformLoadModule("dwmapi.dll");
     if (_glfw.win32.dwmapi.instance)
     {
         _glfw.win32.dwmapi.IsCompositionEnabled = (PFN_DwmIsCompositionEnabled)
-            GetProcAddress(_glfw.win32.dwmapi.instance, "DwmIsCompositionEnabled");
+            _glfwPlatformGetModuleSymbol(_glfw.win32.dwmapi.instance, "DwmIsCompositionEnabled");
         _glfw.win32.dwmapi.Flush = (PFN_DwmFlush)
-            GetProcAddress(_glfw.win32.dwmapi.instance, "DwmFlush");
+            _glfwPlatformGetModuleSymbol(_glfw.win32.dwmapi.instance, "DwmFlush");
         _glfw.win32.dwmapi.EnableBlurBehindWindow = (PFN_DwmEnableBlurBehindWindow)
-            GetProcAddress(_glfw.win32.dwmapi.instance, "DwmEnableBlurBehindWindow");
+            _glfwPlatformGetModuleSymbol(_glfw.win32.dwmapi.instance, "DwmEnableBlurBehindWindow");
         _glfw.win32.dwmapi.GetColorizationColor = (PFN_DwmGetColorizationColor)
-            GetProcAddress(_glfw.win32.dwmapi.instance, "DwmGetColorizationColor");
+            _glfwPlatformGetModuleSymbol(_glfw.win32.dwmapi.instance, "DwmGetColorizationColor");
     }
 
-    _glfw.win32.shcore.instance = LoadLibraryA("shcore.dll");
+    _glfw.win32.shcore.instance = _glfwPlatformLoadModule("shcore.dll");
     if (_glfw.win32.shcore.instance)
     {
         _glfw.win32.shcore.SetProcessDpiAwareness_ = (PFN_SetProcessDpiAwareness)
-            GetProcAddress(_glfw.win32.shcore.instance, "SetProcessDpiAwareness");
+            _glfwPlatformGetModuleSymbol(_glfw.win32.shcore.instance, "SetProcessDpiAwareness");
         _glfw.win32.shcore.GetDpiForMonitor_ = (PFN_GetDpiForMonitor)
-            GetProcAddress(_glfw.win32.shcore.instance, "GetDpiForMonitor");
+            _glfwPlatformGetModuleSymbol(_glfw.win32.shcore.instance, "GetDpiForMonitor");
     }
 
-    _glfw.win32.ntdll.instance = LoadLibraryA("ntdll.dll");
+    _glfw.win32.ntdll.instance = _glfwPlatformLoadModule("ntdll.dll");
     if (_glfw.win32.ntdll.instance)
     {
         _glfw.win32.ntdll.RtlVerifyVersionInfo_ = (PFN_RtlVerifyVersionInfo)
-            GetProcAddress(_glfw.win32.ntdll.instance, "RtlVerifyVersionInfo");
+            _glfwPlatformGetModuleSymbol(_glfw.win32.ntdll.instance, "RtlVerifyVersionInfo");
     }
 
     return GLFW_TRUE;
@@ -176,22 +175,22 @@
 static void freeLibraries(void)
 {
     if (_glfw.win32.xinput.instance)
-        FreeLibrary(_glfw.win32.xinput.instance);
+        _glfwPlatformFreeModule(_glfw.win32.xinput.instance);
 
     if (_glfw.win32.dinput8.instance)
-        FreeLibrary(_glfw.win32.dinput8.instance);
+        _glfwPlatformFreeModule(_glfw.win32.dinput8.instance);
 
     if (_glfw.win32.user32.instance)
-        FreeLibrary(_glfw.win32.user32.instance);
+        _glfwPlatformFreeModule(_glfw.win32.user32.instance);
 
     if (_glfw.win32.dwmapi.instance)
-        FreeLibrary(_glfw.win32.dwmapi.instance);
+        _glfwPlatformFreeModule(_glfw.win32.dwmapi.instance);
 
     if (_glfw.win32.shcore.instance)
-        FreeLibrary(_glfw.win32.shcore.instance);
+        _glfwPlatformFreeModule(_glfw.win32.shcore.instance);
 
     if (_glfw.win32.ntdll.instance)
-        FreeLibrary(_glfw.win32.ntdll.instance);
+        _glfwPlatformFreeModule(_glfw.win32.ntdll.instance);
 }
 
 // Create key code translation tables
@@ -332,15 +331,64 @@
     }
 }
 
+// Window procedure for the hidden helper window
+//
+static LRESULT CALLBACK helperWindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
+{
+    switch (uMsg)
+    {
+        case WM_DISPLAYCHANGE:
+            _glfwPollMonitorsWin32();
+            break;
+
+        case WM_DEVICECHANGE:
+        {
+            if (!_glfw.joysticksInitialized)
+                break;
+
+            if (wParam == DBT_DEVICEARRIVAL)
+            {
+                DEV_BROADCAST_HDR* dbh = (DEV_BROADCAST_HDR*) lParam;
+                if (dbh && dbh->dbch_devicetype == DBT_DEVTYP_DEVICEINTERFACE)
+                    _glfwDetectJoystickConnectionWin32();
+            }
+            else if (wParam == DBT_DEVICEREMOVECOMPLETE)
+            {
+                DEV_BROADCAST_HDR* dbh = (DEV_BROADCAST_HDR*) lParam;
+                if (dbh && dbh->dbch_devicetype == DBT_DEVTYP_DEVICEINTERFACE)
+                    _glfwDetectJoystickDisconnectionWin32();
+            }
+
+            break;
+        }
+    }
+
+    return DefWindowProcW(hWnd, uMsg, wParam, lParam);
+}
+
 // Creates a dummy window for behind-the-scenes work
 //
 static GLFWbool createHelperWindow(void)
 {
     MSG msg;
+    WNDCLASSEXW wc = { sizeof(wc) };
+
+    wc.style         = CS_OWNDC;
+    wc.lpfnWndProc   = (WNDPROC) helperWindowProc;
+    wc.hInstance     = _glfw.win32.instance;
+    wc.lpszClassName = L"GLFW3 Helper";
+
+    _glfw.win32.helperWindowClass = RegisterClassExW(&wc);
+    if (!_glfw.win32.helperWindowClass)
+    {
+        _glfwInputErrorWin32(GLFW_PLATFORM_ERROR,
+                             "Win32: Failed to register helper window class");
+        return GLFW_FALSE;
+    }
 
     _glfw.win32.helperWindowHandle =
         CreateWindowExW(WS_EX_OVERLAPPEDWINDOW,
-                        _GLFW_WNDCLASSNAME,
+                        MAKEINTATOM(_glfw.win32.helperWindowClass),
                         L"GLFW message window",
                         WS_CLIPSIBLINGS | WS_CLIPCHILDREN,
                         0, 0, 1, 1,
@@ -382,7 +430,6 @@
    return GLFW_TRUE;
 }
 
-
 //////////////////////////////////////////////////////////////////////////
 //////                       GLFW internal API                      //////
 //////////////////////////////////////////////////////////////////////////
@@ -402,13 +449,13 @@
         return NULL;
     }
 
-    target = calloc(count, sizeof(WCHAR));
+    target = _glfw_calloc(count, sizeof(WCHAR));
 
     if (!MultiByteToWideChar(CP_UTF8, 0, source, -1, target, count))
     {
         _glfwInputErrorWin32(GLFW_PLATFORM_ERROR,
                              "Win32: Failed to convert string from UTF-8");
-        free(target);
+        _glfw_free(target);
         return NULL;
     }
 
@@ -430,13 +477,13 @@
         return NULL;
     }
 
-    target = calloc(size, 1);
+    target = _glfw_calloc(size, 1);
 
     if (!WideCharToMultiByte(CP_UTF8, 0, source, -1, target, size, NULL, NULL))
     {
         _glfwInputErrorWin32(GLFW_PLATFORM_ERROR,
                              "Win32: Failed to convert string to UTF-8");
-        free(target);
+        _glfw_free(target);
         return NULL;
     }
 
@@ -551,88 +598,134 @@
     return RtlVerifyVersionInfo(&osvi, mask, cond) == 0;
 }
 
-
-//////////////////////////////////////////////////////////////////////////
-//////                       GLFW platform API                      //////
-//////////////////////////////////////////////////////////////////////////
-
-int _glfwPlatformInit(void)
+GLFWbool _glfwConnectWin32(int platformID, _GLFWplatform* platform)
 {
-    // To make SetForegroundWindow work as we want, we need to fiddle
-    // with the FOREGROUNDLOCKTIMEOUT system setting (we do this as early
-    // as possible in the hope of still being the foreground process)
-    SystemParametersInfoW(SPI_GETFOREGROUNDLOCKTIMEOUT, 0,
-                          &_glfw.win32.foregroundLockTimeout, 0);
-    SystemParametersInfoW(SPI_SETFOREGROUNDLOCKTIMEOUT, 0, UIntToPtr(0),
-                          SPIF_SENDCHANGE);
+    const _GLFWplatform win32 =
+    {
+        .platformID = GLFW_PLATFORM_WIN32,
+        .init = _glfwInitWin32,
+        .terminate = _glfwTerminateWin32,
+        .getCursorPos = _glfwGetCursorPosWin32,
+        .setCursorPos = _glfwSetCursorPosWin32,
+        .setCursorMode = _glfwSetCursorModeWin32,
+        .setRawMouseMotion = _glfwSetRawMouseMotionWin32,
+        .rawMouseMotionSupported = _glfwRawMouseMotionSupportedWin32,
+        .createCursor = _glfwCreateCursorWin32,
+        .createStandardCursor = _glfwCreateStandardCursorWin32,
+        .destroyCursor = _glfwDestroyCursorWin32,
+        .setCursor = _glfwSetCursorWin32,
+        .getScancodeName = _glfwGetScancodeNameWin32,
+        .getKeyScancode = _glfwGetKeyScancodeWin32,
+        .setClipboardString = _glfwSetClipboardStringWin32,
+        .getClipboardString = _glfwGetClipboardStringWin32,
+        .initJoysticks = _glfwInitJoysticksWin32,
+        .terminateJoysticks = _glfwTerminateJoysticksWin32,
+        .pollJoystick = _glfwPollJoystickWin32,
+        .getMappingName = _glfwGetMappingNameWin32,
+        .updateGamepadGUID = _glfwUpdateGamepadGUIDWin32,
+        .freeMonitor = _glfwFreeMonitorWin32,
+        .getMonitorPos = _glfwGetMonitorPosWin32,
+        .getMonitorContentScale = _glfwGetMonitorContentScaleWin32,
+        .getMonitorWorkarea = _glfwGetMonitorWorkareaWin32,
+        .getVideoModes = _glfwGetVideoModesWin32,
+        .getVideoMode = _glfwGetVideoModeWin32,
+        .getGammaRamp = _glfwGetGammaRampWin32,
+        .setGammaRamp = _glfwSetGammaRampWin32,
+        .createWindow = _glfwCreateWindowWin32,
+        .destroyWindow = _glfwDestroyWindowWin32,
+        .setWindowTitle = _glfwSetWindowTitleWin32,
+        .setWindowIcon = _glfwSetWindowIconWin32,
+        .getWindowPos = _glfwGetWindowPosWin32,
+        .setWindowPos = _glfwSetWindowPosWin32,
+        .getWindowSize = _glfwGetWindowSizeWin32,
+        .setWindowSize = _glfwSetWindowSizeWin32,
+        .setWindowSizeLimits = _glfwSetWindowSizeLimitsWin32,
+        .setWindowAspectRatio = _glfwSetWindowAspectRatioWin32,
+        .getFramebufferSize = _glfwGetFramebufferSizeWin32,
+        .getWindowFrameSize = _glfwGetWindowFrameSizeWin32,
+        .getWindowContentScale = _glfwGetWindowContentScaleWin32,
+        .iconifyWindow = _glfwIconifyWindowWin32,
+        .restoreWindow = _glfwRestoreWindowWin32,
+        .maximizeWindow = _glfwMaximizeWindowWin32,
+        .showWindow = _glfwShowWindowWin32,
+        .hideWindow = _glfwHideWindowWin32,
+        .requestWindowAttention = _glfwRequestWindowAttentionWin32,
+        .focusWindow = _glfwFocusWindowWin32,
+        .setWindowMonitor = _glfwSetWindowMonitorWin32,
+        .windowFocused = _glfwWindowFocusedWin32,
+        .windowIconified = _glfwWindowIconifiedWin32,
+        .windowVisible = _glfwWindowVisibleWin32,
+        .windowMaximized = _glfwWindowMaximizedWin32,
+        .windowHovered = _glfwWindowHoveredWin32,
+        .framebufferTransparent = _glfwFramebufferTransparentWin32,
+        .getWindowOpacity = _glfwGetWindowOpacityWin32,
+        .setWindowResizable = _glfwSetWindowResizableWin32,
+        .setWindowDecorated = _glfwSetWindowDecoratedWin32,
+        .setWindowFloating = _glfwSetWindowFloatingWin32,
+        .setWindowOpacity = _glfwSetWindowOpacityWin32,
+        .setWindowMousePassthrough = _glfwSetWindowMousePassthroughWin32,
+        .pollEvents = _glfwPollEventsWin32,
+        .waitEvents = _glfwWaitEventsWin32,
+        .waitEventsTimeout = _glfwWaitEventsTimeoutWin32,
+        .postEmptyEvent = _glfwPostEmptyEventWin32,
+        .getEGLPlatform = _glfwGetEGLPlatformWin32,
+        .getEGLNativeDisplay = _glfwGetEGLNativeDisplayWin32,
+        .getEGLNativeWindow = _glfwGetEGLNativeWindowWin32,
+        .getRequiredInstanceExtensions = _glfwGetRequiredInstanceExtensionsWin32,
+        .getPhysicalDevicePresentationSupport = _glfwGetPhysicalDevicePresentationSupportWin32,
+        .createWindowSurface = _glfwCreateWindowSurfaceWin32
+    };
 
+    *platform = win32;
+    return GLFW_TRUE;
+}
+
+int _glfwInitWin32(void)
+{
     if (!loadLibraries())
         return GLFW_FALSE;
 
     createKeyTables();
     _glfwUpdateKeyNamesWin32();
 
-    if (_glfwIsWindows10CreatorsUpdateOrGreaterWin32())
+    if (_glfwIsWindows10Version1703OrGreaterWin32())
         SetProcessDpiAwarenessContext(DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2);
     else if (IsWindows8Point1OrGreater())
         SetProcessDpiAwareness(PROCESS_PER_MONITOR_DPI_AWARE);
     else if (IsWindowsVistaOrGreater())
         SetProcessDPIAware();
 
-    if (!_glfwRegisterWindowClassWin32())
-        return GLFW_FALSE;
-
     if (!createHelperWindow())
         return GLFW_FALSE;
 
-    _glfwInitTimerWin32();
-    _glfwInitJoysticksWin32();
-
     _glfwPollMonitorsWin32();
     return GLFW_TRUE;
 }
 
-void _glfwPlatformTerminate(void)
+void _glfwTerminateWin32(void)
 {
+    if (_glfw.win32.blankCursor)
+        DestroyIcon((HICON) _glfw.win32.blankCursor);
+
     if (_glfw.win32.deviceNotificationHandle)
         UnregisterDeviceNotification(_glfw.win32.deviceNotificationHandle);
 
     if (_glfw.win32.helperWindowHandle)
         DestroyWindow(_glfw.win32.helperWindowHandle);
+    if (_glfw.win32.helperWindowClass)
+        UnregisterClassW(MAKEINTATOM(_glfw.win32.helperWindowClass), _glfw.win32.instance);
+    if (_glfw.win32.mainWindowClass)
+        UnregisterClassW(MAKEINTATOM(_glfw.win32.mainWindowClass), _glfw.win32.instance);
 
-    _glfwUnregisterWindowClassWin32();
-
-    // Restore previous foreground lock timeout system setting
-    SystemParametersInfoW(SPI_SETFOREGROUNDLOCKTIMEOUT, 0,
-                          UIntToPtr(_glfw.win32.foregroundLockTimeout),
-                          SPIF_SENDCHANGE);
-
-    free(_glfw.win32.clipboardString);
-    free(_glfw.win32.rawInput);
+    _glfw_free(_glfw.win32.clipboardString);
+    _glfw_free(_glfw.win32.rawInput);
 
     _glfwTerminateWGL();
     _glfwTerminateEGL();
     _glfwTerminateOSMesa();
 
-    _glfwTerminateJoysticksWin32();
-
     freeLibraries();
 }
 
-const char* _glfwPlatformGetVersionString(void)
-{
-    return _GLFW_VERSION_NUMBER " Win32 WGL EGL OSMesa"
-#if defined(__MINGW32__)
-        " MinGW"
-#elif defined(_MSC_VER)
-        " VisualC"
-#endif
-#if defined(_GLFW_USE_HYBRID_HPG) || defined(_GLFW_USE_OPTIMUS_HPG)
-        " hybrid-GPU"
-#endif
-#if defined(_GLFW_BUILD_DLL)
-        " DLL"
-#endif
-        ;
-}
+#endif // _GLFW_WIN32
 
diff --git a/src/win32_joystick.c b/src/win32_joystick.c
index 2eb25da..59389a9 100644
--- a/src/win32_joystick.c
+++ b/src/win32_joystick.c
@@ -1,5 +1,5 @@
 //========================================================================
-// GLFW 3.3 Win32 - www.glfw.org
+// GLFW 3.4 Win32 - www.glfw.org
 //------------------------------------------------------------------------
 // Copyright (c) 2002-2006 Marcus Geelnard
 // Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.org>
@@ -24,11 +24,11 @@
 //    distribution.
 //
 //========================================================================
-// Please use C89 style variable declarations in this file because VS 2010
-//========================================================================
 
 #include "internal.h"
 
+#if defined(_GLFW_WIN32)
+
 #include <stdio.h>
 #include <math.h>
 
@@ -199,11 +199,11 @@
     if (GetRawInputDeviceList(NULL, &count, sizeof(RAWINPUTDEVICELIST)) != 0)
         return GLFW_FALSE;
 
-    ridl = calloc(count, sizeof(RAWINPUTDEVICELIST));
+    ridl = _glfw_calloc(count, sizeof(RAWINPUTDEVICELIST));
 
     if (GetRawInputDeviceList(ridl, &count, sizeof(RAWINPUTDEVICELIST)) == (UINT) -1)
     {
-        free(ridl);
+        _glfw_free(ridl);
         return GLFW_FALSE;
     }
 
@@ -248,7 +248,7 @@
         }
     }
 
-    free(ridl);
+    _glfw_free(ridl);
     return result;
 }
 
@@ -264,7 +264,7 @@
         IDirectInputDevice8_Release(js->win32.device);
     }
 
-    free(js->win32.objects);
+    _glfw_free(js->win32.objects);
     _glfwFreeJoystick(js);
 }
 
@@ -416,8 +416,8 @@
 
     memset(&data, 0, sizeof(data));
     data.device = device;
-    data.objects = calloc(dc.dwAxes + (size_t) dc.dwButtons + dc.dwPOVs,
-                          sizeof(_GLFWjoyobjectWin32));
+    data.objects = _glfw_calloc(dc.dwAxes + (size_t) dc.dwButtons + dc.dwPOVs,
+                                sizeof(_GLFWjoyobjectWin32));
 
     if (FAILED(IDirectInputDevice8_EnumObjects(device,
                                                deviceObjectCallback,
@@ -428,7 +428,7 @@
                         "Win32: Failed to enumerate device objects");
 
         IDirectInputDevice8_Release(device);
-        free(data.objects);
+        _glfw_free(data.objects);
         return DIENUM_CONTINUE;
     }
 
@@ -445,7 +445,7 @@
                         "Win32: Failed to convert joystick name to UTF-8");
 
         IDirectInputDevice8_Release(device);
-        free(data.objects);
+        _glfw_free(data.objects);
         return DIENUM_STOP;
     }
 
@@ -473,7 +473,7 @@
     if (!js)
     {
         IDirectInputDevice8_Release(device);
-        free(data.objects);
+        _glfw_free(data.objects);
         return DIENUM_STOP;
     }
 
@@ -491,39 +491,6 @@
 //////                       GLFW internal API                      //////
 //////////////////////////////////////////////////////////////////////////
 
-// Initialize joystick interface
-//
-void _glfwInitJoysticksWin32(void)
-{
-    if (_glfw.win32.dinput8.instance)
-    {
-        if (FAILED(DirectInput8Create(_glfw.win32.instance,
-                                      DIRECTINPUT_VERSION,
-                                      &IID_IDirectInput8W,
-                                      (void**) &_glfw.win32.dinput8.api,
-                                      NULL)))
-        {
-            _glfwInputError(GLFW_PLATFORM_ERROR,
-                            "Win32: Failed to create interface");
-        }
-    }
-
-    _glfwDetectJoystickConnectionWin32();
-}
-
-// Close all opened joystick handles
-//
-void _glfwTerminateJoysticksWin32(void)
-{
-    int jid;
-
-    for (jid = GLFW_JOYSTICK_1;  jid <= GLFW_JOYSTICK_LAST;  jid++)
-        closeJoystick(_glfw.joysticks + jid);
-
-    if (_glfw.win32.dinput8.api)
-        IDirectInput8_Release(_glfw.win32.dinput8.api);
-}
-
 // Checks for new joysticks after DBT_DEVICEARRIVAL
 //
 void _glfwDetectJoystickConnectionWin32(void)
@@ -594,7 +561,7 @@
     {
         _GLFWjoystick* js = _glfw.joysticks + jid;
         if (js->connected)
-            _glfwPlatformPollJoystick(js, _GLFW_POLL_PRESENCE);
+            _glfwPollJoystickWin32(js, _GLFW_POLL_PRESENCE);
     }
 }
 
@@ -603,7 +570,38 @@
 //////                       GLFW platform API                      //////
 //////////////////////////////////////////////////////////////////////////
 
-int _glfwPlatformPollJoystick(_GLFWjoystick* js, int mode)
+GLFWbool _glfwInitJoysticksWin32(void)
+{
+    if (_glfw.win32.dinput8.instance)
+    {
+        if (FAILED(DirectInput8Create(_glfw.win32.instance,
+                                      DIRECTINPUT_VERSION,
+                                      &IID_IDirectInput8W,
+                                      (void**) &_glfw.win32.dinput8.api,
+                                      NULL)))
+        {
+            _glfwInputError(GLFW_PLATFORM_ERROR,
+                            "Win32: Failed to create interface");
+            return GLFW_FALSE;
+        }
+    }
+
+    _glfwDetectJoystickConnectionWin32();
+    return GLFW_TRUE;
+}
+
+void _glfwTerminateJoysticksWin32(void)
+{
+    int jid;
+
+    for (jid = GLFW_JOYSTICK_1;  jid <= GLFW_JOYSTICK_LAST;  jid++)
+        closeJoystick(_glfw.joysticks + jid);
+
+    if (_glfw.win32.dinput8.api)
+        IDirectInput8_Release(_glfw.win32.dinput8.api);
+}
+
+GLFWbool _glfwPollJoystickWin32(_GLFWjoystick* js, int mode)
 {
     if (js->win32.device)
     {
@@ -749,7 +747,12 @@
     return GLFW_TRUE;
 }
 
-void _glfwPlatformUpdateGamepadGUID(char* guid)
+const char* _glfwGetMappingNameWin32(void)
+{
+    return "Windows";
+}
+
+void _glfwUpdateGamepadGUIDWin32(char* guid)
 {
     if (strcmp(guid + 20, "504944564944") == 0)
     {
@@ -760,3 +763,5 @@
     }
 }
 
+#endif // _GLFW_WIN32
+
diff --git a/src/win32_joystick.h b/src/win32_joystick.h
index d591a82..9ab6438 100644
--- a/src/win32_joystick.h
+++ b/src/win32_joystick.h
@@ -1,5 +1,5 @@
 //========================================================================
-// GLFW 3.3 Win32 - www.glfw.org
+// GLFW 3.4 Win32 - www.glfw.org
 //------------------------------------------------------------------------
 // Copyright (c) 2006-2017 Camilla Löwy <elmindreda@glfw.org>
 //
@@ -24,11 +24,8 @@
 //
 //========================================================================
 
-#define _GLFW_PLATFORM_JOYSTICK_STATE         _GLFWjoystickWin32 win32
-#define _GLFW_PLATFORM_LIBRARY_JOYSTICK_STATE struct { int dummyLibraryJoystick; }
-
-#define _GLFW_PLATFORM_MAPPING_NAME "Windows"
-#define GLFW_BUILD_WIN32_MAPPINGS
+#define GLFW_WIN32_JOYSTICK_STATE         _GLFWjoystickWin32 win32;
+#define GLFW_WIN32_LIBRARY_JOYSTICK_STATE
 
 // Joystick element (axis, button or slider)
 //
@@ -49,9 +46,6 @@
     GUID                    guid;
 } _GLFWjoystickWin32;
 
-
-void _glfwInitJoysticksWin32(void);
-void _glfwTerminateJoysticksWin32(void);
 void _glfwDetectJoystickConnectionWin32(void);
 void _glfwDetectJoystickDisconnectionWin32(void);
 
diff --git a/src/win32_module.c b/src/win32_module.c
new file mode 100644
index 0000000..47c8dff
--- /dev/null
+++ b/src/win32_module.c
@@ -0,0 +1,51 @@
+//========================================================================
+// GLFW 3.4 Win32 - www.glfw.org
+//------------------------------------------------------------------------
+// Copyright (c) 2021 Camilla Löwy <elmindreda@glfw.org>
+//
+// 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.
+//
+//========================================================================
+
+#include "internal.h"
+
+#if defined(GLFW_BUILD_WIN32_MODULE)
+
+//////////////////////////////////////////////////////////////////////////
+//////                       GLFW platform API                      //////
+//////////////////////////////////////////////////////////////////////////
+
+void* _glfwPlatformLoadModule(const char* path)
+{
+    return LoadLibraryA(path);
+}
+
+void _glfwPlatformFreeModule(void* module)
+{
+    FreeLibrary((HMODULE) module);
+}
+
+GLFWproc _glfwPlatformGetModuleSymbol(void* module, const char* name)
+{
+    return (GLFWproc) GetProcAddress((HMODULE) module, name);
+}
+
+#endif // GLFW_BUILD_WIN32_MODULE
+
diff --git a/src/win32_monitor.c b/src/win32_monitor.c
index 67337fd..87c85b9 100644
--- a/src/win32_monitor.c
+++ b/src/win32_monitor.c
@@ -1,5 +1,5 @@
 //========================================================================
-// GLFW 3.3 Win32 - www.glfw.org
+// GLFW 3.4 Win32 - www.glfw.org
 //------------------------------------------------------------------------
 // Copyright (c) 2002-2006 Marcus Geelnard
 // Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.org>
@@ -24,15 +24,14 @@
 //    distribution.
 //
 //========================================================================
-// Please use C89 style variable declarations in this file because VS 2010
-//========================================================================
 
 #include "internal.h"
 
+#if defined(_GLFW_WIN32)
+
 #include <stdlib.h>
 #include <string.h>
 #include <limits.h>
-#include <malloc.h>
 #include <wchar.h>
 
 
@@ -96,7 +95,7 @@
     DeleteDC(dc);
 
     monitor = _glfwAllocMonitor(name, widthMM, heightMM);
-    free(name);
+    _glfw_free(name);
 
     if (adapter->StateFlags & DISPLAY_DEVICE_MODESPRUNED)
         monitor->win32.modesPruned = GLFW_TRUE;
@@ -145,7 +144,7 @@
     disconnectedCount = _glfw.monitorCount;
     if (disconnectedCount)
     {
-        disconnected = calloc(_glfw.monitorCount, sizeof(_GLFWmonitor*));
+        disconnected = _glfw_calloc(_glfw.monitorCount, sizeof(_GLFWmonitor*));
         memcpy(disconnected,
                _glfw.monitors,
                _glfw.monitorCount * sizeof(_GLFWmonitor*));
@@ -197,7 +196,7 @@
             monitor = createMonitor(&adapter, &display);
             if (!monitor)
             {
-                free(disconnected);
+                _glfw_free(disconnected);
                 return;
             }
 
@@ -227,7 +226,7 @@
             monitor = createMonitor(&adapter, NULL);
             if (!monitor)
             {
-                free(disconnected);
+                _glfw_free(disconnected);
                 return;
             }
 
@@ -241,7 +240,7 @@
             _glfwInputMonitor(disconnected[i], GLFW_DISCONNECTED, 0);
     }
 
-    free(disconnected);
+    _glfw_free(disconnected);
 }
 
 // Change the current video mode
@@ -254,7 +253,7 @@
     LONG result;
 
     best = _glfwChooseVideoMode(monitor, desired);
-    _glfwPlatformGetVideoMode(monitor, &current);
+    _glfwGetVideoModeWin32(monitor, &current);
     if (_glfwCompareVideoModes(&current, best) == 0)
         return;
 
@@ -314,7 +313,7 @@
     }
 }
 
-void _glfwGetMonitorContentScaleWin32(HMONITOR handle, float* xscale, float* yscale)
+void _glfwGetHMONITORContentScaleWin32(HMONITOR handle, float* xscale, float* yscale)
 {
     UINT xdpi, ydpi;
 
@@ -350,11 +349,11 @@
 //////                       GLFW platform API                      //////
 //////////////////////////////////////////////////////////////////////////
 
-void _glfwPlatformFreeMonitor(_GLFWmonitor* monitor)
+void _glfwFreeMonitorWin32(_GLFWmonitor* monitor)
 {
 }
 
-void _glfwPlatformGetMonitorPos(_GLFWmonitor* monitor, int* xpos, int* ypos)
+void _glfwGetMonitorPosWin32(_GLFWmonitor* monitor, int* xpos, int* ypos)
 {
     DEVMODEW dm;
     ZeroMemory(&dm, sizeof(dm));
@@ -371,15 +370,15 @@
         *ypos = dm.dmPosition.y;
 }
 
-void _glfwPlatformGetMonitorContentScale(_GLFWmonitor* monitor,
-                                         float* xscale, float* yscale)
+void _glfwGetMonitorContentScaleWin32(_GLFWmonitor* monitor,
+                                      float* xscale, float* yscale)
 {
-    _glfwGetMonitorContentScaleWin32(monitor->win32.handle, xscale, yscale);
+    _glfwGetHMONITORContentScaleWin32(monitor->win32.handle, xscale, yscale);
 }
 
-void _glfwPlatformGetMonitorWorkarea(_GLFWmonitor* monitor,
-                                     int* xpos, int* ypos,
-                                     int* width, int* height)
+void _glfwGetMonitorWorkareaWin32(_GLFWmonitor* monitor,
+                                  int* xpos, int* ypos,
+                                  int* width, int* height)
 {
     MONITORINFO mi = { sizeof(mi) };
     GetMonitorInfoW(monitor->win32.handle, &mi);
@@ -394,7 +393,7 @@
         *height = mi.rcWork.bottom - mi.rcWork.top;
 }
 
-GLFWvidmode* _glfwPlatformGetVideoModes(_GLFWmonitor* monitor, int* count)
+GLFWvidmode* _glfwGetVideoModesWin32(_GLFWmonitor* monitor, int* count)
 {
     int modeIndex = 0, size = 0;
     GLFWvidmode* result = NULL;
@@ -453,7 +452,7 @@
         if (*count == size)
         {
             size += 128;
-            result = (GLFWvidmode*) realloc(result, size * sizeof(GLFWvidmode));
+            result = (GLFWvidmode*) _glfw_realloc(result, size * sizeof(GLFWvidmode));
         }
 
         (*count)++;
@@ -463,21 +462,25 @@
     if (!*count)
     {
         // HACK: Report the current mode if no valid modes were found
-        result = calloc(1, sizeof(GLFWvidmode));
-        _glfwPlatformGetVideoMode(monitor, result);
+        result = _glfw_calloc(1, sizeof(GLFWvidmode));
+        _glfwGetVideoModeWin32(monitor, result);
         *count = 1;
     }
 
     return result;
 }
 
-void _glfwPlatformGetVideoMode(_GLFWmonitor* monitor, GLFWvidmode* mode)
+GLFWbool _glfwGetVideoModeWin32(_GLFWmonitor* monitor, GLFWvidmode* mode)
 {
     DEVMODEW dm;
     ZeroMemory(&dm, sizeof(dm));
     dm.dmSize = sizeof(dm);
 
-    EnumDisplaySettingsW(monitor->win32.adapterName, ENUM_CURRENT_SETTINGS, &dm);
+    if (!EnumDisplaySettingsW(monitor->win32.adapterName, ENUM_CURRENT_SETTINGS, &dm))
+    {
+        _glfwInputError(GLFW_PLATFORM_ERROR, "Win32: Failed to query display settings");
+        return GLFW_FALSE;
+    }
 
     mode->width  = dm.dmPelsWidth;
     mode->height = dm.dmPelsHeight;
@@ -486,9 +489,11 @@
                   &mode->redBits,
                   &mode->greenBits,
                   &mode->blueBits);
+
+    return GLFW_TRUE;
 }
 
-GLFWbool _glfwPlatformGetGammaRamp(_GLFWmonitor* monitor, GLFWgammaramp* ramp)
+GLFWbool _glfwGetGammaRampWin32(_GLFWmonitor* monitor, GLFWgammaramp* ramp)
 {
     HDC dc;
     WORD values[3][256];
@@ -506,7 +511,7 @@
     return GLFW_TRUE;
 }
 
-void _glfwPlatformSetGammaRamp(_GLFWmonitor* monitor, const GLFWgammaramp* ramp)
+void _glfwSetGammaRampWin32(_GLFWmonitor* monitor, const GLFWgammaramp* ramp)
 {
     HDC dc;
     WORD values[3][256];
@@ -536,6 +541,13 @@
 {
     _GLFWmonitor* monitor = (_GLFWmonitor*) handle;
     _GLFW_REQUIRE_INIT_OR_RETURN(NULL);
+
+    if (_glfw.platform.platformID != GLFW_PLATFORM_WIN32)
+    {
+        _glfwInputError(GLFW_PLATFORM_UNAVAILABLE, "Win32: Platform not initialized");
+        return NULL;
+    }
+
     return monitor->win32.publicAdapterName;
 }
 
@@ -543,6 +555,15 @@
 {
     _GLFWmonitor* monitor = (_GLFWmonitor*) handle;
     _GLFW_REQUIRE_INIT_OR_RETURN(NULL);
+
+    if (_glfw.platform.platformID != GLFW_PLATFORM_WIN32)
+    {
+        _glfwInputError(GLFW_PLATFORM_UNAVAILABLE, "Win32: Platform not initialized");
+        return NULL;
+    }
+
     return monitor->win32.publicDisplayName;
 }
 
+#endif // _GLFW_WIN32
+
diff --git a/src/win32_platform.h b/src/win32_platform.h
index e729709..7e3d884 100644
--- a/src/win32_platform.h
+++ b/src/win32_platform.h
@@ -1,5 +1,5 @@
 //========================================================================
-// GLFW 3.3 Win32 - www.glfw.org
+// GLFW 3.4 Win32 - www.glfw.org
 //------------------------------------------------------------------------
 // Copyright (c) 2002-2006 Marcus Geelnard
 // Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.org>
@@ -165,9 +165,6 @@
 // Replacement for versionhelpers.h macros, as we cannot rely on the
 // application having a correct embedded manifest
 //
-#define IsWindowsXPOrGreater()                                 \
-    _glfwIsWindowsVersionOrGreaterWin32(HIBYTE(_WIN32_WINNT_WINXP),   \
-                                        LOBYTE(_WIN32_WINNT_WINXP), 0)
 #define IsWindowsVistaOrGreater()                                     \
     _glfwIsWindowsVersionOrGreaterWin32(HIBYTE(_WIN32_WINNT_VISTA),   \
                                         LOBYTE(_WIN32_WINNT_VISTA), 0)
@@ -181,9 +178,11 @@
     _glfwIsWindowsVersionOrGreaterWin32(HIBYTE(_WIN32_WINNT_WINBLUE), \
                                         LOBYTE(_WIN32_WINNT_WINBLUE), 0)
 
-#define _glfwIsWindows10AnniversaryUpdateOrGreaterWin32() \
+// Windows 10 Anniversary Update
+#define _glfwIsWindows10Version1607OrGreaterWin32() \
     _glfwIsWindows10BuildOrGreaterWin32(14393)
-#define _glfwIsWindows10CreatorsUpdateOrGreaterWin32() \
+// Windows 10 Creators Update
+#define _glfwIsWindows10Version1703OrGreaterWin32() \
     _glfwIsWindows10BuildOrGreaterWin32(15063)
 
 // HACK: Define macros that some xinput.h variants don't
@@ -220,6 +219,57 @@
  #define DIDFT_OPTIONAL 0x80000000
 #endif
 
+#define WGL_NUMBER_PIXEL_FORMATS_ARB 0x2000
+#define WGL_SUPPORT_OPENGL_ARB 0x2010
+#define WGL_DRAW_TO_WINDOW_ARB 0x2001
+#define WGL_PIXEL_TYPE_ARB 0x2013
+#define WGL_TYPE_RGBA_ARB 0x202b
+#define WGL_ACCELERATION_ARB 0x2003
+#define WGL_NO_ACCELERATION_ARB 0x2025
+#define WGL_RED_BITS_ARB 0x2015
+#define WGL_RED_SHIFT_ARB 0x2016
+#define WGL_GREEN_BITS_ARB 0x2017
+#define WGL_GREEN_SHIFT_ARB 0x2018
+#define WGL_BLUE_BITS_ARB 0x2019
+#define WGL_BLUE_SHIFT_ARB 0x201a
+#define WGL_ALPHA_BITS_ARB 0x201b
+#define WGL_ALPHA_SHIFT_ARB 0x201c
+#define WGL_ACCUM_BITS_ARB 0x201d
+#define WGL_ACCUM_RED_BITS_ARB 0x201e
+#define WGL_ACCUM_GREEN_BITS_ARB 0x201f
+#define WGL_ACCUM_BLUE_BITS_ARB 0x2020
+#define WGL_ACCUM_ALPHA_BITS_ARB 0x2021
+#define WGL_DEPTH_BITS_ARB 0x2022
+#define WGL_STENCIL_BITS_ARB 0x2023
+#define WGL_AUX_BUFFERS_ARB 0x2024
+#define WGL_STEREO_ARB 0x2012
+#define WGL_DOUBLE_BUFFER_ARB 0x2011
+#define WGL_SAMPLES_ARB 0x2042
+#define WGL_FRAMEBUFFER_SRGB_CAPABLE_ARB 0x20a9
+#define WGL_CONTEXT_DEBUG_BIT_ARB 0x00000001
+#define WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x00000002
+#define WGL_CONTEXT_PROFILE_MASK_ARB 0x9126
+#define WGL_CONTEXT_CORE_PROFILE_BIT_ARB 0x00000001
+#define WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB 0x00000002
+#define WGL_CONTEXT_MAJOR_VERSION_ARB 0x2091
+#define WGL_CONTEXT_MINOR_VERSION_ARB 0x2092
+#define WGL_CONTEXT_FLAGS_ARB 0x2094
+#define WGL_CONTEXT_ES2_PROFILE_BIT_EXT 0x00000004
+#define WGL_CONTEXT_ROBUST_ACCESS_BIT_ARB 0x00000004
+#define WGL_LOSE_CONTEXT_ON_RESET_ARB 0x8252
+#define WGL_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB 0x8256
+#define WGL_NO_RESET_NOTIFICATION_ARB 0x8261
+#define WGL_CONTEXT_RELEASE_BEHAVIOR_ARB 0x2097
+#define WGL_CONTEXT_RELEASE_BEHAVIOR_NONE_ARB 0
+#define WGL_CONTEXT_RELEASE_BEHAVIOR_FLUSH_ARB 0x2098
+#define WGL_CONTEXT_OPENGL_NO_ERROR_ARB 0x31b3
+#define WGL_COLORSPACE_EXT 0x309d
+#define WGL_COLORSPACE_SRGB_EXT 0x3089
+
+#define ERROR_INVALID_VERSION_ARB 0x2095
+#define ERROR_INVALID_PROFILE_ARB 0x2096
+#define ERROR_INCOMPATIBLE_DEVICE_CONTEXTS_ARB 0x2054
+
 // xinput.dll function pointer typedefs
 typedef DWORD (WINAPI * PFN_XInputGetCapabilities)(DWORD,DWORD,XINPUT_CAPABILITIES*);
 typedef DWORD (WINAPI * PFN_XInputGetState)(DWORD,XINPUT_STATE*);
@@ -266,6 +316,34 @@
 typedef LONG (WINAPI * PFN_RtlVerifyVersionInfo)(OSVERSIONINFOEXW*,ULONG,ULONGLONG);
 #define RtlVerifyVersionInfo _glfw.win32.ntdll.RtlVerifyVersionInfo_
 
+// WGL extension pointer typedefs
+typedef BOOL (WINAPI * PFNWGLSWAPINTERVALEXTPROC)(int);
+typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBIVARBPROC)(HDC,int,int,UINT,const int*,int*);
+typedef const char* (WINAPI * PFNWGLGETEXTENSIONSSTRINGEXTPROC)(void);
+typedef const char* (WINAPI * PFNWGLGETEXTENSIONSSTRINGARBPROC)(HDC);
+typedef HGLRC (WINAPI * PFNWGLCREATECONTEXTATTRIBSARBPROC)(HDC,HGLRC,const int*);
+#define wglSwapIntervalEXT _glfw.wgl.SwapIntervalEXT
+#define wglGetPixelFormatAttribivARB _glfw.wgl.GetPixelFormatAttribivARB
+#define wglGetExtensionsStringEXT _glfw.wgl.GetExtensionsStringEXT
+#define wglGetExtensionsStringARB _glfw.wgl.GetExtensionsStringARB
+#define wglCreateContextAttribsARB _glfw.wgl.CreateContextAttribsARB
+
+// opengl32.dll function pointer typedefs
+typedef HGLRC (WINAPI * PFN_wglCreateContext)(HDC);
+typedef BOOL (WINAPI * PFN_wglDeleteContext)(HGLRC);
+typedef PROC (WINAPI * PFN_wglGetProcAddress)(LPCSTR);
+typedef HDC (WINAPI * PFN_wglGetCurrentDC)(void);
+typedef HGLRC (WINAPI * PFN_wglGetCurrentContext)(void);
+typedef BOOL (WINAPI * PFN_wglMakeCurrent)(HDC,HGLRC);
+typedef BOOL (WINAPI * PFN_wglShareLists)(HGLRC,HGLRC);
+#define wglCreateContext _glfw.wgl.CreateContext
+#define wglDeleteContext _glfw.wgl.DeleteContext
+#define wglGetProcAddress _glfw.wgl.GetProcAddress
+#define wglGetCurrentDC _glfw.wgl.GetCurrentDC
+#define wglGetCurrentContext _glfw.wgl.GetCurrentContext
+#define wglMakeCurrent _glfw.wgl.MakeCurrent
+#define wglShareLists _glfw.wgl.ShareLists
+
 typedef VkFlags VkWin32SurfaceCreateFlagsKHR;
 
 typedef struct VkWin32SurfaceCreateInfoKHR
@@ -280,30 +358,55 @@
 typedef VkResult (APIENTRY *PFN_vkCreateWin32SurfaceKHR)(VkInstance,const VkWin32SurfaceCreateInfoKHR*,const VkAllocationCallbacks*,VkSurfaceKHR*);
 typedef VkBool32 (APIENTRY *PFN_vkGetPhysicalDeviceWin32PresentationSupportKHR)(VkPhysicalDevice,uint32_t);
 
-#include "win32_joystick.h"
-#include "wgl_context.h"
-#include "egl_context.h"
-#include "osmesa_context.h"
+#define GLFW_WIN32_WINDOW_STATE         _GLFWwindowWin32  win32;
+#define GLFW_WIN32_LIBRARY_WINDOW_STATE _GLFWlibraryWin32 win32;
+#define GLFW_WIN32_MONITOR_STATE        _GLFWmonitorWin32 win32;
+#define GLFW_WIN32_CURSOR_STATE         _GLFWcursorWin32  win32;
 
-#if !defined(_GLFW_WNDCLASSNAME)
- #define _GLFW_WNDCLASSNAME L"GLFW30"
-#endif
+#define GLFW_WGL_CONTEXT_STATE          _GLFWcontextWGL wgl;
+#define GLFW_WGL_LIBRARY_CONTEXT_STATE  _GLFWlibraryWGL wgl;
 
-#define _glfw_dlopen(name) LoadLibraryA(name)
-#define _glfw_dlclose(handle) FreeLibrary((HMODULE) handle)
-#define _glfw_dlsym(handle, name) GetProcAddress((HMODULE) handle, name)
 
-#define _GLFW_EGL_NATIVE_WINDOW  ((EGLNativeWindowType) window->win32.handle)
-#define _GLFW_EGL_NATIVE_DISPLAY EGL_DEFAULT_DISPLAY
+// WGL-specific per-context data
+//
+typedef struct _GLFWcontextWGL
+{
+    HDC       dc;
+    HGLRC     handle;
+    int       interval;
+} _GLFWcontextWGL;
 
-#define _GLFW_PLATFORM_WINDOW_STATE         _GLFWwindowWin32  win32
-#define _GLFW_PLATFORM_LIBRARY_WINDOW_STATE _GLFWlibraryWin32 win32
-#define _GLFW_PLATFORM_LIBRARY_TIMER_STATE  _GLFWtimerWin32   win32
-#define _GLFW_PLATFORM_MONITOR_STATE        _GLFWmonitorWin32 win32
-#define _GLFW_PLATFORM_CURSOR_STATE         _GLFWcursorWin32  win32
-#define _GLFW_PLATFORM_TLS_STATE            _GLFWtlsWin32     win32
-#define _GLFW_PLATFORM_MUTEX_STATE          _GLFWmutexWin32   win32
+// WGL-specific global data
+//
+typedef struct _GLFWlibraryWGL
+{
+    HINSTANCE                           instance;
+    PFN_wglCreateContext                CreateContext;
+    PFN_wglDeleteContext                DeleteContext;
+    PFN_wglGetProcAddress               GetProcAddress;
+    PFN_wglGetCurrentDC                 GetCurrentDC;
+    PFN_wglGetCurrentContext            GetCurrentContext;
+    PFN_wglMakeCurrent                  MakeCurrent;
+    PFN_wglShareLists                   ShareLists;
 
+    PFNWGLSWAPINTERVALEXTPROC           SwapIntervalEXT;
+    PFNWGLGETPIXELFORMATATTRIBIVARBPROC GetPixelFormatAttribivARB;
+    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;
+} _GLFWlibraryWGL;
 
 // Win32-specific per-window data
 //
@@ -320,13 +423,15 @@
     // Whether to enable framebuffer transparency on DWM
     GLFWbool            transparent;
     GLFWbool            scaleToMonitor;
+    GLFWbool            keymenu;
+    GLFWbool            showDefault;
 
     // Cached size used to filter out duplicate events
     int                 width, height;
 
     // The last received cursor position, regardless of source
     int                 lastCursorPosX, lastCursorPosY;
-    // The last recevied high surrogate when decoding pairs of UTF-16 messages
+    // The last received high surrogate when decoding pairs of UTF-16 messages
     WCHAR               highSurrogate;
 } _GLFWwindowWin32;
 
@@ -336,8 +441,9 @@
 {
     HINSTANCE           instance;
     HWND                helperWindowHandle;
+    ATOM                helperWindowClass;
+    ATOM                mainWindowClass;
     HDEVNOTIFY          deviceNotificationHandle;
-    DWORD               foregroundLockTimeout;
     int                 acquiredMonitorCount;
     char*               clipboardString;
     short int           keycodes[512];
@@ -352,6 +458,8 @@
     RAWINPUT*           rawInput;
     int                 rawInputSize;
     UINT                mouseTrailSize;
+    // The cursor handle to use to hide the cursor (NULL or a transparent cursor)
+    HCURSOR             blankCursor;
 
     struct {
         HINSTANCE                       instance;
@@ -417,32 +525,10 @@
     HCURSOR             handle;
 } _GLFWcursorWin32;
 
-// Win32-specific global timer data
-//
-typedef struct _GLFWtimerWin32
-{
-    uint64_t            frequency;
-} _GLFWtimerWin32;
 
-// Win32-specific thread local storage data
-//
-typedef struct _GLFWtlsWin32
-{
-    GLFWbool            allocated;
-    DWORD               index;
-} _GLFWtlsWin32;
-
-// Win32-specific mutex data
-//
-typedef struct _GLFWmutexWin32
-{
-    GLFWbool            allocated;
-    CRITICAL_SECTION    section;
-} _GLFWmutexWin32;
-
-
-GLFWbool _glfwRegisterWindowClassWin32(void);
-void _glfwUnregisterWindowClassWin32(void);
+GLFWbool _glfwConnectWin32(int platformID, _GLFWplatform* platform);
+int _glfwInitWin32(void);
+void _glfwTerminateWin32(void);
 
 WCHAR* _glfwCreateWideStringFromUTF8Win32(const char* source);
 char* _glfwCreateUTF8FromWideStringWin32(const WCHAR* source);
@@ -451,10 +537,91 @@
 void _glfwInputErrorWin32(int error, const char* description);
 void _glfwUpdateKeyNamesWin32(void);
 
-void _glfwInitTimerWin32(void);
-
 void _glfwPollMonitorsWin32(void);
 void _glfwSetVideoModeWin32(_GLFWmonitor* monitor, const GLFWvidmode* desired);
 void _glfwRestoreVideoModeWin32(_GLFWmonitor* monitor);
-void _glfwGetMonitorContentScaleWin32(HMONITOR handle, float* xscale, float* yscale);
+void _glfwGetHMONITORContentScaleWin32(HMONITOR handle, float* xscale, float* yscale);
+
+GLFWbool _glfwCreateWindowWin32(_GLFWwindow* window, const _GLFWwndconfig* wndconfig, const _GLFWctxconfig* ctxconfig, const _GLFWfbconfig* fbconfig);
+void _glfwDestroyWindowWin32(_GLFWwindow* window);
+void _glfwSetWindowTitleWin32(_GLFWwindow* window, const char* title);
+void _glfwSetWindowIconWin32(_GLFWwindow* window, int count, const GLFWimage* images);
+void _glfwGetWindowPosWin32(_GLFWwindow* window, int* xpos, int* ypos);
+void _glfwSetWindowPosWin32(_GLFWwindow* window, int xpos, int ypos);
+void _glfwGetWindowSizeWin32(_GLFWwindow* window, int* width, int* height);
+void _glfwSetWindowSizeWin32(_GLFWwindow* window, int width, int height);
+void _glfwSetWindowSizeLimitsWin32(_GLFWwindow* window, int minwidth, int minheight, int maxwidth, int maxheight);
+void _glfwSetWindowAspectRatioWin32(_GLFWwindow* window, int numer, int denom);
+void _glfwGetFramebufferSizeWin32(_GLFWwindow* window, int* width, int* height);
+void _glfwGetWindowFrameSizeWin32(_GLFWwindow* window, int* left, int* top, int* right, int* bottom);
+void _glfwGetWindowContentScaleWin32(_GLFWwindow* window, float* xscale, float* yscale);
+void _glfwIconifyWindowWin32(_GLFWwindow* window);
+void _glfwRestoreWindowWin32(_GLFWwindow* window);
+void _glfwMaximizeWindowWin32(_GLFWwindow* window);
+void _glfwShowWindowWin32(_GLFWwindow* window);
+void _glfwHideWindowWin32(_GLFWwindow* window);
+void _glfwRequestWindowAttentionWin32(_GLFWwindow* window);
+void _glfwFocusWindowWin32(_GLFWwindow* window);
+void _glfwSetWindowMonitorWin32(_GLFWwindow* window, _GLFWmonitor* monitor, int xpos, int ypos, int width, int height, int refreshRate);
+GLFWbool _glfwWindowFocusedWin32(_GLFWwindow* window);
+GLFWbool _glfwWindowIconifiedWin32(_GLFWwindow* window);
+GLFWbool _glfwWindowVisibleWin32(_GLFWwindow* window);
+GLFWbool _glfwWindowMaximizedWin32(_GLFWwindow* window);
+GLFWbool _glfwWindowHoveredWin32(_GLFWwindow* window);
+GLFWbool _glfwFramebufferTransparentWin32(_GLFWwindow* window);
+void _glfwSetWindowResizableWin32(_GLFWwindow* window, GLFWbool enabled);
+void _glfwSetWindowDecoratedWin32(_GLFWwindow* window, GLFWbool enabled);
+void _glfwSetWindowFloatingWin32(_GLFWwindow* window, GLFWbool enabled);
+void _glfwSetWindowMousePassthroughWin32(_GLFWwindow* window, GLFWbool enabled);
+float _glfwGetWindowOpacityWin32(_GLFWwindow* window);
+void _glfwSetWindowOpacityWin32(_GLFWwindow* window, float opacity);
+
+void _glfwSetRawMouseMotionWin32(_GLFWwindow *window, GLFWbool enabled);
+GLFWbool _glfwRawMouseMotionSupportedWin32(void);
+
+void _glfwPollEventsWin32(void);
+void _glfwWaitEventsWin32(void);
+void _glfwWaitEventsTimeoutWin32(double timeout);
+void _glfwPostEmptyEventWin32(void);
+
+void _glfwGetCursorPosWin32(_GLFWwindow* window, double* xpos, double* ypos);
+void _glfwSetCursorPosWin32(_GLFWwindow* window, double xpos, double ypos);
+void _glfwSetCursorModeWin32(_GLFWwindow* window, int mode);
+const char* _glfwGetScancodeNameWin32(int scancode);
+int _glfwGetKeyScancodeWin32(int key);
+GLFWbool _glfwCreateCursorWin32(_GLFWcursor* cursor, const GLFWimage* image, int xhot, int yhot);
+GLFWbool _glfwCreateStandardCursorWin32(_GLFWcursor* cursor, int shape);
+void _glfwDestroyCursorWin32(_GLFWcursor* cursor);
+void _glfwSetCursorWin32(_GLFWwindow* window, _GLFWcursor* cursor);
+void _glfwSetClipboardStringWin32(const char* string);
+const char* _glfwGetClipboardStringWin32(void);
+
+EGLenum _glfwGetEGLPlatformWin32(EGLint** attribs);
+EGLNativeDisplayType _glfwGetEGLNativeDisplayWin32(void);
+EGLNativeWindowType _glfwGetEGLNativeWindowWin32(_GLFWwindow* window);
+
+void _glfwGetRequiredInstanceExtensionsWin32(char** extensions);
+GLFWbool _glfwGetPhysicalDevicePresentationSupportWin32(VkInstance instance, VkPhysicalDevice device, uint32_t queuefamily);
+VkResult _glfwCreateWindowSurfaceWin32(VkInstance instance, _GLFWwindow* window, const VkAllocationCallbacks* allocator, VkSurfaceKHR* surface);
+
+void _glfwFreeMonitorWin32(_GLFWmonitor* monitor);
+void _glfwGetMonitorPosWin32(_GLFWmonitor* monitor, int* xpos, int* ypos);
+void _glfwGetMonitorContentScaleWin32(_GLFWmonitor* monitor, float* xscale, float* yscale);
+void _glfwGetMonitorWorkareaWin32(_GLFWmonitor* monitor, int* xpos, int* ypos, int* width, int* height);
+GLFWvidmode* _glfwGetVideoModesWin32(_GLFWmonitor* monitor, int* count);
+GLFWbool _glfwGetVideoModeWin32(_GLFWmonitor* monitor, GLFWvidmode* mode);
+GLFWbool _glfwGetGammaRampWin32(_GLFWmonitor* monitor, GLFWgammaramp* ramp);
+void _glfwSetGammaRampWin32(_GLFWmonitor* monitor, const GLFWgammaramp* ramp);
+
+GLFWbool _glfwInitJoysticksWin32(void);
+void _glfwTerminateJoysticksWin32(void);
+GLFWbool _glfwPollJoystickWin32(_GLFWjoystick* js, int mode);
+const char* _glfwGetMappingNameWin32(void);
+void _glfwUpdateGamepadGUIDWin32(char* guid);
+
+GLFWbool _glfwInitWGL(void);
+void _glfwTerminateWGL(void);
+GLFWbool _glfwCreateContextWGL(_GLFWwindow* window,
+                               const _GLFWctxconfig* ctxconfig,
+                               const _GLFWfbconfig* fbconfig);
 
diff --git a/src/win32_thread.c b/src/win32_thread.c
index ce0686d..212e666 100644
--- a/src/win32_thread.c
+++ b/src/win32_thread.c
@@ -1,5 +1,5 @@
 //========================================================================
-// GLFW 3.3 Win32 - www.glfw.org
+// GLFW 3.4 Win32 - www.glfw.org
 //------------------------------------------------------------------------
 // Copyright (c) 2002-2006 Marcus Geelnard
 // Copyright (c) 2006-2017 Camilla Löwy <elmindreda@glfw.org>
@@ -24,11 +24,11 @@
 //    distribution.
 //
 //========================================================================
-// Please use C89 style variable declarations in this file because VS 2010
-//========================================================================
 
 #include "internal.h"
 
+#if defined(GLFW_BUILD_WIN32_THREAD)
+
 #include <assert.h>
 
 
@@ -43,8 +43,7 @@
     tls->win32.index = TlsAlloc();
     if (tls->win32.index == TLS_OUT_OF_INDEXES)
     {
-        _glfwInputErrorWin32(GLFW_PLATFORM_ERROR,
-                             "Win32: Failed to allocate TLS index");
+        _glfwInputError(GLFW_PLATFORM_ERROR, "Win32: Failed to allocate TLS index");
         return GLFW_FALSE;
     }
 
@@ -97,3 +96,5 @@
     LeaveCriticalSection(&mutex->win32.section);
 }
 
+#endif // GLFW_BUILD_WIN32_THREAD
+
diff --git a/src/win32_thread.h b/src/win32_thread.h
new file mode 100644
index 0000000..dd5948f
--- /dev/null
+++ b/src/win32_thread.h
@@ -0,0 +1,53 @@
+//========================================================================
+// GLFW 3.4 Win32 - www.glfw.org
+//------------------------------------------------------------------------
+// Copyright (c) 2002-2006 Marcus Geelnard
+// Copyright (c) 2006-2017 Camilla Löwy <elmindreda@glfw.org>
+//
+// 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.
+//
+//========================================================================
+
+// This is a workaround for the fact that glfw3.h needs to export APIENTRY (for
+// example to allow applications to correctly declare a GL_KHR_debug callback)
+// but windows.h assumes no one will define APIENTRY before it does
+#undef APIENTRY
+
+#include <windows.h>
+
+#define GLFW_WIN32_TLS_STATE            _GLFWtlsWin32     win32;
+#define GLFW_WIN32_MUTEX_STATE          _GLFWmutexWin32   win32;
+
+// Win32-specific thread local storage data
+//
+typedef struct _GLFWtlsWin32
+{
+    GLFWbool            allocated;
+    DWORD               index;
+} _GLFWtlsWin32;
+
+// Win32-specific mutex data
+//
+typedef struct _GLFWmutexWin32
+{
+    GLFWbool            allocated;
+    CRITICAL_SECTION    section;
+} _GLFWmutexWin32;
+
diff --git a/src/win32_time.c b/src/win32_time.c
index b4e31ab..a38e15d 100644
--- a/src/win32_time.c
+++ b/src/win32_time.c
@@ -1,5 +1,5 @@
 //========================================================================
-// GLFW 3.3 Win32 - www.glfw.org
+// GLFW 3.4 Win32 - www.glfw.org
 //------------------------------------------------------------------------
 // Copyright (c) 2002-2006 Marcus Geelnard
 // Copyright (c) 2006-2017 Camilla Löwy <elmindreda@glfw.org>
@@ -24,28 +24,20 @@
 //    distribution.
 //
 //========================================================================
-// Please use C89 style variable declarations in this file because VS 2010
-//========================================================================
 
 #include "internal.h"
 
-
-//////////////////////////////////////////////////////////////////////////
-//////                       GLFW internal API                      //////
-//////////////////////////////////////////////////////////////////////////
-
-// Initialise timer
-//
-void _glfwInitTimerWin32(void)
-{
-    QueryPerformanceFrequency((LARGE_INTEGER*) &_glfw.timer.win32.frequency);
-}
-
+#if defined(GLFW_BUILD_WIN32_TIMER)
 
 //////////////////////////////////////////////////////////////////////////
 //////                       GLFW platform API                      //////
 //////////////////////////////////////////////////////////////////////////
 
+void _glfwPlatformInitTimer(void)
+{
+    QueryPerformanceFrequency((LARGE_INTEGER*) &_glfw.timer.win32.frequency);
+}
+
 uint64_t _glfwPlatformGetTimerValue(void)
 {
     uint64_t value;
@@ -58,3 +50,5 @@
     return _glfw.timer.win32.frequency;
 }
 
+#endif // GLFW_BUILD_WIN32_TIMER
+
diff --git a/src/win32_time.h b/src/win32_time.h
new file mode 100644
index 0000000..ef57a5a
--- /dev/null
+++ b/src/win32_time.h
@@ -0,0 +1,43 @@
+//========================================================================
+// GLFW 3.4 Win32 - www.glfw.org
+//------------------------------------------------------------------------
+// Copyright (c) 2002-2006 Marcus Geelnard
+// Copyright (c) 2006-2017 Camilla Löwy <elmindreda@glfw.org>
+//
+// 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.
+//
+//========================================================================
+
+// This is a workaround for the fact that glfw3.h needs to export APIENTRY (for
+// example to allow applications to correctly declare a GL_KHR_debug callback)
+// but windows.h assumes no one will define APIENTRY before it does
+#undef APIENTRY
+
+#include <windows.h>
+
+#define GLFW_WIN32_LIBRARY_TIMER_STATE  _GLFWtimerWin32   win32;
+
+// Win32-specific global timer data
+//
+typedef struct _GLFWtimerWin32
+{
+    uint64_t            frequency;
+} _GLFWtimerWin32;
+
diff --git a/src/win32_window.c b/src/win32_window.c
index 5aecaad..e6a9496 100644
--- a/src/win32_window.c
+++ b/src/win32_window.c
@@ -1,5 +1,5 @@
 //========================================================================
-// GLFW 3.3 Win32 - www.glfw.org
+// GLFW 3.4 Win32 - www.glfw.org
 //------------------------------------------------------------------------
 // Copyright (c) 2002-2006 Marcus Geelnard
 // Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.org>
@@ -24,14 +24,13 @@
 //    distribution.
 //
 //========================================================================
-// Please use C89 style variable declarations in this file because VS 2010
-//========================================================================
 
 #include "internal.h"
 
+#if defined(_GLFW_WIN32)
+
 #include <limits.h>
 #include <stdlib.h>
-#include <malloc.h>
 #include <string.h>
 #include <windowsx.h>
 #include <shellapi.h>
@@ -98,8 +97,7 @@
 
 // Creates an RGBA icon or cursor
 //
-static HICON createIcon(const GLFWimage* image,
-                        int xhot, int yhot, GLFWbool icon)
+static HICON createIcon(const GLFWimage* image, int xhot, int yhot, GLFWbool icon)
 {
     int i;
     HDC dc;
@@ -195,7 +193,7 @@
     const DWORD style = getWindowStyle(window);
     const DWORD exStyle = getWindowExStyle(window);
 
-    if (_glfwIsWindows10AnniversaryUpdateOrGreaterWin32())
+    if (_glfwIsWindows10Version1607OrGreaterWin32())
     {
         AdjustWindowRectExForDpi(&frame, style, FALSE, exStyle,
                                  GetDpiForWindow(window->win32.handle));
@@ -225,7 +223,8 @@
 //
 static void updateCursorImage(_GLFWwindow* window)
 {
-    if (window->cursorMode == GLFW_CURSOR_NORMAL)
+    if (window->cursorMode == GLFW_CURSOR_NORMAL ||
+        window->cursorMode == GLFW_CURSOR_CAPTURED)
     {
         if (window->cursor)
             SetCursor(window->cursor->win32.handle);
@@ -233,7 +232,12 @@
             SetCursor(LoadCursorW(NULL, IDC_ARROW));
     }
     else
-        SetCursor(NULL);
+    {
+        // NOTE: Via Remote Desktop, setting the cursor to NULL does not hide it.
+        // HACK: When running locally, it is set to NULL, but when connected via Remote
+        //       Desktop, this is a transparent cursor.
+        SetCursor(_glfw.win32.blankCursor);
+    }
 }
 
 // Sets the cursor clip rect to the window content area
@@ -287,9 +291,9 @@
 static void disableCursor(_GLFWwindow* window)
 {
     _glfw.win32.disabledCursorWindow = window;
-    _glfwPlatformGetCursorPos(window,
-                              &_glfw.win32.restoreCursorPosX,
-                              &_glfw.win32.restoreCursorPosY);
+    _glfwGetCursorPosWin32(window,
+                           &_glfw.win32.restoreCursorPosX,
+                           &_glfw.win32.restoreCursorPosY);
     updateCursorImage(window);
     _glfwCenterCursorInContentArea(window);
     captureCursor(window);
@@ -307,9 +311,9 @@
 
     _glfw.win32.disabledCursorWindow = NULL;
     releaseCursor();
-    _glfwPlatformSetCursorPos(window,
-                              _glfw.win32.restoreCursorPosX,
-                              _glfw.win32.restoreCursorPosY);
+    _glfwSetCursorPosWin32(window,
+                           _glfw.win32.restoreCursorPosX,
+                           _glfw.win32.restoreCursorPosY);
     updateCursorImage(window);
 }
 
@@ -344,7 +348,7 @@
 
     GetClientRect(window->win32.handle, &rect);
 
-    if (_glfwIsWindows10AnniversaryUpdateOrGreaterWin32())
+    if (_glfwIsWindows10Version1607OrGreaterWin32())
     {
         AdjustWindowRectExForDpi(&rect, style, FALSE,
                                  getWindowExStyle(window),
@@ -443,11 +447,8 @@
 
         // HACK: When mouse trails are enabled the cursor becomes invisible when
         //       the OpenGL ICD switches to page flipping
-        if (IsWindowsXPOrGreater())
-        {
-            SystemParametersInfoW(SPI_GETMOUSETRAILS, 0, &_glfw.win32.mouseTrailSize, 0);
-            SystemParametersInfoW(SPI_SETMOUSETRAILS, 0, 0, 0);
-        }
+        SystemParametersInfoW(SPI_GETMOUSETRAILS, 0, &_glfw.win32.mouseTrailSize, 0);
+        SystemParametersInfoW(SPI_SETMOUSETRAILS, 0, 0, 0);
     }
 
     if (!window->monitor->window)
@@ -470,8 +471,7 @@
         SetThreadExecutionState(ES_CONTINUOUS);
 
         // HACK: Restore mouse trail length saved in acquireMonitor
-        if (IsWindowsXPOrGreater())
-            SystemParametersInfoW(SPI_SETMOUSETRAILS, _glfw.win32.mouseTrailSize, 0, 0);
+        SystemParametersInfoW(SPI_SETMOUSETRAILS, _glfw.win32.mouseTrailSize, 0, 0);
     }
 
     _glfwInputMonitorWindow(window->monitor, NULL);
@@ -505,7 +505,7 @@
     {
         const DWORD exStyle = GetWindowLongW(window->win32.handle, GWL_EXSTYLE);
 
-        if (_glfwIsWindows10AnniversaryUpdateOrGreaterWin32())
+        if (_glfwIsWindows10Version1607OrGreaterWin32())
         {
             const UINT dpi = GetDpiForWindow(window->win32.handle);
             AdjustWindowRectExForDpi(&rect, style, FALSE, exStyle, dpi);
@@ -528,57 +528,26 @@
                  SWP_NOACTIVATE | SWP_NOZORDER | SWP_FRAMECHANGED);
 }
 
-// Window callback function (handles window messages)
+// Window procedure for user-created windows
 //
-static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
-                                   WPARAM wParam, LPARAM lParam)
+static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 {
     _GLFWwindow* window = GetPropW(hWnd, L"GLFW");
     if (!window)
     {
-        // This is the message handling for the hidden helper window
-        // and for a regular window during its initial creation
-
-        switch (uMsg)
+        if (uMsg == WM_NCCREATE)
         {
-            case WM_NCCREATE:
+            if (_glfwIsWindows10Version1607OrGreaterWin32())
             {
-                if (_glfwIsWindows10AnniversaryUpdateOrGreaterWin32())
-                {
-                    const CREATESTRUCTW* cs = (const CREATESTRUCTW*) lParam;
-                    const _GLFWwndconfig* wndconfig = cs->lpCreateParams;
+                const CREATESTRUCTW* cs = (const CREATESTRUCTW*) lParam;
+                const _GLFWwndconfig* wndconfig = cs->lpCreateParams;
 
-                    // On per-monitor DPI aware V1 systems, only enable
-                    // non-client scaling for windows that scale the client area
-                    // We need WM_GETDPISCALEDSIZE from V2 to keep the client
-                    // area static when the non-client area is scaled
-                    if (wndconfig && wndconfig->scaleToMonitor)
-                        EnableNonClientDpiScaling(hWnd);
-                }
-
-                break;
-            }
-
-            case WM_DISPLAYCHANGE:
-                _glfwPollMonitorsWin32();
-                break;
-
-            case WM_DEVICECHANGE:
-            {
-                if (wParam == DBT_DEVICEARRIVAL)
-                {
-                    DEV_BROADCAST_HDR* dbh = (DEV_BROADCAST_HDR*) lParam;
-                    if (dbh && dbh->dbch_devicetype == DBT_DEVTYP_DEVICEINTERFACE)
-                        _glfwDetectJoystickConnectionWin32();
-                }
-                else if (wParam == DBT_DEVICEREMOVECOMPLETE)
-                {
-                    DEV_BROADCAST_HDR* dbh = (DEV_BROADCAST_HDR*) lParam;
-                    if (dbh && dbh->dbch_devicetype == DBT_DEVTYP_DEVICEINTERFACE)
-                        _glfwDetectJoystickDisconnectionWin32();
-                }
-
-                break;
+                // On per-monitor DPI aware V1 systems, only enable
+                // non-client scaling for windows that scale the client area
+                // We need WM_GETDPISCALEDSIZE from V2 to keep the client
+                // area static when the non-client area is scaled
+                if (wndconfig && wndconfig->scaleToMonitor)
+                    EnableNonClientDpiScaling(hWnd);
             }
         }
 
@@ -608,6 +577,8 @@
             {
                 if (window->cursorMode == GLFW_CURSOR_DISABLED)
                     disableCursor(window);
+                else if (window->cursorMode == GLFW_CURSOR_CAPTURED)
+                    captureCursor(window);
 
                 window->win32.frameAction = GLFW_FALSE;
             }
@@ -626,6 +597,8 @@
 
             if (window->cursorMode == GLFW_CURSOR_DISABLED)
                 disableCursor(window);
+            else if (window->cursorMode == GLFW_CURSOR_CAPTURED)
+                captureCursor(window);
 
             return 0;
         }
@@ -634,9 +607,11 @@
         {
             if (window->cursorMode == GLFW_CURSOR_DISABLED)
                 enableCursor(window);
+            else if (window->cursorMode == GLFW_CURSOR_CAPTURED)
+                releaseCursor();
 
             if (window->monitor && window->autoIconify)
-                _glfwPlatformIconifyWindow(window);
+                _glfwIconifyWindowWin32(window);
 
             _glfwInputWindowFocus(window, GLFW_FALSE);
             return 0;
@@ -661,7 +636,12 @@
 
                 // User trying to access application menu using ALT?
                 case SC_KEYMENU:
-                    return 0;
+                {
+                    if (!window->win32.keymenu)
+                        return 0;
+
+                    break;
+                }
             }
             break;
         }
@@ -703,6 +683,9 @@
                 _glfwInputChar(window, codepoint, getKeyMods(), uMsg != WM_SYSCHAR);
             }
 
+            if (uMsg == WM_SYSCHAR && window->win32.keymenu)
+                break;
+
             return 0;
         }
 
@@ -800,7 +783,7 @@
             {
                 // HACK: Release both Shift keys on Shift up event, as when both
                 //       are pressed the first release does not emit any event
-                // NOTE: The other half of this is in _glfwPlatformPollEvents
+                // NOTE: The other half of this is in _glfwPollEventsWin32
                 _glfwInputKey(window, GLFW_KEY_LEFT_SHIFT, scancode, action, mods);
                 _glfwInputKey(window, GLFW_KEY_RIGHT_SHIFT, scancode, action, mods);
             }
@@ -928,8 +911,8 @@
             GetRawInputData(ri, RID_INPUT, NULL, &size, sizeof(RAWINPUTHEADER));
             if (size > (UINT) _glfw.win32.rawInputSize)
             {
-                free(_glfw.win32.rawInput);
-                _glfw.win32.rawInput = calloc(size, 1);
+                _glfw_free(_glfw.win32.rawInput);
+                _glfw.win32.rawInput = _glfw_calloc(size, 1);
                 _glfw.win32.rawInputSize = size;
             }
 
@@ -946,8 +929,28 @@
             data = _glfw.win32.rawInput;
             if (data->data.mouse.usFlags & MOUSE_MOVE_ABSOLUTE)
             {
-                dx = data->data.mouse.lLastX - window->win32.lastCursorPosX;
-                dy = data->data.mouse.lLastY - window->win32.lastCursorPosY;
+                POINT pos = {0};
+                int width, height;
+
+                if (data->data.mouse.usFlags & MOUSE_VIRTUAL_DESKTOP)
+                {
+                    pos.x += GetSystemMetrics(SM_XVIRTUALSCREEN);
+                    pos.y += GetSystemMetrics(SM_YVIRTUALSCREEN);
+                    width = GetSystemMetrics(SM_CXVIRTUALSCREEN);
+                    height = GetSystemMetrics(SM_CYVIRTUALSCREEN);
+                }
+                else
+                {
+                    width = GetSystemMetrics(SM_CXSCREEN);
+                    height = GetSystemMetrics(SM_CYSCREEN);
+                }
+
+                pos.x += (int) ((data->data.mouse.lLastX / 65535.f) * width);
+                pos.y += (int) ((data->data.mouse.lLastY / 65535.f) * height);
+                ScreenToClient(window->win32.handle, &pos);
+
+                dx = pos.x - window->win32.lastCursorPosX;
+                dy = pos.y - window->win32.lastCursorPosY;
             }
             else
             {
@@ -995,6 +998,8 @@
             //       resizing the window or using the window menu
             if (window->cursorMode == GLFW_CURSOR_DISABLED)
                 enableCursor(window);
+            else if (window->cursorMode == GLFW_CURSOR_CAPTURED)
+                releaseCursor();
 
             break;
         }
@@ -1009,6 +1014,8 @@
             //       resizing the window or using the menu
             if (window->cursorMode == GLFW_CURSOR_DISABLED)
                 disableCursor(window);
+            else if (window->cursorMode == GLFW_CURSOR_CAPTURED)
+                captureCursor(window);
 
             break;
         }
@@ -1091,7 +1098,7 @@
             if (window->monitor)
                 break;
 
-            if (_glfwIsWindows10AnniversaryUpdateOrGreaterWin32())
+            if (_glfwIsWindows10Version1607OrGreaterWin32())
             {
                 AdjustWindowRectExForDpi(&frame, style, FALSE, exStyle,
                                          GetDpiForWindow(window->win32.handle));
@@ -1168,7 +1175,7 @@
                 break;
 
             // Adjust the window size to keep the content area size constant
-            if (_glfwIsWindows10CreatorsUpdateOrGreaterWin32())
+            if (_glfwIsWindows10Version1703OrGreaterWin32())
             {
                 RECT source = {0}, target = {0};
                 SIZE* size = (SIZE*) lParam;
@@ -1199,7 +1206,7 @@
             // need it to compensate for non-client area scaling
             if (!window->monitor &&
                 (window->win32.scaleToMonitor ||
-                 _glfwIsWindows10CreatorsUpdateOrGreaterWin32()))
+                 _glfwIsWindows10Version1703OrGreaterWin32()))
             {
                 RECT* suggested = (RECT*) lParam;
                 SetWindowPos(window->win32.handle, HWND_TOP,
@@ -1232,7 +1239,7 @@
             int i;
 
             const int count = DragQueryFileW(drop, 0xffffffff, NULL, 0);
-            char** paths = calloc(count, sizeof(char*));
+            char** paths = _glfw_calloc(count, sizeof(char*));
 
             // Move the mouse to the position of the drop
             DragQueryPoint(drop, &pt);
@@ -1241,19 +1248,19 @@
             for (i = 0;  i < count;  i++)
             {
                 const UINT length = DragQueryFileW(drop, i, NULL, 0);
-                WCHAR* buffer = calloc((size_t) length + 1, sizeof(WCHAR));
+                WCHAR* buffer = _glfw_calloc((size_t) length + 1, sizeof(WCHAR));
 
                 DragQueryFileW(drop, i, buffer, length + 1);
                 paths[i] = _glfwCreateUTF8FromWideStringWin32(buffer);
 
-                free(buffer);
+                _glfw_free(buffer);
             }
 
             _glfwInputDrop(window, count, (const char**) paths);
 
             for (i = 0;  i < count;  i++)
-                free(paths[i]);
-            free(paths);
+                _glfw_free(paths[i]);
+            _glfw_free(paths);
 
             DragFinish(drop);
             return 0;
@@ -1274,6 +1281,67 @@
     DWORD style = getWindowStyle(window);
     DWORD exStyle = getWindowExStyle(window);
 
+    if (!_glfw.win32.mainWindowClass)
+    {
+        WNDCLASSEXW wc = { sizeof(wc) };
+        wc.style         = CS_HREDRAW | CS_VREDRAW | CS_OWNDC;
+        wc.lpfnWndProc   = windowProc;
+        wc.hInstance     = _glfw.win32.instance;
+        wc.hCursor       = LoadCursorW(NULL, IDC_ARROW);
+#if defined(_GLFW_WNDCLASSNAME)
+        wc.lpszClassName = _GLFW_WNDCLASSNAME;
+#else
+        wc.lpszClassName = L"GLFW30";
+#endif
+        // Load user-provided icon if available
+        wc.hIcon = LoadImageW(GetModuleHandleW(NULL),
+                              L"GLFW_ICON", IMAGE_ICON,
+                              0, 0, LR_DEFAULTSIZE | LR_SHARED);
+        if (!wc.hIcon)
+        {
+            // No user-provided icon found, load default icon
+            wc.hIcon = LoadImageW(NULL,
+                                  IDI_APPLICATION, IMAGE_ICON,
+                                  0, 0, LR_DEFAULTSIZE | LR_SHARED);
+        }
+
+        _glfw.win32.mainWindowClass = RegisterClassExW(&wc);
+        if (!_glfw.win32.mainWindowClass)
+        {
+            _glfwInputErrorWin32(GLFW_PLATFORM_ERROR,
+                                 "Win32: Failed to register window class");
+            return GLFW_FALSE;
+        }
+    }
+
+    if (GetSystemMetrics(SM_REMOTESESSION))
+    {
+        // NOTE: On Remote Desktop, setting the cursor to NULL does not hide it
+        // HACK: Create a transparent cursor and always set that instead of NULL
+        //       When not on Remote Desktop, this handle is NULL and normal hiding is used
+        if (!_glfw.win32.blankCursor)
+        {
+            const int cursorWidth = GetSystemMetrics(SM_CXCURSOR);
+            const int cursorHeight = GetSystemMetrics(SM_CYCURSOR);
+
+            unsigned char* cursorPixels = _glfw_calloc(cursorWidth * cursorHeight, 4);
+            if (!cursorPixels)
+                return GLFW_FALSE;
+
+            // NOTE: Windows checks whether the image is fully transparent and if so
+            //       just ignores the alpha channel and makes the whole cursor opaque
+            // HACK: Make one pixel slightly less transparent
+            cursorPixels[3] = 1;
+
+            const GLFWimage cursorImage = { cursorWidth, cursorHeight, cursorPixels };
+            _glfw.win32.blankCursor = createIcon(&cursorImage, 0, 0, FALSE);
+            _glfw_free(cursorPixels);
+
+            if (!_glfw.win32.blankCursor)
+                return GLFW_FALSE;
+        }
+    }
+
     if (window->monitor)
     {
         MONITORINFO mi = { sizeof(mi) };
@@ -1297,8 +1365,17 @@
 
         AdjustWindowRectEx(&rect, style, FALSE, exStyle);
 
-        frameX = CW_USEDEFAULT;
-        frameY = CW_USEDEFAULT;
+        if (wndconfig->xpos == GLFW_ANY_POSITION && wndconfig->ypos == GLFW_ANY_POSITION)
+        {
+            frameX = CW_USEDEFAULT;
+            frameY = CW_USEDEFAULT;
+        }
+        else
+        {
+            frameX = wndconfig->xpos + rect.left;
+            frameY = wndconfig->ypos + rect.top;
+        }
+
         frameWidth  = rect.right - rect.left;
         frameHeight = rect.bottom - rect.top;
     }
@@ -1308,7 +1385,7 @@
         return GLFW_FALSE;
 
     window->win32.handle = CreateWindowExW(exStyle,
-                                           _GLFW_WNDCLASSNAME,
+                                           MAKEINTATOM(_glfw.win32.mainWindowClass),
                                            wideTitle,
                                            style,
                                            frameX, frameY,
@@ -1318,7 +1395,7 @@
                                            _glfw.win32.instance,
                                            (LPVOID) wndconfig);
 
-    free(wideTitle);
+    _glfw_free(wideTitle);
 
     if (!window->win32.handle)
     {
@@ -1340,6 +1417,8 @@
     }
 
     window->win32.scaleToMonitor = wndconfig->scaleToMonitor;
+    window->win32.keymenu = wndconfig->win32.keymenu;
+    window->win32.showDefault = wndconfig->win32.showDefault;
 
     if (!window->monitor)
     {
@@ -1356,7 +1435,7 @@
         if (wndconfig->scaleToMonitor)
         {
             float xscale, yscale;
-            _glfwGetMonitorContentScaleWin32(mh, &xscale, &yscale);
+            _glfwGetHMONITORContentScaleWin32(mh, &xscale, &yscale);
 
             if (xscale > 0.f && yscale > 0.f)
             {
@@ -1365,7 +1444,7 @@
             }
         }
 
-        if (_glfwIsWindows10AnniversaryUpdateOrGreaterWin32())
+        if (_glfwIsWindows10Version1607OrGreaterWin32())
         {
             AdjustWindowRectExForDpi(&rect, style, FALSE, exStyle,
                                      GetDpiForWindow(window->win32.handle));
@@ -1407,68 +1486,15 @@
         window->win32.transparent = GLFW_TRUE;
     }
 
-    _glfwPlatformGetWindowSize(window, &window->win32.width, &window->win32.height);
+    _glfwGetWindowSizeWin32(window, &window->win32.width, &window->win32.height);
 
     return GLFW_TRUE;
 }
 
-
-//////////////////////////////////////////////////////////////////////////
-//////                       GLFW internal API                      //////
-//////////////////////////////////////////////////////////////////////////
-
-// Registers the GLFW window class
-//
-GLFWbool _glfwRegisterWindowClassWin32(void)
-{
-    WNDCLASSEXW wc;
-
-    ZeroMemory(&wc, sizeof(wc));
-    wc.cbSize        = sizeof(wc);
-    wc.style         = CS_HREDRAW | CS_VREDRAW | CS_OWNDC;
-    wc.lpfnWndProc   = windowProc;
-    wc.hInstance     = _glfw.win32.instance;
-    wc.hCursor       = LoadCursorW(NULL, IDC_ARROW);
-    wc.lpszClassName = _GLFW_WNDCLASSNAME;
-
-    // Load user-provided icon if available
-    wc.hIcon = LoadImageW(GetModuleHandleW(NULL),
-                          L"GLFW_ICON", IMAGE_ICON,
-                          0, 0, LR_DEFAULTSIZE | LR_SHARED);
-    if (!wc.hIcon)
-    {
-        // No user-provided icon found, load default icon
-        wc.hIcon = LoadImageW(NULL,
-                              IDI_APPLICATION, IMAGE_ICON,
-                              0, 0, LR_DEFAULTSIZE | LR_SHARED);
-    }
-
-    if (!RegisterClassExW(&wc))
-    {
-        _glfwInputErrorWin32(GLFW_PLATFORM_ERROR,
-                             "Win32: Failed to register window class");
-        return GLFW_FALSE;
-    }
-
-    return GLFW_TRUE;
-}
-
-// Unregisters the GLFW window class
-//
-void _glfwUnregisterWindowClassWin32(void)
-{
-    UnregisterClassW(_GLFW_WNDCLASSNAME, _glfw.win32.instance);
-}
-
-
-//////////////////////////////////////////////////////////////////////////
-//////                       GLFW platform API                      //////
-//////////////////////////////////////////////////////////////////////////
-
-int _glfwPlatformCreateWindow(_GLFWwindow* window,
-                              const _GLFWwndconfig* wndconfig,
-                              const _GLFWctxconfig* ctxconfig,
-                              const _GLFWfbconfig* fbconfig)
+GLFWbool _glfwCreateWindowWin32(_GLFWwindow* window,
+                                const _GLFWwndconfig* wndconfig,
+                                const _GLFWctxconfig* ctxconfig,
+                                const _GLFWfbconfig* fbconfig)
 {
     if (!createNativeWindow(window, wndconfig, fbconfig))
         return GLFW_FALSE;
@@ -1501,10 +1527,13 @@
             return GLFW_FALSE;
     }
 
+    if (wndconfig->mousePassthrough)
+        _glfwSetWindowMousePassthroughWin32(window, GLFW_TRUE);
+
     if (window->monitor)
     {
-        _glfwPlatformShowWindow(window);
-        _glfwPlatformFocusWindow(window);
+        _glfwShowWindowWin32(window);
+        _glfwFocusWindowWin32(window);
         acquireMonitor(window);
         fitToMonitor(window);
 
@@ -1515,16 +1544,16 @@
     {
         if (wndconfig->visible)
         {
-            _glfwPlatformShowWindow(window);
+            _glfwShowWindowWin32(window);
             if (wndconfig->focused)
-                _glfwPlatformFocusWindow(window);
+                _glfwFocusWindowWin32(window);
         }
     }
 
     return GLFW_TRUE;
 }
 
-void _glfwPlatformDestroyWindow(_GLFWwindow* window)
+void _glfwDestroyWindowWin32(_GLFWwindow* window)
 {
     if (window->monitor)
         releaseMonitor(window);
@@ -1552,18 +1581,17 @@
         DestroyIcon(window->win32.smallIcon);
 }
 
-void _glfwPlatformSetWindowTitle(_GLFWwindow* window, const char* title)
+void _glfwSetWindowTitleWin32(_GLFWwindow* window, const char* title)
 {
     WCHAR* wideTitle = _glfwCreateWideStringFromUTF8Win32(title);
     if (!wideTitle)
         return;
 
     SetWindowTextW(window->win32.handle, wideTitle);
-    free(wideTitle);
+    _glfw_free(wideTitle);
 }
 
-void _glfwPlatformSetWindowIcon(_GLFWwindow* window,
-                                int count, const GLFWimage* images)
+void _glfwSetWindowIconWin32(_GLFWwindow* window, int count, const GLFWimage* images)
 {
     HICON bigIcon = NULL, smallIcon = NULL;
 
@@ -1601,7 +1629,7 @@
     }
 }
 
-void _glfwPlatformGetWindowPos(_GLFWwindow* window, int* xpos, int* ypos)
+void _glfwGetWindowPosWin32(_GLFWwindow* window, int* xpos, int* ypos)
 {
     POINT pos = { 0, 0 };
     ClientToScreen(window->win32.handle, &pos);
@@ -1612,11 +1640,11 @@
         *ypos = pos.y;
 }
 
-void _glfwPlatformSetWindowPos(_GLFWwindow* window, int xpos, int ypos)
+void _glfwSetWindowPosWin32(_GLFWwindow* window, int xpos, int ypos)
 {
     RECT rect = { xpos, ypos, xpos, ypos };
 
-    if (_glfwIsWindows10AnniversaryUpdateOrGreaterWin32())
+    if (_glfwIsWindows10Version1607OrGreaterWin32())
     {
         AdjustWindowRectExForDpi(&rect, getWindowStyle(window),
                                  FALSE, getWindowExStyle(window),
@@ -1632,7 +1660,7 @@
                  SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOSIZE);
 }
 
-void _glfwPlatformGetWindowSize(_GLFWwindow* window, int* width, int* height)
+void _glfwGetWindowSizeWin32(_GLFWwindow* window, int* width, int* height)
 {
     RECT area;
     GetClientRect(window->win32.handle, &area);
@@ -1643,7 +1671,7 @@
         *height = area.bottom;
 }
 
-void _glfwPlatformSetWindowSize(_GLFWwindow* window, int width, int height)
+void _glfwSetWindowSizeWin32(_GLFWwindow* window, int width, int height)
 {
     if (window->monitor)
     {
@@ -1657,7 +1685,7 @@
     {
         RECT rect = { 0, 0, width, height };
 
-        if (_glfwIsWindows10AnniversaryUpdateOrGreaterWin32())
+        if (_glfwIsWindows10Version1607OrGreaterWin32())
         {
             AdjustWindowRectExForDpi(&rect, getWindowStyle(window),
                                      FALSE, getWindowExStyle(window),
@@ -1675,9 +1703,9 @@
     }
 }
 
-void _glfwPlatformSetWindowSizeLimits(_GLFWwindow* window,
-                                      int minwidth, int minheight,
-                                      int maxwidth, int maxheight)
+void _glfwSetWindowSizeLimitsWin32(_GLFWwindow* window,
+                                   int minwidth, int minheight,
+                                   int maxwidth, int maxheight)
 {
     RECT area;
 
@@ -1694,7 +1722,7 @@
                area.bottom - area.top, TRUE);
 }
 
-void _glfwPlatformSetWindowAspectRatio(_GLFWwindow* window, int numer, int denom)
+void _glfwSetWindowAspectRatioWin32(_GLFWwindow* window, int numer, int denom)
 {
     RECT area;
 
@@ -1709,22 +1737,22 @@
                area.bottom - area.top, TRUE);
 }
 
-void _glfwPlatformGetFramebufferSize(_GLFWwindow* window, int* width, int* height)
+void _glfwGetFramebufferSizeWin32(_GLFWwindow* window, int* width, int* height)
 {
-    _glfwPlatformGetWindowSize(window, width, height);
+    _glfwGetWindowSizeWin32(window, width, height);
 }
 
-void _glfwPlatformGetWindowFrameSize(_GLFWwindow* window,
-                                     int* left, int* top,
-                                     int* right, int* bottom)
+void _glfwGetWindowFrameSizeWin32(_GLFWwindow* window,
+                                  int* left, int* top,
+                                  int* right, int* bottom)
 {
     RECT rect;
     int width, height;
 
-    _glfwPlatformGetWindowSize(window, &width, &height);
+    _glfwGetWindowSizeWin32(window, &width, &height);
     SetRect(&rect, 0, 0, width, height);
 
-    if (_glfwIsWindows10AnniversaryUpdateOrGreaterWin32())
+    if (_glfwIsWindows10Version1607OrGreaterWin32())
     {
         AdjustWindowRectExForDpi(&rect, getWindowStyle(window),
                                  FALSE, getWindowExStyle(window),
@@ -1746,25 +1774,24 @@
         *bottom = rect.bottom - height;
 }
 
-void _glfwPlatformGetWindowContentScale(_GLFWwindow* window,
-                                        float* xscale, float* yscale)
+void _glfwGetWindowContentScaleWin32(_GLFWwindow* window, float* xscale, float* yscale)
 {
     const HANDLE handle = MonitorFromWindow(window->win32.handle,
                                             MONITOR_DEFAULTTONEAREST);
-    _glfwGetMonitorContentScaleWin32(handle, xscale, yscale);
+    _glfwGetHMONITORContentScaleWin32(handle, xscale, yscale);
 }
 
-void _glfwPlatformIconifyWindow(_GLFWwindow* window)
+void _glfwIconifyWindowWin32(_GLFWwindow* window)
 {
     ShowWindow(window->win32.handle, SW_MINIMIZE);
 }
 
-void _glfwPlatformRestoreWindow(_GLFWwindow* window)
+void _glfwRestoreWindowWin32(_GLFWwindow* window)
 {
     ShowWindow(window->win32.handle, SW_RESTORE);
 }
 
-void _glfwPlatformMaximizeWindow(_GLFWwindow* window)
+void _glfwMaximizeWindowWin32(_GLFWwindow* window)
 {
     if (IsWindowVisible(window->win32.handle))
         ShowWindow(window->win32.handle, SW_MAXIMIZE);
@@ -1772,33 +1799,49 @@
         maximizeWindowManually(window);
 }
 
-void _glfwPlatformShowWindow(_GLFWwindow* window)
+void _glfwShowWindowWin32(_GLFWwindow* window)
 {
-    ShowWindow(window->win32.handle, SW_SHOWNA);
+    int showCommand = SW_SHOWNA;
+
+    if (window->win32.showDefault)
+    {
+        // NOTE: GLFW windows currently do not seem to match the Windows 10 definition of
+        //       a main window, so even SW_SHOWDEFAULT does nothing
+        //       This definition is undocumented and can change (source: Raymond Chen)
+        // HACK: Apply the STARTUPINFO show command manually if available
+        STARTUPINFOW si = { sizeof(si) };
+        GetStartupInfoW(&si);
+        if (si.dwFlags & STARTF_USESHOWWINDOW)
+            showCommand = si.wShowWindow;
+
+        window->win32.showDefault = GLFW_FALSE;
+    }
+
+    ShowWindow(window->win32.handle, showCommand);
 }
 
-void _glfwPlatformHideWindow(_GLFWwindow* window)
+void _glfwHideWindowWin32(_GLFWwindow* window)
 {
     ShowWindow(window->win32.handle, SW_HIDE);
 }
 
-void _glfwPlatformRequestWindowAttention(_GLFWwindow* window)
+void _glfwRequestWindowAttentionWin32(_GLFWwindow* window)
 {
     FlashWindow(window->win32.handle, TRUE);
 }
 
-void _glfwPlatformFocusWindow(_GLFWwindow* window)
+void _glfwFocusWindowWin32(_GLFWwindow* window)
 {
     BringWindowToTop(window->win32.handle);
     SetForegroundWindow(window->win32.handle);
     SetFocus(window->win32.handle);
 }
 
-void _glfwPlatformSetWindowMonitor(_GLFWwindow* window,
-                                   _GLFWmonitor* monitor,
-                                   int xpos, int ypos,
-                                   int width, int height,
-                                   int refreshRate)
+void _glfwSetWindowMonitorWin32(_GLFWwindow* window,
+                                _GLFWmonitor* monitor,
+                                int xpos, int ypos,
+                                int width, int height,
+                                int refreshRate)
 {
     if (window->monitor == monitor)
     {
@@ -1814,7 +1857,7 @@
         {
             RECT rect = { xpos, ypos, xpos + width, ypos + height };
 
-            if (_glfwIsWindows10AnniversaryUpdateOrGreaterWin32())
+            if (_glfwIsWindows10Version1607OrGreaterWin32())
             {
                 AdjustWindowRectExForDpi(&rect, getWindowStyle(window),
                                          FALSE, getWindowExStyle(window),
@@ -1885,7 +1928,7 @@
         else
             after = HWND_NOTOPMOST;
 
-        if (_glfwIsWindows10AnniversaryUpdateOrGreaterWin32())
+        if (_glfwIsWindows10Version1607OrGreaterWin32())
         {
             AdjustWindowRectExForDpi(&rect, getWindowStyle(window),
                                      FALSE, getWindowExStyle(window),
@@ -1904,32 +1947,32 @@
     }
 }
 
-int _glfwPlatformWindowFocused(_GLFWwindow* window)
+GLFWbool _glfwWindowFocusedWin32(_GLFWwindow* window)
 {
     return window->win32.handle == GetActiveWindow();
 }
 
-int _glfwPlatformWindowIconified(_GLFWwindow* window)
+GLFWbool _glfwWindowIconifiedWin32(_GLFWwindow* window)
 {
     return IsIconic(window->win32.handle);
 }
 
-int _glfwPlatformWindowVisible(_GLFWwindow* window)
+GLFWbool _glfwWindowVisibleWin32(_GLFWwindow* window)
 {
     return IsWindowVisible(window->win32.handle);
 }
 
-int _glfwPlatformWindowMaximized(_GLFWwindow* window)
+GLFWbool _glfwWindowMaximizedWin32(_GLFWwindow* window)
 {
     return IsZoomed(window->win32.handle);
 }
 
-int _glfwPlatformWindowHovered(_GLFWwindow* window)
+GLFWbool _glfwWindowHoveredWin32(_GLFWwindow* window)
 {
     return cursorInContentArea(window);
 }
 
-int _glfwPlatformFramebufferTransparent(_GLFWwindow* window)
+GLFWbool _glfwFramebufferTransparentWin32(_GLFWwindow* window)
 {
     BOOL composition, opaque;
     DWORD color;
@@ -1956,24 +1999,54 @@
     return GLFW_TRUE;
 }
 
-void _glfwPlatformSetWindowResizable(_GLFWwindow* window, GLFWbool enabled)
+void _glfwSetWindowResizableWin32(_GLFWwindow* window, GLFWbool enabled)
 {
     updateWindowStyles(window);
 }
 
-void _glfwPlatformSetWindowDecorated(_GLFWwindow* window, GLFWbool enabled)
+void _glfwSetWindowDecoratedWin32(_GLFWwindow* window, GLFWbool enabled)
 {
     updateWindowStyles(window);
 }
 
-void _glfwPlatformSetWindowFloating(_GLFWwindow* window, GLFWbool enabled)
+void _glfwSetWindowFloatingWin32(_GLFWwindow* window, GLFWbool enabled)
 {
     const HWND after = enabled ? HWND_TOPMOST : HWND_NOTOPMOST;
     SetWindowPos(window->win32.handle, after, 0, 0, 0, 0,
                  SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE);
 }
 
-float _glfwPlatformGetWindowOpacity(_GLFWwindow* window)
+void _glfwSetWindowMousePassthroughWin32(_GLFWwindow* window, GLFWbool enabled)
+{
+    COLORREF key = 0;
+    BYTE alpha = 0;
+    DWORD flags = 0;
+    DWORD exStyle = GetWindowLongW(window->win32.handle, GWL_EXSTYLE);
+
+    if (exStyle & WS_EX_LAYERED)
+        GetLayeredWindowAttributes(window->win32.handle, &key, &alpha, &flags);
+
+    if (enabled)
+        exStyle |= (WS_EX_TRANSPARENT | WS_EX_LAYERED);
+    else
+    {
+        exStyle &= ~WS_EX_TRANSPARENT;
+        // NOTE: Window opacity also needs the layered window style so do not
+        //       remove it if the window is alpha blended
+        if (exStyle & WS_EX_LAYERED)
+        {
+            if (!(flags & LWA_ALPHA))
+                exStyle &= ~WS_EX_LAYERED;
+        }
+    }
+
+    SetWindowLongW(window->win32.handle, GWL_EXSTYLE, exStyle);
+
+    if (enabled)
+        SetLayeredWindowAttributes(window->win32.handle, key, alpha, flags);
+}
+
+float _glfwGetWindowOpacityWin32(_GLFWwindow* window)
 {
     BYTE alpha;
     DWORD flags;
@@ -1988,25 +2061,28 @@
     return 1.f;
 }
 
-void _glfwPlatformSetWindowOpacity(_GLFWwindow* window, float opacity)
+void _glfwSetWindowOpacityWin32(_GLFWwindow* window, float opacity)
 {
-    if (opacity < 1.f)
+    LONG exStyle = GetWindowLongW(window->win32.handle, GWL_EXSTYLE);
+    if (opacity < 1.f || (exStyle & WS_EX_TRANSPARENT))
     {
         const BYTE alpha = (BYTE) (255 * opacity);
-        DWORD style = GetWindowLongW(window->win32.handle, GWL_EXSTYLE);
-        style |= WS_EX_LAYERED;
-        SetWindowLongW(window->win32.handle, GWL_EXSTYLE, style);
+        exStyle |= WS_EX_LAYERED;
+        SetWindowLongW(window->win32.handle, GWL_EXSTYLE, exStyle);
         SetLayeredWindowAttributes(window->win32.handle, 0, alpha, LWA_ALPHA);
     }
+    else if (exStyle & WS_EX_TRANSPARENT)
+    {
+        SetLayeredWindowAttributes(window->win32.handle, 0, 0, 0);
+    }
     else
     {
-        DWORD style = GetWindowLongW(window->win32.handle, GWL_EXSTYLE);
-        style &= ~WS_EX_LAYERED;
-        SetWindowLongW(window->win32.handle, GWL_EXSTYLE, style);
+        exStyle &= ~WS_EX_LAYERED;
+        SetWindowLongW(window->win32.handle, GWL_EXSTYLE, exStyle);
     }
 }
 
-void _glfwPlatformSetRawMouseMotion(_GLFWwindow *window, GLFWbool enabled)
+void _glfwSetRawMouseMotionWin32(_GLFWwindow *window, GLFWbool enabled)
 {
     if (_glfw.win32.disabledCursorWindow != window)
         return;
@@ -2017,12 +2093,12 @@
         disableRawMouseMotion(window);
 }
 
-GLFWbool _glfwPlatformRawMouseMotionSupported(void)
+GLFWbool _glfwRawMouseMotionSupportedWin32(void)
 {
     return GLFW_TRUE;
 }
 
-void _glfwPlatformPollEvents(void)
+void _glfwPollEventsWin32(void)
 {
     MSG msg;
     HWND handle;
@@ -2092,38 +2168,39 @@
     if (window)
     {
         int width, height;
-        _glfwPlatformGetWindowSize(window, &width, &height);
+        _glfwGetWindowSizeWin32(window, &width, &height);
 
         // NOTE: Re-center the cursor only if it has moved since the last call,
         //       to avoid breaking glfwWaitEvents with WM_MOUSEMOVE
+        // The re-center is required in order to prevent the mouse cursor stopping at the edges of the screen.
         if (window->win32.lastCursorPosX != width / 2 ||
             window->win32.lastCursorPosY != height / 2)
         {
-            _glfwPlatformSetCursorPos(window, width / 2, height / 2);
+            _glfwSetCursorPosWin32(window, width / 2, height / 2);
         }
     }
 }
 
-void _glfwPlatformWaitEvents(void)
+void _glfwWaitEventsWin32(void)
 {
     WaitMessage();
 
-    _glfwPlatformPollEvents();
+    _glfwPollEventsWin32();
 }
 
-void _glfwPlatformWaitEventsTimeout(double timeout)
+void _glfwWaitEventsTimeoutWin32(double timeout)
 {
     MsgWaitForMultipleObjects(0, NULL, FALSE, (DWORD) (timeout * 1e3), QS_ALLINPUT);
 
-    _glfwPlatformPollEvents();
+    _glfwPollEventsWin32();
 }
 
-void _glfwPlatformPostEmptyEvent(void)
+void _glfwPostEmptyEventWin32(void)
 {
     PostMessageW(_glfw.win32.helperWindowHandle, WM_NULL, 0, 0);
 }
 
-void _glfwPlatformGetCursorPos(_GLFWwindow* window, double* xpos, double* ypos)
+void _glfwGetCursorPosWin32(_GLFWwindow* window, double* xpos, double* ypos)
 {
     POINT pos;
 
@@ -2138,7 +2215,7 @@
     }
 }
 
-void _glfwPlatformSetCursorPos(_GLFWwindow* window, double xpos, double ypos)
+void _glfwSetCursorPosWin32(_GLFWwindow* window, double xpos, double ypos)
 {
     POINT pos = { (int) xpos, (int) ypos };
 
@@ -2150,15 +2227,15 @@
     SetCursorPos(pos.x, pos.y);
 }
 
-void _glfwPlatformSetCursorMode(_GLFWwindow* window, int mode)
+void _glfwSetCursorModeWin32(_GLFWwindow* window, int mode)
 {
-    if (_glfwPlatformWindowFocused(window))
+    if (_glfwWindowFocusedWin32(window))
     {
         if (mode == GLFW_CURSOR_DISABLED)
         {
-            _glfwPlatformGetCursorPos(window,
-                                      &_glfw.win32.restoreCursorPosX,
-                                      &_glfw.win32.restoreCursorPosY);
+            _glfwGetCursorPosWin32(window,
+                                   &_glfw.win32.restoreCursorPosX,
+                                   &_glfw.win32.restoreCursorPosY);
             _glfwCenterCursorInContentArea(window);
             if (window->rawMouseMotion)
                 enableRawMouseMotion(window);
@@ -2169,7 +2246,7 @@
                 disableRawMouseMotion(window);
         }
 
-        if (mode == GLFW_CURSOR_DISABLED)
+        if (mode == GLFW_CURSOR_DISABLED || mode == GLFW_CURSOR_CAPTURED)
             captureCursor(window);
         else
             releaseCursor();
@@ -2179,9 +2256,9 @@
         else if (_glfw.win32.disabledCursorWindow == window)
         {
             _glfw.win32.disabledCursorWindow = NULL;
-            _glfwPlatformSetCursorPos(window,
-                                      _glfw.win32.restoreCursorPosX,
-                                      _glfw.win32.restoreCursorPosY);
+            _glfwSetCursorPosWin32(window,
+                                   _glfw.win32.restoreCursorPosX,
+                                   _glfw.win32.restoreCursorPosY);
         }
     }
 
@@ -2189,31 +2266,29 @@
         updateCursorImage(window);
 }
 
-const char* _glfwPlatformGetScancodeName(int scancode)
+const char* _glfwGetScancodeNameWin32(int scancode)
 {
-    int key;
-
     if (scancode < 0 || scancode > (KF_EXTENDED | 0xff))
     {
         _glfwInputError(GLFW_INVALID_VALUE, "Invalid scancode %i", scancode);
         return NULL;
     }
 
-    key = _glfw.win32.keycodes[scancode];
+    const int key = _glfw.win32.keycodes[scancode];
     if (key == GLFW_KEY_UNKNOWN)
         return NULL;
 
     return _glfw.win32.keynames[key];
 }
 
-int _glfwPlatformGetKeyScancode(int key)
+int _glfwGetKeyScancodeWin32(int key)
 {
     return _glfw.win32.scancodes[key];
 }
 
-int _glfwPlatformCreateCursor(_GLFWcursor* cursor,
-                              const GLFWimage* image,
-                              int xhot, int yhot)
+GLFWbool _glfwCreateCursorWin32(_GLFWcursor* cursor,
+                                const GLFWimage* image,
+                                int xhot, int yhot)
 {
     cursor->win32.handle = (HCURSOR) createIcon(image, xhot, yhot, GLFW_FALSE);
     if (!cursor->win32.handle)
@@ -2222,24 +2297,46 @@
     return GLFW_TRUE;
 }
 
-int _glfwPlatformCreateStandardCursor(_GLFWcursor* cursor, int shape)
+GLFWbool _glfwCreateStandardCursorWin32(_GLFWcursor* cursor, int shape)
 {
     int id = 0;
 
-    if (shape == GLFW_ARROW_CURSOR)
-        id = OCR_NORMAL;
-    else if (shape == GLFW_IBEAM_CURSOR)
-        id = OCR_IBEAM;
-    else if (shape == GLFW_CROSSHAIR_CURSOR)
-        id = OCR_CROSS;
-    else if (shape == GLFW_HAND_CURSOR)
-        id = OCR_HAND;
-    else if (shape == GLFW_HRESIZE_CURSOR)
-        id = OCR_SIZEWE;
-    else if (shape == GLFW_VRESIZE_CURSOR)
-        id = OCR_SIZENS;
-    else
-        return GLFW_FALSE;
+    switch (shape)
+    {
+        case GLFW_ARROW_CURSOR:
+            id = OCR_NORMAL;
+            break;
+        case GLFW_IBEAM_CURSOR:
+            id = OCR_IBEAM;
+            break;
+        case GLFW_CROSSHAIR_CURSOR:
+            id = OCR_CROSS;
+            break;
+        case GLFW_POINTING_HAND_CURSOR:
+            id = OCR_HAND;
+            break;
+        case GLFW_RESIZE_EW_CURSOR:
+            id = OCR_SIZEWE;
+            break;
+        case GLFW_RESIZE_NS_CURSOR:
+            id = OCR_SIZENS;
+            break;
+        case GLFW_RESIZE_NWSE_CURSOR:
+            id = OCR_SIZENWSE;
+            break;
+        case GLFW_RESIZE_NESW_CURSOR:
+            id = OCR_SIZENESW;
+            break;
+        case GLFW_RESIZE_ALL_CURSOR:
+            id = OCR_SIZEALL;
+            break;
+        case GLFW_NOT_ALLOWED_CURSOR:
+            id = OCR_NO;
+            break;
+        default:
+            _glfwInputError(GLFW_PLATFORM_ERROR, "Win32: Unknown standard cursor");
+            return GLFW_FALSE;
+    }
 
     cursor->win32.handle = LoadImageW(NULL,
                                       MAKEINTRESOURCEW(id), IMAGE_CURSOR, 0, 0,
@@ -2254,21 +2351,21 @@
     return GLFW_TRUE;
 }
 
-void _glfwPlatformDestroyCursor(_GLFWcursor* cursor)
+void _glfwDestroyCursorWin32(_GLFWcursor* cursor)
 {
     if (cursor->win32.handle)
         DestroyIcon((HICON) cursor->win32.handle);
 }
 
-void _glfwPlatformSetCursor(_GLFWwindow* window, _GLFWcursor* cursor)
+void _glfwSetCursorWin32(_GLFWwindow* window, _GLFWcursor* cursor)
 {
     if (cursorInContentArea(window))
         updateCursorImage(window);
 }
 
-void _glfwPlatformSetClipboardString(const char* string)
+void _glfwSetClipboardStringWin32(const char* string)
 {
-    int characterCount;
+    int characterCount, tries = 0;
     HANDLE object;
     WCHAR* buffer;
 
@@ -2296,12 +2393,20 @@
     MultiByteToWideChar(CP_UTF8, 0, string, -1, buffer, characterCount);
     GlobalUnlock(object);
 
-    if (!OpenClipboard(_glfw.win32.helperWindowHandle))
+    // NOTE: Retry clipboard opening a few times as some other application may have it
+    //       open and also the Windows Clipboard History reads it after each update
+    while (!OpenClipboard(_glfw.win32.helperWindowHandle))
     {
-        _glfwInputErrorWin32(GLFW_PLATFORM_ERROR,
-                             "Win32: Failed to open clipboard");
-        GlobalFree(object);
-        return;
+        Sleep(1);
+        tries++;
+
+        if (tries == 3)
+        {
+            _glfwInputErrorWin32(GLFW_PLATFORM_ERROR,
+                                 "Win32: Failed to open clipboard");
+            GlobalFree(object);
+            return;
+        }
     }
 
     EmptyClipboard();
@@ -2309,16 +2414,25 @@
     CloseClipboard();
 }
 
-const char* _glfwPlatformGetClipboardString(void)
+const char* _glfwGetClipboardStringWin32(void)
 {
     HANDLE object;
     WCHAR* buffer;
+    int tries = 0;
 
-    if (!OpenClipboard(_glfw.win32.helperWindowHandle))
+    // NOTE: Retry clipboard opening a few times as some other application may have it
+    //       open and also the Windows Clipboard History reads it after each update
+    while (!OpenClipboard(_glfw.win32.helperWindowHandle))
     {
-        _glfwInputErrorWin32(GLFW_PLATFORM_ERROR,
-                             "Win32: Failed to open clipboard");
-        return NULL;
+        Sleep(1);
+        tries++;
+
+        if (tries == 3)
+        {
+            _glfwInputErrorWin32(GLFW_PLATFORM_ERROR,
+                                 "Win32: Failed to open clipboard");
+            return NULL;
+        }
     }
 
     object = GetClipboardData(CF_UNICODETEXT);
@@ -2339,7 +2453,7 @@
         return NULL;
     }
 
-    free(_glfw.win32.clipboardString);
+    _glfw_free(_glfw.win32.clipboardString);
     _glfw.win32.clipboardString = _glfwCreateUTF8FromWideStringWin32(buffer);
 
     GlobalUnlock(object);
@@ -2348,7 +2462,58 @@
     return _glfw.win32.clipboardString;
 }
 
-void _glfwPlatformGetRequiredInstanceExtensions(char** extensions)
+EGLenum _glfwGetEGLPlatformWin32(EGLint** attribs)
+{
+    if (_glfw.egl.ANGLE_platform_angle)
+    {
+        int type = 0;
+
+        if (_glfw.egl.ANGLE_platform_angle_opengl)
+        {
+            if (_glfw.hints.init.angleType == GLFW_ANGLE_PLATFORM_TYPE_OPENGL)
+                type = EGL_PLATFORM_ANGLE_TYPE_OPENGL_ANGLE;
+            else if (_glfw.hints.init.angleType == GLFW_ANGLE_PLATFORM_TYPE_OPENGLES)
+                type = EGL_PLATFORM_ANGLE_TYPE_OPENGLES_ANGLE;
+        }
+
+        if (_glfw.egl.ANGLE_platform_angle_d3d)
+        {
+            if (_glfw.hints.init.angleType == GLFW_ANGLE_PLATFORM_TYPE_D3D9)
+                type = EGL_PLATFORM_ANGLE_TYPE_D3D9_ANGLE;
+            else if (_glfw.hints.init.angleType == GLFW_ANGLE_PLATFORM_TYPE_D3D11)
+                type = EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE;
+        }
+
+        if (_glfw.egl.ANGLE_platform_angle_vulkan)
+        {
+            if (_glfw.hints.init.angleType == GLFW_ANGLE_PLATFORM_TYPE_VULKAN)
+                type = EGL_PLATFORM_ANGLE_TYPE_VULKAN_ANGLE;
+        }
+
+        if (type)
+        {
+            *attribs = _glfw_calloc(3, sizeof(EGLint));
+            (*attribs)[0] = EGL_PLATFORM_ANGLE_TYPE_ANGLE;
+            (*attribs)[1] = type;
+            (*attribs)[2] = EGL_NONE;
+            return EGL_PLATFORM_ANGLE_ANGLE;
+        }
+    }
+
+    return 0;
+}
+
+EGLNativeDisplayType _glfwGetEGLNativeDisplayWin32(void)
+{
+    return GetDC(_glfw.win32.helperWindowHandle);
+}
+
+EGLNativeWindowType _glfwGetEGLNativeWindowWin32(_GLFWwindow* window)
+{
+    return window->win32.handle;
+}
+
+void _glfwGetRequiredInstanceExtensionsWin32(char** extensions)
 {
     if (!_glfw.vk.KHR_surface || !_glfw.vk.KHR_win32_surface)
         return;
@@ -2357,9 +2522,9 @@
     extensions[1] = "VK_KHR_win32_surface";
 }
 
-int _glfwPlatformGetPhysicalDevicePresentationSupport(VkInstance instance,
-                                                      VkPhysicalDevice device,
-                                                      uint32_t queuefamily)
+GLFWbool _glfwGetPhysicalDevicePresentationSupportWin32(VkInstance instance,
+                                                        VkPhysicalDevice device,
+                                                        uint32_t queuefamily)
 {
     PFN_vkGetPhysicalDeviceWin32PresentationSupportKHR
         vkGetPhysicalDeviceWin32PresentationSupportKHR =
@@ -2375,10 +2540,10 @@
     return vkGetPhysicalDeviceWin32PresentationSupportKHR(device, queuefamily);
 }
 
-VkResult _glfwPlatformCreateWindowSurface(VkInstance instance,
-                                          _GLFWwindow* window,
-                                          const VkAllocationCallbacks* allocator,
-                                          VkSurfaceKHR* surface)
+VkResult _glfwCreateWindowSurfaceWin32(VkInstance instance,
+                                       _GLFWwindow* window,
+                                       const VkAllocationCallbacks* allocator,
+                                       VkSurfaceKHR* surface)
 {
     VkResult err;
     VkWin32SurfaceCreateInfoKHR sci;
@@ -2409,15 +2574,20 @@
     return err;
 }
 
-
-//////////////////////////////////////////////////////////////////////////
-//////                        GLFW native API                       //////
-//////////////////////////////////////////////////////////////////////////
-
 GLFWAPI HWND glfwGetWin32Window(GLFWwindow* handle)
 {
     _GLFWwindow* window = (_GLFWwindow*) handle;
     _GLFW_REQUIRE_INIT_OR_RETURN(NULL);
+
+    if (_glfw.platform.platformID != GLFW_PLATFORM_WIN32)
+    {
+        _glfwInputError(GLFW_PLATFORM_UNAVAILABLE,
+                        "Win32: Platform not initialized");
+        return NULL;
+    }
+
     return window->win32.handle;
 }
 
+#endif // _GLFW_WIN32
+
diff --git a/src/window.c b/src/window.c
index db37a72..1463d16 100644
--- a/src/window.c
+++ b/src/window.c
@@ -1,5 +1,5 @@
 //========================================================================
-// GLFW 3.3 - www.glfw.org
+// GLFW 3.4 - www.glfw.org
 //------------------------------------------------------------------------
 // Copyright (c) 2002-2006 Marcus Geelnard
 // Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.org>
@@ -25,8 +25,6 @@
 //    distribution.
 //
 //========================================================================
-// Please use C89 style variable declarations in this file because VS 2010
-//========================================================================
 
 #include "internal.h"
 
@@ -44,6 +42,9 @@
 //
 void _glfwInputWindowFocus(_GLFWwindow* window, GLFWbool focused)
 {
+    assert(window != NULL);
+    assert(focused == GLFW_TRUE || focused == GLFW_FALSE);
+
     if (window->callbacks.focus)
         window->callbacks.focus((GLFWwindow*) window, focused);
 
@@ -55,7 +56,7 @@
         {
             if (window->keys[key] == GLFW_PRESS)
             {
-                const int scancode = _glfwPlatformGetKeyScancode(key);
+                const int scancode = _glfw.platform.getKeyScancode(key);
                 _glfwInputKey(window, key, scancode, GLFW_RELEASE, 0);
             }
         }
@@ -73,6 +74,8 @@
 //
 void _glfwInputWindowPos(_GLFWwindow* window, int x, int y)
 {
+    assert(window != NULL);
+
     if (window->callbacks.pos)
         window->callbacks.pos((GLFWwindow*) window, x, y);
 }
@@ -82,6 +85,10 @@
 //
 void _glfwInputWindowSize(_GLFWwindow* window, int width, int height)
 {
+    assert(window != NULL);
+    assert(width >= 0);
+    assert(height >= 0);
+
     if (window->callbacks.size)
         window->callbacks.size((GLFWwindow*) window, width, height);
 }
@@ -90,6 +97,9 @@
 //
 void _glfwInputWindowIconify(_GLFWwindow* window, GLFWbool iconified)
 {
+    assert(window != NULL);
+    assert(iconified == GLFW_TRUE || iconified == GLFW_FALSE);
+
     if (window->callbacks.iconify)
         window->callbacks.iconify((GLFWwindow*) window, iconified);
 }
@@ -98,6 +108,9 @@
 //
 void _glfwInputWindowMaximize(_GLFWwindow* window, GLFWbool maximized)
 {
+    assert(window != NULL);
+    assert(maximized == GLFW_TRUE || maximized == GLFW_FALSE);
+
     if (window->callbacks.maximize)
         window->callbacks.maximize((GLFWwindow*) window, maximized);
 }
@@ -107,6 +120,10 @@
 //
 void _glfwInputFramebufferSize(_GLFWwindow* window, int width, int height)
 {
+    assert(window != NULL);
+    assert(width >= 0);
+    assert(height >= 0);
+
     if (window->callbacks.fbsize)
         window->callbacks.fbsize((GLFWwindow*) window, width, height);
 }
@@ -116,6 +133,12 @@
 //
 void _glfwInputWindowContentScale(_GLFWwindow* window, float xscale, float yscale)
 {
+    assert(window != NULL);
+    assert(xscale > 0.f);
+    assert(xscale < FLT_MAX);
+    assert(yscale > 0.f);
+    assert(yscale < FLT_MAX);
+
     if (window->callbacks.scale)
         window->callbacks.scale((GLFWwindow*) window, xscale, yscale);
 }
@@ -124,6 +147,8 @@
 //
 void _glfwInputWindowDamage(_GLFWwindow* window)
 {
+    assert(window != NULL);
+
     if (window->callbacks.refresh)
         window->callbacks.refresh((GLFWwindow*) window);
 }
@@ -132,6 +157,8 @@
 //
 void _glfwInputWindowCloseRequest(_GLFWwindow* window)
 {
+    assert(window != NULL);
+
     window->shouldClose = GLFW_TRUE;
 
     if (window->callbacks.close)
@@ -142,6 +169,7 @@
 //
 void _glfwInputWindowMonitor(_GLFWwindow* window, _GLFWmonitor* monitor)
 {
+    assert(window != NULL);
     window->monitor = monitor;
 }
 
@@ -186,7 +214,7 @@
     if (!_glfwIsValidContextConfig(&ctxconfig))
         return NULL;
 
-    window = calloc(1, sizeof(_GLFWwindow));
+    window = _glfw_calloc(1, sizeof(_GLFWwindow));
     window->next = _glfw.windowListHead;
     _glfw.windowListHead = window;
 
@@ -197,13 +225,14 @@
     window->videoMode.blueBits    = fbconfig.blueBits;
     window->videoMode.refreshRate = _glfw.hints.refreshRate;
 
-    window->monitor     = (_GLFWmonitor*) monitor;
-    window->resizable   = wndconfig.resizable;
-    window->decorated   = wndconfig.decorated;
-    window->autoIconify = wndconfig.autoIconify;
-    window->floating    = wndconfig.floating;
-    window->focusOnShow = wndconfig.focusOnShow;
-    window->cursorMode  = GLFW_CURSOR_NORMAL;
+    window->monitor          = (_GLFWmonitor*) monitor;
+    window->resizable        = wndconfig.resizable;
+    window->decorated        = wndconfig.decorated;
+    window->autoIconify      = wndconfig.autoIconify;
+    window->floating         = wndconfig.floating;
+    window->focusOnShow      = wndconfig.focusOnShow;
+    window->mousePassthrough = wndconfig.mousePassthrough;
+    window->cursorMode       = GLFW_CURSOR_NORMAL;
 
     window->doublebuffer = fbconfig.doublebuffer;
 
@@ -213,9 +242,9 @@
     window->maxheight   = GLFW_DONT_CARE;
     window->numer       = GLFW_DONT_CARE;
     window->denom       = GLFW_DONT_CARE;
+    window->title       = _glfw_strdup(title);
 
-    // Open the actual window and create its context
-    if (!_glfwPlatformCreateWindow(window, &wndconfig, &ctxconfig, &fbconfig))
+    if (!_glfw.platform.createWindow(window, &wndconfig, &ctxconfig, &fbconfig))
     {
         glfwDestroyWindow((GLFWwindow*) window);
         return NULL;
@@ -244,6 +273,9 @@
     _glfw.hints.window.autoIconify  = GLFW_TRUE;
     _glfw.hints.window.centerCursor = GLFW_TRUE;
     _glfw.hints.window.focusOnShow  = GLFW_TRUE;
+    _glfw.hints.window.xpos         = GLFW_ANY_POSITION;
+    _glfw.hints.window.ypos         = GLFW_ANY_POSITION;
+    _glfw.hints.window.scaleFramebuffer = GLFW_TRUE;
 
     // The default is 24 bits of color, 24 bits of depth and 8 bits of stencil,
     // double buffered
@@ -258,9 +290,6 @@
 
     // The default is to select the highest available refresh rate
     _glfw.hints.refreshRate = GLFW_DONT_CARE;
-
-    // The default is to use full Retina resolution framebuffers
-    _glfw.hints.window.ns.retina = GLFW_TRUE;
 }
 
 GLFWAPI void glfwWindowHint(int hint, int value)
@@ -338,8 +367,17 @@
         case GLFW_VISIBLE:
             _glfw.hints.window.visible = value ? GLFW_TRUE : GLFW_FALSE;
             return;
-        case GLFW_COCOA_RETINA_FRAMEBUFFER:
-            _glfw.hints.window.ns.retina = value ? GLFW_TRUE : GLFW_FALSE;
+        case GLFW_POSITION_X:
+            _glfw.hints.window.xpos = value;
+            return;
+        case GLFW_POSITION_Y:
+            _glfw.hints.window.ypos = value;
+            return;
+        case GLFW_WIN32_KEYBOARD_MENU:
+            _glfw.hints.window.win32.keymenu = value ? GLFW_TRUE : GLFW_FALSE;
+            return;
+        case GLFW_WIN32_SHOWDEFAULT:
+            _glfw.hints.window.win32.showDefault = value ? GLFW_TRUE : GLFW_FALSE;
             return;
         case GLFW_COCOA_GRAPHICS_SWITCHING:
             _glfw.hints.context.nsgl.offline = value ? GLFW_TRUE : GLFW_FALSE;
@@ -347,12 +385,19 @@
         case GLFW_SCALE_TO_MONITOR:
             _glfw.hints.window.scaleToMonitor = value ? GLFW_TRUE : GLFW_FALSE;
             return;
+        case GLFW_SCALE_FRAMEBUFFER:
+        case GLFW_COCOA_RETINA_FRAMEBUFFER:
+            _glfw.hints.window.scaleFramebuffer = value ? GLFW_TRUE : GLFW_FALSE;
+            return;
         case GLFW_CENTER_CURSOR:
             _glfw.hints.window.centerCursor = value ? GLFW_TRUE : GLFW_FALSE;
             return;
         case GLFW_FOCUS_ON_SHOW:
             _glfw.hints.window.focusOnShow = value ? GLFW_TRUE : GLFW_FALSE;
             return;
+        case GLFW_MOUSE_PASSTHROUGH:
+            _glfw.hints.window.mousePassthrough = value ? GLFW_TRUE : GLFW_FALSE;
+            return;
         case GLFW_CLIENT_API:
             _glfw.hints.context.client = value;
             return;
@@ -371,7 +416,7 @@
         case GLFW_OPENGL_FORWARD_COMPAT:
             _glfw.hints.context.forward = value ? GLFW_TRUE : GLFW_FALSE;
             return;
-        case GLFW_OPENGL_DEBUG_CONTEXT:
+        case GLFW_CONTEXT_DEBUG:
             _glfw.hints.context.debug = value ? GLFW_TRUE : GLFW_FALSE;
             return;
         case GLFW_CONTEXT_NO_ERROR:
@@ -411,6 +456,10 @@
             strncpy(_glfw.hints.window.x11.instanceName, value,
                     sizeof(_glfw.hints.window.x11.instanceName) - 1);
             return;
+        case GLFW_WAYLAND_APP_ID:
+            strncpy(_glfw.hints.window.wl.appId, value,
+                    sizeof(_glfw.hints.window.wl.appId) - 1);
+            return;
     }
 
     _glfwInputError(GLFW_INVALID_ENUM, "Invalid window hint string 0x%08X", hint);
@@ -434,7 +483,7 @@
     if (window == _glfwPlatformGetTls(&_glfw.contextSlot))
         glfwMakeContextCurrent(NULL);
 
-    _glfwPlatformDestroyWindow(window);
+    _glfw.platform.destroyWindow(window);
 
     // Unlink window from global linked list
     {
@@ -446,7 +495,8 @@
         *prev = window->next;
     }
 
-    free(window);
+    _glfw_free(window->title);
+    _glfw_free(window);
 }
 
 GLFWAPI int glfwWindowShouldClose(GLFWwindow* handle)
@@ -467,6 +517,16 @@
     window->shouldClose = value;
 }
 
+GLFWAPI const char* glfwGetWindowTitle(GLFWwindow* handle)
+{
+    _GLFWwindow* window = (_GLFWwindow*) handle;
+    assert(window != NULL);
+
+    _GLFW_REQUIRE_INIT_OR_RETURN(NULL);
+
+    return window->title;
+}
+
 GLFWAPI void glfwSetWindowTitle(GLFWwindow* handle, const char* title)
 {
     _GLFWwindow* window = (_GLFWwindow*) handle;
@@ -474,7 +534,12 @@
     assert(title != NULL);
 
     _GLFW_REQUIRE_INIT();
-    _glfwPlatformSetWindowTitle(window, title);
+
+    char* prev = window->title;
+    window->title = _glfw_strdup(title);
+
+    _glfw.platform.setWindowTitle(window, title);
+    _glfw_free(prev);
 }
 
 GLFWAPI void glfwSetWindowIcon(GLFWwindow* handle,
@@ -507,7 +572,7 @@
         }
     }
 
-    _glfwPlatformSetWindowIcon(window, count, images);
+    _glfw.platform.setWindowIcon(window, count, images);
 }
 
 GLFWAPI void glfwGetWindowPos(GLFWwindow* handle, int* xpos, int* ypos)
@@ -521,7 +586,7 @@
         *ypos = 0;
 
     _GLFW_REQUIRE_INIT();
-    _glfwPlatformGetWindowPos(window, xpos, ypos);
+    _glfw.platform.getWindowPos(window, xpos, ypos);
 }
 
 GLFWAPI void glfwSetWindowPos(GLFWwindow* handle, int xpos, int ypos)
@@ -534,7 +599,7 @@
     if (window->monitor)
         return;
 
-    _glfwPlatformSetWindowPos(window, xpos, ypos);
+    _glfw.platform.setWindowPos(window, xpos, ypos);
 }
 
 GLFWAPI void glfwGetWindowSize(GLFWwindow* handle, int* width, int* height)
@@ -548,7 +613,7 @@
         *height = 0;
 
     _GLFW_REQUIRE_INIT();
-    _glfwPlatformGetWindowSize(window, width, height);
+    _glfw.platform.getWindowSize(window, width, height);
 }
 
 GLFWAPI void glfwSetWindowSize(GLFWwindow* handle, int width, int height)
@@ -563,7 +628,7 @@
     window->videoMode.width  = width;
     window->videoMode.height = height;
 
-    _glfwPlatformSetWindowSize(window, width, height);
+    _glfw.platform.setWindowSize(window, width, height);
 }
 
 GLFWAPI void glfwSetWindowSizeLimits(GLFWwindow* handle,
@@ -606,9 +671,9 @@
     if (window->monitor || !window->resizable)
         return;
 
-    _glfwPlatformSetWindowSizeLimits(window,
-                                     minwidth, minheight,
-                                     maxwidth, maxheight);
+    _glfw.platform.setWindowSizeLimits(window,
+                                       minwidth, minheight,
+                                       maxwidth, maxheight);
 }
 
 GLFWAPI void glfwSetWindowAspectRatio(GLFWwindow* handle, int numer, int denom)
@@ -637,7 +702,7 @@
     if (window->monitor || !window->resizable)
         return;
 
-    _glfwPlatformSetWindowAspectRatio(window, numer, denom);
+    _glfw.platform.setWindowAspectRatio(window, numer, denom);
 }
 
 GLFWAPI void glfwGetFramebufferSize(GLFWwindow* handle, int* width, int* height)
@@ -651,7 +716,7 @@
         *height = 0;
 
     _GLFW_REQUIRE_INIT();
-    _glfwPlatformGetFramebufferSize(window, width, height);
+    _glfw.platform.getFramebufferSize(window, width, height);
 }
 
 GLFWAPI void glfwGetWindowFrameSize(GLFWwindow* handle,
@@ -671,7 +736,7 @@
         *bottom = 0;
 
     _GLFW_REQUIRE_INIT();
-    _glfwPlatformGetWindowFrameSize(window, left, top, right, bottom);
+    _glfw.platform.getWindowFrameSize(window, left, top, right, bottom);
 }
 
 GLFWAPI void glfwGetWindowContentScale(GLFWwindow* handle,
@@ -686,7 +751,7 @@
         *yscale = 0.f;
 
     _GLFW_REQUIRE_INIT();
-    _glfwPlatformGetWindowContentScale(window, xscale, yscale);
+    _glfw.platform.getWindowContentScale(window, xscale, yscale);
 }
 
 GLFWAPI float glfwGetWindowOpacity(GLFWwindow* handle)
@@ -695,7 +760,7 @@
     assert(window != NULL);
 
     _GLFW_REQUIRE_INIT_OR_RETURN(0.f);
-    return _glfwPlatformGetWindowOpacity(window);
+    return _glfw.platform.getWindowOpacity(window);
 }
 
 GLFWAPI void glfwSetWindowOpacity(GLFWwindow* handle, float opacity)
@@ -714,7 +779,7 @@
         return;
     }
 
-    _glfwPlatformSetWindowOpacity(window, opacity);
+    _glfw.platform.setWindowOpacity(window, opacity);
 }
 
 GLFWAPI void glfwIconifyWindow(GLFWwindow* handle)
@@ -723,7 +788,7 @@
     assert(window != NULL);
 
     _GLFW_REQUIRE_INIT();
-    _glfwPlatformIconifyWindow(window);
+    _glfw.platform.iconifyWindow(window);
 }
 
 GLFWAPI void glfwRestoreWindow(GLFWwindow* handle)
@@ -732,7 +797,7 @@
     assert(window != NULL);
 
     _GLFW_REQUIRE_INIT();
-    _glfwPlatformRestoreWindow(window);
+    _glfw.platform.restoreWindow(window);
 }
 
 GLFWAPI void glfwMaximizeWindow(GLFWwindow* handle)
@@ -745,7 +810,7 @@
     if (window->monitor)
         return;
 
-    _glfwPlatformMaximizeWindow(window);
+    _glfw.platform.maximizeWindow(window);
 }
 
 GLFWAPI void glfwShowWindow(GLFWwindow* handle)
@@ -758,10 +823,10 @@
     if (window->monitor)
         return;
 
-    _glfwPlatformShowWindow(window);
+    _glfw.platform.showWindow(window);
 
     if (window->focusOnShow)
-        _glfwPlatformFocusWindow(window);
+        _glfw.platform.focusWindow(window);
 }
 
 GLFWAPI void glfwRequestWindowAttention(GLFWwindow* handle)
@@ -771,7 +836,7 @@
 
     _GLFW_REQUIRE_INIT();
 
-    _glfwPlatformRequestWindowAttention(window);
+    _glfw.platform.requestWindowAttention(window);
 }
 
 GLFWAPI void glfwHideWindow(GLFWwindow* handle)
@@ -784,7 +849,7 @@
     if (window->monitor)
         return;
 
-    _glfwPlatformHideWindow(window);
+    _glfw.platform.hideWindow(window);
 }
 
 GLFWAPI void glfwFocusWindow(GLFWwindow* handle)
@@ -794,7 +859,7 @@
 
     _GLFW_REQUIRE_INIT();
 
-    _glfwPlatformFocusWindow(window);
+    _glfw.platform.focusWindow(window);
 }
 
 GLFWAPI int glfwGetWindowAttrib(GLFWwindow* handle, int attrib)
@@ -807,19 +872,21 @@
     switch (attrib)
     {
         case GLFW_FOCUSED:
-            return _glfwPlatformWindowFocused(window);
+            return _glfw.platform.windowFocused(window);
         case GLFW_ICONIFIED:
-            return _glfwPlatformWindowIconified(window);
+            return _glfw.platform.windowIconified(window);
         case GLFW_VISIBLE:
-            return _glfwPlatformWindowVisible(window);
+            return _glfw.platform.windowVisible(window);
         case GLFW_MAXIMIZED:
-            return _glfwPlatformWindowMaximized(window);
+            return _glfw.platform.windowMaximized(window);
         case GLFW_HOVERED:
-            return _glfwPlatformWindowHovered(window);
+            return _glfw.platform.windowHovered(window);
         case GLFW_FOCUS_ON_SHOW:
             return window->focusOnShow;
+        case GLFW_MOUSE_PASSTHROUGH:
+            return window->mousePassthrough;
         case GLFW_TRANSPARENT_FRAMEBUFFER:
-            return _glfwPlatformFramebufferTransparent(window);
+            return _glfw.platform.framebufferTransparent(window);
         case GLFW_RESIZABLE:
             return window->resizable;
         case GLFW_DECORATED:
@@ -828,6 +895,8 @@
             return window->floating;
         case GLFW_AUTO_ICONIFY:
             return window->autoIconify;
+        case GLFW_DOUBLEBUFFER:
+            return window->doublebuffer;
         case GLFW_CLIENT_API:
             return window->context.client;
         case GLFW_CONTEXT_CREATION_API:
@@ -842,7 +911,7 @@
             return window->context.robustness;
         case GLFW_OPENGL_FORWARD_COMPAT:
             return window->context.forward;
-        case GLFW_OPENGL_DEBUG_CONTEXT:
+        case GLFW_CONTEXT_DEBUG:
             return window->context.debug;
         case GLFW_OPENGL_PROFILE:
             return window->context.profile;
@@ -865,39 +934,41 @@
 
     value = value ? GLFW_TRUE : GLFW_FALSE;
 
-    if (attrib == GLFW_AUTO_ICONIFY)
-        window->autoIconify = value;
-    else if (attrib == GLFW_RESIZABLE)
+    switch (attrib)
     {
-        if (window->resizable == value)
+        case GLFW_AUTO_ICONIFY:
+            window->autoIconify = value;
             return;
 
-        window->resizable = value;
-        if (!window->monitor)
-            _glfwPlatformSetWindowResizable(window, value);
-    }
-    else if (attrib == GLFW_DECORATED)
-    {
-        if (window->decorated == value)
+        case GLFW_RESIZABLE:
+            window->resizable = value;
+            if (!window->monitor)
+                _glfw.platform.setWindowResizable(window, value);
             return;
 
-        window->decorated = value;
-        if (!window->monitor)
-            _glfwPlatformSetWindowDecorated(window, value);
-    }
-    else if (attrib == GLFW_FLOATING)
-    {
-        if (window->floating == value)
+        case GLFW_DECORATED:
+            window->decorated = value;
+            if (!window->monitor)
+                _glfw.platform.setWindowDecorated(window, value);
             return;
 
-        window->floating = value;
-        if (!window->monitor)
-            _glfwPlatformSetWindowFloating(window, value);
+        case GLFW_FLOATING:
+            window->floating = value;
+            if (!window->monitor)
+                _glfw.platform.setWindowFloating(window, value);
+            return;
+
+        case GLFW_FOCUS_ON_SHOW:
+            window->focusOnShow = value;
+            return;
+
+        case GLFW_MOUSE_PASSTHROUGH:
+            window->mousePassthrough = value;
+            _glfw.platform.setWindowMousePassthrough(window, value);
+            return;
     }
-    else if (attrib == GLFW_FOCUS_ON_SHOW)
-        window->focusOnShow = value;
-    else
-        _glfwInputError(GLFW_INVALID_ENUM, "Invalid window attribute 0x%08X", attrib);
+
+    _glfwInputError(GLFW_INVALID_ENUM, "Invalid window attribute 0x%08X", attrib);
 }
 
 GLFWAPI GLFWmonitor* glfwGetWindowMonitor(GLFWwindow* handle)
@@ -943,9 +1014,9 @@
     window->videoMode.height      = height;
     window->videoMode.refreshRate = refreshRate;
 
-    _glfwPlatformSetWindowMonitor(window, monitor,
-                                  xpos, ypos, width, height,
-                                  refreshRate);
+    _glfw.platform.setWindowMonitor(window, monitor,
+                                    xpos, ypos, width, height,
+                                    refreshRate);
 }
 
 GLFWAPI void glfwSetWindowUserPointer(GLFWwindow* handle, void* pointer)
@@ -973,7 +1044,7 @@
     assert(window != NULL);
 
     _GLFW_REQUIRE_INIT_OR_RETURN(NULL);
-    _GLFW_SWAP_POINTERS(window->callbacks.pos, cbfun);
+    _GLFW_SWAP(GLFWwindowposfun, window->callbacks.pos, cbfun);
     return cbfun;
 }
 
@@ -984,7 +1055,7 @@
     assert(window != NULL);
 
     _GLFW_REQUIRE_INIT_OR_RETURN(NULL);
-    _GLFW_SWAP_POINTERS(window->callbacks.size, cbfun);
+    _GLFW_SWAP(GLFWwindowsizefun, window->callbacks.size, cbfun);
     return cbfun;
 }
 
@@ -995,7 +1066,7 @@
     assert(window != NULL);
 
     _GLFW_REQUIRE_INIT_OR_RETURN(NULL);
-    _GLFW_SWAP_POINTERS(window->callbacks.close, cbfun);
+    _GLFW_SWAP(GLFWwindowclosefun, window->callbacks.close, cbfun);
     return cbfun;
 }
 
@@ -1006,7 +1077,7 @@
     assert(window != NULL);
 
     _GLFW_REQUIRE_INIT_OR_RETURN(NULL);
-    _GLFW_SWAP_POINTERS(window->callbacks.refresh, cbfun);
+    _GLFW_SWAP(GLFWwindowrefreshfun, window->callbacks.refresh, cbfun);
     return cbfun;
 }
 
@@ -1017,7 +1088,7 @@
     assert(window != NULL);
 
     _GLFW_REQUIRE_INIT_OR_RETURN(NULL);
-    _GLFW_SWAP_POINTERS(window->callbacks.focus, cbfun);
+    _GLFW_SWAP(GLFWwindowfocusfun, window->callbacks.focus, cbfun);
     return cbfun;
 }
 
@@ -1028,7 +1099,7 @@
     assert(window != NULL);
 
     _GLFW_REQUIRE_INIT_OR_RETURN(NULL);
-    _GLFW_SWAP_POINTERS(window->callbacks.iconify, cbfun);
+    _GLFW_SWAP(GLFWwindowiconifyfun, window->callbacks.iconify, cbfun);
     return cbfun;
 }
 
@@ -1039,7 +1110,7 @@
     assert(window != NULL);
 
     _GLFW_REQUIRE_INIT_OR_RETURN(NULL);
-    _GLFW_SWAP_POINTERS(window->callbacks.maximize, cbfun);
+    _GLFW_SWAP(GLFWwindowmaximizefun, window->callbacks.maximize, cbfun);
     return cbfun;
 }
 
@@ -1050,7 +1121,7 @@
     assert(window != NULL);
 
     _GLFW_REQUIRE_INIT_OR_RETURN(NULL);
-    _GLFW_SWAP_POINTERS(window->callbacks.fbsize, cbfun);
+    _GLFW_SWAP(GLFWframebuffersizefun, window->callbacks.fbsize, cbfun);
     return cbfun;
 }
 
@@ -1061,20 +1132,20 @@
     assert(window != NULL);
 
     _GLFW_REQUIRE_INIT_OR_RETURN(NULL);
-    _GLFW_SWAP_POINTERS(window->callbacks.scale, cbfun);
+    _GLFW_SWAP(GLFWwindowcontentscalefun, window->callbacks.scale, cbfun);
     return cbfun;
 }
 
 GLFWAPI void glfwPollEvents(void)
 {
     _GLFW_REQUIRE_INIT();
-    _glfwPlatformPollEvents();
+    _glfw.platform.pollEvents();
 }
 
 GLFWAPI void glfwWaitEvents(void)
 {
     _GLFW_REQUIRE_INIT();
-    _glfwPlatformWaitEvents();
+    _glfw.platform.waitEvents();
 }
 
 GLFWAPI void glfwWaitEventsTimeout(double timeout)
@@ -1090,12 +1161,12 @@
         return;
     }
 
-    _glfwPlatformWaitEventsTimeout(timeout);
+    _glfw.platform.waitEventsTimeout(timeout);
 }
 
 GLFWAPI void glfwPostEmptyEvent(void)
 {
     _GLFW_REQUIRE_INIT();
-    _glfwPlatformPostEmptyEvent();
+    _glfw.platform.postEmptyEvent();
 }
 
diff --git a/src/wl_init.c b/src/wl_init.c
index f66c63a..3aff476 100644
--- a/src/wl_init.c
+++ b/src/wl_init.c
@@ -1,5 +1,5 @@
 //========================================================================
-// GLFW 3.3 Wayland - www.glfw.org
+// GLFW 3.4 Wayland - www.glfw.org
 //------------------------------------------------------------------------
 // Copyright (c) 2014 Jonas Ådahl <jadahl@gmail.com>
 //
@@ -23,13 +23,11 @@
 //    distribution.
 //
 //========================================================================
-// It is fine to use C99 in this file because it will not be built with VS
-//========================================================================
-
-#define _POSIX_C_SOURCE 200809L
 
 #include "internal.h"
 
+#if defined(_GLFW_WAYLAND)
+
 #include <errno.h>
 #include <limits.h>
 #include <linux/input.h>
@@ -39,9 +37,60 @@
 #include <sys/mman.h>
 #include <sys/timerfd.h>
 #include <unistd.h>
-#include <wayland-client.h>
+#include <time.h>
 #include <assert.h>
 
+#include "wayland-client-protocol.h"
+#include "xdg-shell-client-protocol.h"
+#include "xdg-decoration-unstable-v1-client-protocol.h"
+#include "viewporter-client-protocol.h"
+#include "relative-pointer-unstable-v1-client-protocol.h"
+#include "pointer-constraints-unstable-v1-client-protocol.h"
+#include "fractional-scale-v1-client-protocol.h"
+#include "xdg-activation-v1-client-protocol.h"
+#include "idle-inhibit-unstable-v1-client-protocol.h"
+
+// NOTE: Versions of wayland-scanner prior to 1.17.91 named every global array of
+//       wl_interface pointers 'types', making it impossible to combine several unmodified
+//       private-code files into a single compilation unit
+// HACK: We override this name with a macro for each file, allowing them to coexist
+
+#define types _glfw_wayland_types
+#include "wayland-client-protocol-code.h"
+#undef types
+
+#define types _glfw_xdg_shell_types
+#include "xdg-shell-client-protocol-code.h"
+#undef types
+
+#define types _glfw_xdg_decoration_types
+#include "xdg-decoration-unstable-v1-client-protocol-code.h"
+#undef types
+
+#define types _glfw_viewporter_types
+#include "viewporter-client-protocol-code.h"
+#undef types
+
+#define types _glfw_relative_pointer_types
+#include "relative-pointer-unstable-v1-client-protocol-code.h"
+#undef types
+
+#define types _glfw_pointer_constraints_types
+#include "pointer-constraints-unstable-v1-client-protocol-code.h"
+#undef types
+
+#define types _glfw_fractional_scale_types
+#include "fractional-scale-v1-client-protocol-code.h"
+#undef types
+
+#define types _glfw_xdg_activation_types
+#include "xdg-activation-v1-client-protocol-code.h"
+#undef types
+
+#define types _glfw_idle_inhibit_types
+#include "idle-inhibit-unstable-v1-client-protocol-code.h"
+#undef types
+
 static void wmBaseHandlePing(void* userData,
                              struct xdg_wm_base* wmBase,
                              uint32_t serial)
@@ -138,15 +187,27 @@
                              &zwp_idle_inhibit_manager_v1_interface,
                              1);
     }
+    else if (strcmp(interface, "xdg_activation_v1") == 0)
+    {
+        _glfw.wl.activationManager =
+            wl_registry_bind(registry, name,
+                             &xdg_activation_v1_interface,
+                             1);
+    }
+    else if (strcmp(interface, "wp_fractional_scale_manager_v1") == 0)
+    {
+        _glfw.wl.fractionalScaleManager =
+            wl_registry_bind(registry, name,
+                             &wp_fractional_scale_manager_v1_interface,
+                             1);
+    }
 }
 
 static void registryHandleGlobalRemove(void* userData,
                                        struct wl_registry* registry,
                                        uint32_t name)
 {
-    int i;
-
-    for (i = 0; i < _glfw.monitorCount; ++i)
+    for (int i = 0; i < _glfw.monitorCount; ++i)
     {
         _GLFWmonitor* monitor = _glfw.monitors[i];
         if (monitor->wl.name == name)
@@ -198,8 +259,6 @@
 //
 static void createKeyTables(void)
 {
-    int scancode;
-
     memset(_glfw.wl.keycodes, -1, sizeof(_glfw.wl.keycodes));
     memset(_glfw.wl.scancodes, -1, sizeof(_glfw.wl.scancodes));
 
@@ -322,7 +381,7 @@
     _glfw.wl.keycodes[KEY_KPENTER]    = GLFW_KEY_KP_ENTER;
     _glfw.wl.keycodes[KEY_102ND]      = GLFW_KEY_WORLD_2;
 
-    for (scancode = 0;  scancode < 256;  scancode++)
+    for (int scancode = 0;  scancode < 256;  scancode++)
     {
         if (_glfw.wl.keycodes[scancode] > 0)
             _glfw.wl.scancodes[_glfw.wl.keycodes[scancode]] = scancode;
@@ -366,7 +425,136 @@
 //////                       GLFW platform API                      //////
 //////////////////////////////////////////////////////////////////////////
 
-int _glfwPlatformInit(void)
+GLFWbool _glfwConnectWayland(int platformID, _GLFWplatform* platform)
+{
+    const _GLFWplatform wayland =
+    {
+        .platformID = GLFW_PLATFORM_WAYLAND,
+        .init = _glfwInitWayland,
+        .terminate = _glfwTerminateWayland,
+        .getCursorPos = _glfwGetCursorPosWayland,
+        .setCursorPos = _glfwSetCursorPosWayland,
+        .setCursorMode = _glfwSetCursorModeWayland,
+        .setRawMouseMotion = _glfwSetRawMouseMotionWayland,
+        .rawMouseMotionSupported = _glfwRawMouseMotionSupportedWayland,
+        .createCursor = _glfwCreateCursorWayland,
+        .createStandardCursor = _glfwCreateStandardCursorWayland,
+        .destroyCursor = _glfwDestroyCursorWayland,
+        .setCursor = _glfwSetCursorWayland,
+        .getScancodeName = _glfwGetScancodeNameWayland,
+        .getKeyScancode = _glfwGetKeyScancodeWayland,
+        .setClipboardString = _glfwSetClipboardStringWayland,
+        .getClipboardString = _glfwGetClipboardStringWayland,
+#if defined(GLFW_BUILD_LINUX_JOYSTICK)
+        .initJoysticks = _glfwInitJoysticksLinux,
+        .terminateJoysticks = _glfwTerminateJoysticksLinux,
+        .pollJoystick = _glfwPollJoystickLinux,
+        .getMappingName = _glfwGetMappingNameLinux,
+        .updateGamepadGUID = _glfwUpdateGamepadGUIDLinux,
+#else
+        .initJoysticks = _glfwInitJoysticksNull,
+        .terminateJoysticks = _glfwTerminateJoysticksNull,
+        .pollJoystick = _glfwPollJoystickNull,
+        .getMappingName = _glfwGetMappingNameNull,
+        .updateGamepadGUID = _glfwUpdateGamepadGUIDNull,
+#endif
+        .freeMonitor = _glfwFreeMonitorWayland,
+        .getMonitorPos = _glfwGetMonitorPosWayland,
+        .getMonitorContentScale = _glfwGetMonitorContentScaleWayland,
+        .getMonitorWorkarea = _glfwGetMonitorWorkareaWayland,
+        .getVideoModes = _glfwGetVideoModesWayland,
+        .getVideoMode = _glfwGetVideoModeWayland,
+        .getGammaRamp = _glfwGetGammaRampWayland,
+        .setGammaRamp = _glfwSetGammaRampWayland,
+        .createWindow = _glfwCreateWindowWayland,
+        .destroyWindow = _glfwDestroyWindowWayland,
+        .setWindowTitle = _glfwSetWindowTitleWayland,
+        .setWindowIcon = _glfwSetWindowIconWayland,
+        .getWindowPos = _glfwGetWindowPosWayland,
+        .setWindowPos = _glfwSetWindowPosWayland,
+        .getWindowSize = _glfwGetWindowSizeWayland,
+        .setWindowSize = _glfwSetWindowSizeWayland,
+        .setWindowSizeLimits = _glfwSetWindowSizeLimitsWayland,
+        .setWindowAspectRatio = _glfwSetWindowAspectRatioWayland,
+        .getFramebufferSize = _glfwGetFramebufferSizeWayland,
+        .getWindowFrameSize = _glfwGetWindowFrameSizeWayland,
+        .getWindowContentScale = _glfwGetWindowContentScaleWayland,
+        .iconifyWindow = _glfwIconifyWindowWayland,
+        .restoreWindow = _glfwRestoreWindowWayland,
+        .maximizeWindow = _glfwMaximizeWindowWayland,
+        .showWindow = _glfwShowWindowWayland,
+        .hideWindow = _glfwHideWindowWayland,
+        .requestWindowAttention = _glfwRequestWindowAttentionWayland,
+        .focusWindow = _glfwFocusWindowWayland,
+        .setWindowMonitor = _glfwSetWindowMonitorWayland,
+        .windowFocused = _glfwWindowFocusedWayland,
+        .windowIconified = _glfwWindowIconifiedWayland,
+        .windowVisible = _glfwWindowVisibleWayland,
+        .windowMaximized = _glfwWindowMaximizedWayland,
+        .windowHovered = _glfwWindowHoveredWayland,
+        .framebufferTransparent = _glfwFramebufferTransparentWayland,
+        .getWindowOpacity = _glfwGetWindowOpacityWayland,
+        .setWindowResizable = _glfwSetWindowResizableWayland,
+        .setWindowDecorated = _glfwSetWindowDecoratedWayland,
+        .setWindowFloating = _glfwSetWindowFloatingWayland,
+        .setWindowOpacity = _glfwSetWindowOpacityWayland,
+        .setWindowMousePassthrough = _glfwSetWindowMousePassthroughWayland,
+        .pollEvents = _glfwPollEventsWayland,
+        .waitEvents = _glfwWaitEventsWayland,
+        .waitEventsTimeout = _glfwWaitEventsTimeoutWayland,
+        .postEmptyEvent = _glfwPostEmptyEventWayland,
+        .getEGLPlatform = _glfwGetEGLPlatformWayland,
+        .getEGLNativeDisplay = _glfwGetEGLNativeDisplayWayland,
+        .getEGLNativeWindow = _glfwGetEGLNativeWindowWayland,
+        .getRequiredInstanceExtensions = _glfwGetRequiredInstanceExtensionsWayland,
+        .getPhysicalDevicePresentationSupport = _glfwGetPhysicalDevicePresentationSupportWayland,
+        .createWindowSurface = _glfwCreateWindowSurfaceWayland
+    };
+
+    void* module = _glfwPlatformLoadModule("libwayland-client.so.0");
+    if (!module)
+    {
+        if (platformID == GLFW_PLATFORM_WAYLAND)
+        {
+            _glfwInputError(GLFW_PLATFORM_ERROR,
+                            "Wayland: Failed to load libwayland-client");
+        }
+
+        return GLFW_FALSE;
+    }
+
+    PFN_wl_display_connect wl_display_connect = (PFN_wl_display_connect)
+        _glfwPlatformGetModuleSymbol(module, "wl_display_connect");
+    if (!wl_display_connect)
+    {
+        if (platformID == GLFW_PLATFORM_WAYLAND)
+        {
+            _glfwInputError(GLFW_PLATFORM_ERROR,
+                            "Wayland: Failed to load libwayland-client entry point");
+        }
+
+        _glfwPlatformFreeModule(module);
+        return GLFW_FALSE;
+    }
+
+    struct wl_display* display = wl_display_connect(NULL);
+    if (!display)
+    {
+        if (platformID == GLFW_PLATFORM_WAYLAND)
+            _glfwInputError(GLFW_PLATFORM_ERROR, "Wayland: Failed to connect to display");
+
+        _glfwPlatformFreeModule(module);
+        return GLFW_FALSE;
+    }
+
+    _glfw.wl.display = display;
+    _glfw.wl.client.handle = module;
+
+    *platform = wayland;
+    return GLFW_TRUE;
+}
+
+int _glfwInitWayland(void)
 {
     // These must be set before any failure checks
     _glfw.wl.keyRepeatTimerfd = -1;
@@ -374,7 +562,69 @@
 
     _glfw.wl.tag = glfwGetVersionString();
 
-    _glfw.wl.cursor.handle = _glfw_dlopen("libwayland-cursor.so.0");
+    _glfw.wl.client.display_flush = (PFN_wl_display_flush)
+        _glfwPlatformGetModuleSymbol(_glfw.wl.client.handle, "wl_display_flush");
+    _glfw.wl.client.display_cancel_read = (PFN_wl_display_cancel_read)
+        _glfwPlatformGetModuleSymbol(_glfw.wl.client.handle, "wl_display_cancel_read");
+    _glfw.wl.client.display_dispatch_pending = (PFN_wl_display_dispatch_pending)
+        _glfwPlatformGetModuleSymbol(_glfw.wl.client.handle, "wl_display_dispatch_pending");
+    _glfw.wl.client.display_read_events = (PFN_wl_display_read_events)
+        _glfwPlatformGetModuleSymbol(_glfw.wl.client.handle, "wl_display_read_events");
+    _glfw.wl.client.display_disconnect = (PFN_wl_display_disconnect)
+        _glfwPlatformGetModuleSymbol(_glfw.wl.client.handle, "wl_display_disconnect");
+    _glfw.wl.client.display_roundtrip = (PFN_wl_display_roundtrip)
+        _glfwPlatformGetModuleSymbol(_glfw.wl.client.handle, "wl_display_roundtrip");
+    _glfw.wl.client.display_get_fd = (PFN_wl_display_get_fd)
+        _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.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)
+        _glfwPlatformGetModuleSymbol(_glfw.wl.client.handle, "wl_proxy_add_listener");
+    _glfw.wl.client.proxy_destroy = (PFN_wl_proxy_destroy)
+        _glfwPlatformGetModuleSymbol(_glfw.wl.client.handle, "wl_proxy_destroy");
+    _glfw.wl.client.proxy_marshal_constructor = (PFN_wl_proxy_marshal_constructor)
+        _glfwPlatformGetModuleSymbol(_glfw.wl.client.handle, "wl_proxy_marshal_constructor");
+    _glfw.wl.client.proxy_marshal_constructor_versioned = (PFN_wl_proxy_marshal_constructor_versioned)
+        _glfwPlatformGetModuleSymbol(_glfw.wl.client.handle, "wl_proxy_marshal_constructor_versioned");
+    _glfw.wl.client.proxy_get_user_data = (PFN_wl_proxy_get_user_data)
+        _glfwPlatformGetModuleSymbol(_glfw.wl.client.handle, "wl_proxy_get_user_data");
+    _glfw.wl.client.proxy_set_user_data = (PFN_wl_proxy_set_user_data)
+        _glfwPlatformGetModuleSymbol(_glfw.wl.client.handle, "wl_proxy_set_user_data");
+    _glfw.wl.client.proxy_get_tag = (PFN_wl_proxy_get_tag)
+        _glfwPlatformGetModuleSymbol(_glfw.wl.client.handle, "wl_proxy_get_tag");
+    _glfw.wl.client.proxy_set_tag = (PFN_wl_proxy_set_tag)
+        _glfwPlatformGetModuleSymbol(_glfw.wl.client.handle, "wl_proxy_set_tag");
+    _glfw.wl.client.proxy_get_version = (PFN_wl_proxy_get_version)
+        _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");
+
+    if (!_glfw.wl.client.display_flush ||
+        !_glfw.wl.client.display_cancel_read ||
+        !_glfw.wl.client.display_dispatch_pending ||
+        !_glfw.wl.client.display_read_events ||
+        !_glfw.wl.client.display_disconnect ||
+        !_glfw.wl.client.display_roundtrip ||
+        !_glfw.wl.client.display_get_fd ||
+        !_glfw.wl.client.display_prepare_read ||
+        !_glfw.wl.client.proxy_marshal ||
+        !_glfw.wl.client.proxy_add_listener ||
+        !_glfw.wl.client.proxy_destroy ||
+        !_glfw.wl.client.proxy_marshal_constructor ||
+        !_glfw.wl.client.proxy_marshal_constructor_versioned ||
+        !_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)
+    {
+        _glfwInputError(GLFW_PLATFORM_ERROR,
+                        "Wayland: Failed to load libwayland-client entry point");
+        return GLFW_FALSE;
+    }
+
+    _glfw.wl.cursor.handle = _glfwPlatformLoadModule("libwayland-cursor.so.0");
     if (!_glfw.wl.cursor.handle)
     {
         _glfwInputError(GLFW_PLATFORM_ERROR,
@@ -383,15 +633,15 @@
     }
 
     _glfw.wl.cursor.theme_load = (PFN_wl_cursor_theme_load)
-        _glfw_dlsym(_glfw.wl.cursor.handle, "wl_cursor_theme_load");
+        _glfwPlatformGetModuleSymbol(_glfw.wl.cursor.handle, "wl_cursor_theme_load");
     _glfw.wl.cursor.theme_destroy = (PFN_wl_cursor_theme_destroy)
-        _glfw_dlsym(_glfw.wl.cursor.handle, "wl_cursor_theme_destroy");
+        _glfwPlatformGetModuleSymbol(_glfw.wl.cursor.handle, "wl_cursor_theme_destroy");
     _glfw.wl.cursor.theme_get_cursor = (PFN_wl_cursor_theme_get_cursor)
-        _glfw_dlsym(_glfw.wl.cursor.handle, "wl_cursor_theme_get_cursor");
+        _glfwPlatformGetModuleSymbol(_glfw.wl.cursor.handle, "wl_cursor_theme_get_cursor");
     _glfw.wl.cursor.image_get_buffer = (PFN_wl_cursor_image_get_buffer)
-        _glfw_dlsym(_glfw.wl.cursor.handle, "wl_cursor_image_get_buffer");
+        _glfwPlatformGetModuleSymbol(_glfw.wl.cursor.handle, "wl_cursor_image_get_buffer");
 
-    _glfw.wl.egl.handle = _glfw_dlopen("libwayland-egl.so.1");
+    _glfw.wl.egl.handle = _glfwPlatformLoadModule("libwayland-egl.so.1");
     if (!_glfw.wl.egl.handle)
     {
         _glfwInputError(GLFW_PLATFORM_ERROR,
@@ -400,13 +650,13 @@
     }
 
     _glfw.wl.egl.window_create = (PFN_wl_egl_window_create)
-        _glfw_dlsym(_glfw.wl.egl.handle, "wl_egl_window_create");
+        _glfwPlatformGetModuleSymbol(_glfw.wl.egl.handle, "wl_egl_window_create");
     _glfw.wl.egl.window_destroy = (PFN_wl_egl_window_destroy)
-        _glfw_dlsym(_glfw.wl.egl.handle, "wl_egl_window_destroy");
+        _glfwPlatformGetModuleSymbol(_glfw.wl.egl.handle, "wl_egl_window_destroy");
     _glfw.wl.egl.window_resize = (PFN_wl_egl_window_resize)
-        _glfw_dlsym(_glfw.wl.egl.handle, "wl_egl_window_resize");
+        _glfwPlatformGetModuleSymbol(_glfw.wl.egl.handle, "wl_egl_window_resize");
 
-    _glfw.wl.xkb.handle = _glfw_dlopen("libxkbcommon.so.0");
+    _glfw.wl.xkb.handle = _glfwPlatformLoadModule("libxkbcommon.so.0");
     if (!_glfw.wl.xkb.handle)
     {
         _glfwInputError(GLFW_PLATFORM_ERROR,
@@ -415,110 +665,127 @@
     }
 
     _glfw.wl.xkb.context_new = (PFN_xkb_context_new)
-        _glfw_dlsym(_glfw.wl.xkb.handle, "xkb_context_new");
+        _glfwPlatformGetModuleSymbol(_glfw.wl.xkb.handle, "xkb_context_new");
     _glfw.wl.xkb.context_unref = (PFN_xkb_context_unref)
-        _glfw_dlsym(_glfw.wl.xkb.handle, "xkb_context_unref");
+        _glfwPlatformGetModuleSymbol(_glfw.wl.xkb.handle, "xkb_context_unref");
     _glfw.wl.xkb.keymap_new_from_string = (PFN_xkb_keymap_new_from_string)
-        _glfw_dlsym(_glfw.wl.xkb.handle, "xkb_keymap_new_from_string");
+        _glfwPlatformGetModuleSymbol(_glfw.wl.xkb.handle, "xkb_keymap_new_from_string");
     _glfw.wl.xkb.keymap_unref = (PFN_xkb_keymap_unref)
-        _glfw_dlsym(_glfw.wl.xkb.handle, "xkb_keymap_unref");
+        _glfwPlatformGetModuleSymbol(_glfw.wl.xkb.handle, "xkb_keymap_unref");
     _glfw.wl.xkb.keymap_mod_get_index = (PFN_xkb_keymap_mod_get_index)
-        _glfw_dlsym(_glfw.wl.xkb.handle, "xkb_keymap_mod_get_index");
+        _glfwPlatformGetModuleSymbol(_glfw.wl.xkb.handle, "xkb_keymap_mod_get_index");
     _glfw.wl.xkb.keymap_key_repeats = (PFN_xkb_keymap_key_repeats)
-        _glfw_dlsym(_glfw.wl.xkb.handle, "xkb_keymap_key_repeats");
+        _glfwPlatformGetModuleSymbol(_glfw.wl.xkb.handle, "xkb_keymap_key_repeats");
     _glfw.wl.xkb.keymap_key_get_syms_by_level = (PFN_xkb_keymap_key_get_syms_by_level)
-        _glfw_dlsym(_glfw.wl.xkb.handle, "xkb_keymap_key_get_syms_by_level");
+        _glfwPlatformGetModuleSymbol(_glfw.wl.xkb.handle, "xkb_keymap_key_get_syms_by_level");
     _glfw.wl.xkb.state_new = (PFN_xkb_state_new)
-        _glfw_dlsym(_glfw.wl.xkb.handle, "xkb_state_new");
+        _glfwPlatformGetModuleSymbol(_glfw.wl.xkb.handle, "xkb_state_new");
     _glfw.wl.xkb.state_unref = (PFN_xkb_state_unref)
-        _glfw_dlsym(_glfw.wl.xkb.handle, "xkb_state_unref");
+        _glfwPlatformGetModuleSymbol(_glfw.wl.xkb.handle, "xkb_state_unref");
     _glfw.wl.xkb.state_key_get_syms = (PFN_xkb_state_key_get_syms)
-        _glfw_dlsym(_glfw.wl.xkb.handle, "xkb_state_key_get_syms");
+        _glfwPlatformGetModuleSymbol(_glfw.wl.xkb.handle, "xkb_state_key_get_syms");
     _glfw.wl.xkb.state_update_mask = (PFN_xkb_state_update_mask)
-        _glfw_dlsym(_glfw.wl.xkb.handle, "xkb_state_update_mask");
+        _glfwPlatformGetModuleSymbol(_glfw.wl.xkb.handle, "xkb_state_update_mask");
     _glfw.wl.xkb.state_key_get_layout = (PFN_xkb_state_key_get_layout)
-        _glfw_dlsym(_glfw.wl.xkb.handle, "xkb_state_key_get_layout");
+        _glfwPlatformGetModuleSymbol(_glfw.wl.xkb.handle, "xkb_state_key_get_layout");
     _glfw.wl.xkb.state_mod_index_is_active = (PFN_xkb_state_mod_index_is_active)
-        _glfw_dlsym(_glfw.wl.xkb.handle, "xkb_state_mod_index_is_active");
-
+        _glfwPlatformGetModuleSymbol(_glfw.wl.xkb.handle, "xkb_state_mod_index_is_active");
     _glfw.wl.xkb.compose_table_new_from_locale = (PFN_xkb_compose_table_new_from_locale)
-        _glfw_dlsym(_glfw.wl.xkb.handle, "xkb_compose_table_new_from_locale");
+        _glfwPlatformGetModuleSymbol(_glfw.wl.xkb.handle, "xkb_compose_table_new_from_locale");
     _glfw.wl.xkb.compose_table_unref = (PFN_xkb_compose_table_unref)
-        _glfw_dlsym(_glfw.wl.xkb.handle, "xkb_compose_table_unref");
+        _glfwPlatformGetModuleSymbol(_glfw.wl.xkb.handle, "xkb_compose_table_unref");
     _glfw.wl.xkb.compose_state_new = (PFN_xkb_compose_state_new)
-        _glfw_dlsym(_glfw.wl.xkb.handle, "xkb_compose_state_new");
+        _glfwPlatformGetModuleSymbol(_glfw.wl.xkb.handle, "xkb_compose_state_new");
     _glfw.wl.xkb.compose_state_unref = (PFN_xkb_compose_state_unref)
-        _glfw_dlsym(_glfw.wl.xkb.handle, "xkb_compose_state_unref");
+        _glfwPlatformGetModuleSymbol(_glfw.wl.xkb.handle, "xkb_compose_state_unref");
     _glfw.wl.xkb.compose_state_feed = (PFN_xkb_compose_state_feed)
-        _glfw_dlsym(_glfw.wl.xkb.handle, "xkb_compose_state_feed");
+        _glfwPlatformGetModuleSymbol(_glfw.wl.xkb.handle, "xkb_compose_state_feed");
     _glfw.wl.xkb.compose_state_get_status = (PFN_xkb_compose_state_get_status)
-        _glfw_dlsym(_glfw.wl.xkb.handle, "xkb_compose_state_get_status");
+        _glfwPlatformGetModuleSymbol(_glfw.wl.xkb.handle, "xkb_compose_state_get_status");
     _glfw.wl.xkb.compose_state_get_one_sym = (PFN_xkb_compose_state_get_one_sym)
-        _glfw_dlsym(_glfw.wl.xkb.handle, "xkb_compose_state_get_one_sym");
+        _glfwPlatformGetModuleSymbol(_glfw.wl.xkb.handle, "xkb_compose_state_get_one_sym");
 
-    _glfw.wl.display = wl_display_connect(NULL);
-    if (!_glfw.wl.display)
+    if (!_glfw.wl.xkb.context_new ||
+        !_glfw.wl.xkb.context_unref ||
+        !_glfw.wl.xkb.keymap_new_from_string ||
+        !_glfw.wl.xkb.keymap_unref ||
+        !_glfw.wl.xkb.keymap_mod_get_index ||
+        !_glfw.wl.xkb.keymap_key_repeats ||
+        !_glfw.wl.xkb.keymap_key_get_syms_by_level ||
+        !_glfw.wl.xkb.state_new ||
+        !_glfw.wl.xkb.state_unref ||
+        !_glfw.wl.xkb.state_key_get_syms ||
+        !_glfw.wl.xkb.state_update_mask ||
+        !_glfw.wl.xkb.state_key_get_layout ||
+        !_glfw.wl.xkb.state_mod_index_is_active ||
+        !_glfw.wl.xkb.compose_table_new_from_locale ||
+        !_glfw.wl.xkb.compose_table_unref ||
+        !_glfw.wl.xkb.compose_state_new ||
+        !_glfw.wl.xkb.compose_state_unref ||
+        !_glfw.wl.xkb.compose_state_feed ||
+        !_glfw.wl.xkb.compose_state_get_status ||
+        !_glfw.wl.xkb.compose_state_get_one_sym)
     {
         _glfwInputError(GLFW_PLATFORM_ERROR,
-                        "Wayland: Failed to connect to display");
+                        "Wayland: Failed to load all entry points from libxkbcommon");
         return GLFW_FALSE;
     }
 
     if (_glfw.hints.init.wl.libdecorMode == GLFW_WAYLAND_PREFER_LIBDECOR)
-        _glfw.wl.libdecor.handle = _glfw_dlopen("libdecor-0.so.0");
+        _glfw.wl.libdecor.handle = _glfwPlatformLoadModule("libdecor-0.so.0");
 
     if (_glfw.wl.libdecor.handle)
     {
         _glfw.wl.libdecor.libdecor_new_ = (PFN_libdecor_new)
-            _glfw_dlsym(_glfw.wl.libdecor.handle, "libdecor_new");
+            _glfwPlatformGetModuleSymbol(_glfw.wl.libdecor.handle, "libdecor_new");
         _glfw.wl.libdecor.libdecor_unref_ = (PFN_libdecor_unref)
-            _glfw_dlsym(_glfw.wl.libdecor.handle, "libdecor_unref");
+            _glfwPlatformGetModuleSymbol(_glfw.wl.libdecor.handle, "libdecor_unref");
         _glfw.wl.libdecor.libdecor_get_fd_ = (PFN_libdecor_get_fd)
-            _glfw_dlsym(_glfw.wl.libdecor.handle, "libdecor_get_fd");
+            _glfwPlatformGetModuleSymbol(_glfw.wl.libdecor.handle, "libdecor_get_fd");
         _glfw.wl.libdecor.libdecor_dispatch_ = (PFN_libdecor_dispatch)
-            _glfw_dlsym(_glfw.wl.libdecor.handle, "libdecor_dispatch");
+            _glfwPlatformGetModuleSymbol(_glfw.wl.libdecor.handle, "libdecor_dispatch");
         _glfw.wl.libdecor.libdecor_decorate_ = (PFN_libdecor_decorate)
-            _glfw_dlsym(_glfw.wl.libdecor.handle, "libdecor_decorate");
+            _glfwPlatformGetModuleSymbol(_glfw.wl.libdecor.handle, "libdecor_decorate");
         _glfw.wl.libdecor.libdecor_frame_unref_ = (PFN_libdecor_frame_unref)
-            _glfw_dlsym(_glfw.wl.libdecor.handle, "libdecor_frame_unref");
+            _glfwPlatformGetModuleSymbol(_glfw.wl.libdecor.handle, "libdecor_frame_unref");
         _glfw.wl.libdecor.libdecor_frame_set_app_id_ = (PFN_libdecor_frame_set_app_id)
-            _glfw_dlsym(_glfw.wl.libdecor.handle, "libdecor_frame_set_app_id");
+            _glfwPlatformGetModuleSymbol(_glfw.wl.libdecor.handle, "libdecor_frame_set_app_id");
         _glfw.wl.libdecor.libdecor_frame_set_title_ = (PFN_libdecor_frame_set_title)
-            _glfw_dlsym(_glfw.wl.libdecor.handle, "libdecor_frame_set_title");
+            _glfwPlatformGetModuleSymbol(_glfw.wl.libdecor.handle, "libdecor_frame_set_title");
         _glfw.wl.libdecor.libdecor_frame_set_minimized_ = (PFN_libdecor_frame_set_minimized)
-            _glfw_dlsym(_glfw.wl.libdecor.handle, "libdecor_frame_set_minimized");
+            _glfwPlatformGetModuleSymbol(_glfw.wl.libdecor.handle, "libdecor_frame_set_minimized");
         _glfw.wl.libdecor.libdecor_frame_set_fullscreen_ = (PFN_libdecor_frame_set_fullscreen)
-            _glfw_dlsym(_glfw.wl.libdecor.handle, "libdecor_frame_set_fullscreen");
+            _glfwPlatformGetModuleSymbol(_glfw.wl.libdecor.handle, "libdecor_frame_set_fullscreen");
         _glfw.wl.libdecor.libdecor_frame_unset_fullscreen_ = (PFN_libdecor_frame_unset_fullscreen)
-            _glfw_dlsym(_glfw.wl.libdecor.handle, "libdecor_frame_unset_fullscreen");
+            _glfwPlatformGetModuleSymbol(_glfw.wl.libdecor.handle, "libdecor_frame_unset_fullscreen");
         _glfw.wl.libdecor.libdecor_frame_map_ = (PFN_libdecor_frame_map)
-            _glfw_dlsym(_glfw.wl.libdecor.handle, "libdecor_frame_map");
+            _glfwPlatformGetModuleSymbol(_glfw.wl.libdecor.handle, "libdecor_frame_map");
         _glfw.wl.libdecor.libdecor_frame_commit_ = (PFN_libdecor_frame_commit)
-            _glfw_dlsym(_glfw.wl.libdecor.handle, "libdecor_frame_commit");
+            _glfwPlatformGetModuleSymbol(_glfw.wl.libdecor.handle, "libdecor_frame_commit");
         _glfw.wl.libdecor.libdecor_frame_set_min_content_size_ = (PFN_libdecor_frame_set_min_content_size)
-            _glfw_dlsym(_glfw.wl.libdecor.handle, "libdecor_frame_set_min_content_size");
+            _glfwPlatformGetModuleSymbol(_glfw.wl.libdecor.handle, "libdecor_frame_set_min_content_size");
         _glfw.wl.libdecor.libdecor_frame_set_max_content_size_ = (PFN_libdecor_frame_set_max_content_size)
-            _glfw_dlsym(_glfw.wl.libdecor.handle, "libdecor_frame_set_max_content_size");
+            _glfwPlatformGetModuleSymbol(_glfw.wl.libdecor.handle, "libdecor_frame_set_max_content_size");
         _glfw.wl.libdecor.libdecor_frame_set_maximized_ = (PFN_libdecor_frame_set_maximized)
-            _glfw_dlsym(_glfw.wl.libdecor.handle, "libdecor_frame_set_maximized");
+            _glfwPlatformGetModuleSymbol(_glfw.wl.libdecor.handle, "libdecor_frame_set_maximized");
         _glfw.wl.libdecor.libdecor_frame_unset_maximized_ = (PFN_libdecor_frame_unset_maximized)
-            _glfw_dlsym(_glfw.wl.libdecor.handle, "libdecor_frame_unset_maximized");
+            _glfwPlatformGetModuleSymbol(_glfw.wl.libdecor.handle, "libdecor_frame_unset_maximized");
         _glfw.wl.libdecor.libdecor_frame_set_capabilities_ = (PFN_libdecor_frame_set_capabilities)
-            _glfw_dlsym(_glfw.wl.libdecor.handle, "libdecor_frame_set_capabilities");
+            _glfwPlatformGetModuleSymbol(_glfw.wl.libdecor.handle, "libdecor_frame_set_capabilities");
         _glfw.wl.libdecor.libdecor_frame_unset_capabilities_ = (PFN_libdecor_frame_unset_capabilities)
-            _glfw_dlsym(_glfw.wl.libdecor.handle, "libdecor_frame_unset_capabilities");
+            _glfwPlatformGetModuleSymbol(_glfw.wl.libdecor.handle, "libdecor_frame_unset_capabilities");
         _glfw.wl.libdecor.libdecor_frame_set_visibility_ = (PFN_libdecor_frame_set_visibility)
-            _glfw_dlsym(_glfw.wl.libdecor.handle, "libdecor_frame_set_visibility");
+            _glfwPlatformGetModuleSymbol(_glfw.wl.libdecor.handle, "libdecor_frame_set_visibility");
         _glfw.wl.libdecor.libdecor_frame_get_xdg_toplevel_ = (PFN_libdecor_frame_get_xdg_toplevel)
-            _glfw_dlsym(_glfw.wl.libdecor.handle, "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)
-            _glfw_dlsym(_glfw.wl.libdecor.handle, "libdecor_configuration_get_content_size");
+            _glfwPlatformGetModuleSymbol(_glfw.wl.libdecor.handle, "libdecor_configuration_get_content_size");
         _glfw.wl.libdecor.libdecor_configuration_get_window_state_ = (PFN_libdecor_configuration_get_window_state)
-            _glfw_dlsym(_glfw.wl.libdecor.handle, "libdecor_configuration_get_window_state");
+            _glfwPlatformGetModuleSymbol(_glfw.wl.libdecor.handle, "libdecor_configuration_get_window_state");
         _glfw.wl.libdecor.libdecor_state_new_ = (PFN_libdecor_state_new)
-            _glfw_dlsym(_glfw.wl.libdecor.handle, "libdecor_state_new");
+            _glfwPlatformGetModuleSymbol(_glfw.wl.libdecor.handle, "libdecor_state_new");
         _glfw.wl.libdecor.libdecor_state_free_ = (PFN_libdecor_state_free)
-            _glfw_dlsym(_glfw.wl.libdecor.handle, "libdecor_state_free");
+            _glfwPlatformGetModuleSymbol(_glfw.wl.libdecor.handle, "libdecor_state_free");
 
         if (!_glfw.wl.libdecor.libdecor_new_ ||
             !_glfw.wl.libdecor.libdecor_unref_ ||
@@ -546,7 +813,7 @@
             !_glfw.wl.libdecor.libdecor_state_new_ ||
             !_glfw.wl.libdecor.libdecor_state_free_)
         {
-            _glfw_dlclose(_glfw.wl.libdecor.handle);
+            _glfwPlatformFreeModule(_glfw.wl.libdecor.handle);
             memset(&_glfw.wl.libdecor, 0, sizeof(_glfw.wl.libdecor));
         }
     }
@@ -570,13 +837,6 @@
     // Sync so we got all initial output events
     wl_display_roundtrip(_glfw.wl.display);
 
-#ifdef __linux__
-    if (!_glfwInitJoysticksLinux())
-        return GLFW_FALSE;
-#endif
-
-    _glfwInitTimerPOSIX();
-
     if (_glfw.wl.libdecor.handle)
     {
         _glfw.wl.libdecor.context = libdecor_new(_glfw.wl.display, &libdecorInterface);
@@ -593,13 +853,11 @@
         }
     }
 
-#ifdef WL_KEYBOARD_REPEAT_INFO_SINCE_VERSION
     if (wl_seat_get_version(_glfw.wl.seat) >= WL_KEYBOARD_REPEAT_INFO_SINCE_VERSION)
     {
         _glfw.wl.keyRepeatTimerfd =
             timerfd_create(CLOCK_MONOTONIC, TFD_CLOEXEC | TFD_NONBLOCK);
     }
-#endif
 
     if (!_glfw.wl.wmBase)
     {
@@ -629,11 +887,8 @@
     return GLFW_TRUE;
 }
 
-void _glfwPlatformTerminate(void)
+void _glfwTerminateWayland(void)
 {
-#ifdef __linux__
-    _glfwTerminateJoysticksLinux();
-#endif
     _glfwTerminateEGL();
     _glfwTerminateOSMesa();
 
@@ -642,20 +897,20 @@
         // Allow libdecor to finish receiving all its requested globals
         // and ensure the associated sync callback object is destroyed
         while (!_glfw.wl.libdecor.ready)
-            _glfwPlatformWaitEvents();
+            _glfwWaitEventsWayland();
 
         libdecor_unref(_glfw.wl.libdecor.context);
     }
 
     if (_glfw.wl.libdecor.handle)
     {
-        _glfw_dlclose(_glfw.wl.libdecor.handle);
+        _glfwPlatformFreeModule(_glfw.wl.libdecor.handle);
         _glfw.wl.libdecor.handle = NULL;
     }
 
     if (_glfw.wl.egl.handle)
     {
-        _glfw_dlclose(_glfw.wl.egl.handle);
+        _glfwPlatformFreeModule(_glfw.wl.egl.handle);
         _glfw.wl.egl.handle = NULL;
     }
 
@@ -669,7 +924,7 @@
         xkb_context_unref(_glfw.wl.xkb.context);
     if (_glfw.wl.xkb.handle)
     {
-        _glfw_dlclose(_glfw.wl.xkb.handle);
+        _glfwPlatformFreeModule(_glfw.wl.xkb.handle);
         _glfw.wl.xkb.handle = NULL;
     }
 
@@ -679,14 +934,14 @@
         wl_cursor_theme_destroy(_glfw.wl.cursorThemeHiDPI);
     if (_glfw.wl.cursor.handle)
     {
-        _glfw_dlclose(_glfw.wl.cursor.handle);
+        _glfwPlatformFreeModule(_glfw.wl.cursor.handle);
         _glfw.wl.cursor.handle = NULL;
     }
 
     for (unsigned int i = 0; i < _glfw.wl.offerCount; i++)
         wl_data_offer_destroy(_glfw.wl.offers[i].offer);
 
-    free(_glfw.wl.offers);
+    _glfw_free(_glfw.wl.offers);
 
     if (_glfw.wl.cursorSurface)
         wl_surface_destroy(_glfw.wl.cursorSurface);
@@ -724,6 +979,10 @@
         zwp_pointer_constraints_v1_destroy(_glfw.wl.pointerConstraints);
     if (_glfw.wl.idleInhibitManager)
         zwp_idle_inhibit_manager_v1_destroy(_glfw.wl.idleInhibitManager);
+    if (_glfw.wl.activationManager)
+        xdg_activation_v1_destroy(_glfw.wl.activationManager);
+    if (_glfw.wl.fractionalScaleManager)
+        wp_fractional_scale_manager_v1_destroy(_glfw.wl.fractionalScaleManager);
     if (_glfw.wl.registry)
         wl_registry_destroy(_glfw.wl.registry);
     if (_glfw.wl.display)
@@ -737,20 +996,8 @@
     if (_glfw.wl.cursorTimerfd >= 0)
         close(_glfw.wl.cursorTimerfd);
 
-    free(_glfw.wl.clipboardString);
+    _glfw_free(_glfw.wl.clipboardString);
 }
 
-const char* _glfwPlatformGetVersionString(void)
-{
-    return _GLFW_VERSION_NUMBER " Wayland EGL OSMesa"
-#if defined(_POSIX_TIMERS) && defined(_POSIX_MONOTONIC_CLOCK)
-        " clock_gettime"
-#else
-        " gettimeofday"
-#endif
-        " evdev"
-#if defined(_GLFW_BUILD_DLL)
-        " shared"
-#endif
-        ;
-}
+#endif // _GLFW_WAYLAND
+
diff --git a/src/wl_monitor.c b/src/wl_monitor.c
index 6f785a3..df30313 100644
--- a/src/wl_monitor.c
+++ b/src/wl_monitor.c
@@ -1,5 +1,5 @@
 //========================================================================
-// GLFW 3.3 Wayland - www.glfw.org
+// GLFW 3.4 Wayland - www.glfw.org
 //------------------------------------------------------------------------
 // Copyright (c) 2014 Jonas Ådahl <jadahl@gmail.com>
 //
@@ -23,17 +23,19 @@
 //    distribution.
 //
 //========================================================================
-// It is fine to use C99 in this file because it will not be built with VS
-//========================================================================
 
 #include "internal.h"
 
+#if defined(_GLFW_WAYLAND)
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <errno.h>
 #include <math.h>
 
+#include "wayland-client-protocol.h"
+
 
 static void outputHandleGeometry(void* userData,
                                  struct wl_output* output,
@@ -76,7 +78,7 @@
 
     monitor->modeCount++;
     monitor->modes =
-        realloc(monitor->modes, monitor->modeCount * sizeof(GLFWvidmode));
+        _glfw_realloc(monitor->modes, monitor->modeCount * sizeof(GLFWvidmode));
     monitor->modes[monitor->modeCount - 1] = mode;
 
     if (flags & WL_OUTPUT_MODE_CURRENT)
@@ -110,24 +112,22 @@
 {
     struct _GLFWmonitor* monitor = userData;
 
-    monitor->wl.contentScale = factor;
+    monitor->wl.scale = factor;
 
     for (_GLFWwindow* window = _glfw.windowListHead; window; window = window->next)
     {
-        for (int i = 0; i < window->wl.scaleCount; i++)
+        for (size_t i = 0; i < window->wl.outputScaleCount; i++)
         {
-            if (window->wl.scales[i].output == monitor->wl.output)
+            if (window->wl.outputScales[i].output == monitor->wl.output)
             {
-                window->wl.scales[i].factor = monitor->wl.contentScale;
-                _glfwUpdateContentScaleWayland(window);
+                window->wl.outputScales[i].factor = monitor->wl.scale;
+                _glfwUpdateBufferScaleFromOutputsWayland(window);
                 break;
             }
         }
     }
 }
 
-#ifdef WL_OUTPUT_NAME_SINCE_VERSION
-
 void outputHandleName(void* userData, struct wl_output* wl_output, const char* name)
 {
     struct _GLFWmonitor* monitor = userData;
@@ -141,18 +141,14 @@
 {
 }
 
-#endif // WL_OUTPUT_NAME_SINCE_VERSION
-
 static const struct wl_output_listener outputListener =
 {
     outputHandleGeometry,
     outputHandleMode,
     outputHandleDone,
     outputHandleScale,
-#ifdef WL_OUTPUT_NAME_SINCE_VERSION
     outputHandleName,
     outputHandleDescription,
-#endif
 };
 
 
@@ -169,11 +165,7 @@
         return;
     }
 
-#ifdef WL_OUTPUT_NAME_SINCE_VERSION
     version = _glfw_min(version, WL_OUTPUT_NAME_SINCE_VERSION);
-#else
-    version = 2;
-#endif
 
     struct wl_output* output = wl_registry_bind(_glfw.wl.registry,
                                                 name,
@@ -184,7 +176,7 @@
 
     // The actual name of this output will be set in the geometry handler
     _GLFWmonitor* monitor = _glfwAllocMonitor("", 0, 0);
-    monitor->wl.contentScale = 1;
+    monitor->wl.scale = 1;
     monitor->wl.output = output;
     monitor->wl.name = name;
 
@@ -197,13 +189,13 @@
 //////                       GLFW platform API                      //////
 //////////////////////////////////////////////////////////////////////////
 
-void _glfwPlatformFreeMonitor(_GLFWmonitor* monitor)
+void _glfwFreeMonitorWayland(_GLFWmonitor* monitor)
 {
     if (monitor->wl.output)
         wl_output_destroy(monitor->wl.output);
 }
 
-void _glfwPlatformGetMonitorPos(_GLFWmonitor* monitor, int* xpos, int* ypos)
+void _glfwGetMonitorPosWayland(_GLFWmonitor* monitor, int* xpos, int* ypos)
 {
     if (xpos)
         *xpos = monitor->wl.x;
@@ -211,18 +203,18 @@
         *ypos = monitor->wl.y;
 }
 
-void _glfwPlatformGetMonitorContentScale(_GLFWmonitor* monitor,
-                                         float* xscale, float* yscale)
+void _glfwGetMonitorContentScaleWayland(_GLFWmonitor* monitor,
+                                        float* xscale, float* yscale)
 {
     if (xscale)
-        *xscale = (float) monitor->wl.contentScale;
+        *xscale = (float) monitor->wl.scale;
     if (yscale)
-        *yscale = (float) monitor->wl.contentScale;
+        *yscale = (float) monitor->wl.scale;
 }
 
-void _glfwPlatformGetMonitorWorkarea(_GLFWmonitor* monitor,
-                                     int* xpos, int* ypos,
-                                     int* width, int* height)
+void _glfwGetMonitorWorkareaWayland(_GLFWmonitor* monitor,
+                                    int* xpos, int* ypos,
+                                    int* width, int* height)
 {
     if (xpos)
         *xpos = monitor->wl.x;
@@ -234,28 +226,28 @@
         *height = monitor->modes[monitor->wl.currentMode].height;
 }
 
-GLFWvidmode* _glfwPlatformGetVideoModes(_GLFWmonitor* monitor, int* found)
+GLFWvidmode* _glfwGetVideoModesWayland(_GLFWmonitor* monitor, int* found)
 {
     *found = monitor->modeCount;
     return monitor->modes;
 }
 
-void _glfwPlatformGetVideoMode(_GLFWmonitor* monitor, GLFWvidmode* mode)
+GLFWbool _glfwGetVideoModeWayland(_GLFWmonitor* monitor, GLFWvidmode* mode)
 {
     *mode = monitor->modes[monitor->wl.currentMode];
+    return GLFW_TRUE;
 }
 
-GLFWbool _glfwPlatformGetGammaRamp(_GLFWmonitor* monitor, GLFWgammaramp* ramp)
+GLFWbool _glfwGetGammaRampWayland(_GLFWmonitor* monitor, GLFWgammaramp* ramp)
 {
-    _glfwInputError(GLFW_PLATFORM_ERROR,
+    _glfwInputError(GLFW_FEATURE_UNAVAILABLE,
                     "Wayland: Gamma ramp access is not available");
     return GLFW_FALSE;
 }
 
-void _glfwPlatformSetGammaRamp(_GLFWmonitor* monitor,
-                               const GLFWgammaramp* ramp)
+void _glfwSetGammaRampWayland(_GLFWmonitor* monitor, const GLFWgammaramp* ramp)
 {
-    _glfwInputError(GLFW_PLATFORM_ERROR,
+    _glfwInputError(GLFW_FEATURE_UNAVAILABLE,
                     "Wayland: Gamma ramp access is not available");
 }
 
@@ -268,6 +260,15 @@
 {
     _GLFWmonitor* monitor = (_GLFWmonitor*) handle;
     _GLFW_REQUIRE_INIT_OR_RETURN(NULL);
+
+    if (_glfw.platform.platformID != GLFW_PLATFORM_WAYLAND)
+    {
+        _glfwInputError(GLFW_PLATFORM_UNAVAILABLE, "Wayland: Platform not initialized");
+        return NULL;
+    }
+
     return monitor->wl.output;
 }
 
+#endif // _GLFW_WAYLAND
+
diff --git a/src/wl_platform.h b/src/wl_platform.h
index 8affdd1..149cd24 100644
--- a/src/wl_platform.h
+++ b/src/wl_platform.h
@@ -1,5 +1,5 @@
 //========================================================================
-// GLFW 3.3 Wayland - www.glfw.org
+// GLFW 3.4 Wayland - www.glfw.org
 //------------------------------------------------------------------------
 // Copyright (c) 2014 Jonas Ådahl <jadahl@gmail.com>
 //
@@ -24,10 +24,9 @@
 //
 //========================================================================
 
-#include <wayland-client.h>
+#include <wayland-client-core.h>
 #include <xkbcommon/xkbcommon.h>
 #include <xkbcommon/xkbcommon-compose.h>
-#include <dlfcn.h>
 
 #include <stdbool.h>
 
@@ -45,38 +44,100 @@
 typedef VkResult (APIENTRY *PFN_vkCreateWaylandSurfaceKHR)(VkInstance,const VkWaylandSurfaceCreateInfoKHR*,const VkAllocationCallbacks*,VkSurfaceKHR*);
 typedef VkBool32 (APIENTRY *PFN_vkGetPhysicalDeviceWaylandPresentationSupportKHR)(VkPhysicalDevice,uint32_t,struct wl_display*);
 
-#include "posix_thread.h"
-#include "posix_time.h"
-#ifdef __linux__
-#include "linux_joystick.h"
-#else
-#include "null_joystick.h"
-#endif
 #include "xkb_unicode.h"
-#include "egl_context.h"
-#include "osmesa_context.h"
+#include "posix_poll.h"
 
-#include "wayland-xdg-shell-client-protocol.h"
-#include "wayland-xdg-decoration-client-protocol.h"
-#include "wayland-viewporter-client-protocol.h"
-#include "wayland-relative-pointer-unstable-v1-client-protocol.h"
-#include "wayland-pointer-constraints-unstable-v1-client-protocol.h"
-#include "wayland-idle-inhibit-unstable-v1-client-protocol.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);
+typedef int (* PFN_wl_display_read_events)(struct wl_display* display);
+typedef struct wl_display* (* PFN_wl_display_connect)(const char*);
+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 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*);
+typedef struct wl_proxy* (* PFN_wl_proxy_marshal_constructor)(struct wl_proxy*,uint32_t,const struct wl_interface*,...);
+typedef struct wl_proxy* (* PFN_wl_proxy_marshal_constructor_versioned)(struct wl_proxy*,uint32_t,const struct wl_interface*,uint32_t,...);
+typedef void* (* PFN_wl_proxy_get_user_data)(struct wl_proxy*);
+typedef void (* PFN_wl_proxy_set_user_data)(struct wl_proxy*,void*);
+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,...);
+#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
+#define wl_display_read_events _glfw.wl.client.display_read_events
+#define wl_display_disconnect _glfw.wl.client.display_disconnect
+#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_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
+#define wl_proxy_marshal_constructor _glfw.wl.client.proxy_marshal_constructor
+#define wl_proxy_marshal_constructor_versioned _glfw.wl.client.proxy_marshal_constructor_versioned
+#define wl_proxy_get_user_data _glfw.wl.client.proxy_get_user_data
+#define wl_proxy_set_user_data _glfw.wl.client.proxy_set_user_data
+#define wl_proxy_get_tag _glfw.wl.client.proxy_get_tag
+#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 _glfw_dlopen(name) dlopen(name, RTLD_LAZY | RTLD_LOCAL)
-#define _glfw_dlclose(handle) dlclose(handle)
-#define _glfw_dlsym(handle, name) dlsym(handle, name)
+struct wl_shm;
+struct wl_output;
 
-#define _GLFW_EGL_NATIVE_WINDOW         ((EGLNativeWindowType) window->wl.egl.window)
-#define _GLFW_EGL_NATIVE_DISPLAY        ((EGLNativeDisplayType) _glfw.wl.display)
+#define wl_display_interface _glfw_wl_display_interface
+#define wl_subcompositor_interface _glfw_wl_subcompositor_interface
+#define wl_compositor_interface _glfw_wl_compositor_interface
+#define wl_shm_interface _glfw_wl_shm_interface
+#define wl_data_device_manager_interface _glfw_wl_data_device_manager_interface
+#define wl_shell_interface _glfw_wl_shell_interface
+#define wl_buffer_interface _glfw_wl_buffer_interface
+#define wl_callback_interface _glfw_wl_callback_interface
+#define wl_data_device_interface _glfw_wl_data_device_interface
+#define wl_data_offer_interface _glfw_wl_data_offer_interface
+#define wl_data_source_interface _glfw_wl_data_source_interface
+#define wl_keyboard_interface _glfw_wl_keyboard_interface
+#define wl_output_interface _glfw_wl_output_interface
+#define wl_pointer_interface _glfw_wl_pointer_interface
+#define wl_region_interface _glfw_wl_region_interface
+#define wl_registry_interface _glfw_wl_registry_interface
+#define wl_seat_interface _glfw_wl_seat_interface
+#define wl_shell_surface_interface _glfw_wl_shell_surface_interface
+#define wl_shm_pool_interface _glfw_wl_shm_pool_interface
+#define wl_subsurface_interface _glfw_wl_subsurface_interface
+#define wl_surface_interface _glfw_wl_surface_interface
+#define wl_touch_interface _glfw_wl_touch_interface
+#define zwp_idle_inhibitor_v1_interface _glfw_zwp_idle_inhibitor_v1_interface
+#define zwp_idle_inhibit_manager_v1_interface _glfw_zwp_idle_inhibit_manager_v1_interface
+#define zwp_confined_pointer_v1_interface _glfw_zwp_confined_pointer_v1_interface
+#define zwp_locked_pointer_v1_interface _glfw_zwp_locked_pointer_v1_interface
+#define zwp_pointer_constraints_v1_interface _glfw_zwp_pointer_constraints_v1_interface
+#define zwp_relative_pointer_v1_interface _glfw_zwp_relative_pointer_v1_interface
+#define zwp_relative_pointer_manager_v1_interface _glfw_zwp_relative_pointer_manager_v1_interface
+#define wp_viewport_interface _glfw_wp_viewport_interface
+#define wp_viewporter_interface _glfw_wp_viewporter_interface
+#define xdg_toplevel_interface _glfw_xdg_toplevel_interface
+#define zxdg_toplevel_decoration_v1_interface _glfw_zxdg_toplevel_decoration_v1_interface
+#define zxdg_decoration_manager_v1_interface _glfw_zxdg_decoration_manager_v1_interface
+#define xdg_popup_interface _glfw_xdg_popup_interface
+#define xdg_positioner_interface _glfw_xdg_positioner_interface
+#define xdg_surface_interface _glfw_xdg_surface_interface
+#define xdg_toplevel_interface _glfw_xdg_toplevel_interface
+#define xdg_wm_base_interface _glfw_xdg_wm_base_interface
+#define xdg_activation_v1_interface _glfw_xdg_activation_v1_interface
+#define xdg_activation_token_v1_interface _glfw_xdg_activation_token_v1_interface
+#define wl_surface_interface _glfw_wl_surface_interface
+#define wp_fractional_scale_v1_interface _glfw_wp_fractional_scale_v1_interface
 
-#define _GLFW_PLATFORM_WINDOW_STATE         _GLFWwindowWayland  wl
-#define _GLFW_PLATFORM_LIBRARY_WINDOW_STATE _GLFWlibraryWayland wl
-#define _GLFW_PLATFORM_MONITOR_STATE        _GLFWmonitorWayland wl
-#define _GLFW_PLATFORM_CURSOR_STATE         _GLFWcursorWayland  wl
-
-#define _GLFW_PLATFORM_CONTEXT_STATE         struct { int dummyContext; }
-#define _GLFW_PLATFORM_LIBRARY_CONTEXT_STATE struct { int dummyLibraryContext; }
+#define GLFW_WAYLAND_WINDOW_STATE         _GLFWwindowWayland  wl;
+#define GLFW_WAYLAND_LIBRARY_WINDOW_STATE _GLFWlibraryWayland wl;
+#define GLFW_WAYLAND_MONITOR_STATE        _GLFWmonitorWayland wl;
+#define GLFW_WAYLAND_CURSOR_STATE         _GLFWcursorWayland  wl;
 
 struct wl_cursor_image {
     uint32_t width;
@@ -264,21 +325,12 @@
 #define libdecor_state_new _glfw.wl.libdecor.libdecor_state_new_
 #define libdecor_state_free _glfw.wl.libdecor.libdecor_state_free_
 
-typedef enum _GLFWdecorationSideWayland
-{
-    GLFW_MAIN_WINDOW,
-    GLFW_TOP_DECORATION,
-    GLFW_LEFT_DECORATION,
-    GLFW_RIGHT_DECORATION,
-    GLFW_BOTTOM_DECORATION
-} _GLFWdecorationSideWayland;
-
-typedef struct _GLFWdecorationWayland
+typedef struct _GLFWfallbackEdgeWayland
 {
     struct wl_surface*          surface;
     struct wl_subsurface*       subsurface;
     struct wp_viewport*         viewport;
-} _GLFWdecorationWayland;
+} _GLFWfallbackEdgeWayland;
 
 typedef struct _GLFWofferWayland
 {
@@ -290,7 +342,7 @@
 typedef struct _GLFWscaleWayland
 {
     struct wl_output*           output;
-    int                         factor;
+    int32_t                     factor;
 } _GLFWscaleWayland;
 
 // Wayland-specific per-window data
@@ -298,12 +350,14 @@
 typedef struct _GLFWwindowWayland
 {
     int                         width, height;
+    int                         fbWidth, fbHeight;
     GLFWbool                    visible;
     GLFWbool                    maximized;
     GLFWbool                    activated;
     GLFWbool                    fullscreen;
     GLFWbool                    hovered;
     GLFWbool                    transparent;
+    GLFWbool                    scaleFramebuffer;
     struct wl_surface*          surface;
     struct wl_callback*         callback;
 
@@ -328,31 +382,37 @@
 
     struct {
         struct libdecor_frame*  frame;
-        int                     mode;
     } libdecor;
 
     _GLFWcursor*                currentCursor;
     double                      cursorPosX, cursorPosY;
 
-    char*                       title;
+    char*                       appId;
 
     // We need to track the monitors the window spans on to calculate the
     // optimal scaling factor.
-    int                         contentScale;
-    _GLFWscaleWayland*          scales;
-    int                         scaleCount;
-    int                         scaleSize;
+    int32_t                     bufferScale;
+    _GLFWscaleWayland*          outputScales;
+    size_t                      outputScaleCount;
+    size_t                      outputScaleSize;
+
+    struct wp_viewport*             scalingViewport;
+    uint32_t                        scalingNumerator;
+    struct wp_fractional_scale_v1*  fractionalScale;
 
     struct zwp_relative_pointer_v1* relativePointer;
     struct zwp_locked_pointer_v1*   lockedPointer;
+    struct zwp_confined_pointer_v1* confinedPointer;
 
-    struct zwp_idle_inhibitor_v1*          idleInhibitor;
+    struct zwp_idle_inhibitor_v1*   idleInhibitor;
+    struct xdg_activation_token_v1* activationToken;
 
     struct {
-        struct wl_buffer*                  buffer;
-        _GLFWdecorationWayland             top, left, right, bottom;
-        _GLFWdecorationSideWayland         focus;
-    } decorations;
+        GLFWbool                    decorations;
+        struct wl_buffer*           buffer;
+        _GLFWfallbackEdgeWayland    top, left, right, bottom;
+        struct wl_surface*          focus;
+    } fallback;
 } _GLFWwindowWayland;
 
 // Wayland-specific global data
@@ -375,6 +435,8 @@
     struct zwp_relative_pointer_manager_v1* relativePointerManager;
     struct zwp_pointer_constraints_v1*      pointerConstraints;
     struct zwp_idle_inhibit_manager_v1*     idleInhibitManager;
+    struct xdg_activation_v1*               activationManager;
+    struct wp_fractional_scale_manager_v1*  fractionalScaleManager;
 
     _GLFWofferWayland*          offers;
     unsigned int                offerCount;
@@ -411,6 +473,7 @@
         struct xkb_context*     context;
         struct xkb_keymap*      keymap;
         struct xkb_state*       state;
+
         struct xkb_compose_state* composeState;
 
         xkb_mod_index_t         controlIndex;
@@ -448,6 +511,29 @@
     _GLFWwindow*                keyboardFocus;
 
     struct {
+        void*                                       handle;
+        PFN_wl_display_flush                        display_flush;
+        PFN_wl_display_cancel_read                  display_cancel_read;
+        PFN_wl_display_dispatch_pending             display_dispatch_pending;
+        PFN_wl_display_read_events                  display_read_events;
+        PFN_wl_display_disconnect                   display_disconnect;
+        PFN_wl_display_roundtrip                    display_roundtrip;
+        PFN_wl_display_get_fd                       display_get_fd;
+        PFN_wl_display_prepare_read                 display_prepare_read;
+        PFN_wl_proxy_marshal                        proxy_marshal;
+        PFN_wl_proxy_add_listener                   proxy_add_listener;
+        PFN_wl_proxy_destroy                        proxy_destroy;
+        PFN_wl_proxy_marshal_constructor            proxy_marshal_constructor;
+        PFN_wl_proxy_marshal_constructor_versioned  proxy_marshal_constructor_versioned;
+        PFN_wl_proxy_get_user_data                  proxy_get_user_data;
+        PFN_wl_proxy_set_user_data                  proxy_set_user_data;
+        PFN_wl_proxy_get_tag                        proxy_get_tag;
+        PFN_wl_proxy_set_tag                        proxy_set_tag;
+        PFN_wl_proxy_get_version                    proxy_get_version;
+        PFN_wl_proxy_marshal_flags                  proxy_marshal_flags;
+    } client;
+
+    struct {
         void*                   handle;
 
         PFN_wl_cursor_theme_load theme_load;
@@ -507,7 +593,7 @@
 
     int                         x;
     int                         y;
-    int                         contentScale;
+    int32_t                     scale;
 } _GLFWmonitorWayland;
 
 // Wayland-specific per-cursor data
@@ -522,8 +608,83 @@
     int                         currentImage;
 } _GLFWcursorWayland;
 
+GLFWbool _glfwConnectWayland(int platformID, _GLFWplatform* platform);
+int _glfwInitWayland(void);
+void _glfwTerminateWayland(void);
+
+GLFWbool _glfwCreateWindowWayland(_GLFWwindow* window, const _GLFWwndconfig* wndconfig, const _GLFWctxconfig* ctxconfig, const _GLFWfbconfig* fbconfig);
+void _glfwDestroyWindowWayland(_GLFWwindow* window);
+void _glfwSetWindowTitleWayland(_GLFWwindow* window, const char* title);
+void _glfwSetWindowIconWayland(_GLFWwindow* window, int count, const GLFWimage* images);
+void _glfwGetWindowPosWayland(_GLFWwindow* window, int* xpos, int* ypos);
+void _glfwSetWindowPosWayland(_GLFWwindow* window, int xpos, int ypos);
+void _glfwGetWindowSizeWayland(_GLFWwindow* window, int* width, int* height);
+void _glfwSetWindowSizeWayland(_GLFWwindow* window, int width, int height);
+void _glfwSetWindowSizeLimitsWayland(_GLFWwindow* window, int minwidth, int minheight, int maxwidth, int maxheight);
+void _glfwSetWindowAspectRatioWayland(_GLFWwindow* window, int numer, int denom);
+void _glfwGetFramebufferSizeWayland(_GLFWwindow* window, int* width, int* height);
+void _glfwGetWindowFrameSizeWayland(_GLFWwindow* window, int* left, int* top, int* right, int* bottom);
+void _glfwGetWindowContentScaleWayland(_GLFWwindow* window, float* xscale, float* yscale);
+void _glfwIconifyWindowWayland(_GLFWwindow* window);
+void _glfwRestoreWindowWayland(_GLFWwindow* window);
+void _glfwMaximizeWindowWayland(_GLFWwindow* window);
+void _glfwShowWindowWayland(_GLFWwindow* window);
+void _glfwHideWindowWayland(_GLFWwindow* window);
+void _glfwRequestWindowAttentionWayland(_GLFWwindow* window);
+void _glfwFocusWindowWayland(_GLFWwindow* window);
+void _glfwSetWindowMonitorWayland(_GLFWwindow* window, _GLFWmonitor* monitor, int xpos, int ypos, int width, int height, int refreshRate);
+GLFWbool _glfwWindowFocusedWayland(_GLFWwindow* window);
+GLFWbool _glfwWindowIconifiedWayland(_GLFWwindow* window);
+GLFWbool _glfwWindowVisibleWayland(_GLFWwindow* window);
+GLFWbool _glfwWindowMaximizedWayland(_GLFWwindow* window);
+GLFWbool _glfwWindowHoveredWayland(_GLFWwindow* window);
+GLFWbool _glfwFramebufferTransparentWayland(_GLFWwindow* window);
+void _glfwSetWindowResizableWayland(_GLFWwindow* window, GLFWbool enabled);
+void _glfwSetWindowDecoratedWayland(_GLFWwindow* window, GLFWbool enabled);
+void _glfwSetWindowFloatingWayland(_GLFWwindow* window, GLFWbool enabled);
+float _glfwGetWindowOpacityWayland(_GLFWwindow* window);
+void _glfwSetWindowOpacityWayland(_GLFWwindow* window, float opacity);
+void _glfwSetWindowMousePassthroughWayland(_GLFWwindow* window, GLFWbool enabled);
+
+void _glfwSetRawMouseMotionWayland(_GLFWwindow* window, GLFWbool enabled);
+GLFWbool _glfwRawMouseMotionSupportedWayland(void);
+
+void _glfwPollEventsWayland(void);
+void _glfwWaitEventsWayland(void);
+void _glfwWaitEventsTimeoutWayland(double timeout);
+void _glfwPostEmptyEventWayland(void);
+
+void _glfwGetCursorPosWayland(_GLFWwindow* window, double* xpos, double* ypos);
+void _glfwSetCursorPosWayland(_GLFWwindow* window, double xpos, double ypos);
+void _glfwSetCursorModeWayland(_GLFWwindow* window, int mode);
+const char* _glfwGetScancodeNameWayland(int scancode);
+int _glfwGetKeyScancodeWayland(int key);
+GLFWbool _glfwCreateCursorWayland(_GLFWcursor* cursor, const GLFWimage* image, int xhot, int yhot);
+GLFWbool _glfwCreateStandardCursorWayland(_GLFWcursor* cursor, int shape);
+void _glfwDestroyCursorWayland(_GLFWcursor* cursor);
+void _glfwSetCursorWayland(_GLFWwindow* window, _GLFWcursor* cursor);
+void _glfwSetClipboardStringWayland(const char* string);
+const char* _glfwGetClipboardStringWayland(void);
+
+EGLenum _glfwGetEGLPlatformWayland(EGLint** attribs);
+EGLNativeDisplayType _glfwGetEGLNativeDisplayWayland(void);
+EGLNativeWindowType _glfwGetEGLNativeWindowWayland(_GLFWwindow* window);
+
+void _glfwGetRequiredInstanceExtensionsWayland(char** extensions);
+GLFWbool _glfwGetPhysicalDevicePresentationSupportWayland(VkInstance instance, VkPhysicalDevice device, uint32_t queuefamily);
+VkResult _glfwCreateWindowSurfaceWayland(VkInstance instance, _GLFWwindow* window, const VkAllocationCallbacks* allocator, VkSurfaceKHR* surface);
+
+void _glfwFreeMonitorWayland(_GLFWmonitor* monitor);
+void _glfwGetMonitorPosWayland(_GLFWmonitor* monitor, int* xpos, int* ypos);
+void _glfwGetMonitorContentScaleWayland(_GLFWmonitor* monitor, float* xscale, float* yscale);
+void _glfwGetMonitorWorkareaWayland(_GLFWmonitor* monitor, int* xpos, int* ypos, int* width, int* height);
+GLFWvidmode* _glfwGetVideoModesWayland(_GLFWmonitor* monitor, int* count);
+GLFWbool _glfwGetVideoModeWayland(_GLFWmonitor* monitor, GLFWvidmode* mode);
+GLFWbool _glfwGetGammaRampWayland(_GLFWmonitor* monitor, GLFWgammaramp* ramp);
+void _glfwSetGammaRampWayland(_GLFWmonitor* monitor, const GLFWgammaramp* ramp);
+
 void _glfwAddOutputWayland(uint32_t name, uint32_t version);
-void _glfwUpdateContentScaleWayland(_GLFWwindow* window);
+void _glfwUpdateBufferScaleFromOutputsWayland(_GLFWwindow* window);
 
 void _glfwAddSeatListenerWayland(struct wl_seat* seat);
 void _glfwAddDataDeviceListenerWayland(struct wl_data_device* device);
diff --git a/src/wl_window.c b/src/wl_window.c
index caa5188..5b491ff 100644
--- a/src/wl_window.c
+++ b/src/wl_window.c
@@ -1,5 +1,5 @@
 //========================================================================
-// GLFW 3.3 Wayland - www.glfw.org
+// GLFW 3.4 Wayland - www.glfw.org
 //------------------------------------------------------------------------
 // Copyright (c) 2014 Jonas Ådahl <jadahl@gmail.com>
 //
@@ -23,13 +23,13 @@
 //    distribution.
 //
 //========================================================================
-// It is fine to use C99 in this file because it will not be built with VS
-//========================================================================
 
 #define _GNU_SOURCE
 
 #include "internal.h"
 
+#if defined(_GLFW_WAYLAND)
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <errno.h>
@@ -40,10 +40,18 @@
 #include <sys/mman.h>
 #include <sys/timerfd.h>
 #include <poll.h>
-#include <signal.h>
-#include <time.h>
 #include <linux/input-event-codes.h>
 
+#include "wayland-client-protocol.h"
+#include "xdg-shell-client-protocol.h"
+#include "xdg-decoration-unstable-v1-client-protocol.h"
+#include "viewporter-client-protocol.h"
+#include "relative-pointer-unstable-v1-client-protocol.h"
+#include "pointer-constraints-unstable-v1-client-protocol.h"
+#include "xdg-activation-v1-client-protocol.h"
+#include "idle-inhibit-unstable-v1-client-protocol.h"
+#include "fractional-scale-v1-client-protocol.h"
+
 #define GLFW_BORDER_SIZE    4
 #define GLFW_CAPTION_HEIGHT 24
 
@@ -110,12 +118,12 @@
             return -1;
         }
 
-        name = calloc(strlen(path) + sizeof(template), 1);
+        name = _glfw_calloc(strlen(path) + sizeof(template), 1);
         strcpy(name, path);
         strcat(name, template);
 
         fd = createTmpfileCloexec(name);
-        free(name);
+        _glfw_free(name);
         if (fd < 0)
             return -1;
     }
@@ -185,76 +193,28 @@
     return buffer;
 }
 
-// Wait for data to arrive on any of the specified file descriptors
-//
-static GLFWbool waitForData(struct pollfd* fds, nfds_t count, double* timeout)
+static void createFallbackEdge(_GLFWwindow* window,
+                               _GLFWfallbackEdgeWayland* edge,
+                               struct wl_surface* parent,
+                               struct wl_buffer* buffer,
+                               int x, int y,
+                               int width, int height)
 {
-    for (;;)
-    {
-        if (timeout)
-        {
-            const uint64_t base = _glfwPlatformGetTimerValue();
-
-#if defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__CYGWIN__)
-            const time_t seconds = (time_t) *timeout;
-            const long nanoseconds = (long) ((*timeout - seconds) * 1e9);
-            const struct timespec ts = { seconds, nanoseconds };
-            const int result = ppoll(fds, count, &ts, NULL);
-#elif defined(__NetBSD__)
-            const time_t seconds = (time_t) *timeout;
-            const long nanoseconds = (long) ((*timeout - seconds) * 1e9);
-            const struct timespec ts = { seconds, nanoseconds };
-            const int result = pollts(fds, count, &ts, NULL);
-#else
-            const int milliseconds = (int) (*timeout * 1e3);
-            const int result = poll(fds, count, milliseconds);
-#endif
-            const int error = errno; // clock_gettime may overwrite our error
-
-            *timeout -= (_glfwPlatformGetTimerValue() - base) /
-                (double) _glfwPlatformGetTimerFrequency();
-
-            if (result > 0)
-                return GLFW_TRUE;
-            else if (result == -1 && error != EINTR && error != EAGAIN)
-                return GLFW_FALSE;
-            else if (*timeout <= 0.0)
-                return GLFW_FALSE;
-        }
-        else
-        {
-            const int result = poll(fds, count, -1);
-            if (result > 0)
-                return GLFW_TRUE;
-            else if (result == -1 && errno != EINTR && errno != EAGAIN)
-                return GLFW_FALSE;
-        }
-    }
-}
-
-static void createFallbackDecoration(_GLFWwindow* window,
-                                     _GLFWdecorationWayland* decoration,
-                                     struct wl_surface* parent,
-                                     struct wl_buffer* buffer,
-                                     int x, int y,
-                                     int width, int height)
-{
-    decoration->surface = wl_compositor_create_surface(_glfw.wl.compositor);
-    wl_surface_set_user_data(decoration->surface, window);
-    wl_proxy_set_tag((struct wl_proxy*) decoration->surface, &_glfw.wl.tag);
-    decoration->subsurface =
-        wl_subcompositor_get_subsurface(_glfw.wl.subcompositor,
-                                        decoration->surface, parent);
-    wl_subsurface_set_position(decoration->subsurface, x, y);
-    decoration->viewport = wp_viewporter_get_viewport(_glfw.wl.viewporter,
-                                                      decoration->surface);
-    wp_viewport_set_destination(decoration->viewport, width, height);
-    wl_surface_attach(decoration->surface, buffer, 0, 0);
+    edge->surface = wl_compositor_create_surface(_glfw.wl.compositor);
+    wl_surface_set_user_data(edge->surface, window);
+    wl_proxy_set_tag((struct wl_proxy*) edge->surface, &_glfw.wl.tag);
+    edge->subsurface = wl_subcompositor_get_subsurface(_glfw.wl.subcompositor,
+                                                       edge->surface, parent);
+    wl_subsurface_set_position(edge->subsurface, x, y);
+    edge->viewport = wp_viewporter_get_viewport(_glfw.wl.viewporter,
+                                                edge->surface);
+    wp_viewport_set_destination(edge->viewport, width, height);
+    wl_surface_attach(edge->surface, buffer, 0, 0);
 
     struct wl_region* region = wl_compositor_create_region(_glfw.wl.compositor);
     wl_region_add(region, 0, 0, width, height);
-    wl_surface_set_opaque_region(decoration->surface, region);
-    wl_surface_commit(decoration->surface);
+    wl_surface_set_opaque_region(edge->surface, region);
+    wl_surface_commit(edge->surface);
     wl_region_destroy(region);
 }
 
@@ -266,48 +226,53 @@
     if (!_glfw.wl.viewporter)
         return;
 
-    if (!window->wl.decorations.buffer)
-        window->wl.decorations.buffer = createShmBuffer(&image);
-    if (!window->wl.decorations.buffer)
+    if (!window->wl.fallback.buffer)
+        window->wl.fallback.buffer = createShmBuffer(&image);
+    if (!window->wl.fallback.buffer)
         return;
 
-    createFallbackDecoration(window, &window->wl.decorations.top, window->wl.surface,
-                             window->wl.decorations.buffer,
-                             0, -GLFW_CAPTION_HEIGHT,
-                             window->wl.width, GLFW_CAPTION_HEIGHT);
-    createFallbackDecoration(window, &window->wl.decorations.left, window->wl.surface,
-                             window->wl.decorations.buffer,
-                             -GLFW_BORDER_SIZE, -GLFW_CAPTION_HEIGHT,
-                             GLFW_BORDER_SIZE, window->wl.height + GLFW_CAPTION_HEIGHT);
-    createFallbackDecoration(window, &window->wl.decorations.right, window->wl.surface,
-                             window->wl.decorations.buffer,
-                             window->wl.width, -GLFW_CAPTION_HEIGHT,
-                             GLFW_BORDER_SIZE, window->wl.height + GLFW_CAPTION_HEIGHT);
-    createFallbackDecoration(window, &window->wl.decorations.bottom, window->wl.surface,
-                             window->wl.decorations.buffer,
-                             -GLFW_BORDER_SIZE, window->wl.height,
-                             window->wl.width + GLFW_BORDER_SIZE * 2, GLFW_BORDER_SIZE);
+    createFallbackEdge(window, &window->wl.fallback.top, window->wl.surface,
+                       window->wl.fallback.buffer,
+                       0, -GLFW_CAPTION_HEIGHT,
+                       window->wl.width, GLFW_CAPTION_HEIGHT);
+    createFallbackEdge(window, &window->wl.fallback.left, window->wl.surface,
+                       window->wl.fallback.buffer,
+                       -GLFW_BORDER_SIZE, -GLFW_CAPTION_HEIGHT,
+                       GLFW_BORDER_SIZE, window->wl.height + GLFW_CAPTION_HEIGHT);
+    createFallbackEdge(window, &window->wl.fallback.right, window->wl.surface,
+                       window->wl.fallback.buffer,
+                       window->wl.width, -GLFW_CAPTION_HEIGHT,
+                       GLFW_BORDER_SIZE, window->wl.height + GLFW_CAPTION_HEIGHT);
+    createFallbackEdge(window, &window->wl.fallback.bottom, window->wl.surface,
+                       window->wl.fallback.buffer,
+                       -GLFW_BORDER_SIZE, window->wl.height,
+                       window->wl.width + GLFW_BORDER_SIZE * 2, GLFW_BORDER_SIZE);
+
+    window->wl.fallback.decorations = GLFW_TRUE;
 }
 
-static void destroyFallbackDecoration(_GLFWdecorationWayland* decoration)
+static void destroyFallbackEdge(_GLFWfallbackEdgeWayland* edge)
 {
-    if (decoration->subsurface)
-        wl_subsurface_destroy(decoration->subsurface);
-    if (decoration->surface)
-        wl_surface_destroy(decoration->surface);
-    if (decoration->viewport)
-        wp_viewport_destroy(decoration->viewport);
-    decoration->surface = NULL;
-    decoration->subsurface = NULL;
-    decoration->viewport = NULL;
+    if (edge->subsurface)
+        wl_subsurface_destroy(edge->subsurface);
+    if (edge->surface)
+        wl_surface_destroy(edge->surface);
+    if (edge->viewport)
+        wp_viewport_destroy(edge->viewport);
+
+    edge->surface = NULL;
+    edge->subsurface = NULL;
+    edge->viewport = NULL;
 }
 
 static void destroyFallbackDecorations(_GLFWwindow* window)
 {
-    destroyFallbackDecoration(&window->wl.decorations.top);
-    destroyFallbackDecoration(&window->wl.decorations.left);
-    destroyFallbackDecoration(&window->wl.decorations.right);
-    destroyFallbackDecoration(&window->wl.decorations.bottom);
+    window->wl.fallback.decorations = GLFW_FALSE;
+
+    destroyFallbackEdge(&window->wl.fallback.top);
+    destroyFallbackEdge(&window->wl.fallback.left);
+    destroyFallbackEdge(&window->wl.fallback.right);
+    destroyFallbackEdge(&window->wl.fallback.bottom);
 }
 
 static void xdgDecorationHandleConfigure(void* userData,
@@ -346,44 +311,84 @@
     wl_region_destroy(region);
 }
 
-
-static void resizeWindow(_GLFWwindow* window)
+static void resizeFramebuffer(_GLFWwindow* window)
 {
-    int scale = window->wl.contentScale;
-    int scaledWidth = window->wl.width * scale;
-    int scaledHeight = window->wl.height * scale;
+    if (window->wl.fractionalScale)
+    {
+        window->wl.fbWidth = (window->wl.width * window->wl.scalingNumerator) / 120;
+        window->wl.fbHeight = (window->wl.height * window->wl.scalingNumerator) / 120;
+    }
+    else
+    {
+        window->wl.fbWidth = window->wl.width * window->wl.bufferScale;
+        window->wl.fbHeight = window->wl.height * window->wl.bufferScale;
+    }
 
     if (window->wl.egl.window)
-        wl_egl_window_resize(window->wl.egl.window, scaledWidth, scaledHeight, 0, 0);
+    {
+        wl_egl_window_resize(window->wl.egl.window,
+                             window->wl.fbWidth,
+                             window->wl.fbHeight,
+                             0, 0);
+    }
+
     if (!window->wl.transparent)
         setContentAreaOpaque(window);
-    _glfwInputFramebufferSize(window, scaledWidth, scaledHeight);
 
-    if (!window->wl.decorations.top.surface)
-        return;
-
-    wp_viewport_set_destination(window->wl.decorations.top.viewport,
-                                window->wl.width, GLFW_CAPTION_HEIGHT);
-    wl_surface_commit(window->wl.decorations.top.surface);
-
-    wp_viewport_set_destination(window->wl.decorations.left.viewport,
-                                GLFW_BORDER_SIZE, window->wl.height + GLFW_CAPTION_HEIGHT);
-    wl_surface_commit(window->wl.decorations.left.surface);
-
-    wl_subsurface_set_position(window->wl.decorations.right.subsurface,
-                               window->wl.width, -GLFW_CAPTION_HEIGHT);
-    wp_viewport_set_destination(window->wl.decorations.right.viewport,
-                                GLFW_BORDER_SIZE, window->wl.height + GLFW_CAPTION_HEIGHT);
-    wl_surface_commit(window->wl.decorations.right.surface);
-
-    wl_subsurface_set_position(window->wl.decorations.bottom.subsurface,
-                               -GLFW_BORDER_SIZE, window->wl.height);
-    wp_viewport_set_destination(window->wl.decorations.bottom.viewport,
-                                window->wl.width + GLFW_BORDER_SIZE * 2, GLFW_BORDER_SIZE);
-    wl_surface_commit(window->wl.decorations.bottom.surface);
+    _glfwInputFramebufferSize(window, window->wl.fbWidth, window->wl.fbHeight);
 }
 
-void _glfwUpdateContentScaleWayland(_GLFWwindow* window)
+static GLFWbool resizeWindow(_GLFWwindow* window, int width, int height)
+{
+    width = _glfw_max(width, 1);
+    height = _glfw_max(height, 1);
+
+    if (width == window->wl.width && height == window->wl.height)
+        return GLFW_FALSE;
+
+    window->wl.width = width;
+    window->wl.height = height;
+
+    resizeFramebuffer(window);
+
+    if (window->wl.scalingViewport)
+    {
+        wp_viewport_set_destination(window->wl.scalingViewport,
+                                    window->wl.width,
+                                    window->wl.height);
+    }
+
+    if (window->wl.fallback.decorations)
+    {
+        wp_viewport_set_destination(window->wl.fallback.top.viewport,
+                                    window->wl.width,
+                                    GLFW_CAPTION_HEIGHT);
+        wl_surface_commit(window->wl.fallback.top.surface);
+
+        wp_viewport_set_destination(window->wl.fallback.left.viewport,
+                                    GLFW_BORDER_SIZE,
+                                    window->wl.height + GLFW_CAPTION_HEIGHT);
+        wl_surface_commit(window->wl.fallback.left.surface);
+
+        wl_subsurface_set_position(window->wl.fallback.right.subsurface,
+                                window->wl.width, -GLFW_CAPTION_HEIGHT);
+        wp_viewport_set_destination(window->wl.fallback.right.viewport,
+                                    GLFW_BORDER_SIZE,
+                                    window->wl.height + GLFW_CAPTION_HEIGHT);
+        wl_surface_commit(window->wl.fallback.right.surface);
+
+        wl_subsurface_set_position(window->wl.fallback.bottom.subsurface,
+                                -GLFW_BORDER_SIZE, window->wl.height);
+        wp_viewport_set_destination(window->wl.fallback.bottom.viewport,
+                                    window->wl.width + GLFW_BORDER_SIZE * 2,
+                                    GLFW_BORDER_SIZE);
+        wl_surface_commit(window->wl.fallback.bottom.surface);
+    }
+
+    return GLFW_TRUE;
+}
+
+void _glfwUpdateBufferScaleFromOutputsWayland(_GLFWwindow* window)
 {
     if (wl_compositor_get_version(_glfw.wl.compositor) <
         WL_SURFACE_SET_BUFFER_SCALE_SINCE_VERSION)
@@ -391,19 +396,26 @@
         return;
     }
 
-    // Get the scale factor from the highest scale monitor.
-    int maxScale = 1;
+    if (!window->wl.scaleFramebuffer)
+        return;
 
-    for (int i = 0; i < window->wl.scaleCount; i++)
-        maxScale = _glfw_max(window->wl.scales[i].factor, maxScale);
+    // When using fractional scaling, the buffer scale should remain at 1
+    if (window->wl.fractionalScale)
+        return;
+
+    // Get the scale factor from the highest scale monitor.
+    int32_t maxScale = 1;
+
+    for (size_t i = 0; i < window->wl.outputScaleCount; i++)
+        maxScale = _glfw_max(window->wl.outputScales[i].factor, maxScale);
 
     // Only change the framebuffer size if the scale changed.
-    if (window->wl.contentScale != maxScale)
+    if (window->wl.bufferScale != maxScale)
     {
-        window->wl.contentScale = maxScale;
+        window->wl.bufferScale = maxScale;
         wl_surface_set_buffer_scale(window->wl.surface, maxScale);
         _glfwInputWindowContentScale(window, maxScale, maxScale);
-        resizeWindow(window);
+        resizeFramebuffer(window);
 
         if (window->wl.visible)
             _glfwInputWindowDamage(window);
@@ -422,19 +434,19 @@
     if (!window || !monitor)
         return;
 
-    if (window->wl.scaleCount + 1 > window->wl.scaleSize)
+    if (window->wl.outputScaleCount + 1 > window->wl.outputScaleSize)
     {
-        window->wl.scaleSize++;
-        window->wl.scales =
-            realloc(window->wl.scales,
-                    window->wl.scaleSize * sizeof(_GLFWscaleWayland));
+        window->wl.outputScaleSize++;
+        window->wl.outputScales =
+            _glfw_realloc(window->wl.outputScales,
+                          window->wl.outputScaleSize * sizeof(_GLFWscaleWayland));
     }
 
-    window->wl.scaleCount++;
-    window->wl.scales[window->wl.scaleCount - 1].factor = monitor->wl.contentScale;
-    window->wl.scales[window->wl.scaleCount - 1].output = output;
+    window->wl.outputScaleCount++;
+    window->wl.outputScales[window->wl.outputScaleCount - 1] =
+        (_GLFWscaleWayland) { output, monitor->wl.scale };
 
-    _glfwUpdateContentScaleWayland(window);
+    _glfwUpdateBufferScaleFromOutputsWayland(window);
 }
 
 static void surfaceHandleLeave(void* userData,
@@ -446,17 +458,18 @@
 
     _GLFWwindow* window = userData;
 
-    for (int i = 0; i < window->wl.scaleCount; i++)
+    for (size_t i = 0; i < window->wl.outputScaleCount; i++)
     {
-        if (window->wl.scales[i].output == output)
+        if (window->wl.outputScales[i].output == output)
         {
-            window->wl.scales[i] = window->wl.scales[window->wl.scaleCount - 1];
-            window->wl.scaleCount--;
+            window->wl.outputScales[i] =
+                window->wl.outputScales[window->wl.outputScaleCount - 1];
+            window->wl.outputScaleCount--;
             break;
         }
     }
 
-    _glfwUpdateContentScaleWayland(window);
+    _glfwUpdateBufferScaleFromOutputsWayland(window);
 }
 
 static const struct wl_surface_listener surfaceListener =
@@ -500,7 +513,7 @@
 
     setIdleInhibitor(window, GLFW_TRUE);
 
-    if (window->wl.decorations.top.surface)
+    if (window->wl.fallback.decorations)
         destroyFallbackDecorations(window);
 }
 
@@ -523,6 +536,25 @@
     }
 }
 
+void fractionalScaleHandlePreferredScale(void* userData,
+                                         struct wp_fractional_scale_v1* fractionalScale,
+                                         uint32_t numerator)
+{
+    _GLFWwindow* window = userData;
+
+    window->wl.scalingNumerator = numerator;
+    _glfwInputWindowContentScale(window, numerator / 120.f, numerator / 120.f);
+    resizeFramebuffer(window);
+
+    if (window->wl.visible)
+        _glfwInputWindowDamage(window);
+}
+
+const struct wp_fractional_scale_v1_listener fractionalScaleListener =
+{
+    fractionalScaleHandlePreferredScale,
+};
+
 static void xdgToplevelHandleConfigure(void* userData,
                                        struct xdg_toplevel* toplevel,
                                        int32_t width,
@@ -556,7 +588,7 @@
 
     if (width && height)
     {
-        if (window->wl.decorations.top.surface)
+        if (window->wl.fallback.decorations)
         {
             window->wl.pending.width  = _glfw_max(0, width - GLFW_BORDER_SIZE * 2);
             window->wl.pending.height =
@@ -630,13 +662,9 @@
         }
     }
 
-    if (width != window->wl.width || height != window->wl.height)
+    if (resizeWindow(window, width, height))
     {
-        window->wl.width = width;
-        window->wl.height = height;
-        resizeWindow(window);
-
-        _glfwInputWindowSize(window, width, height);
+        _glfwInputWindowSize(window, window->wl.width, window->wl.height);
 
         if (window->wl.visible)
             _glfwInputWindowDamage(window);
@@ -731,13 +759,9 @@
         damaged = GLFW_TRUE;
     }
 
-    if (width != window->wl.width || height != window->wl.height)
+    if (resizeWindow(window, width, height))
     {
-        window->wl.width = width;
-        window->wl.height = height;
-        resizeWindow(window);
-
-        _glfwInputWindowSize(window, width, height);
+        _glfwInputWindowSize(window, window->wl.width, window->wl.height);
         damaged = GLFW_TRUE;
     }
 
@@ -777,7 +801,7 @@
 {
     // Allow libdecor to finish initialization of itself and its plugin
     while (!_glfw.wl.libdecor.ready)
-        _glfwPlatformWaitEvents();
+        _glfwWaitEventsWayland();
 
     window->wl.libdecor.frame = libdecor_decorate(_glfw.wl.libdecor.context,
                                                   window->wl.surface,
@@ -795,8 +819,10 @@
     libdecor_frame_commit(window->wl.libdecor.frame, frameState, NULL);
     libdecor_state_free(frameState);
 
-    if (strlen(window->wl.title))
-        libdecor_frame_set_title(window->wl.libdecor.frame, window->wl.title);
+    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)
@@ -842,6 +868,50 @@
     return GLFW_TRUE;
 }
 
+static void updateXdgSizeLimits(_GLFWwindow* window)
+{
+    int minwidth, minheight, maxwidth, maxheight;
+
+    if (window->resizable)
+    {
+        if (window->minwidth == GLFW_DONT_CARE || window->minheight == GLFW_DONT_CARE)
+            minwidth = minheight = 0;
+        else
+        {
+            minwidth  = window->minwidth;
+            minheight = window->minheight;
+
+            if (window->wl.fallback.decorations)
+            {
+                minwidth  += GLFW_BORDER_SIZE * 2;
+                minheight += GLFW_CAPTION_HEIGHT + GLFW_BORDER_SIZE;
+            }
+        }
+
+        if (window->maxwidth == GLFW_DONT_CARE || window->maxheight == GLFW_DONT_CARE)
+            maxwidth = maxheight = 0;
+        else
+        {
+            maxwidth  = window->maxwidth;
+            maxheight = window->maxheight;
+
+            if (window->wl.fallback.decorations)
+            {
+                maxwidth  += GLFW_BORDER_SIZE * 2;
+                maxheight += GLFW_CAPTION_HEIGHT + GLFW_BORDER_SIZE;
+            }
+        }
+    }
+    else
+    {
+        minwidth = maxwidth = window->wl.width;
+        minheight = maxheight = window->wl.height;
+    }
+
+    xdg_toplevel_set_min_size(window->wl.xdg.toplevel, minwidth, minheight);
+    xdg_toplevel_set_max_size(window->wl.xdg.toplevel, maxwidth, maxheight);
+}
+
 static GLFWbool createXdgShellObjects(_GLFWwindow* window)
 {
     window->wl.xdg.surface = xdg_wm_base_get_xdg_surface(_glfw.wl.wmBase,
@@ -865,8 +935,10 @@
 
     xdg_toplevel_add_listener(window->wl.xdg.toplevel, &xdgToplevelListener, window);
 
-    if (window->wl.title)
-        xdg_toplevel_set_title(window->wl.xdg.toplevel, window->wl.title);
+    if (window->wl.appId)
+        xdg_toplevel_set_app_id(window->wl.xdg.toplevel, window->wl.appId);
+
+    xdg_toplevel_set_title(window->wl.xdg.toplevel, window->title);
 
     if (window->monitor)
     {
@@ -905,33 +977,7 @@
             createFallbackDecorations(window);
     }
 
-    if (window->minwidth != GLFW_DONT_CARE && window->minheight != GLFW_DONT_CARE)
-    {
-        int minwidth  = window->minwidth;
-        int minheight = window->minheight;
-
-        if (window->wl.decorations.top.surface)
-        {
-            minwidth  += GLFW_BORDER_SIZE * 2;
-            minheight += GLFW_CAPTION_HEIGHT + GLFW_BORDER_SIZE;
-        }
-
-        xdg_toplevel_set_min_size(window->wl.xdg.toplevel, minwidth, minheight);
-    }
-
-    if (window->maxwidth != GLFW_DONT_CARE && window->maxheight != GLFW_DONT_CARE)
-    {
-        int maxwidth  = window->maxwidth;
-        int maxheight = window->maxheight;
-
-        if (window->wl.decorations.top.surface)
-        {
-            maxwidth  += GLFW_BORDER_SIZE * 2;
-            maxheight += GLFW_CAPTION_HEIGHT + GLFW_BORDER_SIZE;
-        }
-
-        xdg_toplevel_set_max_size(window->wl.xdg.toplevel, maxwidth, maxheight);
-    }
+    updateXdgSizeLimits(window);
 
     wl_surface_commit(window->wl.surface);
     wl_display_roundtrip(_glfw.wl.display);
@@ -990,8 +1036,13 @@
 
     window->wl.width = wndconfig->width;
     window->wl.height = wndconfig->height;
-    window->wl.contentScale = 1;
-    window->wl.title = _glfw_strdup(wndconfig->title);
+    window->wl.fbWidth = wndconfig->width;
+    window->wl.fbHeight = wndconfig->height;
+    window->wl.appId = _glfw_strdup(wndconfig->wl.appId);
+
+    window->wl.bufferScale = 1;
+    window->wl.scalingNumerator = 120;
+    window->wl.scaleFramebuffer = wndconfig->scaleFramebuffer;
 
     window->wl.maximized = wndconfig->maximized;
 
@@ -999,6 +1050,28 @@
     if (!window->wl.transparent)
         setContentAreaOpaque(window);
 
+    if (_glfw.wl.fractionalScaleManager)
+    {
+        if (window->wl.scaleFramebuffer)
+        {
+            window->wl.scalingViewport =
+                wp_viewporter_get_viewport(_glfw.wl.viewporter, window->wl.surface);
+
+            wp_viewport_set_destination(window->wl.scalingViewport,
+                                        window->wl.width,
+                                        window->wl.height);
+
+            window->wl.fractionalScale =
+                wp_fractional_scale_manager_v1_get_fractional_scale(
+                    _glfw.wl.fractionalScaleManager,
+                    window->wl.surface);
+
+            wp_fractional_scale_v1_add_listener(window->wl.fractionalScale,
+                                                &fractionalScaleListener,
+                                                window);
+        }
+    }
+
     return GLFW_TRUE;
 }
 
@@ -1016,7 +1089,7 @@
         buffer = cursorWayland->buffer;
     else
     {
-        if (window->wl.contentScale > 1 && cursorWayland->cursorHiDPI)
+        if (window->wl.bufferScale > 1 && cursorWayland->cursorHiDPI)
         {
             wlCursor = cursorWayland->cursorHiDPI;
             scale = 2;
@@ -1052,7 +1125,7 @@
 {
     _GLFWcursor* cursor;
 
-    if (!window || window->wl.decorations.focus != GLFW_MAIN_WINDOW)
+    if (!window || !window->wl.hovered)
         return;
 
     cursor = window->wl.currentCursor;
@@ -1131,21 +1204,23 @@
 
 static void handleEvents(double* timeout)
 {
-#if defined(__linux__)
-    _glfwDetectJoystickConnectionLinux();
+#if defined(GLFW_BUILD_LINUX_JOYSTICK)
+    if (_glfw.joysticksInitialized)
+        _glfwDetectJoystickConnectionLinux();
 #endif
 
     GLFWbool event = GLFW_FALSE;
-    struct pollfd fds[4] =
+    enum { DISPLAY_FD, KEYREPEAT_FD, CURSOR_FD, LIBDECOR_FD };
+    struct pollfd fds[] =
     {
-        { wl_display_get_fd(_glfw.wl.display), POLLIN },
-        { _glfw.wl.keyRepeatTimerfd, POLLIN },
-        { _glfw.wl.cursorTimerfd, POLLIN },
-        { -1, POLLIN }
+        [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 }
     };
 
     if (_glfw.wl.libdecor.context)
-        fds[3].fd = libdecor_get_fd(_glfw.wl.libdecor.context);
+        fds[LIBDECOR_FD].fd = libdecor_get_fd(_glfw.wl.libdecor.context);
 
     while (!event)
     {
@@ -1171,13 +1246,13 @@
             return;
         }
 
-        if (!waitForData(fds, sizeof(fds) / sizeof(fds[0]), timeout))
+        if (!_glfwPollPOSIX(fds, sizeof(fds) / sizeof(fds[0]), timeout))
         {
             wl_display_cancel_read(_glfw.wl.display);
             return;
         }
 
-        if (fds[0].revents & POLLIN)
+        if (fds[DISPLAY_FD].revents & POLLIN)
         {
             wl_display_read_events(_glfw.wl.display);
             if (wl_display_dispatch_pending(_glfw.wl.display) > 0)
@@ -1186,7 +1261,7 @@
         else
             wl_display_cancel_read(_glfw.wl.display);
 
-        if (fds[1].revents & POLLIN)
+        if (fds[KEYREPEAT_FD].revents & POLLIN)
         {
             uint64_t repeats;
 
@@ -1206,7 +1281,7 @@
             }
         }
 
-        if (fds[2].revents & POLLIN)
+        if (fds[CURSOR_FD].revents & POLLIN)
         {
             uint64_t repeats;
 
@@ -1214,7 +1289,7 @@
                 incrementCursorImage(_glfw.wl.pointerFocus);
         }
 
-        if (fds[3].revents & POLLIN)
+        if (fds[LIBDECOR_FD].revents & POLLIN)
         {
             if (libdecor_dispatch(_glfw.wl.libdecor.context, 0) > 0)
                 event = GLFW_TRUE;
@@ -1250,7 +1325,7 @@
         const size_t requiredSize = length + readSize + 1;
         if (requiredSize > size)
         {
-            char* longer = realloc(string, requiredSize);
+            char* longer = _glfw_realloc(string, requiredSize);
             if (!longer)
             {
                 _glfwInputError(GLFW_OUT_OF_MEMORY, NULL);
@@ -1302,25 +1377,21 @@
 
     _GLFWwindow* window = wl_surface_get_user_data(surface);
 
-    if (surface == window->wl.decorations.top.surface)
-        window->wl.decorations.focus = GLFW_TOP_DECORATION;
-    else if (surface == window->wl.decorations.left.surface)
-        window->wl.decorations.focus = GLFW_LEFT_DECORATION;
-    else if (surface == window->wl.decorations.right.surface)
-        window->wl.decorations.focus = GLFW_RIGHT_DECORATION;
-    else if (surface == window->wl.decorations.bottom.surface)
-        window->wl.decorations.focus = GLFW_BOTTOM_DECORATION;
-    else
-        window->wl.decorations.focus = GLFW_MAIN_WINDOW;
-
     _glfw.wl.serial = serial;
     _glfw.wl.pointerEnterSerial = serial;
     _glfw.wl.pointerFocus = window;
 
-    window->wl.hovered = GLFW_TRUE;
-
-    _glfwPlatformSetCursor(window, window->wl.currentCursor);
-    _glfwInputCursorEnter(window, GLFW_TRUE);
+    if (surface == window->wl.surface)
+    {
+        window->wl.hovered = GLFW_TRUE;
+        _glfwSetCursorWayland(window, window->wl.currentCursor);
+        _glfwInputCursorEnter(window, GLFW_TRUE);
+    }
+    else
+    {
+        if (window->wl.fallback.decorations)
+            window->wl.fallback.focus = surface;
+    }
 }
 
 static void pointerHandleLeave(void* userData,
@@ -1338,12 +1409,20 @@
     if (!window)
         return;
 
-    window->wl.hovered = GLFW_FALSE;
-
     _glfw.wl.serial = serial;
     _glfw.wl.pointerFocus = NULL;
     _glfw.wl.cursorPreviousName = NULL;
-    _glfwInputCursorEnter(window, GLFW_FALSE);
+
+    if (window->wl.hovered)
+    {
+        window->wl.hovered = GLFW_FALSE;
+        _glfwInputCursorEnter(window, GLFW_FALSE);
+    }
+    else
+    {
+        if (window->wl.fallback.decorations)
+            window->wl.fallback.focus = NULL;
+    }
 }
 
 static void pointerHandleMotion(void* userData,
@@ -1364,81 +1443,87 @@
     window->wl.cursorPosX = xpos;
     window->wl.cursorPosY = ypos;
 
-    const char* cursorName = NULL;
-
-    switch (window->wl.decorations.focus)
+    if (window->wl.hovered)
     {
-        case GLFW_MAIN_WINDOW:
-            _glfw.wl.cursorPreviousName = NULL;
-            _glfwInputCursorPos(window, xpos, ypos);
-            return;
-        case GLFW_TOP_DECORATION:
-            if (ypos < GLFW_BORDER_SIZE)
-                cursorName = "n-resize";
-            else
-                cursorName = "left_ptr";
-            break;
-        case GLFW_LEFT_DECORATION:
-            if (ypos < GLFW_BORDER_SIZE)
-                cursorName = "nw-resize";
-            else
-                cursorName = "w-resize";
-            break;
-        case GLFW_RIGHT_DECORATION:
-            if (ypos < GLFW_BORDER_SIZE)
-                cursorName = "ne-resize";
-            else
-                cursorName = "e-resize";
-            break;
-        case GLFW_BOTTOM_DECORATION:
-            if (xpos < GLFW_BORDER_SIZE)
-                cursorName = "sw-resize";
-            else if (xpos > window->wl.width + GLFW_BORDER_SIZE)
-                cursorName = "se-resize";
-            else
-                cursorName = "s-resize";
-            break;
-        default:
-            assert(0);
+        _glfw.wl.cursorPreviousName = NULL;
+        _glfwInputCursorPos(window, xpos, ypos);
+        return;
     }
 
-    if (_glfw.wl.cursorPreviousName != cursorName)
+    if (window->wl.fallback.decorations)
     {
-        struct wl_surface* surface = _glfw.wl.cursorSurface;
-        struct wl_cursor_theme* theme = _glfw.wl.cursorTheme;
-        int scale = 1;
+        const char* cursorName = "left_ptr";
 
-        if (window->wl.contentScale > 1 && _glfw.wl.cursorThemeHiDPI)
+        if (window->resizable)
         {
-            // We only support up to scale=2 for now, since libwayland-cursor
-            // requires us to load a different theme for each size.
-            scale = 2;
-            theme = _glfw.wl.cursorThemeHiDPI;
+            if (window->wl.fallback.focus == window->wl.fallback.top.surface)
+            {
+                if (ypos < GLFW_BORDER_SIZE)
+                    cursorName = "n-resize";
+            }
+            else if (window->wl.fallback.focus == window->wl.fallback.left.surface)
+            {
+                if (ypos < GLFW_BORDER_SIZE)
+                    cursorName = "nw-resize";
+                else
+                    cursorName = "w-resize";
+            }
+            else if (window->wl.fallback.focus == window->wl.fallback.right.surface)
+            {
+                if (ypos < GLFW_BORDER_SIZE)
+                    cursorName = "ne-resize";
+                else
+                    cursorName = "e-resize";
+            }
+            else if (window->wl.fallback.focus == window->wl.fallback.bottom.surface)
+            {
+                if (xpos < GLFW_BORDER_SIZE)
+                    cursorName = "sw-resize";
+                else if (xpos > window->wl.width + GLFW_BORDER_SIZE)
+                    cursorName = "se-resize";
+                else
+                    cursorName = "s-resize";
+            }
         }
 
-        struct wl_cursor* cursor = wl_cursor_theme_get_cursor(theme, cursorName);
-        if (!cursor)
-            return;
+        if (_glfw.wl.cursorPreviousName != cursorName)
+        {
+            struct wl_surface* surface = _glfw.wl.cursorSurface;
+            struct wl_cursor_theme* theme = _glfw.wl.cursorTheme;
+            int scale = 1;
 
-        // TODO: handle animated cursors too.
-        struct wl_cursor_image* image = cursor->images[0];
-        if (!image)
-            return;
+            if (window->wl.bufferScale > 1 && _glfw.wl.cursorThemeHiDPI)
+            {
+                // We only support up to scale=2 for now, since libwayland-cursor
+                // requires us to load a different theme for each size.
+                scale = 2;
+                theme = _glfw.wl.cursorThemeHiDPI;
+            }
 
-        struct wl_buffer* buffer = wl_cursor_image_get_buffer(image);
-        if (!buffer)
-            return;
+            struct wl_cursor* cursor = wl_cursor_theme_get_cursor(theme, cursorName);
+            if (!cursor)
+                return;
 
-        wl_pointer_set_cursor(_glfw.wl.pointer, _glfw.wl.pointerEnterSerial,
-                              surface,
-                              image->hotspot_x / scale,
-                              image->hotspot_y / scale);
-        wl_surface_set_buffer_scale(surface, scale);
-        wl_surface_attach(surface, buffer, 0, 0);
-        wl_surface_damage(surface, 0, 0, image->width, image->height);
-        wl_surface_commit(surface);
+            // TODO: handle animated cursors too.
+            struct wl_cursor_image* image = cursor->images[0];
+            if (!image)
+                return;
 
-        _glfw.wl.cursorPreviousName = cursorName;
+            struct wl_buffer* buffer = wl_cursor_image_get_buffer(image);
+            if (!buffer)
+                return;
+
+            wl_pointer_set_cursor(_glfw.wl.pointer, _glfw.wl.pointerEnterSerial,
+                                  surface,
+                                  image->hotspot_x / scale,
+                                  image->hotspot_y / scale);
+            wl_surface_set_buffer_scale(surface, scale);
+            wl_surface_attach(surface, buffer, 0, 0);
+            wl_surface_damage(surface, 0, 0, image->width, image->height);
+            wl_surface_commit(surface);
+
+            _glfw.wl.cursorPreviousName = cursorName;
+        }
     }
 }
 
@@ -1450,85 +1535,74 @@
                                 uint32_t state)
 {
     _GLFWwindow* window = _glfw.wl.pointerFocus;
-    int glfwButton;
-
-    uint32_t edges = XDG_TOPLEVEL_RESIZE_EDGE_NONE;
-
     if (!window)
         return;
-    if (button == BTN_LEFT)
+
+    if (window->wl.hovered)
     {
-        switch (window->wl.decorations.focus)
+        _glfw.wl.serial = serial;
+
+        _glfwInputMouseClick(window,
+                             button - BTN_LEFT,
+                             state == WL_POINTER_BUTTON_STATE_PRESSED,
+                             _glfw.wl.xkb.modifiers);
+        return;
+    }
+
+    if (window->wl.fallback.decorations)
+    {
+        if (button == BTN_LEFT)
         {
-            case GLFW_MAIN_WINDOW:
-                break;
-            case GLFW_TOP_DECORATION:
+            uint32_t edges = XDG_TOPLEVEL_RESIZE_EDGE_NONE;
+
+            if (window->wl.fallback.focus == window->wl.fallback.top.surface)
+            {
                 if (window->wl.cursorPosY < GLFW_BORDER_SIZE)
                     edges = XDG_TOPLEVEL_RESIZE_EDGE_TOP;
                 else
-                {
                     xdg_toplevel_move(window->wl.xdg.toplevel, _glfw.wl.seat, serial);
-                }
-                break;
-            case GLFW_LEFT_DECORATION:
+            }
+            else if (window->wl.fallback.focus == window->wl.fallback.left.surface)
+            {
                 if (window->wl.cursorPosY < GLFW_BORDER_SIZE)
                     edges = XDG_TOPLEVEL_RESIZE_EDGE_TOP_LEFT;
                 else
                     edges = XDG_TOPLEVEL_RESIZE_EDGE_LEFT;
-                break;
-            case GLFW_RIGHT_DECORATION:
+            }
+            else if (window->wl.fallback.focus == window->wl.fallback.right.surface)
+            {
                 if (window->wl.cursorPosY < GLFW_BORDER_SIZE)
                     edges = XDG_TOPLEVEL_RESIZE_EDGE_TOP_RIGHT;
                 else
                     edges = XDG_TOPLEVEL_RESIZE_EDGE_RIGHT;
-                break;
-            case GLFW_BOTTOM_DECORATION:
+            }
+            else if (window->wl.fallback.focus == window->wl.fallback.bottom.surface)
+            {
                 if (window->wl.cursorPosX < GLFW_BORDER_SIZE)
                     edges = XDG_TOPLEVEL_RESIZE_EDGE_BOTTOM_LEFT;
                 else if (window->wl.cursorPosX > window->wl.width + GLFW_BORDER_SIZE)
                     edges = XDG_TOPLEVEL_RESIZE_EDGE_BOTTOM_RIGHT;
                 else
                     edges = XDG_TOPLEVEL_RESIZE_EDGE_BOTTOM;
-                break;
-            default:
-                assert(0);
+            }
+
+            if (edges != XDG_TOPLEVEL_RESIZE_EDGE_NONE)
+            {
+                xdg_toplevel_resize(window->wl.xdg.toplevel, _glfw.wl.seat,
+                                    serial, edges);
+            }
         }
-        if (edges != XDG_TOPLEVEL_RESIZE_EDGE_NONE)
+        else if (button == BTN_RIGHT)
         {
-            xdg_toplevel_resize(window->wl.xdg.toplevel, _glfw.wl.seat,
-                                serial, edges);
-            return;
+            if (window->wl.xdg.toplevel)
+            {
+                xdg_toplevel_show_window_menu(window->wl.xdg.toplevel,
+                                              _glfw.wl.seat, serial,
+                                              window->wl.cursorPosX,
+                                              window->wl.cursorPosY);
+            }
         }
     }
-    else if (button == BTN_RIGHT)
-    {
-        if (window->wl.decorations.focus != GLFW_MAIN_WINDOW &&
-            window->wl.xdg.toplevel)
-        {
-            xdg_toplevel_show_window_menu(window->wl.xdg.toplevel,
-                                          _glfw.wl.seat, serial,
-                                          window->wl.cursorPosX,
-                                          window->wl.cursorPosY);
-            return;
-        }
-    }
-
-    // Don’t pass the button to the user if it was related to a decoration.
-    if (window->wl.decorations.focus != GLFW_MAIN_WINDOW)
-        return;
-
-    _glfw.wl.serial = serial;
-
-    /* Makes left, right and middle 0, 1 and 2. Overall order follows evdev
-     * codes. */
-    glfwButton = button - BTN_LEFT;
-
-    _glfwInputMouseClick(window,
-                         glfwButton,
-                         state == WL_POINTER_BUTTON_STATE_PRESSED
-                                ? GLFW_PRESS
-                                : GLFW_RELEASE,
-                         _glfw.wl.xkb.modifiers);
 }
 
 static void pointerHandleAxis(void* userData,
@@ -1567,6 +1641,7 @@
     struct xkb_state* state;
     struct xkb_compose_table* composeTable;
     struct xkb_compose_state* composeState;
+
     char* mapStr;
     const char* locale;
 
@@ -1780,7 +1855,6 @@
     }
 }
 
-#ifdef WL_KEYBOARD_REPEAT_INFO_SINCE_VERSION
 static void keyboardHandleRepeatInfo(void* userData,
                                      struct wl_keyboard* keyboard,
                                      int32_t rate,
@@ -1792,7 +1866,6 @@
     _glfw.wl.keyRepeatRate = rate;
     _glfw.wl.keyRepeatDelay = delay;
 }
-#endif
 
 static const struct wl_keyboard_listener keyboardListener =
 {
@@ -1801,9 +1874,7 @@
     keyboardHandleLeave,
     keyboardHandleKey,
     keyboardHandleModifiers,
-#ifdef WL_KEYBOARD_REPEAT_INFO_SINCE_VERSION
     keyboardHandleRepeatInfo,
-#endif
 };
 
 static void seatHandleCapabilities(void* userData,
@@ -1873,8 +1944,8 @@
                                       struct wl_data_offer* offer)
 {
     _GLFWofferWayland* offers =
-        realloc(_glfw.wl.offers,
-                sizeof(_GLFWofferWayland) * (_glfw.wl.offerCount + 1));
+        _glfw_realloc(_glfw.wl.offers,
+                      sizeof(_GLFWofferWayland) * (_glfw.wl.offerCount + 1));
     if (!offers)
     {
         _glfwInputError(GLFW_OUT_OF_MEMORY, NULL);
@@ -1974,12 +2045,12 @@
             _glfwInputDrop(_glfw.wl.dragFocus, count, (const char**) paths);
 
         for (int i = 0; i < count; i++)
-            free(paths[i]);
+            _glfw_free(paths[i]);
 
-        free(paths);
+        _glfw_free(paths);
     }
 
-    free(string);
+    _glfw_free(string);
 }
 
 static void dataDeviceHandleSelection(void* userData,
@@ -2018,28 +2089,25 @@
     dataDeviceHandleSelection,
 };
 
-// Translates a GLFW standard cursor to a theme cursor name
-//
-static char *translateCursorShape(int shape)
+static void xdgActivationHandleDone(void* userData,
+                                    struct xdg_activation_token_v1* activationToken,
+                                    const char* token)
 {
-    switch (shape)
-    {
-        case GLFW_ARROW_CURSOR:
-            return "left_ptr";
-        case GLFW_IBEAM_CURSOR:
-            return "xterm";
-        case GLFW_CROSSHAIR_CURSOR:
-            return "crosshair";
-        case GLFW_HAND_CURSOR:
-            return "hand2";
-        case GLFW_HRESIZE_CURSOR:
-            return "sb_h_double_arrow";
-        case GLFW_VRESIZE_CURSOR:
-            return "sb_v_double_arrow";
-    }
-    return NULL;
+    _GLFWwindow* window = userData;
+
+    if (activationToken != window->wl.activationToken)
+        return;
+
+    xdg_activation_v1_activate(_glfw.wl.activationManager, token, window->wl.surface);
+    xdg_activation_token_v1_destroy(window->wl.activationToken);
+    window->wl.activationToken = NULL;
 }
 
+static const struct xdg_activation_token_v1_listener xdgActivationListener =
+{
+    xdgActivationHandleDone
+};
+
 void _glfwAddSeatListenerWayland(struct wl_seat* seat)
 {
     wl_seat_add_listener(seat, &seatListener, NULL);
@@ -2055,10 +2123,10 @@
 //////                       GLFW platform API                      //////
 //////////////////////////////////////////////////////////////////////////
 
-int _glfwPlatformCreateWindow(_GLFWwindow* window,
-                              const _GLFWwndconfig* wndconfig,
-                              const _GLFWctxconfig* ctxconfig,
-                              const _GLFWfbconfig* fbconfig)
+GLFWbool _glfwCreateWindowWayland(_GLFWwindow* window,
+                                  const _GLFWwndconfig* wndconfig,
+                                  const _GLFWctxconfig* ctxconfig,
+                                  const _GLFWfbconfig* fbconfig)
 {
     if (!createNativeSurface(window, wndconfig, fbconfig))
         return GLFW_FALSE;
@@ -2069,8 +2137,8 @@
             ctxconfig->source == GLFW_NATIVE_CONTEXT_API)
         {
             window->wl.egl.window = wl_egl_window_create(window->wl.surface,
-                                                         wndconfig->width,
-                                                         wndconfig->height);
+                                                         window->wl.fbWidth,
+                                                         window->wl.fbHeight);
             if (!window->wl.egl.window)
             {
                 _glfwInputError(GLFW_PLATFORM_ERROR,
@@ -2095,6 +2163,9 @@
             return GLFW_FALSE;
     }
 
+    if (wndconfig->mousePassthrough)
+        _glfwSetWindowMousePassthroughWayland(window, GLFW_TRUE);
+
     if (window->monitor || wndconfig->visible)
     {
         if (!createShellObjects(window))
@@ -2104,7 +2175,7 @@
     return GLFW_TRUE;
 }
 
-void _glfwPlatformDestroyWindow(_GLFWwindow* window)
+void _glfwDestroyWindowWayland(_GLFWwindow* window)
 {
     if (window == _glfw.wl.pointerFocus)
         _glfw.wl.pointerFocus = NULL;
@@ -2112,6 +2183,9 @@
     if (window == _glfw.wl.keyboardFocus)
         _glfw.wl.keyboardFocus = NULL;
 
+    if (window->wl.activationToken)
+        xdg_activation_token_v1_destroy(window->wl.activationToken);
+
     if (window->wl.idleInhibitor)
         zwp_idle_inhibitor_v1_destroy(window->wl.idleInhibitor);
 
@@ -2121,13 +2195,16 @@
     if (window->wl.lockedPointer)
         zwp_locked_pointer_v1_destroy(window->wl.lockedPointer);
 
+    if (window->wl.confinedPointer)
+        zwp_confined_pointer_v1_destroy(window->wl.confinedPointer);
+
     if (window->context.destroy)
         window->context.destroy(window);
 
     destroyShellObjects(window);
 
-    if (window->wl.decorations.buffer)
-        wl_buffer_destroy(window->wl.decorations.buffer);
+    if (window->wl.fallback.buffer)
+        wl_buffer_destroy(window->wl.fallback.buffer);
 
     if (window->wl.egl.window)
         wl_egl_window_destroy(window->wl.egl.window);
@@ -2135,47 +2212,43 @@
     if (window->wl.surface)
         wl_surface_destroy(window->wl.surface);
 
-    free(window->wl.title);
-    free(window->wl.scales);
+    _glfw_free(window->wl.appId);
+    _glfw_free(window->wl.outputScales);
 }
 
-void _glfwPlatformSetWindowTitle(_GLFWwindow* window, const char* title)
+void _glfwSetWindowTitleWayland(_GLFWwindow* window, const char* title)
 {
-    if (window->wl.title)
-        free(window->wl.title);
-    window->wl.title = _glfw_strdup(title);
-
     if (window->wl.libdecor.frame)
         libdecor_frame_set_title(window->wl.libdecor.frame, title);
     else if (window->wl.xdg.toplevel)
         xdg_toplevel_set_title(window->wl.xdg.toplevel, title);
 }
 
-void _glfwPlatformSetWindowIcon(_GLFWwindow* window,
-                                int count, const GLFWimage* images)
+void _glfwSetWindowIconWayland(_GLFWwindow* window,
+                               int count, const GLFWimage* images)
 {
-    _glfwInputError(GLFW_PLATFORM_ERROR,
-                    "Wayland: Setting window icon not supported");
+    _glfwInputError(GLFW_FEATURE_UNAVAILABLE,
+                    "Wayland: The platform does not support setting the window icon");
 }
 
-void _glfwPlatformGetWindowPos(_GLFWwindow* window, int* xpos, int* ypos)
+void _glfwGetWindowPosWayland(_GLFWwindow* window, int* xpos, int* ypos)
 {
     // A Wayland client is not aware of its position, so just warn and leave it
     // as (0, 0)
 
-    _glfwInputError(GLFW_PLATFORM_ERROR,
-                    "Wayland: Window position retrieval not supported");
+    _glfwInputError(GLFW_FEATURE_UNAVAILABLE,
+                    "Wayland: The platform does not provide the window position");
 }
 
-void _glfwPlatformSetWindowPos(_GLFWwindow* window, int xpos, int ypos)
+void _glfwSetWindowPosWayland(_GLFWwindow* window, int xpos, int ypos)
 {
     // A Wayland client can not set its position, so just warn
 
-    _glfwInputError(GLFW_PLATFORM_ERROR,
-                    "Wayland: Window position setting not supported");
+    _glfwInputError(GLFW_FEATURE_UNAVAILABLE,
+                    "Wayland: The platform does not support setting the window position");
 }
 
-void _glfwPlatformGetWindowSize(_GLFWwindow* window, int* width, int* height)
+void _glfwGetWindowSizeWayland(_GLFWwindow* window, int* width, int* height)
 {
     if (width)
         *width = window->wl.width;
@@ -2183,7 +2256,7 @@
         *height = window->wl.height;
 }
 
-void _glfwPlatformSetWindowSize(_GLFWwindow* window, int width, int height)
+void _glfwSetWindowSizeWayland(_GLFWwindow* window, int width, int height)
 {
     if (window->monitor)
     {
@@ -2191,13 +2264,13 @@
     }
     else
     {
-        window->wl.width = width;
-        window->wl.height = height;
-        resizeWindow(window);
+        if (!resizeWindow(window, width, height))
+            return;
 
         if (window->wl.libdecor.frame)
         {
-            struct libdecor_state* frameState = libdecor_state_new(width, height);
+            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);
         }
@@ -2207,9 +2280,9 @@
     }
 }
 
-void _glfwPlatformSetWindowSizeLimits(_GLFWwindow* window,
-                                      int minwidth, int minheight,
-                                      int maxwidth, int maxheight)
+void _glfwSetWindowSizeLimitsWayland(_GLFWwindow* window,
+                                     int minwidth, int minheight,
+                                     int maxwidth, int maxheight)
 {
     if (window->wl.libdecor.frame)
     {
@@ -2225,37 +2298,10 @@
                                             maxwidth, maxheight);
     }
     else if (window->wl.xdg.toplevel)
-    {
-        if (minwidth == GLFW_DONT_CARE || minheight == GLFW_DONT_CARE)
-            minwidth = minheight = 0;
-        else
-        {
-            if (window->wl.decorations.top.surface)
-            {
-                minwidth  += GLFW_BORDER_SIZE * 2;
-                minheight += GLFW_CAPTION_HEIGHT + GLFW_BORDER_SIZE;
-            }
-        }
-
-        if (maxwidth == GLFW_DONT_CARE || maxheight == GLFW_DONT_CARE)
-            maxwidth = maxheight = 0;
-        else
-        {
-            if (window->wl.decorations.top.surface)
-            {
-                maxwidth  += GLFW_BORDER_SIZE * 2;
-                maxheight += GLFW_CAPTION_HEIGHT + GLFW_BORDER_SIZE;
-            }
-        }
-
-        xdg_toplevel_set_min_size(window->wl.xdg.toplevel, minwidth, minheight);
-        xdg_toplevel_set_max_size(window->wl.xdg.toplevel, maxwidth, maxheight);
-        wl_surface_commit(window->wl.surface);
-    }
+        updateXdgSizeLimits(window);
 }
 
-void _glfwPlatformSetWindowAspectRatio(_GLFWwindow* window,
-                                       int numer, int denom)
+void _glfwSetWindowAspectRatioWayland(_GLFWwindow* window, int numer, int denom)
 {
     if (window->wl.maximized || window->wl.fullscreen)
         return;
@@ -2272,41 +2318,36 @@
             width *= targetRatio;
     }
 
-    if (width != window->wl.width || height != window->wl.height)
+    if (resizeWindow(window, width, height))
     {
-        window->wl.width = width;
-        window->wl.height = height;
-        resizeWindow(window);
-
         if (window->wl.libdecor.frame)
         {
-            struct libdecor_state* frameState = libdecor_state_new(width, height);
+            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);
         }
 
-        _glfwInputWindowSize(window, width, height);
+        _glfwInputWindowSize(window, window->wl.width, window->wl.height);
 
         if (window->wl.visible)
             _glfwInputWindowDamage(window);
     }
 }
 
-void _glfwPlatformGetFramebufferSize(_GLFWwindow* window,
-                                     int* width, int* height)
+void _glfwGetFramebufferSizeWayland(_GLFWwindow* window, int* width, int* height)
 {
-    _glfwPlatformGetWindowSize(window, width, height);
     if (width)
-        *width *= window->wl.contentScale;
+        *width = window->wl.fbWidth;
     if (height)
-        *height *= window->wl.contentScale;
+        *height = window->wl.fbHeight;
 }
 
-void _glfwPlatformGetWindowFrameSize(_GLFWwindow* window,
-                                     int* left, int* top,
-                                     int* right, int* bottom)
+void _glfwGetWindowFrameSizeWayland(_GLFWwindow* window,
+                                    int* left, int* top,
+                                    int* right, int* bottom)
 {
-    if (window->wl.decorations.top.surface)
+    if (window->wl.fallback.decorations)
     {
         if (top)
             *top = GLFW_CAPTION_HEIGHT;
@@ -2319,16 +2360,26 @@
     }
 }
 
-void _glfwPlatformGetWindowContentScale(_GLFWwindow* window,
-                                        float* xscale, float* yscale)
+void _glfwGetWindowContentScaleWayland(_GLFWwindow* window,
+                                       float* xscale, float* yscale)
 {
-    if (xscale)
-        *xscale = (float) window->wl.contentScale;
-    if (yscale)
-        *yscale = (float) window->wl.contentScale;
+    if (window->wl.fractionalScale)
+    {
+        if (xscale)
+            *xscale = (float) window->wl.scalingNumerator / 120.f;
+        if (yscale)
+            *yscale = (float) window->wl.scalingNumerator / 120.f;
+    }
+    else
+    {
+        if (xscale)
+            *xscale = (float) window->wl.bufferScale;
+        if (yscale)
+            *yscale = (float) window->wl.bufferScale;
+    }
 }
 
-void _glfwPlatformIconifyWindow(_GLFWwindow* window)
+void _glfwIconifyWindowWayland(_GLFWwindow* window)
 {
     if (window->wl.libdecor.frame)
         libdecor_frame_set_minimized(window->wl.libdecor.frame);
@@ -2336,12 +2387,12 @@
         xdg_toplevel_set_minimized(window->wl.xdg.toplevel);
 }
 
-void _glfwPlatformRestoreWindow(_GLFWwindow* window)
+void _glfwRestoreWindowWayland(_GLFWwindow* window)
 {
     if (window->monitor)
     {
         // There is no way to unset minimized, or even to know if we are
-        // minimized, so there is nothing to do here.
+        // minimized, so there is nothing to do in this case.
     }
     else
     {
@@ -2359,7 +2410,7 @@
     }
 }
 
-void _glfwPlatformMaximizeWindow(_GLFWwindow* window)
+void _glfwMaximizeWindowWayland(_GLFWwindow* window)
 {
     if (window->wl.libdecor.frame)
         libdecor_frame_set_maximized(window->wl.libdecor.frame);
@@ -2369,17 +2420,17 @@
         window->wl.maximized = GLFW_TRUE;
 }
 
-void _glfwPlatformShowWindow(_GLFWwindow* window)
+void _glfwShowWindowWayland(_GLFWwindow* window)
 {
     if (!window->wl.libdecor.frame && !window->wl.xdg.toplevel)
     {
-        // NOTE: The XDG/shell surface is created here so command-line applications
+        // NOTE: The XDG surface and role are created here so command-line applications
         //       with off-screen windows do not appear in for example the Unity dock
         createShellObjects(window);
     }
 }
 
-void _glfwPlatformHideWindow(_GLFWwindow* window)
+void _glfwHideWindowWayland(_GLFWwindow* window)
 {
     if (window->wl.visible)
     {
@@ -2391,29 +2442,68 @@
     }
 }
 
-void _glfwPlatformRequestWindowAttention(_GLFWwindow* window)
+void _glfwRequestWindowAttentionWayland(_GLFWwindow* window)
 {
-    // TODO
-    _glfwInputError(GLFW_PLATFORM_ERROR,
-                    "Wayland: Window attention request not implemented yet");
+    if (!_glfw.wl.activationManager)
+        return;
+
+    // We're about to overwrite this with a new request
+    if (window->wl.activationToken)
+        xdg_activation_token_v1_destroy(window->wl.activationToken);
+
+    window->wl.activationToken =
+        xdg_activation_v1_get_activation_token(_glfw.wl.activationManager);
+    xdg_activation_token_v1_add_listener(window->wl.activationToken,
+                                         &xdgActivationListener,
+                                         window);
+
+    xdg_activation_token_v1_commit(window->wl.activationToken);
 }
 
-void _glfwPlatformFocusWindow(_GLFWwindow* window)
+void _glfwFocusWindowWayland(_GLFWwindow* window)
 {
-    _glfwInputError(GLFW_PLATFORM_ERROR,
-                    "Wayland: Focusing a window requires user interaction");
+    if (!_glfw.wl.activationManager)
+        return;
+
+    if (window->wl.activationToken)
+        xdg_activation_token_v1_destroy(window->wl.activationToken);
+
+    window->wl.activationToken =
+        xdg_activation_v1_get_activation_token(_glfw.wl.activationManager);
+    xdg_activation_token_v1_add_listener(window->wl.activationToken,
+                                         &xdgActivationListener,
+                                         window);
+
+    xdg_activation_token_v1_set_serial(window->wl.activationToken,
+                                       _glfw.wl.serial,
+                                       _glfw.wl.seat);
+
+    _GLFWwindow* requester = _glfw.wl.keyboardFocus;
+    if (requester)
+    {
+        xdg_activation_token_v1_set_surface(window->wl.activationToken,
+                                            requester->wl.surface);
+
+        if (requester->wl.appId)
+        {
+            xdg_activation_token_v1_set_app_id(window->wl.activationToken,
+                                               requester->wl.appId);
+        }
+    }
+
+    xdg_activation_token_v1_commit(window->wl.activationToken);
 }
 
-void _glfwPlatformSetWindowMonitor(_GLFWwindow* window,
-                                   _GLFWmonitor* monitor,
-                                   int xpos, int ypos,
-                                   int width, int height,
-                                   int refreshRate)
+void _glfwSetWindowMonitorWayland(_GLFWwindow* window,
+                                  _GLFWmonitor* monitor,
+                                  int xpos, int ypos,
+                                  int width, int height,
+                                  int refreshRate)
 {
     if (window->monitor == monitor)
     {
         if (!monitor)
-            _glfwPlatformSetWindowSize(window, width, height);
+            _glfwSetWindowSizeWayland(window, width, height);
 
         return;
     }
@@ -2426,41 +2516,42 @@
     if (window->monitor)
         acquireMonitor(window);
     else
-        _glfwPlatformSetWindowSize(window, width, height);
+        _glfwSetWindowSizeWayland(window, width, height);
 }
 
-int _glfwPlatformWindowFocused(_GLFWwindow* window)
+GLFWbool _glfwWindowFocusedWayland(_GLFWwindow* window)
 {
     return _glfw.wl.keyboardFocus == window;
 }
 
-int _glfwPlatformWindowIconified(_GLFWwindow* window)
+GLFWbool _glfwWindowIconifiedWayland(_GLFWwindow* window)
 {
-    // xdg-shell doesn’t give any way to request whether a surface is iconified
+    // xdg-shell doesn’t give any way to request whether a surface is
+    // iconified.
     return GLFW_FALSE;
 }
 
-int _glfwPlatformWindowVisible(_GLFWwindow* window)
+GLFWbool _glfwWindowVisibleWayland(_GLFWwindow* window)
 {
     return window->wl.visible;
 }
 
-int _glfwPlatformWindowMaximized(_GLFWwindow* window)
+GLFWbool _glfwWindowMaximizedWayland(_GLFWwindow* window)
 {
     return window->wl.maximized;
 }
 
-int _glfwPlatformWindowHovered(_GLFWwindow* window)
+GLFWbool _glfwWindowHoveredWayland(_GLFWwindow* window)
 {
     return window->wl.hovered;
 }
 
-int _glfwPlatformFramebufferTransparent(_GLFWwindow* window)
+GLFWbool _glfwFramebufferTransparentWayland(_GLFWwindow* window)
 {
     return window->wl.transparent;
 }
 
-void _glfwPlatformSetWindowResizable(_GLFWwindow* window, GLFWbool enabled)
+void _glfwSetWindowResizableWayland(_GLFWwindow* window, GLFWbool enabled)
 {
     if (window->wl.libdecor.frame)
     {
@@ -2475,15 +2566,11 @@
                                               LIBDECOR_ACTION_RESIZE);
         }
     }
-    else
-    {
-        // TODO
-        _glfwInputError(GLFW_PLATFORM_ERROR,
-                        "Wayland: Window attribute setting not implemented yet");
-    }
+    else if (window->wl.xdg.toplevel)
+        updateXdgSizeLimits(window);
 }
 
-void _glfwPlatformSetWindowDecorated(_GLFWwindow* window, GLFWbool enabled)
+void _glfwSetWindowDecoratedWayland(_GLFWwindow* window, GLFWbool enabled)
 {
     if (window->wl.libdecor.frame)
     {
@@ -2509,55 +2596,68 @@
     }
 }
 
-void _glfwPlatformSetWindowFloating(_GLFWwindow* window, GLFWbool enabled)
+void _glfwSetWindowFloatingWayland(_GLFWwindow* window, GLFWbool enabled)
 {
-    // TODO
-    _glfwInputError(GLFW_PLATFORM_ERROR,
-                    "Wayland: Window attribute setting not implemented yet");
+    _glfwInputError(GLFW_FEATURE_UNAVAILABLE,
+                    "Wayland: Platform does not support making a window floating");
 }
 
-float _glfwPlatformGetWindowOpacity(_GLFWwindow* window)
+void _glfwSetWindowMousePassthroughWayland(_GLFWwindow* window, GLFWbool enabled)
+{
+    if (enabled)
+    {
+        struct wl_region* region = wl_compositor_create_region(_glfw.wl.compositor);
+        wl_surface_set_input_region(window->wl.surface, region);
+        wl_region_destroy(region);
+    }
+    else
+        wl_surface_set_input_region(window->wl.surface, NULL);
+}
+
+float _glfwGetWindowOpacityWayland(_GLFWwindow* window)
 {
     return 1.f;
 }
 
-void _glfwPlatformSetWindowOpacity(_GLFWwindow* window, float opacity)
+void _glfwSetWindowOpacityWayland(_GLFWwindow* window, float opacity)
 {
+    _glfwInputError(GLFW_FEATURE_UNAVAILABLE,
+                    "Wayland: The platform does not support setting the window opacity");
 }
 
-void _glfwPlatformSetRawMouseMotion(_GLFWwindow* window, GLFWbool enabled)
+void _glfwSetRawMouseMotionWayland(_GLFWwindow* window, GLFWbool enabled)
 {
     // This is handled in relativePointerHandleRelativeMotion
 }
 
-GLFWbool _glfwPlatformRawMouseMotionSupported(void)
+GLFWbool _glfwRawMouseMotionSupportedWayland(void)
 {
     return GLFW_TRUE;
 }
 
-void _glfwPlatformPollEvents(void)
+void _glfwPollEventsWayland(void)
 {
     double timeout = 0.0;
     handleEvents(&timeout);
 }
 
-void _glfwPlatformWaitEvents(void)
+void _glfwWaitEventsWayland(void)
 {
     handleEvents(NULL);
 }
 
-void _glfwPlatformWaitEventsTimeout(double timeout)
+void _glfwWaitEventsTimeoutWayland(double timeout)
 {
     handleEvents(&timeout);
 }
 
-void _glfwPlatformPostEmptyEvent(void)
+void _glfwPostEmptyEventWayland(void)
 {
     wl_display_sync(_glfw.wl.display);
     flushDisplay();
 }
 
-void _glfwPlatformGetCursorPos(_GLFWwindow* window, double* xpos, double* ypos)
+void _glfwGetCursorPosWayland(_GLFWwindow* window, double* xpos, double* ypos)
 {
     if (xpos)
         *xpos = window->wl.cursorPosX;
@@ -2565,16 +2665,18 @@
         *ypos = window->wl.cursorPosY;
 }
 
-void _glfwPlatformSetCursorPos(_GLFWwindow* window, double x, double y)
+void _glfwSetCursorPosWayland(_GLFWwindow* window, double x, double y)
 {
+    _glfwInputError(GLFW_FEATURE_UNAVAILABLE,
+                    "Wayland: The platform does not support setting the cursor position");
 }
 
-void _glfwPlatformSetCursorMode(_GLFWwindow* window, int mode)
+void _glfwSetCursorModeWayland(_GLFWwindow* window, int mode)
 {
-    _glfwPlatformSetCursor(window, window->wl.currentCursor);
+    _glfwSetCursorWayland(window, window->wl.currentCursor);
 }
 
-const char* _glfwPlatformGetScancodeName(int scancode)
+const char* _glfwGetScancodeNameWayland(int scancode)
 {
     if (scancode < 0 || scancode > 255)
     {
@@ -2631,14 +2733,14 @@
     return _glfw.wl.keynames[key];
 }
 
-int _glfwPlatformGetKeyScancode(int key)
+int _glfwGetKeyScancodeWayland(int key)
 {
     return _glfw.wl.scancodes[key];
 }
 
-int _glfwPlatformCreateCursor(_GLFWcursor* cursor,
-                              const GLFWimage* image,
-                              int xhot, int yhot)
+GLFWbool _glfwCreateCursorWayland(_GLFWcursor* cursor,
+                                  const GLFWimage* image,
+                                  int xhot, int yhot)
 {
     cursor->wl.buffer = createShmBuffer(image);
     if (!cursor->wl.buffer)
@@ -2651,34 +2753,108 @@
     return GLFW_TRUE;
 }
 
-int _glfwPlatformCreateStandardCursor(_GLFWcursor* cursor, int shape)
+GLFWbool _glfwCreateStandardCursorWayland(_GLFWcursor* cursor, int shape)
 {
-    struct wl_cursor* standardCursor;
+    const char* name = NULL;
 
-    standardCursor = wl_cursor_theme_get_cursor(_glfw.wl.cursorTheme,
-                                                translateCursorShape(shape));
-    if (!standardCursor)
+    // Try the XDG names first
+    switch (shape)
     {
-        _glfwInputError(GLFW_PLATFORM_ERROR,
-                        "Wayland: Standard cursor \"%s\" not found",
-                        translateCursorShape(shape));
-        return GLFW_FALSE;
+        case GLFW_ARROW_CURSOR:
+            name = "default";
+            break;
+        case GLFW_IBEAM_CURSOR:
+            name = "text";
+            break;
+        case GLFW_CROSSHAIR_CURSOR:
+            name = "crosshair";
+            break;
+        case GLFW_POINTING_HAND_CURSOR:
+            name = "pointer";
+            break;
+        case GLFW_RESIZE_EW_CURSOR:
+            name = "ew-resize";
+            break;
+        case GLFW_RESIZE_NS_CURSOR:
+            name = "ns-resize";
+            break;
+        case GLFW_RESIZE_NWSE_CURSOR:
+            name = "nwse-resize";
+            break;
+        case GLFW_RESIZE_NESW_CURSOR:
+            name = "nesw-resize";
+            break;
+        case GLFW_RESIZE_ALL_CURSOR:
+            name = "all-scroll";
+            break;
+        case GLFW_NOT_ALLOWED_CURSOR:
+            name = "not-allowed";
+            break;
     }
 
-    cursor->wl.cursor = standardCursor;
-    cursor->wl.currentImage = 0;
+    cursor->wl.cursor = wl_cursor_theme_get_cursor(_glfw.wl.cursorTheme, name);
 
     if (_glfw.wl.cursorThemeHiDPI)
     {
-        standardCursor = wl_cursor_theme_get_cursor(_glfw.wl.cursorThemeHiDPI,
-                                                    translateCursorShape(shape));
-        cursor->wl.cursorHiDPI = standardCursor;
+        cursor->wl.cursorHiDPI =
+            wl_cursor_theme_get_cursor(_glfw.wl.cursorThemeHiDPI, name);
+    }
+
+    if (!cursor->wl.cursor)
+    {
+        // Fall back to the core X11 names
+        switch (shape)
+        {
+            case GLFW_ARROW_CURSOR:
+                name = "left_ptr";
+                break;
+            case GLFW_IBEAM_CURSOR:
+                name = "xterm";
+                break;
+            case GLFW_CROSSHAIR_CURSOR:
+                name = "crosshair";
+                break;
+            case GLFW_POINTING_HAND_CURSOR:
+                name = "hand2";
+                break;
+            case GLFW_RESIZE_EW_CURSOR:
+                name = "sb_h_double_arrow";
+                break;
+            case GLFW_RESIZE_NS_CURSOR:
+                name = "sb_v_double_arrow";
+                break;
+            case GLFW_RESIZE_ALL_CURSOR:
+                name = "fleur";
+                break;
+            default:
+                _glfwInputError(GLFW_CURSOR_UNAVAILABLE,
+                                "Wayland: Standard cursor shape unavailable");
+                return GLFW_FALSE;
+        }
+
+        cursor->wl.cursor = wl_cursor_theme_get_cursor(_glfw.wl.cursorTheme, name);
+        if (!cursor->wl.cursor)
+        {
+            _glfwInputError(GLFW_CURSOR_UNAVAILABLE,
+                            "Wayland: Failed to create standard cursor \"%s\"",
+                            name);
+            return GLFW_FALSE;
+        }
+
+        if (_glfw.wl.cursorThemeHiDPI)
+        {
+            if (!cursor->wl.cursorHiDPI)
+            {
+                cursor->wl.cursorHiDPI =
+                    wl_cursor_theme_get_cursor(_glfw.wl.cursorThemeHiDPI, name);
+            }
+        }
     }
 
     return GLFW_TRUE;
 }
 
-void _glfwPlatformDestroyCursor(_GLFWcursor* cursor)
+void _glfwDestroyCursorWayland(_GLFWcursor* cursor)
 {
     // If it's a standard cursor we don't need to do anything here
     if (cursor->wl.cursor)
@@ -2743,8 +2919,8 @@
 {
     if (!_glfw.wl.relativePointerManager)
     {
-        _glfwInputError(GLFW_PLATFORM_ERROR,
-                        "Wayland: no relative pointer manager");
+        _glfwInputError(GLFW_FEATURE_UNAVAILABLE,
+                        "Wayland: The compositor does not support pointer locking");
         return;
     }
 
@@ -2777,7 +2953,44 @@
     window->wl.lockedPointer = NULL;
 }
 
-void _glfwPlatformSetCursor(_GLFWwindow* window, _GLFWcursor* cursor)
+static void confinedPointerHandleConfined(void* userData,
+                                          struct zwp_confined_pointer_v1* confinedPointer)
+{
+}
+
+static void confinedPointerHandleUnconfined(void* userData,
+                                            struct zwp_confined_pointer_v1* confinedPointer)
+{
+}
+
+static const struct zwp_confined_pointer_v1_listener confinedPointerListener =
+{
+    confinedPointerHandleConfined,
+    confinedPointerHandleUnconfined
+};
+
+static void confinePointer(_GLFWwindow* window)
+{
+    window->wl.confinedPointer =
+        zwp_pointer_constraints_v1_confine_pointer(
+            _glfw.wl.pointerConstraints,
+            window->wl.surface,
+            _glfw.wl.pointer,
+            NULL,
+            ZWP_POINTER_CONSTRAINTS_V1_LIFETIME_PERSISTENT);
+
+    zwp_confined_pointer_v1_add_listener(window->wl.confinedPointer,
+                                         &confinedPointerListener,
+                                         window);
+}
+
+static void unconfinePointer(_GLFWwindow* window)
+{
+    zwp_confined_pointer_v1_destroy(window->wl.confinedPointer);
+    window->wl.confinedPointer = NULL;
+}
+
+void _glfwSetCursorWayland(_GLFWwindow* window, _GLFWcursor* cursor)
 {
     if (!_glfw.wl.pointer)
         return;
@@ -2786,26 +2999,35 @@
 
     // If we're not in the correct window just save the cursor
     // the next time the pointer enters the window the cursor will change
-    if (window != _glfw.wl.pointerFocus ||
-        window->wl.decorations.focus != GLFW_MAIN_WINDOW)
-    {
+    if (!window->wl.hovered)
         return;
-    }
 
     // Update pointer lock to match cursor mode
     if (window->cursorMode == GLFW_CURSOR_DISABLED)
     {
+        if (window->wl.confinedPointer)
+            unconfinePointer(window);
         if (!window->wl.lockedPointer)
             lockPointer(window);
     }
+    else if (window->cursorMode == GLFW_CURSOR_CAPTURED)
+    {
+        if (window->wl.lockedPointer)
+            unlockPointer(window);
+        if (!window->wl.confinedPointer)
+            confinePointer(window);
+    }
     else if (window->cursorMode == GLFW_CURSOR_NORMAL ||
              window->cursorMode == GLFW_CURSOR_HIDDEN)
     {
         if (window->wl.lockedPointer)
             unlockPointer(window);
+        else if (window->wl.confinedPointer)
+            unconfinePointer(window);
     }
 
-    if (window->cursorMode == GLFW_CURSOR_NORMAL)
+    if (window->cursorMode == GLFW_CURSOR_NORMAL ||
+        window->cursorMode == GLFW_CURSOR_CAPTURED)
     {
         if (cursor)
             setCursorImage(window, &cursor->wl);
@@ -2914,7 +3136,7 @@
     dataSourceHandleCancelled,
 };
 
-void _glfwPlatformSetClipboardString(const char* string)
+void _glfwSetClipboardStringWayland(const char* string)
 {
     if (_glfw.wl.selectionSource)
     {
@@ -2929,7 +3151,7 @@
         return;
     }
 
-    free(_glfw.wl.clipboardString);
+    _glfw_free(_glfw.wl.clipboardString);
     _glfw.wl.clipboardString = copy;
 
     _glfw.wl.selectionSource =
@@ -2949,7 +3171,7 @@
                                  _glfw.wl.serial);
 }
 
-const char* _glfwPlatformGetClipboardString(void)
+const char* _glfwGetClipboardStringWayland(void)
 {
     if (!_glfw.wl.selectionOffer)
     {
@@ -2961,13 +3183,31 @@
     if (_glfw.wl.selectionSource)
         return _glfw.wl.clipboardString;
 
-    free(_glfw.wl.clipboardString);
+    _glfw_free(_glfw.wl.clipboardString);
     _glfw.wl.clipboardString =
         readDataOfferAsString(_glfw.wl.selectionOffer, "text/plain;charset=utf-8");
     return _glfw.wl.clipboardString;
 }
 
-void _glfwPlatformGetRequiredInstanceExtensions(char** extensions)
+EGLenum _glfwGetEGLPlatformWayland(EGLint** attribs)
+{
+    if (_glfw.egl.EXT_platform_base && _glfw.egl.EXT_platform_wayland)
+        return EGL_PLATFORM_WAYLAND_EXT;
+    else
+        return 0;
+}
+
+EGLNativeDisplayType _glfwGetEGLNativeDisplayWayland(void)
+{
+    return _glfw.wl.display;
+}
+
+EGLNativeWindowType _glfwGetEGLNativeWindowWayland(_GLFWwindow* window)
+{
+    return window->wl.egl.window;
+}
+
+void _glfwGetRequiredInstanceExtensionsWayland(char** extensions)
 {
     if (!_glfw.vk.KHR_surface || !_glfw.vk.KHR_wayland_surface)
         return;
@@ -2976,9 +3216,9 @@
     extensions[1] = "VK_KHR_wayland_surface";
 }
 
-int _glfwPlatformGetPhysicalDevicePresentationSupport(VkInstance instance,
-                                                      VkPhysicalDevice device,
-                                                      uint32_t queuefamily)
+GLFWbool _glfwGetPhysicalDevicePresentationSupportWayland(VkInstance instance,
+                                                          VkPhysicalDevice device,
+                                                          uint32_t queuefamily)
 {
     PFN_vkGetPhysicalDeviceWaylandPresentationSupportKHR
         vkGetPhysicalDeviceWaylandPresentationSupportKHR =
@@ -2996,10 +3236,10 @@
                                                             _glfw.wl.display);
 }
 
-VkResult _glfwPlatformCreateWindowSurface(VkInstance instance,
-                                          _GLFWwindow* window,
-                                          const VkAllocationCallbacks* allocator,
-                                          VkSurfaceKHR* surface)
+VkResult _glfwCreateWindowSurfaceWayland(VkInstance instance,
+                                         _GLFWwindow* window,
+                                         const VkAllocationCallbacks* allocator,
+                                         VkSurfaceKHR* surface)
 {
     VkResult err;
     VkWaylandSurfaceCreateInfoKHR sci;
@@ -3038,6 +3278,14 @@
 GLFWAPI struct wl_display* glfwGetWaylandDisplay(void)
 {
     _GLFW_REQUIRE_INIT_OR_RETURN(NULL);
+
+    if (_glfw.platform.platformID != GLFW_PLATFORM_WAYLAND)
+    {
+        _glfwInputError(GLFW_PLATFORM_UNAVAILABLE,
+                        "Wayland: Platform not initialized");
+        return NULL;
+    }
+
     return _glfw.wl.display;
 }
 
@@ -3045,6 +3293,16 @@
 {
     _GLFWwindow* window = (_GLFWwindow*) handle;
     _GLFW_REQUIRE_INIT_OR_RETURN(NULL);
+
+    if (_glfw.platform.platformID != GLFW_PLATFORM_WAYLAND)
+    {
+        _glfwInputError(GLFW_PLATFORM_UNAVAILABLE,
+                        "Wayland: Platform not initialized");
+        return NULL;
+    }
+
     return window->wl.surface;
 }
 
+#endif // _GLFW_WAYLAND
+
diff --git a/src/x11_init.c b/src/x11_init.c
index 6049904..e992f44 100644
--- a/src/x11_init.c
+++ b/src/x11_init.c
@@ -1,5 +1,5 @@
 //========================================================================
-// GLFW 3.3 X11 - www.glfw.org
+// GLFW 3.4 X11 - www.glfw.org
 //------------------------------------------------------------------------
 // Copyright (c) 2002-2006 Marcus Geelnard
 // Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.org>
@@ -24,12 +24,10 @@
 //    distribution.
 //
 //========================================================================
-// It is fine to use C99 in this file because it will not be built with VS
-//========================================================================
 
 #include "internal.h"
 
-#include <X11/Xresource.h>
+#if defined(_GLFW_X11)
 
 #include <stdlib.h>
 #include <string.h>
@@ -214,7 +212,7 @@
 //
 static void createKeyTables(void)
 {
-    int scancode, scancodeMin, scancodeMax;
+    int scancodeMin, scancodeMax;
 
     memset(_glfw.x11.keycodes, -1, sizeof(_glfw.x11.keycodes));
     memset(_glfw.x11.scancodes, -1, sizeof(_glfw.x11.scancodes));
@@ -360,7 +358,7 @@
         };
 
         // Find the X11 key code -> GLFW key code mapping
-        for (scancode = scancodeMin;  scancode <= scancodeMax;  scancode++)
+        for (int scancode = scancodeMin;  scancode <= scancodeMax;  scancode++)
         {
             int key = GLFW_KEY_UNKNOWN;
 
@@ -419,7 +417,7 @@
                                           scancodeMax - scancodeMin + 1,
                                           &width);
 
-    for (scancode = scancodeMin;  scancode <= scancodeMax;  scancode++)
+    for (int scancode = scancodeMin;  scancode <= scancodeMax;  scancode++)
     {
         // Translate the un-translated key codes using traditional X11 KeySym
         // lookups
@@ -460,7 +458,41 @@
     return found;
 }
 
-// Check whether the specified atom is supported
+static void inputMethodDestroyCallback(XIM im, XPointer clientData, XPointer callData)
+{
+    _glfw.x11.im = NULL;
+}
+
+static void inputMethodInstantiateCallback(Display* display,
+                                           XPointer clientData,
+                                           XPointer callData)
+{
+    if (_glfw.x11.im)
+        return;
+
+    _glfw.x11.im = XOpenIM(_glfw.x11.display, 0, NULL, NULL);
+    if (_glfw.x11.im)
+    {
+        if (!hasUsableInputMethodStyle())
+        {
+            XCloseIM(_glfw.x11.im);
+            _glfw.x11.im = NULL;
+        }
+    }
+
+    if (_glfw.x11.im)
+    {
+        XIMCallback callback;
+        callback.callback = (XIMProc) inputMethodDestroyCallback;
+        callback.client_data = NULL;
+        XSetIMValues(_glfw.x11.im, XNDestroyCallback, &callback, NULL);
+
+        for (_GLFWwindow* window = _glfw.windowListHead;  window;  window = window->next)
+            _glfwCreateInputContextX11(window);
+    }
+}
+
+// Return the atom ID only if it is listed in the specified array
 //
 static Atom getAtomIfSupported(Atom* supportedAtoms,
                                unsigned long atomCount,
@@ -573,20 +605,20 @@
 static GLFWbool initExtensions(void)
 {
 #if defined(__OpenBSD__) || defined(__NetBSD__)
-    _glfw.x11.vidmode.handle = _glfw_dlopen("libXxf86vm.so");
+    _glfw.x11.vidmode.handle = _glfwPlatformLoadModule("libXxf86vm.so");
 #else
-    _glfw.x11.vidmode.handle = _glfw_dlopen("libXxf86vm.so.1");
+    _glfw.x11.vidmode.handle = _glfwPlatformLoadModule("libXxf86vm.so.1");
 #endif
     if (_glfw.x11.vidmode.handle)
     {
         _glfw.x11.vidmode.QueryExtension = (PFN_XF86VidModeQueryExtension)
-            _glfw_dlsym(_glfw.x11.vidmode.handle, "XF86VidModeQueryExtension");
+            _glfwPlatformGetModuleSymbol(_glfw.x11.vidmode.handle, "XF86VidModeQueryExtension");
         _glfw.x11.vidmode.GetGammaRamp = (PFN_XF86VidModeGetGammaRamp)
-            _glfw_dlsym(_glfw.x11.vidmode.handle, "XF86VidModeGetGammaRamp");
+            _glfwPlatformGetModuleSymbol(_glfw.x11.vidmode.handle, "XF86VidModeGetGammaRamp");
         _glfw.x11.vidmode.SetGammaRamp = (PFN_XF86VidModeSetGammaRamp)
-            _glfw_dlsym(_glfw.x11.vidmode.handle, "XF86VidModeSetGammaRamp");
+            _glfwPlatformGetModuleSymbol(_glfw.x11.vidmode.handle, "XF86VidModeSetGammaRamp");
         _glfw.x11.vidmode.GetGammaRampSize = (PFN_XF86VidModeGetGammaRampSize)
-            _glfw_dlsym(_glfw.x11.vidmode.handle, "XF86VidModeGetGammaRampSize");
+            _glfwPlatformGetModuleSymbol(_glfw.x11.vidmode.handle, "XF86VidModeGetGammaRampSize");
 
         _glfw.x11.vidmode.available =
             XF86VidModeQueryExtension(_glfw.x11.display,
@@ -595,18 +627,18 @@
     }
 
 #if defined(__CYGWIN__)
-    _glfw.x11.xi.handle = _glfw_dlopen("libXi-6.so");
+    _glfw.x11.xi.handle = _glfwPlatformLoadModule("libXi-6.so");
 #elif defined(__OpenBSD__) || defined(__NetBSD__)
-    _glfw.x11.xi.handle = _glfw_dlopen("libXi.so");
+    _glfw.x11.xi.handle = _glfwPlatformLoadModule("libXi.so");
 #else
-    _glfw.x11.xi.handle = _glfw_dlopen("libXi.so.6");
+    _glfw.x11.xi.handle = _glfwPlatformLoadModule("libXi.so.6");
 #endif
     if (_glfw.x11.xi.handle)
     {
         _glfw.x11.xi.QueryVersion = (PFN_XIQueryVersion)
-            _glfw_dlsym(_glfw.x11.xi.handle, "XIQueryVersion");
+            _glfwPlatformGetModuleSymbol(_glfw.x11.xi.handle, "XIQueryVersion");
         _glfw.x11.xi.SelectEvents = (PFN_XISelectEvents)
-            _glfw_dlsym(_glfw.x11.xi.handle, "XISelectEvents");
+            _glfwPlatformGetModuleSymbol(_glfw.x11.xi.handle, "XISelectEvents");
 
         if (XQueryExtension(_glfw.x11.display,
                             "XInputExtension",
@@ -627,50 +659,50 @@
     }
 
 #if defined(__CYGWIN__)
-    _glfw.x11.randr.handle = _glfw_dlopen("libXrandr-2.so");
+    _glfw.x11.randr.handle = _glfwPlatformLoadModule("libXrandr-2.so");
 #elif defined(__OpenBSD__) || defined(__NetBSD__)
-    _glfw.x11.randr.handle = _glfw_dlopen("libXrandr.so");
+    _glfw.x11.randr.handle = _glfwPlatformLoadModule("libXrandr.so");
 #else
-    _glfw.x11.randr.handle = _glfw_dlopen("libXrandr.so.2");
+    _glfw.x11.randr.handle = _glfwPlatformLoadModule("libXrandr.so.2");
 #endif
     if (_glfw.x11.randr.handle)
     {
         _glfw.x11.randr.AllocGamma = (PFN_XRRAllocGamma)
-            _glfw_dlsym(_glfw.x11.randr.handle, "XRRAllocGamma");
+            _glfwPlatformGetModuleSymbol(_glfw.x11.randr.handle, "XRRAllocGamma");
         _glfw.x11.randr.FreeGamma = (PFN_XRRFreeGamma)
-            _glfw_dlsym(_glfw.x11.randr.handle, "XRRFreeGamma");
+            _glfwPlatformGetModuleSymbol(_glfw.x11.randr.handle, "XRRFreeGamma");
         _glfw.x11.randr.FreeCrtcInfo = (PFN_XRRFreeCrtcInfo)
-            _glfw_dlsym(_glfw.x11.randr.handle, "XRRFreeCrtcInfo");
+            _glfwPlatformGetModuleSymbol(_glfw.x11.randr.handle, "XRRFreeCrtcInfo");
         _glfw.x11.randr.FreeGamma = (PFN_XRRFreeGamma)
-            _glfw_dlsym(_glfw.x11.randr.handle, "XRRFreeGamma");
+            _glfwPlatformGetModuleSymbol(_glfw.x11.randr.handle, "XRRFreeGamma");
         _glfw.x11.randr.FreeOutputInfo = (PFN_XRRFreeOutputInfo)
-            _glfw_dlsym(_glfw.x11.randr.handle, "XRRFreeOutputInfo");
+            _glfwPlatformGetModuleSymbol(_glfw.x11.randr.handle, "XRRFreeOutputInfo");
         _glfw.x11.randr.FreeScreenResources = (PFN_XRRFreeScreenResources)
-            _glfw_dlsym(_glfw.x11.randr.handle, "XRRFreeScreenResources");
+            _glfwPlatformGetModuleSymbol(_glfw.x11.randr.handle, "XRRFreeScreenResources");
         _glfw.x11.randr.GetCrtcGamma = (PFN_XRRGetCrtcGamma)
-            _glfw_dlsym(_glfw.x11.randr.handle, "XRRGetCrtcGamma");
+            _glfwPlatformGetModuleSymbol(_glfw.x11.randr.handle, "XRRGetCrtcGamma");
         _glfw.x11.randr.GetCrtcGammaSize = (PFN_XRRGetCrtcGammaSize)
-            _glfw_dlsym(_glfw.x11.randr.handle, "XRRGetCrtcGammaSize");
+            _glfwPlatformGetModuleSymbol(_glfw.x11.randr.handle, "XRRGetCrtcGammaSize");
         _glfw.x11.randr.GetCrtcInfo = (PFN_XRRGetCrtcInfo)
-            _glfw_dlsym(_glfw.x11.randr.handle, "XRRGetCrtcInfo");
+            _glfwPlatformGetModuleSymbol(_glfw.x11.randr.handle, "XRRGetCrtcInfo");
         _glfw.x11.randr.GetOutputInfo = (PFN_XRRGetOutputInfo)
-            _glfw_dlsym(_glfw.x11.randr.handle, "XRRGetOutputInfo");
+            _glfwPlatformGetModuleSymbol(_glfw.x11.randr.handle, "XRRGetOutputInfo");
         _glfw.x11.randr.GetOutputPrimary = (PFN_XRRGetOutputPrimary)
-            _glfw_dlsym(_glfw.x11.randr.handle, "XRRGetOutputPrimary");
+            _glfwPlatformGetModuleSymbol(_glfw.x11.randr.handle, "XRRGetOutputPrimary");
         _glfw.x11.randr.GetScreenResourcesCurrent = (PFN_XRRGetScreenResourcesCurrent)
-            _glfw_dlsym(_glfw.x11.randr.handle, "XRRGetScreenResourcesCurrent");
+            _glfwPlatformGetModuleSymbol(_glfw.x11.randr.handle, "XRRGetScreenResourcesCurrent");
         _glfw.x11.randr.QueryExtension = (PFN_XRRQueryExtension)
-            _glfw_dlsym(_glfw.x11.randr.handle, "XRRQueryExtension");
+            _glfwPlatformGetModuleSymbol(_glfw.x11.randr.handle, "XRRQueryExtension");
         _glfw.x11.randr.QueryVersion = (PFN_XRRQueryVersion)
-            _glfw_dlsym(_glfw.x11.randr.handle, "XRRQueryVersion");
+            _glfwPlatformGetModuleSymbol(_glfw.x11.randr.handle, "XRRQueryVersion");
         _glfw.x11.randr.SelectInput = (PFN_XRRSelectInput)
-            _glfw_dlsym(_glfw.x11.randr.handle, "XRRSelectInput");
+            _glfwPlatformGetModuleSymbol(_glfw.x11.randr.handle, "XRRSelectInput");
         _glfw.x11.randr.SetCrtcConfig = (PFN_XRRSetCrtcConfig)
-            _glfw_dlsym(_glfw.x11.randr.handle, "XRRSetCrtcConfig");
+            _glfwPlatformGetModuleSymbol(_glfw.x11.randr.handle, "XRRSetCrtcConfig");
         _glfw.x11.randr.SetCrtcGamma = (PFN_XRRSetCrtcGamma)
-            _glfw_dlsym(_glfw.x11.randr.handle, "XRRSetCrtcGamma");
+            _glfwPlatformGetModuleSymbol(_glfw.x11.randr.handle, "XRRSetCrtcGamma");
         _glfw.x11.randr.UpdateConfiguration = (PFN_XRRUpdateConfiguration)
-            _glfw_dlsym(_glfw.x11.randr.handle, "XRRUpdateConfiguration");
+            _glfwPlatformGetModuleSymbol(_glfw.x11.randr.handle, "XRRUpdateConfiguration");
 
         if (XRRQueryExtension(_glfw.x11.display,
                               &_glfw.x11.randr.eventBase,
@@ -721,37 +753,43 @@
     }
 
 #if defined(__CYGWIN__)
-    _glfw.x11.xcursor.handle = _glfw_dlopen("libXcursor-1.so");
+    _glfw.x11.xcursor.handle = _glfwPlatformLoadModule("libXcursor-1.so");
 #elif defined(__OpenBSD__) || defined(__NetBSD__)
-    _glfw.x11.xcursor.handle = _glfw_dlopen("libXcursor.so");
+    _glfw.x11.xcursor.handle = _glfwPlatformLoadModule("libXcursor.so");
 #else
-    _glfw.x11.xcursor.handle = _glfw_dlopen("libXcursor.so.1");
+    _glfw.x11.xcursor.handle = _glfwPlatformLoadModule("libXcursor.so.1");
 #endif
     if (_glfw.x11.xcursor.handle)
     {
         _glfw.x11.xcursor.ImageCreate = (PFN_XcursorImageCreate)
-            _glfw_dlsym(_glfw.x11.xcursor.handle, "XcursorImageCreate");
+            _glfwPlatformGetModuleSymbol(_glfw.x11.xcursor.handle, "XcursorImageCreate");
         _glfw.x11.xcursor.ImageDestroy = (PFN_XcursorImageDestroy)
-            _glfw_dlsym(_glfw.x11.xcursor.handle, "XcursorImageDestroy");
+            _glfwPlatformGetModuleSymbol(_glfw.x11.xcursor.handle, "XcursorImageDestroy");
         _glfw.x11.xcursor.ImageLoadCursor = (PFN_XcursorImageLoadCursor)
-            _glfw_dlsym(_glfw.x11.xcursor.handle, "XcursorImageLoadCursor");
+            _glfwPlatformGetModuleSymbol(_glfw.x11.xcursor.handle, "XcursorImageLoadCursor");
+        _glfw.x11.xcursor.GetTheme = (PFN_XcursorGetTheme)
+            _glfwPlatformGetModuleSymbol(_glfw.x11.xcursor.handle, "XcursorGetTheme");
+        _glfw.x11.xcursor.GetDefaultSize = (PFN_XcursorGetDefaultSize)
+            _glfwPlatformGetModuleSymbol(_glfw.x11.xcursor.handle, "XcursorGetDefaultSize");
+        _glfw.x11.xcursor.LibraryLoadImage = (PFN_XcursorLibraryLoadImage)
+            _glfwPlatformGetModuleSymbol(_glfw.x11.xcursor.handle, "XcursorLibraryLoadImage");
     }
 
 #if defined(__CYGWIN__)
-    _glfw.x11.xinerama.handle = _glfw_dlopen("libXinerama-1.so");
+    _glfw.x11.xinerama.handle = _glfwPlatformLoadModule("libXinerama-1.so");
 #elif defined(__OpenBSD__) || defined(__NetBSD__)
-    _glfw.x11.xinerama.handle = _glfw_dlopen("libXinerama.so");
+    _glfw.x11.xinerama.handle = _glfwPlatformLoadModule("libXinerama.so");
 #else
-    _glfw.x11.xinerama.handle = _glfw_dlopen("libXinerama.so.1");
+    _glfw.x11.xinerama.handle = _glfwPlatformLoadModule("libXinerama.so.1");
 #endif
     if (_glfw.x11.xinerama.handle)
     {
         _glfw.x11.xinerama.IsActive = (PFN_XineramaIsActive)
-            _glfw_dlsym(_glfw.x11.xinerama.handle, "XineramaIsActive");
+            _glfwPlatformGetModuleSymbol(_glfw.x11.xinerama.handle, "XineramaIsActive");
         _glfw.x11.xinerama.QueryExtension = (PFN_XineramaQueryExtension)
-            _glfw_dlsym(_glfw.x11.xinerama.handle, "XineramaQueryExtension");
+            _glfwPlatformGetModuleSymbol(_glfw.x11.xinerama.handle, "XineramaQueryExtension");
         _glfw.x11.xinerama.QueryScreens = (PFN_XineramaQueryScreens)
-            _glfw_dlsym(_glfw.x11.xinerama.handle, "XineramaQueryScreens");
+            _glfwPlatformGetModuleSymbol(_glfw.x11.xinerama.handle, "XineramaQueryScreens");
 
         if (XineramaQueryExtension(_glfw.x11.display,
                                    &_glfw.x11.xinerama.major,
@@ -790,34 +828,38 @@
                               XkbGroupStateMask, XkbGroupStateMask);
     }
 
+    if (_glfw.hints.init.x11.xcbVulkanSurface)
+    {
 #if defined(__CYGWIN__)
-    _glfw.x11.x11xcb.handle = _glfw_dlopen("libX11-xcb-1.so");
+        _glfw.x11.x11xcb.handle = _glfwPlatformLoadModule("libX11-xcb-1.so");
 #elif defined(__OpenBSD__) || defined(__NetBSD__)
-    _glfw.x11.x11xcb.handle = _glfw_dlopen("libX11-xcb.so");
+        _glfw.x11.x11xcb.handle = _glfwPlatformLoadModule("libX11-xcb.so");
 #else
-    _glfw.x11.x11xcb.handle = _glfw_dlopen("libX11-xcb.so.1");
+        _glfw.x11.x11xcb.handle = _glfwPlatformLoadModule("libX11-xcb.so.1");
 #endif
+    }
+
     if (_glfw.x11.x11xcb.handle)
     {
         _glfw.x11.x11xcb.GetXCBConnection = (PFN_XGetXCBConnection)
-            _glfw_dlsym(_glfw.x11.x11xcb.handle, "XGetXCBConnection");
+            _glfwPlatformGetModuleSymbol(_glfw.x11.x11xcb.handle, "XGetXCBConnection");
     }
 
 #if defined(__CYGWIN__)
-    _glfw.x11.xrender.handle = _glfw_dlopen("libXrender-1.so");
+    _glfw.x11.xrender.handle = _glfwPlatformLoadModule("libXrender-1.so");
 #elif defined(__OpenBSD__) || defined(__NetBSD__)
-    _glfw.x11.xrender.handle = _glfw_dlopen("libXrender.so");
+    _glfw.x11.xrender.handle = _glfwPlatformLoadModule("libXrender.so");
 #else
-    _glfw.x11.xrender.handle = _glfw_dlopen("libXrender.so.1");
+    _glfw.x11.xrender.handle = _glfwPlatformLoadModule("libXrender.so.1");
 #endif
     if (_glfw.x11.xrender.handle)
     {
         _glfw.x11.xrender.QueryExtension = (PFN_XRenderQueryExtension)
-            _glfw_dlsym(_glfw.x11.xrender.handle, "XRenderQueryExtension");
+            _glfwPlatformGetModuleSymbol(_glfw.x11.xrender.handle, "XRenderQueryExtension");
         _glfw.x11.xrender.QueryVersion = (PFN_XRenderQueryVersion)
-            _glfw_dlsym(_glfw.x11.xrender.handle, "XRenderQueryVersion");
+            _glfwPlatformGetModuleSymbol(_glfw.x11.xrender.handle, "XRenderQueryVersion");
         _glfw.x11.xrender.FindVisualFormat = (PFN_XRenderFindVisualFormat)
-            _glfw_dlsym(_glfw.x11.xrender.handle, "XRenderFindVisualFormat");
+            _glfwPlatformGetModuleSymbol(_glfw.x11.xrender.handle, "XRenderFindVisualFormat");
 
         if (XRenderQueryExtension(_glfw.x11.display,
                                   &_glfw.x11.xrender.errorBase,
@@ -832,6 +874,37 @@
         }
     }
 
+#if defined(__CYGWIN__)
+    _glfw.x11.xshape.handle = _glfwPlatformLoadModule("libXext-6.so");
+#elif defined(__OpenBSD__) || defined(__NetBSD__)
+    _glfw.x11.xshape.handle = _glfwPlatformLoadModule("libXext.so");
+#else
+    _glfw.x11.xshape.handle = _glfwPlatformLoadModule("libXext.so.6");
+#endif
+    if (_glfw.x11.xshape.handle)
+    {
+        _glfw.x11.xshape.QueryExtension = (PFN_XShapeQueryExtension)
+            _glfwPlatformGetModuleSymbol(_glfw.x11.xshape.handle, "XShapeQueryExtension");
+        _glfw.x11.xshape.ShapeCombineRegion = (PFN_XShapeCombineRegion)
+            _glfwPlatformGetModuleSymbol(_glfw.x11.xshape.handle, "XShapeCombineRegion");
+        _glfw.x11.xshape.QueryVersion = (PFN_XShapeQueryVersion)
+            _glfwPlatformGetModuleSymbol(_glfw.x11.xshape.handle, "XShapeQueryVersion");
+        _glfw.x11.xshape.ShapeCombineMask = (PFN_XShapeCombineMask)
+            _glfwPlatformGetModuleSymbol(_glfw.x11.xshape.handle, "XShapeCombineMask");
+
+        if (XShapeQueryExtension(_glfw.x11.display,
+            &_glfw.x11.xshape.errorBase,
+            &_glfw.x11.xshape.eventBase))
+        {
+            if (XShapeQueryVersion(_glfw.x11.display,
+                &_glfw.x11.xshape.major,
+                &_glfw.x11.xshape.minor))
+            {
+                _glfw.x11.xshape.available = GLFW_TRUE;
+            }
+        }
+    }
+
     // Update the key code LUT
     // FIXME: We should listen to XkbMapNotify events to track changes to
     // the keyboard mapping.
@@ -955,7 +1028,7 @@
 {
     unsigned char pixels[16 * 16 * 4] = { 0 };
     GLFWimage image = { 16, 16, pixels };
-    return _glfwCreateCursorX11(&image, 0, 0);
+    return _glfwCreateNativeCursorX11(&image, 0, 0);
 }
 
 // Create a helper window for IPC
@@ -1051,9 +1124,8 @@
 
 // Creates a native cursor object from the specified image and hotspot
 //
-Cursor _glfwCreateCursorX11(const GLFWimage* image, int xhot, int yhot)
+Cursor _glfwCreateNativeCursorX11(const GLFWimage* image, int xhot, int yhot)
 {
-    int i;
     Cursor cursor;
 
     if (!_glfw.x11.xcursor.handle)
@@ -1069,7 +1141,7 @@
     unsigned char* source = (unsigned char*) image->pixels;
     XcursorPixel* target = native->pixels;
 
-    for (i = 0;  i < image->width * image->height;  i++, target++, source += 4)
+    for (int i = 0;  i < image->width * image->height;  i++, target++, source += 4)
     {
         unsigned int alpha = source[3];
 
@@ -1090,8 +1162,92 @@
 //////                       GLFW platform API                      //////
 //////////////////////////////////////////////////////////////////////////
 
-int _glfwPlatformInit(void)
+GLFWbool _glfwConnectX11(int platformID, _GLFWplatform* platform)
 {
+    const _GLFWplatform x11 =
+    {
+        .platformID = GLFW_PLATFORM_X11,
+        .init = _glfwInitX11,
+        .terminate = _glfwTerminateX11,
+        .getCursorPos = _glfwGetCursorPosX11,
+        .setCursorPos = _glfwSetCursorPosX11,
+        .setCursorMode = _glfwSetCursorModeX11,
+        .setRawMouseMotion = _glfwSetRawMouseMotionX11,
+        .rawMouseMotionSupported = _glfwRawMouseMotionSupportedX11,
+        .createCursor = _glfwCreateCursorX11,
+        .createStandardCursor = _glfwCreateStandardCursorX11,
+        .destroyCursor = _glfwDestroyCursorX11,
+        .setCursor = _glfwSetCursorX11,
+        .getScancodeName = _glfwGetScancodeNameX11,
+        .getKeyScancode = _glfwGetKeyScancodeX11,
+        .setClipboardString = _glfwSetClipboardStringX11,
+        .getClipboardString = _glfwGetClipboardStringX11,
+#if defined(GLFW_BUILD_LINUX_JOYSTICK)
+        .initJoysticks = _glfwInitJoysticksLinux,
+        .terminateJoysticks = _glfwTerminateJoysticksLinux,
+        .pollJoystick = _glfwPollJoystickLinux,
+        .getMappingName = _glfwGetMappingNameLinux,
+        .updateGamepadGUID = _glfwUpdateGamepadGUIDLinux,
+#else
+        .initJoysticks = _glfwInitJoysticksNull,
+        .terminateJoysticks = _glfwTerminateJoysticksNull,
+        .pollJoystick = _glfwPollJoystickNull,
+        .getMappingName = _glfwGetMappingNameNull,
+        .updateGamepadGUID = _glfwUpdateGamepadGUIDNull,
+#endif
+        .freeMonitor = _glfwFreeMonitorX11,
+        .getMonitorPos = _glfwGetMonitorPosX11,
+        .getMonitorContentScale = _glfwGetMonitorContentScaleX11,
+        .getMonitorWorkarea = _glfwGetMonitorWorkareaX11,
+        .getVideoModes = _glfwGetVideoModesX11,
+        .getVideoMode = _glfwGetVideoModeX11,
+        .getGammaRamp = _glfwGetGammaRampX11,
+        .setGammaRamp = _glfwSetGammaRampX11,
+        .createWindow = _glfwCreateWindowX11,
+        .destroyWindow = _glfwDestroyWindowX11,
+        .setWindowTitle = _glfwSetWindowTitleX11,
+        .setWindowIcon = _glfwSetWindowIconX11,
+        .getWindowPos = _glfwGetWindowPosX11,
+        .setWindowPos = _glfwSetWindowPosX11,
+        .getWindowSize = _glfwGetWindowSizeX11,
+        .setWindowSize = _glfwSetWindowSizeX11,
+        .setWindowSizeLimits = _glfwSetWindowSizeLimitsX11,
+        .setWindowAspectRatio = _glfwSetWindowAspectRatioX11,
+        .getFramebufferSize = _glfwGetFramebufferSizeX11,
+        .getWindowFrameSize = _glfwGetWindowFrameSizeX11,
+        .getWindowContentScale = _glfwGetWindowContentScaleX11,
+        .iconifyWindow = _glfwIconifyWindowX11,
+        .restoreWindow = _glfwRestoreWindowX11,
+        .maximizeWindow = _glfwMaximizeWindowX11,
+        .showWindow = _glfwShowWindowX11,
+        .hideWindow = _glfwHideWindowX11,
+        .requestWindowAttention = _glfwRequestWindowAttentionX11,
+        .focusWindow = _glfwFocusWindowX11,
+        .setWindowMonitor = _glfwSetWindowMonitorX11,
+        .windowFocused = _glfwWindowFocusedX11,
+        .windowIconified = _glfwWindowIconifiedX11,
+        .windowVisible = _glfwWindowVisibleX11,
+        .windowMaximized = _glfwWindowMaximizedX11,
+        .windowHovered = _glfwWindowHoveredX11,
+        .framebufferTransparent = _glfwFramebufferTransparentX11,
+        .getWindowOpacity = _glfwGetWindowOpacityX11,
+        .setWindowResizable = _glfwSetWindowResizableX11,
+        .setWindowDecorated = _glfwSetWindowDecoratedX11,
+        .setWindowFloating = _glfwSetWindowFloatingX11,
+        .setWindowOpacity = _glfwSetWindowOpacityX11,
+        .setWindowMousePassthrough = _glfwSetWindowMousePassthroughX11,
+        .pollEvents = _glfwPollEventsX11,
+        .waitEvents = _glfwWaitEventsX11,
+        .waitEventsTimeout = _glfwWaitEventsTimeoutX11,
+        .postEmptyEvent = _glfwPostEmptyEventX11,
+        .getEGLPlatform = _glfwGetEGLPlatformX11,
+        .getEGLNativeDisplay = _glfwGetEGLNativeDisplayX11,
+        .getEGLNativeWindow = _glfwGetEGLNativeWindowX11,
+        .getRequiredInstanceExtensions = _glfwGetRequiredInstanceExtensionsX11,
+        .getPhysicalDevicePresentationSupport = _glfwGetPhysicalDevicePresentationSupportX11,
+        .createWindowSurface = _glfwCreateWindowSurfaceX11
+    };
+
     // HACK: If the application has left the locale as "C" then both wide
     //       character text input and explicit UTF-8 input via XIM will break
     //       This sets the CTYPE part of the current locale from the environment
@@ -1099,27 +1255,272 @@
     if (strcmp(setlocale(LC_CTYPE, NULL), "C") == 0)
         setlocale(LC_CTYPE, "");
 
-    XInitThreads();
-    XrmInitialize();
-
-    _glfw.x11.display = XOpenDisplay(NULL);
-    if (!_glfw.x11.display)
+#if defined(__CYGWIN__)
+    void* module = _glfwPlatformLoadModule("libX11-6.so");
+#elif defined(__OpenBSD__) || defined(__NetBSD__)
+    void* module = _glfwPlatformLoadModule("libX11.so");
+#else
+    void* module = _glfwPlatformLoadModule("libX11.so.6");
+#endif
+    if (!module)
     {
-        const char* display = getenv("DISPLAY");
-        if (display)
-        {
-            _glfwInputError(GLFW_PLATFORM_ERROR,
-                            "X11: Failed to open display %s", display);
-        }
-        else
-        {
-            _glfwInputError(GLFW_PLATFORM_ERROR,
-                            "X11: The DISPLAY environment variable is missing");
-        }
+        if (platformID == GLFW_PLATFORM_X11)
+            _glfwInputError(GLFW_PLATFORM_ERROR, "X11: Failed to load Xlib");
 
         return GLFW_FALSE;
     }
 
+    PFN_XInitThreads XInitThreads = (PFN_XInitThreads)
+        _glfwPlatformGetModuleSymbol(module, "XInitThreads");
+    PFN_XrmInitialize XrmInitialize = (PFN_XrmInitialize)
+        _glfwPlatformGetModuleSymbol(module, "XrmInitialize");
+    PFN_XOpenDisplay XOpenDisplay = (PFN_XOpenDisplay)
+        _glfwPlatformGetModuleSymbol(module, "XOpenDisplay");
+    if (!XInitThreads || !XrmInitialize || !XOpenDisplay)
+    {
+        if (platformID == GLFW_PLATFORM_X11)
+            _glfwInputError(GLFW_PLATFORM_ERROR, "X11: Failed to load Xlib entry point");
+
+        _glfwPlatformFreeModule(module);
+        return GLFW_FALSE;
+    }
+
+    XInitThreads();
+    XrmInitialize();
+
+    Display* display = XOpenDisplay(NULL);
+    if (!display)
+    {
+        if (platformID == GLFW_PLATFORM_X11)
+        {
+            const char* name = getenv("DISPLAY");
+            if (name)
+            {
+                _glfwInputError(GLFW_PLATFORM_UNAVAILABLE,
+                                "X11: Failed to open display %s", name);
+            }
+            else
+            {
+                _glfwInputError(GLFW_PLATFORM_UNAVAILABLE,
+                                "X11: The DISPLAY environment variable is missing");
+            }
+        }
+
+        _glfwPlatformFreeModule(module);
+        return GLFW_FALSE;
+    }
+
+    _glfw.x11.display = display;
+    _glfw.x11.xlib.handle = module;
+
+    *platform = x11;
+    return GLFW_TRUE;
+}
+
+int _glfwInitX11(void)
+{
+    _glfw.x11.xlib.AllocClassHint = (PFN_XAllocClassHint)
+        _glfwPlatformGetModuleSymbol(_glfw.x11.xlib.handle, "XAllocClassHint");
+    _glfw.x11.xlib.AllocSizeHints = (PFN_XAllocSizeHints)
+        _glfwPlatformGetModuleSymbol(_glfw.x11.xlib.handle, "XAllocSizeHints");
+    _glfw.x11.xlib.AllocWMHints = (PFN_XAllocWMHints)
+        _glfwPlatformGetModuleSymbol(_glfw.x11.xlib.handle, "XAllocWMHints");
+    _glfw.x11.xlib.ChangeProperty = (PFN_XChangeProperty)
+        _glfwPlatformGetModuleSymbol(_glfw.x11.xlib.handle, "XChangeProperty");
+    _glfw.x11.xlib.ChangeWindowAttributes = (PFN_XChangeWindowAttributes)
+        _glfwPlatformGetModuleSymbol(_glfw.x11.xlib.handle, "XChangeWindowAttributes");
+    _glfw.x11.xlib.CheckIfEvent = (PFN_XCheckIfEvent)
+        _glfwPlatformGetModuleSymbol(_glfw.x11.xlib.handle, "XCheckIfEvent");
+    _glfw.x11.xlib.CheckTypedWindowEvent = (PFN_XCheckTypedWindowEvent)
+        _glfwPlatformGetModuleSymbol(_glfw.x11.xlib.handle, "XCheckTypedWindowEvent");
+    _glfw.x11.xlib.CloseDisplay = (PFN_XCloseDisplay)
+        _glfwPlatformGetModuleSymbol(_glfw.x11.xlib.handle, "XCloseDisplay");
+    _glfw.x11.xlib.CloseIM = (PFN_XCloseIM)
+        _glfwPlatformGetModuleSymbol(_glfw.x11.xlib.handle, "XCloseIM");
+    _glfw.x11.xlib.ConvertSelection = (PFN_XConvertSelection)
+        _glfwPlatformGetModuleSymbol(_glfw.x11.xlib.handle, "XConvertSelection");
+    _glfw.x11.xlib.CreateColormap = (PFN_XCreateColormap)
+        _glfwPlatformGetModuleSymbol(_glfw.x11.xlib.handle, "XCreateColormap");
+    _glfw.x11.xlib.CreateFontCursor = (PFN_XCreateFontCursor)
+        _glfwPlatformGetModuleSymbol(_glfw.x11.xlib.handle, "XCreateFontCursor");
+    _glfw.x11.xlib.CreateIC = (PFN_XCreateIC)
+        _glfwPlatformGetModuleSymbol(_glfw.x11.xlib.handle, "XCreateIC");
+    _glfw.x11.xlib.CreateRegion = (PFN_XCreateRegion)
+        _glfwPlatformGetModuleSymbol(_glfw.x11.xlib.handle, "XCreateRegion");
+    _glfw.x11.xlib.CreateWindow = (PFN_XCreateWindow)
+        _glfwPlatformGetModuleSymbol(_glfw.x11.xlib.handle, "XCreateWindow");
+    _glfw.x11.xlib.DefineCursor = (PFN_XDefineCursor)
+        _glfwPlatformGetModuleSymbol(_glfw.x11.xlib.handle, "XDefineCursor");
+    _glfw.x11.xlib.DeleteContext = (PFN_XDeleteContext)
+        _glfwPlatformGetModuleSymbol(_glfw.x11.xlib.handle, "XDeleteContext");
+    _glfw.x11.xlib.DeleteProperty = (PFN_XDeleteProperty)
+        _glfwPlatformGetModuleSymbol(_glfw.x11.xlib.handle, "XDeleteProperty");
+    _glfw.x11.xlib.DestroyIC = (PFN_XDestroyIC)
+        _glfwPlatformGetModuleSymbol(_glfw.x11.xlib.handle, "XDestroyIC");
+    _glfw.x11.xlib.DestroyRegion = (PFN_XDestroyRegion)
+        _glfwPlatformGetModuleSymbol(_glfw.x11.xlib.handle, "XDestroyRegion");
+    _glfw.x11.xlib.DestroyWindow = (PFN_XDestroyWindow)
+        _glfwPlatformGetModuleSymbol(_glfw.x11.xlib.handle, "XDestroyWindow");
+    _glfw.x11.xlib.DisplayKeycodes = (PFN_XDisplayKeycodes)
+        _glfwPlatformGetModuleSymbol(_glfw.x11.xlib.handle, "XDisplayKeycodes");
+    _glfw.x11.xlib.EventsQueued = (PFN_XEventsQueued)
+        _glfwPlatformGetModuleSymbol(_glfw.x11.xlib.handle, "XEventsQueued");
+    _glfw.x11.xlib.FilterEvent = (PFN_XFilterEvent)
+        _glfwPlatformGetModuleSymbol(_glfw.x11.xlib.handle, "XFilterEvent");
+    _glfw.x11.xlib.FindContext = (PFN_XFindContext)
+        _glfwPlatformGetModuleSymbol(_glfw.x11.xlib.handle, "XFindContext");
+    _glfw.x11.xlib.Flush = (PFN_XFlush)
+        _glfwPlatformGetModuleSymbol(_glfw.x11.xlib.handle, "XFlush");
+    _glfw.x11.xlib.Free = (PFN_XFree)
+        _glfwPlatformGetModuleSymbol(_glfw.x11.xlib.handle, "XFree");
+    _glfw.x11.xlib.FreeColormap = (PFN_XFreeColormap)
+        _glfwPlatformGetModuleSymbol(_glfw.x11.xlib.handle, "XFreeColormap");
+    _glfw.x11.xlib.FreeCursor = (PFN_XFreeCursor)
+        _glfwPlatformGetModuleSymbol(_glfw.x11.xlib.handle, "XFreeCursor");
+    _glfw.x11.xlib.FreeEventData = (PFN_XFreeEventData)
+        _glfwPlatformGetModuleSymbol(_glfw.x11.xlib.handle, "XFreeEventData");
+    _glfw.x11.xlib.GetErrorText = (PFN_XGetErrorText)
+        _glfwPlatformGetModuleSymbol(_glfw.x11.xlib.handle, "XGetErrorText");
+    _glfw.x11.xlib.GetEventData = (PFN_XGetEventData)
+        _glfwPlatformGetModuleSymbol(_glfw.x11.xlib.handle, "XGetEventData");
+    _glfw.x11.xlib.GetICValues = (PFN_XGetICValues)
+        _glfwPlatformGetModuleSymbol(_glfw.x11.xlib.handle, "XGetICValues");
+    _glfw.x11.xlib.GetIMValues = (PFN_XGetIMValues)
+        _glfwPlatformGetModuleSymbol(_glfw.x11.xlib.handle, "XGetIMValues");
+    _glfw.x11.xlib.GetInputFocus = (PFN_XGetInputFocus)
+        _glfwPlatformGetModuleSymbol(_glfw.x11.xlib.handle, "XGetInputFocus");
+    _glfw.x11.xlib.GetKeyboardMapping = (PFN_XGetKeyboardMapping)
+        _glfwPlatformGetModuleSymbol(_glfw.x11.xlib.handle, "XGetKeyboardMapping");
+    _glfw.x11.xlib.GetScreenSaver = (PFN_XGetScreenSaver)
+        _glfwPlatformGetModuleSymbol(_glfw.x11.xlib.handle, "XGetScreenSaver");
+    _glfw.x11.xlib.GetSelectionOwner = (PFN_XGetSelectionOwner)
+        _glfwPlatformGetModuleSymbol(_glfw.x11.xlib.handle, "XGetSelectionOwner");
+    _glfw.x11.xlib.GetVisualInfo = (PFN_XGetVisualInfo)
+        _glfwPlatformGetModuleSymbol(_glfw.x11.xlib.handle, "XGetVisualInfo");
+    _glfw.x11.xlib.GetWMNormalHints = (PFN_XGetWMNormalHints)
+        _glfwPlatformGetModuleSymbol(_glfw.x11.xlib.handle, "XGetWMNormalHints");
+    _glfw.x11.xlib.GetWindowAttributes = (PFN_XGetWindowAttributes)
+        _glfwPlatformGetModuleSymbol(_glfw.x11.xlib.handle, "XGetWindowAttributes");
+    _glfw.x11.xlib.GetWindowProperty = (PFN_XGetWindowProperty)
+        _glfwPlatformGetModuleSymbol(_glfw.x11.xlib.handle, "XGetWindowProperty");
+    _glfw.x11.xlib.GrabPointer = (PFN_XGrabPointer)
+        _glfwPlatformGetModuleSymbol(_glfw.x11.xlib.handle, "XGrabPointer");
+    _glfw.x11.xlib.IconifyWindow = (PFN_XIconifyWindow)
+        _glfwPlatformGetModuleSymbol(_glfw.x11.xlib.handle, "XIconifyWindow");
+    _glfw.x11.xlib.InternAtom = (PFN_XInternAtom)
+        _glfwPlatformGetModuleSymbol(_glfw.x11.xlib.handle, "XInternAtom");
+    _glfw.x11.xlib.LookupString = (PFN_XLookupString)
+        _glfwPlatformGetModuleSymbol(_glfw.x11.xlib.handle, "XLookupString");
+    _glfw.x11.xlib.MapRaised = (PFN_XMapRaised)
+        _glfwPlatformGetModuleSymbol(_glfw.x11.xlib.handle, "XMapRaised");
+    _glfw.x11.xlib.MapWindow = (PFN_XMapWindow)
+        _glfwPlatformGetModuleSymbol(_glfw.x11.xlib.handle, "XMapWindow");
+    _glfw.x11.xlib.MoveResizeWindow = (PFN_XMoveResizeWindow)
+        _glfwPlatformGetModuleSymbol(_glfw.x11.xlib.handle, "XMoveResizeWindow");
+    _glfw.x11.xlib.MoveWindow = (PFN_XMoveWindow)
+        _glfwPlatformGetModuleSymbol(_glfw.x11.xlib.handle, "XMoveWindow");
+    _glfw.x11.xlib.NextEvent = (PFN_XNextEvent)
+        _glfwPlatformGetModuleSymbol(_glfw.x11.xlib.handle, "XNextEvent");
+    _glfw.x11.xlib.OpenIM = (PFN_XOpenIM)
+        _glfwPlatformGetModuleSymbol(_glfw.x11.xlib.handle, "XOpenIM");
+    _glfw.x11.xlib.PeekEvent = (PFN_XPeekEvent)
+        _glfwPlatformGetModuleSymbol(_glfw.x11.xlib.handle, "XPeekEvent");
+    _glfw.x11.xlib.Pending = (PFN_XPending)
+        _glfwPlatformGetModuleSymbol(_glfw.x11.xlib.handle, "XPending");
+    _glfw.x11.xlib.QueryExtension = (PFN_XQueryExtension)
+        _glfwPlatformGetModuleSymbol(_glfw.x11.xlib.handle, "XQueryExtension");
+    _glfw.x11.xlib.QueryPointer = (PFN_XQueryPointer)
+        _glfwPlatformGetModuleSymbol(_glfw.x11.xlib.handle, "XQueryPointer");
+    _glfw.x11.xlib.RaiseWindow = (PFN_XRaiseWindow)
+        _glfwPlatformGetModuleSymbol(_glfw.x11.xlib.handle, "XRaiseWindow");
+    _glfw.x11.xlib.RegisterIMInstantiateCallback = (PFN_XRegisterIMInstantiateCallback)
+        _glfwPlatformGetModuleSymbol(_glfw.x11.xlib.handle, "XRegisterIMInstantiateCallback");
+    _glfw.x11.xlib.ResizeWindow = (PFN_XResizeWindow)
+        _glfwPlatformGetModuleSymbol(_glfw.x11.xlib.handle, "XResizeWindow");
+    _glfw.x11.xlib.ResourceManagerString = (PFN_XResourceManagerString)
+        _glfwPlatformGetModuleSymbol(_glfw.x11.xlib.handle, "XResourceManagerString");
+    _glfw.x11.xlib.SaveContext = (PFN_XSaveContext)
+        _glfwPlatformGetModuleSymbol(_glfw.x11.xlib.handle, "XSaveContext");
+    _glfw.x11.xlib.SelectInput = (PFN_XSelectInput)
+        _glfwPlatformGetModuleSymbol(_glfw.x11.xlib.handle, "XSelectInput");
+    _glfw.x11.xlib.SendEvent = (PFN_XSendEvent)
+        _glfwPlatformGetModuleSymbol(_glfw.x11.xlib.handle, "XSendEvent");
+    _glfw.x11.xlib.SetClassHint = (PFN_XSetClassHint)
+        _glfwPlatformGetModuleSymbol(_glfw.x11.xlib.handle, "XSetClassHint");
+    _glfw.x11.xlib.SetErrorHandler = (PFN_XSetErrorHandler)
+        _glfwPlatformGetModuleSymbol(_glfw.x11.xlib.handle, "XSetErrorHandler");
+    _glfw.x11.xlib.SetICFocus = (PFN_XSetICFocus)
+        _glfwPlatformGetModuleSymbol(_glfw.x11.xlib.handle, "XSetICFocus");
+    _glfw.x11.xlib.SetIMValues = (PFN_XSetIMValues)
+        _glfwPlatformGetModuleSymbol(_glfw.x11.xlib.handle, "XSetIMValues");
+    _glfw.x11.xlib.SetInputFocus = (PFN_XSetInputFocus)
+        _glfwPlatformGetModuleSymbol(_glfw.x11.xlib.handle, "XSetInputFocus");
+    _glfw.x11.xlib.SetLocaleModifiers = (PFN_XSetLocaleModifiers)
+        _glfwPlatformGetModuleSymbol(_glfw.x11.xlib.handle, "XSetLocaleModifiers");
+    _glfw.x11.xlib.SetScreenSaver = (PFN_XSetScreenSaver)
+        _glfwPlatformGetModuleSymbol(_glfw.x11.xlib.handle, "XSetScreenSaver");
+    _glfw.x11.xlib.SetSelectionOwner = (PFN_XSetSelectionOwner)
+        _glfwPlatformGetModuleSymbol(_glfw.x11.xlib.handle, "XSetSelectionOwner");
+    _glfw.x11.xlib.SetWMHints = (PFN_XSetWMHints)
+        _glfwPlatformGetModuleSymbol(_glfw.x11.xlib.handle, "XSetWMHints");
+    _glfw.x11.xlib.SetWMNormalHints = (PFN_XSetWMNormalHints)
+        _glfwPlatformGetModuleSymbol(_glfw.x11.xlib.handle, "XSetWMNormalHints");
+    _glfw.x11.xlib.SetWMProtocols = (PFN_XSetWMProtocols)
+        _glfwPlatformGetModuleSymbol(_glfw.x11.xlib.handle, "XSetWMProtocols");
+    _glfw.x11.xlib.SupportsLocale = (PFN_XSupportsLocale)
+        _glfwPlatformGetModuleSymbol(_glfw.x11.xlib.handle, "XSupportsLocale");
+    _glfw.x11.xlib.Sync = (PFN_XSync)
+        _glfwPlatformGetModuleSymbol(_glfw.x11.xlib.handle, "XSync");
+    _glfw.x11.xlib.TranslateCoordinates = (PFN_XTranslateCoordinates)
+        _glfwPlatformGetModuleSymbol(_glfw.x11.xlib.handle, "XTranslateCoordinates");
+    _glfw.x11.xlib.UndefineCursor = (PFN_XUndefineCursor)
+        _glfwPlatformGetModuleSymbol(_glfw.x11.xlib.handle, "XUndefineCursor");
+    _glfw.x11.xlib.UngrabPointer = (PFN_XUngrabPointer)
+        _glfwPlatformGetModuleSymbol(_glfw.x11.xlib.handle, "XUngrabPointer");
+    _glfw.x11.xlib.UnmapWindow = (PFN_XUnmapWindow)
+        _glfwPlatformGetModuleSymbol(_glfw.x11.xlib.handle, "XUnmapWindow");
+    _glfw.x11.xlib.UnsetICFocus = (PFN_XUnsetICFocus)
+        _glfwPlatformGetModuleSymbol(_glfw.x11.xlib.handle, "XUnsetICFocus");
+    _glfw.x11.xlib.VisualIDFromVisual = (PFN_XVisualIDFromVisual)
+        _glfwPlatformGetModuleSymbol(_glfw.x11.xlib.handle, "XVisualIDFromVisual");
+    _glfw.x11.xlib.WarpPointer = (PFN_XWarpPointer)
+        _glfwPlatformGetModuleSymbol(_glfw.x11.xlib.handle, "XWarpPointer");
+    _glfw.x11.xkb.FreeKeyboard = (PFN_XkbFreeKeyboard)
+        _glfwPlatformGetModuleSymbol(_glfw.x11.xlib.handle, "XkbFreeKeyboard");
+    _glfw.x11.xkb.FreeNames = (PFN_XkbFreeNames)
+        _glfwPlatformGetModuleSymbol(_glfw.x11.xlib.handle, "XkbFreeNames");
+    _glfw.x11.xkb.GetMap = (PFN_XkbGetMap)
+        _glfwPlatformGetModuleSymbol(_glfw.x11.xlib.handle, "XkbGetMap");
+    _glfw.x11.xkb.GetNames = (PFN_XkbGetNames)
+        _glfwPlatformGetModuleSymbol(_glfw.x11.xlib.handle, "XkbGetNames");
+    _glfw.x11.xkb.GetState = (PFN_XkbGetState)
+        _glfwPlatformGetModuleSymbol(_glfw.x11.xlib.handle, "XkbGetState");
+    _glfw.x11.xkb.KeycodeToKeysym = (PFN_XkbKeycodeToKeysym)
+        _glfwPlatformGetModuleSymbol(_glfw.x11.xlib.handle, "XkbKeycodeToKeysym");
+    _glfw.x11.xkb.QueryExtension = (PFN_XkbQueryExtension)
+        _glfwPlatformGetModuleSymbol(_glfw.x11.xlib.handle, "XkbQueryExtension");
+    _glfw.x11.xkb.SelectEventDetails = (PFN_XkbSelectEventDetails)
+        _glfwPlatformGetModuleSymbol(_glfw.x11.xlib.handle, "XkbSelectEventDetails");
+    _glfw.x11.xkb.SetDetectableAutoRepeat = (PFN_XkbSetDetectableAutoRepeat)
+        _glfwPlatformGetModuleSymbol(_glfw.x11.xlib.handle, "XkbSetDetectableAutoRepeat");
+    _glfw.x11.xrm.DestroyDatabase = (PFN_XrmDestroyDatabase)
+        _glfwPlatformGetModuleSymbol(_glfw.x11.xlib.handle, "XrmDestroyDatabase");
+    _glfw.x11.xrm.GetResource = (PFN_XrmGetResource)
+        _glfwPlatformGetModuleSymbol(_glfw.x11.xlib.handle, "XrmGetResource");
+    _glfw.x11.xrm.GetStringDatabase = (PFN_XrmGetStringDatabase)
+        _glfwPlatformGetModuleSymbol(_glfw.x11.xlib.handle, "XrmGetStringDatabase");
+    _glfw.x11.xrm.UniqueQuark = (PFN_XrmUniqueQuark)
+        _glfwPlatformGetModuleSymbol(_glfw.x11.xlib.handle, "XrmUniqueQuark");
+    _glfw.x11.xlib.UnregisterIMInstantiateCallback = (PFN_XUnregisterIMInstantiateCallback)
+        _glfwPlatformGetModuleSymbol(_glfw.x11.xlib.handle, "XUnregisterIMInstantiateCallback");
+    _glfw.x11.xlib.utf8LookupString = (PFN_Xutf8LookupString)
+        _glfwPlatformGetModuleSymbol(_glfw.x11.xlib.handle, "Xutf8LookupString");
+    _glfw.x11.xlib.utf8SetWMProperties = (PFN_Xutf8SetWMProperties)
+        _glfwPlatformGetModuleSymbol(_glfw.x11.xlib.handle, "Xutf8SetWMProperties");
+
+    if (_glfw.x11.xlib.utf8LookupString && _glfw.x11.xlib.utf8SetWMProperties)
+        _glfw.x11.xlib.utf8 = GLFW_TRUE;
+
     _glfw.x11.screen = DefaultScreen(_glfw.x11.display);
     _glfw.x11.root = RootWindow(_glfw.x11.display, _glfw.x11.screen);
     _glfw.x11.context = XUniqueContext();
@@ -1135,33 +1536,22 @@
     _glfw.x11.helperWindowHandle = createHelperWindow();
     _glfw.x11.hiddenCursorHandle = createHiddenCursor();
 
-    if (XSupportsLocale())
+    if (XSupportsLocale() && _glfw.x11.xlib.utf8)
     {
         XSetLocaleModifiers("");
 
-        _glfw.x11.im = XOpenIM(_glfw.x11.display, 0, NULL, NULL);
-        if (_glfw.x11.im)
-        {
-            if (!hasUsableInputMethodStyle())
-            {
-                XCloseIM(_glfw.x11.im);
-                _glfw.x11.im = NULL;
-            }
-        }
+        // If an IM is already present our callback will be called right away
+        XRegisterIMInstantiateCallback(_glfw.x11.display,
+                                       NULL, NULL, NULL,
+                                       inputMethodInstantiateCallback,
+                                       NULL);
     }
 
-#if defined(__linux__)
-    if (!_glfwInitJoysticksLinux())
-        return GLFW_FALSE;
-#endif
-
-    _glfwInitTimerPOSIX();
-
     _glfwPollMonitorsX11();
     return GLFW_TRUE;
 }
 
-void _glfwPlatformTerminate(void)
+void _glfwTerminateX11(void)
 {
     if (_glfw.x11.helperWindowHandle)
     {
@@ -1181,8 +1571,13 @@
         _glfw.x11.hiddenCursorHandle = (Cursor) 0;
     }
 
-    free(_glfw.x11.primarySelectionString);
-    free(_glfw.x11.clipboardString);
+    _glfw_free(_glfw.x11.primarySelectionString);
+    _glfw_free(_glfw.x11.clipboardString);
+
+    XUnregisterIMInstantiateCallback(_glfw.x11.display,
+                                     NULL, NULL, NULL,
+                                     inputMethodInstantiateCallback,
+                                     NULL);
 
     if (_glfw.x11.im)
     {
@@ -1198,43 +1593,43 @@
 
     if (_glfw.x11.x11xcb.handle)
     {
-        _glfw_dlclose(_glfw.x11.x11xcb.handle);
+        _glfwPlatformFreeModule(_glfw.x11.x11xcb.handle);
         _glfw.x11.x11xcb.handle = NULL;
     }
 
     if (_glfw.x11.xcursor.handle)
     {
-        _glfw_dlclose(_glfw.x11.xcursor.handle);
+        _glfwPlatformFreeModule(_glfw.x11.xcursor.handle);
         _glfw.x11.xcursor.handle = NULL;
     }
 
     if (_glfw.x11.randr.handle)
     {
-        _glfw_dlclose(_glfw.x11.randr.handle);
+        _glfwPlatformFreeModule(_glfw.x11.randr.handle);
         _glfw.x11.randr.handle = NULL;
     }
 
     if (_glfw.x11.xinerama.handle)
     {
-        _glfw_dlclose(_glfw.x11.xinerama.handle);
+        _glfwPlatformFreeModule(_glfw.x11.xinerama.handle);
         _glfw.x11.xinerama.handle = NULL;
     }
 
     if (_glfw.x11.xrender.handle)
     {
-        _glfw_dlclose(_glfw.x11.xrender.handle);
+        _glfwPlatformFreeModule(_glfw.x11.xrender.handle);
         _glfw.x11.xrender.handle = NULL;
     }
 
     if (_glfw.x11.vidmode.handle)
     {
-        _glfw_dlclose(_glfw.x11.vidmode.handle);
+        _glfwPlatformFreeModule(_glfw.x11.vidmode.handle);
         _glfw.x11.vidmode.handle = NULL;
     }
 
     if (_glfw.x11.xi.handle)
     {
-        _glfw_dlclose(_glfw.x11.xi.handle);
+        _glfwPlatformFreeModule(_glfw.x11.xi.handle);
         _glfw.x11.xi.handle = NULL;
     }
 
@@ -1244,9 +1639,11 @@
     _glfwTerminateEGL();
     _glfwTerminateGLX();
 
-#if defined(__linux__)
-    _glfwTerminateJoysticksLinux();
-#endif
+    if (_glfw.x11.xlib.handle)
+    {
+        _glfwPlatformFreeModule(_glfw.x11.xlib.handle);
+        _glfw.x11.xlib.handle = NULL;
+    }
 
     if (_glfw.x11.emptyEventPipe[0] || _glfw.x11.emptyEventPipe[1])
     {
@@ -1255,20 +1652,5 @@
     }
 }
 
-const char* _glfwPlatformGetVersionString(void)
-{
-    return _GLFW_VERSION_NUMBER " X11 GLX EGL OSMesa"
-#if defined(_POSIX_TIMERS) && defined(_POSIX_MONOTONIC_CLOCK)
-        " clock_gettime"
-#else
-        " gettimeofday"
-#endif
-#if defined(__linux__)
-        " evdev"
-#endif
-#if defined(_GLFW_BUILD_DLL)
-        " shared"
-#endif
-        ;
-}
+#endif // _GLFW_X11
 
diff --git a/src/x11_monitor.c b/src/x11_monitor.c
index fb3a67b..38af7e0 100644
--- a/src/x11_monitor.c
+++ b/src/x11_monitor.c
@@ -1,5 +1,5 @@
 //========================================================================
-// GLFW 3.3 X11 - www.glfw.org
+// GLFW 3.4 X11 - www.glfw.org
 //------------------------------------------------------------------------
 // Copyright (c) 2002-2006 Marcus Geelnard
 // Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.org>
@@ -24,11 +24,11 @@
 //    distribution.
 //
 //========================================================================
-// It is fine to use C99 in this file because it will not be built with VS
-//========================================================================
 
 #include "internal.h"
 
+#if defined(_GLFW_X11)
+
 #include <limits.h>
 #include <stdlib.h>
 #include <string.h>
@@ -116,7 +116,7 @@
         disconnectedCount = _glfw.monitorCount;
         if (disconnectedCount)
         {
-            disconnected = calloc(_glfw.monitorCount, sizeof(_GLFWmonitor*));
+            disconnected = _glfw_calloc(_glfw.monitorCount, sizeof(_GLFWmonitor*));
             memcpy(disconnected,
                    _glfw.monitors,
                    _glfw.monitorCount * sizeof(_GLFWmonitor*));
@@ -209,7 +209,7 @@
                 _glfwInputMonitor(disconnected[i], GLFW_DISCONNECTED, 0);
         }
 
-        free(disconnected);
+        _glfw_free(disconnected);
     }
     else
     {
@@ -232,7 +232,7 @@
         RRMode native = None;
 
         const GLFWvidmode* best = _glfwChooseVideoMode(monitor, desired);
-        _glfwPlatformGetVideoMode(monitor, &current);
+        _glfwGetVideoModeX11(monitor, &current);
         if (_glfwCompareVideoModes(&current, best) == 0)
             return;
 
@@ -310,11 +310,11 @@
 //////                       GLFW platform API                      //////
 //////////////////////////////////////////////////////////////////////////
 
-void _glfwPlatformFreeMonitor(_GLFWmonitor* monitor)
+void _glfwFreeMonitorX11(_GLFWmonitor* monitor)
 {
 }
 
-void _glfwPlatformGetMonitorPos(_GLFWmonitor* monitor, int* xpos, int* ypos)
+void _glfwGetMonitorPosX11(_GLFWmonitor* monitor, int* xpos, int* ypos)
 {
     if (_glfw.x11.randr.available && !_glfw.x11.randr.monitorBroken)
     {
@@ -336,8 +336,8 @@
     }
 }
 
-void _glfwPlatformGetMonitorContentScale(_GLFWmonitor* monitor,
-                                         float* xscale, float* yscale)
+void _glfwGetMonitorContentScaleX11(_GLFWmonitor* monitor,
+                                    float* xscale, float* yscale)
 {
     if (xscale)
         *xscale = _glfw.x11.contentScaleX;
@@ -345,7 +345,9 @@
         *yscale = _glfw.x11.contentScaleY;
 }
 
-void _glfwPlatformGetMonitorWorkarea(_GLFWmonitor* monitor, int* xpos, int* ypos, int* width, int* height)
+void _glfwGetMonitorWorkareaX11(_GLFWmonitor* monitor,
+                                int* xpos, int* ypos,
+                                int* width, int* height)
 {
     int areaX = 0, areaY = 0, areaWidth = 0, areaHeight = 0;
 
@@ -437,7 +439,7 @@
         *height = areaHeight;
 }
 
-GLFWvidmode* _glfwPlatformGetVideoModes(_GLFWmonitor* monitor, int* count)
+GLFWvidmode* _glfwGetVideoModesX11(_GLFWmonitor* monitor, int* count)
 {
     GLFWvidmode* result;
 
@@ -450,7 +452,7 @@
         XRRCrtcInfo* ci = XRRGetCrtcInfo(_glfw.x11.display, sr, monitor->x11.crtc);
         XRROutputInfo* oi = XRRGetOutputInfo(_glfw.x11.display, sr, monitor->x11.output);
 
-        result = calloc(oi->nmode, sizeof(GLFWvidmode));
+        result = _glfw_calloc(oi->nmode, sizeof(GLFWvidmode));
 
         for (int i = 0;  i < oi->nmode;  i++)
         {
@@ -482,31 +484,38 @@
     else
     {
         *count = 1;
-        result = calloc(1, sizeof(GLFWvidmode));
-        _glfwPlatformGetVideoMode(monitor, result);
+        result = _glfw_calloc(1, sizeof(GLFWvidmode));
+        _glfwGetVideoModeX11(monitor, result);
     }
 
     return result;
 }
 
-void _glfwPlatformGetVideoMode(_GLFWmonitor* monitor, GLFWvidmode* mode)
+GLFWbool _glfwGetVideoModeX11(_GLFWmonitor* monitor, GLFWvidmode* mode)
 {
     if (_glfw.x11.randr.available && !_glfw.x11.randr.monitorBroken)
     {
         XRRScreenResources* sr =
             XRRGetScreenResourcesCurrent(_glfw.x11.display, _glfw.x11.root);
-        XRRCrtcInfo* ci = XRRGetCrtcInfo(_glfw.x11.display, sr, monitor->x11.crtc);
+        const XRRModeInfo* mi = NULL;
 
+        XRRCrtcInfo* ci = XRRGetCrtcInfo(_glfw.x11.display, sr, monitor->x11.crtc);
         if (ci)
         {
-            const XRRModeInfo* mi = getModeInfo(sr, ci->mode);
-            if (mi)  // mi can be NULL if the monitor has been disconnected
+            mi = getModeInfo(sr, ci->mode);
+            if (mi)
                 *mode = vidmodeFromModeInfo(mi, ci);
 
             XRRFreeCrtcInfo(ci);
         }
 
         XRRFreeScreenResources(sr);
+
+        if (!mi)
+        {
+            _glfwInputError(GLFW_PLATFORM_ERROR, "X11: Failed to query video mode");
+            return GLFW_FALSE;
+        }
     }
     else
     {
@@ -517,9 +526,11 @@
         _glfwSplitBPP(DefaultDepth(_glfw.x11.display, _glfw.x11.screen),
                       &mode->redBits, &mode->greenBits, &mode->blueBits);
     }
+
+    return GLFW_TRUE;
 }
 
-GLFWbool _glfwPlatformGetGammaRamp(_GLFWmonitor* monitor, GLFWgammaramp* ramp)
+GLFWbool _glfwGetGammaRampX11(_GLFWmonitor* monitor, GLFWgammaramp* ramp)
 {
     if (_glfw.x11.randr.available && !_glfw.x11.randr.gammaBroken)
     {
@@ -557,7 +568,7 @@
     }
 }
 
-void _glfwPlatformSetGammaRamp(_GLFWmonitor* monitor, const GLFWgammaramp* ramp)
+void _glfwSetGammaRampX11(_GLFWmonitor* monitor, const GLFWgammaramp* ramp)
 {
     if (_glfw.x11.randr.available && !_glfw.x11.randr.gammaBroken)
     {
@@ -602,6 +613,13 @@
 {
     _GLFWmonitor* monitor = (_GLFWmonitor*) handle;
     _GLFW_REQUIRE_INIT_OR_RETURN(None);
+
+    if (_glfw.platform.platformID != GLFW_PLATFORM_X11)
+    {
+        _glfwInputError(GLFW_PLATFORM_UNAVAILABLE, "X11: Platform not initialized");
+        return None;
+    }
+
     return monitor->x11.crtc;
 }
 
@@ -609,6 +627,15 @@
 {
     _GLFWmonitor* monitor = (_GLFWmonitor*) handle;
     _GLFW_REQUIRE_INIT_OR_RETURN(None);
+
+    if (_glfw.platform.platformID != GLFW_PLATFORM_X11)
+    {
+        _glfwInputError(GLFW_PLATFORM_UNAVAILABLE, "X11: Platform not initialized");
+        return None;
+    }
+
     return monitor->x11.output;
 }
 
+#endif // _GLFW_X11
+
diff --git a/src/x11_platform.h b/src/x11_platform.h
index 03ff9d2..14e363d 100644
--- a/src/x11_platform.h
+++ b/src/x11_platform.h
@@ -1,5 +1,5 @@
 //========================================================================
-// GLFW 3.3 X11 - www.glfw.org
+// GLFW 3.4 X11 - www.glfw.org
 //------------------------------------------------------------------------
 // Copyright (c) 2002-2006 Marcus Geelnard
 // Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.org>
@@ -28,11 +28,11 @@
 #include <unistd.h>
 #include <signal.h>
 #include <stdint.h>
-#include <dlfcn.h>
 
 #include <X11/Xlib.h>
 #include <X11/keysym.h>
 #include <X11/Xatom.h>
+#include <X11/Xresource.h>
 #include <X11/Xcursor/Xcursor.h>
 
 // The XRandR extension provides mode setting and gamma control
@@ -47,6 +47,258 @@
 // The XInput extension provides raw mouse motion input
 #include <X11/extensions/XInput2.h>
 
+// The Shape extension provides custom window shapes
+#include <X11/extensions/shape.h>
+
+#define GLX_VENDOR 1
+#define GLX_RGBA_BIT 0x00000001
+#define GLX_WINDOW_BIT 0x00000001
+#define GLX_DRAWABLE_TYPE 0x8010
+#define GLX_RENDER_TYPE 0x8011
+#define GLX_RGBA_TYPE 0x8014
+#define GLX_DOUBLEBUFFER 5
+#define GLX_STEREO 6
+#define GLX_AUX_BUFFERS 7
+#define GLX_RED_SIZE 8
+#define GLX_GREEN_SIZE 9
+#define GLX_BLUE_SIZE 10
+#define GLX_ALPHA_SIZE 11
+#define GLX_DEPTH_SIZE 12
+#define GLX_STENCIL_SIZE 13
+#define GLX_ACCUM_RED_SIZE 14
+#define GLX_ACCUM_GREEN_SIZE 15
+#define GLX_ACCUM_BLUE_SIZE 16
+#define GLX_ACCUM_ALPHA_SIZE 17
+#define GLX_SAMPLES 0x186a1
+#define GLX_VISUAL_ID 0x800b
+
+#define GLX_FRAMEBUFFER_SRGB_CAPABLE_ARB 0x20b2
+#define GLX_CONTEXT_DEBUG_BIT_ARB 0x00000001
+#define GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB 0x00000002
+#define GLX_CONTEXT_CORE_PROFILE_BIT_ARB 0x00000001
+#define GLX_CONTEXT_PROFILE_MASK_ARB 0x9126
+#define GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x00000002
+#define GLX_CONTEXT_MAJOR_VERSION_ARB 0x2091
+#define GLX_CONTEXT_MINOR_VERSION_ARB 0x2092
+#define GLX_CONTEXT_FLAGS_ARB 0x2094
+#define GLX_CONTEXT_ES2_PROFILE_BIT_EXT 0x00000004
+#define GLX_CONTEXT_ROBUST_ACCESS_BIT_ARB 0x00000004
+#define GLX_LOSE_CONTEXT_ON_RESET_ARB 0x8252
+#define GLX_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB 0x8256
+#define GLX_NO_RESET_NOTIFICATION_ARB 0x8261
+#define GLX_CONTEXT_RELEASE_BEHAVIOR_ARB 0x2097
+#define GLX_CONTEXT_RELEASE_BEHAVIOR_NONE_ARB 0
+#define GLX_CONTEXT_RELEASE_BEHAVIOR_FLUSH_ARB 0x2098
+#define GLX_CONTEXT_OPENGL_NO_ERROR_ARB 0x31b3
+
+typedef XID GLXWindow;
+typedef XID GLXDrawable;
+typedef struct __GLXFBConfig* GLXFBConfig;
+typedef struct __GLXcontext* GLXContext;
+typedef void (*__GLXextproc)(void);
+
+typedef XClassHint* (* PFN_XAllocClassHint)(void);
+typedef XSizeHints* (* PFN_XAllocSizeHints)(void);
+typedef XWMHints* (* PFN_XAllocWMHints)(void);
+typedef int (* PFN_XChangeProperty)(Display*,Window,Atom,Atom,int,int,const unsigned char*,int);
+typedef int (* PFN_XChangeWindowAttributes)(Display*,Window,unsigned long,XSetWindowAttributes*);
+typedef Bool (* PFN_XCheckIfEvent)(Display*,XEvent*,Bool(*)(Display*,XEvent*,XPointer),XPointer);
+typedef Bool (* PFN_XCheckTypedWindowEvent)(Display*,Window,int,XEvent*);
+typedef int (* PFN_XCloseDisplay)(Display*);
+typedef Status (* PFN_XCloseIM)(XIM);
+typedef int (* PFN_XConvertSelection)(Display*,Atom,Atom,Atom,Window,Time);
+typedef Colormap (* PFN_XCreateColormap)(Display*,Window,Visual*,int);
+typedef Cursor (* PFN_XCreateFontCursor)(Display*,unsigned int);
+typedef XIC (* PFN_XCreateIC)(XIM,...);
+typedef Region (* PFN_XCreateRegion)(void);
+typedef Window (* PFN_XCreateWindow)(Display*,Window,int,int,unsigned int,unsigned int,unsigned int,int,unsigned int,Visual*,unsigned long,XSetWindowAttributes*);
+typedef int (* PFN_XDefineCursor)(Display*,Window,Cursor);
+typedef int (* PFN_XDeleteContext)(Display*,XID,XContext);
+typedef int (* PFN_XDeleteProperty)(Display*,Window,Atom);
+typedef void (* PFN_XDestroyIC)(XIC);
+typedef int (* PFN_XDestroyRegion)(Region);
+typedef int (* PFN_XDestroyWindow)(Display*,Window);
+typedef int (* PFN_XDisplayKeycodes)(Display*,int*,int*);
+typedef int (* PFN_XEventsQueued)(Display*,int);
+typedef Bool (* PFN_XFilterEvent)(XEvent*,Window);
+typedef int (* PFN_XFindContext)(Display*,XID,XContext,XPointer*);
+typedef int (* PFN_XFlush)(Display*);
+typedef int (* PFN_XFree)(void*);
+typedef int (* PFN_XFreeColormap)(Display*,Colormap);
+typedef int (* PFN_XFreeCursor)(Display*,Cursor);
+typedef void (* PFN_XFreeEventData)(Display*,XGenericEventCookie*);
+typedef int (* PFN_XGetErrorText)(Display*,int,char*,int);
+typedef Bool (* PFN_XGetEventData)(Display*,XGenericEventCookie*);
+typedef char* (* PFN_XGetICValues)(XIC,...);
+typedef char* (* PFN_XGetIMValues)(XIM,...);
+typedef int (* PFN_XGetInputFocus)(Display*,Window*,int*);
+typedef KeySym* (* PFN_XGetKeyboardMapping)(Display*,KeyCode,int,int*);
+typedef int (* PFN_XGetScreenSaver)(Display*,int*,int*,int*,int*);
+typedef Window (* PFN_XGetSelectionOwner)(Display*,Atom);
+typedef XVisualInfo* (* PFN_XGetVisualInfo)(Display*,long,XVisualInfo*,int*);
+typedef Status (* PFN_XGetWMNormalHints)(Display*,Window,XSizeHints*,long*);
+typedef Status (* PFN_XGetWindowAttributes)(Display*,Window,XWindowAttributes*);
+typedef int (* PFN_XGetWindowProperty)(Display*,Window,Atom,long,long,Bool,Atom,Atom*,int*,unsigned long*,unsigned long*,unsigned char**);
+typedef int (* PFN_XGrabPointer)(Display*,Window,Bool,unsigned int,int,int,Window,Cursor,Time);
+typedef Status (* PFN_XIconifyWindow)(Display*,Window,int);
+typedef Status (* PFN_XInitThreads)(void);
+typedef Atom (* PFN_XInternAtom)(Display*,const char*,Bool);
+typedef int (* PFN_XLookupString)(XKeyEvent*,char*,int,KeySym*,XComposeStatus*);
+typedef int (* PFN_XMapRaised)(Display*,Window);
+typedef int (* PFN_XMapWindow)(Display*,Window);
+typedef int (* PFN_XMoveResizeWindow)(Display*,Window,int,int,unsigned int,unsigned int);
+typedef int (* PFN_XMoveWindow)(Display*,Window,int,int);
+typedef int (* PFN_XNextEvent)(Display*,XEvent*);
+typedef Display* (* PFN_XOpenDisplay)(const char*);
+typedef XIM (* PFN_XOpenIM)(Display*,XrmDatabase*,char*,char*);
+typedef int (* PFN_XPeekEvent)(Display*,XEvent*);
+typedef int (* PFN_XPending)(Display*);
+typedef Bool (* PFN_XQueryExtension)(Display*,const char*,int*,int*,int*);
+typedef Bool (* PFN_XQueryPointer)(Display*,Window,Window*,Window*,int*,int*,int*,int*,unsigned int*);
+typedef int (* PFN_XRaiseWindow)(Display*,Window);
+typedef Bool (* PFN_XRegisterIMInstantiateCallback)(Display*,void*,char*,char*,XIDProc,XPointer);
+typedef int (* PFN_XResizeWindow)(Display*,Window,unsigned int,unsigned int);
+typedef char* (* PFN_XResourceManagerString)(Display*);
+typedef int (* PFN_XSaveContext)(Display*,XID,XContext,const char*);
+typedef int (* PFN_XSelectInput)(Display*,Window,long);
+typedef Status (* PFN_XSendEvent)(Display*,Window,Bool,long,XEvent*);
+typedef int (* PFN_XSetClassHint)(Display*,Window,XClassHint*);
+typedef XErrorHandler (* PFN_XSetErrorHandler)(XErrorHandler);
+typedef void (* PFN_XSetICFocus)(XIC);
+typedef char* (* PFN_XSetIMValues)(XIM,...);
+typedef int (* PFN_XSetInputFocus)(Display*,Window,int,Time);
+typedef char* (* PFN_XSetLocaleModifiers)(const char*);
+typedef int (* PFN_XSetScreenSaver)(Display*,int,int,int,int);
+typedef int (* PFN_XSetSelectionOwner)(Display*,Atom,Window,Time);
+typedef int (* PFN_XSetWMHints)(Display*,Window,XWMHints*);
+typedef void (* PFN_XSetWMNormalHints)(Display*,Window,XSizeHints*);
+typedef Status (* PFN_XSetWMProtocols)(Display*,Window,Atom*,int);
+typedef Bool (* PFN_XSupportsLocale)(void);
+typedef int (* PFN_XSync)(Display*,Bool);
+typedef Bool (* PFN_XTranslateCoordinates)(Display*,Window,Window,int,int,int*,int*,Window*);
+typedef int (* PFN_XUndefineCursor)(Display*,Window);
+typedef int (* PFN_XUngrabPointer)(Display*,Time);
+typedef int (* PFN_XUnmapWindow)(Display*,Window);
+typedef void (* PFN_XUnsetICFocus)(XIC);
+typedef VisualID (* PFN_XVisualIDFromVisual)(Visual*);
+typedef int (* PFN_XWarpPointer)(Display*,Window,Window,int,int,unsigned int,unsigned int,int,int);
+typedef void (* PFN_XkbFreeKeyboard)(XkbDescPtr,unsigned int,Bool);
+typedef void (* PFN_XkbFreeNames)(XkbDescPtr,unsigned int,Bool);
+typedef XkbDescPtr (* PFN_XkbGetMap)(Display*,unsigned int,unsigned int);
+typedef Status (* PFN_XkbGetNames)(Display*,unsigned int,XkbDescPtr);
+typedef Status (* PFN_XkbGetState)(Display*,unsigned int,XkbStatePtr);
+typedef KeySym (* PFN_XkbKeycodeToKeysym)(Display*,KeyCode,int,int);
+typedef Bool (* PFN_XkbQueryExtension)(Display*,int*,int*,int*,int*,int*);
+typedef Bool (* PFN_XkbSelectEventDetails)(Display*,unsigned int,unsigned int,unsigned long,unsigned long);
+typedef Bool (* PFN_XkbSetDetectableAutoRepeat)(Display*,Bool,Bool*);
+typedef void (* PFN_XrmDestroyDatabase)(XrmDatabase);
+typedef Bool (* PFN_XrmGetResource)(XrmDatabase,const char*,const char*,char**,XrmValue*);
+typedef XrmDatabase (* PFN_XrmGetStringDatabase)(const char*);
+typedef void (* PFN_XrmInitialize)(void);
+typedef XrmQuark (* PFN_XrmUniqueQuark)(void);
+typedef Bool (* PFN_XUnregisterIMInstantiateCallback)(Display*,void*,char*,char*,XIDProc,XPointer);
+typedef int (* PFN_Xutf8LookupString)(XIC,XKeyPressedEvent*,char*,int,KeySym*,Status*);
+typedef void (* PFN_Xutf8SetWMProperties)(Display*,Window,const char*,const char*,char**,int,XSizeHints*,XWMHints*,XClassHint*);
+#define XAllocClassHint _glfw.x11.xlib.AllocClassHint
+#define XAllocSizeHints _glfw.x11.xlib.AllocSizeHints
+#define XAllocWMHints _glfw.x11.xlib.AllocWMHints
+#define XChangeProperty _glfw.x11.xlib.ChangeProperty
+#define XChangeWindowAttributes _glfw.x11.xlib.ChangeWindowAttributes
+#define XCheckIfEvent _glfw.x11.xlib.CheckIfEvent
+#define XCheckTypedWindowEvent _glfw.x11.xlib.CheckTypedWindowEvent
+#define XCloseDisplay _glfw.x11.xlib.CloseDisplay
+#define XCloseIM _glfw.x11.xlib.CloseIM
+#define XConvertSelection _glfw.x11.xlib.ConvertSelection
+#define XCreateColormap _glfw.x11.xlib.CreateColormap
+#define XCreateFontCursor _glfw.x11.xlib.CreateFontCursor
+#define XCreateIC _glfw.x11.xlib.CreateIC
+#define XCreateRegion _glfw.x11.xlib.CreateRegion
+#define XCreateWindow _glfw.x11.xlib.CreateWindow
+#define XDefineCursor _glfw.x11.xlib.DefineCursor
+#define XDeleteContext _glfw.x11.xlib.DeleteContext
+#define XDeleteProperty _glfw.x11.xlib.DeleteProperty
+#define XDestroyIC _glfw.x11.xlib.DestroyIC
+#define XDestroyRegion _glfw.x11.xlib.DestroyRegion
+#define XDestroyWindow _glfw.x11.xlib.DestroyWindow
+#define XDisplayKeycodes _glfw.x11.xlib.DisplayKeycodes
+#define XEventsQueued _glfw.x11.xlib.EventsQueued
+#define XFilterEvent _glfw.x11.xlib.FilterEvent
+#define XFindContext _glfw.x11.xlib.FindContext
+#define XFlush _glfw.x11.xlib.Flush
+#define XFree _glfw.x11.xlib.Free
+#define XFreeColormap _glfw.x11.xlib.FreeColormap
+#define XFreeCursor _glfw.x11.xlib.FreeCursor
+#define XFreeEventData _glfw.x11.xlib.FreeEventData
+#define XGetErrorText _glfw.x11.xlib.GetErrorText
+#define XGetEventData _glfw.x11.xlib.GetEventData
+#define XGetICValues _glfw.x11.xlib.GetICValues
+#define XGetIMValues _glfw.x11.xlib.GetIMValues
+#define XGetInputFocus _glfw.x11.xlib.GetInputFocus
+#define XGetKeyboardMapping _glfw.x11.xlib.GetKeyboardMapping
+#define XGetScreenSaver _glfw.x11.xlib.GetScreenSaver
+#define XGetSelectionOwner _glfw.x11.xlib.GetSelectionOwner
+#define XGetVisualInfo _glfw.x11.xlib.GetVisualInfo
+#define XGetWMNormalHints _glfw.x11.xlib.GetWMNormalHints
+#define XGetWindowAttributes _glfw.x11.xlib.GetWindowAttributes
+#define XGetWindowProperty _glfw.x11.xlib.GetWindowProperty
+#define XGrabPointer _glfw.x11.xlib.GrabPointer
+#define XIconifyWindow _glfw.x11.xlib.IconifyWindow
+#define XInternAtom _glfw.x11.xlib.InternAtom
+#define XLookupString _glfw.x11.xlib.LookupString
+#define XMapRaised _glfw.x11.xlib.MapRaised
+#define XMapWindow _glfw.x11.xlib.MapWindow
+#define XMoveResizeWindow _glfw.x11.xlib.MoveResizeWindow
+#define XMoveWindow _glfw.x11.xlib.MoveWindow
+#define XNextEvent _glfw.x11.xlib.NextEvent
+#define XOpenIM _glfw.x11.xlib.OpenIM
+#define XPeekEvent _glfw.x11.xlib.PeekEvent
+#define XPending _glfw.x11.xlib.Pending
+#define XQueryExtension _glfw.x11.xlib.QueryExtension
+#define XQueryPointer _glfw.x11.xlib.QueryPointer
+#define XRaiseWindow _glfw.x11.xlib.RaiseWindow
+#define XRegisterIMInstantiateCallback _glfw.x11.xlib.RegisterIMInstantiateCallback
+#define XResizeWindow _glfw.x11.xlib.ResizeWindow
+#define XResourceManagerString _glfw.x11.xlib.ResourceManagerString
+#define XSaveContext _glfw.x11.xlib.SaveContext
+#define XSelectInput _glfw.x11.xlib.SelectInput
+#define XSendEvent _glfw.x11.xlib.SendEvent
+#define XSetClassHint _glfw.x11.xlib.SetClassHint
+#define XSetErrorHandler _glfw.x11.xlib.SetErrorHandler
+#define XSetICFocus _glfw.x11.xlib.SetICFocus
+#define XSetIMValues _glfw.x11.xlib.SetIMValues
+#define XSetInputFocus _glfw.x11.xlib.SetInputFocus
+#define XSetLocaleModifiers _glfw.x11.xlib.SetLocaleModifiers
+#define XSetScreenSaver _glfw.x11.xlib.SetScreenSaver
+#define XSetSelectionOwner _glfw.x11.xlib.SetSelectionOwner
+#define XSetWMHints _glfw.x11.xlib.SetWMHints
+#define XSetWMNormalHints _glfw.x11.xlib.SetWMNormalHints
+#define XSetWMProtocols _glfw.x11.xlib.SetWMProtocols
+#define XSupportsLocale _glfw.x11.xlib.SupportsLocale
+#define XSync _glfw.x11.xlib.Sync
+#define XTranslateCoordinates _glfw.x11.xlib.TranslateCoordinates
+#define XUndefineCursor _glfw.x11.xlib.UndefineCursor
+#define XUngrabPointer _glfw.x11.xlib.UngrabPointer
+#define XUnmapWindow _glfw.x11.xlib.UnmapWindow
+#define XUnsetICFocus _glfw.x11.xlib.UnsetICFocus
+#define XVisualIDFromVisual _glfw.x11.xlib.VisualIDFromVisual
+#define XWarpPointer _glfw.x11.xlib.WarpPointer
+#define XkbFreeKeyboard _glfw.x11.xkb.FreeKeyboard
+#define XkbFreeNames _glfw.x11.xkb.FreeNames
+#define XkbGetMap _glfw.x11.xkb.GetMap
+#define XkbGetNames _glfw.x11.xkb.GetNames
+#define XkbGetState _glfw.x11.xkb.GetState
+#define XkbKeycodeToKeysym _glfw.x11.xkb.KeycodeToKeysym
+#define XkbQueryExtension _glfw.x11.xkb.QueryExtension
+#define XkbSelectEventDetails _glfw.x11.xkb.SelectEventDetails
+#define XkbSetDetectableAutoRepeat _glfw.x11.xkb.SetDetectableAutoRepeat
+#define XrmDestroyDatabase _glfw.x11.xrm.DestroyDatabase
+#define XrmGetResource _glfw.x11.xrm.GetResource
+#define XrmGetStringDatabase _glfw.x11.xrm.GetStringDatabase
+#define XrmUniqueQuark _glfw.x11.xrm.UniqueQuark
+#define XUnregisterIMInstantiateCallback _glfw.x11.xlib.UnregisterIMInstantiateCallback
+#define Xutf8LookupString _glfw.x11.xlib.utf8LookupString
+#define Xutf8SetWMProperties _glfw.x11.xlib.utf8SetWMProperties
+
 typedef XRRCrtcGamma* (* PFN_XRRAllocGamma)(int);
 typedef void (* PFN_XRRFreeCrtcInfo)(XRRCrtcInfo*);
 typedef void (* PFN_XRRFreeGamma)(XRRCrtcGamma*);
@@ -85,9 +337,15 @@
 typedef XcursorImage* (* PFN_XcursorImageCreate)(int,int);
 typedef void (* PFN_XcursorImageDestroy)(XcursorImage*);
 typedef Cursor (* PFN_XcursorImageLoadCursor)(Display*,const XcursorImage*);
+typedef char* (* PFN_XcursorGetTheme)(Display*);
+typedef int (* PFN_XcursorGetDefaultSize)(Display*);
+typedef XcursorImage* (* PFN_XcursorLibraryLoadImage)(const char*,const char*,int);
 #define XcursorImageCreate _glfw.x11.xcursor.ImageCreate
 #define XcursorImageDestroy _glfw.x11.xcursor.ImageDestroy
 #define XcursorImageLoadCursor _glfw.x11.xcursor.ImageLoadCursor
+#define XcursorGetTheme _glfw.x11.xcursor.GetTheme
+#define XcursorGetDefaultSize _glfw.x11.xcursor.GetDefaultSize
+#define XcursorLibraryLoadImage _glfw.x11.xcursor.LibraryLoadImage
 
 typedef Bool (* PFN_XineramaIsActive)(Display*);
 typedef Bool (* PFN_XineramaQueryExtension)(Display*,int*,int*);
@@ -123,6 +381,51 @@
 #define XRenderQueryVersion _glfw.x11.xrender.QueryVersion
 #define XRenderFindVisualFormat _glfw.x11.xrender.FindVisualFormat
 
+typedef Bool (* PFN_XShapeQueryExtension)(Display*,int*,int*);
+typedef Status (* PFN_XShapeQueryVersion)(Display*dpy,int*,int*);
+typedef void (* PFN_XShapeCombineRegion)(Display*,Window,int,int,int,Region,int);
+typedef void (* PFN_XShapeCombineMask)(Display*,Window,int,int,int,Pixmap,int);
+
+#define XShapeQueryExtension _glfw.x11.xshape.QueryExtension
+#define XShapeQueryVersion _glfw.x11.xshape.QueryVersion
+#define XShapeCombineRegion _glfw.x11.xshape.ShapeCombineRegion
+#define XShapeCombineMask _glfw.x11.xshape.ShapeCombineMask
+
+typedef int (*PFNGLXGETFBCONFIGATTRIBPROC)(Display*,GLXFBConfig,int,int*);
+typedef const char* (*PFNGLXGETCLIENTSTRINGPROC)(Display*,int);
+typedef Bool (*PFNGLXQUERYEXTENSIONPROC)(Display*,int*,int*);
+typedef Bool (*PFNGLXQUERYVERSIONPROC)(Display*,int*,int*);
+typedef void (*PFNGLXDESTROYCONTEXTPROC)(Display*,GLXContext);
+typedef Bool (*PFNGLXMAKECURRENTPROC)(Display*,GLXDrawable,GLXContext);
+typedef void (*PFNGLXSWAPBUFFERSPROC)(Display*,GLXDrawable);
+typedef const char* (*PFNGLXQUERYEXTENSIONSSTRINGPROC)(Display*,int);
+typedef GLXFBConfig* (*PFNGLXGETFBCONFIGSPROC)(Display*,int,int*);
+typedef GLXContext (*PFNGLXCREATENEWCONTEXTPROC)(Display*,GLXFBConfig,int,GLXContext,Bool);
+typedef __GLXextproc (* PFNGLXGETPROCADDRESSPROC)(const GLubyte *procName);
+typedef void (*PFNGLXSWAPINTERVALEXTPROC)(Display*,GLXDrawable,int);
+typedef XVisualInfo* (*PFNGLXGETVISUALFROMFBCONFIGPROC)(Display*,GLXFBConfig);
+typedef GLXWindow (*PFNGLXCREATEWINDOWPROC)(Display*,GLXFBConfig,Window,const int*);
+typedef void (*PFNGLXDESTROYWINDOWPROC)(Display*,GLXWindow);
+
+typedef int (*PFNGLXSWAPINTERVALMESAPROC)(int);
+typedef int (*PFNGLXSWAPINTERVALSGIPROC)(int);
+typedef GLXContext (*PFNGLXCREATECONTEXTATTRIBSARBPROC)(Display*,GLXFBConfig,GLXContext,Bool,const int*);
+
+// libGL.so function pointer typedefs
+#define glXGetFBConfigs _glfw.glx.GetFBConfigs
+#define glXGetFBConfigAttrib _glfw.glx.GetFBConfigAttrib
+#define glXGetClientString _glfw.glx.GetClientString
+#define glXQueryExtension _glfw.glx.QueryExtension
+#define glXQueryVersion _glfw.glx.QueryVersion
+#define glXDestroyContext _glfw.glx.DestroyContext
+#define glXMakeCurrent _glfw.glx.MakeCurrent
+#define glXSwapBuffers _glfw.glx.SwapBuffers
+#define glXQueryExtensionsString _glfw.glx.QueryExtensionsString
+#define glXCreateNewContext _glfw.glx.CreateNewContext
+#define glXGetVisualFromFBConfig _glfw.glx.GetVisualFromFBConfig
+#define glXCreateWindow _glfw.glx.CreateWindow
+#define glXDestroyWindow _glfw.glx.DestroyWindow
+
 typedef VkFlags VkXlibSurfaceCreateFlagsKHR;
 typedef VkFlags VkXcbSurfaceCreateFlagsKHR;
 
@@ -149,30 +452,71 @@
 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 "posix_thread.h"
-#include "posix_time.h"
 #include "xkb_unicode.h"
-#include "glx_context.h"
-#include "egl_context.h"
-#include "osmesa_context.h"
-#if defined(__linux__)
-#include "linux_joystick.h"
-#else
-#include "null_joystick.h"
-#endif
+#include "posix_poll.h"
 
-#define _glfw_dlopen(name) dlopen(name, RTLD_LAZY | RTLD_LOCAL)
-#define _glfw_dlclose(handle) dlclose(handle)
-#define _glfw_dlsym(handle, name) dlsym(handle, name)
+#define GLFW_X11_WINDOW_STATE           _GLFWwindowX11 x11;
+#define GLFW_X11_LIBRARY_WINDOW_STATE   _GLFWlibraryX11 x11;
+#define GLFW_X11_MONITOR_STATE          _GLFWmonitorX11 x11;
+#define GLFW_X11_CURSOR_STATE           _GLFWcursorX11 x11;
 
-#define _GLFW_EGL_NATIVE_WINDOW  ((EGLNativeWindowType) window->x11.handle)
-#define _GLFW_EGL_NATIVE_DISPLAY ((EGLNativeDisplayType) _glfw.x11.display)
+#define GLFW_GLX_CONTEXT_STATE          _GLFWcontextGLX glx;
+#define GLFW_GLX_LIBRARY_CONTEXT_STATE  _GLFWlibraryGLX glx;
 
-#define _GLFW_PLATFORM_WINDOW_STATE         _GLFWwindowX11  x11
-#define _GLFW_PLATFORM_LIBRARY_WINDOW_STATE _GLFWlibraryX11 x11
-#define _GLFW_PLATFORM_MONITOR_STATE        _GLFWmonitorX11 x11
-#define _GLFW_PLATFORM_CURSOR_STATE         _GLFWcursorX11  x11
 
+// GLX-specific per-context data
+//
+typedef struct _GLFWcontextGLX
+{
+    GLXContext      handle;
+    GLXWindow       window;
+} _GLFWcontextGLX;
+
+// GLX-specific global data
+//
+typedef struct _GLFWlibraryGLX
+{
+    int             major, minor;
+    int             eventBase;
+    int             errorBase;
+
+    void*           handle;
+
+    // GLX 1.3 functions
+    PFNGLXGETFBCONFIGSPROC              GetFBConfigs;
+    PFNGLXGETFBCONFIGATTRIBPROC         GetFBConfigAttrib;
+    PFNGLXGETCLIENTSTRINGPROC           GetClientString;
+    PFNGLXQUERYEXTENSIONPROC            QueryExtension;
+    PFNGLXQUERYVERSIONPROC              QueryVersion;
+    PFNGLXDESTROYCONTEXTPROC            DestroyContext;
+    PFNGLXMAKECURRENTPROC               MakeCurrent;
+    PFNGLXSWAPBUFFERSPROC               SwapBuffers;
+    PFNGLXQUERYEXTENSIONSSTRINGPROC     QueryExtensionsString;
+    PFNGLXCREATENEWCONTEXTPROC          CreateNewContext;
+    PFNGLXGETVISUALFROMFBCONFIGPROC     GetVisualFromFBConfig;
+    PFNGLXCREATEWINDOWPROC              CreateWindow;
+    PFNGLXDESTROYWINDOWPROC             DestroyWindow;
+
+    // GLX 1.4 and extension functions
+    PFNGLXGETPROCADDRESSPROC            GetProcAddress;
+    PFNGLXGETPROCADDRESSPROC            GetProcAddressARB;
+    PFNGLXSWAPINTERVALSGIPROC           SwapIntervalSGI;
+    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;
+} _GLFWlibraryGLX;
 
 // X11-specific per-window data
 //
@@ -299,6 +643,104 @@
     Atom            GLFW_SELECTION;
 
     struct {
+        void*       handle;
+        GLFWbool    utf8;
+        PFN_XAllocClassHint AllocClassHint;
+        PFN_XAllocSizeHints AllocSizeHints;
+        PFN_XAllocWMHints AllocWMHints;
+        PFN_XChangeProperty ChangeProperty;
+        PFN_XChangeWindowAttributes ChangeWindowAttributes;
+        PFN_XCheckIfEvent CheckIfEvent;
+        PFN_XCheckTypedWindowEvent CheckTypedWindowEvent;
+        PFN_XCloseDisplay CloseDisplay;
+        PFN_XCloseIM CloseIM;
+        PFN_XConvertSelection ConvertSelection;
+        PFN_XCreateColormap CreateColormap;
+        PFN_XCreateFontCursor CreateFontCursor;
+        PFN_XCreateIC CreateIC;
+        PFN_XCreateRegion CreateRegion;
+        PFN_XCreateWindow CreateWindow;
+        PFN_XDefineCursor DefineCursor;
+        PFN_XDeleteContext DeleteContext;
+        PFN_XDeleteProperty DeleteProperty;
+        PFN_XDestroyIC DestroyIC;
+        PFN_XDestroyRegion DestroyRegion;
+        PFN_XDestroyWindow DestroyWindow;
+        PFN_XDisplayKeycodes DisplayKeycodes;
+        PFN_XEventsQueued EventsQueued;
+        PFN_XFilterEvent FilterEvent;
+        PFN_XFindContext FindContext;
+        PFN_XFlush Flush;
+        PFN_XFree Free;
+        PFN_XFreeColormap FreeColormap;
+        PFN_XFreeCursor FreeCursor;
+        PFN_XFreeEventData FreeEventData;
+        PFN_XGetErrorText GetErrorText;
+        PFN_XGetEventData GetEventData;
+        PFN_XGetICValues GetICValues;
+        PFN_XGetIMValues GetIMValues;
+        PFN_XGetInputFocus GetInputFocus;
+        PFN_XGetKeyboardMapping GetKeyboardMapping;
+        PFN_XGetScreenSaver GetScreenSaver;
+        PFN_XGetSelectionOwner GetSelectionOwner;
+        PFN_XGetVisualInfo GetVisualInfo;
+        PFN_XGetWMNormalHints GetWMNormalHints;
+        PFN_XGetWindowAttributes GetWindowAttributes;
+        PFN_XGetWindowProperty GetWindowProperty;
+        PFN_XGrabPointer GrabPointer;
+        PFN_XIconifyWindow IconifyWindow;
+        PFN_XInternAtom InternAtom;
+        PFN_XLookupString LookupString;
+        PFN_XMapRaised MapRaised;
+        PFN_XMapWindow MapWindow;
+        PFN_XMoveResizeWindow MoveResizeWindow;
+        PFN_XMoveWindow MoveWindow;
+        PFN_XNextEvent NextEvent;
+        PFN_XOpenIM OpenIM;
+        PFN_XPeekEvent PeekEvent;
+        PFN_XPending Pending;
+        PFN_XQueryExtension QueryExtension;
+        PFN_XQueryPointer QueryPointer;
+        PFN_XRaiseWindow RaiseWindow;
+        PFN_XRegisterIMInstantiateCallback RegisterIMInstantiateCallback;
+        PFN_XResizeWindow ResizeWindow;
+        PFN_XResourceManagerString ResourceManagerString;
+        PFN_XSaveContext SaveContext;
+        PFN_XSelectInput SelectInput;
+        PFN_XSendEvent SendEvent;
+        PFN_XSetClassHint SetClassHint;
+        PFN_XSetErrorHandler SetErrorHandler;
+        PFN_XSetICFocus SetICFocus;
+        PFN_XSetIMValues SetIMValues;
+        PFN_XSetInputFocus SetInputFocus;
+        PFN_XSetLocaleModifiers SetLocaleModifiers;
+        PFN_XSetScreenSaver SetScreenSaver;
+        PFN_XSetSelectionOwner SetSelectionOwner;
+        PFN_XSetWMHints SetWMHints;
+        PFN_XSetWMNormalHints SetWMNormalHints;
+        PFN_XSetWMProtocols SetWMProtocols;
+        PFN_XSupportsLocale SupportsLocale;
+        PFN_XSync Sync;
+        PFN_XTranslateCoordinates TranslateCoordinates;
+        PFN_XUndefineCursor UndefineCursor;
+        PFN_XUngrabPointer UngrabPointer;
+        PFN_XUnmapWindow UnmapWindow;
+        PFN_XUnsetICFocus UnsetICFocus;
+        PFN_XVisualIDFromVisual VisualIDFromVisual;
+        PFN_XWarpPointer WarpPointer;
+        PFN_XUnregisterIMInstantiateCallback UnregisterIMInstantiateCallback;
+        PFN_Xutf8LookupString utf8LookupString;
+        PFN_Xutf8SetWMProperties utf8SetWMProperties;
+    } xlib;
+
+    struct {
+        PFN_XrmDestroyDatabase DestroyDatabase;
+        PFN_XrmGetResource GetResource;
+        PFN_XrmGetStringDatabase GetStringDatabase;
+        PFN_XrmUniqueQuark UniqueQuark;
+    } xrm;
+
+    struct {
         GLFWbool    available;
         void*       handle;
         int         eventBase;
@@ -335,6 +777,15 @@
         int          major;
         int          minor;
         unsigned int group;
+        PFN_XkbFreeKeyboard FreeKeyboard;
+        PFN_XkbFreeNames FreeNames;
+        PFN_XkbGetMap GetMap;
+        PFN_XkbGetNames GetNames;
+        PFN_XkbGetState GetState;
+        PFN_XkbKeycodeToKeysym KeycodeToKeysym;
+        PFN_XkbQueryExtension QueryExtension;
+        PFN_XkbSelectEventDetails SelectEventDetails;
+        PFN_XkbSetDetectableAutoRepeat SetDetectableAutoRepeat;
     } xkb;
 
     struct {
@@ -356,6 +807,9 @@
         PFN_XcursorImageCreate ImageCreate;
         PFN_XcursorImageDestroy ImageDestroy;
         PFN_XcursorImageLoadCursor ImageLoadCursor;
+        PFN_XcursorGetTheme GetTheme;
+        PFN_XcursorGetDefaultSize GetDefaultSize;
+        PFN_XcursorLibraryLoadImage LibraryLoadImage;
     } xcursor;
 
     struct {
@@ -407,6 +861,19 @@
         PFN_XRenderQueryVersion QueryVersion;
         PFN_XRenderFindVisualFormat FindVisualFormat;
     } xrender;
+
+    struct {
+        GLFWbool    available;
+        void*       handle;
+        int         major;
+        int         minor;
+        int         eventBase;
+        int         errorBase;
+        PFN_XShapeQueryExtension QueryExtension;
+        PFN_XShapeCombineRegion ShapeCombineRegion;
+        PFN_XShapeQueryVersion QueryVersion;
+        PFN_XShapeCombineMask ShapeCombineMask;
+    } xshape;
 } _GLFWlibraryX11;
 
 // X11-specific per-monitor data
@@ -430,11 +897,86 @@
 } _GLFWcursorX11;
 
 
+GLFWbool _glfwConnectX11(int platformID, _GLFWplatform* platform);
+int _glfwInitX11(void);
+void _glfwTerminateX11(void);
+
+GLFWbool _glfwCreateWindowX11(_GLFWwindow* window, const _GLFWwndconfig* wndconfig, const _GLFWctxconfig* ctxconfig, const _GLFWfbconfig* fbconfig);
+void _glfwDestroyWindowX11(_GLFWwindow* window);
+void _glfwSetWindowTitleX11(_GLFWwindow* window, const char* title);
+void _glfwSetWindowIconX11(_GLFWwindow* window, int count, const GLFWimage* images);
+void _glfwGetWindowPosX11(_GLFWwindow* window, int* xpos, int* ypos);
+void _glfwSetWindowPosX11(_GLFWwindow* window, int xpos, int ypos);
+void _glfwGetWindowSizeX11(_GLFWwindow* window, int* width, int* height);
+void _glfwSetWindowSizeX11(_GLFWwindow* window, int width, int height);
+void _glfwSetWindowSizeLimitsX11(_GLFWwindow* window, int minwidth, int minheight, int maxwidth, int maxheight);
+void _glfwSetWindowAspectRatioX11(_GLFWwindow* window, int numer, int denom);
+void _glfwGetFramebufferSizeX11(_GLFWwindow* window, int* width, int* height);
+void _glfwGetWindowFrameSizeX11(_GLFWwindow* window, int* left, int* top, int* right, int* bottom);
+void _glfwGetWindowContentScaleX11(_GLFWwindow* window, float* xscale, float* yscale);
+void _glfwIconifyWindowX11(_GLFWwindow* window);
+void _glfwRestoreWindowX11(_GLFWwindow* window);
+void _glfwMaximizeWindowX11(_GLFWwindow* window);
+void _glfwShowWindowX11(_GLFWwindow* window);
+void _glfwHideWindowX11(_GLFWwindow* window);
+void _glfwRequestWindowAttentionX11(_GLFWwindow* window);
+void _glfwFocusWindowX11(_GLFWwindow* window);
+void _glfwSetWindowMonitorX11(_GLFWwindow* window, _GLFWmonitor* monitor, int xpos, int ypos, int width, int height, int refreshRate);
+GLFWbool _glfwWindowFocusedX11(_GLFWwindow* window);
+GLFWbool _glfwWindowIconifiedX11(_GLFWwindow* window);
+GLFWbool _glfwWindowVisibleX11(_GLFWwindow* window);
+GLFWbool _glfwWindowMaximizedX11(_GLFWwindow* window);
+GLFWbool _glfwWindowHoveredX11(_GLFWwindow* window);
+GLFWbool _glfwFramebufferTransparentX11(_GLFWwindow* window);
+void _glfwSetWindowResizableX11(_GLFWwindow* window, GLFWbool enabled);
+void _glfwSetWindowDecoratedX11(_GLFWwindow* window, GLFWbool enabled);
+void _glfwSetWindowFloatingX11(_GLFWwindow* window, GLFWbool enabled);
+float _glfwGetWindowOpacityX11(_GLFWwindow* window);
+void _glfwSetWindowOpacityX11(_GLFWwindow* window, float opacity);
+void _glfwSetWindowMousePassthroughX11(_GLFWwindow* window, GLFWbool enabled);
+
+void _glfwSetRawMouseMotionX11(_GLFWwindow *window, GLFWbool enabled);
+GLFWbool _glfwRawMouseMotionSupportedX11(void);
+
+void _glfwPollEventsX11(void);
+void _glfwWaitEventsX11(void);
+void _glfwWaitEventsTimeoutX11(double timeout);
+void _glfwPostEmptyEventX11(void);
+
+void _glfwGetCursorPosX11(_GLFWwindow* window, double* xpos, double* ypos);
+void _glfwSetCursorPosX11(_GLFWwindow* window, double xpos, double ypos);
+void _glfwSetCursorModeX11(_GLFWwindow* window, int mode);
+const char* _glfwGetScancodeNameX11(int scancode);
+int _glfwGetKeyScancodeX11(int key);
+GLFWbool _glfwCreateCursorX11(_GLFWcursor* cursor, const GLFWimage* image, int xhot, int yhot);
+GLFWbool _glfwCreateStandardCursorX11(_GLFWcursor* cursor, int shape);
+void _glfwDestroyCursorX11(_GLFWcursor* cursor);
+void _glfwSetCursorX11(_GLFWwindow* window, _GLFWcursor* cursor);
+void _glfwSetClipboardStringX11(const char* string);
+const char* _glfwGetClipboardStringX11(void);
+
+EGLenum _glfwGetEGLPlatformX11(EGLint** attribs);
+EGLNativeDisplayType _glfwGetEGLNativeDisplayX11(void);
+EGLNativeWindowType _glfwGetEGLNativeWindowX11(_GLFWwindow* window);
+
+void _glfwGetRequiredInstanceExtensionsX11(char** extensions);
+GLFWbool _glfwGetPhysicalDevicePresentationSupportX11(VkInstance instance, VkPhysicalDevice device, uint32_t queuefamily);
+VkResult _glfwCreateWindowSurfaceX11(VkInstance instance, _GLFWwindow* window, const VkAllocationCallbacks* allocator, VkSurfaceKHR* surface);
+
+void _glfwFreeMonitorX11(_GLFWmonitor* monitor);
+void _glfwGetMonitorPosX11(_GLFWmonitor* monitor, int* xpos, int* ypos);
+void _glfwGetMonitorContentScaleX11(_GLFWmonitor* monitor, float* xscale, float* yscale);
+void _glfwGetMonitorWorkareaX11(_GLFWmonitor* monitor, int* xpos, int* ypos, int* width, int* height);
+GLFWvidmode* _glfwGetVideoModesX11(_GLFWmonitor* monitor, int* count);
+GLFWbool _glfwGetVideoModeX11(_GLFWmonitor* monitor, GLFWvidmode* mode);
+GLFWbool _glfwGetGammaRampX11(_GLFWmonitor* monitor, GLFWgammaramp* ramp);
+void _glfwSetGammaRampX11(_GLFWmonitor* monitor, const GLFWgammaramp* ramp);
+
 void _glfwPollMonitorsX11(void);
 void _glfwSetVideoModeX11(_GLFWmonitor* monitor, const GLFWvidmode* desired);
 void _glfwRestoreVideoModeX11(_GLFWmonitor* monitor);
 
-Cursor _glfwCreateCursorX11(const GLFWimage* image, int xhot, int yhot);
+Cursor _glfwCreateNativeCursorX11(const GLFWimage* image, int xhot, int yhot);
 
 unsigned long _glfwGetWindowPropertyX11(Window window,
                                         Atom property,
@@ -447,4 +989,16 @@
 void _glfwInputErrorX11(int error, const char* message);
 
 void _glfwPushSelectionToManagerX11(void);
+void _glfwCreateInputContextX11(_GLFWwindow* window);
+
+GLFWbool _glfwInitGLX(void);
+void _glfwTerminateGLX(void);
+GLFWbool _glfwCreateContextGLX(_GLFWwindow* window,
+                               const _GLFWctxconfig* ctxconfig,
+                               const _GLFWfbconfig* fbconfig);
+void _glfwDestroyContextGLX(_GLFWwindow* window);
+GLFWbool _glfwChooseVisualGLX(const _GLFWwndconfig* wndconfig,
+                              const _GLFWctxconfig* ctxconfig,
+                              const _GLFWfbconfig* fbconfig,
+                              Visual** visual, int* depth);
 
diff --git a/src/x11_window.c b/src/x11_window.c
index ef02f13..e029546 100644
--- a/src/x11_window.c
+++ b/src/x11_window.c
@@ -1,5 +1,5 @@
 //========================================================================
-// GLFW 3.3 X11 - www.glfw.org
+// GLFW 3.4 X11 - www.glfw.org
 //------------------------------------------------------------------------
 // Copyright (c) 2002-2006 Marcus Geelnard
 // Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.org>
@@ -24,19 +24,15 @@
 //    distribution.
 //
 //========================================================================
-// It is fine to use C99 in this file because it will not be built with VS
-//========================================================================
-
-#define _GNU_SOURCE
 
 #include "internal.h"
 
+#if defined(_GLFW_X11)
+
 #include <X11/cursorfont.h>
 #include <X11/Xmd.h>
 
 #include <poll.h>
-#include <signal.h>
-#include <time.h>
 
 #include <string.h>
 #include <stdio.h>
@@ -60,53 +56,6 @@
 
 #define _GLFW_XDND_VERSION 5
 
-// Wait for data to arrive on any of the specified file descriptors
-//
-static GLFWbool waitForData(struct pollfd* fds, nfds_t count, double* timeout)
-{
-    for (;;)
-    {
-        if (timeout)
-        {
-            const uint64_t base = _glfwPlatformGetTimerValue();
-
-#if defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__CYGWIN__)
-            const time_t seconds = (time_t) *timeout;
-            const long nanoseconds = (long) ((*timeout - seconds) * 1e9);
-            const struct timespec ts = { seconds, nanoseconds };
-            const int result = ppoll(fds, count, &ts, NULL);
-#elif defined(__NetBSD__)
-            const time_t seconds = (time_t) *timeout;
-            const long nanoseconds = (long) ((*timeout - seconds) * 1e9);
-            const struct timespec ts = { seconds, nanoseconds };
-            const int result = pollts(fds, count, &ts, NULL);
-#else
-            const int milliseconds = (int) (*timeout * 1e3);
-            const int result = poll(fds, count, milliseconds);
-#endif
-            const int error = errno; // clock_gettime may overwrite our error
-
-            *timeout -= (_glfwPlatformGetTimerValue() - base) /
-                (double) _glfwPlatformGetTimerFrequency();
-
-            if (result > 0)
-                return GLFW_TRUE;
-            else if (result == -1 && error != EINTR && error != EAGAIN)
-                return GLFW_FALSE;
-            else if (*timeout <= 0.0)
-                return GLFW_FALSE;
-        }
-        else
-        {
-            const int result = poll(fds, count, -1);
-            if (result > 0)
-                return GLFW_TRUE;
-            else if (result == -1 && errno != EINTR && errno != EAGAIN)
-                return GLFW_FALSE;
-        }
-    }
-}
-
 // Wait for event data to arrive on the X11 display socket
 // This avoids blocking other threads via the per-display Xlib lock that also
 // covers GLX functions
@@ -117,7 +66,7 @@
 
     while (!XPending(_glfw.x11.display))
     {
-        if (!waitForData(&fd, 1, timeout))
+        if (!_glfwPollPOSIX(&fd, 1, timeout))
             return GLFW_FALSE;
     }
 
@@ -130,24 +79,25 @@
 //
 static GLFWbool waitForAnyEvent(double* timeout)
 {
-    nfds_t count = 2;
-    struct pollfd fds[3] =
+    enum { XLIB_FD, PIPE_FD, INOTIFY_FD };
+    struct pollfd fds[] =
     {
-        { ConnectionNumber(_glfw.x11.display), POLLIN },
-        { _glfw.x11.emptyEventPipe[0], POLLIN }
+        [XLIB_FD] = { ConnectionNumber(_glfw.x11.display), POLLIN },
+        [PIPE_FD] = { _glfw.x11.emptyEventPipe[0], POLLIN },
+        [INOTIFY_FD] = { -1, POLLIN }
     };
 
-#if defined(__linux__)
-    if (_glfw.linjs.inotify > 0)
-        fds[count++] = (struct pollfd) { _glfw.linjs.inotify, POLLIN };
+#if defined(GLFW_BUILD_LINUX_JOYSTICK)
+    if (_glfw.joysticksInitialized)
+        fds[INOTIFY_FD].fd = _glfw.linjs.inotify;
 #endif
 
     while (!XPending(_glfw.x11.display))
     {
-        if (!waitForData(fds, count, timeout))
+        if (!_glfwPollPOSIX(fds, sizeof(fds) / sizeof(fds[0]), timeout))
             return GLFW_FALSE;
 
-        for (int i = 1; i < count; i++)
+        for (int i = 1; i < sizeof(fds) / sizeof(fds[0]); i++)
         {
             if (fds[i].revents & POLLIN)
                 return GLFW_TRUE;
@@ -463,7 +413,6 @@
 // Decode a Unicode code point from a UTF-8 stream
 // Based on cutef8 by Jeff Bezanson (Public Domain)
 //
-#if defined(X_HAVE_UTF8_STRING)
 static uint32_t decodeUTF8(const char** s)
 {
     uint32_t codepoint = 0, count = 0;
@@ -483,7 +432,6 @@
     assert(count <= 6);
     return codepoint - offsets[count - 1];
 }
-#endif /*X_HAVE_UTF8_STRING*/
 
 // Convert the specified Latin-1 string to UTF-8
 //
@@ -495,7 +443,7 @@
     for (sp = source;  *sp;  sp++)
         size += (*sp & 0x80) ? 2 : 1;
 
-    char* target = calloc(size, 1);
+    char* target = _glfw_calloc(size, 1);
     char* tp = target;
 
     for (sp = source;  *sp;  sp++)
@@ -508,7 +456,8 @@
 //
 static void updateCursorImage(_GLFWwindow* window)
 {
-    if (window->cursorMode == GLFW_CURSOR_NORMAL)
+    if (window->cursorMode == GLFW_CURSOR_NORMAL ||
+        window->cursorMode == GLFW_CURSOR_CAPTURED)
     {
         if (window->cursor)
         {
@@ -581,9 +530,9 @@
         enableRawMouseMotion(window);
 
     _glfw.x11.disabledCursorWindow = window;
-    _glfwPlatformGetCursorPos(window,
-                              &_glfw.x11.restoreCursorPosX,
-                              &_glfw.x11.restoreCursorPosY);
+    _glfwGetCursorPosX11(window,
+                         &_glfw.x11.restoreCursorPosX,
+                         &_glfw.x11.restoreCursorPosY);
     updateCursorImage(window);
     _glfwCenterCursorInContentArea(window);
     captureCursor(window);
@@ -598,12 +547,20 @@
 
     _glfw.x11.disabledCursorWindow = NULL;
     releaseCursor();
-    _glfwPlatformSetCursorPos(window,
-                              _glfw.x11.restoreCursorPosX,
-                              _glfw.x11.restoreCursorPosY);
+    _glfwSetCursorPosX11(window,
+                         _glfw.x11.restoreCursorPosX,
+                         _glfw.x11.restoreCursorPosY);
     updateCursorImage(window);
 }
 
+// Clear its handle when the input context has been destroyed
+//
+static void inputContextDestroyCallback(XIC ic, XPointer clientData, XPointer callData)
+{
+    _GLFWwindow* window = (_GLFWwindow*) clientData;
+    window->x11.ic = NULL;
+}
+
 // Create the X11 window (and its colormap)
 //
 static GLFWbool createNativeWindow(_GLFWwindow* window,
@@ -619,6 +576,14 @@
         height *= _glfw.x11.contentScaleY;
     }
 
+    int xpos = 0, ypos = 0;
+
+    if (wndconfig->xpos != GLFW_ANY_POSITION && wndconfig->ypos != GLFW_ANY_POSITION)
+    {
+        xpos = wndconfig->xpos;
+        ypos = wndconfig->ypos;
+    }
+
     // Create a colormap based on the visual used by the current context
     window->x11.colormap = XCreateColormap(_glfw.x11.display,
                                            _glfw.x11.root,
@@ -639,7 +604,7 @@
     window->x11.parent = _glfw.x11.root;
     window->x11.handle = XCreateWindow(_glfw.x11.display,
                                        _glfw.x11.root,
-                                       0, 0,   // Position
+                                       xpos, ypos,
                                        width, height,
                                        0,      // Border width
                                        depth,  // Color depth
@@ -663,7 +628,7 @@
                  (XPointer) window);
 
     if (!wndconfig->decorated)
-        _glfwPlatformSetWindowDecorated(window, GLFW_FALSE);
+        _glfwSetWindowDecoratedX11(window, GLFW_FALSE);
 
     if (_glfw.x11.NET_WM_STATE && !window->monitor)
     {
@@ -758,6 +723,15 @@
             hints->min_height = hints->max_height = height;
         }
 
+        // HACK: Explicitly setting PPosition to any value causes some WMs, notably
+        //       Compiz and Metacity, to honor the position of unmapped windows
+        if (wndconfig->xpos != GLFW_ANY_POSITION && wndconfig->ypos != GLFW_ANY_POSITION)
+        {
+            hints->flags |= PPosition;
+            hints->x = 0;
+            hints->y = 0;
+        }
+
         hints->flags |= PWinGravity;
         hints->win_gravity = StaticGravity;
 
@@ -803,29 +777,12 @@
                         PropModeReplace, (unsigned char*) &version, 1);
     }
 
-    _glfwPlatformSetWindowTitle(window, wndconfig->title);
-
     if (_glfw.x11.im)
-    {
-        window->x11.ic = XCreateIC(_glfw.x11.im,
-                                   XNInputStyle,
-                                   XIMPreeditNothing | XIMStatusNothing,
-                                   XNClientWindow,
-                                   window->x11.handle,
-                                   XNFocusWindow,
-                                   window->x11.handle,
-                                   NULL);
-    }
+        _glfwCreateInputContextX11(window);
 
-    if (window->x11.ic)
-    {
-        unsigned long filter = 0;
-        if (XGetICValues(window->x11.ic, XNFilterEvents, &filter, NULL) == NULL)
-            XSelectInput(_glfw.x11.display, window->x11.handle, wa.event_mask | filter);
-    }
-
-    _glfwPlatformGetWindowPos(window, &window->x11.xpos, &window->x11.ypos);
-    _glfwPlatformGetWindowSize(window, &window->x11.width, &window->x11.height);
+    _glfwSetWindowTitleX11(window, wndconfig->title);
+    _glfwGetWindowPosX11(window, &window->x11.xpos, &window->x11.ypos);
+    _glfwGetWindowSizeX11(window, &window->x11.width, &window->x11.height);
 
     return GLFW_TRUE;
 }
@@ -834,7 +791,6 @@
 //
 static Atom writeTargetToProperty(const XSelectionRequestEvent* request)
 {
-    int i;
     char* selectionString = NULL;
     const Atom formats[] = { _glfw.x11.UTF8_STRING, XA_STRING };
     const int formatCount = sizeof(formats) / sizeof(formats[0]);
@@ -877,14 +833,13 @@
         // Multiple conversions were requested
 
         Atom* targets;
-        unsigned long i, count;
+        const unsigned long count =
+            _glfwGetWindowPropertyX11(request->requestor,
+                                      request->property,
+                                      _glfw.x11.ATOM_PAIR,
+                                      (unsigned char**) &targets);
 
-        count = _glfwGetWindowPropertyX11(request->requestor,
-                                          request->property,
-                                          _glfw.x11.ATOM_PAIR,
-                                          (unsigned char**) &targets);
-
-        for (i = 0;  i < count;  i += 2)
+        for (unsigned long i = 0;  i < count;  i += 2)
         {
             int j;
 
@@ -942,7 +897,7 @@
 
     // Conversion to a data target was requested
 
-    for (i = 0;  i < formatCount;  i++)
+    for (int i = 0;  i < formatCount;  i++)
     {
         if (request->target == formats[i])
         {
@@ -1000,7 +955,7 @@
         return *selectionString;
     }
 
-    free(*selectionString);
+    _glfw_free(*selectionString);
     *selectionString = NULL;
 
     for (size_t i = 0;  i < targetCount;  i++)
@@ -1079,7 +1034,7 @@
                 if (itemCount)
                 {
                     size += itemCount;
-                    string = realloc(string, size);
+                    string = _glfw_realloc(string, size);
                     string[size - itemCount - 1] = '\0';
                     strcat(string, data);
                 }
@@ -1091,7 +1046,7 @@
                         if (targets[i] == XA_STRING)
                         {
                             *selectionString = convertLatin1toUTF8(string);
-                            free(string);
+                            _glfw_free(string);
                         }
                         else
                             *selectionString = string;
@@ -1153,8 +1108,8 @@
         GLFWvidmode mode;
 
         // Manually position the window over its monitor
-        _glfwPlatformGetMonitorPos(window->monitor, &xpos, &ypos);
-        _glfwPlatformGetVideoMode(window->monitor, &mode);
+        _glfwGetMonitorPosX11(window->monitor, &xpos, &ypos);
+        _glfwGetVideoModeX11(window->monitor, &mode);
 
         XMoveResizeWindow(_glfw.x11.display, window->x11.handle,
                           xpos, ypos, mode.width, mode.height);
@@ -1197,8 +1152,7 @@
     if (event->type == KeyPress || event->type == KeyRelease)
         keycode = event->xkey.keycode;
 
-    if (_glfw.x11.im)
-        filtered = XFilterEvent(event, None);
+    filtered = XFilterEvent(event, None);
 
     if (_glfw.x11.randr.available)
     {
@@ -1314,7 +1268,6 @@
                 {
                     int count;
                     Status status;
-#if defined(X_HAVE_UTF8_STRING)
                     char buffer[100];
                     char* chars = buffer;
 
@@ -1325,7 +1278,7 @@
 
                     if (status == XBufferOverflow)
                     {
-                        chars = calloc(count + 1, 1);
+                        chars = _glfw_calloc(count + 1, 1);
                         count = Xutf8LookupString(window->x11.ic,
                                                   &event->xkey,
                                                   chars, count,
@@ -1339,36 +1292,9 @@
                         while (c - chars < count)
                             _glfwInputChar(window, decodeUTF8(&c), mods, plain);
                     }
-#else /*X_HAVE_UTF8_STRING*/
-                    wchar_t buffer[16];
-                    wchar_t* chars = buffer;
-
-                    count = XwcLookupString(window->x11.ic,
-                                            &event->xkey,
-                                            buffer,
-                                            sizeof(buffer) / sizeof(wchar_t),
-                                            NULL,
-                                            &status);
-
-                    if (status == XBufferOverflow)
-                    {
-                        chars = calloc(count, sizeof(wchar_t));
-                        count = XwcLookupString(window->x11.ic,
-                                                &event->xkey,
-                                                chars, count,
-                                                NULL, &status);
-                    }
-
-                    if (status == XLookupChars || status == XLookupBoth)
-                    {
-                        int i;
-                        for (i = 0;  i < count;  i++)
-                            _glfwInputChar(window, chars[i], mods, plain);
-                    }
-#endif /*X_HAVE_UTF8_STRING*/
 
                     if (chars != buffer)
-                        free(chars);
+                        _glfw_free(chars);
                 }
             }
             else
@@ -1562,6 +1488,9 @@
             if (event->xconfigure.width != window->x11.width ||
                 event->xconfigure.height != window->x11.height)
             {
+                window->x11.width = event->xconfigure.width;
+                window->x11.height = event->xconfigure.height;
+
                 _glfwInputFramebufferSize(window,
                                           event->xconfigure.width,
                                           event->xconfigure.height);
@@ -1569,9 +1498,6 @@
                 _glfwInputWindowSize(window,
                                      event->xconfigure.width,
                                      event->xconfigure.height);
-
-                window->x11.width = event->xconfigure.width;
-                window->x11.height = event->xconfigure.height;
             }
 
             int xpos = event->xconfigure.x;
@@ -1599,9 +1525,10 @@
 
             if (xpos != window->x11.xpos || ypos != window->x11.ypos)
             {
-                _glfwInputWindowPos(window, xpos, ypos);
                 window->x11.xpos = xpos;
                 window->x11.ypos = ypos;
+
+                _glfwInputWindowPos(window, xpos, ypos);
             }
 
             return;
@@ -1647,7 +1574,7 @@
             else if (event->xclient.message_type == _glfw.x11.XdndEnter)
             {
                 // A drag operation has entered the window
-                unsigned long i, count;
+                unsigned long count;
                 Atom* formats = NULL;
                 const GLFWbool list = event->xclient.data.l[1] & 1;
 
@@ -1671,7 +1598,7 @@
                     formats = (Atom*) event->xclient.data.l + 2;
                 }
 
-                for (i = 0;  i < count;  i++)
+                for (unsigned int i = 0;  i < count;  i++)
                 {
                     if (formats[i] == _glfw.x11.text_uri_list)
                     {
@@ -1777,14 +1704,14 @@
 
                 if (result)
                 {
-                    int i, count;
+                    int count;
                     char** paths = _glfwParseUriList(data, &count);
 
                     _glfwInputDrop(window, count, (const char**) paths);
 
-                    for (i = 0;  i < count;  i++)
-                        free(paths[i]);
-                    free(paths);
+                    for (int i = 0;  i < count;  i++)
+                        _glfw_free(paths[i]);
+                    _glfw_free(paths);
                 }
 
                 if (data)
@@ -1821,6 +1748,8 @@
 
             if (window->cursorMode == GLFW_CURSOR_DISABLED)
                 disableCursor(window);
+            else if (window->cursorMode == GLFW_CURSOR_CAPTURED)
+                captureCursor(window);
 
             if (window->x11.ic)
                 XSetICFocus(window->x11.ic);
@@ -1841,12 +1770,14 @@
 
             if (window->cursorMode == GLFW_CURSOR_DISABLED)
                 enableCursor(window);
+            else if (window->cursorMode == GLFW_CURSOR_CAPTURED)
+                releaseCursor();
 
             if (window->x11.ic)
                 XUnsetICFocus(window->x11.ic);
 
             if (window->monitor && window->autoIconify)
-                _glfwPlatformIconifyWindow(window);
+                _glfwIconifyWindowX11(window);
 
             _glfwInputWindowFocus(window, GLFW_FALSE);
             return;
@@ -1886,7 +1817,7 @@
             }
             else if (event->xproperty.atom == _glfw.x11.NET_WM_STATE)
             {
-                const GLFWbool maximized = _glfwPlatformWindowMaximized(window);
+                const GLFWbool maximized = _glfwWindowMaximizedX11(window);
                 if (window->x11.maximized != maximized)
                 {
                     window->x11.maximized = maximized;
@@ -1988,12 +1919,44 @@
     }
 }
 
+void _glfwCreateInputContextX11(_GLFWwindow* window)
+{
+    XIMCallback callback;
+    callback.callback = (XIMProc) inputContextDestroyCallback;
+    callback.client_data = (XPointer) window;
+
+    window->x11.ic = XCreateIC(_glfw.x11.im,
+                               XNInputStyle,
+                               XIMPreeditNothing | XIMStatusNothing,
+                               XNClientWindow,
+                               window->x11.handle,
+                               XNFocusWindow,
+                               window->x11.handle,
+                               XNDestroyCallback,
+                               &callback,
+                               NULL);
+
+    if (window->x11.ic)
+    {
+        XWindowAttributes attribs;
+        XGetWindowAttributes(_glfw.x11.display, window->x11.handle, &attribs);
+
+        unsigned long filter = 0;
+        if (XGetICValues(window->x11.ic, XNFilterEvents, &filter, NULL) == NULL)
+        {
+            XSelectInput(_glfw.x11.display,
+                         window->x11.handle,
+                         attribs.your_event_mask | filter);
+        }
+    }
+}
+
 
 //////////////////////////////////////////////////////////////////////////
 //////                       GLFW platform API                      //////
 //////////////////////////////////////////////////////////////////////////
 
-int _glfwPlatformCreateWindow(_GLFWwindow* window,
+GLFWbool _glfwCreateWindowX11(_GLFWwindow* window,
                               const _GLFWwndconfig* wndconfig,
                               const _GLFWctxconfig* ctxconfig,
                               const _GLFWfbconfig* fbconfig)
@@ -2055,9 +2018,12 @@
             return GLFW_FALSE;
     }
 
+    if (wndconfig->mousePassthrough)
+        _glfwSetWindowMousePassthroughX11(window, GLFW_TRUE);
+
     if (window->monitor)
     {
-        _glfwPlatformShowWindow(window);
+        _glfwShowWindowX11(window);
         updateWindowMode(window);
         acquireMonitor(window);
 
@@ -2068,9 +2034,9 @@
     {
         if (wndconfig->visible)
         {
-            _glfwPlatformShowWindow(window);
+            _glfwShowWindowX11(window);
             if (wndconfig->focused)
-                _glfwPlatformFocusWindow(window);
+                _glfwFocusWindowX11(window);
         }
     }
 
@@ -2078,7 +2044,7 @@
     return GLFW_TRUE;
 }
 
-void _glfwPlatformDestroyWindow(_GLFWwindow* window)
+void _glfwDestroyWindowX11(_GLFWwindow* window)
 {
     if (_glfw.x11.disabledCursorWindow == window)
         enableCursor(window);
@@ -2112,23 +2078,16 @@
     XFlush(_glfw.x11.display);
 }
 
-void _glfwPlatformSetWindowTitle(_GLFWwindow* window, const char* title)
+void _glfwSetWindowTitleX11(_GLFWwindow* window, const char* title)
 {
-#if defined(X_HAVE_UTF8_STRING)
-    Xutf8SetWMProperties(_glfw.x11.display,
-                         window->x11.handle,
-                         title, title,
-                         NULL, 0,
-                         NULL, NULL, NULL);
-#else
-    // This may be a slightly better fallback than using XStoreName and
-    // XSetIconName, which always store their arguments using STRING
-    XmbSetWMProperties(_glfw.x11.display,
-                       window->x11.handle,
-                       title, title,
-                       NULL, 0,
-                       NULL, NULL, NULL);
-#endif
+    if (_glfw.x11.xlib.utf8)
+    {
+        Xutf8SetWMProperties(_glfw.x11.display,
+                             window->x11.handle,
+                             title, title,
+                             NULL, 0,
+                             NULL, NULL, NULL);
+    }
 
     XChangeProperty(_glfw.x11.display,  window->x11.handle,
                     _glfw.x11.NET_WM_NAME, _glfw.x11.UTF8_STRING, 8,
@@ -2143,25 +2102,24 @@
     XFlush(_glfw.x11.display);
 }
 
-void _glfwPlatformSetWindowIcon(_GLFWwindow* window,
-                                int count, const GLFWimage* images)
+void _glfwSetWindowIconX11(_GLFWwindow* window, int count, const GLFWimage* images)
 {
     if (count)
     {
-        int i, j, longCount = 0;
+        int longCount = 0;
 
-        for (i = 0;  i < count;  i++)
+        for (int i = 0;  i < count;  i++)
             longCount += 2 + images[i].width * images[i].height;
 
-        unsigned long* icon = calloc(longCount, sizeof(unsigned long));
+        unsigned long* icon = _glfw_calloc(longCount, sizeof(unsigned long));
         unsigned long* target = icon;
 
-        for (i = 0;  i < count;  i++)
+        for (int i = 0;  i < count;  i++)
         {
             *target++ = images[i].width;
             *target++ = images[i].height;
 
-            for (j = 0;  j < images[i].width * images[i].height;  j++)
+            for (int j = 0;  j < images[i].width * images[i].height;  j++)
             {
                 *target++ = (((unsigned long) images[i].pixels[j * 4 + 0]) << 16) |
                             (((unsigned long) images[i].pixels[j * 4 + 1]) <<  8) |
@@ -2183,7 +2141,7 @@
                         (unsigned char*) icon,
                         longCount);
 
-        free(icon);
+        _glfw_free(icon);
     }
     else
     {
@@ -2194,7 +2152,7 @@
     XFlush(_glfw.x11.display);
 }
 
-void _glfwPlatformGetWindowPos(_GLFWwindow* window, int* xpos, int* ypos)
+void _glfwGetWindowPosX11(_GLFWwindow* window, int* xpos, int* ypos)
 {
     Window dummy;
     int x, y;
@@ -2208,11 +2166,11 @@
         *ypos = y;
 }
 
-void _glfwPlatformSetWindowPos(_GLFWwindow* window, int xpos, int ypos)
+void _glfwSetWindowPosX11(_GLFWwindow* window, int xpos, int ypos)
 {
     // HACK: Explicitly setting PPosition to any value causes some WMs, notably
     //       Compiz and Metacity, to honor the position of unmapped windows
-    if (!_glfwPlatformWindowVisible(window))
+    if (!_glfwWindowVisibleX11(window))
     {
         long supplied;
         XSizeHints* hints = XAllocSizeHints();
@@ -2232,7 +2190,7 @@
     XFlush(_glfw.x11.display);
 }
 
-void _glfwPlatformGetWindowSize(_GLFWwindow* window, int* width, int* height)
+void _glfwGetWindowSizeX11(_GLFWwindow* window, int* width, int* height)
 {
     XWindowAttributes attribs;
     XGetWindowAttributes(_glfw.x11.display, window->x11.handle, &attribs);
@@ -2243,7 +2201,7 @@
         *height = attribs.height;
 }
 
-void _glfwPlatformSetWindowSize(_GLFWwindow* window, int width, int height)
+void _glfwSetWindowSizeX11(_GLFWwindow* window, int width, int height)
 {
     if (window->monitor)
     {
@@ -2261,32 +2219,32 @@
     XFlush(_glfw.x11.display);
 }
 
-void _glfwPlatformSetWindowSizeLimits(_GLFWwindow* window,
-                                      int minwidth, int minheight,
-                                      int maxwidth, int maxheight)
+void _glfwSetWindowSizeLimitsX11(_GLFWwindow* window,
+                                 int minwidth, int minheight,
+                                 int maxwidth, int maxheight)
 {
     int width, height;
-    _glfwPlatformGetWindowSize(window, &width, &height);
+    _glfwGetWindowSizeX11(window, &width, &height);
     updateNormalHints(window, width, height);
     XFlush(_glfw.x11.display);
 }
 
-void _glfwPlatformSetWindowAspectRatio(_GLFWwindow* window, int numer, int denom)
+void _glfwSetWindowAspectRatioX11(_GLFWwindow* window, int numer, int denom)
 {
     int width, height;
-    _glfwPlatformGetWindowSize(window, &width, &height);
+    _glfwGetWindowSizeX11(window, &width, &height);
     updateNormalHints(window, width, height);
     XFlush(_glfw.x11.display);
 }
 
-void _glfwPlatformGetFramebufferSize(_GLFWwindow* window, int* width, int* height)
+void _glfwGetFramebufferSizeX11(_GLFWwindow* window, int* width, int* height)
 {
-    _glfwPlatformGetWindowSize(window, width, height);
+    _glfwGetWindowSizeX11(window, width, height);
 }
 
-void _glfwPlatformGetWindowFrameSize(_GLFWwindow* window,
-                                     int* left, int* top,
-                                     int* right, int* bottom)
+void _glfwGetWindowFrameSizeX11(_GLFWwindow* window,
+                                int* left, int* top,
+                                int* right, int* bottom)
 {
     long* extents = NULL;
 
@@ -2296,7 +2254,7 @@
     if (_glfw.x11.NET_FRAME_EXTENTS == None)
         return;
 
-    if (!_glfwPlatformWindowVisible(window) &&
+    if (!_glfwWindowVisibleX11(window) &&
         _glfw.x11.NET_REQUEST_FRAME_EXTENTS)
     {
         XEvent event;
@@ -2345,8 +2303,7 @@
         XFree(extents);
 }
 
-void _glfwPlatformGetWindowContentScale(_GLFWwindow* window,
-                                        float* xscale, float* yscale)
+void _glfwGetWindowContentScaleX11(_GLFWwindow* window, float* xscale, float* yscale)
 {
     if (xscale)
         *xscale = _glfw.x11.contentScaleX;
@@ -2354,7 +2311,7 @@
         *yscale = _glfw.x11.contentScaleY;
 }
 
-void _glfwPlatformIconifyWindow(_GLFWwindow* window)
+void _glfwIconifyWindowX11(_GLFWwindow* window)
 {
     if (window->x11.overrideRedirect)
     {
@@ -2369,7 +2326,7 @@
     XFlush(_glfw.x11.display);
 }
 
-void _glfwPlatformRestoreWindow(_GLFWwindow* window)
+void _glfwRestoreWindowX11(_GLFWwindow* window)
 {
     if (window->x11.overrideRedirect)
     {
@@ -2380,12 +2337,12 @@
         return;
     }
 
-    if (_glfwPlatformWindowIconified(window))
+    if (_glfwWindowIconifiedX11(window))
     {
         XMapWindow(_glfw.x11.display, window->x11.handle);
         waitForVisibilityNotify(window);
     }
-    else if (_glfwPlatformWindowVisible(window))
+    else if (_glfwWindowVisibleX11(window))
     {
         if (_glfw.x11.NET_WM_STATE &&
             _glfw.x11.NET_WM_STATE_MAXIMIZED_VERT &&
@@ -2403,7 +2360,7 @@
     XFlush(_glfw.x11.display);
 }
 
-void _glfwPlatformMaximizeWindow(_GLFWwindow* window)
+void _glfwMaximizeWindowX11(_GLFWwindow* window)
 {
     if (!_glfw.x11.NET_WM_STATE ||
         !_glfw.x11.NET_WM_STATE_MAXIMIZED_VERT ||
@@ -2412,7 +2369,7 @@
         return;
     }
 
-    if (_glfwPlatformWindowVisible(window))
+    if (_glfwWindowVisibleX11(window))
     {
         sendEventToWM(window,
                     _glfw.x11.NET_WM_STATE,
@@ -2468,22 +2425,22 @@
     XFlush(_glfw.x11.display);
 }
 
-void _glfwPlatformShowWindow(_GLFWwindow* window)
+void _glfwShowWindowX11(_GLFWwindow* window)
 {
-    if (_glfwPlatformWindowVisible(window))
+    if (_glfwWindowVisibleX11(window))
         return;
 
     XMapWindow(_glfw.x11.display, window->x11.handle);
     waitForVisibilityNotify(window);
 }
 
-void _glfwPlatformHideWindow(_GLFWwindow* window)
+void _glfwHideWindowX11(_GLFWwindow* window)
 {
     XUnmapWindow(_glfw.x11.display, window->x11.handle);
     XFlush(_glfw.x11.display);
 }
 
-void _glfwPlatformRequestWindowAttention(_GLFWwindow* window)
+void _glfwRequestWindowAttentionX11(_GLFWwindow* window)
 {
     if (!_glfw.x11.NET_WM_STATE || !_glfw.x11.NET_WM_STATE_DEMANDS_ATTENTION)
         return;
@@ -2495,11 +2452,11 @@
                   0, 1, 0);
 }
 
-void _glfwPlatformFocusWindow(_GLFWwindow* window)
+void _glfwFocusWindowX11(_GLFWwindow* window)
 {
     if (_glfw.x11.NET_ACTIVE_WINDOW)
         sendEventToWM(window, _glfw.x11.NET_ACTIVE_WINDOW, 1, 0, 0, 0, 0);
-    else if (_glfwPlatformWindowVisible(window))
+    else if (_glfwWindowVisibleX11(window))
     {
         XRaiseWindow(_glfw.x11.display, window->x11.handle);
         XSetInputFocus(_glfw.x11.display, window->x11.handle,
@@ -2509,11 +2466,11 @@
     XFlush(_glfw.x11.display);
 }
 
-void _glfwPlatformSetWindowMonitor(_GLFWwindow* window,
-                                   _GLFWmonitor* monitor,
-                                   int xpos, int ypos,
-                                   int width, int height,
-                                   int refreshRate)
+void _glfwSetWindowMonitorX11(_GLFWwindow* window,
+                              _GLFWmonitor* monitor,
+                              int xpos, int ypos,
+                              int width, int height,
+                              int refreshRate)
 {
     if (window->monitor == monitor)
     {
@@ -2537,8 +2494,8 @@
 
     if (window->monitor)
     {
-        _glfwPlatformSetWindowDecorated(window, window->decorated);
-        _glfwPlatformSetWindowFloating(window, window->floating);
+        _glfwSetWindowDecoratedX11(window, window->decorated);
+        _glfwSetWindowFloatingX11(window, window->floating);
         releaseMonitor(window);
     }
 
@@ -2547,7 +2504,7 @@
 
     if (window->monitor)
     {
-        if (!_glfwPlatformWindowVisible(window))
+        if (!_glfwWindowVisibleX11(window))
         {
             XMapRaised(_glfw.x11.display, window->x11.handle);
             waitForVisibilityNotify(window);
@@ -2566,7 +2523,7 @@
     XFlush(_glfw.x11.display);
 }
 
-int _glfwPlatformWindowFocused(_GLFWwindow* window)
+GLFWbool _glfwWindowFocusedX11(_GLFWwindow* window)
 {
     Window focused;
     int state;
@@ -2575,22 +2532,21 @@
     return window->x11.handle == focused;
 }
 
-int _glfwPlatformWindowIconified(_GLFWwindow* window)
+GLFWbool _glfwWindowIconifiedX11(_GLFWwindow* window)
 {
     return getWindowState(window) == IconicState;
 }
 
-int _glfwPlatformWindowVisible(_GLFWwindow* window)
+GLFWbool _glfwWindowVisibleX11(_GLFWwindow* window)
 {
     XWindowAttributes wa;
     XGetWindowAttributes(_glfw.x11.display, window->x11.handle, &wa);
     return wa.map_state == IsViewable;
 }
 
-int _glfwPlatformWindowMaximized(_GLFWwindow* window)
+GLFWbool _glfwWindowMaximizedX11(_GLFWwindow* window)
 {
     Atom* states;
-    unsigned long i;
     GLFWbool maximized = GLFW_FALSE;
 
     if (!_glfw.x11.NET_WM_STATE ||
@@ -2606,7 +2562,7 @@
                                   XA_ATOM,
                                   (unsigned char**) &states);
 
-    for (i = 0;  i < count;  i++)
+    for (unsigned long i = 0;  i < count;  i++)
     {
         if (states[i] == _glfw.x11.NET_WM_STATE_MAXIMIZED_VERT ||
             states[i] == _glfw.x11.NET_WM_STATE_MAXIMIZED_HORZ)
@@ -2622,7 +2578,7 @@
     return maximized;
 }
 
-int _glfwPlatformWindowHovered(_GLFWwindow* window)
+GLFWbool _glfwWindowHoveredX11(_GLFWwindow* window)
 {
     Window w = _glfw.x11.root;
     while (w)
@@ -2650,7 +2606,7 @@
     return GLFW_FALSE;
 }
 
-int _glfwPlatformFramebufferTransparent(_GLFWwindow* window)
+GLFWbool _glfwFramebufferTransparentX11(_GLFWwindow* window)
 {
     if (!window->x11.transparent)
         return GLFW_FALSE;
@@ -2658,14 +2614,14 @@
     return XGetSelectionOwner(_glfw.x11.display, _glfw.x11.NET_WM_CM_Sx) != None;
 }
 
-void _glfwPlatformSetWindowResizable(_GLFWwindow* window, GLFWbool enabled)
+void _glfwSetWindowResizableX11(_GLFWwindow* window, GLFWbool enabled)
 {
     int width, height;
-    _glfwPlatformGetWindowSize(window, &width, &height);
+    _glfwGetWindowSizeX11(window, &width, &height);
     updateNormalHints(window, width, height);
 }
 
-void _glfwPlatformSetWindowDecorated(_GLFWwindow* window, GLFWbool enabled)
+void _glfwSetWindowDecoratedX11(_GLFWwindow* window, GLFWbool enabled)
 {
     struct
     {
@@ -2687,12 +2643,12 @@
                     sizeof(hints) / sizeof(long));
 }
 
-void _glfwPlatformSetWindowFloating(_GLFWwindow* window, GLFWbool enabled)
+void _glfwSetWindowFloatingX11(_GLFWwindow* window, GLFWbool enabled)
 {
     if (!_glfw.x11.NET_WM_STATE || !_glfw.x11.NET_WM_STATE_ABOVE)
         return;
 
-    if (_glfwPlatformWindowVisible(window))
+    if (_glfwWindowVisibleX11(window))
     {
         const long action = enabled ? _NET_WM_STATE_ADD : _NET_WM_STATE_REMOVE;
         sendEventToWM(window,
@@ -2704,18 +2660,19 @@
     else
     {
         Atom* states = NULL;
-        unsigned long i, count;
-
-        count = _glfwGetWindowPropertyX11(window->x11.handle,
-                                          _glfw.x11.NET_WM_STATE,
-                                          XA_ATOM,
-                                          (unsigned char**) &states);
+        const unsigned long count =
+            _glfwGetWindowPropertyX11(window->x11.handle,
+                                      _glfw.x11.NET_WM_STATE,
+                                      XA_ATOM,
+                                      (unsigned char**) &states);
 
         // NOTE: We don't check for failure as this property may not exist yet
         //       and that's fine (and we'll create it implicitly with append)
 
         if (enabled)
         {
+            unsigned long i;
+
             for (i = 0;  i < count;  i++)
             {
                 if (states[i] == _glfw.x11.NET_WM_STATE_ABOVE)
@@ -2733,20 +2690,16 @@
         }
         else if (states)
         {
-            for (i = 0;  i < count;  i++)
+            for (unsigned long i = 0;  i < count;  i++)
             {
                 if (states[i] == _glfw.x11.NET_WM_STATE_ABOVE)
+                {
+                    states[i] = states[count - 1];
+                    XChangeProperty(_glfw.x11.display, window->x11.handle,
+                                    _glfw.x11.NET_WM_STATE, XA_ATOM, 32,
+                                    PropModeReplace, (unsigned char*) states, count - 1);
                     break;
-            }
-
-            if (i < count)
-            {
-                states[i] = states[count - 1];
-                count--;
-
-                XChangeProperty(_glfw.x11.display, window->x11.handle,
-                                _glfw.x11.NET_WM_STATE, XA_ATOM, 32,
-                                PropModeReplace, (unsigned char*) states, count);
+                }
             }
         }
 
@@ -2757,7 +2710,26 @@
     XFlush(_glfw.x11.display);
 }
 
-float _glfwPlatformGetWindowOpacity(_GLFWwindow* window)
+void _glfwSetWindowMousePassthroughX11(_GLFWwindow* window, GLFWbool enabled)
+{
+    if (!_glfw.x11.xshape.available)
+        return;
+
+    if (enabled)
+    {
+        Region region = XCreateRegion();
+        XShapeCombineRegion(_glfw.x11.display, window->x11.handle,
+                            ShapeInput, 0, 0, region, ShapeSet);
+        XDestroyRegion(region);
+    }
+    else
+    {
+        XShapeCombineMask(_glfw.x11.display, window->x11.handle,
+                          ShapeInput, 0, 0, None, ShapeSet);
+    }
+}
+
+float _glfwGetWindowOpacityX11(_GLFWwindow* window)
 {
     float opacity = 1.f;
 
@@ -2780,7 +2752,7 @@
     return opacity;
 }
 
-void _glfwPlatformSetWindowOpacity(_GLFWwindow* window, float opacity)
+void _glfwSetWindowOpacityX11(_GLFWwindow* window, float opacity)
 {
     const CARD32 value = (CARD32) (0xffffffffu * (double) opacity);
     XChangeProperty(_glfw.x11.display, window->x11.handle,
@@ -2788,7 +2760,7 @@
                     PropModeReplace, (unsigned char*) &value, 1);
 }
 
-void _glfwPlatformSetRawMouseMotion(_GLFWwindow *window, GLFWbool enabled)
+void _glfwSetRawMouseMotionX11(_GLFWwindow *window, GLFWbool enabled)
 {
     if (!_glfw.x11.xi.available)
         return;
@@ -2802,21 +2774,22 @@
         disableRawMouseMotion(window);
 }
 
-GLFWbool _glfwPlatformRawMouseMotionSupported(void)
+GLFWbool _glfwRawMouseMotionSupportedX11(void)
 {
     return _glfw.x11.xi.available;
 }
 
-void _glfwPlatformPollEvents(void)
+void _glfwPollEventsX11(void)
 {
     drainEmptyEvents();
 
-#if defined(__linux__)
-    _glfwDetectJoystickConnectionLinux();
+#if defined(GLFW_BUILD_LINUX_JOYSTICK)
+    if (_glfw.joysticksInitialized)
+        _glfwDetectJoystickConnectionLinux();
 #endif
     XPending(_glfw.x11.display);
 
-    while (XQLength(_glfw.x11.display))
+    while (QLength(_glfw.x11.display))
     {
         XEvent event;
         XNextEvent(_glfw.x11.display, &event);
@@ -2827,38 +2800,38 @@
     if (window)
     {
         int width, height;
-        _glfwPlatformGetWindowSize(window, &width, &height);
+        _glfwGetWindowSizeX11(window, &width, &height);
 
         // NOTE: Re-center the cursor only if it has moved since the last call,
         //       to avoid breaking glfwWaitEvents with MotionNotify
         if (window->x11.lastCursorPosX != width / 2 ||
             window->x11.lastCursorPosY != height / 2)
         {
-            _glfwPlatformSetCursorPos(window, width / 2, height / 2);
+            _glfwSetCursorPosX11(window, width / 2, height / 2);
         }
     }
 
     XFlush(_glfw.x11.display);
 }
 
-void _glfwPlatformWaitEvents(void)
+void _glfwWaitEventsX11(void)
 {
     waitForAnyEvent(NULL);
-    _glfwPlatformPollEvents();
+    _glfwPollEventsX11();
 }
 
-void _glfwPlatformWaitEventsTimeout(double timeout)
+void _glfwWaitEventsTimeoutX11(double timeout)
 {
     waitForAnyEvent(&timeout);
-    _glfwPlatformPollEvents();
+    _glfwPollEventsX11();
 }
 
-void _glfwPlatformPostEmptyEvent(void)
+void _glfwPostEmptyEventX11(void)
 {
     writeEmptyEvent();
 }
 
-void _glfwPlatformGetCursorPos(_GLFWwindow* window, double* xpos, double* ypos)
+void _glfwGetCursorPosX11(_GLFWwindow* window, double* xpos, double* ypos)
 {
     Window root, child;
     int rootX, rootY, childX, childY;
@@ -2875,7 +2848,7 @@
         *ypos = childY;
 }
 
-void _glfwPlatformSetCursorPos(_GLFWwindow* window, double x, double y)
+void _glfwSetCursorPosX11(_GLFWwindow* window, double x, double y)
 {
     // Store the new position so it can be recognized later
     window->x11.warpCursorPosX = (int) x;
@@ -2886,15 +2859,15 @@
     XFlush(_glfw.x11.display);
 }
 
-void _glfwPlatformSetCursorMode(_GLFWwindow* window, int mode)
+void _glfwSetCursorModeX11(_GLFWwindow* window, int mode)
 {
-    if (_glfwPlatformWindowFocused(window))
+    if (_glfwWindowFocusedX11(window))
     {
         if (mode == GLFW_CURSOR_DISABLED)
         {
-            _glfwPlatformGetCursorPos(window,
-                                      &_glfw.x11.restoreCursorPosX,
-                                      &_glfw.x11.restoreCursorPosY);
+            _glfwGetCursorPosX11(window,
+                                 &_glfw.x11.restoreCursorPosX,
+                                 &_glfw.x11.restoreCursorPosY);
             _glfwCenterCursorInContentArea(window);
             if (window->rawMouseMotion)
                 enableRawMouseMotion(window);
@@ -2905,7 +2878,7 @@
                 disableRawMouseMotion(window);
         }
 
-        if (mode == GLFW_CURSOR_DISABLED)
+        if (mode == GLFW_CURSOR_DISABLED || mode == GLFW_CURSOR_CAPTURED)
             captureCursor(window);
         else
             releaseCursor();
@@ -2915,9 +2888,9 @@
         else if (_glfw.x11.disabledCursorWindow == window)
         {
             _glfw.x11.disabledCursorWindow = NULL;
-            _glfwPlatformSetCursorPos(window,
-                                      _glfw.x11.restoreCursorPosX,
-                                      _glfw.x11.restoreCursorPosY);
+            _glfwSetCursorPosX11(window,
+                                 _glfw.x11.restoreCursorPosX,
+                                 _glfw.x11.restoreCursorPosY);
         }
     }
 
@@ -2925,7 +2898,7 @@
     XFlush(_glfw.x11.display);
 }
 
-const char* _glfwPlatformGetScancodeName(int scancode)
+const char* _glfwGetScancodeNameX11(int scancode)
 {
     if (!_glfw.x11.xkb.available)
         return NULL;
@@ -2957,71 +2930,140 @@
     return _glfw.x11.keynames[key];
 }
 
-int _glfwPlatformGetKeyScancode(int key)
+int _glfwGetKeyScancodeX11(int key)
 {
     return _glfw.x11.scancodes[key];
 }
 
-int _glfwPlatformCreateCursor(_GLFWcursor* cursor,
+GLFWbool _glfwCreateCursorX11(_GLFWcursor* cursor,
                               const GLFWimage* image,
                               int xhot, int yhot)
 {
-    cursor->x11.handle = _glfwCreateCursorX11(image, xhot, yhot);
+    cursor->x11.handle = _glfwCreateNativeCursorX11(image, xhot, yhot);
     if (!cursor->x11.handle)
         return GLFW_FALSE;
 
     return GLFW_TRUE;
 }
 
-int _glfwPlatformCreateStandardCursor(_GLFWcursor* cursor, int shape)
+GLFWbool _glfwCreateStandardCursorX11(_GLFWcursor* cursor, int shape)
 {
-    int native = 0;
+    if (_glfw.x11.xcursor.handle)
+    {
+        char* theme = XcursorGetTheme(_glfw.x11.display);
+        if (theme)
+        {
+            const int size = XcursorGetDefaultSize(_glfw.x11.display);
+            const char* name = NULL;
 
-    if (shape == GLFW_ARROW_CURSOR)
-        native = XC_left_ptr;
-    else if (shape == GLFW_IBEAM_CURSOR)
-        native = XC_xterm;
-    else if (shape == GLFW_CROSSHAIR_CURSOR)
-        native = XC_crosshair;
-    else if (shape == GLFW_HAND_CURSOR)
-        native = XC_hand2;
-    else if (shape == GLFW_HRESIZE_CURSOR)
-        native = XC_sb_h_double_arrow;
-    else if (shape == GLFW_VRESIZE_CURSOR)
-        native = XC_sb_v_double_arrow;
-    else
-        return GLFW_FALSE;
+            switch (shape)
+            {
+                case GLFW_ARROW_CURSOR:
+                    name = "default";
+                    break;
+                case GLFW_IBEAM_CURSOR:
+                    name = "text";
+                    break;
+                case GLFW_CROSSHAIR_CURSOR:
+                    name = "crosshair";
+                    break;
+                case GLFW_POINTING_HAND_CURSOR:
+                    name = "pointer";
+                    break;
+                case GLFW_RESIZE_EW_CURSOR:
+                    name = "ew-resize";
+                    break;
+                case GLFW_RESIZE_NS_CURSOR:
+                    name = "ns-resize";
+                    break;
+                case GLFW_RESIZE_NWSE_CURSOR:
+                    name = "nwse-resize";
+                    break;
+                case GLFW_RESIZE_NESW_CURSOR:
+                    name = "nesw-resize";
+                    break;
+                case GLFW_RESIZE_ALL_CURSOR:
+                    name = "all-scroll";
+                    break;
+                case GLFW_NOT_ALLOWED_CURSOR:
+                    name = "not-allowed";
+                    break;
+            }
 
-    cursor->x11.handle = XCreateFontCursor(_glfw.x11.display, native);
+            XcursorImage* image = XcursorLibraryLoadImage(name, theme, size);
+            if (image)
+            {
+                cursor->x11.handle = XcursorImageLoadCursor(_glfw.x11.display, image);
+                XcursorImageDestroy(image);
+            }
+        }
+    }
+
     if (!cursor->x11.handle)
     {
-        _glfwInputError(GLFW_PLATFORM_ERROR,
-                        "X11: Failed to create standard cursor");
-        return GLFW_FALSE;
+        unsigned int native = 0;
+
+        switch (shape)
+        {
+            case GLFW_ARROW_CURSOR:
+                native = XC_left_ptr;
+                break;
+            case GLFW_IBEAM_CURSOR:
+                native = XC_xterm;
+                break;
+            case GLFW_CROSSHAIR_CURSOR:
+                native = XC_crosshair;
+                break;
+            case GLFW_POINTING_HAND_CURSOR:
+                native = XC_hand2;
+                break;
+            case GLFW_RESIZE_EW_CURSOR:
+                native = XC_sb_h_double_arrow;
+                break;
+            case GLFW_RESIZE_NS_CURSOR:
+                native = XC_sb_v_double_arrow;
+                break;
+            case GLFW_RESIZE_ALL_CURSOR:
+                native = XC_fleur;
+                break;
+            default:
+                _glfwInputError(GLFW_CURSOR_UNAVAILABLE,
+                                "X11: Standard cursor shape unavailable");
+                return GLFW_FALSE;
+        }
+
+        cursor->x11.handle = XCreateFontCursor(_glfw.x11.display, native);
+        if (!cursor->x11.handle)
+        {
+            _glfwInputError(GLFW_PLATFORM_ERROR,
+                            "X11: Failed to create standard cursor");
+            return GLFW_FALSE;
+        }
     }
 
     return GLFW_TRUE;
 }
 
-void _glfwPlatformDestroyCursor(_GLFWcursor* cursor)
+void _glfwDestroyCursorX11(_GLFWcursor* cursor)
 {
     if (cursor->x11.handle)
         XFreeCursor(_glfw.x11.display, cursor->x11.handle);
 }
 
-void _glfwPlatformSetCursor(_GLFWwindow* window, _GLFWcursor* cursor)
+void _glfwSetCursorX11(_GLFWwindow* window, _GLFWcursor* cursor)
 {
-    if (window->cursorMode == GLFW_CURSOR_NORMAL)
+    if (window->cursorMode == GLFW_CURSOR_NORMAL ||
+        window->cursorMode == GLFW_CURSOR_CAPTURED)
     {
         updateCursorImage(window);
         XFlush(_glfw.x11.display);
     }
 }
 
-void _glfwPlatformSetClipboardString(const char* string)
+void _glfwSetClipboardStringX11(const char* string)
 {
     char* copy = _glfw_strdup(string);
-    free(_glfw.x11.clipboardString);
+    _glfw_free(_glfw.x11.clipboardString);
     _glfw.x11.clipboardString = copy;
 
     XSetSelectionOwner(_glfw.x11.display,
@@ -3037,12 +3079,61 @@
     }
 }
 
-const char* _glfwPlatformGetClipboardString(void)
+const char* _glfwGetClipboardStringX11(void)
 {
     return getSelectionString(_glfw.x11.CLIPBOARD);
 }
 
-void _glfwPlatformGetRequiredInstanceExtensions(char** extensions)
+EGLenum _glfwGetEGLPlatformX11(EGLint** attribs)
+{
+    if (_glfw.egl.ANGLE_platform_angle)
+    {
+        int type = 0;
+
+        if (_glfw.egl.ANGLE_platform_angle_opengl)
+        {
+            if (_glfw.hints.init.angleType == GLFW_ANGLE_PLATFORM_TYPE_OPENGL)
+                type = EGL_PLATFORM_ANGLE_TYPE_OPENGL_ANGLE;
+        }
+
+        if (_glfw.egl.ANGLE_platform_angle_vulkan)
+        {
+            if (_glfw.hints.init.angleType == GLFW_ANGLE_PLATFORM_TYPE_VULKAN)
+                type = EGL_PLATFORM_ANGLE_TYPE_VULKAN_ANGLE;
+        }
+
+        if (type)
+        {
+            *attribs = _glfw_calloc(5, sizeof(EGLint));
+            (*attribs)[0] = EGL_PLATFORM_ANGLE_TYPE_ANGLE;
+            (*attribs)[1] = type;
+            (*attribs)[2] = EGL_PLATFORM_ANGLE_NATIVE_PLATFORM_TYPE_ANGLE;
+            (*attribs)[3] = EGL_PLATFORM_X11_EXT;
+            (*attribs)[4] = EGL_NONE;
+            return EGL_PLATFORM_ANGLE_ANGLE;
+        }
+    }
+
+    if (_glfw.egl.EXT_platform_base && _glfw.egl.EXT_platform_x11)
+        return EGL_PLATFORM_X11_EXT;
+
+    return 0;
+}
+
+EGLNativeDisplayType _glfwGetEGLNativeDisplayX11(void)
+{
+    return _glfw.x11.display;
+}
+
+EGLNativeWindowType _glfwGetEGLNativeWindowX11(_GLFWwindow* window)
+{
+    if (_glfw.egl.platform)
+        return &window->x11.handle;
+    else
+        return (EGLNativeWindowType) window->x11.handle;
+}
+
+void _glfwGetRequiredInstanceExtensionsX11(char** extensions)
 {
     if (!_glfw.vk.KHR_surface)
         return;
@@ -3063,7 +3154,7 @@
         extensions[1] = "VK_KHR_xlib_surface";
 }
 
-int _glfwPlatformGetPhysicalDevicePresentationSupport(VkInstance instance,
+GLFWbool _glfwGetPhysicalDevicePresentationSupportX11(VkInstance instance,
                                                       VkPhysicalDevice device,
                                                       uint32_t queuefamily)
 {
@@ -3116,10 +3207,10 @@
     }
 }
 
-VkResult _glfwPlatformCreateWindowSurface(VkInstance instance,
-                                          _GLFWwindow* window,
-                                          const VkAllocationCallbacks* allocator,
-                                          VkSurfaceKHR* surface)
+VkResult _glfwCreateWindowSurfaceX11(VkInstance instance,
+                                     _GLFWwindow* window,
+                                     const VkAllocationCallbacks* allocator,
+                                     VkSurfaceKHR* surface)
 {
     if (_glfw.vk.KHR_xcb_surface && _glfw.x11.x11xcb.handle)
     {
@@ -3199,6 +3290,13 @@
 GLFWAPI Display* glfwGetX11Display(void)
 {
     _GLFW_REQUIRE_INIT_OR_RETURN(NULL);
+
+    if (_glfw.platform.platformID != GLFW_PLATFORM_X11)
+    {
+        _glfwInputError(GLFW_PLATFORM_UNAVAILABLE, "X11: Platform not initialized");
+        return NULL;
+    }
+
     return _glfw.x11.display;
 }
 
@@ -3206,6 +3304,13 @@
 {
     _GLFWwindow* window = (_GLFWwindow*) handle;
     _GLFW_REQUIRE_INIT_OR_RETURN(None);
+
+    if (_glfw.platform.platformID != GLFW_PLATFORM_X11)
+    {
+        _glfwInputError(GLFW_PLATFORM_UNAVAILABLE, "X11: Platform not initialized");
+        return None;
+    }
+
     return window->x11.handle;
 }
 
@@ -3213,7 +3318,13 @@
 {
     _GLFW_REQUIRE_INIT();
 
-    free(_glfw.x11.primarySelectionString);
+    if (_glfw.platform.platformID != GLFW_PLATFORM_X11)
+    {
+        _glfwInputError(GLFW_PLATFORM_UNAVAILABLE, "X11: Platform not initialized");
+        return;
+    }
+
+    _glfw_free(_glfw.x11.primarySelectionString);
     _glfw.x11.primarySelectionString = _glfw_strdup(string);
 
     XSetSelectionOwner(_glfw.x11.display,
@@ -3232,6 +3343,15 @@
 GLFWAPI const char* glfwGetX11SelectionString(void)
 {
     _GLFW_REQUIRE_INIT_OR_RETURN(NULL);
+
+    if (_glfw.platform.platformID != GLFW_PLATFORM_X11)
+    {
+        _glfwInputError(GLFW_PLATFORM_UNAVAILABLE, "X11: Platform not initialized");
+        return NULL;
+    }
+
     return getSelectionString(_glfw.x11.PRIMARY);
 }
 
+#endif // _GLFW_X11
+
diff --git a/src/xkb_unicode.c b/src/xkb_unicode.c
index 859bedc..6b8dfca 100644
--- a/src/xkb_unicode.c
+++ b/src/xkb_unicode.c
@@ -1,5 +1,5 @@
 //========================================================================
-// GLFW 3.3 X11 - www.glfw.org
+// GLFW 3.4 X11 - www.glfw.org
 //------------------------------------------------------------------------
 // Copyright (c) 2002-2006 Marcus Geelnard
 // Copyright (c) 2006-2017 Camilla Löwy <elmindreda@glfw.org>
@@ -24,11 +24,10 @@
 //    distribution.
 //
 //========================================================================
-// It is fine to use C99 in this file because it will not be built with VS
-//========================================================================
 
 #include "internal.h"
 
+#if defined(_GLFW_X11) || defined(_GLFW_WAYLAND)
 
 /*
  * Marcus: This code was originally written by Markus G. Kuhn.
@@ -940,3 +939,5 @@
     return GLFW_INVALID_CODEPOINT;
 }
 
+#endif // _GLFW_WAYLAND or _GLFW_X11
+
diff --git a/src/xkb_unicode.h b/src/xkb_unicode.h
index be97cdc..b07408f 100644
--- a/src/xkb_unicode.h
+++ b/src/xkb_unicode.h
@@ -1,5 +1,5 @@
 //========================================================================
-// GLFW 3.3 Linux - www.glfw.org
+// GLFW 3.4 Linux - www.glfw.org
 //------------------------------------------------------------------------
 // Copyright (c) 2014 Jonas Ådahl <jadahl@gmail.com>
 //
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 91374b2..f81cfeb 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -12,26 +12,14 @@
     add_definitions(-D_CRT_SECURE_NO_WARNINGS)
 endif()
 
-set(GLAD_GL "${GLFW_SOURCE_DIR}/deps/glad/gl.h"
-            "${GLFW_SOURCE_DIR}/deps/glad_gl.c")
-set(GLAD_VULKAN "${GLFW_SOURCE_DIR}/deps/glad/vulkan.h"
-                "${GLFW_SOURCE_DIR}/deps/glad_vulkan.c")
+set(GLAD_GL "${GLFW_SOURCE_DIR}/deps/glad/gl.h")
+set(GLAD_VULKAN "${GLFW_SOURCE_DIR}/deps/glad/vulkan.h")
 set(GETOPT "${GLFW_SOURCE_DIR}/deps/getopt.h"
            "${GLFW_SOURCE_DIR}/deps/getopt.c")
 set(TINYCTHREAD "${GLFW_SOURCE_DIR}/deps/tinycthread.h"
                 "${GLFW_SOURCE_DIR}/deps/tinycthread.c")
 
-if (${CMAKE_VERSION} VERSION_EQUAL "3.1.0" OR
-    ${CMAKE_VERSION} VERSION_GREATER "3.1.0")
-    set(CMAKE_C_STANDARD 99)
-else()
-    # Remove this fallback when removing support for CMake version less than 3.1
-    add_compile_options("$<$<C_COMPILER_ID:AppleClang>:-std=c99>"
-                        "$<$<C_COMPILER_ID:Clang>:-std=c99>"
-                        "$<$<C_COMPILER_ID:GNU>:-std=c99>")
-
-endif()
-
+add_executable(allocator allocator.c ${GLAD_GL})
 add_executable(clipboard clipboard.c ${GETOPT} ${GLAD_GL})
 add_executable(events events.c ${GETOPT} ${GLAD_GL})
 add_executable(msaa msaa.c ${GETOPT} ${GLAD_GL})
@@ -46,27 +34,27 @@
 add_executable(icon WIN32 MACOSX_BUNDLE icon.c ${GLAD_GL})
 add_executable(inputlag WIN32 MACOSX_BUNDLE inputlag.c ${GETOPT} ${GLAD_GL})
 add_executable(joysticks WIN32 MACOSX_BUNDLE joysticks.c ${GLAD_GL})
-add_executable(opacity WIN32 MACOSX_BUNDLE opacity.c ${GLAD_GL})
 add_executable(tearing WIN32 MACOSX_BUNDLE tearing.c ${GLAD_GL})
 add_executable(threads WIN32 MACOSX_BUNDLE threads.c ${TINYCTHREAD} ${GLAD_GL})
 add_executable(timeout WIN32 MACOSX_BUNDLE timeout.c ${GLAD_GL})
 add_executable(title WIN32 MACOSX_BUNDLE title.c ${GLAD_GL})
 add_executable(triangle-vulkan WIN32 triangle-vulkan.c ${GLAD_VULKAN})
-add_executable(windows WIN32 MACOSX_BUNDLE windows.c ${GETOPT} ${GLAD_GL})
+add_executable(window WIN32 MACOSX_BUNDLE window.c ${GLAD_GL})
 
-target_link_libraries(empty "${CMAKE_THREAD_LIBS_INIT}")
-target_link_libraries(threads "${CMAKE_THREAD_LIBS_INIT}")
+target_link_libraries(empty Threads::Threads)
+target_link_libraries(threads Threads::Threads)
 if (RT_LIBRARY)
     target_link_libraries(empty "${RT_LIBRARY}")
     target_link_libraries(threads "${RT_LIBRARY}")
 endif()
 
-set(GUI_ONLY_BINARIES empty gamma icon inputlag joysticks opacity tearing
-    threads timeout title triangle-vulkan windows)
-set(CONSOLE_BINARIES clipboard events msaa glfwinfo iconify monitors reopen
-                     cursor)
+set(GUI_ONLY_BINARIES empty gamma icon inputlag joysticks tearing threads
+    timeout title triangle-vulkan window)
+set(CONSOLE_BINARIES allocator clipboard events msaa glfwinfo iconify monitors
+    reopen cursor)
 
 set_target_properties(${GUI_ONLY_BINARIES} ${CONSOLE_BINARIES} PROPERTIES
+                      C_STANDARD 99
                       FOLDER "GLFW3/Tests")
 
 if (MSVC)
@@ -84,16 +72,15 @@
     set_target_properties(gamma PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Gamma")
     set_target_properties(inputlag PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Input Lag")
     set_target_properties(joysticks PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Joysticks")
-    set_target_properties(opacity PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Opacity")
     set_target_properties(tearing PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Tearing")
     set_target_properties(threads PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Threads")
     set_target_properties(timeout PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Timeout")
     set_target_properties(title PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Title")
-    set_target_properties(windows PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Windows")
+    set_target_properties(window PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Window")
 
     set_target_properties(${GUI_ONLY_BINARIES} PROPERTIES
                           MACOSX_BUNDLE_SHORT_VERSION_STRING ${GLFW_VERSION}
                           MACOSX_BUNDLE_LONG_VERSION_STRING ${GLFW_VERSION}
-                          MACOSX_BUNDLE_INFO_PLIST "${GLFW_SOURCE_DIR}/CMake/MacOSXBundleInfo.plist.in")
+                          MACOSX_BUNDLE_INFO_PLIST "${GLFW_SOURCE_DIR}/CMake/Info.plist.in")
 endif()
 
diff --git a/tests/allocator.c b/tests/allocator.c
new file mode 100644
index 0000000..3fb004d
--- /dev/null
+++ b/tests/allocator.c
@@ -0,0 +1,142 @@
+//========================================================================
+// Custom heap allocator test
+// Copyright (c) Camilla Löwy <elmindreda@glfw.org>
+//
+// 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 GLAD_GL_IMPLEMENTATION
+#include <glad/gl.h>
+#define GLFW_INCLUDE_NONE
+#include <GLFW/glfw3.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <assert.h>
+
+#define CALL(x) (function_name = #x, x)
+static const char* function_name = NULL;
+
+struct allocator_stats
+{
+    size_t total;
+    size_t current;
+    size_t maximum;
+};
+
+static void error_callback(int error, const char* description)
+{
+    fprintf(stderr, "Error: %s\n", description);
+}
+
+static void* allocate(size_t size, void* user)
+{
+    struct allocator_stats* stats = user;
+    assert(size > 0);
+
+    stats->total += size;
+    stats->current += size;
+    if (stats->current > stats->maximum)
+        stats->maximum = stats->current;
+
+    printf("%s: allocate %zu bytes (current %zu maximum %zu total %zu)\n",
+           function_name, size, stats->current, stats->maximum, stats->total);
+
+    size_t* real_block = malloc(size + sizeof(size_t));
+    assert(real_block != NULL);
+    *real_block = size;
+    return real_block + 1;
+}
+
+static void deallocate(void* block, void* user)
+{
+    struct allocator_stats* stats = user;
+    assert(block != NULL);
+
+    size_t* real_block = (size_t*) block - 1;
+    stats->current -= *real_block;
+
+    printf("%s: deallocate %zu bytes (current %zu maximum %zu total %zu)\n",
+           function_name, *real_block, stats->current, stats->maximum, stats->total);
+
+    free(real_block);
+}
+
+static void* reallocate(void* block, size_t size, void* user)
+{
+    struct allocator_stats* stats = user;
+    assert(block != NULL);
+    assert(size > 0);
+
+    size_t* real_block = (size_t*) block - 1;
+    stats->total += size;
+    stats->current += size - *real_block;
+    if (stats->current > stats->maximum)
+        stats->maximum = stats->current;
+
+    printf("%s: reallocate %zu bytes to %zu bytes (current %zu maximum %zu total %zu)\n",
+           function_name, *real_block, size, stats->current, stats->maximum, stats->total);
+
+    real_block = realloc(real_block, size + sizeof(size_t));
+    assert(real_block != NULL);
+    *real_block = size;
+    return real_block + 1;
+}
+
+int main(void)
+{
+    struct allocator_stats stats = {0};
+    const GLFWallocator allocator =
+    {
+        .allocate = allocate,
+        .deallocate = deallocate,
+        .reallocate = reallocate,
+        .user = &stats
+    };
+
+    glfwSetErrorCallback(error_callback);
+    glfwInitAllocator(&allocator);
+
+    if (!CALL(glfwInit)())
+        exit(EXIT_FAILURE);
+
+    GLFWwindow* window = CALL(glfwCreateWindow)(400, 400, "Custom allocator test", NULL, NULL);
+    if (!window)
+    {
+        glfwTerminate();
+        exit(EXIT_FAILURE);
+    }
+
+    CALL(glfwMakeContextCurrent)(window);
+    gladLoadGL(glfwGetProcAddress);
+    CALL(glfwSwapInterval)(1);
+
+    while (!CALL(glfwWindowShouldClose)(window))
+    {
+        glClear(GL_COLOR_BUFFER_BIT);
+        CALL(glfwSwapBuffers)(window);
+        CALL(glfwWaitEvents)();
+    }
+
+    CALL(glfwTerminate)();
+    exit(EXIT_SUCCESS);
+}
+
diff --git a/tests/clipboard.c b/tests/clipboard.c
index 41454a3..eaad516 100644
--- a/tests/clipboard.c
+++ b/tests/clipboard.c
@@ -27,6 +27,7 @@
 //
 //========================================================================
 
+#define GLAD_GL_IMPLEMENTATION
 #include <glad/gl.h>
 #define GLFW_INCLUDE_NONE
 #include <GLFW/glfw3.h>
diff --git a/tests/cursor.c b/tests/cursor.c
index b6288f6..37f3299 100644
--- a/tests/cursor.c
+++ b/tests/cursor.c
@@ -30,6 +30,7 @@
 //
 //========================================================================
 
+#define GLAD_GL_IMPLEMENTATION
 #include <glad/gl.h>
 #define GLFW_INCLUDE_NONE
 #include <GLFW/glfw3.h>
@@ -69,7 +70,7 @@
 static int wait_events = GLFW_TRUE;
 static int animate_cursor = GLFW_FALSE;
 static int track_cursor = GLFW_FALSE;
-static GLFWcursor* standard_cursors[6];
+static GLFWcursor* standard_cursors[10];
 static GLFWcursor* tracking_cursor = NULL;
 
 static void error_callback(int error, const char* description)
@@ -171,7 +172,8 @@
 
         case GLFW_KEY_ESCAPE:
         {
-            if (glfwGetInputMode(window, GLFW_CURSOR) != GLFW_CURSOR_DISABLED)
+            const int mode = glfwGetInputMode(window, GLFW_CURSOR);
+            if (mode != GLFW_CURSOR_DISABLED && mode != GLFW_CURSOR_CAPTURED)
             {
                 glfwSetWindowShouldClose(window, GLFW_TRUE);
                 break;
@@ -196,6 +198,11 @@
             printf("(( cursor is hidden ))\n");
             break;
 
+        case GLFW_KEY_C:
+            glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_CAPTURED);
+            printf("(( cursor is captured ))\n");
+            break;
+
         case GLFW_KEY_R:
             if (!glfwRawMouseMotionSupported())
                 break;
@@ -271,28 +278,24 @@
             break;
 
         case GLFW_KEY_1:
-            glfwSetCursor(window, standard_cursors[0]);
-            break;
-
         case GLFW_KEY_2:
-            glfwSetCursor(window, standard_cursors[1]);
-            break;
-
         case GLFW_KEY_3:
-            glfwSetCursor(window, standard_cursors[2]);
-            break;
-
         case GLFW_KEY_4:
-            glfwSetCursor(window, standard_cursors[3]);
-            break;
-
         case GLFW_KEY_5:
-            glfwSetCursor(window, standard_cursors[4]);
-            break;
-
         case GLFW_KEY_6:
-            glfwSetCursor(window, standard_cursors[5]);
+        case GLFW_KEY_7:
+        case GLFW_KEY_8:
+        case GLFW_KEY_9:
+        {
+            int index = key - GLFW_KEY_1;
+            if (mods & GLFW_MOD_SHIFT)
+                index += 9;
+
+            if (index < sizeof(standard_cursors) / sizeof(standard_cursors[0]))
+                glfwSetCursor(window, standard_cursors[index]);
+
             break;
+        }
 
         case GLFW_KEY_F11:
         case GLFW_KEY_ENTER:
@@ -358,17 +361,16 @@
             GLFW_ARROW_CURSOR,
             GLFW_IBEAM_CURSOR,
             GLFW_CROSSHAIR_CURSOR,
-            GLFW_HAND_CURSOR,
-            GLFW_HRESIZE_CURSOR,
-            GLFW_VRESIZE_CURSOR
+            GLFW_POINTING_HAND_CURSOR,
+            GLFW_RESIZE_EW_CURSOR,
+            GLFW_RESIZE_NS_CURSOR,
+            GLFW_RESIZE_NWSE_CURSOR,
+            GLFW_RESIZE_NESW_CURSOR,
+            GLFW_RESIZE_ALL_CURSOR,
+            GLFW_NOT_ALLOWED_CURSOR
         };
 
         standard_cursors[i] = glfwCreateStandardCursor(shapes[i]);
-        if (!standard_cursors[i])
-        {
-            glfwTerminate();
-            exit(EXIT_FAILURE);
-        }
     }
 
     glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 2);
diff --git a/tests/empty.c b/tests/empty.c
index c3877a7..72caccb 100644
--- a/tests/empty.c
+++ b/tests/empty.c
@@ -29,6 +29,7 @@
 
 #include "tinycthread.h"
 
+#define GLAD_GL_IMPLEMENTATION
 #include <glad/gl.h>
 #define GLFW_INCLUDE_NONE
 #include <GLFW/glfw3.h>
diff --git a/tests/events.c b/tests/events.c
index 455f886..fdc3c19 100644
--- a/tests/events.c
+++ b/tests/events.c
@@ -31,6 +31,7 @@
 //
 //========================================================================
 
+#define GLAD_GL_IMPLEMENTATION
 #include <glad/gl.h>
 #define GLFW_INCLUDE_NONE
 #include <GLFW/glfw3.h>
@@ -320,6 +321,12 @@
     printf("%08x to %i at %0.3f: Window close\n",
            counter++, slot->number, glfwGetTime());
 
+    if (!slot->closeable)
+    {
+        printf("(( closing is disabled, press %s to re-enable )\n",
+               glfwGetKeyName(GLFW_KEY_C, 0));
+    }
+
     glfwSetWindowShouldClose(window, slot->closeable);
 }
 
@@ -513,6 +520,20 @@
                axisCount,
                buttonCount,
                hatCount);
+
+        if (glfwJoystickIsGamepad(jid))
+        {
+            printf("  Joystick %i (%s) has a gamepad mapping (%s)\n",
+                   jid,
+                   glfwGetJoystickGUID(jid),
+                   glfwGetGamepadName(jid));
+        }
+        else
+        {
+            printf("  Joystick %i (%s) has no gamepad mapping\n",
+                   jid,
+                   glfwGetJoystickGUID(jid));
+        }
     }
     else
     {
diff --git a/tests/gamma.c b/tests/gamma.c
index 7419592..d1f6dc2 100644
--- a/tests/gamma.c
+++ b/tests/gamma.c
@@ -28,6 +28,7 @@
 //
 //========================================================================
 
+#define GLAD_GL_IMPLEMENTATION
 #include <glad/gl.h>
 #define GLFW_INCLUDE_NONE
 #include <GLFW/glfw3.h>
@@ -101,6 +102,7 @@
     monitor = glfwGetPrimaryMonitor();
 
     glfwWindowHint(GLFW_SCALE_TO_MONITOR, GLFW_TRUE);
+    glfwWindowHint(GLFW_WIN32_KEYBOARD_MENU, GLFW_TRUE);
 
     window = glfwCreateWindow(800, 400, "Gamma Test", NULL, NULL);
     if (!window)
diff --git a/tests/glfwinfo.c b/tests/glfwinfo.c
index 1f3b24b..12acbcc 100644
--- a/tests/glfwinfo.c
+++ b/tests/glfwinfo.c
@@ -23,7 +23,9 @@
 //
 //========================================================================
 
+#define GLAD_GL_IMPLEMENTATION
 #include <glad/gl.h>
+#define GLAD_VULKAN_IMPLEMENTATION
 #include <glad/vulkan.h>
 #define GLFW_INCLUDE_NONE
 #include <GLFW/glfw3.h>
@@ -31,6 +33,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <stdbool.h>
 
 #include "getopt.h"
 
@@ -54,10 +57,31 @@
 #define BEHAVIOR_NAME_NONE  "none"
 #define BEHAVIOR_NAME_FLUSH "flush"
 
+#define ANGLE_TYPE_OPENGL   "gl"
+#define ANGLE_TYPE_OPENGLES "es"
+#define ANGLE_TYPE_D3D9     "d3d9"
+#define ANGLE_TYPE_D3D11    "d3d11"
+#define ANGLE_TYPE_VULKAN   "vk"
+#define ANGLE_TYPE_METAL    "mtl"
+
+#define PLATFORM_NAME_ANY   "any"
+#define PLATFORM_NAME_WIN32 "win32"
+#define PLATFORM_NAME_COCOA "cooca"
+#define PLATFORM_NAME_WL    "wayland"
+#define PLATFORM_NAME_X11   "x11"
+#define PLATFORM_NAME_NULL  "null"
+
 static void usage(void)
 {
     printf("Usage: glfwinfo [OPTION]...\n");
     printf("Options:\n");
+    printf("      --platform=PLATFORM   the platform to use ("
+                                        PLATFORM_NAME_ANY " or "
+                                        PLATFORM_NAME_WIN32 " or "
+                                        PLATFORM_NAME_COCOA " or "
+                                        PLATFORM_NAME_X11 " or "
+                                        PLATFORM_NAME_WL " or "
+                                        PLATFORM_NAME_NULL ")\n");
     printf("  -a, --client-api=API      the client API to use ("
                                         API_NAME_OPENGL " or "
                                         API_NAME_OPENGL_ES ")\n");
@@ -100,7 +124,15 @@
     printf("      --srgb                request an sRGB capable framebuffer\n");
     printf("      --singlebuffer        request single-buffering\n");
     printf("      --no-error            request a context that does not emit errors\n");
+    printf("      --angle-type=TYPE     the ANGLE platform type to use ("
+                                        ANGLE_TYPE_OPENGL ", "
+                                        ANGLE_TYPE_OPENGLES ", "
+                                        ANGLE_TYPE_D3D9 ", "
+                                        ANGLE_TYPE_D3D11 ", "
+                                        ANGLE_TYPE_VULKAN " or "
+                                        ANGLE_TYPE_METAL ")\n");
     printf("      --graphics-switching  request macOS graphics switching\n");
+    printf("      --disable-xcb-surface disable VK_KHR_xcb_surface extension\n");
 }
 
 static void error_callback(int error, const char* description)
@@ -108,6 +140,22 @@
     fprintf(stderr, "Error: %s\n", description);
 }
 
+static const char* get_platform_name(int platform)
+{
+    if (platform == GLFW_PLATFORM_WIN32)
+        return "Win32";
+    else if (platform == GLFW_PLATFORM_COCOA)
+        return "Cocoa";
+    else if (platform == GLFW_PLATFORM_WAYLAND)
+        return "Wayland";
+    else if (platform == GLFW_PLATFORM_X11)
+        return "X11";
+    else if (platform == GLFW_PLATFORM_NULL)
+        return "Null";
+
+    return "unknown";
+}
+
 static const char* get_device_type_name(VkPhysicalDeviceType type)
 {
     if (type == VK_PHYSICAL_DEVICE_TYPE_OTHER)
@@ -176,22 +224,19 @@
 
 static void list_context_extensions(int client, int major, int minor)
 {
-    int i;
-    GLint count;
-    const GLubyte* extensions;
-
     printf("%s context extensions:\n", get_api_name(client));
 
     if (client == GLFW_OPENGL_API && major > 2)
     {
+        GLint count;
         glGetIntegerv(GL_NUM_EXTENSIONS, &count);
 
-        for (i = 0;  i < count;  i++)
+        for (int i = 0;  i < count;  i++)
             printf(" %s\n", (const char*) glGetStringi(GL_EXTENSIONS, i));
     }
     else
     {
-        extensions = glGetString(GL_EXTENSIONS);
+        const GLubyte* extensions = glGetString(GL_EXTENSIONS);
         while (*extensions != '\0')
         {
             putchar(' ');
@@ -212,23 +257,14 @@
 
 static void list_vulkan_instance_layers(void)
 {
-    uint32_t i, lp_count = 0;
-    VkLayerProperties* lp;
-
     printf("Vulkan instance layers:\n");
 
-    if (vkEnumerateInstanceLayerProperties(&lp_count, NULL) != VK_SUCCESS)
-        return;
+    uint32_t lp_count;
+    vkEnumerateInstanceLayerProperties(&lp_count, NULL);
+    VkLayerProperties* lp = calloc(lp_count, sizeof(VkLayerProperties));
+    vkEnumerateInstanceLayerProperties(&lp_count, lp);
 
-    lp = calloc(lp_count, sizeof(VkLayerProperties));
-
-    if (vkEnumerateInstanceLayerProperties(&lp_count, lp) != VK_SUCCESS)
-    {
-        free(lp);
-        return;
-    }
-
-    for (i = 0;  i < lp_count;  i++)
+    for (uint32_t i = 0;  i < lp_count;  i++)
     {
         printf(" %s (spec version %u.%u) \"%s\"\n",
                lp[i].layerName,
@@ -242,23 +278,14 @@
 
 static void list_vulkan_device_layers(VkInstance instance, VkPhysicalDevice device)
 {
-    uint32_t i, lp_count;
-    VkLayerProperties* lp;
-
     printf("Vulkan device layers:\n");
 
-    if (vkEnumerateDeviceLayerProperties(device, &lp_count, NULL) != VK_SUCCESS)
-        return;
+    uint32_t lp_count;
+    vkEnumerateDeviceLayerProperties(device, &lp_count, NULL);
+    VkLayerProperties* lp = calloc(lp_count, sizeof(VkLayerProperties));
+    vkEnumerateDeviceLayerProperties(device, &lp_count, lp);
 
-    lp = calloc(lp_count, sizeof(VkLayerProperties));
-
-    if (vkEnumerateDeviceLayerProperties(device, &lp_count, lp) != VK_SUCCESS)
-    {
-        free(lp);
-        return;
-    }
-
-    for (i = 0;  i < lp_count;  i++)
+    for (uint32_t i = 0;  i < lp_count;  i++)
     {
         printf(" %s (spec version %u.%u) \"%s\"\n",
                lp[i].layerName,
@@ -270,7 +297,7 @@
     free(lp);
 }
 
-static int valid_version(void)
+static bool valid_version(void)
 {
     int major, minor, revision;
     glfwGetVersion(&major, &minor, &revision);
@@ -278,13 +305,13 @@
     if (major != GLFW_VERSION_MAJOR)
     {
         printf("*** ERROR: GLFW major version mismatch! ***\n");
-        return GLFW_FALSE;
+        return false;
     }
 
     if (minor != GLFW_VERSION_MINOR || revision != GLFW_VERSION_REVISION)
         printf("*** WARNING: GLFW version mismatch! ***\n");
 
-    return GLFW_TRUE;
+    return true;
 }
 
 static void print_version(void)
@@ -300,23 +327,73 @@
     printf("GLFW library version string: \"%s\"\n", glfwGetVersionString());
 }
 
+static void print_platform(void)
+{
+    const int platforms[] =
+    {
+        GLFW_PLATFORM_WIN32,
+        GLFW_PLATFORM_COCOA,
+        GLFW_PLATFORM_WAYLAND,
+        GLFW_PLATFORM_X11,
+        GLFW_PLATFORM_NULL
+    };
+
+    printf("GLFW platform: %s\n", get_platform_name(glfwGetPlatform()));
+    printf("GLFW supported platforms:\n");
+
+    for (size_t i = 0;  i < sizeof(platforms) / sizeof(platforms[0]);  i++)
+    {
+        if (glfwPlatformSupported(platforms[i]))
+            printf(" %s\n", get_platform_name(platforms[i]));
+    }
+}
+
 int main(int argc, char** argv)
 {
-    int ch, client, major, minor, revision, profile;
-    GLint redbits, greenbits, bluebits, alphabits, depthbits, stencilbits;
-    int list_extensions = GLFW_FALSE, list_layers = GLFW_FALSE;
-    GLenum error;
-    GLFWwindow* window;
+    int ch;
+    bool list_extensions = false, list_layers = false;
 
-    enum { CLIENT, CONTEXT, BEHAVIOR, DEBUG_CONTEXT, FORWARD, HELP,
+    // These duplicate the defaults for each hint
+    int platform = GLFW_ANY_PLATFORM;
+    int client_api = GLFW_OPENGL_API;
+    int context_major = 1;
+    int context_minor = 0;
+    int context_release = GLFW_ANY_RELEASE_BEHAVIOR;
+    int context_creation_api = GLFW_NATIVE_CONTEXT_API;
+    int context_robustness = GLFW_NO_ROBUSTNESS;
+    bool context_debug = false;
+    bool context_no_error = false;
+    bool opengl_forward = false;
+    int opengl_profile = GLFW_OPENGL_ANY_PROFILE;
+    int fb_red_bits = 8;
+    int fb_green_bits = 8;
+    int fb_blue_bits = 8;
+    int fb_alpha_bits = 8;
+    int fb_depth_bits = 24;
+    int fb_stencil_bits = 8;
+    int fb_accum_red_bits = 0;
+    int fb_accum_green_bits = 0;
+    int fb_accum_blue_bits = 0;
+    int fb_accum_alpha_bits = 0;
+    int fb_aux_buffers = 0;
+    int fb_samples = 0;
+    bool fb_stereo = false;
+    bool fb_srgb = false;
+    bool fb_doublebuffer = true;
+    int angle_type = GLFW_ANGLE_PLATFORM_TYPE_NONE;
+    bool cocoa_graphics_switching = false;
+    bool disable_xcb_surface = false;
+
+    enum { PLATFORM, CLIENT, CONTEXT, BEHAVIOR, DEBUG_CONTEXT, FORWARD, HELP,
            EXTENSIONS, LAYERS,
            MAJOR, MINOR, PROFILE, ROBUSTNESS, VERSION,
            REDBITS, GREENBITS, BLUEBITS, ALPHABITS, DEPTHBITS, STENCILBITS,
            ACCUMREDBITS, ACCUMGREENBITS, ACCUMBLUEBITS, ACCUMALPHABITS,
            AUXBUFFERS, SAMPLES, STEREO, SRGB, SINGLEBUFFER, NOERROR_SRSLY,
-           GRAPHICS_SWITCHING };
+           ANGLE_TYPE, GRAPHICS_SWITCHING, XCB_SURFACE };
     const struct option options[] =
     {
+        { "platform",           1, NULL, PLATFORM },
         { "behavior",           1, NULL, BEHAVIOR },
         { "client-api",         1, NULL, CLIENT },
         { "context-api",        1, NULL, CONTEXT },
@@ -346,32 +423,41 @@
         { "srgb",               0, NULL, SRGB },
         { "singlebuffer",       0, NULL, SINGLEBUFFER },
         { "no-error",           0, NULL, NOERROR_SRSLY },
+        { "angle-type",         1, NULL, ANGLE_TYPE },
         { "graphics-switching", 0, NULL, GRAPHICS_SWITCHING },
+        { "vk-xcb-surface",     0, NULL, XCB_SURFACE },
         { NULL, 0, NULL, 0 }
     };
 
-    // Initialize GLFW and create window
-
-    if (!valid_version())
-        exit(EXIT_FAILURE);
-
-    glfwSetErrorCallback(error_callback);
-
-    glfwInitHint(GLFW_COCOA_MENUBAR, GLFW_FALSE);
-
-    if (!glfwInit())
-        exit(EXIT_FAILURE);
-
     while ((ch = getopt_long(argc, argv, "a:b:c:dfhlm:n:p:s:v", options, NULL)) != -1)
     {
         switch (ch)
         {
+            case PLATFORM:
+                if (strcasecmp(optarg, PLATFORM_NAME_ANY) == 0)
+                    platform = GLFW_ANY_PLATFORM;
+                else if (strcasecmp(optarg, PLATFORM_NAME_WIN32) == 0)
+                    platform = GLFW_PLATFORM_WIN32;
+                else if (strcasecmp(optarg, PLATFORM_NAME_COCOA) == 0)
+                    platform = GLFW_PLATFORM_COCOA;
+                else if (strcasecmp(optarg, PLATFORM_NAME_WL) == 0)
+                    platform = GLFW_PLATFORM_WAYLAND;
+                else if (strcasecmp(optarg, PLATFORM_NAME_X11) == 0)
+                    platform = GLFW_PLATFORM_X11;
+                else if (strcasecmp(optarg, PLATFORM_NAME_NULL) == 0)
+                    platform = GLFW_PLATFORM_NULL;
+                else
+                {
+                    usage();
+                    exit(EXIT_FAILURE);
+                }
+                break;
             case 'a':
             case CLIENT:
                 if (strcasecmp(optarg, API_NAME_OPENGL) == 0)
-                    glfwWindowHint(GLFW_CLIENT_API, GLFW_OPENGL_API);
+                    client_api = GLFW_OPENGL_API;
                 else if (strcasecmp(optarg, API_NAME_OPENGL_ES) == 0)
-                    glfwWindowHint(GLFW_CLIENT_API, GLFW_OPENGL_ES_API);
+                    client_api = GLFW_OPENGL_ES_API;
                 else
                 {
                     usage();
@@ -381,15 +467,9 @@
             case 'b':
             case BEHAVIOR:
                 if (strcasecmp(optarg, BEHAVIOR_NAME_NONE) == 0)
-                {
-                    glfwWindowHint(GLFW_CONTEXT_RELEASE_BEHAVIOR,
-                                   GLFW_RELEASE_BEHAVIOR_NONE);
-                }
+                    context_release = GLFW_RELEASE_BEHAVIOR_NONE;
                 else if (strcasecmp(optarg, BEHAVIOR_NAME_FLUSH) == 0)
-                {
-                    glfwWindowHint(GLFW_CONTEXT_RELEASE_BEHAVIOR,
-                                   GLFW_RELEASE_BEHAVIOR_FLUSH);
-                }
+                    context_release = GLFW_RELEASE_BEHAVIOR_FLUSH;
                 else
                 {
                     usage();
@@ -399,11 +479,11 @@
             case 'c':
             case CONTEXT:
                 if (strcasecmp(optarg, API_NAME_NATIVE) == 0)
-                    glfwWindowHint(GLFW_CONTEXT_CREATION_API, GLFW_NATIVE_CONTEXT_API);
+                    context_creation_api = GLFW_NATIVE_CONTEXT_API;
                 else if (strcasecmp(optarg, API_NAME_EGL) == 0)
-                    glfwWindowHint(GLFW_CONTEXT_CREATION_API, GLFW_EGL_CONTEXT_API);
+                    context_creation_api = GLFW_EGL_CONTEXT_API;
                 else if (strcasecmp(optarg, API_NAME_OSMESA) == 0)
-                    glfwWindowHint(GLFW_CONTEXT_CREATION_API, GLFW_OSMESA_CONTEXT_API);
+                    context_creation_api = GLFW_OSMESA_CONTEXT_API;
                 else
                 {
                     usage();
@@ -412,11 +492,11 @@
                 break;
             case 'd':
             case DEBUG_CONTEXT:
-                glfwWindowHint(GLFW_OPENGL_DEBUG_CONTEXT, GLFW_TRUE);
+                context_debug = true;
                 break;
             case 'f':
             case FORWARD:
-                glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GLFW_TRUE);
+                opengl_forward = true;
                 break;
             case 'h':
             case HELP:
@@ -424,31 +504,25 @@
                 exit(EXIT_SUCCESS);
             case 'l':
             case EXTENSIONS:
-                list_extensions = GLFW_TRUE;
+                list_extensions = true;
                 break;
             case LAYERS:
-                list_layers = GLFW_TRUE;
+                list_layers = true;
                 break;
             case 'm':
             case MAJOR:
-                glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, atoi(optarg));
+                context_major = atoi(optarg);
                 break;
             case 'n':
             case MINOR:
-                glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, atoi(optarg));
+                context_minor = atoi(optarg);
                 break;
             case 'p':
             case PROFILE:
                 if (strcasecmp(optarg, PROFILE_NAME_CORE) == 0)
-                {
-                    glfwWindowHint(GLFW_OPENGL_PROFILE,
-                                   GLFW_OPENGL_CORE_PROFILE);
-                }
+                    opengl_profile = GLFW_OPENGL_CORE_PROFILE;
                 else if (strcasecmp(optarg, PROFILE_NAME_COMPAT) == 0)
-                {
-                    glfwWindowHint(GLFW_OPENGL_PROFILE,
-                                   GLFW_OPENGL_COMPAT_PROFILE);
-                }
+                    opengl_profile = GLFW_OPENGL_COMPAT_PROFILE;
                 else
                 {
                     usage();
@@ -458,15 +532,9 @@
             case 's':
             case ROBUSTNESS:
                 if (strcasecmp(optarg, STRATEGY_NAME_NONE) == 0)
-                {
-                    glfwWindowHint(GLFW_CONTEXT_ROBUSTNESS,
-                                   GLFW_NO_RESET_NOTIFICATION);
-                }
+                    context_robustness = GLFW_NO_RESET_NOTIFICATION;
                 else if (strcasecmp(optarg, STRATEGY_NAME_LOSE) == 0)
-                {
-                    glfwWindowHint(GLFW_CONTEXT_ROBUSTNESS,
-                                   GLFW_LOSE_CONTEXT_ON_RESET);
-                }
+                    context_robustness = GLFW_LOSE_CONTEXT_ON_RESET;
                 else
                 {
                     usage();
@@ -479,90 +547,112 @@
                 exit(EXIT_SUCCESS);
             case REDBITS:
                 if (strcmp(optarg, "-") == 0)
-                    glfwWindowHint(GLFW_RED_BITS, GLFW_DONT_CARE);
+                    fb_red_bits = GLFW_DONT_CARE;
                 else
-                    glfwWindowHint(GLFW_RED_BITS, atoi(optarg));
+                    fb_red_bits = atoi(optarg);
                 break;
             case GREENBITS:
                 if (strcmp(optarg, "-") == 0)
-                    glfwWindowHint(GLFW_GREEN_BITS, GLFW_DONT_CARE);
+                    fb_green_bits = GLFW_DONT_CARE;
                 else
-                    glfwWindowHint(GLFW_GREEN_BITS, atoi(optarg));
+                    fb_green_bits = atoi(optarg);
                 break;
             case BLUEBITS:
                 if (strcmp(optarg, "-") == 0)
-                    glfwWindowHint(GLFW_BLUE_BITS, GLFW_DONT_CARE);
+                    fb_blue_bits = GLFW_DONT_CARE;
                 else
-                    glfwWindowHint(GLFW_BLUE_BITS, atoi(optarg));
+                    fb_blue_bits = atoi(optarg);
                 break;
             case ALPHABITS:
                 if (strcmp(optarg, "-") == 0)
-                    glfwWindowHint(GLFW_ALPHA_BITS, GLFW_DONT_CARE);
+                    fb_alpha_bits = GLFW_DONT_CARE;
                 else
-                    glfwWindowHint(GLFW_ALPHA_BITS, atoi(optarg));
+                    fb_alpha_bits = atoi(optarg);
                 break;
             case DEPTHBITS:
                 if (strcmp(optarg, "-") == 0)
-                    glfwWindowHint(GLFW_DEPTH_BITS, GLFW_DONT_CARE);
+                    fb_depth_bits = GLFW_DONT_CARE;
                 else
-                    glfwWindowHint(GLFW_DEPTH_BITS, atoi(optarg));
+                    fb_depth_bits = atoi(optarg);
                 break;
             case STENCILBITS:
                 if (strcmp(optarg, "-") == 0)
-                    glfwWindowHint(GLFW_STENCIL_BITS, GLFW_DONT_CARE);
+                    fb_stencil_bits = GLFW_DONT_CARE;
                 else
-                    glfwWindowHint(GLFW_STENCIL_BITS, atoi(optarg));
+                    fb_stencil_bits = atoi(optarg);
                 break;
             case ACCUMREDBITS:
                 if (strcmp(optarg, "-") == 0)
-                    glfwWindowHint(GLFW_ACCUM_RED_BITS, GLFW_DONT_CARE);
+                    fb_accum_red_bits = GLFW_DONT_CARE;
                 else
-                    glfwWindowHint(GLFW_ACCUM_RED_BITS, atoi(optarg));
+                    fb_accum_red_bits = atoi(optarg);
                 break;
             case ACCUMGREENBITS:
                 if (strcmp(optarg, "-") == 0)
-                    glfwWindowHint(GLFW_ACCUM_GREEN_BITS, GLFW_DONT_CARE);
+                    fb_accum_green_bits = GLFW_DONT_CARE;
                 else
-                    glfwWindowHint(GLFW_ACCUM_GREEN_BITS, atoi(optarg));
+                    fb_accum_green_bits = atoi(optarg);
                 break;
             case ACCUMBLUEBITS:
                 if (strcmp(optarg, "-") == 0)
-                    glfwWindowHint(GLFW_ACCUM_BLUE_BITS, GLFW_DONT_CARE);
+                    fb_accum_blue_bits = GLFW_DONT_CARE;
                 else
-                    glfwWindowHint(GLFW_ACCUM_BLUE_BITS, atoi(optarg));
+                    fb_accum_blue_bits = atoi(optarg);
                 break;
             case ACCUMALPHABITS:
                 if (strcmp(optarg, "-") == 0)
-                    glfwWindowHint(GLFW_ACCUM_ALPHA_BITS, GLFW_DONT_CARE);
+                    fb_accum_alpha_bits = GLFW_DONT_CARE;
                 else
-                    glfwWindowHint(GLFW_ACCUM_ALPHA_BITS, atoi(optarg));
+                    fb_accum_alpha_bits = atoi(optarg);
                 break;
             case AUXBUFFERS:
                 if (strcmp(optarg, "-") == 0)
-                    glfwWindowHint(GLFW_AUX_BUFFERS, GLFW_DONT_CARE);
+                    fb_aux_buffers = GLFW_DONT_CARE;
                 else
-                    glfwWindowHint(GLFW_AUX_BUFFERS, atoi(optarg));
+                    fb_aux_buffers = atoi(optarg);
                 break;
             case SAMPLES:
                 if (strcmp(optarg, "-") == 0)
-                    glfwWindowHint(GLFW_SAMPLES, GLFW_DONT_CARE);
+                    fb_samples = GLFW_DONT_CARE;
                 else
-                    glfwWindowHint(GLFW_SAMPLES, atoi(optarg));
+                    fb_samples = atoi(optarg);
                 break;
             case STEREO:
-                glfwWindowHint(GLFW_STEREO, GLFW_TRUE);
+                fb_stereo = true;
                 break;
             case SRGB:
-                glfwWindowHint(GLFW_SRGB_CAPABLE, GLFW_TRUE);
+                fb_srgb = true;
                 break;
             case SINGLEBUFFER:
-                glfwWindowHint(GLFW_DOUBLEBUFFER, GLFW_FALSE);
+                fb_doublebuffer = false;
                 break;
             case NOERROR_SRSLY:
-                glfwWindowHint(GLFW_CONTEXT_NO_ERROR, GLFW_TRUE);
+                context_no_error = true;
+                break;
+            case ANGLE_TYPE:
+                if (strcmp(optarg, ANGLE_TYPE_OPENGL) == 0)
+                    angle_type = GLFW_ANGLE_PLATFORM_TYPE_OPENGL;
+                else if (strcmp(optarg, ANGLE_TYPE_OPENGLES) == 0)
+                    angle_type = GLFW_ANGLE_PLATFORM_TYPE_OPENGLES;
+                else if (strcmp(optarg, ANGLE_TYPE_D3D9) == 0)
+                    angle_type = GLFW_ANGLE_PLATFORM_TYPE_D3D9;
+                else if (strcmp(optarg, ANGLE_TYPE_D3D11) == 0)
+                    angle_type = GLFW_ANGLE_PLATFORM_TYPE_D3D11;
+                else if (strcmp(optarg, ANGLE_TYPE_VULKAN) == 0)
+                    angle_type = GLFW_ANGLE_PLATFORM_TYPE_VULKAN;
+                else if (strcmp(optarg, ANGLE_TYPE_METAL) == 0)
+                    angle_type = GLFW_ANGLE_PLATFORM_TYPE_METAL;
+                else
+                {
+                    usage();
+                    exit(EXIT_FAILURE);
+                }
                 break;
             case GRAPHICS_SWITCHING:
-                glfwWindowHint(GLFW_COCOA_GRAPHICS_SWITCHING, GLFW_TRUE);
+                cocoa_graphics_switching = true;
+                break;
+            case XCB_SURFACE:
+                disable_xcb_surface = true;
                 break;
             default:
                 usage();
@@ -570,193 +660,239 @@
         }
     }
 
-    print_version();
+    // Initialize GLFW and create window
 
-    glfwWindowHint(GLFW_VISIBLE, GLFW_FALSE);
-
-    window = glfwCreateWindow(200, 200, "Version", NULL, NULL);
-    if (!window)
-    {
-        glfwTerminate();
+    if (!valid_version())
         exit(EXIT_FAILURE);
-    }
 
-    glfwMakeContextCurrent(window);
-    gladLoadGL(glfwGetProcAddress);
+    glfwSetErrorCallback(error_callback);
 
-    error = glGetError();
-    if (error != GL_NO_ERROR)
-        printf("*** OpenGL error after make current: 0x%08x ***\n", error);
+    glfwInitHint(GLFW_PLATFORM, platform);
 
-    // Report client API version
+    glfwInitHint(GLFW_COCOA_MENUBAR, false);
 
-    client = glfwGetWindowAttrib(window, GLFW_CLIENT_API);
-    major = glfwGetWindowAttrib(window, GLFW_CONTEXT_VERSION_MAJOR);
-    minor = glfwGetWindowAttrib(window, GLFW_CONTEXT_VERSION_MINOR);
-    revision = glfwGetWindowAttrib(window, GLFW_CONTEXT_REVISION);
-    profile = glfwGetWindowAttrib(window, GLFW_OPENGL_PROFILE);
+    glfwInitHint(GLFW_ANGLE_PLATFORM_TYPE, angle_type);
+    glfwInitHint(GLFW_X11_XCB_VULKAN_SURFACE, !disable_xcb_surface);
 
-    printf("%s context version string: \"%s\"\n",
-           get_api_name(client),
-           glGetString(GL_VERSION));
+    if (!glfwInit())
+        exit(EXIT_FAILURE);
 
-    printf("%s context version parsed by GLFW: %u.%u.%u\n",
-           get_api_name(client),
-           major, minor, revision);
+    print_version();
+    print_platform();
 
-    // Report client API context properties
+    glfwWindowHint(GLFW_VISIBLE, false);
 
-    if (client == GLFW_OPENGL_API)
+    glfwWindowHint(GLFW_CLIENT_API, client_api);
+    glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, context_major);
+    glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, context_minor);
+    glfwWindowHint(GLFW_CONTEXT_RELEASE_BEHAVIOR, context_release);
+    glfwWindowHint(GLFW_CONTEXT_CREATION_API, context_creation_api);
+    glfwWindowHint(GLFW_CONTEXT_ROBUSTNESS, context_robustness);
+    glfwWindowHint(GLFW_CONTEXT_DEBUG, context_debug);
+    glfwWindowHint(GLFW_CONTEXT_NO_ERROR, context_no_error);
+    glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, opengl_forward);
+    glfwWindowHint(GLFW_OPENGL_PROFILE, opengl_profile);
+
+    glfwWindowHint(GLFW_RED_BITS, fb_red_bits);
+    glfwWindowHint(GLFW_BLUE_BITS, fb_blue_bits);
+    glfwWindowHint(GLFW_GREEN_BITS, fb_green_bits);
+    glfwWindowHint(GLFW_ALPHA_BITS, fb_alpha_bits);
+    glfwWindowHint(GLFW_DEPTH_BITS, fb_depth_bits);
+    glfwWindowHint(GLFW_STENCIL_BITS, fb_stencil_bits);
+    glfwWindowHint(GLFW_ACCUM_RED_BITS, fb_accum_red_bits);
+    glfwWindowHint(GLFW_ACCUM_GREEN_BITS, fb_accum_green_bits);
+    glfwWindowHint(GLFW_ACCUM_BLUE_BITS, fb_accum_blue_bits);
+    glfwWindowHint(GLFW_ACCUM_ALPHA_BITS, fb_accum_alpha_bits);
+    glfwWindowHint(GLFW_AUX_BUFFERS, fb_aux_buffers);
+    glfwWindowHint(GLFW_SAMPLES, fb_samples);
+    glfwWindowHint(GLFW_STEREO, fb_stereo);
+    glfwWindowHint(GLFW_SRGB_CAPABLE, fb_srgb);
+    glfwWindowHint(GLFW_DOUBLEBUFFER, fb_doublebuffer);
+
+    glfwWindowHint(GLFW_COCOA_GRAPHICS_SWITCHING, cocoa_graphics_switching);
+
+    GLFWwindow* window = glfwCreateWindow(200, 200, "Version", NULL, NULL);
+    if (window)
     {
-        if (major >= 3)
-        {
-            GLint flags;
+        glfwMakeContextCurrent(window);
+        gladLoadGL(glfwGetProcAddress);
 
-            glGetIntegerv(GL_CONTEXT_FLAGS, &flags);
-            printf("%s context flags (0x%08x):", get_api_name(client), flags);
+        const GLenum error = glGetError();
+        if (error != GL_NO_ERROR)
+            printf("*** OpenGL error after make current: 0x%08x ***\n", error);
 
-            if (flags & GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT)
-                printf(" forward-compatible");
-            if (flags & 2/*GL_CONTEXT_FLAG_DEBUG_BIT*/)
-                printf(" debug");
-            if (flags & GL_CONTEXT_FLAG_ROBUST_ACCESS_BIT_ARB)
-                printf(" robustness");
-            if (flags & 8/*GL_CONTEXT_FLAG_NO_ERROR_BIT_KHR*/)
-                printf(" no-error");
-            putchar('\n');
+        // Report client API version
 
-            printf("%s context flags parsed by GLFW:", get_api_name(client));
+        const int client = glfwGetWindowAttrib(window, GLFW_CLIENT_API);
+        const int major = glfwGetWindowAttrib(window, GLFW_CONTEXT_VERSION_MAJOR);
+        const int minor = glfwGetWindowAttrib(window, GLFW_CONTEXT_VERSION_MINOR);
+        const int revision = glfwGetWindowAttrib(window, GLFW_CONTEXT_REVISION);
+        const int profile = glfwGetWindowAttrib(window, GLFW_OPENGL_PROFILE);
 
-            if (glfwGetWindowAttrib(window, GLFW_OPENGL_FORWARD_COMPAT))
-                printf(" forward-compatible");
-            if (glfwGetWindowAttrib(window, GLFW_OPENGL_DEBUG_CONTEXT))
-                printf(" debug");
-            if (glfwGetWindowAttrib(window, GLFW_CONTEXT_ROBUSTNESS) == GLFW_LOSE_CONTEXT_ON_RESET)
-                printf(" robustness");
-            if (glfwGetWindowAttrib(window, GLFW_CONTEXT_NO_ERROR))
-                printf(" no-error");
-            putchar('\n');
-        }
-
-        if (major >= 4 || (major == 3 && minor >= 2))
-        {
-            GLint mask;
-            glGetIntegerv(GL_CONTEXT_PROFILE_MASK, &mask);
-
-            printf("%s profile mask (0x%08x): %s\n",
-                   get_api_name(client),
-                   mask,
-                   get_profile_name_gl(mask));
-
-            printf("%s profile mask parsed by GLFW: %s\n",
-                   get_api_name(client),
-                   get_profile_name_glfw(profile));
-        }
-
-        if (GLAD_GL_ARB_robustness)
-        {
-            const int robustness = glfwGetWindowAttrib(window, GLFW_CONTEXT_ROBUSTNESS);
-            GLint strategy;
-            glGetIntegerv(GL_RESET_NOTIFICATION_STRATEGY_ARB, &strategy);
-
-            printf("%s robustness strategy (0x%08x): %s\n",
-                   get_api_name(client),
-                   strategy,
-                   get_strategy_name_gl(strategy));
-
-            printf("%s robustness strategy parsed by GLFW: %s\n",
-                   get_api_name(client),
-                   get_strategy_name_glfw(robustness));
-        }
-    }
-
-    printf("%s context renderer string: \"%s\"\n",
-           get_api_name(client),
-           glGetString(GL_RENDERER));
-    printf("%s context vendor string: \"%s\"\n",
-           get_api_name(client),
-           glGetString(GL_VENDOR));
-
-    if (major >= 2)
-    {
-        printf("%s context shading language version: \"%s\"\n",
+        printf("%s context version string: \"%s\"\n",
                get_api_name(client),
-               glGetString(GL_SHADING_LANGUAGE_VERSION));
+               glGetString(GL_VERSION));
+
+        printf("%s context version parsed by GLFW: %u.%u.%u\n",
+               get_api_name(client),
+               major, minor, revision);
+
+        // Report client API context properties
+
+        if (client == GLFW_OPENGL_API)
+        {
+            if (major >= 3)
+            {
+                GLint flags;
+
+                glGetIntegerv(GL_CONTEXT_FLAGS, &flags);
+                printf("%s context flags (0x%08x):", get_api_name(client), flags);
+
+                if (flags & GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT)
+                    printf(" forward-compatible");
+                if (flags & 2/*GL_CONTEXT_FLAG_DEBUG_BIT*/)
+                    printf(" debug");
+                if (flags & GL_CONTEXT_FLAG_ROBUST_ACCESS_BIT_ARB)
+                    printf(" robustness");
+                if (flags & 8/*GL_CONTEXT_FLAG_NO_ERROR_BIT_KHR*/)
+                    printf(" no-error");
+                putchar('\n');
+
+                printf("%s context flags parsed by GLFW:", get_api_name(client));
+
+                if (glfwGetWindowAttrib(window, GLFW_OPENGL_FORWARD_COMPAT))
+                    printf(" forward-compatible");
+                if (glfwGetWindowAttrib(window, GLFW_CONTEXT_DEBUG))
+                    printf(" debug");
+                if (glfwGetWindowAttrib(window, GLFW_CONTEXT_ROBUSTNESS) == GLFW_LOSE_CONTEXT_ON_RESET)
+                    printf(" robustness");
+                if (glfwGetWindowAttrib(window, GLFW_CONTEXT_NO_ERROR))
+                    printf(" no-error");
+                putchar('\n');
+            }
+
+            if (major >= 4 || (major == 3 && minor >= 2))
+            {
+                GLint mask;
+                glGetIntegerv(GL_CONTEXT_PROFILE_MASK, &mask);
+
+                printf("%s profile mask (0x%08x): %s\n",
+                       get_api_name(client),
+                       mask,
+                       get_profile_name_gl(mask));
+
+                printf("%s profile mask parsed by GLFW: %s\n",
+                       get_api_name(client),
+                       get_profile_name_glfw(profile));
+            }
+
+            if (GLAD_GL_ARB_robustness)
+            {
+                const int robustness = glfwGetWindowAttrib(window, GLFW_CONTEXT_ROBUSTNESS);
+                GLint strategy;
+                glGetIntegerv(GL_RESET_NOTIFICATION_STRATEGY_ARB, &strategy);
+
+                printf("%s robustness strategy (0x%08x): %s\n",
+                       get_api_name(client),
+                       strategy,
+                       get_strategy_name_gl(strategy));
+
+                printf("%s robustness strategy parsed by GLFW: %s\n",
+                       get_api_name(client),
+                       get_strategy_name_glfw(robustness));
+            }
+        }
+
+        printf("%s context renderer string: \"%s\"\n",
+               get_api_name(client),
+               glGetString(GL_RENDERER));
+        printf("%s context vendor string: \"%s\"\n",
+               get_api_name(client),
+               glGetString(GL_VENDOR));
+
+        if (major >= 2)
+        {
+            printf("%s context shading language version: \"%s\"\n",
+                   get_api_name(client),
+                   glGetString(GL_SHADING_LANGUAGE_VERSION));
+        }
+
+        printf("%s framebuffer:\n", get_api_name(client));
+
+        GLint redbits, greenbits, bluebits, alphabits, depthbits, stencilbits;
+
+        if (client == GLFW_OPENGL_API && profile == GLFW_OPENGL_CORE_PROFILE)
+        {
+            glGetFramebufferAttachmentParameteriv(GL_FRAMEBUFFER,
+                                                  GL_BACK_LEFT,
+                                                  GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE,
+                                                  &redbits);
+            glGetFramebufferAttachmentParameteriv(GL_FRAMEBUFFER,
+                                                  GL_BACK_LEFT,
+                                                  GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE,
+                                                  &greenbits);
+            glGetFramebufferAttachmentParameteriv(GL_FRAMEBUFFER,
+                                                  GL_BACK_LEFT,
+                                                  GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE,
+                                                  &bluebits);
+            glGetFramebufferAttachmentParameteriv(GL_FRAMEBUFFER,
+                                                  GL_BACK_LEFT,
+                                                  GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE,
+                                                  &alphabits);
+            glGetFramebufferAttachmentParameteriv(GL_FRAMEBUFFER,
+                                                  GL_DEPTH,
+                                                  GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE,
+                                                  &depthbits);
+            glGetFramebufferAttachmentParameteriv(GL_FRAMEBUFFER,
+                                                  GL_STENCIL,
+                                                  GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE,
+                                                  &stencilbits);
+        }
+        else
+        {
+            glGetIntegerv(GL_RED_BITS, &redbits);
+            glGetIntegerv(GL_GREEN_BITS, &greenbits);
+            glGetIntegerv(GL_BLUE_BITS, &bluebits);
+            glGetIntegerv(GL_ALPHA_BITS, &alphabits);
+            glGetIntegerv(GL_DEPTH_BITS, &depthbits);
+            glGetIntegerv(GL_STENCIL_BITS, &stencilbits);
+        }
+
+        printf(" red: %u green: %u blue: %u alpha: %u depth: %u stencil: %u\n",
+            redbits, greenbits, bluebits, alphabits, depthbits, stencilbits);
+
+        if (client == GLFW_OPENGL_ES_API ||
+            GLAD_GL_ARB_multisample ||
+            major > 1 || minor >= 3)
+        {
+            GLint samples, samplebuffers;
+            glGetIntegerv(GL_SAMPLES, &samples);
+            glGetIntegerv(GL_SAMPLE_BUFFERS, &samplebuffers);
+
+            printf(" samples: %u sample buffers: %u\n", samples, samplebuffers);
+        }
+
+        if (client == GLFW_OPENGL_API && profile != GLFW_OPENGL_CORE_PROFILE)
+        {
+            GLint accumredbits, accumgreenbits, accumbluebits, accumalphabits;
+            GLint auxbuffers;
+
+            glGetIntegerv(GL_ACCUM_RED_BITS, &accumredbits);
+            glGetIntegerv(GL_ACCUM_GREEN_BITS, &accumgreenbits);
+            glGetIntegerv(GL_ACCUM_BLUE_BITS, &accumbluebits);
+            glGetIntegerv(GL_ACCUM_ALPHA_BITS, &accumalphabits);
+            glGetIntegerv(GL_AUX_BUFFERS, &auxbuffers);
+
+            printf(" accum red: %u accum green: %u accum blue: %u accum alpha: %u aux buffers: %u\n",
+                   accumredbits, accumgreenbits, accumbluebits, accumalphabits, auxbuffers);
+        }
+
+        if (list_extensions)
+            list_context_extensions(client, major, minor);
+
+        glfwDestroyWindow(window);
     }
 
-    printf("%s framebuffer:\n", get_api_name(client));
-
-    if (client == GLFW_OPENGL_API && profile == GLFW_OPENGL_CORE_PROFILE)
-    {
-        glGetFramebufferAttachmentParameteriv(GL_FRAMEBUFFER,
-                                              GL_BACK_LEFT,
-                                              GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE,
-                                              &redbits);
-        glGetFramebufferAttachmentParameteriv(GL_FRAMEBUFFER,
-                                              GL_BACK_LEFT,
-                                              GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE,
-                                              &greenbits);
-        glGetFramebufferAttachmentParameteriv(GL_FRAMEBUFFER,
-                                              GL_BACK_LEFT,
-                                              GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE,
-                                              &bluebits);
-        glGetFramebufferAttachmentParameteriv(GL_FRAMEBUFFER,
-                                              GL_BACK_LEFT,
-                                              GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE,
-                                              &alphabits);
-        glGetFramebufferAttachmentParameteriv(GL_FRAMEBUFFER,
-                                              GL_DEPTH,
-                                              GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE,
-                                              &depthbits);
-        glGetFramebufferAttachmentParameteriv(GL_FRAMEBUFFER,
-                                              GL_STENCIL,
-                                              GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE,
-                                              &stencilbits);
-    }
-    else
-    {
-        glGetIntegerv(GL_RED_BITS, &redbits);
-        glGetIntegerv(GL_GREEN_BITS, &greenbits);
-        glGetIntegerv(GL_BLUE_BITS, &bluebits);
-        glGetIntegerv(GL_ALPHA_BITS, &alphabits);
-        glGetIntegerv(GL_DEPTH_BITS, &depthbits);
-        glGetIntegerv(GL_STENCIL_BITS, &stencilbits);
-    }
-
-    printf(" red: %u green: %u blue: %u alpha: %u depth: %u stencil: %u\n",
-           redbits, greenbits, bluebits, alphabits, depthbits, stencilbits);
-
-    if (client == GLFW_OPENGL_ES_API ||
-        GLAD_GL_ARB_multisample ||
-        major > 1 || minor >= 3)
-    {
-        GLint samples, samplebuffers;
-        glGetIntegerv(GL_SAMPLES, &samples);
-        glGetIntegerv(GL_SAMPLE_BUFFERS, &samplebuffers);
-
-        printf(" samples: %u sample buffers: %u\n", samples, samplebuffers);
-    }
-
-    if (client == GLFW_OPENGL_API && profile != GLFW_OPENGL_CORE_PROFILE)
-    {
-        GLint accumredbits, accumgreenbits, accumbluebits, accumalphabits;
-        GLint auxbuffers;
-
-        glGetIntegerv(GL_ACCUM_RED_BITS, &accumredbits);
-        glGetIntegerv(GL_ACCUM_GREEN_BITS, &accumgreenbits);
-        glGetIntegerv(GL_ACCUM_BLUE_BITS, &accumbluebits);
-        glGetIntegerv(GL_ACCUM_ALPHA_BITS, &accumalphabits);
-        glGetIntegerv(GL_AUX_BUFFERS, &auxbuffers);
-
-        printf(" accum red: %u accum green: %u accum blue: %u accum alpha: %u aux buffers: %u\n",
-               accumredbits, accumgreenbits, accumbluebits, accumalphabits, auxbuffers);
-    }
-
-    if (list_extensions)
-        list_context_extensions(client, major, minor);
-
-    glfwDestroyWindow(window);
-
     glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API);
 
     window = glfwCreateWindow(200, 200, "Version", NULL, NULL);
@@ -771,18 +907,10 @@
 
     if (glfwVulkanSupported())
     {
-        uint32_t loader_version = VK_API_VERSION_1_0;
-        int portability_enumeration = GLFW_FALSE;
-        uint32_t i, j, glfw_re_count, re_count, pd_count, ep_count;
-        const char** glfw_re;
-        const char** re;
-        VkApplicationInfo ai = {0};
-        VkInstanceCreateInfo ici = {0};
-        VkInstance instance;
-        VkPhysicalDevice* pd;
-
         gladLoadVulkanUserPtr(NULL, (GLADuserptrloadfunc) glfwGetInstanceProcAddress, NULL);
 
+        uint32_t loader_version = VK_API_VERSION_1_0;
+
         if (vkEnumerateInstanceVersion)
         {
             uint32_t version;
@@ -794,23 +922,25 @@
                VK_VERSION_MAJOR(loader_version),
                VK_VERSION_MINOR(loader_version));
 
-        glfw_re = glfwGetRequiredInstanceExtensions(&glfw_re_count);
+        uint32_t glfw_re_count;
+        const char** glfw_re = glfwGetRequiredInstanceExtensions(&glfw_re_count);
 
-        re_count = glfw_re_count;
-        re = calloc(glfw_re_count, sizeof(char*));
+        uint32_t re_count = glfw_re_count;
+        const char** re = calloc(glfw_re_count, sizeof(char*));
 
-        printf("Vulkan window surface required instance extensions:\n");
         if (glfw_re)
         {
-            for (i = 0;  i < glfw_re_count;  i++)
+            printf("Vulkan window surface required instance extensions:\n");
+            for (uint32_t i = 0;  i < glfw_re_count;  i++)
             {
                 printf(" %s\n", glfw_re[i]);
                 re[i] = glfw_re[i];
             }
         }
         else
-            printf(" missing\n");
+            printf("Vulkan window surface extensions missing\n");
 
+        uint32_t ep_count;
         vkEnumerateInstanceExtensionProperties(NULL, &ep_count, NULL);
         VkExtensionProperties* ep = calloc(ep_count, sizeof(VkExtensionProperties));
         vkEnumerateInstanceExtensionProperties(NULL, &ep_count, ep);
@@ -819,11 +949,13 @@
         {
             printf("Vulkan instance extensions:\n");
 
-            for (i = 0;  i < ep_count;  i++)
+            for (uint32_t i = 0;  i < ep_count;  i++)
                 printf(" %s (spec version %u)\n", ep[i].extensionName, ep[i].specVersion);
         }
 
-        for (i = 0;  i < ep_count;  i++)
+        bool portability_enumeration = false;
+
+        for (uint32_t i = 0;  i < ep_count;  i++)
         {
             if (strcmp(ep[i].extensionName, "VK_KHR_portability_enumeration") != 0)
                 continue;
@@ -831,7 +963,7 @@
             re_count++;
             re = realloc((void*) re, sizeof(char*) * re_count);
             re[re_count - 1] = "VK_KHR_portability_enumeration";
-            portability_enumeration = GLFW_TRUE;
+            portability_enumeration = true;
         }
 
         free(ep);
@@ -839,7 +971,7 @@
         if (list_layers)
             list_vulkan_instance_layers();
 
-        ai.sType = VK_STRUCTURE_TYPE_APPLICATION_INFO;
+        VkApplicationInfo ai = { VK_STRUCTURE_TYPE_APPLICATION_INFO };
         ai.pApplicationName = "glfwinfo";
         ai.applicationVersion = VK_MAKE_VERSION(GLFW_VERSION_MAJOR,
                                                 GLFW_VERSION_MINOR,
@@ -850,7 +982,7 @@
         else
             ai.apiVersion = VK_API_VERSION_1_0;
 
-        ici.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO;
+        VkInstanceCreateInfo ici = { VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO };
         ici.pApplicationInfo = &ai;
         ici.enabledExtensionCount = re_count;
         ici.ppEnabledExtensionNames = re;
@@ -858,13 +990,19 @@
         if (portability_enumeration)
             ici.flags |= VK_INSTANCE_CREATE_ENUMERATE_PORTABILITY_BIT_KHR;
 
+        VkInstance instance = VK_NULL_HANDLE;
+
         if (vkCreateInstance(&ici, NULL, &instance) != VK_SUCCESS)
         {
             glfwTerminate();
             exit(EXIT_FAILURE);
         }
 
-        if (re)
+        free((void*) re);
+
+        gladLoadVulkanUserPtr(NULL, (GLADuserptrloadfunc) glfwGetInstanceProcAddress, instance);
+
+        if (glfw_re_count)
         {
             VkSurfaceKHR surface = VK_NULL_HANDLE;
 
@@ -877,42 +1015,33 @@
                 printf("Failed to create Vulkan window surface\n");
         }
 
-        free((void*) re);
-
-        gladLoadVulkanUserPtr(NULL, (GLADuserptrloadfunc) glfwGetInstanceProcAddress, instance);
-
+        uint32_t pd_count;
         vkEnumeratePhysicalDevices(instance, &pd_count, NULL);
-        pd = calloc(pd_count, sizeof(VkPhysicalDevice));
+        VkPhysicalDevice* pd = calloc(pd_count, sizeof(VkPhysicalDevice));
         vkEnumeratePhysicalDevices(instance, &pd_count, pd);
 
-        for (i = 0;  i < pd_count;  i++)
+        for (uint32_t i = 0;  i < pd_count;  i++)
         {
             VkPhysicalDeviceProperties pdp;
-            uint32_t qfp_count, ep_count;
-
             vkGetPhysicalDeviceProperties(pd[i], &pdp);
 
-            printf("Vulkan %s device: \"%s\" API version %i.%i\n",
-                   get_device_type_name(pdp.deviceType),
-                   pdp.deviceName,
-                   VK_VERSION_MAJOR(pdp.apiVersion),
-                   VK_VERSION_MINOR(pdp.apiVersion));
-
+            uint32_t qfp_count;
             vkGetPhysicalDeviceQueueFamilyProperties(pd[i], &qfp_count, NULL);
 
+            uint32_t ep_count;
             vkEnumerateDeviceExtensionProperties(pd[i], NULL, &ep_count, NULL);
             VkExtensionProperties* ep = calloc(ep_count, sizeof(VkExtensionProperties));
             vkEnumerateDeviceExtensionProperties(pd[i], NULL, &ep_count, ep);
 
             if (portability_enumeration)
             {
-                int conformant = GLFW_TRUE;
+                bool conformant = true;
 
-                for (j = 0; j < ep_count; j++)
+                for (uint32_t j = 0; j < ep_count; j++)
                 {
                     if (strcmp(ep[j].extensionName, "VK_KHR_portability_subset") == 0)
                     {
-                        conformant = GLFW_FALSE;
+                        conformant = false;
                         break;
                     }
                 }
@@ -936,7 +1065,7 @@
             if (glfw_re_count)
             {
                 printf("Vulkan device queue family presentation support:\n");
-                for (j = 0;  j < qfp_count;  j++)
+                for (uint32_t j = 0;  j < qfp_count;  j++)
                 {
                     printf(" %u: ", j);
                     if (glfwGetPhysicalDevicePresentationSupport(instance, pd[i], j))
@@ -949,7 +1078,7 @@
             if (list_extensions)
             {
                 printf("Vulkan device extensions:\n");
-                for (j = 0;  j < ep_count;  j++)
+                for (uint32_t j = 0;  j < ep_count;  j++)
                     printf(" %s (spec version %u)\n", ep[j].extensionName, ep[j].specVersion);
             }
 
diff --git a/tests/icon.c b/tests/icon.c
index aa7ee18..d5baf0a 100644
--- a/tests/icon.c
+++ b/tests/icon.c
@@ -27,6 +27,7 @@
 //
 //========================================================================
 
+#define GLAD_GL_IMPLEMENTATION
 #include <glad/gl.h>
 #define GLFW_INCLUDE_NONE
 #include <GLFW/glfw3.h>
diff --git a/tests/iconify.c b/tests/iconify.c
index 27dcdf9..32fd44f 100644
--- a/tests/iconify.c
+++ b/tests/iconify.c
@@ -28,6 +28,7 @@
 //
 //========================================================================
 
+#define GLAD_GL_IMPLEMENTATION
 #include <glad/gl.h>
 #define GLFW_INCLUDE_NONE
 #include <GLFW/glfw3.h>
diff --git a/tests/inputlag.c b/tests/inputlag.c
index 269a0c8..12e693f 100644
--- a/tests/inputlag.c
+++ b/tests/inputlag.c
@@ -28,6 +28,7 @@
 //
 //========================================================================
 
+#define GLAD_GL_IMPLEMENTATION
 #include <glad/gl.h>
 #define GLFW_INCLUDE_NONE
 #include <GLFW/glfw3.h>
@@ -202,6 +203,7 @@
     glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0);
 
     glfwWindowHint(GLFW_SCALE_TO_MONITOR, GLFW_TRUE);
+    glfwWindowHint(GLFW_WIN32_KEYBOARD_MENU, GLFW_TRUE);
 
     window = glfwCreateWindow(width, height, "Input lag test", monitor, NULL);
     if (!window)
diff --git a/tests/joysticks.c b/tests/joysticks.c
index 8eae021..df00021 100644
--- a/tests/joysticks.c
+++ b/tests/joysticks.c
@@ -28,6 +28,7 @@
 //
 //========================================================================
 
+#define GLAD_GL_IMPLEMENTATION
 #include <glad/gl.h>
 #define GLFW_INCLUDE_NONE
 #include <GLFW/glfw3.h>
@@ -182,6 +183,7 @@
         exit(EXIT_FAILURE);
 
     glfwWindowHint(GLFW_SCALE_TO_MONITOR, GLFW_TRUE);
+    glfwWindowHint(GLFW_WIN32_KEYBOARD_MENU, GLFW_TRUE);
 
     window = glfwCreateWindow(800, 600, "Joystick Test", NULL, NULL);
     if (!window)
diff --git a/tests/monitors.c b/tests/monitors.c
index 2b75d7b..1043e66 100644
--- a/tests/monitors.c
+++ b/tests/monitors.c
@@ -28,6 +28,7 @@
 //
 //========================================================================
 
+#define GLAD_GL_IMPLEMENTATION
 #include <glad/gl.h>
 #define GLFW_INCLUDE_NONE
 #include <GLFW/glfw3.h>
@@ -241,6 +242,8 @@
 
     glfwSetErrorCallback(error_callback);
 
+    glfwInitHint(GLFW_COCOA_MENUBAR, GLFW_FALSE);
+
     if (!glfwInit())
         exit(EXIT_FAILURE);
 
diff --git a/tests/msaa.c b/tests/msaa.c
index 33e2ccc..10bfa3c 100644
--- a/tests/msaa.c
+++ b/tests/msaa.c
@@ -29,6 +29,7 @@
 //
 //========================================================================
 
+#define GLAD_GL_IMPLEMENTATION
 #include <glad/gl.h>
 #define GLFW_INCLUDE_NONE
 #include <GLFW/glfw3.h>
diff --git a/tests/opacity.c b/tests/opacity.c
deleted file mode 100644
index 47f28b1..0000000
--- a/tests/opacity.c
+++ /dev/null
@@ -1,108 +0,0 @@
-//========================================================================
-// Window opacity test program
-// Copyright (c) Camilla Löwy <elmindreda@glfw.org>
-//
-// 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.
-//
-//========================================================================
-
-#include <glad/gl.h>
-#define GLFW_INCLUDE_NONE
-#include <GLFW/glfw3.h>
-
-#define NK_IMPLEMENTATION
-#define NK_INCLUDE_FIXED_TYPES
-#define NK_INCLUDE_FONT_BAKING
-#define NK_INCLUDE_DEFAULT_FONT
-#define NK_INCLUDE_DEFAULT_ALLOCATOR
-#define NK_INCLUDE_VERTEX_BUFFER_OUTPUT
-#define NK_INCLUDE_STANDARD_VARARGS
-#include <nuklear.h>
-
-#define NK_GLFW_GL2_IMPLEMENTATION
-#include <nuklear_glfw_gl2.h>
-
-#include <stdio.h>
-#include <stdlib.h>
-
-static void error_callback(int error, const char* description)
-{
-    fprintf(stderr, "Error: %s\n", description);
-}
-
-int main(int argc, char** argv)
-{
-    GLFWwindow* window;
-    struct nk_context* nk;
-    struct nk_font_atlas* atlas;
-
-    glfwSetErrorCallback(error_callback);
-
-    if (!glfwInit())
-        exit(EXIT_FAILURE);
-
-    glfwWindowHint(GLFW_SCALE_TO_MONITOR, GLFW_TRUE);
-
-    window = glfwCreateWindow(400, 400, "Opacity", NULL, NULL);
-    if (!window)
-    {
-        glfwTerminate();
-        exit(EXIT_FAILURE);
-    }
-
-    glfwMakeContextCurrent(window);
-    gladLoadGL(glfwGetProcAddress);
-    glfwSwapInterval(1);
-
-    nk = nk_glfw3_init(window, NK_GLFW3_INSTALL_CALLBACKS);
-    nk_glfw3_font_stash_begin(&atlas);
-    nk_glfw3_font_stash_end();
-
-    while (!glfwWindowShouldClose(window))
-    {
-        int width, height;
-        struct nk_rect area;
-
-        glfwGetWindowSize(window, &width, &height);
-        area = nk_rect(0.f, 0.f, (float) width, (float) height);
-
-        glClear(GL_COLOR_BUFFER_BIT);
-        nk_glfw3_new_frame();
-        if (nk_begin(nk, "", area, 0))
-        {
-            float opacity = glfwGetWindowOpacity(window);
-            nk_layout_row_dynamic(nk, 30, 2);
-            if (nk_slider_float(nk, 0.f, &opacity, 1.f, 0.001f))
-                glfwSetWindowOpacity(window, opacity);
-            nk_labelf(nk, NK_TEXT_LEFT, "%0.3f", opacity);
-        }
-
-        nk_end(nk);
-        nk_glfw3_render(NK_ANTI_ALIASING_ON);
-
-        glfwSwapBuffers(window);
-        glfwWaitEventsTimeout(1.0);
-    }
-
-    nk_glfw3_shutdown();
-    glfwTerminate();
-    exit(EXIT_SUCCESS);
-}
-
diff --git a/tests/reopen.c b/tests/reopen.c
index 10d22b2..b458755 100644
--- a/tests/reopen.c
+++ b/tests/reopen.c
@@ -33,6 +33,7 @@
 //
 //========================================================================
 
+#define GLAD_GL_IMPLEMENTATION
 #include <glad/gl.h>
 #define GLFW_INCLUDE_NONE
 #include <GLFW/glfw3.h>
diff --git a/tests/tearing.c b/tests/tearing.c
index 1760121..5c7893c 100644
--- a/tests/tearing.c
+++ b/tests/tearing.c
@@ -28,6 +28,7 @@
 //
 //========================================================================
 
+#define GLAD_GL_IMPLEMENTATION
 #include <glad/gl.h>
 #define GLFW_INCLUDE_NONE
 #include <GLFW/glfw3.h>
diff --git a/tests/threads.c b/tests/threads.c
index 9829493..a2caea5 100644
--- a/tests/threads.c
+++ b/tests/threads.c
@@ -30,6 +30,7 @@
 
 #include "tinycthread.h"
 
+#define GLAD_GL_IMPLEMENTATION
 #include <glad/gl.h>
 #define GLFW_INCLUDE_NONE
 #include <GLFW/glfw3.h>
@@ -95,10 +96,11 @@
     if (!glfwInit())
         exit(EXIT_FAILURE);
 
-    glfwWindowHint(GLFW_VISIBLE, GLFW_FALSE);
-
     for (i = 0;  i < count;  i++)
     {
+        glfwWindowHint(GLFW_POSITION_X, 200 + 250 * i);
+        glfwWindowHint(GLFW_POSITION_Y, 200);
+
         threads[i].window = glfwCreateWindow(200, 200,
                                              threads[i].title,
                                              NULL, NULL);
@@ -109,9 +111,6 @@
         }
 
         glfwSetKeyCallback(threads[i].window, key_callback);
-
-        glfwSetWindowPos(threads[i].window, 200 + 250 * i, 200);
-        glfwShowWindow(threads[i].window);
     }
 
     glfwMakeContextCurrent(threads[0].window);
diff --git a/tests/timeout.c b/tests/timeout.c
index bda2560..c273746 100644
--- a/tests/timeout.c
+++ b/tests/timeout.c
@@ -27,6 +27,7 @@
 //
 //========================================================================
 
+#define GLAD_GL_IMPLEMENTATION
 #include <glad/gl.h>
 #define GLFW_INCLUDE_NONE
 #include <GLFW/glfw3.h>
diff --git a/tests/title.c b/tests/title.c
index a5bad34..08a24e7 100644
--- a/tests/title.c
+++ b/tests/title.c
@@ -27,6 +27,7 @@
 //
 //========================================================================
 
+#define GLAD_GL_IMPLEMENTATION
 #include <glad/gl.h>
 #define GLFW_INCLUDE_NONE
 #include <GLFW/glfw3.h>
diff --git a/tests/triangle-vulkan.c b/tests/triangle-vulkan.c
index 3a4bfb1..b38ee13 100644
--- a/tests/triangle-vulkan.c
+++ b/tests/triangle-vulkan.c
@@ -41,6 +41,7 @@
 #include <windows.h>
 #endif
 
+#define GLAD_VULKAN_IMPLEMENTATION
 #include <glad/vulkan.h>
 #define GLFW_INCLUDE_NONE
 #include <GLFW/glfw3.h>
@@ -1246,7 +1247,7 @@
     VkPipelineDepthStencilStateCreateInfo ds;
     VkPipelineViewportStateCreateInfo vp;
     VkPipelineMultisampleStateCreateInfo ms;
-    VkDynamicState dynamicStateEnables[2];
+    VkDynamicState dynamicStateEnables[(VK_DYNAMIC_STATE_STENCIL_REFERENCE - VK_DYNAMIC_STATE_VIEWPORT + 1)];
     VkPipelineDynamicStateCreateInfo dynamicState;
 
     VkResult U_ASSERT_ONLY err;
diff --git a/tests/window.c b/tests/window.c
new file mode 100644
index 0000000..c81bf02
--- /dev/null
+++ b/tests/window.c
@@ -0,0 +1,457 @@
+//========================================================================
+// Window properties test
+// Copyright (c) Camilla Löwy <elmindreda@glfw.org>
+//
+// 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 GLAD_GL_IMPLEMENTATION
+#include <glad/gl.h>
+#define GLFW_INCLUDE_NONE
+#include <GLFW/glfw3.h>
+
+#include <stdarg.h>
+
+#define NK_IMPLEMENTATION
+#define NK_INCLUDE_FIXED_TYPES
+#define NK_INCLUDE_FONT_BAKING
+#define NK_INCLUDE_DEFAULT_FONT
+#define NK_INCLUDE_DEFAULT_ALLOCATOR
+#define NK_INCLUDE_VERTEX_BUFFER_OUTPUT
+#define NK_INCLUDE_STANDARD_VARARGS
+#define NK_BUTTON_TRIGGER_ON_RELEASE
+#include <nuklear.h>
+
+#define NK_GLFW_GL2_IMPLEMENTATION
+#include <nuklear_glfw_gl2.h>
+
+#include <stdbool.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <limits.h>
+
+int main(int argc, char** argv)
+{
+    int windowed_x, windowed_y, windowed_width, windowed_height;
+    int last_xpos = INT_MIN, last_ypos = INT_MIN;
+    int last_width = INT_MIN, last_height = INT_MIN;
+    int limit_aspect_ratio = false, aspect_numer = 1, aspect_denom = 1;
+    int limit_min_size = false, min_width = 400, min_height = 400;
+    int limit_max_size = false, max_width = 400, max_height = 400;
+    char width_buffer[12] = "", height_buffer[12] = "";
+    char xpos_buffer[12] = "", ypos_buffer[12] = "";
+    char numer_buffer[12] = "", denom_buffer[12] = "";
+    char min_width_buffer[12] = "", min_height_buffer[12] = "";
+    char max_width_buffer[12] = "", max_height_buffer[12] = "";
+    int may_close = true;
+    char window_title[64] = "";
+
+    if (!glfwInit())
+        exit(EXIT_FAILURE);
+
+    glfwWindowHint(GLFW_SCALE_TO_MONITOR, GLFW_TRUE);
+    glfwWindowHint(GLFW_WIN32_KEYBOARD_MENU, GLFW_TRUE);
+    glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 2);
+    glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 1);
+
+    GLFWwindow* window = glfwCreateWindow(600, 660, "Window Features", NULL, NULL);
+    if (!window)
+    {
+        glfwTerminate();
+        exit(EXIT_FAILURE);
+    }
+
+    glfwMakeContextCurrent(window);
+    gladLoadGL(glfwGetProcAddress);
+    glfwSwapInterval(0);
+
+    bool position_supported = true;
+
+    glfwGetError(NULL);
+    glfwGetWindowPos(window, &last_xpos, &last_ypos);
+    sprintf(xpos_buffer, "%i", last_xpos);
+    sprintf(ypos_buffer, "%i", last_ypos);
+    if (glfwGetError(NULL) == GLFW_FEATURE_UNAVAILABLE)
+        position_supported = false;
+
+    glfwGetWindowSize(window, &last_width, &last_height);
+    sprintf(width_buffer, "%i", last_width);
+    sprintf(height_buffer, "%i", last_height);
+
+    sprintf(numer_buffer, "%i", aspect_numer);
+    sprintf(denom_buffer, "%i", aspect_denom);
+
+    sprintf(min_width_buffer, "%i", min_width);
+    sprintf(min_height_buffer, "%i", min_height);
+    sprintf(max_width_buffer, "%i", max_width);
+    sprintf(max_height_buffer, "%i", max_height);
+
+    struct nk_context* nk = nk_glfw3_init(window, NK_GLFW3_INSTALL_CALLBACKS);
+
+    struct nk_font_atlas* atlas;
+    nk_glfw3_font_stash_begin(&atlas);
+    nk_glfw3_font_stash_end();
+
+    strncpy(window_title, glfwGetWindowTitle(window), sizeof(window_title));
+
+    while (!(may_close && glfwWindowShouldClose(window)))
+    {
+        int width, height;
+
+        glfwGetWindowSize(window, &width, &height);
+
+        struct nk_rect area = nk_rect(0.f, 0.f, (float) width, (float) height);
+        nk_window_set_bounds(nk, "main", area);
+
+        nk_glfw3_new_frame();
+        if (nk_begin(nk, "main", area, 0))
+        {
+            nk_layout_row_dynamic(nk, 30, 4);
+
+            if (glfwGetWindowMonitor(window))
+            {
+                if (nk_button_label(nk, "Make Windowed"))
+                {
+                    glfwSetWindowMonitor(window, NULL,
+                                         windowed_x, windowed_y,
+                                         windowed_width, windowed_height, 0);
+                }
+            }
+            else
+            {
+                if (nk_button_label(nk, "Make Fullscreen"))
+                {
+                    GLFWmonitor* monitor = glfwGetPrimaryMonitor();
+                    const GLFWvidmode* mode = glfwGetVideoMode(monitor);
+                    glfwGetWindowPos(window, &windowed_x, &windowed_y);
+                    glfwGetWindowSize(window, &windowed_width, &windowed_height);
+                    glfwSetWindowMonitor(window, monitor,
+                                         0, 0, mode->width, mode->height,
+                                         mode->refreshRate);
+                }
+            }
+
+            if (nk_button_label(nk, "Maximize"))
+                glfwMaximizeWindow(window);
+            if (nk_button_label(nk, "Iconify"))
+                glfwIconifyWindow(window);
+            if (nk_button_label(nk, "Restore"))
+                glfwRestoreWindow(window);
+
+            nk_layout_row_dynamic(nk, 30, 2);
+
+            if (nk_button_label(nk, "Hide (for 3s)"))
+            {
+                glfwHideWindow(window);
+
+                const double time = glfwGetTime() + 3.0;
+                while (glfwGetTime() < time)
+                    glfwWaitEventsTimeout(1.0);
+
+                glfwShowWindow(window);
+            }
+            if (nk_button_label(nk, "Request Attention (after 3s)"))
+            {
+                glfwIconifyWindow(window);
+
+                const double time = glfwGetTime() + 3.0;
+                while (glfwGetTime() < time)
+                    glfwWaitEventsTimeout(1.0);
+
+                glfwRequestWindowAttention(window);
+            }
+
+            nk_layout_row_dynamic(nk, 30, 1);
+
+            if (glfwGetWindowAttrib(window, GLFW_MOUSE_PASSTHROUGH))
+            {
+                nk_label(nk, "Press H to disable mouse passthrough", NK_TEXT_CENTERED);
+
+                if (glfwGetKey(window, GLFW_KEY_H))
+                    glfwSetWindowAttrib(window, GLFW_MOUSE_PASSTHROUGH, false);
+            }
+
+            nk_label(nk, "Press Enter in a text field to set value", NK_TEXT_CENTERED);
+
+            nk_flags events;
+            const nk_flags flags = NK_EDIT_FIELD |
+                                   NK_EDIT_SIG_ENTER |
+                                   NK_EDIT_GOTO_END_ON_ACTIVATE;
+
+            nk_layout_row_begin(nk, NK_DYNAMIC, 30, 2);
+            nk_layout_row_push(nk, 1.f / 3.f);
+            nk_label(nk, "Title", NK_TEXT_LEFT);
+            nk_layout_row_push(nk, 2.f / 3.f);
+            events = nk_edit_string_zero_terminated(nk, flags, window_title,
+                                                    sizeof(window_title), NULL);
+            if (events & NK_EDIT_COMMITED)
+                glfwSetWindowTitle(window, window_title);
+            nk_layout_row_end(nk);
+
+            if (position_supported)
+            {
+                int xpos, ypos;
+                glfwGetWindowPos(window, &xpos, &ypos);
+
+                nk_layout_row_dynamic(nk, 30, 3);
+                nk_label(nk, "Position", NK_TEXT_LEFT);
+
+                events = nk_edit_string_zero_terminated(nk, flags, xpos_buffer,
+                                                        sizeof(xpos_buffer),
+                                                        nk_filter_decimal);
+                if (events & NK_EDIT_COMMITED)
+                {
+                    xpos = atoi(xpos_buffer);
+                    glfwSetWindowPos(window, xpos, ypos);
+                }
+                else if (xpos != last_xpos || (events & NK_EDIT_DEACTIVATED))
+                    sprintf(xpos_buffer, "%i", xpos);
+
+                events = nk_edit_string_zero_terminated(nk, flags, ypos_buffer,
+                                                        sizeof(ypos_buffer),
+                                                        nk_filter_decimal);
+                if (events & NK_EDIT_COMMITED)
+                {
+                    ypos = atoi(ypos_buffer);
+                    glfwSetWindowPos(window, xpos, ypos);
+                }
+                else if (ypos != last_ypos || (events & NK_EDIT_DEACTIVATED))
+                    sprintf(ypos_buffer, "%i", ypos);
+
+                last_xpos = xpos;
+                last_ypos = ypos;
+            }
+            else
+                nk_label(nk, "Platform does not support window position", NK_TEXT_LEFT);
+
+            nk_layout_row_dynamic(nk, 30, 3);
+            nk_label(nk, "Size", NK_TEXT_LEFT);
+
+            events = nk_edit_string_zero_terminated(nk, flags, width_buffer,
+                                                    sizeof(width_buffer),
+                                                    nk_filter_decimal);
+            if (events & NK_EDIT_COMMITED)
+            {
+                width = atoi(width_buffer);
+                glfwSetWindowSize(window, width, height);
+            }
+            else if (width != last_width || (events & NK_EDIT_DEACTIVATED))
+                sprintf(width_buffer, "%i", width);
+
+            events = nk_edit_string_zero_terminated(nk, flags, height_buffer,
+                                                    sizeof(height_buffer),
+                                                    nk_filter_decimal);
+            if (events & NK_EDIT_COMMITED)
+            {
+                height = atoi(height_buffer);
+                glfwSetWindowSize(window, width, height);
+            }
+            else if (height != last_height || (events & NK_EDIT_DEACTIVATED))
+                sprintf(height_buffer, "%i", height);
+
+            last_width = width;
+            last_height = height;
+
+            bool update_ratio_limit = false;
+            if (nk_checkbox_label(nk, "Aspect Ratio", &limit_aspect_ratio))
+                update_ratio_limit = true;
+
+            events = nk_edit_string_zero_terminated(nk, flags, numer_buffer,
+                                                    sizeof(numer_buffer),
+                                                    nk_filter_decimal);
+            if (events & NK_EDIT_COMMITED)
+            {
+                aspect_numer = abs(atoi(numer_buffer));
+                update_ratio_limit = true;
+            }
+            else if (events & NK_EDIT_DEACTIVATED)
+                sprintf(numer_buffer, "%i", aspect_numer);
+
+            events = nk_edit_string_zero_terminated(nk, flags, denom_buffer,
+                                                    sizeof(denom_buffer),
+                                                    nk_filter_decimal);
+            if (events & NK_EDIT_COMMITED)
+            {
+                aspect_denom = abs(atoi(denom_buffer));
+                update_ratio_limit = true;
+            }
+            else if (events & NK_EDIT_DEACTIVATED)
+                sprintf(denom_buffer, "%i", aspect_denom);
+
+            if (update_ratio_limit)
+            {
+                if (limit_aspect_ratio)
+                    glfwSetWindowAspectRatio(window, aspect_numer, aspect_denom);
+                else
+                    glfwSetWindowAspectRatio(window, GLFW_DONT_CARE, GLFW_DONT_CARE);
+            }
+
+            bool update_size_limit = false;
+
+            if (nk_checkbox_label(nk, "Minimum Size", &limit_min_size))
+                update_size_limit = true;
+
+            events = nk_edit_string_zero_terminated(nk, flags, min_width_buffer,
+                                                    sizeof(min_width_buffer),
+                                                    nk_filter_decimal);
+            if (events & NK_EDIT_COMMITED)
+            {
+                min_width = abs(atoi(min_width_buffer));
+                update_size_limit = true;
+            }
+            else if (events & NK_EDIT_DEACTIVATED)
+                sprintf(min_width_buffer, "%i", min_width);
+
+            events = nk_edit_string_zero_terminated(nk, flags, min_height_buffer,
+                                                    sizeof(min_height_buffer),
+                                                    nk_filter_decimal);
+            if (events & NK_EDIT_COMMITED)
+            {
+                min_height = abs(atoi(min_height_buffer));
+                update_size_limit = true;
+            }
+            else if (events & NK_EDIT_DEACTIVATED)
+                sprintf(min_height_buffer, "%i", min_height);
+
+            if (nk_checkbox_label(nk, "Maximum Size", &limit_max_size))
+                update_size_limit = true;
+
+            events = nk_edit_string_zero_terminated(nk, flags, max_width_buffer,
+                                                    sizeof(max_width_buffer),
+                                                    nk_filter_decimal);
+            if (events & NK_EDIT_COMMITED)
+            {
+                max_width = abs(atoi(max_width_buffer));
+                update_size_limit = true;
+            }
+            else if (events & NK_EDIT_DEACTIVATED)
+                sprintf(max_width_buffer, "%i", max_width);
+
+            events = nk_edit_string_zero_terminated(nk, flags, max_height_buffer,
+                                                    sizeof(max_height_buffer),
+                                                    nk_filter_decimal);
+            if (events & NK_EDIT_COMMITED)
+            {
+                max_height = abs(atoi(max_height_buffer));
+                update_size_limit = true;
+            }
+            else if (events & NK_EDIT_DEACTIVATED)
+                sprintf(max_height_buffer, "%i", max_height);
+
+            if (update_size_limit)
+            {
+                glfwSetWindowSizeLimits(window,
+                                        limit_min_size ? min_width : GLFW_DONT_CARE,
+                                        limit_min_size ? min_height : GLFW_DONT_CARE,
+                                        limit_max_size ? max_width : GLFW_DONT_CARE,
+                                        limit_max_size ? max_height : GLFW_DONT_CARE);
+            }
+
+            int fb_width, fb_height;
+            glfwGetFramebufferSize(window, &fb_width, &fb_height);
+            nk_label(nk, "Framebuffer Size", NK_TEXT_LEFT);
+            nk_labelf(nk, NK_TEXT_LEFT, "%i", fb_width);
+            nk_labelf(nk, NK_TEXT_LEFT, "%i", fb_height);
+
+            float xscale, yscale;
+            glfwGetWindowContentScale(window, &xscale, &yscale);
+            nk_label(nk, "Content Scale", NK_TEXT_LEFT);
+            nk_labelf(nk, NK_TEXT_LEFT, "%f", xscale);
+            nk_labelf(nk, NK_TEXT_LEFT, "%f", yscale);
+
+            nk_layout_row_begin(nk, NK_DYNAMIC, 30, 5);
+            int frame_left, frame_top, frame_right, frame_bottom;
+            glfwGetWindowFrameSize(window, &frame_left, &frame_top, &frame_right, &frame_bottom);
+            nk_layout_row_push(nk, 1.f / 3.f);
+            nk_label(nk, "Frame Size:", NK_TEXT_LEFT);
+            nk_layout_row_push(nk, 1.f / 6.f);
+            nk_labelf(nk, NK_TEXT_LEFT, "%i", frame_left);
+            nk_layout_row_push(nk, 1.f / 6.f);
+            nk_labelf(nk, NK_TEXT_LEFT, "%i", frame_top);
+            nk_layout_row_push(nk, 1.f / 6.f);
+            nk_labelf(nk, NK_TEXT_LEFT, "%i", frame_right);
+            nk_layout_row_push(nk, 1.f / 6.f);
+            nk_labelf(nk, NK_TEXT_LEFT, "%i", frame_bottom);
+            nk_layout_row_end(nk);
+
+            nk_layout_row_begin(nk, NK_DYNAMIC, 30, 2);
+            float opacity = glfwGetWindowOpacity(window);
+            nk_layout_row_push(nk, 1.f / 3.f);
+            nk_labelf(nk, NK_TEXT_LEFT, "Opacity: %0.3f", opacity);
+            nk_layout_row_push(nk, 2.f / 3.f);
+            if (nk_slider_float(nk, 0.f, &opacity, 1.f, 0.001f))
+                glfwSetWindowOpacity(window, opacity);
+            nk_layout_row_end(nk);
+
+            nk_layout_row_begin(nk, NK_DYNAMIC, 30, 2);
+            int should_close = glfwWindowShouldClose(window);
+            nk_layout_row_push(nk, 1.f / 3.f);
+            if (nk_checkbox_label(nk, "Should Close", &should_close))
+                glfwSetWindowShouldClose(window, should_close);
+            nk_layout_row_push(nk, 2.f / 3.f);
+            nk_checkbox_label(nk, "May Close", &may_close);
+            nk_layout_row_end(nk);
+
+            nk_layout_row_dynamic(nk, 30, 1);
+            nk_label(nk, "Attributes", NK_TEXT_CENTERED);
+
+            nk_layout_row_dynamic(nk, 30, width > 200 ? width / 200 : 1);
+
+            int decorated = glfwGetWindowAttrib(window, GLFW_DECORATED);
+            if (nk_checkbox_label(nk, "Decorated", &decorated))
+                glfwSetWindowAttrib(window, GLFW_DECORATED, decorated);
+
+            int resizable = glfwGetWindowAttrib(window, GLFW_RESIZABLE);
+            if (nk_checkbox_label(nk, "Resizable", &resizable))
+                glfwSetWindowAttrib(window, GLFW_RESIZABLE, resizable);
+
+            int floating = glfwGetWindowAttrib(window, GLFW_FLOATING);
+            if (nk_checkbox_label(nk, "Floating", &floating))
+                glfwSetWindowAttrib(window, GLFW_FLOATING, floating);
+
+            int passthrough = glfwGetWindowAttrib(window, GLFW_MOUSE_PASSTHROUGH);
+            if (nk_checkbox_label(nk, "Mouse Passthrough", &passthrough))
+                glfwSetWindowAttrib(window, GLFW_MOUSE_PASSTHROUGH, passthrough);
+
+            int auto_iconify = glfwGetWindowAttrib(window, GLFW_AUTO_ICONIFY);
+            if (nk_checkbox_label(nk, "Auto Iconify", &auto_iconify))
+                glfwSetWindowAttrib(window, GLFW_AUTO_ICONIFY, auto_iconify);
+
+            nk_value_bool(nk, "Focused", glfwGetWindowAttrib(window, GLFW_FOCUSED));
+            nk_value_bool(nk, "Hovered", glfwGetWindowAttrib(window, GLFW_HOVERED));
+            nk_value_bool(nk, "Visible", glfwGetWindowAttrib(window, GLFW_VISIBLE));
+            nk_value_bool(nk, "Iconified", glfwGetWindowAttrib(window, GLFW_ICONIFIED));
+            nk_value_bool(nk, "Maximized", glfwGetWindowAttrib(window, GLFW_MAXIMIZED));
+        }
+        nk_end(nk);
+
+        glClear(GL_COLOR_BUFFER_BIT);
+        nk_glfw3_render(NK_ANTI_ALIASING_ON);
+        glfwSwapBuffers(window);
+
+        glfwWaitEvents();
+    }
+
+    nk_glfw3_shutdown();
+    glfwTerminate();
+    exit(EXIT_SUCCESS);
+}
+
diff --git a/tests/windows.c b/tests/windows.c
deleted file mode 100644
index 6669856..0000000
--- a/tests/windows.c
+++ /dev/null
@@ -1,174 +0,0 @@
-//========================================================================
-// Simple multi-window test
-// Copyright (c) Camilla Löwy <elmindreda@glfw.org>
-//
-// 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.
-//
-//========================================================================
-//
-// This test creates four windows and clears each in a different color
-//
-//========================================================================
-
-#include <glad/gl.h>
-#define GLFW_INCLUDE_NONE
-#include <GLFW/glfw3.h>
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#include "getopt.h"
-
-static const char* titles[] =
-{
-    "Red",
-    "Green",
-    "Blue",
-    "Yellow"
-};
-
-static const struct
-{
-    float r, g, b;
-} colors[] =
-{
-    { 0.95f, 0.32f, 0.11f },
-    { 0.50f, 0.80f, 0.16f },
-    {   0.f, 0.68f, 0.94f },
-    { 0.98f, 0.74f, 0.04f }
-};
-
-static void usage(void)
-{
-    printf("Usage: windows [-h] [-b] [-f] \n");
-    printf("Options:\n");
-    printf("  -b create decorated windows\n");
-    printf("  -f set focus on show off for all but first window\n");
-    printf("  -h show this help\n");
-}
-
-static void error_callback(int error, const char* description)
-{
-    fprintf(stderr, "Error: %s\n", description);
-}
-
-static void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods)
-{
-    if (action != GLFW_PRESS)
-        return;
-
-    switch (key)
-    {
-        case GLFW_KEY_SPACE:
-        {
-            int xpos, ypos;
-            glfwGetWindowPos(window, &xpos, &ypos);
-            glfwSetWindowPos(window, xpos, ypos);
-            break;
-        }
-
-        case GLFW_KEY_ESCAPE:
-            glfwSetWindowShouldClose(window, GLFW_TRUE);
-            break;
-    }
-}
-
-int main(int argc, char** argv)
-{
-    int i, ch;
-    int decorated = GLFW_FALSE;
-    int focusOnShow = GLFW_TRUE;
-    int running = GLFW_TRUE;
-    GLFWwindow* windows[4];
-
-    while ((ch = getopt(argc, argv, "bfh")) != -1)
-    {
-        switch (ch)
-        {
-            case 'b':
-                decorated = GLFW_TRUE;
-                break;
-            case 'f':
-                focusOnShow = GLFW_FALSE;
-                break;
-            case 'h':
-                usage();
-                exit(EXIT_SUCCESS);
-            default:
-                usage();
-                exit(EXIT_FAILURE);
-        }
-    }
-
-    glfwSetErrorCallback(error_callback);
-
-    if (!glfwInit())
-        exit(EXIT_FAILURE);
-
-    glfwWindowHint(GLFW_DECORATED, decorated);
-    glfwWindowHint(GLFW_VISIBLE, GLFW_FALSE);
-
-    for (i = 0;  i < 4;  i++)
-    {
-        int left, top, right, bottom;
-        if (i)
-            glfwWindowHint(GLFW_FOCUS_ON_SHOW, focusOnShow);
-
-        windows[i] = glfwCreateWindow(200, 200, titles[i], NULL, NULL);
-        if (!windows[i])
-        {
-            glfwTerminate();
-            exit(EXIT_FAILURE);
-        }
-
-        glfwSetKeyCallback(windows[i], key_callback);
-
-        glfwMakeContextCurrent(windows[i]);
-        gladLoadGL(glfwGetProcAddress);
-        glClearColor(colors[i].r, colors[i].g, colors[i].b, 1.f);
-
-        glfwGetWindowFrameSize(windows[i], &left, &top, &right, &bottom);
-        glfwSetWindowPos(windows[i],
-                         100 + (i & 1) * (200 + left + right),
-                         100 + (i >> 1) * (200 + top + bottom));
-    }
-
-    for (i = 0;  i < 4;  i++)
-        glfwShowWindow(windows[i]);
-
-    while (running)
-    {
-        for (i = 0;  i < 4;  i++)
-        {
-            glfwMakeContextCurrent(windows[i]);
-            glClear(GL_COLOR_BUFFER_BIT);
-            glfwSwapBuffers(windows[i]);
-
-            if (glfwWindowShouldClose(windows[i]))
-                running = GLFW_FALSE;
-        }
-
-        glfwWaitEvents();
-    }
-
-    glfwTerminate();
-    exit(EXIT_SUCCESS);
-}
-